Spaghetti Code Interviews Aaron Erickson on LINQ and MetaLINQ

1/31/2008 11:02:00 PM
I sat down with Aaron Erickson of Magenic Technologies and talked to him about LINQ and his own pet project MetaLINQ.  Aaron talks about why LINQ is important and some of the things he is doing to extend the power of LINQ to other areas.  You can get just the audio download here.

Double-click for Full Screen



Enough is Enough - Too Many Award Shows

1/29/2008 5:50:52 PM

How many award shows do people in movie and television need?  Not only do they need a lot of them, apparently, but they need to televise all of them.  We have the Emmy's, the Daytime Emmys, the Oscars, the Golden Globes, the SAG Awards, the People's Choice and a few others I am probably forgetting.  That is not even listing the half dozen different award shows for music.  OMG!!!!  Talk about narcissism at its worst.  The thinking must go something like this,

Hollywood Type #1:  "You know, we are great."

Hollywood Type #2: "You are right!  We should have an award show to tell our people how great they are."

Hollywood Type #1: "That is a great idea.  It's so great, we should have at least seven award shows that basically give the same awards with different names to the same people!"

Hollywood Type #2: "Outstanding!  And we can let each of those people spout inane babble, empty platitudes, and irrelevant social and political commentary when they get their awards!  And we can put it all on TV!!!"

Hollywood Type #1: "Excellent!  Let's do it!!!!  Ummmmm, what does platitudes mean?"

I guess the only thing sadder is that the American public tunes in to enough of these shows in sufficient numbers to make them financially viable.  If you are a movie buff or TV buff then I guess I can see you being interested enough to watch one show.  Apparently its a big deal for a certain gender that is not male to tune in to see what everyone wears to these preen-fests.  But six plus shows?  Come on, get a life already!  And I'm talking to both sides of this sad situation.


Junk | Rant

ScottGu Covers What's New with ASP.NET App Deployment with VS 2008

1/29/2008 10:23:50 AM

Instead of summarizing, just check out Scott's very useful post and associated links.


Slick Thoughts

Programming LINQ and ADO.NET Entity Framework WebCast

1/29/2008 1:08:33 AM

From the ADO.NET Team Blog

Check out our upcoming webcast by Mike Pizzo on LINQ and the Entity Framework.

Programming LINQ and the ADO.NET Entity Framework
Summary: Language Integrated Query (LINQ) introduces an exciting new way fo applications to build strongly typed queries that are deeply integrated into the programming language. The ADO.NET Entity Framework allows applications and services to work in terms of an application-oriented Entity Data Model, decoupling the application's data model from the storage considerations of the relational schema. Join this webcast to see how these two technologies work together to change the way applications work with data.

Date: Wednesday, January 30th, 2008
         11:00 AM Pacific Time (US & Canada)
Language: English-United States
Recommended For: Developers
If you are interested in registering for the webcast, you can sign up here



Library of Congress Gets Silverlight

1/29/2008 12:29:45 AM

A buddy of mine that still works in the DoD sent me a link to this article.  Looks like the LoC will be making some of its historical artifacts available online via Silverlight.  No word on what exactly will be accessible via cyberspace, but it is cool to see Silverlight being used to make some important parts of history available.


Slick Thoughts

Interview with Mr Code Camp, Jason Bock

1/22/2008 11:41:46 AM

jason Way back at the last Twin Cities Code Camp, I had the chance to sit down and talk with Jason Bock about the Code Camp, developer communities and more.  It was a great interview, but due to poor lighting it took me a while to finally figure out how to use my video editing software to get the video to look good enough to not be annoying (thanks Dan!!!).  So at long last, here is that interview.  It weighs in at just over 14 minutes so it's too large to go on Silverlight Streaming.  You can download the video here or get just the audio here.

Make sure you check out the upcoming Twin Cities Code Camp (April 5th, 2008) and sign up now!


Headlines | SpaghettiCode

Heading to MIX 08

1/21/2008 4:17:55 PM

blings_9_25_d I got lucky and will be one of the field Microsoft people that will be heading to MIX this year.  MIX has become one of my favorite Microsoft conferences for its interesting mix (pun intended) of content and attendees.  Designers, marketing types, business folks and developers all get together for a few days to look at the next web.  Of course, MIX has also had its fair share of tech announcements from Micrososft as well and I will be looking forward to the current state of Silverlight and what it looks like moving forward - sure to be a big topic this year.  Make sure you keep an eye on the blog's of Rocky Lhotka and Shannon Braun - two guys from the Twin Cities that will be going and providing some insight on what is going on and what they think it means for Microsoft developers.

Technorati Tags: ,


Slick Thoughts

Aliens - The Director's Cut

1/21/2008 3:14:00 PM

Just on a whim, I picked up the director's cut of Aliens.  I'm not a film person by any stretch so I am not sure if it is ok to say this or not, but in general, I like James Cameron's work.  Anyway, I figure seeing a few extra scenes or whatever would be fun while I watched one of those "great films" from when I was younger.  Lo and behold, the Director's cut weighed in at 2 hours and 39 minutes.  This was not just a few extra scenes thrown in, it was almost like watching an entirely different movie. Not that extreme maybe, but it made the film even better.  You learn more about Ripley, the colony, and some of the things that just seemed disjointed in the theatrical release fall into place (a la why Ripley seemed to become attached to Newt in a split second --- the background on Ripley is now there to explain that).  All in all, I'm really glad I picked it up!



Silverlight Streaming to Your Silverlight Player - Content Only

1/18/2008 6:28:00 PM

Silverlight streaming is pretty cool stuff.  4GB of free space to store your videos and associated Silverlight player files.  Kind of a mini-MyYouTube sort of thing.  Of course, the 10min/22MB size limitation is a negative, but I've been able to work around it for most of the stuff I have done with my Spaghetti Code videos.

My current project (that has gotten in the way of continuing work on my Spaghetti Code 'Almost Live' project - never enough time) is to create a video "broadcasting" interface so folks can get a slick experience to find and view videos.  As part of this, I really wanted to just pull .wmv content off of the Silverlight Streaming infrastructure.  I didn't want to go the iframe route or some other solution that required me to actually host a Silverlight .xaml interface on Silverlight Streaming. 

The Silverlight Streaming SDK references that scenario, but the SDK is pretty sparse on examples or even detail more than just a vague blurb and a snippet of out-of-context code (at least for someone just digging around out of context ;-) ).  The other thing I wanted to do was leverage all of the great templates and javascript that Expression Encoder provides so I could minimize the amount of code I would have to write to get my Silverlight player working.  That was another scenario that did not have a lot of documentation. 

So, my intrepid readers (all four of you - yes Slickthought readership is on the upswing!), here are the steps to stream *.wmv content to your own Silverlight player.  I'm assuming you already have a Silverlight Streaming account and have posted some content out there that you would like to access.

1.  Using Expression Encoder, encode your content and use Encoder to create a Silverlight player for you.  You can open that project file associated with the output and modify in Blend.  See Tim Heuer's blog post on using Expression Encoder templates as the foundation for your own Silverlight player.  If you don't have Expression Encoder, that is fine, but I have based my solution on some of the files it spits out.  If you are building your own player from scratch, you should be able to figure out what you need to do since Expression Encoder uses some of the same files that are provided as part of the Silverlight SDK (that I assume you are using or else you are one sick javascript writing puppy).

2.  Now we need to modify the default output of our Silverlight project to access content directly from the Silverlight Streaming service.  Step one is to change where our silverlight.js file is being downloaded from. 

a) Open default.html

b) Find <script type='text/javascript' src="Silverlight.js" mce_src="Silverlight.js"></script> and change it to <script type='text/javascript' src=""></script>.  This downloads a version of the silverlight.js file that allows us to instantiate our Silverlight object with a different method that we can configure to access content from Silverlight Streaming instead of a normal URL.

3. Next up, we need to update out startplayer.js file.  The first thing we want to look at is function StartPlayer_0(parentId).  It originally looks like this

function StartPlayer_0(parentId) {
    this._hostname = EePlayer.Player._getUniqueName("xamlHost");
    Silverlight.createObjectEx( {   source: 'player.xaml',
                                        parentElement: $get(parentId ||"divPlayer_0"),
                                        properties:{ width:'100%', height:'100%', version:'1.0',, isWindowless:'false' },
                                        events:{ onLoad:Function.createDelegate(this, this._handleLoad) } } );
    this._currentMediainfo = 0;     

as you can see, this function creates our Silverlight host by using the createObjectEx function.  For our purposes, we like this method of invocation because it allows us to specify what XAML we wanted hosted.  That way, even if the original content on Silverlight Streaming included it's own Silverlight player interface, we can use our own instead.  Unfortunately, createdObjectEx does not let us do this.  That is why we are using the other silverlight.js file, which allows us to modify our code as shown below:

function StartPlayer_0(parentId) {
    this._hostname = EePlayer.Player._getUniqueName("xamlHost");
    Silverlight.createHostedObjectEx( {   source: 'player.xaml?v=1',
                                        parentElement: $get(parentId ||"divPlayer_0"),
                                        properties:{ width:'100%', height:'100%', version:'1.0',, isWindowless:'false' },
                                        events:{ onLoad:Function.createDelegate(this, this._handleLoad) },
                                        initParams: 'streaming:/<silverlightAccountId>/<silverlightApplicationName>/somefile.wmv' } );

    this._currentMediainfo = 0;     

We change createObjectEx to createHostedObjectEx.  This allows us to still use our own XAML put also specify where the content comes from using initParam and the special syntax of stream:/...  Note that there is only a single forward slash following the colon, not two like in http://.  Following streaming:/ we put a Silverlight account number, followed by the application id that contains the content we want to get, and end with the physical file name of the media file.

4.  The last part is the part that was hard to figure out. If you are just hacking through the code like I was, it takes a little bit of time to figure out what needs to be fixed next.  If you look at the code inside of StartPlayer_0.prototype  you will see it ends with this._playNextVideo(); The code inside of _playNextVideo() function then calls the following function:

function get_mediainfo(mediainfoIndex) {
    switch (mediainfoIndex) {       

        case 0:
            return  { "mediaUrl": "somefile.wmv",
                      "placeholderImage": "someimage.jpg",
                      "chapters": [              
                                  ] };                                                               
             throw Error.invalidOperation("No such mediainfo");

The issue is with the "mediaUrl" value.  By default, it points to the media file that Expression Encoder expects to be in the same web directory as the Silverlight player.  In our case, however, our content is actually in the Silverlight Streaming cloud.  It would seem that all you would have to do is change somefile.wmv to streaming:/<silverlightAccountId>/<silverlightApplicationName>/<somefile.wmv> and you would be good to go.  Unfortunately, life is not that easy.  streaming:/ is a place holder that the createHostedObjectEx function translates into an actual URL that points to the physical file in the Silverlight Streaming cloud.  That URL can be different each time you use streaming:/ even though you may be requesting the same file. 

There may be other ways to do this, and I suspect there are, but, I haven't taken the time to bone up on my javascript or the javascript libraries used by Silverlight, so I "brute forced" an answer based on some info I found on the web.  To fix the problem, I replaced the this._playNextVideo();  with a call to my own function this.loadStreamingVideo();.  The code for this function is added to the StartPlayer_0.prototype and is shown below:

_loadStreamingVideo: function() {
        var params = $get(this._hostname).InitParams;
            {"mediaUrl": params, "placeholderImage": "", "chapters": [] }


That's all there is to it. ;-)  I've attached a copy of startplayer.js here (as a .txt file) so you can take a look and compare the changes to the normal Expression Encoder startplayer.js file.  I'm working on getting SlickthoughtTV up and running so that people can easy browse the videos I am posting.  There are some great examples

Technorati Tags:

of doing this already, but I want to hack it up from scratch since these examples do a lot more than what I want and I want to learn something along the way.  I'll share how I did it in some videos once I get it done.



Spaghetti Code 'Almost Live' 1: Custom Attribute

1/18/2008 5:28:00 PM
The first "coding edition" of Almost Live is up and can be viewed.  In this session, I introduce how I will use custom attributes to map data from the Daily Racing Form CSV data file into my application.  You will see the type of data we are dealing with and I create the custom attribute that we will be using.  In the next session, I will show how we will use the custom attribute in conjunction with reflection to parse the data and load it into objects.  You can download the source project (not a ton right now of course) here.

Double-click for full screen


SpaghettiCode | Screencasts

Powered by BlogEngine.NET
Theme by Mads Kristensen

About the author

Jeff Brand Jeff Brand

This is the personal web site of Jeff Brand, self-proclaimed .NET Sex Symbol and All-Around Good guy. Content from my presentations, blog, and links to other useful .NET information can all be found here.

E-mail me Send mail


<<  August 2014  >>

View posts in large calendar

My Twitter Updates


Recent comments


The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2014

Sign in