Nugroho's blog.

Tuesday, March 27, 2012

Radiobutton di Delphi

Buat aplikasi baru

Tempatkan 2 buah edit, dua buah label, empat radiobutton dan satu tombol pada form

Ubah sedemikian rupa sehingga menjadi seperti gambar kedua

Dobelklik tombol “Hitung”, isi dengan perintah berikut



if radiobutton1.Checked=true then begin
edit3.Text:=inttostr(strtoint(edit1.Text)+strtoint(edit2.Text));
end else if radiobutton2.Checked=true then begin
edit3.Text:=inttostr(strtoint(edit1.Text)-strtoint(edit2.Text));
end else if radiobutton3.Checked=true then begin
edit3.Text:=inttostr(strtoint(edit1.Text)*strtoint(edit2.Text));
end else if radiobutton4.Checked=true then begin
edit3.Text:=floattostr(strtoint(edit1.Text)/strtoint(edit2.Text));
end;

jalankan program

sebagai pelengkap, tambahkan perintah pada radiobutton sedemikian sehingga jika kita memilih “Pengurangan”, maka otomatis label1 menjadi “-”

Berkenalan dengan Delphi

Perkenalan dengan Delphi

Buat aplikasi baru

Buat sebuah label di dalam form, pada caption di properties, ubah tulisan “label1” menjadi “Hello World”


Buat satu tombol di dalam form, pada caption di properties ubah “button1”menjadi “Halo Dunia”




Dobel klik tombol “Halo Dunia”, tuliskan perintah berikut untuk mengubah tulisan “Hello World” menjadi “Halo Dunia”
form1.Label1.Caption:='Halo Dunia';


Jalankan program dengan menu Run->Run atau tombol F9


Ketikkan perintah berikut untuk mengubah warna font pada label 1
form1.Label1.Font.Color:=cllime;


Ketikkan perintah berikut untuk mengubah warna background pada label
form1.Label1.Color:=clred;


cllime, clred adalah warna-warna yang dikenali oleh Delphi. Warna-warna yang lain dapat dilihat di bagian properties


Buat tiga edit dan sebuah tombol

di properties bagian text pada masing-masing edit, ganti dengan angka nol
ganti caption pada tombol dengan “Hitung”

Dobelklik tombol “Hitung” dan ketikkan perintah berikut
edit3.Text:=edit1.Text+edit2.Text;

Jalankan program, klik tombol “Hitung”, apa yang terjadi? Ubah angka-angka pada kotak input (edit1 dan edit2) kemudian klik tombol hitung, apa yang terjadi?

Angka yang ada pada edit diperlakukan sebagai string (huruf) oleh Delphi sehingga jika kita menambahkan angka pada edit1 dengan angka pada edit2, maka mereka tidak menjumlahkan angka melainkan menambahkan angka edit2 di samping edit1.

Agar angka pada edit1 diperlakukan sebagai angka, maka harus kita konversi dengan perintah strtoint(edit1)

Namun karena hasil penjumlahan antara strtoint(edit1)+strtoint(edit2) adalah angka, kita tidak dapat memasukkannya ke edit3; kita harus mengkonversi kembali menjadi string sehingga perintah lengkapnya adalah
edit3.Text:= inttostr(strtoint(edit1)+strtoint(edit2));

jalankan program untuk melihat bedanya

Monday, February 20, 2012

Preman Kemanusiaan

Apakah aku merasa kasihan terhadap pengemis yang menggendong bayinya?

Tidak. Aku kasihan kepada bayinya.

Kenapa tidak diadopsi saja?

Tentu saja, tapi tak mungkin ibunya mau, pasti pendapatannya turun karena tak punya nilai jual lagi di perempatan.

Thursday, February 2, 2012

Kebersihan Sebagian dari Iman

Pagi tadi setelah sarapan aku langsung melompat ke dalam mobil dan memulai perjalanan rutin 50 km tanpa sempat melakukan aktivitas lain karena jarum jam sudah diambang

Di dinding toilet tertulis "harap disiram karena kebersihan sebagian dari iman". Hm, dengan menyiram bersih toilet saja saya sudah memiliki sebagian iman.

Jika ditambah dengan cinta tanah air, maka iman saya sudah penuh, karena cinta tanah air adalah sebagian lainnya, hehehe.

Pernah dengar saat SMP, mungkin ustadz, mungkin guru agama, aku lupa yang mana. Beliau mengartikan kalimat di atas secara lain: "Kebersihan adalah perwujudan dari iman".

Sepertinya aku lebih suka definisi yang terakhir.

Thursday, December 29, 2011

Tinycore Linux on Lion's Virtual Box

I installed it on new machine. Though it's not really installing for I just running the iso. My virtual machine is set without harddisk.

The OS boot very quick. But here the problem arise.

While GUI is included in this 8 Mb distro, I can't used it effectivelly soon. You know, my mac has dvorak keyboard layout, so what I typed come out as gibberish. There is  kmaps.tcz and I applied it but it has no effect

Saturday, December 24, 2011

Tiny Core Linux


Just wandering around and landed in ibiblio, glaring at my mac screen the tiny core linux, just 10 Mb linux distro with GUI, wow… and I thought damnsmalllinux is small enough.

This distribution is based on nothing, I mean it didn't based on large or old distro like ubuntu, debian or slackware like other mini distros that usually is stripped down version of its big distro.



here some excerpt from (http://distro.ibiblio.org/tinycorelinux/intro.html)
Tiny Core is:


  • Very Small. At 10 megabytes, Tiny Core is 1/400 to 1/100 the size of the most widely used operating systems in the world (even compared to most Linux distros). That makes Tiny Core flexible enough to be stored and run from usb sticks, a just-about-full CD, or even embedded devices. hardware.




  • Linux. Tiny Core uses the Linux Kernel and a set of command-line (text interface) tools including busybox.




  • A GUI Desktop. Tiny Core has a flexible and fully-customizable Graphical User Interface Desktop. Mouse, keyboard, and screen support basically works out-of-the-box thanks to FLWM, the FLTK Desktop. You can also quickly install and try out a variety of other desktops and interfaces including Fluxbox, XFCE, OpenBox, IceWM, Joe's WM, LXDE, and others.




  • Minimal. Tiny Core does not 'ship' with most end-user software. Instead, Tiny Core lets you quickly and easily compare, select, download, and install your preferred web browser, word processor, music player, and other software.




  • Unusually Stable. Every time Tiny Core loads, it is brand-spanking new. That means Tiny Core just doesn't get a blue screen. Instead of installing programs into the system file space and risking damage to the system files, Tiny Core uses program 'extensions' that are re-prepared at each reboot ... and they are prepared fast.




  • Unusually Fast. Unlike most operating systems, the Tiny Core can run completely from RAM. Individuals with RAM to spare can even use Tiny Core to load and run their programs from RAM (you didn't know your computer could run Open Office and Firefox so quick). Experienced users can still install Tiny Core to disk, but Tiny Core can run in 48 megabytes of RAM ... or less.




  • Internet ready. Tiny Core almost always finds your network card right right away. You'll be adding applications and tools after an unusually quick boot. You can even come back here and ransack the forums if you find you need help.




  • Available even smaller. Linophiles that get things done without a GUI can get the MicroCore, a version of Tiny Core without X that is under 7 MB.




  • An open source community. Tiny Core is under active community development, led by a team of really dedicated people. You can find answers and ask questions in the forum, add your own experiences to the wiki, help add extensions (programs) to the Tiny Core Repository, and read enough Tiny Core to make your head spin.



What are the minimum requirements?
An absolute minimum of RAM is 46mb. TC won't boot with anything less, no matter how many terabytes of swap you have.
Microcore runs with 28mb of ram.
The minimum cpu is i486DX (486 with a math processor).


A recommended configuration:
Pentium 2 or better, 128mb of ram + some swap


Is Tiny Core for me?
If Linux and distributions are confusing to you, then Tiny Core might not be for you. To help you decide, you need to know a few things about Tiny Core.


To get started, Tiny Core is:



  • Not a duplicate of another really common operating system. Tiny Core doesn't have a pretty boot screen, or stock wallpaper, and Tiny Core certainly doesn't have its own advertising campaigns.




  • Not a 'turnkey' operating system. Tiny Core can help you do what you need to do, but Tiny Core stays tiny by not including tools like a browser or word processor (but Tiny Core can help you download and install those really quickly).




  • Not for everyone. Tiny Core is fast, powerful, and flexible. You can use Tiny Core without much technical knowledge, but, like any strong tool, Tiny Core becomes really useful if you know how to use it. Great starter skills could include command line usage, simple shell scripting, and Linux file and permission management, and some reasonably fast typing skills.



If you aren't scared off yet, you need to know that there are some characteristics that make Tiny Core a really unique Linux distribution.



SSH Tunnelling Firefox on Oneiric Ocelot behind Virtual Box's NAT

I have Ubuntu 11.10 guest installation on my VBox on OS X Lion host. What the point of it? Yeah, first I want to create isolated environment that won't bring the headache if it destroyed. Second, I want to break that isolated environment so it can reach the world wide.



For start, I begin with ssh tunneling. I used ssh connection to tunnel firefox's data. It look like firefox isn't connect through NAT but through my ssh server instead.

To be able to do this. I have to have access to some server outside via ssh. Fortunately, now free shell access is widely available, just google for it and subscribe.

To make connection through ssh for tunneling use this command

ssh -ND 7777 yourusername@shellserver.com 

It will bring a prompt ask for password and then nothing, that N means, it will not bring interactive shell

On firefox side, open edit, preferences, advanced, network, setting
Choose manual configuration and type on SOCKS host: localhost port 7777

Now firefox's connection have been tunnelled.
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)