Outputting Data in Excel .xls format

January 22, 2008 – 5:51 pm

All clients love data! The only thing they like more than data is data in a spreadsheet, and that’s where we would be in all sorts of trouble if we had to rely on special export libraries that in turn have to keep track with the dataformat - whims of Microsoft. Thankfully there’s a more durable solution, so your application will still be happily exporting in the future.

So here’s how you can quickly spit out a table for Excel:

(more…)


Filed under: Rnadom Sftuf — by Richtermeister

PHP Short Opening Tag not supported… null problemo!

January 20, 2008 – 9:28 pm

Here’s another config - particularity of PHP, right up there with my beloved register_globals run-ins and $_REQUEST access issues..
Recently I’ve had to deploy a site on a server that had short opening tags disabled, and no access to the php.ini. Wow, didn’t see that coming.

Now, for my scripts that didn’t really mean a thing, since I habitually start a multi-line php code block with <?php, however, I do like using <?= within my “templates” (or view files), rather than <?php echo, because, well it keeps things “template-ier” IMHO. Almost as short as the smarty tag, eh? ;)

So what to do avoid string replacing the hell out of your front-end?

(more…)


Filed under: Rnadom Sftuf — by Richtermeister

XAMPP all-in-one dev environment

January 19, 2008 – 1:05 pm

For everyone looking for a clean & simple Apache + php + mySQL development environment for their local machine, XAMP is an all-in-one solution that installs in seconds. I use it on my Windows XP laptop, but it’s also available for Linux and Mac OS.. plus, it’s free. ( get it here )

Here’s how you go about running multiple sites on your local machine (and this might be common knowledge, but it took me a little research to find how to do it..):

(more…)


Filed under: Php - Tools, Toolz that Rulez — by Richtermeister

Updated jQuery Niceforms

January 18, 2008 – 5:50 pm

I may be wrong, but there really only seems to be one “niceforms” plugin available for JS (this one by BadBoy), and I was so happy to see that it’s been ported to jQuery style by Lucian Lature (get it here).. Recently I’ve used it on a project, and it turned out that it breaks under certain conditions:

  • only works properly for one form on the page (if used on more than one form, selects reference the wrong elements)
  • the “onChange” event disappeared

Since the client already signed off on the design, I tried fixing it, and heeey, it actually works! Based on the fact that I only had to change about 3 lines, I’d say it’s probably right ;) . (See: The implicit rightness of elegant code)

Here’s the updated version: (Updated Niceforms for jQuery)

Changes: “niceform” class should now be attached to a container (div, for example) that the form resides in. Keep in mind that there might still be broken functionality under the hood. I only fixed it to the point where I could use it for my project.

Enjoy

PS: Post a comment if you find a newer / better version of this plugin.


Filed under: JavaScript Tools, Rnadom Sftuf, Toolz that Rulez — Tags: , , — by Richtermeister

FileSystem Package

– 5:46 pm

This package provides functionality to manipulate files on the server. This includes type and size validation, uploading, image resizing, MP3 - ID3 tag parsing, etc..

The need for this package really came up around the third time I had to accept file uploads from a site… first, there is a lot of steps you have to take that the file is actually there and valid (depending on varying criteria), and then I could never remember the proper syntax for moving files. This doesn’t even include validating target destinations and creating directories.. Pretty annoying!

So as you can see, plenty of opportunity for encapsulation. Enter the FileSystem Package…

(more…)


Filed under: Packages — Tags: , , , , , — by Richtermeister

Powered by WordPress