Using KnockoutJS to Bind to Unknown Dataset

I’m currently working on a web application that retrieves data from a web API and displays it in a web page, using KnockoutJS to provide the view model to bind to.  In some scenarios, the shape of the data that is retrieved will be unknown at design time.  The tables and columns that make up the dataset will be configurable via an admin section of the site.  So when it comes to displaying the data on the page, I won’t know how many tables, rows, or columns are available.

Here is how I retrieve the dataset from the API:

var dataSetsUri = baseApiUri + 'http://localhost:63978/api/datasets/';
vm.getDataSetData = function() {
    var uri = dataSetsUri + datasetId;
    ajaxHelper(uri, 'GET').done(function (data) {
        if (data != '') {
            for (var key in data) {
                var table = data[key];

Here is a sample of the data returned from that web service call:

		{"Id":"1","FirstName":"Joe","LastName":"One","AddressLine1":"1234 Main St.","AddressLine2":"","City":"Jacksonville","State":"FL","Zip":"32256","EmailAddress":"","DateOfBirth":null}],

Using the ‘foreach’ binding, I want to display the data in my HTML page.  So I start with a div to act as a container.  Within the container, I want a table for each data table in my results:

<div class="container" data-bind="foreach: { data: dataTables, as: 'table' }">

Now that I have the tables, I want to have a column in the tables for each column in my results. Notice that the column names will be different for each table, so I need to discover them dynamically at run time. To accomplish this, I add a function to my view model which can be called from the HTML:

vm.getColumns = function (row) {
    var columns = [];
    for (var col in row) {
    return columns;

Now I can call that function from the Knockout binding.  I use the $root syntax to reference the view model scope.

    <tr data-bind="foreach: { data: $root.getColumns(table[0]), as: 'columnName' }">
        <th data-bind="text: columnName"></th>

In the table body, I will need a row for each row in the data, so again I use the Knockout foreach binding. I also reuse the getColumns function to create the table cells in each row:

<tbody data-bind="foreach: { data: table, as: 'row' }">
    <tr data-bind="foreach: { data: $root.getColumns(row), as: 'cell' }">

The final step is to display the value in each cell. I can use the ‘row’ and ‘cell’ aliases from the foreach bindings to easily access the values. The final result:

<div class="container" data-bind="foreach: { data: dataTables, as: 'table' }">
    <table class="table table-bordered">
            <tr data-bind="foreach: { data: $root.getColumns(table[0]), as: 'columnName' }">
                <th data-bind="text: columnName"></th>
        <tbody data-bind="foreach: { data: table, as: 'row' }">
            <tr data-bind="foreach: { data: $root.getColumns(row), as: 'cell' }">
                    <span data-bind="text: row[cell]"></span>

And the finished product:
Go forth and code!

MinistryMate 2.4 Released

ministrymateToday I released version 2.4 of my popular Windows Phone ministry app, MinistryMate.  This is the first update in several months, but I’m certain the wait was worth it.  This update brings some very important functionality to the app: the ability to sync data to “the cloud.”  This functionality is useful for a couple reasons.

First, it removes the need for manual backups of the app data. Since the app was first released, backing up the data has been a constant concern among users who were fearful of unexpected crashes or phone malfunctions.  So I added the ability to backup the app’s data file to, and then restore from that backup.  That allowed users to easily reload their data if they had to reset their phone, or load it on a different device if they switched phones.  But lately, the backup functionality has been finicky at best, frequently causing the app to crash, or not being able to retrieve the backed up file from dropbox.  So now, the data is backed up automatically to a secure database on the web host.

Second, adding the cloud storage to the app enables the app to be used from any device on which MinistryMate is installed, without having to worry about losing or overwriting any data.  Today, that may not mean much. You most likely aren’t using two phones and need to have your latest ministry data on each one at any given time.  But in the near future, I plan on releasing MinistryMate as a Windows Store app!  At that time, you will be able to install it on a Windows 8 PC, a Windows 8 or Windows RT tablet, or a Windows Phone 8 device.  Then I expect that you will love having access to your MinistryMate data from any of those devices!

Thanks to all who have supported the app and continue to provide kind words and constructive criticism. Because of you, MinistryMate is the best ministry app on Windows Phone, and my hope is that it will soon be the best ministry app on Windows period.

The new version can be found in the Windows Phone store by clicking here.

Watchtower Library on Windows Phone 8?

I recently wrote a post about the fact that the Watchtower Library program is not available on Windows Phone 7, and detailing some possible workarounds.  A reader responded with the following question:

Do you have any news about WTLIB on Windows 8 Phone?

In short, no, I don’t have any information about the availability of Watchtower Library on WP8.  However, based on the redesign of the website, and the inclusion of the Watchtower Online Library, it seems to me that the branch does not intend to build native apps for any mobile platforms. That site is accessible from any internet-connected device with a mobile browser, eliminating the need for a dedicated app.

This is a wise approach for the brothers. Building a native app on each mobile platform currently available would consume a lot of time and resources that would be better spent elsewhere.  Even if they chose to only target one or two most commonly used OS’s, considerable effort is required to maintain the apps once they are published.  For example, as new literature is released, it would have to be incorporated into the apps.  Add to that the fact that the mobile OS landscape is in a constant state of flux, with new updates being released at a breath-taking pace.  Publishing the data via a well-designed website is a much more cost-effective choice, without sacrificing any of the convenience that comes from having it on your mobile device.


I recently read a blog post regarding the YAGNI principle of programming.  The acronym stands for “You Aren’t Gonna Need It!”.  The idea really hit home for me because, while I’ve never heard it before, I have seen its truthfulness play out time and again in my programming career.  In hindsight, this approach could have saved me countless hours of coding/testing/debugging/refactoring on features that were not ever used.  Putting that time and effort to good use on the parts of my projects that were actually used could have benefited not only me, but my managers and employers.

One example was a project I worked on in the early days of .NET 1.0.  We were porting an ASP web app with a C++ back end to use C# and ASP.NET.  The lead developer/architect insisted on building an overly complicated process to protect the code from any unexpected changes to the underlying data structures.  In theory, it was a useful feature, employing a command-line app to generate strongly-typed datasets, which allowed us to be notified at compile-time of any changes to the structure and modify our code accordingly.  What was missing from that equation, however, was the fact that during the 3-year duration of the project, the number of data structure changes could be counted on one hand.  And each of those changes was thoroughly documented well ahead of time, so the requisite changes on our end could be made at the appropriate time.

In addition to the added time spent building and maintaining the supporting app, this approach forced developers to retrieve data in a rigid and non-performant fashion.  The resulting complexity slowed down development of core pieces of the application and ultimately led to more bugs and less readable and less maintainable code.  The debate raged within the development team about whether or not this was the appropriate way to architect the application, but its clear in looking back that the most efficient use of our time and resources would have been to avoid the added complexity and build only what we needed, only when we needed it.

More recently, a development manager that I worked for was fond of designing elaborate and complex solutions to problems that we had not yet encountered.  Often, this involved some new design pattern he had read about and wanted to find a way to work into our project.  The result was seemingly constant revisions to the product release dates, as well as sometimes tense discussions with upper management trying to rationalize the delays.  Also, we frequently had to deal with performance issues due to unnecessary layers in the architecture.  We finally made the decision to pare down the code base to just the basics, and the resulting simplicity and improved performance was refreshing!

Having lived and learned, I vow never to build in features before I need them.  My time is too valuable to spend on something that may never be used, no matter how brilliant it may seem at the time!

AssemblyMate: Now on Android

AssemblyMate_AndroidA few months ago, I released my latest Windows Phone app, AssemblyMate.  It’s a simple app designed for use by Jehovah’s Witnesses to take notes at assemblies and conventions.  I have received a lot of positive feedback from users of the app, and I’ve enjoyed using it myself.  But being available only on Windows Phone presented some limitations.

First, the relatively small form factor of the phone makes note-taking a little tedious.  It’s not terrible, but not ideal either.  In the post where I mentioned the initial release of AssemblyMate, I mentioned that I was looking forward to Windows 8 as an opportunity to run the app on a larger tablet device.  While those devices are coming soon, they are not yet available.

Second, despite the high level of satisfaction expressed by those who have adopted Windows Phone, the fact remains that the group remains small compared to other mobile OSes.  Again, I expect this to change in the future as the Windows 8/Windows Phone 8 software and devices created by Microsoft and their partners gain traction and popularity among consumers and businesses.  But such widespread adoption is likely six months to a year away, in the best case scenario.

The solution to both of those problems was to port the application to another mobile OS, either Android or iOS.  Both platforms run on tablet devices and both have large user bases to which I could market my apps.  In the end, I settled on Android as the next platform for AssemblyMate.  It was a grueling, months-long process.  First, I had to familiarize myself the process and tools involved with writing and publishing Android apps.  Then I had to learn how to code in Java.  Due to my familiarity with C#, it wasn’t totally foreign, but the difficulty of performing some tasks made it a struggle at times.

The good news is that the process finally came to an end today.  This morning I published AssemblyMate on Google Play.  Download and enjoy!

UPDATE: As of July 15, the app is now also available in the Amazon app store (download here), and will soon be available in the Barnes & Noble Nook app store.

P.S. Since it is my first Android app, and I don’t have a physical device on which to test it, I intended to release the app as a beta version, free to early adopters, and then begin charging for the app after I weed out bugs and any device-specific issues.  However, the Google policies would not let me switch from free to paid at a later date, so I had to set the $0.99 price from the start.  If anyone wants to get a free copy and help with beta testing, email me and I will hook you up.

Watchtower Library on Windows Phone?

Watchtower LibraryI am often asked by blog readers and users of my Windows Phone apps (MinistryMate, AssemblyMate, and TMS Tracker) if its possible to install the Watchtower Library program on their smartphone running Windows Phone 7.  The question is understandable, because a few years ago, a version of the program was made compatible with Windows Mobile devices.  And when running the setup for Watchtower Library, you are asked whether you want to install it on your computer or your Windows Mobile phone.

Is It Possible?

In a word, no.  Unfortunately, since Windows Phone 7 was a complete reboot of Microsoft’s mobile operating system, programs are not compatible across the two platforms. I know this is particularly disappointing for a lot of people.  I for one was excited about the launch of Windows Phone 7 because I anticipated having the Watchtower Library app on my phone.

Also, as of now, I am not aware of any effort being put forth by Watch Tower Bible and Tract Society (the publishers of Watchtower Library) to make a version that is compatible with the current Windows Phone platform.  If anything, I could foresee a version that would run on tablets, such as iPad and Android, and perhaps future Windows 8 devices. I’m sure such a broad approach would be well-received by the friends. But my fear is that with the mobile computing landscape changing so rapidly, they may decide that it’s impossible to keep up, and their time, energy and resources could be better spent elsewhere.

Other Options

The good news is there is a way to get the data from the Watchtower Library on your Windows Phone in a useable format.  The best approach is to install an app called iSilo, available here in the Marketplace for $9.99.  iSilo is a versatile e-book/document reader, available on a wide variety of software platforms.  Once you have it installed on your phone, you will then want to locate and download the Watchtower Library data in a format that iSilo can read.  Here, you have to be conscious of the terms of use outlined in the Introductory Letter found in the Watchtower Library program.  It says in part:

 What constitutes proper use? Watchtower Library has been designed for your personal use. Hence, you may copy, print, or excerpt from the data for your personal use. But you may not distribute the program or large sections of the data to others who do not own Watchtower Library on CD-ROM. Do not sell Watchtower Library or put the program or data on the Internet or any electronic network.

Because this excerpt specifically forbids distributing the data to those who do not own Watchtower Library, some brothers have viewed that as tacit approval of providing the data to those that do own the program.  One site where you can find the data – along with detailed instructions for downloading it into iSilo – is  In order to get around the above restriction, the brother requires you to become a member of the site, and the process of becoming a member involves proving you own a copy of Watchtower Library.  Once you have downloaded the data file to your device, you will be able to use iSilo to access all the data in the Watchtower Library.

You can find some additional information and links at

Beautifully Different

Nokia Lumia 900Beautifully Different – That’s been the marketing slogan for the new Nokia Lumia 900, the flagship Windows Phone in the US.  I got mine two days ago and I could not be happier!  I’ve been using a Samsung Focus since the day after Windows Phone 7 launched in November 2010, and it met and exceeded my expectations during that time.  So it didn’t take a lot of convincing to get me to fork over the $99 for the latest greatest smartphone available.  I love Windows Phone for everything that it is, as well as for what it is not.  But Nokia just added one more reason to the list.

Apparently since the Lumia 900 launched in the US a few days ago, some users have experienced issues with connections to the AT&T network.  I personally have not experienced this issue, except that it took about 30 minutes for my phone to connect after I left the AT&T store.

Now, if this was an iPhone story, it might go something like this: Unhappy customers take to the forums on Apple’s site or fan sites and complain, only to be met with stern denials, blame shifting and evasive customer service.  Then Apple would quietly issue a software patch or other remediation measure to address the issue which they had previously denied existed.

Not so with Nokia!  In less than 72 hours, they have responded with the following: 1) acknowledgement of the issue, 2) an update to resolve the issue, and 3) an unprecedented gesture of goodwill

Every individual who has already purchased a Nokia Lumia 900 — or who will purchase one between now and April 21st – will receive a $100 credit to their AT&T bill from Nokia.


I would say that’s exactly what I want from the companies I choose to do business with, but that would not be accurate.  This is beyond my expectations, and that my friends is beautifully different.

Coming soon: AssemblyMate

I submitted a new Windows Phone app today called AssemblyMate. Building on the success of my app for Jehovah’s Witnesses to use in the ministry — MinistryMate — I am hoping to address another common need with the new app.  AssemblyMate will allow you to take notes at assemblies and conventions and have the notes stored right on your phone.  You can also record details about the assembly such as attendance and baptism numbers.

The assembly programs will be automatically downloaded to your phone as soon as they are available.  Then you can set the dates for when you will attend.  Within the program listing, you will be able to click on each talk and enter the name of the speaker as well as some points you want to remember.

But what good are all those notes if they only exist on your phone?  One of the nicest features is the ability to upload the notes for the entire assembly to your SkyDrive account.  From there, you can download them to your PC, print them, search them, anything you want!

And this is just the beginning!  When Windows 8 is released in 2012, look for a version of AssemblyMate that works on your Windows tablet device!

MinistryMate 2.2

MinistryMateToday I submitted the latest update to the best ministry app on the Windows Phone platform, MinistryMate.  As more and more users have downloaded the app, the feedback I have received has proven invaluable in deciding what changes to make and what new features to add.  The latest release is another example of that.  The goal of this app is to help fellow Witnesses be more organized and productive in their ministry, and incorporating the most requested fixes and new features is helping that goal become a reality.  Here’s what’s new in 2.2:

  1. Improved navigation – A landing page now gives you 1-click access to anywhere in the app.  Also, the ‘recent’ section of the panorama lets you get back to the most current items without having to hunt them down.
  2. Schedule hours for future dates – Add time for a future date, and it is added to your report as “projected” time, helping you schedule your month’s activity and keep on track to reach your goals.
  3. Filter calls by street – Have several calls on the same street?  Select the street in the calls filter and see only those calls.
  4. See current location on map – Now you can see not only the location of your call(s) on a map, but see where you are too.
  5. Bug fixes – A bug with the sorting of calls was fixed.  Also, photos should now display correctly, regardless of the orientation they were taken in.

Also, new users may note that the price has been reduced to only $1.29.  Thanks to all for the continued support, and by all means please continue to give me your feedback, both positive and negative, so I can make this app everything you need it to be.


WP7 App: MinistryMate v1.5

I just submitted the next update of MinistryMate for certification.  I’m really excited about this release because of some of the new features I was able to add that will greatly enhance the user’s experience.  Here’s a quick rundown of what’s included:

Phone Number Context Menu
Phone Number Context Menu
  1. Better backup and restore using – I added backup/restore functionality back in version 1.3, but some users have reported issues with connectivity to the remote server which the backups are sent to.  In order to overcome that problem, as well as to give the user more flexibility and access to their data, the backups will now be sent to the user’s own Dropbox account.  This transition was made dramatically easier thanks to the DropNet API developed by Damian Karzon.  NOTE: To utilize this feature, you will need to create your own (free) account at, if you don’t already have one.
  2. Easy error reporting – I’ve tried hard to create an app that is bug free and will provide the user with a reliable, stable experience.  But the realities of the mobile app world are unavoidable.  Sometimes the users will experience errors that neither I nor Microsoft have encountered in testing the app.  To address that situation, I added some error reporting code in this release.  It catches and logs any errors that cause the app to shutdown unexpectedly.  Then the next time you launch the app, it prompts you to email the error report to me.  The hope is that more information on more errors will help me make a better experience for the users.
  3. Edit RVs on the bulk edit screen – Version 1.4 saw the introduction of  bulk editing of placements as part of an improved time managment process.  I left out the editing of RVs because I assumed the automatic calculation that takes place would be sufficient.  But the voice of the users has been heard, and I have added RVs to the bulk edit screen in the new release.
  4. Service year totals for pioneers or traveling overseers – This was another commonly requested feature that I was able to add in this release.  The totals will automatically display at the top of the ‘reports’ screen if the publisher type is set to Regular Pioneer, Special Pioneer, or Traveling Servant.
  5. Turn a house-to-house entry into a call – Another user-requested feature that I was able to deliver with this release.
  6. Send a text message to a call – Instead of just clicking on the person’s phone number to call them, a user requested the ability to send a text message to the phone number.  To use this new feature, you just click and hold on the phone number.  A menu will popup allowing you to select whether you want to call or text the person.  Clicking on the phone number still works the way it always has.
  7. Spanish and French versions – Thanks to the efforts of a couple of our brothers, every line of text in the entire application has been translated to Spanish and French.  Hopefully their efforts will benefit more of our brothers who have been waiting to use this application in their native tongue.

This is easily the biggest update I’ve made to MinistryMate since the initial release back in January.  I hope you enjoy the new features, and, more importantly, I hope they make your ministry more productive as well.  Please continue to provide feedback — positive or negative — and I’ll keep working to make this app better.

piratebay,pirate bay,pirate,bay,torrents,free,free software,software,torrents,free torrents,free porn,porn torrents,torrent