Archive

On Chrome and Firefox 32+, navigator.languages contains an array of locales in order of user preference, and is more accurate than navigator.language, however to make it backwards-compatible (Tested Chrome / IE / Firefox / Safari), then use this:

Writing an app is one thing, but publicising and selling it is where the real upside is for a developer. I recently discovered that Xamarin allows you to develop Mac desktop apps. Which got me interested, since I’m a seasoned .NET developer, and thought that it seemed easier than learning objective C (although I should…).

I’ve written plenty of PhoneGap (Cordova) apps, which are basically HTML apps, and I thought that I could really easily port a phone gap app across to objective C, once I could embed a WebView (WebBrowser control) into an Mac OS X app. So, kicking off Xamarin studio, I created a basic Cocoa app, and opened the XIB in Xcode, dropped in a webView, and set its auto-resizing to fill the window. then ctrl-dragged it as an outlet into MainWindow.h

Back to Xamarin Studio, I copied the www folder from the Phonegap project, and set it’s build action to content, I then added the code:

Where {ProjectName} is the name of the project – not literally that string! – This avoids error ITMS-90259 which gives an Invalid Binary error on iTunes connect

I then changed it to release mode, selected Build > Archive for Publishing

Using terminal, I navigated to the output folder, and ran

chmod -R a+rX *

This got rid of an earlier submission error where it was complaining that only the root user had access to certain files.

I then switched to Xcode organiser and submit to app store, selected my provisioning profile, and unchecked “include app symbols”, and submitted. – Once it said uploaded successfully, then I went back into iTunes Connect, selected the build, and filled in the rest of the information, including screenshots. No Icon necessary, it takes it from the Binary, then pressed submit for review….

A great way to increase the accessibility of your website to more users is to provided it in multiple languages, not just English. but what happens if you have dynamic content, and just too much content to justify translating manually?

You can simply link out to Google translate, but then you loose the SEO advantage of having your content served from your domain, so doing it server side is key to maintain your traffic. – You “should” use the Google Translate API for this, but it’s a paid-for service, and if you’re not feeling that generous, you can hack your way through Google’s page translation service – until such time as they block your IP 🙂

This makes a call to translate_p, and extracts the link that google returns, then makes a call to this url. The Curl request has to fake the user agent, and referrer, otherwise Google will block the request.

There’s no guarantee that this will last for ever, in fact, it’s probable that it will be blocked before too long, but should be fine for low-traffic websites.
?>

If you want to send form emails from the command line, based on data returned from a SQL server, then this bit of code might be what you;re looking for. I’m omitting the SMTP settings and Database settings, but it should be clear where they go.