2012/03/14

How to mount vdi file to Linux!?

First install QEMU on Ubuntu: 
sudo apt-get install qemu
 
Then run these: 
sudo modprobe nbd 
         // create net disks
sudo qemu-nbd -c /dev/nbd0 /media/ 
         // locate the vdi as a net disk
sudo mount /dev/nbd0 /home/

         // mount the net disk to directory

2011/03/13

VirtualBox - How to forward connections to guest SSH server!!

To set the rule:
VBoxManage modifyvm "VM name" --natpf1 "guestssh,tcp,,2222,,22

ps. TCP is replcable by UDP

To remove the rule:
VBoxManage modifyvm "VM name" --natpf1 delete "guestssh"

ps. VM must be shutdown while setting.

2010/03/24

Code Complete: My notes for Chapter 2

Below are the key points listed in the book, I rewrite them a bit using my words. (Hope it does not violate any rules. :) )

1. Using metaphors requires heuristic thinking, not algorithmic.

2. It is actually about analogism to the activities you are familiar with.

3. A programmer should own multi-tools as a toolbox, then use the tools according to the different jobs.

Code Complete: My notes for Chapter 1

Below are the key points listed in the book, I rewrite them a bit using my words. (Hope it does not violate any rules. :) )

1. The most important event in software development is "Software construction".

2. The construction includes design, coding, debugging, and developer testing.

3. The "KNOW HOW" of construction decides how good a programmer you are.

2010/02/11

MRTG in FreeBSD

I've searched online for a long time.... but today I found it is not that complicated to run MRTG on a FreeBSD server.

People recommended that installing net-snmpd first before MRTG. Somehow, since I have a FreeBSD 7.2, it has bsnmpd already.

So, all we have to do is to activate bsnmpd by adding the line, [ bsnmpd_enable="YES" ] in /etc/rc.conf .

Then, as usual, cd to /usr/ports/net-mgmt/mrtg to complete the installation.

After installing, do cfgmaker to configure everything as following.

In CLI:

cfgmaker --global 'WorkDir: /usr/local/www/apache22/data/mrtg'  --global 'Options[_]: growright, bits'  --global 'WithPeak[_]: wmy' public@localhost  >  /usr/local/etc/mrtg/mrtg.cfg

Next, the index:

indexmaker  --title 'MRTG'  --addhead=''  --output /usr/local/www/apache22/data/mrtg/index.html  --columns=1  --nolegend  /usr/local/etc/mrtg/mrtg.cfg

Last, run mrtg for about three times till no error messages.

mrtg /usr/local/etc/mrtg/mrtg.cfg

Add mrtg to crontab! (per 5 min)

*/5 * * * * /usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg

2010/01/18

eclipse on ubuntu

Once the JVM is installed...., we can start to use eclipse as our IDE.

0. download eclipse

1. change owned by root on eclipse directory
sudo chown -R root:root /directory of eclipse

2. make eclipse executable (jump to the directory locates eclipse)
sudo chmod +x eclipse

3. eclipse executable
sudo touch /directory of eclipse
sudo chmod 755 /directory of eclipse
sudo vi /directory of eclipse

4. before the 1st run:
eclipse -clean