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.
Sunday, July 12, 2009
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.
Wednesday, June 24, 2009
My Ubuntu 9.04 Setup for Rails Development
The what, why, and how of bringing up an Ubunto 9.04 box for development...I currently do primarily Ruby on Rails development so that is what you will find here along with the various tools I use to get the job done. The steps are listed below. You can find a file with the apt-get commands I use here. You can also find a file for the gem commands I use here, however, you will have to install rubygems manually before kicking that one off as I have had problems with the Ubuntu package management and rubygems in the past. Here are the full details:
| what? | why? | how? |
|---|---|---|
| update your system | you just installed | sudo apt-get update && sudo apt-get upgrade |
| add the terminal to your launcher panel | quick terminal access | applications -> accessories -> right click on terminal, click add launcher to panel |
| get gtk to use emacs keys | you can't type without this | run gconf-editor, set /desktop/gnome/interface/gtk_key_theme to "Emacs" |
| change the caps lock to a control | you can't type without this | system -> preferences -> keyboard -> layouts -> layout options -> ctrl key position -> make capslock an additional ctrl |
| install emacs | you can't work without this | sudo apt-get install emacs |
| add the emacs to your launcher panel | quick emacs access | applications -> accessories -> right click on emacs, click add launcher to panel |
| generate a private / public key pair | you are going to use this to connect to github among other | ssh-keygen -t rsa |
| install git | you can't work without this | sudo apt-get install git-core |
| set up public key for github | typing passwords repeatedly won't work | follow instructions at github |
| install subversion | you can't work without this | sudo apt-get install subversion |
| bring in your bin/ and dotfiles from git | all your common stuff | hmmm, need to expand on this later |
| install emacs extensions rhtml, rinari, yasnippet, and yasnippets-rails | useful emacs extensions | ummmmm, check them out from github / google code dropping them in your .emacs.d/ directory |
| install build-essential | every developer needs this at some point to build something | sudo apt-get install build-essential |
| install ruby development environment | its your dev environment! | sudo apt-get install ruby rdoc ri libopenssl-ruby ruby1.8-dev irb |
| install mysql | common database for development | sudo apt-get install mysql-server mysql-client libmysqlclient15-dev |
| install odbc and tds | development against SQL Server | sudo apt-get install unixodbc unixodbc-dev tdsodbc freetds-dev libodbc-ruby1.8 |
| configure your odbcinst.ini for development with dsn-less connections | development against SQL Server |
edit your /etc/odbcinst.ini to look like this:
[FreeTDS] Description = TDS driver (Sybase/MS SQL) Driver = /usr/lib/odbc/libtdsodbc.so Setup = /usr/lib/odbc/libtdsS.so CPTimeout = CPReuse = FileUsage = 1 |
| install ruby odbc stuff | will need this to work with odbc connections | sudo gem install dbi dbd-odbc |
| install libxml dev | will need this to install libxml-ruby | sudo apt-get install libxml2-dev |
| install rubygems | its your ruby packaging system! (not trusting apt-get for this yet, been burned before) | download the latest tgz, unpack, and run sudo ruby setup.rb |
| symlink gem to gem1.8 | you don't want to have to remember to type gem1.8 all the time | cd /usr/bin && ln -s gem1.8 gem |
| install capistrano | rails deployment nirvana | sudo gem install capistrano |
| install some of the gems you will be using | rails development | sudo gem install rails mysql libxml-ruby mongrel |
| install firebug | web development | go get it |
| install git_remote_branch | makes common git tasks dead simple | sudo gem install git_remote_branch |
| install the flex sdk | gotta compile flex stuff | go here download the sdk and data visualization components unzip them in a flex_sdk_3 directory and make a flex symlink to that directory |
| install tofrodos | unix2dos, damn windows line endings | sudo apt-get install tofrodos |
| install java tools | yes I work with java | sudo apt-get install sun-java6-jdk ant |
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.
Monday, June 22, 2009
Don't Miss Aloha on Rails!
You don't want to miss the Hawaii Ruby On Rails Conference - Waikiki, Oahu, Hawaii - October 5-6 2009. The speaker list is impressive and still growing. The venue is awesome and is only a short (really short!!!) walk from Waikiki beach. The economic downturn is making flights to Hawaii very reasonable right now. This conference is being primarily organized by Seth Ladd, a Honolulu based RoR developer and great co-worker of mine. There is an Aloha On Rail Blog featuring the latest information. The latest post features another great co-worker of mine, Honolulu Hacker Kevin English in a clip on why you should come to Aloha on Rails. Why Aloha on Rails???
This is a no brainer - register now! |
Friday, June 19, 2009
Rails Bug in *_changed?
UPDATE: The latest rails has fixed this problem but this problem was still present in Rails 2.2.2.
The new dirty methods in Rails show this interesting result:
The above code has position as a nullable integer column. When parameters come in a post via the parameters hash position comes across as a string. For 14 you get the Rails goodness and assigning "14" is not seen as a change - but why not the same thing for 0?
The problem is in the following offending code in vendor/rails/activerecord/lib/active_record/dirty.rb file. I have commented out the problem line (look for the no!!!!...) and added what I believe to be the correct code below it:

