Alex's Undercover Blog

For the geekier side of me.

Checking in...

Posted: Sun, 16 Sep 2018 by

Every now and then I'll open up my blog (if you can call it that) to see when the last time I wrote something of use. I've always liked writing, but have been horrible at getting in the habit of doing so. This is clearly the case since I haven't written since early 2013 (more than 5 years ago at this point) and, embarrassingly, was me proclaiming I was going to get "this and that" done by the end of the year. While setting goals is good, I've learned from experience that the goals that I need to set need to generally be smaller in scope and be shorter term. I set a bunch of goals for the year, but those goals weren't broken down into smaller chunks or time frames which made it hard to track my progress with them (not that I was tracking their progress).

In my previous post I wrote about wanting to read a laundry list of books, some technical, some not. The list seems fine enough, but the fact is the mood that I'm in shifts regularly enough that thinking I would be interested enough in those books, whenever I got around to them, was wishful thinking. Especially if I was going to be reading them over the course of the year. Over the last several years I've started to get into the habit of reading one technical book, to read when I have an hour or more by myself to spare, and one non-technical book, to read before bed or while I'm driving (in audio format), at a time. Basically I let whatever mood I'm in drive what it is I'm reading. It seems simple, I know.

With respect to reading, I've been trying to use Good Reads to track my reading progress (using my Kindle) and to keep a list of books that I want to read at some point in the future. That way I should be able to jump straight into the next book, once I've completed one. This is much more visible then keeping all the books I want to read on my kindle and then trying to find the one I'm after. It's not perfect but it's a step in the right direction.

As far as technical books go, my ability to tackle them has been a bit hit or miss, especially now having a toddler running around the house. In order for me to really absorb what it is I've been reading, I need to be able to apply it on a regular basis. There are so many things that I want to learn, but the fact is if I don't come up with a project to apply what I'm learning as I go, I essentially lose it. The books that I've been the most successful with have been those that have a book-long project that is built up and improved as you read the book. Two books that come to mind are:

Both of these start you off with the very simplest knowledge you need to get some basic functionality implemented, and then build on top of the initial codebase, a lot of the times starting you out with less than stellar coding patterns, but backing those things out in favor of more improved ways of doing things once you have the knowledge to do so.

Both of these books I've been able to stick with because the projects are compelling.

I've also found success reading books on those subjects that I use on a daily basis at work. The most recent being Functional Programming in Java. Java 8 introduced lambda functions and functional programming facilities to make code cleaner, more efficient, etc. Because the codebase I was working on was starting to use these facilities, it was important that I be able to use them effectively. It was easy to read a chapter or a half, and then apply it the next day at work.

So what am I doing to try and actually accomplish things that I want to accomplish?

  • Jotting down ideas as soon as I have them, and taking notes whenever I think of new and interesting details. In this way I can capture enough details to help kick start whatever it is that I'm doing.
  • Planning things as much as I can. Organizing the notes above and coming up with a general plan of execution and then tracking these tasks somewhere. I've been using Trello.com for this as I can define swim lanes for each step of the development process. The planning step is hard but worth it as it allows me to focus what little time I have on specific tasks.
  • Doing my best to get a project that I'm working on to a stage where it's actually working so I'm not left with a bunch of half-implemented code. This blog is a good example. Written from scratch and has enough functionality to be useful but could easily be extended in a number of different ways to make it better.
  • Making sure the project is useful to me in some way. This will give me more incentive to actually get it to a working state.

I've only found success with this process once so far, but I'm happy with the results. I have lots of notes written for a number of project ideas to pursue at some point, and also have a mostly finished Alexa skill that provides me some benefit. My hope is to keep working on it until it's fit for consumption by other Alexa-using customers (right now it's hard-coded for just me, but the base of the skill is there and working well).

One last thing. I want to pursue writing a bit more, technically and personally; a journal of sorts. Even if they're only small bits of writing, it's nice to be able to look back and see what it was I was doing at the time, and I'm not super keen on Facebook or Twitter anymore, what with all the privacy-related crap that's been going down.

This was definitely a hodge-podge of stuff and not super organized but just wanted to get something on the books.

Updated: 2018-09-16 15:40:48 -0700

Goals for 2013

Posted: Thu, 03 Jan 2013 by

Almost 4 years ago, around this time I wrote about doing new year's resolutions differently. It's funny to look back that far and read about my good intentions in that single post but not reading anymore about my goals that I mention again. This year I'm going to attempt to identify what I've done wrong in the past and do things differently so that I can feel like I accomplish more in the year and avoid insanity.

Lets have a look at the goals I set 4 years ago and see how I've ended up:

  • Writing more: Technically I did write more (from 0 to some) but certainly far less than what I had intended by saying "more".
  • Continue to improve healthy habits: This is probably the one I've done the best at. Though I was hesitant in the original post I did end up running my first half-marathon in 2009 and have run several races since, including a full marathon in 2011.
  • Accomplish more personal projects: There have been a few minor things that I've done under this high-level goal though the only specific thing that I can think of is writing my own blog platform which I only just accomplished in 2012 (and am using now to share this post).

What exactly was it that was missing from the goals I set back then? First of all they were too vague. Take the writing goal for instance. The goal that I set didn't provide any specific means for measuring its success or failure. Again, technically I met the goal given that I wrote more than nothing but I don't feel that the goal was met. If I had come up with something more specific like "Write at least one blog post a month" it would've been much easier to measure the success or failure.

The second thing I should have provided for the goals was a time frame for accomplishing them. The "once a month" goal above would've have worked well for the writing goal. Really any timeframe other than "by the end of the year" would've been a big help in preventing procrastinating with regards to the goals.

One last thing that I can think of that would've helped is occasionally checking in to see how much progress I was making towards the goals to see if the goals should be adjusted, if they ended up being too unrealistic or weren't specific enough.

Now that I have these things in mind what goals am I going to set for 2013 you ask? While I have some specific goals in mind but I want to give some time to thinking about what those goals are and put together a plan for how I want to accomplish them. So really my first goal for the year is to come up with goals for the year. Sounds kind of silly but if I take the time to plan them out I think I have a much better chance of accomplishing them in 2013. I'm committing to coming up with more specific plans by Sunday evening (Jan. 6). That's not to say I'm going to have the whole year planned but at least have a few specific plans in mind to get started on.

Hopefully by this time next year I'll be able to look back and feel like I've accomplished what I set out to.

Updated: 2013-01-03 09:42:16 -0800

The Cynical Voter

Posted: Tue, 02 Nov 2010 by

They get you through television, radio, mail, and by calling you. For the last few months we've all been bombarded with half (or less) truths from an array of candidates and groups supporting one initiative or another. With every election I find myself becoming more and more cynical. So cynical in fact I've threatened to not vote just out of spite though I know that won't solve anything. Each of the candidates spends more time putting down their opponent(s) then presenting exactly what it is they stand for and why they would make the best next whatever. Not to mention the fact that millions upon millions of dollars are spent to get the word out for the different campaigns. It's gotten to the point (and has been that way for a long time) where regular Joes can't run for an office of their choice simply because they don't have the money.

Some might say that that's what fund raising is for, but I say why should it be necessary to spend so much money when it could be put to much better use. I really think it's time that we overhaul our political system. I'm certainly not holding my breath though.

Tagged: propoganda vote
Updated: 2012-02-25 15:51:26 -0800

The Trouble with Project 365

Posted: Tue, 11 May 2010 by

For those of you that I'm close to you know that I recently picked up a camera and committed to doing Project 365. That is taking and sharing a picture a day for a year. So far the undertaking has been a lot of different things. At times it's been exciting and inspiring and at other times frustrating and desperate.

Unfortunately for the last few weeks (or month even) most of my "efforts" have been pure desperation to get photos for each day. At just over 100 days in this is, from what I understand, I pretty classic place for project-goers to get stuck. I've spent the first few months of this project exploring my neighborhood and around where I work. It's been really great to see these two areas from a different perspective but it's become more and more clear that, as far as my inspiration is concerned, I've almost completely exhausted the possibilities of this limited scope. At least for the time being.

While I've grown in my photography a lot in the last few months I truly believe that my biggest growth is yet to come. I think that if I can really get myself in the habit of visiting some new and different places my desire to take photographs will return. Even visiting some familiar places and trying to get a different perspective on them would be helpful. Of course this is easier said than done given that my weekdays are generally filled with work and running.

Updated: 2012-02-25 15:52:56 -0800

And All of a Sudden I'm an (Amateur) Photographer

Posted: Thu, 31 Dec 2009 by

I've always loved photography. I got some of that love from my father and sister who are both incredible photographers. Until just recently however 100% of what I've done has been simple point and shoot. I've been able to get some great quality pictures but really wanted to take it to the next level.

A couple of months ago Chase Jarvis, a professional photographer, came to Amazon to promote his latest book "The Best Camera is the One You Have With You". He was clearly very passionate about his work and wanted to get everybody else in the room fired up about photography too. That's really when I started to  give photography a bit more consideration. I hatched a plan to save up for a new DSLR (a Nikon D90), signed up for a beginning photography class at the nearby community college (which I start Tuesday) and have started to make photography part of my everyday life.

More recently I started reading Digital Photography School and came across an article about the concept of Project 365. The idea is that you commit to taking and sharing one photograph a day for a year so you can see how you progress with your skill and also to integrate photography into your every day life. Since I'm starting to take the art more seriously I thought I'd give it a try and joined the Project 365! group on Flickr and took my first photo this morning:

Since I'm only just getting into the details of photography I'm excited to see how quickly my skill and technique improve.

Updated: 2012-02-25 19:29:28 -0800

Rejoining The World Of Warcraft

Posted: Fri, 27 Mar 2009 by

I've been playing World of Warcraft off and on since before it's initial release in 2004. I've never been a huge fan of MMORPG's in the past either because they require far too much grinding or they place too much of a focus on the multi-player aspect and essentially ignoring the solo player (because I have such a busy schedule I tend to be more of a solo player in general). When WoW came along I was intrigued by the small barrier to entry, it's simple and effective questing system and it of course had the advantage of the Warcraft history built in. Because of my lack of focus when it comes to games (I'm far too easily distracted by other things) I would generally play for a few months and then take several months off from WoW. My latest hiatus lasted about a year. It took a new expansion to get me back into the game.

I've been playing again now for about 4 months or so and am delighted to say that I'm having a great time and not getting bored nearly as easily as I have in the past. Previously the highest level that I achieved for a character was 44. At that point I would either start a new character of a different class or just quit altogether. My current main character is a level 58 rogue. I'm glad I've really stuck with the game this time as I'm only now starting to discover the higher level content; content which I haven't seen before. Here's why I think WoW is such a great game and why it always keeps me coming back for more....

  • As mentioned before the barrier to entry is minimal. You can easily jump into a new character and figure out how to play it pretty quickly.
  • The interface is customizable. There are some fantastic add ons out there that make the game more fun and efficient to play all because Blizzard decided to make the interface scriptable.
  • It's feasible to solo. Although some classes are better than others for this purpose WoW is accessible for the solo player.
  • The stories and history of Azeroth that ate presented to you throughout the game is nothing short of astounding. There are definitely some truly creative minds at Blizzard.
  • There is a ton of content. The world is just huge. If you get bored questing in one area there are likely several others that will be suited for your character's level.
  • Multi-player specific content is reasonably accessible. The UI makes it easy to find other people to group with for the games instances and the rewards are worth it. Also the 5 man instances can be run through in a few hours so it's not a big time commitment.
  • The new achievements system adds an interesting twist. If after all the main content you start to get bored they have some very interesting and sometimes strange things to do for accomplishment points (and bragging rights of course).
  • Leveling isn't quite as difficult as it used to be. This is another aspect that makes soloing possible.
  • You're not penalized for not playing for a while. When logged out you actually become rested. When your character is rested you gain twice the experience when killing creatures for a while which can make up for some lost time.
  • Though I mainly solo I've started a small guild with a few friends and we run instances together occasionally. That only adds to the fun. Since I finally got a character past 55 I've been playing the new death knight class from the latest release and have also been able to visit Outland.
I'm still discovering new and cool things about the game. It's easy enough to suck you in and deep enough to keep you playing for a long time.

Updated: 2012-02-25 15:15:34 -0800

The Historian

Posted: Fri, 23 Jan 2009 by

Based on a recommendation I got at a party I recently picked up a copy of The Historian at the library. All I really knew about the book going into it was that it was a story about people attempting to ascertain the true origin of Vlad the Impaler (Dracula). I've been really into vampire/zombie books lately so I though it might be a good read.

It turns out the book is more historical fiction than science-fiction. The reader is left on many a precipice of unknowns. As one question is answered many more are left unanswered and you are "forced" to venture through more of the book if you want to get at those answers. I'm about half way through it so far and can honestly say it's a great book. It's a perfect combination of historical fact with a great adventure story on top of it. It's definitely one of my new favorites and I would highly recommend it to anyone.

Updated: 2012-02-25 16:16:26 -0800

Interplay relaunches site, rehires original Fallout dev

Posted: Wed, 24 Sep 2008 by

Say what now? How cool is this?! I worked for both Babbages and Egghead Software during and after high school and played just about all of the games that Interplay published. It seems to have taken quite an effort on their part but hopefully this is just the beginning of the good news for this company. The first project to be an MMORPG based on the Fallout universe is very exciting. It certainly has a ton of potential. Hiring Chris Taylor was a great move also.

Updated: 2012-02-24 11:54:28 -0800

Backfilling Flickr Data in Aperture

Posted: Sun, 21 Sep 2008 by

This is a follow-up post to the Scripting OS X with Ruby post from the other day.

Step 1: Determine Flickr ID mappings

With the knowledge from that post I started to write some code which would help me get my photos' Flickr ids from my old data into my new data. I started by writing some Java code to export the photo name to Flickr id mappings using the Photoshop Elements library I wrote about. Because I had very rarely changed the titles of the photos it was easy to make the mapping from the base file name to Aperture version name (base file name: P1000243.JPG, Aperture version name: P1000243). The code I wrote simply output the expected version name and the Flickr id with a colon as the delimiter between them on each line of a file. Because of the work I had done previously it took about 10 minutes to write, debug and get my simple mapping file together.

Step 2: Backfill metadata from hacky app to Aperture

With the mapping file I was then able to write some Ruby code to go through each line of the file, getting the version name and Flickr ID and then applying that Flickr id to the corresponding photo in Aperture using the following script:

  #!/usr/bin/ruby
  require 'rubygems'
  require 'appscript'
  include Appscript
  aperture = app('Aperture')
  library = aperture.libraries.get[0]
  failed_images = Array.new
  file = File.new( 'flickr_image.export' )
  file.each do |line|
    (version_name, flickr_id) = line.split(/:/)
    flickr_id.chomp
    begin
    image = library.image_versions[version_name]
    image.make(:new => :custom_tag, :with_properties => {
      :name => 'Flickr ID',
      :value => flickr_id
    })
    puts("#{version_name} updated successfully.")
    rescue
      $stderr.puts("Version name: #{version_name} doesn't exist.")
      failed_images.push(version_name)
    end
  end
  images = failed_images.join("\n")
  $stderr.puts("The following images failed:\n#{images}")

If the version name I was after didn't exist in the Aperture library an exception would be thrown. This worked well for about 100 photos or so but I started to get the failed messages for just about every photo after that for some reason. Strangely enough the new meta data was applied successfully to all of the photos in the list regardless.

Step 3: Check my work

With all of the failed messages I saw above it was very important to check my work as the exceptions were unexpected.

  • In Aperture I did a search by looking for any photos in the library which didn't contain the "Flickr ID" meta data.
  • Click on the magnifying glass icon to the right of the top-level Library in the Projects Pain.
  • On the right side of the HUD that pops up click the "+" drop-down and select "Other Metadata".
  • In the entry that appears at the bottom of the HUD select "Flickr ID" from the first drop-down and "is empty" from the second drop-down. If "Flickr ID" isn't an option then you likely don't have any photos with that metadata included.
  • The photos that show up are all of the photos in your library that don't contain the "Flickr ID" data.

Most of what I found wasn't surprising. Almost all of the photos that showed up were ones that I expected to not have a Flickr ID yet because I hadn't uploaded them. There were about 200 or so that I had uploaded, however. All of our wedding photos, which I had uploaded using my hacky app mentioned in the previous post didn't appear to have saved the Flickr mappings when running. In order to back-fill that information I had to go back to some scripting.

Step 4: Backfill from Flickr to Aperture

Because all of the data I needed (again, version name and flickr id) were already contained in Flickr and the number of photos in the Flickr Set and the Album in Aperture were the same I decided to use Ruby to get the data and again add the metadata to the photos in Aperture.

By browsing to the set that contained all of our wedding photos and viewing the source I was able to get all the photos' Flickr IDs involved. Just look for a section near the top of the page that looks like:

  this:global_sets['72157600654403170'] = new Object();
  global_sets['72157600654403170'].id = '72157600654403170';
  global_sets['72157600654403170'].title = 'Alex and Sari's Wedding';
  global_sets['72157600654403170'].description = '';
  global_sets['72157600654403170'].photo_idsA = [721448862,720575657, ... ,722434609];
  global_sets['72157600654403170'].primary_photo_id = [722434609];
  var page_set = global_sets['72157600654403170'];

The line you want is the one that looks like

  global_sets['????'].photo_idsA = ...

The comma-delimited list on that line is all of the Flickr IDs involved.

By writing a Ruby script that would get the name of each of the photos corresponding to the Flickr ID I could then add the meta data to Aperture. I copied the list of IDs from above, replaced all of the commas with newline characters (one ID per line) and wrote the IDs to a file called flickr_ids.

I then wrote a script to read in each line of the file, get data on the Flickr photo and write the photo's name along with the Flickr ID to a file to be read by the first script:

  #!/usr/bin/ruby
  require 'rubygems'
  require 'flickr'
  KEY = 'YOUR KEY HERE'
  flickr = Flickr.new( KEY )
  flickr_ids = File.new('flickr_ids')
  flickr_ids_export = File.new('flickr_ids.export', 'w')
  flickr_ids.each do |flickr_id|
    flickr_id.chomp!
    begin
      photo = Flickr::Photo.new(flickr_id, KEY)
      parts = photo.title.split(/./)
      version_name = parts[0]
      flickr_ids_export.puts("#{version_name}:#{flickr_id}") 
    rescue
      $stderr.puts("Photo with id #{flickr_id} not found.")
    end
  end
  flickr_ids_export.close

After changing the name of the file imported I used the existing script to set the Flickr IDs and I was done. This assumes that the photos in question are public on Flickr.

I realize this is a problem very specific to my custom code and this specific problem but hopefully my experience will show how easy it is to do some pretty great things with Ruby.

Updated: 2012-02-25 16:34:09 -0800

Scripting OS X Software with Ruby

Posted: Fri, 19 Sep 2008 by

Ever since I discovered Flickr a few years ago I've wanted to develop an application to synchronize the data between it and whatever desktop application I was using. At the time I was using Photoshop Elements on Windows and was able to "decode" the data model used in the Access database that stores all of it's data. Using that knowledge I created a library in Java to read the data into Java objects. On top of that I was able to throw together some simple code to upload images and add metadata in Flickr using the Flickrj library. It was inefficient but got the job done... eventually. Since it worked well enough I pretty much abandoned further development in favor of other projects.

Fast forward a year or two and I started to desire moving to the Mac platform and iPhoto or Aperture. I wanted to be able to adapt my existing code to export to one of the new apps and then export from there to Flickr. Unfortunately the Java support on OS X does not necessarily intend interaction with native applications which makes this kind of process difficult. After asking how this process might be accomplished on some Apple development forums I eventually gave up. For the time being I settled for exporting meta data to the images, adding them to Aperture, and painstakingly reorganizing them into sets. Not a fun process. I then added the popular Flickr Export plugin to send my photos to Flickr. Unfortunately Flickr Export is only intended to export (no syncing) and if I update meta data in Aperture it won't be updated in Flickr which is a bug as far as I'm concerned. Because I am the way I am I've always felt uncomfortable with this process. To top it all off the images that I've already stored don't have the Flickr IDs stored in the images so all that information was lost in Aperture (though I still had the mappings stores on my Windows box).

It seems I've found a way to kill two birds with one stone. The first issue I wanted to solve was to get Flickr information into Aperture so Flickr Export wouldn't upload photos that were already there. I knew I could do this pretty easily with AppleScript but as I don't know AppleScript and the syntax, while intended to be more readable is incredibly cryptic, I wanted to avoid it at all costs. Plus I didn't feel like learning a whole new language to write what would essentially be a use-once, throw away script. Ruby to the rescue! There are two Ruby libraries which can interact with OS X applications that I evaluated: Ruby OSA and appscript.

While Ruby OSA has a much nicer Ruby-like syntax and is able to generate API documentation for OS X applications you're unable (as far as I can tell) to access objects in collections by name. More specifically I wanted to be able to get an image from my Aperture library by name. I could write a quick method which would iterate the whole set of images but with about 5000 images in my library it would be terribly inefficient. I eventually settled on the appscript library which can do this and do it efficiently. Armed with this knowledge I'm now able to write code which will take the Flickr IDs associated with my old photo library and add them to the images in Aperture. Additionally using the code for these libraries as an example (or the Objective C version of appscript) I should be able to do similar operations using a combination of native code and JNI calls.I'm really excited about these prospects and hope to apply them to future development to make my Aperture to Flickr workflow more efficient and reliable. I'll post more about this effort as I make progress.

Updated: 2012-02-25 17:20:03 -0800