I recently gave a brief overview of my permanent disability and workers’ compensation benefit calculators. In that post I wrote a little bit about how my online benefits calculators work. Since then I’ve posted about my use of javascript and PHP in creating these permanent disability and permanent impairment calculators.

As I’ve mentioned in those prior posts, both javascript and PHP have inherent downsides. My very first attempt at online benefits calculators using javascript and ASP actually suffered from all of the downsides of javascript and PHP. Those first calculators used tons of user’s computers’ resources, bandwidth, and server power. However, learning more about AJAX enabled me to build a set of calculators which benefited from the strengths of javascript and PHP while minimizing, if not eliminating, their weaknesses.

The acronym “AJAX” refers to “asynchronous javascript and XML” – a collection of other technologies which allow a webpage to communicate with a web server without requiring an entire page download.

Example 1: A calculator without AJAX calculating “6 x 7” would send information to be calculated to the web server. The web server would then respond by giving you an entirely new page with the answer, “42”. However, in order to download that answer you would need to download a whole new page – and all the images, text, and code associated with it. Even a normal web page could be between 30,000 and 300,000 bytes in size. ((A download of “www.google.com” was approximately 30,000 bytes and a download of “www.yahoo.com” was approximately 300,000 bytes.))

Example 2: A calculator with AJAX calculating “6 x 7” would send information to be calculated to the web server. The web server would then respond by sending back just the answer, “42”. This would be 2 bytes.

If my calculators needed to download of 300 kilobytes for every single operation, a simple calculation could take about 30 seconds on dialup and a full 1 second on broadband. Although 1 second doesn’t seem like a long time – it is in the internet age. Most of the calculations on this site take approximately .500 seconds using a broadband connection. I would guess that about 90% of that time is due to network latency/network lag – which wouldn’t be much different for a dialup connection.

For the first few months after the launch of this website, it did not use a MySQL database. I actually went to some pretty ridiculous extremes to not have to learn a new programming language. I eventually gave in, learned how to use MySQL and am a better programmer for it.

Next up, MySQL!

I recently saw banner advertisement for something called, “The Mojave Experiment.” The “Mojave Experiment” consists of hidden camera videos of people (who had negative opinions about Vista, but had never used it) being shown the next version of Windows, codenamed “Mojave.”

The Twist: Mojave was really just Vista.

Critical flaw #9: People who haven’t tried Vista by now probably don’t know enough about computers to tell whether the program they’re using is good or bad.

Shocking development #7: Everyone loved Mojave! Riiight. Everyone thought Vista could do wonderful things and was fast and responsive.

Here’s what they’re not telling you:

  • How many people tried “Mojave”
  • Which version of Vista these people were shown ((There are eight versions (four consumer, two business, one Ultimate, and one Red edition)))
  • What kind of hardware were these “Mojave” machines running ((Vista requires four times the RAM, three times the processor speed, and ten times the hard drive space of XP.))
  • Whether these people actually used “Mojave” or merely watched the interviewer use “Mojave”
  • What programs they’re showing these people and whether those programs would work on other versions of Windows

I would be astounded if this bit of propaganda changed a single person’s mind. More than 18 months after Windows Vista’s launch on January 30, 2007, people still loathe it. People hate it so much they’re telling their friends.

Here’s a business tip for Microsoft: Don’t try to convince people they want your product. Just learn from your mistakes and build a better product.

I recently gave a brief overview of my permanent disability and workers’ compensation benefit calculators. In that post I wrote a little bit about how my online benefits calculators work. My last post in this series was about how and why these permanent disability and workers’ compensation benefits calculators use javascript.

I had tried Microsoft’s ASP (active server pages) in experimenting with a prior version of my permanent impairment calculators, and while functional, the coding was a complete mess since I didn’t fully understand what I was doing. To make matters worse, the only manuals on ASP I could find gave examples using VBScript – which is MS’s version of javascript. ((Can’t we all just get along?))

Just over a year ago a friend of mine encouraged me to try PHP. (Thanks Johnny!) Its syntax, the way in which you write code, is very similar to javascript and was fairly easy to learn.

Unlike javascript, PHP is run only on the web server. There are a lot of benefits to moving all of the calculations from being performed by a user’s computer to my web server:

  • Uniformity. All calculations will always be performed by the web server in the same exact way – irrespective of the user’s computer.
  • Speed. Since all calculations are performed on the web server, the user’s computer doesn’t need to do any number crunching.
  • Protection. All of the formulas, tables, and magical incantations used to generate the calculations are kept only on the web server.

But, PHP isn’t without its downsides:

  • PHP is being used to perform a calculation, even when javascript would be faster. Javascript takes longer to crunch the answer, but you have to “wait” for PHP to send a request to the server and wait for the answer. ((I say “faster,” but we’re talking about the difference between 10 milliseconds for javascript to calculate the answer and waiting 400 milliseconds for the server to return the answer.))
  • A pure PHP calculator would require the user to send the web server the entire page and wait for a whole new page to load. Every calculation would take a full second or more using a pure PHP calculator. ((A second might not seem like a long time – but it is when you’re using a computer. I’d bet that if these calculators took 1 second for everything (such as finding an occupational code or work restriction) no one would use them.))
  • When PHP is used to perform handle all calculations, there is more of a strain on the web server itself.

Using AJAX (more on this later) to create workers’ compensation benefits calculators has allowed me to take advantage of all of the strengths of javascript and PHP and minimize the negatives of these technologies.

Next up, AJAX!

Mario Puzo, the famed author of The Godfather, The Sicilian, and The Last Don, also wrote a slightly lesser known book by the name of “Fools Die.” ((Did you know Puzo also wrote the screenplays for Superman and Superman II?)) Fools Die was a very cynical look at the gambling, literary, and film industries. Some of the best parts were the casino owners talking about gambling:

Percentages never lie. We built all these hotels on percentages. We stay rich on the percentage. You can lose faith in everything, religion and God, women and love, good and evil, war and peace. You name it. But the percentage will always stand fast.

Throughout the book characters say, “no percentage,” or “bad percentage,” or “I have the percentage.” This phrase refers to a (slight) mathematical advantage or disadvantage which, with the inevitability of a glacier, will guarantee a net win or loss over time.

I’ve given a little more thought to the idea of offering website calculators that can be used from a cell phone. Right now, there are precious few cell phones and cell phone web browsers that are capable of using the basic internet protocols necessary to use these workers’ compensation benefits calculators.

At this point I could redevelop the calculators to work with more phones. No one is clamoring for cell phone based permanent disability and permanent impairment calculators. Though I have a feeling that day is not far off, right now there is no percentage in that game.

However, do not despair – I’m thinking of offering something of a consolation prize. More on this later.