Archive for September, 2008

Blog Overhaul Using Django

Tuesday, September 23rd, 2008

My plan for a long time now has been to move away from Wordpress as my blog engine. Wordpress has been great for me, and it does a lot of things right (for one, it just works and you can be up and running with a blog very rapidly), but it can be a pig. Anyway, I figure that by putting it in writing I’ll start to find the time to get this process started. So, my only decision is what will be my engine. Here is a list of choices that I have considered over the past few months, as well as reasons why I am not going in their direction:

Expression Engine (EE)

I have never built an EE site.  Twice now I have installed 1.6, only to be turned off by the administrative experience.  It seems clunky to me and not very fluid.  With that said, I have heard great things about this software.  I also like what I’ve heard about the framework that powers EE (CodeIgnitor), and I’m especially exited about the looks of 2.0 (where the hell are you).  I’m choosing not to go with EE because in the coming months I will get my fix through work.  I believe there are at least 2 projects coming up where we will be using EE.

CakePHP

I have considered building my blog from the ground up with CakePHP.  I am working on 3 projects now that are powered by CakePHP.  Cake has made me a better developer by keeping me organized (thanks MVC), making me follow conventions (but allowing me to break those conventions where necessary), and providing a host of valuable classes for a variety of tasks.  A lot of which take the mundane out of developing.  Let’s face it, developing can be mundane and repetitive.  I am choosing not to go with Cake because I am getting my Cake Fix at work.

CodeIgnitor and Doctrine

I have considered building my blog from the ground up with CodeIgnitor and Doctrine.  I have virtually no experience with Doctrine, and even less with CI, but I’ve heard great things about both.  Doctrine seems like it rocks the house, and EllisLabs (the guys responsible for CI) seem like they really have their act together.  I am choosing not to go this route because if I am building an app from the ground up, chances are very high that I will be choosing CakePHP.  Until the day comes where someone shows me overwhelming evidence as to why I should be using a framework other than Cake (and yes, I’ve seen Rasums’ presentation on frameworks), than I’ll continue baking.

And the Winner Is Django

Just in case you didn’t get it from my title, I’ll be choosing to go the route of Django for my rebuild.  In the few hours I’ve taken to read Django documentation and play around I have been thoroughly impressed.  The template system is awesome, and the automatic admin generation has me all hot and bothered (though I’ll really get hot and bothered after I give the tires a really good kick).  I’ve wanted to dive into python for a few years now, and I’ve been curious about Django for over a year, so I figure it is a good choice for me.

Anyway, there you have it.  With grad school and everything else I have going on (we have a super secret, earth shattering, take over the world project in the making at work), I just hope I won’t be looking back at this post in 6 months thinking, “what a set of donkey balls I was for writing that.  I haven’t done shit in 6 months”.  If you think you can persuade me to try something other than Django, give it a try.

CakePHP Auth Model Update User on Model Edit

Monday, September 22nd, 2008

Ok, so I’m in the mood to write a little bit. I finished my grad school homework a little early, so I’d like to talk about CakePHP. Specifically, updating your user model session data when the user model is edited.  Here is the scenario:

  • Your are using CakePHP’s wonderful Auth Component.
  • After a successful login, you have auth model data available to you via $this->Auth->user(’key’);
  • It just so happens that this model data is stored in a session, in a format something like the following:
Array
(
    [Auth] => Array
    (
        [Model] => Array
        (
            [id] => 1
            [first_name] => Jason
            [last_name] => Leveille
        )
    )
)
  • You use this data
  • When you update your user model, you want this data updated as well

If you’re anything like I am, you make use of this data to display information to your authenticated user. For example, in your controller you might set a firstName variable for use in a welcome message.

$firstName = $this->Auth->user('first_name');
$this->set(compact('firstName'));

It’s very likely that you have provided an edit action in your auth userModel controller. It’s also likely that you have provided the user with the ability to modify their first name. In our welcome message, we are pulling our first name data from a session. If we want this data to be accurate, than the change to our user first name in the action will also need will not be reflected in this auth session. The solution of course is to merge $this->data['$this-Auth->userModel] with our Auth.Model session.

//update the auth userModel data
$authUpdated = Set::merge(
    $this->Session->read(
        sprintf('Auth.%s', $this->Auth->userModel)
    ),
    $this->data[$this->Auth->userModel]
);
$this->Session->write(
    sprintf('Auth.%s', $this->Auth->userModel),
    $authUpdated
);

Again, this code would be part of your user model edit action, and would be included after a successful save operation.

How to use the Font Tag

Wednesday, September 17th, 2008

It’s disheartening, but I got an email this morning from a former co-worker (teacher).  He is a Web design/development teacher, and I feel like he has his act together.  Here is his email:

So my professor taught us how to use the font tag last night.  No joke.  I had a hard time not saying anything.

I am not sure if this makes it better, but she said that we had to use “” with our attribute values, though, because then it complies with web standards.

Do I say something?

And here is my response:

This is a really hard situation to be in. I definitely don’t think you should say something in front of the class.

Tread carefully, but I might talk to her alone and explain that you have been doing web design for a very long time. Explain why you use CSS over font tags (why you as a web designer separate content from presentation. Not “you” as in the general public). You’ll get a feeling if she is receptive or not to what you are saying.

Is this a prerequisite for another class? Do you have to take this class? If she isn’t receptive to what you are saying I would try to get out of the class.

Jason

It’s one thing to try to force the teaching of CSS for complete and total page layout on a college professor. I could stomach an argument for the use of tables for certain presentational effects. However, teaching the use of the font tag in 2008 is irresponsible. That might be a little strong considering I don’t know the background of this teacher. Perhaps my friend should try harder to point this professor in the right direction. Your thoughts?

Interview at Teach Me The Web

Friday, September 12th, 2008

Recently I took part in an interview at Teach Me The Web.  The owner of this site, Jeff Brown, is a Web teacher at Damascus High School in Damascus, Maryland.  Included in Jeff’s curriculum are weekly speakers, as well as frequent interviews with professionals.  I would say that Jeff likely has one of the best web design/development programs in the country.  The exposure he is providing his students to the web industry is a perfect illustration of his commitment to teaching web design / development as it should be taught.  HS classrooms are not black boxes.  Anyway, keep it up Jeff!

The Interview