Saturday, July 16, 2011

What are we upto

Well, this is not one of the technical posts. The 3 of us are in the middle of our summer break, and frankly I (Phalgun) am making the best use of it. The other 2(Nitheesh and Phaneendra) have been doing it since the first summer break. Yes, I'm a little slow in catching up with stuff  and I like to talk a lot about myself.

Its been a productive break for the 3 of us. Let me start off with the best news, Phaneendra got into Google Summer of Code 2011!! After many days of deliberation,whether we (I applied too!) would actually stand a chance, it was indeed a great thing.He is working on a project called 'Fancy Bookmarking', its one of KDE's projects. He has been blogging about it here. And he is making a butt load of money.(Don't yell 'treat treat' now)

Next up, Nitheesh got into Intel as an intern. He was handpicked by the hot shots of Intel when they came to our college.He always wanted to get into Intel and finally has.He is working on Android and other embedded systems ("That's pretty much what I can legally tell you" was what he said when I pressed for details) And yes, he is making a butt load of money too, and said he is only interested in treating people who are going to install awesome window manager on their comps.That's when I stopped pestering him for one.

About me (finally!), I got into a startup called MobStac as an intern and am working on some hardcore web development. MobStac is pretty chilled out, and has a great bunch of guys working there.

Now, after we are done with our summer breaks and internships, what next was one of the highly discussed topics in our recent meetings. And (drumroll)finally we decided what we wanted to do today! I'm not supposed to tell you what it is. "That's pretty much what I can legally tell you"


If you haven't noticed, all the 3 of us have been blogging privately. Somehow, this blog is back alive, and I hope to write some more in the coming days. Until then, we are busy with our new found work, ciao.

PS : Started to monetize the blog finally.Drumroll again.

Which Linux?

…being a linux user I’ve tried out various linux distros, trying to find the one that suits me the best.

Each of them are wonderful in their own way. Many of the distros are made for a specific set of users. Some aim at security, some at being small and off course some to replace windows :)

 But none of them seem to satisfy me. Some distros provide wonderful UI and customization but hog a lot of memory. Few of them are very fast and small but does not provide a good GUI. Most of the time, there are so many unwanted features that I hardly use.

So I decided that I’l build my own based on my requirements. In the beginning I thought of using ‘Arch’ as it comes with a plane and simple base system upon which I can add my required modules. Moreover since ‘Arch’ is based on rolling release, the fact I would not have to frequently upgrade to newer stable versions was comforting.

Then I came across this project call ‘linux from scratch’(LFS). I’m glad I found that project. LFS provides step-by-step instruction to build a custom linux from source code. I couldn’t ask for more. This is the next best thing to writing my own OS.

LFS lets me create a basic system. similarly there are other xLFS, that lets you to continue on the base system to create more advanced and customized systems .

So, if there are others out there who also want a customized linux, then  http://www.linuxfromscratch.org/ should be your first step.

saving grub from windows

lost your grub after installing windows? here is a simple way of getting it back.

[note: assuming windows being installed on top of ubuntu(using grub2) ]

1: boot from a live cd and open a terminal

2: sudo fdisk -l

this will show the partitioin table. Here is my partition table

Device Boot   Start         End              Blocks    Id  System

/dev/sda1                   63        771119      385528+   de  Dell Utility

/dev/sda2   *        772096   105629695    52428800   83  Linux

/dev/sda4       105631722   625141759   259755019    f   W95 Ext’d (LBA)

/dev/sda5       105631744   315355949   104862103    7  HPFS/NTFS

/dev/sda6       315356013   561134384   122889186    7  HPFS/NTFS

/dev/sda7       621142016   625141759      1999872   82   Linux swap / Solaris

/dev/sda8       561134448   621137159    30001356    83   Linux

3: mount the linux partition on which you want install the grub (sda8 in my case)

$sudo mount /dev/sda8 /mnt/

$sudo mount - -bind /dev /mnt/dev

$sudo mount - -bind /proc /mnt/proc

4: Now chroot into this environment

sudo chroot /mnt

[optional]if you want to change any default setting like timeout options… then look at /etc/default/grub

5: #grub-install /dev/sda

[ in case of error do #grub-install - -recheck /dev/sda ]

6: now unmount and reboot the system.

#exit

$sudo umount /mnt/dev

$sudo umount /mnt/proc

$sudo umount /mnt

$sudo reboot

simple cmd line power management.

I am a cmd line user, so i spend most of my time on the terminal and its really painful to use the gui for some of the common things. Power management is one such case.

Just to put the system to sleep i’ve to go to the menu and then select, suspend. Same for hibernate, or to put the battery to power save mode.

So here is the simple way to do the same tasks from the cmd line.

pm : power management. check out the man pages for its various options.

pm-suspend : suspend/sleep the system

pm-hibernate : hibernate the system

pm-powersave : set the battery to power save mode

using these commands are way more simpler than using the gui :) [provided you are cmdline user]

Restoring Grub entries…

If you’ve lost your grub entries after installing a new os, here’s a simple way of adding it back to your grub.Lets take the common situation where fedora has been installed along side ubuntu.In this case, the grub which you’l see is that of fedora, so you’l have to add the ubuntu entry into fedora’s grub.
first, boot into fedora and open the file ‘/boot/grub/menu.lst’.This is the file that has the entries which are visible when the grub is loaded.
Amongst other things, the file would have a few statements that would look like

####################################

title Fedora (2.6.35.12-90.fc14.i686.PAE)

      root (hd0, 1)

      kernel /boot/vmlinuz-2.6.35.12-90.fc14.i686.PAE ro root=UUID=912d5b84-5c9c-4NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us rhgb

        initrd /boot/initramfs-2.6.35.12-90.fc14.i686.PAE.img

###################################

these four lines are responsible for your grub to show the title ‘fedora…’ on the grub menu and boot it. To be short, the first line denotes the name to be displayed in the grub menu.The second line provides the hard disk and partiion (in which that particular os is existing) to be set as the root in the path. The third line is the full path to the kernel image of that os and the arguments that have to be passed for booting and the fourth line is the path to the initrd image


so if you want to add ubuntu(or any other) to the grub menu, all you have to do is to provide these parameters in the fedora’s menu.lst file.These parameters will already be present in ubuntu(or any other) grub file.

mount your ubuntu partition and open the grub menu file(/boot/grub/menu.lst or grub.cfg).If the other os uses grub2 then you’l have to use grub.cfg instead of menu.lst
Since ubuntu is now shipped with grub2, grub.cfg will have entries similar to

###################################

menuentry ‘Ubuntu,  with Linux 2.6.32-28-generic’ —class ubuntu —class gnu-linux —class gnu —class os{

          recordfail

          insmod ext2

          set root=’(hd0, 8)’

          search —no-floppy —fs-uuid —set f18af736-8d79-43e5-815e-0033f9c31ffe

          linux   /boot/vmlinuz-2.6.32-28-generic root=UUID=f18af736-8d79-43e5-815e-0033f9c31ffe ro   crashkernel=384M-2G:64M, 2G-:128M quiet splash

          initrd  /boot/initrd.img-2.6.32-28-generic

}

###################################

it has a differnt format, but contains the same information

1st line is the title

in the 4th line (hd0, 8) is the harddisk and the partition in that hard disk where the os is existing

6th line is the path to that os’s kernel and its boot options7th line is the path to the initrd image of that os

so all you’ve to do now is to add these entries into fedora’s menu.lst fileIn our case, the new entry in the menu.lst file would be

###################################

title ubuntu

      root (hd0, 7)

      kernel /boot/vmlinuz-2.6.32-28-generic root=UUID=f18af736-8d79-43e5-815e-0033f9c31ffe ro  crashkernel=384M-2G:64M, 2G-:128M quiet splash

      initrd  /boot/initrd.img-2.6.32-28-generic

###################################

Note: in grub.cfg the partition was 8, but we use 7 in menu.lst because for this version of grub the partition number starts from 0

Now save the file and reboot. You’l have this new option in the grub menu

Instapaper

When I started depending more and more on e-resources than actual books, I ended up bookmarking every other page that seemed interesting for reading later or just as a knowledge resource.

This process grew haphazardly over time.I had a few bookmarks saved in my laptop and a few other in desktop, and of course I couldn’t import/sync them (Is there a method to do this? I don’t know).

Then I stumbled upon (real stumble!) Instapaper.It helped me save my bookmarks onto their servers.So I can now manage my bookmarks from laptop and desktop or any other device.I can log into my account and edit/delete/share/like my bookmarks etc.The features are best explained in their site.

The USP of Instapaper is its simplicity, right from the homepage to how your bookmarks are treated.It reminded of those WYSIWYG applications.Its so simple that I do not have much to write about it!

You are given a ‘Read Later’ bookmark which can be added onto your bookmark bar and once you want to bookmark any webpage,just click on the ‘Read Later’ bookmark and your webpage is saved.

Instapaper is free, and a premium membership as of now has no added bonuses.But, the creator of Instapaper Marco Arment is one of those shrewd startup minds and he would come up with something sneeky about the premium membership.Why I call Marco Arment shrewd is because of how he handled the iphone paid and free Instapaper apps.More on this can be found here.

Incidently,Marco Arment was involved with tumblr before he started with Instapaper.

Yes,Instapaper is not the first to offer these services.There is evernote,pinboard,deli.cio.us and even the more recent scrible.But Instapaper struck a chord with me with its in-your-face simplicity and functionality.Scrible may have more fancier features but I don’t see them using it.

Till then,Instapaper will do.

PS : I wish the ‘read later’ bookmark had a favicon.

Adding Gadgets in tumblr

Hack tumblr themes.

By ‘Hack’ I don’t mean an exhaustive modification of code, just a few additions so that, you get the ‘blogger’ experience.

I have noticed that it is not that easy to add a gadget or a widget onto your tumblr account.Here is a brief tutorial on how you can go about it.For example, Have a look at the left hand side bar of this page and you can notice 2 gadgets I have added.

One,the hit counter and another is the AdSanthe gadget which is a project which i worked on for the past 4 months. Know more here.

So, if you want to add gadgets like these, the following tutorial will help you.

Step one : Get the code

Identify what you want to add to your tumblr site. Lets take a hit counter for example, go to hit-counter.info, select the desired type and grab the code.So, whatever gadget you want to add, grab its code.

Step two : Customize

Dashboard -> your site -> Customize
If you are not familiar with HTML the easiest thing to do is
- Click on Info and in the description text box, paste the code that you copied( from hit counter eg.)
Go to step 4.
If you are familiar with HTML, you can easily choose where you want the gadget to be placed.
In the customize page, click on Theme -> Custom HTML
If you want to add the gadget onto the left hand sidebar, find the line where the code for sidebar ends(This is usually commented, so its easy to find it) and just paste the copied code snippet there.
Update
And you are done. This is a very brief tutorial and if you need more help feel free to mail/shout/rant.

Mongodb : ‘Connect failed’ error

Learning Mongodb these days, and encountered this error when starting the mongodb client.

Mongodb connect failed error

The problem here is that, the mongod daemon has to be started first.The steps to do so is

Ubuntu/Debian
Execute the following command in the terminal
$ sudo /etc/init.d/mongodb start

Fedora/RedHat
$ su
Now, switch to the directory where mongo was installed, and execute the following command in the terminal
# mongodb-linux-xxxx-1.6.x/bin/mongod

This should get the daemon up and running, the normal procedure for starting the mongodb client should then be followed.

Gmail multiple account sign-in

Gmail - multiple log in
I just found out that not many people who use gmail know about its multiple sign in feature.So, if you have multiple gmail accounts and wish to access all of them simultaneously, you need not have to logout of one to log into another.

This is an extremely handy feature useful to people who have multiple Google powered mail accounts, a personal Gmail account and another provided at their work.

To enable this feature, go here  and select the ‘on’ button.Check the following terms and conditions (as always) and you are set.

Now, to log into multiple accounts :

Click your name or email address at the top of the page.
Select Sign in to another account from the drop-down menu.
On the page that opens, enter the email address and password for another account you wish to access, and click Sign in.
Note : The above instructions are the official instructions from Google.Yes, I was too lazy to come up with my own.