December 2009 Archives

Happy New Year's

| No TrackBacks
Thumbnail image for shanghai-fireworks-new.year.jpgLast year I wrote up a quick blog post to ring in the New Year, highlighting some of my accomplishments and failures of 2008.  In that spirit, keeping the tradition alive, here's my 2009 in a nutshell:

I kicked off 2009 figuring out how to block Trackback Spam, and wrote up an opinionated piece re: why I dislike and therefore don't use, FacebookMyCougarLand.com failed to update their DNS records, which generated a lot of traffic (not the kind you would expect) to my blog.  In late January, I discovered that I own a bottle of wine from a convicted felon.  Ala February, I joined Twitter, and heard that Network Solutions featured my WHOIS Firefox Plugin on their homepage.  I bought a new battery backup UPS for my home data center, after a little physics exercise to discover the exact type of UPS I needed.  I launched kolich.cc, but then later built and released Onyx.  With summer approaching, I made my own solar shield out of cardboard and tinfoil while thinking up ten awesome .htaccess hacks for Movable Type.  Continuing the awesomeness, I launched a mobile version of my blog at kolich.mobi for all of my readers on mobile devices.  Like any good year, a few of my systems crashed, then recovered but I had fun with HP LaserJet printers at the office.  I registered kolich.tel, went green for Iran, and figured out how to include base-64 encoded binary data in CSS.  And, of course, I released Gagawa PHP 1.2 before hiking Mount San Gorgonio in the San Bernardino National Forest, but not before I wasted several days at the office on a stupid bug.  I registered koli.ch (thank you Network Solutions!), and gave hot linkers a nice big 5000x5000px animated GIF to chew on.  And to cap it all off, I blew the whistle on Twitter (they're spying on us) and then dove into some C++ to discover how Windows UAC works, which by the way, reminded me how much I hate Windows.

2009, the end.
My somewhat narcissistic obsession with domain names involving my last name has recently driven me to purchase markkolich.com.  The saga leading up to this acquisition started when I snagged koli.ch, and saw my ranking in a few search engine results absolutely plummet.  I kicked off my own investigation and realized that Google doesn't seem to understand a custom domain hack of my last name.  For the record, Yahoo! does.  I suppose that's one thing Yahoo! actually does better than Google: properly interpreting domain hacks and other URL trickery.

In any event, I setup the markkolich.com VirtualHost to redirect to mark.koli.ch via a 302 Found.  It seems that when Google and Yahoo encounter an HTTP 302 Found, they gracefully redirect their spiders to the destination but maintain the redirector's address.  For example, this URL https://onyx.koli.ch/x2fr redirects to http://plugins.jquery.com/project/Timer using a 302 Found.  When spiders encounter https://onyx.koli.ch/x2fr they are forwarded to the destination, but add http://plugins.jquery.com/project/Timer under https://onyx.koli.ch/x2fr to their index.  In other words, the jQuery Timer plugin page will be listed under the URL https://onyx.koli.ch/x2fr in the search results!  Interestingly enough, HTTP 301 Moved Permanently does not exhibit this behavior.

For the time being, I'm going to see how the new domain stacks up against koli.ch.  My expectation is that spiders will index markkolich.com, see a 302 Found, and add it to their index as is without worrying about the destination address.

Stay tuned.
Most web-apps include a number of JavaScript and CSS files, that in most cases, need to be included/sourced on every page of the application.  Doing so can bring up a few, while trivial, often annoying problems:

  • Dependencies between scripts.  For example, if you attempt to use a jQuery plugin before the base jQuery library has loaded into the browser you'll obviously see an error.  Working out these dependencies before hand can save you a few headaches.

  • Web-browsers and web-proxies cache your JavaScript and CSS files too often.  I can't count the number of times on two hands when I made a small change to a JavaScript file, saved the change, refreshed my browser, and .... nothing.  The web-browser didn't load the changed file; instead, it loaded the JavaScript from cache.  Using a mechanism to always force the web-browser or web-proxy to reload your JavaScript and CSS can save you time.
Meet Gagawa, an open source object-oriented HTML generation engine written in Java and PHP.  You probably wouldn't build an entire site with Gagawa, but it's absolutely perfect for small HTML tasks, like solving this irritating dependency and caching problem.
javax-swing-timer-demo-screencap.jpgIn the last week or so, while working on some Java Swing code for a project at work, I hit Swing bug #4480705.  When the user clicked a button to start an "activation", I changed the ImageIcon on a JButton to an animated GIF to indicate activity (e.g., "we're doing something, please wait").  So, while the application was busy, I disabled the JButton and set its ImageIcon to an animated spinner.  Loading this animated GIF and setting it on the JButton using setIcon() caused the Java Swing EventQueue threads to deadlock, as described here, and my entire application hung.  Well technically speaking, not the entire application, but just the Swing portion of the JVM.  Clearly, Swing doesn't like animated GIF's as much as the Sun documentation claims.

The solution to this deadlock is to avoid using animated GIF's all together, and write your own animate loop using javax.swing.Timer.  That's exactly what I did, and it works great.

For your viewing pleasure, I wrote up a quick demo/example (see Beavis and Butthead screencap) which demonstrates the use of javax.swing.Timer and how you can integrate it into your Swing application.

Download just the source, or the full Eclipse project.

Rock on.
uac-prompt-sucks.jpgI just finished an absolutely monstrous project at work that involved quite a bit of Java and a little Visual C++.  The latter part of this project involved writing some VC++ that interactively upgraded a piece of Java based software installed on a PC.  This sounds relatively mundane, but frankly, it wasn't.  I ended up spending almost of week of engineering effort, writing code that gracefully understands how to deal with Window's User Account Control (UAC).  If you're not familiar with UAC, it's that incredibly annoying security mechanism in Vista, and Win7, that prompts the user for confirmation if a piece of software attempts to make any changes to a protected location on the computer.  I appreciate what Microsoft was trying to accomplish with UAC, but it couldn't be more painful for a developer to work with.  Not to mention I couldn't find any decent documentation from Microsoft that discussed how to properly integrate your software with UAC.  I found a lot of marketing type documents and other nonsense through MSDN, and eventually gave up in disgust.  All I wanted was a simple document, ideally one titled "this is how to open a UAC prompt in your application."

In the end, I figured out how to deal with UAC by studying the source code of the Mozilla Firefox Updater (knowing that Firefox is open-source, so I can look at its code, and it always seems to update itself just fine on my development Win 7 and Vista boxes).  This post is an attempt to document how I built an application that understands, and gracefully handles UAC.

Twitter (@markkolich)

Translate

About this Archive

This page is an archive of entries from December 2009 listed from newest to oldest.

November 2009 is the previous archive.

January 2010 is the next archive.

Find recent content on the main index or look in the archives to find all content.