Avik’s Ruminations

Musings on technology and life by Avik Sengupta

Wrapping Java to Ruby

without comments

So, java by far has the largest set of libraries and components out there. However, if Ruby is your favourite language, but you bemoaned the lack of libraries, bemoan no longer. Help is at hand…
Only if you wanted to write excel files from Ruby. I just checked in the POI Ruby Bindings , which allows you to create Excel files from Ruby.

Using a GCJ compiled, SWIG wrapped Ruby extension, this provides all Ruby users access to a large (and, might I say, great) Java library.

The inspiration for this project came from PyLucene, so thanks to the OSAF folks. Also thanks to Lyle Johnson for taking me over a small but crucial roadblock over at the SWIG lists.

Written by

February 18th, 2005 at 10:11 pm

Posted in Technology

Hieraki

without comments

Using an idea that is obvious only in retrospect , Hieraki is a cool new application that does a simple job well. Maybe using Rails has something to do with this.

Take a wiki, and constrain its structure into a hierarchy, and you have a perfect solution for maintaining technical documentation. You get the benefit of distributed editing, without having to strain to retain a semblance of structure to guide your reader. Highly recommended. Its a niche that is far from crowded, even though there are thousands of wiki implementations out there. While many of the proprietary document management solutions are moving in this direction, Hieraki is the only open source app that I know of in the ‘use a wiki to write a book’ space.
In true open source fashion, of course, some goodness has started to flow from external contributions – I’ve been motivated to submit a patch for creating XSL:FO: (from which you can generate PDF’s) here, while a system for fine grained access control has been submitted here.

Written by

February 3rd, 2005 at 2:18 am

Posted in Technology

Do you think this is cool?

without comments

irb(main):001:0> require 'release/poi4r'
=> true
irb(main):002:0> h=Poi4r::HSSFWorkbook.new
=> #
irb(main):003:0> s=h.createSheet("Sheet1")
=> #
irb(main):004:0> r=s.createRow(0)
=> #
irb(main):005:0> c=r.createCell(0)
=> #
irb(main):006:0> c.setCellValue(24)
=> nil
irb(main):007:0> c.getNumericCellValue()
=> 24.0
irb(main):008:0> c.setCellValue("blah")
=> nil
irb(main):009:0> c.getNumericCellValue()
RuntimeError: error calling poi
java.lang.NumberFormatException: You cannot get a numeric value from a String based cell
at org.apache.poi.hssf.usermodel.HSSFCell.getNumericCellValue() (...../release/poi4r.so)
at ruby_exec (/usr/lib/libruby.so.1.8.2)
at ruby_run (/usr/lib/libruby.so.1.8.2)
at main (Unknown Source)
at __libc_start_main (/lib/tls/libc-2.3.4.so)
at _start (Unknown Source)
from (irb):9:in `getNumericCellValue'
from (irb):9
irb(main):010:0> c.getStringCellValue()
=> "blah"
irb(main):011:0>


The exception should give you an idea of whats going on. Currently just a proof of concept. Real thing coming to a repository near you… any time now!

Written by

January 28th, 2005 at 3:15 pm

Posted in Technology

Closures etc

without comments

Martin Fowler provides an succinct summary of Closures with some fairly useful but simple examples. While trying to explain Closures or Higher Order Functions to Java or C developers, one quite often struggles to respond to “oh I can do that using function pointers and/or anonymous inner classes”.

Well, you can’t, not only because you need proper lexical scoping to have real fun, but also because the non-intrusiveness of defining them in the language is as important. However, some of these subtleties may be difficult to grasp without actually writing some code. So the next time you are explaining all this to a Java programmer, and are feeling too lazy to come up with real life examples, point them here.

Written by

September 13th, 2004 at 11:29 am

Posted in Technology

More Site Changes

with one comment

A scary attack of comment spam last night, 100’s of hits! Some fortifications created, lets see if it works.

I’ve also added a sidebar with a list of books I’ve been reading, mainly to motivate myself to keep the list churning. I dont do as much reading these days as I’d have hoped, which is a shame.

Written by

August 31st, 2004 at 4:41 pm

Posted in Technology

Surprise!

without comments

I recently acquired two networking products. One, a no-brand USB WiFi adaptor (which, from its FCC Id turned out to be a TwinMOS product), as well as a Banyan Networks DSL modem (as part of a DSL service by the “local telecom incumbent“. I was pleasently surprised to find both products, in their driver install CD’s, had a directory called Linux!

So, while I was ready for a bit of mucking around in /proc , and a few hours of fun with kernel compilation, it turned out real easy.

Maybe world domination isnt an unlikely goal any more! 🙂

Written by

August 26th, 2004 at 5:19 pm

Posted in Technology

IKVM

without comments

O’Reilly ONJava has published an article on IKVM which I hope conveys my excitement about this technology.

Think about it… you’ve had no chance to find open source projects providing you the functionality of FOP and POI if you were writing code in C#. IKVM lets you do that, and I think it’s a pretty deal. And that’s the reason I am so excited about that project.

In case you are wondering about the choice of FOP as an example, since, unfortunately, FOP requires a small patch on its last released version to work with IKVM (the “have you tested your code being loaded by the BootClassloader?” issue that afflicts many alternative VM’s), while POI works out of the box (at least for simple stuff) … well, can’t have all my articles talk about POI!

Update:

1. Discussion on TheServerSide

2. Jeroen likes the article 🙂

Written by

August 18th, 2004 at 9:06 pm

Posted in Technology

Ruby on Rails

with one comment

I just discovered Rails yesterday, and today I find that Chad Fowler makes it the RubyGem of the Month. There has been some very good reports on Rails.

I’ve been learning/playing with Ruby for some months now, and have all but given up on other languages for my scripting needs, but Rails will probably be the incentive to start on a meatier project in Ruby.

The trouble, from my point of view, is that very soon after starting to program in Ruby, you start wondering why ResultSet cannot take a code block and call into it for every row! And that results in needless frustration everytime you have to write Java code :).

Recently however, I was forced to wade through a bunch of strcpy, so Java feels like heaven right now!

Written by

August 17th, 2004 at 9:40 pm

Posted in Technology

JDJ

without comments

Ryan and I have co-written an article on POI that appears in this months Java Developer Journal.

Written by

August 6th, 2004 at 12:32 pm

Posted in Technology

More RSS Woes

with one comment

I’ve “written earlier”:http://www.sengupta.net/musings/archives/000002.html about my travails looking for a good RSS aggregator. Since then, I have been a happy user of “Bloglines”:http://www.bloglines.com for many months. Together with a “subscribe bookmarklet”:http://www.bloglines.com/help/easysub, it succeeds very well at what I think is the most important feature of an RSS aggregator: low overhead. It just works!
Recently however, a few applications on our intranet have started producing RSS. And suddenly, Bloglines doesnt cut it any more! So I’m off again on more adventures in RSS land. Maybe bloglines should open source its engine? 🙂

Written by

July 28th, 2004 at 8:32 pm

Posted in Technology