Archives for the ‘Java’ Category
Friday, 21 May 2010
After installing rails on JRuby, I was surprised that I couldn’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, [...]
Posted in Java | No Comments »
Wednesday, 19 May 2010
I haven’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
Posted in Java | No Comments »
Saturday, 24 April 2010
I haven’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?
Posted in javafx | 1 Comment »
Friday, 26 March 2010
One thing I don’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\>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 [...]
Tags: javafx
Posted in javafx | No Comments »
Saturday, 8 August 2009
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://<HOST>:<PORT>/<DB>
com.ashna.jturbo.driver.Driver
Microsoft SQL Server (Sprinta) JDBC connection URL
jdbc:inetdae7:<HOST>:<PORT>?database=<DB>
com.inet.tds.TdsDrive
download
Tags: Java, jdbc
Posted in Java, SQL Server | 11 Comments »
Tuesday, 2 June 2009
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 & maps])
Returns a map that consists of the rest of the maps conj-ed onto
the first. [...]
Tags: clojure
Posted in Java, lisp | No Comments »
Tuesday, 2 June 2009
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 [...]
Tags: clojure
Posted in Java, lisp | No Comments »
Thursday, 2 April 2009
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 : "MyApp"
scene: Scene {
width: 200
height: [...]
Tags: javafx
Posted in javafx | 1 Comment »
Monday, 30 March 2009
Setting custom cursors with JavaFx is relatively straightforward, but for one little catch. Your image has to be 32×32. If you want a 16×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 {
[...]
Posted in javafx | 2 Comments »
Tuesday, 24 March 2009
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("{name} {varType}");
if (varType instanceof FXSequenceType)
{
[...]
Tags: javafx
Posted in Java, javafx | No Comments »
Friday, 20 March 2009
I had a Group of circles, i.e.
var circles:Circle[];
var group:Group = Group { content: [circles] };
strangely, I couldn’t get newly inserted circles to render.
It turns out that you have to bind group.content to ensure that changes in circles are reflected in group.content.
Here’s a test routine.
import javafx.scene.*;
import javafx.scene.paint.*;
import javafx.scene.shape.*;
import javafx.stage.*;
var lines = for (i in [1..10])
[...]
Tags: javafx
Posted in javafx | 1 Comment »
Friday, 6 March 2009
Submitting screenshots through the web takes several steps more than it ought to. Firstly we have to paste it into mspaint.exe, save it to disk, only to then fiddle around with the File upload to look for the file again.
Another way to do it is via a signed applet. Unfortunately, the signed applet is unable [...]
Tags: Java, html
Posted in Java | 3 Comments »
Friday, 6 March 2009
Andrew Haley Zero, Shark – llvm code generators
Gary Benson RedHat. Zero and Shark
Volker Simonis – SAP JIT group, how to build HotSpot
Pekka Jato – JIT compiler for Java
Jevgeni Kabanov Class reloading using serialization to patch runtime instances
I’m sorry if I missed your name here. Please leave a comment here if you wish to be [...]
Tags: jvm
Posted in Java | 2 Comments »
Saturday, 21 February 2009
Take a look at aribaweb.org (viaTheServerSide).
AribaWeb is a 4GL RAD for web applications running on a Java stack.
It uses an approach described in data dictionaries as a database pattern to generate metadata-driven UI.
The Ariba toolset seems reasonably mature from the screencasts, although one has to be wary because a lot of the AJAX work [...]
Tags: 4GL, rad
Posted in Java, database | 3 Comments »
Wednesday, 18 February 2009
Having spent a few weeks experimenting with JavaFX, and creating several examples, here is an assessment of whether JavaFX succeeds in it’s objective of being a graphics DSL. Bear in mind that I am evaluating it in terms of it’s ease in being a graphics DSL – if it makes my life easier, it succeeds. [...]
Tags: javafx
Posted in javafx | 1 Comment »
Friday, 13 February 2009
Here is a minimal test case illustrating how exasperating the default JavaFX Text node can be, especially when aligning text.
You’d be surprised to note that both pieces of text below are aligned using TextAlignment.CENTER.
import javafx.scene.text.*;
import javafx.scene.layout.*;
VBox
{
translateY:10
content:
[
Text {
[...]
Tags: javafx
Posted in General, Java, javafx | No Comments »
Thursday, 12 February 2009
Given the following piece of JavaFX Script
import javafx.scene.CustomNode;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.shape.Rectangle;
import javafx.scene.paint.Color;
import java.lang.Math.sqrt;
class C extends CustomNode
{
// Test #1: Commented out
//var node: Group = Group {};
protected override function create():Node
{
return node;
[...]
Tags: javafx
Posted in Java, javafx | No Comments »
Wednesday, 4 February 2009
JavaFX gets to start on a clean slate, without burdens of compatibility with browsers. However, how well does it paint itself?
How are – say – Rectangles defined?
Is the startX based on center lines? or is it from the origin?
What about borders? Are borders painted to the bottom right of the origin?
How [...]
Tags: javafx
Posted in General, javafx | 3 Comments »
Wednesday, 10 December 2008
JavaFX 1.0 is finally out of the gate. There are probably many Java engineers and architects who are trying to figure out this technology and see how it could apply to their existing projects. Here is my assessment. Note this applies to JavaFX 1.0.
JavaFX 1.0 is not ready as a Flash replacement in public-facing projects
While [...]
Tags: javafx, ria
Posted in Flex, Java, javafx | 8 Comments »
Thursday, 18 September 2008
[Note: I've reposted this (with minor edits) as my original post got accidentally deleted. Thanks to Google cache]
Why is it? Why is it that Java applets -despite having the first mover advantage – achieved little traction. While Flash – a tool which targets graphic designers originally – continue to gain mindshare, and is now a [...]
Tags: Java, jvm
Posted in Java, PHP, Popular essays, javafx | No Comments »