I believe that JRuby is the most crucial technology for Ruby's future right now. Regardless of how fast or how solid the C or C++ based Ruby implementations get, the vast majority of large organizations are *never* going to run them. That's the truth. If we can leverage JRuby to grab 1-2% of the Java market, we'll *double* the size of the Ruby community. If we completely lose the Java platform to alternatives, Rubyists may not have the luxury of remaining Rubyists in the future. It's that big a deal.
Tuesday, August 4, 2009
Ruby stands or falls with JRuby?
Headius makes an interesting argument
Friday, October 31, 2008
Headius on FFI
As usual Headius is the shit
Take that SWIG! Although IIRC, .NET (including Mono) had some this sort of coolness as well.
To break it down
FFI stands for Foreign Function Interface. FFI has been implemented in various libraries; one of them, libffi, actually serves as the core of JNA, allowing Java code to load and call arbitrary C libraries. libffi allows code to load a library by name, retrieve a pointer to a function within that library, and invoke it, all without static bindings, header files, or any compile phase.
Take that SWIG! Although IIRC, .NET (including Mono) had some this sort of coolness as well.
To break it down
A simple FFI script calling the C "getpid" function:
require 'ffi'
module GetPid
extend FFI::Library
attach_function :getpid, [], :uint
end
Sunday, October 12, 2008
Nanite: Ruby Cloud Computing
Over on Ruby Inside Peter blogs on Nanite which really looks interesting -- not that I'll have any time to play around with it anytime soon.
Sunday, October 5, 2008
Ruby HTTP Client Performance
Courtesy of Ruby Inside there is a pretty interesting analysis of Ruby 1.8.x client performance
Ruby’s Net::HTTP implementation blows. It’s a bit better in 1.8.7 with the new 16K buffer size, but the timeout implementation has got to go. Even with timeout eliminated, Net::HTTP is trounced by the pure-Ruby rfuzz and the native/Ruby blend curb, suggesting that timeout notwithstanding, there are other inefficiencies in Net::HTTP. Looking at the protocol.rb code, I’m struck by how painfully inefficient the implementation is with buffers. rfuzz and curb minimize buffer copies and my rfuzz streaming HTTP extension reuses the same buffer for multiple calls, while Net::HTTP is happily appending and sliceing away at arrays.
Wednesday, September 24, 2008
Headius and the Elephant
At Cisco we used to have the phrase "No Technology Religion" on our badges and although this is easier said than done, it is the thought that counts (to double up on cliches).
It is the religious fervor (intolerance of diversity and the belief in one path to enlightenment vs. many ways to climb the mountain) that seems to be one of the differences. between between the Python & Ruby communities:
The is illustrated in the The Elephant from earlier this month:
It is the religious fervor (intolerance of diversity and the belief in one path to enlightenment vs. many ways to climb the mountain) that seems to be one of the differences. between between the Python & Ruby communities:
The is illustrated in the The Elephant from earlier this month:
I don't see this in the Python community, for example, which might surprise some Rubyists. Pythonistas seem to have positively embraced both IronPython and Jython. There's no side-chatter at the conferences about the evils of anything with a J in it. There's no mocking slides, no jokes at Jython or IronPython developers' expense. No "Python elite" cliques actively working to shut Jython or IronPython out, or to discourage others from considering them. The community as a whole--Guido included--seems to be genuinely thankful for implementation diversity. Even if one of them does have a J in it.
Tuesday, July 1, 2008
Matasano on Ruby Vuln Handling
A must read if you need something to be angry about.
Developers relying on any of these frameworks are then faced with a difficult choice: wait an indeterminate amount of time for a good release from the official maintainers (and remain vulnerable in the meantime), or apply a patch from a third-party which may not plug all the security holes, or may include unforeseen bugs. This is clearly a problem. In the meantime maintainers have to scramble to get ruby back to a good state that actually plugs the holes while people complain. Everyone loses.
Monday, May 26, 2008
21 Ruby Tricks
Haven't blogged here forever (mostly using Python these days, although I did break into some JRuby a couple of weeks back to avoid Java coding) but definitely check out 21 Ruby Tricks from Peter Cooper.
Regex, Array Joins, file operations, and more
Good stuff..
Regex, Array Joins, file operations, and more
Good stuff..
Sunday, April 27, 2008
Headius on the Peril
The Promise and Peril of Alternative Implementations is a must read, if only for his detailed summary of the Ruby implementations out there, but on the peril's:
JRuby
IronRuby
Say I wonder if anyone has written a Ruby implementation in Python, hehe
JRuby
Compatibility is *hard*. I'm not talking a little hard, I'm talking monumentally hard. Ruby is a very flexible, complicated language to implement, and it ships with a number of very flexible, complicated core class implementations. Very little exists in the way of specifications and test kits, so what we've done with JRuby we've done by stitching together every suite we could find. And after all this time, we still have known bugs and weekly reports of minor incompatibilities. I don't think an alternative implementation can ever truly become "compatible" as much as "more compatible". We're certainly the most compatible alternative impl, and even now we've got our hands full fixing bugs. Then there's Ruby 1.9 support, coming up probably in JRuby 1.2ish. Another adventure.
IronRuby
But there's some peril here too. IronRuby is largely still being developed in a vacuum. Perhaps in order to have secrets to announce at "the next big conference" or perhaps because Microsoft's own policies require it, IronRuby's development process proceeds largely from all-internal commits, all-internal discussions, and all-internal emails that periodically result in a blob of code tossed over the fence to external contributors. The OSS story has improved, since those of us on the outside can actually get access to the code, but the necessary two-way street still isn't there. That's going to slow progress, and eventually could make it impossible for IronRuby to keep up as resources are moved to other projects at Microsoft. JRuby has managed to sustain for as long as it has with only two fulltime developers entirely because of our community and openness, and indeed JRuby would never have been possible without a fully OSS process.
Say I wonder if anyone has written a Ruby implementation in Python, hehe
Have you started working on your Ruby implementation yet? All the cool kids are doing it. It's remarkable how many implementations of Ruby are in the works right now. It remains to be seen whether the ecosystem can support such diversity in the long term, but at the very least they're introducing splendid variation. And there's a lot more to do with Ruby in terms of performance, scaling, and "getting things done". Ruby's future is looking bright, in no small part due to the many implementations. How's your favorite language looking?
Friday, April 25, 2008
Sad to Say It But I miss Ruby
So I'm writing a quick CRUD app for work and I decided to go with Django mainly because of the power of the built in Admin interface. This is not a real app. I just wanted to get some data in a database and maybe generate some simple reports, so Rails didn't make sense. It would take too long. Plus, following the Django tutorial for the umteenth time during the last couple of years gave me 80% of the functionality I needed in just a few hours. Yeah Django migrations are non-existent and there is not Model inheritance, but since this isn't a real app (basically something quick where a wiki or Excel wouldn't do) I was left with no choice.
But I definitely miss the density of Ruby.
But I definitely miss the density of Ruby.
Monday, March 3, 2008
Yeah, I'd Give Greg Brown Sixty Bucks
And I'm not being sarcastic, either. Maybe it would just be a vicarious pleasure because with 3 kids, a year oold Honda Minivan and overpriced Skokie house there is no way in hell I could live on $2000/month. Or maybe because there's a bunch of cool Python (non-web) libraries that should be ported to Ruby. If I'm willing to give Obama $50 I'm certainly willing to give Greg Brown $60 To work on Open Source
I find myself in a rather unique situation: Single, living alone in a small studio apartment, only taking a class or two here and there, and basically living off of small contracts. It’s not that I’m not offered big gigs, or that I couldn’t go back to school full time if I really wanted to, I just find I enjoy living a simple lifestyle that lets me spend a lot of time on community oriented projects, especially Ruby stuff.
Saturday, February 23, 2008
RUSH is On To Something
Courtesy of Ruby Inside I ran across Rush: The Ruby Shell
What we really want - the modern way - is to query the unix system (filesystem, processes, network, services) as if they were a database. This avoids the fragility of text pipes, the complexities of firing up a complete new environment on each system call, and would allow unit tests of system-level code.
This is why I've created rush. It's a replacement for bash and ssh which uses Ruby syntax. More than that: it IS ruby. Imagine an irb shell in which you can do everything you can do at the unix command line, but without any backticks. That's the vision; what I've got so far is a good start in that direction.
Friday, February 8, 2008
Tuesday, January 1, 2008
Now this guy is really angry (and also switching back to Python)
Rails is a Ghetto is even harsher than anything I've written here:
This is that rant. It is part of my grand exit strategy from the Ruby and Rails community. I don’t want to be a “Ruby guy” anymore, and will probably start getting into more Python, Factor, and Lua in the coming months. I’ve got about three or four more projects in the works that will use all of those and not much Ruby planned.
This rant is full of stories about companies and people who’ve either pissed in my cheerios somehow or screwed over friends. I can back all of them up from emails, IRC chat logs, or with witnesses. Nothing in here is a lie unless it’s really obviously a lie through exaggeration, and there’s a lot of my opinion as well.
Hat Tip: Mr. Brown and response to Zed.
Hey wasn't Zed in Pulp Fiction?
Wednesday, November 28, 2007
Where is the PSI for Ruby?
About every 6 months a Google recruiter will run across my LinkedIn page and try to trick me into starting the grueling 2-3 month interview process. Why anyone with a job already would put themselves through this is beyond me, but it did get me thinking about Python again and to catch up on my Python Package Index Feed (which kicks RubyForge's ass, BTW) and I ran across the Python System Information. I had to write this sort of stuff (and more) in Ruby about 6 months ago. That is the different between Python (and grudgingly Perl, gag) and Ruby. Some sort of mainstream task is probably already done (and relatively)
Not that I'm complaining
Not that I'm complaining
>>> import psi
>>> a = psi.arch.arch_type()
>>> a
>>> isinstance(a, psi.arch.ArchMacOSX)
True
>>> isinstance(a, psi.arch.ArchDarwin)
True
>>> a.sysname
'Darwin'
>>> a.nodename
'laptop'
>>> a.release
'8.9.1'
>>> a.version
'Darwin Kernel Version 8.9.1: Thu Feb 22 20:55:00 PST 2007; root:xnu-792.18.15~1/RELEASE_I386'
>>> a.machine
'i386'
>>> psi.loadavg()
(0.705078125, 0.73046875, 0.7626953125)
>>> import os
>>> mypid = os.getpid()
>>> mypid
13903
>>> p = psi.process.Process(mypid)
>>> p.command
Friday, October 12, 2007
Cool Ruby Logfile Visualization Tool
Check out glTail.rb (there is even a movie) that I stumbled across courtesy of Peter Cooper over on Ruby Inside:
I can't wait to try it on a few gigs of firewall logs.
glTail is a great little Ruby script by Erlend Simonsen (aka Fudgie) that uses OpenGL and Ruby to visualize the events taking place in log files in real time. An example video on the official site shows requests coming into an HTTP server, each represented by a "ball" which is thrown across the screen. The script uses net-ssh to connect to a server and then libopengl-ruby to output the graphics. Parsers are included for processing Apache, Rails, IIS and Postfix log files. Nice work! The code is merely a couple hundred lines of Ruby, so if you've fancied putting together a basic OpenGL app, it's worth looking at it for that reason too.
I can't wait to try it on a few gigs of firewall logs.
Friday, September 28, 2007
Trying out jrubyc
Following up the good news, I pulled down trunk, and compiled a stupid 2 line script. This obviously is no test of the compiler, but the first time I've used jrubyc. Above and beyond the normal JRUBY environment stuff, to execute classes you have to add jna.jar and jruby.jar to your CLASSPATH.
franz-g4:~/jruby/jruby/trunk/jruby/bin mdfranz$ java bobo
1.1
java
franz-g4:~/jruby/jruby/trunk/jruby/bin mdfranz$ ls -al bobo.class
-rw-r--r-- 1 mdfranz mdfranz 2866 Sep 28 09:43 bobo.class
franz-g4:~/jruby/jruby/trunk/jruby/bin mdfranz$ cat bobo.rb
puts JRUBY_VERSION
puts RUBY_PLATFORM
franz-g4:~/jruby/jruby/trunk/jruby/bin mdfranz$ echo $CLASSPATH
:/Users/mdfranz/java/lib/hsqldb.jar:/Users/mdfranz/java/db-derby-10.3.1.4-bin/lib/derby.jar:/Users/mdfranz/java/db-derby-10.3.1.4-bin/lib/derbytools.jar:.:/Users/mdfranz/jruby/jruby/trunk/jruby/lib/jruby.jar:/Users/mdfranz/jruby/jruby/trunk/jruby/lib/jruby.jar:/Users/mdfranz/jruby/jruby/trunk/jruby/lib/jna.jar
franz-g4:~/jruby/jruby/trunk/jruby/bin mdfranz$ echo $JRUBY_HOME
/Users/mdfranz/jruby/jruby/trunk/jruby
Wednesday, September 26, 2007
If you are angry enough you might get a book!

So I was pleased to learn that I will be receiving a review copy of Practical JRuby on Rails Web 2.0 Projects: Bringing Ruby on Rails to Java. Thanks Ola if you had anything to do with it!
No time (and probably not qualified) right now to do a real review, but I will say that Chapter 6 (Java Integration) and the Appendix B (JRuby Reference) are probably worth the 21 bucks for the e-version of the book, even if you don't plan on doing any JRoR work right now.
Tuesday, September 25, 2007
JRuby Enum Constants and my irrational fear of ::'s
So development on PeerTAB is rolling along. Sort of. I am continuing to play with JXTA via JRuby.
So in Java
manager = new NetworkManager(NetworkManager.ConfigMode.EDGE, "HelloWorld");
But of course in JRuby
include_class "net.jxta.platform.NetworkManager"
m = NetworkManager.new(NetworkManager.ConfigMode.EDGE, "HelloWorld")
fails with
irb(main):010:0> NetworkManager.ConfigMode
NoMethodError: undefined method `ConfigMode' for Java::NetJxtaPlatform::NetworkManager:Class
from (irb):10:in `binding'
from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:150:in `eval_input'
from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:70:in `signal_status'
from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:147:in `eval_input'
from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:70:in `each_top_level_statement'
from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:146:in `loop'
from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:146:in `catch'
from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:146:in `eval_input'
from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:70:in `start'
from :1:in `catch'
from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:69:in `start'
from :1
So the question then I how do I get these enum constants?
So interestingly enough
irb(main):020:0> NetworkManager.constants
=> ["ConfigMode"]
irb(main):021:0>
But that did get me anywhere and it was only until I ran across this blog post that I figured it out.
irb(main):011:0> NetworkManager::ConfigMode
=> Java::NetJxtaPlatform::NetworkManager::ConfigMode
irb(main):012:0> NetworkManager.constants
=> ["ConfigMode"]
irb(main):013:0> NetworkManager.constants.class
=> Array
irb(main):014:0> NetworkManager::ConfigMode::EDGE
=> #
irb(main):015:0>
And I know part of the problem is I refuse to use :: unless I'm forced to because it seems way too Perl-ish and ugly. And yeah, I've heard there is something called C++.
So in Java
manager = new NetworkManager(NetworkManager.ConfigMode.EDGE, "HelloWorld");
But of course in JRuby
include_class "net.jxta.platform.NetworkManager"
m = NetworkManager.new(NetworkManager.ConfigMode.EDGE, "HelloWorld")
fails with
irb(main):010:0> NetworkManager.ConfigMode
NoMethodError: undefined method `ConfigMode' for Java::NetJxtaPlatform::NetworkManager:Class
from (irb):10:in `binding'
from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:150:in `eval_input'
from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:70:in `signal_status'
from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:147:in `eval_input'
from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:70:in `each_top_level_statement'
from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:146:in `loop'
from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:146:in `catch'
from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:146:in `eval_input'
from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:70:in `start'
from :1:in `catch'
from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:69:in `start'
from :1
So the question then I how do I get these enum constants?
So interestingly enough
irb(main):020:0> NetworkManager.constants
=> ["ConfigMode"]
irb(main):021:0>
But that did get me anywhere and it was only until I ran across this blog post that I figured it out.
irb(main):011:0> NetworkManager::ConfigMode
=> Java::NetJxtaPlatform::NetworkManager::ConfigMode
irb(main):012:0> NetworkManager.constants
=> ["ConfigMode"]
irb(main):013:0> NetworkManager.constants.class
=> Array
irb(main):014:0> NetworkManager::ConfigMode::EDGE
=> #
irb(main):015:0>
And I know part of the problem is I refuse to use :: unless I'm forced to because it seems way too Perl-ish and ugly. And yeah, I've heard there is something called C++.
Monday, September 24, 2007
Interesting Bruce Tate Podcast
I listened to Robert Stephenson's interview with Bruce Tate while washing dishes tonight and it was certainly a treat and certainly kept my mind occupied while cleaning up the minestrone remnants:
Among the highlights:
Check it out...
Among the highlights:
- How development in Rails (and I would add comparable frameworks such as Django) allows smaller teams to communicate more effectively (and frequently) with clients than would be possible with "traditional" languages such a Java.
- The high correlation between offshoring/outsourcing and traditional (waterfall) development models (if you outsource something you have to be more rigorous in the your specification, your unit testing, integration, etc.)
- Lots of talk about JRuby and positing that much of the work we do is essentially scripting. Use of JRuby with Business Rules Engines/DSLs (such as Drools) which is something I've wanted to play around with yet. As well as using a Java scripting languages to access cool APIs.
Check it out...
Tuesday, September 11, 2007
I didn't want indentation to break my code?
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.
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.
Subscribe to:
Posts (Atom)
