Amitava Shee's Technical Diary

Sunday, September 03, 2006

HTTPS not suppored by open-uri module in Ruby

The open-uri module provides a convenient overload to Kernel::open that allows uniform and easy access to different IO resource type. However this does not work with SSL (https) sites. See the irb session below

irb(main):001:0> require 'open-uri'
=> true
irb(main):002:0> url = ""
=> ""
irb(main):003:0> open(url) { |f| p }
OpenSSL::SSL::SSLError: certificate verify failed
from c:/ruby/lib/ruby/1.8/net/http.rb:586:in `connect'
from c:/ruby/lib/ruby/1.8/net/http.rb:586:in `connect'
from c:/ruby/lib/ruby/1.8/net/http.rb:553:in `do_start'
from c:/ruby/lib/ruby/1.8/net/http.rb:542:in `start'
from c:/ruby/lib/ruby/1.8/open-uri.rb:245:in `open_http'
from c:/ruby/lib/ruby/1.8/open-uri.rb:629:in `buffer_open'
from c:/ruby/lib/ruby/1.8/open-uri.rb:167:in `open_loop'
from c:/ruby/lib/ruby/1.8/open-uri.rb:165:in `open_loop'
from c:/ruby/lib/ruby/1.8/open-uri.rb:135:in `open_uri'
from c:/ruby/lib/ruby/1.8/open-uri.rb:531:in `open'
from c:/ruby/lib/ruby/1.8/open-uri.rb:86:in `open'
from (irb):3

How to run .NET 2.0 SDK help outside visual studio 2005

Visual Studio 2005 does not distribute help in chm format. It took some spelunking to find out how to run MSDN help outside Visual Studio.

From Start->Run, invoke the following

dexplore /helpcol ms-help://MS.NETFramework.v20.en

However, if you try to create a shortcut, you have to specify the full path as
"C:\Program Files\Common Files\Microsoft Shared\Help\dexplore.exe" /helpcol ms-help://MS.NETFramework.v20.en

Please note that you can create an alias to an executable by creating a .reg file as below

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Your Alias]
"Path"="path containing exe with a trailing backslash"
@="full path exe"

Thursday, May 11, 2006

JBoss 4.04-CR2 integration with JDK1.5 jconsole JMX client

Did you know that you could manage JBoss MBeans from jconsole? Here are the steps

In windows, open %JBOSS_HOME%\bin\run.bat and append the following parameters to JAVA_OPTS environment variable as the following

set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx512m
org.jboss.system.server.jmx.MBeanServerBuilderImpl -Djboss.platform.mbeanserver

The arguments added is highlighted in red.

Now fire up jconsole and click on the MBeans tab.

Please see JBoss wiki for further details

Sunday, May 07, 2006

Open source J2EE stacks

I have been playing around with open source J2EE offerings. I tried the following 3
  1. Sun Java Application Server 8
  2. JBoss 4.0.4-CR2
  3. Websphere Application Server Community Edition 1.0.1
The Sun offering impressed me the most. This is mostly due to the tool support provided in Java Studio Creator 2 and NetBeans 5.0. Sun has a complete stack - from the proven Solaris to fully certified j2ee app server and slick RAD development tools. The only downside is the large memory footprint and somewhat sluggish performance. Please note that I am running everything in my laptop (w/1.5GB RAM) and is not indicative of performance in production deployments.

I have not tried Glassfish yet (this is the Sun backed community building J2EE 5 appserver) . I am planning to try it next week.

I was also pretty impressed with JBoss (especially JBoss seam). It has good tooling support via eclipse plug-in's. However, it took some fooling around with ant build scripts to get my app going. I loved seam, especially the sample booking application that integrates JSF with EJB3. Please note that this application uses facelet which I am totally excited about.

IBM has packaged Apache's Geronimo J2EE server as WASCE. The application server works just fine. However, the tooling support is less than perfect. IBM is relying on Eclipse WTP for the development experience. However, I could not get WTP to publish to the server. I had to manually export and deploy the EAR.

J2EE continues to be more complex than it need be. IMHO, they are playing catch-up with .NET. For instance, ASP.NET introduced the concept of programmable web controls 5 years back. JSF (borrows heavily from ASP.NET) is coming off age now. Features similar to ADO.NET (DataSet - disconnected in-memory data) is proposed for the upcoming JDBC 4.0

Ruby on rails (RoR) makes J2EE even more painful. Of course I may be comparing apples to oranges. With years of maturity and a vast array of capabilities in J2EE, there is really no other platform that comes close. But if you are building straight forward database driven applications, I would recommend lightweight platforms like RoR, php or Python.

Saturday, April 29, 2006

JBoss seam example deployment

I was getting the following exception while deploying jboss-seam-1.0.0.CR2

ejb-jar.xml must either obey the right xml schema or define a valid DOCTYPE!

I didn't find much help googling for it. Turns out that while installating JBoss 4.0.4CR2 (using the installer), you have to select ejb3 radio button. I had mistakenly assumed that by selecting "all" ejb3 would be included. After I reinstalled jboss AS with "ejb3" checked, jboss seam example "seam-booking" is up and running

I'll be playing around with seam and post my findings here.

Stay tuned

Monday, April 24, 2006

Reset mysql root password

The steps to reset mysql root password

  1. Stop mysqld service - In fedora this can be done as "sudo /sbin/service mysqld stop"
  2. Start mysqld with skip-grant-table option - "sudo /usr/bin/mysqld_safe --skip-grant-table &"
  3. Fire up mysql client as "mysql -u root mysql"
  4. Reset password - mysql> update user set password=password("secret") where user="root";
  5. Flush privileges - mysql>flush privileges;
  6. Shutdown mysqld - mysqladmin -u root -p shutdown. Please note that this will prompt for the newly created password