Nugroho's blog.

Tuesday, March 27, 2012

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.

Friday, December 23, 2011

Automounting Shared Folder on Ubuntu 11.10 Oneiric Ocelot as Guest in OS X Lion VirtualBox

My Ubuntu 11.10 Oneiric Ocelot on virtual box have shared folder with host OS X Lion named 'vbox'. I used to typing command after login to mount that folder to my home directory. I mount it to falder named 'vbox' too using this command

$sudo mount -t vboxsf vbox vbox.  

However, at old time, I used to auto mount other partition that refused to automount (usually ntfs or other linux distros partition) at login by editing /etc/fstab



(using vi, press k to scrolldown and press i or a to edit the last line)
aravir@aravir-VirtualBox:~$ sudo vi /etc/fstab

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
#
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda1 during installation
UUID=3c8759e3-314b-4e42-a39e-efe9c18a130c / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=1b64eb34-42af-4ada-8bf1-0273d572cdb6 none swap sw 0 0
#virtualbox shared folder
vbox /home/aravir/vbox vboxsf auto 0 0

press :wq! to save and quit vi session


Restart the machine. 


After the machine is back, well, there is no sign that my tweak above worked. Curious, I want to take a peek of what kind and what are already mounted by system.


aravir@aravir-VirtualBox:~$ mount
/dev/sda1 on / type ext4 (rw,errors=remount-ro,commit=0)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
vbox on /home/aravir/vbox type vboxsf (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
vbox on /media/sf_vbox type vboxsf (rw,gid=1001)
gvfs-fuse-daemon on /home/aravir/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=aravir)
aravir@aravir-VirtualBox:~$
It's like the vbox is successfully mounted TWO times, however:
  • vbox did mount on /home/aravir/vbox but it's no file at all 
  • vbox mounted on /media/sf_vbox but only root have access to it 
So the last resort is playing with rc.local
aravir@aravir-VirtualBox:~$ sudo vi /etc/rc.local 

add this line before exit 0 

mount -t vboxsf vbox /home/aravir/vbox 

so the /etc/rc.local become like this
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
mount -t vboxsf vbox /home/aravir/vbox
exit 0
Restart the machine and voila, its success
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)