my thoughts and ideas

Smarty date timeSpan plugin

If you use Smarty for your templating engine, I’m sure you’ve had to format dates to different formats before. This is a handy modifier plugin which converts a date into something human friendly such as “2 minutes ago”, “Tuesday at 3:52pm”, or “March 12 at 6:49am” much like Facebook does. Works great for comments and message boards!

Simply download it, and extract “modifier.timeSpan.php” into your Smarty/plugins/ directory. To use it, simply add the “timeSpan” modifier to any smarty date variable. For example… {$postDate|timeSpan}

It takes advantage of PHP’s strtotime() function, so just about any date format you input should work just fine, but it works best with the YYYY-MM-DD HH:MM:SS format.

Possible outputs are…
Just now // less than 3 minutes ago
5 minutes ago // less than an hour ago
9 hours ago // less than 24 hours ago
Yesterday at 10:15pm // yesterday
Tuesday at 2:45pm // less than 5 days go
October 8 at 1:30am // more than 5 days ago this year
August 18 2007 at 5:32pm // not this year or in the future

PHP Image Resize – generates thumbnails on demand

I wrote a single file PHP Image Resize script that allows you to generate thumbnail images on demand, and thought I would share it with everyone. It actually generates a new jpg image on demand in the correct size, caches it for later use, and displays it. Its very helpful when creating an image gallery, also supports cropping!

Checkout PHP Image Resize

Google makes fun of IE

HTML5 API Adoption by browser

Yesterday was the first day of the Google I/O 2010 Developers conference. During the keynote speech, Vic Gundotra (VP of Engineering for Google) was talking about HTML5 and how there are APIs to allow developers to create better web applications. A graph was then displayed showing past, present, and future adoption of these APIs by the common web browsers.

Vic Gundotra goes on to say “So where do we expect to be by the end of this year? As you can see all the major APIs are going to be present in all modern browsers”.  As you can see in the slide, IE doesn’t appear to be one of those modern browsers.

Watch the video yourself

Steve Jobs puts Flash on its death bed

On apple.com, Steve Jobs posted an article about his thoughts on Flash. The last paragraph sums it all up by saying…

“New open standards created in the mobile era, such as HTML5, will win on mobile devices (and PCs too). Perhaps Adobe should focus more on creating great HTML5 tools for the future, and less on criticizing Apple for leaving the past behind.”

I read this story today, and as much as I am not a Apple fan – I agree 100% with this. Adobe has refused to accept change and are shooting themselves in the foot.

Adobe Flash has never ran decently on Mac or any mobile device, much like it has never ran decently on Linux. Why? Because they are proprietary and for whatever reason – not adopting. If it was open, this wouldn’t be a problem.

Other companies such as Google (YouTube), Vimeo, Netflix, Facebook, ABC, CBS, CNN, MSNBC, Fox News, ESPN, NPR, Time, The New York Times, The Wall Street Journal, Sports Illustrated, People, National Geographic and many others are already supporting HTML5 video (H.264 video format) – showing their support for open standards and waving goodbye to Flash.

Read Steve Jobs full post here.
Thoughts on Flash

Phoenix Framework

I developed a framework for us to use at the office for web applications. Its very lightweight and fast. The only part I think I need to optimize is the view – but it works for now. The framework is built for web applications, and not really for content sites, though it will work great for one. Its all open-source and built in PHP 5.x

Please feel free to download it and give it a try! Let me know what you think.

Phoenix Framework

Google Maps Navigation for Android

Google Maps for Android has a “Navigation” feature which isn’t currently available to iPhone users. This feature turns Google Maps into a turn-by-turn GPS device, with text to speech. Meaning, it will read off exit and street names to you to assist you. It has quite a few interesting features.

Traffic / Travel Time – Tells you the travel time and traffic for your current route.

Alternate Routes – You can easily view and select alternate routes for your trip, incase of traffic or unwanted toll-roads.

Street View – Once you reach your destination, it displays a street view image of the address you are navigating to.

Also, using an Android shortcut, you can create an icon on your phones desktop that automatically navigates you to an address. For example, I’ve setup a icon called ‘Go Home’, and it automatically launches Google Maps and navigates me to my home address – with a single touch.

Checkout the video about it

UI design VS. Database design

Recently I’ve been doing allot of database planning for an eCommerce related product. In the process of doing so, I realized one problem allot of beginner and intermediate programmers have is properly designing a database schema. It seem’s the database structure almost always matches the user interface structure. This sounds logical, however can actually limit what you can do quite a bit.

If you have a product for sale, and that product has images, prices, categories, weight, etc…. In the user-interface, when someone is setting up a new product, the price and weight is filled out by the user while creating the product. This makes perfect sense for a user interface, however – not for a database schema. In the database, the weight and price should be based off of combinations of options for that product – and not tied directly to the product.

Say you have a Playstation3 for sale. The price shouldn’t be tied to the product “Playstation3″. Instead, the price should be tied to an inventory record for this product. Such as Playstation3 – 60GB. The size of the hard drive is an option for this product, which effects the price – thus, the price on the product level is now useless. Your database should reflect this, however the user-interface needs to be designed so that this logic is hidden from the user. (I’ll leave that task to a designer, don’t ask me how).

Robot chassis

I completed the build-out of my robots chassis last night. Its exactly a square foot, and about 8 inches tall. It was a pain getting the training wheels mounted to the motors – but I finally got them mounted after some fabrication work. Anyways, here she is so far…

Robot Chassis

Build your own HTPC (Home theater PC)

Building your own HTPC (Home theater PC) is a great learning experience for anyone who likes tinkering with computers. This entire project took about 7 hours, and less than $300.00. This can get a little technical, but with a little time and research – it pays off greatly. You can also buy gaming CPUs that will make your computer run much smoother.

My first failed attempt was using my eeePC with Ubuntu 9.10 netbook remix with XBMC (XBox Media Center) running as the interface. It worked, however the lil ole netbook didn’t have the processing power (or real driver support) to play HD YouTube videos fullscreen at a decent framerate. Basically, you get to watch a slideshow of the video.

So I did some research and built a new computer from the ground up to run as my HTPC. The project took me 5 hours of build/install/setup/test time and I was able to keep it within a $300 budget – thanks to free open source software. My final solution…

HTPC Completed project

[Read the rest of this entry...]

Google Calendar Syncing

Today I was setting up my netbook as a community computer in my kitchen, and was thinking what I would be using it for. One of those things would be to check and update my calendar. So, I decided to use Google Calendar and was happy to see that all the sites I keep events/calendars on support exporting their data in a compliant format to be displayed within Google Calendar.

Now, while leisurely in the kitchen, I can check my Google Calendar which now has feeds from meetup.com, facebook.com, highrisehq.com, and of course Google Calendars own events. I was also happy to see these all sync with my G1 Android device.