Many faces of programming


I developed software for various computing devices during my lifetime. When I started I had a certain goal, or end game… if you will. These days I see a vastly different person in the mirror compared to when I started, and that got me thinking, “I wonder how everyone else sees me?” Hi, I’m Cliff. You’re here because you write code and nobody else truly understands what you do. I’m here because I share your story. The following is an abbreviated history of where I started my career and where I currently am. It attempts to capture how the people in my life view me and how those views evolved over the years.

frustration

As a software guy I have always been misunderstood. It’s hard to describe, in words, where the disconnect is. Take the following exchange as an example:

So my wife says, “Go to the supermarket and get me a gallon of milk and if they have eggs get 6.” When I came back she was furious with me asking, “why did you buy 6 gallons of milk??!!!”

I replied, “Because they had eggs!”

The problem exists in the different vantage points the people in my life have. In the beginning of my career I was all about backend work. It was mostly legacy AS/400 but then I got into SQL with DB2 and… well, here’s a decorated description:

(Disclaimer: The author has shamelessly linked to artwork from various corners of the internet to make a point. Any similarities with what you find here and real life scenarios is purely coincidental…)

 

The DB2 SQL Database Programmer

What my mother thinks I do

What the Starbucks barista listening to my conference call thinks I do

What I think I do

What my clients think I do

What I actually do

screenshot

 

 

 

 

 

I eventually moved into General desktop client/server programming. I felt the need to convey my career change to loved ones but I truly don’t think they understood where I was headed.

The General Desktop Programmer

What my grandparents think I do

What my uncle thinks I do

uncle-job-description

 

 

 

 

 

 

 

 

What my wife thinks I do

pacman_game

 

What my neighbor thinks I do

What I actually do

Eventually I moved into more modern technologies landing my first job working for a major dotcom company. I got my first Blackberry, then my first iPhone along with other cool mobile computing toys.

The Mobile Developer

What my older daughter thinks I do

What my younger daughter thinks I do

What my best friend thinks I do

What I think I do

What I actually do

 

…and finally I came to understand that not only do different vantage points color my perceived reality, also my choice of programming language has a huge impact on how I attack problems. The next illustration explains how various programming languages would shape ones overall college career.

Programming Languages in College

 

Android Animation Fun


Merry Belated Christmas!!! I find myself trapped under my Macbook this holiday season and completely captivated by the Android animation system. “I find myself” is sort of a strange thing to say since I’ve never really lost myself. I mean, how can I find myself without involving one of those out of body experiences? If I did have an out of body experience I couldn’t imagine losing myself because I would always know where I last left myself. If myself is not inside my-fleshier-self then I would think that my-fleshier-self would know to stay put until I returned to myself, know-what-I’m-saying? By the way, I’m Cliff. You’re here because you probably did lose yourself on one occasion or another.

You see, not many people are as responsible as I am during out of body experience. Other people would probably misplace their fleshier counterpart while they wander off to the casinos, shorelines and so forth… generally having an awesome time. Then they would circle back, completely forgetting which hospital or state they departed from and… where was I going with the story? Android animation!

I was looking to enhance an app I’m building with animation and when I took a step back I realized I built the beginning of an animation composer. It started from my need to see how the different interpolators behave. I found some source online to visualize interpolation and started to build from it. I had this idea of shape morphing so I created a custom view to see how/what I could do to morph it. My project is somewhat basic. I mean I just started with an activity with an Activity containing animation controls.

A basic activity
A basic activity

I read the values from these controls to make an animator and apply it to a custom view. I then wanted to experiment with orchestrating multiple animations at once or in sequence. For that I needed to repurpose my controls into a fragment so I can create a multi-control list view. Pulling the logic out of my Activity and into a Fragment was somewhat simple using Android Studio. I started by moving the controls in the layout into a separate layout with the extract layout refactoring. This created an includable resource which I wrapped in a FrameLayout. I has to move the animate play button out of the layout with the controls since this would eventually apply to all controls. Building and running on the device confirmed that I hadn’t broken anything while rearranging the layout. I gained confidence to delete the include from my layout. I renamed the activity replacing the Activity suffix with a Fragment suffix and changed the logic to load the newly extracted controls layout. Next I created a simple activity to load the fragment dynamically and add it to a frame layout in the center of the screen.

After confirming the app still worked using the controls out of the fragment I went on to introducing a list view replacing the the included fragment. I figured out how to add fragments as list items in an adapter. I added logic to iterate the fragments in the list and build an AnimatorSet where I play all animations together. Things were broken initially but with a few more tweaks I got the entire thing working again.It is still in its infancy stage but it covers the basics of composing animations and playing them against a custom rounded rect view. You can find my work in progress at Bitbucket.

multiple animation support
multiple animation support

Signs you’ve gone too far teaching your kid to code


You’re a parent of a brand new snuggly-size manifestation of humanity and you couldn’t be more excited! You’ve called friends, family, and even told the gas station attendant. There’s no greater moment, but when do you introduce the child to your way of life? When should you explain how awesome writing code can be? Is it slightly after the first diaper change? Do you wait until baby’s first steps? Is it too late once they’ve learned to crawl??? When you start the lesson how do you know if you’ve gone too far???

Hi, I’m Cliff. You’re here because you have young kids at home. You might be thinking, like I once did, how cool would it be to get them into this fantastic field of software engineering. I had the true life experience of schooling a 7 year old in the art of coding. I was using Scratch at the time. It’s an app that teaches young kids to code using colorful little puzzle pieces and a cat that you can animate. It was so much fun yet so limited. I found myself going into source to make modifications while I was teaching. I felt the need to support pointers, robust opcodes and other things. I was also frustrated with the lack of an interactive debugger. When making the cat play in the grass lead to my pulling up Smalltalk tutorials I knew I had crossed some line. I just didn’t know which. How do you know you’ve gone too far with your little one? Here are some of my examples. Some are contrived, many true. Others are slightly exaggerated.

You know you’ve gone too far when…

  1. Baby’s first “hello world” ends with a segfault.
  2. The keyboard and monitor are both angled away from her and toward your general direction.
  3. You start pondering how to check puzzle pieces into Subversion or Github.
  4. Bed time has come but you’re still explaining the significance of bit-masking.
  5. Stacking all those puzzle pieces together is a dumb way to do it, you need a callback!
  6. Your explanation of the merits of event based coding outweighs the kid’s desire make the kitty walk.
  7. A while loop is a stoopid way to do it, you need a callback!
  8. She should stop whining and focus on getting the unit test to turn green!
  9. If she would just stop recording her voice and let you show her how to actually code something…
  10. Using a “wait” is a stoopid way to do it, you need a callback!
  11. You could make the ball move left instead of right if the dumb IDE editor only had an interactive debugger!
  12. You just figured out how to step through source in Scratch
  13. Someone has to remind her that we just made a callback for that function…
  14. A Gradle plugin sounds like a good idea.
  15. She needs to stop copying silly audio clips in the project and work through the scoring algorithm!
  16. See, wasn’t that fun? Look at the multi-module masterpiece she just made (without setting a finger on the keyboard)!
  17. We just have 4 more levels to complete before the game is ready to ship. (After lesson 1)
  18. For the love of peanut butter!!! Why can’t she use the callback???
  19. “Yes dear, just 10 more minutes while we step through source…” becomes an unconscious reply.
  20. She asks you, “Daddy what’s a Jira and why do we have to file one?”
  21. A database just became an integral part of your app.
  22. You opened your first JDBC connection in Scratch.
  23. You’re celebrating because she just fixed the Jenkins build
  24. You explain to the wife how the tears only started when the address to the screen refresh routine became corrupted.
  25. Add some of your own in the comments below…

Xcode Local History


I found a hidden (gem) feature in Xcode today out of desperation. As I find myself bouncing from Intelli *Ahem* Android Studio to Xcode I often miss features from the former IDE. Hi, I’m Cliff. You’re here because you screwed up a source file and need to recover. Your project was probably completely functional but then you made some random edits and now you cannot figure out which change broke which thing. Don’t commit often? Then you probably have this problem frequently.

The way out lies in a hidden feature of Xcode, something we Java lovers have been spoiled by for years… Local History! That’s right, Xcode actually auto-saves revisions of your files as you work the same way Eclipse and the IntelliJ platforms do. The only wrinkle is that while Xcode does maintain a local history there is no history viewer in the IDE. The trick is to open the source file in TextEdit then click “File -> Revert to -> Browse all revisions” from the menu bar. You will be dropped into a Time Machine like interface for the current file where you can cycle back through the various edits. This interface, though more dramatic than what you find in the Jetbrains suite of tools is not as functional. For example, you cannot see a record of when tests passed or failed, only time stamps. Also, lacking a hot-key trigger, it requires 3-4 steps to coordinate. You must right click inside the source file in Xcode, choose “Reveal In Finder”, drag/drop the file into he TextEdit icon in the dock, optionally open TextEdit if you don’t have it pinned, then do the file menu dance. Still it is an incredibly useful tool which just might save my bacon today since I changed something and can’t figure out what it was.

Got that job at GE!


I just started at GE and here they go with this brand new ad campaign! It’s so timely and SO true…

All joking aside, this is one of THE best companies I’ve worked at. They’re doing big things and I get to be a part of it early on. None of the stuff is old fashioned, it’s all cutting edge tech, more so than I’ve seen at other places. (For those of you following me on Twitter I sent the wrong link to the #CodeNewbie chat… FAIL!)

MS Word Wins the Copy Paste Test


You want to grab the guts of a web page and save it for later. You don’t want the hyperlinks on the bottom, or the ads along the side. Just the important stuff right in the middle of the page. Click, drag the blue selection around the interesting part, right-click and copy to clipboard. You could paste into Word but you recall the recent install of Pages on your new Macbook Pro, the Apple equivalent of Microsoft Word. You quickly create a blank Pages document and paste but have disappointing results. Hi, I’m Cliff. You’re here because you wanna know which word processor would win in a Kung Fu fight between Word and Pages. I’m here to announce that Microsoft Word (as much as I LOVE Apple and Pages) puts the roundhouse on Pages in the copy/paste match. I kind of expected more from Pages, though I’e performed this test in the past with similar results.

The test goes like this. You copy some arbitrary web content, open a new document, paste the content, and hope things look similar to how they looked in your web browser. This is such a natural abuse of a word processor that MS Word almost never disappoints. The exception is the rare occasion when there is specialized Javascript and/or CSS involved that caters to a certain environment. Pages seems to get most of the formatting correct but ignores tables in copied content. Again this is not the first time I’ve attempted to copied a partial web page into Pages nor is it the only time I’ve had a disappointing outcome.

MS Word Table
Couchbase Network port table copied into Word

Pages Table
Couchbase Network port table copied into Pages

My experience with Pages vs. Word is different starting from “File New”. I don’t know why, but I feel more comfortable working with Pages. This may be why I keep trying to use it instead of Word. Apple concedes that Microsoft “knows” productivity in the latest iPad keynote and this example of how Word can simply “produce a copy of content” reinforces that sediment. Still, I am routing for the upcoming rival.

And the extra point!


Part 1.5 in my quest to code for the out-dated Kinect model 1473 on an outdated Macbook pro from Mid 2010: I was never, EVER able to get Processing to control the tilt of my Kinect sensor, but now it seems as if I have that working as well! Again, things do not match the documentation/instructions 100% but with enough experience you learn where to look to resolve your issues. I Googled for “kinect tilt libfreenect” which turned up a complaint from someone that they were getting an error when running the libfreenect-glview command.

upload_firmware: failed to find firmware file.

I noticed I was getting the same weird error when running the command to test my install. It turns out the error is explained in the bottom of the FAQ on the openkinect.org site:

I get the following error accessing microphones: upload_firmware: failed to find firmware file.

The Kinect audio system requires a firmware to be sent at runtime. It should be found in your installation (in share/libfreenect/audios.bin) but it might be absent. Run share/libfreenect/fwfetcher.py to download the latest audio firmware file and move it to your installation.

Apparently you need the audio firmware in order to interact with anything more than the camera and depth sensor. There is a “fwfetcher.py” (FirmWareFetcher) Python script bundled in the libfreenect install that will fetch and install the driver for you. Running this command is not possible out of the box because it requires root privileges and is not executable. You have to run “sudo python /usr/local/Cellar/libfreenect/0.5.1/share/fwfetcher.py” (The location of the fwfetcher.py script may vary, this is its location when you install via Homebrew.) After the Python script downloads the Firmware it will crash while extracting because of case sensitivity in the path. It looks for all files under a root folder “$systemupdate” in the zip file but the file name as of the current firmware is “$SystemUpdate”. Opening the script and doing a find/replace “$systemupdate” with “$SystemUpdate” will fix the script so that it downloads and installs the driver correctly. After the install of the driver the audio and tilt devices should be operational both from native code and from the Processing wrapper.

Happy coding!