Sunday, July 29, 2007

installing vmware tools in vmware fusion

my virtual machine (guest OS) is feisty-i386-server. the host is mac0s using vmware fusion. in order to activate the shared folder, we need to install vmware tools, by:

1. Select Virtual Machine -> Install VMware Tools
2. Go to the vm and mount the cd using
% sudo mount /dev/cdrom /media/cdrom0

3. copy the VMwareTools-e.x.p-48339.tar.gz to the home directory,
% cp /media/cdrom0/VMwareTools-e.x.p-48339.tar.gz $HOME

4. extract the file
% tar xvfz VMwareTools-e.x.p-48339.tar.gz

5. go to the vmware-tools-distrib and install:
% cd vmware-tools-distrib
% sudo ./vmware-install.pl

6. just accept the all the default values.

7. don't forget to reboot the system!
% sudo reboot


grub in ubuntu

few days without a post as I was so anxious to wait for my teeth operation, so kids don't forget to brush your teeth. It was a small operation, but operation is an operation. the pain is real.

just a quick and lite tips today:

if you need to find out where is your grub menu option, look no further in

/grub/boot/menu.lst

usually after being updated by the system [for example after installing/upgrading to a new kernel], the old one will be save as /grub/boot/menu.lst~

Tuesday, July 24, 2007

[fds part 1]: installing fedora directory server in ubuntu server 64-bit

1. download the fedora directory server (fds) from:
% wget http://directory.fedoraproject.org/download/fedora-ds-1.0.4-1.FC6.x86_64.opt.rpm
2. convert it to deb [--script was put there as it was warned by the system]:
% sudo alien fedora-ds-1.0.4-1.FC6.x86_64.opt.rpm --script
3. as it is amd64 version, we should use the termcap from fedora and do converting to deb again:
% wget http://download.fedora.redhat.com/pub/fedora/linux/core/6/x86_64/os/Fedora/RPMS/libtermcap-2.0.8-46.1.x86_64.rpm % sudo alien libtermcap-2.0.8-46.1.x86_64.rpm
% sudo dpkg -i libtermcap_2.0.8-47.1.amd64.deb

[deleted as it found to be false]Should 32 bit version is used, we could directly install it using:
% sudo apt-get install termcap-compat [upto here]
we should do:
% wget http://download.fedora.redhat.com/pub/fedora/linux/core/6/i386/os/Fedora/RPMS/
libtermcap-2.0.8-46.1.i386.rpm
% sudo alien
libtermcap-2.0.8-46.1.i386.rpm
% sudo dpkg -i
libtermcap-2.0.8-47.1.i386.deb


4. We need Java, for feisty fawn you can do:
% sudo apt-get install sun-java6-bin

5. Setting JAVA_HOME enviroment variable:
% sudo vi /etc/profile

add these two lines on the last line:
JAVA_HOME=/usr/bin/java
export PATH JAVA_HOME

to make the modification take effect:
% . /etc/profile

test by
% echo $JAVA_HOME
/usr/bin/java [the expected output]

6. We also need apache:
% sudo apt-get install apache2-mpm-worker

as ubuntu recognize apache as apache and fedora recognize it as httpd, we need to create as symbolic link:
% sudo ln -s /usr/sbin/apache2 /usr/sbin/httpd

7. Installing the package:
% sudo dpkg -i fedora-ds_1.0.1-2_i386.deb

Creating a user and group for the daemon:
% sudo groupadd fds
% sudo useradd -s /bin/false -g fds fds

Next, setting up the server....

adding dvd repo in ubuntu server

using ubuntu server means no gui [no synaptic???]. in order to add dvd repo, do:

1. make sure the /cdrom is link to the correct cd/dvd rom being used.
% ls -l /cdrom
lrwxrwxrwx 1 root root 11 2007-07-24 12:25 /cdrom -> /media/cdrom


I put the dvd repo in /media/cdrom. Otherwise you should point to the right direction, for example:
% sudo rm /cdrom
% sudo ln -s /media/cdrom1 /cdrom
# create symbolic link /media/cdrom1 as /cdrom

2. add the dvd repo by
% sudp apt-cdrom add

3. enter your password, then insert the dvd repo disk 1 and press enter.

4. do for the other three by repeating step 3 three times.

5. after that, don't forget to update the system using
% sudo apt-get update


Now, you have added dvd repo to your system, next time you wanna install software, you will be asked to insert a specific cd to where the software reside.


Monday, July 23, 2007

create cd image in mac

last post is about manipulating cd image in linux, now, how about mac? Disk Utility is a powerful tools that can burn a cd/dvd image. In addition, you do not need cd daemon tools to mount a cd image as you can just double click the iso file and it will be mounted automatically.

One thing that is not yet available in an easy way is how to create an image of a cd. Being BSD based, mac inherited some BSD/Linux commands. one of them is dd. But, just now I found out one freeware application to make a cd image easily, its name is ISOlator. You can download the application in http://www.macupdate.com/info.php/id/18634.

Installing this application is easy, just double click the zip file, then follows the instruction to drag the ISOlator to the Application's folder.

Launch the application, there will be a small window appear on the screen, drag your cd's icon to this window, then you will be asked to give a name and location for the new iamge file.

Wait few minutes and the iso file will be ready. That's it all you need to do.

Friday, July 20, 2007

assorted image cd manipulation commands

These tips are taken from http://ubuntuguide.org/wiki/Ubuntu:Feisty/CDDVDBurning

Assumed that /dev/cdrom is the location of CD/DVD-ROM

How to create Image (ISO) files from CD/DVD

% sudo umount /dev/cdrom
% readcd dev=/dev/cdrom f=file.iso


How to create Image (ISO) files from folders

% mkisofs -r -o file.iso /location_of_folder/


How to generate MD5 checksum files

% md5sum file.iso > file.iso.md5


How to check MD5 checksum of files
Assumed that file.iso and file.iso.md5 are in the same folder

# md5sum -c file.iso.md5


How to mount/unmount Image (ISO) files without burning
To mount Image (ISO) file
% sudo mkdir /media/iso
% sudo modprobe loop
% sudo mount file.iso /media/iso/ -t iso9660 -o loop


To unmount Image (ISO) file
% sudo umount /media/iso/


If you want to mount/unmount your ISO image by directly right-clicking on it, you can do this from your home dir:
% cd .gnome2/nautilus-scripts/
% gedit Mount


Copy this script into Mount file
#!/bin/bash
#
for I in "$*"
do
foo=`gksudo -u root -k -m "Enter your password for root terminal access" /bin/echo "got r00t?"`
sudo mkdir /media/"$I"
sudo mount -o loop -t iso9660 "$I" /media/"$I" && nautilus /media/"$I" --no-desktop
done
done
exit0


Save and close, than do the same with unmount file:
# gedit Unmount


Copy these script into Unmount file
#!/bin/bash
#
for I in "$*"
do
foo=`gksudo -u root -k -m "Enter your password for root terminal access" /bin/echo "got r00t?"`
sudo umount "$I" && zenity --info --text "Successfully unmounted /media/$I/" && sudo rmdir "/media/$I/"
done
done
exit0


Make them executable with:
% chmod +x Mount
% chmod +x Unmount


Or a graphical tool type in terminal:
% sudo apt-get install gisomount


to run type in terminal:
% sudo gisomount

Tuesday, July 17, 2007

java: setting proxy

when your java program needs to access the Internet using proxy, use this:
%java -Dhttp.proxyHost=proxyhost [-Dhttp.proxyPort=portNumber]

for example, I want to execute Reader.java

%javac Reader.java
%java -Dhttp.proxyHost=http://192.168.1.1 -Dhttp.proxyPort=8080 Reader


php: file create, read, write, open, close and delete

I have to figure out how to manipulate file in php in order to automate my database converter. The problem here is the main database is using interbase while my local database is using mysql.

This is just a note for my references:

The typical pattern of manipulating file is open, do write or read then close file.

Create & Open File
Open and creating a file are using the same command in php.

$fileName = 'theFile.txt';
$fileHandler = fopen( $fileName, 'X' ) or die( "can't open file! );

replace X with:
r : to read a file, the pointer starts from the beginning of the file.
w : to write to the file, overwrite the previous content.
a : to wrote to the file, appending the new content to the current file.
r+ : open a file to be read from and write to, the pointer starts from the beginning of the file.
w+ : same as r+, but the content of the file becomes overwrite (empty).
a+ : same as r+, only the pointer is at the end of the file.

die( "can't open file! ) needed to stop the process below. Otherwise, errors are pop up for the following file manipulation commands.


Read File

$txt = fread( $fileHandler, n );

where n can be:
integer, for example 10, to read the first 10 bytes [or characters as 1 byte = 1 character], or
if you want to read the all contents of the file, replace n with filesize( $fileName );


Write File

fwrite( $fileHandler, $txtToWrite );


Delete [Unlink] File
In php, deleting a file is equal to unlink the file, if there is no more link to the file object, the system will forget of its existence.

unlink( $fileName );


Closing File

fclose( $ fileHandler );


Actually I summarize that from http://www.tizag.com, solely for the purpose of maintaining single place documentation.

Monday, July 16, 2007

mysql update & insert from file

Maintaining Enrolment system is not an pleasant task. So many things must be reminded as bad documentation was supplied. Hehehe blame on myself that was too lazy to write them down.

This is just notes from me to rectify those problems above:

In order to update the data by increasing or decreasing its value, you do not need to use select then update. Instead you only need update query. See the example below:

UPDATE employee_data SET
salary = salary + 20000,
bonus = bonus - 5000
WHERE title='CEO';

Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0

While, inserting data from main database server to local database [in my case: I need to copy data from main uni's database into faculty's database, so my proposed solution is to read from main uni's database using php then run a script that contains command below. To make the process run automatically, I will put it as cron jobs]

Inserting data into employee_data table with employee.dat file
On Windows
1). Move the file to c:\mysql\bin.
2). Make sure MySQL is running.
3). Issue the following command
mysql employees < employee.data

On Linux
1). Migrate to the directory that contains the downloaded file.
2). Issue the following command
mysql employees < employee.data -u theUser -p
3). Enter your password.

Example of employee.dat:
INSERT INTO employee_data (f_name, l_name, title, age, yos, salary, perks, email) values ("John", "Hagan", "Senior Programmer", 32, 4, 120000, 25000, "john_hagan@bignet.com");
INSERT INTO employee_data (f_name, l_name, title, age, yos, salary, perks, email) values ("Ganesh", "Pillai", "Senior Programmer", 32, 4, 110000, 20000, "g_pillai@bignet.com");
INSERT INTO employee_data (f_name, l_name, title, age, yos, salary, perks, email) values ("Anamika", "Pandit", "Web Designer", 27, 3, 90000, 15000, "ana@bignet.com");

Sources from the tips above with little modification: http://www.webdevelopersnotes.com

Saturday, July 14, 2007

ssh on macos

I have just experience a funny thing when using ssh on my mac. Usually, I access my file server through wifi, but the access rate was not quite acceptable for iso transfer. Hence, I tried using wired network. What a surprise, I could not access the server using ssh although I could ping the server.

It was not
- MacOS problem as I could access the file server using wifi.
- Firewall problem as I could access the file server using my windows and ubuntu machine with the same IP address.

I have tried to delete .ssh/known_host without any luck!

What a problem.....

Wednesday, July 11, 2007

python for mac: installation

People can say that apple is not opensource, but I am still love it. Actually, vista has better gui than macos, but again people say wait for macos 10.5.

Anyway, I am still love my new MacBook Pro.

I'd like to learn python again to maintain my Online Enrolment System [KRS] for my faculty. I remembered when OSDC Meeting in Melbourne, December 2005, Jeff Waugh said that Ubuntu has better support off the shelf for python than any other distro. But, now, I need to install it on my mac. Mac comes with python version 2.3.5 while the newest is version 2.5.1.

Browsing on the python website, I found out that there is macos version for python [download from here: http://www.python.org/ftp/python/2.5.1/python-2.5.1-macosx.dmg]. The file is almost 18 MB. Download it, double click on it, open the installer.

> double click on MacPython.mpkg
> Click on "Continue" button on Introduction, Read Me and Licence pages, then click "Agree" to acknowledge the Licence Agreement.
> Pick the daetination then click on "Continue" button.
> Choose "Install" then enter the password for the admin user.
> Then close it after installation is finished.

To try it:
type python on terminal, you will get directly the new version:
daniel-adinugrohos-computer:~ adinugro$ python
Python 2.5.1 (r251:54869, Apr 18 2007, 22:08:04)
[GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
[use Ctrl-D to exit from python interpreter]

This is what I love with mac, instalation is very simple and has the pattern and interface. Although, Linux is catching up with klik, synaptic and many more.

Tuesday, July 10, 2007

few days in exile......

just kidding, it has been few days since my last posting. I was rather busy finishing my research progress report. It is about Student Enrolment via SMS. Today is the deadline to send the report, but I have not finished yet. That's why I woke up in the early morning. Moreover my little daughter was awake asking for milk.

She is a good daughter, she rarely wake up in the night. Usually just wake up at 2 AM and 4 AM. Sometimes even only once at 2AM. I am lucky to have good and understanding children.

Thursday, July 5, 2007

finding the best calendar software

starting from july 2007, i have been in charged for academic matters. it is not easy, so many meetings, while i have to finish my marking.

my other job is to reorganize our curriculum and drawing a best strategy to our students to graduate in 3.5 years plus having more broader knowledge and practical implementable skills.

one thing i learn that timetable is very important. it is not just to organize our schedule but also to others to understand our schedule so that they can see us if they need it.

now, my journey is begin, finding the best calendar software ........

Monday, July 2, 2007

transfer big files ....

transferring a file larger than 4 gb was is a pain. i could not do it from fedora 4/5 although ubuntu feisty fawn could.

the problem is I need to transfer file from my gateway server [fedora 5] to file server [fedora 4].

[scp simply cannot do that as the file, ubuntu repo, is over 4gb. it is the limitation of scp protocol.] <-- not sure, see comment!

sftp should be able to do it by don't know why it stops at 4gb marked.

solution using dd:
# dd if=ubuntu-repo-amd64-1.iso | ssh root@192.168.1.1 of=/data/ubuntu-repo-amd64.iso

resulting the same!

any suggestions?