Archive for the ‘Linux’ Category

Version Controlling Systems - SVN and BZR

Thursday, November 1st, 2007

I have been using both “svn” and “bzr” lately. “svn” is a quite popular system, have been there for many years. “bzr” is developed by Ubuntu team to use as their version controlling system. Even though bzr is quite new to the field, it’s pretty much transparent to the user. For example if you type “bzr add” in the root bzr branch directory, then all the newly added to the repository recursively whereas svn doesn’t do that recursively. “bzr” is capable of detecting removed files, but “svn” is not; you’ll have to delete the files manually. That’s really annoying.

So, I wrote a small shell script to handle those.

#!/bin/bash

svn status | while read line; do
	command=`echo $line | awk '{print $1}'`
	file=`echo $line | awk '{print $2}'`
	if [ "$command" = "?" ]; then
		echo "Add $file"
		svn add $file
	fi
	if [ "$command" = "!" ]; then
		echo "Remove $file"
		svn delete $file
	fi
done

Display configure GTK and Bullet Proof X

Saturday, September 1st, 2007

If you have used linux for about a year or so, you should have surely edited the xorg.conf file. Actually, that’s a headache. If you are a linux beginner, and if your x server didn’t start, there is high probably that you’ll switch back to windows. Configuring your other video outputs such as s-video output requires you to edit the xorg file manually and restart the xserver.

But now those have become very easy tasks, thanks to two tools, DisplayConfigGTK and BulletProofX.

DisplayConfigGTK is the control panel. You can select the various settings from that such as output screens, resolution, etc.

What happens when the X server failed is it dumps the log file into the screen and go to the shell. But not anymore. BulletProofX uses the minimal settings and displays the DisplayConfigureGTK applet. So, the users can easily select the correct settings and then restart the xserver.

Check this site for screenshots of bullet proof X : http://people.ubuntu.com/~bryce/BulletProofX/

How to convert your live CD iso into a live USB

Monday, July 2nd, 2007

Update: You might be interested in this post “Live iso(distro) without burning & partitioning

Two days ago I downloaded the latest Ubuntu Gusty Tribe 2 (What a pathetic name?). I only had one blank CD left, and the burning process was interrupt by some unknown force. There is no point going to town to get a new CD, so, I started messing around my USB drive.

First what I tried was writing entire CD iso image into the usb drive. As far as I know, there is no easier way to do that in windows. So, I used another real live CD, and used “dd”. What I thought was by writing the iso image, it would behave like a CD and it will work, but It didn’t.

After going through some tutorials in the internet, I came to know that the best solution is syslinux. That’s pretty easy to install also. If you are in windows, download the syslinux, and extract it. Open the command prompt, go to the syslinux folder(if it’s “c:\syslinux\” then type “cd c:\syslinux”) and execute “syslinux X:” where X is your usb drive letter.

Then, to test whether it was executed properly, you can go to the usb drive and do a “dir /a”. It should have a file called “ldlinux.sys”. If it’s there, try booting from the usb drive. Then, it’ll complain the kernel image “linux” is not there. That means it’s installed. If it says, “Boot Error”, there is a HP disk format utility, you can download that and format the disk. If you are in linux, you can use “fdisk” and “mkfs.vfat”. Make sure you mark the partition as boot.

Then simply extract all the files from the ISO into the usb drive. Actually, after this step you have to configure the boot options, move some files here and there, but since I’m not going to keep Ubuntu on my usb forever, I just didn’t do any configuring. To boot up linux, just coping is enough.

So, again restart, and since we haven’t done any configuration, it will surely ask for the kernel again. The kernel is casper/vmlinuz. You also have to mention some kernel parameters. Here is my command.


/casper/vmlinuz boot=casper initrd=/casper/initrd.gz root=/dev/ram rw

However, If you are going to try Ubuntu Gusty Tribe II, it’s not stable yet. So, if you don’t want your linux to crash time to time, install feisty fawn. Since, my modem still doesn’t work in linux, I didn’t install it.

My TV runs linux

Saturday, May 26th, 2007

It’s just the TV output.

Struggling to install - Windows, Heroes and Linux

Wednesday, May 23rd, 2007

Yesterday, ahhh… Heroes season 1 final episode - “how to stop an exploding man”. When I got back to home from exhausted exam paper and a exhausted journey about 3 hours(Colombo to Ratnapura), my brother had almost downloaded it. However, after all who want to watch heroes final episode in small 14″ laptop screen. So, I plugged in my laptop to TV and boot it.

But as usual, when I’m trying to do something, Windows didn’t work. So, I tried fixing that. After lots and lots of fixing, I got it to boot, and when I played heroes sounds didn’t work. So, what to do - I restarted the computer again. Unfortunately, windows is not working again. It says “system32/config/system” file is missing.. ahhh!! That file is always important (lol.. if you are not sure what I’m talking about, read my previous post).

As you have already guessed, now windows doesn’t even boot in safe mode. So, I put a windows professional CD and tried to go to recovery console. No! No! It’s not a pirate version :). I got an original CD for selecting for second round in imagine cup web development (I also didn’t believe what I’m seeing when I first saw that.. So, no need to read that sentence again ;-)). However, recovery console was very helpful : It said “There are no hard disks present”.. whoah!! Cool, isn’t it? Actually, later on I found out I have to disable “Native SATA support” in bios in order to run the windows setup.

Anyway, since I didn’t released that SATA thing before, I rebooted in linux again to check whether I can find an old “system” file and replace the corrupted one. Thanks to my genius mind, System Restore is disabled and I had no copies of the “system” file left. So, I got one from the “windows/repair” and replace it(Thank you ntfs-3g). I could not stop just by just replacing that, I had to replace all the config files SAM, SECURITY, etc.

So, when I rebooted windows again, it worked perfectly, I was damn happy and got prepared to watch heroes. Oh!! Who is “Owner”?? instead of booting my normal user account, it booted to something called “Owner”.. oh!! Shit.. everything in the registry is gone.. How did I miss the fact “system” file is the registry? Anyway, I hope it’s ok and start installing drivers again. Actually, all driver files were in the system32 folder, so I just had to buzz the system to reinstall the drivers. Now, everything is ready, and I started installing software. Crap!! Even though everything seems fine, nothing works correct. It goes into an endless loop, which doesn’t even use my resources. It’s really annoying because usually when your computer is stuck, it uses your CPU power, uses your memory etc.. Then, I know something is going on, and be patience. But now, when I start an application, it just doesn’t show anything.

Okay.. Heroessss….. I can’t wait, and I also want to watch it in a 29. So, I got my hammers, knifes, etc ready and booted linux to see whether I can get the S-Video output working. And I never though this would be this much easier. Screw the hammers and knifes, you just a need a small blade(I think not even that if you are running feisty fawn - Not so sure, have to try that out). I just had to edit the “xorg.conf” file and put an option called “MonitorLayout” to “TV” in the “Device”. That’s all, I ran a “sudo killall gdm” and again a “sudo gdm”, it worked perfectly. (Yes, I know that you can do all that by one click in windows, but imagine getting your TV output works with windows generic drivers, you must be kidding).

And after all, happily ever after, Nathen and Peter stopped the bomb(If you want a detailed description on what happened read Kasun’s post).

After few more hours of installing windows and messing up with the drivers, I got windows running again. After all, how can I goe my ADSL to modem to work in linux? :P

Hitchhikers guide to linux

Friday, March 30th, 2007

Let’s start by the unix way: “do one thing and do it right”. That’s one major part of the unix concept. A typical unix system is build using so many tools and libraries and those are maintainted by different user groups. So, they only have to concentrate on their packages, thus those packages are high on quality. A collection of unix tools and a kernel from linus became the linux system. That’s the beginning of the universe.

Then, once after people found this new universe and got to know that it’s quite interesting they started to build lot of galaxies here and there. One such popular galaxy was redhat, then debian and the current most popular one called ubuntu with huge population.

Fortunately, with a little effort it’s possible to adapt a planet to fit into another galaxy. Usually, people develop a planet in one galaxy and port those into other galaxies. The only problem is that normal users (non developers) might find the newly developing planets unusable in their galaxies unless someone port that to their galaxy.

The nice thing behind these galaxies and planets is that all plans and the core elements of the planet/galaxy is freely available and you can actually see what it is build on and choose what fits your needs. And if you find any difficulty in living there you can always change your galaxy/planets at free of cost. Or you can always talk to someone and solve your problems; most of the people in the universe are willing to help you.

The really nice part is if you don’t like any of the galaxies/planets you can always get the plans of something, modify those and create your own; and trust me when other people are using that, you’ll feel really really happy.

Welcome to the new universe.

Bill Gates says “I recommend Ubuntu”

Thursday, March 22nd, 2007

Get ntfs-3g working with windows hibernate

Sunday, March 18th, 2007

Several weeks ago, I installed ntfs-3g and it was working fine. However, It doesn’t mount the drive if windows is hibernated. I usually hibernate windows in my laptop, so I wasn’t having ntfs-3g in fstab, I just remount it when I need it. I was sick of this and came up with a very simple script which allows me to mount it in ntfs-3g if possible, and to use ntfs otherwise.

This is how to do it.

  1. Install ntfs-3g
  2. Just type sudo apt-get install ntfs-3g

  3. Edit your fstab
  4. Open /etc/fstab and change the mount type from “ntfs” to “ntfs-3g”

  5. Open /etc/init.d/mount-bak.sh
  6. Here is my script. Change your device and get options from the fstab. The device should be changed on both 2nd and 4th lines.

    #!/bin/bash
    mounted=`mount | grep sda1`;
    if [ "$mounted" = "" ]; then
    mount /dev/sda1 /media/sda1 -o ‘defaults,nls=utf8,umask=007,gid=46′
    fi

    Change the permission of the script by running sudo chmod a+x /etc/init.d/mount-bak.sh

  7. Change the run level
  8. sudo ln -s /etc/init.d/mount-bak.sh /etc/rcS.d/47mount-bak.sh

IOI Site is back

Tuesday, March 13th, 2007

Today, after going through a lot, I managed to get the ioi site running. Just drop in there if you are interested in programming.

The grader is written in C++, and the interface is written in PHP using AJAX. This whole project is open source, you can download it from the sourceforge project page. Current release version is bit old, hopefully I’ll upload the current working version tonight.

5 steps guide to enlightment

Friday, March 2nd, 2007

Did you ever wanted to ascend(Either ascend as in stargate, or nirvana as in buddhism)? As far as I know, even if you want to do it, it’s very hard to ascend. No one will ascend you(Daniel Jackson is a special case), you have to do it by yourself. But when it comes to computers, there are always hell of a lot of open source software and documentation. So, at least, let your computer to get ascended.

Step 1 : Install Ubuntu

When it comes to enlightment in computing, there is no doubt that I’m talking about linux (There is a x-windows manager in linux called enlightment, but I’m just refering to word enlightment - nirvana). If you are new to linux, I strongly suggest that you install Ubuntu. Ubuntu is a very popular linux distro, so it has a huge amount of users around the world; which simply means there are hell of a lot of tutorials, documentations and forums for it. However, if you want you can also choose another distro such as debain, gentoo, etc. It doesn’t really matter, after all it’s linux.

Step 2 : Upgrade your system

Linux is built using many small software modules, called libraries. Since all those are open source, even the 3rd party software developers use those libraries, and the libraries are developed independantly from the software, also get upgraded separately. Now, you might be wondering, what if I don’t have those libraries in my computer? Does the software comes with all it’s dependent libraries? No, they don’t. That’s why you have something called package managers(apt-get, synaptic). Package managers take care of the all dependency problems, it’ll calculate the dependencies and install those. But when it comes to downloading packages from the internet, you have to feed the urls of the package repositeries on the internet. Note that this is a very important step in ubuntu, otherwise you’ll only see a limited list of packages. Follow the guide on ubuntuguide.org. Once after you add the extra repositiries, updagrade all the libraries. Since many software depends on libraries, upgrading a one library may increase the performance of many software that you are using.

Step 3 : Install some cool software

There are thousands of cool free applications in the open source world. Just look at the applications list on add/remove programs in ubuntu. However, there are some software, such as Adobe Photoshop, Macromedia Dreamweaver and there is no doubt that those are best software on those fields; and unfortunately most of those don’t have a linux version. But there is an incredible piece of software called wine which allows you to run windows applications on the linux environment. Both Photoshop and Dreamweaver works prefectly on wine. One more thing, if you are worring about the games, the answer is don’t worry :D, smile dude… most of the games works in wine but with a little of configuring.

Step 4 : Install the codecs

Since the computer became a toy to the people, the most people used it for listening songs. MP3s became so much so popular and now people are having thousands of mp3s on their hard disks. But if you tried to play a mp3 file, just after installed ubuntu, you’ll be disapointed. It can’t play mp3 files, and it also doesn’t support many other formates. The reason behind this is that most of those formates are not open source neither free, so it violates the ubuntu open source licence. But again, don’t worry, you can simply install those stuff just using one command :
sudo apt-get install gstreamer0.10-ffmpeg gstreamer0.10-gl gstreamer0.10-plugins-base gstreamer0.10-plugins-good gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse libxine-extracodecs w32codecs

Step 5 : Make it look nice

In every culture, there are some myths; so do in linux. I heard that lot of people says that linux is not user friendly and you have to do everything in that small black window, typing green letters all over here and there. But the truth is that you can do almost everything in terminal, but it’s not the only choice. You’ll see that yourself, even while when you are installing ubuntu - Just see how user friendly it is. So, however, after you logged into the system, it’s default human theme, which doesn’t look so nice to me ;). The solution is that you have to install a composite manager(beryl/compiz). If you don’t want a composite manager, you can just install someother stuffs like gdesklets, etc. Those will add some fancy effects your desktop.

That’s all about it and you are ready to go………..