Sunday, October 5, 2014

Developing Gnome Shell Extensions - 3.12

Gnome shell is gaining more and more popularity these days. Its beautiful, modern and very productive. If you haven't tried or used older versions of gnome and left it, wait no longer. Install it and try. Its a bit cumbersome process but trust me its worthy to try.

One of the core functionalities of gnome shell is its extension support. You can write extensions in Javascript and publish it to extensions store. Lots of extensions are already present and you can try them straightaway.

Then comes a time, when you want to write one for your needs. So you try to search online to start and end up disappointed because documentation is either not present or outdated. If you are falling under same category, read on, this post is for you.

Good introductory post . Important Note - Don't try to start from new extension. Try to use already present extensions and modify them.

A typical example of getting data from API, parsing it and displaying it  (Disclaimer - Yes its my own extension). I developed this extension using this (for XML parsing) and this (base core of my extension)

The above example uses XML Parsing. In case you want JSON parsing, here is one

Small blog about notifications (add const MessageTray = imports.ui.messageTray) at the beginning of the file. Another example of pop menu and on click runs commands from command line.

Few debugging tips

Stay tuned for more updates!

Saturday, July 19, 2014

Little Crazy Afternoon

Lovely pleasant afternoon it is :) Had nice lunch - not heavy but decent and came back to apartments. Awesome weather, beautiful trees and nice breeze made me step towards the pool. Being decided to stay away from virtual world to live in a real world, walked towards children park which is empty - after all its still an afternoon. Took out my thoughts from my brain and started solving a few problems. Then came 3 girls. Little cute girls. One naughty cute girl and two sisters equally naughty. Little introductions followed but as usual don't remember their names.  But when I asked about their school, they told and felt very bad. Yes it is the same school in which that crime happened sadly few days ago :( But they immediately switched the topic and started playing. Apart from that little intro, they didn't come to me much as they appeared a bit reluctant. They started playing merry round. And me too just turned around to try going back into my world. After being for a few mins finally, they decided to play with me in their own style through  beating me and calling me uncle ;) But whatever kids do is fun. Isnt it ? SOooo innocent, cute, beautiful little girls! What can I say ? Nothing except that I requested them to call me bhayya which they rejected straightway unanimously! But I don't want to be a uncle. Atleast not now! So started calling them aunties. They smiled, shouted,  ignored and continued playing. After a bit while, the cute girl ordered  me to start rotation. Me being a bit scared pushed them slowly and they didnt like it and started shouting me to rotate quicker. And I obliged. They liked it and acknowledged it through their cute smiles. Rotated for some time and went back to my problem solving. They too left me alone for a while, played themselves and again started calling me. I went again, played with them for some time and came back again to my place. This went on for some time till I decided to take a break. Not a break from problem solving but from them ;) The cute girl ordered me to push again. I requested her for a break. Till then , she was smiling and having fun with me. The moment I said that, she turned angry and left ! Not able to see her angry went back and rotated again. Again the same thing followed till I finally decided to leave. So asked them to give some poses for pics which they readily gave and finally started walking back. Just before leaving , asked their names again though I was pretty sure that I wont remember. But surprisingly,  the girl who ordered me till then started whispering to other girls not to tell their names. Felt slightly sad but then smiled and started walking back. Walked for around 20 feet and then suddenly I heard a bigggg shout! The cute girl is running towards me. She came to me, asked my name and told back her name, shook hands with me and said bye and left towards her friends to resume her play :) What a gesture it is. Felt sooo happy and all my tiredness went away with that little gesture and then started walking back towards my room thinking

Girls are Girls!

Thursday, July 17, 2014

Installing OpenCV on RHEL 7

Most often we work on either Ubuntu or Windows. Though many other Linux distributions exist, we hardly use them. But then comes a time when you have to use those distributions and end up Googling how to do each step - especially installing non-standard softwares like math tools which is complicated even on Standard Linux Distributions. Though we come across various blogs, various solutions, most of them will be outdated and wont work on new systems. Hence In this series of blogs, we will learn how to install such softwares on RHEL 7. Lets start with OpenCV

Tools/Machines Used 

AWS - G2 instance (with support for GPU and Nvidia)
RedHat - Version 7.0
OpenCV - Version 2.4.9

Fortunately Open CV acknowledged the fact that its installation is very complex and hence came up with fairly simple solution. All we have to do is run a script and it gets installed !

1) Grab the script from here and install. As you can see this repository contains scripts for installing open CV on other operating Systems as well such as Ubuntu, Arch Linux. Thats it! Open CV in installed!

2)Now that open CV has installed lets try to run some scripts.
g++ demo.cpp -pkg-config --cflags --libs opencv -o demo
If it throws any error, its because Open CV got installed in a folder and not as system wide. No worries, all it needs is a small fix. Check this

Done! Now Enjoy Open CVng :P

Advanced Installations:

Now that open CV is installed, we can configure AWS to run graphical outputs as well. AWS forwards the data to the local machine and can then be displayed via local machine

Run a script to check if it works for you. In case graphical output doesn't work just like this we might have to install and configure X Server.

First install X via

yum groupinstall "X Window System"
In new Linux Distributions xorg.conf is not needed. Infact It wont be present as well. However in case you need to tweak few things, we can create xorg.conf and the settings will be respected. Read more here. You don't need to touch any of this file for now.

After installing Xserver still you find some Xforwarding issues, follow this  and make sure that you are sshing with -X argument. So finally you are good to go!

PS: This is a guest blog written by Richa Agrawal. You can follow her here  

Thursday, June 27, 2013

How to fix Ubuntu 13.10/13.04 issues on Dell Inspiron 3521

Due to some issues, moved from Lenovo z570 to *new* Dell Inspiron 3521 :P Sadly it has many compatibility issues :( Due to lack of time,  I am just giving you the summary of them. I shall elaborate them later ;)

Again due to lack of time, wasn't successful to set up dual boot :( Accidentally deleted windows 8 and installed Ubuntu on whole harddisk. Have to setup dual boot later. Anyways I hardly use Windows, so it hardly matters ;)

For now, lets fix Ubuntu issues.

Wireless not working -

Heating and fan issues - This is due to incompatibility of Linux with New Video graphic drivers. Due to some reasons, both video cards (ATI Radeon and Integrated Intel Graphics card) are always on. Hence laptop gets heated quickly and battery gets drained very quickly. Hence till bugs are fixed, its better to disable the Radeon graphic card or use it on demand

Fortunately for 13.10, this is very easy - Just install the latest fglrx driver and fglrx-pxpress from the repositories

sudo apt-get install fglrx fglrx-pxpress 

Now in catalyst center, disable the graphics card.

But for 13.04, you need to work a bit - 

After this fix, my battery life increased from ~2 hours to 3+ hours - though it says 4 hours :P And more importantly no more heating issues :P Fan is still rotating a bit fast but much much better than earlier

You can still try more optimizations - and

Brightness Keys not working -

Suspend not working/lock screen doesn't work properly -

Some minor things (for Advanced users)

Few keyboard shortcuts don't work in FF -

Saturday, January 19, 2013

How to make Awoken customization script work in Gnome Shell Ubuntu 12.10

Awoken Icon Set

If you haven't heard of Awoken icon set yet, have a look at this - . Isn't it beautiful ? Undoubtedly, Its one of the best icon sets available for Gnome! What's more awesome is that it can be customised completely! Just run the script


present in the folder to customize it. Everything will run fine but sadly you might not see any change(especially in Gnome shell). If it works, then awesome. If its not working, then read on. For some reason, it didn't work for me.As usual Immediately googled for the fix. Sadly and surprisingly couldn't find any solution. Hence gave it up. After all who will bother why an icon set doesn't work! But finally one day, after getting bored of current icons,  somehow again decided to fix it. Thus began debugging! Finally After spending a lot of  hours, I got a fix. Actually its a tweak :P What you have to do is - After running the customization script on a particular icon set, copy the folder and paste it at same location. Now select the copy rather than the original one while choosing icon set to be applied. It works! Confused ? Let me explain a bit more.

How to fix:

Say you are customizing AwOkenWhite present in ~/.icons

After running the script for customizing white icons, just copy AwOkenWhite folder and paste it in same folder (~/.icons) and rename it (say to AwOkenWhite1) . So now in ~/.icons, you must have two folders AwOkenWhite and AwOkenWhite1. Now in tweak tool, select AwOkenWhite1 instead of AwOkenWhite! You will see it working . Which means, customization script actually ran successfully. But some how changes are not getting reflected. i.e., original copy doesn't work but its copy works! Not sure if its a bug in gnome shell! If you are patient enough, debug it and drop a comment to let us know what's actually happening :)

You can find me at  

Monday, January 14, 2013

Beautiful Vim plugins and vimrc file

"There will not be a single person who do not hate vim on first instance"


"There will not be a single person who do not love vim once they know power of it"

Yes... VIM is that powerful. Know it and I am sure, you will fall in love with it and start using it as your primary editor :) 

It has tons and tons and tons of awesome features! But sadly hidden as is the case with Linux and its relatives :( All you have to know is discover them and enable them. Here is the start :)

Useful Plugins/Features:

Some Tips 

These are already enabled. You can use them directly

My Vimrc file

"Display line numbers
set nu

 "Auto indentation for coding purposes
 set autoindent

"Dont remember these two lines
map :tab split:exec("tag ".expand(""))
map :vsp :exec("tag ".expand(""))

While pasting - no indentation because it can cause problems
set pastetoggle=<F2>

"Set screen title to current filename
let &titlestring = expand("%:t")
if &term == "screen"
   set t_ts=^[k // To create ^[, which is escape, you need to enter CTRL+V  
   set t_fs=^[\ 
if &term == "screen" || &term == "xterm" 
set title 

" Autocomplete on - who doesnt like it!
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType c set omnifunc=ccomplete#Complete

"Auto complete HTML etc
:iabbrev </ </

As with all posts, I shall keep updating the post now and then. Hence follow this post for regular updates.

Finally after a few days of using vim, you will be tempted to add some mappings on your own instead of google search or copying from others :P It is then you become a master and it is then the time to refer to these beautiful guides -

More Tips

Learn vim easily using vimtutor command. The philosophy behind vim is to save time. In the beginning we don't prefer to remember these commands. Its fine, you dont have to ! But once you start coding, when you are typing immediately, you don't prefer to go to enter keys for navigation, you don't prefer to go to insert/delete etc keys to do operations. You want to do things more quickly. Once you think like that, then read this. Believe me, they save a lot of time. This is just the summary of vimtutor


h       l   

x - delete a character
i, a, A (enter insert mode beginning with end of line), o (next line), O previous line
operator [number] notation
d - delete operator
motions : w (next word), e (end of word), $ (end of line), 0 (Start of line)
2w , 3e
dd - delete whole line
u - undo last command, U - to fix whole line
p - paste
c- change = delete+insert
r - replace one character, R multiple
G - end of file, gg - start of file
% - matching paranthesis

ctrl - D - command line completion of vim

Happy viming :)