Home / Category/Programming

fork()ing and fstat()ing in JRuby using FFI on linux

Sometimes, $DAYJOB can get kindof technical. For reasons I won’t go into here because NDA, the following axioms are true for this puzzle:

  • we have to work in JRuby
  • we are in a plugin within a larger framework providing a service
  • we have to restart the entire service
  • we don’t have a programmatic way to do so
  • we don’t want to rely on external artifacts and cron

Now, this isn’t the initial framing set of axioms you understand; this is what we’re facing into after a few weeks of trying everything else first.

So; obvious solution, system('/etc/init.d/ourService restart').
Except that JRuby doesn’t do system(). Or fork(), exec(), daemon(), or indeed any kind of process duplication I could find. Oh-kay, so we can write to a file, have a cronjob watch for the file and restart the service and delete the file if it finds it.… Read the rest

Read More

DerBlinkenLightzen!

8-pin microcontrollers are pretty neat things. I’d only used the larger PICs before, I didn’t see how these could be all that useful. And the 16C74s could do more… twenty years ago. These days, the 8-pin PICs have caught up with the older models in internal features, if not pincount. It’s really quite remarkable:

Same amount of program memory as the one from PICrat (actually, the modern version of the chip from PICrat, with the fancy flash memory), the CPU’s faster, it has more RAM, it has an internal EEPROM for persistent storage, same number of digital comms, one less CCP (but 32 fewer pins, so okay), half as many ADC channels (again, 32 fewer pins) but higher precision on those channels, same number of timers, a new comparator, a wider range of operating voltages and it takes less power (much less, it turns out).… Read the rest

Read More

PICRat

So twenty years ago this year I graduated, and just after that (and before I started chasing a PhD), I did some work on a project to create a platform for building a micromouse robot. Not a speed run winner or anything, but just a bog standard, easy to use, off-the-shelf black box platform.

This was 1997, remember, these things technically did exist but they were research project level expensive and finicky and whole companies were making good money building them; Arduino is still six years out at this point and it would be years before you saw the level of available support hardware it enjoys today. Lego Mindstorms is years away and Lego’s RCX doesn’t come out till the following year. The BASICStamp is the most popular solution to beginner hobbyists and it costs the guts of $100 at the time if I recall correctly.… Read the rest

Read More