java

JRuby – can’t convert Hash into String

I’ve recently upgraded a JRuby/Rails application from JRuby 1.6.3 (1.8 compatibility mode) to 1.6.8 (1.9 mode). Everything was working out fine except for actions relying on internal CSV library (FasterCSV in 1.8 mode). The error “ was thrown as CSV tries to generate the csv string. This had the hallmarks that the application was still under the 1.8 mode...

newrelic – undefined method `-’ for nil:NilClass

Using JRuby with trinidad (developer mode) – I was intermittently getting this error. Apparently thrown as estimated_time for the transaction was returning nil. I was also having all sorts of other issues (undefined method `metric_name’ for nil:NilClass) with all newrelics action summaries. To resolve (following suggestions on the trinidad google group): {% highlight ruby %} config/initializers/newrelic.rb if defined?(JRUBY_VERSION) &&...

NoMethodError: undefined method `eq’ for nil:NilClass

JRuby 1.5.2 Rails 3.0 activerecord-jdbc-adapter 0.9.7 This issue arises when setting table name with a schema name prefix. For those in the know – this is a must-have if you’re connecting to oracle using a non-owner username (activerecord-jdbc-adapter). {% highlight ruby %} class Model < ActiveRecord::Base set_table_name ‘.<table>’ end` </table></ts_code> Now – tracking this down led to lib/arel/engines/sql/relations/table.rb `def...

Java for the forever beginner (II)

If your JSP code is almost 2/3rd pure Java code, then you’re doing something wrong.  One easy way of knowing Java code from HTML/Snippets is to look at the PALE GREEN (see image for color tone). If the pale green is more than the white – then you must be joking. If you move the green parts to become...

Rails vs The 7 Frameworks

This has nothing to do with comparing 8 different frameworks. It’s just to tell the horror story of one of our down-the-drain projects. The client came with an old product that he needed to add new features to. The product does, what is best described as CRUD operations. Nothing challenging, nothing difficult. It maintains a set of data for...

Pyramids, Application. An Analogy

Working on maintaining and modifying a five year-old Java application, I came to realize there’s a strong relation between legacy and pyramids. Here’s an analogy: | Pyramids are HUGE monuments, built for the sole purpose of being a tomb to one person. Although the project tree is HUGE (14000+ files), the purpose of the application is amazingly modest (CRUD...

Multiple-Application Login

I’m trying to handle an integration between a humongous code-base Java application (doing basic stuff) with a new Rails application (talking about injecting Rails transparently). Handling login (multi-application logins) was my first obstacle, and after talking with Steven and Brenton, I came up with the following implementation: 123456789101112131415161718192021require ‘rubygems’require ‘hpricot’require ‘mechanize’class WelcomeController < ApplicationController… def login agent = WWW::Mechanize.new...

Ruby on Rails – Lunch and Learn

Last Friday was my Ruby on Rails presentation at Commerx Corporation (in Lunch and Learn series). It wasn’t as good as I wanted, but, wasn’t too bad either. Some keys on the laptop were in the on-again-off-again mode, so, I had to rely on an external keyboard and use the touchpad at the same time (not a very recommended...

RoR-DB2/400 – Not There Yet

Breaking the silence – this was posted by “tprentis” on IBM forum for DB2 on Rails Toolkit I’m a recent convert to Ruby on Rails. My organization has several (over 50) iSeries machines on our WAN. As MIS manager, I plan to start pushing RoR development in the near future but really need that DB2 iSeries connector running. Please...

EGJUG First Meeting

I have attended the First EGJUG meeting and it was a good kickstart. EGJUG is an attempt to bring together Egyptian Java enthusiasts, help promote Java in Egypt, and raise the skills of Java developers. With 290+ members and only around 10 attending the first meeting, the group needs a hell lot of marketing. There’s also a good chance...