-
That Magical Model Window
Jun 21, 2014
I recently ran into the following issue in my Objective-C code. Let’s say you have a model class that has (among other things) an
NSMutableArray
of other model classes. How do you let outside objects modify this collection? One obvious solution is to add your own custom accessors:addObject:
,removeObject:
, and so forth. But that’s a little sad, since it’s essentially a simplified, non-standard duplicate of theNSMutableArray
interface. The other obvious choice is to expose the array directly. But oh boy! If you do any pre- or post-processing on add or delete, there’s a world of pain waiting for you. It’s just not wise to let users mess around with the internals of your model like that. Maybe ifNSMutableArray
had a delegate, we could expose the array and then let the model object (as the delegate) have the final say on any changes, but sadly, to my knowledge, it does not. (NSArrayController
on OSX andCFArray
might have that functionality, but that’s just too much work for too little gain.) Finally, there’s the issue of key-value observation. How do we observe changes to the array? If we simply observe the array property, we’ll only get notifications when it’s set. Do we observe the array’scount
property? (Doesn’t work, and wouldn’t handle replacement even if it did.) Do we add manual KVO calls to our custom accessors? Do we set a property somewhere whenever the array is modified?It turns out there’s a solution to all these problems, and it involves something called key-value coding of collections.
Continue Reading... -
Boat++
Jun 17, 2014
So how’s programming on a cruise ship, anyway?
First of all, you can’t count on the internet out at sea. That’s not to say it’s unusable: I saw speeds as high as 15Mbit/sec down, though they usually hovered around 1Mbit/sec or less. (Ping was atrocious, of course.) However, at almost a dollar per minute during regular hours, it was hard to justify. One deal that my particular cruise offered was half-price internet from 11pm to 5am, giving me a rate of $0.37/minute. (This was actually better than most of the package deals and allowed me pay à la carte.) Having mentally allotted $50 for internet use, this meant that I could only use about 10 minutes per day, or 20 if I went once every 2 days. For the most part, I spent these periods rapidly opening a bunch of tabs to Gmail, Feedbin, and Hacker News, loading any new articles I needed since the last internet checkpoint, disconnecting to write any replies, and reconnecting one final time to send them out. It was basic, but it kept me content. (All logging in and logging out was done through an atrocious web interface, while the charges could be verified through an equally despicable account navigator on the cabin television.)
Continue Reading... -
Gathering the Goods, Part 2
Jun 15, 2014
My first run at a packing list was suprisingly solid: everything worked pretty much as intended and there wasn’t anything I desparately missed or needed during my US trip. However, I misjudged the needs of my travel bag:
- I very rarely used my Silver Streak bag as a backpack, and when I did, it was just too heavy for prolonged use. (The total weight of all my equipment was almost 50 pounds.) As a result, I mostly ended up detatching the backpack and carrying the main bag on a shoulder strap, which was very uncomfortable.
- All my important equipment rarely left my backpack. I hardly ever used the expanded compartment in the main bag for anything other than a few spare parts, souvenirs, and my Wacom tablet.
- I gathered a lot of food ingredients during my travels, and to avoid a mess, I carried them in a separate cloth bag. There was never any need to store perishables in the main bag.
As a result, I have replaced my Silver Streak with an Eagle Creek Switchback 22 (on sale). The Switchback does almost everything the Silver Streak does, but adds one vital feature for city use: wheels! Contrary to most of the advice I found on travel blogs, I desparately wished for wheels many times during my trip. (Maybe this would be different if I were spending long miles walking on unpaved roads, but the fact is that most of my traveling happens in modern cities and not the countryside.) The backpack half of the bag now serves as the store for all my tech equipment, while the main bag keeps all my clothes and accessories. Among other things, this consolidation means that I no longer have to move things from bag to bag when I’m leaving the main bag in a locker or on a bus/train/plane. Space is more tight than in the Silver Streak, but everything still fits. (At the moment, I’ve decided to roll up my jacket and clip it onto the handle, since cramming it in takes a bit too much effort.) The Switchback offers great flexibility in regards to transport: backpack zipped onto the main bag, backpack threaded onto the carrying handle, or backpack and main bag separate. (So far, I’ve found the most convenient option to be zipping the backpack onto the main bag and using the wheels. You can walk many miles like this without a problem.) There are many other details that make the Switchback feel like a high quality product, from the multipurpose outside straps to the secondary handle position all the way down to the stitching. It’s clear that a lot of thought was put into the design. One minor annoynace is that the backpack straps have to be taken off the backpack to be used with the main bag, but since I’m mostly set on using the wheels, this isn’t a big deal for me. Before I settled on the Switchback, I also tried the Osprey Meridian, but I was simply not able cram all my stuff in!
Continue Reading... -
Airbnb Tip Fest 2000
May 31, 2014
I’ve come to the conclusion that if you’re doing the work-travel thing, you always need to have a reliable, quiet place nearby to retreat to. Most hostels just don’t offer that level of privacy, while hotels are too expensive. Coworking spaces would be great, except they cost an extra $10-$30 per day. (Except the gratis Wix Lounge in New York, but there’s no privacy there to speak of.)
Aside from finding rooms to rent or sublet (which can be tricky in a foreign country), the best solution I’ve been able to find so far is Airbnb. (Sign up with my referral link to earn us both credit, I think!) Per day, Airbnb listings tend to be roughly on par with hostels in terms of price; per month, they’re more expensive than the local rental rate, but not astronomically. And for the extra cost, you get your own room (often with a window and desk), one or more locals to chat with, a fantastic communication and creditibility channel, and a neat little paper trail of all the places you’ve been to. Plus, you get to experience life in a foregin city as a local! If you’ve ever been to Europe, tell me you’ve never walked down the twisted cobblestone streets and wondered what life was like in those arborial, patchwork buildings…
Continue Reading... -
Cruises for the Rest of Us
May 29, 2014
Hello! I don’t know what happened. Sorry. I think I fell asleep for half a year. OK, I really need to put up the rest of my photos from my US trip. But before that…
I’m in Barcelona! And instead of flying, I took a ship.
I was originally thinking of crossing the Atlantic on a freighter, but an article by a globetrotting programmer pointed me to a somewhat more comfortable option: cruise ships. Wait, wait — before you think “how posh”, hear me out! As it turns out, during certain times of year, the big cruise lines ferry some of their ships across the Atlantic to prepare for their summer Mediterranean cruises. Since these sailings only go one way and happen during typically non-vacation times of the year, they are often very cheap. What’s more, the article pointed to these cruises as a fantastic way to get programming work done. Sure, internet is a no-go, but if you can get past that, you basically have an idyllic floating office (food service and hot tub included!) for a work week or two. Given my needs, it was a no-brainer.
Continue Reading... -
Late 2013 15" Macbook Pro: Intel Iris Pro 5200 vs. Nvidia 750m (And Other Stories)
Dec 19, 2013
I recently got a high-end 15” Macbook Pro. The 13” model I was using before had served me with faith and dignity over the years, but as my appetite for high-performance apps increased, the poor guy just couldn’t keep up like it used to. In the past, I would have only considered upgrading to another 13” laptop, but a lot has changed over the years. Computers have slimmed down. I’ve slimmed up. A 15” device just didn’t seem like the back-breaking monster it used to be.
The other big factor in my decision was graphics performance. Among all the Macbooks currently available, the high-end 15” Macbook Pro is the only one with a discrete graphics chip still inside. You get access to an integrated Intel Iris Pro 5200 for everyday use, but the OS can also switch you over to a powerful Nvidia 750m when the polygons have to fly.
At first, I naturally assumed that the 750m would kick the 5200’s butt; this was a separate ~40w component, after all. But as I started to dig through forum posts and benchmarks for my research, I discovered that while the Iris Pro usually lagged behind the 750m by 15%-50%, there were a few recorded instances where it matched or even surpassed the Nvidia chip! Some people blamed this on drivers, others on architecture. Were the numbers even accurate? I wanted to find out for myself.
There were a couple of specific questions I was looking to answer during my testing:
- How good is the maximum graphics performance of this machine?
- How does the Iris Pro 5200 compare to the 750m?
- How does Windows 7 VM (Parallels) graphics performance compare to native Windows 7 (Bootcamp)?
-
Seattle: You're Probably Tired of Seattle By Now
Dec 5, 2013
A week into my Seattle visit, I moved from the downtown City Hostel to the confusingly-named Hotel Hotel Hostel in the Fremont neighborhood. (The very same neighborhood I had visited with my friends a few days prior.) The streets were quiet and a little quirky, the nearby water gently lapped at the shoreline, and the smell of chocolate followed you down the street. It felt a little like being on vacation. (Of course, having a fantastic gastropub down the street helped. Did I mention I hate the word “gastropub”? It sounds like somewhere you go to cleanse your body of toxins. But I digress…)
Continue Reading... -
Seattle Scenery
Oct 26, 2013
There are many places you can work while travelling. You can stay at your hostel. You can go to a café. But let it be known that none of them will have the grandeur of the Seattle Public Library.
Continue Reading... -
Seattle: Of Lands and Locals
Oct 14, 2013
I spent a couple of wonderful days in Seattle hanging out with an old friend, a new friend, and a baby.
We met up a few times at my friend’s house for dinner and board games. The place was usually brimming with family and friends (great folks, the lot of them) as well as their children, who ran around and did whatever it is that children do. Looking back, I’ve spent a surprisingly small amount of time around kids ever since I was a kid myself, and it was inspiring to once again experience the kind of unreserved enthusiasm and curiosity that tends to fade as you get older. (One of them even asked if my camera was a Nikon!) I was also happy to see that the next generation of gamers was being raised by people with impeccable taste: Rayman Legends, Duck Tales, Fez.
Continue Reading... -
Seattle From Below: Day One at the Pike Place Market
Sep 4, 2013
It’s hard to say enough good things about Seattle. You have the verdant scenery of the northwest; the familiar brick buildings and cobblestone streets; the twisting coastline of the Sound. There are the plentiful waterfront walks, the numerous indie eateries, the beautiful University of Washington campus, the hills and the hilltop views. The people are nice and it’s not too crowded, even when you head to the more touristy parts of town. Everything seems to be within walking distance — or a short bus ride away, at worst. Beer and coffee are consumed in copious amounts. And all this before the backdrop of the magnificent Mount Reinier, head high in the clouds.
Continue Reading...