Monday, 28 April 2014

Taking Stock of Rube Goldberg Branches

Doing a quick review of the Rube Goldberg branches in git:

  • Master - Needs pylint fixing
  • file-plugin - work complete.  Deleted
  • gpio-impl - work complete.  Deleted 
  • http-plug - work still to do.  Merge conflicts from master.  Added Trello item
  • pip-packaging -- work still to do in order to figure out how to use from pip install only. Merged master.  Added Trello
  • scratch-plug - work complete. Deleted. Trello for sorting out tests

Sunday, 27 April 2014

Working on the Minecraft-Scratch Interface for the Rube Goldberg Machine

For the Rube Goldberg project at the CoderDojo I need a way to interact with Scratch from Python.  Here's my steps of how I went about it:

  1. After reading around I realised that I'd have to run Scratch 1.4 and the Python interaction would come from scratchpy - https://github.com/pilliq/scratchpy
  2. Installed scratch 1.4 on Windows
  3. pip install scratchpy
  4. Enabled Scratch remote sensing - http://wiki.scratch.mit.edu/wiki/Remote_Sensor_Connections#Enabling
  5. Played with the interaction - http://youtu.be/YG99uam8pKA
  6. Create new branch for scratch plugin git checkout -b scratch-plug
  7. Check all tests pas
  8. python setup.py test
  9. Tests failed as wasn't on Rasp PI.  After some poking around I discovered that I'd installed the GPIO package on to my development virtual box environment, and so now the package was loading okay and the case that I had set up in the test file to spot the lack of GPIO wasn't working.  I deleted out the GPIO package and it all worked again...phew!
  10. Making the scratch target -- use a broadcast of either "BLOCK-PRESENT" or "BLOCK-ABSENT"
  11. Create a scratchplug.py module
  12. Implemented the target code
  13. Tested that it worked using a file source
  14. Not quite sure how to make the unit tests work.  Will park that problem for now and come back to it later
  15. Now to make the source method
  16. The problem is that the scratch.receive() method blocks until it receives a broadcast, but the Rube Goldberg architecture needs to poll
  17. The solution will be to use the multiprocessing module as shown in this answer on Stack Overflow - http://stackoverflow.com/questions/492519/timeout-on-a-python-function-call
  18. Got a bit stuck coordinating the output with Queues since I didn't realise that multiprocessing had its own implementation of Queue -- you live and learn
  19. Committed that on to the scratch-plug and pushed to GitHub
  20. Made a quick demo of the Minecraft light going into scratch and scratch button turning on a light in Minecraft - https://www.youtube.com/watch?v=cpD-RegWybA

Sunday, 23 February 2014

Python Minecraft CoderDojo -- Play Testers Sought

I've updated the sheets for the Manchester (UK) CoderDojo Python-Minecraft project.  I'm looking for play-testers.  If you are interested, take a look at this on the Minecraft Forum:

Friday, 21 February 2014

Jitsi VOIP Client DTMF Settings

It took me ages to find out how to modify the Jitsi DTMF settings today.  In case you have the same problem, here is a pictorial guide:












Monday, 17 February 2014

The Corn Laws

The Corn Laws where tariffs imposed on the import of corn to the UK from 1815 to 1846.  The intention of the tariffs were to protect the interests of corn producing landowners.  While landowners benefited from the protection of their markets, low-paid workers experienced poverty and famine from having to spend a large proportion of their income on bread.  The struggle to repeal the Corn Laws led to the collapse of the Conservative government and the resignation of Robert Peel as Prime Minister.  Following their repeal corn prices fell in the UK resulting in the reduction in the amount of land dedicated to cereal production and a similar reduction in the demand for agricultural labour.

Thursday, 13 February 2014

Mainline vs. Trunk Development

In software source control (git, mercurial, etc.) you branch the code base in order to isolate different development efforts from one another. In a "mainline" source control model fixes are made on the branches and then merged into the mainline. In a "trunk" source control model fixes are made on the single trunk and then pulled into the branches as needed for a release.
Paul Hammant provides a nice picture of this in which he expresses his preference for the trunk model here: http://paulhammant.com/images/mainline_vs_trunk.png

Monday, 10 February 2014

The Pigeonhole Principle

The Pigeonhole Principle is a counting argument method of mathematical proof.  It says that if you have more items to distribute than pigeonholes to put them into then at least one of the pigeonholes must contain more than one item.  This simple principle becomes interesting when you extend it to countably infinite sets, e.g. the natural numbers.  See: http://en.wikipedia.org/wiki/Hilbert%27s_paradox_of_the_Grand_Hotel