Friday, August 27, 2010

Thursday, August 19, 2010

Silverlight 4 Training Kit - ScottGu's Blog

free Silverlight 4 Training Kit that walks you through building business applications with Silverlight 4.  You can browse the training kit online or alternatively download an entire offline version of the training kit

The training material is structured on teaching how to use the new Silverlight 4 features to build an end to end business application. The training kit includes 8 modules, 25 videos, and several hands on labs.

Posted via email from Mocha Brain Freeze

Wednesday, August 18, 2010

RIATasks: A Simple Silverlight CRUD Example (using View Model) - CodeProject

Silverlight MVVM: An (Overly) Simplified Explanation

The Model

image

The Model is where the data for the application goes, The Model can contain:

  • Web Services – A Silverlight application typically needs to communicate with the web server to get the data, you can put your web service methods here.
  • Rest Services – The same as web services.
  • Generic Collections – Basically any data.

 

The View Model

image

The View Model consists of:

  • Properties – One of something. This could be a String or an Object. Implements INotifyPropertyChanged, so that any element bound to it, is automatically notified whenever it changes.
  • Collections – A collection of something. This is of type ObservableCollection, so that any element bound to it, is automatically notified whenever it changes.
  • Commands – An event that can be raised. Also, one parameter of type Object can be passed. This implements ICommand.

 

The View

image

This is the part that you can make with no code using Expression Blend.

An Outline

  • Model
    • Get your data any way you can. Usually calls to web services.
  • View Model
    • Consists of:
      • Properties – One of something. This could be a String or an Object. Implements INotifyPropertyChanged, so that any element bound to it, is automatically notified whenever it changes.
      • Collections – A collection of something. This is of type ObservableCollection, so that any element bound to it, is automatically notified whenever it changes.
      • Commands – An event that can be raised. Also, one parameter of type Object can be passed. This implements ICommand. 
        • Implemented using Behaviors. Mostly the InvokeCommandAction Behavior  
  • View
    • Properties
      • Bind to a text box, radio button, toggle button, MediaElement, trigger an animation or ViewState change
    • Collections
      • Bind to List box, TreeMenu
    • Commands
      • Implemented using InvokeCommandAction behavior
        • Bind to a ICommand in the ViewModel
        • Indicate the ICommand that you want to raise
        • Pass a parameter

Posted via email from Mocha Brain Freeze

MVVM 101

Model: the Data. Holds the information, but not behaviors or services that manipulate the information.

View: the presentation of the data (ex. the xaml in Silverlight). Contains behaviors, events, and data-bindings that ultimately require knowledge of the underlying model and viewmodel. Not responsible for maintaining its state. Instead, it will synchronize this with the viewmodel. Bindings are the integration/synchronization points with the viewmodel (ex. <TextBlock Text="{Binding FullName}" />

ViewModel: the Controller. Liason between Model and View. Might take input from the view and place it on the model, or it might interact with a service to retrieve the model, then translate properties and place it on the view. Maintains state of the View. Triggers events in the view.

source: http://csharperimage.jeremylikness.com/2010/04/model-view-viewmodel-mvvm-explained.html

Posted via email from Mocha Brain Freeze

Thursday, August 12, 2010

Thank You for Supporting the Future of Human Spaceflight

SpaceX Logo

Thank You for Supporting the Future of Human Spaceflight

We recently asked for your help to protect the future of human spaceflight – and the response was impressive. Your phone calls and the efforts of supportive members of Congress helped stop the NASA Authorization bill from being pushed through the House of Representatives before important improvements could be made.

This bill would have authorized over five times more taxpayer dollars to fly NASA astronauts on the Russian Soyuz than to develop an American-made commercial alternative that would energize our economy and create jobs right here at home.

We still have a tough fight ahead of us, but many in Congress are starting to recognize that commercial vehicles like Dragon and Falcon 9 are the nation's best option for ending our reliance on Russia to transport astronauts to the International Space Station and preserving America's leadership role in space.

It's not over yet. When the House returns from its summer recess in September, NASA Authorization bill H.R. 5781 will be up for vote again.

We hope you will continue to fight for the opportunity to show how a true public/private partnership can transform America's space program.

We thank you for your support and look forward to working together to ensure an exciting future for American spaceflight.

--Elon--


You are subscribed as gotbot@gmail.com. To unsubscribe please click here.


Posted via email from Mocha Brain Freeze

Wednesday, August 11, 2010

An attempt was made to load a program with an incorrect format

This message being spewed-forth by an asp.net application means that the DLL concerned has been compiled as a specific "bitness", but one that doesn't match that which IIS is running at. The most usual reason for this is an assembly marked as "x86" deployed to an "x64" server. If the assembly doesn't P/Invoke out to any 32-bit DLLs, change the platform target to "AnyCpu".

As far as the .net framework is concerned, the x86/x64 categorisation is only used as an indicator of requirements, thus if no P/Invoke is going on it's not needed, as the JIT compiler takes the assembly and JIT compiles it to the relevant instruction set at runtime anyway.

Posted via email from Mocha Brain Freeze

A Developer's Blog · IIS 7.5 And Windows Authentication

HTTP Error 500.19 - Internal Server Error + IIS 7.5 | Andrew Murphy's E-Memory

This is the error that faced me the first time I deployed a .net Framework 3.5 web site to IIS via Visual Studio 2010 and then tried to run it.  After a couple of hours of digging I traced it back to the application pool but I thought it worthy of a write-up.

Problem

Attempting to run a .net framework 3.5 web site hosted in IIS 7.5 (deployed via Visual Studio 2010) gives the following error information:

error

config

Error message:

There is a duplicate ’system.web.extensions/scripting/scriptResourceHandler’ section defined

The error points to sections in the web.config file that ships with the site, a clearer view of which is here:

1: <configSections>

2:   <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">

3:     <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">

4:       <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>

5:       <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">

6:         <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>

7:         <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>

8:         <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>

9:         <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>

10:       </sectionGroup>

11:     </sectionGroup>

12:   </sectionGroup>

13: </configSections>

This is strange because:

  1. The site runs fine in Visual Studio 2010.
  2. It works when deployed into IIS via Visual Studio 2008 (on a different development machine and in live).
  3. This site works if you alter the framework target to be .net 4.0 and then deploy to IIS and run as normal.

History

This web site was originally developed in Visual Studio 2008 but desperate to try 2010, I followed the procedure below:

  1. Installed 2010 on a clean machine (nothing in IIS).
  2. Converted the 2008 solution but kept the framework target as 3.5.
  3. Ran from Visual Studio.
  4. Deployed to IIS and attempted to run from there.

Fault Finding

My first thoughts were:

  1. That IIS thinks this is a .net Framework 4 site rather than a 3.5.  I find this hard to check as aspnet_regiis –lk does not work on Windows 7 (my development OS) and finding anything in IIS 7 is a pain in the neck.
  2. Visual Studio 2010 has messed something up.

Confirming the versions of the target assemblies for the site was problematic however.  When the site was built as .net 4 and so worked, I was able to view the Handler Mappings for the site.  When it was built for .net 3.5 and so broke, I couldn’t view the mappings as IIS displayed the same error as at run-time:

handlerMappings

Solution

It turned out that IIS was confused about the .net framework to use after all, or at least about the application pool version to use.

Viewing the application pools in IIS showed that I had the following:

applicationPools

As you can see, my application was sitting with the default web site inside the DefaultAppPool, which is configured to target .net 4.  Moving the site into the Classic.NET AppPool fixed the issue and worked a treat.

It would have been nice for this to have worked out of the box but you live and learn.

This entry was posted on Tuesday, April 20th, 2010 at 19:02 and is filed under .Net Framework, ASP.Net, Errors, IIS, Misc. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Posted via email from Mocha Brain Freeze