Archive for May, 2013

English Dictionary API served with MongoDB

May 30, 2013 3 comments

As an exercise with the no-SQL database platform MongoDB, I created a free account on mongolabs, created a database called webtropy, and within this, created a collection with the name “dictionary”. I then downloaded a English dictionary in text format from (TWL06), Importing this into Mongo was mongoimport, specifying fields as “word”.

They offer a REST API via their HTTP interface, such as:{‘word’:’HELLO‘}

Where “HELLO” is the word being checked. If the word is missing, i.e. “HELLOY” then the result is an empty JSON array “[]”

For the full English dictionary in JSON format, you can download this from at

Categories: Uncategorized

NAX Advertising WP7 App

May 29, 2013 Leave a comment

Sometimes you just realize that an app won’t sell on an app store. If you’ve had no sales on an app in 30 days, then, give up, and try a different business model…

There is a Windows Phone app for this blog, but, since the blog is very readable on a mobile device, I guess nobody would be willing to pay 0.99, so I tried using Nokia’s Ad Exchange, to add adverts to the app, so I could release the app for free. Instead. Also, it’s part of the DVLUP Challenges – So worth a T-shirt anyway!

I signed up to Nokia’s NAX program, added the details of my app, then downloaded the Windows Phone 7 SDK from Inneractive. Unfortunately the one-liner setup code didn’t work in the 10 second video didn’t work… probably because they never show the XAML!, I then checked out their sample, downgrading it from 7.1 to 7 by modifying the csproj, and the WMAppManifest – then copied (and simplified) their code as follows:

C# Code (In MainPage_Loaded):

var optionalParams = new Dictionary<InneractiveAd.IaOptionalParams, string>();
InneractiveAd iaBanner = new InneractiveAd(“OpenMerchantAccount_NetworkProgramming_WP”,
InneractiveAd.IaAdType.IaAdType_Banner, 60, optionalParams);
// Add the banner to the grid

XAML (Within panorama control)

<controls:PanoramaItem Header=”Ads” VerticalAlignment=”Top”>
<Grid x:Name=”Grid0″ Grid.Row=”0″ />

There’s more you can do with the ads, but I’m just learning…

Categories: Uncategorized

Load Cross Domain JSON via JSONP Proxy

May 23, 2013 Leave a comment

A well known security constraint on modern browsers, is that AJAX requests can only be made to the server which served the page. To get around this, you can use CORS for modern browsers, or JSONP.

JSONP, however does require that the data provider wraps their JSON response in a function call, which they may not do. Therefore, an easy solution is to create a proxy that wraps JSON in a function call, such as:

public partial class JsonProxy : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
string link = Request.QueryString[“url”];
if (link == null || link == “”)
Response.Write(“Requires url parameter”);
WebClient wc = new WebClient();
string strJson = wc.DownloadString(link);
Response.Write(“jsonp_callback(” + strJson + “);”);

Then, on the client side, a this can be used as follows (JQuery version):

<script type=”text/javascript” src=”jquery.js”></script>
<script language=”javascript”>
function init()

function jsonp_callback(data)
$(“body”).html(“Found ” + data.broadcasts.length + ” upcoming comedy shows”);

function LoadJson(url)
var s = document.createElement(“script”);
s.type = “text/javascript”;
s.src = “; + url;
Please Wait.


Categories: Uncategorized

Hosting files on Adobe’s Cloud

May 22, 2013 Leave a comment

Adobe’s creative cloud allows 2GB of free storage, which is handy for uploading large files for personal use. But you can also use these to serve images and files on websites, like the image above. With a little trick.





1. Upload your image or file to Adobe’s cloud

2. Click on the arrow, and select send link

3. Change the slider to public

4. Select Allow Download

5. Select the link icon, and copy the url.

Now, modify the URL as follows:

Where {GUID} will be different in your case.

Categories: Uncategorized

Cordova/PhoneGap for WP7 in Windows XP

May 22, 2013 Leave a comment

Normally, I develop my apps for WP7 natively using Silverlight for Windows Phone, but I thought that some of my apps would be easier to port, if I could use Phonegap (Cordova).

My home PC runs Windows XP, and VS 2010, which means that Windows Phone apps can’t be emulated, but can still be run on a real device (A better experience in any case).  Unfortunately, the XNA framework for Windows Phone is not compatible with Windows XP, and Cordova / Phonegap relies heavily on this library.

So, I decided to take PhoneGap / Cordova version 2.4.0 for Windows Phone 7, take the standalone model, and then strip out all the code that relied on the XNA framework, or just anything that didn’t compile. I understand, that this does cripple many features, such as audio recording, video recording, some file operations, and perhaps other features. However, the code compiles and runs on a Windows Phone 7 device, and renders the HTML page.

You can download this library, from – Should you want to develop Cordova / Phonegap Windows Phone 7 applications on Windows XP.

Categories: Uncategorized

iOS6 support for PhoneGap 0.9.4

May 16, 2013 1 comment

Screen shot 2013-05-16 at 20.37.52
After 1st May 2013, Apple has begun enforcing iOS6 support, and effectively outlawed  access to methods that access device UDID, for security reasons.

However, if your application is based on PhoneGap, and even if you do not access the device UDID via javascript, since the underlying PhoneGap library accesses the UDID, then Apple will reject the application. Now, the solution is to either upgrade to the latest version of PhoneGap – or a one line change 🙂

Double click on PhoneGapLib.xcodeProj then open the PhoneGapDelegate.m file, then scroll down to

– (NSDictionary*) deviceProperties

Then comment out the line

//[devProps setObject:[device uniqueIdentifier] forKey:@”uuid”];

Save the file, and then recompile your application. No more error!

Categories: Uncategorized

Ajax HTTP status code 0 (zero)

May 10, 2013 Leave a comment

I find that when I encounter a HTTP status code of 0 when using Ajax, it means there is some network error between the client and server, for example, a firewall issue, a network failure, or such forth.

The type of issue was spotted in code that looks like this;

// Success case
if (xhr.status == 0)
// Network problem?

Of course, this is only likely to occur in cross-domain ajax, since it is unlikely for a server to serve a page, and then immediately become unreachable to ajax.

Categories: Uncategorized