Bärlauch

Bärlauch
Bärlauch

Bärlauch (literally “Bear leeks”), also known as ramsons or wild garlic, is a wild relative of chives that is native to Europe (and Asia). Here in Switzerland it appears in the produce section of grocery stores at this time of year. Last night I bought my first bunch and baked it into a quiche along with asparagus and potatoes. Its rich garlicky taste really made the quiche. Today I bought a second bunch and tonight I am making it into a pesto (substituting it for basil). I probably won’t need to add in any extra garlic at all. I love learning about new food items like this! (Hat tip to Birgit, my German teacher, for telling me about bärlauch.)

Bärlauch quiche
Bärlauch quiche

Reducing friction

In my post on changes I wrote:

I want to simplify my online life/presence. I was maintaining (neglecting) two separate blogs while mainly posting to Twitter instead.

7 years ago I started a coding blog using free WordPress hosting. This wasn’t ideal, but was good enough at the time, and the price was right. A year later I started a personal blog that also used free WordPress hosting. (The reason for the separate blog was not wanting to dilute my coding blog with personal content.)

Over time I became increasingly frustrated with WordPress dot com’s ads and my lack of control over what are supposed to be my websites. Having two blogs to manage was just extra hassle. Fast forward 6 years and both my blogs had been neglected for years, and when I did post online it was to Twitter. Posting to my own blog should be as frictionless as tweeting. I had been following the development of Manton Reece’s micro-blogging service, micro.blog for some time, but had not yet signed up. In February with the extra free time of not having an employer and inspired by this great post by Brent Simmons, I decided to finally tackle my blog problem. I wanted to accomplish three things:

  1. Move my blogs from wordpress dot com
  2. Combine my two blogs into a single site
  3. Integrate micro-blogging (status) posts into my blog

I decided that I would stick with WordPress as a platform, just not WordPress dot com as a hosting company. I signed up for 5 years of hosting with BlueWin because the price was right and their WordPress support was good enough for me. I had some trouble with WordPress’ import/export tools and ended up having to do a lot of manual migration, but otherwise it was pretty straightforward to port over all posts from my two blogs and combine them into a single site. As a bonus I made SSL mandatory for the site. I even added support for JSON Feed.

At the same time I signed up for an account with micro.blog. While they offer an option to host your micro blog posts, I wanted to host everything here on my own site (which micro.blog fully supports in both their website and apps). I created a micro category to be used with all status posts, so that I could hide them from the main page of my blog. I did opt for a $2/month cross-posting bot that would intelligently post my blog entries to Twitter. (This post by Chris Reed on Configuring WordPress for Micro.blog was very helpful in getting everything set up.)

What I’m doing is not exactly POSSE because status posts under 280 characters are cross-posted to Twitter as plain tweets and don’t link back here, but that’s fine by me. I don’t care if Twitter has copies of my photos and words as long as I have the originals hosted here on my blog.

I downsized from two blogs to one, and now instead of tweeting, I publish status posts to my blog (which get cross-posted to Twitter). I mostly use micro.blog’s iOS app for status posts, but any WordPress-compatible client would work.

Pixel Art Map Tiles in SpriteKit

I decided to use SKTileMapNode to render the mountain that must be climbed. There will be tiles for stone, sky, ice, snow, flowers, etc.

Map Tiles
Tile Map

As I mentioned in my previous post, Mountain Dash renders 1x pixel art at 2x (which means 4 × 4 or 9 × 9 pixels on screen for each pixel in the original assets). I chose to do tiles at 16 × 16 pixels, so I need each tile to render at 32 × 32 points. It is entirely possible to do this using the Tile Set Editor and Tile Map Editor in Xcode, but I ran into two problems:

  1. Every time you assign an image in the Tile Set Editor, it defaults to the image’s actual size (16 × 16) and must be manually changed to the desired size (32 × 32)
  2. Occasionally Xcode for whatever reason decides to blur the tiles when scaling them up. The only solution with the Tile Set Editor is to remove and then re-add all the images (and manually retype all the sizes yet again).
Blurry Tiles
Blurry Tiles

I already knew that I could fix the blur in code by setting filteringMode = .nearest for each texture, but while the Tile Set Editor lets you define textures, it doesn’t let you set filteringMode.

All of the above was way too much hassle and as it turns out unnecessary. Instead of scaling up my maps and my sprite by 2x, I could use all my assets at their native sizes and just use an SKCameraNode and set cameraNode.scale = 0.5 to scale in 2x. I need to use SKCameraNode anyway to scroll my map (you just change the position of the camera), so this was perfect. Also it’s helpful for debugging to use the camera’s scale to either zoom in (see pixel art details) or zoom out (see more of the map on screen at once). (The above screenshot was taken at 4x or scale = 0.25.) I may even add a pinch-to-zoom gesture to allow the player to do the same. The scale on SKCameraNode was unintuitive at first because it is the inverse of what I expected; I’m used to writing scale = 2 to double a view’s size.

Even with everything at 1x, I’ve still had the Tile Set Editor barf on me once and give me blurry tiles, so I’ve decided to permanently fix this by looping through all the textures in the tile set and setting the filteringMode. I wonder if there’s a better way of handling this…

let tileSet = map.tileSet
for tileGroup in tileSet.tileGroups {
    for tileRule in tileGroup.rules {
        for tileDefinition in tileRule.tileDefinitions {
            for texture in tileDefinition.textures {
                texture.filteringMode = .nearest
            }
        }
    }
}

Pixel Art Sprites in SpriteKit

For Mountain Dash I decided to adopt a pixel art aesthetic, primarily as a way to keep the design of the graphics simple, but this choice has lead to its own challenges. I decided I would use a 16 x 32 pixel sprite but that I would render it at 32 x 64 points. Initially I was exporting my assets at 64 x 128 pixels for @2x and 96 x 192 pixels for @3x, but I figured that this was wasteful and there had to be a better way. So I decided to use only a 16 x 32 pixel image at 1x and scale the sprite to 32 x 64 points.

The following is what I got on my first attempt:

Blurry Sprite

The sprite is blurry because of how it is scaled up. Fortunately, this is a simple 1-liner to fix. All you need to do is set filteringMode on your textures (all of them) to .nearest.

let firstTexture = climberAtlas.textureNamed("climber_still")
firstTexture.filteringMode = .nearest
climber = SKSpriteNode(texture: firstTexture)

…and voilà the sprite is rendered pixel perfect as desired!

Sharp Sprite

Mountain Dash – a game

Mountain Dash App Icon

In January I decided to try and write my first iOS game. Inspired by our new home in Switzerland and the movie North Face, I decided that it would be a mountain climbing game. To keep things as simple as possible, it will be written in Swift using SpriteKit. Graphics will be done in a pixel art style. My son will be helping me with art and game play ideas.

Mountain Dash edelweiss

Why a game? Because I’ve always loved (retro) games, and I want to challenge myself with something new and learn frameworks and tools that I’ve never had occasion to use. Initially I thought I would open source the game (indeed it was a public repo on GitHub until just recently), but I finally decided against that for now. Mostly because even if the game is destined to never earn a penny, it would still suck if someone copied it, cloned it, and submitted it to the App Store before me. Maybe I’ll consider open-sourcing it after the game is finished. Regardless, I hope to write about little development challenges I run into along the way. Indeed I am already behind in writing about the first of those.

I’ve also invited my friend and colleague, Ethan Mateja, to join me in working on the game. I enjoy working with him and I hope that between the two of us we can keep things moving forward and not let the project languish. To be honest I didn’t touch the game during the entire month of February. But it’s March now and I’m pushing forward again.

Changes

In January 2018 I left my job with Ubiquiti Networks where I had been developing video apps for the iOS platform since 2014. Prior to Ubiquiti I had been doing client programming work (as an employee with a couple agencies) since 1999. (Really, changes were already afoot because in August of last year our family moved to Switzerland from the United States). I’ve been using the past 8 weeks to catch up on household tasks, enjoy a break after nearly 20 years of constantly working, take stock, and reflect on what I would like to do next. Oh, and I’ve started making my first game (or at least my first game in almost 20 years).

Some of my reflections

  1. I want to simplify my online life/presence. I was maintaining (neglecting) two separate blogs while mainly posting to Twitter instead.
  2. I really enjoy working from home (which I have been doing since the first time we moved to Switzerland in 2002).
  3. It’s very important for me who I work with, perhaps more so than what I work on.
  4. I would like to make games.
  5. Eventually I will need to earn some money.

In future posts I will enumerate what I have (and haven’t yet) done to act on the above points.

Crypto Tech in Zug

I attended a meetup in Zug tonight on using tokenization and distributed ledger technologies to help attain sustainable development goals.

This was the second meetup in a month on using crypto currency tech to effect positive change in the world. Very interesting stuff.

I love that there is a community here that is engaged in having these discussions. The technology is still in its infancy.

Clarification: I think sh*tcoin mining is the devil’s work, and I think there’s a huge crypto currency bubble waiting to burst.

But remember how it felt in 2008 when the App Store launched? Or in the late 90’s with the web? That’s crypto tech in Switzerland now.

Solo Stove Bonfire Mini-Review


Last weekend I impulse purchased a Solo Stove Bonfire fire pit because it looked awesome and was highly reviewed, we’ve wanted a fire pit or outdoor heater, there was a 10% discount for Earth Day weekend, and the mobile website accepted Apple Pay which made checkout super easy.

It arrived today and I was super eager to test it out. I had already purchased some 2″ paver stones to set it on (to protect our wood deck), firewood, and marshmallows.

What follows is my first impression mini-review after using it for the first time:

  • It lights quickly and easily. I used some straw, a few pieces, of kindling, and then straight to logs. There was no need for lighter fluid or fire starters or extra feeding of paper. I made a small bed of straw, put 6 pieces of kindling and 1 log on top and then lit it. Once the fire was going each additional log ignited quickly.
  • Once it heats up, it does produce less smoke than a normal campfire / fire pit. It takes a good 10-15 minutes to reach this point though.
  • The fire pit needs to be both pre-heated and full of logs in order to get the secondary combustion where pre-heated air flows into through holes around the upper rim to form flame jets that burn the smoke emitted from the main fire.
  • It seems to burn through wood pretty quickly.
  • Once the flames die down, it forms a great bed of embers for roasting marshmallows.
  • It burns the wood almost down to nothing. I had a few golf ball sized chunks of charcoal but mostly fine ash left over.
  • The fire pit cools down quickly. I was surprised how quickly it cools down. Because it burns so efficiently, I think it burns everything it can down to ash and then when there’s nothing left it quickly cools. I imagine the same airflow that allows it to burn so efficiently also contributes to the rapid cooling afterwards.
  • 👍

 

​Secondary combustion: ​Look for the jets of flame periodically forming around the rim


Perfect bed of embers for roasting marshmallows

Thoughts on iPhone 7 Plus

Four months ago I replaced my iPhone 6S with an iPhone SE. I loved the idea of the SE: the best features of the 6S with the form factor of the 5/5S for $250 less. Why did I switch? Well, there are a few things I’ve never liked about the 6-series phones compared to the 5-series:

  1. Slippery rounded sides
  2. Power button opposite the volume buttons. I find it very difficult to press the power button without also pressing volume up (and vice versa).
  3. Redesign of the volume buttons

Specifically with the iPhone 6S (especially after a year with the 6 Plus), I was disappointed with its anemic battery life. Not a deal breaker as I can charge at my desk and in my car, but not great either. I never really got into 3D Touch, so I didn’t miss not having it on the SE. The faster Touch ID on the 6S was actually an annoyance to me with iOS 9 and the difficult to press side-mounted power button.

So I was happy to give the SE a try. I enjoyed the fun pink (rose gold) color. The battery life was much better. Mostly I just appreciated the return to the easy-to-grip 5-series form factor. I’ve been very pleased with the SE.

I’m an iOS developer and I tend to focus on UI, so of course I was going to get a 7-series phone eventually. The questions were: (1) which model, and (2) would it replace my SE as my daily driver.

The dual lens camera system available only in the 7 Plus, pretty much decided both those questions. I waited until the SIM-free unlocked phones were available in the U.S. before placing an order, so I only received my 7 Plus this week.

Impressions So Far

  • The matte black color is gorgeous. I’d love to see this color on watches, iPads, and MacBooks.
  • I enjoy having a 5.5″ screen back after a year away.
  • I 💜 the new home button. It feels great.
  • The rounded sides are still slippery and the power button is still not easy to use
  • 2x camera mode is great. Zooming up to 10x is handy. I love the new zoom interface.
  • This is my first 128 GB phone. I could get used to this! 32 GB is now out of the question for me if I am to use the device for more than just testing.
  • 👍

Why so serious?

This morning at breakfast my wife and I were casually discussing the hypothetical question: “What possession of your partner’s would you like to throw away?”. Typically the answer might be that beat-up recliner left over from college days or an old, ratty (but much beloved) t-shirt. Our 7 year-old son, though interpreted the question differently and asked, “Mommy, wouldn’t you like to get rid of Daddy’s seriousness?”

That really took me aback. What, me serious? Why just last night while my wife was working late in the office, my son and I had a video game and ice-cream party at home. We even made an ice-cream run so that we could have seconds, and we went crazy with the sprinkles and toppings. How could he say I was serious, while my wife was the fun one?

A bit of background: my wife and I both work and we both take our work very seriously. While we may not be workaholics, we probably come close, and at a minimum we are both quite passionate about what we do. If anything, I think my wife is more serious at work than I am. Not that she’s mean or anything, far from it, it’s just that she expects the same competency and diligence from her colleagues that she demands from herself, and has little patience for ineptitude or lack of effort. The main difference I think is that while my wife works in an office, I have been working from home for the past 12 years.

I love working from home, and it would take a lot to convince me to return to an office full-time. I have worked from home for our son’s entire life, so for him that’s how the world works: mommy works in an office, and daddy works at home. But a downside that I hadn’t really considered before today is that this means that our son is exposed to my business side on an almost daily basis. I think many people who don’t work at home, imagine that the biggest challenge to working at home would be to remain focused and continue to work instead of spending all day goofing off. Perhaps that’s the case for most people. For me though, the problem is exactly the opposite: learning to leave work behind and have more life in my work-life balance.

My work-life balance issues have been compounded by the fact that for the past 2.5 years or so, I’ve been working harder than ever. I decided at the beginning of 2012 that I really wanted to get better at being an iOS developer, and began taking extra steps to achieve that goal. That meant that on top of my full-time development job I would write blog posts, work on open-source projects, read technical books and blogs, watch technical videos, work on the occasional consulting project, and work on conference presentations (create the talk, make slides, write sample code, and practice the talk). All of the above has already paid off for me: I feel I’ve improved at a much faster rate over the past 2 years than over the previous decade. It has brought me 2 jobs that have each improved my work satisfaction and additional consulting work which has done the same. But the cost has been many weeks of early mornings, late nights, and weekends spent coding instead of enjoying my family.

One of the things I love most about working from home is the flexibility it brings. Being there (almost) every day when my son arrives home from school is priceless. It’s the perfect time to take a break, head downstairs, get a hug and ask him how his day at school was. But somedays if I happen to be in the middle of a conference call or am deeply focused on a difficult task with a critical deadline looming, I can’t take that break, and if my son comes up to tell or ask me something, he glimpses my serious, focused side, and depending on what’s going on (e.g. conference call with a client) I may hardly be able to acknowledge his presence let alone have the conversation he wishes to have with me.

Why so serious?

This morning was definitely a wakeup call for me. I’m sure I’ll never be able to “throw away my seriousness”, but I can make an effort to not think about work outside of work hours, and to take every opportunity to appreciate and enjoy my wife and our son. After all, if I can’t take advantage of the flexibility that working at home affords me, then what’s the point? Kids grow up so fast that I need to savor every precious moment.

Speaking of which, it’s Memorial Day weekend and our pool has just opened for the season. It’s high time to close my laptop and go have some fun.