My name is Kyle.
I'm a

software engineer?

programmer?

developer?

coder?

...these are my notes

Code

Why Unit Test?

Contrary to popular belief, the purpose of unit tests is not to verify correctness of code. Correctness can only be determined by a human. Code can be beautifully engineered and thoroughly unit tested, yet incorrect. The purpose of unit testing is more nuanced: to prevent changes to the expected behavior. When we write unit tests, we are formally specifying the expected behaviors of the testSubject. Whether of not these expectations are the correct expectations is purely subjective. When all of the expected behavior of our code is being witnessed by unit tests, we have a ‘safety net’ in place that allows us to […]

Java

Test Driven Development (TDD) Tutorial

Introduction: Kent Beck, one of the original signers of the Agile manifesto and creator of eXtreme Programming, is credited with discovering Test Driven Development (TDD), but he claims he merely re-popularized the technique and coined the term. Here is what he had to say about rediscovering the technique: “The original description of TDD was in an ancient book about programming. It said you take the input tape, manually type in the output tape you expect, then program until the actual output tape matches the expected output. After I’d written the first xUnit framework in Smalltalk I remembered reading this and […]

Crypto

Install Truecrypt 7.1a on OSX Yosemite

    Despite the suspicious shutdown of Truecrypt, it is still a solid solution for your data encryption needs unless you are an enemy of state.  Installing the last usable version on Truecrypt (7.1a) requires some tribal knowledge to install on OSX Yosemite. Here is how to bypass the “TrueCrypt requires Mac OS X 10.4 or later.” error: 1) Double-click  truecrypt_7.1a_mac_os_x.dmg 2) Right-click  TrueCrypt_7.1a.mpkg and “Show Package Contents” 3) Open Contents Dir 4) Open Packages Dir 5) Install OSXFUSECore.pkg 6) Install OSXFUSEMacFUSE.pkg 7) Install MacFUSE.pkg 8) Install TrueCrypt.pkg

Code Java

Answering an Interview Question…Thoroughly

Here is a coding exercise I was asked to solve during a recent interview: Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, … By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. This is a basic solution, it is what I consider a rough prototype. /* Each new term in the Fibonacci sequence is generated by adding the previous two terms. By […]

Code

Zoomable UITableView iOS component

Apple’s UITableView component does has many clever features right out of the box, but the ability to pinch zoom is not one of them.  I’ve created a custom subclass of UITableView that adds a pinch zoom gesture.  Check out the example project on Github:  https://github.com/bkturley/zoomUITableView

Code iOS

iOS Fix: file is universal (2 slices) but does not contain a(n) armv7s slice: /path/to/file for architecture armv7s

This common error plagued be when trying to run my weatherApp on an iOS device.  It turns out that a build setting needs to be changed. In xcode, select your project file. select the ‘Build Settings’ tab change the view from ‘Basic’ to ‘All’ search for ‘Build Active Architecture Only’ set this value to YES.

C Circuits

Reverse engineering a 16 character display using an Atmel 328p.

Recently I wanted to expand the functionality of an automated test harness for an embedded device. The device has a 16 character display made of 4 Avago HDLx-2416 Series parts (datasheet). I gutted the device and tapped the display’s pins to my AVR. The AVR reads the LED display’s signal pins and sends the displayed string to the test harness via serial connection. Now the test harness can verify that the device under test’s display is lighting as expected. /* * ScreenScan.cpp * * Created: 6/8/2012 *  Author: BK Turley */ /* port wiring: PB0 – ascii 0 PB1 – […]

C Circuits

Switches and interrupts on a PSoC 1 Microcontroller

I. Introduction / Summary The most practical way for a microcontroller to retrieve input is via interrupt.  The vast majority of modern processors have interrupt functionality.  This functionality allows a processor to work on background tasks while no input has happened. Once input is detected, the processor diverts its attention to react, then returns to where it left off after the interrupt has been serviced. II. Description and Circuit Diagrams An optical encoder is connected to VCC and ground to provide power to its internal emitters, detectors, and squaring circuitry.  The encoders outputs are connected to P1[4] and P1[5] on […]

C

Polling a switch Using a PSoC 1 Microcontroller

     One way for a microcontroller to retrieve input is known as polling.  Polling means repeatedly measuring  a sensors value.  I will describe how to poll a pushbutton switch  and react to its measurement when using a Psoc3 microcontroller.   /* * Filename: switchpolling.c * * Title: Polling a switch with a Psoc microcontroller * * Description: This source code file is used with a Psoc 3 microcontroller to poll a switch. * Upon detecting a change in the switches state, An LCD is updated to display the number of * times the switch has been closed in Hex […]