21 March 2007

Translate 0.6.0.11

Changes from 0.6.0.10

* Fixed context menu

Small extension that translates web pages (via toolbar button) or selected text (via context menu) from and to different languages. Uses BabelFish and Google translation engines. Works only with Firefox 2.0.*

Install/Download

Translate Context Menu Problems

I've been investigating into what was causing the problem with the context menu not displaying. It turns out that my XBL binding was overriding Mozilla's and therefore preventing the menupopup element from functioning. I'll upload an new version of Translate tonight.

04 March 2007

Translate 0.6.0.10

Finally :-)

Changes from 0.6.0.9

* Compatible with Firefox 2.0.*
* Removed Tools menu functionality
* Context menu and Toolbutton menus are constructed using XBL instead of javascript

Small extension that translates web pages (via toolbar button) or selected text (via context menu) from and to different languages. Uses BabelFish and Google translation engines. Works only with Firefox 2.0.*

Install/Download

Using Rake to build Firefox extensions

I've been use rake to build my Firefox extension and found that it's been quite a pleasant experience. I needed to write a new build script as my old one was a Windows batch script and no longer use Windows for doing any development. Ant was a instant non-starter, I've had a enough XML config/programming to last me a lifetime. XML is great for data definition, not for configuration or programming. Rake seems very readable, and easy to maintain. Anyway, here's my build script for those of you interested in extension development:


require 'rexml/document'
include REXML

EXTENSION_NAME="translate"
BUILD_DIR="build/#{EXTENSION_NAME}"

# here we have a directory task, it will create the
# build directory if it doesn't already exists
directory "#{BUILD_DIR}/chrome"
task :create_buildchrome_dir => ["#{BUILD_DIR}/chrome"]

# we copy the manifest file to the build dir
# then iterate through each line and change the directory references
# to references to the jar file. this allows us to debug/develop normally
# and let the Rakefile deal with the changes necessary for release.
desc "prepare the chrome.manifest file"
file "#{BUILD_DIR}/chrome.manifest" => [:create_buildchrome_dir] do
open("#{BUILD_DIR}/chrome.manifest",'w') do |infile|
open("chrome.manifest", "r") do |outfile|
while line = outfile.gets
infile.puts line.gsub(/chrome\//, "jar:chrome/#{EXTENSION_NAME}.jar!/")
end
end
end
end
task :create_chrome_manifest => ["#{BUILD_DIR}/chrome.manifest"]

# not much to do here, just copy the install.rdf file over
# to the build dir.
desc "prepare the install.rdf file"
file "#{BUILD_DIR}/install.rdf" => [:create_buildchrome_dir] do
cp 'install.rdf', "#{BUILD_DIR}/install.rdf"
end
task :create_install_rdf => ["#{BUILD_DIR}/install.rdf"]

# here we create the jar file. ruby does natively support the creation of zip files
# so I have to use the shell to do it. the zip command allows the exclusion of certain file
# and in this case I want to exclude my svn files.
desc "create the chrome jar file"
task :create_chrome_jar => [:create_buildchrome_dir] do
sh "cd chrome && zip -qr -0 ../#{BUILD_DIR}/chrome/#{EXTENSION_NAME}.jar * -x \*.svn\*"
end

# this task makes sure the we've created the jar, prepared the manifest and install.rdf
# then we zip all of those files. We also extract the extension's version number from
# the install.rdf in order to generate the correct xpi file name.
desc "create the xpi file and use the version number in the file name"
task :create_extension_xpi => [:create_chrome_jar, :create_chrome_manifest, :create_install_rdf] do
install_rdf_file = File.new('install.rdf','r')
install_rdf_xmldoc = Document.new(install_rdf_file)
version_number = ""
install_rdf_xmldoc.elements.each('RDF/Description/em:version') do |element|
version_number = element.text
end

sh "cd #{BUILD_DIR} && zip -qr -9 ../../#{EXTENSION_NAME}-#{version_number}-fx.xpi *"
rm_rf "build"
end

task :default => [:create_extension_xpi]

21 February 2007

I got my Airport Extreme!

I ordered it on the 16th. Apple said they'd deliver on the 3rd of March, instead I received it today! Great service.
The unit itself looks great, and was a piece of cake to setup. I've already managed to setup up shared harddisk. My Macbook automatically picks up the shares using afp, while my Windows machine mounts them using SMB/CIFS. Better still the mounted volumes have indexing turned on automatically! Now I just need to see if my printer works.

20 February 2007

Translate

Sometime ago I created a Firefox extension called Translate. It was an extension that I initially created for my own needs. I thought some others might like my extension so I gave it some polish by adding a reasonable icon and some user friendliness. Subsequent versions of Firefox required bumping the version number in order to get things working. However, Firefox 2 rendered my extension completely broken. I simple version bump wasn't sufficient.

I get the odd mail now and then from people asking me if/when I can get it working in Firefox 2.0. Last weekend I spent a sometime on Translate. I've refactored a lot of the code, removed some nasty dynamic XUL building code and replaced it with nicer XBL. I've had to completely remove Translate from the tools menu, it was taking to long to debug. I'm guessing no one used that feature anyway.

Anyway, for the few remaining users of Translate, I just need to do some testing, make sure everything is working reasonably well, and release it.

01 January 2007

OGG plugin for Spotlight

I've written an OGG plugin for Spotlight. It allows Spotlight to index the comments found in OGG files. At the moment the following fields are supported; ARTIST, TRACKNUMBER, TITLE, DATE and GENRE. It seems to work for me. I make no guarantees regarding its functionality, reliability or performance so download and use it at your own risk.
Also, bear in mind that I've written this software in my forth day of Mac ownership, so I may have made mistakes with the installer and/or dmg file.


Download