I've written a handy Google Chrome extension for jQuery developers. The extension allows you to bring up a console window and run Javascript and jQuery commands against the current web page. It is great for learning or experimenting with jQuery. I call the extension the jQuery Shell and it can be found here. The source code can be found here. Here is a screen shot for your viewing pleasure:
Google Chrome has a really nice extension framework.
A couple of other useful Javascript tools (not Chrome extensions) I've discovered on the web lately are http://jsfiddle.net and http://jsbin.com/.
Monday, February 01, 2010
Sunday, January 31, 2010
Truncate all Tables in a MySQL Database Revisited
Since this old post still manages to get a fair number of hits I thought I should fix it up to encourage people to not reveal their MySQL passwords in history logs and process lists by entering it on the command line. The new version uses getopts for parsing command line options. If you pass in "-p", it will prompt you for your database password for each mysql command. If you really want the old bad behavior then "-P password" will do the trick. Enjoy:
It is also possible to put your password in your my.cnf file to have it picked up automatically. You can read more about MySQL password for version 5.4 security here.
It is also possible to put your password in your my.cnf file to have it picked up automatically. You can read more about MySQL password for version 5.4 security here.
Sunday, January 10, 2010
Java enum and Static Variables
I've been moving back into the world of Java after some time with Ruby...surprisingly (to me anyway) Java enums don't have access to static variables within the enum in the enum constructor. For example, this will fail to compile with an illegal forward reference when attempting to use the static constant:
I haven't found a work around for this that I am comfortable with. Defining the static constants elsewhere seems quite ugly.
The same problem occurs if you want to set up a static cache during construction as well. This can be worked around with a static initializer:
I haven't found a work around for this that I am comfortable with. Defining the static constants elsewhere seems quite ugly.
The same problem occurs if you want to set up a static cache during construction as well. This can be worked around with a static initializer:
Sunday, July 12, 2009
Searching for Wildcard Characters in SQL
Been a while - a quick flush...you may have a need to search for the wildcard characters "_" and "%". When that happens you need to know how to escape them. This has slightly different behavior for different database products. MySQL and SQL Server do work the same way, however, if you stick to using the ESCAPE clause.
Friday, July 03, 2009
No Peeking in the Javascript Deque
Wednesday, July 01, 2009
Javascript Deque
Doubly ended queue code is just a whole lot cleaner if you go with dummy head and tail nodes to avoid special cases. I put together this Javascript example:
A Javascript array has the methods available (push(), pop(), shift(), unshift()) to be used as a deque but of course being an array you shouldn't be adding and removing from anywhere but the tail end if you need top performance. The following provides for a comparison between my deque and a regular Javascript array for adding and removing items from the head or tail of the data structure.
Tuesday, June 23, 2009
JavaScript InfoVis Toolkit
The JavaScript InfoVis Toolkit is another example of a library exploiting Canvas technology. I put together a small demo Rails application that uses the toolkit to provide a dynamic tree view of the Rails application directory structure.
Subscribe to:
Posts (Atom)
