Nugroho's blog.

Thursday, November 12, 2015

Delphi on OS X

 Here's the WineSkin version.

 I found it's way smoother than WineBottler version, ...., but hard to figure how to use it

 To install Delphi in OS X using WineSkin, we have to download and install Wineskin, of course, :)

  • Open Wineskin Winery.app
  • Make sure you have a Wrapper version and an Engine
  • Select the Engine you want to use (I use WS9Wine1.7.52)
  • Press the Create Wrapper button
  • Enter in the name Delphi (or whatever you have in mind) for the wrapper and press OK
  • When its done being created, click the button to view it in Finder in the finished window
  • Close Wineskin Winery.app.
  • Right click Delphi.app in Finder and select “Show Package Contents”
  • Double click and run Wineskin.app.
  • Now click on the Install Software button
  • Select to choose a setup executable
  • Navigate to the Delphi setup exe file you downloaded in step one
  • Select the setup exe file and press the choose button
  • At this point Delphi setup should begin, go through the Delphi setup like a normal install
  • After the setup is done, back in Wineskin.app, it should pop up asking you to select the .exe file
  • Choose the delphi32.exe file in the drop down list and press the Select Button
  • Now press the Quit button to exit Wineskin.app
  • Back in Finder, double click Delphi.app and start coding

 It has the same problem with WineBottler,  the toolbar tab's seem order by itself alphabetically, so the default toolbar tab is not ' standard ' tab but 'additional' one

code
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
jalan:boolean=false;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
jalan := not jalan;
if jalan = true then button1.Caption:='Stop'
else button1.Caption:='Run';

end;

procedure TForm1.FormCreate(Sender: TObject);
begin
button1.Caption:='Run';
end;

end.
.









Delphi on OS X

 I use WineBottler to install Delphi 7 on my El Capitan.

 It's installed, it can run.

 The one that tickle me is the toolbar list is scrambled, it's sorted alphabetically, so additional toolbar is in the first and act as default toolbar.












code

Pulpen Cadangan, iPod dan Prasangka Baik Terhadap Soal.

 Senjata ujian jaman dulu, :)







Obat Tidur Alami

 Jangan memandang layar di jam-jam tidur, baik layar TV, komputer, handphone.

 Misal terpaksa bekerja dengan komputer di malam hari, gunakan aplikasi seperti flux. Aplikasi ini menghilangkan warna biru di layar.

 Warna biru (seperti cahaya matahari pagi hari) membuat kita tetap terjaga, karena tubuh menganggap hari masih belum malam. Cahaya biru dari layar TV, laptop, hp membuat jam biologis kita menjadi kacau.
Biological clock human.svg
"Biological clock human" by NoNameGYassineMrabetTalk fixed by Addicted04 - The work was done with Inkscape by YassineMrabet. Informations were provided from "The Body Clock Guide to Better Health" by Michael Smolensky and Lynne Lamberg; Henry Holt and Company, Publishers (2000). Landscape was sampled from Open Clip Art Library (Ryan, Public domain). Vitruvian Man and the clock were sampled from Image:P human body.svg (GNU licence) and Image:Nuvola apps clock.png, respectively.. Licensed under CC BY-SA 3.0 via Commons.


Wednesday, November 11, 2015

Heel and Toe?

 I tried several time to no avail. 

 It's just not working for me. 

 Maybe it's my drumming posture on throne, or other cause. 

 It's hard for me to lift my heel, so I use heel down technique all the time, :)

 Is it fast? 

 Not really, but  it's enough for my genre of music.

 If the fast heel and toe is needed, I manage to catch it up with normal kick with heel down and straight toe, and the second hit is with my toe in curl position (heel down)

 It isn't heel and toe technique, it's straight and curl toe technique, :D 

 

Tuesday, November 10, 2015

Yup...

 Mulai ramai tulisan mengeluh tentang hujan yang tak kunjung henti

 (ingat saat kemarau panjang kemarin)

 :)

 .

Monday, November 9, 2015

Sisi Lain

 Terlepas dari kontroversi.

 Tim yamaha factory hebat.

 Di depan tak bisa di-overtake

 Di belakang mengovertake 22 rider di depannya

 Hebat.

 :)


 (ndak lihat tayangan live :( )

Sunday, November 8, 2015

Status.

  Setelah beberapa bulan membaca status bernada mengeluh karena gak hujan-hujan, sekarang siap-siap membaca status-status keluhan karena hujan, :D

SwishMax in Mac.

  :)

 Yeah, I use OS X El Capitan in My Macbook Air and use Wine Bottler to install it.

 Make sure that flash option is ticked in winetriks part


















Integral menggunakan Metode Numerik di Python dan Plot Fungsi menggunakan Matplotlib.

 Kode berikut digunakan untuk mencari nilai integral dari a ke b sebuah fungsi f(x).

 Saya menggunakan modul Numpy untuk fungsi pangkat (power).

from pylab import *
import numpy as np

def f(x):
y = np.power(x,3)+np.power(x,2)+x+1
return y

dx = .1
a = 0.
b = 1.

x = a
c = 0. # untuk menampung hasil integral
while x<=b:
y = f(x)
c += f(x)*dx
x += dx

print 'hasil integral dari ',a,' ke ',b,' adalah ' ,c

#untuk plotting
x = np.arange(-10., 10., .01)
y = f(x)

plot(x,y)
grid(True)
show()


..

Saturday, November 7, 2015

List Files on Certain Google Drive Folder and It's Subfolders

 ...and display it in html format using div tag with border so the files in subfolders will displayed in box, and files in other subfolder will displayed in other box. If subfolder have subfolder, then files inside that sub-subfolder will displayed inside box inside box, :s :P :D

 The Algorithm itself is bit like this previous post. OK, I copy and paste a little bit of,..., ok most of code from it.

 All by Google App Script.

 I use string variable named text to receive all output.

 Basically, after the script is completely executed, the content of variable text  is complete html source code.

 :)

 Here it is

 Code.gs




function listFilesNFolders(form) { 
var text = '';
var lv = 2; //for level depth
var home = DriveApp.getFolderById('0BxZS62a5NdNYUGxySmp2QW41OUU');
text+='<br><h'+lv+'>'+home.getName()+'</h'+lv+'>'
var NIM = home.getFoldersByName("aa");
if(NIM.hasNext()){
var NIMfold = NIM.next();
text+='<br><h'+lv+'>'+NIMfold.getName()+'</h'+lv+'>';
text = crawl(NIMfold,text,lv);
} else{
text+='<br> Anda belum mengupload tugas';
}
Logger.getLog();
return text;
}

function crawl(home,text,lv){
lv++;
var files=home.getFiles();
text+='<div id="p'+lv+'"style="border: 1px solid black;">';
while (files.hasNext()){
var file=files.next();
text+='<br>'+file.getName();
}
text+='</div><br>';
var folders=home.getFolders();
while (folders.hasNext()){
var folder=folders.next();
text+='<br><div id="p'+lv+'"style="border: 1px solid black;">';
text+='<br><h'+lv+'>'+folder.getName()+'</h'+lv+'>';
text = crawl(folder,text,lv);
text+='<br>'; text+='</div>';
}
lv--;
return text;
} function
doGet(e) {
return HtmlService.createHtmlOutputFromFile('form.html');
}

..
form.html

<!DOCTYPE html>
<html>
<head>
<base target="_top">
<style>
input { display:block; margin: 20px; }

#p1 { position: relative; left: 10px;}
#p2 { position: relative; left: 20px;}
#p3 { position: relative; left: 30px;}
#p4 { position: relative; left: 40px;}
#p5 { position: relative; left: 50px;}
#p6 { position: relative; left: 60px;}



h1 { position: relative;margin-left: 10px;font-weight: bold;}
h2 { position: relative;margin-left: 20px;font-weight: bold;}
h3 { position: relative;margin-left: 30px;font-weight: bold;}
h4 { position: relative;margin-left: 40px;font-weight: bold;}
h5 { position: relative;margin-left: 50px;font-weight: bold;}
h6 { position: relative;margin-left: 60px;font-weight: bold;}

</style>
</head>
<body>

<form id="myForm">
<input type="submit"
value="OK"
onclick=
"
this.value='Proses';
google.script.run.withSuccessHandler(fileUploaded).listFilesNFolders(this.parentNode);
return false;
"
>

</form>

<div id="output"></div>

<script>
function fileUploaded(status) {
document.getElementById('myForm').style.display = 'none';
document.getElementById('output').innerHTML = status;
}
</script>

</body>
</html>




Look at the HTML code, the key for indentation is <px> tag with x = 1,2,3,4,5,6. The bigger the number, the more left margin increased. I modify the <hx> tag too.

The content of text variable after script's completely executed.


<br><h2>Testing</h2><br><h2>aa</h2><div id="p3"style="border: 1px solid black;"><br>nug.f<br>nug.f<br>nug.f<br>nug.so<br>nug.f<br>nug.f<br>nug.f<br>nug.f<br>nug.f<br>nug.f<br>nug.f<br>F-1.xls</div><br><br><div id="p3"style="border: 1px solid black;"><br><h3>Desktop</h3><div id="p4"style="border: 1px solid black;"><br>.DS_Store<br>tiketpulang.pdf<br>tiketberangkat.pdf<br>Gmail - Bukti Pemesanan Internet PT. KAI Persero.pdf<br>Gmail - Bukti Pemesanan Internet PT. KAI Persero (pulang).pdf</div><br><br><div id="p4"style="border: 1px solid black;"><br><h4>freebsdvbox</h4><div id="p5"style="border: 1px solid black;"><br>Screen Shot 2015-01-01 at 7.20.02 PM.png<br>Screen Shot 2015-01-01 at 1.56.36 PM.png<br>Screen Shot 2015-01-01 at 1.36.32 PM.png<br>Screen Shot 2015-01-01 at 1.36.00 PM.png<br>Screen Shot 2015-01-01 at 1.35.46 PM.png<br>Screen Shot 2015-01-01 at 1.33.32 PM.png<br>Screen Shot 2015-01-01 at 1.32.53 PM.png<br>Screen Shot 2014-12-31 at 11.30.41 PM.png<br>Screen Shot 2014-12-31 at 11.30.38 PM.png<br>Screen Shot 2014-12-31 at 11.30.16 PM.png<br>Screen Shot 2014-12-31 at 11.30.03 PM.png<br>Screen Shot 2014-12-31 at 11.29.13 PM.png<br>Screen Shot 2014-12-31 at 11.28.00 PM.png<br>Screen Shot 2014-12-31 at 11.26.33 PM.png<br>Screen Shot 2014-12-31 at 11.26.18 PM.png<br>Screen Shot 2014-12-30 at 8.16.46 AM.png<br>.DS_Store</div><br><br><div id="p5"style="border: 1px solid black;"><br><h5>freebsdss</h5><div id="p6"style="border: 1px solid black;"><br>.DS_Store</div><br><br></div><br></div><br></div><br><div id="p3"style="border: 1px solid black;"><br><h3>freebsdvbox</h3><div id="p4"style="border: 1px solid black;"></div><br><br><div id="p4"style="border: 1px solid black;"><br><h4>freebsdss</h4><div id="p5"style="border: 1px solid black;"></div><br><br></div><br></div><br><div id="p3"style="border: 1px solid black;"><br><h3>tugas momentum</h3><div id="p4"style="border: 1px solid black;"><br>tugastumbukan.zip<br>tugasmomentum.zip<br>tugasfisikarevisiyangsalah.zip<br>Screen Shot 2015-10-05 at 6.57.37 AM.png<br>IMG-20151004-WA0091.jpg<br>attachments.zip<br>20151004_201055.jpg<br>.DS_Store</div><br><br><div id="p4"style="border: 1px solid black;"><br><h4>attachments</h4><div id="p5"style="border: 1px solid black;"><br>20151004_221456.jpg<br>20151004_221113.jpg<br>20151004_221052.jpg<br>20151004_221024.jpg</div><br><br></div><br><div id="p4"style="border: 1px solid black;"><br><h4>tugasfisikarevisiyangsalah</h4><div id="p5"style="border: 1px solid black;"><br>IMG_1494.JPG<br>IMG_1489.JPG<br>IMG-20151005-WA0012.jpg</div><br><br></div><br><div id="p4"style="border: 1px solid black;"><br><h4>tugastumbukan</h4><div id="p5"style="border: 1px solid black;"><br>IMG-20151004-WA0039.jpg<br>IMG-20151004-WA0038.jpg<br>IMG-20151004-WA0037.jpg</div><br><br></div><br><div id="p4"style="border: 1px solid black;"><br><h4>tugasmomentum</h4><div id="p5"style="border: 1px solid black;"><br>IMG_20151004_143049.jpg<br>IMG_20151004_143023.jpg</div><br><br></div><br></div><br><div id="p3"style="border: 1px solid black;"><br><h3>pyTest</h3><div id="p4"style="border: 1px solid black;"><br>surface3d_demo2.py<br>surface3d_demo.py<br>sin3d.py<br>simple_anim.py<br>simple_3danim.py<br>sierpinski.py<br>nummpyArray.pdf<br>nugroho.so<br>nugroho.f90<br>nugroho.f<br>nug.so<br>nug.f<br>lines3d_demo.py<br>lines.mp4<br>image_demo.py<br>im.mp4<br>hellofortran.so<br>hellofortran.f<br>Fortran-and-CModulePython.pdf<br>contourf3d_demo2.py<br>cobamodul.py<br>coba2.py<br>coba1.py<br>basic_example.py<br>basic.py<br>animate_decay.py<br>animasi.py<br>anim.py<br>air3.py<br>air2.py<br>air.py<br>3danim.py<br>.DS_Store</div><br><br><div id="p4"style="border: 1px solid black;"><br><h4>air</h4><div id="p5"style="border: 1px solid black;"><br>air700.mp4<br>air4098f1024bit20int.mp4<br>air4096f1024bit.mp4<br>air2700f512bit.mp4<br>air1700.mp4</div><br><br></div><br></div>


 Yeah, it looks like garbage, but it's actual html code and if we open it in web browser, it will looks like this.






Friday, November 6, 2015

Passing String Variable to a Function on Google App Script

I have text a variable with string type, I want to pass it to a function and change the value there just like previous post (using list type)

but, text variable value can't be changed by  passing to function like list (or array). I didn't have append or push syntax.

well, we can still use list

but list have comma, :(

so I updated the value by passing it to a function like this


function htmlOutput(form) {
var text = 'Tadaa...';
text+='Test';

text = dummy(text);
return text;
}

function dummy(text){
text+='hehehe';
return text;
}


.

:)

 By definition, keripik pisang is pisang goreng, :D

 #EdisiError

Hujan

 Pohon dan rumput berpesta.
 
 ...dan aku basah kuyup.

Tuesday, November 3, 2015

Hanya Kemungkinan.

 Akan seru jika di Valencia nanti para rider (sambil cengingisan) minggir memberi jalan Rossi tuk bertarung dengan Lorenzo.

 (seru dan aneh, :) )

 (well, kecuali Marquez mungkin, :) ).

 (gak mungkin, :) ).



Monday, November 2, 2015

The Typical Rick, :)

“Hearthstone Passes Out Even More than Jason Grace (Though I Have No Idea Who That Is)”

Excerpt From: Rick Riordan. “Magnus Chase and the Sword of Summer.” iBooks.


I like Magnus Chase, :)

Friday, October 30, 2015

Read HFS+ from Linux

 The OS X filesystem, HFS+, by default is in read-only mode in my ubuntu.

 So I installed hfsprogs using
  
sudo apt-get install hfsprogs

 (you have to enable universe package-source)

 to mount the "Macintosh HD", use this

$cd 
$mkdir osx
$sudo mount -t hfsplus -o force,rw /dev/sda2 osx


 Nevertheless, it still mounted as read-only, and some folders refused to open at all.

 Here the trick. We have to have same uid as the os x.

 so, create new user

sudo useradd -d /home/newuser -m -s /bin/bash -G root newuser

sudo passwd newuser

sudo usermod --uid 501 newuser

sudo chown -R 501:newuser /home/newuser
.

 by default the first user on OSX has an uid 501.

 Now, as we have the same uid on linux and OS X. We could freely read the filesystem.

Wednesday, October 28, 2015

#MelawanAsap



 Sepertinya tahun depan tidak akan ada kebakaran hutan,

 tak ada asap, 

 karena tak ada lagi yang bisa dibakar.





Monday, October 26, 2015

List Folders and Files Recursively using Google App Script.

 I got the problem because using 'recursive' as function name, :)

 At least now I know that, :)

 The next? Beautifying the result, :D 

.
function listFilesNFolders(form) {
var list = [];
var lv = 0; //lv for level or depth
list.push(['tadaa...<br>']);
list.push(['heheh...']);
var row = [];
row.push('<br> Hello World!!! ');
list.push(row);

var home = DriveApp.getFolderById('0BxZS62a5NdNYUGxySmp2QW41OUU');
list.push('<br>');
list.push(home.getName());
crawl(home,list,lv);
return list;
}

//don't use 'recursive' as function name, it won't work
function crawl(home,list,lv){
lv++;
list.push('<br>tadaa...'+lv+'...');

var files=home.getFiles();
while (files.hasNext()){
var file=files.next();
list.push('<br>f '+file.getName());
}

var folders=home.getFolders();
while (folders.hasNext()){
var folder=folders.next();
list.push('<br>d '+folder.getName());

crawl(folder,list,lv);
}
}

function doGet(e) {
return HtmlService.createHtmlOutputFromFile('form.html');
}



.



Minggu Pagi.

 Sepuluh hari gak ketemu, :)








Saturday, October 24, 2015

#MelawanAsap

 Jika MotoGP Sepang gagal karena asap, maka Rossi cukup finish ketiga di Valencia untuk jadi juara dunia, :)

#MelawanAsap

 Trik Old Shatterhand di Llano Estacado untuk mendatangkan hujan sepertinya tak berhasil di sini.

 :(

 (ingat Karl May)

Friday, October 23, 2015

Global Variable on Google App Script

 I have trouble accessed it within function,

 so I pass it to every function,
 not so elegant solution, but it works, :) .

 In the code below, I have global variable named list.

 I have to passed as parameter on function dummy in order to edit its value or it wouldn't affected or have error message or undefined (I experienced both, :) )

function listFilesNFolders(form) {
var list = [];
list.push(['tadaa...<br>']);
list.push(['heheh...']);
var row = [];
row.push('<br> Hello World!!! ');
list.push(row);

var home = DriveApp.getFolderById('0BxZS62a5NdNYUGxySmp2QW41OUU');

dummy('<br> test',list);
return list;
}

function dummy(d,list){
list.push(d);
}


The form

 <form id="myForm">
<input type="submit"
value="OK"
onclick="
this.value='Proses';
google.script.run.withSuccessHandler(fileUploaded).listFilesNFolders(this.parentNode);
return false;
"
>
</form>
.





Thursday, October 22, 2015

#MelawanAsap



 Ini terjadi di Malang, bukan hutan, ini ladang tebu sehabis panen.

 Naik sepeda lewat beginian, hanya 20 meter terpapar asap, rasanya...

 Cuma sekian detik.

 Tak terbayangkan jika terpapar berbulan-bulan, di setiap tempat, di setiap waktu

323f (5) amp (1) android (12) apple (7) arduino (18) art (1) assembler (21) astina (4) ATTiny (23) blackberry (4) camera (3) canon (2) cerita (2) computer (106) crazyness (11) debian (1) delphi (39) diary (286) flash (8) fortran (6) freebsd (6) google apps script (8) guitar (2) HTML5 (10) IFTTT (7) Instagram (7) internet (12) iOS (5) iPad (6) iPhone (5) java (1) javascript (1) keynote (2) LaTeX (6) lazarus (1) linux (29) lion (15) mac (28) macbook air (8) macbook pro (3) macOS (1) Math (3) mathematica (1) maverick (6) mazda (4) microcontroler (35) mountain lion (2) music (37) netbook (1) nugnux (6) os x (36) php (1) Physicist (29) Picture (3) programming (189) Python (109) S2 (13) software (7) Soliloquy (125) Ubuntu (5) unix (4) Video (8) wayang (3) yosemite (3)