Saturday, September 29, 2018

Modifying Toys

As a hobby, I like playing with Arduinos and having the ability to control real world devices like sensors and motors. Recently I decided to add a Cylon/KITT eye to my son's old robot toy:


First I bought an Arduino Pro Micro and an addressable LED strip. I cut the LED strip to fit into the robot's head, wrote a sketch to simulate Cylon eye and tested the setup:


Then I made sure that it worked with 3 AA batteries:


Then I squeezed in the LED strip into the robot's head and tested once more:


Then I verified that it worked with the robot's batteries:


Finally I assembled the whole robot:


The hardest part was fitting the pro micro and all the extra cables into the robot's body.

What's the point of all of this you ask? First of all, I like doing such things. And secondly... Watch Eli's video: The Value of "Hobbies" for Tech Professionals.

Monday, September 17, 2018

Binary search tree height

As part of HackerRank 30 Days of Code Challenge, I solved the binsary search tree height problem (day 22). My solution is not the most efficient/prettiest solution but it is mine (!):

Tuesday, September 04, 2018

Building a NetBeans java project without installing NetBeans

NetBeans projects that use the Layout class require swing-layout.jar, otherwise you will get the error message "package org.jdesktop.layout does not exist". To build a NetBeans project on a computer without installing NetBeans, you have to copy the swing-layout.jar and add the following to project.properties:
file.references.swing-layout.jar = <path of jar>
java.classpath =
    ${libs.swing-layout.classpath}:\
    ${file.reference.swing-layout.jar}

Also make sure that there are no trailing spaces, especially in the java.classpath section. And finally keep the build-impl.xml file.