Categories
Hardware Humor

Kirk and Spock travel to 2014; get laughed at for their pitiful mobile devices

kirk and spock in 2014

Click the image to see the full comic on its original page.

Dan Piraro, on his comic strip Bizarro, shows exactly what would happen if the crew of the U.S.S. Enterprise time-traveled to 2014 and people saw their communicators.

Oddly enough, it was Star Trek that inspired Motorola’s Martin Cooper in his work on the first truly mobile phones:

this article also appears in the GSG blog

Categories
Uncategorized

Traveling by air? Make sure your mobile devices are charged!

portland airport security gate

Creative Commons photo by M.O. Stevens. Click to see the source.

Following reports of increased activity by Al-Qaeda and affiliated terrorist groups, the Transportation Security Administration (TSA) is requiring security personnel at undisclosed airports in Europe, the Middle East, and Africa to not allow uncharged portable electronics aboard flights. Passengers boarding U.S.-bound aircraft will be required to switch on devices such as laptops, phones, and tablets in order to prove that they are what they appear to be and not disguised explosive devices.

Our recommendation to those of you traveling by air — even you’re flying only within the US — is to make sure that any portable electronics you bring with you are ready to operate at a moment’s notice when you take them through the security check. This means…

"Charge your devices before you fly!": Photo of iPhones charging

Charging your devices before you go to the airport. Ideally, you should do this overnight before leaving. Even plugging a completely drained smartphone or tablet for a half hour should be sufficient for the airport check; we’ve observed that most modern smartphones can be brought up to 50% charge in about an hour.

"Airplane mode doesn't really speed up charging time": Screen shot of iPhone's settings page with Airplane Mode on.

In spite of what some popular reports say, putting your phone or tablet in “Airplane Mode” won’t speed up the charging time very much. You may have seen articles that tell you that devices in Airplane Mode (which turns off their cellular and wifi radio units) charge twice as quickly, but test have shown that the speed boost you get is closer to 2%. You might as well keep your device out of Airplane Mode and not miss any important emails or calls.

"Charge on the way to the airport": Photo of USB cigarette lighter power adapter

Get a USB cigarette lighter power adapter. If you’re driving (or being driven) to the airport and haven’t yet had a chance to charge your mobile device, take advantage of the in-car cigarette lighter (nowadays called the “power socket”) and use it to charge your phone or tablet. These USB chargers are cheap and available just about everywhere — even in gas stations and convenience stores. They’ve saved me a lot of trouble more than once.

"Power mobile users should consider external battery packs": Photo of RAVPower external battery pack

If you’re a heavy mobile user, you should consider getting an external battery pack. It’ll ensure that your device can get through airport security as well as a day of long conversations or heavy mobile computing. This recent Cnet article covers the highest-capacity battery packs available, including the beast pictured above: the RAVPower Element, which gives you 10,400 mAH (milliamp-Hours) of power — “enough juice to charge an iPhone from empty more than five times”. For a mere $30 at Amazon, that’s a lot of bang for the buck.

Keep your devices charged, and have a safe trip!

this article also appears in the GSG blog

Categories
Uncategorized

I’ll be the subject matter expert at this Pomeroy/InformationWeek/GSG webinar this Wednesday: “Uncovering the True Cost of Your Mobile Telecommunications”

pomeroy informationweek gsg webinarThis Wednesday at 1:00 p.m. EDT, we’ll be taking part in a webinar that our partner Pomeroy will be co-sponsoring with InformationWeek titled Uncovering the True Cost of Your Mobile Telecommunications, where we’ll talk about the cost of enterprise telecom and what you can do about it.

Here’s the abstract for the webinar:

The proliferation of mobile platforms and devices in the workplace has resulted in a dizzying array of carrier plans for organizations to track and manage. Telecom expense management tools intended to simplify administration have frustrated managers due to the time, resources and manual processes required. Expense management has become more difficult, and costs harder to control – an unsustainable situation given these costs are now the largest, fastest growing item in the IT budget.

Marty EzzoThe webinar will be hosted by Martin “Marty” Ezzo, Pomeroy’s Practice Director for Enterprise Mobility. Marty has more than 25 years of industry experience developing, communicating and executing corporate strategic vision. His wealth of experience in the Information Technology arena includes leading high-powered teams in the development, implementation and operation of large complex solutions in the area of IT Service Management, specializing in End-user Services, Systems Management, Data Center Operations, Enterprise Mobility and IT Outsourcing.

Joey deVillaGSG will provide additional subject matter expertise to the webinar in the form of Joey deVilla, GSG’s Platform Evangelist. He’ll provide additional information throughout the session, including industry analyst reports, a “state of the union” report on mobile technology in the workplace, GSG’s approach to managing mobile telecom expenses, and case studies of organizations who’ve used GSG’s telecom expense management solutions with great success.

The webinar is free to attend, and will take place this Wednesday, June 25th at 1:00 p.m. Eastern (10:00 a.m. Pacific, GMT-4). You do have to register to attend, and you can do so on InformationWeek’s webinar registration site.

this article also appears in the GSG blog

Categories
Uncategorized

The benefits of putting “World of Warcraft” on your resume (and a funny reminder of WoW’s dangers)

stephen gillett

You might not think it’s a wise idea to list your World of Warcraft achievements on your resume, but it seems to have paid off for Stephen Gillett, who says it’s helped him land jobs at Corbis, theh his CIO job at Starbucks, and now the COO position at Symantec. In case you were wondering, he’s a level 70 paladin and priest with a focus on healing.

Here’s what the recent CNNMoney profile on him has to say:

Gillett said he includes his World of Warcraft achievements on his resume, because it’s not just about role-playing games. It shows he exercises leadership in both the physical and virtual realms. Plus, he understands the current societal fascination with earning points and interactive entertainment.

As a guild master, his current duties and responsibilities include organizing dungeon raids and managing the group’s virtual bank. And he has a knack for recruiting key talent. Think mages and warlocks.

Those skills transferred to his position as Starbucks’ CIO, Gillett says. In that role, he was tasked with saving the company’s suffering technology assets. Cash registers were outdated. Computers were scarce. Customer sales were down.

Gillett’s answer: Take Starbucks executives on a field trip to the Irvine, Calif., headquarters of World of Warcraft maker Activision Blizzard (ATVITech30). The goal was to expose them to a business model that capitalizes on gaming.

I’m glad to see that all that time invested in WoW (I’m judging based on his level 70 status) paid off. It doesn’t always work out that way:

Categories
Swift Kick

Swift roundup: Interesting sample code and tutorials I’ve found this week

swift roundup

swift kickAs useful as Apple’s The Swift Programming Language book is, it’s focused solely on the language and has nothing at all about the other 90% of iOS development: the various Cocoa Touch APIs and libraries. Luckily, it’s not that hard for a developer with some iOS/Objective-C coding experience to figure out how to call on them in Swift, and a number of them are sharing their knowledge and findings. Here are some of the more interesting Swift finds that I’ve stumbled across online this week.

Tutorial: Conway’s “Game of Life”

life in swift

If you’re looking for a tutorial that walks you through the process of building a reasonably complete iOS app, MakeGamesWith.Us’s tutorial is for you! You’ll build Conway’s Game of Life using SpriteKit, and get a better understanding of how to call various Cocoa Touch APIs in Swift.

Brian Advent’s video tutorials

If you’ve gone through Apple’s The Swift Programming Language book and are feeling confident about the language itself but less so about calling the various iOS APIs, you’ll find Brian Advent’s video tutorials helpful.

Simple UI in Swift

Want to get started writing full iOS apps in Swift rather than just coding up language-features-only stuff from the book? Start here.

Swift and UIKit

This goes over Swift and some of the UI features we’ve come to know and love — text fields, alert views, and table views — as well as using Swift delegates and closures.

Blurring with UIVisualEffect and Preview in Interface Builder

UIVisualEffect is a new class in iOS 8; this tutorial shows you how to use it to get a blur visual effect. This video also shows you how to use the Preview feature in IB.

iOS 8 notification

iOS 8 lets you add custom actions to your notifications, whether on the lock screen, the Home screen, or the Notification Center. This tutorial shows you how to code them.

Swift projects on Github

Swift-2048

swift - 2048

Austin Zheng posted iOS-2048, his rendition of the game 2048 in Objective-C a few months back, and he’s since made a Swift version, Swift-2048. It’s not complete, but the basic game works, and it should give you a good starting point for your own non-SpriteKit game projects.

Swift Weather

swiftweather

Swift Weather uses not just an Apple API — Core Location —  but also the third-party AFNetworking framework by way of CocoaPods. Be sure to follow the “How to Build” section of the readme.

Want to see more Swift content?

Click here or on the “Swift Kick” logo near the top of this article to see all the Swift-related articles on Global Nerdy.

Categories
Uncategorized

Hey, Google fans: Want to annoy the Apple fanboys?

Since Global Nerdy’s been so Apple-heavy as of late, I thought I’d offer this to those of you who are heavy into the Google love. I do try to be multi-platform, after all…

meanwhile over at apple

Click the graphic to see the Apple-fan-baiting at full size.

Categories
Swift Kick

Game of Phones, part 1 (or: Arrays in the Swift programming language) [Updated]

Update, July 24, 2014: I’ve updated this article to match the updates made to Swift with the release of Xcode beta 4. Gotta love languages in beta!

ios 8 is coming

swift kick

Welcome to another installment of Swift Kick, the series of articles on Global Nerdy covering programming in Apple’s new Swift programming language. Fell free to follow along and fire up your Xcode 6 beta, copy the examples, and experiment on your own! You can find earlier articles in this series by clicking on the Swift Kick logo to the right.

Spoiler alert! This article uses the events from the TV series Game of Thrones as a framework. You don’t need to have watched the series to understand this article, but it will reveal some plot points from the first three seasons.

Game of Thrones is popular among the sort of people who like programming, and given that the show often adds and (very brutally) deletes characters, I thought it would be a fun basis for an article on arrays in Swift.

Here are the Starks, the first family that we’re introduced to in the series:

starks

In this article, we’re going to be working with an array representing the Stark Family. As you might expect, it’s called starkFamily, and here’s its visual representation:

The Stark Family
Parents Children
0
Ned
(Dead)
1
Catelyn
(Dead)
2
Robb
(Dead)
3
Jon
(Alive)
4
Sansa
(Alive)
5
Arya
(Alive)
6
Bran
(Alive)
7
Rickon
(Alive)
Ned Catelyn Robb Jon Sansa Arya Bran Rickon

Here’s code to define the array and then display its contents:

var starkFamily = ["Ned", "Catelyn", "Robb", "Jon", "Sansa", "Arya", "Bran", "Rickon"]
println(starkFamily)

Here’s the output of that code:

[Ned, Catelyn, Robb, Jon, Sansa, Arya, Bran, Rickon]

While most statements in Swift end at the end of a line, there are certain exceptions. One such exception is made for array literals, which you can write over several lines as shown below. I prefer defining longer arrays this way, as I find them easier to read:

var starkFamily = ["Ned",
                   "Catelyn",
                   "Robb",
                   "Jon",
                   "Sansa",
                   "Arya",
                   "Bran",
                   "Rickon"]

If you’ve programmed in Python or Ruby, you’re familiar with this sort of thing, where the interpreter (or in Swift’s case, the compiler) “knows” that arrays and dictionaries can extend beyond a single line.

Getting individual array elements

stark family array notation

If you’re familiar with programming languages like C#, Java, JavaScript, Lua, Objective-C (more modern versions, anyway), PHP, Python and Ruby, you’ll find Swift’s basic array notation familiar — it’s good ol’ reliable arrayName[index], where arrayName is the name of the array, and index is an integer specifying which element of the array we want to retrieve. As with most programming languages, the first element of an array with n elements is at index 0, the second is at index 1, the third is at index 2, and so on up until the last element, which is at index n-1.

In the code snippet below, we want to access the 3rd and 6th elements of the starkFamily array. Put another way, we want the starkFamily elements at indices 2 and 5:

println("The Stark family member at index 2 is \(starkFamily[2]).")
println("The Stark family member at index 5 is \(starkFamily[5]).")

Here’s the output of that code:

The Stark family member at index 2 is Robb.
The Stark family member at index 5 is Arya.

Setting individual array elements

The same array notation can be used to set array elements. In the code below, we want to change the contents of the element at index 0 from “Ned”, which is a nickname, to his proper name, “Eddard”:

starkFamily[0] = "Eddard"
println(starkFamily)

Here’s the output:

[Eddard, Catelyn, Robb, Jon, Sansa, Arya, Bran, Rickon]

Is the array empty, and if not, how many elements are in the array?

empty fuel gauge

Swift’s Array type has two handy methods that answer these questions:

  • The isEmpty method returns true if the array has no elements, false otherwise
  • The count method returns the number of elements in the array. If the array is empty (that is, if isEmpty returns true), then count returns 0.

For the code snippet below:

println("The statement that starkFamily is empty is \(starkFamily.isEmpty).")
println("There are \(starkFamily.count) members in the Stark Family.")

the resulting output is:

The statement that starkFamily is empty is false.
There are 8 members in the Stark Family.

Getting ranges of array elements

Swift lets you get sub-arrays of an array by specifying a range of elements. This is one of those things that’s easier to show first, then tell afterwards, so I’ll let this picture do the talking first:

selecting sub-arrays using ranges

  • starkFamily[0..<3] (with 2 dots and a <, also known as the half-open range operator) specifies an array made of the elements of starkFamily starting at index 0, and up to but NOT including the element at index 3. If you’re mathematically inclined, you can think of 2 dots as defining a left-closed, right-open interval, which you write as [0, 3).
  • starkFamily[0...3] (with 3 dots, also known as the closed range operator) specifies an array made of the elements of starkFamily starting at index 0, and up to and including the element at index 3. If you’re mathematically inclined, you can think of 3 dots as defining a closed interval, which you’d write as [0, 3].

Here some code showing array ranges in action. Let’s say we want to pull a couple of arrays out of starkFamily:

  1. An array consisting of only the parents (elements 0 and 1).
  2. An array consisting of only the children (elements 2 and beyond).
println("The parents in the Stark Family are \(starkFamily[0...1]).")
println("The children in the Stark Family are \(starkFamily[2...7]).")

Here’s the output:

The parents in the Stark Family are [Eddard, Catelyn].
The children in the Stark Family are [Robb, Jon, Sansa, Arya, Bran, Rickon].

The half-open range operator is useful for when you want to retrieve a range of array elements starting at some given index, and going on for the rest of the array. You use it in conjunction with the count property, like so:

println("The children in the Stark Family are \(starkFamily[2..<starkFamily.count]).")

Remember, in an array of n elements, the index of the last item is n – 1. Of course, you can always get an equivalent result with a 3-dot range…

println("The children in the Stark Family are \(starkFamily[2...starkFamily.count - 1]).")

…but in my opinion, that makes things more complicated than they need to be.

Adding elements to an array

Adding to the end of an array, part 1: The append method

hodor

Let’s add some elements to the end of the array.

While Hodor doesn’t provide much in the way of conversation — the only thing he can say is his own name — he’s practically part of the Stark family. Let’s add him to the end of the starkFamily array with the append method. Here’s a representation of what that would look like:

add hodor

Here’s the code:

println("Once again, the Stark Family:\n\(starkFamily)")
println("Let's add Hodor!")
starkFamily.append("Hodor")
println(starkFamily)

and here’s the output:

Once again, the Stark Family:
[Eddard, Catelyn, Robb, Jon, Sansa, Arya, Bran, Rickon]
Let's add Hodor!
[Eddard, Catelyn, Robb, Jon, Sansa, Arya, Bran, Rickon, Hodor]

Adding to the end of an array, part 2: Adding single elements with the += operator

osha

Later in the series, Osha the wildling is taken prisoner and agrees to work for the Starks as a nanny, so she too is practically part of the family. Let’s add her to the starkFamily array, but using the += operator instead. Here’s the visualization of that operation:

add osha

Here’s the code:

println("Once again, the Stark Family:\n\(starkFamily)")
println("We'll add Osha:")
starkFamily += "Osha"
println(starkFamily)

And here’s the output:

Once again, the Stark Family:
[Eddard, Catelyn, Robb, Jon, Sansa, Arya, Bran, Rickon, Hodor]
We'll add Osha:
[Eddard, Catelyn, Robb, Jon, Sansa, Arya, Bran, Rickon, Hodor, Osha]

Adding to the end of an array, part 3: Adding arrays with the += operator

stark direwolves

In the very first episode of Game of Thrones, the Starks come across a dead direwolf and several surviving pups. Each of the pups — eventually named Grey Wind, Lady, Numeria, Summer, Shaggydog, and Ghost — is taken by the Stark children as a pet, making them practically part of the family. Let’s put the direwolves’ names into an array, and then add that array to starkFamily. Here’s the visualization:

add direwolves

The corresponding code:

var starkPets = ["Grey Wind", "Lady", "Nymeria", "Summer", "Shaggydog", "Ghost"]
println("The Stark pets: \(starkPets)")
starkFamily += starkPets
println("The Stark family, with pets: \(starkFamily)")

And the output:

The Stark pets: [Grey Wind, Lady, Nymeria, Summer, Shaggydog, Ghost]
The Stark family, with pets: [Eddard, Catelyn, Robb, Jon, Sansa, Arya, Bran, Rickon, Hodor, Osha, Grey Wind, Lady, Nymeria, Summer, Shaggydog, Ghost]

Inserting new elements at a specified position

theon

What if we want to add elements to the array, but somewhere other than the end?

After his father’s failed rebellion against the Starks, Theon became a hostage and ward of the Stark family, who raised him as one of their own. Let’s add him to the family, between the two elder brothers, Robb and Jon, using the insert method:

add theon

var starkFamily = ["Ned",
                   "Catelyn",
                   "Robb",
                   "Jon",
                   "Sansa",
                   "Arya",
                   "Bran",
                   "Rickon"]
println("Let's add Theon, between Robb (index 2) and Jon (index 3)")
starkFamily.insert("Theon", atIndex: 3)
println(starkFamily)

The output:

Let's add Theon, between Robb (index 2) and Jon (index 3)
[Eddard, Catelyn, Robb, Theon, Jon, Sansa, Arya, Bran, Rickon, Hodor]

Want to add an element at the beginning of an array? Just use the insert method to insert the new element at index 0.

Deleting elements from an array

Deleting elements from a specified position

The advice given to people new to Game of Thrones is to not get too attached to a character, because anyone — even a lead character — could die. This happened in season 1 when Ned was falsely accused and found guilty of treason:

beheading

…and then Catelyn and Robb (and a good chunk of the army of the North) were killed at the “Red Wedding”, which got this sort of reaction from viewers:

Let’s reflect these deaths by deleting them from the starkFamily array. Here’s the visualization:

killing off characters

Here’s the code:

println(starkFamily)
starkFamily = ["Ned",
               "Catelyn",
               "Robb",
               "Jon",
               "Sansa",
               "Arya",
               "Bran",
               "Rickon"]
println("The Stark Family before: \(starkFamily)")
starkFamily.removeAtIndex(2)
starkFamily.removeAtIndex(1)
starkFamily.removeAtIndex(0)
println("The Stark Family after: \(starkFamily)")

And here’s the output:

The Stark Family before: [Ned, Catelyn, Robb, Jon, Sansa, Arya, Bran, Rickon]
The Stark Family after: [Jon, Sansa, Arya, Bran, Rickon]

There’s a reason I removed element 2, then element 1, then element 0 rather than starting with element 0 and worked my way up. I’m going to leave it to you to figure why I did it that way.

Deleting the last element of an array

Suppose we want to get rid of the last element in starkFamily. One way to do it is to use the count property of the array to get the array’s size, then subtract 1 from it to get the last index of the array. Then, you’d use the removeAtIndex method to remove that element. It’s done in a single line of code:

starkFamily.removeAtIndex(starkFamily.count - 1)

While it’s simple, there’s an even simpler way that doesn’t require you to calculate the last index of the array. It’s the removeLast method, and it removes the last element of the array. Here’s the visualization:

removelast

Here’s the code:

starkFamily = ["Ned",
  "Catelyn",
  "Robb",
  "Jon",
  "Sansa",
  "Arya",
  "Bran",
  "Rickon"]
println("The Stark Family before: \(starkFamily)")
starkFamily.removeLast()
println("The Stark Family after: \(starkFamily)")

The output:

The Stark Family before: [Ned, Catelyn, Robb, Jon, Sansa, Arya, Bran, Rickon]
The Stark Family after: [Ned, Catelyn, Robb, Jon, Sansa, Arya, Bran]

Replacing ranges of array elements

Replacing a range of array elements with an array of equal size

don and betty draper
Let’s cross over to another popular show that airs on Sunday nights: Mad Men. As ill-advised as many of the choices made by the heads of the Stark family were, chances are those choices might by much worse if they were made by Don and Betty Draper. Still, people who make good choices don’t make good drama, so let’s go ahead and replace Ned and Catelyn with Don and Sally.

We could perform the replacement element by element:

starkFamily[0] = "Don"
starkFamily[1] = "Betty"

But we can reduce this operation to a single line by specifying a range in our array, and assigning a replacement array:

replace range equal size

For this code:

starkFamily = ["Ned",
               "Catelyn",
               "Robb",
               "Jon",
               "Sansa",
               "Arya",
               "Bran",
               "Rickon"]
println("The Starks: \(starkFamily)")
starkFamily[0...1] = ["Don", "Betty"]
println("The Draper-Starks: \(starkFamily)")

We get this output:

The Starks: [Ned, Catelyn, Robb, Jon, Sansa, Arya, Bran, Rickon]
The Draper-Starks: [Don, Betty, Robb, Jon, Sansa, Arya, Bran, Rickon]

Replacing a range of array elements with a smaller array

In season 4 of Mad Men, Betty had divorced Don and his second bachelorhood is in full swing. Let’s represent this with an array containing only Don, and let’s use this array to replace the range in starkFamily containing Ned and Catelyn. Here’s a visualization of the result:

replace range smaller

Here’s the code:

starkFamily = ["Ned",
               "Catelyn",
               "Robb",
               "Jon",
               "Sansa",
               "Arya",
               "Bran",
               "Rickon"]
println("The Starks: \(starkFamily)")
starkFamily[0...1] = ["Don"]
println("The Draper-Starks: \(starkFamily)")

And here’s the output:

The Starks: [Ned, Catelyn, Robb, Jon, Sansa, Arya, Bran, Rickon]
The Draper-Starks: [Don, Robb, Jon, Sansa, Arya, Bran, Rickon]

Replacing a range of array elements with a larger array

Later in the Mad Men series, Don marries his second wife, Megan. Let’s treat Don, Betty, and Megan as an array of parents and use them to replace Ned and Catelyn in starkFamily. Here’s the visualization of that arrangement:

replace range larger

Here’s the code:

starkFamily = ["Ned",
               "Catelyn",
               "Robb",
               "Jon",
               "Sansa",
               "Arya",
               "Bran",
               "Rickon"]
println("The Starks: \(starkFamily)")
starkFamily[0...1] = ["Don", "Betty", "Megan"]
println("The Draper-Starks: \(starkFamily)")

And here’s the output:

The Starks: [Ned, Catelyn, Robb, Jon, Sansa, Arya, Bran, Rickon]
The Draper-Starks: [Don, Betty, Megan, Robb, Jon, Sansa, Arya, Bran, Rickon]

Replacing a range of array elements with an empty array

Earlier in this article, we represented the deaths of Ned, Catelyn, and Robb by deleting them from the starkFamily array one at a time. Since Ned’s, Catelyn’s, and Rob’s elements are all in a row in the range [0...2], we can delete them in a single action by replacing that range with an empty array. Here’s the visualization:

replace range empty

Here’s the code:

starkFamily = ["Ned",
               "Catelyn",
               "Robb",
               "Jon",
               "Sansa",
               "Arya",
               "Bran",
               "Rickon"]
println("The Stark Family before: \(starkFamily)")
starkFamily[0...2] = []
println("The Stark Family after: \(starkFamily)")

And here’s the output:

The Stark Family before: [Ned, Catelyn, Robb, Jon, Sansa, Arya, Bran, Rickon]
The Stark Family after: [Jon, Sansa, Arya, Bran, Rickon]

Want to find out more about arrays in Swift?

There’s more in the Collections Types chapter of Apple’s The Swift Programming Language, and I’ll cover more in part 2 as well.