ZAT – notes on Z to A Travel

31 August 2006

Status

I’ve actually been getting quite a bit of coding done the last few weeks, so I haven’t posted much here. The user code for creating a new user id, signing in, changing your password, and so forth is done. You can now sign in, and even have it remember you on your computer (with a cookie). I don’t have any of the other user profile things done.

I decided to use the user’s email address for the user id. Each user has a (unique) nickname, so they can sign on using either their email address or their public nickname. When a user creates a new account, their password is emailed to them. They use this password to log in, but can change their password if desired. If they forget their password, they can have a new one emailed to them. This isn’t completely secure, but this website really doesn’t need a bulletproof level of security. Besides, it won’t be particularly secure until I get a certificate and start using https.

I read an interesting article that pointed out that as long as you have an easy way for people to reset their password, you don’t really need to do the common thing of having them type in their password twice. If they make a mistake, they can just reset it and try again.

As a result, creating a new account is very simple. You just type in your email address and a nickname. ZAT checks to make sure they are both unique (and valid) and then emails out a new password. Signing in is also easy — you just type in either your email address or your nickname, and your password. You can also check a box to have ZAT set a cookie and remember you on the current computer. Most people will want to do this, unless they are accessing ZAT from a random computer (like at an Internet Cafe).

I also have the first Google Map up. This is the map that allows the user to define new Regions. A Region is an area on a map, used to define countries, states, cities, neighborhoods, national parks, etc. Imagine a typical guide book — a Region in ZAT corresponds to a chapter or section in a guide book. Defining a Region is simple. You give it a name (e.g., Portland) and say what it is a part of (e.g., Oregon). You can optionally define alternate names or abbreviations (for example, for the USA you might specify that it has alternate names of “America” and “US”) — this makes it easier for people who are searching. Finally, you click on two points on the map to define the boundary of that Region. That’s it!

Next up is to implement the definition of Places. A Place corresponds to an entry in a guide book; for example, a restaurant, hotel, sight, etc.

After that is the part of ZAT concerned with associating a Place or a Region with a URL (to a web page). So for the Region “Portland” there can be a number of associated web pages, talking about travel to and about Portland. And for the Place “Benson Hotel” (one of the old classic hotels in Portland) there can be a number of links to websites with information about the Benson — the official website, blog entries from people who have stayed in the Benson, photos of the Benson, special discount offers to stay at the Benson, etc.

Then I can start to tackle the really hard part — letting people search a map for Places and Regions, and giving them access to the associated links.

So far it is going well. The Google Maps API is pretty straightforward JavaScript, and is well documented. I did spend a day trying to track down a bug, which turned out to be a bug in their library. I’ve submitted it but it has not been fixed yet. Luckily, it fails only on Safari (not on Firefox or IE, the two other browsers I test), so hopefully Google will fix this bug before I launch ZAT.

Filed under: General — zat @ 6:08 pm

Books

I’ve been reading a number of books in order to bring myself up to speed on current web technologies. Here are some of the ones I’m most enjoying:

Web Design in a Nutshell (third edition) by Jennifer Robbins
Bulletproof Web Design by Dan Cederholm
Pro MySQL by Kruckenbert and Pipes
JavaScript: The Definitive Guide (fifth edition) by David Flanagan

I’ve also bought the following, but haven’t read them enough to evaluate them yet:

DOM Scripting by Jeremy Keith
PHP Hacks by Jack Herrington
Google Maps Hacks by Gibson and Erle
Web Mapping Illustrated by Tyler Mitchell
Mapping Hacks by Erle, Gibson & Walsh
Upgrading to PHP5 by Adam Trachtenberg
Programming PHP by Lerdorf, Tatroe & MacIntyre (so far not too impressed)
Beginning PHP and MySQL 5 by Jason Gilmore

I’ve used a lot of programming languages in my time (even invented a couple of them) but it is very interesting trying to learn two similar languages (PHP and JavaScript) at the same time. Oy! I wish someone would create a decent set of server-side libraries for JavaScript, so you could write both the server-side and client-side code in the same language.

The other day I wrote some Javascript and it wouldn’t work. I looked at it and looked at it, and couldn’t see anything wrong with it. I checked all the library functions to make sure I was calling them correctly. Suddenly, I realized that I was trying to use a PHP library function in a JavaScript program. I was calling it with the correct arguments, I was just in the wrong language. Doh!

–wm

Filed under: General — zat @ 5:20 pm

23 August 2006

New Theme

I was talking to a friend of mine today, and she told me that she looked at this blog but there was only one article in it! Now, I know I haven’t posted much in a week or so, but there is certainly more than one blog entry in here. Turns out that the problem was IE.

I program on a Macintosh, and normally use Safari as my browser (I also use Firefox). IE isn’t even supported on the Mac anymore. But when I set up the blog, I tweaked the theme to make it more to my liking, and somehow I broke IE (more precisely, I broke the blog so it wouldn’t display properly in IE).

Luckily, I have Parallels so I can run Windows on my Macintosh, so I fired it up and tried to fix the blog so it would work on IE. After futzing around for a while, loading an entirely new and different theme started to look mighty attractive. It’s funny, considering all the computer education and experience I’ve had, you’d think getting something simple like WordPress to work on a couple of different lousy browsers would be a piece of cake. But no. Sigh.

So now the blog looks completely different.

CSS sucks.

–wm

Filed under: General — zat @ 12:10 am

1 August 2006

Eclipse

So, I spent most of the last few days playing around with programming tools. The choices were two commercial packages: ActiveState’s Komodo and Zend Studio. In the end, neither won out. I’m currently using a very early beta of the PHP IDE, which is a plug-in for Eclipse. A big advantage of Eclipse is that it is free. I expect this environment to get better over time.

I never was able to get the PHP debugging working. For now, the main benefits of using the PHP IDE are that it does good syntax checking of my PHP, so I’m spending much less time tracking down simple syntax errors (missing semicolons, mismatched brackets, etc.), and code completion (it knows all the built-in PHP functions, plus does code completion on functions you define). I also like the Explorer, which lets me jump to function definitions directly, rather than searching for them in a file.

Another advantage of using an Eclipse plug-in is that it lets me use other Eclipse plug-ins. Unfortunately, I haven’t figured out how to get the Subversion plug-in working yet.

I also found a completely separate IDE called Aptana, which is designed for creating JavaScript, HTML, and CSS. It too is an Eclipse plug-in, so stuff I learn about PHP IDE will also work for me in Aptana. For now, I can run the two IDEs separately, one for PHP on the server-side and one for JavaScript on the client-side. Eventually, I should be able to get them working together, but I haven’t tried that yet since both are early and are evolving quickly (who knows, maybe someone will integrate them together for me!). Besides, having two instances of Eclipse running is no big deal.

Having installed all this stuff, I had another marathon programming session last night, and was able to get lots more of the user model and views implemented. Goes much faster when you’re not tracking down stupid syntax errors, and the Eclipse editor has other features I really like.

I set up MAMP (my Macintosh-Apache-MySQL-PHP stack) so that it has a symbolic link into the PHP IDE workspace. So I’m just using a normal browser to test out the PHP code I write. Unfortunately, this doesn’t give me the facilities of a true debugger, so I’m still doing things like writing print statements to find out the value of variables. But I’m way ahead of my setup before (coding in a text editor and debugging with print statements). Hopefully, either the PHP IDE debugger will get better over time (or I’ll figure out what I’m doing wrong and get the debugger working). Meanwhile, I’m making good progress on ZAT.

–wm

Filed under: General — zat @ 9:52 am

Powered by WordPress