Replacement blog “very nice” says person

Hello!

I got sick of WordPress a while ago and made a new blog which you can find at http://stegriff.co.uk/upblog/

The content is a little more focussed around the prototypes I make and solving technical problems. But I post really frequently! At least once a month and usually once a week or more. Check out my thoughts on the AGENT smartwatch kickstarter, and my latest Windows Phone app, Emoji Studio

There’s a lot more on there, just check out the Upblog front page for a full list of posts.

Thanks for reading :) Bye!

Microwave Leakage

I spent 7 months working in a warehouse where we tested, among other things, the radiation leakage of microwave ovens. Microwave energy is non-ionising, so it does not cause cancer, but it is still dangerous since it is mostly used for cooking things.

We used handheld digital sensors which go on alarm when the emitted radiation is greater than or equal to 5 mW/cm^2. Briefly: 1 watt (W) is the transfer of 1 joule of energy every second (energy applied over time is known as “power”). 1W could power a Raspberry Pi computer or a 4 inch screen. 5mW is 200 times less than that (not very much).

1cm^2 is the area of the very end of your index finger if you point it at your face. The radiation limit means that, each second, a leaking microwave should not be able to apply more than 5 millijoules of energy to each square centimetre of your body which is close enough to be affected. If you lay on top of a leaking microwave, it would be applying that energy to every exposed square centimetre, every second.

Many brand new microwave ovens leak more than the recommended dose of radiation by the time they hit the shop.

This problem was so endemic that our employer eventually asked us to stop testing microwaves because they negatively affected testing statistics. Instead they would dump the whole stock in bulk. The sensors alert at 5 mw/cm^2 but only go up to 10; after that they just say “OL” for OverLoad. At least 1 in 20 of those I tested were OL. I have tested domestic ovens less than a year old which fail with readings of 7 or 8.

Mitigation:

This level of radiation is not worth replacing your oven for. Anyway, new ovens are still likely to leak.

The safest ovens are small, simple models with analogue dials. I don’t know why. The highest risk are larger capacity models, which tend to be modern and digital, though this is probably a coincidence with their size.

The worst areas for leakage are the top of the door, and the left vent. Don’t rest your head near these areas ;)

Take 1 step away from the oven when it is on. This is enough to cut the power per area to less than 1 unit! (This is basically the main preventative step).

Look inside your unit. There is a sparkly piece of card on the right side – this is a filter. If it is burnt or missing, you should replace or return your oven.

While only anecdotal evidence, I hope this article has helped to inform about the metrics involved in microwave leakage.

On Macs

mac-miniI had to use a Mac today at a client office. As far as I could tell, it was a 2009 Mac mini running Snow Leopard on a widescreen. It had a standard Apple mouse and keyboard. Disclosure: I’m not anti-Apple. I am pro-good-computing, so any sensible, usable system is fine by me. I frequently toy with the idea of buying a Mac mini, and I’m aware that a lot of devs use them.

My task was to log onto an FTP server, download some files, and modify and reupload an .htaccess file.

  • First, I downloaded Transmit using Safari. This is easy enough, except that Safari doesn’t maximize? You press the green button on the window, and it just centers itself and gets a little bit bigger. How do you maximize?
  • Additionally, when typing in addresses (or editing text anywhere) there are no Home or End keys. That’s fine, for simplicities sake, but anyone who writes prose or code on a PC uses those a lot. I try Ctrl+Arrows, Alt, Cmd… nothing does what I need. In fact, Cmd+Right inserts a capital ‘C’. Obviously. Now, if the Mac intelligentsia would like to argue that I’m just Doing It Wrong™, I’d like to point out that if it’s inconsistently applied, it doesn’t exist. It doesn’t matter. This stuff is OS level in Windows, Linux… even QNX on my Playbook!

Anyway, I opened Transmit. I realize this is the application’s problem, but the visual cues for how to do stuff are not clear. There are random plusses and stars where you don’t want them, to favourite and save things. At some point, I think I pressed Cmd+T on the offchance it would open Terminal, and it re-based me and pretended that a subdirectory was my root directory, and cleared the navigation breadcrumb so I couldn’t get back to website root. Whatever, I just restarted it.

So I’ve downloaded the stuff. I open Finder and navigate to the file… Oop! I instantly recognise that the file is hidden because it has a leading dot (and that’s how hidden files work on UNIX) so I pop into the easily-found ‘folder view options’ dialogue. Weird, there’s no tickbox for displaying hidden files, and I can’t see any other relevant settings pages.

That’s ok, I’ll do it in Bash (this should be a clue that something is wrong with the GUI). I figure out from something I heard once, and the visual cue, that the magnifier in the top right is Spotlight. Why does the Mac mouse move so sluggishly at low velocities? It’s difficult to target small buttons compared to IBM equipment and Windows/Linux. At this point, I wish I knew the keyboard shortcut for Spotlight.

I type ‘Term’ and hit enter – this works as I intuit, and the Terminal opens


$cd Documents/ftp
$ls -a -l

Oh good, I can see the file now. To try and discover the default plaintext editor, I put a few combinations in spotlight: ‘note’, ‘text’, ‘edit’, ‘pad’. I find ‘textedit’, so, in the console:


$textedit .htaccess
"No such thing as 'textedit', or words to that effect"

Ok whatever, I guess it doesn’t execute from /usr/bin or something. Fingers crossed OSX ships with vi


$vi .htaccess

Yay! The file opens in the primitive editor. Well done Apple for sticking with the old stalwarts of software (it was released in 1976). Using my novice vi proficiency from a half-term spent writing C on Linux, I edit the file, save and exit (that’s ZZ with no colon)

I re-upload the IP whitelist and all is well. Great, good. That whole experience was a huge pain in the rear, to be honest.

Back at the office, I realised how blindingly fast I can use Windows. Most of that is familiarity, knowing shortcuts, and customization. I open Notepad++ by hitting [Win+R np Enter]. I open Explorer with [Win+E]. Still, I feel like using a Mac is so slow. It’s partly the mouse driver’s fault, and mine for not knowing the shortcuts for Spotlight, opening Finder… I remember now I could have Cmd+Tabbed between windows, as picking them off that dock thing takes forever.

Also, I really enjoy the multitouch hierarchy on Lion (and Mavericks, I guess). 4 fingers for OS level, 3 fingers for application level, 2 for meta-document, and 1 finger for document. That’s brilliant; it’s just a different way of thinking. But I’m pretty sure I’d have the same sucky gripes if there was no touchpad. This OS is made for multitouch and it doesn’t work without it.

I eagerly await your commentary.

Inkscape Logo

Inkscape Logo

Does the trend for simple design mean that Inkscape will go back to their first logo? I personally think that the 2009 refresh is the ugliest by far.

So you want an MtG API

What’s an API?

An API is a service that a computer can talk to, in order to get information about a certain topic, or to operate another program remotely.

Why would you need an API for Magic: The Gathering?

If you wanted to write a mobile app which displays information about MtG cards, you either need to load all of that data (about 10MB) into your app and update it every 3 months, or use some service to provide it all, ad-hoc. There is an official site called Gatherer, which displays information about any card you want, but computers can’t read it — it’s meant for people.

What are the options?

I’ve been working on my own card API for a little while now, but today I’ve discovered quite a few other interesting services. Since I’m in the market of filling an unfilled role, I don’t have any special competitive spirit for my own product, so here’s a rundown of what you can use:

magic-api

This is my product. I just released the v1.1 beta [view the super cool and funny* release notes]. It’s open source, so anyone can use, modify, and host their own. It lets you search for a card by name, and returns data structured in JSON. The returned data is in a simpler structure than the other services here. (*Lie)

Update: I now host a pretty version of magic-api called Scry (http://scry.me.uk)

Example query: Hopeful Eidolon on magic-api

Search the City

StC has a pretty website! It queries magiccards.info instead of Gatherer and allows you to search by property instead of just individual card names. The return data is just right. It’s really quite good!

Example query: Hopeful Eidolon on Search the City

Also, it supposedly shares a JSON format with the MTG JSON project…

MTG JSON

This isn’t actually an API; it’s an up-to-date database of all cards, in JSON. Could be a useful fallback if you need your application to work offline.

mtgapi

This is another standard API that does what it says on the tin. It returns JSON but doesn’t set the content-type header (at time of writing), which is annoying.

Example query: Hopeful Eidolon on mtgapi

Hope you have fun developing or learning!

Ste

Introducing Coded for Windows Phone 8

Sometimes you want to edit a code snippet on your phone.

On Windows Phone, there wasn’t an app capable of letting you get a file made on another device, edit it in a code-friendly environment, and then put the file back where you got it from.

That’s why I made Coded!

Give it a try :)

Coded Editor Screen

Main Screen

This is my first app for Windows Phone, but I took a long time polishing it to make it as usable and smart as possible. There are some text editors for WP, but they lack two things:

Sync screen

Sync screen and menu

A “fixed-width” (or “monospace”) font. Examples are Courier New, Consolas, and DejaVu Mono. Every character in these fonts is the same width, which means that columns line up, making code more readable. It also means that tabs are always the same size, and a predictable number of spaces will equal a tab.

Secondly, the ability to import and export files to a web location is key. It’s no good being able to write a file if you then can’t do anything with it. Coded has SkyDrive integration to let you upload/download files from a ‘Coded’ folder in the root of your SkyDrive. In the future, this path might be configurable.

If many people download Coded, I would like to add more features and configuration. If you have Windows Phone 8, and you feel like it might be useful to you, I hope you try it!

MS Word: Focus mode

When I’m writing, I like to have a focussed environment, so I hack around with my editor to make it work for me. It’s a design principle pushed by Mac software such as writer, but not so much by Word. However, in Word 2013 (and 2010) you can hide the ribbon using Ctrl+F1, straight off the bat, without any customisation.

Hiding the ribbon but showing tabs

…But that’s not quite focussed enough!

If you click on the roller-blind icon next to Minimize, you can see more options:

Word 2013 display options

Word 2013 display options

‘Auto-hide Ribbon’ turns out to be what I was looking for. Word also calls it fullscreen mode. So, because I’m a keyboard shortcut person, I went into the shortcut editor (Right click the tabs or ribbon, and choose ‘Customize the Ribbon…’ and then look near the bottom for the ‘Keyboard shortcuts: [Customize]’ button).

Under ‘All Commands’, find your way to ToggleFull. I made it Ctrl+Shift+F1 (conventionally, shift would mean the inverse of show/hide the ribbon, and I would use Ctrl+Alt+F1, but I wasn’t allowed to assign that combination).

ToggleFull-Keyboard-Shortcut

And here’s what fullscreen mode looks like:

Focussed

Also, I missed the simplicity of pressing Ctrl+1, 2, or 3 to set Outline level like in LibreOffice, so I set up those shortcuts too. (Note that in Word, they are mapped by default to Ctrl+Alt+1 etc.)

If you’re wondering what my opinion of Word 2013 is, I think it’s great. It really makes a lot of things easy, but sometimes simple value-adding features (like an obvious focus mode) are left out. Thankfully it has customisation options that can make anything easier!

Hope you’re productive today!

Announcing Open Source MTG API

Announcing Open Source MTG API

Hey, this weekend I built an API and DB solution for Magic: The Gathering cards. It’s now open source on github (where you can read the documentation), and you can use it by sending a query string like this:

http://stegriff.co.uk/host/magic?name=Doorkeeper

OK, have a great day!

PHP Conditional Markup

It can be hard to find the right result when you search for “PHP conditional markup”, so I’m helping myself (and maybe others) by posting this up here!

You can make document content conditional by enclosing it in a regular PHP if{}

<?php if ( $errorMsg ){  ?>
<div id="message">
<?php echo $errorMsg; ?>
</div>
<?php } ?>

But, for the sake of readability, the alternative syntax is often used, where the opening brace changes to a colon (:) and the closing brace changes to the keyword ‘endif;’

<?php if ( $errorMsg ):  ?>
<div id="message">
<?php echo $errorMsg; ?>
</div>
<?php endif; ?>

For more information, see the PHP documentation for Alternative syntax for control structures.

Hope that’s helpful! :)

Two Thousand and Twelve

At the start of 2012, apart from a little seasonal software work, I was employed at the “kettle warehouse”. It was very cold and dirty but I was fond of the camaraderie. I had not been accepted into Manchester University, and didn’t really know what was going to happen next.

IN 2012, I started my Open University degree and completed a quarter of it, with a 1st!

I transitioned from student to kind-of-a-teacher in worship ministry.

I fell in love.

I finished reading the entire Bible for the first time.

I got a steady software development job in Liverpool.

I fell out of love.

And I went on an adventure.

I’m not sure we change continuously… I’m not buying into moment-to-moment developments of character. I’m seeing quanta here; I’m seeing chapters. I think I just graduated the third one!

At the start of 2013, I don’t know what’s going to happen next.

Great, now that’s over with I can blog about PHP and stuff again.