Emacs within Emacs within Emacs…

Timo Geusch from The Lone C++ Coder's Blog

A quick follow-up to my last post where I was experimenting with running emacsclient from an ansi-term running in the main Emacs. Interestingly, you can run Emacs in text mode within an ansi-term, just not emacsclient: Yes, the whole thing got a little recursive. Yes, it’s a little silly, and yes, I’m one of those […]

The post Emacs within Emacs within Emacs… appeared first on The Lone C++ Coder's Blog.

Full Day Workshop: BDD with Cynefin – Liz Keogh

Paul Grenyer from Paul Grenyer

What: Full Day Workshop: BDD with Cynefin - Liz Keogh

When: Wednesday, February 7, 2018, 9:00am to 4:45pm

Where: The King's Centre, King Street, Norwich, NR1 1PH

How much: £130.00

RSVP: https://www.meetup.com/Norfolk-Developers-NorDev/events/245781564/

Behaviour-Driven Development is a practice in which we talk through different examples (scenarios) of how a system might work, from the perspective of its many users. In this unique tutorial we mix BDD with Cynefin, the sensemaking framework that helps makes sense of the world around you and the problems you encounter depending on their predictability.

The course provides thinking and conversational tools to enable teams, product owners and managers to address risk early, develop a deep understanding of requirements at different scales, shorten the time needed to reach that understanding, produce high-quality, innovative solutions, and create human-readable, relevant and memorable tests as a by-product… and it's not just applicable to software!

For each outcome, attendees will demonstrate the skill during interactive exercises in the course.


  • Explain BDD and its practices
  • Create well-formed scenarios which are relevant to your own domain
  • Use conversational patterns to draw out new scenarios and explore scope
  • Discuss how best to engage Developers, Testers and Analysts or Business Experts in conversations
  • Identify and design mechanisms for quick feedback using single scenarios


  • Explain the Cynefin model and how it relates to BDD and Specification by Example
  • Estimate the level of complexity in different requirements phrased at different scales
  • Predict when an unelaborated requirement is likely to cause conflict or excessive discussion
  • Discuss shortcuts to apply to well-understood requirements to reduce analysis and planning time
  • Differentiate between well-understood, domain-specific, and innovative / uncertain aspects of work through using scenarios in conversations

Capability Red

  • Identify core and incidental stakeholders for a project
  • Generate a map of desired capabilities from lower-level stories and scenarios
  • Identify risk and uncertainty in capability maps
  • Discuss prioritization of long-term plans accordingly
  • Decide whether to engage stakeholders before or only after implementation (educators vs. gatekeepers / checklist)
  • Phrase capability-level problems in problem-space language, without diving into solution-focused features
  • Identify continuous capabilities to which BDD can be applied using monitoring (non-functionals and other non-discrete requirements)
  • Discuss monitoring mechanisms, including manual processes and compliance / governance where applicable.

Please note that automation of scenarios will be mentioned in this course, but is out of scope; this course focuses on the conversational and analytical aspects of BDD.

Visual Lint has been released

Products, the Universe and Everything from Products, the Universe and Everything

This is a recommended maintenance update for Visual Lint 6.0 and 6.5. The following changes are included:
  • Modified generated Vera++ command lines to replace the -showrules option with --show-rule. In consequence the minimum supported version of Vera++ is now 1.2.1.
  • When a Visual Studio 2017 project using the /Zc:alignedNew or /Zc:alignedNew+ option is loaded the C++ 17 __STDCPP_DEFAULT_NEW_ALIGNMENT__ preprocessor symbol will now be included in the generated analysis configuration.
  • Corrected the value of _MSC_FULL_VER referenced in the PC-lint Plus compiler indirect files for Visual Studio .NET 2002 and 2003 (co-rb-vs2002.lnt and co-rb-vs2003.lnt respectively).
Download Visual Lint

Recording gameplay videos on RetroPie

Andy Balaam from Andy Balaam's Blog

Credits: this is a slightly corrected and shortened version of How To Record A GamePlay Video From A RetroPie by selsine, which is itself based on Recording Live Gameplay in RetroPie’s RetroArch Emulators Natively on the Raspberry Pi by Retro Resolution.

RetroPie is based on RetroArch. RetroArch has a feature to record gameplay videos, but the current version of RetroPie has it disabled, presumably because it was thought to be too intensive to run properly on a Raspberry Pi.

These instructions tell you how to turn the recording feature on, and set it up. This works perfectly on my Raspberry Pi 3, allowing me to record video and sound from games I am playing.

The code for this is here: github.com/andybalaam/retropie-recording – this was code written by RetroRevolution, with small corrections and additions by me.

Before you start, you should have RetroPie working and connected to the Internet, and updated to the latest version.

Note: you should make a backup of your RetroPie before you start, because if you type the command below you could completely break it, meaning you will have to wipe your SD card and start fresh.

Turning on the recording feature

RetroArch uses the ffmpeg program to record video. To turn on recording, we need to log into the Pi using ssh, download and compile ffmpeg, and then recompile RetroArch with recording support turned on.

Log in to the Pi using ssh

Find out the IP address of your Pi by choosing “RetroPie setup” in the RetroPie menu and choosing “Show IP Address”. Write down the IP address (four numbers with dots in between – for example:

On your Linux* computer open a Terminal and type:

ssh pi@

(put in the IP address you wrote down instead of

When it asks for your password, type: raspberry

If this works right, you should see something like this:
The RetroPie Project joystick logo

* Note: if you don’t have Linux, this should work OK on a Mac, or on Windows you could try using PuTTY.

Download and compile ffmpeg

Log in to the RetroPie as described above. The commands shown below should all be typed in to the window where you are logged in to the RetroPie.

Download the script ffmpeg-install.sh by typing this:

wget https://github.com/andybalaam/retropie-recording/raw/master/ffmpeg-install.sh

Now run it like this:

bash ffmpeg-install.sh

(Note: DON’T use sudo to run this – just type exactly what is written above.)

Now wait a long time for this to work. If it prints out errors, something went wrong – read what it says, and you may need to edit the ffmpeg-install.sh script to figure out what to do. Leave a comment and include the errors you saw if you need help.

Hopefully it will end successfully and print:

FFmpeg and Codec Installation Complete

If so, you are ready to move on to recompiling RetroArch:

Recompile RetroArch with recording turned on

Download the script build-retroarch-with-ffmpeg.sh by typing this:

wget https://github.com/andybalaam/retropie-recording/raw/master/build-retroarch-with-ffmpeg.sh

Now run it like this:

bash build-retroarch-with-ffmpeg.sh

It should finish in about 10 minutes, and print:

Building RetroArch with ffmpeg enabled complete

If it printed that, your RetroPie now has recording support! Restart your RetroPie:

Restart the RetroPie

Restart your RetroPie.

If you want to check that recording support is enabled, Look for “Checking FFmpeg Has Been Enabled in RetroArch” on the RetroResolution guide.

Now you need to set up RetroPie to record your emulator.

Setting up recording for your emulator

To set up an emulator, you need a general recording config file (the same for all emulators), and a launch config for the actual emulator you are using.

Create the recording config file

Log into the RetroPie as described in the first section, and type this to download the recording config file. If you want to change settings like what file format to record in, this is the file you will need to change.

wget https://github.com/andybalaam/retropie-recording/blob/master/recording-config.cfg

Create a launch config for your emulator

Each RetroPie emulator has a config file that describes how to launch it. For example, the NES emulator’s version is in /opt/retropie/configs/nes/emulators.cfg.

To get a list of all the emulators, log into your RetroPie and type:

ls /opt/retropie/configs

In that list you will see, for example, “nes” for the NES emulators, and “gb” for the GameBoy emulators. Find the one you want to edit, and edit it with the nano editor by typing:

nano /opt/retropie/configs/gb/emulators.cfg

(Instead of “gb” type the right name for the emulator you want to use, from the list you got when you typed the “ls” command above.)

Now you need to add a new line in this file. Each line describes how to launch an emulator. You should copy an existing line, and add some more stuff to the end.

For example, my version of this file looks like this:

lr-gambatte = "/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-gambatte/gambatte_libretro.so --config /opt/retropie/configs/gb/retroarch.cfg %ROM%"
lr-gambatte-record = "/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-gambatte/gambatte_libretro.so --config /opt/retropie/configs/gb/retroarch.cfg --record /home/pi/recording_GB_$(date +%Y-%m-%d-%H%M%S).mkv --recordconfig /home/pi/recording-config.cfg %ROM%"
default = "lr-gambatte"
lr-tgbdual = "/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-tgbdual/tgbdual_libretro.so --config /opt/retropie/configs/gb/retroarch.cfg %ROM%"

The line I added is coloured: The green parts are things copied from the line above, and the red parts are new – those parts tell the launcher to use the recording config we made in the previous section.

When you’ve made your edits, press Ctrl-X to exit nano, and type “Y” when it asks whether you want to save.

Once you’ve done something similar to this for every emulator you want to record with, you are ready to actually do the recording!

Actually doing a recording

Launching a game with recording turned on

In the normal RetroPie interface, go to your emulator and start it, but press the A button while it’s launching, and choose “Select emulator for ROM”. In the list that comes up, choose the new line you added in emulators.cfg. In our example, that was called “lr-gambatte-record”.

Now play the game, and exit when you are finished. If all goes well, the recording will have been saved!

(Note: doing this means that every time you launch this game it will be recorded. To stop it doing this, press the “A” button while it’s launching, choose “Select emulator for ROM” and choose the normal line – in our example that would be “lr-gambatte”.)

Getting the recorded files

To get your recording off the RetroPie, go back to your computer, open a terminal, and type:

scp pi@*.mkv ./

This will copy all recorded videos from your RetroPie onto your computer (into your home directory, unless you did a cd commmand before you typed the above).

Now you should delete the files from your RetroPie. Log in to the RetroPie as described in the first section, and delete all recording files by typing this:

Note: This deletes all your recordings, and you can’t undo!

rm recording_*.mkv

Note: This deletes all your recordings, and you can’t undo!

Safer: recording onto a USB stick

Note: recording directly onto the RetroPie like we described above is dangerous because you could fill up all the disk space or corrupt your SD card, which could make RetroPie stop working, meaning you need to wipe your SD card and set up RetroPie again.

It’s safer to record onto a separate USB disk. To find out how, read “Recording to an External Storage Device” in Retro Resolution’s guide.

Let’s Talk About Sets – a.k.

a.k. from thus spake a.k.

In the last couple of posts we have seen various ways to partially or fully sort data and the kinds of queries that we can run against them once they have been. Such query operations make fully sorted arrays a convenient way to represent sets, or more accurately multisets which treat repeated elements as distinct from each other, and in this post we shall exploit this fact to implement some operations that we might wish to perform upon them.

Mini Habits: Smaller Habits, Bigger Results

Paul Grenyer from Paul Grenyer

Mini Habits: Smaller Habits, Bigger Results
Stephen Guise  (Author)

ISBN-13: 978-1494882273

I’ve read quite a few self help books and while they always seem really good at the time, I’m not particularly good at following through. I guess I don’t necessarily have the willpower or the presence of mind to do what they recommend.

Mini Habits are different. They’re to small for failure.

There’s lots of repetition, which is slightly irritating until towards the end of the book the when the author hints as to why. As the author often says, you start with ridiculously small habits, the reoccuring examples are one pushup a day and writing 50 words a day, because it gets you into the habit, making it easier to do more. But you only have to achieve the small habit you set out to do. That’s what success looks like. So you can’t fail.

The book was recommended to me by my good friend Tom Bool. Soon after I started reading the book I started walking everyday right around the park. This took a good 30 minutes or more. Will power failed me some days. Now I make sure I walk for 15 minutes every day. Most days I do more as I walk to work. If I don’t walk to work I do 15 minutes or more in the park.

In addition to this my habits are drinking a pint of water a day and reading two pages of a book a day. Everyday I drink more than a pint of water and my incentive is that I don’t have a cup of tea until I’ve drunk my pint. I’m finding reading is enough reward in itself and I’m usually reading more than two pages a day. But if I haven’t found the time to read, I know I can read two pages just before bed.

I wish I’d read this book when I was still responsible for sales calls, because I could have done one a day which would be much easier than the 10 I’d often try and I could have been a success every day.

Resizable UIWindow on iOS

Pete Barber from C#, C++, Windows & other ramblings

I came across a Todo item in my inbox (I often email myself things todo) whilst tidying it up following Christmas, entitled "Make a resizable UIWindow". I can remember sending this to myself but not what I was reading or watching that prompted me to do it other than I thought it must be possible to play around with the default style of main UIWindow that an iOS App displays most of its content in.

Normally, when running an iOS App the main UIWindow is black and takes up the entire devices screen. It is possible to have more than one UIWindow but the usual case for this is when content is being displayed on a secondary display, e.g. AirPlay. On MacOS it is common to have many instances of UIWindow with these being displayed on the Mac's desktop. It's normal to think of an iOS device as having a desktop as when using an App (or multiple if using Multi-tasking) then the desktop/background is completely obscured.

None the less, UIWindow is a subclass of UIView. This inherently means it has a Frame, i.e. a position in it's parent space plus a width & height. I wondered if these could be altered - they can!

I wrote a very simple single page App which contains a UIView that by default has the screen dimensions and is coloured blue, on top this, roughly in the centre is a red rectangle (a child UIView).

There are a set of 3 gesture recognisers (pinch, rotate & pan) that can be applied to either the Red Rect, the View or the underlying Window. Which one they're applied too is set using the Picker control hosted by the UIView.

The next picture shows all 3 components resized, rotated and moved around. Note how the Status Bar has almost disappeared due the black text colour now being on a black background (though the green battery indicator is still present) as no UIWindow is there.

By dragging the Window over the Status Bar it's revealed again.

Next, the Red Rectangle has been completely detached from the it's parent UIView. At this point touch events do not seem to be sent to it any more.

Taking this further my moving (via the pan gesture) the View from off the Window this too stops receiving input. At this one nothing can be done with the App.

That's not completely true. The App can be rotated. This has some bizarre results probably not helped by there being no constraints.

The code for the App is available on GitHub though the code for ViewController is below

The only slightly strange things happening here are:

  • The re-assignment of the Gesture Recognizers to the selected UIView
  • For each of the methods invoked by the Gesture Recognizers how they 'reset' the main parameter modified by the gesture after each invocation.
If you run the project, as the there are multiple Gesture Recognizers but multiple simultaneous Gesture Recognition support hasn't been enabled then in particular pinch & rotate must be discreet gestures. Also, rotation can be fiddly to get working especially if UI element has been pinched to a small size.

I'm not really aware of any practical application of this. It might be interesting to try have 2 UIWindows displayed at the same time though I'm not sure this is possible and could easily be achieved with 2 UIViews. Perhaps to have 2 sub-apps each in its own UIWindow which can be swapped between.

Was a C90, C99, or C11 compiler used?

Derek Jones from The Shape of Code

How can a program figure out whether it has been compiled with a C90, C99 or C11 compiler?

Support for the // style of commenting was added in C99.

Support for Unicode string literals (e.g., U"Hello World") was added in C11.

Putting these together we get the following:


#define M(U) sizeof(U"s"[0])

int main(void)
    switch(M("")*2 //**/ 2
       case 1: printf("C90\n"); break;
       case 2: printf("C99\n"); break;
       case 8: printf("C11\n"); break;