TimesX – Released on the App Store

This past weekend was dedicated to getting my first app store submission in order. I was overjoyed that it was accepted on the first review!

Music: Pacific Sun by Nicolai Heidlas

Originally made as a learning tool  for my son who was always on his iPad, I wanted him to get more multiplication practice for grade 2. I downloaded several apps which were entertaining and gave him practice, but I wanted more. I wanted to see if he was making progress, which questions he was getting wrong the most often, and how long it took him to do a test today vs last week. So, being a programmer, I made my own app for his iPad.

Features

  • Tests are saved on your device with letter grade, percent score, test time and more
  • With more use, ‘Error Counts’ shows you where your child needs help
  • Choose which times tables will be on the test
  • Limit for selected tables x10 for younger students or x12 for older
  • Live timer display optional

Programming

At first, I made the app in Xamarin Forms. This was going to be the quick and easy way to put it together for him to start using it. Also later,  if I decided to port it, it would be 95% ready for Android as well as iOS. When I started transitioning the app from “my son’s learning tool” to “TimesX”, I ran into issues displaying it on ALL iOS devices from the same layout. That’s when I decided to leave “forms” and move on to Xamarin iOS. The constraints system implemented by Apple for XCode was made for this, and Xamarin carried that through in it’s iOS implementation. A bit of a learning curve but it’s second nature now – constraints were a great solution that allows this app to display on every iOS device from an iPhone 4s to an iPad Pro 12″, in both Portrait and Landscape.

Facebook Promo Page: https://www.facebook.com/timesxmultiplicationtester

iOS Map App Tutorial in C# using Xamarin

Preface

Xamarin is a powerful development environment for creating apps for multiple platforms, using the same C# code base. The new Xamarin Forms technology will even allow you to use most of your UI code between different mobile platforms. Just have to say I LOVE this technology because I can make Android & iOS apps from the same code, rather than using 2 or 3 other languages.

Onto our app.. This example is meant to be simple and quick, and give you a taste of Xamarin development. We are going to make an app that shows a map, and then zooms into your current location when you click a button.

Prerequisites

You can deploy this app to the iOS Simulator or a real iOS device if you have that set up on your Mac already. Oh yeah, you’ll need a Mac, otherwise you’d have to do this somewhat differently on a PC using Visual Studio with Xamarin plugins. The app may be too big to deploy using the Xamarin Starter edition on its own. If you try to publish for iOS and get messages about the app size, take the option to start a free trial.

Create an iPhone App
    1. First thing we want to do is create an iPhone app project in Xamarin. Choose File > New Solution
    2. Give this solution the Name Locator. Xamarin will generate a project that should look like this:

Visually Build the Screen
    1. Next, we visually build our app screen with some standard iOS components. To do that, go to the Solution pane on the left and double click the file MainStoryboard.storyboard. You should get a blank storyboard like this:

    1. Note the Toolbox and Properties panes. We are going to drag components from the Toolbox onto the storyboard, size and position them, and then customize them in the Properties. Drag these components from the Toolbox onto the storyboard so it looks like the image below:a) Label

      b) Button

      c) Map Kit View

Customize Components and Add Hooks for the Code
    1. To resize components, just grab an edge and drag. Let’s start with the Label first. Click on it and then go to the Properties pane in the Widgets. Change the Text property from “Label” to “Locator”
    2. Next, lets give the Map Kit View a hook so we can access it in code. Click on it and set the Name property to “myMap”.
    3. Finally, click on the Button and change the Title text to “Find Me”
    4. Set the Name property to “findMeButton”
    5. To detect the user pressing the button, we could set up the Events tab and write functions or we could let Xamarin generate this code for us. Double-Click the Button on the storyboard and Xamarin should switch you to the LocatorViewController.cs tab, where you’ll see this yellow code hint:

    1. Press Enter and Xamarin should generate this code:
partial void findMeButton_TouchUpInside (UIButton sender)
{
    throw new NotImplementedException ();
}
Start Coding
    1. Lets save our work at this time using File>Save All
    2. Now, lets replace the code in the findMeButton_TouchUpInside function. Add the line:
partial void findMeButton_TouchUpInside (UIButton sender)
{
    MKCoordinateRegion region;
}
    1. Notice the variable type is red, which means that the class you are editing doesn’t know what a MKCoordinateRegion is. To fix, right click on it, and choose Resolve>Using MonoTouch.MapKit. If you scroll to the top of the class, you’ll see the MapKit class was imported. Now lets enter the rest of the code. The function should look like this:
partial void findMeButton_TouchUpInside (UIButton sender)
{
    MKCoordinateRegion region;
    MKCoordinateSpan span;
    region.Center=myMap.UserLocation.Coordinate;
    span.LatitudeDelta=0.005;
    span.LongitudeDelta=0.005;
    region.Span=span;
    myMap.SetRegion( region, true );
}
    1. You’ll notice as you type that Xamarin is suggesting code for you. This is similar to the IntelliSense feature in Visual Studio on the PC, and also several other programming IDEs. Next we need to add one more line of code to a different function. Scroll up to the ViewDidLoad function, and add the myMap line:
public override void ViewDidLoad ()
{
    base.ViewDidLoad ();
    // Perform any additional setup after loading the view
    myMap.ShowsUserLocation=true;
}
    1. Save your work and lets try this app out. Assuming you have the iOS simulator installed on your system, or have published to your iPhone before, press the Debug Button

download source

Test and Debug

Since the iOS simulator does not have a real location service like your iPhone, it will simulate one. You can change the current simulated location in the iOS Simulator using Debug > Location > Custom Location and setting the longitude and latitude. You can also simulate a moving location as demonstrated in this video:

Update for iOS 8

Just finished this post a week before iOS 8 officially rolled out and the update caused the application to break. I started getting this error message:
Trying to start MapKit location updates without prompting for location authorization. Must call -[CLLocationManager requestWhenInUseAuthorization] or -[CLLocationManager requestAlwaysAuthorization] first.

A few extra steps are required to make this work in iOS 8 now:

Edit the Property List File (plist)
    1. In the Solution pane on the left, look for the file Info.plist.
    2. Double click it to open the tab for it
    3. At the bottom of the window, click on the Source tab
    4. Click on the green plus symbol to add a new entry
    5. Change the text Custom Property to NSLocationWhenInUseUsageDescription
    6. Click on the Value field for this entry and enter a message to prompt the user for location access such as Please allow this app to access your location.
Add some C#
    1. Add this locationManager variable under the class definition. If the CCLocationManager is red, right click and choose Resolve>Using MonoTouch.CoreLocation
public partial class LocatorViewController : UIViewController
{
	CLLocationManager locationManager;

    1. Update the ViewDidLoad function to look like this:
public override void ViewDidLoad ()
{
	base.ViewDidLoad ();
	// Perform any additional setup after loading the view, typically from a nib.
	locationManager = new CLLocationManager();
	locationManager.RequestWhenInUseAuthorization();
	myMap.ShowsUserLocation=true;
}

Again, this last section is only for iOS 8, so you would not need to do this for iOS 7.

MookieData C#

 

In 2012 when I was trying to make my game, SlotFriendzy profitable, I felt the need for an Admin tool to analyze the game’s usage and performance. I didn’t want it to be hosted on the web and decided to build it as a Windows Desktop App. I chose Visual Studio and built it on the .NET 4.5 Framework, along with a MySQL C# Connector I downloaded from the MySQL web site.

For security reasons, I normally would not put a database connector directly in a client-side application, but in this case, the intended audience was very a specific population – me. Designing a Form based app in Visual Studio was easy, and this simple layout made it easy to add commands every time I thought of something I wanted to query on a regular basis.

I named it MookieData because the game belonged to my company, Mookie Games Inc.

MindJolt

 

In 2011, I joined the team at MindJolt Inc., now SGN. The founders of MySpace had created this game company who’s main product was the MindJolt App on Facebook. It’s a game portal with thousands of Flash based games, and runs in Facebook as well as a stand-alone site. At one point I believe it had over 13 Million users, and chances are if you play games on Facebook, you’ve seen it.

Flash API
To allow the Flash games to communicate with the MindJolt  App,  they all load another  Flash file,  which is a bridge to the back end and other non-Flash code. The MindJolt Flash API was my main project for quite some time. It dealt with Ads, tracking, user information, settings, and much more. As the MindJolt stack was constantly being improved, changes to the Flash API were always in need.

Games on Mindjolt
I also updated the source code for several of the Flash Games. As new features were introduced in the API , some of the games were modified to take advantage of them. The games you see in the video above are some of the ones I worked on.

Big Games
Later on, I worked on several other games outside of the Mindjolt app such as Panda Jam, Jewels of the Amazon, Bubble Atlantis, as well several enhancements via the Facebook and PlayerIO APIs.

C#
Some other projects included C# work as well. One was to convert a Flash tracking API swf to a C# DLL for Unity projects. Another was to process user information and statistics data for PlayerIO (now the Yahoo Games Network). The PlayerIO SDK has both an ActionScript and C# API.

Automating Text Content for Flash E-Learning with Word and Visual Basic

Medsn’s E-Learning Platform

Within the Microsoft Office suite of applications is a powerful automation tool. They are called Macros when you look through the menus, but are far more powerful than Macros in other applications. You can customize the macros in the Visual Basic programming language. It gives you deep access into the functionality of MS Office applications.

For several years, I architected and maintained the E-Learning platform for Medsn, now Indegene. It was a Flash application to navigate through Flash content, and supported external data sources for text, audio, and quizzes – as well as several other features such as AICC and SCORM tracking. Clients included many of the major pharmaceutical companies as well as medical equipment manufacturers. Here are some samples of the courses I programmed:

Launch Flash! Alcon

Launch Flash! Post Test
Launch Flash! Migrain
Launch Flash! Patient Simulator
Over 100 training courses were developed for this platform and automation was key to get the content writers work into the system. The “parser” was a tool I developed to take a MS Word doc with a predefined table structure, fill it in with content, and then produce the data sources for the training course. This rapid conversion process allowed the writers to iterate and customize content freely.

Script Template

The Script Template is a combination of a Word document template, macros written in VBA ( Visual Basic for Applications ), and forms such as those available in Visual Studio. You can edit macros right from Word, Excel, PowerPoint, or Outlook and have a Microsoft quality IDE.

Macro Editing Environment in Microsoft Word

The automation of Microsoft Office applications is very powerful when combined with a language like Visual Basic.