03.03.2010

How much is that WordPress App in the Window?

Filed under: wordpress @ 14:11

It’s free!

I saw this in the Pasadena, CA Apple Store back in January. That’s how fast I am at blogging.

WordPress iPhone App in Pasadena Apple Store

Get the WordPress iPhone App.

02.07.2010

An Open Letter to Web Developers on Percent-Encoding

Filed under: news @ 02:43

Dear web developers,

Please understand the difference between the encoding called for in application/x-www-form-urlencoded encoded data [1] and the encoding called for in URIs (and how that encoding applies to URIs in the http/https scheme).

In particular, note the difference in how spaces are treated. The former encodes them as +, the later as %20.

Understand also how your web server processes different pieces of URLs. Pay particular attention to your web server’s treatment of plus signs. PHP, for example, interprets “$_GET” data (the data drawn from the query component of the URI) as though it were application/x-www-form-urlencoded and converts those plus signs to spaces [2].

Now that you know that the different encoding methods encode spaces differently and that the different decoding methods decode pluses differently, make sure you’re being consistent.

Because when I type into your website my email address with its plus sign in it, I expect things to work.

Love,
mdawaffe

[1] More details in HTML5’s definition of the application/x-www-form-urlencoded encoding algorithm.

[2] See the difference between urlencode()/urldecode() and rawurlencode()/rawurldecode(). parse_str() uses urldecode().

Decoding the query component of the URI according to application/x-www-form-urlencoded is the logical thing to do, since the web server can’t tell the difference between a GET request generated by a form and one that isn’t (since user agents are not supposed to set a “Content-Type: application/x-www-form-urlencoded” header when submitting a form over http/https via the GET method), but I can’t tell if converting pluses in the query part of the URI into spaces is required; I can’t find anything in the definition of the http URI scheme that says that plus signs are “delimiters” in the query component of the URI. So I believe it to be an implementation-specific choice and therefore up for grabs depending on how you power your web server (PHP, ruby, .NET, etc.).

01.22.2010

PHP 5 + Apache 2 + MySQL 5 on OS X via MacPorts

Filed under: note to self, server @ 14:28
# Displays all files in Finder.  Optional: personal preference.
$ defaults write com.apple.Finder AppleShowAllFiles YES
# Relaunch Finder

# Update MacPorts
$ sudo port selfupdate
$ sudo port upgrade outdated

# Install MySQL
$ sudo port install mysql5-server
$ sudo -u _mysql mysql_install_db5
$ sudo mysqld_safe5 &
$ sudo /opt/local/lib/mysql5/bin/mysql_secure_installation
$ sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist

# Install Apache, PHP (with PEAR), PHP MySQL bindings
$ sudo port install apache2
$ sudo port install php5 +apache2 +pear
$ sudo port install php5-mysql

# Configure Apache
# The following line may not be necessary
? sudo cp /opt/local/apache2/conf/httpd.conf.sample  /opt/local/apache2/conf/httpd.conf
$ cd /opt/local/apache2/modules
$ sudo /opt/local/apache2/bin/apxs -a -e -n "php5" libphp5.so
$ sudo nano /opt/local/apache2/conf/httpd.conf
# Change DocumentRoot to whatever (e.g. /Users/michael/Sites
# Change <directory "{old DocumentRoot}"> to <directory "{new DocumentRoot}">
# In that <directory "{new DocumentRoot}"> section change to the following.
# Options Indexes FollowSymLinks MultiViews
# AllowOverride All
# In <ifmodule mime_module> section, add the following two lines
# AddType application/x-httpd-php .php
# AddType application/x-httpd-php-source .phps
$ sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist

# Configure PHP
$ sudo cp /opt/local/etc/php5/php.ini-development /opt/local/etc/php5/php.ini
$ sudo nano /opt/local/etc/php5/php.ini
# set mysql.default_socket, mysqli.default_socket and pdo_mysql.default_socket to
# /opt/local/var/run/mysql5/mysqld.sock

# Start Apache
$ sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper start
# Hopefully you'll get a window asking if httpd can accept incoming requests.  Approve it.

# Add DB and tables to MySQL for easy WordPress install
$ mysql5 -u root -p
> CREATE DATABASE putyourdbnamehere;
> GRANT ALL PRIVILEGES ON putyourdbnamehere.* TO "usernamehere"@"localhost" IDENTIFIED BY "yourpasswordhere";
> FLUSH PRIVILEGES;
> EXIT

# Install and Configure phpMyAdmin (will need to restart Apache when done)
$ sudo port install phpmyadmin
$ sudo nano /opt/local/apache2/conf/httpd.conf
# Add section
# <Directory "/opt/local/www/phpmyadmin/">
#     Options Indexes MultiViews
#     AllowOverride None
#     Order allow,deny
#     Allow from all
# </Directory>
# In <IfModule alias_module> section add the following
# Alias /phpMyAdmin "/opt/local/www/phpmyadmin"

$ sudo nano /opt/local/www/phpmyadmin/config.inc.php
# See http://www.phpmyadmin.netdocumentation/Documentation.html#config
# Fill in $cfg['blowfish_secret']
# Set $cfg['Servers'][$i]['auth_type'] = 'config';
# Add $cfg['Servers'][$i]['user'] = 'root';
# Add $cfg['Servers'][$i]['password'] = '{root password}';

$ sudo /opt/local/apache2/bin/apachectl {start|restart|graceful|graceful-stop|stop}
$ sudo /opt/local/share/mysql5/mysql/mysql.server {start|stop|restart|reload|force-reload|status}

12.20.2009

Hairectomy via SVN: Day 4

Filed under: news @ 23:59

Day 4: The Gorget Décapitée

2009-12-07T15:11$ for i in `svn pl -R * | grep "hair:scalp"`; do sed -i '' 9,\$d $i; done
2009-12-07T15:11$ svn ci -m "Day 4: The Gorget Décapitée"
Sending        Scalp
Transmitting file data .......
Committed revision 5.
2009-12-07T15:12$ ls -h

11.30.2009

Hairectomy via SVN: Day 3

Filed under: fashion @ 20:05

Day 3: The Gorget

2009-11-30T17:05$ for i in `svn pl -R * | grep "hair:facial"`; do svn del $i; done
D         Goatee
D         Sideburns Rampant
2009-11-30T17:05$ svn ci -m "Day 3: The Gorget"
Deleting       Goatee
Deleting       Sideburns Rampant
Transmitting file data .
Committed revision 4.
2009-11-30T17:06$ ls -h

The Gorget

11.29.2009

Hairectomy via SVN: Day 2

Filed under: fashion @ 16:41

Day 2: The Trident

2009-11-29T15:32$ svn del Chinstrap
D         Chinstrap
2009-11-29T15:32$ svn ci -m "Day 2: The Trident"
Deleting       Chinstrap
Transmitting file data .
Committed revision 3.
2009-11-29T15:32$ ls -h

The Trident

11.27.2009

Hairectomy via SVN

Filed under: fashion @ 14:31

Day 0: The Hirsute

2009-11-26T13:16$ cd /head/hair
2009-11-26T13:16$ du -ch . | grep total
 11.34g	total
2009-11-26T13:16$ svnadmin create /Repositories/hairectomy
2009-11-26T13:17$ svn import . file:///Repositories/hairectomy -m "init: the hirsute"
Adding         mustache
Adding         beard
Adding         hair

Committed revision 1.
2009-11-26T13:17$ ls -h

The Hirsute

Day 1: The Chu Manfu

2009-11-27T13:02$ svn del 'Fu Manchu'
D         Fu Manchu
2009-11-27T13:02$ du -ch . | grep total
 10.49g	total
2009-11-27T13:03$ svn ci -m "Day 1: The Chu Manfu"
Deleting       Fu Manchu
Transmitting file data .
Committed revision 2.
2009-11-27T13:03$ ls -h

The Chu Manfu

11.25.2009

Holiday Acting Demographics — 21:50

I want to see a chart of casting calls for little people as a function of day of the year.

08.31.2009

Geocaches in the 2009 Station Fire Burn Path

Filed under: news @ 15:13

Michelle was off geocaching while I was working on a simple geo visualization project for work and looking up information on the 2009 Station Fire near La Cañada Flintridge and Altadena.

Those three actions in confluence got me thinking about how many geocaches have been affected by the fire.

Geocaches in the 2009 Station Fire
Map of geocaches likely affected by the 2009 Station Fire
. (Click for larger, more up-to-date, interactive map.)

The Los Angeles Times is providing a frequently updated Google map of local fire information which includes approximate fire perimeter (more precise geometry can be found at GeoMAC or InciWeb). With that data, it was fairly straightforward to search for all the geocaches affected. As of today at 2:30pm local time, 228 non-premium geocaches are within the station fire approximate burn area.

Notes for geocachers: The map does not show premium caches, and puzzle caches are assumed to be at their posted coordinates. Archived caches are not shown (though could, in theory, still be in the burn area), but disabled caches are.

While the map is interesting, the loss of a few hundred geocaches is insignificant compared to the destruction of homes. More significant still are the lives that have been lost and those that are still at risk. The fire fighting crews are literally battling the elements to keep us all safe.

I’m not sure what a community that has lost so little in comparison can do, but perhaps a station fire regrowth and memorial geocache offered in thanks and remembrance would be appropriate?

Update [2009-09-01]: The LA Times has updated its fire area geometry. As of 7:53pm local time there are about 180 non-premium geocaches in the burn area.

Update [2009-09-02]: I’m now using the same GeoMAC data InciWeb is using for the burn area geometry.

05.14.2009

Green Plant

Filed under: food, random @ 13:05

I thought this was a joke at first. I have not tried it.

Green Plant Drink

Green Plant Drink

Hm… food beverage….

© mdawaffe (Michael D Adams) - Powered by WordPress - Full Credits