The move to the cloud of many applications means that we have to learn new approaches to solving old problems. One common problem that most developers face at one point or another is background processing for web sites. In the past the solution would have often been to build a Windows Service and install it on a machine. Of course if you are using Azure Web Sites to host you application you do not have access to install services. Depending on what you need to accomplish WebJobs are the solution. This post will discuss the basics of creating and deploying an Azure WebJob.

First you need to determine what type of WebJob makes sense to you. There are the ones that are triggered by Azure events and those that are scheduled. The ones that are triggered revolve around queues and data put into Azure storage. These are generally referred to as continuous. Conversely, if you have code that needs to be performed but is not based on an Azure resource then it is scheduled similarly to how we schedule tasks on a Windows server.

The main difference between the way triggered and scheduled WebJobs are coded is based around using the JobHost class and the Functions class. In the Main method of a triggered job the RunAndBlock method of the JobHost object is executed as shown below. This allows the job to run continuously.

static void Main() { var host = new JobHost(); host.RunAndBlock(); }

The actual work is done in a method of the Functions class. The parameters of each method define the if the function is triggered by a queue entry, a new blob storage or other resource. This example is actually the default that is generated by the project template.

The easiest way to write a WebJob that will run under a schedule is to simply remove the code in the Main method and put in your standard .NET code to perform your tasks. At the same time you can remove the Functions class since it will not be used.

Set connection strings in the app.config for dashboard and storage to the name of your storage account and the storage account secondary access key. They should look like the following configuration snippet.

They can be found at either of these two locations depending on the version of the portal you are using.

There are two ways you can deploy your WebJob to your Azure WebSite. The first is to use Visual Studio. The other way is to zip up your bin directory for you executable and upload that through the Azure portal.

Ultimately WebJobs are pretty easy to create once you find the basic information around their development. Learn them and make your scalable cloud solutions on Azure more robust.

Many developers say with a sarcastic tone “You can fix any problem with another layer of abstraction”. The question is if there is any truth to this. While abstraction can increase reuse, flexibility and testability it comes with a cost of complexity in readability and maintainability. If a developer has to spend a week learning how all the pieces of an application are put together there better be a payoff. Always ask yourself “what do we gain” when adding a new factory or dependency injection? Is there a proper return on investment? I’m not saying don’t add abstraction layers. Be pragmatic about it.

Every pattern has its place, but don’t overuse them. If the requirement of your application is to be able to dynamically plug in a nearly infinite number of modules then a set of interfaces and a generic dependency injection approach might be the way to go, but don’t start there. If that requirement isn’t there don’t use patterns and abstraction layers because you “could, possibly, maybe” need it at some point in the future. Live by the rule “You’re not going to need it”.

I don’t know how many times I have seen code where there is a layer in between your business and data layer that does nothing but call the data layer and pass it back to the business layer without adding any value. Each piece of code needs to have a purpose. If you can’t explain what that purpose is then you need to refactor it out.

Walk through your code and see how many times you need a cheat sheet to know what object you are referencing or what the business purpose of a piece of code is. If you are confused by your own code you may have gone too far. Have someone else walk through your code and see what questions they have and how long it takes them to understand what you have built.

At some point in the future your code will have to be maintained either for enhancements or bug fixes. Consider how much effort those changes will cost in time and effort. Do those costs fit with the requirements of your business? The lesson I would hope to impart is that abstractions should be used and not abused. Keep this in mind as you design and it may just save your sanity.

I’m not sure how, but I seem to be an outlier in this point of view. I am finding that almost everything they are doing to Windows 10 to make it more acceptable to the masses is taking away features that I preferred in Windows 8. It isn’t that I thought everything was great and didn’t need to be improved, but these are features that I found at the very least useful and in most cases efficient. I’m just going to hit on the big ones here.

Let’s start with the left swipe gesture. In Windows 8 this gave us the ability to rotate through open applications. In most cases what you are looking for is the first previous application used. This meant that a single swipe would bring you back to that application. Now you have an old Windows 7 Alt+Tab screen that pops up and sticks there. You then have to pick which screen you wanted.

Another feature that I liked with the modern apps was mutually adjusting snapped apps. If you had two apps snapped side-by-side and adjusted the border in between them both changed size. Since the apps are now on the desktop this no longer works.

The new Start menu/screen is confusing and needs a lot of improvement. Managing tiles needs a book to understand it. There is a grouping structure, but there is no tip or visual queue to how it should be used. On top of that the old start screen used to have a alphabet based jump feature that made it easier to get to parts of the All Apps screen. This is not currently there which means the All Apps list is useless if you have more than 10 apps. At that point you might as well just do a text search for what you want to run.

Now for the touchy subject. I have always been a fan or the charms. I’m not attached to the charms bar, and I’m glad they didn’t get rid of these contract. The search and share features are one of the best features of Windows 8. They have moved them to a button in the title bar of the apps which are near impossible to use on a touch device and are even harder to discover than the charms bar.

Don’t get me wrong. I do like Windows 10 over all. The new notification center is a nice addition. I’ll be patient and see how things shake out over the rest of the preview, but right now I am frustrated..

We can all get in a rut after years in this industry. We get comfortable doing what we know. The problem is that technology does not stand still. If we don’t keep reinventing ourselves then we will eventually find that we don’t have the skills that the industry requires. This is so important an issue that I often ask prospective employment candidates how they keep up with technology. So what is my answer to rejuvenate your career?

Because I spend most of my time developing solutions for the Microsoft technology stack my examples will be bent more in that direction, but the basics stay the same regardless of the technology. The the keys for me are to keep informed, pilot, get certified and teach.

Keeping informed in this day has a lot of possible avenues. Podcasts, blogs, Twitter and dedicated web sites give you a variety of sources to keep up with what is coming out. At first grab everything you can find and then scale your sources back to just the ones that give you the most information for the time you invest.

You also need to get your hands dirty. Pilot new technologies you are interested in or see as affecting the future for your company. In the Microsoft arena there you can now get Visual Studio 2015 for free and the developer license for mobile development is a one time fee. The greatly reduces the barrier to experimenting with the latest technologies.

The next thing I would suggest is go and get certified. This isn’t so that you have the piece of paper. To me certs are near worthless in their own right. What they will do is expose you to the deepest, darkest portions of a product. This will give you an understanding level that will give you a leg up on those around you.

The last component is to teach. This is some times the first thing I do, but first or last it is a great exercise. Whether you blog, produce your own podcast or speak at industry events, you need to know your subject to talk about it. You will find out how true it is that the teacher always learns at least as much as the student.

Don’t get me wrong. It is ok to coast some times. As a matter of fact you can burn out if you are constantly in a mode of drinking from the fire hose. Just make sure you do some of these things on a regular basis to keep your skill viable. It will greatly improve your longevity and your value.

This post is my impressions of Windows 10 after a couple of weeks of use. First let me set the stage though. I have been using Windows 8 since the RC. So I am very comfortable with it. At the end of my first 30 minutes with the Windows 10 Technical Preview I was screaming at my Surface Pro “What idiot asked for these features”. Of course after using it for a while that has subsided.

The upgrade worked seamlessly on my generation 1 Surface Pro. All my apps showed up, both Store and desktop apps. There was a slight hicup with the first launch of the OneNote Store app, but other than that it has been pretty smooth.

Two days after I installed the technical preview I was already installing the second build. This made the things a little more complicated with not being sure what might change, but even that left the system stable and all apps ready to use.

As for the features, I am not a fan of the Task View. If you like the Alt+Tab experience in Windows 7 then you will feel comfortable here, and if I hadn’t already grown accustom to Windows 8 I would too. But as I have it feels clunky. I have really found that at least on my Surface Pro I prefer to be able to swipe in from the left to rotate through my apps. If I could left swipe with both desktop and store apps it would be perfect. The other thing this change doesn’t take into consideration is touch mice. The one I like to use has Windows 8 gestures and the new Task View would hurt there.

Another thing that I miss in Windows 10 is the way that Store Apps snap in Windows 8. You can get both desktop apps and Store apps to snap to either side of the screen and it will go to half screen. The problem is that once I have two apps up I’d like to resize them to change the percentage that each app takes up. So far I haven’t found a way to make this work. I think it would also be great if we could continue to be able to drag windows with touch if I have a touch capable machines.

I do like that the Charms bar is not showing up when the mouse moves to the corners but I’m glad to see it is still there. Joe Belfiore mentioned that this would not stay in its current form. We will have to see what they come up with, but the basic capability and ease of use should stay. My guess would be that the rest of the charms icons may show up in the task bar like the search icon is now.

The next item that aggravates me is the menu. I want to be able to see a larger number of live tile. Ultimately I want my start screen. Fortunately Microsoft has given us some options. You have the ability to revert back to the Start Screen instead of the Start Menu. This requires closing all of your apps and logging out, but I’m able to live with that.

There are some interesting changes in Windows Explorer. Having Frequent Folders and Recent Files sections display along with your drives on the home view is an interesting feature. I’m not sure how much I will use it, but it isn’t too intrusive and can be collapsed.

There are other features that I haven’t played with such as the Virtual Desktop. As I work with Windows 10 more and they make further updates I will try to post more reviews. For now my opinion is that these features may make sense to people who have never experienced real productivity, but even on my laptop without touch I would prefer the Windows 8.1 experience. Thankfully Microsoft is giving everyone the chance to put their 2 cents in with the Feedback app. If you have an extra machine I would suggest downloading the technical preview and letting everyone know what you like and dislike so that we hopefully get the best Windows 10 possible.

Old developers can easily get set in their ways especially if they work in one environment for a dozen years or more. So how do you overcome the “that is the way it has always been done” mentality that sets in?

The first thing you have to do is be patient. Don’t try to force them to change all at once. Too much change at one time can be a shock to anyone’s system. Gradually introduce new ideas and new techniques.

The next thing you need to do is to make sure that you demonstrate examples and explain how the changes will benefit them in their daily work. One of the main resistance points is that people don’t understand why change is needed. If they can see the payoff they can more easily make the transition.

The most important thing you can do though is get management’s support. This does a couple of things. First it gives you a fall back when you encounter resistance. Secondly it relieves the existing developers of the mental responsibility for old habits. They are just doing what is expected of them.

Even with all this said thing aren’t likely to be smooth sailing, but at least you will have a fighting chance.

Up until this week I had not even heard of WiX (Windows Installer XML Tools). As with most open source projects I found myself spending a large amount of time trying to find resources to explain how to use this tool. I figured if I was struggling there might be a few others that could use some help. In this post I will cover a number of topics to get you started with WiX.

First thing you need is the toolset itself. You can get it here. Once you run the install be sure to restart your machine so that the new templates will show up in Visual Studio.

Now that we have the tools you are on your own. I found a video that gives you the absolute minimum information required to create the equivalent of a “Hello World” install. Of course there are a number of things that the video does not cover and I will address a couple of those below.

The WiX toolset has a set of default dialogs, all of which are customizable. The one that I think is useful to the most people is WixUI_InstallDir. This simply has the user accept a EULA and then allows them to set the install directory for your software. This feature can be added by including the WixUIExtension assembly and adding the following namespace attribute to the Wix tag in the wxs file.

xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"

When you use the Install Directory extension it comes with a generic license. You can customize it by simply adding an RTF file with your text and referencing it in the main wxs file inside the product tag. It looks like this.

<WixVariable Id="WixUILicenseRtf" Value="MyLicense.rtf" />

Likewise the banner image at the top of the installer can be changed with a similar entry.

Additionally you may want to check if a particular version of the .NET framework is installed. The simple setup template allows you to do this if you reference the WixNetFXExtension assembly and add its namespace reference. If you want to actually install a framework you need to use Bootstrap project template. In order to do the actual check you will need to add the following tags. The location doesn’t seem to matter but I put them inside the product tag.

Over the past several years JSON has become the darling of service message standards. These days you are shunned if you offer a SOAP service. The more I use JSON service though the more I question if they are really the answer.

The Good

The main feature of JSON that makes it attractive is size of the data over the wire. The structure tagging method is a more compact that that of SOAP/XML messages. For high volume or large message services that could be a critical performance improvement factor.

The fact that JSON was created for use in Javascript also makes it ideal for client side development. So if you develop with a heavy client Javascript coding you will be pretty happy.

The Bad and The Ugly

I have three main complaints about JSON. The first is discoverability of services. Traditional SOAP service have a WSDL service definition associated with them that gives you a list of all the methods in the service and the structure of the calls and returns. Now if you want to obscure the methods you are publishing then JSON is the right tool for the job from what I have found so far. If that is not your goal then you better have very complete documentation that is easily accessible to developers.

My next gripe is about readability. One of the stated goals of the standard is to make it human readable. I would argue that it can be readable it is only if you tools that will format the message for you. I’m not saying that it is less readable than XML, but most development tools have formatters built in for XML which is not the case for JSON. For the moment that means it is harder to inspect JSON messages.

The last thing that frustrates me about JSON are the available tool for interacting with services within Visual Studio. We can serialize JSON messages, debug through them and even past messages as classes, but we still don’t have tools to make service proxies the way we do SOAP services unless they are part of a WCF service.

The Lesson

If you are creating services for general consumption you should take into account who will be leveraging them and what tools they have available. Make their life as easy as possible by either providing a discovery mechanism or at the very least complete and up to date documentation.

On the other side, if you are a consumer of JSON services you need to invest time in discovering the tools and techniques that will allow your development to be successful and painless as possible.

In the end we are stuck with JSON until the next defacto standard comes along. Whether you agree with its appropriateness you need to become well versed with its usage from whatever platform you develop for.

Simple views in ASP.NET MVC 5 are simple, but once you start getting a lot of conditional content formatting in the view things can get very messy. Once you get to the point where your Razor code has way to many if/else blocks and they start repeating you have to come up with a way to abstract and simplify your code. I looked at functions and partial views as possible solutions. Both of these have their place but an alternative that you may want to entertain is implementing your model as more than just a DTO (data transfer object).

The advantage that that this approach gives you is that you can more directly take advantage of the data in the model. If you create a function in Razor you need to either have page variables or pass in a number of parameters to accomplish the same ends. You can use the return value of your methods to set attributes in your HTML or simply to compress your code.

This does break the MVC pattern strictly speaking, but as I always suggest you should use standards as guidelines and not absolutes. Follow the pattern as long as it makes sense and when it gets in the way do what needs to be done to achieve your goals. This is one alternative for a specific problem type. Use it for what it is.

When I first started creating Project Spark worlds I would try to build a mountain and then tunnel through it to create halls and rooms. This really became a test of patients. Once you have created a narrow space with ceilings it is hard to get your camera in the right place to know which direction your tunnels are heading, how close you are to the outside of your terrain and good luck placing props. The solution is actually pretty simple. Use the Add tool with the cube brush and make your corridors and rooms with an overhead camera as displayed above. Once you have the first level laid out paint the room floors and wall, add props and light sources. From there you can then use the Add tool again to create the next layer of your maze which creates you ceilings of the first level as you go. I realize this isn’t anything amazing, but sometimes it is hard to see simple solutions. Enjoy

As you may have noticed, I really enjoy building Project Spark games. Until recently you have only been able to create them on Windows 8.1. Now you have the option of playing Project Spark on XBox One with XBox 360 coming in the future. While I don’t have an XBox I have realized that there are just some things that you can’t do without a controller. The biggest one for me is manipulating the size of trigger zones around props. In order to gain this capability I picked up a second hand controller and quickly found that there was even more of a learning curve than using mouse and keyboard. I figured if I found this a challenge others might and so this post will cover some of the basics. As a starting point check out the control layout diagram here.

Zoom Camera

When you first come into the Spark environment you will find that you are zoomed all the way in to the cursor. This is where the RB is your friend. The thing you have to realize is that when you hold RB it is going to show you a button menu. this is for you to change camera modes. What it doesn’t tell you is that if you hold the RB and move the left joystick you can zoom the camera. At any time you can tilt and pan the camera with the right joystick.

Switching Tools

This one isn’t that difficult. The A button allows you to open the tool panels and the left joystick allows you to navigate through them. Once you are in a tool the arrow pad allows you to navigate the pallet at the bottom of the screen with the up arrow opening the detail menu. The big difference between between mouse and controller is the fact that with the mouse you click a tool a second time to get its alternate function and with the controller you use the left trigger to apply the tool’s alternate function.

Props

This is the area where I have the most aggravation. When you are arrowing through the pallet use the right trigger to create a prop. If you only want the one hit the B button. If you want more clones just continue hitting the right trigger. Likewise if you want to select and existing prop put the cursor on it and hit the right trigger and the B button to drop it. If you want to rotate or scale the prop hold the LB and select the function from the pallet using the arrow pad then while still holding the LB affect the change with the right joystick. Just remember that the B button and the Back buttons are your friend. They can get you out of most situations that you didn’t intend to get into.

Terrain/Paint/Biome

Another significant difference when you move to the controller is the concept of setting the height of your brush above the surface. The mouse is always set to touch current surfaces. With the controller you need to you the X and Y button if you want to move your brush vertically. Just keep an eye on the dotted line below your brush to see if you are at the level you want to affect. Otherwise most of the rules for selecting from pallets apply the same as props.

Brains

Creating Kode in your brains is much slower for me and takes a lot more concentration with the controller. The nice thing about keyboard development is that if I know the tile I want to use I can start typing the name and filter directly to it regardless of how deep it is in the tile tree. Conversely, I am probably learning more about the tile tree using the controller.

To get into a brain select the prop with the right trigger and then hold the LB and press the Y button. To insert a new line or tile where one already exists press the left joystick button. While you are in the tile tree RB and LB will navigate through the pages of the same level. RB and LB will also allow you to navigate through your brain pages. If you are on a line number and press A you will get the arrows to move or indent the line. Pressing A again will leave this mode.

Test/Save/Settings

The Start button will bring you to the screen where you can test and save your work or change settings. While on this screen if you hit the Back button it will take you to your profile screen (always have to know progress on your challenges).

Summary

That should cover most of what you need to get started. Experiment with the popup button menus and enjoy.

It is conference time again and this year I am speaking at the Chicago Code Camp on my latest addiction: Project Spark. This is the game that is currently in beta on Windows 8 and XBox One which doubles as a game development environment. Come and see how you can enjoy this and even spend more time with your kids and subliminally teach them how to code. Register at the link below.

I have found over the years that many of the IT people that I work with have photography as a hobby. Recently I stopped and realized how similar the skill of a good architect are similar to those used in photography. Below I explore what I see as common traits.

First and most important to both endeavours is the ability to see both the big picture and the details. Photographers observer both the individual subject such as a bird and the surroundings that it is interacting with. A beautiful bird alone can make an impressive picture, but if you capture it in an unusual place or interacting with other animals the interest increases exponentially. Likewise you may look at one business problem to be addressed by a software system and solve that problem, but if you can put it in the context of the overall business process you can greatly improve the way a business operates.

You need to look at things from different angles. In photography you may look at a subject from above, below or even behind in order to find a more interesting view. With business problems we will look at it from different users’ perspective in order to make sure that we are taking the most important use cases into account. Likewise we will look at different technology solutions to address the business needs in order to handle usage scenarios and volumes. In order to more easily see these different angles you need to explore different techniques. Spend time when you are not on a project experimenting with proof of concepts, new technologies.

Tools aren’t everything, but they do make a difference. If you have a camera phone (who doesn’t?) then you can capture a wide variety of images, but if you want to optically magnify an image or change the how much of the subject is in focus then a camera phone just won’t do the job. Likewise languages like Javascript are very good a general functionality, but if you need high performance or need to talk directly to the hardware you need a more appropriate language and associated tools.

This is just a generalization of the skills you must acquire to be a good architect. Add these to your toolkit and continue to find ways to improve your projects for your clients.

Many kids are addicted to Minecraft. It is a game that allows you to build the environment you play in and even create new content if you are willing to learn how to make mods. Project Spark is an offering from Microsoft which allows you to create and play top quality games. For the last couple of weeks I have been addicted to the beta of Project Spark and working with my boys to make some games. Even though it is still in beta there are some great features. It would take a tome to cover them all, but here are some highlights.

Modifying your terrain is probably the first thing that you want to do. They have created a number of tools that allow you to create very realistic and varied worlds. They fall into two categories: adding terrain and subtracting terrain. The Add/Subtract tool allows you to quickly add large amounts of terrain or carve trenches. The Expand/Erode tool on the other hand builds or removes terrain is a more even fashion.

Props can be everything from characters, houses and weapons to props that you have built and saved as assemblies. This means that you are not limited to what the Dakota team has created.

You world will need some color. Biomes and painting give you the ability to make your game feel like it is happening in a real world. Painting is about adding simpler textures where as biomes handle adding textures, plants and other objects based on the type of terrain and height.

No game is complete until you add rules and logic to it. Kode is the name of the programming language that Project Spark uses. It is a full featured language that allows you to control practically any aspect of your game. The image below shows a small example.

Given that Project Spark is a beta I have run into a number of bugs. Despite this I think it is really worth your time to sign up and get a beta key. What you can build is almost unlimited and will be even better in future releases. In the near future that key will also get you access to the XBox One and XBox 360 beta. You too could have a new addiction.

Every new version of Visual Studio adds new features that make it easier to build apps in a maintainable way with best practices. Yesterday we got to see the latest enhancements in Visual Studio 2013 during the virtual launch event. I appreciated that yesterday’s event was live streamed, but even more that they didn’t stop the streaming when they left the keynote session. This made it much easier to go back and catch tid-bits that I missed the first time through.

One of my favourite announcements was for Visual Studio Online which takes VS to the cloud. The web site says that this product was formerly known as Team Foundation Service (TFS). It includes end-to-end services: build, deploy, monitor and more. It is free for teams of up to 5 people and for MSDN subscribers with pricing for other team sizes. I need to look into it more, but they stated that it allows you to build non-MS based solutions as well.

They announced “Monaco” which is the code name of the web based IDE that is being released as part of Visual Studio Online. The first release is specifically for building Azure solutions. I can see this growing into a string of VS Express like offerings for each platform. The possibilities are exciting.

A lot of what I saw was more about Azure and platform related rather than Visual Studio itself. There was also a lot of the event was spent highlighting third party tools such as Xamarin.

Of course Scott Hanselman was his usual magnificent showman. I loved it when he was showing the Browser Link feature in VS2013 for ASP.NET development. When he told the crowd not to applaud because what he was showing wasn’t cool enough was great. Any event that has Hanselman and Guthrie is bound to be entertaining and informative.

There are far too many things that were shown during the event to cover in one post. In the end I think Visual Studio 2013 is making great strides toward the goal of “Any App, Any Team”. I would add “Anywhere”. With all the new features and offerings I see development for the Microsoft ecosystem getting easier and easier. I can’t wait to update my machine and start coding.

Tim is a Solutions Architect for PSC Group, LLC. He has been an IT consultant since 1999 specializing in Microsoft technologies. Along with running the Chicago Information Technology Architects Group and speaking on Microsoft and architecture topics he was also contributing author on "The Definitive Guide to the Microsoft Enterprise Library".