George Carlin
Posted by Ben Reubenstein Tue, 24 Jun 2008 04:49:00 GMT

May 12, 1937 – June 22, 2008
Posted by Ben Reubenstein Tue, 10 Jun 2008 01:47:00 GMT
After almost a year of collecting data and half a million results recorded, Xcellent Creations, Inc. has released the next version of the iNetwork Test web application. The iNetwork Test web application for iPhone has been moved to http://www.inetworktest.com/iphone_content. The main iNetworkTest.com is now a portal to Mobile Network Testing Results.Posted by Ben Reubenstein Fri, 02 May 2008 00:24:00 GMT
If you are reading this you are hitting the new server. I separated my sites out into two servers, one running a LAMP stack and the other running a LNMR (Linux Nginx MySQL Rails) stack.
Posted by Ben Reubenstein Sun, 13 Apr 2008 21:06:00 GMT
After getting passenger up and running I realized that I didn't have PHP cranking with the freshly compiled Apache. Here are the steps I took to get PHP going:
Compile PHP from source, be sure to check out ./configure --help for more compile options. Also as always adjust to your systems paths as necessary.
wget http://www.php.net/get/php-5.2.5.tar.gz/from/this/mirror
tar -zxvf php-5.2.5.tar.gz
cd php-5.2.5
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-curl
make
sudo make install
I am not sure why but the php bin file ends up being called php.dSYM. There might be a compile option I missed to fix this or it could be the Mac OS X compiler. I fixed the issue by creating a symlink.
sudo ln -s /usr/local/php/bin/php.dSYM /usr/local/php/bin/php
Add /usr/local/php/bin to your path in .bash_login and reload your terminal so that it is in your path. You can confirm that you are getting the right php by issuing:
which php
#The command should return:
/usr/local/php/bin/php
Add directives to the httpd.conf for Apache to find the PHP module and handle .php files
LoadModule php5_module modules/libphp5.so
AddHandler php5-script php
Restart Apache
/usr/local/apache2/bin/apachectl restart
Put a file in the root of your server or in virtual host directory called info.php with the phpinfo command. Visit the file via your web browser to confirm your install.
<?php phpinfo() ?>
Be sure to leave comments with any issues you have, or updates I can make to this document.
Posted by Ben Reubenstein Sat, 12 Apr 2008 22:32:00 GMT
UPDATE:
In the latest version of Phusion Passenger (mod_rails) 1.0.3 the default Mac OS X Apache installation is now supported! If you're still into rolling you're own these directions still apply. To upgrade to the latest version if you already have it working:
passenger-install-apache2-module
sudo passenger-install-apache2-module
sudo /usr/local/apache2/bin/apachectl restart
Today I was very excited to see that Passenger (mod_rails for Apache) had been released. Here is how I got things rolling on my Mac OS X Leopard installation. Be sure to refer to the official docs for more information.
Compile Apache2 from source. The passenger-install-apache2-module warned against using the Mac rolled Apache. I used a pretty broad ./configure, feel free to customize.
curl -O http://www.alliedquotes.com/mirrors/apache/httpd/httpd-2.2.8.tar.gz
tar -zxvf httpd-2.2.8.tar.gz
cd httpd-2.2.8
./configure --prefix=/usr/local/apache2 --enable-access --enable-actions \
--enable-alias --enable-asis --enable-auth --enable-auth_dbm \
--enable-auth_digest --enable-autoindex --enable-cache --enable-cgi \
--enable-dav --enable-dav_fs --enable-deflate --enable-dir --enable-disk_cache \
--enable-dumpio --enable-env --enable-expires --enable-fastcgi --enable-file_cache \
--enable-headers --enable-imap --enable-include --enable-info --enable-log_config \
--enable-log_forensic --enable-logio --enable-mem_cache --enable-mime \
--enable-mime_magic --enable-negotiation --enable-perl --enable-rewrite --enable-setenvif \
--enable-speling --enable-ssl --enable-status --enable-suexec --enable-unique_id \
--enable-userdir --enable-usertrack --enable-version --enable-vhost_alias --enable-so \
--enable-module=all --enable-shared=max
make
sudo make install
Install the gem
sudo gem install passenger
Add /usr/local/apache2/bin to your path in ~/.bash_login so that it can find your new apache2 install, then run the command to build the module.
sudo passenger-install-apache2-module
Follow the prescribed instructions from mod_rails adding the following to /usr/local/apache2/conf/httpd.conf. BE SURE TO USE THE SETTINGS DUMPED OUT WHEN YOU RUN passenger-install-apache2-module as the paths on your system may differ.
LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-1.0.1/ext/apache2/mod_passenger.so
RailsSpawnServer /usr/local/lib/ruby/gems/1.8/gems/passenger-1.0.1/bin/passenger-spawn-server
RailsRuby /usr/local/bin/ruby
Setup a folder to hold vhosts
sudo mkdir /usr/local/apache2/conf/vhosts
Add an Include to httpd.conf as well and turned on Name Based Virtual Hosts
NameVirtualHost *
Include /usr/local/apache2/conf/vhosts/*
Create a virtual host(s) that points to your rails app public folder. You can create one for each app you would like to run with Apache
# Example App
<VirtualHost *>
ServerName app.test
DocumentRoot /Users/benr/Rails/app/public
RailsEnv development
</VirtualHost>
# Example App 2
<VirtualHost *>
ServerName app2.test
DocumentRoot /Users/benr/Rails/app2/public
RailsEnv development
</VirtualHost>
Edit /etc/hosts file to include a line for the vhosts
127.0.0.1 app.test app2.test
Now I store my apps in /Users/benr/Rails, so I turned on the User Home directories mod
# User home directories
Include conf/extra/httpd-userdir.conf
I then configured the httpd-userdir.conf so that it used that folder, much like in the default Mac Apache it allows you to put a site in ~/Sites
UserDir Rails
<Directory "/Users/*/Rails">
AllowOverride FileInfo AuthConfig Limit Indexes
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
Start Apache
sudo /usr/local/apache2/bin/apachectl start
To restart your app, create a file called RAILS_ROOT/tmp/restart.txt and reload your page. < HOT!
Voila! It worked when I visted app.test and app2.test. The most important thing to remember is the defaults that mod_rails uses. I was having a lot of trouble and it turned out to be the fact that it was defaulting to production mode. The best place to track down the errors is in your RAILS_ROOT/log/YOURENV.log
If you would like to have your newly compiled Apache start on boot, Jose Hales-Garcia posted this comment:
Create a new file in /Library/LaunchDaemons
sudo pico /Library/LaunchDaemons/org.apache.httpd.plist
Paste in the following lines and save the file (UPDATED thx: ecchi):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.apache.httpd</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/apache2/bin/httpd</string>
<string>-k</string>
<string>start</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
Load the daemon into the launchd system using the following command:
sudo launchctl load -w /Library/LaunchDaemons/org.apache.httpd.plist
That's it. The local httpd daemon will load on start-up after that. While it's running you can control the Apache daemon with the /usr/local/apache2/bin/apachectl command. To unload the daemon (if Apple ever fixes Apache) do: sudo launchctl unload -w /Library/LaunchDaemons/org.apache.httpd.plist
UPDATE! Also remember to trash the .htaccess that comes with Rails. This was jacking up a couple of my applications.
UPDATE 2 Don't forget to turn off the Mac OS X Apache if it is running. System Preferences > Sharing
HOPE THIS HELPS! Pease leave comments with suggestions or issues you run into!
Posted by Ben Reubenstein Wed, 09 Apr 2008 16:52:00 GMT
Today I needed an entire site to run over SSL. I implemented a very straight forward before_filter that would catch a request and redirect to SSL if the request was not local and not already over SSL.
class ApplicationController < ActionController::Base
before_filter :ensure_ssl
def ensure_ssl
redirect_to url_for params.merge({:protocol => 'https://'}) unless (request.ssl? || local_request?)
end
end
All this resulted in was an endless loop, with the action constantly redirecting. I turned on some debugging:
logger.info url_for params.merge({:protocol => 'https://'}) # Confirming URL was correct
logger.info request.ssl? # Confirming the request was SSL
logger.info request.port # Checking the port the request came in on
It turned out request.ssl? was nil and the port was always 80. Nginx was not properly proxying along the fact that it was running over ssl. I added the following to my server / location declaration in the nginx.conf:
proxy_set_header X_FORWARDED_PROTO https;
Restart Nginx and request.ssl? returned true and request.port returned 443. I also just found some other great nginx examples from halorgium
Posted by Ben Reubenstein Sat, 05 Apr 2008 13:18:00 GMT
After seeing the Python version, then the shell script version, I decided to write the Ruby version. You could use the class anywhere, but this example is a nice command line script you can call.
#!/usr/bin/env ruby
require 'net/http'
class WebServerInfo
def self.server_type(host)
http = Net::HTTP.new(host, 80)
resp, data = http.get('/', nil)
resp['server']
end
end
if ARGV[0].nil?
puts "usage: which_webserver DOMAIN || IP"
else
puts WebServerInfo.server_type(ARGV[0])
end
Cheers to Corey Goldberg and Brock
Posted by Ben Reubenstein Tue, 18 Mar 2008 16:47:00 GMT
Today I jumped on the 3.1 update for Safari via Software Update on my brand new MacBook Pro. Sadly, the installation hung with the message under the progress bar, "Configuring Installation". I restarted, tried it again, and had the same result. To fix my problem:Posted by Ben Reubenstein Sun, 16 Mar 2008 21:50:00 GMT
Here are the commands I used to compile the required libraries and programs for RMagick to work on Mac OS X 10.5. It is largely the same as this article with slight adjustments. After completing the process I dumped my history.
Before you can execute these commands, you MUST HAVE
Begin by creating a folder to hold the src.
cd ~
mkdir src
cd src
wget
I like wget, which I use in the commands below. To start compile that or replace the wget command with curl -O.
curl -O http://ftp.gnu.org/gnu/wget/wget-latest.tar.gz
tar -zxvf wget-latest.tar.gz
cd wget-1.11/
./configure --prefix=/usr/local
make
sudo make install
cd ..
FreeType
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.3.5.tar.gz
tar zxvf freetype-2.3.5.tar.gz
cd freetype-2.3.5
./configure --prefix=/usr/local
make
sudo make install
cd ..
PNG Library
wget http://internap.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.25.tar.gz
tar -zxvf libpng-1.2.25.tar.gz
cd libpng-1.2.25
./configure --prefix=/usr/local
make
sudo make install
cd ..
JPEG Library
wget ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz
tar -zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b/
ln -s `which glibtool` ./libtool
export MACOSX_DEPLOYMENT_TARGET=10.5
./configure --enable-shared --prefix=/usr/local
make
sudo make install
cd ..
TIFF Library
wget ftp://ftp.remotesensing.org/libtiff/tiff-3.8.2.tar.gz
tar -zxvf tiff-3.8.2.tar.gz
cd tiff-3.8.2
./configure --prefix=/usr/local
make
sudo make install
cd ..
GhostScript Fonts
wget http://superb-east.dl.sourceforge.net/sourceforge/gs-fonts/ghostscript-fonts-std-8.11.tar.gz
tar -zxvf ghostscript-fonts-std-8.11.tar.gz
sudo mkdir /usr/local/share/ghostscript
sudo mv fonts/ /usr/local/share/ghostscript/fonts/
ImageMagick
wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
tar zxvf ImageMagick.tar.gz
cd ImageMagick-6.3.9/
export CPPFLAGS=-I/usr/local/include
export LDFLAGS=-L/usr/local/lib
./configure --prefix=/usr/local --disable-static --with-modules --without-perl --without-magick-plus-plus --with-quantum-depth=8 --with-gs-font-dir=/usr/local/share/ghostscript/fonts
make
sudo make install
cd ..
RMagick
sudo gem install rmagick
MiniMagick
sudo gem install mini_magick
Clean Up
cd ~
rm -Rfv ./src
Posted by Ben Reubenstein Sun, 13 Jan 2008 20:00:00 GMT
My nephew has been saving his money to purchase a new laptop. He enjoys playing flashed based games, and is known to play RuneScape. Just recently he managed to scrap together $350.00 for the purchase. I found a laptop for exactly $350, but after closer examination found it did not include wireless. For $50 more I found a Lenovo 3000 N200 with wireless so with a little help from his Grandpa to make up the difference, we were off to the store.