Gold Plated Blog Posts
Whatev.
Saturday, August 18, 2007

And for my next trick: CameronHinkle.com/blog

The exciting news is that while you may be viewing this blog at my Blogspot domain, you might also be viewing this blog at my own personal domain. While the differences in url are subtle, I'm pretty excited about having my own domain and actually hosting my blog there.

My initial thought was to create a blogger layout and somehow...host...the blog...from...cameronhinkle.com? I'm actually not really sure what I was going to do, but what I ended up doing has turned out much better. Rather than creating a template, I integrated with Blogger's API. I've put a lot of work into it and so far it is very bare bones, but that's because I spent several hours converting my site from static HTML to a site completely controlled by PHP. It's a pretty slick setup and I'll blog about the whole thing when I get some more time. The best part is I can easily integrate with Picasa, where I have a few albums stored and plan to put some more. So after the blog is a little more full featured, I'll be taking that up as my next task.

I hope you'll all take a few minutes to check out the new site. Unfortunately I'm still building it and I don't have a development environment to speak of so it will go down occasionally. Once everything is the way I want it (hopefully in a week or two), I'll remove the Blog widget from this site and just put up a link to the new site, so you might find your bookmark (assuming anyone has actually bookmarked this blog) expiring soon. Anyway, just a heads up.

Tuesday, July 31, 2007

Behold, CameronHinkle.com!

The time has finally come for me to have a legitimate personal website, which you can now find at www.cameronhinkle.com. My previous site, which I created to get a job, was at cs.pdx.edu/~cch/. I put a lot of work into it but at the time, I didn't realize what had happened in the 6 years since I had made a website (what is...."css"?!). So now that I'm a little more up to speed, I've created a whole new layout and new site. I've been reading a lot of books on web design, CSS, XHTML, and useability so hopefully it shows in my new layout.

Of course now I need to consolidate. I've got a blog here and a website there, so my next project is going to be to somehow get this blog to look like the new site. I spent the evening figuring out how to do that. After hours of struggling, I decided to take all the CSS from my current site and paste it into Blogger's template box and it is closer than anything I've come up with so far. I'm trying it out on my other Blogger account so take a look at if you're curious. I hope to have it finished soon. In fact, I hope to have the whole website finished soon because starting August 27th, I'm going to be sitting in front of my television playing with my Wii for a really long time. I stopped at GameStop to get a copy of Sonic for Debbie (which she is surprisingly good at!) and asked the clerk when Metroid Prime 3 was due out. To my complete shock, he said it was a mere month away. That made my day.

On a side note, the fact that I did not know when Metroid Prime 3 was coming out- especially given that it was a month away- says a lot. Save about a 1 year phase in high school, I was the most knowledgeable Nintendophile I knew. There's part of me that's a little disappointed, but there's also a big part of me that is happy. And just think, if I hadn't spent that fourth year at GameStop, I might still be trolling the System Wars Forums every day. So thank you to GameStop for helping me quit cold turkey.

Comments

Damian said...

Hello Cameron,

Loving the php api for google photos. I have been building a fun little photo gallery for my website. I have only run into one problem that I cannot figure out. My code works fine on my localhost but when I upload it the authentication does not seem to work.

$pic = new Picasa();
$pic->authorizeWithClientLogin($user, $password);



$picasa_account = $pic->getAlbumsByUsername($user,null,null,"all");

$albums = $picasa_account->getAlbums();

with the following errors

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 1: parser error : Start tag expected, '<' not found in /home/madinb5/public_html/photoapi/Picasa/Account.php on line 210

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Not authorized to view access all in /home/madinb5/public_html/photoapi/Picasa/Account.php on line 210

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ^ in /home/madinb5/public_html/photoapi/Picasa/Account.php on line 210
An error occured while posting the album: String could not be parsed as XML

Posted Wednesday, September 10, 2008 at 4:07 PM.
Wednesday, June 6, 2007

We have liftoff

With the help of my co-worker Alec (whose finger is visible at right), I've managed to get the development of Popratings.com started. Every development project has a first step, and most of them involve the words "Hello, World!".

I'm really terrible at IT-related work so I feared setting up an environment would be painful but it was actually not so bad. I decided to go with Ubuntu Server Version 7 as a development environment. As a user, I'm more comfortable operating in Windows (which I'm not necessarily proud of, but it is a fact) but for programming, I've been working in Linux for the last 5 years so I prefer that.

Since I don't have a spare computer lying around, or space for one, I found a VMWare image at thoughtpolice.co.uk and have set up the environment there. To start working, I installed PHP 5.0, Subversion, and Vim using Aptitude, which was all very easy. I decided to go with Subversion mainly because I don't really know anything about it and I've heard good things. As for Vim, I haven't decided what I'm going to do for an IDE but Vim will suffice in the interim.

For a few different reasons, I want to have a lot of control over the way the URLs look in Popratings. Because of this, I'm using Mod_rewrite inside Apache to map all URLs that aren't images to a front controller, which I call TrafficController.php (although I certainly could have come up with a more useful name, this is my first PHP project in a couple years so I'll learn from my mistakes). In addition to providing his finger for the photo, Alec also gave me the idea to use .htaccess files to route traffic to a front controller class, although I believe you could also do it for an entire site as opposed to a single directory using 000-default in /etc/apache2/sites-enabled/. Alec used .htaccess files for a site he worked on a few months ago and said it worked out well.

I also decided to add a sub-directory for Popratings in the default directory that Apache serves files from (/var/www/) so that I can easily support more sites in the future from the same server. I can add directories to this folder as my list of sites grows. To accomplish this as well as the URL rewriting, I followed these steps:

  • enable Mod_rewrite by adding a symlink from etc/apache2/mods-available/rewrite.load to /etc/apache2/mods-enabled/rewrite.load. The command for that is ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load

  • in /etc/apache2/sites-enabled/000-default, set the DocumentRoot to /var/www/popratings/ so that Apache knows where to get the files specific to Popratings

  • in /etc/apache2/sites-enabled/000-default, change /var/www/ to /var/www/popratings/ so that the settings in 000-default are applied to the files specific to Popratings

  • in /etc/apache2/sites-enabled/000-default change "AllowOverride None" to "AllowOverride all" to allow rewrites

  • create a file at /var/www/popratings/.htaccess so that I can control traffic sent to the document root

Then, my .htaccess file looks like this:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^$ /home/
RewriteCond %{REQUEST_FILENAME} !^.*css
RewriteCond %{REQUEST_FILENAME} !^.*js
RewriteCond %{REQUEST_FILENAME} !^.*jpg
RewriteCond %{REQUEST_FILENAME} !^.*gif
RewriteCond %{REQUEST_FILENAME} !^.*png
RewriteRule ^(.*)$ TrafficController.php?uri=$1
There are a couple notes to mention here. One is to make sure that when you add "FollowSymLinks" to Options, if you leave the plus sign out, you'll override the other settings for Options that are defined in 000-default. This is a problem if you're writing PHP (and other non-HTML languages) because you'll get a "Forbidden" error. From what I've read of the documentation, I think it's because the "MultiViews" Option gets overridden, although I may be mistaken. At any rate, using the plus sign in front of FollowSymLinks adds it to the other options rather than overwriting them.

To explain a bit about the rewrite rules and conditions, the first rule states that if there is nothing after "popratings.com" in the request, direct the traffic to /home/. The next conditions take all images and include files out of the scenario and tells everything after "popratings.com" to be added as a parameter to TrafficController.php with the name "uri". Note that this includes cases where a user was just accessing the home page, in which case "/home/" is added as the uri parameter. In other words, the URL continues through the redirect rules even after being altered by one of them. Also note that the list of files to exclude from the rules is probably incomplete; you may want to add .exe, .pdf, and/or .xml, among others. As the list gets longer, you may want to change the regular expression so that it only requires one RewriteCond for all necessary file types.

This information was all available on the web but it was not usually specific to my operating system and was not all in one place, so it took a little work. I'm now ready to get some real work done. Unfortunately after setting up this environment, I sat down to actually do that work last night and realized that while I know a lot of design theory, I've forgotten almost all the PHP practice :-( While the progress may take a little bit of effort to get going, I'm sure it will be like riding a bicycle.

Saturday, June 2, 2007

Heavy reading

Since leaving Portland for India, I've had more time to sit and read than I normally would. I saw this coming and in the weeks before I left, stocked up on some interesting reading. As a pet project, I'm going to start building a website for a domain name I registered over a year ago, Popratings.com. Right now it's just a lot of ads from my registrar but when it's finished it will be a site for users to submit reviews on various things. I'll get more into the details of the functionality in a later post, but rest assured that it will include social networking, Web 2.0, and Ajax, as well as any other buzz words that happen to be popular at the time. It's really just a way for me to get back into programming and, more specifically, into PHP.

Since this project is aimed at getting more familiar with some of the technologies I've used in the past and using some skills I've picked up while working at my current job, I want to do everything myself. Given that this covers several different areas, I chose four books to read based on what I'll need to know and what I'm not already comfortable with. The four books are The Principles of Beautiful Web Design by Jason Beaird, User Interface Design for Programmers, by Joel Spolsky, PHP 5 Objects, Patterns, and Practice, by Matt Zandstra, and Beginning JavaScript with DOM Scripting and Ajax: From Novice to Professional, by Christian Heilmann.

I've only had a chance to read the first three selections but so far they're all worth reading. Joel Spolsky is someone who I have a lot of respect for as a developer and an entrepreneur. I've been reading his blog over the past year, which is what prompted me to get his book. Although it's a bit brief, he really has some very simple but effective things to say. His book has stood out the most as being a valuable asset for anyone designing user interfaces- it should definitely not be limited to programmers.

The second two books have certainly been useful. Beaird had a lot of good techniques to share. Towards the end of the book, he walks us through the process of designing an actual website for a client he had, which was helpful. Some of the material throughout was covered in my high school art class but I'm sure it's helpful for many people.

PHP 5 Objects, Patterns and Practice has been a great source of information. The first third covers new features to PHP 5, which you can really skim through if you know Java (yes, Java). The last third covers several PHP tools, including package managers and automated build tools, and will be a great reference. The heart of the book focuses on implementing several design patterns in PHP. There's actually not very much PHP-specific information in this portion. In fact, you might be better off reading the beginning and end of Zandstra's book and Design Patterns: Elements of Reusable Object-Oriented Software by the "Gang of Four", which is referenced throughout PHP 5 Objects, Patterns and Practice.

I'm looking forward to putting these to use; I plan to start writing Pop Ratings in the next week and hope to get a lot done while I'm in India. As I go along, I'll be logging anything particularly difficult or interesting that happens so that hopefully it will be useful for others working on similar projects.

The articles in this blog are authored by Cameron Hinkle, Software Engineer for Nike. The thoughts and opinions expressed are not shared by Nike or any of its affiliates.