tag:blogger.com,1999:blog-31055453921974186482024-03-13T17:35:56.357-07:00Angry Rubyjust because I use it doesn't mean I have to like itMatt Franzhttp://www.blogger.com/profile/00973881935128108475noreply@blogger.comBlogger42125tag:blogger.com,1999:blog-3105545392197418648.post-37055004236758557932009-08-04T05:29:00.001-07:002009-08-04T05:30:26.315-07:00Ruby stands or falls with JRuby?Headius makes an <a href="http://blog.headius.com/2009/07/jrubys-importance-to-ruby-and-erubycon.html">interesting argument</a><br /><blockquote><br />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.<br /></blockquote>Matt Franzhttp://www.blogger.com/profile/00973881935128108475noreply@blogger.com0tag:blogger.com,1999:blog-3105545392197418648.post-55664986118946335322008-10-31T16:53:00.000-07:002008-10-31T16:58:08.719-07:00Headius on FFIAs usual <a href="http://blog.headius.com/2008/10/ffi-for-ruby-now-available.html">Headius is the shit</a><br /><br /><blockquote><br />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.<br /></blockquote><br /><br />Take that SWIG! Although IIRC, .NET (including Mono) had some this sort of coolness as well.<br /><br />To break it down<br /><br /><pre><br />A simple FFI script calling the C "getpid" function:<br /><br />require 'ffi'<br /><br />module GetPid<br /> extend FFI::Library<br /><br /> attach_function :getpid, [], :uint<br />end<br /></pre>Matt Franzhttp://www.blogger.com/profile/00973881935128108475noreply@blogger.com0tag:blogger.com,1999:blog-3105545392197418648.post-19704586387038239592008-10-12T17:12:00.000-07:002008-10-12T17:14:59.480-07:00Nanite: Ruby Cloud ComputingOver on <a href="http://www.rubyinside.com/nanite-self-assembling-cluster-of-ruby-daemons-1245.html">Ruby Inside</a> Peter blogs on <a href="http://github.com/ezmobius/nanite/tree/master/README">Nanite</a> which really looks interesting -- not that I'll have any time to play around with it anytime soon.Matt Franzhttp://www.blogger.com/profile/00973881935128108475noreply@blogger.com0tag:blogger.com,1999:blog-3105545392197418648.post-13084668566258952362008-10-05T09:49:00.000-07:002008-10-05T09:50:55.248-07:00Ruby HTTP Client PerformanceCourtesy of <a href="http://www.rubyinside.com/ruby-18s-dismal-nethttp-performance-1226.html">Ruby Inside</a> there is a pretty interesting <a href="http://apocryph.org/analysis_ruby_18x_http_client_performance">analysis of Ruby 1.8.x client performance</a><br /><blockquote><br />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.<br /></blockquote>Matt Franzhttp://www.blogger.com/profile/00973881935128108475noreply@blogger.com0tag:blogger.com,1999:blog-3105545392197418648.post-71420663529559951662008-09-24T07:38:00.000-07:002008-09-24T07:45:43.210-07:00Headius and the ElephantAt 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).<br /><br />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:<br /><br />The is illustrated in the <a href="http://blog.headius.com/2008/09/elephant.html">The Elephant</a> from earlier this month:<br /><blockquote><br />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.<br /></blockquote>Matt Franzhttp://www.blogger.com/profile/00973881935128108475noreply@blogger.com0tag:blogger.com,1999:blog-3105545392197418648.post-61717551891837628552008-07-01T17:20:00.000-07:002008-07-01T17:21:30.877-07:00Matasano on Ruby Vuln HandlingA <a href="http://www.matasano.com/log/1079/rubys-vulnerability-handling-debacle/">must read</a> if you need something to be angry about.<br /><br /><blockquote><br />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.<br /></blockquote>Matt Franzhttp://www.blogger.com/profile/00973881935128108475noreply@blogger.com0tag:blogger.com,1999:blog-3105545392197418648.post-79854081677280507532008-05-26T14:54:00.000-07:002008-05-26T14:57:04.674-07:0021 Ruby TricksHaven'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 <a href="http://www.rubyinside.com/21-ruby-tricks-902.html">21 Ruby Tricks from Peter Cooper</a>.<br /><br />Regex, Array Joins, file operations, and more<br />Good stuff..Matt Franzhttp://www.blogger.com/profile/00973881935128108475noreply@blogger.com2tag:blogger.com,1999:blog-3105545392197418648.post-35001569027411607442008-04-27T20:32:00.000-07:002008-04-27T20:40:42.081-07:00Headius on the Peril<a href="http://headius.blogspot.com/2008/04/promise-and-peril-for-alternative-ruby.html">The Promise and Peril of Alternative Implementations</a> is a must read, if only for his detailed summary of the Ruby implementations out there, but on the peril's:<br /><br /><br /><b>JRuby</b><br /><blockquote><br />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.<br /></blockquote><br /><br /><br /><b>IronRuby</b><br /><blockquote><br />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.<br /></blockquote><br /><br />Say I wonder if anyone has written a Ruby implementation in Python, hehe<br /><br /><blockquote><br />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?<br /></blockquote>Matt Franzhttp://www.blogger.com/profile/00973881935128108475noreply@blogger.com0tag:blogger.com,1999:blog-3105545392197418648.post-52509249484107405812008-04-25T23:09:00.000-07:002008-04-25T23:19:59.891-07:00Sad to Say It But I miss RubySo 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.<br /><br />But I definitely miss the density of Ruby.Matt Franzhttp://www.blogger.com/profile/00973881935128108475noreply@blogger.com0tag:blogger.com,1999:blog-3105545392197418648.post-73399163147684701102008-03-03T19:18:00.000-08:002008-03-03T19:38:03.863-08:00Yeah, I'd Give Greg Brown Sixty BucksAnd 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 <a href="http://www.oreillynet.com/ruby/blog/2008/03/id_love_to_quit_my_job_sort_of.html">Greg Brown $60 To work on Open Source</a><br /><br /><blockquote><br />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.<br /></blockquote>Matt Franzhttp://www.blogger.com/profile/00973881935128108475noreply@blogger.com2tag:blogger.com,1999:blog-3105545392197418648.post-28995882983757515582008-02-23T17:34:00.000-08:002008-02-23T17:37:58.318-08:00RUSH is On To SomethingCourtesy of <a href="http://www.rubyinside.com/rush-a-ruby-shell-that-abstracts-system-operations-into-ruby-ones-765.html">Ruby Inside</a> I ran across <a href="http://adam.blog.heroku.com/past/2008/2/19/rush_the_ruby_shell/">Rush: The Ruby Shell</a> <br /><br /><blockquote><br />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.<br /><br />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.<br /></blockquote>Matt Franzhttp://www.blogger.com/profile/00973881935128108475noreply@blogger.com0tag:blogger.com,1999:blog-3105545392197418648.post-60317433799913325212008-02-08T05:25:00.000-08:002008-02-08T05:28:02.690-08:00RubyCHeatSheetPalooza<a href="http://www.rubyinside.com/ruby-cheat-sheet-734.html">Courtesy of Ruby Inside</a>Matt Franzhttp://www.blogger.com/profile/00973881935128108475noreply@blogger.com0tag:blogger.com,1999:blog-3105545392197418648.post-57309306255798722762008-01-01T12:37:00.000-08:002008-01-01T12:42:58.875-08:00Now this guy is really angry (and also switching back to Python)<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://zedshaw.com/logo.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 200px;" src="http://zedshaw.com/logo.jpg" border="0" alt="" /></a><br /><br /><br /><a href="http://zedshaw.com/rants/rails_is_a_ghetto.html">Rails is a Ghetto</a> is even harsher than anything I've written here:<br /><br /><blockquote><br />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.<br /><br />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.<br /></blockquote><br /><br /><br />Hat Tip: <a href="http://www.oreillynet.com/ruby/blog/2008/01/zeds_so_expletive_awesome.html">Mr. Brown</a> and <a href="http://www.almostserio.us/articles/2007/12/31/zed-is-so-ghetto">response to Zed</a>.<br /><br />Hey wasn't Zed in Pulp Fiction?Matt Franzhttp://www.blogger.com/profile/00973881935128108475noreply@blogger.com0tag:blogger.com,1999:blog-3105545392197418648.post-12537910083388228432007-11-28T22:25:00.000-08:002007-11-28T22:39:21.808-08:00Where 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 <a href="http://pypi.python.org/pypi">Python Package Index Feed</a> (which kicks RubyForge's ass, BTW) and I ran across the <a href="http://www.psychofx.com/psi/trac/wiki/">Python System Information</a>. 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)<br /><br />Not that I'm complaining<br /><br /><pre><br /> >>> import psi<br /><br /> >>> a = psi.arch.arch_type()<br /> >>> a<br /> <psi.arch.ArchMacOSX object type='Darwin'><br /> >>> isinstance(a, psi.arch.ArchMacOSX)<br /> True<br /> >>> isinstance(a, psi.arch.ArchDarwin)<br /> True<br /> >>> a.sysname<br /> 'Darwin'<br /> >>> a.nodename<br /> 'laptop'<br /> >>> a.release<br /> '8.9.1'<br /> >>> a.version<br /> 'Darwin Kernel Version 8.9.1: Thu Feb 22 20:55:00 PST 2007; root:xnu-792.18.15~1/RELEASE_I386'<br /> >>> a.machine<br /> 'i386'<br /><br /> >>> psi.loadavg()<br /> (0.705078125, 0.73046875, 0.7626953125)<br /><br /> >>> import os<br /> >>> mypid = os.getpid()<br /> >>> mypid<br /> 13903<br /> >>> p = psi.process.Process(mypid)<br /> >>> p.command<br /></pre>Matt Franzhttp://www.blogger.com/profile/00973881935128108475noreply@blogger.com0tag:blogger.com,1999:blog-3105545392197418648.post-59185252269205019762007-10-12T14:57:00.000-07:002007-10-12T15:00:49.061-07:00Cool Ruby Logfile Visualization ToolCheck out <a href="http://www.fudgie.org/">glTail.rb</a> (there is even a movie) that I stumbled across courtesy of <a href="http://www.rubyinside.com/gltail-sexy-log-file-visualization-using-ruby-627.html">Peter Cooper over on Ruby Inside</a>:<br /><br /><blockquote>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.</blockquote><br /><br />I can't wait to try it on a few gigs of firewall logs.Matt Franzhttp://www.blogger.com/profile/00973881935128108475noreply@blogger.com0tag:blogger.com,1999:blog-3105545392197418648.post-30370328181314088722007-09-28T07:50:00.000-07:002007-09-28T07:57:16.249-07:00Trying out jrubycFollowing up the <a href="http://headius.blogspot.com/2007/09/compiler-is-complete.html">good news</a>, 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.<br /><br /><pre><br />franz-g4:~/jruby/jruby/trunk/jruby/bin mdfranz$ java bobo<br />1.1<br />java<br />franz-g4:~/jruby/jruby/trunk/jruby/bin mdfranz$ ls -al bobo.class <br />-rw-r--r-- 1 mdfranz mdfranz 2866 Sep 28 09:43 bobo.class<br />franz-g4:~/jruby/jruby/trunk/jruby/bin mdfranz$ cat bobo.rb <br />puts JRUBY_VERSION<br />puts RUBY_PLATFORM<br />franz-g4:~/jruby/jruby/trunk/jruby/bin mdfranz$ echo $CLASSPATH<br />:/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<br />franz-g4:~/jruby/jruby/trunk/jruby/bin mdfranz$ echo $JRUBY_HOME<br />/Users/mdfranz/jruby/jruby/trunk/jruby<br /></pre>Matt Franzhttp://www.blogger.com/profile/00973881935128108475noreply@blogger.com0tag:blogger.com,1999:blog-3105545392197418648.post-13492809443635874402007-09-26T23:42:00.000-07:002007-09-26T23:53:54.912-07:00If you are angry enough you might get a book!<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8lnauqsDQQuwMDmdC2IGxZW99dhWLSZJxlyI7c97QYQv6YKrfbpiKk8HnUJI7eqfc_fukGofgt5tTSQWk_emoTME06wJdcCpzoftrUubkF8fQekzx2tEjfiNB4aI2FsppO6fIi5tlh-g/s1600-h/olabook.png"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8lnauqsDQQuwMDmdC2IGxZW99dhWLSZJxlyI7c97QYQv6YKrfbpiKk8HnUJI7eqfc_fukGofgt5tTSQWk_emoTME06wJdcCpzoftrUubkF8fQekzx2tEjfiNB4aI2FsppO6fIi5tlh-g/s200/olabook.png" alt="" id="BLOGGER_PHOTO_ID_5114773485413996738" border="0" /></a><br />So I was pleased to learn that I will be receiving a review copy of <a href="http://apress.com/book/view/9781590598818">Practical JRuby on Rails Web 2.0 Projects: Bringing Ruby on Rails to Java</a>. Thanks <a href="http://ola-bini.blogspot.com/">Ola</a> if you had anything to do with it!<br /><br />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.Matt Franzhttp://www.blogger.com/profile/00973881935128108475noreply@blogger.com0tag:blogger.com,1999:blog-3105545392197418648.post-22822688473560223062007-09-25T17:58:00.000-07:002007-09-25T18:32:20.770-07:00JRuby Enum Constants and my irrational fear of ::'sSo development on <a href="http://peertab.blogspot.com/">PeerTAB</a> is rolling along. Sort of. I am continuing to play with JXTA via JRuby.<br /><br /><span style="font-style: italic;">So in Java</span><br /><span style="font-weight: bold;">manager = new NetworkManager(NetworkManager.ConfigMode.EDGE, "HelloWorld");</span><br /><br /><span style="font-style: italic;">But of course in JRuby</span><br /><span style="font-weight: bold;">include_class "net.jxta.platform.NetworkManager"</span><br /><span style="font-weight: bold;">m = NetworkManager.new(NetworkManager.ConfigMode.EDGE, "HelloWorld")</span><br /><br />fails with<br /><br /><span style="font-weight: bold;">irb(main):010:0> NetworkManager.ConfigMode</span><br /><span style="font-weight: bold;">NoMethodError: undefined method `ConfigMode' for Java::NetJxtaPlatform::NetworkManager:Class</span><br /><span style="font-weight: bold;"> from (irb):10:in `binding'</span><br /><span style="font-weight: bold;"> from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:150:in `eval_input'</span><br /><span style="font-weight: bold;"> from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:70:in `signal_status'</span><br /><span style="font-weight: bold;"> from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:147:in `eval_input'</span><br /><span style="font-weight: bold;"> from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:70:in `each_top_level_statement'</span><br /><span style="font-weight: bold;"> from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:146:in `loop'</span><br /><span style="font-weight: bold;"> from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:146:in `catch'</span><br /><span style="font-weight: bold;"> from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:146:in `eval_input'</span><br /><span style="font-weight: bold;"> from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:70:in `start'</span><br /><span style="font-weight: bold;"> from :1:in `catch'</span><br /><span style="font-weight: bold;"> from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:69:in `start'</span><br /><span style="font-weight: bold;"> from :1</span><br /><br />So the question then I how do I get these <a href="http://threatmind.net/jxta/doc/api/net/jxta/platform/NetworkManager.ConfigMode.html#enum_constant_summary">enum constants?</a><br /><br />So interestingly enough<br /><br /><span style="font-weight:bold;">irb(main):020:0> NetworkManager.constants<br />=> ["ConfigMode"]<br />irb(main):021:0><br /></span><br /><br />But that did get me anywhere and it was only until I ran across <a href="http://lastmind.net/2007/02/using-java-enum-constants-in-jruby.html">this blog post</a> that I figured it out.<br /><br /><br />irb(main):011:0> NetworkManager::ConfigMode<br />=> Java::NetJxtaPlatform::NetworkManager::ConfigMode<br />irb(main):012:0> NetworkManager.constants<br />=> ["ConfigMode"]<br />irb(main):013:0> NetworkManager.constants.class<br />=> Array<br />irb(main):014:0> NetworkManager::ConfigMode::EDGE<br />=> #<java::netjxtaplatform::networkmanager::configmode:0x1ff92f5 java_object="EDGE"><br />irb(main):015:0><br /><br />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++.Matt Franzhttp://www.blogger.com/profile/00973881935128108475noreply@blogger.com1tag:blogger.com,1999:blog-3105545392197418648.post-19197275823765737512007-09-24T18:12:00.000-07:002007-09-24T18:31:48.745-07:00Interesting Bruce Tate PodcastI listened to <a href="http://paranode.com/%7Etopfunky/audio/2007/rails-055-erubycon-bruce-tate.mp3">Robert Stephenson's interview with Bruce Tate</a> while washing dishes tonight and it was certainly a treat and certainly kept my mind occupied while cleaning up the minestrone remnants:<br /><br />Among the highlights:<br /><br /><ul><li>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.<br /></li><li>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.)</li><li>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 <a href="http://labs.jboss.com/drools/">Drools</a>) which is something I've wanted to play around with yet. As well as using a Java scripting languages to access cool APIs.</li></ul><br />Check it out...Matt Franzhttp://www.blogger.com/profile/00973881935128108475noreply@blogger.com0tag:blogger.com,1999:blog-3105545392197418648.post-76778584909304603822007-09-11T08:30:00.000-07:002007-09-11T08:39:47.369-07:00I 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 <a href="http://www.h3rald.com/articles/10-reasons-to-learn-ruby/">write lame defenses of their favorite language</a> 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.<br /><br />There, done, filled my quota!<br /><br />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 <a href="http://www.threatmind.net/secwiki/VimConfig">configured properly.</a>Matt Franzhttp://www.blogger.com/profile/00973881935128108475noreply@blogger.com0tag:blogger.com,1999:blog-3105545392197418648.post-60550172365412838912007-09-08T07:07:00.000-07:002007-09-08T10:12:25.206-07:00The Future of Ruby is JRuby?<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhznwbhQhD60gGpFf1pUHCghgyizSwefBLGmbNzfLcoGNBkIhCU5T5XgQqs5bl1JeIJrLWcV0aJZP0fS8M0Ci8tDz8FBGOoQzjFba_bS8r1ufGg0Ak5vKBxp94FrebIPwEwcV1vsSPGZIs/s1600-h/jruby.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhznwbhQhD60gGpFf1pUHCghgyizSwefBLGmbNzfLcoGNBkIhCU5T5XgQqs5bl1JeIJrLWcV0aJZP0fS8M0Ci8tDz8FBGOoQzjFba_bS8r1ufGg0Ak5vKBxp94FrebIPwEwcV1vsSPGZIs/s320/jruby.png" alt="" id="BLOGGER_PHOTO_ID_5107882337718572290" border="0" /></a><br /><br /><br />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 <a href="http://ola-bini.blogspot.com/">Ola Bini'a Blog</a> and an <a href="http://ologix.com/JRubyJavaBin200708.pdf">a great prezo on JRuby</a>. 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.Matt Franzhttp://www.blogger.com/profile/00973881935128108475noreply@blogger.com0tag:blogger.com,1999:blog-3105545392197418648.post-79245452348374782542007-09-03T19:14:00.000-07:002007-09-04T11:35:07.320-07:00Ruby Only Netbeans Builds: Nothing to Be Angry About<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiR-0CxNU7ErNDmbo9P_5Rt7cO6mjyv0JPgezizBDDDds07KwrcJqxxw4i9XzAQ35OPbF4bCxwTxS_P8duK6Xnt-aCDTFe0H7nCUJFiyNl_3o4ulaxlXRv7vYBDjnD6BSq6A23gtve7kdg/s1600-h/netbeans.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiR-0CxNU7ErNDmbo9P_5Rt7cO6mjyv0JPgezizBDDDds07KwrcJqxxw4i9XzAQ35OPbF4bCxwTxS_P8duK6Xnt-aCDTFe0H7nCUJFiyNl_3o4ulaxlXRv7vYBDjnD6BSq6A23gtve7kdg/s400/netbeans.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5106167331507475650" /></a><br />I've never used IDEs that much (with the exception of Visual C# a while back} but I downloaded the <a href='http://deadlock.netbeans.org/hudson/job/ruby/'>latest build of the the Netbeans Ruby IDE.</a> 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.Matt Franzhttp://www.blogger.com/profile/00973881935128108475noreply@blogger.com0tag:blogger.com,1999:blog-3105545392197418648.post-16598357793653504282007-09-02T17:47:00.000-07:002007-09-04T11:32:30.388-07:00Absolutely Worthless JRoR Benchmark: Tomcat 5.5 vs. Glassfish v3So 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 <a href="http://weblogs.java.net/blog/arungupta/archive/2007/08/first_jruby_on.html">Arun Gupta's tutorial app</a><br /><br /><u>Tomcat 5.5.23</u><br />Initial Load: 3.229s<br />Subsequent Loads: 0.115 0.323 0.323s<br /><br /><u>Glassfish v3</u><br />Inital Load: 9.671s<br />Subsequent Loads: 3.005 0.554 0.594s<br /><br /><u>Webrick</u><br />Initial Load: 1.278s<br />Subsequent Loads: 0.559s 0.623<br /><br />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.<br /><br />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.<br /><br /><pre><br />franz-g4:~ mdfranz$ time wget http://192.168.100.91:8080/hello/say/hello<br />--19:30:56-- http://192.168.100.91:8080/hello/say/hello<br /> => `hello.4'<br />Connecting to 192.168.100.91:8080... connected.<br />HTTP request sent, awaiting response... 200 OK<br />Length: 86 [text/html]<br /><br />19:30:59 (1.61 MB/s) - `hello.4' saved [86/86]<br /><br /><br />real 0m3.229s<br />user 0m0.002s<br />sys 0m0.009s<br /></pre>Matt Franzhttp://www.blogger.com/profile/00973881935128108475noreply@blogger.com0tag:blogger.com,1999:blog-3105545392197418648.post-10799647197343333422007-09-02T13:03:00.000-07:002007-09-07T18:46:18.620-07:00JRuby and Embedded Derby: First StepsBefore tackling <a href="http://rubyforge.org/projects/jruby-extras">ActiveRecord-JDBC</a> I thought I'd play around with <a href="http://db.apache.org/derby/papers/DerbyTut/embedded_intro.html">the embedded version of Apache Derby</a> 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:<br /><pre><br />require 'java'<br />include_class "java.sql.Connection"<br />include_class "java.sql.DriverManager"<br />include_class "java.sql.ResultSet"<br />include_class "java.sql.Statement"<br />driver = org.apache.derby.jdbc.EmbeddedDriver.new()<br />conn = DriverManager.getConnection("jdbc:derby:derbyDB;create=true")<br />conn.setAutoCommit(false)<br />s = conn.createStatement()<br /></pre><br />Some of the things that tripped me up, as I was trying to convert the simple Java example to JRuby:<br /><ul><li><span style="font-size:85%;">The </span><span style=";font-family:courier new;font-size:85%;" >Class.forName(driver).newInstance()</span><span style="font-size:85%;"> nonsense, I guess I've never run across this convention before but probably not surprising since I'm not a Java developer<br /></span></li><li><span style=";font-family:courier new;font-size:85%;" >org.apache.derby.impl.jdbc.EmbedSQLException: Derby system shutdown</span><span style="font-size:85%;"> - yes you should do a </span><span style=";font-family:courier new;font-size:85%;" >DriverManager.getConnection("jdbc:derby:;shutdown=true") <span style="font-family:times new roman;">and yes it apparently always throws an exception</span></span></li><li><span style="font-size:85%;">Getting useful <a href="http://db.apache.org/derby/docs/10.3/devguide/cdevconcepts41275.html">results sets</a> 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.</span><br /><br /></li></ul>Since Blogger mangles source code so badly, see the code over on my <a href="http://www.threatmind.net/secwiki/JRuby/Derby">wiki</a>. Next I'm going to try <a href="http://hsqldb.org/">HSQLDB</a> because it supports a larger set of rails migrations using ActiveRecord-JDBC than Derby, but the <a href="http://hypersonic.rubyforge.org/">Hypersonic gem</a> definitely had problems on OSX due to issues with <a href="http://www.cmt.phys.kyushu-u.ac.jp/%7EM.Sakurai/cgi-bin/fw/wiki.cgi?page=YAJB">YAJB</a>. But me sneaking suspicions is that that library is for C-Ruby and not JRuby. Doh!Matt Franzhttp://www.blogger.com/profile/00973881935128108475noreply@blogger.com1tag:blogger.com,1999:blog-3105545392197418648.post-3849791299643726112007-09-01T05:48:00.000-07:002007-09-07T18:46:23.794-07:00JRuby/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 <a href="http://javaposse.com/index.php?post_id=246577">Java Posse 138</a> which had a lengthy (but quite excellent interview with several Sun developers from <a href="https://glassfish.dev.java.net/">Glassfish</a>. Java Posse is an excellent podcast. I wish there was something of comparable quality on Ruby, but no time for that rant.<br /><br />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 <a href="http://weblogs.java.net/blog/arungupta/archive/2007/08/first_jruby_on.html">blog entry on running interpreted rails apps within Glassfish v3 and the Grizzly connector</a>.<br /><br />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)<br /><br />Here the slight differences:<br /><br />I set the environment variables in .bashrc<br /><br /><pre><br />JAVA_HOME=~/jdk6<br />JRUBY_HOME=~/java/jruby<br />GLASSFISH_HOME=~/java/glassfish<br />PATH=$PATH:$JAVA_HOME/bin/:$JRUBY_HOME/bin:$GLASSFISH_HOME/bin<br /></pre><br /><br />Install rails (added --no-ri)<br /><br /><pre><br /># jruby -S gem install rails -y --no-ri --no-rdoc<br /></pre><br /><br /><br />Modify glassfish/config/asenv.conf instead of asenv.bat<br /><br /><pre><br />JRUBY_HOME="/root/java/jruby"<br /></pre><br /><br />Make asadmin exectuable (chmod u+x/700)Matt Franzhttp://www.blogger.com/profile/00973881935128108475noreply@blogger.com2