I've been working with Drupal now for about 3 years now. From time to time there are things that are just strange design decisions or just plain stupid.
One such thing is Date fields, there are a couple of them with no clear documentation (on the Field management page that is, there are if you Google, but who does that?). Anyway, I needed a Date field. The ISO sounded good, pretty much assumed it was just related to the data entry as I was going to feed in a 170000 nodes with date & time field in a easy for machines to parse format.
How.Wrong.Was.I
Drupal uses, obviously, a SQL database. Meaning that dates, should, obviously be stored in a SQL a DATE, TIME, DATETIME type right ? Oh, no no no.
What does Drupal do ? Use a varchar.
No wonder searching, by date ranges, on my collection of 170000 nodes was just a tiny bit slow.
Sunday, August 14, 2016
Thursday, July 21, 2016
Basic IR remote control for arduino train
Got inspired a while ago and added IR remote support to the train set. Lights can be turned on/off and the train can be fully controlled with the Play/Stop/Pause/FF/RW and Prev/Next track buttons.
The code is available on github
- Play will start the train slowly to a set speed
- Stop will engage the brakes and stop the train
- Pause will slowly stop the train
- FF & RW controls the speed
- Prev/Next will change train direction (when stopped)
- Number buttons (1-3) toggles building lights
The code is available on github
Thursday, June 16, 2016
Train set (Environmental education pacakge) demo video
A quick demo of the system in action
Wednesday, June 15, 2016
Environment education package, a train set with various themes
Something I've been working on @Work(tm). It started with the exercise bike generator and then we went a bit crazy with the extras for it.
It is part of a environment education package with various themes, including energy, mobility, waste management and biodiversity. It is part of the City of Turku Ekotuki action.
I've done the technical side of it using an AVR/Arduino as a main controller. The track has 3 (The two that are positioned at the parallel track location are combined into one.) IR sensors to track where the train is. The IR sensors are monitored using interrupts and as there are only two on the ATmega328P the two sensors needs to be combined into one.
A H-bridge motor controller is used to run the train itself using one pin PWM for speed and a couple of pins for direction control.
As the whole system is covered with a plexiglass cover to keep fingers away, the whole system and train needs to be fully automatic. The train controller is configured to run the train around the track a random amount of times (with lower and upper limits), then stop and the station and change direction.
To help debug the system a character LCD is connected trough i2c, it displays the current state, input voltage, speed, wait counters and various other data.
The run time and stop time can be adjusted with two potentiometers so code changes are not required for basic adjustments. These are read at startup with analog inputs.
We are considering adding a automatic/manual model toggle with some kind of a remote controller (IR might work).
All buildings have LED lights and are also controlled by the Arduino, currently some are combined because a lack of hardware (need to add a PWM LED controller) but all lights can be controlled separately.
There is also a tiny i2c connected B&W LCD screen (the red thing by the blue car, supposed to be a charge point for electric cars) that is used to display logos of the sponsors (Föli, Turku Energia, Lounais-suomen jätehuolto and Turun seudun puhdistamo Oy) and train timetables (fixed for now). This will be upgraded to a color LCD sometime in future.
The system can be powered by the exercise bike to demonstrate electricity generation and usage. It is also possible to power the system with a AC-adaptor in cases where using the bike is not possible.
The Arduino source code is open and available on github. It is of course very specific to this particular setup but still, it is there.
The small house at the top has also a working solar panel.
The package is still evolving and one of the features in the pipeline is to add environmental and train sounds, upgrade the sponsor LCD to a color version and fully separate light control. Also a way to run the set in manual mode is
Various kits was used to build the whole thing, you can find links to the major parts below if you are interested:
![]() |
| Environment education package, train set with various themes |
It is part of a environment education package with various themes, including energy, mobility, waste management and biodiversity. It is part of the City of Turku Ekotuki action.
I've done the technical side of it using an AVR/Arduino as a main controller. The track has 3 (The two that are positioned at the parallel track location are combined into one.) IR sensors to track where the train is. The IR sensors are monitored using interrupts and as there are only two on the ATmega328P the two sensors needs to be combined into one.
A H-bridge motor controller is used to run the train itself using one pin PWM for speed and a couple of pins for direction control.
![]() |
| The system, a bit of a mess yes :) |
To help debug the system a character LCD is connected trough i2c, it displays the current state, input voltage, speed, wait counters and various other data.
![]() |
| Debug character LCD |
The run time and stop time can be adjusted with two potentiometers so code changes are not required for basic adjustments. These are read at startup with analog inputs.
![]() |
| Configuration potentiometers |
We are considering adding a automatic/manual model toggle with some kind of a remote controller (IR might work).
All buildings have LED lights and are also controlled by the Arduino, currently some are combined because a lack of hardware (need to add a PWM LED controller) but all lights can be controlled separately.
![]() |
| Building lights |
![]() |
| Recycling point with street light |
There is also a tiny i2c connected B&W LCD screen (the red thing by the blue car, supposed to be a charge point for electric cars) that is used to display logos of the sponsors (Föli, Turku Energia, Lounais-suomen jätehuolto and Turun seudun puhdistamo Oy) and train timetables (fixed for now). This will be upgraded to a color LCD sometime in future.
![]() |
| Electric car charge point with advertisment screen |
The system can be powered by the exercise bike to demonstrate electricity generation and usage. It is also possible to power the system with a AC-adaptor in cases where using the bike is not possible.
The Arduino source code is open and available on github. It is of course very specific to this particular setup but still, it is there.
The small house at the top has also a working solar panel.
![]() |
| Solar panel with LED light in the window |
The package is still evolving and one of the features in the pipeline is to add environmental and train sounds, upgrade the sponsor LCD to a color version and fully separate light control. Also a way to run the set in manual mode is
Various kits was used to build the whole thing, you can find links to the major parts below if you are interested:
- Faller 130459 Wohnhaus "Backstrasse 3"
- Faller 130801 Plattenbau P2
- Faller 131242 Kleine Mühle
- Faller 130468 Biogasanlage
- PIKO 57194 ICE 3 set
Monday, April 25, 2016
Native ScummVM for PlayBook, progress
I was sick and tried to do something usefull at the time. So, a bit of hacking on the BlackBerry fork of SDL to add support for native gestures (Swipe down and and Back swipe "down-left to upper-right").
Swipe down is obviously used for the game menu access (F5 key) and back swipe for Escape to skip cut-scenes (ESC key).
It is pretty much ready for submission!
See below for a quick video on how the swipes are working in Sam & Max Hit the Road and Flight of the Amazon Queen.
Swipe down is obviously used for the game menu access (F5 key) and back swipe for Escape to skip cut-scenes (ESC key).
It is pretty much ready for submission!
See below for a quick video on how the swipes are working in Sam & Max Hit the Road and Flight of the Amazon Queen.
Wednesday, April 13, 2016
ScummVM for PlayBook and BB10
Started to scratch an itch as nobody seemed to have done a proper native port of ScummVM for the PlayBook or BlackBerry 10 devices.
It runs and the games seems to work. Now what is needed is some way to handle left/right clicks, F5 and other keyboard shortcuts.
It runs and the games seems to work. Now what is needed is some way to handle left/right clicks, F5 and other keyboard shortcuts.
![]() |
| Native ScummVM on BlackBerry PlayBook |
Monday, March 21, 2016
RetroPlayer 1.0.0 beta for BlackBerry 10
Very basic, but does what it is supposed to do. More at RetroPlayer project page.
The icon is horrible, I suck at those.
The icon is horrible, I suck at those.
Labels:
Amiga,
Atari,
BlackBerry,
libmodplug,
libsidplayfp,
SID
Subscribe to:
Posts (Atom)









