September72011

Awesome Bike Riding trip

No more work after 5:00 PM and leave office for Surat. Thats what i do on friday but it was different this time as family went to sister’s place and had to decide to be here in concrete jungle so called financial capital of India : Mumbai.

I was talking to Gunju (also known as Gunjan) regarding work and he said he has to leave @ 9:00 PM. I asked why and got my answer of how to spend this weekend. It was Bike Riding Trip.  Though we knew that we would be leaving for a place that we four heard first time and was very hard for us to even remember the name called Bhandar Dhara Dam and Malshej Ghat, none of us care about it. All we were interested was the journey not the destination :).

Like most indian we too started late. Three hour later than what we planed i.e. 9:00 AM in saturday morning. And rain was also equally excited to give us the company. Thanks to traffic that we could get out of mumbai before our enthusiasm dies in the city itself. And then it started.

Riding enfield @ the speed of 80+ on highway was first time experience after seven year old victor ride on surat-baroda highway. But thats not we would like to satisfied with. So took different and bit longer route that passes thorough outskirts. here it is.

Mountains covered with green fields, water falling from the top, curved roads crossing them, tunnel shaping the mountains like mouth and train running through it, river passing along the way when you look below, slow raining. All these i used to draw when i asked to draw natural scene in school. Today we were part of that drawing. It was amazing view.

It was so much of fog that we could hardly see 200 meter site ahead of us on Nasik highway. Similar situation on Malsage ghat but it was heavy raining. High beam light coming from heavy vehicles on high way in night was the third reason who made our trip bit adventures as well. Only way we could drive in these situation was to follow any four wheeler going ahead of us and luckily we succeed.

What a great way to spend weekend. Thanks to Gunju, Rohit, Ankush.

April52010

Productive shortcuts in Vim

I used to use Vim from quite some time. But not more than basic cursor movement and small editing. whenever i need to perform some basic operation on the content, i used to open the file into the Textmate/Editplus. And that remained me unproductive in Vim till now. Small googleing has give me the frequently required shortcuts for the Vim. 

NAVIGATION

* gg  :  Beginning of file, Shift+g : end of file

* {/}  :  Next/Previous paragraph

* w   :  The next word

* b/e  :  Begin/End of the current word. (B/E : for space separated only)

* 0/$  :  Begin/End of line

COPY/CUT/PASTE/SEARCH/REPLACE

* 3yy  :  Copy (yank) 3 lines

** yy is equal to 0y$. So you may use y$ to copy content from cursor position to end of line.

* yW  :  Copy word

* 3dd  :  Cut 3 lines

* p  :  Paste

*  */#  : To find current word

* r  :  Replace character, shift R  : Replace word

MISC

* ma  :  Mark as a , ‘a : to go to marker

* v  :  Visual mode

* ~  : Changes case.

* J  : Joins two lines

* Ctrl+A / Ctrl+X  : Increments/Decrements a number.

* .  :  Repeat last command (a simple macro)

* A  : To end of line and insert mode

* ‘.  :  Jump back to last edited line.


March122010

ABC of VACUUM in Postgres

PostgreSQL databases require periodic maintenance known as vacuuming. VACUUM and VACUUM FULL are the two commands for it. Below are the some basic details about them.

VACUUM

  • Marks the space for future use but doesn’t return reclaimed space to OS.
  • No need of acquiring exclusive lock, so it can be performed on production DB without taking down-time.

VACUUM FULL

  • Reclaims the space and gives it to OS.
  • Needs to acquire exclusive lock on table. So you need to take downtime to perform this.
  • It compacts the table by moving the data and indexes across the pages. Thought the index size gets increased while in action because the old indexes gets deleted only after new indexes gets created.

Tips

  • VACUUM creates significant amount of I/O traffic. So better to do in low usage time frame of your DB.
  • Frequent VACUUM runs are a better approach than infrequent VACUUM FULL runs for maintaining heavily-updated tables. 
  • TRUNCATE removes entire content without requiring a subsequent VACUUM. Preferable to use it for a table whose entire contents are deleted regularly
  • Preferable to run ANALYZE to update planner statistics.

More

March32010

Testing Schema : Give me your garbage

Apart from our growing business, another reason for increasing our DB size was ‘Temporary tables’. Whenever we needed to fetch data that required complex queries, we used to create temporary tables on the same db to fetch the data easily by making join on the other tables. They were increasing not only the db size but back up size also.

Responsiveness of websites has become very important these days. Not only does it make users stick to your website, it also makes them go through the website very quickly. This can result in direct revenue for the websites like facebook. More page the user visits, more ads the site can display to them.

We decided to move our database to flash drives to achieve responsiveness. This clearly required us to reduce the database size. By spending almost two days I listed temporary tables and made sure that they were not used by the application.

Creating a separate schema instead of live (public) schema for this kind of usage is a better approach. Because you can make joins on tables across schemas, queries to fetch data will remain same as before. Also by excluding the temporary schema from the backup process wont increase the backup size.

February212010

Firefox Keywords=Chrome search engines

This is for keyboard friendly users. Recently i switched to google chrome from the firefox because of Chrome’s advantage over firefox. I am surprised when i didn’t find some thing like ‘keywords’ in firefox. By googleing i found that ‘Search engines’ in chrome is similar to ‘Keywords’ in firefox.



Keywords

* Bookmark the page you wont to use frequently.

* Go to ‘property’ by right clicking the new bookmark, add the keyword.

* You can now refer the page by just typing the keyword in address bar.

Search engines

* Right click in address bar

* Add search engines. The name,keyword and url are similar as firefox.



Example

* you may add keyword ‘w’ for http://en.wikipedia.org/wiki/Main_Page to access it by just typing ‘w’ in address bar.

* It can also take search parameter. Lets say you have searched ‘yahoo’ in wikipedia, which will result in the url ‘http://en.wikipedia.org/wiki/Yahoo’. This can be parametrized while creating bookmark by adding ‘http://en.wikipedia.org/wiki/%s’ in URL.

* Now to search any thing in wikipedia just type ‘w searchstring’. i.e. w Microsoft.

Firefox shortcuts

February142010

Burn CD/DVD in Mac

As accepted everything in the mac is very easy, with the exception of burning CD/DVD. Given the fact that almost all Macbook has only one CD/DVD drive, only option remained to you to duplicate CD/DVD is to copy image and then burn it.

Disk Utility is the software to get this done. Below are the steps.

1. Insert the CD/DVD which you wont to duplicate (Make sure its not copy protected).

2. You will find the CD/DVD name in left panel of ‘Disk Utility’. With the name selected, Go to  File->New and create the image of inserted CD/DVD.

3. I would suggest to select the ‘Image Format -> Read Only’ to speed it up.

4. Will see the image in left panel once the image gets created.

5. Select the image and burn it. It will ask you enter blank CD/DVD.

6. Select the values of the different options as you required and you are done.

March282009
“What you want is not always what you need”

quote 

Page 1 of 1