Tuesday, September 13, 2011

Jquery: Get Focus on First Field of Form

Put this in jQuery Document Ready event and you will get focus on Forms first field.

$("form:not(.filter) :input:visible:enabled:first").focus();

This is very useful when there are many forms.

Monday, April 4, 2011

Bulk Resize of Images. - Linux

Want to do easy and quick Resize of bulk Images.  below command is the best solution.

To run below command, ImageMagick needs to be installed.

find ./ -name "*.jpg" -exec mogrify -resize 50% {} \;

Above command will navigate to the all the Folder and Subfolder and shrink all jpg(s) to 50%.

Reseed or Reindex Primary Key - SQL Server

Dealing with database sometimes requires to Reindex the Identity Column or Primary Key to Reindex.

Below is the command or Query to be run on SQL Server to Reseed / Reindex Identity column for SQL Server.

DBCC CHECKIDENT (tablename, reseed, 10)

Above statement will return current max value and reseed the identity from the value given as last parameter.

Here 10 is value to start from.

Friday, December 24, 2010

Creating Password Protected Webpage / Website

Some time if you want your website or webpage to be displayed to selected people or you do not want other people to see what is behind the Page. That time you need to create password protected Site.

So today I decide to share basic steps for the same.

1. You need to create file named - .htaccess
2. Write below code in .htaccess

AuthUserFile /yourserver/fullpath/where.htpasswdresides/.htpasswd
AuthGroupFile /dev/null
AuthName "Whatever Name you want to displayed with Prompt "
AuthType Basic

require user Usernameyouwant 

3.  create .htpasswd file on your linux system by typing command.

 htpasswd -c .htpasswd Usernameyouwant  

4. Upload both file to server.

There is also online utility available here: http://www.tools.dynamicdrive.com/password/

Thursday, December 16, 2010

Ant Philosophy by Jim Rohn

I was surfing the web and I came across to very good resource of Jim Rohn's Ant Philosophy. I have decide to share with you all.

Ant Philosophy divided into 4 parts, mentioned below :

1. Never Give Up
2. Look Ahead
3. Stay Positive
4. Do All You Can

Courtesy: The Ant Philosophy  Read full story here.

Wednesday, December 15, 2010

True ;)

Programming teaches us to be good managers. !!!

Monday, December 13, 2010

YSlow - Plugin for Firefox & Website Optimization

There are tools to check the website performance. I mostly use Firebug to get overall time taken to load resource.

However one another good plugin is YSlow. Take a look and try it out.

Courtesy: Firefox addon

Monday, December 6, 2010

Extract compress files on Server using PHP

Hey All,

Sometimes we need to upload large files and folders to server and it takes long time to complete. To make this process faster and simpler you can uncompress the files using one line of code using PHP.

<? exec("gunzip -x filename.zip"); ?>

You first need to upload the zip on server, make sure to give proper path in PHP code. 

You can also compress Server files using below command.

<? exec("zip -x filename.zip  Foldername"); ?>

Please note, execution of above code tested on PHP running on Linux / Unix Server.