Posts

Using XMLHttpRequest.getResponseHeader to get Json Response Headers in jQuery

Introduction While developing a web page with a summary graph and a detail grid below, I needed to pass a small amount of data outside of the existing Json call data sets. I also wanted to do this without another asynchronous call back to the server. I wound up stuffing the data in a custom http response header while already on the server. This article explains how I retrieved the data on the client. Existing Client Libraries Both the graph and the grid were independent jQuery libraries with very specific Json response requirements. Stuffing the small amount of data in one of those response data sets could have been done with enough tinkering but I wasn’t sure how this would affect those libraries now or in future versions. While the data was related, it was also separate and I wanted the code design to reflect that. Server Http Response Stuffing This project uses Asp.Net MVC 4. The code to add the small amount of data should be the same across the .Net platform: HttpCon...

Background tasks (continuous code) in the Cloud: Cloud Foundry beats AWS and Azure

Introduction I have a background task collection I need run, continuously, but with different timer intervals for each task. It is a critical part of my web services and provides the data gathering and transformations the make the web service valuable. How should I package the code and where should I deploy it? Only in the cloud.   As the cloud space is moving faster than I can write this, any of this could be outdated by the time you reader it. Consider Time, Money, and Ease of Deployment In struggling with where to deploy the code, I considered the cloud cost, the time to learn and build the solution as well as any cloud gothchas. I’m now on my sixth cloud provider trying to determine if they are the best at background tasks. Why? Because background tasks are where the heavy lifting happens. I want to spend my time getting that heavy lifting correct and not fighting with the cloud environment. Background Task Defined Just to be clear, I consider a background task an...

Steps for Consuming XML data in .Net

Image
Introduction While consuming third-party RSS feeds, I found I had to relearn how to deal with XML data. This post is meant to prepare any developer who needs to consume XML which they do not control. While I used RSS feeds, any XML will apply. I wanted to change the meta data and data of the XML file into a model of data that I could control with .Net classes and conventional data storage.   This post is organized to take you from an xml file to .Net classes able to consume, serialize, and test the xml. Generating an XSD file from an XML file using Xsd.exe The first step is to make sure you have the XML Schema Definition tool, xsd.exe , installed. It is part of the .Net Framework tools . Make sure the executable location is part of the system path , user path, or command prompt path. On my computer the path is “C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin” and I added it to the system path so it is available at any command prompt, regardless of the user.   Se...

Post-Ruby High with BDD in .Net

I mentioned in my last post how much I enjoyed Ruby and wanted to continue to use it in my project. That is easier said than done.   In order to leverage all the great Ruby ( RoR ) tools and methodologies I learned, I’m attempting to find .Net equivalents. This started with finding a Behavior Driven Development ( BDD ) tool. There are several that come up but they are a hybrid to a BDD (I picked SpecFlow ) tool siting on top of a TDD tool ( NUnit or MSTest).  I also needed a web driver to make calls to a browser and verify results. I looked at WatiN but went with Selenium .   The next two tools I need to add are a mocking tool ( Moq ) and an injection tool (probably NInject ).   Since the class used GitHub and Heroku , I’ll also stick with that. My GitHub account is DFBerry .  All my example code is posted up their in public repositories.

Results of .Net Developer’s 5 weeks with Ruby (RoR) and SaaS

Introduction Several things happened in a short period of time to influence my decision to take a Ruby/SaaS class. I’m a lifer on .Net or more specifically Asp.Net and it’s precursor, Asp. First, the MVC .Net book I was reading at the time said programmers either use .Net or Ruby for MVC development but not both. Second, an online UC Berkeley class was free and gave me both a new language ( Ruby ) and backfilled any software-as-a-service (SaaS) holes in my knowledge. Third, the class used the Agile methodology which I had bits and pieces of. I wanted to see someone else’s interpretation put into practice.   Ruby on Rails (RoR)/MVC I knew MVC , web protocols, and web development so the learning curve was all Ruby. The class had a quick pace where I knew how to do it in .Net but not Ruby. Ruby, fortunately, is a very easy language to pick up. It feels very much like a script kiddie toy but  more powerful.   Interpreted versus Compiled Ruby is interpreted w...

Combining Multiple Azure Worker Roles into an Azure Web Role

Image
Introduction While working on apps.berryintl.com ’s web service, it appeared from the Windows Azure project templates that I might need several worker roles because they cycle at different times. One worker needed to cycle every day. The other needed to cycle every five minutes. Since the work and the cycle rate were very different, it felt “right” to isolate each role. In this post, I’ll show you how I combined multiple worker roles into a single, underutilized Azure web role thereby keeping the concept and design of worker roles while not having to pay extra for them. In order to verify the solution, the project uses Azure Diagnostics Trace statements. The solution file is available for download . Combining Multiple Azure Worker Roles into an Azure Web Role Currently, I use a small Azure instance and there isn’t enough traffic to justify a separate worker role. I implemented Wayne ’s process for combining one worker role with a web role a while back. Now I needed to add anot...

Updating My Resume

The new preamble to my resume:   I piss excellence. Bill Gates retired from Microsoft only when I promised to work there. I don’t version my code because it only needs a single iteration. Intel optimizes their hardware to match my compiler – not the other way around. My code comments have won a Pulitzer Prize. My current code style will be consider a best practice in two years—at that time I will think it is obsolete. The programing languages that I don’t know I haven’t invented yet. I don’t submit to source control – it submits to me. Since I have never introduced a bug to the code base, my hiring can put the testing department out of work. I don’t require an office chair -- I levitate in front of my desk. My specifications are printed and bound then read at Mosques along with the Koran. Then they make the New York Times Best Seller list. Christ is the only one qualified to give me a code review. He comes back to earth when I need a code review – which hasn’t been required yet...