CodeMash and KidzMash v2.0.1.5 — An Amazing Experience

Last week, I attended my fourth CodeMash conference but for the first time ever I attended as a speaker.  CodeMash is a great technical conference that takes place the first week of every year at the Kalahari Resort in Sandusky, Ohio.  It gathers together C#, .Net, Ruby, JavaScript, F#, Python, and hardware enthusiasts from all over with many speakers traveling internationally for the opportunity to share their expertise at this conference.  But the one thing that makes this conference so very special is the KidzMash conference which runs in parallel and is designed specifically for kids.CodeMash V2.0.1.5

This year, I presented two different KidzMash sessions.  The first one had a handful of kids sorting themselves using a variety of sorting algorithms in order to figure out which would be best for what scenario.  At the end of the session, quicksort won for a previously unsorted list while bubble sort came out looking pretty good for a pre-sorted list.

My second KidzMash session illustrated the fact that computers only think in ones and zeros and what that meant when dealing with simple tasks.  As a group, we learned about binary numbers as well as how to represent letters by assigning each letter a number.  Amongst other activities, we used a simple compression algorithm on a black and while image, sent the information to a “printer” (a child with a black marker), and instructed it to “print” out the original image, all without information loss.  We even discovered the concept of parity!  All this in a fun and highly interactive session.

The adult session I presented, From Zero to Full Deployment Automation in 60 Minutes, was a repeat of one I had done at ThatConference in August 2014.  It was well received and its success has me already considering preparing a sequel to propose for CodeMash 2016.  Immediately after my session, I met a couple of gentlemen who had attended ThatConference and had used my session content to implement continuous deployment at their company.  It was encouraging to see that my material had been instrumental in helping someone improve their development environment!

I attended many sessions, learned a lot, and left the conference inspired to get involved in or even kick off many more projects than I can reasonably tackle in a year.  I met some fabulous people, chatted with old friends, learned to play Settlers of Catan, and had an overall blast.

My gratitude goes to the CodeMash and KidzMash organizers, volunteers, and sponsors.  Thank you for inviting me to speak at your conference, thank you for promptly addressing any and all issues as a speaker, and thank you for believing in me.  You have made CodeMash awesome yet again.


That Conference 2014 – My first speaking gig!

Last week, I attended my first ThatConference ever with my husband and teenaged kids and truly enjoyed the experience. The drive was a bit long but thankfully uneventful. Best of all, there were no road closures due to snow storms the way there was when some co-workers and I drove to CodeMash in January.

Our first ThatConference experience was the lining up for pre-registration on the Sunday night. The lineup was surprisingly long but, as a speaker for the conference (my first official conference speaking gig ever), I was invited to skip to the front of the line with my family, a luxury I am very thankful for!

We then spent a little while getting our bearings in the conference centre and checking out the room I would speak in. Here and there, I ran into speakers or people I had previously met at CodeMash so there were a few familiar faces in the crowd.

The next 3 days disappeared in a blur. Conference sessions, food, great conversations, and waterpark activities made up most of my days. Here’s a quick summary of the sessions I attended:

Pushing Data to Millions of Devices in Seconds – Chris Risner: Chris gave an overview of the Azure Push Notification Service. He covered some of the challenges encountered with high scale notifications as well as the various implementation decisions you might wish to make depending on your usage scenario.

Leon’s Allegory of the Cave – Leon Gersing: Leon started his entertaining talk with finger puppets but quickly moved on to meatier content as he moved through Plato’s allegory of the cave and mapped it to our own lives, encouraging us to be both teacher and student and to honor the journey of those beside us.

The Open Source Survival Guide for Women – Coraline Ehmke: Though I was interested in the topic of open source contribution, I hesitated attending this session because it was targeted to women and my personal philosophy is that gender should have no impact on the subject at hand. I felt my fears had been justified when Coraline kicked off her presentation by asking the dozen or so of us to introduce ourselves and tell the group about a childhood fictional hero of ours. She then walked us through her own personal guide for carving a niche in the open source world. To get a foot in the door, she suggested either starting our own projects or getting involved by fixing bugs or writing documentation for tools you are passionate about in order to build a reputation and a circle of connections. Once the community knows your dependability and your skill level, it’s easier to get involved in the actual development of tools. In spite of the shaky premise and doubtful start, the content was well worth attending.

Read World SPA: A Knockout Case Study – Corey House: Corey walked us through a SPA he and his team developed using Knockout and a whole slew of other tools. He explained the motivation behind the choice of the various tools and described the benefit derived from using them. He also explained the reasoning behind some of the less intuitive choices that the team made that appear to go against what are touted as best practices.

Machine Learning – Recommender Engine and Anomaly Detection – Seth Juarez: Seth’s presentation was awesome. Through well-though-out demos, he showed us the various strategies behind machine learning. My teenaged kids who chose to attend this session as well understood and had their mind blown by how powerful the results are yet how simple the math that makes it all possible is.

How to Build Amazing Creative Music Apps for Windows – Pete Brown: Pete showed music apps and used them to outline the various elements that make an app “good”. There was no programming in this session. The session was focused more on guidelines to adhere to in order for your app to be as great as some of these other ones.

Keep Your Campfire Secrets… Secret – Robert Boedigheimer: This session provided a nice review on the basics of the various cryptography algorithms, their strengths, weaknesses, and recommended usage scenarios.

High Speed Coding in VS with CodeRush – Mark Miller: This was a fun-filled session in watching an expert show off the various CodeRush features that simplify software development. It made me realize that it would be well worth my time to become more proficient with this tool.

The Sketchnote Mini-Workshop – Mike Rohde: This was a hands-on session where, rather than write down notes in words, we were encouraged to develop our own dictionary of glyphs and images we could leverage in a note-taking situation. The presenter then invited us to draw a treehouse and then present our artwork to the rest of the class.

“OMG! This Codebase Sucks!” Paying Down Technical Debt While Continuing to Deliver Value – Jim Homes: Jim outlined the process which should guide an organization when it is considering tackling technical debt: Should we fix it? Can we fix it? How do we fix it? Fix it! Each step came with real-life information about the stakeholders and the factors which influence each decision.

From Zero to Full Deployment Automation in 60 Minutes – Danielle Boldt: Danielle did an outstanding job illustrating how you could automate the deployment of a project so that the action of checking in the code results in the project being deployed on a test bed. 😉

All joking aside, my session went very smoothly though I’m concerned I might have zipped through the material too swiftly for people to grasp. If you attended my session at ThatConference and would like to provide me with feedback (positive as well as negative), I would greatly appreciate it!

Open Spaces are big at ThatConference but the ones I would have liked to attend coincided with sessions I also very much wanted to attend so I regret to say I did not participate in any open spaces. It is an experience I wish I had had.

Attending ThatConference allowed me to finally meet a handful of co-workers that work at the Wisconsin office and provided me with an opportunity to share some of my budding automation expertise with my peers. I truly enjoyed the experience and hope to find other opportunities to do so again.

One think I’ve learned today: Vim!

I was recently struck with how productive a developer could be when using a text editor and keeping his hands on the keyboard.  Sure, I’d coped with Vi 20 years ago in university but I’d been relieved when “better” graphical editors eventually came along for my mouse-driving pleasure.

But still:  Productivity such as I was witnessing was worth investigating.  So with courage in hand I installed Vim and went through the tutorial to learn the basic commands.  Now, I’m inventing reasons to use Vim just so I can get more adept at it.

I’m still young enough to learn new tricks.  What have you learned today?

Getting Started with Universal Apps

On a whim, I decided to create a new Universal App. If you haven’t been following the news, Microsoft announced Universal Apps at the Build 2014 conference. The term is used to refer to an application that is created and that will share code for multiple platforms such as Windows 8.1, Windows Phone 8.1, Android and iOS, amongst others.

In order to get access to the latest project templates, I installed Visual Studio 2013 Update 2 Release Candidate which can be found here.

Once that was done, here are the steps I followed:

In Visual Studio 2013, I created a new project and selected the Blank App (Universal Apps) option. I could have picked the Hub App but I wanted to create my own application from scratch.

New Project

I called my application the CalendarEventCreator.

This created a solution that contained 3 projects: one for Windows 8.1, one for Windows Phone 8.1, and a Shared component where shared XAML and code would reside.


This is good but the shared component is a way of linking files into both projects above. This means that the shared files are built directly into every one of the executables within the same solution. I prefer to have the bulk of my shared code reside in a class library so that it can be unit tested and built only once but referenced by various executables. This means if the shared code changes, I am not forced to rebuild and ship every executable. Here’s an excellent blog post that helps make sense out of both types of shared components: Sharing Code Across Platforms. For my project, I chose to create both a Portable Class Library called CalendarEventCreatorShared and a matching test project. My solution now looks like:


As the test project will be testing the portable shared library, I went to add a reference to the library from the test project. This, however, failed with the following message:

Error message

To solve this, I had to do two things:

  1. Go into the portable class library’s properties by right-clicking the project in the Solution Explorer and add “.NET Framework 4.5.1” as a target.
    Library targets
  2. Go into the unit test project’s properties by right-clicking the project in the Solution Explorer, change the framework to version 4.5.1 and accept the warning.

After having accomplished this, I was able to add a reference to the portable class library into my test project and started doing some real coding…which unfortunately will be a story for another time.

Hope this helps you get started with Universal Apps!


Windows Phone 8.1 First Impressions

I installed the Windows Phone 8.1 developer preview this past week and I’m loving it even though, as I live in Canada, I don’t get to have Cortana as my personal assistant.  I’m aware that I could change my phone settings to US locale in order to get it but I haven’t done so yet.

(All images, except for the manually edited Figure 3,  were acquired from the emulator distributed with VisualStudio 2013)

The first feature I noticed was that swiping from the top now brings up a full set of communication settings.  Here, I can see if I’m connected to Wi-Fi and which network it found to connect to, as well as whether Bluetooth, airplane mode, or rotation lock are enabled.  I also get a nice All Settings button I can click to easily access any other setting I wish to see.  This means I was able to remove the All Settings tile I had created on my main screen.J

Below this new menu, I get to see any system notifications such as whether updates have been automatically applied to my phone.  This Action Centre will also bring issues to my attention.  Unfortunately, the emulator is perfect so there are none to show in this picture.  😉

Figure1 - Settings menu from swiping down

Figure1 – Settings menu from swiping down

Up to this release, my main screen could show up to 4 columns of tiles.  In this new version, I can now fit in 6.  This helps me organize my tiles better and I no longer have to scroll so much when on my main screen.


Figure 2 - Original 4-column tile layout

Figure 2 – Original 4-column tile layout

Here’s what the first two rows of my tiles now kind of look like though, naturally, everything is configurable.  As the emulator doesn’t have any buttons that support the new sizes, I’ve manually modified the images so the rough icon image edges and the misalignments are all my own.  I’m not an image editing expert.  My purpose was to show what I meant by 6 columns of tiles.

Figure 3 - Sample of the new 6-column tile layout

Figure 3 – Sample of the new 6-column tile layout

There are now more sound options for my phone.  By pushing the volume up or volume down buttons, I get the usual volume indicator but it now has a drop-down menu that shows the screen in Figure 4.  This lets me individually control the volume of my ringer and notifications separate from the volume of my media and other applications.

Figure 4 - Volume options

Figure 4 – Volume options

The Calendar application now has a much more useful interface that includes the weather on each day.  However, I’m not sure I like the emulator’s forecasted weather: rain every day would be enough to make me decide to move elsewhere!

Figure 5 - Calendar interface

Figure 5 – Calendar interface

The Battery Saver app now breaks down battery usage per application.  I can discover how much of my battery was used up by reading news on my phone vs reading emails or browsing the internet.  Again, as the emulator uses no battery power, it perennially reports no usage and battery at 100% so I am not able to include a useful image of the results.  Suffice it to say that it’s nice to know what I did that cost me so much battery power!

Another feature I appreciate enormously is that in IE, I can now swipe from the left or right of the screen to navigate forward or backwards through the pages I have visited.  Nice to see that functionality finally making it into the browser though I can’t really be sure it was introduced in this version.  For all I know, it’s been there for a while and I simply didn’t know!

I love the features of my new phone operating system.  I wish I had access to Cortana but I’m sure it will come my way eventually without me having to pretend I’m an American just so she’ll agree to work with me!

Are there features I’ve missed that you’ve discovered and would like to rave about?

Context-switching and multi-tasking: It’s got to stop

I used to be detail-oriented, efficient and reasonably productive.  I prided myself on delivering high quality results on or before deadlines and rarely had to go back and fix anything.

In the last few months, I’ve noticed that I’ve been sending out emails with more typos, I’ve released software with more bugs or design flaws than usual and I’ve been significantly more absent-minded than my regular self.  Someone might start a conversation with me but by the time I’m expected to reply, I’ve no clue what they’ve just said because I was too busy thinking about other stuff.  Important stuff.  Like what I need to accomplish next and how I must not forget to research something.

Looking back, I realized this started around the same time I decided to improve my productivity.   As part of my new initiative, I started to listen to the occasional podcasts while working.  Every so often, I’d perk up when something interesting caught my ear but I was invariably too engrossed up in my work to have gotten the full context.  So I’d rewind the podcast in order to hear that section again.  By the time it played again, I’d be once more caught up in my work.  Sometimes I’d go through this routine 3 or 4 times before truly understanding what was being discussed.

I finally clued in that there was an issue when I reached for the rewind button while on a conference call and there simply wasn’t one.  I’d been idly reading an email while others discussed portions of the project I wasn’t intimately involved with.  I snapped out of it when I heard someone ask me a direct question which I was unable to answer intelligently due to lack of context.  Not a good feeling.


But knowing that I have a problem is not the same as knowing the root cause of the problem nor does it necessarily indicate how to fix said problem.  It took a while but I believe I have it figured out.

I’ve fallen into a rut where I feel inefficient unless I’m doing something “productive” at all waking moments.  Performing a mindless or repetitive task?  I could be learning something while I’m at it.  Two birds with one stone, you see.  Never mind that half the new material doesn’t sink in properly and my lack of attention causes me to introduce mistakes in my work, I’m being productive!  Multi-tasking is where it’s at, or so I’ve been told.

The Self-Help shelves at my local bookstore are loaded with books that claim to improve one’s productivity and many of them push the concept of multi-tasking.  The media continues the frenzy by making me feel like I should be constantly connected and “in-the-know” everywhere I go for everything I do.

I’m not normally easily influenced by media opinions so I really don’t know where I picked up the conviction that multi-tasking is the solution to accomplishing everything I want to accomplish and still get enough sleep in a day.  However, the conviction is so well entrenched that it will require conscious effort on my part to eradicate.  So from now on, I’ll be paying close attention to the tasks I’m trying to accomplish in order to avoid overloading my circuits.

Multi-tasking isn’t working for me.  Is it working for you?


Moving Day!

This blog now has its own domain and is hosted on Microsoft Azure.  In retrospect, I should have taken notes and screenshots as I was going through the process but I got too caught up with the task at hand and now, all I have to show for it is a moved blog and a hand-wavy blog post.  But just in case I choose to do this again, at least this much will have been documented!

The first part of the process involved backing up the blog files from the old domain and restoring them on my local computer.  I then created a Visual Studio 2012 Web Site project and pointed to the folder where I’d restored the blog files.  This meant I could then use Visual Studio as a publishing tool.

Since the domain had changed, I searched through the project files and changed any hard-coded links to the new domain.  There were a fair number of those, which, as a developer, I found somewhat disappointing.

On Azure, I created a new website, configured it, and downloaded the Publish Profile.  This, I used to configure my project’s publishing functionality so Visual Studio would know where to publish my site to .


I then backed up the original WordPress MySQL database using the WordPress Database Backup plugin and sent the resulting file, which consists of a drop / create table script with insert statements for the data, to the Azure server.  Restoring it for use on Azure should have involved simply creating a MySQL database on Azure and running the script file.  The part that caused me the most grief in this whole process occurred right here.  Not only did the source code contain umpteen references to the old URL, so did a number of the database records.  So a search and replace had to be done throughout the database script before executing it in order to get the right data.  Some of the records even contained a length field so that also had to be adjusted to compensate for the new domain name’s length compared to the original one.

Once I had the database created correctly, I went back to Visual Studio.  Here, I modified the wp-config.php file to contain the new database connection string information.  Finally, I right-clicked on the project and Published it.


It took several iterations in order to get all these bits aligning correctly. Indeed, the first time I tried publishing and running the blog, I hadn’t yet realized there was a database associated with it so I got an HTML 500 error.  I used Fiddler to get more information and realized it was complaining about a connection string being incorrect.  That’s when I clued in that I had to back up a database and set it up for the new blog.

Previous to this, I knew as little about WordPress as it’s possible to know and still run a blog using it.  I had never modified .php files and had never consciously worked with MySQL.  And I certainly hadn’t done anything with Azure.  So this is all new to me.

If I’d been smart, I would have searched the web for a list of steps on how to move a WordPress blog.  I’m sure they exist.  But while my ad-hoc approach may have caused more churn than necessary, I sure learned a lot!  :)

Windows Phone 8: Where did the dropdown control go?

I recently started developing my very first Windows Phone 8 (WP8) application using C# and XAML and quickly found myself in an impasse: The Visual Studio 2012 (VS2012) toolbox did not contain anything I could identify as a dropdown or combobox control. Yet, the Calendar application on my phone uses such a control for its "How Long" selector amongst others.
CalendarApp1When the user taps on the control, it opens to reveal its values. If there are more than five values, it opens full-page. With fewer values, such as when specifying the availability state for the duration of the meeting, the list opens in-place.


That was exactly the functionality I was looking for.

A bit of research sent me in the entirely wrong direction and I started investigating the LongListSelector as a possible replacement for the dropdown control. The LongListSelector is ideal for displaying organized lists of items such as a list of contacts in an address book. While the LongListSelector control supports the use of grouping such as by the first letter of a name, for example, it can also be made to display a flat, ungrouped, list. This was what I thought I was looking for but where I wanted to tap an item and have it be selected, the LongListSelector expected the tap to navigate the user somewhere else as it does when tapping a contact.

Thankfully, the article linked above mentioned that the LongListSelector had been moved from the Windows Phone Toolkit to the Windows Phone SDK. So I investigated the Toolkit and found the ListPicker control. This was exactly what I’d been looking for.

I installed the Windows Phone Toolkit using Nuget as described here but was dismayed to find that, though I could now manually add the control by typing it into the XAML file, it didn’t appear anywhere in the VS2012 toolbox.

Again, I searched for instructions for adding these new controls to the VS2012 toolbox and found these. This helped get me a bit closer but didn’t entirely solve my problem. Here are my revised steps for adding the Toolkit controls to the toolbox. Please refer to the original post for screenshots and for a much more comprehensive description of the process.

  • Go to the VS2012 Toolbox tab, right click over General and select Add Tab from the context menu.
  • Give a name to the newly created toolbox section.
  • Right-click the newly added section and select Choose Itemsà


  • This is where my instructions are a bit different. The original poster simply selects the controls and adds them to the section. I never found the ListPicker in any of the Choose Toolbox Items tabs. In order to see it and its toolkit mates, I had to click the Browse button and navigate to the toolkit library located by default in \Documents\Visual Studio 2012\Projects\DataCollector2\packages\WPtoolkit.4.2012.10.30\lib\wp8.
  • Click OK. This adds the list of toolkit controls to the "Windows Phone Components" tab. Note that they are conveniently pre-selected.


  • Click OK. You now should have the controls in a new section in the toolbox so you can drag and drop to your heart’s content.

Hopefully, this can help save the next person some time!

Happy coding!

Kids and Code: Where to start?

Though I am a software developer, I am not a born educator so when my children demonstrated a spark of interest in learning how to program a computer, I turned to the internet and searched for resources appropriate to their age and personalities.

I performed my first search several years ago and the results were less than encouraging. I found a few books aimed at an audience much older than my children were at the time, a few antiquated programs that oftentimes did not install correctly on my home computer, and very little else. Much has changed with every year adding more exciting options to the mix. Here are a few of the options I would have been glad to find back then and may yet be making use of.

Please note that while I may not have personally tried all of these and cannot vouch for their suitability or effectiveness, I do like what I’ve heard and seen so far. I’ve tried to organize the list by age but here again, your individual mileage may vary as every child is unique. I provide some links to online resources but I strongly encourage you to search for more as there are often several excellent sites out there dealing with the same topic. Finally, I’ve deliberately kept the links visible so this list could be printed and remain useful.

How to train your Robot:

Dr. Techniko developed a “programming language” that 5 – 7 year old children can master and write their own program with. It involves no computer and no typing. The programmer uses a series of pre-defined symbols to program their “robot” to perform a certain task. Too bad my own children are too old for this. Looks like fun!

The only requirement is the information from the web site, a goal to accomplish and a patient and willing robot (parent). :)


Scratch is a simple drag-and-drop language designed to enable children to create their own interactive stories, games, and art. It has a healthy online community and a huge amount of resources. It is free and can be downloaded from the web site.


I remember learning LOGO as a child and was pleasantly surprised to see that this lovely language still exists though some of the web sites are a bit dated. LOGO is primarily a geometric shape drawing language.

The list of LOGO commands can be found at though much of the rest of this web site is not publicly accessible. There is a nice editor to type your programs into at

LEGO Mindstorms NXT:

LEGO’s Mindstorms NXT line of programmable robot controllers is an amazing though unfortunately expensive teaching tool. Out of the box, I was a bit dismayed to see that the controller comes with very little in terms of instructions or sample projects but there is a large amount of material online. This means that once your child has happily torn the wrapping paper off the box, the next stop will be the computer to find something to build with the kit.

LEGO recommends this for children 8 and older. Access to the internet is necessary in order to read up on how to program the controller and to research all the neat creations that can be built.


Alice is an object-oriented language used for creating 3-D animated stories, videos or games. It uses a drag-and-drop development environment to avoid unwieldy syntax or complex development tools found in other languages. Alice also has a very active online community.

Targeted to children in middle grade and up, Alice is freeware and can be downloaded from the web-site.

Computer Science Unplugged:

Computer Science Unplugged is a series of interactive group activities that teach computer science concepts without the use of a computer. Aimed at the 5 to 12 year-old group, all you need is a small group of willing participants and someone to lead the activity.


Phrogram is a Visual-Basic-like language that doesn’t attempt to shield the programmer from syntax or the complexity of development tools. Indeed, combined with the appropriate extension libraries, Phrogram applications can be written to access a database, do complex mathematical calculations or read and write to a file on disk. Aimed at the more sophisticated programmer, Phrogram can be downloaded from the web site for a reasonable fee.


Codecademy is an excellent web-based resource for learning web-based development languages and tools such as JavaScript, HTML, CSS, Python and more. It goes through material in a gradual manner. This web site is suitable for anyone who doesn’t require animated characters leading them through their training as if it were a game. A browser is all you need to get started. I know several adults who have learned programming through Codecademy.

Microsoft XNA Game Studio 4.0: Learn Programming Now!

Though not strictly an online resource, this is an excellent book by Rob Miles (Microsoft Press) that teaches a beginner the basics of the C# language and the XNA framework in order to develop games for the XBox platform.

My son devoured the previous edition of this book when he was 10 years old. He read cover-to-cover and tried the first few examples on his own. Then, over spring-break that year, the two of us sat down and went through the remaining exercises till he had a working game and an reasonable grasp of object-oriented programming.

A Windows 7 computer is required. Visual Studio Express and the XNA Framework can be downloaded for free. Access to an XBox 360 makes the end result more exciting but is not required.


Coursera is a collection of free university-level online courses. These courses start a pre-defined date, go for a set number of weeks and require assignments and evaluations to the handed in at specific times. A certificate is presented upon successful completion of the course. Great for teens and adults.

For this, you need to be able to dedicate time each week to view the several hours of lecture videos and complete the assignments.


Along with the above online or book resources, I also recommend looking at community or library education programs, summer camps and other organizations in your community. A quick search of my community guide shows me the following programs are being offered for a reasonable fee:

  • Summer Day Camps: There’s an animation and Web design session for children 8 – 13 and a LEGO Mindstorms NXT program aimed at children 6 – 10.
  • Weekly sessions: Introduction to programming with Scratch is offered to children 11 – 15. Various robot building sessions using LEGO’s Mindstorms NXT are targeted to children 5 – 16 years old. Java, C++, and web design courses, on the other hand, are offered to the 12 – 16 age group.

And finally, there may be private tutoring companies in your community that offer programming courses. For example, Real Programming 4 Kids offers game programming classes for children of various ages in my community. This particular company has at most a 4:1 student to teacher ratio, ensuring that each child gets a fair amount of individual attention. Organization of this type may exist in your community though they may come with a higher price tag than you’re willing to spend.

While I have highlighted the resources I’m familiar with, there are many more excellent ones out there that have simply not crossed my radar. If you know of them and can recommend them, leave me a comment and I’ll gladly update my list.

One thing I’ve learned today: Learning new technologies via samples results in Frankencode

I was asked to develop an internal tool that would manage the advertisements we would display in our application. My requirements were simple: I needed to provide the user the ability to view the list of existing ads, create an ad by uploading an image along with the ad metadata, update and ad or delete an ad. Since our customers would never see this application, I went on a limb and chose a technology I’d never tried and knew nothing about: .Net Web Api. I figured I’d adapt one of the many excellent examples I found on the web so that it would serve my purpose. How difficult could it be?

I wrote the service component first and left the ad management user interface till last and for that, I chose a simple product catalog sample application that used jQuery and Knockout.js, two more technologies I had no previous experience with. Again, I knew there were lots of code snippets available on the web for those libraries so, armed with a decent search engine and StackOverflow, how could I go wrong?

The product catalog sample provided me with code for a basic grid and a set of detail fields. The user would enter the row id in an edit field and click a button to fill the detail fields with the data for that particular ad. An Update and a Delete button at the bottom of the page would update or delete the selected ad. This wasn’t quite what I had in mind but it was a close approximation. I figured adding a delete button to the appropriate row in the grid and providing the ability to click a row to populate the detail fields would be simple to implement once I had the basic functionality working.

I looked for examples of image uploading and found several, all with their quirks and limitations. Figuring out which limitations I could live with and which I couldn’t took some time. I really wanted to be able to upload an image and its associated metadata (name, width and height) all in a single POST request but most of the samples either dealt with uploading just the file or uploading a whole slew of files…but no other data. I tried all sorts of file upload methods with various degrees of success before settling on one that used a strict HTML page with a form tag and a submit button. Have I mentioned I’d never dealt with uploading files over HTTP POST requests before?

Frankencode monster

Once I got the file upload working (though I’m now working on the functionality that will inform the user whether the upload succeeded), I stepped back and took a cold hard look at my application. What I saw was a Frankenstein-type application. The samples I combined were never meant to go together. I know I’m not validating my fields in an even remotely optimal manner. I’ve tried to hide the delete button for images that are still referenced by an ad and therefore can’t be deleted but haven’t figured it out yet. It should be a simple matter of making the delete button’s visibility conditional upon whether the image is referenced by an ad but my condition always evaluates to true so I still have to do a bit more work on the project.

Have I learned something? A resounding yes! I can now claim to know some jQuery, a bit of Knockout.JS and something of .Net Web APIs. However, I’m lacking a lot of the very basic knowledge that I would have gained if I’d picked up a book about any of these topics and read the first few chapters. I liken it to trying to learn C# by trying out async samples. You might eventually understand how the async functionality works but without an understanding of basic C# constructs, you won’t be able to extend those samples without creating a monster and without looking for yet another sample to base your next bit of code on.

But I have to admit it’s been a lot of fun! 😉