Interested in Coworking in Oklahoma?

okccoco_logoIf you’re in or around the Oklahoma City area doing freelance work, there’s some very good news for you.  Derrick Parkhurst along with a few members of the local community are opening OKCCoCo – Oklahoma City Coworking Collaborative.  What is Coworking? Coworking is essentially a movement to create a working office environment for freelancers and independent workers that they miss out on working from home.  Individuals will be able to rent a desk or private office to work at every month with a bunch or other really cool and smart people instead of working from home or signing a long-term lease for a real office and still being by themselves.  If you’re a freelancer or an independent worker that is interested in coworking, you should plan on attending the OPEN HOUSE to view the space on Saturday, January 17th at 2pm.

Details and registration are on the OKCCoCo website.

There will be a few additional announcements and activities at the open house, including a speech from Noah Everett, the founder of TwitPic. My own startup InvoiceMore will have a special announcement as well and a bonus for those who sign-up for OKCCoCo with a full or part-time commitment. Come out if you can, and don’t forget to register first! These are exciting times for the Oklahoma technology community!

PHP array_merge – Preserving Numeric Keys

This is just a quick post on PHP’s default behavior of re-indexing numeric keys when using PHP’s internal array_merge and array_merge_recursive functions, because it’s a problem I recently ran into, and was unable to find a quick solution to online.

Basically, the problem is that if you’re using numerically-indexed arrays with a set number that you don’t want to change (like an ID or some other unique identifier), you can’t use array_merge, because it automatically re-indexes all the numeric keys in the array to start with 0 on down in order.  There is no flag or option for the function to NOT do this, but there is another way to achieve the same result using PHP’s little-documented overridden plus operator ‘+’ for appending an array to another array.

So just replace this:

$destinationArray = array_merge($array1, $array2);

With this instead:

$destinationArray = $array1 + $array2;

Both $array1 and $array2 MUST be arrays or a fatal error will be thrown, so you may want to do some type checking or casting before that line of code. The difference is that instead of merging the arrays together, the second array will simply be appended to the first one with no changes.

Note that the plus operator for arrays ‘+’ is only one-dimensional, and is only suitable for simple arrays. If you need a multi-dimensional or complex solution, Keith Devens has a custom merge function that might work for you.

Get the Most From Your Google Analytics Dashboard

main_logoI’m a big fan of Google Analytics.  The service is free, can go on multiple websites using just one account, and displays and processes stats beautifully. But the one thing that’s always annoyed me about Google Analytics is the default dashboard setup when you create a new website profile.

The dashboard is the place for the most important things to be. it should be the single place you can view to and get an overview of all the most important things about your website regarding your visitors without having to drill deeper or go through multiple pages or sub-sections.  But the default dashboard Analytics starts you off with is all wrong, and is almost never the information I really want to see.  Let’s see how we can fix this. Continue reading

Deleting Duplicate Rows in MySQL With ONE Query

So you have a MySQL table that, somehow or another (usually on many-to-many relation tables), winds up having rows with duplicate data. Trouble is, finding and deleting these rows most of the time involves several steps that could leave your website with a few errors showing here and here if you don’t perform the updates fast enough. So is deleting multiple duplicate rows in mysql without deleting the first original row possible with just ONE query? Turns out, it is with subqueries, a MySQL feature available since the 4.1 branch. The steps are bit tricky and the query is complex, so I’ve broken it down into several steps that should make it easier to follow. Continue reading

IE6 and Multiple Button Submit Elements

I stumbled across yet another weird issue in Internet Explorer 6 today.  This time it has to do with <button type="submit"> elements and how data is sent back to the server.

<button type=”submit”> vs <input type=”submit”>

You would think both elements would behave exactly the same, because they’re both basically the same thing – the “submit” button on HTML forms.  Turns out that in Internet Explorer 6, they don’t behave the same at all.  Surprise, surprise.  The issue has to do with using multiple submit buttons on a form which can perform different actions:

[Displayed cart contents with editable quantity fields]

Update

Checkout >

Continue reading

Introducing… PHP DataMapper!

phpdatamapperPHP DataMapper is an open-source project I’ve been building and working on for a little while now.  It’s a lightweight Object-Relational Mapper based on the Data Mapper design pattern, setup using one mapper per table.  The primary goal is to make database access one of the easiest parts of building your application instead of the most tedious, and for PHP DataMapper itself to have no dependencies outside the default PHP5 installation so it can be used anywhere, in any application (no frameworks required!).

The project itself hasn’t changed too much recently, but I decided to finally formally introduce this project because I finally got some time to write some decent documentation on how to use PHP DataMapper in in your own application.  Head on over to the PHP DataMapper page to check it out, or just get right into the good stuff with the Getting Started tutorial or the
Usage – Finders example.

More updates and documentation will be coming soon.  If you’re interested in learning more about the project or contributing, please join the Google Group.

UPDATE: Links have been updated to the new home for the project – phpdatamapper.com

In Oklahoma? Come to The OpenBeta “Unconference”

If you’re in or around the Oklahoma City, Oklahoma area, you need to schedule some time for the upcoming OpenBeta "Unconference".  From the event website:>OpenBeta is an un-conference — a participant-driven community event aimed at exposing ideas and creating opportunities by connecting smart, passionate and motivated people with different expertises.

The event will be held on Thursday, October 30, 2008 at the IAO Gallery in downtown Oklahoma City at 7:00pm.  It’s going to be a night of good fun and networking with like-minded technology-oriented individuals in Oklahoma.  I’ll be giving a quick 5-minute lightning talk presentation myself on my upcoming InvoiceMore project and what makes it different from competing online billing and involving services that already exist.

Please consider attending, and have those networking skills ready!

Early Performance Benchmarking is a Disease

Benchmarking and performance concerns should be one of the last things you address while building your application, but it seems as though, in the PHP community especially, it’s often one of the first things novice developers think about.

Any PHP developer who’s been in the community for a while has heard preposterous claims like “use single quotes (‘) for strings instead of double quotes (“), because it’s faster”. That is, faster over the 100,000 or so iterations it took the tester to generate a number sufficiently large enough to justify the claim, with a particular version of PHP, in a particular development environment in which it was tested.

Continue reading

Presentation Slides From Tulsa TechFest 2008

Well Tulsa TechFest is over, and it was a pretty good conference overall. Here are the slides of my presentations at the conference for those who are interested. I have voice recordings of both my presentations too, but unfortunately the digital recorder I bought has no way of directly accessing the files stored in memory to move or copy them to a computer. It just has a line in/out like the old cassette recorders. What’s the point in making a digital recorder if there’s no USB cable or anything to get directly to the files? Huh Sony? Anyways – I didn’t have the cable required to re-record the audio on my computer, so I’ll probably pick one up and make videos of these presentations a little while later. But for now, you can at least enjoy the slides. Continue reading