Getting web site text in Swift

Loading the text of a webpage in Swift has not completely dropped its Objective-C origins, which makes the process a little bit less obvious than it should be. Fortunately it is only a few lines…

let url:NSURL = NSURL(string: "http://ebscer.com")!
let request:NSURLRequest = NSURLRequest(URL: url)
NSURLConnection.sendAsynchronousRequest(request, 
    queue: NSOperationQueue(),
    completionHandler: { (response:NSURLResponse?,
        data: NSData? error: NSError?) -> Void in
            let responseText:String = String(data: data!,
                encoding: NSUTF8StringEncoding)!
            print(responseText)
    })

You may also need to edit your plist file to whitelist the domain.

UI design for questions in your app

IMG_20160721_103356When asking a question in an app, it is important to make it easy for the user to find the right answer to the question. Simply because a question is phrased for a yes/no answer doesn’t mean that presenting yes or no as answers is a good idea. Instead it is a good idea to present the answers such that the right option can be selected even if the user doesn’t even bother to read the question.

The Brexit ballot from earlier this month is an example of good design. The question on the ballet asked if the UK should leave the EU, but the answers to pick from are ‘remain’ and ‘leave’ rather than ‘yes’ and ‘no’. This makes for a better user experience.

The image to the right is from the Stuff I Need app and shows the example of the same design. ‘Delete All’ and ‘Cancel’ do not explicitly answer the question, but give the user the opportunity to pick the right choice, even if they don’t read the question.

BlackBerry 10 distribution still flat

As has been the case for the past few months, the distribution of BlackBerry 10 devices has remained unchanged with the percentage of users on OS 10.3.X in the low 90’s.

One thing that was different, is that for the first time we have seen a few phones running OS 10.3.3 which is the long promised final update to BlackBerry 10, that includes zero new third party APIs.2016Jun-Pixelated-BB10OSVersions
2016Jun-StuffINeed-BB10OSVersions

This data was collected by BlackBerry World for downloads of the free strategy game Pixelated and the free checklist app Stuff I Need. Data shown on the chart is from the beginning of June 2015 through the end of June 2016.

Showing the full file path in the finder

By default the finder on Mac OSX does not show the full file path of the current folder. This can make it hard to remember where a folder is, and can cause confusion when working with multiple folders with the same name.

Fortunately, there is a simple fix that will show the full file path in the finder’s title bar.

In the terminal type

defaults write com.apple.finder _FXShowPosixPathInTitle -bool true

And then to restart the finder

killall Finder

After that the folders full path will be displayed in the title of the finder.

BlackBerry 10 distribution has been unchanged since the start of 2016

For the fifth straight month, the distribution of the BlackBerry 10 operating system has been essentially unchanged. The use of OS 10.3.2 has seemed to have maxed out in the low 80 percent of users.

2016May-Pixelated-BB10OSVersions

2016May-StuffINeed-BB10OSVersions

This data was collected by BlackBerry World for downloads of the free strategy game Pixelated and the free checklist app Stuff I Need. Data shown on the chart is from the beginning of May 2015 through the end of May 2016.

Head Words game updated

ShapeItAppThe BlackBerry 10 game Head Words has been updated to version 1.3 in BlackBerry App World. This update includes the new Comic Books category, and also includes some supplemental items to the existing categories.

About Head Words

Head Words is a native multi-player guessing game similar to Celebrity, Hedbanz, and Heads Up. After selecting a category, one player places the phone on their forehead while the other players give clues. With one minute to guess as many words as possible, the player can tilt the phone down for each correct answer, or tilt the phone up to pass. At the end of round a word list will show what was guessed right and wrong. The swipe down menu provides an option to turn the sound on or off.

The game includes five categories for free, and the option to purchase access to ten additional categories for a dollar each.

Links & Information

480X

Smartphones have gotten boring

Last week Google hosted their I/O conference for developers. For those of us who develop Android apps for phones and tablets there was very little announced. Android was mentioned often, but more for use in watches and virtual reality than for phones. And when phones were mentioned it was as a platform for Google’s own messaging apps. The biggest new item for developers is the Vulkan API, which as a low level graphics processor is not something most developers are going to use directly anyhow.

It is not just Android, but rather that the smartphone market has matured. It has become boring. Despite being an enthusiast, there is a reason that I am ok with using a two and a half year old phone running a dead operating system. Things are not changing as quick as they once were.

Furthermore new platforms such as wearables, virtual reality, and the internet of things lack the standardized platforms (and stores) that once made phones so exciting.

Preventing Windows 10 updates from rebooting your computer

By default Windows will download and install updates on your computer without any required interaction. This is great, but the problem is that it will also reboot on its own, closing anything you may have been in the middle of working on. No idea why Microsoft approved of this terrible user experience, but fortunately there is a (very hidden) way of preventing it from happening.

First from the start menu, search and open “gpedit.msc”. Then in the application go to Computer Configuration -> Administrative Templates -> Windows Components -> Windows Update. Then select the option “No auto-restart with logged on users for scheduled automatic updates installations”, then click “Enable”, and then “Apply”.

This will ensure that your Windows 10 machine will only restart when you want it to.

BB10 distribution still flat

Use of BlackBerry 10.3.X and 10.3.2 remain the same as they have for the last few months. Despite OS 10.3 being out for a long while now, there are still a decent number of users still running OS 10.2.1 on their devices.

2016Apr-Pixelated-BB10OSVersions

2016Apr-StuffINeed-BB10OSVersions

This data was collected by BlackBerry World for downloads of the free strategy game Pixelated and the free checklist app Stuff I Need. Data shown on the chart is from the beginning of April 2015 through the end of April 2016.

Inexplicably BlackBerry’s advertising has gotten worse

BlackBerry is a company that has never understood advertising. This was a company that though support for Adobe Flash was a feature worth advertising despite most consumers not understanding, and experts not caring. A company whose sole Super Bowl ad went out of its way to explicitly show zero of the phones features, and who once paid for an eleven minute ad about two girls in an ice cream truck fighting monsters.

It would be easy to think that the floor could not get any lower. Yet it has. The content coming out of the BlackBerry blog these days is pure nonsense.

In reaction to the Panama Papers scandal BlackBerry had some recommendations on how to prevent finding yourself in a similar situation. However, while most people would take an opportunity to advice against hiding your money in an offshore account, BlackBerry had a different reaction and instead decided that the real problem was Mossack Fonseca’s lack of internal security.

Their recent blog titled “How to Ease Employees’ ‘Big Brother’ Fears About Location Tracking” is not so much advising that you protect the privacy of your employees, but rather how to convince them to not worry about the invasion of their privacy.

However the worst bit is BlackBerry’s recent obsession on preparing for a work place shooting. Stories about workplace violence have been posted three times in the past three months, painting ridiculously unlikely scenarios. Somehow BlackBerry expects that this fear mongering is going to help them sell enterprise software.

Every line in the articles jumps between “active shooter incidents are now, unfortunately, a stark reality that must be given serious consideration” and “the likelihood of being involved in a workplace shooting is infinitesimally small“, but with the need to justify themselves they end up recommending “multiple training sessions and no-notice exercises“. And have also included such bizarrely unuseful information such as “Police officers responding to an active shooter situation are trained to proceed immediately to the area where shots were last heard. Their purpose is to stop the shooting as quickly as possible. The first responding officers will normally be in pairs. They may be dressed in regular patrol uniforms, or they may be wearing bulletproof vests, Kevlar helmets and other tactical gear. The officers may be armed with handguns, rifles or shotguns to address the situation.” The fact that during a shooting, police officers would arrive dressed as police officers should have been able to go without saying.

Worse though is the most recent post points out that the real danger of workplace shootings is that it leaves companies open to liability and OSHA compliance issues. I get that BlackBerry has now become a boring enterprise company, but that doesn’t mean that they need to be manipulative as well.

Synchronous AlertDialogs in Android

In general Android does not want developers creating alert dialogs that block the flow of code, but for those situations where it is needed, there is a way to force a dialog to wait. The approach essentially uses a handler to create a slightly more elegant version of a busy loop.

private boolean resultValue;
public boolean getDialogValueBack(Context context)
{
    final Handler handler = new Handler()
    {
        @Override
        public void handleMessage(Message mesg)
        {
            throw new RuntimeException();
        } 
    };

    AlertDialog.Builder alert = new AlertDialog.Builder(context);
    alert.setTitle("Title");
    alert.setMessage("Message");
    alert.setPositiveButton("Return True", new DialogInterface.OnClickListener()
    {
        public void onClick(DialogInterface dialog, int id)
        {
            resultValue = true;
            handler.sendMessage(handler.obtainMessage());
        }
    });
    alert.setNegativeButton("Return False", new DialogInterface.OnClickListener()
    {
        public void onClick(DialogInterface dialog, int id)
        {
            resultValue = false;
            handler.sendMessage(handler.obtainMessage());
        }
    });
    alert.show();

    try{ Looper.loop(); }
    catch(RuntimeException e){}

    return resultValue;
}

Percentage of BlackBerry 10 users running OS 10.3 levels off in the low nineties

Use of BlackBerry 10.3 remains level at 91% of Pixelated users, and 93% for Stuff I Need users. These numbers have been level for a while with most users running the newest variant of OS 10.3.2.
2016Mar-Pixelated-BB10OSVersions
2016Mar-StuffINeed-BB10OSVersions
This data was collected by BlackBerry World for downloads of the free strategy game Pixelated and the free checklist app Stuff I Need. Data shown on the chart is from the beginning of March 2015 through the end of March 2016.

Another 10 levels for Xploding Boxes

IMG_20150206_175129_cropXploding Boxes has been updated to version 5.7 with 10 new levels. The new version of the app has been updated in Google Play, the Amazon App Store, BlackBerry AppWorld, Windows 10/Windows Phone App Store.

About Xploding Boxes

Xploding Boxes is a strategy game where the goal is to start a chain reaction that will explode all of the boxes on the screen. Each level presents a different look and number of touches, requiring a different strategy to solve.

The game itself, and the first 25 levels are available for free, while a one time in-app purchase can be used to access the rest of the levels for just $2.99 while still maintaining your progress from the free levels.

Links & Information

icon