Category Archives: Programming

OS X .htaccess

For some reason, I could not get .htaccess files to work on my system for the longest time. I’ve since upgraded to Leopard, and I eventually just gave up on it (I could do that, since I’m only running a development environment).

Anyway, the solution depends on which version you’re running:

For Tiger, edit /private/etc/httpd.conf AND /private/etc/users/username.conf for the correct directives

For Leopard, edit just /private/etc/apache2/httpd.conf

Days of pulling hair solved because I was looking in the wrong places.

Update: because of the upgrade from Tiger to Leopard, ALL of the above directories were present on my system, but only /private/etc/apache2 was being used.  This is because Leopard uses apache2 and Tiger uses apache 1.3.  Obviously, apache2 uses /private/etc/apache2 instead of /private/etc/httpd.  If you had installed Leopard from scratch, this would not be a problem.

MySQL Triggers

I came across an interesting problem: I needed to create priorities for records in a database so that they would be able to be displayed in a particular order. Moreover, I needed to find a way to reorder the priorities on the fly. My first instinct was for each record to have its own priority (PRI) column. But what would happen on an insert, if, say, the newly inserted item’s priority is somewhere in the middle? I would have to reorder the list. My table looks like this:

Table TEST

I have never used triggers before, but from what I understood, they would have been the perfect solution.

Continue reading

TI-85 Gaussian Classifier

Here’s a TI-85 program for the final that calculates the Mean Matrix, Covariances, Cv inverse, and the probability. I split it apart into two programs so that you can easily write down the answers and set your variables.

To calculate Mean, Covariance and Cv Inverse, enter the following into the program menu (I named mine GMEAN). The results are in variables called S and C (Cv Inverse is trivial to compute).

Continue reading

Installing PHP on Mac OS X

I’m back from my surgery. Thankfully, the laptop from my new employer arrived just in time to keep me occupied during recovery. It’s a 17″ MacBook Pro with the 1920×1200 resolution screen (Sah-weet!). 4 GB of RAM. I must say, this is probably the only machine that could have EVER switched me to being a Mac user. I will write a comprehensive review of what (still) bothers the hell out of me (after two weeks of use) in OS X, and what I find really cool (hint: the Unix prompt is #1). Anyway, I digress…

I just had the pleasure of installing PHP on Mac OS X. It took me about 3 hours to compile PHP 5.2.4 with MySQL, GD, and XML DOM API. By 3 hours, I mean, to find all the libraries, download them, compile them and install. I know OS X ships with PHP 4, but c’mon — PHP 4 will be discontinued by the end of the year.
Continue reading