Friday, February 09, 2007

VB.NET Logical Operators are lame

While writing some application architecture documentation for my current project, I drew a blank looking for the technical term "short-circuit" logical operators.

These are really simple in C#.

public bool Method1()

{

   Console.WriteLine("Method1 called.");

   return false;

}

public bool Method2()

{

   Console.WriteLine("Method2 called.");

   return true;

}

public void ShowShortCircuiting()

{

   Console.WriteLine("Regular AND:");

   Console.WriteLine("Result is: {0}", Method1() & Method2());

   Console.WriteLine("Short-Circuit AND:");

   Console.WriteLine("Result is: {0}", Method1() && Method2());

}

Produces the following output:

Regular AND:
Method1 called.
Method2 called.
Result is: False
Short-Circuit AND:
Method1 called.
Result is: False

The concept is really simple too: If the first item isn't true then don't bother executing the next condition.

When speaking with a colleague, he asked if this was possible in VB.NET. Google says yes. But isn't syntax in VB is completely backward??

The C# equivalents map to VB.NET, thusly:

C#: &
VB: And
C#: &&
VB: AndAlso

To quote the article I've highlighted:

If you want the second test to be executed every time, use And. If that's not what you want, use AndAlso.

Syntax-wise, I think that this reads as: "I want this and also this to be evaluated". But if the first condition doesn't pass, (insert smirk) wouldn't it better to say, "I want this, and maybe this to be evaluated."??

I'm not sure what prompted me to switch from VB6 to C#, but boy, I'm glad I did.

Friday, February 02, 2007

Eating dog food I preach

There's a fairly large disconnect between what I personally use and what my industry has highlighted as holy-grail great. So I finally got around to creating a del.icio.us account, and managed to find the time to add it to my blog. (I found a great resource for a list of online-del.icio.us tools here)

While I'm not convinced I need the social-networking aspect, an online bookmark solution makes sense for a few reasons:

Too many browsers. I use FireFox for my day-to-day, but occasionally I'll encounter some weird bugginess in FireFox 2.0 so I'll boot up IE 7. What's interesting about switching back and forth between browsers is that once you get settled into a session with a half-dozen tabs open, you don't want to switch back during that session. I also find that I don't bookmark most pages, I use the Browser History sidebar (CTRL+H) to relocate helpful sites. An online solution makes a lot more sense; I just have to bookmark more frequently.

Obsessive Compulsion Disorder and Format C Colon Slash Syndrome. If I kept an organized list of links from the time that I started out online it would be several reams thick. Unfortunately, I never keep a list of bookmarks for too long because I start to suspect my windows machines with performance and garbage in the registry after the install is over a year old. (I start to get anxi around the six-month mark...) I tend to give into this paranoia and format my drives somewhat frequently and in doing so I always forget to backup my bookmarks.

Blog-worthy, maybe. I started my blog to capture thoughts and findings on the web, but some days, posting a blog entry is a challenge. While I do use my blog to capture URLs for reference, not all URLs are blog worthy.

...and heck, if a colleague wanted to find a URL that I found useful, I could point them to my del.icio.us account. So, maybe I do want the social aspect after all. Hmm.

Well, let's see how this experiment plays out -- I've added the delicious tag cloud to my blog on the right. If it's not there in a few months, maybe I stopped using it.

Monday, January 29, 2007

the Church of Home Depot

I once heard that Home Depot does more business with Canada than the United States does with France. I'd believe it too, I go to Home Depot on the weekends so frequently, I call it Church.

Saturday, January 27, 2007

Trusted computing

Great animated short that stabs at Trusted Computing. From the short:

In a trusted computing environment the major goal is to protect us from potential threats. The original trusted computing idea is designed to let you decide what to consider as threat and what to consider as trust worthy. You can control by your own personal conviction. The industry's interpretation of the trusted computing idea looks quite similar, aiming at the same to fight threats and to make computing trustworthier. The main difference is that you cannot decide by your own what is trustworthy and what is not because they already decided for you... and they already decided not to trust you.

Friday, January 26, 2007

Can't Touch This - Touch Screen

I was really quite impressed with the iPhone's multi-touch technology as demonstrated in the MacWorld keynote, but this puts the iPhone to shame. This article on Fast Company might have you thinking that you accidentally woke up in the year 2054. Even better, check out this video demonstration. Update: This based on some amazing work that Jeff Han of NYU has produced. Multi-touch is probably a better name than Frustrated Total Internal Reflection.

Thursday, January 18, 2007

Wired 14.08: Be an Expert on Anything

Wired magazine did a how-to issue back in august where Stephen Colbert had the cover: how to be an expert on anything. My favourite: Don't be afraid to make things up. Never fear being exposed as a fraud. Experts make things up all the time. They're qualified to.

Friday, January 12, 2007

Internet Explorer 7: Quick Reference Sheet

I've always loved that FireFox has CTRL+K for a shorcut to the search window. Turns out it's CTRL+E: Internet Explorer 7: Quick Reference Sheet Here's a shortcut key listing for Firefox which conveniently lists Internet Explorer and Opera against FireFox, though I think it might be for IE6.

Monday, January 08, 2007

Updated Template

Along with Blogger's version upgrades are some new templates. Enjoy the new look. I chose this template because the width of the posts expands with the browser window. Maybe now I'll consider posting code examples :D

Sunday, January 07, 2007

VS.NET Blogging help

Stumbled across this great post over at Stephen Chu's blog, which points to an open source Visual Studio Add-in. The Add-in allows you to copy any code snippet into the clipboard as properly formatted HTML. A great tool for blogging!

Thursday, December 21, 2006

Props to Blogger

Blogspot has finally rolled out their new version. Good job. Better administration, tagging, faster publishing. Only suggestion: spellcheck. I've upgraded my template to take advantage of these new features, and I've even tagged most of my posts. I'll update Cameron's blog soon. I've been posting more to my blog internal to our company, but hopefully this new year I'll find the time to blog more. More pictures too. If you find yourself reading this, leave comments -- they're encouraging and a good prod in the butt to write more. Incidentally, I've got lots of posts I've started but haven't finished. I should get those out, shake off the dust and post 'em.... even if they are several years old.

Software and the Metropolis

Update: the link has changed to: http://msdn.microsoft.com/en-us/library/aa480026.aspx I attended the VS Live conference back in 2004, where Pat Helland gave this really interesting talk about how IT and Software are experiencing the same trends as the evolution of major cities. The parallels are really interesting. According to Pat, we're in 1880 I've referred to this talk many times, so I'm posting a link to it now. I can't believe that was over two years ago. One of the interesting anticdotes made is that after the railroads were invented (the internet), we needed a way to package our stuff up and send it between places. Hence, the invention of cardboard in 1880. XML is Cardboard. Ever buy a memory stick from dell? The cardboard it shipped in probably weighed more than the RAM stick. The cardboard had your name on it, where it came from, a shipping number, a customs tag on it, etc, etc -- but in the end, the contents of the package were more important than the package.

Monday, December 18, 2006

Geeking with Greg: Talk on eBay architecture

Cool post on e-bay architecture. Vertical scalability is where it's at. Interesting that XSLT and local file storage are used.

Wednesday, December 13, 2006

Rogers Digital Cable

I guess the picture's okay, but I can't get over how cluegy their guide is. Half the screen is taken up by their logo, the picture in picture looks like a stretched gif and the responsiveness of the menu is sloooooow. Thankfully, with my media center, I don't have to worry about that. I download the guide settings off the internet and then use the ever-so-user-friendly user-interface of media center to browse the guide. I can scroll through the channels (all of them) in under 15 seconds, plus I can remove channels from the listings that I don't want to see. Now, the big bonus is that I can multiple receivers (finally) hooked up to the media center so I can record one show while watching another live program.

Tuesday, December 12, 2006

About Friggin Time

Since February, the Internet connection at home has been flakey.  There had also been a lot of static on the phone line, maybe from a recent snow storm, so I figured this could be interrupting the DSL service. I called Bell to come out and take a look at the phone lines. They claimed they dispatched someone, but I never heard from them.

For a short while, the Internet seemed better and the phone line service wasn't so static-y. But sure enough, the Internet got worse and the static returned. So I called Bell. I asked why they never came by the house; they claimed they had a service technician splice the phone lines. This time, they dispatched someone. They tested the outside phone lines and determined everything was great. They tested the line going into the house and determined there was something wrong.

Aha, admist all the confusion of our new son being born, I had forgotten that we had activated our alarm system. Surely, it must be the alarm system that was interfering.

So I called ADT and asked. It took them a while to get me to a technician (they don't have anybody who can answer these questions on the phone outside of 9-5 PM Monday-Friday).

So I called Bell. Bell ran some diagnostics from their helpdesk and determined that it sounded like an "unfiltered telephonic device". Is it my alarm system? Maybe. Or, it's the new 3-in-1 handset cordless phone. Apparently, they draw a lot of current on the phone line.

So, Bell recommended:

  1. Disconnect the alarm.
  2. Disconnect the phone.
  3. Good luck.

So I decided to disconnected the cordless phone, and well... nothing happened. For about one week, the Internet worked great. After that, well. It was like 14 baud. Not 56,000 baud or even 14,000 baud. 14. Bruuuuutal.

So by about May, I was able to finally get someone from ADT to come by the house. Thankfully, those bastards charged me $150 bucks to install a phone-line adapter which they should have done during the install. (Thanks F#@#ers!!) Surely now, this would resolve the unfiltered-telephonic device.

Unfortunately, no. However, between June and July, every so often, the Internet would work for a few minutes at a time. In September I was able to use a bit-torrent client for about a week before I went back to 14 baud.

So November rolls around and I've had it. Time to get off DSL and onto Cable. Make the switch from dreaded Monopoly Bell to dreaded Monopoly Rogers. We hum and haa about switching, but eventually decide to switch everything: cell, TV, Internet, home phone. We feel glad we've made the purchase, and the installer is coming the following week. Great!

For the next week, every single day Rogers calls and leaves an automated message reminding me to be there for the 8-11 am install. Every frikking day.

Sure enough, at 10:50 the installer arrives. He's bright, cheerful. The first set back is that he can't get into the cable box, so he used a sledge-hammer to annihilate the existing box. He plugs holes and installs new metal clips to hold down the cables. Fantastic.

When it comes time to hook things up inside, it took me a while to convince him that I know where I want everything installed:

"Everything's in the basement.", I say.

"How about on the main floor?", he asks.

My main floor is devoid of technology.  "You see any TVs?"

Somehow the fact that there aren't any computers, phones or TVs on the main floor doesn't phase him.  Puzzled he asks, "So... main floor?"

This guy has been great so far, so I politely assert, "Why not put it in the basement with the TV, Wireless router and phone jacks?"

Obviously, he's either not listening to me or has a fear of finished basements. "We could just move stuff on this shelf and put it next to this phone. Most people do."

I walk over to the basement.  "Okay, so how about the basement then?"

Eventually, several hours later -- everything's hooked up. The installer makes some comment like, "it's not going to work right away. You know some people freak out because it doesn't work right away." I somehow let that slide. I wonder why people would think this?  Maybe because your automated voice-messaging system has been harassing people about the install??

Just as he's leaving, he mentions that there's a provisioning problem and it should be cleared up in a few hours. Not sure what he meant by this, I call Rogers about an hour later and ask for them some clarification. We sit on hold for nearly 30 minutes before the tech suggests that he can call me back when he knows. Gee, why didn't you offer that suggestion seconds after me calling you?? So the voicemail says, "there's a problem with getting the home phone number from Bell. Everything's backed up. We don't know how long. Maybe 24 hours."

So 24 hours later, I'm on the phone again. I'm put on hold for a very long time before someone comes back and tells me that "24-48 hours."

So 72 hours after the install, I get the impression that I'm working for Rogers now. I call in, yell at their stupid automated-voice system. The story I get is "... The work-order is showing as pending. So until we get the home-phone installed, we can't activate the TV or the Internet." This blows me away. Technically, the Internet and TV are hooked up correctly, and should work. But, because the paper work says the home-phone hasn't been hooked up -- technically, nothing can be activated.  So the best they can do, is schedule someone to come out to my house and finish the install in another week. But, he can make sure I get free TV for a month. Arrrgh!!

So they book the install for 5-8 a week later.  Which they show up at 5:01 for.  My wife got home from work (I was away on business) around 5:05 to find the "you weren't here note." Bastards!!

So I book the next install, now nearly three weeks since the original install. We get home at 4:58 to find two nearly identical messages on our phone: "Hello, this is Rogers installer. I want to do install. Please call me back."

Hmmm, maybe I would call you ...if you left your phone number!  So 5:01 he's knocking on the door. The entire home-phone installation takes 1 minute: snip the wire from bell. Plug the modem into the phone jack.

24 hours later. It works.

About Friggin Time.

Thursday, September 21, 2006

Running windows 2003 on a mac

Ok, maybe you can use parallels or bootcamp to install a windows OS on a intel-chip mac, but I had no idea that Windows 2003 was supported. When I saw this, I felt inspired to use the extremely crappy camera in my cell phone to take this snap.... Either the staffer who stocked the shelves of the Macintosh section at this book store is incompetent, had no Mac books, or had a sense of humour. Posted by Picasa

Sunday, July 16, 2006

VS.NET 2005 ASP.NET Web Application add-on

At work, we've shunned the VS 2003 concept of "Web Sites". Who really thinks you can build an enterprise web-application that is developed against the web-server with FrontPage Extensions?

Fritz Onion wrote an article ages ago that showed how you could treat a standard Class Library as a web application. This is the model we've been using ever since.

I've been wanting to try out the new Visual Studio 2005 Web Application Project since it was released but am just getting around to it.

There's an Update to Visual Studio 2005 you have to download first.

Haven't spent too much time on it yet, but you don't have to hack the IDE's config settings nor set up IIS.

Bitchin'.

submit to reddit

Float's Mobile Agent

I wasn't surprised recently when my laptop's hard-drive started to sound like a Suzuki motorcycle running up and down a hilly road. I'd been running it to the limit since the day I got it, constantly downloading and iterating through several hundred-thousand files. The space around the hard-drive would get so hot that I'm pretty sure that it has cooked the fleshy part of my left-palm. So when it finally died, despite the huge bummer of having to reinstall everything, I saw this as an opportunity to clean up my files and get my laptop organized.

One of the things that I've been wanting to get more out of is my Bluetooth enabled laptop and phone. I'd tried using the Sony Ericsson software that shipped with my phone but was completely unimpressed. I'd heard of this great utility flOat's Mobile Agent (FMA), but just couldn't get it to work.

So before instead of installing the Sony Ericsson software, this time I was going to put more time into FMA. Being open-source, it naturally is a little poor on setup details and documentation. However, I found a great starter document that shows how to get it up and running. In short:

  • Using the Bluetooth software, pair your Phone with the PC
  • Bring up the context-menu of the phone, choose Connect to Serial Port -- it'll add a new COM Port. You'll need to make note of the COM port it creates (ie COM4, COM5, COM6, etc)
  • Launch FMA
  • Choose Tools -> Options. Select the COM Port that was defined for your phone. (Mine was COM6)
  • OK your way out of the Options and then choose the "Phone -> Connect" option from the menu.

After about 30 seconds, FMA identifies your phone and begins to configure itself. Immediately afterwards, the FMA dashboard knows more about your phone that you do: battery, signal strength, firmware revision, call lists for incoming / outgoing and missed calls. Once you set the "Autoconnect on startup" and "Auto-reconnect (use proximity)" FMA takes care of managing the connection to your phone transparently. In addition, FMA loads itself into your phone like it was a Bluetooth accessory like a head-set or speaker phone.

Although albeit a bit buggy (it *is* OpenSource so that's to be expected) this is a great tool that changes the way you see your phone. It has the standard tools that you would expect, such as the ability to manage your phonebook, text messages, and upload/download files to and from your phone -- plus it has some additional goodies like viewing your call-lists, sending SMS messages from your PC and synchronizing with Outlook. What's more is that it provides on-screen call-display for your incoming calls: I got the onscreen popup that my wife was calling before my phone rang!

My favorite feature is the proximity detection. Mac users with iSync have had the luxury of integrated Bluetooth proximity. When I walk away from my PC, the speakers mute and it locks my workstation. When I return, the speakers un-mute. (The "unlock workstation" checkbox is currently grayed out in the Tools -> Options).

I was impressed that it goes beyond the Sony Ericsson software capabilities and lets you control every aspect of your phone remotely: silent mode, locked keys -- you can even turn off the phone.

Even further still, I was surprised to learn that the developers of FMA have thought of the inverse -- the ability to control your PC from your phone. Once FMA is initialized, it loads itself into your phone like it was a Bluetooth accessory like a head-set or speaker phone. By default, it opens a menu of applications and tools that can be launched such as WinAmp. Among this menu list is a "General Tools" which lets you turn off your monitor, lock the workstation, hibernate, and even shutdown.

Much like UltraMon, this is a utility I'll be preaching to anyone who has a Bluetooth enabled phone and PC.

Windows 98 + high speed Internet = hilarious

Tip: If you have high speed Internet and you don't have a router or other physical firewall device, you are running at serious risk. Go buy a router!! Here's a story about how a simple OS installation turned out to be a nightmare...

My wife and I took a trip out east for my Mother-in-Law's 60th birthday. Anytime she was in our province, she'd always talk about her computer with such disappointment and how I should come out to fix it someday. Well, when I learned that their machine was completely unstable on Windows ME (gawd help me) and their tech-friendly neighbour downgraded them to Windows 98 (holy crap!) -- I knew I needed to help.

So I looked into buying a copy of XP. Strangely, an upgrade is $230 and an OEM copy is $110. The catch is that you have to buy a motherboard in order to qualify for the OEM version -- no exceptions. Even if I bought a cheapo motherboard it would still work cheaper than the upgrade. Hey Microsoft -- fix your pricing, that's stupid.

So instead of purchasing a new version, I decided that my aging computer that I haven't hooked up since we moved into our house a year ago was officially retired -- I could donate that copy to my Mother-in-Law without violating any licensing agreements.

I bought a cheap 80Gb hard-drive for $50 (+ tax, grrr) on the day of my flight out and committed to installing the new Hard-Drive and OS while I was there. The installation turned out to be the most-complicated OS install I've ever performed.

I learned that there must have been some serious security improvements to XP since the first release of the OS -- I received my copy the week XP was launched so a fresh installation needs a zillion updates. I also learned that either the high-speed Internet provider out east could care less about mitigating hackers or I just didn't realize how effective my Linksys Router is.

I ended up installing the OS three times:

The first install went flawlessly -- I kept the Internet connection unplugged until it was ready to download updates. As soon as I started up Windows Update, the initial fix (the background intelligent transfer service BITS upgrade) took forever to install. About twenty minutes in, I realized that some hacker had compromised the machine and in place of the BITS upgrade, a Trojan had been installed with the same name, and the root of the hard-drive was filling up with garbage files and executables, pop-up messages were launching: this pc was now a honey-pot for hackers. In frustration, I put the installation CD back in and rebooted -- screw this!

I wised up for the second installation and took some additional security steps. I changed permissions on the hard-drive, disabled simple sharing. I thought I turned off "File and Printer Sharing" but an hour later, I was screaming politely (in front of my father-in-law) and rebooted with the installation CD.

The third installation, I needed help. I borrowed a neighbour's DLink router and magically all the hacker non-sense stopped. Before I left Nova Scotia I convinced my father-in-law that they absolutely needed to have a router.

Looking back on it -- they claimed they had serious problems with Windows ME but fewer problems with Windows 98. Though I'm not sure how to qualify "fewer" because when I was backing up data for the re-installation their machine would crash two/three times per hour. In a way it was comical because each time it crashed my not-so-computer-friendly father-in-law would ask, "What causes that?"

I explained it the best I could -- "Running Windows 98 nearly ten years ago when everyone was on dial-up was considered "safe". Now that everyone's on broadband things have changed; security has changed. Imagine a bank with security practices from the 1950's that has no bars, silent alarms or security cameras... would you bank there?"

Tuesday, May 16, 2006

Access / SQL - Write Conflict Error

We've been using an Access Database to front a SQL Server database. It's handy in that we can leverage all the simple UI features that Access Provides, such as drop-down lists.

However, recently we had a problem when we couldn't update any rows and we were getting this mysterious "Write Conflict" error.

Turns out that Access UI tries to assign default values to columns, and for some data-types, this causes problems.

Here's the MS Knowledge base article: You may receive write conflict errors when you update records of a linked SQL Server table in Access 2000

Thursday, May 11, 2006

Colbert Roasts President Bush

Saw the Repor(t) the other day where he called out some of the highlights from this speech, but it was out of context....

Here's the full speech...

awesome.

the mesquite-powered car.

Tuesday, May 09, 2006

Asynchronous client-side error logging

Finally got around to setting up a Bloglines account: handy tool.

While catching up on some of Scott Guthrie's posts, I was intrigued by Logging JavaScript Errors To ASP.NET

The code module is ASP.NET 2.0, and integrates with the Health Monitoring system.

submit to reddit

Friday, March 24, 2006

Zenview Arena 21S: Six-Screen Display

I know I'm spoiled with a laptop/flat screen monitor combo, and it's true I might be more productive. I know I'll have a hard time switching to anything but dual monitor support. Imagine how productive you'd be if you had this..

Plus now, you can save $300 bucks.

Holy Smoke!

While I was commuting back from Las Vegas, my folks were on the Princess Cruiseship freaking out. You hear this stuff happening, but it always happens to strangers. My folks are fine, but this is really unbelievable... CNN.com - Cruise ship fire survivors count themselves lucky - Mar 24, 2006

MIX06 - Bill's Q&A with Tim O'Reilly video

A day after returning from the conference, I'm still churning things over and writing posts, don't worry more to follow. But while doing some research, I found this great clip from the end of Bill's KeyNote where he had Tim O'Reilly, CEO of O'Reilly books, come up and ask questions.

It's really funny how being there and watching the video are two very different experiences. The comments on the web site see Bill as this hero, but what they don't show in the video is the very first twenty or thirty seconds where Tim came out and completely ZINGED Bill for why Tim was invited.

In short, he came out and expressed he had no idea why Bill had invited him and it put Bill on the defensive. Everyone in the room saw Tim as this non-Microsoft guy who could fearlessly push Bill around a bit and get him going (I'm totally buying O'Reilly books from here in). Once edited, the video makes Bill look the opposite, like he's on top of the questions -- but while I was there, it seemed as though he was reacting.

What I really identified with is the segment that occurs about 17 minutes in, where the software industry is changing with new business models that are unlike previous competitors. Tim implies that Apple's success is because they're the first of a new generation of software applications: the iPod has this amazing experience where the device, the software, and the Internet are married together into an epiphony experience, versus, buying a device and then having the user cobble the experience together after the fact. Bill replies by saying, "we support more devices." Sure, Bill's answers are great, and they make sense from a guy who's business model is to sell software units in his prehistoric business model: wouldn't it be nice if you had a phone that automatically configured your experience across all devices?

But to me, and many others at the conference, Bill didn't get the question.

Wednesday, March 22, 2006

Mix06 WPF - Sure it's great, but is the Jury still out?

One of the dazzling showcase items of this conference is the Windows Presentation Foundation (Formerly code named "Avalon") and the WinFx applications that are built upon it. Several sessions have been focused around it, especially around the kiosk application that was built for The North Face -- a feature rich application with dazzling graphics and hi-definition video sure to drop many jaws of developers and designers alike. The really great thing about The North Face, as a premier early adopter of WPF, is that it is so completely over the top that it is going to reset the bar, and next generation applications will leave the web as we know it today far, far behind.

But before we get into all that exciting goodness, let's talk more about WPF. This new distributable that will be downloadable for Windows XP and shipped with Vista is a framework for building feature rich next generation windows applications. Already we're seeing it being heavily utilized by the next-generation version of Windows Media Center bundled into Vista. Unlike GDI+, WPF is more than a set of classes and code examples; it's primary delivery mechanism is through structured Xml documents which drive the presentation elements, known as "XAML" (which is being pronounced as "Zam-mel").

Aside: When I first saw this, I didn't know what to think. As I was mulling it over walking to the next session, a Microsoft employee asked me what I thought. I smiled and replied, "Kinda reminds me of Liquid Motion" which got a good chuckle from him. Hardly anyone remembers this, but ten years ago, Microsoft tried to compete against Flash by creating a tool that created ActiveX based animations with DHTML. It failed miserably, and rightfully so -- it was like building a website using the PaperClip.

It takes a second or two to fully realize what exactly XAML is, and it requires you to take a leap of faith in the presenter, because initially it doesn't makes any sense. At its core XAML is a markup language that describes presentation layer elements: a page, a grid, some text, an image, a button. If that was it, we could all log off and call it Miller time. But instead, XAML goes further to describe vector graphics, animations, complex 3D modeling, lighting and transformations. To put it into context, imagine a custom shape with a drop-shadow sitting on a shiny reflective surface with an cool fog slowly undulating in the background, described purely as markup with absolutely no code. That alone is very cool. Now add data-binding from an external xml file and provide scripting support from a codebehind, and your head is spinning. I'll definitely want to download the community technology preview and play with this technology.

As a complete aside, just to give an example as to how next-generation XAML is, all colour representations are now 4 bytes (8 hex characters #FF3C3C3c) where the first byte represents opacity.

As XAML can get very confusing very fast, Microsoft is introducing a new tool called "Expression" which is graphical designer that ...well, looks like Flash MX. Tweening, objects, timelines, but with a Microsoft Visual Studio sort of IDE. After seeing how simple objects can be transformed into majestic elements simply by changing properties of objects through the IDE, the great light-bulb in your head goes off and we see that our designers and flash developers can enter the production cycle earlier, working on the same file format and at each step it becomes more specialized.

This is all very exciting, so why am I being skeptical? Okay, skeptical is a poor word. How about apprehensive, worried, or uncertain?

One of my uncertainties comes from the fact that this is the first convention I've attended where Microsoft is making a deliberate effort to involve graphic designers. Traditionally Microsoft uses personas to identify developers (like "Mort", the VB6 spaghetti-procedural-code developer turned VB.NET object oriented procedural programmer) but Microsoft has no established Persona for designers(, yet). Which begs a very good question -- how well has Microsoft identified with the designer community? and.. Will the designer community abandon their traditional Macintosh and Macromedia tools in favour of Microsoft technologies? Or are we going to get rid of them all and make our developers graphical designers? (god help us, no)

In the end, if there is no adoption from the designer community then it's becomes all promise and no delivery. After all, if I was responsible for Flash development, it'd be stick figures and powerpoint style animated text with swooshing noises. Microsoft probably knows this, and that's why this conference is trying to tickle designers into gleeful hysteria.

My second apprehension is surrounding the "demo-factor" of the The North Face example. The gotcha is that it is not a web application, but rather a full-blown executable that is going to be running on high-performant PCs inside the North Face stores. The North Face went with a kiosk application because of the sheer size of hi-def video files and needed hardware acceleration to pull off hi-def movies rendered into a 3D Modelled space. I can also assume that there's a lot of custom application logic and controls that had to be hand-coded, and probably a lot of hours in trial and error to make it the killer app that it appears to be. Fluid, the agency who did the implementation, referred to their whitepapers for explanations of key concepts, but how much code will represent howto's within WPF/XAML versus core application logic is yet to be seen.

Taking WPF to the Web

In addition, there's a lot of talk about Windows Presentation Foundation for Everywhere (WPF/E) that works like a flash substitute as a browser plugin. A lot of people are wondering just how much of TNF can be ported to the web experience, and what the implementation will look like. In fact, the session I attended for WPF/E was about 40 minutes demo / 40 minutes of endless questions.

WPF/E is an interesting beast, with gotchas of its own. The first one being that WPF/E won't be available until after Vista launches. The others are hard to explain, so I'll start by explaining what I know (which is very little). At the same time, this technology is bleeding edge and is more than a year out from ship date, which translates into another 18 months before market penetration is significant enough to make this discussion relevant.

Although this is not a definitive list, the targeted audience for WPF/E is IE 6 SP2, FireFox / Mozilla 1.x, Safari running on Windows XP or Mac OS X. There appears to be some discussion happening about Linux support as well, but like most things that are a year out from their release, everything is "under consideration".

Most of the examples shown in the sessions used an object tag (embed tag for FireFox) with a CLSID and a script block that hosted the XAML as a data-island, though some examples did illustrate referencing the XAML as an external file. From a client-scripting standpoint, JavaScript is the language of choice to directly manipulate the XAML through its Document Object Model just like it was DHTML; changes to the XAML are immediately reflected in the browser. A second option for scripting exists which the presenter quickly glossed over, but the audience was so horrified by the implications that it inspired dozens of follow-up questions (people started lining up at the microphones seconds after he moved to the next slide).

The second option sounded like we were witnessing the birth of the Anti-Christ in ActiveX version 2.0 format: You can write your script in C#, compile it into a wpse file and then download it to the client where the runtime will parse the IL and execute your code. Sounds like a recipe for disaster, and I can just picture the continual stream of security advisories related to it, but I don't think it's as bad as it sounds. Let's decipher Lucifer...

Mentioning "IL" to a conference room of .net developers means "managed code", and it also implies that the end-user must have the .net framework installed. Not true: "IL" in this case refers to an IL interpreter as part of the WPF/E browser plug-in. The classes within the WPF/E can be compiled using the same compiler built into Visual Studio, but only the classes within the WPF/E will be accessible via client-code. As such, you won't be able to include .net core classes that require the .net framework as part of the wpse file.

Automatically executing arbitrary code simply by visiting a page on a website is scary and implies massive security holes that will be continually patched up. Also not true, but I'm willing to place bets that exploits will eventually be made. The classes within the WPF/E namespace will be limited only to the rendering engine and manipulating the XAML DOM. Currently, the wiring of the codebehind to web-services for AJAX style XAML inside the wpse is "under development". As an aside, it was mentioned that cross-domain scripting for IL won't be supported for version 1.0, probably because they don't want to expose themselves to security exploits. The thinking here is they want to do it right the first time.

Compilation of code implies that my codebehind is somehow available for download and bundled with my assembly, or, we're creating projects for each xaml file? Although I didn't understand the explanation that was given to me (it's something i need to see), they glossed over it by saying my MS Build script would compile my xaml codebehinds and bundle them up. Referring to my "MS Build Script" really means someone better get cracking on the wpse Nant contribution for CruiseControl integration, or I need to better understand what they mean by "bundled up".

The other observation that I have is that most of the code samples provided were ports of the The North Face kiosk application, which may work fine to demonstrate the portability of XAML to the web, but the actual implementation of that code is unsuitable for Internet applications. To illustrate, one of the samples is this amazing product shot of a jacket which can be rotated in 3D. Under close inspection of the sample, the product shot is not a 3D rendered model represented in a SVG format, but rather a collection of transparent PNG images taken in 360 degree angles. Where the example breaks down, is the javascript that manipulates the XAML is simply changing the image path to represent the requested angle of the product shot: if these images aren't preloaded, the experience will be remarkably different online compared to when the images are being served locally.

Issues like this are fundamental problems that start alarm bells ringing in my head. Flash developers have long since identified and addressed these issues ages ago, and we take them for granted -- yet these problems are essentially brand-new and waiting to be rediscovered by a new set of developers. While this can be seen as a cost impedement to adopting WPF/E versus Flash, this is clearly an opportunity for early adopters and advocates of this new technology to establish key best practices. Since XAML is a well structured document format, we're already better positioned to start building tools and third party libraries compared to the current state of cobbled together flash solutions. Kinda wants you to go out and buy a Wrox XAML book, doesn't it?

All in all, it looks like it's an amazing technology that is going to radically change many aspects of web and desktop applications. But its the minor considerations that cast shadows of reasonable doubt that will keep the Jury closely watching its evolution before coming to a decision.

Monday, March 20, 2006

Mix06 - Internet Explorer... seven, eh?

Internet Explorer has a huge skeptic to convince. Ok, aside from me, there's an 11% market share of FireFox users who'll give the "who cares" argument to Microsoft's Internet Explorer release. Right out of the gate, I'm expecting nothing exciting from the next generation browser. After all, Microsoft themselves (Paul H the Microsoft Program Manager for IE himself) declared "We screwed up." Technically the last major release of Internet Explorer was five years ago in 2001, since then Microsoft has failed to demonstrate their commitment to the web, and thus has let the fruit rot on the vine. What's so important about Internet Explorer 7? Frankly, why should we care?

Microsoft puts forward that they've got some great new browser enhancements, and I'll admit, they are pretty cool but there's nothing so dramatic that it won't be available as an extension for FireFox in a few weeks. What Internet Explorer is going to provide is the experience of FireFox rolled out to the non-tech saavy masses; Think of Windows Update as the great equalizer of the Internet, correcting a major wrong and restoring balance that has been rapidly shifting to FireFox.

Though I wouldn't call better or proper css implementation a "feature", it is certainly well received. The real question is how strict is Internet Explorer on proper HTML implementation, since Internet Explorer's greatest weakness is it's ability to forgive bad HTML: it might look ok in IE, but browsers that strictly comply with HTML standards clearly don't render the same markup.

Sadly, ActiveX support is still available for Internet Explorer so "the" wrong has not been removed, but the security settings that support ActiveX will warn the user as they make changes (the configuration section turns bright red), when they run under these settings and they get warned everytime they start the browser. It's kind of the <slap><slap><slap>"Are you nuts?" warning that tells them they are at risk. Whether this warning is perceived by end-users as the car dashboard "DANGER: Car needs Servicing NOW" directive or the "Please fasten seat belts" notification is still yet to be seen, but is a very good step in the right direction. It would appear as though MS is gearing to make ActiveX disabled by default. Ontop of all the excellent security visual enhancements, the low-level stuff is what's changed the most from the previous version. How's this -- even the administrator gets locked down... <head tilt>really? Outside of toolbar plugins, this move feels very much like MS might be planning the obsolecense of ActiveX. (haha, maybe in ten years)

The tabbed browsing experience is not new to FireFox users, but the implementation is very clean: the new tab button appears as a very small tab at the end of the current tabset, making it a very intuitive experience. What is unique is the ability to save entire groups of tabs as a Favourite (which I'm sure will bring new meaning to the copy-n-paste snippet demo) and the ability to preview all the current tabs at the same time.

Also interesting is the removal of the menu bar from the main browser window. It is now conveniently tucked away as a button in the toolbar. As a side-effect, it's as though the site is running in full-screen mode which means that more screen real-estate will become the norm.

While the visual enhancements and features do appear to be borrowed from FireFox, there's a lot of plumbing in the background that represent an interesting shift in the way we think about websites. Most notably is the native support for RSS Feeds. Two important aspects about this: how RSS is displayed in the browser and how RSS feeds are treated.

Regarding native display of RSS, similar to the way the xslt-transform that is applied to XML files in the browser, RSS is given a nice xslt transform so that the data is made pretty when viewed in the browser. As the primary usage of RSS today is to represent blog posts, the standard xslt makes it easy to sort the entries by Title or by Date. While this is convienent, the twist is that IE7 supports the concept of rich-data in the RSS Feed: you'll be able to add some additional meta data within the feed to describe what the feed contains. Some examples include Amazon's top music feed which includes images for the artist and links to download or buy music, plus the ability to sort by many different attributes in the data, such as Artist, Song Title, Genre.

Secondly, RSS feeds are now considered outside the scope of Internet Explorer. Feeds become centralized on the computer as a repository for all feeds, which provides a wide range of new opportunities for web 2.0 integration. Consider the newsgator plugin that automatically synchronizes your feeds with their server, or the Windows Vista desktop gadget that consumes that data in new and interesting ways such as the myspace.com buddy gadget which displays updates and pictures posted by your online friends.

Now, if only Microsoft had embraced the extension model that FireFox has... I would probably switch.

Mix06 - Bill's KeyNote

Like waiting for a rock concert, the theatre hall is alive with a buzz. Massive screens glow with contest entries for website redesign of the mix06 website.

Bill comes out and there's lots of cameras flashing, like it was a new york fashion runway. But with all the money he's got, he's still comes out looking like a big nerd: signature glasses and uncombed hair. Couldn't somebody say, "Mr. Gates, let me take care of your onscreen makeup?" Scary thing is, someone may have already put work into making him look the way he does.

Bill's focus is getting the experience to cross as many devices, and the market is really expanding from high-resolution monitors, to TVs, to xBoxes, to PDAs to mobile phones. The key is to get a toolset that acts an abstraction to assist from large to small screen sizes.

One of the main focuses is Internet Explorer. There are three areas of improvement:

  • streamlined user interface (tabs, print-preview, improved print capabilities)
  • security enhancements (low rights mode, phishing filter - reputation services)
  • enhancements improved css, rss support, native xml, transparent png's

With what they've done for IE7, it's no wonder why Bill sees that RSS usage is going to explode. RSS represents a fundamental shift, the "programmable web". Simple APIs for your website treat your website as a service or component that is consumed elsewhere for other purposes, ie eBay. Much like native XML support for Internet Explorer, IE7 provides built-in support for rendering of RSS feeds which provides the ability to render the RSS with rich data tags. Apparently, Microsoft released a standard for the rich-data tags within RSS about six months ago. Amazon, eBay and others have adopted the standard and are including rich-data tags within their feeds to date.

There's a big buzz about "Atlas", the suite of tools for building AJAX websites. Bill expects that new tools such as Office 2007, outlook web-access and other core applications will leverage AJAX. They're touting Atlas as more than an AJAX library, it's a consistent methodology for building ajax applications.

Bill also mentions it's a big year for Media Center with 6 million units sold. Bill has big hopes for partnerships in this space to take it further over the next few years. XBOX 360 as an extender also plays a big role in the media center expansion. This is the focus of the next 3 days, where we look "Beyond the browser"...

Bill highlighted a few mobile devices, but was very brief... "here's one. here's another. this was is cool, too. Check this one out..." Wasn't anything that exciting.

Showcased in the Keynote are the CTO for MySpace.com and the director of New Media for the BBC. Both had amazing stories to tell. MySpace showed how Microsoft technologies made them the #2 traffic site on the Internet, and the BBC showcased how they're looking to use some of the new features of Vista and tight integration of Microsoft technologies to allow them to find new cost effective means to deliver their content over the Internet.

Regarding VISTA, all I have to say is that at first glance it is really slick. I'm expecting a huge pouty lip from our Mac user friends who'll claim they've stolen all the cool things out of Mac OS X. Transparent toolbars, widgets, slide-in/slide-out windows. Really slick. The registration package includes copies of Vista (among other swag) plus they've got labs set up to play with IE 7, Vista, XBox -- lots of stuff to play with.

Mix06 - No sleep, but hey.

7:30 AM PST

Ok. This is where having an infant is helpful. Sleep deprevation actually pays off -- 5 hours sleep and I feel great. My wife is planning on taking off with my son to my parent's place. Unfortunately, they're on vacation somewhere in the Carribbean, so she's by herself at night, but has my brother's and sister-in-law's and nephews to keep her company. I give her a call just to say that I made it ok.

I open the blinds of my hotel window, I have a pleasant view of the parking garage. But in the distance -- wow: mountains and palm trees, a rare combination indeed. Add the crazy architecture and neon lights, and you can only be in Las Vegas.

Mix06 - Back from the foray

Okay. Back at my laptop, thoughts are swimming around my very tired brain. The best place to start (and to sign off for the night) is: I can't believe the scale of it all.

The Venetian is a colossus, the Mirage is huge, the 100 foot billboards of lounge singers. And I've only really walked around the block.

I want to take pictures but not sure where to start. Oh, second thought: open booze. People are walking around with beer bottles and mixed drinks. This floors me. Growing up in a small town (and having been fined for open liquor once) all I see is liability lawsuits everywhere, but I guess that's the thinking behind it all -- I can sell you the booze, but what you choose to do with it is your problem.

Mix06 - Sleep?

Great. Checked-in. Unpacked. Go to sleep? Why not, it's only 3 am my time? No way, it's only 12 am Nevada time. Besides, I don't have any idea as to where I'm supposed to be going. I should venture out in the bright-lights and see what all the fuss is about.

Mix06 - Vegas, baby! Vegas

Arrived in Sunny Las Vegas, Sin City, City that never sleeps, 2:30 in the morning. Despite the late hour, the city is still a-buzz. Perhaps the most surprising of all is how close the airport is to the strip. Coming into the gate, you can see it all! Pyramids, New York, Paris -- feels just like a CSI fly-by sequence.

Managed to find my luggage and the taxi line up. As luck would have it, a few gentlemen were chatting with some of their seat-mates, and I overheard that they were headed to the Venetian -- the location of my event. I was pretty lucky with the travel arrangements; although I couldn't get the discounted rate at the Venetian, they managed to get me into Harrahs, which is next door.

I was able to pool together and take a cab with these guys to the Venetian, and then I had to find my way to Harrahs. I had to skirt through a parking garage, cross the street at an unlikely intersection and then pulled my travel luggage into the valet parking area.

Sunday, March 19, 2006

Mix06 - Start

Off to Mix06 -- Microsoft's event where they'll be showcasing Internet Explorer 7, Windows Vista, Avalon, Atlas, etc. Should be pretty cool, as it's in Las Vegas. Bill Gates is giving the keynote, so all in all, an exciting time to be had.

My flight pulls out of Pearson at 8:35 Sunday night, which means I'll get there late...

Wednesday, March 15, 2006

Recorded Media Center Programs Meet Pocket PC: Part II

A few posts back, I was lamenting about trying to get my Windows Media Center recorded TV programs onto My Pocket PC. After upgrading to PocketPC 2003, the native support for Windows Media 9 has made transcoding MS-DVR files into WMV painless:

In the morning, I transcode my TV show while I'm in the shower. I plop my 2 GB SD card into the media-drive on my Media Center and drag-n-drop 60Mb worth of Stephen Colbert's Colbert Report for viewing while on the TTC.

And... I'm happy to report, that I've suddenly found my PDA useful again.

Screen Capture for Invisible Windows

I was recently tinkering around in an admin tool that is used to build web-sites, and found myself wondering if it was possible to create a "preview" of the web-site as an image. The idea being, I want to show a list of pages in the website with thumbnails of page previews; thus the site administrator can see the entire site on a single page and would be able to know what they were editing before they opened the page configuration.

If you're like me, these kinds of problems drive me crazy. I ear mark them as "nifty ideas" and I slowly mull them over in my head when my head has idle time. (What, you don't have head idle time? Between 3-4 in the morning when I change sleeping positions, I have to force myself not to address my mental challenge To-do list. I recently discovered that our brains solve a lot of problems after only a few hours of sleep.)

So although I haven't actually cracked the code open to tackle this problem, here's what I envision the implementation to be:

  1. Use the .NET Process object to launch a window to the web page.
  2. Grab the handle of the Process and pass it to the GDI+ to convert into an image. This CodeProject article gives a really good overview of doing just that.

I'm hoping that if the .NET Process is launched with the ProcessWindowStyle set to "Hidden" that it still has a valid device context used to paint onto the screen. If that's true, there should be no reason why I couldn't convert the hidden window's content into a Bitmap.

Few other things to consider, such as when to determine that the browser has fully loaded the requested page? I might have to consider using the WebBrowser control to load the webpage and wait until the document onload event or page status changes....

Yet another task to play with...

submit to reddit

Tuesday, March 14, 2006

Shell extensions in C#

I work with a lot of Xml files, where the filenames are random GUIDs. Since all the documents have the same structure, I wonder if it would be possible to create a shell extension for Windows Explorer that could add a column to the details tab.

This CodeProject article, Explorer column handler shell extension in C# - The Code Project - C# Programming, looks like a good starting point.

Update 06/07/2008: I've written a few shell extensions following this example.  Although they work, they can seize a lot of memory if you need to spawn a debugger.

submit to reddit

Friday, March 03, 2006

Recorded Media Center programs, meet Pocket PC

Dang!

Recently I bought a 2 GB SD card cheap from Future Shop ($99 CAN) so that I could start to take some of my recorded Media Center TV shows onto my Pocket PC. This has proven to be a bit difficult task...

First off, it's takes a lot of time to find a convenient way to transform Microsoft's dvr-ms files into something less... massive. One hour of recorded TV is roughly 2.5 GB. And -- everyone has got a piece of software to do the job for a price. I've test-driven several freeware applications, but you've got to be really frikkin patient to try some of these things out.

DVR 2 WMV has proven to be the quickest way to convert into Windows Media Format, where 1 hour of video takes about 20 minutes. Initially I had some problems getting the application to work, but after I turned on Compatibility mode, things seemed to work fine. (I've also got my eye on using the MSDVR Toolkit to automatically strip out commercials and convert into various formats, but it's not as straight forward as DVR 2 WMV)

The next big challenge is actually my PocketPC. I have an iPaq 3870 which was released back in 2002 as a Compaq product before the big HP merger. At that time, the 203Mhz, TFT screen, 64Mb internal memory, SD Card slot and built in Bluetooth was HOT. It was crazy expensive compared to some of the units available today. (Yet another pioneering effort on my part. You do realize that me buying this stuff at the early-adopter stage is what it makes it affordable for you people? You're welcome)

Although I've used my PDA fairly frequently, I even wrote some applications in Compact .NET framework, it's become more of a second-class peripheral on my cluttered desk. I use it mainly to display my calendar for the day, and since my Laptop has Bluetooth, I don't even have to worry about hooking it up in the morning.

Sadly, it's also only running PocketPC 2002 which has Window Media Player 8.5 for Pocket PC. Guess what format DVR 2 WMV uses? If you guessed Windows Media 9 you would be absolutely correct. Enjoy a coke on me.

So, at long last, I finally found a reason to download and install The Core Pocket Media Player, an opensource media player for pretty much any portable device. It can play most media formats, including divX. But I was shutout again! It looks like the Windows Media Support for TCPMP is based on the windows media codecs installed on the device. Back to square one, either find a way to acquire the codecs, or look at finding another tool to encode the DVR-MS files.

Although I wasn't able to find the codecs as a separate download, the real killer is that you can't just download Windows Media 9 for Pocket PCs -- you have to upgrade your OS, which is... sub-optimal. Turns out you can't just walk into a store and buy a copy of PocketPC 2003, it can only be upgraded through the manufacturer of the device. Specifically, the ROM has to be reprogrammed. Do you think HP is going to have a ROM for a 4 year old Compaq device available for purchase on their site? Rhetoric question answerers may drink another coke for answering no.

Then, on a whim, I tried E-Bay. I was pleasantly surprised to find the ROM for only $2.99 US, free shipping. Skip the afternoon $2 coffee, have that sucker shipped to my office, pronto. So, we'll see what an upgrade brings. Maybe I'll find myself with a renewed interest in my Pocket PC. Or, as a late-adopter, I'll break down and buy an iPod like the rest of you (thank you for making that stuff affordable)

Wednesday, March 01, 2006

SubInACL

Pretty powerful ACL tool for windows.

Saturday, February 04, 2006

Markdown.NET

A recent project at work, our content management system converts the raw text into HTML and persists the translated values as part of an XML document.

However, Markdown.NET would appear to be an interesting alternative. MarkDown, which started off in perl has been ported to php, phyton and others. I'd be interested to see how it would fit into our solution framework.

Friday, February 03, 2006

DVD-Decryptor is dead, now what?

I'm really interested in taking DVD content and ripping it into a format for my portable media player, but I came late to the game -- the fan favourite DVD-Decryptor is out of business, simply because their application could break copyright encryption.

But ShrinkTo5 may stand as the next successor to DVD-Decryptor. I've heard rave reviews about this tool, and I need to find some time to play with it.

The big difference: it doesn't break CSS encryption. Well, at least not on it's own.

A popular DeCSS encryption dll, "machinist.dll" can decrypt the CSS... if this dll was included in the same folder as ShrinkTo5, it'll load the decryption algorithm and decrypt on the fly.

A quick google and I was able to find a location that posts the machinist.dll for download. Remember, decrypting is not illegal in all countries.

Thursday, February 02, 2006

....set the building on fire....

I can understand why Milton Adams (Stephen Root) of Office Space would be up in arms about his Red Swingline stapler gone missing. My brother-in-law bought me the stapler for christmas as a joke. But make no mistake, this heavy-duty diecast metal stapler is all business. I'm able to punch documents that would make normal staplers roll over and die.

Tuesday, January 24, 2006

Google Sightseeing

Google's social influence meets world tourist.

Get Geolocation stats for your web site, for free...

gVisit.com has provided a simple tool that collects the last 20 visitors to your site and then correlates and displays this information on a google-map. Yet another example of how everything is becoming more ubiquitos and coadjuvant.

Thursday, January 19, 2006

CodeProject: Server-side handling for css and js

This post on CodeProject talks about creating a custom handler for css and js files, so that relative paths can be resolved. The ability to specify relative paths to your application root is clearly an advantage if your application root is a virtual directory or sub-folder from the web root. But I think this solution could go one further: II6 supports wildcard mapping, so that all requests can be funelled through the asp.net runtime, an advantage if you want to use virtual URLs for both folders and files. I believe that dotText is using wildcard mapping in this manner, and I think they have implemented a very decent handler for static files, such as js, css, images, etc. I wonder if the dotText controls can be extended to support this type of ~ (AppDomainAppVirtualPath) mapping.

submit to reddit

Friday, January 13, 2006

Hot Keys and Quick Launch groups

I've been watching too much G4Tech TV recently, specifically "Call For Help". While maybe the context of the show is geared towards computer-newbies, they do seem to cover a wide range of stuff.

A segment of the show includes a "download of the day". A few days ago they featured PS Hot Launch, a lightweight tool quick-launch toolbar for the applications that you use frequently. What makes it unique is that you can group them together and assign hotkeys to the group. You can configure to show a quick-launch menu for the hot-key or to launch all applications in a group -- perfect if you have tasks where you need an IDE, command-line, nunit, and browser!

Wednesday, January 04, 2006

Microsoft Google Search

I don't know how many times I've tried to weed out what I was looking for in a search result. Turns out, Google has probably noticed that I (ok, and the rest of the planet) have done a lot of Microsoft related searches.

In the Advanced Search of Google, they've provided customized search pages for common searches, including:

  • Apple
  • Macintosh
  • BSD
  • Unix
  • Linux
  • Microsoft
  • and others

Even better -- you can add the Microsoft search to Firefox as a Search Engine Plugin

Friday, September 02, 2005

Classic Computer Magazine Archive

How old school is this? Fond memories.

Monday, June 20, 2005

Das Keyboard

Ya, you typing.

Monday, June 06, 2005

UltraMon

I've been running a laptop and a flat-screen monitor for a few months now and stumbled upon UltraMon. It's a commercial product but it provides a trial version. After reading it's specs, I'm definately going to check it out.

Wednesday, May 25, 2005

Dynamic control generation using XSLT

In a recent project, we needed to render .net controls dynamically. Instead of using ascx controls, we used XSLT to transform static Xml data into dynamic presentation layers; a viable approach to providing multiple look and feels for the site. Here's a quick walkthrough of how it works.

Dynamically loading the HTML is simple, using the built-in ParseControl method of the System.Web.UI.Page class.

Control c = Page.ParseControl( "<b> Literal Text </b>");

The same logic can be applied to parsing the output of an Xslt transformation.

string transformOutput = xslTransformer.Transform();
Control c = Page.ParseControl(transformOutput);

If you want to add server-side controls into the transformation, there are a few gotchas:

  1. XSLT parser needs namespace definitions for .net and custom tag prefixes.
  2. Namespaces appear as attributes in the formatted output, which will need to be stripped out before adding to the Page.Controls collection.

If you're adding asp.net controls or custom controls into your XSLT file, you'll need to declare the namespace at the top of the xslt header, otherwise the XML Parser will complain:

xmlns:asp="http://schemas.microsoft.com/AspNet/WebControls"

Incidentally, if you're using Visual Studio 2003, adding this namespace declaration will give you Intellisense for your asp.net controls in your XSLT file.

With all the proper namespaces defined, you'll bypass any nasty Xslt Parser errors, however, these namespaces will now appear scattered throughout your transformed output as attributes. If you leave these values in and try to parse the output into a control, the .net runtime will try to resolve the namespaces as attributes of the controls and will generate runtime errors.

Fortunately, a quick regular expression can strip all these namespaces out of the transformed output:

string transformedOutput = transformedOutput.Replace("xmlns:\w+=\"[^"]+\"", "");

With the namespaces stripped out of the transformed output, you should be able to parse the string into a control.

using System.Xml;
using System.Xml.Xsl;
using System.Web;

XslTransform transform = new XslTransform();
transform.resolver = new System.Uri("http://localhost"); 
string xslFilePath = Server.MapPath("/controls.xslt");
transform.Load( xslFilePath );

string xmlFilePath = Server.MapPath("/data.xml");
string transformedOutput = transform.Transform( xmlFilePath );
transformedOutput = transformedOutput.Replace("xmlns:\w+=\"[^"]+\"", "");

Control c = Page.ParseControl( transformedOutput ); 
Page.Controls.Add( c );

Cheers

submit to reddit

Monday, May 23, 2005

Poking around in SMTP

A few years back, I had seen a mailer engine that spit out email messages in EML format. I found this engine to be extremely helpful because I could turn off the SMTP service, run the mailer-engine, and then manually inspect the messages in Outlook Express. If the messages were fine, I re-enabled the SMTP service.

At the time, it was clear that the engine was leveraging the CDO.Message object's ability to persist to a file.

Recently, I wondered if this was possible using the .net framework, but was dissapointed to find out that the System.Web.Mail.SMTPServer object only exposed the method "Send".

Enter Reflector.

The SMTPServer implementation is very interesting. Reflection shows that there are three internal classes:

  • CdoSysHelper
  • CdoNtHelper
  • LateBoundAccessHelper

As it turns out, the SMTPServer object acts as a proxy between the legacy COM objects, "CDO.Message" and "CDONTS.NewMail" -- it detects which environment you are using, then delegates the sending of the message to the "Send" method to the appropriate COM object.

What's equally interesting, is that the .net framework doesn't use COM Interop to talk to the COM objects. Instead, it uses the LateBoundAccessHelper to instantiate the COM object by it's ProgId, and then manually sets its properties and methods using Late Binding.

To stream my messages out into EML format I suppose I could use COM Interop to the CDO library, but that would mean I would have to package the interop wrapper (and its dependencies) with my assembly.

I'll have to take a look at extracting this code using a Reflector add-in, and extending the class to save to a file instead of sending directly. It'll be interesting if I can do this without adding an Interop wrapper to CDO. I wonder if there'll be any performance drawbacks in this approach...

yet another side-project...

submit to reddit

Saturday, May 21, 2005

The saga ends

At the end of Star Wars: Episode III Revenge of the Sith, everything wraps up nicely, making a decent bridge between episode III and IV. However, it's a surreal experience, to see the end of a saga complete itself in the middle.

So how was it? Prior to going to the show, everyone gave me one of two reviews. Either "Good, the first two were bad." or "Awesome, the first two sucked." Clearly the delta between good and bad and awesome and sucked or equal.

Personally, I enjoyed it -- or rather, parts of it. Unlike all other star-wars movies there seems to be a whole lot more story to tell: from Annakin's fall to the darkside and the dawning of Darth Vader, to the end of the clone wars and the death of the republic, not to mention the wrapping up of one trilogy and the segway to the next.

This bulk of multiple stories can't be told with action alone, so there's a whole lot of Lucas-style dialogue that has to find its way into two hours and twenty minutes. As result, I found it to be very fragmented -- only a few seconds of setup for a scene, some forced dialogue, followed by the traditional Star Wars "swipe" to the next story.

But it's done well, and clearly one of the lessons Lucas has learned since the last two films is the special effects are the vehicle, not the story. Revenge of the Sith uses the technology from the last two films transparently. There isn't a twenty minute Pod race, nor a pointless cgi character that doesn't seem like a ILM "show off". Yoda and General Grievous are done so well, you become absorbed by the complexities of their character rather than than their near-life-like representation.

All in all -- it may be Lucas's redemption for the Star Wars saga. I might even see it again.

Monday, May 09, 2005

Star Wars Episode III: Revenge Of The Sith - Review Digest

I nearly soiled myself while reading this.

Thursday, May 05, 2005

Star Wars III hype

The new star wars movie is upon us in a few weeks. I'm a little undecided.

I grew up as a star wars fan. I had all the toys, the books ... the works. Back then we didn't have VCR's, so the trip to the theatre meant your brain was on full record. I had known since I was a kid that there was supposed to be nine movies. I had played it out in my head what they were supposed to be about, and I always figured that the 9th one was where Darth Vader bit it. (Side rant: How surprised was I when Luke pulled Darth Vader's helmet off in ROTJ???)

Needless to say, I had some high expectations for Episode I. But I played it down, was cool about the whole thing. I remember sitting in the theatre, just before the show was about to start, and it felt like any other movie experience. But when the green lucas film logo faded and the bright blue familiar "far far away" catch-phrase started to fade it dawned on me... "I have no idea what comes next" and I was instantly 7 years old again.

The last two have been pretty disappointing. I don't need to go into the details of that. The whole thing seems like a bad car wreck, you don't want to watch but you're strangely compelled.

At this point, the trailer looks pretty good. Actually, the trailer looks *too* good. But still, Lucas could screw it up. After all, he's considered some sort of editing genius -- he could have given very specific instructions for the trailer crew, "Be sure to exclude all suck-ass parts".

You never know, Jar-Jar could show up with a light-saber screaming "Mesa using-da force!"

Please Mr Lucas, don't screw this one up. If you do, my enter childhood memories will be forfeit. At the very least, please tell me you hired a dialogue coach.

I'll show up with my brain set for record.

Even the bad guys have feelings...

The Darth Side: Memoirs of a Monster

Friday, February 18, 2005

Movin Madness

This month our client migrated their servers to another environment. When the actual date for the migration was upon us, it felt a lot like the Moving Van had arrived at the client's home and he was in his bathrobe frantically trying to wave it off for a few more days. For the most part, the server migration went fairly well, with some issues (big and small). I've outlined a few of them -- some of which drove me crazy. MSXML 4 - Access Denied We've got a neat little flash microsite that pulls an xml feed from an external site using classic asp. Interestingly enough, the simple ServerXMLHTTP method .Send() for a simple URL was returning an Access Denied error. Turns out, this is a feature of security hardening in MSXML4 SP2. I had to change the Local Security Policy, add the URL to the Trusted Sites internet zone in Internet explorer and REBOOT the server. Quite a bit of hassle just for a xml feed. Cannot resolve conflict in Collation Restored databases from the old production envrionment onto the new environment, and found that some applications weren't behaving as expected. When poking into the error, I found that i was receiving an error based on the current Collation (the language and sort order of the database) between databases were different. This was probably because the regional settings between the machines were different, and the databases that were created on the server defaulted to an incompatible. To resolve I had to: 1) Create a new version of the database with a different name 2) Use an ALTER DATABASE statement to set it to the desired collation. 3) Script the original database into a single block of SQL DDL statements 4) Remove all collation specific references on fields as the script would try and create varchar fields with specific collations. 5) Use a DTS task to copy the data from one database to the other, specifying in the task to Use Collation so it would adopt the collation of the target machine. 6) Drop the original database and rename the new version to reflect the original name. Cannot enroll in new Transaction Brilliant. Originally I asked the new hosting provider two months ago if they had any best practices on how to configure an environment with a firewall between the database and web servers. The only answer I received from their tech team was to use port 1433 -- which in lamens terms, is like saying cars need gas -- SQL always uses port 1433. The problem I knew we were going to have is when you actually try and use distributed transactions from the web server: there is a lot of communication between the web server and database -- way more than just port 1433. When I found out that they weren't aware of this concern, that should have been my first guess. I gave up that the hosting provider was going to make this easy for me, so I provided them very clear instructions on how I was going to configure DCOM to restrict the web and database servers to use specific ports. I clearly told them that once this was done, I would need two way (inbound/outbound) communcation on these ports. I outlined very specifically which ports i needed TWO WAY communication. When I recieved an email confirmation that they had opened the ports for TWO WAY communication, I politely thanked them and went back to the process of configuring my applications. When I received the unable to enlist in new transaction error, I was a bit suprised, but as I didn't have a whole lot of time to fully test the application in the new environment, I wasn't that surprised. I thought I might be having problems with incorrect registry settings, or name resolution, etc. It was about fourty minutes later, after double-checking my settings and reading knowledge base articles on this problem, that I discovered that the ports had been opened for the web server, but not the database. The email I sent the hosting provider, to which I attached my previous email with the clearly outlined instructions, retrospectively, wasn't that polite. I only wrote SOME of the email in ALL CAPS. (Incidentally, why is it THAT ALL CAPS LOOKS LIKE YOU'RE SHOUTING?????) Unable to convert varchar to datetime When I realized that the default regional setting of the server didn't really help, I went digging into the code. We had a form that collected the data in a very specific format: Please provide your date of birth (yyyy/mm/dd): At the code level, some very ancient asp classic code that was building the sql statement inside the script (terrible!!!) and opening the recordset with the target SQL. strSQL = "SELECT count(*) from myTable where DateCreated = ' " & Request.Form("TimeStamp") & " ' " oRs.Open strSQL, oConn Brutal. Here we're basically asking the SQL server to try and resolve the text into a datetime using the text format the user supplied -- if your SQL box is configured with a different time format, you're pretty much screwed. While writing inline sql inside your presentation code is considered extremely bad form, I can appreciate the developer's complaint that it's too much work to write a custom COM object just to write a silly database call. But if you have to use inline sql, you should at least attempt to use a stored procedure. If you so lazy that you can't write a stored procedure and you have to write inline sql because you're a toe head, then heaven forbid you write a few extra lines of code and use a parameterized sql statement, as so: strSQL = "SELECT count(*) from myTable where DateCreated = ?" Dim oCmd set oCmd = Server.CreateObject("ADODB.Command") oCmd.Parameters.Append oCmd.CreateParameter("TimeStamp", adDBTime, adParamInput, 8, Request.Form("TimeStamp") ) oRs.Open oCmd, oConn, 1, 3 Although it's a couple extra lines, I sleep better knowing that ADO will take care of the datetime format conversion.

Sunday, January 30, 2005

What time is it?

One of my current projects involves relocating my client to a new hosting environment. This is proving to be a challenge as I don't really know the application that well, yet. The code is hybrid asp/.net, and one of the bugs that is totally driving me crazy is actually date formatting. The old server environment was configured with English US as the default locale, whereas the new environment is English Canada. As a result, I have a few database inserts that are using VBScript's Now() function to write the current time-stamp. (Not exactly why the database isn't providing this functionality -- but that's another problem). What's odd is that I changed the default locale, but wasn't seeing any changes in the old asp code -- the date format was still wrong.... I had changed the regional settings (or at least I thought I had) and couldn't figure out why I was seeing the proper date format from the command-line but not in asp. The glaring mistake I made was that I had missed the "Set Default" button at the bottom of the control panel. If you forget to click that -- then you're only applying changes to the current user profile. The link for this article points to a ms kb article on some new options for the regional settings for w2k sp2+. I'll come back to that if it proves to be a problem with my .net code.

submit to reddit

Wednesday, January 19, 2005

the countdown goes askew!

Lori and I have been counting down the days to our house closing on a chalkboard in the kitchen. Our real estate agent just called us and asked how we felt about moving the closing date up by a month! I'm all for moving in early, but we've already paid for our March rent. We're trying to figure out a way to maximize our move-in time while minimizing the money going out.

i'll have a low-fat soy half half-caf-decaf-cappucino with a lime and a twist

If code is half-science and half-art, then this is either code reflecting life, or geeks seeing code when ordering coffee.

Tuesday, January 11, 2005

svn up

Over the last year, our organization has been migrating our version control systems to subversion. Man, what a ride. Previously, I've grown accustomed to Visual Source Safe, which when looking back seems like -- well, for lack of a better term, like sticking your code into a shredder and setting it on fire. While it does have it's advantages (it doesn't require any brain-power to use) -- it doesn't do complex things well, if at all. If you go down the path of pushing the envelope and try to make it behave like an enterprise version control system, ... it'll bite back. hard. Am I surly? Sure, why not. Unfair? Well, you try repairing a 3 Gig corrupted vss database and call me unfair. Subversion is a far cry from the simplicity of VSS. It's command-line utilities only (there are open-source GUI's, but I haven't heard any good things), the concepts are radically different, and it doesn't plug into the IDE. I'm not complaining -- these are advantages. Subversion requires you to think differently about what you consider source-control. Gone are the days of my team complaining that they "...can't work on that file because it's currently checked out." At any rate, I won't be going back to VSS any time soon. I'm sold on subversion. Coupled with Cruise-Control.net, we've got a pretty sweet development-integration cycle happening. As of late, I've switched projects recently, a form of promotion if you want to call it that, and I'm now responsible for a large account that pushed out about 62 projects last year. This means we are branching and merging in subversion all the time. At the rate we're going, I'll be a subversion guru in a week....

submit to reddit

Thursday, January 06, 2005

Pluggable Architectures with Provider Models in .NET 1.1

Lately, these articles have sparked a lot of interest within our app dev group. Provider Model Design Pattern, Part 1 Provider Design Pattern, Part 2 I had a client that was experiencing problems with their monolithic application, in that they were adding microsites to their site on a weekly basis, and found that they had to recreate the wheel for their application framework for each microsite. At one point, they had up to 20 different assemblies referenced for each microsite. In addition, they wanted to keep the Personal Information in their production database private, thus they didn't want to hand out their schema or access to their database. On top of that, they had a multitude of 3rd party vendors who supplied code to them. Each had their own set of coding standards and beliefs about the application's responsibilities. Including us ;-) We looked at building an abstract framework that all the code would reference. The trick was to make everything extremely generic so that it could be 100% transparent to the developers. This meant pushing code out of base classes and into an abstract version in the framework, or out of the project entirely and into HttpModules. The abstract framework tied to concrete providers, as in the msdn articles above, and allow third party vendors to write and use their own providers for their own environments, and allowed the client to use the same application-framework for multiple small-to-large size applications with different configured providers. I've found these links useful, so I'm posting them here so that I can find them when I need them, but if you stumble upon them, maybe you'll find them useful.

submit to reddit

Wednesday, December 22, 2004

Some handy registry hacks

I found this handy link on Dave Wanta's blog regarding registry hacks. I especially love the command line autocomplete registry hack. I've recently adopted Subversion as my primary version control system, and have found that the command line is the best and only way to go. Having autocomplete at the command line is extremely handy.

submit to reddit

Thursday, December 02, 2004

Buying a house in Toronto - Part IV

Wow, part IV, like it's "A New Hope" or something... So with offer in the works, our agents worked furiously trying to contact the seller's agent and to setup a face-to-face presentation of the offer. The idea is that it's harder to laugh in someone's face than it is to a piece of paper. Once the offer is set into place, if accepted, we only have five days to get everything sorted out: financing, insurance, lawyers, house inspection, etc. So we spent most of the day trying to get a jump on all that paper work. Our agents managed to co-ordinate a face-to-face meeting for around 7:30... so the plan was to meet a nearby restaurant, sign some more formalized documents (a zillion times times four), and then have dinner while they negotiated. However, when we arrived at the restaurant, the seller couldn't contact his wife in time, and she went somewhere with their kids for a few hours. Since they both owned the house, they both needed to be there. She wasn't expected home until around 9:30. All this meant was that our pins-and-needles tension would only be dragged out longer than we expected. We had dinner, went home and sat by the phone and waited. Around 10pm, the phone rang. There were a couple things that had to be hammered out, ranging from the price to the alarm system. They had come down a little bit in the price, which was expected. Interestingly, they were waiting to sell the house before they started looking for a new home -- so they wanted additional time on the closing date. As first time house buyers, this was to our advantage. Now the ball was in our court; we only had an hour to decide. We could come up as much as they had come down, and that could go two ways: we would probably have another round of back-n-forth, or it would piss 'em off and they'd refuse our counter-offer. If we could pick the right psychological number, they'd be more inclined. We came up to the lower half of the halfway point, pushed the closing date out.... and waited for our agents to call us back. Around 11:30, the phone rang again, the offer had been accepted. According to our agents, the husband wanted to sell the house and his wife didn't. They hadn't begun to look for a house yet, and were waiting to see if they could sell the house before Christmas. As soon as the offer was accepted, she went white as a ghost and began to ball her eyes out. The only thing left was the house-inspection...

Buying a house in Toronto - Part III

As we returned to the city from our weekend getaway, we decided to take another route and do a drive by on the semi to get a better feel for the surrounding neighbourhood. Turns out, there were several more houses for sale in the general area. When our Agent called us the following afternoon, they had already looked at eight other homes that were listed. "Zero for Eight" -- all weren't even worth looking at. So we gave our agent the list of additional homes we looked at, and they went to work trying to set up appointments. Since the houses were in the same neighbourhood, we'd start at the semi and go from there. The asking price for the semi was higher than the farm house, but after taking a long second look, Lori didn't want to look any further. Although slightly smaller in size, it would not require any rennovations whatsoever and it had a spacious garage connected to a shared laneway. So we stopped, and decided to find a place to talk about it. We somehow found ourselves at the scummiest coffee shop in the seediest area. The working girls and drug dealers turned tricks while we sat inside and talked. We found out later that a new shopping mall with a more reputable coffee shop had plenty of room only a few blocks in the other direction. Oddly enough it didn't bother us. After some long discussions, my reservations with the place were put to bed, and we decided to put in an offer. It's funny how my negatives about the house seemed to disappear when we spoke of putting the offer in nearly 18K below their asking price. In Toronto, most of the houses sell well over the asking price, and that's mainly because of bidding wars, etc. However, this time of year is the best time to look mainly because no one wants to look / move / sell during Christmas, and in some cases, the market drops dead around Christmas and starts to pick up again around February. Once February rolls around, the prices start to inflate dramatically. So it was now or never. We put together the offer, listing all the items that would be included and excluded in the house, and any addtional conditions we could think of. Then we had to initial the documents in about a zillion places. We took a risk and decided to make our offer below asking price, and so that the seller wouldn't get pissed off, we took the appliances out of the offer. ... we were sold, but the question on would the seller agree to our conditions?

Wednesday, December 01, 2004

Buying a house in Toronto - Part II

After a few weeks of driving around and getting a feel for price ranges for neighbourhoods, we called up the Agents we worked with last year. They're a husband and wife sales team, great people, and parents of a friend at work. The tag team duo works well because they split up in the mornings to cover more ground. By mid-afternoon, they've narrowed the search down to a few good candidates. There's a whole range of emotions that you go through with each house, and each one is wildly different. On the outside, some look like solid homes with lots of potential, but the inside fill you with terror that they'll collapse at any second. But the personal favourite are the houses that have that 15 degree slant to them, and the brand new kitchen they've installed to distract you from the slant has been custom fit on that angle. What we didn't expect, was that we would find a house we liked on the first night out. In fact, it was the second house we looked at. It was a detached three bedroom with formal dining and living rooms and finished basement, built in 1913. It had amazing character, completely rennovated to retain the original charm of the home and within our price range. Only drawback: it was a bit further north than we were accustomed to, in a neighbourhood we weren't crazy about, and no parking. Everything we looked at after that, was compared to this home. We went back for a second look, and aside from the neighborhood, we were sold. Another house, a few blocks south, was the complete opposite in character and charm. It was probably 65 years old but the owner worked in construction. He had spent the last 13 years rebuilding the house from the inside out, and had furnished it with top of line everything. On top of having a laneway in the back, he had build a two car garage with ten foot ceilings-- an oddity in the Toronto market. The craziest part of the house was the fact that the current owner's tastes were ... how to put it... ok, awful. The house was uncomfortablely crammed with tasteless junk, almost garish, and it made it difficult to see the value in the home. A few days later, convinced we were interested in the old farm house, we took the Friday off and spent the morning driving around in the neighbourhood. There's lots of construction in the neighbourhood, new condos and townhomes going in -- the neighbourhood is sure to change over the next five years, but still, we weren't convinced. Lori wants to have kids, and she couldn't picture herself taking the stroller out by herself. We were out of town for the weekend, and gave us some time to think about it. The more we thought about it, the old farm house would eventually need work, and somethings just weren't going to change.... ... could we trade the warm detached farm house filled with books and landscaped perrenial gardens for the garrishly decorated semi (complete with disco ball) and two car garage?

Buying a house in Toronto - Part I

Last year, after the initial fuss of our engagement had settled down, Lori and I decided to buy a house. As house prices are high, the price tag of a wedding and a house purchase seemed prohibitive, so we thought we might buy a house and throw the wedding there. It didn't take long for our optimism to fade, and we quickly became very discouraged. Discouraged doesn't come close to describing how messed up buying a house in the city actually is. So the dilemma is: do you buy a house in the city and pay through the nose; or do you save your money and buy a house outside of the city and spend all your free time commuting. Personally, I enjoy sleep too much to have to get up early to take commuter trains, and I love the fact that TTC allows me to come and go from work to home as I please. Buying a house in the downtown area borders on madness. The houses you can afford either have three kitchens in them and require major renovation to make the space livable, or they are so small that it would be a complete change in lifestyle. Finding a balance between them is difficult, and often is a matter of timing more than anything. The problem Lori and I currently have, is that the neighbourhood and apartment we're currently in is amazing. Well, at least we think it's amazing -- we may look back years from now and have a good laugh at it. In short though, we're in an $800K home in a $800K neighbourhood. Anything that we move to will be a step down: two bedrooms, two dens, two bathrooms, large spacious kitchen, large master bedroom, patio, backyard, private parking, all utilities included and about 100 feet from transit. We really wanted to buy a home in our neighbourhood, so postponing the purchase allowed us to save a bit more for a down payment. So, a few weeks ago we started up the house hunt again. This time, we spent a couple weekends driving around, trying to get a feel for the surrounding neighbourhoods. We saw lots of listings in our area, and we looked them up on MLS, but quickly discovered that even the smallest dumps in our area were beyond our price range, and if we could afford it, we'd be burying ourselves so far under that our lifestyle would exist to support the house. We made a trip out to the east end of the city, which is popular for first time home buyers. The east end of the city is completely foreign to us, and to make matters worse we were driving around the east-end on a weekend that the Don Valley Parkway was closed for maintenance. We spent nearly an hour on Queen St East, and got a really good whiff of the garbage processing plant. Unfortunately for the east end, we resolved that we were not east end people, despite how pleasant everyone makes it sound. We decided to focus our search in the west end of the city, just outside of the downtown core. We expanded our search area to our surrounding neighbourhoods, compromising on the location for price. .....