How to write a bug report

You found some behavior you think isn’t right in a piece of software and you are thinking about reporting a bug.. Wait, stop, read this first as it will save you time in back/forth with the developer.

Is this actually a bug or desired behaviour?

Ask on the mailing list for the software first. Most developers do things for a reason.

Does a bug already exist for this?

Look through the bug tracker / issues for this software, it’s possible a bug already exists. If so you can throw a +1 at it, +1 is a universal “bump” to show your interest. You can also track issues on tools like Github.

Are you reporting the bug in the right place?

Etherpad, as an example doesn’t take plug-in bug reports on the core bug tracker. Plug-in bugs should be reported on the individual plug-in bug trackers.

Want it fixing quickly?

Create a bounty. You will be more likely to get a fix in a timely fashion. This is especially true for feature/enhancement requests.

Provide information

Bug reports like “I can’t click on anything” are completely useless. Include information such as:

  • Operating system (IE Windows)
  • Your browser (IE Firefox)
  • Your browser version (IE 24.2)
  • The page you are on (IE https://23to2.com/foo?241bar)
  • The version of software (IE Libre Office 9)

If you are running a server / client setup you should provide the details for both the server and the client.

Provide Steps to replicate.

Provide how you got the problem to happen.. IE

  • click on page X
  • click on element Y
  • do Z.

Don’t be a leech.

When you file a bug developers will look at your repository and if this is your first ever bug report and you don’t contribute anything back to any other projects it’s likely you will be ignored.

Provide Expected behavior

It’s useful for the developer to know what you actually expect to happen IE:
Expected behavior: Z element gets big.
Actual behavior: Z dissapears.

Be polite

Actually, I don’t care about this. I’d rather you were clear.

Other things to consider..

Is this a security issue? If so use the software packages responsible security disclosure. Can’t find it? Post to the mailing list or bump them on IRC.

Adding i18n to a Cordova App

i18n (Internationalization) in applications roughly means adding support for translations and other languages.  In this blog post I will talk you through a general approach to implementing i18n in Cordova Apps.  If your app isn’t open-source, move along, the 90s is on another website.

As Cordova apps are written in HTML/CSS/JS we can easily leverage existing web platforms and services to provide i18n at break-neck speeds.

TLDR Services/frameworks used:
* Translatewiki to provide translations
* Marcel’s html10n i18n implementation
* Handlebars for templating
* Etherpad implementation of detecting locale/language also written by Marcel

Implementation steps

* Ensure your app fulfills Translatewiki’s requirements (Open source etc)
* Talk to Translate / Internationalization team at Wikimedia foundation before creating Gerrit commit
* Gerrit commit to TranslateWiki adding support for your App.
* Include handlebars and html10n libraries in your app
* Modify your HTML putting markup in handlebar script tags
* Move your text strings into locales files.
* Include a handlebars html10n render helper
* Use the Etherpad implementation of detecting locale/language* Give someone at WMF access to commit to your Repo

Sit back and enjoy..

Once you have completed your implementation and it’s approved by the WMF the WMF translation team will translate all of your strings and commit them back to your repo. You might want to provide the WMF team with the ability to see each of your strings in situ in a browser, this means providing a mechanism to fake Cordova events..

Summary

This implementation is basically a straight copy of how we handle i18n in Etherpad, it’s pretty robust and clean to implement. All in all a complete refactor of the NFC Ring Control App while implementing i18n took about a week of full time commitment, well worth doing as now the larger community can provide translations which if I was to do hans solo would take months 🙂

Object measurement with webcam

Shut up and show me the demo.

I have been experimenting with using a webcam to measure an objects size, width and height.

It works by comparing the size of a user defined box to the size of a magnetic strip (which is also user defined). I tested it against a ruler and it seems accurate but obviously the larger the object the more accurate it becomes. Right now it’s setup to measure the size of a ring finger.

As this is a weekend project I published the source up on github. I haven’t decided on a license yet so for now don’t adopt it in any commercial applications but do feel free to contact me to chat about funding further development.

I use getUserMedia / Canvas to do most of the interaction between the webcam and the browser and I’m using PaperJS for drawing the boxes onto the canvas. The actual math is really simple

// Takes a scale value and tries to figure out the mm diameter of each ring
function scaleToRingSize(widthPx){
  return (85.72500 / stripWidth * widthPx).toFixed(2); // 85.72500 being the width of a magnetic strip in mm
}

The fingers.js also contains code for converting ring sizes in mm to the nearest smaller ring size. IE if your ring size is 22mm it will give you a ring size in US/EU that is 22.2mm instead of 20mm.

I’m researching using Tracking.Js with some custom OpenCV maps to do better object detection, I know this is possible but right now the algos are a bit buggy and I’d need a lot of positive images to create a good training set. If I could do some object tracking in theory I could auto detect the strip / target object size and automate / realtime the whole measurement process and in theory I could do ask a server to do real time object detection, but that’s for another day..

The measurement app might not quite fit on your page, this is because it’s 800px x 600px with absolute positioning, I guess I could make it use relative positioning but right now I’m not interested.

The tool will work in all browsers that support getUserMedia which is IE11, FF 17, Chjrome 21, Safari 7 and Opera 12, iOS Safari, BBB 10, Opera Mobile 12. For more browser support queries see getUserMedia browser support. Obviously if you are still using IE then you have probably made many other poor life decisions and you are beyond my help. Obviously because I’m using JS / CSS the app will work on a mobile and desktop webcam so you can in theory measure objects whilst on the move.

I had to worry about the overheads of the large javascript fabric.js library so I decided I didn’t want the additional overheads of jQuery. It’s entirely written in JS (with obv some CSS/HTML) throw into the mix. I could probably refactor it down to just JS without too much headache and this would give site admins the ability to do something like:

<script src="measurer.js"></script>
var measure = new Measurer();
measure.create("targetDiv"); // can do it like this because getUserMedia is limited to one instance of browser/OS.
measure.on('success', function(measurement){
  alert("Got a measurement of", measurement);
  measure.destroy();
});

You will need a card with a magnetic strip on the back, ideally a credit card as these are guaranteed to be a universal size.

Final thoughts: None of the images are saved to a server but as you know these images are being passed through the Internet which means your ISP is sending a copy of them to the NSA. I strongly recommend against using this tool to measure any part of your anatomy.

Cloudflare – My experience.

Cloudflare is a service that speeds up your website or blog loading speed times by handling your website DNS and acting as a CDN for your sites content. I tried it out on MySchoolHolidays.com

CF = Cloudflare.

Some things that rock:

  • CF sped my page loading up by minifying my JS/CSS etc and reducing the hops to the static content.  Also DNS lookups were marginally faster (<5%).
  • Some of the plugins available may be of use to others but weren’t for me and some of them even introduced JS bugs.
  • CF introduced me to some new techniques for doing stuff such as catching client side JS bugs.
  • CF would help me scale quick
  • CF protects against exploits and scrapers.
  • FREE and if you want pro you can pay a small amount.

Some things that suck:

  • No round robin ergo no high availability for sites that use this which means greater downtime.
  • Poor customer support.
  • Horrible console and back end.
  • Bugs, lots of bugs.  Everywhere…
  • Paid option doesn’t really give you much in the way of improvements if anything.
  • CF “always online” feature doesn’t work.
  • No wildcard domains.

Cloudflare have a great opportunity and a huge audience but they have some massive problems to deal with if they want to make it a worthwhile service for me to adopt across the board.

Note: I’m too lazy to include stats.

Summary: Use the free version, get used to using a CDN for offloading some page content.  Make sure you setup analytics before so you can review your page speed load times.   Amazon and Google have similar offerings that will probably have a higher QOS ergo provide a better ROI.