Useful tidbits for Raspberry pi users on Raspian – aka things I wish I knew quicker/easier

I love my Pi2 and my Pi3, they’re amazing pieces of cheap kit I can do anything with – although to be honest I don’t use them anywhere near as much as I should. So here is a compilation of things I found useful this last week when I finally got around to building my Pi3 installation for my house-wide audio system / automation. Update your firmware Just get this done right at the start. sudo BRANCH=next rpi-update Be sure to restart after it’s done (sudo shutdown -r now) Disable onboard audio (useful if you want to use USB only … Continue reading

Cloudant (IBM) Query – Indexing arrays directly using Erlang

Really short post this one on indexing using Cloudant Query to index arrays in your document, e.g. documents that have a field like this: { “ids”: [ “alpha”, “bravo”, “charlie” ] } I was reading the documentation and just could not get it to index these items using anything but the default _all_docs indexer (don’t use this for large databases!) but then I came across the source code for Mango and hidden in the tests and the implementation was the answer I needed. To create an index, as the documentation states, you just need to POST to /dbname/_index with something like: … Continue reading

Heterogeneous Parallel Programming – Completed and Certified!

I just got my certificate through from Coursera for completing the Heterogeneous Parallel Programming by University of Illinois at Urbana-Champaign on Coursera and I’m very happy! It was a fun (and free) course that covered primarily CUDA programming but towards the end went on to OpenCL. Fun course to do and really helped me rethink parallel computing. The principles taught in the course can be applied quite easily to multithreaded programming.   This was one of the things that started me down the route of my libraries on GitHub – parallelisation, logging, etc. It’s a course I would recommend to anyone interested … Continue reading

Standardising logging and parallelisation in multiple languages

Over the last few days I’ve been working on interfaces to use across multiple programming languages to standardise how some things are done. This stemmed from a requirement to allow processing to be dealt with in any language from any other language. People do this all the time, it’s nothing new, but they generally stick to “language A will have a requirement to get some data and we’ll get this data using language B across multiple servers/threads”. This results in an API contract between the two languages but not much else (you, in advance say I’ll request it in this way … Continue reading

Windows 10 coming to Raspberry Pi 2 – free!

As if the news wasn’t good enough that all Windows 7 and 8 users are going to be getting a free upgrade to Windows 10 – the new Windows OS that promises to be everything we wanted and then some. Microsoft have announced that the recently released Raspberry Pi 2 will be getting a specially compiled version of Windows 10. Considering the new Raspberry Pi 2 is only $35 for it’s quad-core 1GB goodness, this is certainly welcome news. We see the Maker community as an amazing source of innovation for smart, connected devices that represent the very foundation of … Continue reading

phantomjs custom module – require and create

Recently I’ve been working with phantomjs in order to do some on-page control without wanting to use an actual browser (phantomjs is headless and requires no X server to be running). One of the first things I wanted to do was created custom modules so I could organise my code clearly. I found a surprising lack of information on this topic so decided to quickly write up how I did it so it follows how the included modules work. To use a custom module, you need to prefix the require with a path (./ works fine for the current directory) and … Continue reading

C# MySqlDataReader – “one line” function to return a row as an instance of a class.

MySql in C# is rather painless using the MySQL Connector for .net, but one thing it is missing is a no-frills, no extra requirements, no pre-defined ERD return a row as an instance of a class function. Coming from a PHP background, I love the PDO function fetchObject(), it’s just right there and you get an object you can handle. I really wanted this functionality in my code to not only make it easier to read, but also make types easier to manage when returned from MySQL – why do I need to call GetString() or GetInt() when I can … Continue reading

Cloudant’s Rather Awesome dbcopy for re-reducing the output of existing map/reduce data.

I love Cloudant, simple as, their implementation of CouchDB as a DDaaS (as opposed to DBaaS) has no real competitor – as CouchDB develop’s, that may, of course, become a problem as it gives dominance in a market, but for now, we’re good. One of their best features is the dbcopy command, this copies the output of a map/reduce view to either the same database or another database entirely. Why would you want to do this when you can just create another view? Simple really, you already have the data you need and you don’t want to re-build a view … Continue reading

Country/Currency List for C#, JSON, PHP and HTML select

So often you find yourself needing a list of countries for use in your software and I keep having to re-use this code so here is a list of countries with their ISO codes in a variety of formats you can simply just use. # C# Dictionary ISO { countrycode, countryname } list new Dictionary<string, string>() {{“AD”,”Andorra”},{“AE”,”United Arab Emirates”},{“AF”,”Afghanistan”},{“AG”,”Antigua and Barbuda”},{“AI”,”Anguilla”},{“AL”,”Albania”},{“AM”,”Armenia”},{“AN”,”Netherlands Antilles”},{“AO”,”Angola”},{“AQ”,”Antarctica”},{“AR”,”Argentina”},{“AS”,”American Samoa”},{“AT”,”Austria”},{“AU”,”Australia”},{“AW”,”Aruba”},{“AX”,”Åland Islands”},{“AZ”,”Azerbaijan”},{“BA”,”Bosnia and Herzegovina”},{“BB”,”Barbados”},{“BD”,”Bangladesh”},{“BE”,”Belgium”},{“BF”,”Burkina Faso”},{“BG”,”Bulgaria”},{“BH”,”Bahrain”},{“BI”,”Burundi”},{“BJ”,”Benin”},{“BL”,”Saint Barthélemy”},{“BM”,”Bermuda”},{“BN”,”Brunei Darussalam”},{“BO”,”Bolivia, Plurinational State of”},{“BQ”,”Bonaire, Sint Eustatius and Saba”},{“BR”,”Brazil”},{“BS”,”Bahamas”},{“BT”,”Bhutan”},{“BV”,”Bouvet Island”},{“BW”,”Botswana”},{“BY”,”Belarus”},{“BZ”,”Belize”},{“CA”,”Canada”},{“CC”,”Cocos (Keeling) Islands”},{“CD”,”Congo, the Democratic Republic of the”},{“CF”,”Central African Republic”},{“CG”,”Congo”},{“CH”,”Switzerland”},{“CI”,”Côte d’Ivoire”},{“CK”,”Cook Islands”},{“CL”,”Chile”},{“CM”,”Cameroon”},{“CN”,”China”},{“CO”,”Colombia”},{“CR”,”Costa Rica”},{“CS”,”Czechoslovak Socialist Republic”},{“CU”,”Cuba”},{“CV”,”Cape Verde”},{“CW”,”Curaçao”},{“CX”,”Christmas Island”},{“CY”,”Cyprus”},{“CZ”,”Czech Republic”},{“DD”,”German Democratic Republic”},{“DE”,”Germany”},{“DJ”,”Djibouti”},{“DK”,”Denmark”},{“DM”,”Dominica”},{“DO”,”Dominican Republic”},{“DZ”,”Algeria”},{“EC”,”Ecuador”},{“EE”,”Estonia”},{“EG”,”Egypt”},{“EH”,”Western Sahara”},{“ER”,”Eritrea”},{“ES”,”Spain”},{“ET”,”Ethiopia”},{“FI”,”Finland”},{“FJ”,”Fiji”},{“FK”,”Falkland Islands (Malvinas)”},{“FM”,”Micronesia, … Continue reading

Using Amazon EC2 with C# .net

Amazon’s EC2 platform has a very in-depth console which allows you to do a lot, but what if you want to automate some of the processes or handling servers? I’ve been working with EC2 a lot recently and automating server starting/stopping based on parameters of the system we use here at MediaSkunkworks and thought I’d share some knowledge. Getting Started You’ll want to grab yourself the AWSSDK; this can be from the installer at or as a NuGet package in your VS project. If you use the installer, be sure to add a reference to the AWSSDK.dll file (should … Continue reading