At home I have a Macbook Pro that acts as my everyday desktop computer and a headless (no monitor) Ubuntu Linux server that acts as a development testbed. The Ubuntu server has Apache, MySQL and PHP installed for development. My Mac has that too, but I prefer turning those services off and let the Linux machine do the heavy lifting. Usually, it’s sufficient to log into the Linux machine through SSH and hack around with vi. However, there are times that you may want to log into the Linux GUI. That’s a pain in the arse for me, since I would have to connect a monitor and keyboard to the server. The simplest solution is to log in through X and XDMCP.
Continue reading
Free Tools for the Mac Hacker
I use the Mac OSX daily for my job as a developer. It’s a Unix based OS so it has a very ‘hackerish’ feel to it if you get past the shiny GUI. In fact, Leopard has PHP, perl and python installed and ready for use from the get-go. Here are some tools that I use for the Mac to make my life easier.
Continue reading
Realistic Bouncing Spheres C++ mini-Implementation
Here’s a good article for realistically modeling collisions between spheres. It’s an oldie but a goodie.
Pool Hall lessons
There’s a bit of pseudo code at the bottom, but I’ll post on a C++ implementation of the article.
Continue reading
SVN: The client is older than the working copy repository.
This post is for my benefit. Sometimes when working with SVN, I will use a tool like Eclipse/SVN or some fancy GUI svn, but then decide to ditch it and do things through the command-line. And as things have it, the command-line version is an older version than my fancy GUI SVN. The SVN client will complain: “This client is too old to work with working copy ‘…’ “. And I end up googling for the fix (because I know there is one and I’ve used it in the past) and have a hard time coming up with the keywords to find it.
Here it is for quick reference:
More to the point, here’s the script to fix it: Working Copy Format Script
From the FAQ:
I got an error saying “This client is too old to work with working copy ‘…’ “. How can I fix it without upgrading Subversion?
Sometimes the working copy metadata format changes incompatibly between minor releases. For example, say you have a working copy created with Subversion 1.4.4, but one day you decide to try out Subversion 1.5.0. Afterwards, you attempt to switch back to 1.4.4, but it doesn’t work — it just gives the above error.
This is because 1.5.0 upgraded your working copy format to support some new features (in this case, changelists, the keep-local flag, and variable-depth directories). Although 1.4.4 doesn’t know anything about these new features, it can at least recognize that the working copy format has been upgraded to something higher than it can handle.
1.5.0 upgraded the working copy for a good reason: it realizes that 1.4.4 does not know about these new features, and that if 1.4.4 were to meddle with the working copy metadata now, important information might be lost, possibly causing corruption (see issue #2961, for example).
But this automatic upgrade behavior can be annoying, if you just want to try out a new release of Subversion without installing it permanently. For this reason, we distribute a script that can downgrade working copies when doing so is safe:
MySQL tidbits: IF statement
A useful (but seemingly underused) SQL keyword is the IF statement.
The usage is as follows:
SELECT IF(expr1, expr2, expr3);
If expr1 evalues to true, then expr2 is executed, otherwise, expr3 is. This is useful for doing conditional queries inside the SQL without having to put logic in your script/program.
SELECT IF( (SELECT name FROM people) = 'john'), (SELECT age FROM people WHERE name = 'john') , 'no age');
The above statement will return the age of the user ‘john’ if he exists in the people table. If not the query will return ‘no age.’
The caveat is that expr2 and expr3 must evaluate to a single value. The braces around expr2′s SELECT statement are required.
