Howie Mandell trying to look hard.
Howie Mandell trying to look hard.

Javascript appears all over the internet. You can be pretty sure that your favorite websites use a LOT of javascript. You see it every time a website creates a pop-up advertisement, sends you an alert, lets you bookmark their page, or interacts with you in some way.

I’ve written some pretty cool (in my nerdy opinion) things in javascript:

  • A blackjack strategy simulator. You tell the program how many decks, when you want to hit, stand, double down depending on the deck count, and it will run through a given number of hands – telling you how much your strategy has won/lost overall.
  • A “Deal or No Deal” odds simulator. The program calculated the average of the remaining unopened suitcases – to compare against the Banker’s offer. It made rudimentary guesses about how much the Banker would offer. There has been some incredible and complex analysis of how these offers are created.
  • A billing program. It had separate timers for different tasks, tallied time, expenses, ability to save reports, and create invoices for different clients.
  • A simple program for tallying points for gin rummy.
  • Several small programs for solving various internet website puzzles.
  • Several small tools which allow me to write other programs or web pages more efficiently.

I’ve written innumerable other mini-programs which either had a very limited or one-time use or which I never developed into an actual program. One example was a program that would help me quickly search muliple ebay auctions and compare the various prices. Another was a Sudoku puzzle solver which I never completed.

I was fortunate enough to play with two (very patient) experienced golfers (and Steve) on Friday August 15, 2008 at the DVICA 21st Annual Golf Classic. While my individual performance was just above terrible, I had a great time. We were playing “best ball” and had to use my shot more than once.

I learned a lot on Friday. Some things are probably common sense or common knowledge. Some I learned the hard way, other things I learned by watching someone else learn the hard way. Here’s a list of the top 10 things I learned about golf from the event:

  • 10. It helps to tie your clubs to the back of the cart.
  • 9. Inevitably, someone will quote Caddyshack. ((I prefer Happy Gilmore. Sacrilege, I know. “The price is wrong!”))
  • 8. Head down, knees bent, shoulders level, and always follow through.
  • 7. Shorts or slacks – NO jeans. ((Fortunately, I did not have to learn this one first hand.))
  • 6. Finesse, not power, is everything.
  • 5. Never walk through another player’s line of sight. ((Sorry Jeff!))
  • 4. Whatever you do, advance the ball.
  • 3. Bring twice as many balls and three times as much water as you think you’ll need.
  • 2. Golf is a game of honor and etiquette. ((No wonder I stink!))

And, the #1 most important thing I learned at the Diablo Valley Industrial Claims Association Golf Classic?

  • 1. Worst player buys the drinks. :)

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’ll be at the DVICA 21st Annual Golf Classic tomorrow!

Look for the guy wearing glasses and a Sebastiani cap. Unfortunately, unlike my fellow Indians, I can’t play golf. Its really quite shameful. (Sorry guys!) Fortunately I make up in enthusiasm what I lack in skill. :)

Hopefully I’ll remember to bring my digital camera so I can post a few shots here.

Be sure to track me down and say hello!