Friday, March 21, 2008

Programmer's Calculator Google Gadget

Sometimes when I run into a coding problem in the middle of a programming project, I create a new separate file to experiment and test theoretical solutions instead of messing around with the larger project that I'm working on. I usually prefer to use JavaScript as a experimenting language because:

  • JavaScript is fast and easy to write and test.
  • It's an interpreted language so no recompiling is needed.
  • It's readily available and standard in all modern web browsers.
  • It provides a basic, but fairly good set of features that can usually be easily retranslated later to other more powerful languages.
  • It is fairly easy to debug (especially with the Javascript error console in Mozilla/Firefox browsers).
This programmer's calculator began as just that: a experimental JavaScript web page that I whipped up to test base conversions. I realized afterwards however, that there could perhaps be some practical future use...

Many programmer's calculators out there currently only handle one base at a time, and simply don't provide certain conversions such as ASCII/Unicode characters or RGB which are easy enough to implement. Also, a good amount of code in typical calculator applets/gadgets is usually dedicated to having pretty graphical user interface which frankly I think is usually entirely unnecessary for computer-based calculator applets. (You do have a real keyboard in front of you already, don't you?) For serious programming, the leaner and meaner it is, the better.

So without further ado, here it is:

Description: A programmer's calculator featuring multiple simultaneous conversions and common operations. Instantly converts between decimal, hexadecimal, binary, octal/any base between 2-36, character codes, and 24/48 bit RGB. Operations supported include Addition, subtraction, multiplication, division, and bitwise NOT, AND, OR, XOR.


Add to Google

Sunday, February 03, 2008

Rock Paper Scissors

I recently decided to start tinkering with developing for the Google Gadgets platform. Google Gadgets is a wrapper API used to create mini-applications that can be embedded into various Google services and properties such as iGoogle, Google Desktop, Orkut, Blogger, Google Page Creator, as well as web pages in general.

Here's a simple little Javascript game of Rock Paper Scissors that I wrote about 3-4 years ago (with a few updates/enhancements), and decided to make into my first Google Gadget. I haven't published it to the Google Gadgets directory yet, but you can use the add button below to add it to your iGoogle homepage.


Add to Google

Friday, February 01, 2008

The National Flag of Canada

Time for a little change of pace...

All of the SketchUp models that I have posted so far have been of buildings that are located in Winnipeg, so I decided why not whip up a quickie little SketchUp model that might have some practical use outside of Google Earth (and potentially in it too)? After all, Google's 3D Warehouse is for all types of 3D models, not just models of buildings.

I suppose that when one starts spending a little time looking at and searching for pictures of buildings, you start to notice the presence of ubiquitous objects that exist around many buildings like trees, roadsigns, fences, flagpoles, etc.

So my latest model is none other than a flagpole with the national flag of Canada raised on it. Naturally I decided to do a search in the 3D Warehouse before I started. Not surprisingly, there are quite a number of flagpoles and flags, but none of the Canadian flag yet... that is until now!

National Flag of Canada

Feel free to make use of this model and modify it for your own needs. Yes, it is componentized, so you can easily reuse and work with it inside other models.

By the way, this is just in time for Canada's National Flag Day, which is later this month on February 15th. Introduced in 1965, Canada's modern national flag will be 43 years old this year.

Saturday, January 26, 2008

SketchUp Model Updates & Optimization

I'm a huge fan of optimization... as a programmer and web developer, improving the performance, simplifying algorithms and reducing resource utilization in my code is something that I constantly strive to do. I'm rarely satisfied by simply writing or using code that is "dirty but gets the job done".

Yesterday I made some updates to the SketchUp models of the Commodity Exchange Tower, Royal Bank Building and Winnipeg Square. Since I didn't originally create these models, they were noticeably lacking a lot of detail. The changes that were posted yesterday mainly consist of a little bit more detail enhancement... but probably a more noteworthy change in my opinion, is that the Commodity Exchange Tower model has been "optimized".

The original model actually contained a lot of detail, with hundreds, maybe thousands, of lines and faces making up the facade & windows. I shudder to think how much time and effort it must have taken to do this... unfortunately, all the extra geometry made the model swell up to a file size of 2.26 mb, or over 800 kb for the Google Earth rendition.

The updates I made were actually more of a redo -- I completely deleted all the extra geometry and created a couple of simple replacement textures for the windows and external panels. By doing this, I was able to reduce the file size to a mere 188 kb, or an impressively tiny 42 kb for the Google Earth version; a whopping 91.8% reduction for SketchUp and about 20-fold improvement for Google Earth!

Thursday, January 24, 2008

Winnipeg Building Model #14

The Winnipeg, Manitoba 3D Warehouse collection seems to be slowly growing to a more respectable size now. I found a few more Winnipeg-located models to add to the collection last night, although they are mainly of the residential variety.

Although these newly added models have apparently been posted in the 3D Warehouse for quite a while already, I didn't catch them earlier because they aren't tagged well enough to be locatable through searching. I only found them by installing the 3D Warehouse Network Link for Google Earth... which I had somehow missed and only discovered yesterday evening.

Anyway, I have decided to release my 14th contribution: the Canadian Grain Commission building. This brings the current tally of models in the Winnipeg, Manitoba collection to 22.

Canadian Grain Commission Building

Although this building is among one of the more distinct and prominent buildings seen on the Winnipeg skyline near Portage & Main, I think a lot of Winnipeggers probably don't know very much about this building (or maybe it's just me?)... it actually took a bit of effort for me to research just the name of the building. My reasoning for this lack of awareness is that because it is a federal government office building, the majority of people probably would not have very much reason to visit this building under normal circumstances.