Thursday, May 19, 2011

Ubuntu Update Manager/Synaptic package manager error

While updating your Ubuntu distros using the Update Manager or while using the Synaptic Package Manager, if you ever encounter a error like


'E:Encountered a section with no Package: header, 
 E:Problem with MergeList /var/lib/apt/lists/any name here,
 E:The package lists or status file could not be parsed or opened.'


The easiest thing to do is remove all the contents of the mentioned directory /var/lib/apt/lists/ and then populate the lists again.


1. Remove all the entries
       $ sudo rm /var/lib/apt/lists/*
2. Populate the entries again
       $ sudo apt-get update


This is a short hand trick and do use it at your own risk.
But Linux is all about taking that little extra risk, right?

Wednesday, May 18, 2011

Enabling front panel audio jacks in Ubuntu


When I moved my trade to Ubuntu 10.04 ‘completely’ last year, I had a tough time getting my desktop’s front audio panel.
It was a rather easy affair in Windows XP, I just had to enable a option using Realtek.But, in Ubuntu its not so straightforward albeit not complicated either.
All you have to do is, type the following commands in the terminal
  1. Open the alsa-base.conf file for editing
    $ sudo gedit /etc/modprobe.d/alsa-base.conf
  2. It prompts for the password, after entering it add the following line at the end of the file
    $ options snd-hda-intel model=auto 
  3. Reboot
This should get it working.

Tuesday, May 17, 2011

c.vim

Recently, I was thinking about the way we write c programs. There are certain set of statements and a few other things that we are bound to use again and again. Like the main routine, the headers, the comments...to mention a few. It would be nice if the editor did these redundant tasks. We would code lot faster. Such features are normally provided in the IDEs, but being a linux user I use vim to code c programs. Vim has so many features, i was sure that it would also have this...and i was darn right about it :)

'c.vim' is a small plugin for vim that converts it into a c/c++ IDE. Adding this to vim considerably increased my coding speed. It provides insertion of complete statements, code snippets, comments and a few more nice features.

Its fairly easy to change the template for the code snippets and the comments. You can also set your personal details like your name to be displayed, your contact etc. You can follow the documentation that is provided with the plugin to customize it to your needs. Once that is done, just take a look at the key combination to perform the actions.

Now open a new c file to code as usual, and you'll automatically be greeted with your information (the personal details which you've set in the template file) and also an empty main routine. The cursors is also placed in the appropriate positions so that you can continue to code.

All the key combinations begins with '\'. for example, '\cfr' creates a frame comment. There are many more available. Make sure to read the 'c-hotkeys' file that is provided with the documentation.
download the c.vim here .

Once you get used to it, you'l definitely code a lot more faster and your code will also follow a consistant format.