a glob of nerdishness

May 21, 2008

Resuming incomplete downloads

written by natevw @ 11:52 am

Here’s a quick little tip I had to figure out again today. Sometimes a flaky network or server will cause Safari to think it is done downloading a file before it’s complete. When this happens, Safari will drop the incomplete file out of its temporary download wrapper, leaving you stuck with a partially saved copy that can no longer be resumed. If this happens halfway through a large file, you can use the built-in OS X ‘curl’ command to resume the incomplete download right where it quit, provided the server supports it:

curl -o <incomplete_local_file> -C - <URL>

The trick is the ‘-C’ option with the “-” argument, which tells curl to continue from the offset automatically determined by the local partially-downloaded file.

April 30, 2008

Version Control

written by natevw @ 2:43 pm

There was never any question that I was going to use a version control system for this year’s development work. The question is, which one?

Obviously, CVS is out. I’d rather use plain old RCS. Xcode does have nice Subversion integration, and Apple’s development tools are pretty good at working around its precious .svn litter. However, with a lot of development work happening on my laptop now, the server ball-and-chain is very unappealing. (Not to mention that in lieu of a real backup plan, my server was getting powered down and hidden just about every time we left our rental unattended.) Even some of Subversion’s own developers have bravely and frankly admitted that Subversion is not the future of version control, at least not for developers who have any choice in the matter.

After playing around with a couple of the modern alternatives, I’ve definitely caught the Distributed Version Control bug myself. Other folks have explained DVCS better, and given a number of reasons [pdf] for it. I’m addicted for two simple reasons: it’s light, and it works offline. Making a repository is as burdenless as creating a directory, and I don’t need to be at home for the utilities to work.

The question remains: which utility? I quickly narrowed my choice down to Bazaar and Mercurial, but was then at an impasse. (Git was out from the get-go. There are some brilliant minds behind it, but that’s also a shortcoming. I’ve got better things to do than comprehend the brainchild of hard-core Linux hackers, and they apparently have better things to do than support their mess on the other two major operating systems.)

Mercurial has some cool features which I don’t claim to fully understand, like the Mercurial Queues patch management system. There’s a few things that seem strange (like the CVSesque lack of versioned directories) but in practice things like don’t usually come up. I know of at least one other Mac developer who chose Mercurial over Bazaar. I like Bazaar’s clean command line and its clean website, and how it rarely needs me to fiddle with its configuration files. I’ve joined the #bzr chat on IRC a couple of times, and the folks there are friendly, helpful and focused.

I had told myself originally that I would just use Mercurial, but in the course of playing with them both I ended up accidentally using Bazaar for my original prototype. As I was liking Bazaar anyway, I decided to stick with it for code and have been happily using it for months now. I did start using Mercurial for something else lately, and found myself annoyed at all the manual configuration file tweaking it made me do versus Bazaar, and in the process was reminded how much less polished going to the Mercurial site for documentation feels.

If you’re having trouble choosing between Bazaar and Mercurial, the best advice I have is a coin. You can even bias it before flipping! Overall, they are both excellent choices for a developer who mostly wants to code. To be honest, that’s kind of a shame. It seems like Mercurial has hit a sweet spot for developers who know better than to try reconfiguring their minds for enjoyment of the heroic git, yet do want something they get to wrestle with a little. I’m happy for the Mercurial team, but would hate for what Bazaar represents to lose out.

As a Bazaar fan, I really enjoy its usability and polish, yet I so often see “Mercurial or git” as if they were the two options from Subversion. It feels like I’m the underdog with a Macintosh in the 1990s, hearing someone say that they’re “deciding between Windows or Linux”. I do have confidence that even if Bazaar doesn’t have an “OS X” in its future, it is popular enough that I will be able to migrate should the need arise. The Bazaar and Mercurial teams are on good terms, perhaps they will eventually find a way to pool their mindshare against the lead dog. Until then, it looks to be an interesting race!

April 25, 2008

Debugging Universal applications in Rosetta

written by natevw @ 11:02 am

Apple have a guide on debugging PowerPC binaries on an Intel-based Macintosh. Unfortunately, those instructions do not work if the application is a Universal Binary.

If Xcode’s build settings dialog hadn’t gone from kinda bad to utterly screwy, it might have been easiest just to temporarily edit your application target’s build settings to build just ppc. As an alternative, you can use the following steps to debug the PPC code of a Universal binary on an Intel Mac:

  1. First, make sure your Debug version of your application’s target is set to include the ppc architecture. It may be set to just the “Native Architecture” to speed up normal debug builds.
  2. You will need the OAH_GDB environment variable set. In bash, use: export OAH_GDB=YES.
  3. Instead of running your application directly as Apple’s reference states, use /usr/libexec/oah/translate /<path>/<your_application>.app/Contents/MacOS/<your_application> from the shell in which you set the OAH_GDB flag.
  4. Open another terminal tab and start gdb using gdb --oah.
  5. Instead of attaching to <your_application>, you will need to attach to the “translate” process that’s running your app. GDB may autocomplete the whole thing if you press Tab after typing just “attach “.
  6. Now use gdb’s c command to Continue (or start, in this case) execution. Prepare for extremely slow execution, since your app is running under both Rosetta and the debugger.

Note that only the odd numbered steps, especially steps 3 and 5, differ from Apple’s instructions. Since it’s a Universal Binary, you have to force PPC behaviour by manually starting your application in the Rosetta translator.

Whichever method (compiling ppc-only or running via translate) you like better, you will likely want to load your app’s symbols with the gdb command symbol-file /<path>/<your_application>.app/Contents/MacOS/<your_application>. If you’re like me and generally inept with raw gdb, you may find the tips and links Apple’s Using GDB for Testing article to be a good starting guide for learning your way around gdb. There are some caveats to debugging under Rosetta mentioned in the first Apple guide, especially that you can’t call functions. Of course, I didn’t realize that was even possible, so I guess I’ll have to try that when I’m debugging normally sometime!

April 8, 2008

Starting up, staring up

written by natevw @ 8:05 pm

Today was one of those days where I did a lot of errands, a few little tasks, and some communication, but not much actual programming progress. A little frustrating, but since I’m not in a mood to code anyway I might as well take this new non-monospaced font for a spin. I haven’t really followed up on what’s been happening since I quit my job at the end of last year.

I’ve been a bit hesitant to elaborate online exactly what I’m doing. Now that I realize how much work is actually involved, I feel a bit more comfortable sharing a little more! I said before, “my mission is simple: Create the best software for organising photos geographically.” The mission is still that simple, even if the work is not. While the past few weeks have taken me more into the photo and organizing side of things, the “geographically” part involves pushing my mapping skills way beyond where they were last year.

To me, that’s the most exciting part even though it does involve maths and algorithms and architectures that I really should have learned before I met the real world. (Pun intended?) Even the current progress — too lurid to flaunt in public right now — makes me glad I’m taking the hard road. I’d already come across EveryBlock and noted their similar feelings on cartography, and today one of their co-founders posted an article about creating custom maps. The beginning of the article is a nice confirmation that my work is worthwhile.

Nervous joking about famous last words aside, things are more or less progressing well. Many days can still be a struggle to think clearly, yet I’ve been able to keep course despite many new product ideas and a few new platforms. (The Software Developer’s Kit for the iPhone and cousins being quite high on that latter list!) As far as the startup process goes, I think I am somewhere near the “Crash of Ineptitude”, but Hoping that I am already past that and into the Wriggles of False…Hope. Oh.

So what’s the plan from here? For me, it’s mostly keeping my head in the game and continuing to do the best I can with the time and talents I’ve been given. In less than two months, one good friend is planning on moving out to the area to help part time, too. Hopefully around that time you’ll start seeing more activity on Calf Trail Software’s home page as a result of my work and his, with a light dose of some graphic design provided our artist comes back online.

After that the real work begins, I suppose. It’s likely that that startup diagram is actually fractaline in nature. What are the chances it will be worth it? There’s a lot of potential out there; that makes me eager to get back to work tomorrow.

Up-gradorred!

written by administrator @ 8:34 am

There were about 5,042 critical security flaws patched between the blog software that was installed and the one I upgraded to this morning. Now that I’ve gotten around to it, the cynic in me expects that tomorrow morning a huge big messup will come to light and I’ll have to do it all again. Sigh…

Anyway, while I was mucking about with it, I also tried switching themes. I kind of liked the “Classic” theme that came with this and was tempted to keep it, until I noticed that the “older/newer” page links seemed to be swapped. If I were going to do any sort of troubleshooting on this blog engine, I would just roll my own for practice at this point. Since I have a life, I just tweaked the stylesheet a bit to at least lose the atrocious monospaced font in the main text. This still doesn’t seem to be a great font for setting extended text, but I’ve been trying to ramble less anyway. (Besides, it’s better than before. And if you don’t like this, you should see the *colors* in the new admin pages I write this with.) Someday when I have nothing to do, I will integrate this blog into the main site better. Uh-huh.

So anyway, I’ve got work to do. Later.

March 22, 2008

Federal 1040 helper as Numbers spreadsheet

written by natevw @ 12:41 pm

Below you will find the IRS’s Federal 1040 form in a completely unofficial, completely at your own risk spreadsheet template worksheet for iWork’s Numbers application. As you fill in each line, it updates an estimate that might be similar to what you might owe or be refunded from federal United States taxes. This year, only the main F1040 form is “complete” although there is a very simplified part of Schedule C that hooks in as well.

f1040 spreadsheet screenshot (reduced)

You can download the template and try it out. It is licensed under a Creative Commons Attribution, Share Alike license so feel free to share any corrections or additions.

As I’ve posted before, I quit my job at the end of last year. In preparation, my wife and I were trying to estimate where we might be at financially this year. I love Numbers, so I put this together to help get a more solid estimate of our tax liability. While I was preparing this year, it also helped me see by how much deductions would affect the bottom line. Of course, this is no substitute for the official forms or the advice of a certified accountant. Don’t trust this form, but please do let us know if you find any errors. Either leave a comment for everyone, or if you want to send attachments my email account with yahoo.com is “natevw”.

Speaking of the official forms, another piece of advice: On both of my work computers, Preview.app has two frustrating, er…deficiencies I’ve encountered when filling out the PDF tax forms. First of all, if I use “Save as” to keep my work it instead *clears* my work and I end up with two blank PDFs. I think a hearty EPIC FAIL is in order here. When I try to work around that by printing to a PDF instead, it often crashes halfway through printing and I end up with one blank and one corrupted PDF. So the advice? Do all your official figuring on good old paper printouts and pencil. If you do want it in digital form, copy the values into the spiteful electronic nemesis when you’re all done. Then if (WHEN!) it tries to subvert you, you needn’t waste time recalculating.

March 1, 2008

Everything is Miscellaneous

written by natevw @ 11:50 am

This review of David Weinberger’s Everything is Miscellaneous is categorized under both “Books” and “Reviews”. I think he would be okay with that — he’s not against sorting, just opposed to “the idea that there’s a best way of organizing the world”. That thesis, found on page ten, echoes throughout the book with various applications. When James Tauber mentioned the book, the title alone drew me in. Indeed, the book was an affirmation of many ideas I’d had.

I can’t say I enjoyed the book as much as I’d hoped, though. When it arrived in its bubbly blue cover, I became a bit suspicious. Indeed, this book is written in a fluffy, overly colorful style. Furthermore, the author categorizes certain ideas as “those which it is safe to condescend”, sometimes rightly and sometimes wrongly. Right and wrong themselves are a bit too provincial for Weinberger, and I got the impression he’s still bitter towards any religion on account of one of his forbear’s being waterboarded by a Republican during the Spanish Inquisition. Perhaps that was the case, which would be unfortunate, but that recurring tone distracted this book from its more useful points.

I read the book last fall, and took the notes for this review at that time. This morning I finally got around to listening to Clay Shirky’s Ontology is Overrated presentation, which was delivered more than two years before this book came out. It’s much less sensationalist, more elegant than vitriolic when presenting its worldview, and still manages to cover almost everything that Dr. Weinberger did. If you’d like a general introduction to the benefits of non-hierarchical, decentralized, fuzzy means of classification, I’d recommend Shirky’s presentation before Weinberger’s book.

However, Everything is Miscellaneous did strike me as reasonably well researched and presented some interesting ideas that expanded in some areas beyond what “Ontology is Overrated” covered. As James Tauber said in his post, the book didn’t really change my mind either, but I don’t regret reading it. I’d still like to add it to one of my shelves. But I’m waiting until after it’s available in paperback this April, as that is a more appropriate medium for the writing style.

February 8, 2008

Age algorithm

written by natevw @ 12:00 am

I think I’ve figured out an easy way to keep track of my age through the coming journey. All I need to do is subtract year_born from year_current.

You’re smacking your forehead because they’ve been teaching this in school since way before year_born. Well, the school method of figuring age out involves annoying trifles like “have I had a birthday this year?”. I haven’t practiced answering that question enough to be very good at it; growing up, I just knew how old I was because it was somehow important. Not anymore.

I think my simplification will serve me well in the coming years. Since I don’t usually mentally increment year_current until about February anyway, my method has a good chance of being right without needing any conditional branches.

January 12, 2008

Bookmarking with del.icio.us: Now I’m a believer.

written by natevw @ 6:08 pm

I’m almost embarrassed to admit it, but I just registered at del.icio.us, the socially/taggy bookmarking site. Why it took so long, I don’t know. Years ago I heard about it but wrote it off as some fad. Why would I want all my bookmarks online anyway?

Since then I’ve switched operating systems (which to my mind happened in the distant past!) and switched browsers and gotten my first modern laptop. I’ve also begun to realize what information overload means, but still don’t want to lose recollection of great sites that might have taken a bit of serendipity to notice in all the noise.

I had already given up using the built in browser bookmark folders. (I do use the bookmarks *toolbar* for more frequent destinations.) I’ve got no idea how to categorize something as chaotic as my web surfing in the first place, and any method I pick just gets so messy. The static nature means that things stay in place long past relevancy, and I’m bad at knowing when that time has come. Now that I’m using both a laptop and a desktop they would never be on the right machine anyway. Not to mention the quandary that came about when I started this blog: “Do I have anything worthwhile to say about this link, or must I keep it to myself?”

Del.icio.us seems to tackle all those problems. When I bookmark a link, I’m also sharing it. By nature of their centralization, I can access them from any machine I’m on. (As a friend pointed out, “the cloud” is a great place for bookmarks since you need web access to use them anyway.) Like a blog, there is a timeline element so that recent bookmarks are up top while older ones can fade away. To top it off, the semi-habitual yet often-random nature of web safari trophies is an excellent application for tagging.

I hope to eventually make this blog format less disgusting. When I find the time to take the ugly out, integrate with the rest of the site and organize to suit my personality — someday, someday — I hope to include this new discovery into the mix. Until then, feel free to follow my bookmarks as I settle in to a new groove.

Visual Basic makes you Dim

written by natevw @ 4:54 pm

It’s been a kinda rough week realizing that Cocoa’s power does not lie in it’s learnability. But I’d learn it any day over Visual Basic.

When learning Objective-C and its joined at the waist framework, I can do a couple quick Google searches and find Apple’s official reference, an informative third party introduction, great guides like this and this, and many other quality references and sample code.

But with Visual Basic, any “answer” I find is glossed over in some script kiddie forum, and seemingly missing (or at least unfindable) in any of Microsoft’s manuals. What is this “Set” keyword? I gather it’s deprecated, but knowing would sure make figuring out old code easier…I tried and tried and tried to find a one-stop reference that would teach me the overall language so I could know what I had to work with. [Emphasis on "had to".] Mostly I just came up with basic “how to make an Excel macro” type stuff. I eventually found a wikibook, but even that left me wanting.

Eventually I did find What Set means in Visual Basic, tucked in an article. But even if all the various Cocoa concepts makes me feel like I’m just playing whack-a-mole, at least I know a) what concepts there are, and b) where to get reliable information on each when I need it.

« Previous PageNext Page »