Monday, May 18, 2009
Friday, May 15, 2009
Catching Up
The move into the house it taking a toll on my time. Unfortunately I haven't had much time to work on the site. I'm hoping I can make some real progress this weekend, at least creating mockups of the dashboard (or search and search results page) if nothing else.
Tuesday, May 12, 2009
The building blocks of a registration page
I've built out and pretty much completed the registration workflow at this point. It's nothing fancy, you fill out a bunch of forms and upon successful completion it drops a row into the database, but it works. There were quite a few individual components that contributed to my success.
First off, I used a HTML + CSS form template that I found over at woork. I wanted to avoid tables and this helped me to do it. Ultimately I'm not quite sure if its the final model I'll follow for building out forms, but it's working for now, so I'll quit messing with it.
Next I used jQuery + jQuery UI to style my buttons and error notifications. Google is hosting these libraries thanks to their AJAX Libraries API. Oh, and did you know that Google also hosts the CSS for jQuery UI as of jQuery UI 1.7.0? They don't mention it on their API page anywhere, but they do. Here's how to load up the CSS for the jQuery UI Redmond theme via Google:
<link rel="stylesheet" type="text/css" media="all" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/redmond/jquery-ui.css" />
Also rediculously helpful is a page over at the filament group that explains how to style buttons for jQuery UI, as well as how to do things like getting a hand icon to show up when you hover over a button. (Why doesn't jQuery UI have a page like this?!)
As for the actual logic behind the form, most of that is handled by the awesomeness that is CodeIgniter. They have a fantastic form validation class that handles almost everything for you. Not only can you validate data, but in the same stroke you can clean data too (e.g. trim, convert to a md5 hash, etc.), like this:
$this->form_validation->set_rules('username', 'Username', 'trim|required|min_length[5]|max_length[12]|xss_clean');
$this->form_validation->set_rules('password', 'Password', 'trim|required|matches[passconf]|md5');
Thanks to their ability to chain all of the rules together, you can literally validate and prep a field in one line. Done. Finito!
First off, I used a HTML + CSS form template that I found over at woork. I wanted to avoid tables and this helped me to do it. Ultimately I'm not quite sure if its the final model I'll follow for building out forms, but it's working for now, so I'll quit messing with it.
Next I used jQuery + jQuery UI to style my buttons and error notifications. Google is hosting these libraries thanks to their AJAX Libraries API. Oh, and did you know that Google also hosts the CSS for jQuery UI as of jQuery UI 1.7.0? They don't mention it on their API page anywhere, but they do. Here's how to load up the CSS for the jQuery UI Redmond theme via Google:
<link rel="stylesheet" type="text/css" media="all" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/redmond/jquery-ui.css" />
Also rediculously helpful is a page over at the filament group that explains how to style buttons for jQuery UI, as well as how to do things like getting a hand icon to show up when you hover over a button. (Why doesn't jQuery UI have a page like this?!)
As for the actual logic behind the form, most of that is handled by the awesomeness that is CodeIgniter. They have a fantastic form validation class that handles almost everything for you. Not only can you validate data, but in the same stroke you can clean data too (e.g. trim, convert to a md5 hash, etc.), like this:
$this->form_validation->set_rules('username', 'Username', 'trim|required|min_length[5]|max_length[12]|xss_clean');
$this->form_validation->set_rules('password', 'Password', 'trim|required|matches[passconf]|md5');
Thanks to their ability to chain all of the rules together, you can literally validate and prep a field in one line. Done. Finito!
Saturday, May 9, 2009
How I stay motivated
I tend to read a lot of posts on entrepreneurship. Not necessarily because I think of myself as an entrepreneur, but more because I'm fascinated with the topic and learning about what to do (and not to do). Amongst all of the advice I'd read there's been a lot of common themes. One of them is that you'll spend a lot of time on your business, far more time than you'd spend in any regular job. The second is that you really need to love what you're doing if you want to stay motivated.
As much as I love working on my website there are days when I would really rather be doing something else. Such as, for instance, when some new downloadable content comes out for a game and I'd rather be playing that than programming. It happens. So how do I keep motivated?
I've started many projects previously and I have a very bad habit of starting a project only to get halfway through it and start on a new, different project. But I've been doing something different this time, and it's working to my advantage: blogging. As simple as it sounds, keeping a blogging schedule has led me to make constant, steady progress on my site. By requiring myself to post something new every few days I have to make progress on the site, otherwise I have nothing to blog about. And there's always something worth blogging about, whether it's discussing how I solved a problem, or implemented a new technology, or mockups I created for a page I'm going to build, etc. There's always something new, but only if I've been working on my site. Blogging about what I'm working on is definitely a practice I'll take with me on other projects I work on (but not before I'm done with this one!).
As much as I love working on my website there are days when I would really rather be doing something else. Such as, for instance, when some new downloadable content comes out for a game and I'd rather be playing that than programming. It happens. So how do I keep motivated?
I've started many projects previously and I have a very bad habit of starting a project only to get halfway through it and start on a new, different project. But I've been doing something different this time, and it's working to my advantage: blogging. As simple as it sounds, keeping a blogging schedule has led me to make constant, steady progress on my site. By requiring myself to post something new every few days I have to make progress on the site, otherwise I have nothing to blog about. And there's always something worth blogging about, whether it's discussing how I solved a problem, or implemented a new technology, or mockups I created for a page I'm going to build, etc. There's always something new, but only if I've been working on my site. Blogging about what I'm working on is definitely a practice I'll take with me on other projects I work on (but not before I'm done with this one!).
Wednesday, May 6, 2009
A framework for speed
When I first started posting to this blog I had the (unstated) goal of posting every 2 to 3 days. I've not posted for two weeks. 2 days != 2 weeks. Sorry. To be fair, I just moved into a new house, so between the packing, moving, and unpacking I've not had time for much of anything. However, if I were smart I would've planned for that by either saying I was going to take a break or making sure I'd have content ready during that time period. I did neither. Lesson learned; it won't happen again.
Anyway, while I was building out the registration forms for the site I realized that I was not moving fast enough (yet again). I was diving into all sorts of intricacies of form validation when I knew there had to be a much easier way to do it. I needed a framework that could do the heavy lifting leaving me to simply build out the pages on the site without having to write so much code. I stumbled upon a couple solutions, one being CakePHP and the other CodeIgniter. After studying them both I decided upon using CodeIgniter, mainly because it seemed faster, smaller, and easier to use.* It many ways it feels like an extension to PHP, providing a vast array of tools without requiring you to use any of them. And their documentation supports that. You can easily grab a class or a helper, quickly reference it, complete the task you're on and move right on to the next thing.
After completing the registration form I'll need to take a quick detour and work on the style for a bit. I've toyed around with a couple styling possibilities, but I need to solidify something soon or else I'm going to have to come back later and update the classes on every tag on every page. That doesn't sound like fun.
*Note that this is entirely based on my perception, not reality, as I've not had the time to play with them both fully. Your mileage may vary.
Anyway, while I was building out the registration forms for the site I realized that I was not moving fast enough (yet again). I was diving into all sorts of intricacies of form validation when I knew there had to be a much easier way to do it. I needed a framework that could do the heavy lifting leaving me to simply build out the pages on the site without having to write so much code. I stumbled upon a couple solutions, one being CakePHP and the other CodeIgniter. After studying them both I decided upon using CodeIgniter, mainly because it seemed faster, smaller, and easier to use.* It many ways it feels like an extension to PHP, providing a vast array of tools without requiring you to use any of them. And their documentation supports that. You can easily grab a class or a helper, quickly reference it, complete the task you're on and move right on to the next thing.
After completing the registration form I'll need to take a quick detour and work on the style for a bit. I've toyed around with a couple styling possibilities, but I need to solidify something soon or else I'm going to have to come back later and update the classes on every tag on every page. That doesn't sound like fun.
*Note that this is entirely based on my perception, not reality, as I've not had the time to play with them both fully. Your mileage may vary.
Subscribe to:
Posts (Atom)