Posts Tagged ‘coding’

Adding an Auto Increment Column After The Fact…

Tuesday, September 29th, 2009

Yep, I pulled a ‘whoops’ today. I made a table, filled it with data, then realized I forgot my standard ‘id’.  My primary key, auto incrementing column that makes me feel good about myself.

Once I noticed it was gone, it was easy to add it back. Right? Right? Well, not so fast.  You can add the new column at the beginning of the table.  But as soon as you go to set it to a Primary, Auto increment, MySQL is going to cry because of all the zero values.  The primary key’s can’t be the same so it blows up.

Before setting it to be the primary key, you need to auto-fill it.  You can do it programmatically with any script of your choice, but I find it easy to do it with MySQL…

SET @pants := 0;
UPDATE `ratings` SET id = (SELECT @pants := @pants + 1);

And that’s it.  Time for a beer.

Using Environment Variables So You Can Commit Your .project File

Wednesday, February 25th, 2009

Quick Update: this apparently only works with Zend Studio for Eclipse. Sorry for any confusion if you’re trying to figure out where the f$#@ those dialogs are.

All of my projects reside in an SVN repository and now they’re starting to get accessed by multiple users.  Typically with eclipse, I would just have a project that contained externally required libraries – such as the Zend Framework – but now the location of this is required to be more flexible.

(more…)

Zend Framework 1.6, and more.

Wednesday, September 17th, 2008

Zend released version 1.6 of their framework just a short while ago and I’ve been reviewing a lot of the changes.  As it turns out this framework is becoming quite large and diverse in what it can do.  Some of the newer features that interest me:

  • Saving sessions to a database table.
  • Dojo integration
  • Captcha and File upload form elements.

The saving sessions to a database table is conveniently easy, but I’m not too sure how well it will fare once I really get going.  It’s so simple that I’m not sure how well it’ll handle validating and securing sessions (based on Users IP, or web browser agent).  But we’ll see.

Dojo integration doesn’t really excite me that much. I’m a big fan of Prototype and Scriptaculous, and having another Javascript framework just sitting there seems like a waste of space to me – but again, it’s something I haven’t exactly dove into yet.  Maybe dojo rocks my socks and I just haven’t felt it yet.

And finally, the captcha and file uploaders may seem very trivial, but trust me – when you’re trying to build a site and those two elements were unavailable for use with Zend_Form — it was a big pain in the ass and effectively made Zend_Form useless when you needed those two elements.

Things are looking good, and the new source base for pileofcrap.org is getting there.  Of course every time I go to work on it I get distracted and then when I return to working on it a new version of ZF is out. Go figure!

Google I/O 2008

Wednesday, June 11th, 2008

I had the pleasure of attending Google I/O in San Francisco this year.  I’m only getting to posting about it now because work has been far too insane for me to even stop and think about all the glorious things I heard about during the conference.

In fact, I still find it hard to come up with any one outstanding part of the conference.  It was all so awesome, and all so in depth.

If there is anything that I brought out of it, it’s a desire to learn more Java and figure out some ideas to deal with GWT and Android.  Those are two pretty hot topics in my mind right now.

I was also impressed with the Google Earth and Google Maps API integration.  That’s a pretty sweet package right there.  I love maps, and man making maps with Google is fun.

Hopefully I’ll be able to put together some cool things for work in the near future.  I’ve got one project requiring maps and travel data right now, so we’ll see what that brings.

I also have a desire to actually figure out a Rubiks Cube.  Thanks Google, it was a blast.  See you next year, I hope.

Subversion on the Mac

Wednesday, March 5th, 2008

Why does subversion on the Mac have to suck so bad?

Sure there’s apps, SvnX, SCPlugin for Finder, and a few others that typically suck — and unfortunately I always end up using Eclipse and it’s Subversion plugin.

But really, the user friendliness of it all is making my stomach turn.