/girls
ls -a /girls | grep 'chill'
Straight outa the foothills of Vermont.
Came upon this rather slick geocode class written in PHP5 for use with google maps.
Thought I would share it.
Just fixed the weird spacing on the p tag within posts, and commentlist list-style-position to outside.
Should help clean things up a bit.
if($blog->lastUpdate > '2 months') { echo 'DUDE WTF'; else { echo 'n_n'; }
Be sure to grab this package, if you’re doing any major PHP development on your Ubuntu box.
Running PHP interactively is a fun and productive way to debug and test out your applications code without having to refresh your browser every time you make a change.
Besides having to install the package, you have to add the -a flag to /usr/bin/php under the terminal.
/usr/bin/php -a
It’s that simple. You can use absolute paths when including files, or cd into your applications directory and begin relatively including your code base.
While you could technically run your entire application under the interactive console, I would highly discern anyone from doing so. I recommend you just include the current file you are testing and work out any bugs one at a time.
I know a lot of developers are using and writing their own test modules to debug their code for them, but I prefer to be face-to-face with my code when I’m testing. You start to build a familiarity with your code in doing so and finding better ways to do things when you’re dealing with it personally. After all you’re going to be the one documenting and interfacing with the code, be one with the code.
ruby -le '33.times{|y|print" "*(32-y),(0..y).map{|x|~y&x>0?" .":" A"}}'
So the other day I decided to upgrade to Ubuntu Hardy Heron, and after a few days of testing it out I was getting some very strange memory leaks. Also, there were “zombie” processes hanging under “sh” that I couldn’t probe. Fed up with current circumstances in the bloated-Linux-world, I decided to switch back to the tried and true - after all I really had no reason to not switch back other then my undeniable hatred for the Lilo bootloader.
I got over it, and got it up and running late last night. This morning I got the latest nvidia drivers running, as well as my adjusted my sound card levels. Much to my suprise this sound card (Audigy 2) works great under slack.
My first hurdle was getting mysql to start.. I kept getting a nohup error and it wasn’t allowed to connect to the mysql socket. First things first, permissions and users.. make sure the server isn’t running:
ps xa | grep mysql
You should only see your grep process in the list of processes and you’re good to move on.
sudo chown -R mysql:mysql /var/lib/mysql/ sudo chown -R mysql:mysql /var/run/mysql/
Next we need to get our config in place:
sudo mv /etc/my-small.cnf /etc/my.cnf
After that we can run the database installer:
sudo /usr/bin/mysql_install_db
Once that is complete, we can start up the server:
sudo /usr/share/mysql/mysql.server start
We’ll also want to move the mysql script to our rc.d folder so that it can be started upon boot:
sudo cp /usr/share/mysql/mysql.server /etc/rc.d/rc.mysql sudo chmod 644 /etc/rc.d/rc.mysql
Lastly we’ll create a new password for the root user in mysql:
sudo /usr/bin/mysqladmin -u root password 'your password here'
That’s all, you should now be able to connect to the server just fine. If you need any help with Mysql commands and command-line syntax check this out.
After initially testing ModRails with my supreme hosting partner, I decided to try out a common application on the system. I still amazed at how fast this system is.. see for yourself:
zscott@Lian:~$ ab -n 1000 http://zak.railsplayground.net/ This is ApacheBench, Version 2.0.41-dev <$Revision: 1.141 $> apache-2.0 Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/ Benchmarking zak.railsplayground.net (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Finished 1000 requests Server Software: Apache/2.0.59 Server Hostname: zak.railsplayground.net Server Port: 80 Document Path: / Document Length: 47 bytes Concurrency Level: 1 Time taken for tests: 176.54368 seconds Complete requests: 1000 Failed requests: 2 (Connect: 0, Length: 2, Exceptions: 0) Write errors: 0 Total transferred: 481156 bytes HTML transferred: 85390 bytes Requests per second: 5.68 [#/sec] (mean) Time per request: 176.054 [ms] (mean) Time per request: 176.054 [ms] (mean, across all concurrent requests) Transfer rate: 2.66 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 64 82 16.9 78 191 Processing: 65 92 72.8 80 1251 Waiting: 64 90 59.9 79 1164 Total: 135 175 75.4 161 1324 Percentage of the requests served within a certain time (ms) 50% 161 66% 170 75% 180 80% 186 90% 206 95% 236 98% 290 99% 401 100% 1324 (longest request)
Today Joe set-up beta testing for modrails on railsplayground, and a test account for me to play around with.
I quickly setup a basic Contact manager using Rails 2.02 scaffolding and added some test data. After the initial bump of forgetting to configure for production we were under way.
These are the results of benchmarking the application under 1,000 requests, looks good so far.
zscott@Lian:~$ ab -n 1000 http://zak.railsplayground.net/contacts This is ApacheBench, Version 2.0.41-dev <$Revision: 1.141 $> apache-2.0 Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/ Benchmarking zak.railsplayground.net (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Finished 1000 requests Server Software: Apache/2.0.59 Server Hostname: zak.railsplayground.net Server Port: 80 Document Path: /contacts Document Length: 2357 bytes Concurrency Level: 1 Time taken for tests: 151.627619 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 3060000 bytes HTML transferred: 2357000 bytes Requests per second: 6.60 [#/sec] (mean) Time per request: 151.628 [ms] (mean) Time per request: 151.628 [ms] (mean, across all concurrent requests) Transfer rate: 19.71 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 55 69 13.8 66 288 Processing: 60 81 36.4 75 739 Waiting: 59 77 29.2 71 586 Total: 118 151 39.2 144 808 Percentage of the requests served within a certain time (ms) 50% 144 66% 151 75% 156 80% 160 90% 174 95% 191 98% 222 99% 264 100% 808 (longest request)
Although there are many way’s to test whether or not your model has saved, this is a fool-proof way that I’ve come to love.
begin object.save! rescue Record Invalid => error # failed end