Skip to main content

Posts

Streaming JSON in React Native

On the current app I'm working on, we download some quite large JSON files from which we create a Couchbase DB. These files are some tens of megabytes. Initially, we downloaded them on the JS side and just sent those via the bridge to our custom Couchbase module. This works fine on iOS, but Android devices generally have more strict heap size limitations, and even downloading and parsing a 40 MB file will crash the app on a two-year-old device. In Android, we have to download the files in the native code and write the DB inserts directly from the input stream. We don't have to strongly type the incoming JSON objects, so I came up with this handy snippet for creating a generic Map<String, Object> from a JSON object using plain old Android utility libraries. 

Core memory simulator

The exceptional video series on Apollo guidance computer restoration by CuriousMarc inspired me to create a simple simulation of how core memory works. Magnetic-core memory was the memory form used in space applications and any computer systems from the fifties all the way to the seventies.  https://jompanakumpana.fi/corememory/

DIY vs. dependency

I recently pulled an apparently small item from the backlog. It was to add a guided tour, a showcase of the essential features of the app. Naturally, I search for an open-source library that would do the job, and Bob's your uncle. There are a few alternatives to pick from. Yet, they seem just not quite fit the need here. All of them require excessive changes to the existing implementation instead of just plug and play. In cases like these, how do I draw the line, when to use a library, when to DIY. First of all, I have a high do it yourself threshold.  I generally think that almost any reasonably used OS library is a better option than DIY. You probably are a worse developer in the domain of the library than the community behind it. You also have not yet run into all those corner cases and weird bugs that come biting you back. Even if the dependency may bring something you don't need, I see it as a worthwhile trade-off. I'll skip the frameworks vs. libraries debate here. If...

Non geeky post warning! A guide (rant) how to survive as a cyclist.

After 15 years of being an active cyclist, here is my opinionated guide on how to survive this long. As with any hobby that includes tech, biking is unreasonably full of marketing hype, which appeals to fundamental instincts. You can quickly get sucked into the depths of the seemingly innovative pool of shiny tech and gear. In my opinion, this can seriously hinder the fundamental enjoyment of riding a bike and cause anxiety. A tech-savvy rider will spend his evenings hunting for deals instead of planning that awesome next trip at a local sight. I argue that the latter will satisfy their needs more sustainably. You don't need an expensive bike and kit. I rode my 2005 road bike I bought second hand from 2008 all the way to this year (2020) and my conservative estimate how long it lasted is 1800 hours, so about 45 000 kilometers. I have only two pairs of bibs and jerseys, one cycling jacket, and shoes I bought in 2009. In the winter, I drive my inexpensive travel bike ...

Bluetooth MIDInator

I got inspired by a Youtube video on making a cool MIDI controller by Switch & Lever  https://www.youtube.com/watch?v=JZ5yPdoPooU He uses scrapped/recycled parts for the controls screwed into a beautifully crafted casing. Sadly, I'm not as talented as a craftsman as the Youtuber and could not conjure up the energy to start looting up phone dials and joysticks, yet I took on the project by building up my version. I decided to make a Bluetooth MIDInator.   The Arduino board I use is a Bluno board with integrated Bluetooth  https://www.dfrobot.com/product-1175.html The controller layout is a much simpler version than the original MIDInator with 16 potentiometers and four encoders. First, I forked the repo and took a look at the code. It was understandable and readable, thus a good starting point for the project. I use a breadboard and a potentiometer to try out the MIDI communication through the serial port to a DAW with Hairless MIDI and loopMIDI, ...

Aalto BDA course

I've been studying the Aalto university Bayesian data analysis course on my own (slow) pace this spring and early summer. I've mostly watched the excellent course videos and scrolling through the coursebook, but there has been some coding as well. The exercises are supposed to be made with R, but me being a master hackerman, I chose golang and gonum. While the gonum library is limited compared to what R has, my goal with this course is not to become a statistics expert but rather to relearn what I have forgotten from my university studies. I also value keeping my go skills in tune. I present you, exercise one.   

AnimatedIcon.tsx

I've been using react-native-reanimated for simple animations. It's great, but it has a rather steep learning curve. There is a 2.0 version coming out soon with a different syntax, which should allow producing native animations more straightforward. In anticipation of 2.0 release, I present you a 1.X.Y version of an Icon with a discrete scaling animation on tap. Edit: Now reanimated 2 is out so a much cleaner version is possible. See AnimatedIcon2.tsx