Thursday, January 28, 2010


   UPDATE customer_address SET default_address =1 WHERE address_id = ( 
   SELECT MIN(address_id) FROM (SELECT * FROM customer_address) AS temp
   WHERE customer_id =5 )    

Posted by Posted by WL at 3:21 PM
Categories:

0 comments  

Monday, January 25, 2010


ps -ef | grep -i {process-name} | grep -iv grep | head -1 | awk '{print $2} | xargs kill -9

Posted by Posted by WL at 12:31 PM
Categories:

0 comments  

mount -t iso9660 -o loop disk1.iso /mnt/disk

Posted by Posted by WL at 12:24 PM
Categories:

0 comments  

Add a user :

create user 'user'@'%' identified by 'pass';

Grant privileges :
grant all privileges on *.* to 'user'@'localhost' with grant option;
flush privileges

Set root password for the first time :
mysqladmin -u root password NEWPASSWORD

Posted by Posted by WL at 12:23 PM
Categories:

0 comments  

1. modify XF86Config and load module "vnc"
2. copy over vnc.so to /usr/X11R6/lib/modules/extensions/
3. add Option "SecurityTypes" "None" to Screens section to disable authentication

Posted by Posted by WL at 12:21 PM
Categories:

0 comments  

xargs:
find / -iname "*.mp3" -type f | xargs -I '{}' mv {} /mnt/mp3
find . -name C*.log | grep -e str1 -e str2 | grep -v str3 | xargs /usr/xpg4/bin/grep -e "35=D"


exec:
find / -iname "*.mp3" -exec mv {} /mnt/mp3 \;

Posted by Posted by WL at 11:41 AM
Categories:

0 comments  

Monday, January 18, 2010


Use a proxy.pac for automatic proxy configuration. Here is my file.

function FindProxyForURL(url, host) {
if(isInNet(host, "192.168.*.*", "255.255.0.0")) {
return "DIRECT";
} else if (host == "localhost") {
return "DIRECT";
} else {
return "PROXY localhost:9000";
}
}

This does following :
a. For all requests to ip address 192.168.*.* do not use a proxy and return DIRECT connection
b. For all requests to local webserver do not use proxy and return DIRECT connection
c. For any other requests use proxy server running at localhost:9000

Notes:
* host is NOT the machine requesting a page. Host is the name/ip of remote server
* url is the full url
* alert statement can be used to debug this function. This behaves just like a normal JS function

Posted by Posted by WL at 8:56 AM
Categories:

0 comments  

We wanted to add bug categories to Bugzilla, but there is no such default field. However there is a field that you can turn on called whiteboard (parameters > bug fields > usestatuswhiteboard). This is a text field and you can add whatever tag or category you want in this field. The field appears right below summary field on a bug description page.

To make it appear on the search results is a little bit more involved. The field is stored in a database table as status_whiteboard. So all you need to do is add this field in Constants.pm file (under Bugzilla/). In Constants.pm modify this field : "DEFAULT_COLUMN_LIST".

My DEFAULT_COLUMN_LIST looks like this :

# The default list of columns for buglist.cgi
use constant DEFAULT_COLUMN_LIST => (
"bug_severity", "priority", "status_whiteboard","assigned_to",
"bug_status", "resolution", "short_short_desc"
);

Posted by Posted by WL at 8:51 AM
Categories:

0 comments  

Tuesday, January 12, 2010


To split multi-page tiff file into single page multiple tiff files using imagemagick:

convert multipage-file.tiff singlepage-%d.tiff

Posted by Posted by WL at 4:53 PM
Categories:

0 comments  

Sunday, January 3, 2010


Iphone call log is located under /User/Library/CallHistory in a file named call_history.db. This file is a SQLite database. There is a table named call which holds the log.

There is another table in this database named "_SqliteDatabaseProperties". This table store call log properties in key => value format. One of the property here is call_history_limit which is set to 100 by default. Change that number to something like 500 to store last 500 entries.

You could use a SQLite Manager (firefox add-on) to do this or write a quick java program.

Posted by Posted by WL at 11:29 AM
Categories:

0 comments  

Friday, January 1, 2010


I was doing this for the first time and it took me a hell of time to customize my theme. I am using GAIA NEUE from deviant art. I am also using compiz. I set the gnome panel to be transparent with the color matching wallpaper behind it. Everything worked perfect and the panel looked transparent except the gnome menubar part (application, places, system).

No matter what I did, it wouldn't go transparent and retained the color. After digging through gtkrc and other rc files and spending about and hour here is how I achieved it.

1. In gtkrc file, added a style named toolbar :
style "toolbar"
{
bg[PRELIGHT] = @selected_bg_color
base[PRELIGHT] = @selected_bg_color
}

@selected_bg_color : this means whatever color you selected under your panel settings.
2. Under "widget styles" section, added following

widget_class "*MenuBar" style "toolbar"
class "*MenuBar" style "toolbar"


Yep, that's it. Took me one hour not including time spent (useless) searching on google.

Posted by Posted by WL at 4:50 PM
Categories:

0 comments  

I am not sure what this feature is called officially, but lets call it auto songs preview. In nautilus (gnome file browser) if you go to a directory where your mp3's are displayed move your mouse pointer onto a mp3 file and it will start playing automatically, without launching any player. No need to double click. Hell, don't even need to click. Just point and listen.

I am not sure how I would use it, but I like it anyway.

Posted by Posted by WL at 4:29 PM
Categories:

0 comments  

 
>