This blog entry shows how to use snippets in Xcode to avoid retain cycles when working with asynchronous blocks. We use the weakSelf and strongSelf paradigm that Apple’s engineers recommend as a best practice in Objective-C.

Why weakSelf And strongSelf?

 
Nowadays a great many apps perform asynchronous operations using GCD blocks. For example, if you’ve ever done a fetch over a network you may have used asynchronous AFNetworking callback blocks or Apple’s native session-based asynchronous blocks. Apple recommends using a weak variable to reference self whenever we perform asynchronous operations in order to prevent retain cycles. Okay…but why?

First, some background. Remember that a block captures variables within its scope along with their qualifiers. That means if we reference self inside a block (i.e., a variable that’s intrinsically __strong), the block will hold onto it strongly. Similarly, if we reference a __weak variable in a block, the block will capture the weak variable, uh, weakly. ๐Ÿ™‚

Continue reading »

 

This was recently driving me nuts. I couldn’t get my self-hosted WordPress installation to allow more than an 8MB file upload. My WordPress system is installed on a Mac currently running OS X 10.8 Mountain Lion, using the system administrator’s Web Sharing (which shares documents from /Library/WebServer/Documents).

Eventually I found the solution. You’ll need to be able to sudo to perform these steps (if you don’t know what sudo is, I recommend you don’t try this). Also, AFAIK, this will only work on OS X systems using the built-in PHP and Web Sharing to host WordPress. The solution to allow larger file uploads was:

Continue reading »

Tagged with:  
Tagged with:  

Hopefully this post will be of use to anyone living in the downtown Bellevue, WA area. I got tired of repeatedly looking up the various places to recycle my stuff, so here they are. This is not a comprehensive list, but instead favors places that are free or inexpensive.

AAA/AA/C/D NiCad BATTERIES, UPS/LANTERN/ALARM/WHEELCHAIR BATTERIES, BUTTON CELL (WATCH) BATTERIES
No batteries over 12 pounds. No car batteries. Limit of 6 items per customer per day.
Staples (Bellevue) [MAP]
1645 140th Ave NE
Bellevue, WA 98005
425-373-3335

ALKALINE BATTERIES
Alkaline batteries can be safely thrown in the trash. In case you missed the memo 15 years ago (as I did :)), alkaline batteries haven’t contained mercury since 1997.

CELLS PHONES / MOBILE PHONES, CELL PHONE BATTERIES
Bartell Drugs [MAP]
10116 NE 8th Street
Bellevue, WA 98004
425-454-3111

Continue reading »

Tagged with:  


This article discusses how to clone a failing TiVo hard drive. It doesn’t cover how to upgrade a TiVo drive to a larger drive. It’s meant for people who have a TiVo with a failing hard drive who want to try to save the contents of their TiVo.

(Edit: This known to work for PC computers. According to Colin’s feedback in the comments section, these steps are confirmed to work for Mac Pro computers too — see Colin’s comment for more info.)

Before proceeding, I recommend that you have some basic familiarity with computers, configuring CMOS, and working with the command line before you try these steps. It’s not rocket science, but if you accidentally bork your hard drive, well, it’s not my fault. ๐Ÿ™‚

Furthermore I assume that you’re already familiar with how to remove a TiVo drive and reinstall it, as well as how to install/remove hard drives in your PC, so I don’t cover that in this article. And always remember never boot Windows with TiVo drives attached — be sure you don’t accidentally boot into Windows after you’re finished with Linux.

When Good Drives Go Bad

About three months ago I upgraded my TiVo Premiere XL drive from 1TB to 2TB using a Western Digital WD20EARX drive. Unfortunately, in the past couple of weeks my WD20EARX upgrade drive started to fail the S.M.A.R.T. tests and began experiencing drive errors (e.g., glitches in recorded shows, spontaneous reboots, and other nasty stuff). I needed to clone it to a new drive before it failed altogether, and ideally preserve its contents and recover any errors along the way.

Continue reading »

Tagged with:  

This post will help you set up Streambaby so it works on your Mac running Lion. You’ll see how to share your Mac’s Movies folder so you can easily view your videos on your big screen TV. To access Streambaby on your TiVo you will need a Tivo Premiere, TiVo Series 3, or TiVo HD. The installation and configuration process takes roughly 10 minutes.

First… What is Streambaby? Basically, Streambaby is a free application that works with your current model TiVo to stream video from your computer to your TiVo DVR. It automatically shows up in your TiVo’s menus when Streambaby is running on your Mac.

In other words, having Streambaby is like hosting your own Netflix service, but with all of your own personal videos. ๐Ÿ™‚

Note the purpose of Streambaby is to stream rather than transfer your videos. Streambaby does not transfer video from your computer to your TiVo. (If you want to transfer videos from your computer to your TiVo then you’re looking for a different program called pyTivo.)

One of the things that makes Streambaby great is that you can store many terabytes of video on your Mac. With Streambaby your terabytes of video don’t consume valuable disk space on your TiVo itself, yet you can easily view the video anytime on any TiVo in your home. The video can be in any format supported by Streambaby and its dependent library, FFmpeg.

This post assumes you have basic familiarity with the command line, etc. This is a pretty safe procedure, but the standard disclaimers apply about messing up your computer etc. ๐Ÿ™‚

Continue reading »

Tagged with:  

This article was originally written in October 2008 and posted on my old blog at wordpress.com. I’ve retired that blog, so I’ve reposted the original contents here in the hope someone finds it useful. As of December 2011 the code still works great. Note I’m an iOS developer nowadays, not a Java developer, so regretfully I can’t offer any support nor updates if it doesn’t work for you. Please feel free to read, comment, and link to the article here at its new home.

Background

About a week ago I needed to write a SOAP-based client for work. The SOAP framework I’m using is Apache CXF. I’m a total noob when it comes to SOAP services, and so I was a little apprehensive about this at first. My apprehension sprung from hearing horror stories a few years ago from coworkers who were writing Axis SOAP applications, and they were basically tearing their hair out over Axis.

However, word has it that CXF is much easier to use. Well, it took me a while to get it working correctly. In an effort to save other folks the same grief, I’ve posted my code here. If you’re reading this, I’m assuming you’re acquainted with Java and Maven, but fairly new to SOAP, WSDL, etc.

Continue reading »

Tagged with:  

BMW Angel Eyes

On 11 Aug 2011, in bmw, by Justin

Some German cars come with “bling”. For example, Audis have a rope of LED “Christmas lights” under the headlights. New BMWs these days come with bright pure white halos around the headlights. These provide a unique high-tech look and are often called “angel eyes”.

Angel eyes have changed over the years. BMWs that shipped back in 2005 (the year my car was built) have a much dimmer, yellowish halos as original equipment. Fortunately the aftermarket has stepped up to offer upgrades to our dim, yellow halos.

The first generation of angel eye upgrades were just as dim as BMW’s original equipment at about 1 Watt, but they changed the yellow halos to white.

The latest aftermarket halo upgrades are not only white, but much brighter than the original halo upgrades. They’re still not quite as bright as halos on a new BMW, perhaps, but not too shabby either.

Armed with the above information I went searching for a nice halo upgrade. Here’s what I found.

Continue reading »

Tagged with: