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.
I was recently tasked with supporting multiple languages in a PHP script. I found an article on about.com that was a good starting point. The author basically suggested creating associative arrays with different translations:
(P.S. I modified his code just a little to better conform to PHP 5 standards)
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:
I have never used triggers before, but from what I understood, they would have been the perfect solution.
Not really a KNN Classifier, as much as a mass, N-dimension euclidean distance calculator.
Input is a Matrix MAT of all the points to test against (row-based), and a Vector X the point to test against. Output is a Nx1 matrix V of all the distances between X and each row of the Matrix (in order).
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).
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.
The Depth-First Search algorithm can be used to find a path between two points. I recently had to use it to draw a map in PHP. This is my implementation of a graph structure with DFS in PHP5. Download the source.