<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Chui's counterpoint &#187; Java</title>
	<atom:link href="http://www.redmountainsw.com/wordpress/archives/category/java/feed" rel="self" type="application/rss+xml" />
	<link>http://www.redmountainsw.com/wordpress</link>
	<description>pulling the rug</description>
	<lastBuildDate>Thu, 02 Sep 2010 08:20:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>JRuby 1.5.0 problem with -S switch</title>
		<link>http://www.redmountainsw.com/wordpress/archives/jruby-1-5-0-problem-with-s-switch</link>
		<comments>http://www.redmountainsw.com/wordpress/archives/jruby-1-5-0-problem-with-s-switch#comments</comments>
		<pubDate>Fri, 21 May 2010 13:00:12 +0000</pubDate>
		<dc:creator>Chui</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.redmountainsw.com/wordpress/?p=950</guid>
		<description><![CDATA[After installing rails on JRuby, I was surprised that I couldn&#8217;t execute jruby -S rails

GEM_PATH=gem
# rails is in GEM_PATH\bin\rails
java -jar jruby-complete-1.5.0.jar -S rails
jruby - no such directory, file or command

I decided to whip out the trusty JD-GUI and jdb and a do bit of source diving.
The routine responsible for locating the script is in org.jruby.RubyInstanceConfig.argumentProcessor$.resolveScript().
First, [...]]]></description>
			<content:encoded><![CDATA[<p>After installing rails on JRuby, I was surprised that I couldn&#8217;t execute <code>jruby -S rails</code></p>
<pre class="brush: php">
GEM_PATH=gem
# rails is in GEM_PATH\bin\rails
java -jar jruby-complete-1.5.0.jar -S rails
jruby - no such directory, file or command
</pre>
<p>I decided to whip out the trusty JD-GUI and jdb and a do bit of source diving.</p>
<p>The routine responsible for locating the script is in org.jruby.RubyInstanceConfig.argumentProcessor$.resolveScript().<br />
First, it searches the script in the current directory, then in jruby.home\bin, and finally in PATH.</p>
<pre class="brush: java">
    private String resolveScript(String scriptName)
    {
      try
      {
        File fullName = JRubyFile.create(RubyInstanceConfig.this.currentDirectory, scriptName);
        if ((fullName.exists()) &amp;&amp; (fullName.isFile())) {
          return scriptName;
        }

        fullName = JRubyFile.create(RubyInstanceConfig.this.getJRubyHome(), &quot;bin/&quot; + scriptName);
        if ((fullName.exists()) &amp;&amp; (fullName.isFile())) {
          return fullName.getAbsolutePath();
        }
        try
        {
          String path = System.getenv(&quot;PATH&quot;);
          if (path != null) {
            String[] paths = path.split(System.getProperty(&quot;path.separator&quot;));
            for (int i = 0; i &lt; paths.length; ++i) {
              fullName = JRubyFile.create(paths[i], scriptName);
              if ((fullName.exists()) &amp;&amp; (fullName.isFile()))
                return fullName.getAbsolutePath();
            }
          }
        }
        catch (SecurityException se) {
        }
      }
      catch (IllegalArgumentException iae) {
        if (RubyInstanceConfig.this.debug) System.err.println(&quot;warning: could not resolve -S script on filesystem: &quot; + scriptName);
      }
      return null;
    }
</pre>
<p>The problem occurs because jruby.home is located inside a jar file, and there was a check called isAbsolute() that fails with jar! paths. </p>
<p>JRubyFile ends up throwing an IllegalArgumentException when it couldn&#8217;t find <code>file:\E:\bin\jruby\jruby-complete-1.5.0.jar!\META-INF\jruby.home\bin\rails</code>.</p>
<pre class="brush: java">
class JRubyFile
{
private static JRubyFile createNoUnicodeConversion(String cwd, String pathname)
  {
    if ((pathname == null) || (pathname.equals(&quot;&quot;)) || (Ruby.isSecurityRestricted())) {
      return JRubyNonExistentFile.NOT_EXIST;
    }
    File internal = new JavaSecuredFile(pathname);
    if (!(internal.isAbsolute())) {
      internal = new JavaSecuredFile(cwd, pathname);
      if (!(internal.isAbsolute())) {
        throw new IllegalArgumentException(&quot;Neither current working directory (&quot; + cwd + &quot;) nor pathname (&quot; + pathname + &quot;) led to an absolute path&quot;);
      }
    }
    return new JRubyFile(internal);
  }
}
</pre>
<p>If you have a close look at <i>resolveScript()</i>, the IllegalArgumentException short-circuits resolveScript, and bypasses the code that subsequently searches through PATH, and jumps straight to the error handler.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.redmountainsw.com/wordpress/archives/jruby-1-5-0-problem-with-s-switch/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning JRuby on Rails on Windows</title>
		<link>http://www.redmountainsw.com/wordpress/archives/jruby-on-rails-on-windows</link>
		<comments>http://www.redmountainsw.com/wordpress/archives/jruby-on-rails-on-windows#comments</comments>
		<pubDate>Wed, 19 May 2010 12:04:47 +0000</pubDate>
		<dc:creator>Chui</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.redmountainsw.com/wordpress/?p=937</guid>
		<description><![CDATA[I haven&#8217;t figured out how to put RoR on a USB stick, but JRuby with an embedded server seems to be a reasonable place to start, while not having to download so many files.
With thanks to ]]></description>
			<content:encoded><![CDATA[<p>I haven&#8217;t figured out how to put RoR on a USB stick, but JRuby with an embedded server seems to be a reasonable place to start, while not having to download so many files.</p>
<p>With thanks to <a href="http://mathias-biilmann.net/2010/2/jruby-and-rails-3-beta-step-by-step"">JRuby on Rails 3 Step by Step</a></p>
<p>Step #1: http://jruby.org/download<br />
<code>
<pre>
&gt;mkdir JRuby
&gt;cd JRuby
&gt;copy con jruby.bat
SET GEM_HOME=%~dp0
"C:\Program Files (x86)\Java\jre6\bin\java.exe" -jar %~dp0jruby-complete-1.5.0.jar %*
^Z
&gt;REM activerecord 3 beta install fails on RDoc, so we specify --no-rdoc
&gt;jruby -S gem  install   rails --pre -i lib --no-ri --no-rdoc
&gt;jruby -S gem install activerecord-jdbc-adapter -i lib
&gt;
&gt;jruby -S lib\bin\rails rails_3_app
&gt;cd rails_3_app
</pre>
<p></code></p>
<p>To support H2 database, do the following</p>
<pre class="brush: sh">
&gt;jruby -S gem install activerecord-jdbch2-adapter -i lib
</pre>
<p>The Gemfile has to be modified as such, note that activerecord-jdbc-adapter should be at least 0.9.6</p>
<pre>
#gem 'sqlite3-ruby', :require => 'sqlite3'
gem "activerecord-jdbc-adapter", :require =>'jdbc_adapter' if defined?(JRUBY_VERSION)
</pre>
<pre><code>
&gt;..\jruby -S ..\lib\bin\bundle install
</pre>
<p></code></p>
<p>Modify the <code>config\database.yml</code></p>
<pre><code>
development:
  adapter: jdbch2
  database: /home/$yourusername/dev/db/myapp_dev
  username: sa
</code></pre>
<p>http://github.com/kim/jruby-rack</p>
<p> jruby -S rake db:migrate<br />
 jruby -S script/server</p>
<h2>Learning notes</h2>
<p>I can't just install a gem and use it in your Rails 3 application. Case in point: I decided to use jdbcsqlite3 instead, and dutifully installed jdcsqlite3 using the "gem install command"</p>
<pre class="brush: php">
jruby.bat -S gem install activerecord-jdbcsqlite3-adapter
</pre>
<p>However, Rails wouldn't load the gem</p>
<pre class="brush: php">
jruby.bat rake db:create
rake aborted!
Please install the jdbcsqlite3 adapter: `gem install activerecord-jdbcsqlite3-adapter` (no such file to load -- active_record/connection_adapters/jdbcsqlite3_adapter)
</pre>
<p>Instead, the jdbcsqlite3 adapter must be explicitly specified in the Gemfile</p>
<pre class="brush: php">
gem &#039;activerecord-jdbcsqlite3-adapter&#039;, :require =&gt; &#039;jdbc-sqlite3&#039;, :require =&gt;&#039;jdbc_adapter&#039; if defined
(JRUBY_VERSION)
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.redmountainsw.com/wordpress/archives/jruby-on-rails-on-windows/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Identifying JavaFX 1.3&#8217;s Amble Font</title>
		<link>http://www.redmountainsw.com/wordpress/archives/amble-font</link>
		<comments>http://www.redmountainsw.com/wordpress/archives/amble-font#comments</comments>
		<pubDate>Sat, 24 Apr 2010 09:47:49 +0000</pubDate>
		<dc:creator>Chui</dc:creator>
				<category><![CDATA[javafx]]></category>

		<guid isPermaLink="false">http://www.redmountainsw.com/wordpress/?p=928</guid>
		<description><![CDATA[I haven&#8217;t heard of the Amble font before. With the help of WhatTheFont, I uploaded this little section, 

And the best matched turned out to be Robusta Pro SemiCond
Identifont suggested Anivers but I thought it was way off mark.
What do you think Amble was?
]]></description>
			<content:encoded><![CDATA[<p>I haven&#8217;t heard of the Amble font before. With the help of <a href="http://www.myfonts.com/WhatTheFont/">WhatTheFont</a>, I uploaded this little section, </p>
<p><img class="aligncenter size-full wp-image-929" title="amble-font" src="http://www.redmountainsw.com/wordpress/wp-content/uploads/amble-font.png" alt="" width="1401" height="105" /></p>
<p>And the best matched turned out to be <a href="http://www.myfonts.com/fonts/tilde/robusta-pro/semicond/">Robusta Pro SemiCond</a></p>
<p>Identifont suggested <a href="http://www.identifont.com/identify?18+%20+58D+4C+30D+97+6X5+1UA+4A+1KU+1KK+11+6XA+1A+53M+9Z+1R0+42+1U+8R2+M">Anivers</a> but I thought it was way off mark.</p>
<p>What do you think Amble was?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.redmountainsw.com/wordpress/archives/amble-font/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Interactive JavaFX Script shell</title>
		<link>http://www.redmountainsw.com/wordpress/archives/interactive-javafx-script-shell</link>
		<comments>http://www.redmountainsw.com/wordpress/archives/interactive-javafx-script-shell#comments</comments>
		<pubDate>Thu, 25 Mar 2010 23:04:57 +0000</pubDate>
		<dc:creator>Chui</dc:creator>
				<category><![CDATA[javafx]]></category>

		<guid isPermaLink="false">http://www.redmountainsw.com/wordpress/?p=897</guid>
		<description><![CDATA[One thing I don&#8217;t like about JavaFX (compared to HTML) is the edit, recompile, launch, debug cycle. In HTML, it is a matter of editing the file and refreshing with F5.
Imagine my delight when I found the JavaFX SDK ships with an interactive shell.

C:\javafx-sdk1.2\&#62;java -Djava.ext.dirs=lib/desktop;lib/shared/ com.sun.tools.javafx.script.
ScriptShell
/*fx1*/ def circle = javafx.scene.shape.Circle {centerX: 50 centerY: 50 radius:80 [...]]]></description>
			<content:encoded><![CDATA[<p>One thing I don&#8217;t like about JavaFX (compared to HTML) is the edit, recompile, launch, debug cycle. In HTML, it is a matter of editing the file and refreshing with F5.</p>
<p>Imagine my delight when I found the JavaFX SDK ships with an interactive shell.</p>
<pre class="brush: bash">
C:\javafx-sdk1.2\&gt;java -Djava.ext.dirs=lib/desktop;lib/shared/ com.sun.tools.javafx.script.
ScriptShell
/*fx1*/ def circle = javafx.scene.shape.Circle {centerX: 50 centerY: 50 radius:80 fill:javafx.scene.paint.Color.PURPLE }
le
/*fx2*/ def stage = javafx.stage.Stage { title: &quot;Interactive stage&quot; width: 400 height: 300 }
fx.stage.Stage@c7057c
/*fx3*/ import javafx.scene.Scene;
/*fx4*/ stage.scene = Scene {content: circle};
fx.scene.Scene@19e733e
</pre>
<p><a href="http://www.redmountainsw.com/wordpress/wp-content/uploads/javafx-interactive.png"><img src="http://www.redmountainsw.com/wordpress/wp-content/uploads/javafx-interactive.png" alt="" title="javafx-interactive" width="400" height="300" class="aligncenter size-full wp-image-899" /></a></p>
<p>Why do this? </p>
<p>Firstly, if you make any syntax errors, they get caught straight away. So explore away, saving the working snippets into your final source file.</p>
<p>Secondly, results are immediate. There is no need to restart the javafx application. Time is money.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.redmountainsw.com/wordpress/archives/interactive-javafx-script-shell/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JDBC Connection URLs for 22 Databases</title>
		<link>http://www.redmountainsw.com/wordpress/archives/jdbc-connection-urls</link>
		<comments>http://www.redmountainsw.com/wordpress/archives/jdbc-connection-urls#comments</comments>
		<pubDate>Fri, 07 Aug 2009 23:40:22 +0000</pubDate>
		<dc:creator>Chui</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[jdbc]]></category>

		<guid isPermaLink="false">http://www.redmountainsw.com/wordpress/?p=131</guid>
		<description><![CDATA[Here is a non-exhaustive list of JDBC connection URLs for various databases. Corrections welcome!
Microsoft SQL Server JDBC connection URL
jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=northwind
com.microsoft.jdbc.sqlserver.SQLServerDriver
msbase.jar;mssqlserver.jar;msutil.jar
downloadl
Microsoft SQL Server 2005 JDBC connection URL
jdbc:sqlserver://serverName\instance:port[;user=value][;password=value][;property=value]
com.microsoft.sqlserver.jdbc.SQLServerDriver
sqljdbc.jar
download SQL Server 2005 driver
Microsoft SQL Server (JTurbo) JDBC connection URL
jdbc:JTurbo://&#60;HOST&#62;:&#60;PORT&#62;/&#60;DB&#62;
com.ashna.jturbo.driver.Driver
Microsoft SQL Server (Sprinta) JDBC connection URL
jdbc:inetdae7:&#60;HOST&#62;:&#60;PORT&#62;?database=&#60;DB&#62;
com.inet.tds.TdsDrive
download

Cloudscape JDBC connection URL
jdbc:cloudscape:MyDataBase
COM.cloudscape.core.JDBCDriver
Cloudscape RMI JDBC connection URL
jdbc:rmi://hostname:portnumber/jdbc:cloudscape:MyDatabase
RmiJdbc.RJDriver
Hypersonic SQL (server) JDBC connection URL
jdbc:hsqldb:hsql://localhost
org.hsqldb.jdbcDriver
hsqldb.jar
download (SourceForge)
Hypersonic SQL [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a non-exhaustive list of JDBC connection URLs for various databases. Corrections welcome!</p>
<h2>Microsoft SQL Server JDBC connection URL</h2>
<pre>jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=northwind
com.microsoft.jdbc.sqlserver.SQLServerDriver
msbase.jar;mssqlserver.jar;msutil.jar
<a href="http://www.microsoft.com/sql/downloads/default.asp">download</a>l</pre>
<h2>Microsoft SQL Server 2005 JDBC connection URL</h2>
<pre>jdbc:sqlserver://serverName\instance:port[;user=value][;password=value][;property=value]
com.microsoft.sqlserver.jdbc.SQLServerDriver
sqljdbc.jar
<a href="http://www.microsoft.com/downloads/details.aspx?familyid=e22bc83b-32ff-4474-a44a-22b6ae2c4e17&amp;displaylang=en">download SQL Server 2005 driver</a></pre>
<h2>Microsoft SQL Server (JTurbo) JDBC connection URL</h2>
<pre>jdbc:JTurbo://&lt;HOST&gt;:&lt;PORT&gt;/&lt;DB&gt;
com.ashna.jturbo.driver.Driver</pre>
<h2>Microsoft SQL Server (Sprinta) JDBC connection URL</h2>
<pre>jdbc:inetdae7:&lt;HOST&gt;:&lt;PORT&gt;?database=&lt;DB&gt;
com.inet.tds.TdsDrive
<a href="http://www.inetsoftware.de/products/jdbc/mssql/sprinta/">download</a></pre>
<p><span id="more-131"></span></p>
<h2>Cloudscape JDBC connection URL</h2>
<pre>jdbc:cloudscape:MyDataBase
COM.cloudscape.core.JDBCDriver</pre>
<h2>Cloudscape RMI JDBC connection URL</h2>
<pre>jdbc:rmi://hostname:portnumber/jdbc:cloudscape:MyDatabase
RmiJdbc.RJDriver</pre>
<h2>Hypersonic SQL (server) JDBC connection URL</h2>
<pre>jdbc:hsqldb:hsql://localhost
org.hsqldb.jdbcDriver
hsqldb.jar
<a href="http://sourceforge.net/project/showfiles.php?group_id=23316">download (SourceForge)</a></pre>
<h2>Hypersonic SQL (in-process) JDBC connection URL</h2>
<pre>jdbc:hsqldb:file:/opt/db/testdb
org.hsqldb.jdbcDriver
hsqldb.jar</pre>
<h2>Hypersonic SQL (in-memory) JDBC connection URL</h2>
<pre>jdbc:hsqldb:mem:aname
org.hsqldb.jdbcDriver
hsqldb.jar</pre>
<h2><a href="http://www.h2database.com">H2 Database</a> (embedded)</h2>
<pre>jdbc:h2:test</pre>
<h2><a href="http://www.h2database.com">H2 Database</a> (Client Server)</h2>
<pre>jdbc:h2:tcp://localhost:9092/test</pre>
<h2><a href="http://www.h2database.com">H2 Database</a> (Client Server, Clustered)</h2>
<pre>jdbc:h2:tcp://localhost:9092,backuphost.com:9092/test</pre>
<h2><a href="http://www.h2database.com">H2 Database</a> (In Memory)</h2>
<pre>jdbc:h2:{ {.|mem:}[name] | [file:]fileName | {tcp|ssl}:[//]server[:port][,server2[:port]]/name }[;key=value...]</pre>
<h2>Informix JDBC connection URL</h2>
<pre>jdbc:informix-sqli://hostname:portnumber/MyDatabase:INFORMIXSERVER=MyServerName
com.informix.jdbc.IfxDriver</pre>
<h2>MySQL JDBC connection URL</h2>
<pre>jdbc:mysql:///test
jdbc:mysql://[host][,failoverhost...][:port]/[database][?propertyName1][=propertyValue1][&amp;propertyName2][=propertyValue2]...
com.mysql.jdbc.Driver</pre>
<h2>Oracle JDBC connection URL</h2>
<pre>jdbc:oracle:thin:@localhost:1521:MyDatabase
oracle.jdbc.driver.OracleDriver
classes12.zip</pre>
<p>To reference the Oracle SID (Service name), you have to <a href="http://dirknachbar.blogspot.com/2009/06/jdbc-url-with-oracle-sid-or-servicename.html">apply // in front of the host name</a>.</p>
<pre>jdbc:oracle:thin:myusername/mypassword@//localhost:1521/PROD.OCZH.CH</pre>
<p>To connect to your database <a href="http://theblasfrompas.blogspot.com/2008/04/jdbc-thin-connection-using-tnsnamesora.html">using a tnsnames.ora entry</a>, </p>
<pre>
System.setProperty("oracle.net.tns_admin",
                        "D:\\oracle\\product\\10.2.0\\db_1\\NETWORK\\ADMIN");
or
Doracle.net.tns_admin=D:\oracle\product\10.2.0\db_1\NETWORK\ADMIN
jdbc:oracle:thin:@mysvcname
</pre>
<h2>PostgresSQL JDBC connection URL</h2>
<pre>jdbc:postgresql:template1
org.postgresql.Driver</pre>
<h2>DB2 JDBC connection URL</h2>
<pre>jdbc:db2:test
com.ibm.db2.jdbc.app.DB2Driver</pre>
<h2><a href="http://www.oracle.com/technology/software/products/timesten/index.html">TimesTen</a> in-memory database JDBC connection URL</h2>
<pre>jdbc:timesten:direct:test
com.timesten.jdbc.TimesTenDriver</pre>
<h2>DB2/400 (native) JDBC connection URL</h2>
<pre>jdbc:db2://systemname
com.ibm.db2.jdbc.app.DB2Driver</pre>
<h2>DB2/400 (toolbox) JDBC connection URL</h2>
<pre>jdbc:as400://systemname
com.ibm.as400.access.AS400JDBCDriver</pre>
<h2>Derby JDBC connection URL</h2>
<pre>jdbc:derby:/test;create=true
org.apache.derby.jdbc.EmbeddedDriver</pre>
<h2>Derby JDBC network connection URL</h2>
<pre>jdbc:derby://localhost:1527/sample;user=judy;password=no12see
jdbc:derby://localhost:1527/c:/my-db-dir/my-db-name;user=judy;password=no12see
org.apache.derby.jdbc.ClientDriver
</pre>
<p>Note that authentication is <b>off</b> by default. To enable user authentication, the property <code>derby.connection.requireAuthentication</code> must be set to true. This is set in the <em>derby.properties</em> file.</p>
<h2>Sybase JDBC connection URL</h2>
<pre>jdbc:sybase:Tds:localhost:2048/MyDatabase
com.sybase.jdbc2.jdbc.SybDriver
jconn2.jar
<a href="http://www.google.com.au/url?sa=t&amp;ct=res&amp;cd=1&amp;url=http%3A//www.sybase.com/products/informationmanagement/softwaredeveloperkit/jconnect&amp;ei=cHnRQ4WRN6e2YPGUtYYD&amp;sig2=xEo08Vaed31IRQ5KRNQ6ow">download</a></pre>
<h2>Mckoi SQL JDBC connection URL</h2>
<pre>jdbc:mckoi:local://C:/mckoi1.0.3/db.conf
com.mckoi.JDBCDriver</pre>
<h2>SAP DB JDBC connection URL</h2>
<pre>jdbc:sapdb://localhost/TST
com.sap.dbtech.jdbc.DriverSapDB</pre>
<h2>JSQL JDBC connection URL</h2>
<pre>jdbc:JSQLConnect://localhost/test
com.jnetdirect.jsql.JSQLDriver</pre>
<h2>JTurbo JDBC connection URL</h2>
<pre>jdbc:JTurbo://localhost:1433/test
com.newatlanta.jturbo.driver.Driver</pre>
<h2>jTDS JDBC connection URL</h2>
<pre>jdbc:jtds:sqlserver://localhost/dbName;instance=instanceName
net.sourceforge.jtds.jdbc.Driver</pre>
<p>(thanks JoelN for the correction)</p>
<h2>Interbase (Java driver) JDBC connection URL</h2>
<pre>jdbc:firebirdsql:localhost/3050:/firebird/test.gdb
org.firebirdsql.jdbc.FBDriver</pre>
<h2>Interbase (Interclient driver) JDBC connection URL</h2>
<pre>jdbc:interbase://localhost:3060/C:/firebird/test.gdb
interbase.interclient.Driver</pre>
<h2>PointBase JDBC connection URL</h2>
<pre>jdbc:pointbase:embedded:sample
com.pointbase.jdbc.jdbcUniversalDriver</pre>
<h2>Ingres JDBC connection URL</h2>
<p>ca.edbc.jdbc.EdbcDriver<br />
jdbc:edbc://localhost:II7/database</p>
<h2>Mimer SQL JDBC connection URL</h2>
<pre>jdbc:mimer:multi1
com.mimer.jdbc.Driver</pre>
<h2>Sources</h2>
<ul>
<li><a href="http://www.hibernate.org/">Hibernate</a></li>
<li><a href="http://www.visualcase.com/jdbc.htm#Microsoft%20SQL%20Server%202000">VisualCase</a></li>
<li><a href="http://www.petefreitag.com/articles/jdbc_urls/">Pete&#8217;s Guide to JDBC Driver URLs</a></li>
<li><a href="http://www.devx.com/tips/Tip/28818">devX List of JDBC Drivers</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.redmountainsw.com/wordpress/archives/jdbc-connection-urls/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Clojure symbol counting</title>
		<link>http://www.redmountainsw.com/wordpress/archives/clojure-symbol-counting</link>
		<comments>http://www.redmountainsw.com/wordpress/archives/clojure-symbol-counting#comments</comments>
		<pubDate>Mon, 01 Jun 2009 23:27:39 +0000</pubDate>
		<dc:creator>Chui</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[lisp]]></category>
		<category><![CDATA[clojure]]></category>

		<guid isPermaLink="false">http://www.redmountainsw.com/wordpress/?p=774</guid>
		<description><![CDATA[One of the little things I found enjoyable while trying out Clojure was discovering the merge-with command. After counting the each of the subbranch and collecting the results in dictionaries, the dictionaries were merged together.

clojure.core/merge-with
([f &#038; maps])
  Returns a map that consists of the rest of the maps conj-ed onto
  the first.  [...]]]></description>
			<content:encoded><![CDATA[<p>One of the little things I found enjoyable while trying out <a href="http:/www.clojure.org/">Clojure</a> was discovering the <b>merge-with</b> command. After counting the each of the subbranch and collecting the results in dictionaries, the dictionaries were merged together.</p>
<pre>
clojure.core/merge-with
([f &#038; maps])
  Returns a map that consists of the rest of the maps conj-ed onto
  the first.  If a key occurs in more than one map, the mapping(s)
  from the latter (left-to-right) will be combined with the mapping in
  the result by calling (f val-in-result val-in-latter).
</pre>
<p>Using merge-with yields a rather terse code, comprising a tree-walker and a final tally.</p>
<pre>

(defn count-syms
  "count number time of a symbol occurs in the first place of a sequence"
  [obj]
  (if (not (seq? obj))
      {} ; only count sequences
      (do
        (reduce #(merge-with + %1 %2)
          (conj
            (map
                count-syms
                (filter seq? (rest obj)))
            (inc-dict dict (first obj)))))))
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.redmountainsw.com/wordpress/archives/clojure-symbol-counting/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A plan for learning clojure</title>
		<link>http://www.redmountainsw.com/wordpress/archives/a-plan-for-learning-clojure</link>
		<comments>http://www.redmountainsw.com/wordpress/archives/a-plan-for-learning-clojure#comments</comments>
		<pubDate>Mon, 01 Jun 2009 14:05:04 +0000</pubDate>
		<dc:creator>Chui</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[lisp]]></category>
		<category><![CDATA[clojure]]></category>

		<guid isPermaLink="false">http://www.redmountainsw.com/wordpress/?p=772</guid>
		<description><![CDATA[I had printed out the list of functions and macros in the Clojure API page, and it filled out two A4 pages. Where to start though? I walked the entire clojure and clojure contrib directory and counted the number of function calls. Here are the top stats.

sym	count	len
clojure.core/list	3872	17
quote	2749	5
defn	1757	4
clojure.core/seq	1481	16
clojure.core/concat	1480	19
=	1074	1
let	1042	3
is	885	2
.	836	1
if	826	2
defmethod	431	9
def	407	3
complex	377	7
defn-	376	5
fn	356	2
first	346	5
defmacro	298	8
clojure.core/apply	264	18
deftest	257	7
str	252	3
when	244	4
imaginary	238	9
recur	237	5
apply	229	5
instance?	220	9
nil	217	3
and	214	3
next	208	4
cl-format	206	9
fn*	197	3
ns	194	2
map	193	3
:use	187	4
list	184	4
1	181	1
count	178	5
+	169	1
seq	167	3
reduce	165	6
are	148	3
cons	143	4
println	141	7
or	141	2
not	135	3
loop	133	4
thrown?	127	7
*	127	1
conj	125	4
print	124	5
nth	124	3
-	116	1
doseq	114	5

Now, I have a study-plan.
Incidentally, waterfront IDE is quite [...]]]></description>
			<content:encoded><![CDATA[<p>I had printed out the list of functions and macros in the Clojure API page, and it filled out two A4 pages. Where to start though? I walked the entire clojure and clojure contrib directory and counted the number of function calls. Here are the top stats.</p>
<pre>
sym	count	len
clojure.core/list	3872	17
quote	2749	5
defn	1757	4
clojure.core/seq	1481	16
clojure.core/concat	1480	19
=	1074	1
let	1042	3
is	885	2
.	836	1
if	826	2
defmethod	431	9
def	407	3
complex	377	7
defn-	376	5
fn	356	2
first	346	5
defmacro	298	8
clojure.core/apply	264	18
deftest	257	7
str	252	3
when	244	4
imaginary	238	9
recur	237	5
apply	229	5
instance?	220	9
nil	217	3
and	214	3
next	208	4
cl-format	206	9
fn*	197	3
ns	194	2
map	193	3
:use	187	4
list	184	4
1	181	1
count	178	5
+	169	1
seq	167	3
reduce	165	6
are	148	3
cons	143	4
println	141	7
or	141	2
not	135	3
loop	133	4
thrown?	127	7
*	127	1
conj	125	4
print	124	5
nth	124	3
-	116	1
doseq	114	5
</pre>
<p>Now, I have a study-plan.</p>
<p>Incidentally, waterfront IDE is quite nice, particularly because I don&#8217;t have to learn Emacs key-bindings. There are some moments when it barfs and prints out hashmaps incorrectly, but I enjoyed working in a REPL environment. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.redmountainsw.com/wordpress/archives/a-plan-for-learning-clojure/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaFX experiment</title>
		<link>http://www.redmountainsw.com/wordpress/archives/javafx-experiment</link>
		<comments>http://www.redmountainsw.com/wordpress/archives/javafx-experiment#comments</comments>
		<pubDate>Wed, 01 Apr 2009 20:12:24 +0000</pubDate>
		<dc:creator>Chui</dc:creator>
				<category><![CDATA[javafx]]></category>

		<guid isPermaLink="false">http://www.redmountainsw.com/wordpress/?p=739</guid>
		<description><![CDATA[I was having a lot of problems getting the simplest test case below to run without throwing an odd exception:

import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.*;
import javafx.ext.swing.SwingTextField;
import javafx.ext.swing.SwingButton;

Stage {
    title : &#34;MyApp&#34;
    scene: Scene {
        width: 200
        height: [...]]]></description>
			<content:encoded><![CDATA[<p>I was having a lot of problems getting the simplest test case below to run without throwing an odd exception:</p>
<pre class="brush: java">
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.*;
import javafx.ext.swing.SwingTextField;
import javafx.ext.swing.SwingButton;

Stage {
    title : &quot;MyApp&quot;
    scene: Scene {
        width: 200
        height: 200
        content: [
            VBox{
                content:
                [
                SwingTextField {
                columns: 10
                text: &quot;TextField&quot;
                editable: true
                },
                SwingButton {
                text: &quot;Button&quot;
                action: function() {  }
                }]
            }

        ]
    }
}
</pre>
<p>SwingTextField barfs like this:</p>
<pre>
Exception in thread "AWT-EventQueue-1" java.lang.IllegalArgumentException: Zero length string passed to TextLayout constructor.
        at java.awt.font.TextLayout.<init>(TextLayout.java:364)
        at sun.font.FontDesignMetrics.charsWidth(FontDesignMetrics.java:487)
        at javax.swing.text.Utilities.getTabbedTextWidth(Utilities.java:262)
        at javax.swing.text.Utilities.getTabbedTextWidth(Utilities.java:191)
        at javax.swing.text.PlainView.modelToView(PlainView.java:335)
        at javax.swing.text.FieldView.modelToView(FieldView.java:248)
        at javax.swing.plaf.basic.BasicTextUI$RootView.modelToView(BasicTextUI.java:1496)
        at javax.swing.plaf.basic.BasicTextUI.modelToView(BasicTextUI.java:1034)
        at javax.swing.text.DefaultCaret.paint(DefaultCaret.java:600)
        at javax.swing.plaf.basic.BasicTextUI.paintSafely(BasicTextUI.java:730)
        at javax.swing.plaf.basic.BasicTextUI.paint(BasicTextUI.java:868)
        at javax.swing.plaf.basic.BasicTextUI.update(BasicTextUI.java:847)
        at javax.swing.JComponent.paintComponent(JComponent.java:758)
        at javafx.ext.swing.JTextFieldImpl.paintComponent(JTextFieldImpl.java:77)
        at javax.swing.JComponent.paint(JComponent.java:1022)
        at javax.swing.JComponent.paintChildren(JComponent.java:859)
        at javax.swing.JComponent.paint(JComponent.java:1031)
        at com.sun.embeddedswing.EmbeddedPeer.paint(EmbeddedPeer.java:135)
        at com.sun.scenario.scenegraph.SGComponent.paint(SGComponent.java:121)
        at com.sun.scenario.scenegraph.SGLeaf.render(SGLeaf.java:179)
        at com.sun.scenario.scenegraph.SGWrapper.render(SGWrapper.java:122)
        at com.sun.scenario.scenegraph.SGGroup.render(SGGroup.java:222)
        at com.sun.scenario.scenegraph.SGWrapper.render(SGWrapper.java:122)
        at com.sun.scenario.scenegraph.SGGroup.render(SGGroup.java:222)
        at com.sun.scenario.scenegraph.SGGroup.render(SGGroup.java:222)
        at com.sun.scenario.scenegraph.JSGPanel.paintComponent(JSGPanel.java:582)
        at javax.swing.JComponent.paint(JComponent.java:1022)
        at javax.swing.JComponent.paintChildren(JComponent.java:859)
        at javax.swing.JComponent.paint(JComponent.java:1031)
        at javax.swing.JLayeredPane.paint(JLayeredPane.java:564)
        at javax.swing.JComponent.paintChildren(JComponent.java:859)
        at javax.swing.JComponent.paintToOffscreen(JComponent.java:5111)
        at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1386)
        at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1317)
        at javax.swing.RepaintManager.paint(RepaintManager.java:1132)
        at javax.swing.JComponent.paint(JComponent.java:1008)
        at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:21)
        at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:60)
        at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:97)
        at java.awt.Container.paint(Container.java:1797)
        at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:738)
        at javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:667)
        at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:128)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
        at com.sun.embeddedswing.EmbeddedEventQueue.dispatchEvent(EmbeddedEventQueue.java:369)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)</pre>
<p>Running javafx with the verbose switch pointed the fault out</p>
<pre>javafx -verbose:class test
:
:
[Loaded java.awt.Container$EventTargetFilter from c:\Progra~1\Java\jdk1.6.0\jre\lib\rt.jar]
:
</pre>
<p>I was running an old version of the JDK!<br />
Unsetting the JAVA_HOME resolved the problem.<br />
I hope this helps somebody.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.redmountainsw.com/wordpress/archives/javafx-experiment/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>JavaFX Custom Cursors</title>
		<link>http://www.redmountainsw.com/wordpress/archives/javafx-custom-cursors</link>
		<comments>http://www.redmountainsw.com/wordpress/archives/javafx-custom-cursors#comments</comments>
		<pubDate>Mon, 30 Mar 2009 01:00:47 +0000</pubDate>
		<dc:creator>Chui</dc:creator>
				<category><![CDATA[javafx]]></category>

		<guid isPermaLink="false">http://www.redmountainsw.com/wordpress/archives/javafx-custom-cursors</guid>
		<description><![CDATA[Setting custom cursors with JavaFx is relatively straightforward, but for one little catch. Your image has to be 32&#215;32. If you want a 16&#215;16 icon, simply leave the rest of the image transparent.

import java.awt.Toolkit;
import javafx.scene.Cursor;
import javafx.scene.image.Image;

public class ColorChooser extends Cursor
{
    public override function impl_getAWTCursor(): java.awt.Cursor {

       [...]]]></description>
			<content:encoded><![CDATA[<p>Setting custom cursors with JavaFx is relatively straightforward, but for one little catch. <span style="font-style: italic;">Your image has to be 32&#215;32</span>. If you want a 16&#215;16 icon, simply leave the rest of the image transparent.</p>
<pre class="brush: java">
import java.awt.Toolkit;
import javafx.scene.Cursor;
import javafx.scene.image.Image;

public class ColorChooser extends Cursor
{
    public override function impl_getAWTCursor(): java.awt.Cursor {

        def url = &quot;{__DIR__}eyedropper.png&quot;;

        var toolkit = Toolkit.getDefaultToolkit();

        var image = Image{width:32 height:32 url:url}.bufferedImage;
        var hotspot = new java.awt.Point(0,15);
        var cursor = toolkit.createCustomCursor(image, hotspot, &quot;colorpicker&quot;);
        return cursor;
    }
}

public def ColorChooserCursor=ColorChooser{};

public function run()
{
    javafx.scene.shape.Rectangle
    {
        x:5 y:5
        width:200 height:200
        cursor:ColorChooserCursor
    }
}
</pre>
<p><!-- technorati tags begin -->
<p style="font-size:10px;text-align:right;">Tags: <a href="http://technorati.com/tag/javafx" rel="tag">javafx</a></p>
<p><!-- technorati tags end --></p>
]]></content:encoded>
			<wfw:commentRss>http://www.redmountainsw.com/wordpress/archives/javafx-custom-cursors/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>JavaFX Introspection</title>
		<link>http://www.redmountainsw.com/wordpress/archives/javafx-introspection</link>
		<comments>http://www.redmountainsw.com/wordpress/archives/javafx-introspection#comments</comments>
		<pubDate>Mon, 23 Mar 2009 14:59:58 +0000</pubDate>
		<dc:creator>Chui</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[javafx]]></category>

		<guid isPermaLink="false">http://www.redmountainsw.com/wordpress/archives/javafx-introspection</guid>
		<description><![CDATA[Just sharing some code snippets for deserialization of JavaFX objects.

function getValueType(obj:Object,name:String):String
{
    var context:FXLocal.Context=FXLocal.getContext();
    var objectValue:FXLocal.ObjectValue = new FXLocal.ObjectValue(obj,context);
    var cls:FXClassType = objectValue.getClassType();
    var varType:FXType = cls.getVariable(name).getType();
    println(&#34;{name} {varType}&#34;);
    if (varType instanceof FXSequenceType)
    {
  [...]]]></description>
			<content:encoded><![CDATA[<p>Just sharing some code snippets for deserialization of JavaFX objects.</p>
<pre class="brush: java">
function getValueType(obj:Object,name:String):String
{
    var context:FXLocal.Context=FXLocal.getContext();
    var objectValue:FXLocal.ObjectValue = new FXLocal.ObjectValue(obj,context);
    var cls:FXClassType = objectValue.getClassType();
    var varType:FXType = cls.getVariable(name).getType();
    println(&quot;{name} {varType}&quot;);
    if (varType instanceof FXSequenceType)
    {
        return &quot;array&quot;;
    } else if (varType instanceof FXClassType) {
        return &quot;element&quot;;
    } else {
        return &quot;value&quot;;
    }
}
</pre>
<p>Thanks to James Weaver for tips on <a href="http://learnjavafx.typepad.com/weblog/2009/03/answering-reader-mail-about-the-javafx-reflection-api.html">JavaFX Reflection API</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.redmountainsw.com/wordpress/archives/javafx-introspection/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
