This is a nice tutorial on how to run your first c and c++ codes on Ubuntu:
http://www.ubuntugeek.com/how-to-install-c-and-c-compilers-in-ubuntu-and-testing-your-first-c-and-c-program.html
Sunday, November 22, 2009
Perl Hello World on Ubuntu
#!/usr/bin/perl
print "Hello World\n";
Those are 2 lines for the Hello World application.
My question is: How can I know the first line should be #!/usr/bin/perl ?
Well, open the terminal, then run which perl
It will show you the location of the Perl interpreter.
To run the code, just type perl hello.pl in terminal.
Now, I want to make the file 'executable'. Go to the directory where I saved the file, then run:
chmod +x hello.pl
./hello.pl
+x is used to put executable attribute to the file.
What about ./hello.pl? Why do we need ./ ? Why don't just type hello.pl?
For the complete explanation, see this website http://www.linfo.org/dot_slash.html
When we execute the file, we need to put the absolute path. The easiest way to put the absolute path is by using ./
./ refers to the current directory.
print "Hello World\n";
Those are 2 lines for the Hello World application.
My question is: How can I know the first line should be #!/usr/bin/perl ?
Well, open the terminal, then run which perl
It will show you the location of the Perl interpreter.
To run the code, just type perl hello.pl in terminal.
Now, I want to make the file 'executable'. Go to the directory where I saved the file, then run:
chmod +x hello.pl
./hello.pl
+x is used to put executable attribute to the file.
What about ./hello.pl? Why do we need ./ ? Why don't just type hello.pl?
For the complete explanation, see this website http://www.linfo.org/dot_slash.html
When we execute the file, we need to put the absolute path. The easiest way to put the absolute path is by using ./
./ refers to the current directory.
Wednesday, November 4, 2009
Unmount cdrom in Ubuntu
I wanted to remove a CD from my computer. I pressed the eject button, it didn't work. I right-clicked the CD icon and select 'Unmount' or 'Eject', it didn't work.
So, I tried to open the terminal and run this command 'umount -l /media/cdrom'..and it worked!
What is -l option? According to man page:
Lazy unmount. Detach the filesystem from the filesystem hierarchy
now, and cleanup all references to the filesystem as soon as
it is not busy anymore. (Requires kernel 2.4.11 or later.)
So, I tried to open the terminal and run this command 'umount -l /media/cdrom'..and it worked!
What is -l option? According to man page:
Lazy unmount. Detach the filesystem from the filesystem hierarchy
now, and cleanup all references to the filesystem as soon as
it is not busy anymore. (Requires kernel 2.4.11 or later.)
Remove red dot and vertical blue line in jEdit
In jEdit, there's a red dot at the end of each line, and there's a vertical blue line. How to remove them?
Go to Utilities > Global Options > Text Area
Uncheck both 'End of line markers' and 'Wrap guide'.
Done.
Go to Utilities > Global Options > Text Area
Uncheck both 'End of line markers' and 'Wrap guide'.
Done.
Sunday, November 1, 2009
Mount SMB shares
I have 2 ubuntu machines. One of the machine acts as the file server. I want to mount the shared folder to the other machine.
Firstly, install Samba File System and Samba client:
sudo apt-get install smbfs smbclient
Secondly,use smbmount command to mount the share.
Ex: The shared folder is located in 192.168.1.2 machine, and the folder name is java.
I wanted to mount it to /home/adi/java
smbmount //192.168.1.2/java /home/adi/java -o username=adi,pass=mysecretpassword
Done.
Source: http://ubuntuforums.org/showthread.php?t=280473
Firstly, install Samba File System and Samba client:
sudo apt-get install smbfs smbclient
Secondly,use smbmount command to mount the share.
Ex: The shared folder is located in 192.168.1.2 machine, and the folder name is java.
I wanted to mount it to /home/adi/java
smbmount //192.168.1.2/java /home/adi/java -o username=adi,pass=mysecretpassword
Done.
Source: http://ubuntuforums.org/showthread.php?t=280473
Get MDB2's mysql package
I installed Pear a few years ago but I only used it a few times.
This morning I decided to try the MDB2 package.
I tried the sample code from the Pear website. When I ran the code, I got this error unable to find package 'MDB2_Driver_mysql' file 'MDB2\Driver\mysql.php'
So, I had to update the package. 2 things that I had to do:
1. 'pear upgrade MDB2' to upgrade MDB2 package to the latest version
2. 'pear install MDB2_Driver_mysql' to get the mysql package
This morning I decided to try the MDB2 package.
I tried the sample code from the Pear website. When I ran the code, I got this error unable to find package 'MDB2_Driver_mysql' file 'MDB2\Driver\mysql.php'
So, I had to update the package. 2 things that I had to do:
1. 'pear upgrade MDB2' to upgrade MDB2 package to the latest version
2. 'pear install MDB2_Driver_mysql' to get the mysql package
Subscribe to:
Posts (Atom)