Thursday, June 19, 2008

Silverlight 2 In Action - I'm Writing a Chapter!

So as you all know I've been posting a lot about Silverlight lately.  Well not recently as I've been a tad busy.  I've been quite lucky to get to work on Silverlight at my day job which has greatly increased my knowledge of it in a short time.  I've also been pretty active in sharing the knowledge I've gained with other developers through this blog, live presentations and the forums at silverlight.net

Apparently all that effort was noticed because a couple weeks ago Chad Campbell asked if I would be interested in writing a chapter for Silverlight 2 in Action.  Well, of course I jumped at the opportunity.  Oh, and he needed the chapter written in less than two weeks.

Having never written a book before I had no idea how much work it was.  I knew two weeks was aggressive but wow.  I've spent pretty much every waking moment since the evening of 6/9/08 either at my regular job or sitting at my laptop writing.  Who knew that writing could be so tiring?

The chapter I'm writing is Chapter 6 - Networking and Communication.  This means that I have to write a ton of code samples, make sure they all work and then boil them down to just the parts that are needed.  There is a lot to this chapter too.  I've been writing about things like duplex WCF services, transferring JSON data from REST services and, of course, clientaccesspolicy.xml, everyone's favorite file :).

With the chapter almost wrapped up I should be able to start writing informative blog posts again, I've got a couple ideas for posts that should be pretty helpful.

One last note, Manning Publications has a program called MEAP where you can get the rough draft of the book in PDF form before it is published.  That means you can actually go buy a real Silverlight 2 book today!  Don't worry, you will also get the PDF (or print version if you prefer) of the final book when it is published.  You can get to the MEAP version of the book here.

Well, I've got to get this chapter done before the editor hunts me down :).

Friday, June 6, 2008

Silverlight Installation on Intranet Hosted Applications

Silverlight_Logo_thumb A few months back Tim Heuer wrote up a great post on customizing the Silverlight installation experience.  I highly recommend reading his post and doing something similar in your own applications, it can really make the user experience better. 

What I'm going to discuss builds on what Tim already wrote so go read his post first if you haven't done so already.  Don't worry, I'll wait.

The Problem

Welcome back.  I was recently presented with a situation that isn't exactly common, but is not so unusual that no one else will experience it, in fact, some of you may be working on this right now.  The situation I was presented with is we are building an ASP.NET application that contains a Silverlight application and is installed at client locations via a installation CD.  At some of the installed locations, end user PCs that will use the application don't have access to the outside Internet.  So how do we install the Silverlight Plug-in if the browser can't access the Microsoft download site? 

Hopefully the corporate IT department will have already pushed the Silverlight plug-in to all PCs in the enterprise.  There was a nice white paper put together last year explaining different approaches for doing just that.  Unfortunately, we all know that many IT departments are slow (or reluctant) to install new software, which is why we have this issue.

Since the application is installed in numerous locations from a single installation CD, we don't know the environment it will be installed in, so any solution had to handle cases both with and without Internet access.  After attempting numerous approaches I came up with something that is so simple and elegant I felt a little stupid for not coming up with the answer hours earlier.

The Solution

The first step is to ad the latest version of the Silverlight Plug-in installation .exe in your web app.  You could just point your installation link to that exe and call it done but that's an easy way out.  It would be better to have the user install directly from the Microsoft site to ensure it is the latest version that gets installed.  So what we needed was a way to determine if the users browser can access the Microsoft download site and then install the runtime from there if available or from the intranet application's web server if MS is not reachable.  This is actually quite easy.

There are two parts to the solution:

Object Tag

As Tim stated in his post, you can put quite a bit inside the object tag that hosts your Silverlight app that doesn't get rendered if the browser has Silverlight installed.  In this case I kept it very simple (basically the default object tag).  All I changed were the location the image gets loaded from and the destination of the link.  The image is now coming from the current application and the link points to a JavaScript function, which you will see next.ObjectTag

JavaScript

The JavaScript is also easy.  You will notice that the first two lines are not inside a function declaration, that means that they are executed as soon as the browser parses them during page load.  What those two lines are doing is attempting to load an image from the Microsoft.com download site.  Those of you with much web experience will notice that this is the technique we use to pre-load images for rollovers and similar effects.

The function then, which is called only if the user doesn't have Silverlight installed and clicks the "Install Silverlight" link, checks to see if the image was successfully downloaded or not.  If the image is present it means that the user does indeed have access to the Microsoft download site and directs the browser to the correct location and if not, directs them to the exe in the Intranet application.

JavaScript

Finally

As you can see this is a very simple way to make sure that users of Intranet hosted applications can still get the Silverlight plug-in, even if they don't have Internet access.  If anyone else has similar tips please pass them along.

kick it on DotNetKicks.com

Thursday, June 5, 2008

How I got started in software development

So a twitter friend, Michael Eaton, started something that sounds like fun, and before I could get my answers posted a few others have as well.  So here it is, the Reader's Digest version of how I became a programmer.  Please post your own answers as well, this is a fun way to get to know each other.

How old were you when you started programming?

I think I was about 13 when my dad bought a TRS-80 Model III.  That awesome machine had dual 5 1/4 floppy drives, 48k (yup, 48k) of RAM and no hard drive.  I learned BASIC so I could program simple little animations and things.  The only problem was that if you forgot to boot from a floppy, the drives weren't initialized and you would have no way to save the tiny program you just spent hours coding.  I don't miss those days.

How did you get started in programming?

I don't know, maybe I was always a big dork? :).  I learned it as a teenager since it was the newest thing around, I think that even at that age and time (would have been around 1984) I knew that computers were going to be big. 

In college though I spent the first couple years as a History major, not taking a single programming class.  I did have a laptop though, which was unusual in 1995, and do simple desktop publishing and stuff for friends at the coffee shop.  Finally after the 100th person asked me if I were a computer science major I realized that maybe I should be.

What was your first language?

That would be BASIC, not QuickBasic or Visual Basic but plain old BASIC.

What was the first real program you wrote?

The earliest real program I can remember was a phone number database built using VBA on top of Access.  It was for a small college where I was doing tech support and started as a way for the switchboard operator to have quicker access to find the correct numbers.  Eventually I even built a web interface for it and added it to the school intranet (which also didn't exist before that).

What languages have you used since you started programming?

Lets see (I'll be generous in my definition of language to make the list longer :) )

  • Basic
  • VB
  • C++
  • Java
  • HTML
  • JavaScript
  • VBScript
  • BHTML (Who out there know where this comes from?)
  • XML
  • C#
  • XAML
  • ANSI SQL
  • T-SQL
  • PL/SQL

I know I'm forgetting some but that should be most of it.  I know that some of those aren't 'real' languages, but they seemed to fit for this list.

What was your first professional programming gig?

At the college I mentioned above I ended up doing quite a bit of programming of little utilities and the school website but I was never officially a programmer.  It wasn't until 1999 and I was hired by a web design/consulting company called Mozes Cleveland & Company.  That company grew like mad, had a ton of clients and promptly went out of business in the summer of 2001, like so many other companies of it's type.  I still think fondly of those days, they were fun.

If you knew then what you know now, would you have started programming?

YES!  Six months ago I don't know if I would have had the same answer but two things have really rekindled my programming spirit: Community & Silverlight.

If there is one thing you learned along the way that you would tell new developers, what would it be?

Never be satisfied.  Always work actively to improve yourself and your code.  Never consider a project complete until your manager tells you to stop, it can always be made better.  Never stop learning, complacency is what lets you get passed over and allows boredom to set in.

What's the most fun you've ever had ... programming?

I actually already wrote about this one in a old post.  Basically being sent to the Netherlands, working on a truly international team and writing some cool code, nothing else has come close... yet.

Wednesday, June 4, 2008

Cleveland Day of .NET 2008 is History!

ClevelandDODNOn Saturday, May 17th, we held the first Cleveland Day of .NET and it was, from all accounts, a success.  It sounds like everyone had a good time, met a lot of new people and learned about technologies they would not have been exposed to in their normal jobs.  This is exactly what we were trying to accomplish.

How it got started

All of this came about because a few community members were talking on twitter about Cleveland needing a Code Camp or something similar and deciding to do something about it.  Myself, Sarah Dutkiewicz and Michael Letterlie, none of whom new each other in person, decided to create this.  A few days later was an ArcReady where Joe Fiorini and Corey Haines also joined in.  By the time we had our first meeting Sam Nasr was also an organizer and by the second meeting, Mike Slade was with us as well.  From the very first meeting, where most of us actually met each other, until the Cleveland Day of .NET took place was just under three months.  This group of people pulled off a great conference without any of us having done anything like this before.  If you see any of these organizers out in the community, thank them, they all deserve a big congratulations.

A Good Day

In the weeks since Cleveland Day of .NET I have heard directly and indirectly from many people that all say it was a good event.  Sponsors, speakers, attendees and organizers alike all feel that it was a good day.  Of course there are things that can be improved upon for next year, that is true of any event, but the day did accomplish what we set out to do: Provide a locally hosted developer focused event for fellow developers.

Thanks!

In addition to the people that worked so had to pull this together, plenty of other people are deserving of our thanks.

Speakers

When we were first organizing this, we dreamed big but were skeptical of getting very many speakers.  We were wrong.  After deciding on time and tracks there was room for 24 sessions and 4 vendor sessions.  When we placed the call for speakers, hoping to get 24 good responses, we had almost 50 talks proposed, it ended up being quite a task to trim that down to the 24 that we had room for.

Some drove long distances, some spoke at very little notice, some were speaking in front of a group for the first time.  All of them did it completely for free, no gas money, no free hotel.  Ok, so some of them may have just come for the opportunity to drink with fellow geeks :).

Please thank all of these speakers when you see them around:

Community

Without the support of the local development community this event would have been pointless.  Both of the relevant user groups, the Cleveland C#/VB. NET SIG and the Cleveland .NET SIG helped to spread the word and offered any support we needed.  The community members that attended put up with the narrow hallways, lack of lunch and no good meeting place yet offered nothing but praise.

Sponsors

There was also a lot of support for Day of .NET from local companies as well.  Without the generous sponsors all the effort put in would never have been enough since it always ends up coming down to money.  We had a great bunch of sponsors that all were very supportive and adaptable, even when we weren't sure what we were doing.  If you would like to thank them yourself (and please do) here they are:

We also had a number of companies donate books, software and swag to give away:

Finally

It's all over now, we're all finally caught up on rest and back to life as normal.  But let's not let the momentum die, we've started something here, lets keep it going.  And I'll see you in the community.