RSS

This post is dedicated to all my non technical friends who don't know about RSS or know a little about it but don't know how to use it. Without going into the details, I'll tell you how I read my feeds and the way I use to subscribe to feeds. There are many other ways and tools but I'll stick to what I use.

So here's how you do it.

step 1: Get Firefox

step 2: Open any blog or website(exept facebook) in Firefox.

step 2: Go to Tools->Page info

step 3: select Feeds

step 4: Select any feeds and click subscribe

step 5: Now you will see at the top of the page options for what to use for subscribing. Select Google and click subscribe now.

step 6: Log into your google account if you haven't and then select Add to Google Reader.

And that's it. You can visit your google reader any time by going to www.google.com/reader

Now whenever you want to check new things happening on that website open your google reader and check there. It's just like email newsletters but without flooding your inbox with unnecessary mails.

Connecting to Internet via mobile phone in linux

Let me tell you how I connected to Internet using my mobile phone (Samsung c3200) on linux using wvdial. Let me break it down in steps so it is easy to understand. Let's get started.

Step 1: plug in the phone using data cable
Step 2: Running lsusb
Run lsusb command. Output on my pc is like this.

 [noel@Daedalus ~]$ lsusb Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 007: ID 04e8:6843 Samsung Electronics Co., Ltd 

Notice the last line. It means that my mobile is detected succesfully. Also notice the weird codes after ID. That's what we need.

Step 3: Loading kernel modules Kernel modules are loaded with modprobe command. For my mobile it will look like this:

 modprobe usbserial vendor=0x04e8 product=0x6843 (run as root) 

If you have different lsusb output, then use those IDs in the modprobe command.

Step 4: Configuring wvdial Normally wvdial is configured simply by executing the command wvdialconf. However, I already use wvdial for one data card and didn't want to overwrite the working config file in /etc. So I issued command:

 wvdialconf samsung.conf (run as root) 

It will write all the configurations in the samsung.conf file instead of the default /etc/wvdial.conf. Let's see what I've got.]

 Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 Modem Type = USB Modem ; Phone = <Target Phone Number> ISDN = 0 ; Username = <Your Login Name> Init1 = ATZ ; Password = <Your Password> Modem = /dev/ttyACM0 Baud = 460800 

Step 5: Add the phone number and credentials. Now comes the tricky part. You need to know which number to dial and the login credentials. I have a vodafone connection here so I knew I need to dial *99# in order to connect to internet. However the problem was that the connection didn't need any username and password. It just connected to the internet. That was a problem for me. When I tried to connect to internet wvdial complained that there were no valid username and password in the configuration. The errors were:

 –> Configuration does not specify a valid login name.  –> Configuration does not specify a valid password.  

So, I installed opera mini in my mobile and went online and search for the solution. I found out that you can put username = user and password = pass as default values. I edited the configuration file accordingly. My final confinguration file looked like this.

 [Dialer Defaults] Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 Modem Type = USB Modem Phone = *99# ISDN = 0 Username = user Init1 = ATZ Password = pass Modem = /dev/ttyACM0 Baud = 460800 

Then I did:

 wvdial -C samsung.conf (run as root) 

Woohooo. Internet connected via mobile.

Quake like terminal emulator(not quite what you think)

Everyone who has used the GNU/Linux terminal knows it is a force to be reckoned with. However, it’s a pain to have to launch a terminal emulator wait for a it to load, and then have to keep Alt-Tabbing to it. That's why quake like terminal emulators exists. For those of you who don't know what a quake like terminal is, let's clear it up first. Quake is a popular first person shooter created by id software. In the game, there is a terminal that is accessible by hitting the ~ key. It is used for editing settings and variables(like changing the gravity variable so you can jump 20-30 feet high or jump & never come down by setting it to zero…) and cheats.

So basically what we want is to pop up a terminal at a press of a button & when we press the same button again, hide the terminal. Now, there are many terminal emulators are developed to just do that. Tilda and YaKuake to name a few. I was using Tilda until a few days when I decided to trim the fat from my system. Now tilda isn't very heavy on resources or anything but installing 2 terminal emulator excluding xterm seemed like a waste, so just for the heck of it I removed Tilda. As my other terminal I was using xfce4's terminal emulator Terminal. So I decided to get the same functionality with the Terminal.

So here's what I did.
I installed wmctrl utility that controls windows from command line & then wrote a little script, & saved it to ~/scripts/terminal.sh

#! /bin/bash
#title of the window you want to show/hide
TITLE="Terminal"
#application name
APP=terminal

#List all applications
if [ “`wmctrl -l | grep -c “$TITLE”`” = “0” ]
then
#start the application if it is not already running
$APP &
else
#if the application is running, determine if we should show or hide the window
if [ “`xwininfo -int -id $(xdotool getactivewindow) | grep 'Window id' | grep -c “$TITLE”`” = “0” ]
then
# show the window
wmctrl -R “$TITLE”
else
# hide the window
wmctrl -r “$TITLE” -b add,hidden
fi
fi;

& then in openbox's configuration which is located at ~/.config/openbox/rc.xml I added this in the keyboard section.

So now whenever I press the Menu key(the one that pops up right click menu), the script gets executed. Which the Terminal is not running then it runs Terminal, if it is runnning it decides if it has focus or not & then acts accordingly.

So that's what I did. This way you can get quake like functionality in the terminal emulator of your choice. If you want to use any other terminal you just need to change the variable TITLE and APP in the script. So, for example if you want to use sakura terminal, do TITLE=”sakura” & APP=sakura & you're all set.

Automatically mount NTFS partition on boot

To mount ntfs partitions we need to specify where we want to mount those partitions. By default, when you mount any partition/plug in any flash drive/insert a cd, it is mounted in /media/ directory. So we'll create a directory in /media/.
Step 1 : Create directories
sudo mkdir /media/directory name
replace “directory name” with the name of the directory you want to create.
I want to create a directory named data, so I will….
sudo mkdir /media/data
Now we need to get a list of all the partitions, this command will do just that.
Step 2 : get list of all partitions in all hard drives
sudo fdisk -l
Here is the output on my pc.
noel@Daedalus:~$ sudo fdisk -l
[sudo] password for noel:

Disk /dev/sda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000becdb

Device    Boot Start  End    Blocks     Id     System
/dev/sda1 *    1      1305   10482381   7      HPFS/NTFS
/dev/sda2      1306   4864   28587667+  f W95  Ext'd (LBA)
/dev/sda5      1306   4864   28587636   7      HPFS/NTFS

Disk /dev/sdb: 10.2 GB, 10242892800 bytes
255 heads, 63 sectors/track, 1245 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x03640363

Device    Boot Start End    Blocks    Id   System
/dev/sdb1      1     1147   9213246   83   Linux
/dev/sdb2      1148  1153   48195     83   Linux
/dev/sdb3      1154  1245   738990    82   Linux swap / Solaris

Now, the partition I want to mount at startup is /dev/sda5.
For that, we need to edit /etc/fstab file. This file holds the configurations of all the partitions that are mounted during boot. So DO NOT remove anything(unless you know what you are doing). All you need to do is to add one line(if you want to mount more than one ntfs partition you'll need to add one line per partition).
Step 3 : editing /etc/fstab
Now the syntax of a fstab entery is like this :
[Device] [Mount Point] [File System Type] [Options] [Dump] [Pass]
note: options in the fstab entery & option parameters in mount command are similar.
in terminal, issue this command :
sudo gedit /etc/fstab
Here, gedit is the name of the text editor i use, you can replace it by the name of whicever editor you use(like nano or vi).
add following line at the end of the file.
/dev/xxxx /media/directory name ntfs defaults,users 0 0
& replace the xxxx with the partition you want to mount, & directory name with the name of the directory you created in the first step.
so mine will look like this…
/dev/sda5 /media/data ntfs defaults,users 0 0
here defaults & users are options. If you want to know more about all the options you can read it in manual of mount command.
man mount
save file, partiotion should auto mount the next time you boot.
you can read more about fstab here : https://help.ubuntu.com/community/Fstab