Completely unfair, totally biased review of PHP ORM libraries
2009-05-07 4:37 pm ∴ Rant,Thoughts ∴ Tags: , , , ∴ by matt -

This has been on my mind for a long, long time. Having been spoiled with SQLAlchemy and Elixir, I am tortured with sub-par ORM libraries while at work. Granted I did get to use SA for an internal project, but the majority of the things I do involves PHP.

I’ve been stuck with it for years. It is the language of choice for people who run servers and hate web developers. So yeah, 5 years of PHP and MySQL …and using so many different libs for database abstraction has given me some room to shoot my mouth off.

Anyway, this is going to be a long post and not for the faint of heart.  I’m going to start off at the beginning…

(more…)

I hate giving away ideas, but…
2009-04-12 8:22 pm ∴ Thoughts ∴ Tags: , , ∴ by matt -
Awesome

Awesome

I really, really, really, really want an old timey bathing suit.

See how awesome that is? That guy is picking up two chicks AND it’s a stereoscopic photo.

I want one for my next beach trip. Yeah, I haven’t been on a beach since I was twelve or so and I cook in the sun and it smells like bacon (Hickory Smoked!), but I think I could easily pull off the look.

Plus, I can use great pick-up lines.

“Hey dame, what do you say you and I go for some outlawed spirits while we buy stocks on margin. Later, we can head to my house where I have a light bulb!”

Or:
“Has anyone ever told you you’re the swinginest flapper who ever jabbed herself with a hatpin?”

Or: “Have you met the Great Gatsby?”

I. Can’t. Lose.
!

Today was not a typical day
2009-04-09 2:34 pm ∴ Thoughts ∴ Tags: , , , ∴ by matt -

So I managed to get bit by a bunch of freaking IE bugs today:

  1. The double-margin bug
  2. The opposing floats bug
  3. The IE8 horizontal-rule alignment crap — also in Opera :(
  4. And the hasLayout bug in IE6 and 7…twice! Once has an element having hasLayout screwing up lists. The other was an element not having it causing a background to not show.

Ugh

Maybe there’s a way we can get people to switch to Firefox by offering a rebate? Give out a rebate code with a download. Or Chrome? Google’s got money…

I haven’t thought this through yet

Censored?
2009-04-08 2:21 pm ∴ Thoughts ∴ by matt -

Hardly.

After HostMySite’s apology, I agreed to hide the blog post. Someone actually admitted that the technician, who was telling our client I was doing it wrong, was wrong. Turns out he was talking about ASP, not PHP. It’s ok because I get those confused all the time.

(Editor’s note: I’ve never confused ASP and PHP. I’ve also never confused .Net and the JRE, Qt and GTK, Rails and Pylons, the Daily Show and the Colbert Report, Grep and Awk, Bash and Zsh, OpenGL and Direct3D, or Vim and Emacs. Turns out some things are totally not like each other, period.)

Anyway, the matter’s done with. Til next time, I suppose.

Maybe I’m doing it wrong?
2009-03-06 10:07 am ∴ Programming,Thoughts ∴ Tags: , , , ∴ by matt -

I decided to try my hand at writing an RIA using Ajax again. It didn’t take long before I realized stuff wasn’t working or wasn’t going to work and I changed the architecture.

Then changed it again…
…and again…
…and again…

I must be doing something wrong, right? There’s no way it should be this hard in this day and age to write a really simple Ajax-app. Why can’t I wrap my head around the design phase. I get my plan in motion, then I just realize, “Oh that’s not going to work.”

Yesterday, I downloaded the free Adobe Flex SDK to give it a shot.

I must say, it’s very impressive. I felt like I was doing real programming and not just hacks upon hacks. MXML is a bit like XUL, based on my very limited XUL experience.

XUL was another candidate but, running XUL stuff isn’t as easy. There’s no guarantee that my target user will be using Firefox. Nearly everyone has Flash. The downside to Flex is that it’s probably a good deal slower than XUL would be. But that’s ok too — I’m not going for performance here, it’s more about cutting development time.

More to come later…

VIM makes my life easier
2009-03-05 4:34 pm ∴ Programming,Thoughts ∴ Tags: , , ∴ by matt -

So today, I had to comment out a bunch of links on a static website. It was only linked from 10 or so pages, so I thought writing a regex to comment out just that link would be too bothersome. I decided to just use VIM. Here’s how easy it was:

<Enter>  -- Open the file in WinSCP
:41 -- go to the line number of the tag to comment out
vat -- select all of the tag
<Alt-X> -- Comment out the selection with the EnhancedCommentify plugin
ZZ -- save and close
<Down-Arrow> -- go to the next file in WinSCP

That’s all. If I had more commands to do, I could record a macro and get everything down to around 6 keystrokes. Can’t beat that.

Fun with PHP dates
2009-02-05 11:53 am ∴ Programming,Thoughts ∴ Tags: , , , ∴ by matt -

So in a recent project, I had to handle some formatted dates. Piece of cake right? Date handling in PHP is a snap with date() and strtotime(). In fact, I’ve often said that the date functions are the best part of PHP, so I’ll have this knocked out in no time.

Well, maybe not.

I’m handling credit card expiration dates specifically in this case. Usually, the user is given a choice of months and years in a drop-down list. “That’s too annoying,” I thought, “It’s much faster to just type it in and let PHP handle the date formatting.” The expected input format is mm/yy so, of course I proceed with something like this for storage:

date("m/Y", strtotime($ccexpr));

Done and done! Hmm…until I tested it.

Turns out that strtotime() doesn’t like the format mm/yy. So maybe if I enter it as mm/yyyy it’ll be ok. No, not ok there either. “That’s kind of odd,” I thought. So I head to the function’s page to see if there are any user comments on it and I see this:

strtotime returns time() for any string that begins with “eat” (case insensitive)

Hrm? What sense does that make? It could be an abbreviation, but what does EAT stand for? Well, I’m getting off point by now, so I set up some tests to see what I could figure out with strtotime():

strtotime():
2/8/2010 => 02/2010
2.8.2010 => 08/2010
2010-2-8 => 02/2010
2/8/10 => 02/2010
2.8.10 => 02/2009
10-2-8 => 02/2010
2/10 => 02/2009
2/2010 => false
2010-02 => 02/2010

Weird huh? 2/8/10 gives the correct year, but 2.8.10 doesn’t? 2/10 gives the wrong year (because it’s assuming the date given is 2/10/current_year), but 2/2010 fails? Yet, 2010-02 works. I’m kinda baffled by this, but I’m sure there are some eccentricities to this function since it handles stuff like “tomorrow +20 years.”

So, since I’m asking for a specific format, I decide to switch to strptime(). As with all PHP functions I seldom use, I check to make sure it’s available in the version I’m using. Since 5.1? Ok, whew! Wait…really? This is a pretty basic date function that’s provided in the C run-time. Why did it take so long to get in to PHP? Ok that’s beside the point — but I look a little down the page and see:

Note: This function is not implemented on Windows platforms.

What? Why? It’s like I’m in bizarro world or something. Am I crazy?

Ok — it still doesn’t matter, there are still things here that need to be done, I just can’t test it on my machine at work. No biggie. So I check strftime() to see about the formatting codes. Hmm. Wait a second…again…  strftime() has been available since PHP 4? Why it — what — not — both — ? Arghhh!

I must be crazy. I must be. If I’m not, PHP will surely drive me there.

Off to a great sturt
2009-01-27 4:24 pm ∴ Thoughts ∴ by matt -

I was just reading over my post from yesterday — I didn’t mean it to come across as whiny. It was more of a cynical tone that I intended. Firefox and Firebug have saved me more trouble than they’ve caused, so it’s not a total bash against those two pieces of total garbage. ;)

Anyway, the point of this post was to say that I was hoping to make this more than a site in which I complain about stuff — and that I’m off to a terrific start! Also I wanted to list topics that I’ve been thinking of just today –

  1. Writing robust web apps is still a lot of work
  2. PHP ORMs are truly the work of Satan
  3. On a more personal level — My thoughts on why I feel like I don’t fit in with anyone.
  4. Taking pictures and doing stuff not computer related
  5. The ins and outs of some wordpress plugin I’m going to write.
  6. The process of converting a 2-D game from D3D to SDL.

Those are just some potential things to explore. Any other ideas?

[p → -∞]