Archive for the 'scripting' Category

Speeding up your code with the Bitwise Operator (&)

Tuesday, March 28th, 2006

While building a Flash game, I wrote some code to alternate through squares on a grid system and it seemed rather slow. My code made use of the % (modulo) operator and, thinking that was the cause, I went in search of a better solution. I blew the dust off the Bitwise operator (&) and researched what it actually does. As it turns out, this little bit of programming’s past can be quite handy.

Comments & corrections are always welcome and if you have any similiar tricks to share, I’d love to hear about them.

Du You?

Sunday, January 29th, 2006

I built this popular game in Flash 8 for a brain exercise before I had ever actually played it. I did no research and when I completed the code, I played it once to test it out. I can see how it could become very addictive.

Now that’s what I love to hear

Wednesday, January 18th, 2006

I got an email the other day from Steven Mading, a developer at the BioMagnetic Resonance Bank at the University of Wisconsin. In it, he shared his experience using jsTrace and, with his permission, I’m sharing it with all of you:

I just thought I’d give a quick thank you to you for the little jsTrace JavaScript utility you made available online. I found it from a Google search and it was exactly what I needed.

It really helped me a lot. I had a problem with some widgets on an HTML form that had a lot of JavaScript hooks (things like onblur, onclick, onfocus, etc). The events were occurring in a weird order and I couldn’t trace what was happening. Using the standard alert() function was useless because making an alert window POP up caused the events to be different and changed the relevant behavior (since onfocus and onblur were a relevant part of the behavior, popping up a window changes the focus and invalidates the debugging information when what I’m trying to do is figure out why the focus changes aren’t happening the way I expect.)

Your jsTrace allowed me to figure out the problem (which, as it turns out, was that when I clicked on Widget B, I was calling BOTH the onclick for Widget B and the onblur for Widget A, but not always in a predictable order). So once I knew that was happening, I was able to redesign my code to work either way and thus fix the bug.

Again, thank you for making this tool publicly available.

I love it when things work out like that. It makes it all worthwhile.

Have you had an experience with using jsTrace that you’d like to share? Do you use it orĀ  any other scripts we’ve built often? Are any of the user enhancement scripts in use on production websites? Let us know your thoughts, good or bad.

Holiday Greetings & Games

Monday, December 19th, 2005

This has been one crazy Fall work-wise, so I apologize for the scarcity of posts, but I do have a few holiday treats for you.

From my day job at Cronin and Company, we’ve got Cronin’s “Grab Bag of Goodness.” As with most internal projects, this was a major rush job. I take no credit for the design (which was handed to me with no wiggle room), but when it comes to the CSS and DOM Scripting, that I’ll proudly take credit for. Use the code “9301” to get in. Of particular note in this piece:

  • Taking a page from Dan’s Bulletproof Logos, most all of the text is in (shock) images. Toss in the text as an alt attribute and with images and CSS off, you’re still golden. As this was a one-off, sIFR seemed like overkill.
  • Ooh, check out that marquee. Brings back memories, doesn’t it. Well, this one’s a little different. The markup is an ul and each item is a li. CSS makes it all display: inline; and then JavaScript keeps reducing the margin-left of the first li by 2px until the absolute value of it’s margin-left is greater than the li’s width. That li is then plucked from the front of the list and appended to the end. Though I am not a big fan of scrolling marquees, this was a pretty fun experiment.
  • Those animated icons you can click to make a donation are actually form controls. Originally, I had made them into custom submit inputs, but Safari’s inability to customize certain form controls made me abandon that element in favor of button. It’s a great effect too (IMHO).

Then there’s the Easy Designs holiday card. I will spare the commentary on this one with the exception of giving major props to Dave for building the game in a day. I’m pretty darn proud of it, especially since we pretty much went from concept to execution in a matter of days (yeah, procrastination’s a bitch). If you’re interested, you can see a rough approximation of the email that went out (our first Campaign Monitor mailing) or simply play the game.

Dave’s Work Draws a Crowd

Tuesday, November 29th, 2005

I just saw a copy of the latest issue of DMNews and Dave’s hard work garnered the Wadsworth Atheneum a feature story and Cronin and Company some major kudos. Here’s an excerpt from the article:

An online campaign initiated by the 161-year-old museum and developed by Glastonbury, CT, ad agency Cronin and Company Inc. doubled visits to the site at www.wadsworthatheneum.org. Components included a SurrealPainter Web tool, banner ads and the seeding of blogs.

Central to the campaign is the tool at www.wadsworthatheneum.org/painter. Visitors through Dec. 18 can choose from various colorful backgrounds and objects, then flip, copy, layer or scale them. Once completed, the online artwork can be titled, printed, published and e-mailed to family and friends.

Be sure to make your own surrealist painting, while you still can.

Today’s chosen site: Canadian Pharmacy