Written on 4th September, 2013 in Programming, Apple, iOS 7, and Object-C.

Background Fetch looks like an interesting feature of iOS 7.

For Facebook and other social media apps, background fetching means you’ll see an updated newsfeed the moment you fire it up. And for content apps like The New York Times or Instapaper, background fetching means you won’t have to wait for today’s edition or saved articles to load — the latest content should already be there when you open the app. Apple’s guidelines for iOS7 developers actually demand we avoid splash screens ‘or other startup experience.’

Written on 13th June, 2011 in Programming, and Java.

Tell me, what do the following have in common?

  • Paying with a credit card.
  • Going to the emergency room
  • Adjusting your 401k.
  • Using your insurance card at the dentist.
  • Shopping around for the best car insurance.
  • A BNSF train pulling a Union Pacific coal car.
  • Transferring money between banks.
  • Filling a prescription.

All the above industries are billion dollar players in our economy. All of the above industries write new COBOL and mainframe assembler programs.

Written on 12th May, 2011 in Python, Programming, and Algorithm.

An interesting look at the worst algorithm in the world:

{% highlight python %}

!/usr/bin/env python

import sys

def fib_rec(n): assert n >= 0 if n < 2: return n return fib_rec(n - 2) + fib_rec(n - 1)

if name == “main“: print fib_rec(int(sys.argv[1]))

Which when calculating to forty takes one minute and seven seconds. Verses the improved version:

{% highlight python %}

!/usr/bin/env python

import sys

def bits(n): bits = [] while n > 0: n, bit = divmod(n, 2) bits.append(bit) bits.reverse() return bits

def fib_mat(n): assert n >= 0 a, b, c = 1, 0, 1 for bit in bits(n): a, b, c = aa + bb, ab + bc, bb + cc if bit: a, b, c = b, c, b+c return b

if name == “main“: print fib_mat(int(sys.argv[1]))

Which when calculating to four hundred thousand takes four seconds.

Definitely worth the read.

Written on 11th April, 2011 in Programming, Programers, and Developers.

We can’t estimate the time for any individual task in software development because the nature of the work is creating new knowledge.

The goal of software development is to automate processes. Once a process is automated, it can be run repeatedly, and in most cases, in a predictable time. Source code is like a manufacturing blueprint, the computer is like a manufacturing plant, the inputs (data) are like raw materials, and the outputs (data) are like finished goods. To use another analogy, the reason Starbucks makes drinks so quickly and repeatably is because they invested a lot of time in the design of the process, which was (and is, ongoing) a complex and expensive task. Individual Starbucks franchises don’t have to re-discover this process, they just buy the blueprint. I’ll leave it as an exercise to the reader to infer my opinion of the Costa coffee-making process.

Written on 15th February, 2011 in Programming, C#, and PHP.

<p>The <span class="caps">TIOBE</span> Programming Community index, an indicator of the popularity of programming languages, is showing that C# is starting to over take <span class="caps">PHP</span> for the fifth&nbsp;spot.</p> <blockquote> <p>The rise of C# and Python are continuing in 2011. Both languages scored another old-time high this month and are now busy with overtaking&nbsp;<span class="caps">PHP</span>.</p> </blockquote> <div class="inline illustration"> <a href="http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html" title="TIOBE Programming Community Index for February 2011"> <img src="//media.mylesbraithwaite.com/cache/61/31/613172e0d9cadb57360e5339478617cd.jpg" alt="TIOBE Programming Community Index for February 2011"> </a> </div>

Written on 17th January, 2011 in Programming, NASA, Bugs, and Software.

This is the large issue with writing software that can put people’s lives in danger. The cost of writing “bug free software” is huge but the cost of a human life is even greater. But the likelihood of a failure at 98% vs. 99% is actually worth the risk.

Rumor has it that space shuttle software costs $1,500 per line to develop. When asked about the price tag, Norvig said “I don’t know if it’s optimal. I think they might be better off with buggy software.” At some point it’s certainly not optimal. If it doubles the price of a project to increase your probability of a successful mission from 98% to 99%, it’s not worth it; you’re better off running two missions with a 98% chance of success each.

By the way if you are a computer engineer/scientist/programmer I can’t make a larger suggestion then purchasing a copy of Coders at Work.