I haven't done an "angry" post for a while and since I don't want to close down this blog, so I'll posit there is something unique about the Ruby community which compels folks to write lame defenses of their favorite language the way that doesn't seem to occur for other languages. I never saw this with Python or Perl, but it mostly seems to ooze from converts from Java/C++ or God-forbid PHP.
There, done, filled my quota!
P.S. - for "h3rald" or anyone else, you won't have any problem with Python if you use a decent editor like Vim and have it configured properly.
Tuesday, September 11, 2007
Saturday, September 8, 2007
The Future of Ruby is JRuby?

While fighting with ActiveRecord-JDBC (I thought Derby was built in JDK 1.6, but I still have to copy the derby .jar's into jruby/lib ???) this morning I ran across Ola Bini'a Blog and an a great prezo on JRuby. If you read between the lines (I obviously didn't see/hear the prezo) but Ola seems to be suggesting the future of Ruby is indeed JRuby. Slide after slide there are aspects of C-Ruby that are broken (and will not be fixed in 1.9) but where Java is superior : GC, performance (maybe), multi-core, internationalization, etc.
Monday, September 3, 2007
Ruby Only Netbeans Builds: Nothing to Be Angry About

I've never used IDEs that much (with the exception of Visual C# a while back} but I downloaded the latest build of the the Netbeans Ruby IDE. and it was amazing how fast it loaded without all that useless Java crap that causes the progress bar to take soooo long on the full-featured Netbeans 6.0 preview releases.
Sunday, September 2, 2007
Absolutely Worthless JRoR Benchmark: Tomcat 5.5 vs. Glassfish v3
So for grins (not worth much else, was looking for something to pass the time before my kids went to sleep) I decided to compare initial page load times for the hello world between Tomcat and Glassfishv3 using the Arun Gupta's tutorial app
Tomcat 5.5.23
Initial Load: 3.229s
Subsequent Loads: 0.115 0.323 0.323s
Glassfish v3
Inital Load: 9.671s
Subsequent Loads: 3.005 0.554 0.594s
Webrick
Initial Load: 1.278s
Subsequent Loads: 0.559s 0.623
For Webrick is the time to boot it was about 3-4 times as long as it took to start Tomcat and deploy app through the manager (no more than 10 seconds) but for Glassfish, deployments took anywhere from 29-52 seconds.
Not like it really matters, but the hardware/software: VMWare Debian 4.0 JRE1.6 running on aging AMD K7-1.5 with 1.2GB RAM.
Tomcat 5.5.23
Initial Load: 3.229s
Subsequent Loads: 0.115 0.323 0.323s
Glassfish v3
Inital Load: 9.671s
Subsequent Loads: 3.005 0.554 0.594s
Webrick
Initial Load: 1.278s
Subsequent Loads: 0.559s 0.623
For Webrick is the time to boot it was about 3-4 times as long as it took to start Tomcat and deploy app through the manager (no more than 10 seconds) but for Glassfish, deployments took anywhere from 29-52 seconds.
Not like it really matters, but the hardware/software: VMWare Debian 4.0 JRE1.6 running on aging AMD K7-1.5 with 1.2GB RAM.
franz-g4:~ mdfranz$ time wget http://192.168.100.91:8080/hello/say/hello
--19:30:56-- http://192.168.100.91:8080/hello/say/hello
=> `hello.4'
Connecting to 192.168.100.91:8080... connected.
HTTP request sent, awaiting response... 200 OK
Length: 86 [text/html]
19:30:59 (1.61 MB/s) - `hello.4' saved [86/86]
real 0m3.229s
user 0m0.002s
sys 0m0.009s
JRuby and Embedded Derby: First Steps
Before tackling ActiveRecord-JDBC I thought I'd play around with the embedded version of Apache Derby with JRuby. This actually took me a lot longer that it should of, mostly because its been months since I've done anything with JRuby and years since I've touched JDBC. But here are the basic steps, which probably aren't that much difference from any other JDBC in JRuby:
Some of the things that tripped me up, as I was trying to convert the simple Java example to JRuby:
require 'java'
include_class "java.sql.Connection"
include_class "java.sql.DriverManager"
include_class "java.sql.ResultSet"
include_class "java.sql.Statement"
driver = org.apache.derby.jdbc.EmbeddedDriver.new()
conn = DriverManager.getConnection("jdbc:derby:derbyDB;create=true")
conn.setAutoCommit(false)
s = conn.createStatement()
Some of the things that tripped me up, as I was trying to convert the simple Java example to JRuby:
- The Class.forName(driver).newInstance() nonsense, I guess I've never run across this convention before but probably not surprising since I'm not a Java developer
- org.apache.derby.impl.jdbc.EmbedSQLException: Derby system shutdown - yes you should do a DriverManager.getConnection("jdbc:derby:;shutdown=true") and yes it apparently always throws an exception
- Getting useful results sets back is where I spent most of my time. Fortunately Derby documentation (like most Apache projects) are among of the best of any, whether commercial or Open Source APIs.
Saturday, September 1, 2007
JRuby/Rails on Glassfish Actually Works!
So traffic was so bad on Thursday I popped open my Powerbook on the Edens spur (I swear it took me an hour to go 3 miles) and listened to Java Posse 138 which had a lengthy (but quite excellent interview with several Sun developers from Glassfish. Java Posse is an excellent podcast. I wish there was something of comparable quality on Ruby, but no time for that rant.
Besides the performance improvements (indeed the startup time is quite amazing compared to JBOSS, Geronimo, or Sun's appserver) they mentioned running JRuby apps and I ran across this blog entry on running interpreted rails apps within Glassfish v3 and the Grizzly connector.
I had to make few changes to get it working to Linux-ify the tutorial (had to create a symlink within glassfish/lib to point to the jruby directory) but it was relatively straightforward on Debian 4.0, (JRuby 1.0.1 and jdk1.6.0_02)
Here the slight differences:
I set the environment variables in .bashrc
Install rails (added --no-ri)
Modify glassfish/config/asenv.conf instead of asenv.bat
Make asadmin exectuable (chmod u+x/700)
Besides the performance improvements (indeed the startup time is quite amazing compared to JBOSS, Geronimo, or Sun's appserver) they mentioned running JRuby apps and I ran across this blog entry on running interpreted rails apps within Glassfish v3 and the Grizzly connector.
I had to make few changes to get it working to Linux-ify the tutorial (had to create a symlink within glassfish/lib to point to the jruby directory) but it was relatively straightforward on Debian 4.0, (JRuby 1.0.1 and jdk1.6.0_02)
Here the slight differences:
I set the environment variables in .bashrc
JAVA_HOME=~/jdk6
JRUBY_HOME=~/java/jruby
GLASSFISH_HOME=~/java/glassfish
PATH=$PATH:$JAVA_HOME/bin/:$JRUBY_HOME/bin:$GLASSFISH_HOME/bin
Install rails (added --no-ri)
# jruby -S gem install rails -y --no-ri --no-rdoc
Modify glassfish/config/asenv.conf instead of asenv.bat
JRUBY_HOME="/root/java/jruby"
Make asadmin exectuable (chmod u+x/700)
Saturday, August 25, 2007
Ruby Statistics Functions
The StatArray class provides some basic statistical operations to be used on arrays:
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'statarray'
=> true
irb(main):003:0> a = [1,2,3,4,6]
=> [1, 2, 3, 4, 6]
irb(main):004:0> sa = a.to_statarray
=> [1, 2, 3, 4, 6]
irb(main):005:0> sa.mean
=> 3.2
irb(main):007:0> sa.median
=> 3
Subscribe to:
Posts (Atom)
