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 - http://gnome-look.org/content/show.php?content=126344 . 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

awoken-icon-theme-customization

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"

But...

"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=^[\ 
endif 
if &term == "screen" || &term == "xterm" 
set title 
endif


" 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

Navigation

     k
h       l   
     j

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 :) 


Monday, December 10, 2012

Installing Ubuntu 12.10 on Lenovo z570

Finally After working for 2.5 years in Yahoo! I moved to a new Indian startup - ZipDial :) looking for new opportunities, new challenges and new life. Unexpectedly - A challenge came right on the very first day - Installing Ubuntu on my new laptop :P

Generally installing Ubuntu is very easy. I generally remove my entire Windows partition and install Ubuntu Completely. Why the hell does one need Windows anyways :P But as I find out, you need Windows, yes some times ;) When you want to play games :P Hence decided to install Ubuntu along with my Windows partition. Doing this should also be easy, effortless and straight forward. But on some laptops due to various reasons, installing Ubuntu along with windows is not straight forward. Lenovo z570 unfortunately falls under this category. But Dont panic! its not that difficult. Luckily being a hit model, a lot of blogs are already present in internet guiding you. But most of them are little outdated. Hence, In this blog, I am going to fill that gap and help you in installing Latest Ubuntu version as of date - 12.10.

But why ? Why is it such a pain ? Here is the reason : A system can have a total of 4 primary and extended partitions. Inside an extended partition you can have multiple partitions though. Lenovo z570 by default comes with 3 primary and 1 extended partition which leaves no space to install Ubuntu. Hence what we gonna do is shrink a primary partition , get some space, merge the space in extended partition and use that space to install Ubuntu. Don't worry if you haven't understood this! Just follow the steps given below and you will be able to install Ubuntu easily

Firstly, All credits to this blog - http://sezerb.blogspot.in/2012/11/hello-world-installing-ubuntu-to-lenovo.html . Everything you need is here. Follow it and you can install Ubuntu easily. However, its little outdated and few things dont work as written. Since I cannot edit that blog, I am adding the changes here. Read the two blogs simultaneously and install Ubuntu.

  • Before performing step3 - de-fragment your harddisk in Windows (in case you need more space for Ubuntu than it allowed) - using tune up utilities or any other software you like
  • In move extended partition step, if the given procedure doesn't work for you- Do this. While resizing - change the setting of align to (from default MiB) to Cylinder - which sets free space preceding from default 0 MB to some number (3MB around)
  • After installing Ubuntu, still you may not be booting into Ubuntu. Run https://help.ubuntu.com/community/Boot-Repair recommended setup. It may take long time to repair (took few hours for me). And then it said , it was not able to install properly! But don't panic bcz it still works :P Happy dual booting :P 

Finally its done. Awesssssome! But why ? Why do we have to do all this to install some stupid OS ? Because, some good things only come with little effort ;) Believe me, its worth doing this to enter into the beautiful world of Ubuntu (along with Gnome shell instead of Unity :P)
Note: This laptop comes with nvidia-optimus technology. This should work in the following way: Most of the time, the system runs using the Intel graphics, which improves the battery life, and when you need to use more graphic power, it switches automatically to the nvidia card. The problem is that there is no official support of the optimus technology on linux - try bumblee (I haven't tried this. So do it at your own risk!)
Watch this space , I will be updating this blog now and then.

Update 1: Tried to install Nvidia graphic drivers but couldnot succeed even with bumblebee. For now, just disabled graphic card which increased my battery life from default 2 hours to 4+ hours :) [To disable graphic card, in BIOS, press F2 and in second/third section, go to graphics section and change from optimus to other one.]

Saturday, November 24, 2012

A Brief Overview of HTTP, TCP/IP, Push Technologies

 HTTP  1.0 - Normal connection
  • Opens a TCP connection
    • Client sends SYN packet
    • Server receives it and sends SYN ACK
    • Client receives it and sends ACK
  • TCP Connection(3 way handshake) is established. Now it can be used to transfer data
  • Browser sends HTTP Request
  • Server parses the request and sends the response
  • Then connection is closed
For every HTTP request this process repeats. First a TCP connection is established. Then HTTP request is sent and TCP Connection is closed.

From HTTP 1.1 ,persistent connections(Keep Alive) started which means after one HTTP request/response, the TCP connection is not closed. The same connection can be used for another request there by eliminating the need of handshake for future requests.

(Dont confuse persistent connection characteristic with stateless protocol characteristic of HTTP which says that server doesnt store any information about client. It's just that in persistent connections, same TCP connection is used for another request,no information is stored on server which makes it still stateless)

 PUSH Technology - Can be done in muliple ways

  • HTTP Server push - Generally the web server does not terminate a connection after response data has been served to a client. The web server leaves the connection open so that if an event is received, it can immediately be sent to one or multiple clients
  • Pushlet - In this technique, the server takes advantage of persistent HTTP connections and leaves the response perpetually "open" (i.e. it never terminates the response), effectively fooling the browser into continuing in "loading" mode after the initial page load would normally be complete. The server then periodically sends snippets of JavaScript to update the content of the page, thereby achieving push capability
  • Long polling - Long polling is a variation of the traditional polling technique and allows emulation of an information push from a server to a client. With long polling, the client requests information from the server in a similar way to a normal poll. However, if the server does not have any information available for the client, instead of sending an empty response, the server holds the request and waits for some information to be available. Once the information becomes available (or after a suitable timeout), a complete response is sent to the client. The client will normally then immediately re-request information from the server, so that the server will almost always have an available waiting request that it can use to deliver data in response to an event.

Saturday, November 10, 2012

Games In Ubuntu

http://askubuntu.com/questions/28738/what-new-games-are-available-for-ubuntu-in-2011

UPDATE :  Looks like there is a blog dedicated for this!  Follow http://ubuntuvibes.com/ for all latest updates about gaming on Ubuntu.


Easy Easy Easy! Its all about making life easy!


In olden days, we used to do every task manually. Be it booking movie tickets, transferring funds or shopping or many things. Then computers came and eased our work. Well, some like it and some dont! But one has to admit that computers really simplified our work a lot (making us lazy too :P).

But.... In order to simplify things in outside world, we need to code in computer world. It involves designing a webpage by starting with html tag, setting up database , designing schema etc etc etc which is not yet simple! Isn't it ? Looks like, we still haven't yet avoided the task of manual work! Even after many years! Don't you think ?

If you agree, then you are wrong. Because time has changed. Time is gone when you need do everything manually. To simplify things, to simplify coding, to setup a online site - be it a blogging site or ecommerce one or a internal social network, lot of tools are available which can you make use of to do your stuff. Here I present you few such tools which I am sure can save your months of work :) Enjoy!

I will not be giving you extensive opinion about each and every tool since one can find it easily online,instead I will be just giving you the list of options available.Feel free to add yours in comments :)



  • Blogging - Wordpress, Drupal, Joomla
  • Ecommerce - ATG, Hybris, Magento (Java platforms are preferred , though PHP platforms are available too) .  For More info, check this
  • Social Networking - Dolphin, Buddy press. For more Info,  Check this
  • Internet telephony (IVR) - Kookoo
  • Making beautiful presentations -  prezi
  • Databases - MongoDB, Cassandra (alternative to MySQL)
  • Cross browser issues Taking advantage of cool new web technologies is great fun, until you have to support browsers that lag behind. Modernizr makes it easy for you to write conditional JavaScript and CSS to handle each situation, whether a browser supports a feature or not. It’s perfect for doing progressive enhancement easily. - http://modernizr.com/
  • For load balancing, PUSH notifications - http://nginx.org/en/
  • python webserver for push notifications - http://www.tornadoweb.org
  • Apache Ant (to build and deploy the site after a push)
  • Android testing on different devices - http://testdroid.com/
  • Data Visualization tools - http://selection.datavisualization.ch/ Most importantly - D3.js, Google charts
  • Timeline - http://timeline.verite.co/
  • 3D visualisation tool for source control repositories: https://github.com/acaudwell/Gource
  • Javascript - Jquery, JsPlumb
  • CSS - Twitter bootstrap(framework) along with http://fortawesome.github.com/Font-Awesome/, Normalize CSS, Reset CSS, Jquery UI, Kendo
  • Blogs - Tumblr
  • HTML5 framework - HTLM5 Boilerplate (default template) which you can extend to use others like Twitter bootstrap etc
  • Python - Jango framework
  • PHP - CakePHP framework, Croogo
  • python SQL toolkit ORM - SQLAlchemy
  • Book turn HTML5 effect- Turnjs
  • Conditional resource loader - yepnopejs
  • Creating videos/animations - http://wideo.co/
  • MVC frameworks for Javascript - Ember, Backbone, Angular 

      Conclusion: In one word, don't try to start everything from scratch. For learning its fine, you can start from scratch. But if you really wanted to do some cool project, look for tools already available in Internet. Because in the end its the project that matters  the most, not anything else. I bet you will find atleast one for everything!  Happy Tooling :)

      Sunday, October 7, 2012

      How to fix Dual booting issues! (Windows 7 + Linux/Ubuntu)

      In this blog, I am going to demonstrate you the most complex scenario that can happen. Not everyone may fall in this category, but if you learn how to come out of this, then you can easily come out of every other scenario ;)

      One of my friends have Dell XPS 13 Ultrabook, a good looking white computer ;) but only with 120 GB hard disk :(  and no CD drive as well !  Out of which nearly 20 GB was eaten by Windows Recovery partition! Damn Windows, Isn't it ? :P And One day she decided to install Ubuntu on it. So me being genius ;) have suggested to delete the recovery partition and install Ubuntu on it (Why the hell does one want to waste 20% on recovery which never works when needed the most :P) And then boom! The worse thing happened!

      (Impatient folks can directly jump to summary to get the fix)

      Installed Ubuntu successfully. Good! But ...... After restarting, its booting directly into Ubuntu without presenting any options. Since I know a little bit about Ubuntu, I knew that one has to restore grub after installing Ubuntu on a windows machine. So I copied Ubuntu on a USB flash drive and followed this guide, using recommended option, restored grub. The Commands I used to restore grub are

      sudo add-apt-repository ppa:yannubuntu/boot-repair
      sudo apt-get update
      sudo apt-get install -y boot-repair
      boot-repair


      (And selected recommended repair)

      Now grub appeared ! I can see some options. But ...... sadly windows option didnot appear in the grub. On Quick Googling, I found out that windows might be corrupted.It might not be your case though! Check with boot-repair forums or Ubuntu forums given below.   And learn't that, I have to first fix windows to appear in grub menu. What happened here is, recently, Windows started placing some of its important boot files(bootmgr) which are necessary for booting up of windows on recovery partition instead of Standard C partition. Weird! But yeah, thats how windows is :P Since I deleted it, Windows is not booting. So I googled and found out various links for repairing bootmgr files. One good link I found is - this

      But I neither have windows Image nor CD drive. So, using windows 7 OS image from internet installed on a pendrive, I tried to repair the windows with above guide. But ......  unfortunately it didnt work! So Googling began again ! Later I found out that before applying the fix, I first have to make C partition active . Done. Then I followed the previous procedure again to restore windows boot loader . And finally windows is booting! yayyyyyyyy! And now, I am booting directly into windows and Linux is not appearing :( Then using Ubuntu on pendrive, I followed the above guide to restore the grub. And finally everything works now. Grub - Dual boot - Both Linux and Windows showing in menu .  Wowwwwww awesome! Finally :) Thank god! Problem is solved :)


      Few more details for interested ppl


      When a system starts, control first goes to BIOS - The first screen you see (showing Dell/HP logo). Then the control goes to MBR (master boot record 0-512bytes of the harddisk). In MBR, partition table as well as boot loader code (necessary for booting up of OS - also called as bootstrap code) is present. Windows have its own bootloader and Ubuntu have its own (GRUB).A hard disk can have max 4 primary partitions or 3 primary + 1 extended partition. Extended partition can be further divided into multiple extended partitions. In case of GRUB, after control goes to MBR, it loads GRUB stage1 which inturn loads stage 2. And from GRUB, depending on users selection, it either loads Linux Kernel (first loads VBR of the linux partition which inturn loads Linux Kernel) or control goes to Windows bootloader.VBR is first sector of a partition.It contains code to load an operating System present in that partition

      Note: Everyone might not need to follow all the below mentioned steps.
      • After installing ubuntu on a windows box, fix grub using boot-repair using Ubuntu image on pendrive. If everything works fine,and both windows and ubuntu are appearing,  then you are lucky. Go and sleep. If you are not that lucky read on.You cannot sleep now :P
      • In case windows is not appearing, it might be corrupted (neednot be true in all cases though)
        • Then First fix windows . Till then it wont appear in grub
          • Try repair using  this.  If it didnt work (as in my case) then
            • First Make C partition active using - this
            • Then repair windows using the repair guide in above step. If it says success, then you will be able to boot into windows!
        • Now windows is fixed.
      • But you will notice, sadly grub is gone . You cannot boot into ubuntu now. No worries.Its very simple. Just use Live ubuntu CD and using boot repair, restore grub using this
      • Now Everything should work fine! If not , hmmm, you are still not lucky. Apart from googling ,try to post in forums given below.

      Valuable Resources

      • In case you have some issues with windows 7 - You can ask here
      • In case you have some issues with boot repair of Ubuntu - you can ask here
      • You can also get some help from here
      • And last but not least, you can find awesome help from here

      Happy Dual booting :)

      PS: Oops forgot to add an important disclaimer: I just shared my experiences so that it can help others. I am not responsible if you followed this and anything wrong happens and bla bla bla. Just kidding :) Check with someone else too before applying the above fixes :) Special thanks to Seven forums, askubuntu, boot-repair devs for helping me in fixing my issue :)