I ran into a situation today when one of our microsites that was developed by a 3rd party is no longer… manageable. To be less politically correct, we don’t have access to the data anymore. Nothing significant, but annoying. The only way to see the data was through the web site. Yet data was paged, with about 40 pages. This is where curl was really helpful. Apparently, you can parameterize URLs (thanks to Sameer’s post) passed into the command, as well as the output. Here’s an example:

curl.exe -o page#1.html http://dummy.com/show?page=[1-40]

Where page#1.html will be populated by the current index and index is set from 1 to 40. Awesome trick!

This is it. Liam has built his first program (sort of) and I am glad that the reason he did it was to confirm what he learned and not as a desire to become a programmer. If you haven’t seen http://www.khanacademy.org/cs/ check it out. An outstanding resource for kids to learn basic programming and practice some math skills. Liam has started Algebra and this was his first “program” to solidify understanding of concepts such as variablealgebraic expression, formula, input, and output.

image

I loved the fact that it was in JavaScript, so natural (he knows how to use browser), intuitive (var for variable). Except semicolon – VB developers would agree with Liam on his words: “weird”. 

As a parent, I’m going to embrace this tool, hoping that Liam will benefit from “real-time” visualization, though I will never substitute a printed book with it.

PS: Liam is 8, in case you are wondering.

If you have tried to build a web interface that would work for most of browsers and variety of devices, you’ll appreciate Twitter Bootstrap project/framework.

Personally, I liked the following:

  1. Decent documentation and examples
  2. Ease of setup and use (nuget: Install-Package twitter.Bootstrap)
  3. Intuitive rules names

Recent DNC Magazine has a starter article on how to get it going.

When system is built, no one wants to baby sit after its up and running. Therefore, there is a strong desire to automate everything, including error handling. But sometimes automation is not suitable for every error, and here is a good example.

An email signup service that I have created is using a 3rd party service to discover city, region, and country from city name only.  Easy and intuitive for customers, head ache free to maintain (no need to keep data source up-to-date). All good and nice till I got an error reported by someone on the team – instead of City the system reported “junk” (see screenshot).

image

After debugging a little, it was simply bad data coming back from the 3rd party service (which I have to admit was extremely reliable and accurate for the most part). So what do you do? Initial response in the team was “lets code it so that when a city has a comma and space, we strip it along with the rest. I.e., when “Calgary, Alberta” is received for a city name, we strip the “, Alberta” portion. Sounds like a great idea, can be automated and be done.

But wait a second, there’s also a different issue as well, sometimes system reports Region (aka state / district / province) incorrectly (“AB Alberta” rather than “Alberta”). It is not affecting production right away. So would it be correct to apply the same “fix logic”? At the same time, it could be “City, Regions, Country” returned in a field for City only. Does it make sense to automate the process of fixing the problem (considering that it happens rarely)? Or, perhaps, it’s worth to automate alerts about malformed data, but leave data clean-up to a person?

We have decided to do the minimum required – automate alerts for data that looks odd, and leave fixing to a person that actually deals with subscriptions.

I’m new to Windows Azure, and learning by making mistakes. There’s a lot to learn about Azure in general, and one of the interesting aspects is deployments and cost associated with it. Taking this moment, I’d like to thank Yves Goeleven, Azure MVP, who has helped me a lot.

The simplest deployment that can be done is either directly from Visual Studio .NET. But it’s not automated, and requires a person to trigger it. Next option is to automate it with PowerShell scripts, leveraging Windows Azure PowerShell Cmdlet. But you have to ask yourself, what am I deploying EVERY SINGLE TIME?

When deployed for the first time, I was horrified – 30MB package. Goodness, no wonder it takes forever. “Azure sucks” was my immediate diagnosis. Wait a second, does it? Hmmm… Something tells me it’s not the Azure that sucks. Let’s analyze it. I have several 3rd party dependencies which contributed over 7MB in assemblies. Wow, that’s a lot. Now for each role (and I have two – web and worker roles) that is 7MB x 2 = 14MB. Heavy, don’t you think?

Solution is simple – Startup Task. Azure supports Startup tasks, which is a very powerful concept. You have an option to operate on the machine instance or a role is deployed to, prior to the role execution. This is great, because I can fetch my 3rd party dependencies just before role instance is started, ensuring all dependencies are in place. Where from though? Azure storage. When you deploy your package, you deploy it to the Azure Storage anyways, so why not to upload a zipped blob with your dependencies once, and fetch it every time? This will save you the cost of uploading for every single deployment you do. Event better – when on the same data centre, you don’t pay for moving data. So not only your packages are smaller, shorter deployment time (upload part), but also you save on storage transactions, translated into money saving.

I have gone through this exercise with the dependency I had – NServiceBus, once just for worker role, and then for web role as well, and results are quite impressive as you can see. From 30MB deployment down to 11MB.

image

Dependencies need to be packaged and uploaded either manually, or scripted as a part of build process upon dependencies version change. Therefore I’d suggest to evaluate which dependencies can follow this path and which cannot. You don’t have to stop on 3rd party only, and can also apply the same to Microsoft Azure assemblies, since those eat up space as well, and are found in every role you deploy.

image

And once you do that, well, you are down to the minimum of your project generated artefacts.

I have an idea of creating a “Dependencies Start-Up Task” NuGet package that would take away boiler platting away and allow you to achieve this task with less effort. Would you consider it to be useful? Let me know your opinion, and, perhaps, a few bits will be spared and NuGet be less spammed.

When packaging Windows Azure solution from within Visual Studio .NET 2010, CSPACK is generating cspackproperties file behind the scenes, defaulting to .NET 3.5 Framework. I missed that part when going over the documentation and had to go through the worker role that can’t starts and no error is logged, since worker never loads. Gladly, solution is trivial and so old that is probably long time forgotten by the Azure veterans. But for newbies like myself, don’t dismiss old material, even if it’s from 2010.  Nothing New Under the Sky…

Past

In the past I have always created on premises solutions for web applications that have mostly based on the server side code responsible for front UI and backend code, with a little to none client side code (usually called “scripting” with intention that it is not really a code), predominant validation on the server side with some duplication on the client. Technology of choice was ASP.NET MVC. When choice was not mine, sometime it would be ASP.NET WebForms. Services would be created using WCF, without auto-generated proxies.

Always had quite  a few challenges with this approach, and those included:

  1. How do I test my UI interactions (those are especially brutal when UI generated partially by server side code)
  2. How do I communicate data more fluently between server and client
  3. How do I handle services related issues
  4. How do I scale development for a mixed team that has creative folks w/o coding background or setup on their machines

Current

After looking where web development is heading, it stroke me that I am dismissing client side big time. For the sake of argument, my cellphone is as much capable as my computer browser. Interesting that I still differentiate the two when besides the size and and scale of horse power both are sort of the same these days…

Either way, after looking at backbone.js and the tooling around it, playing with it in JetBrains WebStorm IDE it felt right to write client side application and delegate UI responsibility to the browser executed code, and not script I was using before (note: I still don’t entirely grasp the potential with JavaScript, but hopefully getting there). When watched Backbone Basics it made me wander, why would I need my server code for UI and related validation? Truly, all it was required for was for data retrieval/storage. I scaled back my server side application to static views, controllers, and integration code (storage, services, etc.).

This way, some of my questions if not got answered, then at least I could see the light at the end of the tunnel. neither designers didn’t have to stare and @Model.FirstName like fields anymore asking what the heck is that, nor had they to have a full blown development environment in order to make CSS change or markup layout update. It felt great. Suddenly, UI interactions testing became more realistic (I have only saw Jasmin and QUnit in action, and it looks way better than no tests for client side at all I used to complaint about).

Another great outcome of this was ubiquitous language. I know it sounds a bit weird, we are using C# on server side and JavaScript on the client side. Ubiquitous language for me was JSON. I know could go back and forth leveraging a single standard for expressing data.

Now in the server side code I could concentrate on things like reliability using NServiceBus, which I like a lot, which solved a lot of questions of reliability, boiler platting code, and simplicity.

Next step was to challenge on premises hosting. I have tried Azure (cloud solution or whatever the current name is) and all of the above fit so nicely. It just made sense. Static files became content that could be served faster through CDNs (or at least this is my plan), which would possibly include views, templates, images, and client side code. Services could be scaled if needed (granted they are written in appropriate manner, and this is where NServiceBus helps a lot). I also looked at the cost benefit. Looking at the hosting cost, hardware cost, maintenance cost, cloud becomes more attractive. There’s a lot to figure out and improve in my case, though it feels like the right direction.

Future

So with all this, where am I heading? Exploring more for sure. I have to figure things like automation and deployments using build server and automated scripts, rather than Visual Studio .NET. I have to learn how to leverage web better for things like caching and distribution. Really get JavaScript and not just use it shallowly. Review my old development assumptions and possibly unlearn a thing or two Smile

Whatever it is going to be, it looks better than were I started, because it’s getting into a shape where I would want my code to be. And if you happened to know good resources for pushing forward approach I am trying to adopt, don’t be shy to share.

Sometimes very basic things are so rooted in our heads that we often forget how to explain those basics to others. So was in my case when I needed to prove my son that A(B+C) is AB+AC and not just AB+C as he originally thought. To my surprise, I couldn’t think of a way to visualize it and explain. Wait a second, if you can’t explain something you supposedly know, then you don’t really know it well… Gladly, a friend of mine remind me the way to prove it. Why am I sharing this incident? Because a lot of times we assume we know something, till we actually need to explain it to others, and that’s where our knowledge is truly tested. This is something that is greatly exposed in pair-programming. And maybe that’s the reason so many avoid it with every possible excuse out there. Just saying…

Oh, and if you want to see the simplest way to explain to a kid why A(B+C) = AB+AC, here’s visualization:

 ABC

I have ran into a problem when tried to pull down a project from subversion repository that uses self-signed certificate. This post has helped tremendously.

This exception drove me nuts:

System.Transactions.TransactionException: The partner transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT: 0x8004D025) ---> System.Runtime.InteropServices.COMException: The partner transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT: 0x8004D025)

This blog post solved it and made my day. Thank you.

DTC was disabled on SQL Server machine, which caused messages sent via NServiceBus to fail when NSB service was trying to process them in transactional manner agains SQL Server. As blog post above says, Microsoft post explains how to address the issue.

More Posts « Previous page - Next page »