nosewheelie

Technology, mountain biking, politics & music.

Archive for April, 2008

Official Java 6 support on the Mac

without comments

Beaten by Gruber again (I blame the timezone), Apple has released a non-beta version of Java 6 (1.6.0_05) for the Mac:

This update provides Java SE 6 version 1.6.0_05.

This release does not change the default version of Java. This release is only for Mac OS X v10.5.2 and later, and should not be installed on earlier versions of Mac OS X. This release is for 64-bit Intel-based Macs only and cannot run on PowerPC-based or 32-bit Intel-based Macs.

Software developers can visit the Java Reference Library for information on this release’s features.

Here’s the download link.

It’d be nice to see this fix some of the issues with Java apps (not) interacting with Spaces.

Update: To get this working in Java apps, edit /Applications/App.app/Contents/Info.plist and ensure the JVMVersion string is set to 1.5+. Then open /Applications/Utilites/Java/Java Preferences.app and ensure “Java SE 6 (64-bit)” is at the top of the application order (drag it up). You may also want to update any JAVA_HOME, JDK_DIR, JDK_HOME, etc. environment variables, and potentially update the /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK symlink to point at /System/Library/Frameworks/JavaVM.framework/Versions/1.6. Should catch all command line apps and build scripts, etc.

Written by Tom Adams

April 30th, 2008 at 8:20 am

Posted in Java,Mac

Tagged with , ,

Good-Bye, Cheap Oil. So Long, Suburbia?

without comments

The suburban landscape has been marred by foreclosures and half-built communities abandoned in the subprime aftermath. But James Howard Kunstler, author of a dozen books, including The Geography of Nowhere: The Rise and Decline of America’s Man-Made Landscape, thinks there’s a bigger threat to those far-flung neighborhoods: the scarcity of oil. As Kunstler sees it, oil wells are running dry and the era of cheap fuel is over. Given the supply constraints, he says the U.S. will have to rethink suburban sprawl, bringing an end to strip malls, big-box stores, and other trappings of the automotive era.

Source: Good-Bye, Cheap Oil. So Long, Suburbia?.

Written by Tom Adams

April 29th, 2008 at 12:41 pm

Posted in Environment

Tagged with , , , , ,

Easy DSLs in Scala

without comments

Debasish Ghosh has another excellent Scala post, this one on External DSLs made easy with Scala Parser Combinators:

External DSLs are hard since implementing them involves reinventing most of the mechanisms found in a general purpose language. Designing internal DSLs are equally hard, more so in a statically typed language. Dynamically typed languages like Ruby offer strong meta-programming facilities, which help in implementing internal DSLs. But metaprogramming in Ruby is still considered elitist by many, and is not an art mastered by programmers at large.

Here is a sample DSL (simplified for brevity) for accepting client orders to buy/sell equities ..

(buy 100 IBM shares at max USD 45, sell 50 CISCO shares at min USD 25, buy 100 Google shares at max USD 800) for trading_account "SSS1234"

The equivalent XML will be too verbose, too painful for the eyes, and will definitely need more extraneous infrastructure over native language support for meaningful processing.

Written by Tom Adams

April 22nd, 2008 at 3:30 pm

Posted in Scala

Tagged with , , , ,

Pimp my (Java) methods

with 7 comments

A friend of mine has been playing around with Scala and asked about its meta-programming ability. In particular, he’s a Ruby fiend, so is used to its nice reflection abilities. Specifically he wanted to be able to explore an API interactively from the console, like the following for an integer in Ruby:

>> 1.class
=> Fixnum
>> 1.methods
=> ["%", "inspect", "<<", "singleton_method_added", "&", "clone", ">>", "method", "round", "public_methods", "instance_variable_defined?", "divmod", "equal?", "freeze", "integer?", "chr", "*", "+", "to_i", "methods", "respond_to?", "-", "upto", "between?", "prec", "truncate", "/", "dup", "instance_variables", "__id__", "modulo", "object_id", "succ", "|", "eql?", "zero?", "require", "~", "id", "to_f", "singleton_methods", "send", "prec_i", "taint", "step", "to_int", "frozen?", "instance_variable_get", "__send__", "^", "instance_of?", "remainder", "to_a", "+@", "nonzero?", "-@", "type", "**", "floor", "<", "protected_methods", "<=>", "instance_eval", "==", "prec_f", "quo", ">", "display", "===", "downto", "id2name", "size", "instance_variable_set", "kind_of?", "abs", "extend", ">=", "next", "to_s", "<=", "coerce", "hash", "ceil", "class", "tainted?", "=~", "private_methods", "gem", "div", "nil?", "untaint", "times", "to_sym", "[]", "is_a?"]
>> Fixnum.methods
=> ["inspect", "private_class_method", "const_missing", "clone", "method", "public_methods", "public_instance_methods", "instance_variable_defined?", "method_defined?", "superclass", "equal?", "freeze", "included_modules", "const_get", "methods", "respond_to?", "module_eval", "class_variables", "dup", "protected_instance_methods", "instance_variables", "public_method_defined?", "__id__", "object_id", "eql?", "const_set", "require", "id", "singleton_methods", "send", "class_eval", "taint", "frozen?", "instance_variable_get", "include?", "private_instance_methods", "__send__", "instance_of?", "private_method_defined?", "to_a", "name", "autoload", "type", "<", "protected_methods", "instance_eval", "<=>", "==", ">", "display", "===", "instance_method", "instance_variable_set", "kind_of?", "extend", "protected_method_defined?", "const_defined?", ">=", "ancestors", "to_s", "<=", "public_class_method", "allocate", "hash", "class", "instance_methods", "tainted?", "=~", "private_methods", "gem", "class_variable_defined?", "induced_from", "nil?", "untaint", "constants", "autoload?", "is_a?"]

Unfortunately Scala’s meta-programming abilities are currently limited to Java’s, which is to say not very good. As I’m in Rails-land at the moment, I asked Tony to have a crack at it, to which, he’s obliged:

class Classs[T](c: Class[T]) {
  lazy val methods = scala.collection.immutable.HashSet(c.getDeclaredMethods: _*) ++ c.getMethods
}

object Classs {
  implicit def c[T](c: Class[T]) = new Classs(c)
}

Here’s how to use it, we ask for all of Integer‘s methods that start with a “t”:

scala> classOf[Integer].methods.filter(_.getName.startsWith("t")).foreach(println(_))
public static java.lang.String java.lang.Integer.toBinaryString(int)
public static java.lang.String java.lang.Integer.toHexString(int)
public static java.lang.String java.lang.Integer.toOctalString(int)
public java.lang.String java.lang.Integer.toString()
public static java.lang.String java.lang.Integer.toString(int,int)
public static java.lang.String java.lang.Integer.toString(int)
private static java.lang.String java.lang.Integer.toUnsignedString(int,int)

Tony’s original source: http://fprogramming.org/paste/viewpaste.php?id=107.

Written by Tom Adams

April 21st, 2008 at 12:40 pm

16 design mistakes for account sign-in

without comments

  1. Having a sign-in in the first place
  2. Requiring sign-in too soon
  3. Not stating the benefits to registering
  4. Hiding the sign-in button
  5. Not making “Create a New Account” or “Forgot Your Password” a button or link
  6. Not providing sign-in opportunities at key locations
  7. Asking for too much information when registering
  8. Not telling users how you’ll use their information
  9. Not telling the users the requirements for username and password up front
  10. Requiring stricter password requirements than the NSA
  11. Using challenge questions they won’t remember in a year
  12. Not returning users to their desired objective
  13. Not explaining if it’s the username or password they got wrong
  14. Not putting a register link when the sign-in is in error
  15. Not giving the user a non-email solution to recover their password
  16. Requiring more than one element when recovering password

Source: 16 design mistakes for account sign-in.

Written by Tom Adams

April 18th, 2008 at 10:24 am

Posted in Design

IntelliJ IDEA 8 Roadmap

with 4 comments

Via Talios, the IntelliJ 8 roadmap has been refined a little, notable inclusions are:

  • Scala (finally!)
  • Python
  • git???

I’d be nice to see a preview drop of the Scala plugin, it currently doesn’t build from source.

Written by Tom Adams

April 17th, 2008 at 8:36 am

Persistent block level storage in EC2

without comments

Via Yariv:

I just caught Amazon’s announcement of the new persistent storage engine for EC2. This is great stuff. It lets you create persistent block level storage devices ranging from 1GB to 1TB in size and attach them to EC2 instances in predetermined availability zones. This service complements Amazon’s other storage services — EC2 and SimpleDB — in providing raw block-level storage devices that are persistent, fast and local (so you don’t have to worry about SimpleDB’s eventual consistency issues). You can use these volumes for anything — running a traditional DBMS (MySQL, Postgres) is the first thing that comes to mind.

The original announcement:

Developers who have found our cloud computing model attractive have been asking us to be a little bit more open about what we are planning to do in the future. To date we’ve simply announced new additions to the Amazon Web Services lineup, with immediate beta availability at the time of announcement.

Earlier this year we started to post specifications for new features along with requests for feedback. We did this for the Amazon S3 Copy feature and for Amazon S3 Post Support . We received a lot of helpful feedback in both cases.

Now it is time for the next step…

I am excited to be able to tell you about an entire new feature, a feature so new that it doesn’t even have a proper name, and that you can’t use just yet. But you can read about it and you can start thinking about the best way to incorporate it into your system architecture.

If you have taken a close look at Amazon EC2, you know that the instances are ephemeral. The instances have anywhere from 160 GB to 1.7 TB of attached storage. The storage is there as long as the instance is running, but of course it disappears as soon as the instance is shut down. Applications with a need for persistent storage could store data in Amazon S3 or in Amazon SimpleDB, but they couldn’t readily access either one as if it was an actual file system.

As you can read in our forum post, we’ve been working on addressing this.

Written by Tom Adams

April 14th, 2008 at 8:06 pm

Posted in HPC

Tagged with ,

CSS Naked Day

without comments

In support of web standards, this blog is proud to go CSS naked for the day! Well, more than a day really…

Written by Tom Adams

April 10th, 2008 at 2:13 pm

Posted in Blog

The Australian Open Source Industry & Community Report 2008

without comments

In our interaction with business, government, education and the Open Source industry, we have found a sharp disconnect between the perceptions held by the market, and the reality of Open Source in Australia.

We knew that our country has produced some of the world’s most influential Open Source innovators and projects. We knew that clever, home-grown Open Source companies were succeeding in local and export markets.

But we didn’t have the numbers. Until now.

Source: The Australian Open Source Industry & Community Report 2008.

Written by Tom Adams

April 9th, 2008 at 10:14 am

Posted in OSS

Browser Detect patch for Safari support

without comments

Scoodi’s picture uploading function is known to cause issues in Safari 2 when Keep-Alive connections are turned on. For performance reasons we want to enable Keep-Alives, however don’t need to inform older Safari users (though I don’t believe we have any current Safari 2 users) of the known issues.

We use Browser Detect within Scoodi for browser specific functions, which means IE at present, to do things such as correctly alpha blend images, etc. Unfortunately the current version of Browser Detect has limited support for Safari versioning, and especially doesn’t like the latest Safari versions (3+) which have slightly changed the user agent string.

Luckily, the details are documented so a patch is easy:


...
else if (this.isSafari) {
  // Correctly identify version, see: http://developer.apple.com/internet/safari/faq.html#anchor2
  if (ua.lastIndexOf('version/') != -1) {
    this.versionMinor = parseFloat(ua.substring(ua.lastIndexOf('version/') + 8));
  } else {
    this.versionMinor = parseFloat(ua.substring(ua.lastIndexOf('safari/') + 7));
  }
}
...

Which makes for some nice Safari detection:


...
this.isSafari1x = (this.isSafari && this.versionMajor >= 125 && this.versionMajor < = 312);
this.isSafari124 = (this.isSafari && this.versionMajor == 125);
this.isSafari132 = (this.isSafari && this.versionMajor == 312);
this.isSafari1up = (this.isSafari && (ua.lastIndexOf('version/') != -1 || this.versionMajor >= 125));
this.isSafari2x = (this.isSafari && this.versionMajor >= 419);
this.isSafari204 = (this.isSafari && this.versionMajor == 419);
this.isSafari2up = (this.isSafari && (ua.lastIndexOf('version/') != -1 || this.versionMajor >= 419));
this.isSafari3x = (this.isSafari && this.versionMajor == 3);
this.isSafari30 = (this.isSafari && this.versionMinor == 3.0);
this.isSafari31 = (this.isSafari && this.versionMinor == 3.1);
this.isSafari3up = (this.isSafari && ua.lastIndexOf('version/') != -1);
...

Here’s the complete file: browser_detect.js.

Hopefully something like this can get added back into the main distribution.

Written by Tom Adams

April 8th, 2008 at 3:54 pm

Posted in Design,Ruby

Tagged with , , ,