XPather 1.4 on Firefox 3

XPather What to say. I made Firefox 3 compatibility update of XPather. Go, and get it from XPather’s site or soon also from AMO. Bye.

Oh yes, since FF 3 beta 4, the DOMinspector is not anymore distributed with FF. You need to install it as a separate extension.

Oh, XPather has always been just a small development-utility toy-project, though it helps (a lot?). Anyway, the facts are inspiring: 2,5 year old; 58000 downloads; very positive feedback; $7 donations (+5 empty promises); $27 adsense. The mission: contribution to public successful. Isn’t it? ;)

Easy cron scheduling in Ruby.

You do Ruby. You are on *nix. You have a task you need to schedule using cron from your scripts. Later you schedule another task. After some time, and probably from another script, you want to unschedule/cancel the first task … How do you do it?

Fetch CronEdit

    sudo gem install cronedit

….and just do it:

    
    Crontab.Add  'agent1', '5,35 0-23/2 * * * echo agent1'
    ...
    Crontab.Add  'agent2', {:minute=>5, :command=>'echo 42'}
    ...
    Crontab.Remove 'agent1'

You can CRUD your tasks independently (based on the IDs you give them). The schedule can be in Hash notation, or the standard cron text definition.

UPDATE: The new version of library allows you to do some more tricks. First of all, you can manipulate groups of definitions (bulk/group operations). Besides modifications of the actual crontab, you can do now all operations upon files or in memory. And you can combine these ‘devices’ as needed. Let me show you a small example:

    fc = FileCrontab.new '/jobs/mail-delivery.cron'
    Crontab.Merge fc
    ...
    Crontab.Subtract fc

The previous snippet loads a group of cron definitions from file and merges them with the current system crontab. On the last line the same group of definitions is removed from the system crontab.

See documentation for more details and examples.
UPDATE: A related article discusses the library in context of scheduling of Ruby Agents using Cron.

In Ruby there are few schedulers out there, for example the most advanced: openwferu scheduler. They are great for many task, yet…. they are Ruby proprietary schedulers and the host ruby script needs to be running. If you need native cron scheduling, for whatever reason, go for CronEdit.

Rhotoalbum – a ruby photo album generator

Do you want to have photo albums (on your site)? I did. I wanted a comfortable but not “over-web20-ized” user experience, and above all, simple and pragmatic content management/control.

Believe or not, nothing I came across was just the right thing. Too heavy, too weak, too ajaxy, unacceptable license, etc. At the end of the day I found out I had not had to look too far. Ondrej Jaura (a good friend of mine) created a simple command-line album generator – Rhotoalbum. Bonus: it is written in ruby :)
You treat your images as ordinary files in directories (which stand for albums) and run a generation command. That’s all you need to do. You add new images or change something? Just run the same script – anytime. It creates necessary thumbnails, and simple style-able index pages. For slideshow purposes it (optionally) integrates with nice TripTracker.

My way of appreciation of my Ondrej’s great work was … to contribute the project and help out in making it better. This resulted into a release of a new stable version 0.3 these days.

Well, I started this post saying I wanted some place for our photos to show them to friends occasionally. Here is are our Rhoto photo gallery. Another showcase for Rhotoalbum is Ondrej’s photo gallery.

Acquisition of LumberJaczk Technologies

LumberJaczkIn Summer 2005 I started few home-made experiments with workflows for governing complex processes – such as system integration on Web layer. I did this as a part of my PhD activities. The main motivation had been my deep disappointment with all the “enterprisy” workflow systems bull**** laying around. I needed something very dynamic, light-weight and portable. I needed a hammer !

I engaged with Mozilla platform and built a workflow engine on top of this unbelievably feature-rich and mature open-source technology. This platform, surprisingly, allowed for much more. So I added libraries for Web navigation, information extraction, rich GUI, etc.

At the end of the day, there it was: a system for development and execution of full-fledged personalized on-top-Web applications. Users could create and share their own scenarios, own personal agents for searching best cars, checking back account, performing complex transactions on portals, or making any mashups crimes. You can learn more about it on the LumberJaczk homepage. From the very beginning the system was meant to be open-source as it really fits the model.

In mids 2006 a wave of strong interest arouse from commercial segments. Unfortunately this interest clashed with the open-source strategy.

Lixto Software GmbH.May 2007 – The end of the story (or beginning of another one). Lixto Software GmbH acquires the LumberJaczk technologies. Lixto is at the moment one of the market-leaders in the field of Information Extraction and a solution provider for Online Market Intelligence, Web Process Integration and Metasearch. Openly, the current plan of the company is to keep the source closed.

I hope interesting things will happen!

JSSh for Firefox on Linux (because Firewatir loves it)

It goes like this: Firewatir, the Firefox port of WATIR, depends on JSSh. And JSSh does not install & run nicely on Linux. Clear ?
Annoyed by this situation, I looked what’s the problem with this JSSh. To make the story short, success – downlaod the working JSSh for Linux here.
Update 2007-04-11: modified to work also with FF 1.5.3+

Oh, by the way, JSSh stands for JavaScript Shell and it allows you remotely manipulate Firefox remotely. Firewatir gives you a higher-level toolkit for “Web Application Testing in Ruby” (of course not Web scraping ;>>> ). Talking about it let me show how to install the whole thing:

(0. I would recommand to create a dedicated Firefox profile run Firefox in a dedicated profile firefox -ProfileManager)

1. Downlaod and install JSSh extension to Firefox and restart it.

2. Start Firefox:
firefox -P testyard -jssh

The JSSh should be up, listening on port 9997 (note: consider security issues). You should be able to communicate with Firefox via telnet. For example:

>telnet localhost 9997
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Welcome to the Mozilla JavaScript Shell!
> 1+1
2
> help()
....
> exit()

3. Dowload firewatir (you have to do it from its homepage, it is not on rubyforge yet). Use the mswin32 version, although you are on Linux. Install:
sudo gem install firewatir-1.0.1-mswin32.gem

3. Get to the real ruby test. For example:

require 'rubygems'
require 'firewatir'
include FireWatir

ff=Firefox.new
ff.goto("http://www.google.com/ncr")
ff.text_field(:name,"q").set("ruby")
ff.button(:value,"Google Search").click
puts ff.element_by_xpath("//a[@class='l']").text
ff.close

PS: For those interested in what did I fix: I took one of the latest builds from Dave, repackaged it so that it installs “properly” – as an extension of “21st century” – and added the config GUI shipped originally with the JSSh. It was tested with FF 2.0.0.1 on Ubuntu (Eft), Kubuntu, Gentoo. Update: tested also on FF 1.5(.0.7)

Subversion: move, migrate, split

Common problems: a repository in on server A and needs to be migrated onto server B; a single repository needs to be spit into few separate ones; what to do with local working copies after server migration; the repository storage method needs to be changes e.g. from berkleyDB to file-system.

In some simple cases the repository can be moved directly on file system level. However, the following steps describes a more complex case, in a generally applicable way: a migration and split of repositories from one server to another, fixing the local working copies. Assume this situation:

ServerA, repository: projects  path: /proj1
                            path: /proj2

->

ServerB: repository: proj1     path: /
ServerB: repository: proj2     path: /

For example: https://svn.server.com/projects/proj1 -> https://mysvn.com/proj1

1. Export the repository on ServerA
svnadmin dump /path/to/repos/projects > projects.dump

2. Split / filter out repositories
svndumpfilter include proj1 < projects.dump > proj1.dump
svndumpfilter include proj2 < projects.dump > proj2.dump

3. Fix the paths
As the dump is in a text format you can easily edit it to change prune the projects root directory. You do it:

  1. by renaming the paths:
    sed -e "s/Node-path: projects//Node-path: /" < proj1.dump > proj1-fixed.dump
    The same for proj2.dump
  2. and removing the section that creates the root directory, i.e. delete the following lines form somewhere at the beginning of both dumps proj1-fix.dump and proj2-fix.dump:
    Node-path: projects
    Node-action: add
    Node-kind: dir
    Prop-content-length: 10
    Content-length: 10

    PROPS-END

4. Import the repositories on Server
Create a new repository for each project and import the dumps. (A detailed description of how to setup a Subversion (and friends) is in my previous post)

svnadmin create /path/to/repos/proj1
svnadmin load /path/to/repos/proj1 < proj1-fixed.dump

Do it analogically also for proj2.

Done
Happy checkout :) After migration you'd rather check/modify/recreate the hooks, users for authentication (if you used some of those). And again, read the official SVNBook for details.

Fixing existing working copies
If you don't want to checkout but rather continue using existing working copies you can (cannot be done in case of some repository splits).

First of all, use --force-uuid option for svnadmin load (step 4). Then you can tweak the local copy by running (in the root of the local repo):
svn switch --relocate http://ServerA/testproject https://ServerB/project .

Installation of Subversion on Ubuntu, with Apache, SSL, and BasicAuth.

I did it again! Yet another installation of Subversion for “standard” project development purposes, i.e. using Apache2, WebDAV, SSL, Basic Authentication. In case I do it again … and soon again, I recorded the installation howto logs.

NOTE: The target OS is Ubuntu Edgy 6.10, and Feisty. I use $NAME notation to refer to places to be substituted by the installation specific values

1. Install packages:
sudo apt-get install subversion libapache2-svn libapache-mod-dav apache2

2. Enable SSL:
sudo a2enmod ssl
sudo sh -c "echo 'Listen 443' >> /etc/apache2/ports.conf"

3. Generate Certificate:
Ubuntu < Feisty:
sudo apache2-ssl-certificate
Use the server name to be used for access the web server.

Ubuntu >= Feisty: (thanx Roderik)
sudo apt-get install ssl-cert
sudo mkdir /etc/apache2/ssl
sudo /usr/sbin/make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem

4. Create Virtual Host:
sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/$SITENAME
sudo vim /etc/apache2/sites-available/$SITENAME

change:
NameVirtualHost *:443
<VirtualHost *:443>

add:
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.pem
SSLProtocol all
SSLCipherSuite HIGH:MEDIUM

5. Enable the site:
sudo a2ensite $SITENAME
sudo /etc/init.d/apache2 restart

A warning that complaints about failure of server name determination can be fixed by adding ServerName $SERVERNAME to the main Apache config /etc/apache2/apache2.conf

6. Adding repository(ies):
The following setup assumes we want to host multiple repositories.
sudo mkdir /var/svn
sudo svnadmin create /var/svn/$REPOS
sudo chown -R www-data:www-data /var/svn/$REPOS
sudo chmod -R g+ws /var/svn/$REPOS

7. Adding Basic Authentication:
sudo htpasswd2 -c -m /etc/apache2/dav_svn.passwd $AUTH_USER

8. Enable and configure WebDAV and SVN:
Add to /etc/apache2/mods-available/dav_svn.conf
DAV svn
SVNParentPath /var/svn
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd
Require valid-user
SSLRequireSSL

and for non-anonymous access comment out:
#<LimitExcept GET PROPFIND OPTIONS REPORT>
#</LimitExcept>

(optionally the same configuration can be set for particular virtual host only, i.e. /etc/apache2/sites-available/$SITENAME)

9. Finalization: (guess what?)
sudo /etc/init.d/apache2 restart

Testing:
Web access:
lynx https://localhost/svn/$REPOS exposes the repository.
lynx http://localhost/svn/$REPOS says: eat my shorts , i.e. 403-forbidden.

An initial import:
svn import --username $AUTH_USER $A_FILE https://localhost/svn/$REPOS/testdir -m "Testing"

… and check-out:
svn co --username $AUTH_USER https://localhost/svn/$REPOS

To add a new repository just repeat the step 6 (without making the root directory of course).
If you wish to configure a single repository only, instead of point 6:
sudo svnadmin create /var/svn
sudo chown -R www-data:www-data /var/svn
sudo chmod -R g+ws /var/svn

and in /etc/apache2/mods-available/dav_svn.conf (step 8) use this instead of SVNParentPath:
SVNPath /var/svn

Above all, check the great SVN Book.

New Version of XPather 1.1

XPatherHola hey! A new version of XPather is out since Sep 29 2006. Though it may take some time to appear also on AMO, it is already available at XPather’s site.

The new version brings few severe bugfixes, improvements, and two new features:

  • Cross-frame XPath evaluation – You can evaluate your XPaths from one place against all frames/iframes/etc in the document.
  • Handling of default namespaces – The documents with default namespaces can be queried.

For the detailed list of changes check out the changelog. All of you folks who have already installed XPather (and who have not deactivated the automatic extension updates) should get the updates automatically.

Enjoy!

On-top-of-Web Applications’ Address: lumberjaczk.org

Two weeks ago I announced the new project – the LumberJaczk. There I described it as: LumberJaczk - On-top-of-Web applications

An open-source technology that enables better ways to get and use information on the Web. It let people run and create light-weight on-top-of-Web applications and share them with others. Hacking out your own “best flights search”, “personal investments monitor” will be fun to do.

Since yesterdays late night, the LumberJaczk has its official Web running public at:

Besides the “obligatory” project information the site features few use-cases and screencasts showing the LumberJaczk in action. To keep you informed of what’s going on next subscribe to the project news RSS feed, or join/browse the project mailing list. I’m looking forward to hearing from you guys :)