Posted on 1 Comment

So what am I doing at 2:30am?

I turn to my Windows98 machine running an ancient version of Photoshop. In a flattened image, I select a small region and copy its contents. I open a new image automatically sized to the selected region. I paste the copy into the new window and immediately copy the layer and hide the background layer. This gives me the ability to have transparency in the image. I outline the parts I want to keep then create a new layer. In that layer I fill the selection with red and reduce the opacity to 50%. Next I invert the selection and go back to the layer with my image. I delete the extraneous graphics and save the photoshop file. Then I save a gif with transparency optimized for the web. I go back to the source image and note the x, y coordinates of the upper left corner of the selection. I spin to my Linux box with MySQL Query Browser open and I update the database with the x, y coordinates and the new image name.

I’m repeating this process for roughly 160 images. I should be using Amazon’s Mechanical Turk for this.

Posted on Leave a comment

Learn or become irrelevant

I can’t seem to remember much of yesterday. I know it was stressful. I know I was looking at code until my eyes blurred. Then I broke for some continued professional development (CPD). What is CPD? CPD is the training and education you receive while at work. It could be night school, seminars, or online learning. As a programmer, my industry changes and moves so quickly that I must constantly educate myself else risk becoming irrelevant. Here’s some CPD I received while working at The Learning Company eons ago:

  • First Things First Time Management Seminar by Covey Leadership Seminars
  • Systems Testing & Quality Assurance Tech Seminar by Advanced Information Technologies
  • Software Project Management by Educational Services Institute in association with The George Washington University
  • Basic Supervision by Keye Productivity Center a Division of American Management Association
  • E3s QA Day – An all day QA Conference and open forum with influential persons and trend setters from the gaming industry’s quality assurance field (sponsored by Advanced Quality)
  • How to Develop and Administer a Budget by Fred Pryor Seminars
  • Bondware training by Nashville-based EdgeNet

I met Sid Meier at E3’s QA Day. That was very cool!

I once helped a client improve a website that tracked their client’s continued professional development. The idea behind the site was to make sure that the user didn’t cheat the system by turning on the lesson then walking away to watch television. It was quite a challenge! It also inspired me to make sure that I was continually developing my own skills.

Continued professional development can be returning to your roots and reviewing the basics. For instance, when I teach someone to juggle, after getting them to juggle three balls, I often have them return to only practicing with one ball. This gives the the opportunity to relearn with a better understanding of the end goal and helps break bad habits formed while trying to learn the concept of the end goal. It’s amazing what habits and prejudices we form and accept as rule when in fact those premises are wrong. For instance, I’ve been working with ColdFusion since version 2 became version 3. Adobe has just released the ColdFusion 9 beta. There are plenty of habits from CF3 and CF4.5 revolving around best practices and crossbrowser compatibility that no longer apply to current versions of ColdFusion. For instance, I still twitch at the suggestion of using CFGrid even though I shouldn’t. I’ve been working with PHP for a very long time. My habit had been to declare public methods for classes with var until I took some time to re-read some documentation on classes and learned that var had been deprecated for public. Breaking habits is only one aspect of continued professional development. New technologies, better techniques, improved optimizations form all the time. We must set aside time to learn otherwise the experience we have gained over the years will be declared irrelevant due to the lack of inclusion of the latest buzzword.

Posted on Leave a comment

activeCollab IRC support on Efnet and Freenode

Sort of. I’ve opened an #activecollab channel on IRC’s Efnet (and Freenode) in hopes some real-time community support will develop for people interested in customizing activeCollab‘s project management and collaboration tool. I won’t promise to always be there nor to have useful information, but perhaps if a group of us form we can generate answers faster than the forums.

Posted on 1 Comment

Your thoughts on embedded WMVs with progress bars

Let me reach out to the community for a moment. I’m trying to deliver a movie to be played in a web browser. The movie must play in Internet Explorer 6, 7 and 8, Firefox and Safari. The movie sits on a LAMP box. The movie is roughly 35MB windows media (WMV). jQuery is available. The challenge: Deliver the movie to the client without the client impatiently clicking the play button repeatedly (elevator syndrome), reloading the page, or giving up and leaving. This implies some sort of progress bar or loading spinner. I can’t seem to get a loader to work to save my life.

I’ve tried:

  • Various attributes on the object and embed tags
  • Using jQuery plugins like jQuery Media plugin and jMedia
  • Looked into other players and ruled out Flowplayer and SWFObject2
  • Tried getting Ajaxy but the document finishes before the movie completely downloads and the spinner quits too early.
  • I’m testing WVX streaming right now but it’s not looking good.
  • Some other stuff

The goal is simple: Take a large wmv movie and present a loading indicator until the movie is cached in the user’s browser. This one is giving me a real hard way to go.

Posted on 2 Comments

Today’s Programming Advice – Code for the impossible

Always code for the impossible case! The impossible tends to happen surprisingly often. The programming language is irrelevant. Whether you code in C, C++, F#, ColdFusion, PHP, JavaScript, or whatever, conditional statements and case statements should always accommodate the unexpected value.

Right now I am dealing with some code that involves a list of 1 or more items. The actionable part of the code involves clicking on one of the items in the list therefore at least 1 item must exist. Having zero items is impossible because if there were no items then I could not click on the item to start the actionable part of the code. So why waste time coding of the zero items case? This is not the best example since this is a multi-user, client/server web application and the zero case can be created quite simply by having two users pull up the same list and then one user deletes an item before the other. But that answers the question of why waste time coding for the impossible? Because it does happen. My code frequently has conditional statements that end with a default case or a special case that simply outputs "This is impossible. Please contact the administrator." and includes some debugging information. In my career, doing this has saved me hours and hours of debugging time on more than a couple of occasions.

Posted on Leave a comment

How is Firefox reading my mind and will it cause cancer?!

In Firefox’s search box, I typed "Mysql error no. 1130" and almost as fast as I typed the individual letters, the drop down box was recommending potential searches. It does this incredibly accurately and quickly for bizarre terms that under normal circumstances would never be put together. How are they doing this?! Programmaticly I can conjecture at how they’ve pulled this off. It’s a very impressive feature! (particularly if it really is using mind reading)

Posted on Leave a comment

Thank you!

I banged my head against a wall last night until it bled. I woke at 3:30am this morning to pound on the wall some more. I consulted peers on IRC. I Googled. I Blingo‘d. Finally I began to type my situation here.

On one of my projects, I am using a modal dialog to present forms to the user. These forms submit the user input to the server via ajax and depending upon the return from the server either present an error message or perform and action then close. The staple of a good programmer is code reuse. In my case, I have written a module to pop up the dialog box and, based upon a variable passed into the module, populate the dialog box with the correct form.

I proceeded to type an abbreviated, generic version of the code segment that was giving me grief. And as I neared the end, I saw my typo! Problem resolved. Life can move on. Now that’s a good use of a blog!

Posted on 1 Comment

ShareThis WordPress Plugin Broken – Easy Fix!

I recently added a ShareThis link ShareThis.com to each of my posts. I chose ShareThis.com because it seems to be very robust while leaving a relatively small footprint on the blog and appears relatively unintrusiveness and benign. Of course, some folks will be quick to point out that the tracking features and having the icon linked back to sharethis.com is very intrusive and anything but benign. In this instance, I don’t see it as that big a deal. One of the attractions to ShareThis.com was its WordPress plugin making setup as easy as going to the website to generate the widget code, then inserting that code in the settings box on the admin screen in your WordPress blog. But it didn’t work.

At ShareThis.com, a publisher generates a script that looks like this:

<script type="text/javascript" src="http://w.sharethis.com/button/sharethis.js#publisher=abcdefgh-ijkl-mnop-qrst-uvwxyz012345&amp;type=wordpress&amp;embeds=true&amp;post_services=facebook%2Cdigg%2Cdelicious%2Cybuzz%2Ctwitter%2Cstumbleupon%2Creddit%2Ctechnorati%2Cmixx%2Cblogger%2Ctypepad%2Cwordpress%2Cgoogle_bmarks%2Cwindows_live%2Cmyspace%2Cfark%2Cbus_exchange%2Cpropeller%2Cnewsvine%2Clinkedin%2Cfriendfeed&amp;headerTitle=Thank%20you%20for%20sharing!"></script>

After updating, the code will have a 2nd publisher id appended to the end. With two publisher ids, ShareThis will not register your site nor collect statistics.

<script type="text/javascript" src="http://w.sharethis.com/button/sharethis.js#publisher=abcdefgh-ijkl-mnop-qrst-uvwxyz012345&amp;type=wordpress&amp;embeds=true&amp;post_services=facebook%2Cdigg%2Cdelicious%2Cybuzz%2Ctwitter%2Cstumbleupon%2Creddit%2Ctechnorati%2Cmixx%2Cblogger%2Ctypepad%2Cwordpress%2Cgoogle_bmarks%2Cwindows_live%2Cmyspace%2Cfark%2Cbus_exchange%2Cpropeller%2Cnewsvine%2Clinkedin%2Cfriendfeed&amp;headerTitle=Thank%20you%20for%20sharing!&amp;publisher=a1b2c3d4-ijkl-mnop-qrst-u4w2y10a2r4d"></script>

After reviewing the plugin code, I realized the way ShareThis generates the script must have changed overtime. Crowd Favorite wrote a great plug-in but it expects the publisher=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx to be at very end and if it does not find a publisher id at the end, it puts one there which is why you will end up with two publisher ids. To fix this, simply move the publisher id to the end of the script before pasting the code into the ShareThis settings box in the WordPress admin:

<script type="text/javascript" src="http://w.sharethis.com/button/sharethis.js#type=wordpress&amp;embeds=true&amp;post_services=facebook%2Cdigg%2Cdelicious%2Cybuzz%2Ctwitter%2Cstumbleupon%2Creddit%2Ctechnorati%2Cmixx%2Cblogger%2Ctypepad%2Cwordpress%2Cgoogle_bmarks%2Cwindows_live%2Cmyspace%2Cfark%2Cbus_exchange%2Cpropeller%2Cnewsvine%2Clinkedin%2Cfriendfeed&amp;headerTitle=Thank%20you%20for%20sharing!&amp;publisher=abcdefgh-ijkl-mnop-qrst-uvwxyz012345"></script>

Note: In the settings box, the &amp; will be converted to just & but the code correctly uses &amp; with the post. Your code will still be xhtml compliant.

Posted on Leave a comment

ZZZzzzz Programming

I’m not sure how many different careers allow you to work in your sleep. Probably most of them when you come down to it since our dreams seem to be where we work out our issues. As a programmer, I have solved a variety of problems in my sleep and I love it! Last night I lay down with this complex conditional statement I was going to have to write to finalize yesterday’s coding. I woke up at 4am knowing how to solve the problem in one line of code. Now that’s the way to start your day!

Posted on Leave a comment

The Perfect Job Pet Project

I took my 15 minutes on my pet project in bed as I drifted to sleep. No computer was necessary. The question of how to write the application had to be answered. ColdFusion or PHP? I have hosting for both. This question only applies if I am going to totally custom design the application from ground up.

Custom designing a web application can be compared to redesigning a kitchen. You have skills. You can buy tools and wood at Home Depot. A professional might choose different places for equipment and materials. You could draw rectangles on a piece of paper and build your own cabinets but you will probably make some mistakes that a professional carpenter has been trained to avoid. When your cabinet sags oddly in the middle you might apply a hack by wedging a length of 2×4 under the sag. A professional would never do that but no one is going to see your hack so what does it matter? That is until you try to install an appliance under the counter and realize your counter cannot be used with that appliance due to the accessibility issue created by your 2×4. In the end you will probably have spent the time and money doing it yourself and then time and money to have a professional repair your installation. Of course, at this point you resent the professional because so much money is being spent. A less expensive option would be to purchase pre-built (open source) cabinets. These should mostly fit your situation and you probably have the talent to install them yourself although paying a professional to install the pre-built cabinets will guarantee they are installed correctly and don’t fall off the walls.

Laying in bed thinking about the path of least resistance and picking low hanging fruit, I ruled out a custom application despite having the talent to build it. A custom application will take much longer to launch and there is no guarantee that The Perfect Job will get traffic or produce income. Although there is plenty of open source in the ColdFusion community, I will rule it out and limit myself to the PHP open source community. This narrows my decision to WordPress, Joomla, Drupal, and Django (a web application framework..so this is still custom programming). There are plenty of other options but no sense in making the list too long. A comprehensive list can be found at http://cmsmatrix.org/.

I have more experience in customizing Drupal than I do with Joomla or Django. Drupal is a powerful CMS and many consider it a real CMS while WordPress is frequently dismissed as "just a blogging platform." However, Drupal hits a server kind of hard. I don’t pay much for hosting and you get what you pay for so I will rule Drupal out to avoid having increased hosting fees due to too many CPU cycles or memory usage. Once The Perfect Job is getting more attention, I can always upgrade the hosting and reconsider Drupal.

The choice is quickly becoming self-evident. Joomla gets a lot of positive press. It is a split from the Mambo development. If I am not mistaken, Scripps Networks is a fan of Django and that alone should be a reason to experiment with and learn Django. The fact that they are a major online publisher adds more reason. However, I am far more familiar with WordPress customizations than Joomla or Django. The path of least resistance is undeniably WordPress.

So in less than 15 minutes, I was able to come to a firm decision to write the features of The Perfect Job as part of a WordPress installation. The next 15 minutes will come this evening or this weekend and will be to closely read the WordPress licensing agreement to see if the coding I do for The Perfect Job will have to be released into the open source community or not.

Posted on Leave a comment

What do I do?

I often get the feeling that most people have no idea what I do down in this dungeon. Here’s a sample:

In the next hour, I will write, test and prove some php and JavaScript+jQuery to present a table of data, allow a user to click a delete icon, use a modal to prompt for delete confirmation, then remove the data from the database and the row from the table without a page refresh. Will work in IE6, 7, Chrome, Safari and Firefox.

This is also a micro-milestone. I often write these down, although I rarely publish them, when the number of tasks I have is overwhelming, or I have coder’s block, or I need motivation. Giving yourself small, achievable milestones can lead to great productivity.

Update: Had a digression. To get the new code to work I had to upgrade jQuery’s UI from 1.5.3 to 1.7.1. This was well worth the effort. They’ve done a great job with 1.7.1!