Extracting .MSI Files

February 24th, 2011 2 comments

Mercurial is a really nice revision control tool, but unfortunately there are no portable binary packages for Windows. They do offer msi packages, though. But retrieving their content without actually installing the software is a bit tricky.
You can just unpack them using 7-zip, but you are likely to get garbage.
Using your favorite search engine, you will find suggestions to perform an administrative installation using msiexec /a. Well, don’t. That’s just a normal installation, but without the GUI of the installer being shown.

Fortunately, there is lessmsi. It allows to open, inspect and extract Windows Installer packages.
For TortoiseHG, download the binary .msi package from the Mercurial homepage. Run lessmsi, open the .msi package and select “extract”. Mercurial will be extracted to WheretherYouExtracted\SourceDir\PFiles\TortoiseHg, and the original folder layout of Mercurial will be preserved.

Lessmsi is provided under the MIT License and does not require installation. Just download, unzip and run it.

“unbound wildcard type” errors in Scala

February 16th, 2011 No comments

In Scala 2.8.1, I ran into problems while compiling this:

object Test
{
  def log(item: _) : Unit = 
    println("you logged " + item)
 
  def main(args: Array[String]) : Unit =
  {
    log(42)
  }
}

The error message wasn’t not helping that much at the first glance:

/home/niels/tmp/test.scala:3: error: unbound wildcard type
	def log(item: _) : Unit = 
                      ^

To fix it, change the prototype of the log function like this:

	def log(item: Any) : Unit =

There is a pretty good overview of the Scala type hierarchy on the Scala homepage. In short, Scala Objects are subtypes of AnyRef. Primitive types (Int, Boolean, …) are subtypes of “AnyVal”. Both “AnyRef” and “AnyVal” are subtypes of “Any”, and substituting “Any” with “_” in prototypes and templates is not allowed in Scala 2.8.

Tags:

Adding Notes to Existing Commits in Git

January 14th, 2011 No comments

A really nice feature in Git is the ability to add notes to existing commits:

git notes add -m 'this concerns the foo issue as well (refs #0815)' 12a3df56

Editing existing notes is pretty easy as well:

git notes edit 12a3df56

Make sure to have a look at Evgenys extensive Git guide for further details and more hidden gems.

Tags:

JDK7 and OpenJDK for Mac OS X

January 12th, 2011 No comments

Apple won’t provide further updates to Java, but OpenJDK for Mac OS X is advancing rapidly.
Thankfully, TheServerSide.com provides an extensive list of OpenJDK/OS X related links:

For more information about the Mac OS X Port project, please check out these resources:
Project home: <http://openjdk.java.net/projects/macosx-port>
Project wiki & getting started instructions: <http://wikis.sun.com/display/OpenJDK/Mac+OS+X+Port>
Project status: <http://wikis.sun.com/display/OpenJDK/Mac+OS+X+Port+Project+Status>
Mailing list: <http://mail.openjdk.java.net/mailman/listinfo/macosx-port-dev>
Source repository: <http://hg.openjdk.java.net/macosx-port/macosx-port>

You are looking for binaries? Then head over to the opendjk-osx-build project on Google Code (via).

Tags: , , ,

Coping with “DeprecationWarning: BaseException” Warnings in Python

January 6th, 2011 No comments

BaseException has been deprecated as of Python 2.6. So if you have something like this in your code …

try:
     doSomethingStupid()
except MyException, e:
     print e.message

… you will run in some warnings. This is a quick way to fix those problems:

try:
     doSomethingStupid()
except MyException, e:
     print str(e)
Tags:
Performance Optimization WordPress Plugins by W3 EDGE