DataOne arrives

BSNL DataOne – The monster 2 Mb/s broadband connection. The dream, my friends, has at last come true!

I have had some weird encounters with broadband connections in the past.. Take ’03 for example. It was a time when the rest of the world was getting used to broadband. And I was not to be left behind. So I looked around.. and found my neighbour working on his Ph.D thesis – On his all new 512 Kb/s cable connection. *big grin*.

Thus began a long week of purchasing cables, crimping them in crossover mode (nightmare, I tell you!), configuring the system for connection sharing, realizing I messed up in the crimping, doing everything all over again.. etc.

At the end of the week, when I was finally browsing at the promised speeds (and he was getting dial-up speeds since I was using up all the bandwidth *big grin number 2*).. disaster struck. In all the excitement, I had completely forgotten that my Board exams (I was in class 10th back then) were inching closer.. And it seemed my parents were just waiting for the connection to be up and running before they spilled out the bad news: “Son, you’re spending way too much time “watching” the computer. You’ll have to pack it up.. And Oh, that means no more internet!”

By the time I was free again, the neighbour was done with his goddamn Ph.D and I was done with my broadband. Sigh.

If I were to plot the average connection speeds I had gotten till 2006, it’d be a straight line, hovering around 30 Kb/s.. with a few pulses thrown in here and there.

From 2006 to ’07, I used GPRS. Oooohh GPRS. I can’t find enough (swear) words to describe it. But it was better than nothing..

2007 ushered in the era of “Huawei” (I’m referring to BSNL DataCard here..). It was better than GPRS. But only marginally so.

And in December 2008 I switched to *drum rolls* DataOne. As of now, I have no complaints whatsoever. The 2.5 Gb/s cap is just fine and the speeds are amazing. Their “portal” seems to go down very often which usually means I’m unable to check my current usage for days at a time. But that’s a minor glitch in an otherwise superb connection.

Compared to “Huawei”, DataOne is well, beyond comparison.. But I do miss the little white modem with its long tail. Whenever the speeds seemed to go down, I would try re-positioning the device, sometimes on the CPU, sometimes under it. In fact, I spent a considerable amount of time doing just this.. and as a result, I knew exactly which spatial co-ordinate yielded what speeds! Ahh sweet memories!

And so the story goes.. I hope the graph never looks down again. I hope the pacific is as blue as it is in my dreams. I hope… 😛

Side Note: There’s a nifty little Firefox plug-in that displays DataOne usage in the status bar. It seems to be able to retrieve usage data even when the “portal” is down (most of the time anyway). Download link: DataFox Plug-in.

Blah Blah

2 months since my last post.. and needless to say, I was rather busy 😉

Where do I start..? Ahh yes. After dreaming about laptops and shamelessly blabbering about how much I wanted one in every other post, I finally got my hands on a Sony Vaio CS-17 – The “Knight in Shining Black Armor” as my friend likes to call it. I’m too lazy to list out all its features so here’s a quick gist: It’s a Centrino 2, 3 gigs of RAM, 14.1″ display and 250 gig HDD. For those interested in knowing more, I point you to this page.

College-work has started to pile up like never before (they won’t take me alive!) and there’s lesser time for serious online stuff like blogging :P.

September was spent working on a Front-End for the AXEL download accelerator (I’ve uploaded the code at Sourceforge CVS. Here’s the link if you’re interested) …

.. and October on preparing for a seminar on “The Future of Human-Computer Interaction” and studying for internals. Now that I’ve got those outta my way, I can concentrate on my Main Project which is going to be something related to Facial Recognition. I’m hoping it doesn’t meet the same fate as my Twenty20 Cricket manager plan. Sigh.

Apart from all that, there’s GATE preparation (which is going nowhere as of now) and a bunch of features that I’m supposed to add to our college website (which ain’t going nowhere either).

In short, I long for the day when I can sit at home, watch a movie, relax and basically be my old lazy-ass self again.

P.S: Talking of Linux, I haven’t tried out Intrepid Ibex yet. Waiting for my broadband connection to arrive..

Ubuntu Tweaking Part I

Here’s a list of essential apps that I install everytime after setting up a fresh Ubuntu system. I plan to keep this list updated so maybe you’ll find it useful too. Editing config files and other tweaks will be (sooner or later) covered in Part II of this article.

Essentials:

  1. build-essential: A meta-package that includes all the stuff you’ll need to compile source code. If you ever find yourself typing ‘make’, then you need this.

    sudo aptitude install build-essential

  2. ubuntu-restricted-extras: The default Ubuntu insallation can’t play MP3’s and other audio/video formats. Lift this restriction by installing the “restricted extras”.

    sudo aptitude install ubuntu-restricted-extras

  3. Compression Software: Everything you’ll ever need.

    sudo aptitude install unace rar unrar zip unzip p7zip-full p7zip-rar sharutils aish uudeview mpack lha arj cabextract file-roller

  4. Java: Check out this link.

Multimedia:

  1. Amarok: Do I need to explain?

    sudo aptitude install amarok

  2. VLC: DINTX? (wow, new acronym)

    sudo aptitude install vlc

  3. MPlayer: Another nice Vid player. I don’t use it much though..

    sudo aptitude install mplayer

  4. K3B: The best CD-Burning software available. Period.

    sudo aptitude install k3b

Internet:

  1. Kopete: Pretty good IM client. I wouldn’t say it’s better than Pidgin, but it’s worth a try..

    sudo aptitude install kopete

  2. FileZilla: For all your FTP needs.

    sudo aptitude install filezilla

  3. Azureus: A very powerful Bit-Torrent client. Requires Java.

    sudo aptitude install azureus

  4. X-Chat: IRC Client. The best.

    sudo aptitude install xchat

  5. Axel and Aria2: Download accelerators (command-line) for Linux. I prefer Axel.

    sudo aptitude install axel aria2

Programming:

  1. gVim: Better than plain VIM imo..

    sudo aptitude install vim-gnome

  2. gdb: The GNU Debugger. Immensely useful.

    sudo aptitude install gdb

  3. CVS (If it isn’t there already): If you plan to use bleeding-edge software, chances are you’ll need to pull it out of a CVS repo.

    sudo aptitude install cvs

  4. cscope: Very useful tool – analyzes C/CPP files.

    sudo aptitude install cscope

System Tools and Utilities:

  1. Bum (Boot up Manager): Tweak runlevels and other init scripts. Very useful.

    sudo aptitude install bum

  2. Preload: The adaptive Read-ahead daemon. Can increase performance of your Ubuntu system drastically.

    sudo aptitude install preload

  3. GParted: A superb Partition manager for GNOME. I recommend burning the GParted Bootable CD as well (It’s available at their site – Click Here).

    sudo aptitude install gparted

  4. AllTray: Minimize any app to system tray.

    sudo aptitude install alltray

  5. NTFS-Config: Stop messing around with /etc/fstab and configure your NTFS partitions the easy way.

    sudo aptitude install ntfs-config

  6. Quake-like terminals: These can be real time savers. You can choose between Tilda, Yakuake and Guake. (For guake, visit their site).
  7. HTOP: View and manipulate processes in the system. For a brief intro, Click Here.

    sudo aptitude install htop

  8. Envy: Problems with your video drivers? Envy will take care of everything.

    Download from: http://albertomilone.com/nvidia_scripts1.html

That’s all I can remember as of now.. If you think I missed something important, then please do leave a comment.

Playing with VIM

A fortnight worth of tinkering and lo! my Vim looks unrecognizably different. Its behaviour, looks, everything has changed… for the better. The once empty .vimrc in my home folder (that’s Vim’s central config file, in case you don’t know) is now almost 3 pages long.. and growing fast.

I have been gobbling up all Vim-related info I could lay my hands on.. and there’s plenty to share. Let’s take it one step at a time.

First off, Vim’s key-bindings. There’s plenty up on the net for anyone out to get a decent idea of the default ones. To name a few:

And if you need more than a decent idea:

So much for defaults.. Actually a lot can be accomplished by redefining the right keys in your vimrc. Take Esc for example. It’s probably the most used key when working with Vim.. and unless you have really long fingers, it makes sense to remap it. In my case, I decided to go with ii. i to get into insert mode, ii to leave. Nifty eh? Oh but there’s more.. Check out my Vimrc (link given at end of post). Here’s a gist of the more important ones:

  • [Tab] and [Shift-Tab] do automatic keyword completion (which means you can still use Tab to insert a .. duh Tab)
  • Firefox-like Tab management (Ctrl-T to create a new Tab etc..)
  • [Ctrl-N][Ctrl-N] to toggle display of Line numbers
  • [,v] to bring up my VimRC, [,m] to bring up MRU list (requires MRU plugin)

BTW somewhere down the line, you’ll get confused between map, imap, nmap and the other map variants. When that day arrives, click here.

Alright let’s move on.. Recently I did some research on fonts for programmers and discovered that the font I was using for the past 9 years (yeah you guessed it, Courier New. I bet you use that too) while programming sucks. It can’t differentiate between 1 and l (small Ell), O and 0 (number zero) etc.. Now, I knew all that but the other fonts in my system just didn’t cut it.. (Except probably Andale Mono, but I never liked it).

Finding a better font was just a google search away, yet I never thought about it until recently. It was only then that I discovered a world of fonts designed specifically for programmers.. by programmers. Try searching for “fonts for programmers” and you’ll be surprised.

What has all this got to do with Vim? Nothing.. I just thought every programmer should know. Oh and BTW I use MonteCarlo. Bit small but perfect for my needs.

Coming back to Vim, there are some really kick-ass customizations that can be done using its various options. Here are a few from my Vimrc:

  • Indentation: Disable autoindent and enable smartindent. Also, set an autocmd to enable cindent whenever a c/c++ file is detected (refer to my Vimrc for details)
  • Enable wildmenu. Displays a sexy menu when using tab-completion in the command-line.
  • Enable autoread: Reread a file even if it has been modified outside Vim.
  • Disable toolbar: I feel it just uses up screen space. So disable it.
  • Jazz up the status bar.
  • Enable dictionary completion. Specify different dictionaries for different languages/API’s/whatever. Hint: Go to Vim’s syntax folder if you want a language’s keywords.

And finally, Vim’s plugins. There are just too many of them out there and it’s upto you to find the ones that suit your needs. Check out Vim’s script wiki.

Hot Tip: Search the net for “vimrc”, go through about 10 to 15 results and modify your Vimrc accordingly. Chances are you’ll end up with just the right options.

Hot Tip 2: Back up your vimrc at dotfiles.org periodically. That way you’ll always have it handy.

P.S: Here’s a link to my VimRC.
VIMRC – Saurav

**** Emacs, VIM rocks!

VIM is the best text editor EVAAHHH! w000t !!

Phew.. that one was just waiting to come out 🙂 As you might’ve guessed, Vim has managed to literally *floor* me. After days of pondering, I still fail to understand why I missed something like this for so long…! All these years, I never used it for more than 5 minutes at a stretch. What a pity. If only I had realized…

Ages ago, I remember typing in the “vimtutor” command… Hoping for the best (Go ahead, try it). And I remember quitting the tutorial (giving up would be better) in about 10 minutes… I wondered.. Why would anyone, with a sane mind, use an editor like this?

If you were to ask me that question today, I’d call you insane if you weren’t using Vim! Alright that’s exaggerating a bit. Let’s put it this way: I’d call you insane if you knew touch typing and weren’t using Vim.. There. Better. So what caused the sudden change in mindset? It’s the philosophy..

Vim follows a simple philosophy: Try to keep your fingers close to the Home Row of the keyboard at all times. Do you understand what that means? No, you don’t. It means.. STAY AWAY FROM THE ARROW KEYS! This may sound weird at first, but trust me.. the Vim-way of editing text just pwns everything else. It takes time and patience to get used to, but it’s definitely worth it. It’s this feature that distinguishes it from everything else, including the Emacs Operating System..

If you know how to touch type, then you sure as hell know that pulling your hand away from the Home row to press the Arrow keys, Delete, Function keys etc. and then bringing it all the way back takes a lot of time. Especially if you’re on a Laptop (it becomes a nightmare, really, with all the keys stacked together in the weirdest of places).

The creators of Vim found a neat solution: Eliminate the need to pull your hand away. For this it uses what is called “modal editing” (modal, modes.. get it?) wherein a user can not only enter text (called insert mode) but also perform various operations on the text without touching anything on the right half of the keyboard..

Now I can blabber on and on and try to explain (in vain) how the different modes work and how they supposedly make life easier, but IMO Vim’s features are best understood by actually using those features.

First of all, you need to have Vim installed (if it isn’t there already). I personally use gVim, a gnome front-end for traditional Vim. And I suggest you use it too.. So if you’re using Debian/Ubuntu. It’s as easy as:

$ sudo aptitude install gvim

gVim is also available for Windows. Download it from vim.org

Once the installation is done, go read the following page. It discusses the essential features of Vim as an informal IRC-style conversation:

http://www.vi-improved.org/tutorial.php

That should get you started. Additional tips can be found at the VIM Site (they have a nice Tips Wiki) as well as a ton of other pages. Just search. I’ll soon write a post discussing a few features and key-bindings that I use on a regular basis. Till then, Enjoy!

The Ubuntu Man

Well well well… Guess what? I’ve finally bid buh-bye to good ol’ faithful Debian. Ubuntu has taken its place now… not 8.04, but 7.10. Mr. Hoary Hedgehog refused to work correctly after I installed the nVidia drivers – Yeah that’s right, the Driver Dilemma all over again. I wonder when my lappy will arrive and put an end to this…

The version doesn’t matter much though. It’s all Ubuntu after all.. I have my sturdy 87.76 drivers working flawlessly – which is more than enough for me. The overall stability isn’t really top-notch but I can do without that I guess… No mission critical apps running on my PC. No sir 😉

As usual, eye candy was top priority.. so without thinking twice I went for Enlightenment 17 (aka E17). I’m telling ya, it really blew my mind away! Animated wallpapers, icons, menus… animated everything! So much for the window manager dilemma.. Here’s a screenshot:

E17 on Gutsy
E17 on Gutsy

So it went on for a few days.. a few crashes here and there. Nothing out of the ordinary. And then it struck me.. I suddenly realized how s-l-o-w everything was.. Hell, even my bloated KDE of yester-years was far better! Turns out e17 had no Hardware acceleration. All that eye candy was eating up a sizeable chunk of my CPU time. So much for looks.

Somewhat hesitantly, I switched back to GNOME.. themed it up. Made it look like E17. I couldn’t get even close of course, but hey, it was hardware accelerated 🙂

Here’s a screenie:

And that’s the story till now.. a GNOME user finally. Not something I fancied but as I said.. Speed is the magic word. The stability needs to improve but there’s really not much I can do… It’s the drivers.. or the RAM… or both. 😦

HOWTO: Setup BSNL Data Card in Linux

Here’s how you can configure a BSNL CDMA data modem to work in Linux. The device I have is a HUAWEI EC325 meant for the 144 Kb/s connection, but this guide should work fine for other BSNL devices as well (2 Mb/s device, for eg.)

Let’s start off by installing the software. We’ll be needing wvdial and gnome-ppp. So let’s install that. On a Debian based system (Ubuntu, Mint, Elive etc.), do:

$ sudo aptitude update
$ sudo aptitude install wvdial gnome-ppp

Note: Since the net connection isn’t up and working just as yet (duh), make sure your installation CD/DVD is in the apt sources list before you issue the above commands. Use apt-cdrom add for that.

The next step is to setup wvdial. Follow these steps:

1. Make sure the device is plugged in.

2. Type the following command (as root)
# lsusb

3. You’ll see a bunch of lines of the form:
Bus XYZ Device XYZ: ID AAAA:BBBB [Name of Device]

4. Note down the AAAA and BBBB part of your BSNL device. In case no such device is listed, unplug all USB devices except your data card and run the command again. All entries except one will have AAAA and BBBB values of 0. Note this down.

5. Alright, now we have the vendor and product ID of the device. Type the following command:
#modprobe usbserial vendor=0xAAAA product=0xBBBB
(Here replace AAAA and BBBB with the ID you wrote down earlier)

6. Now we can configure wvdial. We’ll need to edit the wvdial.conf file. So do this:
$ sudo nano -w /etc/wvdial.conf

7. Edit it so that the [Dialer Defaults] section looks like this:

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Stupid Mode = 1
Modem Type = USB Modem
ISDN = 0
Phone = #777
New PPPD = yes
Modem = /dev/ttyUSB0
Username = Your BSNL username here
Password = Your BSNL Password
Baud = 460800

There. Make sure you save the file 🙂

8. Let’s test if everything’s working. Type:
$ sudo wvdial

9. If everything’s configured properly, you should see a series of lines in the terminal and the connection should be successful. You might want to fire up the browser and visit a site to check if it’s working…

10. Now let’s configure gnome-ppp. Start it up by running Run -> ‘gnome-ppp’

11. Click Setup

12. In the Modem page, set Device to “/tty/USB0”, Type -> USB Modem, Speed -> 460800, Volume -> Off, Wait for Dialtone -> Checked.

13. Leave the Networking page as it is. The Options page should look something like this:

gppp Options
gppp Options

14. Close the Setup page, type your username and password in the respective boxes and click connect. If you did everything right, the connection should get established.

15. All done! Now you can create a shortcut to ‘gnome-ppp’ and configure it to start at system startup (using Sessions manager in Gnome/KDE).

There you go… configuring a BSNL data card is a piece o’ cake 😉 In case you have any doubts/suggestions, please post it as a comment.