Open-sourcing sneakernet?

So I’ve gotten a couple of e-mails over the past week from people who know about sneakernet and want to see the code. I’m thinking about forking the code and creating an OSS version, but only if enough people are interested and willing to contribute patches.

Sneakernet is a cross-platform filesharing network that uses offline methods for file transfer. You simply visit a website and tell it what files you want, and the network routes files to you from flash drive to flash drive. Eventually, you get an e-mail stating your files are ready, and voila! They decrypt like magic!

Sneakernet takes care of all the routing logic and gets files across a short distance with the minimum amount of work and zero knowledge on the part of the delivery guys. Everything is strongly encrypted.

While I am responsible for some of the code, and have the power to fork and license it, much of it was not written by me. In addition, there are no plans, now or ever, to open the database for any particular sneakernet network. This would strictly be a code fork, enabling you to run your own sneakernet, with the potential to commit patches upstream. To be clear, I have no access to any sneakernet database, nor do I know anyone who does. My responsibility is strictly code.

So if there’s enough interest in an arrangement like this, I can push to get the code released under a friendly license (suggestions?). If there’s not enough interest, I won’t bother.

Phoenix Wright headed to iPhone

So it looks like my wish has come true: Phoenix Wright is finally headed to the iPhone.

I’ve blogged about how lacking the iPhone games market really is, and how this series was a point sample of how Nintendo still owns the market. That ownage may be slipping.

As a prominent iPhone developer, I’d be happy to assist with the port or help test. Unfortunately, I can’t figure out who’s actually behind it…

Hanoi in MIPS (loop is 32 instructions)

##############################
####DREW CRAWFORD#############
####ASSIGNMENT 2##############
####COMPUTER ARCHITECTURE#####
####FEB 2 2010########
##############################
.data
.align 2
A: .asciiz "A\n"
.align 2
B: .asciiz "B\n"
.align 2
C: .asciiz "C\n"
prompt: .asciiz "How many disks?"
.align 2
newline: .asciiz "\n"
.align 2
print:  .asciiz "Move from \n"
.align 2
to: .asciiz " to \n"
.align 2
movet: .asciiz "The total number of moves is: \n"

.text
la $a0,prompt
li $v0,51
syscall
move $t0,$a0

#####t0 - n
#####a1 - "A"
#####a2 - "B"
#####a3 - "C"
la $a1,A
la $a2,B
la $a3,C
jal hanoi
#print totals
la $s1,movet
jal printstr
move $a0,$v1
li $v0,1
syscall
li $v0,10
syscall

li $v1,0

#A hanoi solution in 32 instructions
#(11 print instructions, 1 move count instruction)
#So only 20 algorithmic instructions.
#And only one expensive lw/sw pair per call.
#Beat that.
hanoi:
beq $t0,0,silentreturn
addi $t0,$t0,-1
xor $a2,$a2,$a3
xor $a3,$a2,$a3
xor $a2,$a2,$a3
addi $sp,$sp,-4
sw $ra,0($sp)
jal hanoi
##############non-algoirthmic section
#An implementation detail prevents me from using the printstr syscall on my emulator
#Feel free to replace with the syscall
la $s1, print
jal printstr
move $s1, $a1
jal printstr
la $s1,to
jal printstr
move $s1, $a3
jal printstr
la $a0,newline
la $v0,4
syscall
addi $v1,$v1,1
#############end non-algorithmic section
move $t1,$a3
move $a3,$a1
move $a1,$a2
move $a2,$t1
jal hanoi
xor $a1,$a1,$a3
xor $a3,$a1,$a3
xor $a1,$a1,$a3
lw $ra,0($sp)
addi $sp,$sp,4
addi $t0,$t0,1
silentreturn: jr $ra

printstr: #my hack around a printstr issue on my emulator
ld $s2,($s1)
andi $a0,$s2,255 #select xxxX
li $v0,11
beq $a0,10,ret
syscall
andi $a0,$s2,65280 #select xxXx
srl $a0,$a0,8
beq $a0,10,ret
syscall
andi $a0,$s2,16711680 #select xXxx
srl $a0,$a0,16
beq $a0,10,ret
syscall
andi $a0,$s2,4278190080 #select Xxxx
srl $a0,$a0,24
beq $a0,10,ret
syscall
addi $s1,$s1,4
j printstr
ret: jr $ra

On Closed Systems

> We lose nothing by having closed systems.

For good or for bad, for the past 25 years or so, programmers have effectively been subsidized in that the tools to design and create programs are effectively the same as the tools to *run* programs.

So every system, simply by installing a compiler, is ready to write computer programs.

Early computers didn’t even have that step. They had assemblers and basic in the ROM. It was assumed that you were going to be writing programs; how else were you going to get computers to do what you want?

The iPad/iPhone is the latest and greatest step in that huge gap. A little uneasy, for some of us, perhaps, who grew up with QBASIC on-device-coding and can’t imagine any other way.

But that is sort of a straw-man issue. You have to buy a real computer, so what? There’s a closely-related, but way-more-troubling problem.

App review.

App review is painful. I’ve had two apps axed by Apple not for bugs or for security issues, but because, quite simply, Apple didn’t like them (technically I had 3 such rejections; one was “reversed” on “appeal”).

Think this doesn’t affect you? It does. Google Voice found out the hard way. It was easier for them to rewrite their app in HTML5 then to talk Apple into letting it on the app store. Same goes for Google Navigation, that will never see the light of day.

For every app that you hear about, there are hundreds (I suspect more like thousands) of developers who had an app rejected and quietly went away.

That’s the danger in these new devices. Not that you need a computer to develop for them. Not that the apps are sandboxed and you can’t animate your icons or you require some ridiculous API nobody should ever need.

The problem is that Apple can–and, in fact, does–reject well-behaved applications that it simply doesn’t like. Not just the buggy ones. Not just the malicious ones.

That’s a thought that should chill every developer to the bone.

Apple Predictions

Tablet (obviously).

  • LCD or OLED (not e-ink).  ARM-based.
  • 802.11n and 3G.  You can buy it without a contract, and get it on AT&T’s network later.  One US carrier.
  • Runs existing iPhone applications (I have inside info about this).
  • Tactile feedback API.  While the iPhone keyboard was best-in-class, consumers won’t accept a pure softkeyboard on a tablet-sized device.  A feedback keyboard, though…
  • Shipping in a few weeks
  • Battery life for reading a book will be incredible
  • 128 GB SDD option
  • Runs iPhone OS 4.0, possibly under a different name.
  • Major partnerships with health industry, publishing industry, and news corps.  News will be a “rental” model.
  • Named iPad (sorry…)
  • Prosumer-grade (bose, etc.) “hifi” dock, intended to replace your stereo.  Maybe it’s not demoed, but you know Apple’s partners will have it on launch day.

iPhone OS 3.2

  • Mostly a performance release, a few small features and fixes
  • Immediate availability (days)

iPhone OS 4.0

  • immediate SDK release to all paid developers
  • Unified SDK for tablet and iPhone/iTouch
  • tactile feedback API
  • Huge resolution independence changes
  • Turn-by-turn navigation built in (sorry Google)
  • Easy advertising API for free apps.  Just turn it on and get it paid around 25c per download.
  • Special API designed for low-power consumption mode (reading)
  • Complete ObjC overhaul to prevent you from any visibility into private methods.  This is a major complex rewrite which is required if app review will ever end.
  • No announcements about changes to the app review process (except to say they’re staffing up)
  • Changes to multitouch API to support more complex multihand gestures
  • Available for 3Gs (maybe 3G too, but not anything prior) and latest-generation iTouch
  • Multitasking (maybe they won’t announce this tomorrow for anything except the tablet, but a pre-summer handheld will support it and there will be references to it in OS 4.0)
  • 802.11n sync (really a wishlist item, not sure how possible this is.  Tablet had better support it tho.)

iPhone/iTouch

  • No announcements, new iPhone shipping in early summer.

OSX

  • No announcements, 10.7 developer release for WWDC

bassdll – an Arduino piezo music library

I’m finally getting around to publishing bassdll, a project that (unfortunately) has sat on my shelf for over a year now.

bassdll is an arduino sound/music engine that lets you wire up piezo buzzers across your arduino pins and make multichannel music!

Check out the demo below:

Check out the source on github.

Quick math puzzle

Got this in an e-mail today and I’m ashamed to say it took me a full three minutes to get the trick.  I used to do these all the time as a kid.

Click this link and play the game.  It takes all of 15 seconds.  I’ll wait.

The math behind it is pretty simple:  whatever number you choose, subtracting both digits will give you a multiple of 9.  Why is this true?  Well:

  1. Subtracting the second digit alone will always give you a number that’s divisible by 10.  Subtracting 7 from 27 yields 20, subtracting 6 from 26 yields 20, etc.
  2. Given a number that’s divisible by 10, subtracting the first digit will give you some multiple of 9.  I used this trick throughout gradeschool to memorize the multiplication table (Actually, I used a related statement: the digits of any two-digit 9-multiple add to 9).  With a bit of hoodwinking and some axioms, one can be proved from the other.

The first statement works independently, but it would be a bit obvious if the number you had at the end was always divisible by 10.  So the second trick is employed to make the results feel more random.

Then it’s simply a matter of picking a random gift and listing it for each 9-multiple:

Notice that all the 9-multiples say “refrigerator magnet” in my case.

After mulling this over, I found a more direct statement:  any arbitrary-digit number, after subtracting its digits, is a multiple of 9.

Consider a three-digit number in the decimal system, i.e. a * 100 + b * 10 + c, where a, b, c, are natural numbers.

Then a * 100 + b * 10 + c – a – b – c = 99*a + 9*b.  It should be obvious that 99*a+9*b is divisible by 9.  For math majors:

  1. 99,9,a,b are all natural numbers
  2. Natural addition is closed
  3. 99 and 9 are multiples of 9
  4. Any multiple of 9 can be written as k * 9, for k some natural number
  5. Application of these rules yields 9*k*a + 9*j*b, {k,a,j,b elements of the natural numbers}
  6. Factoring yields 9 * (k*a+j*b).  Since natural addition is closed, this can be rewritten 9 * p for natural number p
  7. By application of #4, this is a multiple of 9.

Bonus points:  prove that all n-digit numbers, less their digits, are a multiple of 9 (for n a natural number).

Extra bonus points:  prove that uncountably long numbers, less their digits, are multiples of 9.

Sakaguchi iPhone project

Remember back when I was lamenting the lack of really solid iPhone titles?  Sure, your innovative block puzzler is kinda cool, but it’s no Final Fantasy or Chrono Trigger.

Well, Sakaguchi (the guy who designed Final Fantasy and Chrono Trigger) is now working on an iPhone project.  Along with some people from Brownie Brown (an offshoot of Square).

I can barely contain myself.

My macbook is a lemon

I’ve been having a crapload of trouble with my Late ‘06 macbook.

So far I’ve had

  • Two logic board replacements (and I need a third)
  • At least two heatpipe / thermal replacements
  • The display panel replaced
  • The battery replaced at least twice
  • The charger replaced

.  This last time the repair depot replaced the logic board, clearly it was a hardware problem, but they decided to wipe my hard disk for some inexplicable reason, and install 10.4 even though it had 10.6 installed.  Which was OK, I had a backup.  But by the time I spent the 4-5 hours doing the Time Machine restore and rebooted it wasn’t starting up anymore.  That’s right, the new logic board died on the second reboot.  Basically, the repair depot gave me a faulty part and wiped my machine.  Thanks for the help.

I’ve gone through three  logic boards (including the one it came with).  If I ship it to the repair depot and they give me fourth logic board, what’s to stop that one from breaking too?

I’m a software developer for a living, and I depend on this machine for my livelihood.  And when it has three major issues in the last 4 months, I can’t depend on it.

Logitech Sucks

I’ve been having a showstopping issue with my Logitech DiNovo Edge Mac Edition.  To put it simply:  it’s impossible to drag-and-drop with the included touchdisc.  Sure, it works for a few seconds, but the drag gets suddenly dropped–without any warning.  I’ve got two keyboards and three macs, and the same issue on all of them.

There’s a thread about this on the support forums where a bunch of people are complaining.  The issue manifests itself with a brand-new, out-of-the-box Mac, so it’s not like it’s difficult to reproduce.  It’s a software issue with Logitech’s LCC software–I might even consider reverse-engineering it and releasing a patch if they don’t fix it.  This is a $150 keyboard, which has consistently garnered 4.5-5 star reviews.  It’s fantastic–except for this showstopping issue.

I’ve contacted Logitech both via online e-mail support and phone support.  The e-mail people gave me a few old software versions to try, and when that didn’t work they said to call phone support (presumably, because they didn’t want what the phone support people were about to tell me in writing).  The phone support people said “there is a conflict” between my software configuration and the keyboard software, totally ignoring the fact that the issue manifests on an out-of-the-box Mac.  That’s a standard one-liner to avoid fixing the actual problem.

In this case, however, I’m a software developer, and I know how to test this stuff.  It’s definitely an LCC bug (probably triggered by OS X 10.5.8, which changed some keyboard drivers around).  Instead of owning up to their mistakes, Logitech prefers to run me around between support departments.

Not cool.  Suffice it to say, that’s the last Logitech keyboard I’ll ever buy.

Return top