July 30th, 2007
Need a series of non-repeating but random numbers? For example, random images from a gallery or portfolio screenshots? Let me save you some time:
$numbers = range($min, $max);
shuffle($numbers);
$random_1 = $numbers[0]; // first random number
$random_2 = $numbers[1]; // next random, non repeating
$random_3 = $numbers[2]; // next random, non repeating
Normally I wouldn’t blog about something like that, except that I just spent 20 minutes using rand() to generate a random number, then saved it into an array, then ran an in_array() to look for it, and start the process over.
It wasn’t until I was about 15 minutes into it that I thought to myself… “What on Earth am I doing?”. Then stubbornness kicked in and I tried to finish my monstrosity, then I finally re-evaluated my strategy.
Funny, because I’ve never used shuffle() before for anything, so my brain could only think of commonly used array functions like sort() and asort() (and of course, your favourite and mine… array_intersect_uassoc() - which I freely admit to only just now looking up to discover it exists).
Why are we sometimes driven to code the most complex solution possible, and worse, even when we know it is utterly involved and inelegant, we still drive to make it work, “just to see it working”?
Continue reading “Using PHP for random, non-repeating numbers”. Posted in
How-To, PHP with 5 comments 
July 27th, 2007
I got an email from a community member from CodeIgniter. I won’t use his name here (feel free to comment below in case anyone thinks I’m lying ;) ), but with his permission I’m reposting this. He asked about how I got started, and the realities of running a business. This is the second time in a week I was asked, and thought I’d post a bit here. What you see below is a mostly unedited response that I wanted to share.
I’ve blogged a little bit about this before. Especially when I wrote hear me now and believe me later.
And don’t believe the fortune cookie...
Continue reading “how I started my business and career”. Posted in
Education, Personal with 6 comments 
July 26th, 2007
Well, considerable bug squashing effort has gone in here, and things seem to be running smoothly! Bamboo is now available in English, French, German, Spanish and Dutch. As well, the code is leaner, cleaner and ready to keep growing.
This release is mostly a maintenance release. Next version will have new features, including the commonly asked for line-based items (price, quantity, description, etc).
Don’t forget to run the update script if you’re… um… upgrading ;)
Continue reading “BambooInvoice 0.8.1”. Posted in
BambooInvoice with 8 comments 
July 24th, 2007
I’m supposed to be working right now (of course… damn deadlines), but I’ve got a turtle waffle-bowl sundae in me, and I can’t seem to concentrate. 4 cups of coffee a day… don’t think its the caffeine… must be the sugar. Ugh… not sleeping tonight.
Hm, ok overly personal post with not too much web-related stuff. Next post will focus on starting a web consulting business.
Continue reading “Damn you Dairy Queen”. Posted in
Personal with 2 comments 
July 16th, 2007
I’m very proud to say that BambooInvoice 0.8.0 is completed and live. The changelog covers it off pretty well. I’d like to very, very gratefully acknowledge Marc Arbour, Micha Schlieper, and Alex Williams. Each helped with energy, ideas, and translation efforts.
The big thing about this version of Bamboo, aside from squashing every known bug, was the inclusion of Internationalization. It once again highlighted the flexibility of a good PHP framework. Now that the work has been done, dropping in new languages is a snap. Currently Bamboo runs in English, French and German. Additional languages are always welcome.
Also of note is the new reports feature I wrote about earlier. It seems to be giving me some grief in Safari. If you’re a javascript guru familiar with Safari’s parser, I’d love if you could take a quick look and see if you can’t nail that down. And don’t even get me started about Internet Explorer… for what its worth, Bamboo does run in IE flawlessly.
0.8.1 will focus on any bug fixes that are found on release (there’s bound to be 1 or 2), and then 0.8.2 will focus on code cleanup. Bamboo was written before CodeIgniter even had models, and there are lots of inconsistencies, loose code and other items I want to address. 0.8.3 will start adding in new features again, as we work towards a completed 1.0 release.
One thing on my radar is to drop DOMPDF as the PDF library. I’ve been happy-ish with it, but development seems to have stagnated, and it seems to be a bit of a memory pig, often causing the “Allowed memory size of xxxxxxx bytes exhausted” error (which I’ve added a specific note about in the installation guide). The Zend PDF library seems nice. Jonathan Snook had an interesting article on implementing Zend components into CakePHP. He talks about a vendor() helper, but it looks to me like CodeIgniter could do the same thing with relative ease.
include(APPPATH . '/zend/pdf.php');
In fact, the prolific Dan Freak has already written about Using Zend Framework components in CodeIgniter, so its not like I have any excuses here.
BambooInvoice, “the little project that could”, has taken on a life of its own. If you use it please drop me a line or leave a comment here. I’d love to hear how you think it helps you, or what it would need to be able to do that.
Continue reading “BambooInvoice 0.8.0… its ALIVE!”. Posted in
BambooInvoice with 4 comments 
July 16th, 2007
With BambooInvoice 0.8 about to be released, and the big new feature being internationalization, this has brought to light a few issues with character sets, particularly as they apply to the database. It seems that MySQL, in its default configuration, and especially with popular installers such as XAMPP, MAMP and WinLamp, usually sets the default character set as “latin-1”. For English, this is a complete non-issue, and things work as they should, however if you try to set other languages, characters such as ö, ä, and ï (as well as dozens of others) tend to load to the screen as garbage. This is often compounded by the fact that the webpage itself might be in a character set such as UTF-8, which is very “international friendly”, and so things appear to work on the “front end” but as soon as data goes into a database and back out… its borked.
The solution of course is to simply use UTF-8 as the character set for your database. The problem though, is that many of us have legacy data in MySQL, and as mentioned above, the data started its life as latin-1. This is particularly true of BambooInvoice, as the installer I set up did not specificy any character set, so nearly everyone’s databases (my own included) is in latin-1.
I’ve found 2 good ways of converting an existing database from latin-1 to UTF-8. Here’s how you can convert your data…
Continue reading “Changing MySQL default character sets to UTF-8”. Posted in
BambooInvoice, How-To with 3 comments 
July 12th, 2007
From the CodeIgniter news:
CodeIgniter 1.5.4 Released
Version 1.5.4 is primarily a maintenance release. For a list of all changes please see the Change Log. If you are currently running CodeIgniter please read the update instructions.
A maintenance release? Rick, the master of understatement as usual. All of us busted our butts, but particular praise should go to Derek and Paul, who (among many other things) rewrote the input library and significantly increased its awesomeness. In fact, security in CI on the whole is a considerable step up.
Here are some other notables:
- configurable character sets
- much better handling up uploads and mime types, particularly in “everyone’s favourite browser™”
- autoloadable custom languages
- better (valid) docs with more functions and less typos
- massive bug stomps
OK, I guess that fits the definition of maintenance release, then why did it feel like so much work?
The autoloadable custom languages is almost directly resulting from the renewed effort to internationalize BambooInvoice. Much more is coming, and CI development is once again in our wheelhouse.
Continue reading “CodeIgniter 1.5.4 released”. Posted in
CodeIgniter with 6 comments 
July 10th, 2007
Internationalizing BambooInvoice? Yup.
Again? Yup!
Seems I’ve had quite a love/hate relationship with internationalizing my application, but today I’m proud to say, that despite rumours to the contrary, an internationalized, and localized BambooInvoice is going to happen. Actually, it’s happening as you read this (here’s my local installation)...

BambooInvoice 0.8.0 will be added to the online demo shortly, and the code released a matter of days after that.
I’m finished implementing new features, and what is left is the major job of finishing off the language variables for internationalization (I’m about 40% through right now). I’m proud of the improvements that Bamboo has seen over the last few days. As a small sampling, there has been a significant overhaul to the way languages are handled, and this will actually have a trickle down directly into the CodeIgniter codebase (the ability to autoload language files). The symbol of curreny ($ vs £ vs ¥) is now customizable. Long standing bugs and half-implemented features (I’m looking at you password-reset) are fixed up or added in.
A full new update path is now built in. Inspired by how smoothly ExpressionEngine handles updates, I’ve decided to follow a similar path. In essence, each Bamboo version is now identified via a version number, and when a new release is out, just hit the “update” page, and Bamboo will intelligently and silently make changes to the underlying database structure.
This is on top of the reports I mentioned in an earlier post of course. I’ve implemented an SVG/Canvas charting library that dynamically draws your yearly invoice totals and taxes for you. I absolutely love the end result, but it took a hundred thousand hours to get working right in IE. Does anyone still use IE? Anyhow, check out the new reports feature. Yeah, May was a good month for me ;)
It was fun to dig into the guts of prototype and javascript again. To anyone who still thinks of javascript as a toy language…think again. It is often the right tool for the job - and with libraries like prototype and scriptaculous to build on, it is very much a mature tool. Of course its buggy, but all environments are. Have you tried testing for readable files on various server setups lately? At EllisLab we have… and it’s a monumental pain; and PHP is largely considered among the most stable environments available.
There’s also been significant compatibility improvements, and an installation routine that checks for most requirements before the installation takes place. Also, more of the usual code cleanup - getting rid of un-needed files, and a few cosmetic changes here and there.
Also of note, CodeIgniter itself has also undergone some pretty significant changes recently in the subversion repository, and should see at least a few more in the next few days and Derek and I go on a bug hunt.
Continue reading “Internationalized BambooInvoice revisited”. Posted in
BambooInvoice with 2 comments 
July 09th, 2007
First of all, Veerle is flippin’ brilliant to begin with, but then writes a blog post entitled “What a designer has to do when looking for a job” that is chalk chock full of great advice, and then recommends you use ExpressionEngine to set up your portfolio. What’s not to love!
Next, I would design myself a website using web standards of course. How far you take this is based on personal knowledge. If it was me, I would use ExpressionEngine to power my portfolio and blog. Why? Because it’s a great way to get your name out and to show your work to the world.
Thanks Veerle!
Continue reading “Quick Link: What a designer has to do when looking for a job”. Posted in
Education, Quick Links with 3 comments 
July 09th, 2007
LuckyOliver is another entry into the stock-photo market. They’ve been around for a bit of time now. I first heard about them when I was down at South by Southwest, where they gave out these nifty beer coasters as promotional giveaways. So what makes them different then the venerable iStock? Well, they’re both stock photo sites, so you’d expect similarities. iStock seems to have generally higher quality work, but you can find some great pictures on LuckyOliver.
iStock also has videos now, which is something not available at LuckyOliver. Then again, videos are generally only useful if you’re doing very specific Flash work, and even then the video selection from iStock leaves a little be be desired (although, to their credit it is growing every day, and finding high-quality video clips is getting easier and easier).
So what does LuckyOliver have over iStock? In a word, attitude. They still exude that “small team of guys trying to make a run of this” feel. Their blog is candid, and fun. The site is designed to look worn, but the interface remains clean and clear - but still “flirty”. Running a search? They offer you the option of “no nudies”. Your “control panel” is called the “Big Top”, and also offer the “Odditorium”. Cute. There are other interface niceties there as well. When you first sign up, they give you a simple 2 option choice box. “Ready to buy, or read to sell” - attractively presented. I have no interest in uploading or selling images, and the presentation left me feeling like I knew what I needed to do next. Even when they nag you for money, its well presented. “Interested? You’ll need to get yourself some tokens”. Oh yeah, continuing on the carnival theme, they call credits “tokens”.
The search tool looks really promising, but isn’t giving me as accurate of results as I had hoped for yet. A search for “old people” gave me a bikini Ms. Santa Claus and about 8 Shakespeare actors, a police cruiser… a toilet? Um… ok. If they can get that sorted out, they have great ideas. You can search by orientation, be specific about illustrations or photos, licenses and many other options. Nice.
While it doesn’t mean much to me, they do a photo commenting not unlike Flickr, and also offer image tagging, lightboxes, and the other standard fares.
Finally, they seem to offer types of photos that I don’t see too much on other stock sites. Worn, risque type imagery. LuckyOliver has intrigued me enough to add it to my stable of resources, and I’m hopeful it won’t let me down.
Continue reading “Quick Link: LuckyOliver.com”. Posted in
Quick Links with 3 comments 
1 2 >