Skip to content →

diego.org Posts

How to get the main storyboard

Here’s how to get at the main storyboard from inside your view controller.

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:
[[NSBundle mainBundle].infoDictionary objectForKey:@"UIMainStoryboardFile"]
bundle:[NSBundle mainBundle]];

Most of the time you can just use self.storyboard. But if you are in a view controller that was not created by a storyboard, then self.storyboard will be nil.

Comments closed

Unable to determine simulator device to boot.

I’ve gotten this message “Unable to determine simulator device to boot.” a few times when trying to run my app in the iOS Simulator.  Unable to determine simulator device to boot. Each time it took me awhile to remember what it meant.

I’ve been working on updating an app to iOS8 and using Xcode 6.    Occasionally I need to run the current version and I start up Xcode 5.   When trying to run the app in the simulator I see this error.

The reason for the error is because the Xcode 6 simulator is already running and it doesn’t know which one to use.  simulator_in_dock

The solution is simple.  Just quit both simulators and try again run again.

 

 

Comments closed

WWDC 2014 – iOS Developer Wish list

As an iOS developer, here are a few things I’d like to see at WWDC 2014

  • Siri Extensibility – I’d like to see Apple open up Siri to third party apps.  For example if I have RunKeeper on my iPhone, I’d like to be able to tell Siri “Start my run”, “End my run”.
  • Blocks added to older API’s – A lot of older API’s are using delegates instead of completion blocks.  For example: UIAlertView
  • UIActivityViewController enhancements – Every time I’ve used UIActivityViewController, I’ve had to extend it to do what I wanted.  It shouldn’t be that hard to share an email where you can specific the recipient, subject, attachment, body, etc..
  • Inter App Communication – I’d like to see something more like Intents on Android.
  • AppleTV SDK – I’d love to be able to write apps for the AppleTV
  • Filesystem – Mac OS X and iOS are due for a new filesystem. ZFS was rumored for awhile but fell through.
  • Multi User iOS – It would be nice if iOS support multiple users, so a family could share an iPad.
Comments closed

ld: library not found for -lPods

I’ve had this error a few times, so I figured I’d document the solution for the next time it occurred.

When doing a build in Xcode, I got the following error:


ld: library not found for -lPods

My project is setup to use cocoapods.

First make sure you are using MyProject.xcworkspace and not MyProject.xcodeproj

For me this was the case.  But I realized that I just created a new configuration for “Ad Hoc” builds.  To fix the problem I had to install the Podfile again with the command:


pod install

After running pod infall, open the project: MyProject.xcworkspace, clean your project and build.  The error should go away.

Comments closed

Replace battery on Celestron NexStar 4SE Star Pointer ?

I left the switch turn ON on my Celestron NexStar 4SE Star Pointer and the batteries died. It wasn’t obvious where the battery was. I read the manual and found that it took: 3-volt lithium battery (#CR2032)

Afer reading a few reviews, I ordered the Strip of 5 Genuine Sony CR2032. I read a lot of reviews about getting what you pay for with the cheaper ones.

After reading some forums I found where the battery compartment is. Here is a picture showing where it is:
Celestron NexStar 4SE Star Pointer Battery Compartment

I carefully pried the cover off with my fingernails. Under the cover was the battery:
Celestron NexStar 4SE Star Pointer Battery Compartment Open

 

I replaced the battery and put the cover back on.

Comments closed

Bike Lights

For the past nine months, I have been riding my bike to work. It’s a little over 7 miles each way. During the summertime, there is plenty of light in the morning and evening. In October of 2013, when it started getting darker earlier, I had to upgrade my bike lights. I ended up with a Lumina 700 for my headlight and a Serfas Thunderbolt for my taillight. I’ve been very happy with both. I’ve had other bikers, people in cars and people on the road ask me about both of them. They’ve been impressed about how bright they are. Here are some more details.

Lumina 700

NightRider Lumina 700
What I like about the Lumina 700:

  • It has three levels of brightness. It’s plenty bright to light up the dark road on my route where there are no street lights.
  • It has a flash mode with I use for daylight riding. It’s super bright and cars can see me
  • It’s rechargeable via USB. I usually charge at night, but when I forget it’s easy to plugin at work.
  • It’s light weight

You can read all the specs at the Lumina 700 product page. It’s a great light and I highly recommend it. You can buy the Lumina 700 on Amazon for $97. That about $20 cheaper then when I bought it.

Serfas Thunderbolt USB Taillight

serfasThunderbolt

What I like about the Serfas Thunderbolt:

  • It’s the brightest taillight I’ve ever seen. I’ve had several people comment on that.
  • It’s rechargeable via USB. I usually charge at night, but when I forget it’s easy to plugin at work.
  • It mounts on the seat post and is very easy to put on or remove.

You can read all the specs at the THUNDERBOLT (USB) TAIL LIGHT. You can buy the Serfas Thunderbolt on Amazon for $36 – $45 depending on the color.

Comments closed

AddressBookFiller for iOS

AddressBookFiller is a simple application which populates your address book with contacts. It is an updated version of my previous post.

This is useful when developing for the iOS and working on the emulator. On many occasions, I’ve spent quite a bit of time adding contacts to the emulator to test something. Then when I change emulator version, they all get erased. This is very frustrating. So I put together this simple application which allow you to programatically fill up your address book.

Currenly the address book is populated with U.S. Presidents. Values are set for:
* first name
* last name
* photo
* phone number
* birthday
* Address: street, city, state, zip

Source on Github: https://github.com/dougdiego/AddressBookFiller

Comments closed

Node.js on the Raspberry Pi

I needed to install Node.js on the Raspberry Pi and searching the web gave me so many difficult ways to do it. But since node.js now distributed as a binary for the Raspberry Pi, it’s pretty easy.

First, go to http://nodejs.org/dist/latest/ and find the latest Raspberry Pi release. It’s the file ending in: linux-arm-pi.tar.gz

Then on the Raspberry Pi, update the package list

sudo apt-get update

Update packages

sudo apt-get upgrade -y

Create a directory to install node:

sudo mkdir /opt/node

Change directories to a temporary directory.

cd /tmp

Download the latest release you found at http://nodejs.org/dist/latest/

wget http://nodejs.org/dist/latest/node-v0.10.17-linux-arm-pi.tar.gz

Uncompress it:

tar xvzf node-v0.10.17-linux-arm-pi.tar.gz

Copy it to your new directory:

sudo cp -r node-v0.10.17-linux-arm-pi/* /opt/node

Then add it to your environment variables by opening or creating .bash_profile in your home directory. (You nano if you can’t use vi.):

cd
vi .bash_profile

Add the following to your .bash_profile

PATH=$PATH:/opt/node/bin
export PATH

After saving the file, you’re all set!

Comments closed

Raspberry Pi Tip: Change keyboard layout

If you’re in the US like me and you start coding on your Raspberry Pi, you might quickly realize that when typing the pound key # you get the currency symbol: £

This is because the Raspberry Pi defaults to the British Keyboard layout. To change this, as sudo edit the file:

etc/default/keyboard

Change XKBLAYOUT=”gb” to XKBLAYOUT=”us”

# KEYBOARD CONFIGURATION FILE

# Consult the keyboard(5) manual page.

XKBMODEL="pc105"
XKBLAYOUT="us"
XKBVARIANT=""
XKBOPTIONS=""

BACKSPACE="guess"

Then restart your Pi.

Comments closed

Knight Rider with Arduino and AdaFruit NeoPixel

Arduino code to light a AdaFruit NeoPixel with the Kight Rider light sequence. This code was based off the Arduino Knight Rider Tutorial.

Source: https://github.com/dougdiego/KnightRiderNeoPixel

Requirements

  1. An Arduino Board. I’m using an Uno.
  2. AdaFruit NeoPixel
  3. Adafruit NeoPixel library

Instructions

  1. Install Adafruit NeoPixel library
  2. Connect the NeoPixel to ground and power. Power requirements here: AdaFruit NeoPixel
  3. Connect NeoPixel to PIN 6 of the Arduino. Connect NeoPixel ground to the ground of the Arduino.
  4. Upload KnightRiderNeoPixel to the board and run it.

Credit

This code was based off the Arduino Knight Rider Tutorial.

Knight Rider Light sequence on a Arduino with AdaFruit NeoPixel led lights from doug on Vimeo.

Comments closed