Coolnamehere

May 4, 2008

Purpose

Filed under: Uncategorized — Tags: — coolnamehere @ 10:34 am

I’ve been thinking about it, and I decided that this would be my new geek blog. My Blogger account just hasn’t been cutting it for me for a while. Not that it’s a bad system, but it doesn’t seem quite as nice as WordPress.

There probably won’t be a lot of posts here any time soon. Work’s been keeping me very busy, and when I’m not busy I’m poking through How to Think Like a (Python) Programmer. That’s a fun book, incidentally. There’s no new educational matter if you already know Python, but I like the way it’s organized and the exercises are great fun.

I’ll eventually have something to write about and the time to write about it, though. I’m sure you’ll be on pins and needles waiting for it.

February 10, 2008

First Post

Filed under: Uncategorized — coolnamehere @ 12:54 pm

I’m just exploring different hosted blog systems right now. I have been thinking a lot about switching my site over to a blog-based system, which does mean transferring content and doing something about categories. My blogger account seems a little straitjacketed for all the stuff I’m thinking of, so now I’m looking at WordPress. Impressions so far? It’s pretty.

Hello world!

Filed under: Uncategorized — coolnamehere @ 12:50 pm

Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!

September 22, 2006

Filed under: Uncategorized — coolnamehere @ 7:36 am

I’ve been experimenting with CakePHP over the last couple of weeks for a project. It’s definitely not Ruby on Rails, but it has a lot of charm. This library provides a MVC system for PHP applications, but the really interesting thing is that you can just drop it onto your Web server space with no fuss or bother. You don’t even have to worry about clever mod_rewrite rules if you don’t want to.

Since CakePHP is so accessible, I thought it would be fun to explore the framework a little bit more, and document what’s going on here. Now, I’m not the greatest at remembering to update this blog, but I’ll do my best.

My goal is straightforward: create a forum application, similar in purpose to phpBB. I’m sure it has already been done, but I’m in this strictly for the educational exercise.

The first task – assuming you already have Web space with support for PHP and MySQL – is to get CakePHP. That’s easy enough. Just grab the latest archive from the download section of the CakePHP site, and unpack it to your server space. I’m fond of using my personal machine as a development site, so I won’t be worrying about issues like uploading or editing remote files.

$ cd /var/www
$ sudo tar xfvz ~/cake_1.1.7.3363.tar.gz
...
$ mv cake_1.1.7.3363.tar.gz cakebb
$ sudo chown --recursive brianwisti cakebb

Okay, there are much safer approaches to setting things up, but I am only doing quick and dirty development on my home machine.

Next I need to manage the database connections. CakePHP uses PHP code for configuration, following along with the Rails idea of “convention over configuration.” The theory is that a handful of PHP files are easier to sort through than a handful of XML configuration files.

Configuration files are kept in cakebb/app/config. The first one I’ll be looking at is database.php, except that there is no database.php when Cake is first extracted. We have a file database.php.default instead. I’ll move it over to database.php so that Cake has something to look at on startup.

$ mv database.php.default database.php

Of course now I need to edit the file to establish the database connection details. I’ll also need to set up the appropriate databases on my local MySQL server.

So here’s the important part of database.php:

class DATABASE_CONFIG
{
    var $default = array('driver' => 'mysql',
                                'connect' => 'mysql_connect',
                                'host' => 'localhost',
                                'login' => 'cakebb',
                                'password' => 'cakebb_user',
                                'database' => 'my secret password',
                                'prefix' => '');

    var $test = array('driver' => 'mysql',
                            'connect' => 'mysql_connect',
                            'host' => 'localhost',
                            'login' => 'cakebb_user',
                            'password' => 'my secret password',
                            'database' => 'cakebb_test',
                            'prefix' => '');
}

Then I go into the MySQL shell to create the databases and accounts needed by CakeBB.

$ mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6 to server version: 5.0.22-Debian_0ubuntu6.06.2-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create database cakebb;
Query OK, 1 row affected (0.01 sec)

mysql> create database cakebb_test;
Query OK, 1 row affected (0.00 sec)

mysql> grant all on cakebb.* to 'cakebb_user'@'%' identified by 'my secret password';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all on cakebb_test.* to 'cakebb_user'@'%' identified by 'my secret password';
Query OK, 0 rows affected (0.00 sec)

I feel like skipping mod_rewrite for now, so I’ll uncomment the following line (around line 40 of app/config/core.php):

//  define ('BASE_URL', env('SCRIPT_NAME'));

All I’ve got at this point is the basic setup, but I should test it just to make sure everything is connecting. I send my browser to http://localhost/cakebb/ and get a lovely status page telling me that CakePHP is installed and able to connect to the database.

Great. I’m set up and functional. The next step will be to build the application models. But that will have to wait until tomorrow, because I need to get to work now.

March 29, 2006

I still like UNIX better

Filed under: Uncategorized — coolnamehere @ 6:59 am

But at least now I have learned enough to actually get stuff done in Windows. That, and enough of my favorite tools have been ported over that I don’t have to feel homesick.

March 25, 2006

Filed under: Uncategorized — coolnamehere @ 12:56 am

There must be something wrong with me. I’ve been sitting here for the last hour, merrily watching Jigdo downloading components for a Debian ISO. This is roughly equivalent to watching paint dry, except for the fact that at least the latter provides you with a dry painted surface when it’s done.

Like I said, there must be something wrong with me.

March 2, 2006

Aliases

Filed under: Uncategorized — coolnamehere @ 1:18 am

Here’s something I didn’t know. When you override a method in a subclass, you also need to redeclare any aliases for that method. Seems pretty obvious when you think about it. I didn’t think about it, though, and it caught me up for a few minutes.

I’d post a block of sample code, but I keep getting “body, Malformed HTML found.” errors from 43Things whenever I try to save with my code in there (pre tags and all)

February 13, 2006

Sticking with Vim

Filed under: Uncategorized — coolnamehere @ 4:26 am

I’ve been experimenting with several excellent editors for Windows, including UltraEdit and Crimson Editor. The experiments will continue, but for now I am going to stick to a Windows install of Vim. Becoming familiar with Windows doesn’t mean I have to drop everything I already know in the dust!

January 7, 2006

Filed under: Uncategorized — coolnamehere @ 10:41 pm

I snuck out a couple of new PageTemplate releases over the last week. There were no significant changes. The main bugfix is that PT should now work okay in an environment where $SAFE > 0. This means you can finally use stock PageTemplate in your mod_ruby projects. I don’t have any major plans for PT in the near future. I really need to improve the tests, so I can know for sure that the package does what it’s currently advertised to do. Much later, I want to split the library into components so that people who want the bare minimum can use a PageTemplate::Core module which would be equivalent to PT 0.3.2.

Blog at WordPress.com.