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 - http://askubuntu.com/questions/289609/dell-3721-wifi-problem-ubuntu-13-04/289614#289614

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 - 
 http://www.askubuntu.com/questions/205112/how-do-i-get-amd-intel-hybrid-graphics-drivers-to-work 

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 - http://www.webupd8.org/2011/06/linux-kernel-power-issue-fix.html and http://www.webupd8.org/2013/04/improve-power-usage-battery-life-in.html


Brightness Keys not working - http://askubuntu.com/questions/162776/screen-brightness-of-dell-inspiron-n4050-is-not-changing

Suspend not working/lock screen doesn't work properly - http://ubuntuforums.org/showthread.php?t=1978290

Some minor things (for Advanced users)

Few keyboard shortcuts don't work in FF - http://ubuntuforums.org/showthread.php?t=1353231



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