A Technical Packrat

My name is Vince and I'm a technical packrat.  ( Hello Vince.... )

I have notes from the first Dallas .Net User Group meeting in 2001 and the first Microsoft MSDN meetings in Dallas around 1998.  I have an ascii chart in my wallet but soon to be on my phone.  I have books related to project management in the late 80's.  I still have 8086 assembly and SQL 6.5 books.

    Why?  I'm a technical packrat.

After 20 years of development, I actually know who I am and what I want to focus on.  Technology moves like a train around mountains, but it still moves forward.  Some good advise I've heard is that if we don't read it in 3 months, throw it out.  It feels good to throw away obsolete things that no one needs.  A trip to the local Goodwill will be a relief.

What's in your wallet?

-Vince

Posted by vblasberg with no comments
Filed under:

Windows Phone Mango Release - Finally Upgraded

After several attempts, I finally got my Windows Phone 7 updated to the Mango release.  It kept failing and reported an error C1010007.  That error indicates that the cable is bad or not the original cable.  I finally tried again and kept touching the phone every minute or two.  The upgrade continued and finally finished.  I suspect the phone goes to sleep during the upgrade. 

Hope this helps others upgrade easier.  It's something to remember for the next upgrade.

-Vince

Posted by vblasberg with no comments
Filed under:

The .Net Micro Framework Event in Dallas

This is a mention of the event that came and went last weekend for the .Net Micro Framework here in Dallas at the Improving Enterprises offices.  Shawn Weisfeld worked on the event for the last 6 months.  Shawn pushed the moderately priced package from FEZ that proved to be an excellent product.  We all met last Saturday and went through some exercises to understand how to develop most of the basic tasks to interact with the plug and play hardware.  When the day was over, we all had a great understanding of how to create .Net application with Visual Studio 2010 and deploy to this device.  It's so much easier than the Windows CE deployments. 

All this to say that if anyone has a project that needs low-power consumption hardware integration, the FEZ boards are a great solution with C# and Visual Studio.  I think one of the coolest things on the board is not the ethernet, infrared, or color touch screen but the serial port integration.  There are still so many integrations needed for existing serial port devices.  Just plug this in and with .Net get you the rest of the way to a solid solution.

 The Products

Then there's an ebook with suggested projects for our cool new geek toy.  http://www.ghielectronics.com/downloads/FEZ/FEZ_Internet_of_Things_Book.pdf

Now I'm off off build something great with C# of course.

-Vince

Posted by vblasberg with no comments

Never SELECT * from Entity Framework called Stored Procedures

The Entity Framework can help us create an efficient Data Access Layer or a horribly inefficient one. 

It's worth mentioning that if we use Entity Framework to call a stored procedure that returns a database derived Entity using a SELECT * (star), we will have that horribly inefficient DAL.  Of course, as we've been told for years, SELECT * is 99.0% wrong with 1% for those dynamic field cases.  With EF calling a stored procedure, it's really wrong.

SQL Profiler will show us that the store procedure does return all records as fast as it can, barring a badly written stored procedure or low SQL server memory.  Entity Framework unfortunately does not assume all fields have returned.  EF then calls back with the defined primary key for each record.  This means that for a stored procedure that returns 1 million rows in one connection, actually returns 2 million rows with 2 million and one database server calls / connections from the application layer.  Try it on a 3 record table sometime to see that it calls SQL Server 4 times for three rows even when we use a stored procedure.  Enterprise DBA's will complain as they should.  If there is an obscure switch to avoid this, I couldn't find it.

The Moral of the Story:

  • Always define fields from the SELECT statement even if SQL 2005 and greater does optimize it for us.
  • Use SQL Profiler to look at the number of calls and the I/O count of each call.

-Vince

Posted by vblasberg with no comments

Containing Silverlight Lists and DataGrids in the Browser Window

In a typical Silverlight line-of-business application we have Lists, Grids, DataGrids, and StackPanels.  We populate a list and it flows down and off the browser page.  When we have a ScrollViewer, it will scroll the whole page including edit controls and graphics and not just the list that's tall and flowing off the page.  The good news is that we can easily contain the list in the viewable area with the few simple steps listed below.

  1. Remove the ScrollViewer from the page if it exists.
  2. Contain all upper area graphics and edit controls in a RowDefinitions of explicit size or Auto.
  3. Contain the lower List(s) in a final Grid RowDefinition with the Star notation to fill the remainder of the window using the outer-most Grid as a parent container.
  4. Optionally specify for the List properties,  VerticalAlignment="Top" and VerticalContentAlignment="Stretch".  Otherwise the List and its borders will stretch to the bottom of the screen even if it has no items.  Either way may be preferred. 

The following screen shots demonstrate this with a simple GridSplitter to size either side.  Notice the List on the left is using two rows compared to the list on the right.  The list on the right isn’t flowing to the bottom and uses only one row.  Both lists flow to the bottom of the browser window and no further, regardless of the number of items.

XAML rocks
.
-Vince


Runtime:

  

Designer:

  

 

XAML:

    <Grid x:Name="LayoutRoot"
          Background="#FFCEA1A1">
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="50" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <sdk:Label Content="List 1"
                   HorizontalAlignment="Center"
                   VerticalAlignment="Center"
                   FontSize="16"
                   FontWeight="Bold" />
        <sdk:Label Grid.Column="2"
                   Content="List 2"
                   HorizontalAlignment="Center"
                   VerticalAlignment="Center"
                   FontSize="16"
                   FontWeight="Bold" />
        <ListBox Grid.Row="1"
                 Grid.RowSpan="2"
                 Name="listBox1"
                 Margin="10" />
        <sdk:GridSplitter Grid.Row="1"
                          Grid.Column="1"
                          Width="10"
                          HorizontalAlignment="Stretch"
                          Grid.RowSpan="2" />
        <ListBox Grid.Row="2"
                 Grid.Column="2"
                 Name="listBox2"
                 Margin="10"
                 VerticalAlignment="Top"
                 VerticalContentAlignment="Stretch" />
        <sdk:Label Grid.Row="1"
                   Grid.Column="2"
                   Content="(Edit Controls)"
                   FontSize="16"
                   FontWeight="Bold"
                   HorizontalAlignment="Center" />
    </Grid>
</UserControl> 


Code-Behind:

private void MainPage_Loaded(object sender, RoutedEventArgs e)
{
    listBox1.Items.Clear();
    listBox2.Items.Clear();

    for (int i = 1; i <= 100; i++)
    {
        string listItem = "List Item " + i.ToString();

        listBox1.Items.Add(listItem);
        listBox2.Items.Add(listItem);
    }
}

 

 

Posted by vblasberg with no comments
Filed under: ,

Dallas GiveCamp 2011

Dallas GiveCamp came and went this last weekend.  It was my second GiveCamp and was very rewarding.  Our team created a site for the Tarrant County Birth Network.  Jon and I quickly explained the resulting web site and sat down, but I forgot to present and thank the team.  So this is a very weak attempt to thank them after the event.

Thanks to the Dallas GiveCamp team for a fun weekend.

  • Jonathan Keith - Developer
  • Nick Coombs - Developer
  • Rick Michaels – Developer
  • Sridhar – Very helpful floating developer
  • Shannon Blackwell - The very active charity representative
  • Jaime Grassi - Business Analyst
  • Vince Blasberg (myself) – Developer

The GiveCamp weekend was very unusual, thankfully.  There were many challenges from the first moment until the last.  In the end we at least accomplished one big thing.  We enabled the charity with a CMS that will grow as their needs grow.  They now have a huge network of .Net developers around the world that can easily develop and support them.  When they switch over to the new site, there is no doubt the requirements document will grow and there will be developers like our team to help them.

What is the Tarrant County Birth Network?
http://tcbirthnetwork.org/
The Tarrant County Birth Network is a community organization to provide information about, and advocacy for evidence-based, Mother-Friendly care for expectant Tarrant County families seeking a healthy, informed, and enjoyable pregnancy and birth.

What is GiveCamp
http://dallasgivecamp.org/
GiveCamp is a weekend-long event where software developers, designers, and database administrators donate their time to create custom software for non-profit organizations.

I hope to see everyone there next year.

-Vince

Posted by vblasberg with 1 comment(s)
Filed under:

Videos from My Past Presentations

Shawn Weisfeld has recorded several presentations that I've been fortunate enough to present at various times.  Shawn also stalks other active community speakers with that camera of his.  Check out the complete list on the INETA Champs live site at http://newlive.ineta.org/.  That's more than enough video content to fill a Saturday night or skip the Monday night football.


Here is a list of my presentations at http://newlive.ineta.org/Presentation/Speaker/26

 

Nuts and Bolts in XAML Part 1 - 7/6/2010
http://newlive.ineta.org/Presentation/ViewVideo/110


Nuts and Bolts in XAML Part 2 - 8/3/2010
http://newlive.ineta.org/Presentation/ViewVideo/122


Working with Data in Silverlight - 6/18/2010
http://newlive.ineta.org/Presentation/ViewVideo/106


Understanding Databinding with XAML in WPF and Silverlight - 3-2-2010
http://newlive.ineta.org/Presentation/ViewVideo/36
http://newlive.ineta.org/Presentation/ViewVideo/37
http://newlive.ineta.org/Presentation/ViewVideo/38

Posted by vblasberg with no comments

RIA Services - Solutions to 'The remote server returned an error: NotFound'

Isn't it great when the answers are out there?  I finally got a Google hint and overcame this one.  So here are a few reasons that I encountered and overcame this error.  We can easily reproduce (and often fix) this error.  This occurs on the asynchronous return from a Silverlight 4 to RIA services.  It's as if for any of the few reasons it fails, the call just gets aborted and we get a head-scratching "Not Found".  We can sometimes even hit a debugger breakpoint in the Domain Service that gets the IQueryable call and wonder why the server appears to work in the debugger.

Here are a few suggestions to help.

  1. Returning too much data for the object graph.  Solution: Edit the 'maxItemsInObjectGraph' setting in the web.config.
  2. Throwing an unhandled error on the service logic.  It can't get back to the client.  Solution: Comment out logic and see if the call succeeds.
  3. Solution: Only enable Anonymous authentication.  The request can then avoid authentication errors and possibly return successfully.  This one got me again tonight when deployed a new client’s project for the first time.  It also confused several of us at the Dallas Silverlight and WP7 DevCamp that I mentored at the other day.   The project will work great in the local development server but when deployed to IIS, we get a Not Found error.  So try disabling the Forms and Basic Authentication with only Anonymous enabled.  I'm convinced that this is the most likely reason for most people.

Hope this helps others with this unintuitive error message....Hopefully it's "Now Found".

-Vince

Posted by vblasberg with no comments
Filed under: ,

Silverlight OOB - CheckAndDownloadUpdateAsync

I’ve been looking at the Silverlight Out-Of-Browser support and the easy update feature.  In the current version, we’re given the method, CheckAndDownloadUpdateAsync().  This method does a lot for us but is rather limited.  With an asynchronous method and no parameters, what can we expect?  With a huge team in Redmond working for us and trying to meet deadlines, we get what we get.  In the spirit of sharing, here’s what I see so far.

Features:

  • Detect network connectivity (and sometimes it fails miserably…)
  • Connect to the original authorized URL that it was installed from
  • Download the new XAP file and compare the current version against the downloaded version from the manifest
  • Detect the current Silverlight version vs. the new version’s Silverlight version
  • If a failure occurs, failure exception types are provided for recovery such as “PlatformNotSupportedException”

Limitations:

  • Can’t interrupted the request.  So when it times out, we wait for it.
  • Can’t download the update and make it optional to install and replace the currently running XAP.  A flag to just detect a newer version would be better.  This would allow the UI to show the current version and available update version.
  • Returns a false for the “UpdateAvailable” property for several reasons such as the new XAP is not signed, is a newer Silverlight Version, or various other errors.  We must then look at *ALL* of the possible error class types placed in the error collection.  A bunch of try-catches are therefore necessary.  The try-catches do the job as long as we have every possible error type in a catch.  An enum for the actual error reason may be better.
  • Can’t revert to a previous stable version and have it install over a newer bad version.  It makes sense, but real development teams have recovery plans when updating production versions.

Q: What if we want to make the newer XAP file replacement optional?   Here are some thoughts.

Not everyone wants to increase the newer version number for a rollback version.  The Silverlight client can call the web server to get the new version number using other networking connectivity options.  The server call could be as complicated as a WCF service, ASMX service, Web Method call, or an HTTPRequest to get the online version information.  Getting the version from the server could be as complicated as reading the newer version’s manifest file, read the new file date and time, or newer folder date and time.  It could be as simple as getting a text file that has only the expected Silverlight version and the new XAP version.  If the major or minor version is different, then the Silverlight client can act appropriately such as displaying an update message box or button to perform the CheckAndDownloadUpdateAsync() call.  The only issues I can imagine would be security issues of calling back to a “different” server where a ClientAccessPolicy.xml file is required.  If it were HTTPS from the install, the new version check call may to an HTTP.  The different server could also include “WWW” or not include it and therefore require the ClientAccessPolicy.xml file.  The simple version text file can be automatically generated in the Silverlight application build script.  This way DEV, QA, and Production can generate and test it easily without requiring the file to be edited every time it gets deployed.  This may not allow a previous version to replace a new bad version (users install updates with the Silverlight plugin, not our code) but it does get closer so the installed version can stop working or corrupting data until they uninstall and reinstall the previous version.  A rollback with a version increase is easier so we can just call CheckAndDownloadUpdateAsync for the actual rollback.  Again, these are just some thoughts to get closer to real-world deployments.

A Silverlight OOB launcher debugger is available. More information: http://blogs.msdn.com/b/silverlight_sdk/archive/2010/04/10/sllauncher-error-messages.aspx

Q: Needs some good code examples?  A few really good Silverlight OOB blog entries can be found here: http://nerddawg.blogspot.com/search/label/Out-of-browser

This should give some food for thought until we get a more robust CheckAndDownloadUpdateAsync method.

-Vince

 

Posted by vblasberg with no comments
Filed under:

Silverlightpalooza - The DFW Silverlight and WP7 DevCamp

Teresa Burger and Chris Koenig are heading up a great event on Jun 18th and 19th called the DFW Silverlight and WP7 DevCamp.  It is two full days (Friday and Saturday) of Silverlight and Windows Phone 7 fun.  Yes - I said fun.  I'll be one of the available on-site mentors both days. It will be at our favorite hang-out, the  Microsoft headquarters in Dallas.  There will be prizes and lots of experience to be gained.  So if you want to join in the fun and learning, please register now before it is filled.  After two days of Silverlight and WP7, there’s still a Sunday left to ride the motorcycle.  So it definitely will be a great weekend.


http://silverlightpalooza.dynamitesilverlight.com/


-Vince

Posted by vblasberg with no comments
More Posts Next page »