Web sharing and FileVault

Posted by Dick on November 23, 2008

NetBeans 6.5 just came out, so I worked through a JQuery tutorial to try its JavaScript support.

If you make a new web project, you can specify a folder to hold the project and a URL to view it at. This lets you do live debugging of webapps, etc.

FileVault makes your home directory mode 700 (which is perfectly sensible), so OSXs Apache can’t see my Sites folder.

My workaround was to create another directory I could use :

sudo mkdir -p /Users/rasputnik-pub/docroot
sudo chown -R rasputnik /Users/rasputnik-pub

and then point apache to that by creating /etc/apache2/other/fix-filevault.conf that looks like :

Alias /rasputnik/ /Users/rasputnik-pub/docroot/
<Directory /Users/rasputnik-pub/docroot>
  Allow from all
</Directory>
# advertise via Bonjour, like a 'real' Sites directory
RegisterResource "Rasputnik" /rasputnik

Now kick apache

sudo apachectl restart

and content under /Users/rasputnik-pub/docroot should be visible at http://localhost/rasputnik/ (or http://hostname.local/rasputnik/).

decent postgreSQL install on OSX

Posted by Dick on August 17, 2008

public service announcement

I need a good database to run locally. When I Google for ‘postgreSQL OSX’ I see a lot of old posts that start with ‘download and build readline’. No wonder people still use MySQL.

If you’re on a Mac use EnterpriseDBs installer. It’s up to date and you get a reasonably sane default config

(everything is under /Library/PostgreSQL/8.3 if you want to tweak it).

Also bundles docs and pgAdmin (which seems to have become a half-decent tool  while I wasn’t looking) in /Applications/PostgreSQL (I found a JDBC driver under /Library/Extensions/Java too, although that could have come from anywhere).

There are also installers there for Linux (but you might as well use your package manager ) and Windows (no, really).

For production, I’d use something on a ‘real’ UNIX obviously - the Solaris 10 / SXCE bundled PostgreSQL 8.2 / 8.3 works great.

changing the default JVM on OSX Leopard

Posted by Dick on May 21, 2008

I’ve been using a bit of Java lately, and the OSX 1.6 JVM seemed pretty stable.

JRuby is the next thing on my geek list, and that runs best on Java 6.

Although the 1.6 JDK was installed in the last system update, it’s not the default:
 

hypnotoad:Desktop $ /usr/bin/java -version
java version "1.5.0_13"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05-237)
Java HotSpot(TM) Client VM (build 1.5.0_13-119, mixed mode, sharing)
hypnotoad:Desktop $
hypnotoad:~ $ ls -l `which java`
lrwxr-xr-x  1 root  wheel  74 30 Apr 10:07 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
hypnotoad:~ $ cd /System/Library/Frameworks/JavaVM.framework/Versions/
hypnotoad:Versions $ ls -ld Current*
lrwxr-xr-x  1 root  wheel    1 30 Apr 10:08 Current -> A
lrwxr-xr-x  1 root  wheel    3 30 Apr 10:07 CurrentJDK -> 1.5

I know what you’re thinking. Don’t. Re-pointing those symlinks seems to work, but in fact it breaks all your GUI apps (the ‘A’ is for AWT)::

hypnotoad:Versions $ jconsole
2008-05-20 23:26:20.524 jconsole[680:10b] Apple AWT Startup Exception : ** -[NSCFArray insertObject:atIndex:]: attempt to insert nil
2008-05-20 23:26:20.525 jconsole[680:10b] Apple AWT Restarting Native Event Thread

Instead, you want to open /Applications/Utilities/Java/Java Preferences.App :

'Java Application Runtime Settings' determines the output of 'java -version'

hypnotoad:~ $ java -version
java version "1.6.0_05"
Java(TM) SE Runtime Environment (build 1.6.0_05-b13-120)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_05-b13-52, mixed mode)
hypnotoad:~ $

( ignore the text about ‘when an applet is executed in this browser’ - Intel Safari is 32-bit, and if you’re on PPC you don’t get JAVA 6 anyway ).

That Steve Jobs has a great sense of humour.

first look at GF3

Posted by Dick on May 13, 2008

Fishes eyes

I’ve been following Glassfish with interest for a while now
I want a Tomcat replacement: webapps, a connection pool and an admin
interface that doesn’t stink. Not much to ask.

Glassfish2 delivers all that in spades, plus clusters very nicely.
But it also has a lot of J(2)EE features that I’m not really interested in.

Glassfish v3s design follows a ‘microkernel’ model, which should mean its
a lot lighter, faster, and lets you mix and match the features you need.

It’s matured enough for me to give it a go.

Get it from https://glassfish.dev.java.net/downloads/v3-techPreview-2.html. The same ZIPfile runs on all platforms (I’m on a Macbook Pro).

cd ~/Applications
unzip ~/Downloads/gfv3-preview2.zip
PATH=$PATH:~/Applications/glassfishv3-tp2/bin

nice feature #1 : typo detection

hypnotoad:glassfishv3-tp2 $ ./bin/asadmin list-domain
Closest matching command(s):
list-domains
Remote server does not listen for requests on [localhost:8080].
Is the server up?
Command list-domain failed.
hypnotoad:glassfishv3-tp2 $ ./bin/asadmin list-domains
domain1
Command list-domains executed successfully.

nice feature #2 : boot time

hypnotoad:glassfishv3-tp2 $ time asadmin start-domain domain1
Command start-domain executed successfully.
real  0m1.029s
user  0m0.456s
sys 0m0.091s

nice feature #3 : not everyone needs an /admin webapp

First nice feature: open http://localhost:8080 and try
‘to manage the server, click here ‘. Glassfish gets the request for /admin,
realises it doesn’t have an admin webapp, and offers to install it whle U wait:

Once admingui.war downloads, it’s deployed and you get a login prompt.
Login as ‘anonymous’ (no password) and you get the usual admin screen -
as you can see there’s a lot less stuff in there by default.

nice feature #4 : you can deploy things to it

(In my experience, that’s not a given).

Just knock up a stub webapp in Netbeans ( here’s one I made earlier ) and deploy it:

hypnotoad:glassfishv3-tp2 $ time asadmin deploy ~/NetBeansProjects/hellonasty/dist/hellonasty.war
upload file successful: /private/tmp/gfv3/hellonasty.war
Command deploy executed successfully.
real  0m2.393s
user  0m0.288s
sys 0m0.071s

And here it is:

nice feature #5 : documentation

is at : http://docs.sun.com/app/docs/coll/1343.7

next steps

Seems to run OK to me, even though OS X isn’t listed as a supported platform yet.
There are a few features missing (asadmin list-commands is a lot shorter than on GFv2)
but I’m pretty pleased with it.

Next on the list : hook up NetBeans and JRuby and try deploying a database-backed Rails app.
I’ve just figured out how to get JavaDB and Glassfish to play nice.

this site best viewed in…

Posted by Dick on March 27, 2008

This mornings WebKit nightly build rendering the Acid3 test:

 webkit r31370 FTW 

 And look! Firefox painted me a beautiful picture too:

5/10 SEE ME  

 That’s lovely, sweetheart. 

Guess who’s not regretting switching a couple of months back.To be fair, Opera apparently scores very highly too (both its users must be delighted).