Thursday, March 29, 2012

As the site title says...

let my VPS go... backed everything up and kinda missed some of the content I had.  so I stuck it on blogger.  busy busy busy, but had to take time to go through the old stuff.  memories...

Monday, March 15, 2010

New opportunity

As anyone reading this may already know... I left Platinum Solutions for a position with a company called Solutions Made Simple, Inc. based in Reston, VA.  I'm moving my family away from the beach which makes us sad, but we are moving into an area we are very familiar with and are looking at this as an adventure!

I  had a great 5 year run with Platinum and met some great people along the way.  Hoping to create more lasting relationships with SMSi and their clients and am looking forward to some very challenging work ahead!

Monday, November 23, 2009

Web Services in Seconds (SOAP/REST)

Don't blink...

1. open netbeans...



2. create a new Java Web Project



3. create a new Web Service





4. specify the implementation details of your new Web Service



5. deploy it!



6. go see  your newly created Web Service in action!

http://localhost:8080/MyTest/TimeService?wsdl

7. now to support  REST too!



8. test your newly created REST service!





Or just hit:

http://localhost:8080/MyTest/resources/timeserviceport/gettime/


That's it, hope you didn't blink...

Groovy in Action

I started my career with "dynamic languages" (we called them scripting languages then). I enjoy getting things done quickly with scripting languages, the power it gives you and the freedom to concentrate on the problem domain and not fight with the platform. With all the new languages that are available on the JVM alone, I'm having a lot of fun getting back to my roots. To this point I've mostly stuck to Ruby (JRuby) as I really like the syntax of the Ruby language. I've been aware of Groovy for quite some time... hearing Scott Davis and Andy Glover singing it's praises. But have just not given it enough attention... until recently.

I've been reading the Groovy in Action book from Manning. What a great title to get started with. When I get a tech book, I want to make sure it will pass the test of time... meaning: I don't want to read through it and then have to sell it or throw it away immediately due to it's uselessness. This book has a key component to it that makes it worth the money... the logical flow and organization of the book makes it perfect to work as a reference manual later on. If you are like me, you don't exactly remember EVERYTHING you read... reference abilities are VERY important to me.

With features like "FOR THE GEEKS", the layout stays interesting (as interesting as a technical book can be anyway... :) ) I also appreciate the effort taken not to go too far into Grails. Grails is very important to the Groovy language, but not everything. It's touched on in the back of the book, but just enough to give you an idea of it's potential benefit to your arsenal.

Sunday, May 31, 2009

Google App Engine - JVM support

So of course most have heard Google App Engine now supports the JVM... and in doing that they have not only gone from just supporting Python, they now support Java and most of the other languages written to run on the JVM.

I find it interesting the first app I built for GAE with the new JVM support was simple Sinatra app using JRuby.  Like many other alternative JVM language implementers, the JRuby team leaped into action to make sure their stuff worked on GAE.  I have to admit I was amazed how things just seemed to work.  With some help from Ola Bini's post (for Bumble), I was able to build a simple application in no time at all.

CouchoRecently I was asked to look into implementation options for a project who's resources seem to have a skill set based in PHP.  Most of our work is based in the JVM so I went back to Caucho's Quercus PHP support for the JVM.  Based on a recommendation from the Twitterverse I started looking into the CodeIgniter PHP web framework as well.  This project seems to have a some momentum, the documentation at first glance appears up-to-snuff and video demonstrations are always a plus!

After playing around with CodeIgniter for a while running under oucho's Resin server, I figured someone had already run this framework on GAE... and of course someone has.  Caucho released a blog post about Quercus running PHP on GAE and this application seems to be proof of CodeIgniter on GAE.

Google had a ton of folks crying out to get their favorite language supported on GAE, Java was high on that list I'm sure.  But in supporting the JVM, Google has opened their App Engine cloud based platform to a miriad of developers to play around on.  Nice move Google.

Thursday, January 8, 2009

Pick your battles

Random: Had a conversation today about when the right time to push for the things you want at work... in this case tools.  There is definitely a right and wrong time.  In this case, some of the push-back is due to the many deadlines hanging over everyone's head... and then again some may be posturing.  Requesting new tools to be installed/purchased/etc. during a period of stress at any level is futile.  The best advice I could give was to get things done first and document the different times during the push that this new tool could have come in handy.  After a "big win" or deployment, I'm not sure he'll have the same resistence to the tools he wants.

Tuesday, December 9, 2008

New Ruby Shootout 12/08

Antonio Cangiano has released another Ruby Shootout which are always fun to check out.  Looks like Ruby 1.9 is leading the pack with JRuby 1.1.6RC1 close behind.  Some of the JRuby tests failed which I'm sure pissed Charlie off!

Friday, December 5, 2008

JRuby vs. Java speed (re: Stochastic Simulation with SSJ)

Just read Ali Rizvi's blog post about "JRuby: Stochastic Simulation with SSJ" and decided to take a look at the implementation real quick... of course the Java version will be much faster, but the numbers given seemed a little strange.  After setting up the environment and running the tests, I saw the major slowdown as expected, then I decided to take a look at the Ruby code to see if I could speed things up a little.  This was done rather quickly, if you have better result... please share!

First, the Java version:
real    0m7.960s
user    0m7.839s
sys     0m0.056s

The JRuby version took too long to run (I'm pressed for time) so I added a few options to the runtime:

jruby -J-Djruby.compile.fastest=true --server collision.rb
real 3m55.834s
user 3m53.684s
sys 0m2.355s


Not as bad as reported by the blog ref'd above... but still pretty bad. I had a hunch the loops were what was killing the time and made the following changes to the collision.rb file:

@k.times { |i| @used[i] = false}
changed to:
@used.fill(false)


That brought the time down a bit:


real 1m1.430s
user 1m1.344s
sys 0m0.538s


It would seem loops are a sore spot. (kinda expected? the loop for setting happens in the Java impl) Decided to make one last change to see what happened. I condensed the "generate_c" method back into "simulate_runs" method to get the loops in one place. Some (not much) benefit was shown in my tests:


real 0m59.081s
user 0m59.027s
sys 0m0.502s


CONCLUSION: Yes, straight java is faster. Yes, there are ways to tune your Ruby to make things a bit more efficient. Yes, I'm sure there are other ways to make this run faster. I think prototyping this sort of thing in JRuby is just fine... then when you need more perf (if this stuff will be called from say a JRuby on Rails app) you can code it up in Java (Collision.java) and just call that from JRuby layer.

Here is the final collision.rb I ended up with :

require 'java'
require 'ssj.jar'

import 'umontreal.iro.lecuyer.rng.RandomStream' import 'umontreal.iro.lecuyer.stat.Tally' import 'umontreal.iro.lecuyer.rng.MRG32k3a' class Collision def initialize(k, m) @k = k @m = m @lambda = m * m / (2.0 * k) @used = Array.new(k, false) end
def simulate_runs(n, stream, stat_c)
stat_c.init
n.times do
c = 0
@used.fill(false)
@m.times do
loc = stream.nextInt(0, @k-1)
if @used[loc]
c += 1
else
@used[loc] = true
end
end
stat_c.add(c)
end
stat_c.setConfidenceIntervalStudent()
puts stat_c.report(0.95, 3)
puts " Theoretical mean: #{@lambda} "
end

def self.run
stat_c = Tally.new("Statistics on collision")
col = Collision.new(10000,500)
col.simulate_runs(100000, MRG32k3a.new, stat_c)
end

end

Collision.run

Thursday, December 4, 2008

JRuby getting lots of attention lately

Of course while I'm away, toiling on projects using Spring/Hibernate, JBoss/EJB3/GWT things with the JRuby world get really exciting.  New versions of JRuby are rolling out everytime you turn around and the gems and projects that run on jruby are getting refreshed daily it seems.  Here are just some of the highlights I've seen fly by...

Hopefully I'll get some time of the holidays to dust off some of my (now old) projects and give them a whirl with all the new hotness... I'd love to do some more benchmarks and see if the thread-safety of Rails does anything to improve things on jruby outright.  Of course, I'll post results if I can get around to it.

For a sort of realtime look at what folks are doing with jruby:

Tuesday, September 9, 2008

So where is Pogo?

I just remembered a while back AT&T was looking to get into the browser market with Pogo.  Some of the features look interesting... but where is it?



Tuesday, September 2, 2008

Taking a look through Google Chrome's eyes

Google just released their new browser on the windows world... figured I'd give it a shot.

google chrome


Google Chrome


Have already found and reported a few minor issues... some javascript horking.  In all, I dig the UI.  Could maybe use a "manage bookmarks" feature.  Maybe it's in here somewhere. 

(NOTE: posting this from chrome right now... found another JS issue.)

Thursday, July 17, 2008

Interesting... that is all

Just read this post...

Just saying... it's interesting.  Seems to be a lot of the benchmarking bug going around these days.

Thursday, July 3, 2008

JRuby slowdown from Rails 2.0.2 to 2.1.0

Before you decide to bring your current JRuby on Rails app to the latest 2.1.0 version... you may want to take a look at the performance. I was running the console benchmark from this blog post with jruby trunk and saw some numbers I wasn't expecting:
[sourcecode language="ruby"]
in console: 6.times {puts Benchmark.measure {10000.times {Person.find :first}}.total}
4.47 : jruby 1.1.2 & rails 2.0.2 (jdbc) (best out of 6 runs)
5.43 : jruby 1.1.2 & rails 2.1.0 (jdbc)
4.12 : jruby 1.1.3 (trunk) & rails 2.0.2 (jdbc)
5.06 : jruby 1.1.3 (trunk) & rails 2.1.0 (jdbc)
[/sourcecode]

JRuby trunk IS faster than 1.1.2 as expected, but JRuby overall is experiencing a (pretty significant) slowdown when running Rails 2.1.0.

Hopefully finding the culprit for this slowdown will open the floodgates for improving JRuby on Rails performance.

Friday, May 30, 2008

Loss of internet connection...

When you have to write something like this (on mac), things are bad mmmmkay?

[sourcecode language="ruby"]
loop do
if system('curl -m 2 http://google.com')
system("say \"Mike! Cox Communications has finally fixed the lines, we're back in business!\"")
end
sleep(30)
end
[/sourcecode]

Tuesday, May 27, 2008

Syntactic Sugar...

Was reading this post about Groovy syntactic sugar... closures and ++ operator are nice... but you could open up Hash and Array to get the other stuff.

[sourcecode language="ruby"]
# working with hashes
class Hash
def method_missing(name, *args)
fetch(name) if has_key?(name) or nil
end
end
user = {:save => true, :destroy => false}
puts "--hashes"
puts "save? : #{user.save}"
puts "destroy? : #{user.destroy}"

# working with arrays
class Array
def method_missing(name, *args)
collect {|i| i.send(name)}
end
end
puts "--upcase"
puts ["Mike", "McKinney"].upcase

# fetching attributes of arrays
name1 = {:first_name => "Mike", :last_name => "McKinney"}
name2 = {:first_name => "Bo", :last_name => "Diddley"}
names = [name1, name2]

puts "--first names "
puts names.first_name
puts "--last names "
puts names.last_name
puts "--middle names "
puts names.middle_name
[/sourcecode]

Of course you would want to look a little closer at the implications this type of patch would have on your code, but it's sure nice how flexible ruby can be.

Tuesday, May 13, 2008

JavaOne '08 - Script Bowl apps for JRuby released

This year's JavaOne had an interesting competition... the Script Bowl.  Pitting 4 different languages (Groovy, Scala, Jython & JRuby) on the JVM against each other in three different categories.  (Rich Client Application, Web Application and an Open event)  Check the results here on Rags' blog.

Headius just posted the JRuby Script Bowl artifacts for your viewing pleasure.  Anyone know if the other languages have posted their apps/code?

Monday, May 5, 2008

Re: RSS Feeds for Subversion

I was reading a friend's blog post about RSS feeds for Subversion repositories earlier... he couldn't find anything that was not written in a scripting language which he has no access to in his environment... he needed a Java based solution.  He solved his problem with a war.  I came back to this after dinner (and a few glasses of wine) and decided to show him another way to solve this problem on the JVM... (you knew it was coming Matt.)

Assuming you already have JRuby setup (of course you do), we'll do the following to get the one gem we'll need:
[sourcecode language="css"]
> jruby -S gem install rscm
[/sourcecode]

The RSCM (Ruby Source Code Management) gem provides a nice interface to SVN, CVS, ClearCase, StarTeam, etc. and since it's written in pure Ruby, it runs just fine on the JVM.

Then download this file. Not much to it, 106 lines and 45 of that is the template for creating the rss xml doc.

Command line has a few options, here's an example:
[sourcecode language="css"]
> jruby -J-server server.rb -p 8080 -m svnlog
or just get help
> jruby server --help

-p, --port=3003 Which port do you want the server to listen on.
-m, --mount-point=svnrss http:///
-h, --help Show help (this).
[/sourcecode]

Point your RSS reader @ the following: http://localhost:8080/svnlog?url=http://svn.codehaus.org/jruby/trunk/&num_revs=15 and here's what you get:

SVN RSS Feed


(Firefox 3 beta)


Nice, think I'll actually use this.

Thursday, May 1, 2008

Some Rails perf numbers on JRuby 1.1.1 part 2 (Linux, JDK 6)

After this post, I got a lot of suggestions to re-run the benchmarks using JDK 6. I'll let you read the previous post to see what exactly I did... here's what the runtime looks like for this run:

  • Ubuntu 7.10 / Dell Latitude D830

  • Ruby 1.8.6

  • JRuby 1.1.1

  • JDK 1.6.0_03


*NOTE: could not run benchmarks without jdbc drivers (jdbcmysql adapter) due to JRUBY-2303

First the Rails console benchmark numbers:

Rails console numbers


[sourcecode language="css"]
5.15 seconds - Ruby console
2.41 seconds - JRuby console (jdbc)
[/sourcecode]

(side-note: re-running the console test with JDK 5 on same machine, best out of 6 runs: 3.31 seconds)

Next the Web Server numbers: (numbers in parens are the number of benchmark runs)

Rails ab numbers


[sourcecode language="css"]
272.84 Mongrel (6)
257.02 GlassFish (40)
235.17 Mongrel (jruby/jdbc) (20)
188.12 Glassfish (-n 2, 20)
179.76 Mongrel (jruby/jdbc) (10)
168.52 Glassfish (6)
161.12 Mongrel (jruby/jdbc) (6)
151.04 Glassfish (-n 2, 6)
131.89 Tomcat 6 (30)
105.72 Tomcat 6 (6)
[/sourcecode]

The console numbers show JDK 6 really kicking in... contrast that with the numbers for actually serving the Rails app and you can see there is still some work to be done to make Ruby on Rails serve faster on the JVM.

Again, not very scientific, just something to show where things stand for now. If you have better benchmarks, please link to them from the comments section below.

Monday, April 28, 2008

Some Rails perf numbers on JRuby 1.1.1

UPDATE: Next up will be the same benchmarks using Java 6 on ubuntu.

Just before JRuby 1.1.1 was released, I was surfing around and found this post which shows JRuby running basic Rails bench tests slower than MRI. I wondered what those numbers would look like now, so I got to testing.

I started by downloading the latest binary release of JRuby here.

I setup a Rails app following the theme mentioned by the blog post above, then ran the console benchmark 6 times with each runtime and list the lowest time below:
[sourcecode language='css']
jruby -J-server script/console production
>> Benchmark.measure {10000.times {Person.find :first}}.total
=> 10.352999925613403

ruby script/console production
>> Benchmark.measure {10000.times {Person.find :first}}.total
=> 4.98
[/sourcecode]

Now I wanted to see if the ActiveRecord-JDBC drivers would help the situation:
[sourcecode language='css']
jruby -S gem install activerecord-jdbcmysql-adapter
vi config/database.yml ("mysql" -> "jdbcmysql")

jruby -J-server script/console production
>> Benchmark.measure {10000.times {Person.find :first}}.total
=> 4.134999990463257
[/sourcecode]

console results


Sped things up quite a bit... Now for Mongrel:
[sourcecode language='css']
> mongrel_rails start -e production
Requests per second: 202.27 [#/sec] (mean)

jruby -S gem install mongrel
jruby -J-server -S mongrel_rails start -e production
Requests per second: 96.47 [#/sec] (mean)

# now with adapter: jdbcmysql about the same... got a bit faster after warm-up
Requests per second: 120.05 [#/sec] (mean)
[/sourcecode]

MRI's Mongrel beats JRuby version even after a little warm-up period. I also wanted to see what GlassFish would do :
[sourcecode language='css']
jruby -S gem install glassfish

jruby -S glassfish_rails start ../person_test/
Requests per second: 132.93 [#/sec] (mean)

# now with jdbcmysql adapter
jruby -S glassfish_rails start ../person_test/
Requests per second: 139.96 [#/sec] (mean)
[/sourcecode]

Just goofing around, I used an experimental setting to see what would happen. I repeated the benchmark for some time and you can then really start seeing the JVM 'harden' the execution path... I'm sure the tests above may have benefited in the same way had I let them run but here are the numbers of a glassfish_rails server with 2 Rails instances (probably ran the benchmark about 10-15 times?)
[sourcecode language='css']
jruby -J-server -J-Djruby.compile.fastest=true -S glassfish_rails start -n 2 ../person_test/
Requests per second: 211.64 [#/sec] (mean)
[/sourcecode]

I also wanted to see some numbers for Tomcat 6, a war'd Rails app using Warbler. The numbers were not at all what I was expecting... even though I know things out of the box are not tuned for this type of deployment. The best numbers I could get were:
[sourcecode language='css']
Requests per second: 67.68 [#/sec] (mean)
[/sourcecode]

Rails perf chart


So what does this tell me? JRuby is getting faster each release. There is more work to be done to make JRuby on Rails apps faster. GlassFish is a very easy way to deploy JRoR apps. And last, I am definitely doing something wrong with my war'd depoyment!

I could not find much else in the way of JRuby on Rails benchmarks... if you know of any, please link in comments!

P.S.
All these benchmarks were run on a MacBook 2GHz Core Duo with 1GB mem., Java 5, JRuby 1.1.1, Ruby 1.8.6, Ruby on Rails 2.0.2, MySQL 5.0.27.

Aloha Color Theme for NetBeans 6.1*

UPDATE: The Aloha theme is included in the Extra Ruby Themes module
for NetBeans.


Finally... (sorry for the wait) The Aloha Color Theme for NB 6.1 is available for download.

The original version for 6.0 (here) had issues coming over. If you have not updated yet, you will want to with this list of features.

Aloha Color Theme for NetBeans


Aloha Look


Ruby


xml


XML



C



Java



JavaScript



CSS


NetBeans Download the NBM here. NetBeans


After the download, open NetBeans and go to Tools > Plugins. In the Download tab, add the AlohaTheme.nbm and install. To use it, just select it from the Fonts & Colors profile "Aloha."



You will want to go change the "Diff" colors which are not included in the theme (not yet anyway). Color of Added Text: Black, Color of Changed Text: Dark Grey.