I won't go into all the boring details, but after very nearly 5 years it has become necessary for me to get a more practical car. I'm afraid that I've recently sold my lovely Honda S2000.
It's a bit sad because this is a fantastic car. I have to admit that sometimes I've even felt it to be a bit of a responsibility to look after this car because it's so special. It's a great piece of engineering, and fun to drive as well. It deserves to be taken care of.
One of the nice things about owning an S2000 is that people come and talk to you about it. These cars have a great reputation amongst car enthusiasts. Although one time a young lady walked up to me when I was filling it up with fuel and said: "I love your car, it's so very ... erm ... ahh ... blue!" - she was obviously lost for words. That incident still makes me chuckle. But strangely she was right - the blue ones are the best :-)
I will also miss waving at any other S2000 owner I see when driving around. I can't remember any time when I've seen another S2000 and not been given a smile and a wave. It seems that S2000 owners are a friendly and happy bunch. Maybe it helps when you drive a brilliant car which is unlikely to let you down.
But I am sticking with Honda though, I reckon I've had 5 different Hondas now and they've all been really good cars. So it's on to Honda #6... I've also converted my Dad to Honda too, he has a couple of them at the moment.
A friend of mine who also drives an S2000 once said "people who have not owned an S2000 just don't understand". I can go along with that.
Since my H2D2 project has quite a lot of code in it now, I've been using .Net interop as a quick way to write some unit tests for the H2D2 programming language.
I have written a C# unit test project in Visual Studio which tests much of the existing H2D2 language syntax. This means that I can add new features and quickly check that I've not broken any of the existing code. So I can very easily make sure that programs which used to run continue to work as expected.
Recently, I've been making H2D2 support function calls, and so it's been handy to write tests for various different types of function call (passing parameters, reading return values, allowing functions that don't return a value, etc). The unit tests have made it much easier to ensure that everything works after I've made changes.
Since I've written more unit tests in C# than anything else, I thought it would be the quickest way to get my tests up and running. And because I had already compiled H2D2 into a windows dll (the unmanaged kind), it is not very hard to run H2D2 programs from .Net - even easier because I had already written some basic wrapper code for all the interop stuff. It's not much harder than putting some H2D2 source code into a string and calling a Run() method. Obviously all this has been done 'just for fun', since it's only one of my hobbyist projects anyway.
But when I mentioned to one of my colleagues that I had spent some of my free time writing unit tests for fun he said that I was clearly stark raving mad. There's a possibility he's correct.
However, when I think of how I'd feel if I broke some of my existing H2D2 code and had to go back and unpick where I went wrong, I reckon that these unit tests are really less about having fun and more about preventing a severe loss of fun if I ended up scratching my head and trying to figure out what I'd done to make something break.
So I hope that's a suitable explanation for why I've been writing unit tests in my free time. It's the best excuse I've got.
Although ultimately, I may end up looking for a unit testing framework for C so that I only need one IDE loaded to run my tests... The .Net interop solution may just be a stepping stone.
I've just discovered Topshelf for creating Windows Services in .Net. It makes building Windows Services a breeze, and you can also run them in the Visual Studio debugger easily too. Just look at the simple code example here ... and you only need to create a console app to make this example work.
Adding Topshelf to your project is easy thanks to NuGet. Your service code just needs to be a plain object and doesn't need to inherit from any special base class. It makes the whole thing extremely simple.
When you've compiled your console app, you can run it in the debugger to check it, and when you want to install it as a proper service, you just pass "install" as a command line argument when you run the exe. To remove the service you re-run the console app and pass "uninstall" on the command line.
Back in the summer, on a Saturday in Cambridge I saw this busker playing guitar and singing whilst *inside* a litter bin. It was very entertaining, it really made me laugh:
... it was made better somehow because he was playing songs from Jungle Book.
In the last couple of weeks, a few people have said that my libpigpio GPIO shared library for the Raspberry Pi only works if
they recompile it from source, like here for example.
(although a chap called Brendan mentioned it first, thanks Brendan).
So I thought that it was worth making people aware of that. Since I compiled the library on the initial Debian Squeeze
release, there’s probably some difference with other Debian distributions that have come out since.
However, compiling the library from source on your own Raspberry Pi seems to work, so at some point I’ll update the zip file
without the .so file, so that people can just compile their own version. In the meantime, the instructions are as follows:
- Download the zip file from here.
- Copy the zip file to the Raspberry Pi and extract the files to a folder
- Open a terminal window and use the 'cd' command to change directory to where you extracted the files
- Now type these commands (press enter after each line):
gcc -c -fpic libpigpio.c
gcc -shared -o libpigpio.so libpigpio.o
sudo cp libpigpio.so /lib
- That will have compiled and installed the library into /lib
- I have also included a test program which you could try, like this...
- In the same terminal window enter these commands
(note the spelling of -lpigpio is important):
gcc -Wall -o test main.c -lpigpio
- Now the GPIO pins 7 to 11 should be turning on an off
(use CTRL+C when you’re fed up)
I hope that helps...
On my recent holiday to Fuerteventura, I decided that I should take the opportunity to understand more
about Quantum Mechanics, as you do, so I took the book
In Search Of Schrodinger's Cat with me. I really enjoyed it, I can recommend it if you need a bit
more wierdness in your life.
I suppose that I'm bound to try and think about it in terms of computing; but I couldn't help feeling that
since it seems impossible to measure certain pairs of properties simultaneously, it's like the universe has
built in security protocols which only allow us to go so far. For example, it's not possible to measure both
the position and momentum of a particle like an electron simultaneously, if you're certain about one of
those properties, the other becomes more uncertain.
So, to me, the whole of Quantum Mechanics seems to be about Hacking the Universe. Nice.
version uploaded here. You can now select
three different colours and a palette will be
interpolated made up from in-between colours.
So, here's an example that I came up with using the new version:
There's a couple more simple options in this version, like a choice of fractal sizes and
a reset button. It would be handy to have an 'undo' option for those times
when you've made a slip of the mouse...
So, don't be surprised if there are more changes to come.
Since I seem to like my Mandelbrot drawing test program so much, I thought that I should create an easy way to experiment with different parameters, then I can stop drawing the same old thing all the time... Plus it would be nice to see the Mandelbrot set in all it's graphical glory for a change.
But I've also been wanting an excuse to play around with some more html5 canvas stuff, so I decided that this was a good opportunity.
So I set myself these goals:
- draw the fractal in a reasonable amount of time (try not to make it too slow in other words)
- observe the fractal whilst in progress, so you don't have to stare at a blank page until the whole thing has rendered
- be able to select a region of the fractal (with a mouse click) and redraw it (zoomed in) showing the new parameters
addicts, sorry, enthusiasts - and also use it myself of course. Perhaps I'll find some good new coordinates for future renderings in ASCII art.
I've also used it as an excuse to mess around with things like Twitter Bootstrap, which is a handy way to start a project from scratch.
I even tried to get it to work on older versions of IE which don't support HTML5, but whilst I found that I could use things like ExCanvas to bring canvas support to older versions of IE, the performance was poor when running my fractal code. So I gave up on that idea, it was locking up older versions of IE.
So I got to play with a few different toys along the way... which was fun and I learned some new things.
So I'm reasonably happy with the result. It even works on iOS, (although it did lock up once on my iPhone) I'd probably have to tinker with a few things to optimise it for proper mobile use (but I doubt that I'll bother). Even on my older iPhone 3GS the speed is acceptable. Mental note: I should try it on the Raspberry Pi and see how fast (or slow) it is, or if it works at all...
So here is some example output created whilst I have been playing:
And you can try it for yourself here.
Happy fractaling. Enjoy!
The main idea was for it to be minimalistic - so it's a character based system only. I always remember thinking that the work Microsoft did with MinWin was cool, so that's one of my influences. I always remember that Windows flag logo animated from ASCII characters...
Since I wanted to be able to run several things at the same time, I built a primitive window based environment - but one that works with keyboard control only, and in a browser.
Already I've got something which can move, resize, open and close windows. Everything is simply rendered into a <pre> tag with a monospace font, so theres no mucking about with <div> blocks or anything, just an array of strings that represent the screen - one string for each line on the screen.
Each 'window' draws its own content (which scrolls when it runs out of space) and this means that I can do different things in different windows. So each window becomes a kind of widget, in a text-only kind of way.
I have also allowed character input into each window which can post back a command to a webservice, and this means you can have a command processor running as a web service somewhere else. Of course, different windows could point to different command processors, so a variety of tasks can be done from the one environment.
Here's a screenshot of how it looks so far:
So before I get H2D2 running in mode_w I'm building a few experimental widgets, like the google search widget, just to see how well it works and to iron out any issues. The google search widget allows you to type in a search term and see the top matching URLs.
And maybe I'll build an expression parsing widget which could also be used as a calculator. But after that I will try and get it to host some H2D2 programs, since that is why I made it in the first place...
For the past couple of weeks I've been bringing my Raspberry Pi to work with me each day in my bag. But my desktop PC only has one network socket which is already in use, so I've only been able to connect the Raspberry Pi to my laptop. To make things easier, I bought a USB Ethernet adaptor, so that I can use my Raspberry Pi in the office with ease, in fact I can use it on any PC with a free USB socket. Here it is in action:
That works OK, which is cool. You can see I'm still running the Pi from the battery - which is still on it's original charge. It's given me light use of the Raspberry Pi for over two weeks. But at some point a Raspberry Pi powered laptop will appear I expect...
For my part, I'd be happy if somebody made an integrated Raspberry Pi case-and-battery. Then you could just carry one box around and recharge it like a phone or a kindle. But there may not be a market for crazy people like me who carry their RasPi around with them.