February 12th, 2008 by darrend
Treetop was one of the more exciting projects I saw at last year’s RubyConf. Nathan Sobo’s Treetop talk is available online and I urge you to watch it. Nathan did a great job of explaining the basics of syntactic analysis, and then got into the specifics of using Treetop’s implementation of parsing expression grammars to put the concepts to work.
Treetop appeared to gather all the concepts together into an understandable domain specific language. All of the tokenization and node structure can go into a single file, and the interactive nature of Ruby makes for the perfect sand box. I felt like I could get somewhere if I invested just an hour into this. I was happy to find that my impressions were correct.
After a short time I had caught on enough to start writing my own code. Once over the hump the rest was easy. I was able to write and test a Treetop grammar for parsing CSV files within a few hours. I chose CSV parsing because I was already familiar with the format, and I could compare my implementation to not just one but two existing Ruby libraries.
Read the rest of this entry »
Posted in ruby | No Comments »
January 30th, 2008 by steveny
Capistrano is a tool for automating tasks via SSH on remote servers. It has many uses, I (and many others) use it to deploy their (rails) applications. The best I can tell there is no built in way to deploy a branch from your source code control system. There are a couple ways of accomplishing this. I chose passing in the branch as a parameter to the Capistrano command:
cap --set-before branch=testbranch deploy
Read the rest of this entry »
Posted in ruby, system administration | No Comments »
January 11th, 2008 by steveny
Ajax can bring a much more responsive and intuitive feel to web applications. However, many times developers overlook error cases when using Ajax. What if the request fails? In one particular case a user’s session may have timed out before they made an Ajax call. This post describes one such way of handling this in a somewhat friendly way.
Read the rest of this entry »
Posted in ajax, java, javascript | No Comments »
April 26th, 2007 by darrend
A client site still uses cvs, the ever trusty version control system. After what seemed a run of the mill merge I noticed this:
C lib/jt400_3_3.jar
cvs update: move away lib/jt400_3_3.jar; it is in the way
Very peculiar. That file hadn’t changed on the branch. I googled around and an explanation started to come together.
First, from the always excellent Roedy Green’s Java & Internet Glossary on Mindprod:
CVS is disturbed by the appearance of repository files it did not put there. Your best bet is simply to delete the entire directory containing the offending file by hand, and re checkout or reupdate the directory to build the necessary entries. Then you can add the files safely.
Then, I found this mailing list post:
This means the file that CVS wants to checkout exists on the local machine but CVS never created the file in the past. This it isn’t CVS’s file and it complains rather than blindly overwriting.
The solution everywhere was the same: just blow away the directory and check it out again. Worked for me. Now I need to puzzle out how it happened in the first place…
Posted in system administration, utilities | 1 Comment »
April 22nd, 2007 by darrend
If you have a model that uses set_table_name you may hit a snag when trying to use fixtures and unit tests. The solution is twofold: name the fixture file using the legacy table name, and use the set_fixture_class method in your unit test. I coudn’t find this method mentioned in Agile Web Development with Rails, and there’s only a brief mention on the rubyonrails.com site. Still, some web searches turned up the answers.
Here is a simple example:
Read the rest of this entry »
Posted in Uncategorized, rails, ruby, systems integration | 2 Comments »
April 18th, 2007 by steveny
I have seen several examples of sending email using oracle with non-ascii characters floating around the Internet, but few seem to tackle sending these ’special’ characters in both the subject and the body. Many also take a shortcut and use 8bit transfer encoding for the body. I am 99.9% sure that this will work on today’s mail servers, but basic SMTP only really needs to support 3 transfer encodings - 7bit ascii, base64, and quoted-printable.
Read the rest of this entry »
Posted in Oracle | 3 Comments »
April 12th, 2007 by carsonm
There have been a couple recent enhancements to sitemaps that everyone should start using.
The first is that Google now supports embedding kml data into sitemaps. This allows you to provide a hint as to where information is related to geographicaly as well as more detailed information to be used in popups on the map. For more information on how to make the integration see the maps sitemap API page. We already support sitemaps in our content management solution and we will be integrating this new mapping feature as well.
The second new feature added has to do with getting your sitemap included in search engines. Now all search engines that support sitemaps will inspect your robots.txt file for a pointer to your sitemap. This should remove the need for everyone to submit their sitemap to every search engine. You may still want to submit your sitemap because there are nice tools from engines like Google that let you investigate more information about your site but now you won’t have to if all you are looking for is your site to be crawled correctly.
Posted in seo | No Comments »
April 11th, 2007 by carsonm
If you ever need to work with something other than a day when using sysdate you are in luck. As it turns out you can work on sysdate with fractional days. This is just what a person needs when they want to do something like:
SELECT mycol FROM sometable WHERE sometimestamp < "30 seconds ago"
The main trick here is to know that sysdate math is based in days and fractional days work. Here are a few examples:
Remove hours from a date:
sysdate - hours/hours in a day
Remove minutes from a date:
sysdate - minutes/(hours in a day * minutes in an hour)
or
sysdate - minutes/minutes in a day
Remove seconds from a date:
sysdate - seconds/(hours in a day * minutes in an hour * seconds in a minute)
or
sysdate - seconds/seconds in a day
The example above would be:
SELECT mycol FROM sometable WHERE sometimestamp < sysdate - 30/(24*60*60)
Posted in Oracle | No Comments »
April 6th, 2007 by carsonm
A few days ago Google made their “My Maps” announcment and since then there has been nothing but buzz buzz buzz about it. So I figured I would take a minute to show how someone can use this new tool from Google to create their own embedded maps for their site.
Read the rest of this entry »
Posted in gis | 7 Comments »
April 3rd, 2007 by steveny
We had the need to hook up a simple ruby web process (non-rails) to our production apache server. As Leslie Hensley pointed out, fcgi and scgi are on the way out, and mongrel + mod_proxy_balancer is the new way to go. We use mongrel extensively in our rails deploys, but always just used WEBrick to do simple serving. To make a long story short, we had to ask ourselves….is mongrel that much better (and in this case better == faster) than WEBrick?
Read the rest of this entry »
Posted in apache, ruby | 3 Comments »