Code Painters The Art of Coding


Why java.nio is a better idea for Android

In my recent Android project I've encountered totally unexpected, low-level problems with TCP sockets. The problem occurs when you try to interrupt a blocking socket I/O by closing the socket. It is expected for the blocked operation to throw a SocketError exception immediately when the socket is closed from another thread (that's the only way to interrupt blocking socket operation, actually - Thread.interrupt() doesn't abort blocked I/O). Continue reading…


Flashing LPC1342/43 from Linux

The LPC1342/43 bootloader code is a great feature, allowing for firmware upgrades over USB with no additional hardware (given USB socket is there). Simply pull PIO0_1 low, reset the chip and it enumerates as a mass storage USB device. Copy over the firmware binary and you're done. Cool, isn't it? At least in theory, as my first attempt to flash the MCU using my Linux box simply failed - the firmware got corrupted. Continue reading…