Snippet
Find the Calling Class
Posted March 28th, 2008 by administrator
Here is a simple snippet to find out the calling Java Class.
Class.forName(new Throwable().getStackTrace()[2].getClassName()));
Compute size of Mysql database with it's tables
Posted February 5th, 2008 by administratorSo the size of the database is sum total of size of its individual tables.
Size of database = Sum of {Individual Table Size}
Recursively Convert Gif Images To Jpg
Posted December 26th, 2007 by administrator
Converting images from gif to jpg for web or other reason can be done easily using the ImageIO package. The following snippet convert all the gif images in directory rootDir to jpg images.Compile this class and execute using java command line. This utility class is also available as part of the Livrona Tools Project.The following is the code for the Image Converter.
Clean up Rail Sessions
Posted August 16th, 2007 by administrator
By default rails does not clear out stale sessions from the session store. Depending on the configuration session can be stored in the local file system or the database.
Retrieve Page Contents via Http Get
Posted August 16th, 2007 by administrator
This script retrieves the content of url and dumps it to the output
Example copy this script into file named : get_page.rb
#!/usr/bin/ruby
require 'net/http'
host,port,url = ARGV
http = Net::HTTP.new(host, port)
STDERR.puts "url {#url}"
response, data = http.get(url)
puts data
Usage
ruby get_page.rb <host> <port> <url>
The url is specified as a relative path