Archive for February, 2007

XYZ

Wednesday, February 28th, 2007 at 8:13 am

Know what’s embarrassing? Realizing, as you arrive at your office, that your fly is down and probably has been for the 15-minute walk from home.

Whoopsie.

Let It Snow

Sunday, February 25th, 2007 at 11:58 am

It’s snowing like a mother out there, big fluffy flakes that are fun to play in, and, thanks to Virignia’s fear of weather, foreshadow another day off for local kids.

CakePHP: First Impressions

Sunday, February 25th, 2007 at 12:22 am

About a month ago, I spent some time (more than I should have, really) getting Ruby on Rails running on my laptop so I could run through this tutorial on Apple Developer Connection. Ruby on Rails has been heralded as The Next Big Thing for about a year now, and I figured it was time to get on board. After all, PHP developers are most likely to switch, so I had to give it a shot.

I understood the concepts, but the fact that I’ve never even seen Ruby code (let alone written it) made it a little hard to follow. Was I willing to learn a new language to use the framework? If it would save me time in the long run, sure. But, at this point, I don’t really feel like I have a lot of time to be putting into new languages. I wanted the ease of development without such a heavy time investment upfront.

Thus: CakePHP. I know PHP. I’m reasonably comfortable with the MVC framework. And, as it turns out, Cake is real easy to set up. Their manual could use a little work - a lot of it was “Scaffolding makes things easy!” rather than “This is how you set up scaffolding.” Thankfully, the blog tutorial was more helpful than the rest of the manual (the parts I’ve read, anyway), and there’s a fairly significant Cake community writing articles and how-to’s all over the place. I later found out that scaffolding DOES make things easy (if not pretty) - I created a users table, two files with under a dozen lines of code between them, and I’ve got a super-basic user management utility. Obviously, I won’t be using it in the real world, but for quick prototyping or a basic placeholder for more advanced functionality, it’s great.

So that’s good news. I think I’ll be using it for that project after all. And, putzing around with it this afternoon taught me a few other new things. I had been meaning to set up a Subversion repository somewhere for a while now. In the past, I’ve used RCS for a few projects so I could roll back code if I screwed it up good, but it’s a pretty crappy solution. I spent about ten minutes trying to find SVN server software for the Mac before it occurred to me to just try svnadmin create /svnroot. I also found the language association drop-down in TextMate - it’s right there at the bottom of the window, by the way - so now it knows my .thtml Cake view files are actually PHP and colorizes appropriately.

I didn’t get much code written today, but I’m in a better position to get more done from here on out - I’ve got a good framework, a code repository, and I’m becoming more comfortable with my editor. Sometimes, you just need to take a day for all this extra crap, so that the coding part goes a little quicker and a little smoother.

And now, if you’ll excuse me, I’m going to crash. I slept about ten hours last night and took a three-hour nap this afternoon when I had a bad headache, and in spite of all that, I’ve had trouble keeping my eyes open for the past hour. I really hope it’s not my turn to get sick.

CakePHP, Anyone?

Thursday, February 22nd, 2007 at 10:26 pm

I know that I don’t have too many readers, but still: have any of you used CakePHP?

I’ve got a side project that I’ve just started with a pretty short time frame. I program against an MVC framework at work and would like to build something similar for this project. Unfortunately, their server is running PHP 4.4.2, which makes things a little tougher (I use 5 daily at work, so I’m accustomed to full OOP capability). It’s do-able, but I don’t want to waste a lot of time getting a framework established. From what I’ve been able to find, CakePHP has a bit of a learning curve, but will make things a lot easier to manage in the long run. The problem is that I can’t find any decent testimonials about it (even tried Jyte). What I need is someone who can say, “It’s good for this reason and sucks because of that.”

Unless I find some reviews, I’m going to spend tomorrow evening playing with it. If things don’t go well, I’m down a day, but at least I’ll know whether it’s worth pursuing.

PHP, Zend, TextMate, and Code Completion

Tuesday, February 20th, 2007 at 10:40 pm

I spend most of my day coding PHP, so Zend Studio is like my Holy Grail. I had never even heard of it until i started my current job; we got it shortly after I started, and I’ve used it daily since.

The wonderful thing about Zend is its code completion. If I type strp, it will suggest strpos and strptime. When I hit Enter or Tab to select strpos, it finishes the function name, adds parenthesis, and in a little box above the code, it tells me strpos(string $haystack, mixed $needle [, int $offset]). And it’s the greatest thing ever.

I know how to program, and obviously, I know how to program in PHP, or else I wouldn’t be doing it for a living. However, there are very few compelling reasons to know every built-in function and the arguments they take; it’s far more important to know what that function does and what it will return. I know what strpos() does, and I know that it will return a boolean FALSE if $needle isn’t found in $haystack, and that it can also return 0 (which evaluates to FALSE) if $haystack begins with $needle.

Knowing these details is important, but I use strpos infrequently enough that I can never seem to remember whether $needle or $haystack is the first argument. With Zend, I don’t even need to think about it, so I can focus instead on what I’m doing, what variables I’m using, and what code needs to come next.

Of course, I don’t even really need to remember what variables I’m using, since Zend knows those, too. It also builds an index of all functions, classes, variables, and defines that I’VE written - not just the built-in ones - so I don’t need to remember much of that, either. Obviously, it’s quicker if I’m familiar with them and don’t have to rely on auto-complete for everything, but it sure as hell helps. How often is the source of frustration a $filename where it should have been $fileName? In Zend, I type $filen-tab, and it capitalizes the N and finishes the variable name for me.

Some programmers would argue that this isn’t “real” programming, since I’m relying on the software to tell me what to do. Some programmers would argue that the first group of programmers is a bunch of self-righteous Linux geeks and why don’t they just move out of their mom’s basement fer crissakes. I, of course, am in the latter camp.

Zend has significantly improved my productivity by allowing me to keep programming without switching over to documentation very often. Everyone has to RTFM every now and again, but the less I have to do it, the faster I can get things done. Even with the code hints, I still need to check php.net a few times a day (for example: the arguments for str_replace are $search, $replace, and $subject - is $search the thing I’m looking for, or the thing I’m searching through?)

Now, Zend isn’t all puppies and rainbows. It’s based on Eclipse, which was built in Java, which I’ve never had much luck with. On my PC at work, it’s a memory hog, and on my iBook, it’s barely usable. My work machine is pretty beefy, so it’s really not a problem there, but working from my Mac can be a real pain. On top of the speed issue, the fonts occasionally get messed up: the cursor appears somewhere it isn’t, so keystrokes affect some other area on-screen. I haven’t figured out what causes it, but I have to restart Zend whenever it happens (which leads me to another gripe: Zend takes forever to start).

Enter TextMate. Mac-happy developers have been in a tizzy about it for a few months now, but I finally started playing with it a couple weeks ago. It’s fast. It seems to be stable. The open-file tabbing is much better than Zend on the Mac. And, if you run it from Terminal with mate dirName/, it will load that directory (and any new files created in it while TextMate is open) into it’s file browser thingy. Zend has a similar file browser, but it’s not file system-aware (is that a real phrase, or did I make it up? Either way, you know what I mean).

However, it too has its downfalls. It doesn’t support open/save over FTP. And, much more importantly, it doesn’t do code completion.

I did find a PHP code-completion bundle, which has helped a bit. I type strp, and when I hit Escape, it suggests strpos (another Escape, and I get strptime). It’s a start, but it doesn’t know anything about arguments. You can hit Shift+F1 to go to the PHP manual for a function, but who wants to keep going back and forth like that? Furthermore, it’s only good for built-in functions - no functions I define, and no variables.

My TextMate trial ran out today, so I coughed up the $50 for a license. I’m hoping that I’ll find a bundle (or something) to soothe my code-completion addiction, but even if I don’t, it’s a good editor. In the meantime, I’ll probably commit more argument details to memory and get used to visiting php.net. I’m starting to do more development on my laptop (another big help: MAMP), so I think it’s going to be worth it.

Plus, that’s $50 I can write off come tax time next year. Right?

I’ve Done A Very Bad Thing

Sunday, February 18th, 2007 at 10:42 pm

Friends, I must confess a grave offense.

Earlier this evening, I supported the box office take on Ghost Rider. It was an irresponsible and regretful act, but I was caught in the heat of the moment. I hope you can forgive me.

I started the evening with the best of intentions; the Sunday Night Film Club was scheduled to see Breach, but it was sold out when we got there. We were left with slim pickins, but we agreed that Ghost Rider would, at the least, make us laugh.

And make us laugh it did. Seriously, I could barely contain myself during some of Nicolas Cage’s serious lines. I mean, I KNEW it would be bad, but this movie reached previously unknown levels of wretch. It’s hard enough to watch Nicolas Cage in a GOOD movie, but this? This was just kind of sad. And Peter Fonda? The goddamn Easy Rider playing Mephistopheles in some low-rent Cage movie? What has become of us, America?

At the moment, Ghost Rider is #1on IMDB’s Tops at the Box Office list. I’ve done a very, very bad thing.

A Career in Media

Saturday, February 17th, 2007 at 12:15 am

I’ve always thought that it would be a pretty great feeling to have directed or produced a movie. The actual directing and producing is probably a bitch, but once that’s all done, there has to be an immense sense of accomplishment.

TV is probably similar; a live news or sports program is likely frantic at the time, but very satisfying once finished. A weekly program is sort of like a short movie every week: lots of work, but a tangible end-game.

When I was finishing college, I thought I’d really like to be involved in some kind of media. I even looked for jobs at newspapers, thinking that might be a stepping stone into the more visual world of film and television. Obviously, I didn’t wind up there, and for a number of reasons, it’s probably for the best. Even so, when watching the “Making Of” featurettes on DVDs, I can’t help but think that I’d enjoy being involved somewhere along the way. I am most satisfied with any job where I can say, “This is what I made” when all is said and done, and with a movie, there is definitely something showable at the end of things.

I don’t know where I’m going with this. I guess I just want to appear in a making-of featurette. Someone should get on that.

Fancy Desk

Wednesday, February 14th, 2007 at 11:37 pm
My newly-decorated desk

Check it out, I finally put up some pictures at work. Picture frames are pricey - $20 for a 3-picture frame - so I got some fishing line, binder clips, and 3M hooks, and made my own damn picture hangy thingy! I ordered these from Flickr a while ago, but I’m going to print some more over at Target sometime soon.

I also bought a new shower head. Staying with Sarah and Ryan gave me all sorts of ideas - I tend to get stuck in a rhythm and don’t even realize that things could use some changing-up. It’s little changes like pictures of friends that make my day a little brighter.

Vacation Post-Mortem

Sunday, February 11th, 2007 at 5:33 pm

Have you ever taken one of those naps where you just blink and an hour goes by? That happened to me just after we pulled away from the gate in Atlanta. When I opened my eyes, we were halfway to DC and they were serving drinks. I didn’t get to sleep at all in the airport, and just passed out before we even taxied to the runway.

I also forgot to mention that I neglected to take off my belt (and more importantly, my belt buckle) at security, and was thus treated to a San Francisco pat-down courtesy of the TSA. Nothing like standing in the middle of a busy airport, crucifixion-style, while some guy prods your crotch.

I got back to the apartment around noon yesterday, took a quick shower, and fell asleep for seven hours. Did some grocery shopping, washed some laundry, then fell asleep again - for another ten hours - at about 4 AM. I’m feeling quite refreshed today.

I’m Not Crazy

Sunday, February 11th, 2007 at 3:35 am

Have you ever talked with someone who’s a little spaced out, and you feel like they’re really not having the same conversation that you are?

Have you ever been on the other side of the conversation and realized that the perfectly reasonable and articulate ideas in your head just aren’t coming out of your mouth right, and that you must sound like you’re more than a little off, but there’s no good way to explain to the other person that you’re totally with them but can’t, for one reason or another, express this fact?

That’s happened to me a lot lately.