August 2006


CVS supports virtual users, which have access to the repository, but not to the system.
Those users names and passwords are stored in CVSROOT/passwd file, but there is no standard method CVS provides to add users to this file.
So, how do you add a user to cvs CVSROOT/passwd file?
cvs passwd file has the following stucture:
user_name:hashed_password[:real_user]

the first row is the user name which the user is aware of (what he preceives as his user name).
the second row is the user password, encrypted with the standard unix crypt() function.
the third row is an optional real user name to map this user to. this is useful if you want all users to act under the same user.
in my case, I wanted all users to act under the user ‘cvs’ with the group ‘cvs’.
I wrote this script, which uses htpasswd, which is a standard apache tool, to create the passwd file.
(change /cvs to your actual repository path)
add-cvs-user:


#!/bin/bash
if [ $# = 0 ]; then
  echo user name not specified
  exit
fi
PASS=`htpasswd -n $1`
echo $PASS:cvs >> /cvs/CVSROOT/passwd

make sure you change the file ownership to root:root, and change the permissions for it so that only root can read its content.

See the changelog in the usual place.

A common riddle in the homework of A.I courses homework is this:
Given an NxN board, you need too arrange N queens such that no queen threatens any other queen.
Of course I write about it because I got this question in the homework of my Intro to A.I course.
The algorithm that solves this riddle efficently is a random and greedy:
Since there are N rows and N queens, there must be a queen in each column (why?),
so we put a queen in each row, but we also need to pick a row for each queen.
the idea is to randomize the rows at the begining, and then, in each iteration move one queen that reduces the number of threatened queens by a maximum.
We do it in each iteration, until the number if threatened queens reach 0, or we get to a situation where we can’t improve any more, because we had a bad start - so we start over, randomizing locations again, and doing the whole thing again, until the queens a safe spot.

The question was not algorithmic but implementational, the algorithm was desribed in the question very clearly, I only need to pick a language and implement it.
unlike my previous assignment, where I choose Prolog to implement Sudoku, which took a long time and brought questionable results, this time I decided to go for the home language - Java.
in about an hour it was written, except it didn’t work - sometimes the algorithm stuck in an infinite loop.
initially I printed the board to the console, but I quickly realized I wont get far this way:
its very hard to detect repeating patterns when they are printed as text, and its also hard to see if the queens threatens diagonaly.
I decided to do wheat I do well, and wrote a User interface that show a simulation of the algorithm, and with it I found and fixed the bugs.
I thought to myself, If I have got this far, I might as well invest some more and make it more useful:
I turned it into an Applet, to allow running it also in the browser, and added a few buttons to control the simultion.
this is the result:
Try to play with it, every time it gets stuck the background turns red and it randomize positions again.
Note that you can solve very big boards with it.
more things to notice are that there is a problem with small board (how small?) and that every time it gives a different solution because the start is random.
the applet is here, the code is included.


After many days and nights, its out!
FireStats 0.9-beta.

A word of caution to the brave user:
This is a real beta, unlike google’s beta, and as such, it has bugs.
some I know about, some I don’t - yet.

also, although I have put a lot of thought into the database structure, it may still change in the next version.
since this is a beta, you might be required to delete the firestats tables before the next install (losing the statistics you collected with it).
if you are uncomportable with it, you better wait for the stable release.

As usual, the FireStats home page contain all the details.

Although I decided not to continue developing Counterize2 in favor of FireStates (which - by the way - is progressing fine, a first version is expected soon), I received yesterday a bugfix from Greg.
The bug fix handle an issue with the dashboard display, and a problem with missing images in some of the graphs.
You can download the fix here.

FireStats is stating to take form, a new demo is available.
more info here.

After diving deeper into Counterize source, I decided to start my own statistics plugin project.
Its somewhat based on Counterize, but its an almost complete rewrite.
You can see a live demo here, comments and feedback are most welcomed.
Note that its a work in progress, this means that its will missing some obvious features, and that is not yet available for download.