Categories
Uncategorized

Tampa iOS Meetup’s first meeting: Wednesday, October 28th at 7:00 p.m.!

tampa ios meetup

Last Saturday, Angela Don and I gave a well-attended presentation on getting started with iOS development using Swift. It went so well that we decided to make it a regular thing, and thus the Tampa iOS Meetup was born. We’re having our inaugural gathering next Wednesday, October 28th at 7:00 p.m. in South Tampa at 3825 Henderson Blvd., Suite 300, and if you’re interested in getting started with iOS development and Swift, or if you’re an old hand looking for another get-together of like-minded people, come join us!

tampa ios meetup 2

Me and Angela presenting at BarCamp Tampa Bay 2015.

I had the great fortune of meeting Angela at OpenHack Ybor, Tony Winn’s monthly gathering of local developers and techies who enjoy catching up over beer and tech talk in Ybor City, Tampa’s party district (Here’s my recent writeup about OpenHack Ybor). She was talking about doing a presentation at BarCamp Tampa Bay 2015, I told her that I’d been thinking about doing the same, and a couple of days later, we had a full-fledged presentation where we demoed a couple of quick Swift apps and playgrounds.

tampa ios meetup banner

If you’ve got an interest in developing for iOS, whether you’re new to coding or an old hand at it, or if you’re a designer or entrepreneur who wants to make iOS apps, or if you’re just curious, you’re invited to come! We’ll talk about iOS development, go over what you’d like to see in upcoming meetups, and of course, talk about iOS. Bring your projects — we love show and tell! We’ll provide pizza and pop, too.

Once again:

We hope to see you there!

Special thanks to Jamie Johnson, who’s loaning us the boardroom of his company, Energy Sense Finance, to hold these events!

Categories
Uncategorized

Hey test-driven developers: these mods let you take a page from Volkswagen’s book and pass all tests, no matter what!

meanwhile at vw's emissions test center

Inspired by the recent scandal in which Volkswagen programmed the engines in their cars to detect if they were undergoing an emissions test and alter their behavior so that they’d pass, a couple of developers have created modules that enable your test suite to detect if they’re running on a continuous integration server , and if that’s the case, report all tests as passing. Think of all the time you could save!

PHPUnit VW Extension

phpunit-vw logoIf you’ve got a PHP project that absolutely, positively, needs to pass the automated testing phase because you’ll go postal if you have to deal with yet another bug, you want phpunit-vw, also known as PHPUnit VW Extension. Hugues Maignol, a developer based in Grenoble, France, made his initial commits of this project not long ago — September 28th — and it’s now his most popular GitHub repo.

phpunit-vw checks for the commonly-used continuous integration tools’ default environment variables, and ensures that all unit tests pass if it detects the presence of any of these:

If your CI tool isn’t in the list, but makes use of environment variables commonly used by test suites (such as BUILD_ID), phpunitvw might work with it.

volkswagen

transformers g1 bumblebeeIf your project is Node-flavored, you’ll want to get your hands on the Node package named volkswagen. Written by Kenneth Auchenberg and “heavily inspired” by phpunit-vw, it’s also his most popular GitHub repo. It can detect the following CI servers:

…as well as any server that exposes an environment variable like CI or CONTINUOUS_INTEGRATION.

Why should Volkswagen have all the fun? Get these add-ons and start passing tests with flying colors today!

Categories
Uncategorized

In case of fire…

in case of fire

Found on Imgur. Click to see the source.

Categories
Florida Swift Kick

Swift programming tip: How to execute a block of code after a specified delay

burning fuse
swift kick

Sometimes, you want some code to execute after a specified delay. For me, this happens often in user interfaces; there are many cases where I want some notification or other interface element to appear and then disappear after a couple of seconds. I used to use an NSTimer to make it happen, but nowadays, I call on a simple method called delay().

Consider the simple “Magic 8-Ball” app design shown below:

magic 8-ball app

The two functional interface items are the Tap me button and a label that displays a random “yes/no/maybe” answer in response to a button tap. The button should be disabled and the answer should remain onscreen for three seconds, after which the app should revert to its initial state, with the button enabled and the answer label blank.

Here’s the action method that responds to the Touch Up Inside event on the “Tap me” button:

@IBAction func buttonClicked(sender: UIButton) { 
  tapMeButton.enabled = false
  predictionLabel.text = randomAnswer()
  delay(3.0) {
    self.tapMeButton.enabled = true
    self.predictionLabel.text = ""
  }
}

Don’t worry too much about the randomAnswer() method; it simply returns a randomly-selected string from an array of possible answers. The really interesting method is delay(), which takes two parameters:

  • A number of seconds that the system should wait before executing a block of code. In this particular case, we want a 3-second delay.
  • The block of code to be executed after the delay. In our block, we want to blank the label and enable the button.

The block of code that we’re passing to delay() is a closure, which means it will be executed outside the current ViewController object, which in turns means that we’ve got to be explicit when capturing variables in the current scope. We can’t just refer to the button and label as tapMeButton and predictionLabel, but by their fully-qualified names, self.tapMeButton and self.predictionLabel.

Here’s the code for delay():

func delay(delay: Double, closure: ()->()) { 
  dispatch_after(
    dispatch_time(
      DISPATCH_TIME_NOW,
      Int64(delay * Double(NSEC_PER_SEC))
    ),
    dispatch_get_main_queue(),
    closure
  )
}

delay() is just a wrapper for dispatch_after(), one of the functions in Grand Central Dispatch, Apple’s library for running concurrent code on multicore processors on iOS and OS X. dispatch_after() takes three parameters:

  • How long the delay should be before executing the block of code should be,
  • the queue on which the block of code should be run, and
  • the block of code to run.

We could’ve simply used dispatch_after(), but it exposes a lot of complexity that we don’t need to deal with. Matt Neuburg, the author of the O’Reilly book iOS 9 Programming Fundamentals with Swift, found that he was using dispatch_after() so often that he wrote delay() as a wrapper to simplify his code. Which would you rather read — this…

dispatch_after(
  dispatch_time(
    DISPATCH_TIME_NOW,
    Int64(3.0 * Double(NSEC_PER_SEC))
  ),
  dispatch_get_main_queue(),
  {
    self.tapMeButton.enabled = true
    self.predictionLabel.text = ""
  }
)

…or this?

delay(3.0) {
  self.tapMeButton.enabled = true
  self.predictionLabel.text = ""
}

Here’s the code for the example “Magic 8-Ball” app, which I’ve put entirely in the view controller for simplicity’s sake:

//
// ViewController.swift
//

import UIKit


class ViewController: UIViewController {

  @IBOutlet weak var tapMeButton: UIButton!
  @IBOutlet weak var predictionLabel: UILabel!
  
  let predictions = [
    "Yes.",
    "Sure thing.",
    "But of course!",
    "I'd bet on it.",
    "AWWW YISSS!",
    "No.",
    "Nuh-uh.",
    "Absolutely not!",
    "I wouldn't bet on it.",
    "HELL NO.",
    "Maybe.",
    "Possibly...",
    "Ask again later.",
    "I can't be certain.",
    "Reply hazy. Try again later."
  ]
  
  override func viewDidLoad() {
    super.viewDidLoad()
    predictionLabel.text = ""
  }

  override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
  }

  @IBAction func buttonClicked(sender: UIButton) {
    
    // When the "Tap me" button tapped,
    // we want to:
    // 1. Disable the button
    // 2. Display a random magic 8-ball answer
    // 3. Wait 3 seconds, and then:
    //    a) Enable the button
    //    b) Clear the displayed answer
    
    tapMeButton.enabled = false
    predictionLabel.text = randomAnswer()
    delay(3.0) {
      self.tapMeButton.enabled = true
      self.predictionLabel.text = ""
    }
  }
  
  func randomAnswer() -> String {
    return predictions[randomIntUpToButNotIncluding(predictions.count)]
  }
  
}


// MARK: Utility functions

func delay(delay: Double, closure: ()->()) {
  
  // A handy bit of code created by Matt Neuburg, author of a lot of books including
  // iOS Programming Fundamentals with Swift (O'Reilly 2015).
  // See his reply in Stack Overflow for details:
  // http://stackoverflow.com/questions/24034544/dispatch-after-gcd-in-swift/24318861#24318861
  //
  // The secret sauce is Grand Central Dispatch's (GCD) dispatch_after() function.
  // Ray Wenderlich has a good tutorial on GCD at:
  // http://www.raywenderlich.com/79149/grand-central-dispatch-tutorial-swift-part-1
  
  dispatch_after(
    dispatch_time(
      DISPATCH_TIME_NOW,
      Int64(delay * Double(NSEC_PER_SEC))
    ),
    dispatch_get_main_queue(),
    closure
  )
}

func randomIntUpToButNotIncluding(count: Int) -> Int {
  return Int(arc4random_uniform(UInt32(count)))
}

Resources

zip file iconYou can see this code in action by downloading the zipped project files for the demo project, DelayDemo [220K Xcode 7 / Swift 2 project and associated files, zipped].

If you’d like to learn more about coding for concurrency with Grand Central Dispatch, a good starting place is the tutorial on Ray Wenderlich’s site. It’s a two parter; here’s part 1, and here’s part 2.

I found Matt Neuburg’s delay() method in his answer to this Stack Overflow question.

Categories
Uncategorized

BlackBerry CEO John Chen’s awkward demo of the BlackBerry Priv

BlackBerry CEO John Chen’s demo of the Priv to BNN’s Amber Kanwar, their new Android-based QWERTY phone, should’ve been the bright spot in a bad news-filled day (they’d missed their 2Q15 target, for which the bar was already pretty low). Unfortunately, he was unprepared, improvising, and working with a device that hadn’t yet been fully set up and whose OS was unfamiliar to him.

The Android OS that the Priv runs on was so new to him that he had trouble launching Chrome, which meant that he couldn’t do a proper demo of the keyboard’s capacitive-touch scrolling, and the swiping motions he was using had no effect because they were BlackBerry 10 gestures. The most telling thing, however, was his saying that the Priv “runs Google“.

The “priv [rhymes with give] stands for privacy” line was also painful, and it telegraphs Chen’s general unpreparedness for Amber Kanwar’s questions in the rest of the video. I understand that he’s got a lot on his plate, but maybe it’s time for someone else to do these demos, and let Chen focus on his reputed turnaround magic.

blackberry priv

If you take away just one lesson from this video, let it be this: if you’re expected to demo something that’s new to you (like a new product that uses an operating system you normally don’t use), you need to practice, practice, and practice again. If you want to take away an additional lesson, it’s that you should try to anticipate the questions you’ll be asked, and try to have some answers — or be ready to change the topic.

Categories
Uncategorized

Catch our free “Dark Mobile” webinar tomorrow at 1:00 p.m. eastern!

dark mobile

Tomorrow — Tuesday, September 29th — at 1:00 p.m. eastern (10:00 a.m. Pacific), GSG and Enterprise Mobile will host a webinar titled The Secrets Nobody Tells You About Dark Mobile. It’s free to attend, and you can register here.

In this webinar, GSG’s Platform Evangelist Joey deVilla will talk about that area of an organization’s mobile telecom environment that goes, unobserved, unknown, or unmanaged — the terra incognita that we call “Dark Mobile”. We look at the negative effects it has on a company’s…

  • spending,
  • management,
  • security, and
  • efficiency

Join us in this quick webinar (it’ll be about half an hour) as we look at the four kinds of Dark Mobile and how we can shed some light into this crucial area of your IT environment.

this article also appears in the GSG blog

Categories
Uncategorized

VarageSale is looking for a community manager based in Central Florida

varagesale - community manager

My friend Sarah Baird is the COO of the Toronto-based startup VarageSale, an online, local-focused marketplace that competes with Craigslist by focusing on mobile platforms. VarageSale has expanded to cover all of Canada and most states in the U.S., and now they’ve got their eyes on Florida. In order to establish a presence here, they need a community manager, and they’re looking for one based in Central Florida.

varagesale app

VarageSale — that’s short for “Virtual Garage Sale” — is the brainchild of Tami Zuckerman, who came up with the idea out of frustration while trying to clear out her house by selling stuff through Craigslist and similar marketplace sites. She and her husband developed an app that helped her sell her excess stuff with her smartphone, and while they didn’t start out intending to create a business, the idea grew into one.

VarageSale connects people through their Facebook profiles, and uses volunteer moderators to approve new members. You post items for sale and an asking price, and the app lets prospective buyers comment, haggle over price, or say “sold”! The service has grown in popularity, the Canadian tech news site TechVibes named them Canadian Startup of the Year for 2014, and in March, they raised $34 million in venture money from Sequoia Capital and Lightspeed Venture Partners. So to answer a question you might have already asked: yes, it looks like they’ve got a future.

I’ll personally vouch for VarageSale’s Chief Operating Officer, Sarah Baird, as someone who knows how to get things done. I know her through my developer evangelism work in Toronto with Tucows, Microsoft, and Shopify, and through her work at Interactive Ontario (a not-for-profit industry trade organization that encourages the growth of the interactive digital content industry in the province of Ontario), the social game development shop Social Game Universe, and at various industry events in Toronto’s thriving tech scene. She gets stuff done, and my feeling is that so will any company that where she’s COO.

florida - toronto

If you get the job, you’ll be working remotely from Florida and in regular communication with the team at the head office in Toronto, Canada, which you’ll have to visit from time to time (it’s a great city). You’ll be part of the Growth Team and the “face” of VarageSale in the Sunshine State, get people hooked up with VarageSale and building up the community of Floridians who use it to buy and sell things. You’ll be part of their global expansion effort and working closely with their Launch, Marketing, and Happiness Teams to kick off their push in Florida and building and nurturing Florida’s VarageSale communities on an ongoing basis.

Some things about the community manager job (these are distilled from their job posting):

  • You’ll need to be able to communicate your passion and care for the community not just in person, but, more importantly, online.
  • You have to be comfortable being the celebrity in the grocery store and the go-to online resource for all VarageSale communities. This is a job for someone who can get in front of a crowd, “shake hands and kiss babies”, and get them to take action — namely, using VarageSale and getting them to get other people to use it as well.
  • Your job will be to grow VarageSale communities in Florida. This means building bases of users all over the state, finding and cultivating influencers to help get the word out, and organizing and hosting VarageSale events. That means showing up, which in turn means you’ll have to do some traveling.
  • You should be comfortable working remotely in a startup culture, and you should have some marketing and/or community management experience. If you’ve ever had to be the “face” of a product or service, that’s even better. And you’ll need to know how to work a community.

If this sounds like your kind of gig, go to their Florida Community Manager job page and apply now! Tell them Joey sent you.

Links you might find usefulvaragesale icon

This article also appears in The Adventures of Accordion Guy in the 21st Century.