Thursday, September 25, 2008

I've Moved

Nothing against blogspot, but I've moved on.

Please check out my new site at riathoughts.com. I'll continue blogging about the same kinds of things I have been, just doing it within a new structure. I'll also be focusing a little more on RIA topics in general, not just Silverlight.

Those of you that subscribe to my feed should still get my updates but I encourage you to switch over to the new feed.

The new site is still a work in process but it should allow me to do a lot more than I've been able to within this environment. Thank you all for supporting me and I hope you will move along with me.

Monday, July 14, 2008

What I did on My Summer Vacation

So it's not so much did as still doing but here's just a little update on what I'm up to at the moment, it's quite a bit.

Moving

moving Many of you already know this but I am in the process of selling my house and moving out of Ohio.  It is with mixed feelings that I do this as I have really come to love the emerging sense of community in the Cleveland development arena and the help we've had in building it from the twitter tribe.  On the other hand I'm taking this opportunity to move to anywhere I want, anywhere at all. 

I've been searching for a specific type of company for the last several months and finally decided on one that I feel is a perfect for for me at the moment.  I'm not going to say who yet, I don't want to jinx it, but it's a great web firm out of Seattle and they are flying me out for an in-person interview in a week or two.  I've already had a couple phone conversations with them as well as did a "home work" coding assignment.  So far it would seem like they like what they see, I know I do.  This is a great chance to be a full time Silverlight developer, and I'm more than a little excited at the prospect.

As part of this process we're also selling our house.  If you've ever sold a house before you know how much work it is getting and keeping everything perfect.  It's not a great market to be selling a house but we're optimistic that we'll get an offer soon.  We hope so anyway.

Writing

campbell_cover150 The writing on Silverlight 2 in Action is still ongoing.  I now see how much effort goes into the writing of a book.  There is probably a hour of research and coding for every five minutes of actual writing.  We are waiting until the release candidate comes out to finalize everything but I still have a ton of work to do even before that.  It's all worth it though.

It is known among people that teach or present that committing to do one of those actions is a good way to learn a technology.  I would argue that writing a book is even better.  You have to ensure that you know the material good enough to stand up to the criticism of peers, and trust me, we can criticize quite well.

Speaking

microsoft_silverlight_c Remember a minute ago when I said that presenting is a good way to learn a new technology?  Well, watching a presentation can be a good introduction as well, so come watch me talk.  I'll be the speaker at the August 12th meeting of the Cleveland .NET SIG.

Here's my abstract for the talk: Now that most people know that Silverlight can do fancy animations and play videos, lets look at how to make it do some real work.  In this presentation we will demonstrate connecting to web services, using returned data, binding data to controls and discuss some limitations Silverlight currently has.  And of course, since it's Silverlight, we'll try to make it look good in the process.

Coding

stacked_small_slbc_08 Hopefully you have all heard about the Silverlight Control Builder Contest by now but if not, head over there and read up on it now.  Basically, you build a templateable custom control, submit it to the contest, and win prizes.  Well, you can try to win prizes anyway, a whole bunch of other people will be entering as well.  The prizes are getting better and better and include books, software, gift certificates and more.  Wait a second, the more people that enter the less my chances of winning.... Never mind, don't enter :).

How to Learn Silverlight

image001_low With a lot of people wanting to learn Silverlight today and not really knowing where to start, I thought I'd write something to help people get started.  This is not meant to be better than Jesse Liberty's version of the same thing, just a different take on it.

  1. Go read my post titled What Is Silverlight.  This should give you enough of an overview of Silverlight to make sure that it is what you think it is.
  2. Install the tools at http://silverlight.net/getstarted.  This will give you everything you need to begin building Silverlight applications.  Don't forget Expression Blend, even if you are not a designer some things are just a lot easier using Blend.
  3. Watch a couple "How Do I" videos on getting started and any other topics that interest you.
  4. Work through a QuickStart.  These expose you to programming numerous areas of Silverlight.  Feel free to just read the sections you need, when you need them.
  5. Build something.  It doesn't have to be original, fancy or even work well.  Don't even show it to anyone if it doesn't turn out looking quite right, but build something.  Pick an idea like a weather widget or an ad rotator or get adventurous and build a simple little space invaders style game, anything just BUILD something.  Using it is the best way to actually learn any technology.
  6. Don't be shy.  Use the forums at http://silverlight.net/forums whenever you run into a stumbling block.  I would encourage you to attempt a search of the forums first though since if you are having trouble with something, someone else probably has as well.
  7. Read a lot.  Everybody and their brother is blogging about Silverlight.  A simple Google search will turn up information on nearly anything you can think of.  A good place to start is to subscribe to the Community blog aggregation feed from Silverlight.net.  Also be sure to catch Silverlight Cream as Dave Campbell does a great job of aggregating all the Silverlight posts he can find into a nice, searchable site.
  8. Push yourself.  Commit to doing something that you don't know how to do yet but know is possible.  There are a lot of options in this arena:
    1. Build a prototype for a work project
    2. Give a Silverlight presentation to a local user group
    3. Write an in-depth technical blog post
    4. Enter a contest.  At the moment I know of the Control Builder contest, an article writing contest and INETA is supposed to be starting the Silverlight Challenge soon as well.

I know that everyone has their own individual style and pace of learning but hopefully this will point you towards the path of [Silver]enlightenment.

Friday, July 11, 2008

What Is Silverlight?

image002_low I've noticed lately that a lot of people seem to have misconceived notions of what exactly Silverlight is and does.  I will attempt to explain what Silverlight is and how it fits into the web spectrum in language that even your boss will understand.  What I won't do is try to tell you when you should or shouldn't use Silverlight or how to build specific applications using it, those are topics for other posts.

If you have built a little prototype app in Silverlight, and certainly if you have done more than that, this post is not for you.  This post is directed at those that have heard of Silverlight, think they might know what it is and would like to know if it fits their needs.  It is also a good post to read to get a good general understanding of the way web development works.

Terminology

IIS, Apache, etc.  These are web servers.  They accept the request from a client browser and return the appropriate response.

PHP, ASP.NET, PERL, JSP, Cold Fusion.  These are all server technologies.  They execute on the web server itself in response to requests from a client, typically a web browser.  They typically output HTML. 

MySQL, SQL Server.  These are the databases, they also are located on a server.  Typically the web server technology will have a method to connect to the database.

HTML, JavaScript, AJAX, Silverlight, Flash.  These are all client technologies.  They execute from the web browser itself.

SOAP, WCF, REST.  These are all types of web services.  Typically these are created on a web server to expose data and logic to outside applications.

XML, JSON.  These are data formats.

Where Silverlight Fits

As stated in the previous section, Silverlight executes in the client browser.  What does this mean? It means:

  • Silverlight applications need to be hosted on a web server
  • Silverlight does NOT need to be hosted in IIS, any web server will do
  • Silverlight does NOT need ASP.NET on the server
  • Silverlight applications cannot access databases without an intermediary (like a web service)
  • Silverlight applications cannot access server-side classes or variables without an intermediary (like a web service)

Silverlight also can run on any major browser (Internet Explorer, Firefox, Safari) on any major OS (XP SP2, Vista, OSX, Linux).

Programming Silverlight

Programming Silverlight applications can take many forms.  This is due to a number of items. 

First, the plugin contains a limited version of the .NET framework.  What this means is that you can write real, compiled and managed code that executes in the context of the client browser itself.  What it doesn't mean is that you have access to the full framework.  There are a lot of areas of the framework that are missing completely, like System.IO and others that are present but are missing features, like no ArrayList for instance.  It also doesn't mean that you can build reference an already existing class library from your Silverlight application.  You can still use class libraries but they must be compiled against the Silverlight version of the framework.

Silverlight also introduces what is known as the DLR, or Dynamic Language Runtime.  This allows you to write code in non-traditional .NET languages such as IronPython or IronRuby.

Silverlight Versions

The most current version of Silverlight that is in full release is Silverlight 1.  Silverlight 1 is very good at displaying Media (audio and video) but it's lack of controls and reliance on JavaScript as the only programming language, introduce numerous limitations.  For a first generation plugin though, it isn't bad at all.

Silverlight 2 is currently in it's second public beta and is due to be in full release this fall.  It also contains a full commercial "go live" license, which means that you are permitted to use it to build real production, money-making applications with the Beta version.  Silverlight 2 introduces the .NET framework to Silverlight along with the DLR and a rich control set.  The majority of applications being built today are using Silverlight 2.  With all of the advances in Silverlight 2 combined with the go-live license and the short timeframe until the full release, building anything in Silverlight 1 today seems wasteful to me.

Silverlight and WPF

Silverlight is a limited subset of WPF, both of which use XAML as their markup language.  This allows for several things, such as the shortening of the learning curve when moving from one to the other.  It also means that typically, if you develop an application using Silverlight, it can normally be ported to run as a WPF desktop application with minimal effort.  Moving the other direction however, from WPF to Silverlight, can be more troublesome due to the greatly increased .NET framework and control set in WPF.

Silverlight and ASP.NET

ASP.NET and Silverlight overlap in some of their capabilities, but Silverlight is not a straight replacement for ASP.NET.  Since code written for ASP.NET executes on the server it has access to the entire .NET framework, can use connection strings to access databases and can use any number of third-party or internally generated class libraries.

Even on the client, there are times when you may want to stick with ASP.NET over Silverlight.  If you have parts of your application that are nothing more than data-entry forms, the standard ASP.NET controls are very well suited to that kind of work.

Silverlight and Flash

Everyone has heard talk of Silverlight being Microsoft's "Flash Killer".  Personally, I do not think that is the intention or even goal of Microsoft when it comes to Silverlight.  I believe that they (MS) saw a way to add more interactive capabilities to web applications in a way that is friendly to .NET programmers.  I see the emerging RIA space as being plenty large enough for Flash/Flex, Silverlight and even a few others.  Yes, they both do many of the same things and yes, Flash may do some of them better currently.  But give Silverlight some time to mature and you will see much more feature parity between the two.

Silverlight and AJAX

Built into the Silverlight plugin and SDK are numerous features that perform the same functionality as that provided by AJAX, but with the need to write complex JavaScript.  Silverlight has very rich support for reading data of numerous types from web services to RSS feeds to static XML files.  It also has methods to facilitate the deserialization of XML or JSON into strongly types objects for simple manipulation and binding.

Finally

Hopefully this post has helped answer some of your questions as to what Silverlight is, what it isn't and where it fits into the web space.  If you have more questions or want to correct me on something I may have mistyped, please leave comments here or use the forums at http://silverlight.net.

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.