Saturday, July 28, 2007

Javascript get the local file path in Mozilla

This function gives you the local file path of the file (nsIFile).

function getLocalFilePath(file) {
// file is nsIFile
var ios = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var fileHandler = ios.getProtocolHandler("file")
.QueryInterface(Components.interfaces.nsIFileProtocolHandler);
var URL = fileHandler.getURLSpecFromFile(file);
return URL;
}

Thursday, July 19, 2007

svn ignore files and directories

Ignore files and directories
The svn:ignore property can be set on filename patterns and directories.

svn propset svn:ignore PATTERN directory PATH
svn propset svn:ignore directory PATH

Edit property setting
Subversion properties can be edited using svn’s propedit function.

svn propedit svn:ignore PATH
svn propget svn:ignore PATH

PATH is assumed current working directory if not specified. If PATTERN is not specified, an editor window will open and let you edit patterns.

Wednesday, July 18, 2007

ActiveRecord Session for Rails

I know that this is probably all over the Internet, this is just an entry for my own convenience.

  • Uncomment the ‘config.action_controller.session_store = :active_record_store’ from the app/config/environment.rb
  • rake db:sessions:create
  • rake migrate

Restart your server, and you are done!