Archive for the 'Uncategorized' Category

logcheck update on FreeBSD

Saturday, January 23rd, 2010

Logging this quickly for posterity.

If like me, you just updated the logcheck port on your FreeBSD to version 1.2.69_1 and found that it’s broken, you might have run into the same permission problem I did.

Apparently, the port installed some files with too restrictive permissions and the error message from logcheck does not help. The files in question are some dynamically interpreted Perl plug-ins to detect rotated files in various schemes.

Just change the permissions as follows and it should all work again:


# chmod 644 /usr/local/share/logcheck/detectrotate/*.dtr

Tornado with VirtualEnv and Pip Quickstart

Friday, October 9th, 2009

Friendfeed’s open source Tornado web server is great, and is incredibly easy to get up-and-running. Just install tornado, write your app and run it.

At some point, however, you’d want more structure in your project and manage dependencies to ease deployment. This is where virtualenv and pip shines. For a few more steps, you can bootstrap your project and have the warm fuzzy feeling that you can easily deploy the stuff when the code is ready.

Installing virtualenv and pip

If you haven’t set up virtualenv, do so (as root):

# easy_install virtualenv

Decide where you’d put your project directory. I’ll use /path/to/myapp for now. The next step is to create a virtualenv where all your Python packages are stored. I like to use the convention of a directory called root where all dependencies are installed. I’d generally also use it as the prefix for any cmmi packages that I’d like to contain within the project.

$ cd /path/to/myapp
$ virtualenv --no-site-packages root

Activate the environment that we just created:

$ . root/bin/activate
(root)[wil@wasabi /path/to/myapp]$

From now on, all packages installed with easy_install will be placed in this virtualenv.

Next, we will install pip into this virtualenv:

(root)[wil@wasabi /path/to/myapp]$ easy_install pip

Once pip is installed, as long as you’ve got your virtualenv activated, anything installed with pip will also go into the right place (without your having to remember to use the -E command line argument.)

Installing Tornado

Tornado (as of the current version) needs two mandatory dependencies, i.e. pycURL and simplejson. Make sure you have the right libcURL version installed on your system (using apt-get or other mechanism) and pick the compatible pyCURL version.

(root)[wil@wasabi /path/to/myapp]$ pip install pycurl==7.16.4
(root)[wil@wasabi /path/to/myapp]$ pip install simplejson

Now we’ll install tornado proper. I chose to go with the bleeding edge and ask pip to install from the git trunk.

(root)[wil@wasabi /path/to/myapp]$ pip install -e \
  git+git://github.com/facebook/tornado.git#egg=tornado

Should you not want that, you can tell pip to install from the tarball URL instead (at least until tornado gets added to PyPI.)

(root)[wil@wasabi /path/to/myapp]$ pip install \
  http://www.tornadoweb.org/static/tornado-0.2.tar.gz

Tornado is installed!

Every now and then, it’s a good idea to save your pip dependencies by running

(root)[wil@wasabi /path/to/myapp]$ pip freeze > pip-req.txt

Start your project

What I like about this is that the project directory has all the dependencies contained within a single directory (root). This is really just my convention; I’d create a src directory where my application code lives.

(root)[wil@wasabi /path/to/myapp]$ mkdir src
(root)[wil@wasabi /path/to/myapp]$ cd src
(root)[wil@wasabi /path/to/myapp/src]$

Let’s test drive Tornado:

(root)[wil@wasabi /path/to/myapp/src]$ cp ../root/src/tornado/demos/helloworld/helloworld.py .
(root)[wil@wasabi /path/to/myapp/src]$ python helloworld.py

From browser, visit your host at port 8888 to verify.

That’s it!

links for 2009-02-19

Friday, February 20th, 2009

links for 2009-02-18

Thursday, February 19th, 2009

IDN Converter

Monday, October 9th, 2006

Quickly hacked up a two-way IDNA converter for IDNSearch. It has a short and easy-to-remember URL too: idnsearch.net/converter

Enjoy :D

Linksys WRT54GP2 Router with ATA

Thursday, May 26th, 2005

I seldom get a toy like this, so I’m very excited!

Linksys WRT54GP2 with ATA

This is essentially a combination of the WRT54G wireless router and a Sipura 2000. I get to play with this because I had signed up to be a beta tester with engin, with whom I am contracting.

Incidentally, the announcement came today that engin had won the AIIA 2005 award for communications applications. I can’t help but feel proud, though I haven’t been around long enough to claim any credits for it. Congratulations, and kudo’s to all my colleagues.

BugMeNot.com down

Tuesday, August 17th, 2004

I can no longer access the site to get my free passwords. Did a quick DNS check: ns1.bugmenot.com and ns2.bugmenot.com aren’t serving up the A record, so I’m not sure whether it’s a transient problem or if NYT and gang caught up with it…

Sigh… all good things must come to an end. But wait! The creators of BugMeNot had anticipated it and mentioned Project Hydra as its successor (See the google cache for http://www.bugmenot.com/assist.php.)

What is dready?

Thursday, February 12th, 2004

I’ve been using dready as a personal handle for at least 6 years now. Many people have expressed their confusion of the word “dready” whenever I spelt it out to them. They don’t usually ask me directly what it is but I can tell by the look on their faces, I can see it even over the phone:

XYZ: Can I have your email address please?
Me: Sure! It’s wil _at_ dready _dot_ org, ‘d’ ‘r’ ‘e’ ‘a’ ‘d’ ‘y’.
XYZ: …
Me: Have you got it?
XYZ: .. yes.
Me thinking: you sure?

Yet, some have called it d-ready, or mistaken it for “already”.

So, what exactly is “dready” and how should I pronounce it?

Well, I was inspired by the character on the record bag that I was using. Later, I discovered www.dreadybrand.com and is accompanied by Sista too! As you can see, they’ve got dreadlocks, and that’s how “dready” got his name. Pronounce it as \dread”y\.

Eventhough I don’t know where the bag is right now, I can always go see dready and get that warm, nostalgic feeling.