Category Archives: Mac OS X

Xcode building to multiple devices

Color me stupid.

I have been working on two projects for some time now – each for a different device. I’ve been alternating project focus and ejecting/attaching those devices back and forth to build to them. I had assumed that Xcode would simply see one device – no, no, no, no. Attach as many devices as you can and in each of the project windows choose the device to build to. Bamo! Easy. Get all that NSLog goodness and speed of build here, change here, build there.

Facepalm.

I wasted so much freaking time…

Apple firings…

I for one am rather pleased that Tim Cook pulled the pin on the firing grenade and tossed Scott Forstall & John Browett and has done some re-organization at Apple Inc. Browett has been horrible and Forstall has been a thorn in many sides. Forstall staying on for a year as advisor to Cook which really means he’s being paid to hang at Apple for a year without being hired by Amazon, Google, Microsoft, etc. Thumb-twiddling for cash.

Now Jony Ive leads design (hardware and software), Craig Federighi takes over iOS as well as OS X, and Bob Mansfield runs Technologies (for two years). This means we should expect software design will get a large boost from Ive’s influence. Streamlined, modern, simple, and fantastic. Things are not anchored tightly to product anymore. I’m not sure if that’s good or bad – it was that way at Apple for many years and seemed to be working until late.

Tim might have waited too long it could be argued. But he has taken decisive action. I applaud him for that.

Gone also will be the design to schedule that has hand-cuffed Apple but delighted the media for so many years. If something isn’t quite finished, it won’t ship. See Maps in iOS 6 and Siri for iPhone 4S. Et al. I think this is a much more responsible approach than to kill your engineers with a headstone end-date looming over their heads. Apple answers to it’s stockholders, it’s people, and it’s users. Not to a media schedule, not to conference expectations (beyond knowledge transfer), not to a competitor’s releases.

Let’s see what happens. I imagine some of Ive’s influence might be the first to find it’s way to the iPhone in way of a Calendar.app update to remove the leather and stitching.

Thank you Steve. Again.

Steve

Today is the one year anniversary of the passing of Steven P. Jobs. Thank you Steve. Again.

It’s hard to believe it’s been a whole year since Steve passed away. It feels like it only happened a few months ago. I still remember being on my iPad with my daughter (she likes me to sit in her room sometimes until she falls asleep at night) and finding the news online. I knew that Steve was very sick and there were rumors of this and that – and a photo that went viral showing Steve looking like he weighed 100 lbs.

But it was something one stayed hopeful about. I guess when he stepped down and was out of the news for the most part, it was easy to think he’d stay the same and somehow beat his illness. And then suddenly he just stopped. The world stopped a bit. And the world cried.

I still have a working Apple ][+ with Monitor ///. It’s what started my entire career really. That and some talent and a lot of dedicated hard work. I grew up with Apple – both maturing at the same time. That’s part of what made Apple and Steve so special to me.

Thank you Steve. Thank you Apple. Who knows what path I may have taken instead of the one you helped light in the dark forest of uncertainty.

Objective-C: UIButtons and Event Propagation / for(;;){

UIBUttons that won’t stop event propagation

Today I needed to add a few UIButtons to an interface I had created as a Storyboard. However I am heavily using touchesBegan, touchesMoved, and touchesEnded. UIButtons swallow touch events like that and won’t allow them pass through into my touches<Condition> code. That was a problem for me. You could subclass a UIButton and use it, but I am rather fond of placing some elements myself into a Storyboard. I found a nice solution online. Before the implementation in your view controller, add this code (I think I found it on StackOverflow somewhere):

#pragma mark PassTouch

@interface UIButton (PassTouch)
@end

@implementation UIButton (PassTouch)
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    [super touchesBegan:touches withEvent:event];
    [self.nextResponder touchesBegan:touches withEvent:event];
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    [super touchesMoved:touches withEvent:event];
    [self.nextResponder touchesMoved:touches withEvent:event];
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    [super touchesEnded:touches withEvent:event];
    //[self.nextResponder touchesEnded:touches withEvent:event];
}
@end
...

This was a lot easier than subclassing a button, etc. The only thing is that all of your UIButtons are now going to pass events along. I commented that one line out in touchesEnded for the button since that bit was interfering with some of my code. Handy stuff that.

A for loop that won’t quit

I wanted to use a while loop for something (just a random number that wouldn’t be a repeat of the previous number). I stumbled upon some documentation that showed something I haven’t seen before. This is a style thing really as there are other ways to achieve the same and commonly needed results.

    int rndValue;
    for(;;){
        rndValue = 0 + arc4random() % ([songsArray count] - 0);
        if(rndValue != currentRandomTrack){
            currentRandomTrack = rndValue;
            break;
        }
    }

Check out that for loop. Until that condition is met to break, that for loop will run until someone kills the battery. Just another way to do it, but I hadn’t seen it before so I thought I’d pass it along. Pretty cool looking with the Snidley Whiplash eyes in there.

That’s all – have a great weekend.

WWDC 12

Happy.
I’m really excited to be attending WWDC this year. The last time I was in San Francisco for anything was for FlashForward I think. I’ve been to a few MacWorld conferences and have enjoyed a SteveNote from just behind the press pool (close).

I feel lucky to have been able to get a ticket since they sold out so quickly. I’m lucky to be on the East coast and also lucky someone at work was talking with someone early in the morning who noticed tickets went on sale before I got my SMS message about it. I definitely would have missed out if not for that.

Pilgrimage.
Jeff LaMarche used to help run a bus pilgrimage to Apple on the Sunday before things kicked off, but it looks like this isn’t happening this year. If anyone has heard of something else please leave a comment. I was thinking of renting a car but it’s a pretty long drive (2 hours?) to arrive someplace where I’d know not where to go or where to park, etc. It would be tough to do during the week and miss out on a lot. Perhaps I’ll just have to pass on it.

Anyway, my Twitter account: @eric_dolecki

Not adding fuel to the Flash fire

Image of tree branches

I’m not going to add any flames or speculation for what the recent choices Adobe has made in regards to mobile Flash, Flex, AIR, or JavaScript/HTML5. There is already plenty of that out there and it’s hard to know what is FUD, what the Adobe FAQ answers truly mean moving forward, or if some people just like taking shots at Flash because they think it sucks. Go read that at your leisure and make of it what you will.

If you’re at all concerned with Flash falling by the wayside, you have a few options that I can think of

 

  • Hope that nothing changes for you and you can keep putting Flash-assisted cash in your bank account. Assume that nothing is changing or that it won’t affect you.
  • Start to learn some JavaScript techniques and general HTML5 approaches to make up for any Flash application drop off. Start branching your toolbox just a little bit in case a client starts harping about HTML5 because it’s in the news more lately.
  • Start jamming on AIR for Android and iOS so you can offer something up to those platforms in a round-about way without committing to hunkering down and learning totally new stuff.
  • Start jamming on Android Java and iOS Objective-C so you can offer up some native goodness to those platforms. Leave the optimization headaches and late-adopter OS-version capabilities to other developers.

I am always in favor of rounding out your capabilities as broadly as you can. Push yourself a bit more. Flash has been a mainstay technology for a great many of us for quite a long time. Some of us got our start and remain profitable (employable) being one-trick Flash ponies. Some of us have branched out and used Flash as a springboard to other languages and platforms.

Things change in this technology field, and you have to be open to that change if you want to stay on top of the game. And remain in high demand. It’s my personal belief that if you haven’t started to branch out yet because you’ve got AS3 nailed and you love it, I’d suggest you start branching now. It will only help you as a developer anyway… when you pick up bits of other languages you’ll improve all around in how you approach coding projects in any language. You’ll start to think more broadly about what you’re doing.

I’ve been tooling with Android and iOS (both natively) for some time now and I can almost pump out apps in the same amount of time that they took in AS3/Flex. So now I can offer native Android, native iOS, Mac OS X, Flex, AS3, and AIR as options. I haven’t done the AIR for mobile yet because I don’t like having some magic sauce do magic things underneath me. I do value the superior portability of platform it can bring though.

Once you branch you’ll see how similar many languages are to one another. Same ideas just different syntax and approaches – so having AS3 under your belt will get you a jump start on other languages.

Branch out… it’s a ton of fun!

iOS: collect and parse local project files

Do you have a bunch of HTML files that are local to your iOS project? Would you like to run through them and parse out keywords for your own search method? While I won’t go into the indexing and searching (separate topic), digging through your own stuff dynamically is actually pretty easy when you put a few pieces together. I give you a method which finds all the HTML pages in your application.

- (void)indexAllHTML
{    
    NSArray *pages = [[NSBundle mainBundle] pathsForResourcesOfType:@".html" inDirectory:nil];
    for(int i=0; i<[pages count]; i++){
        NSString *path = [pages objectAtIndex:i];
        NSString *pageData = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
        NSArray *foo = [path componentsSeparatedByString:@"/"];
        NSString *shortPath = [foo lastObject];
        //Perform your indexing magic here
    }
}

Devastated

Today I feel absolutely sick, like countless others. Today passed one of my absolute heroes. Steve Jobs was the sole reason I got into tech to begin with… my father having lost his new Apple ][+ to me and long nights of coding on my own.

I can’t even properly put into words what this man did for me and for others. I was shocked that the end came so quickly.

After many tears all I can say is thank you. Thank you. Thank you.

Update

I only hope that Apple continues to innovate and produce amazing products moving forward. I think a large part of the allure of working for Apple is centered around the fact that they had a task master in charge of decision making and projects. He was critical of people who didn’t perform well. He pushed people beyond their normal limits to develop great products. They loved and hated him at the same time. They loved for what he made them realize. They hated him during production and development because he didn’t take crap as a solution. He took risks, abandoning technologies in lieu of better solutions.

Apple doesn’t (didn’t) market test like other companies do – he had a knack of knowing himself what he wanted and that almost always turned out for the best. If it past the Steve Jobs smell test, it was good enough to pursue. I don’t think you can replace his mind or his drive currently within the walls of Apple. I hope that his spirit lives on in a strong way at the company I love so much.

Genius only comes around a few times every few centuries. He took a company on the edge of disaster and turned it into the best company in the world. How many companies has he made possible?

I never met the man, but was fortunate enough to have attended a keynote in the front row when the iPod was first released. He made my own career possible. He was an amazing man. Beyond technology. Here’s to the crazy ones.

My son and daughter use our iPhones and iPad regularly – they got it from the beginning and love those devices. They learn, play games, interact with information, etc. Steve made that possible.

I’ll be okay at some point. I’ll be able to breathe. Right now I feel a little lost. I grew up with this man and his company. He impacted me to such a degree that I am taking this emotionally very hard. I feel for his family and for all those who knew him. The world just grew a little dimmer and I don’t know if that point of light could ever be replaced. I feel a bit lost.

Poll: Mac OS X Lion

It hasn’t been long, but I wanted to poll some visitors to see where they have landed mentally in regards to this Mac OS X Lion operating system.

This poll expires at the end of the month since it’s timely.