Wednesday, May 2, 2012

Mac OS (10.6+) Mount external filesystem

Why do that?


  1. Allows you to drag-drop files between server filesystem and your machine without using FTP software
  2. Allows you editing remote files with your favorite editor (Textmate, emacs) directly (Yay, no more ugly VI editing)

How to do that?

  1. Make sure you are running MacOS 10.6+ (Current dependency of macfusion)
  2. Install OSXFuse from http://osxfuse.github.com/
  3. Install Macfusion from http://macfusionapp.org/
  4. Run Macfusion
  5. Configure your connection by pressing "+" button and entering your server credentials
  6. Click "Mount"
  7. Press Cmd-R to reveal mounted filesystem in Finder
  8. Enjoy

Sunday, July 26, 2009

Mac OS X: Installing Rhino

Pretty good tutorial found here

Mac OS X: Installing and using SQLITE with Rhino JavaScript

1. Download latest jar from here.
2. Move the jar to ~/Library/Java/Extensions/
3. Start using it in JavaScript as follows:


importPackage(java.sql);
java.lang.Class.forName('org.sqlite.JDBC');

try {
var sDB = 'test.db';
var oConnection = DriverManager.getConnection('jdbc:sqlite:' + sDB);
var oStatement = oConnection.createStatement();

oStatement.executeUpdate('create table t(id smallint, value varchar(25))');

oStatement.executeUpdate('insert into t values(1, "hello")');
oStatement.executeUpdate('insert into t values(2, "world")');

var oResultSet = oStatement.executeQuery('select * from t');
while (oResultSet.next()) {
print(oResultSet.getString('id') + ' – ' + oResultSet.getString('value'));
}

oResultSet.close();
oStatement.close();
oConnection.close();
} catch (e) {
print(e);
}