C-Sharp as a scripting language

Here’s a cool technology you might not have heard of: scriptcs. Gives you the ability to use C# as a scripting language. It does this using the Rosyln compiler. So here’s an example below, taken directly from the scriptcs website: using System; using System.IO; using System.Web.Http; using System.Web.Http.SelfHost; var address = "http://localhost:8080"; var conf = new HttpSelfHostConfiguration(new Uri(address)); conf.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); var server = new HttpSelfHostServer(conf); server....

<span title='2013-03-07 04:49:07 +0000 UTC'>March 7, 2013</span>&nbsp;·&nbsp;1 min

Using the MVVM pattern on web applications – Part III

We are at the finale of this three part series. In part I we discussed the MVVM design pattern, in part II we looked at the overall architecture and how the server side fits into the picture. In this article we are going to look at the client side of this and close with some final thoughts. The best place to start with the client is the HTML - so here’s the part of the HTML that’s interesting:...

<span title='2013-03-06 06:39:59 +0000 UTC'>March 6, 2013</span>&nbsp;·&nbsp;3 min

IE Compatibility and W3C Validation

I’ve always been a junkie when it comes to markup validation. It’s important to me that my sites are 100% XHTML/strict compatible. But recently I came across a situation that I thought I simply couldn’t get around. In this article I am going to show you how you can add the X-UA-Compatible attribute and at the same time validate your pages through W3C validation. My website had the following tag:...

<span title='2013-03-04 08:17:23 +0000 UTC'>March 4, 2013</span>&nbsp;·&nbsp;1 min

Using the MVVM pattern on web applications – Part II

Last time we looked at what the MVVM pattern was, and how it is used today in XAML-based applications. Today we are going to take a step further and build a mechanism to use the MVVM pattern on traditional web applications. Imagine how powerful it would be if your UI could evolve independently. We are going to build a simple web application that will display top 5 “memory intensive” processes on the server side, and here’s our basic architecture: Recall, with MVVM we need the ability for our ViewModels to somehow send messages to the UI....

<span title='2013-03-03 04:23:51 +0000 UTC'>March 3, 2013</span>&nbsp;·&nbsp;4 min

Microsoft on{x} - Automate your life

Microsoft on{x} is a set of services built by the team I work for. On{x} allows you to configure arbitrary actions during specific circumstances. For instance, on{x} provides an API called modeOfTransport. This API gives the developer the current mode of transportation - whether you are walking, running or driving. You can subscribe to a change in this event and build cool scenarios like when someone is going from driving to walking (imagine parking a car), your phone can automatically remember your parking location....

<span title='2013-03-02 19:12:00 +0000 UTC'>March 2, 2013</span>&nbsp;·&nbsp;1 min

How do you test your software?

There seems to be two types of developers out there. One that believes in integration tests, and the other that believes in both unit and integration tests. Integration tests are tests that execute everything as if they were real “transactions” only to verify the expected results. For instance, if you were building a web application that managed a list of employees and their supervisors. Your integration test would probably add an employee to the database (actually add it), and then read it back from that database, and so on (from a test database of course)....

<span title='2013-03-01 15:09:40 +0000 UTC'>March 1, 2013</span>&nbsp;·&nbsp;4 min

Using the MVVM pattern on web applications – Part I

In this series I will be discussing how the MVVM pattern can be used for almost any type of web application. MVVM (a variant on the MVP pattern) - is a really powerful pattern that can be used in UI applications. Traditionally these UI applications has been WPF and Silverlight. In this article I will show you how you can use the same principles to build web applications. With MVVM you have the following three ideas:...

<span title='2013-02-28 09:01:15 +0000 UTC'>February 28, 2013</span>&nbsp;·&nbsp;5 min

Learning to program

If you or your kids want to learn how to program - you can start here: http://www.code.org/. For instance, just see this example. You have a great editor, where you can type and see results immediately on the right. On top of that, you have a video, with someone talking you through basic ideas like functions, and parameters. The site has support from top names like Bill Gates and Mark Zuckerberg....

<span title='2013-02-27 04:42:28 +0000 UTC'>February 27, 2013</span>&nbsp;·&nbsp;1 min

Asynchronous Anonymous Methods

So a cool new feature in .NET 4.5 is the ability to create anonymous methods that are asynchronous (async). Task.Run(async () => await Task.Yield()); That’s just a cool way of saying do nothing!

<span title='2013-02-27 04:04:42 +0000 UTC'>February 27, 2013</span>&nbsp;·&nbsp;1 min

Task Timeouts

When dealing with .NET tasks – we often want to timeout the operation if it does not complete within a certain period of time. For instance, if you make an asynchronous WebRequest call – you may want to timeout this asynchronous operation within 3 seconds if you don’t get a response back. In the past, we had to create Timers to monitor the Task (or the Thread) for completion in the callback of the timer, and then do other crazy gymnastics to make it all play well together....

<span title='2013-02-26 03:25:30 +0000 UTC'>February 26, 2013</span>&nbsp;·&nbsp;2 min