Internet is such a strange place. I've found by chance some lines of GFA Basic code I wrote something like 20 years ago.
Actually in the late 80s the French magazine ST Mag used to publish short GFA Basic programs written by the readers. These were called GFA Punch. They had to have at most 20 lines of code, and had to do something funny or useful. Some GFA Punch I had written were published. Someone kept a floppy disk of a bunch of GFA Punch that were published and made it available.
Now, among all these programs I've found some of my old GFA Punch. For me its like finding an old sepia picture in a box. It's weird. I've decided to post two of these programs just for archeological reason. There isn't any technological interest as the quality of the code is poor.
This one draw colored frames :
This one draw a big ugly and slow scroll text :
dimanche 9 novembre 2008
jeudi 6 novembre 2008
TDD and tomatoes
Tomatoes are like tests, it is easier to make a tomato go from green to red, than from red to green.
mardi 14 octobre 2008
Sanitize dates in podcast title with groovy + jid3lib
When I sort the podcasts I download by their ID3 titles, I want to see an older episode sorted after a newer episode.
Here is a groovy script that modifies the MP3 title of an MP3 file passed as first parameter of the script, and replaces any dd.mm.20yy date by a 20yy.mm.dd date. It also moves the date at the beginning of the title.
You need the Java ID3 Tag Library (jid3lib) and an embeddable Groovy (groovy-all.jar)
Now in order to run the script after each download, your podcast receiver must be able to run a custom command after each download. You can use Juice.
So here is a quick and dirty script sanitize_dates.groovy :
In the preferences of Juice you can use Run this command after each download with for exemple :
Here is a groovy script that modifies the MP3 title of an MP3 file passed as first parameter of the script, and replaces any dd.mm.20yy date by a 20yy.mm.dd date. It also moves the date at the beginning of the title.
You need the Java ID3 Tag Library (jid3lib) and an embeddable Groovy (groovy-all.jar)
Now in order to run the script after each download, your podcast receiver must be able to run a custom command after each download. You can use Juice.
So here is a quick and dirty script sanitize_dates.groovy :
In the preferences of Juice you can use Run this command after each download with for exemple :
samedi 11 octobre 2008
MTP Mp3 players and Asus eee
Works like a charm :
Open a console : CTRL+ALT+T then
sudo apt-get install libmtp libnjb gnomad2
./gnomad2
Does not work with Amarok though, as the MTP support does not seem to be compiled in the version provided with the eee.
Open a console : CTRL+ALT+T then
sudo apt-get install libmtp libnjb gnomad2
./gnomad2
Does not work with Amarok though, as the MTP support does not seem to be compiled in the version provided with the eee.
jeudi 9 octobre 2008
MTP devices, udev and permissions in Ubuntu Dapper
I had to install Gnomad2 in Ubuntu Dapper in order to upload files to my MTP Mp3 player.
I followed this great How To
However Gnomad2 could not open the device unless I was root (same thing for mtp-detect)
It looked like a permission problem in /dev/bus/usb
This worked for me :
In /etc/udev/rules.d/40-permissions.rules I changed
# USB devices (usbfs replacement)
SUBSYSTEM=="usb_device", MODE="0664"
to
# USB devices (usbfs replacement)
SUBSYSTEM=="usb_device", MODE="0664", GROUP="plugdev"
Then
sudo /etc/init.d/udev restart
I followed this great How To
However Gnomad2 could not open the device unless I was root (same thing for mtp-detect)
It looked like a permission problem in /dev/bus/usb
This worked for me :
In /etc/udev/rules.d/40-permissions.rules I changed
# USB devices (usbfs replacement)
SUBSYSTEM=="usb_device", MODE="0664"
to
# USB devices (usbfs replacement)
SUBSYSTEM=="usb_device", MODE="0664", GROUP="plugdev"
Then
sudo /etc/init.d/udev restart
vendredi 5 septembre 2008
samedi 30 août 2008
TDD : Can Shared Fixture test unexpected statefulness ?
When praticing TDD, the impact of the different types of fixture that can be used to setup the tests must be known in order to avoid to create Obscure Tests
The usual default fixture type is the Fresh Fixture
When the fresh fixture takes too much time a Shared Fixture can be used. Now, that being said, the shared fixture should usually be avoided (there's a risk of Erratic Test)
A few days ago, during a discussion about test fixture, some colleagues of mine and I were wondering if shared fixture could be used in order to test the statelessness of the objects used in the fixture as a side effect of the sharing.
Here is the initial reasoning : when an object is supposed to be stateless, but is buggy and not actually stateless , the use of this object will lead to some failing test, since the state left by some tests will make some subsequent tests fail. The statelessness is tested "for free" with a lot of different combination. Actually, if the object happens to be stateful it is a case of Interacting Tests and the reason why some tests fail could be quite hard to find.
I must admit that it may help to find some obscure statefulness interaction, but I do not really like this idea :
To try to use the side effect of the shared fixture to test statelessness may seem to be worthwhile at first, but it creates Technical Debt. And in this case I think that the financial interest of the debt is pretty high.
The usual default fixture type is the Fresh Fixture
When the fresh fixture takes too much time a Shared Fixture can be used. Now, that being said, the shared fixture should usually be avoided (there's a risk of Erratic Test)
A few days ago, during a discussion about test fixture, some colleagues of mine and I were wondering if shared fixture could be used in order to test the statelessness of the objects used in the fixture as a side effect of the sharing.
Here is the initial reasoning : when an object is supposed to be stateless, but is buggy and not actually stateless , the use of this object will lead to some failing test, since the state left by some tests will make some subsequent tests fail. The statelessness is tested "for free" with a lot of different combination. Actually, if the object happens to be stateful it is a case of Interacting Tests and the reason why some tests fail could be quite hard to find.
I must admit that it may help to find some obscure statefulness interaction, but I do not really like this idea :
- I fear Interacting Tests far more than a single bug, as Interacting Tests in a test suite is hell on earth,
- A test is supposed to have One Assertion Per Test. Or, at most a few assertions. In this case, the statefulness test is spread in the whole test class.
To try to use the side effect of the shared fixture to test statelessness may seem to be worthwhile at first, but it creates Technical Debt. And in this case I think that the financial interest of the debt is pretty high.
Inscription à :
Articles (Atom)