eXPlainPMT Guest Patch v0.0.0.0.1/2
I just finished working on a patch for Railfrog’s eXPlainPMT so we can have a read only guest access. It took me a bit of time but it is done…. by done I mean I have stopped to work on it today.
It is rather hackish and has 0 tests added but it provides the overall features needed. I had to touch the database, which sucks a bit but it is only one column so upgrades shouldn’t be too hard.
Well you can find it here at my dropbox
Eric
You might be a geek if...
…your phone’s startup screen display’s OOP code in it…
Powered by Ruby
Phone.startup.show_splash
Eric
Running Shell Commands in Ruby
One of the major benefits of unix is the quantity of many simple programs that one thing great. As a developer for unix, you must learn how to leverage these commands into your own scripts. Here is how to do this in Ruby.
Say you script wants to call on the unix command to view the amount of freespace on your disks.
df -h Filesystem Size Used Avail Capacity Mounted on /dev/disk0s3 37G 23G 14G 62% / devfs 110K 110K 0B 100% /dev fdesc 1.0K 1.0K 0B 100% /dev
To add this to Ruby all you need to do is to add a line of code (note the back-ticks):
disk_free = `df -h`
That takes the output from the command and puts it into a String. So an example script that will show the “df -h” output could be
#!/usr/bin/env ruby def disk_free diskfree = `df -h` puts diskfree end disk_free
How simple is that!
Now even though it would be easier to just use the real “df” command for this, you could easily write a Ruby script to call on other scripts and use all of Ruby’s powers to modify the output. That is how I made the Server Status Sidebar, calling “uptime” and regex to get the correct string I wanted.
Happy coding.
Eric
(Found this tip by using Safari)
Server Status Plugin
I just got a new sidebar plugin developed for Typo here. It shows the uptime and load average of the server it is running on.
It should work on any server that allows the “uptime” command to work. I have tested it on OSX(Darwin) and Debian 3.1 so far and it works on both.
I am going to hold on to it for a bit to test it out some more but will add the patch to Typo soon. (Main stopper is my diff isn’t coming out right.)
Anyways see it in action over here on my sidebar and if you want to grab the copy, it is at my dropbox. The diff comes from REV 657, even though it doesn’t say.
This plugin, plugin code, and all it’s goodies will be released under the MIT License (same as Typo).
Eric
Back on Typo
Well I am back on Typo after going to Wordpress for a bit. The reason I left was because after about 12 hours of being up my website would stop responding. Lighttpd was the only thing that logged it but it was a weird log message
2005-09-20 11:59:12: (server.c.937) connection closed - write-request-timeout: 9
And it seemed to do this on a static image (typically the header image). So I went from Typo/Rails/FastCGI/Lighttpd to Wordpress/PHP/FastCGI/Lighttpd. But then I found that it happened in WP too (the header image file again).
I tried almost every config I could for the website and decided that my lighttpd or FastCGI was wrong. So I updated to the latest lighttpd source and gave WP/PHP another go.
Still broken, so I started to tear up my server trying to find the solution. Then I remembered that when I was mirroring large files, the download would just timeout. The only thing that would fix it was removing the bandwidth throttle.
server.kbytes-per-second = 50
After dumping that one line of code, I restarted my server and crossed my fingers. Well Wordpress stayed up over 26 hours, even with ab hitting it hard. So next I setup Typo on a subdomain and hit it hard and long. Typo had over 100,000 pages in it’s cache after a few hours, but it stayed up and pretty responsive even with development mode and over 25 concurrent connections.
Now it is about 24 hours latter and Typo and Wordpress were ok. So I now am running Typo again, my favorite { CMS | blog } ever.
Now to see what goodies TRUNK has for me.
Eric, back with AJAX