Posted on 1 Comment

What is programming?

In essense, a client presents a challenge and I solve the problem.

Today’s challenge: a custom ordering system (shopping cart) written in ColdFusion is producing the wrong totals.
The system design: tax is built into the price of the items stored in the database except for certain non-taxable items. A flag indicates if an item has tax built into the price or not. At the bottom of the invoice, the amount of tax charged is shown.
The problem: The system allows for the administrator to apply a discount. Tax cannot be discounted but the total tax shown on the invoice is calculated off the discounted price.

How do you solve this kind of problem? I use my tools available to me. I could just jump into the code and start changing it but I can do a better job and document my efforts by using MS Excel and MS Word to help solve the problem.

  1. I pull up the sample invoice that the client used to show the incorrect figures.
  2. I reproduce the invoice in Excel.
  3. I open the database (in this case with MS Access) and find the products listed on the invoice so that I can be certain which items are taxed and which are not.
  4. I manipulate the spreadsheet to assure that I am using the correct math formulas to get the correct result.
  5. Find the code within the system that calculates the tax and change it to use the new formula for presentation.

Update: I think perhaps the end of this post was lost…

Posted on 1 Comment

Error converting tiff to pdf

So I am trying to deploy the website I recently completed. Deploy? That means move the site from a development server to a production server where the world can see the application in action. It took this long to deploy because the webhost was running PHP 4.0.0 and had to upgrade to at least PHP 4.4.4 (went to 5.1.6 which is nice). However, they did not take the extra 10 minutes it would have taken to include CURL support.

So, the dev works great using CURL to pull a series of tiffs from another server, then using the Zend Framework, combine those tiffs into a single tiff, and finally convert the tiff to a pdf. I moved the code to the production server and it works fine until we get to converting the tiff to a pdf. It actually converts but the pdf is unviewable simply producing the error "file does not begin with ‘%PDF-‘." These kinds of problems are why developers never make their deadlines. I am working on the presumption that I failed to write some header information into the file. I want this over.

Posted on 5 Comments

Pacman them resources!

Apparently our websites have been eating enourmous resources on the shared server that does our hosting. The end result is we were flagged to "go away" or buy a dedicated server. It could be the live plugin that I enjoyed so much or it could be my experiments with this website or a combination of both. The idea of jumping from $20 per month to $100 per month to host a bunch of websites that don’t a dime really disconcerned me so, bye bye, live plugin. And that image manipulation stuff has to get gone too.

Posted on Leave a comment

Principle 30 – Follow The Lemmings With Care

Excerpt from Alan M. Davis’ excellent book "201 Principles of Software Development" which ever programmer, QA person, consultant, project manager, analyst…shoot, anyone involved in software should own this book and review it regularly.

If 50 million people say a foolish thing, it is still a foolish thing. -Anatole France

Just because everybody is doing something does not make it right for you. It may be right, but you need to carefully assess its applicability to your environment (Principles 142, 143, 149, 150, and 151), software reuse (Principle 84), process maturity (Principle 163), computer-aided software engineering (CASE, Principles 22 through 25), and prototyping (Principles 11, 12, 13, and 42). In all cases, these offer very positive opportunities for increased quality, decreased cost, or increased user satisfaction. However, the advantages are available only to those organizations in which it makes sense. Although the rewards are significant, their potentials are often oversold and are by no means guaranteed or universal.

When you learn about a "new" technology, don’t readily accept the inevitable hype associated with it (Principle 129). Read carefully. Be realistic with respect to payoffs and risks. Run experiments before making major commitments. But by no means can you afford to ignore "new" technologies (see related Principle 31).

Ref: Davis, A., "Software Lemmingineering," IEEE Software, 10, 6 (September 1993), pp. 79-81, 84.

The index points object oriented programming to Principle 30 calling OO a "fad" (see Priniciple 31) since object oriented programming is really one implementation of the principle of encapsulation (Principle 65). This is by no means to berate object oriented program, which I enjoy very much, but simply to point out that OO is not always the best solution to a particular problem.

Posted on 13 Comments

Plug me in – Enhancing WordPress

For anyone interested, these are the plugins I currently use. I’m experimenting with one not listed but it has to prove itself before it gets any credits.

  • Spam Karma 2 (absolutely incredible, occasionally some trackback spam gets through but this just makes it all manageable)
  • Audio Player (slick way to include audio on the site)
  • Live (for the stat addicted, it shows the ip of someone on your blog while they are there, whether or not they are on the site or rss, if they are leaveing a comment etc) (Note: stat addiction can be cured. Don’t judge the success of your blog on "stats")
  • Flickr Photo Gallery (adds a tab on the upload box that allows you to easily paste several size pictures from your Flickr account)
  • Subscribe to comments (gives your readers the ability to request an email when someone replies to a particular comment thread)
  • Time Zone (automates daylight savings time adjustments so that the times on your posts are always correct) (wonder if it will break in 2007)
Posted on Leave a comment

Interpretting ColdFusion Error Messages

Everyone knows what Apple’s "Type 1" error message means. Well, you should. It means "something went wrong and we have no clue why!" Everything computer related has something like this. Even AdoMacrollaire’s ColdFusion has some strange ones.

Invalid token ‘\n’ found on line 40 at column 0.

This error message means you forgot to close a comment somewhere. ColdFusion comments are delineated the same as HTML comments (<!– html comment here –>) but with an extra dash (<!— cfml comment here —>). So if you open a comment and forget to close it perhaps even following it with another comment you will get the reference to a linefeed (\n) being an invalid token.

<!--- this is the messed up comment
<!--- and this is a valid comment --->

Posted on 1 Comment

Oh yes! Program done!

I now have successfully written a PHP program that goes to another website, downloads any number of tif files (one test used 48), combines them into a single tif file, converts the tiff to a single pdf file (48 tiffs become a 48 page pdf), and presents the new single pdf and single tif to the enduser for downloading or viewing. This was a nightmare and has cost me dearly. It is done and I can move on.

Posted on Leave a comment

Stupid Lawyers DMCA Comedy Central Clips on Youtube

Colbert joked about needing a check for $700million since roughly a third of all movies on YouTube were from the Colbert Report at the time of YouTube’s $1.6billion sale to Google. "Jon Stewart and Daily Show Executive Producer even encouraged viewers to watch the show on the Internet."

I received a couple of emails from YouTube this afternoon (see below) notifying me that a third party (probably attorneys for Comedy Central) had made a DMCA request to take down Colbert Report and Daily Show clips. [Source]

When will the lawyers and the RIAA et al realise that the distribution of clips on mediums like YouTube only create benefit and popularity for the program, artist, album and so forth. Can old dogs like Senator Stevens just not learn these new tricks.