the most awesome guy ever.

The Blog of Darryl E. Clarke

  Random musings from a jaded coder who just needs a hug.

Posts Tagged ‘code’

There’s Something about FITC Toronto…

Wednesday, May 2nd, 2012

On the days of April 23rd to April 25th, 2012, I attended a few various sessions at FITC Toronto. At the time the amount of information I was consuming was a little bit of overload. However, now that things have sunk in, I’d like to reflect upon it.

HTML5 Gaming

One of my primary goals of the conference was to cozy up to the idea of HTML5 gaming. It’s definitely a big thing that you can’t ignore.  The concept of being able to write a game and deploy it wherever an HTML5 capable browser exists is somewhat exciting.

First up on my list was “HTML5: My Life in the Trenches” with Grant Skinner. For the most part Grant introduced the audience to a nifty set of tools called CreateJS – which I think has great potential to become a solid standard for HTML5 gaming libraries. As you can see from some of the featured demos on the CreateJS site, developers are already building a great array of types of games. They’re fast, well done, and with the tools used they maintain compatibility across platforms that support HTML5.

Next up was “My Adventures in HTML5 Gaming” with Jesse Freeman. Jesse’s focus was more oriented towards the design of games and making what you want. When it comes to actually designing, you shouldn’t be afraid to share your ideas with others. You should document every little feature you want, even if it’s not realistic at the time. Also, don’t be afraid to just re-create something you like. It’s one of the best ways to learn. Jesse’s primary HTML5 library of choice is ImpactJS (he’s also selling a book about it), a full featured canvas and game engine. It’s $99, one time, per developer license fee might keep people away from it.

In both presentations it was made clear to me, albeit indirectly, that Adobe’s direction is definitely moving away from Flash as a final distribution format.  They’re re-tooling and adding the ability to export Flash and related assets directly into HTML5 libraries and resources.  These resources can be easily leveraged by any awesome HTML5/JavaScript library.

Overall, both HTML5 related talks were pretty good.  They definitely opened my eyes to newer tools and technologies with some innovative ways to use them.

Aware, Phsyical, Wearable, and Interactive Things

Another one of my favourite things of late is the ability to have things that are aware. Whether it’s my phone being aware that I’m in the office or at home; or my couch aware that I’m sitting on it; or the ability for my computer to detect that I turned on my Apple TV and ask me “Hey, Darryl, do you want me to turn your TV to Input5?” where I say yes and it does it.  But I digress. These potential things are just too awesome.

There were a few presentations that I saw that I felt were right up this alley. “NFC: Thinking Creatively Beyond Mobile Payments” with Pearl Chen was one such eye opener. The idea of using NFC to tag food storage containers and connect it to recipes in Evernote was one such awesomeness.  Another being a ‘smart’ case for your phone, which can detect via NFC the orientation of your device and set it’s ring tone to a certain way. It’s pretty damn cool.

Hey Ellie, What are You?” with Matt Fisher was a pretty awesome display of how you can leverage open source projects to create your own. With his home brew always-on voice command recognition system a la HAL or Jarvis (Iron Man), the potential for home automation and home awesomeness is endless. This one presentation alone filled my melon with so many ideas. My Evernote cupeth floweth over.

A Window to the Physical” with Peter Nitsch was all about going beyond digital, on screen, glass interfaces. His talk ventured into the realm of “the internet of things”, a world of connected and aware devices. He touched on a lot of greatness like how affordable and accessible DIY physical hardware (arduino, 3d printing, prototyping) has become.  And literally, if you can think of something, you can likely make a prototype these days without much cost.  The concepts presented really work into my overall desire to make something using things that are aware and things that can interact with other things.

The most interactive presentation was Marvin.  Marvin was just hanging out in the lobby for the entire time. He wasn’t really presenting anything.  I don’t think a lot of people realized what Marvin was.  A giant bear-like creature that for the most part just had people sitting on it.  Until people realized the sign that said “Run and Jump on Marvin…” Then the fun began.  As it turns out, Marvin was loaded up with some sensors and he detected a good pounce and hug.  When that happened, the bigger the pounce the bigger the “smile-works” show was above him.  You can see the videos below. It’s silly little cool things like this that make me love technology.


When it all comes down to putting all these incredible technological things together it takes time and process. And that’s where a talk titled “The rapid prototyping, creative incubating, lean startup.” by Hoss Gifford comes in to play.  He explained a lot about process that they use at OneMethod.  Everything starts with an idea and gets a time limit. A two month incubation time limit. If you cannot take your idea to a working prototype in that time, it should likely be back-burnered.  The main reasoning is that everyone’s passion around a project is at a high during the early stages and as time goes on that high can fall down drastically, so they jump on another new project with a fresh new high.  Not to say all projects should be thrown out; but the amount of attention you should give it is directly related the initial feedback and response of your prototype.

The prototype itself should be as lean as you can make it.  The most minimal, working product you can get to market that does what you want.  Time to market is typically critical. In this digital age if you sit on your idea and “make it perfect” over many months or even years, chances are the technology you’ve built it on, or the social buzz that you were banking on has likely moved on.

Overall, I found most of the sessions at FITC Toronto 2012 to be very well rounded. There were many other sessions that I attended with mixed impressions and little take-away. These ones though, they really hit home. Together, each of the sessions I have mentioned will all play a little (or big?) part in how I operate my future initiatives.  I’ve got a lot of crazy ideas. I can see the process.  Now if only I can find the time.

And Finally, Some Useless Content 😉

Tags: , , , , , ,
Posted in Conferences

Queueing With Zend Queue and MemcacheQ

Thursday, November 18th, 2010

I was bored last night so I thought I’d enhance one of my applications with a little bit of Queueing. (And for the record both Queueing and Queuing are valid spellings depending on your locale)

The concept is fairly straight forward. Normally when a web application runs, it runs in a linear pattern. It starts, it does stuff, it does more stuff, then it finishes with a web page. That’s pretty much it. The problem is, the user has to wait for it to do stuff and more stuff. And when they have to wait for more and more stuff, it gets slow. If some of that stuff can be offloaded because it has no affect on what the user sees right now – why not? That’s where a Queue comes in to play. Send a command to a queue that something else can process for you.

So enter Zend Queue. A feature of Zend Framework that will let you use various queue systems to your advantage. I chose MemcacheQ because it was simple to install and I knew that I’d need not do anything to my configurations to utilize it. MemcacheQ is a light-weight, fast, persistant queueing system (It’ll remember what it has when it gets shut down) based on Memcache’s protocol. So accessing the data in the queue is a piece of cake.

I tried using Zend_Queue_Adapter_Memcacheq in Zend Framework 1.10.8 – but it failed. It doesn’t seem to work properly with MemcacheQ 0.2.0 which is the latest version. That lead me to write my own little adapter – based on the existing one – to fix the incompatibilities. I also added automatic serialization to the messages sent to the queue. This allows me to send useful items, instead of just strings. I implemented the queue system in a way that I can now do queued inserts and updates on database rows wherever I see the need.  It’s also setup in a way that if sending a message to the queue fails, it will do the desired action right away (slower for the user, but no loss of data.)  After that I was set.

I send my messages to my queue as described in Zend Framework’s documentation ($queue->send($bundle)); My bundle is a small array containing a few useful items. One: a class name, two: a method to call, three: parameters for the method. And that’s it. Now I’m queueing magical commands.  I need to process the queue.

I then wrote a queue processor. This processor is a very small command line tool that utilizes my existing Zend Framework applications configuration – so it has all the access it needs to the application database and code base. The queue processor pulls in a small set of bundles from the queue – executes them – and waits for a short period of time and then processes more.  In the event that a command fails, the queue processor will re-queue the item and wait to try again.  This is to prevent data loss.  If for some reason the database is unavailable the updates and inserts will persist in the queue until they can be executed properly.

I hope I’ve explained it in enough detail that you can understand the process. If not, leave a comment and I’ll try and clarify it. I’m not posting any code just yet because it’s not “pretty.”

So how well did it do? Judge for yourself. You can tell when I enabled it.

Tags: , , , ,
Posted in Coding, PHP, Zend Framework

Tell Your Redirector How to Do It’s Job

Sunday, October 17th, 2010

There’s a big difference between a redirect that uses a 301 and a 302 code on a website. If you don’t know the difference, you should find out.
301 says “This stuff has moved permanently and you shouldn’t come here anymore.”
302 says “You just need to go here, but this place will still answer you later.”

The appropriate use isn’t too complicated if you understand those two little statements. Within a web application there are many redirects that take place. If you use the 301 in these situations web browsers might get confused and your application won’t work properly.

By default the Zend Framework action helper aptly called “redirector” defaults to using 302’s; which is fine for most cases. But if you happen to be in a refactoring mode and rearranging your code and url structure it’s super important to use 302’s or your search engine rankings can fall right off the table.

Telling the _redirect helper to use a 301 code is really quite easy:


Unfortunately it’s a bit strange, because at first you think you can just use ‘$this->_redirect(‘destination’, code); but you can’t and that sucks.  If you have multiple case redirects and some might be 301’s or 302’s you should make sure you set the code back before redirecting.

Tags: , , , , ,
Posted in Coding, PHP, Zend Framework

Don’t Trust Facebook’s Photo Privacy At All

Sunday, November 22nd, 2009

You constantly hear about things happening to people because of things on facebook.  Mostly pictures and how certain people who probably shouldn’t be able to see them somehow managed to see them.

And it goes sort of like this.  I have a photo album called ‘Pets‘ and this album on Facebook.  This album has the privacy setting “Friends Only” and as you will see if you click the link to the album a few things will happen depending on who you are and whether or not you are logged in to Facebook… (more…)

Tags: , , , , ,
Posted in Security

Some Thoughts on MVC, Bad Design and Confusion

Saturday, March 14th, 2009

I was reading a post over here about why the ActionStack in Zend Framework is evil.  And I agree. I’ve used ActionStack before in a few older ZF sites (where better alternatives weren’t ready or I just didn’t know about them) but now as the framework has progressed there are many better alternatives to get other ‘actions’ to be executed on every request.

That better alternative is to simply not stack actions. One practice that I’ve been bringing into habit over the last year or so with my coding is to keep my controllers thinned out. As Ryan states: Fat Models, Thin Controllers.  And as things have rolled out over the last few months, I’ve discovered that is a Good Thing™.

Skinny supermodels beware, your jobs are at risk…


Tags: , , , ,
Posted in PHP, Zend Framework