Just a quick tip for those of you working away in Flash. You've probably noticed that the source fla files get really big, really fast. In fact, Here's a fun little exercise for you.
- Create a new, blank .fla file and save it.
- Note the filesize.
- Add a bunch of sound files to it, some components, a couple symbols... now resave, and note the new file size. It should be bigger (d'uh!)
- Now remove all that crap. Resave, and note the new file size.
Your instincts would tell you that since you removed all that information, that the file should be smaller, but in fact, its the opposite...
I posted earlier about an article that James Nicol had up on this blog. The long awaited (well, long awaited for 6 days) article is now up, Real world apps with CodeIgniter: part II. Clever title!
He delves deeper into the black art of Code Ingiter, and discussing integrating with third party systems, validation, and my favourite understatement of the week.
Before we even went live the clients came back asking for more features...
<sarcasm>What!?! That hardly ever happens!</sarcasm>
At any rate, its a great read, and I hope James keeps writing!
For a project I'm currently working on, subscribed users get up to the minute most current information (as outlined by a date field in MySQL). Unsubscribed users get the information still, only it is a day behind.
Due to the way the information is going into the system, there could be multiple entries for one date, and then no entries for a few days, then new, etc. Basically, the information cannot be predicted by the application. Retrieving the most recent date is trivially easy with a MAX command, but there is no "almostMAX" command, so I found myself staring at the screen wondering what the most efficient way to approach this was. Here's my solution:
SELECT * FROM table GROUP BY dateIssued ORDER BY dateIssued DESC LIMIT 1,1
Fortunately for me, LIMIT accepts offsets, and I can specific to grab only the second entry. If you can think of a more elegant way to do this (or heck, if you just want to comment), please leave a note below.
One of the very nice things about CodeIgniter (and really all the PHP frameworks I've looked at) is the built in security tools. For example, CodeIgniter automatically cleans cookies, sessions, user input and URLs in addition to coming with a host of other built in tools to make your job in securing your application as easy as possible. But, like all good things, there is a trade off. In the case of security, the trade off is convenince. The more secure, the less convenient. Since security isn't really something we can compromise on, clever developers need to find alternate ways of implementing common things.
CodeIgniter for example limits the characters that one can use in a URL to letters, numbers, and "~, %, :, _ and -". A good collection sure, but what if you need to pass other characters, such as "(, ), =" or even spaces? Here's how I did it.
I've had a few requests asking how I built my RSS feed since I'm using a custom built Code Igniter blogging system. Actually, it was pretty straight forward, but I thought I'd take a few moments to outline step by step how I did it.
Hmm... lools like my love affair with SQL related posts continues.
MySQL has posted an excellent resource posted called Top 10 SQL Performance Tips. Although, it is kind of a misleading name, since its a wiki, and everybody is able to post. Currently it's up to 84 tips, most of which look really great. Here is a small sampling...
UGH! So apparently I need one of those Matrix-style brain implants to help me remember SQL.
I'm writing this down now as both a personal reminder... and maybe I'll save you from the same fate. When writing the archive for this blog, I wanted to create friendly URLs, so that /blog/archive would display all posts, /blog/archive/2006 would show all of the posts from 2006, and finally /blog/archive/2006/11 would show all of the posts from November of 2006. Simple enough right?
When I originally released BambooInvoice I learned a lot about trying to code for a site specific goal, and coding for a mass audience. I originally wrote these tips on the Code Igniter forums, but since I was recently asked for advice again, I thought I'd repost them here. The original thread is still active.
Since I released BambooInvoice I've received a number of interested emails from developers looking for tips on getting started building an application using code igniter that you intend to widely distribute. Here is a small collection of useful processes.
I don't like the way Firefox 2 handles closing tabs. Here's how I fixed my Firefox to get back to the behaviour I wanted.