Cephi Systems Software and Contract Services

6May/120

Beetles and Gems

We are working on a new iPhone game in our spare time as just a fun weekend project. It is an action game with some puzzle elements. Above is some of the concept art. The working title is Boulder Smash, however our marketing resources are working on the most appetizing name they can conjure, as well as a name that won't solicit lawsuits for copyright infringement. It's also just not nice (or our business model) to steal someone else's name or unwittingly interfere with existing intellectual property.

The beetles and gems are some of the various prizes that can pop up. You tap them quickly to capture them for extra points and to complete various collections for access to bonus stages. A segment of the population likes collection style activities in games so we are thinking this game play element will be appealing to them.

As I was writing the methods which instantiate these prizes I was thinking about variable and method names that would succinctly describe themselves and came up with names like boulderPrize and spawnBoulderPrize since these types of prizes come from tapping boulders.

The artwork was done in Adobe Illustrator which is well suited for the simple style we chose. Illustrator really helps make art asset generation easy.

We are building the game engine from scratch just using UIKit for the entire game. No Quartz, no fancy libraries, OpenGL, or even Cocos2d.

Even without any of the above, it is really amazing how little code is required for the game engine and how very complex animations can be done in just a few lines of code in Objective-C and iOS.

We love to talk about system design internally, with our strategic partners, and with customers. Our business plan goes into great depth about how the vast majority of games and software titles out there get fairly poor reviews, i.e. less than a rating of 80%, or 3 out of 5 stars etc.

What causes all of these games to be regarded so poorly? Is it lack of vision, passion, or expertise on the developers part? Is it the business side of the industry interfering with the creative process, or pushing to release something that is not ready? Why are there so few truly great games? Thinking back over the last decade, there have been whole calendar years without any blockbuster titles.

Developers and business leaders have rectified this some by releasing sequels to already existing hits. This may stifle innovation a bit, but most of the time I see them doing a good job of correcting past mistakes, and even adding depth, new elements, and new twists to their franchise.

Game and application design is a subset of system design which is my passion. Economy of design (call it KISS or LEAN or minimalsitic design principles) is truly an art-form that is beautiful to behold, and its elegance is immediately apparent.

The goal is to achieve the desired result in the fewest possible steps. The same thinking in software engineering exists in technical writing, consumer product design, transportation logistics, martial arts, bioprocess system design, and aseptic operations in manufacturing. You see it in nature wherein the successful animals are the ones that acquire the most food while expending the fewest calories.

This is not just the providence of the great innovator or the engineer or efficiency expert. It is a natural process. Look at the cheetah below

It is a lean system designed to kill and then periodically make baby cheetahs. It is a life support system for sharp teeth and claws. Everything about it supports this end. It is an elegant animal, no?

You can also see it throughout human history in the desisgn of the spear or shovel, and in the economic movements Greek and Roman phalanxes.

William Shakespeare summed it up nicely around 400 years ago:

"Brevity is the soul of whit."

1Mar/120

CephiSearch

cephi-search-logo

CephiSearch

$25 (or $75 with US tech support)

Contact us to buy or with questions

CephiSearch is an ecapsulated search engine written in Objective-C designed to add simple search functionality to existing iOS application with little to no refactoring of existing code.

This class is great for developers who need to add a search function for strings within in a collection of managed objects with core data, a plist, or just a plain old array or dictionary like dad used to use. If your application is already on the App Store or your table view is up and running, adding search functionality typically requires refactoring of the tableview methods which may create some headaches and unwanted development time.

CephiSearch can be added to an existing project, and after passing it a refereance to your array holding your objects it will perform a text search with a button tap. No UISearchBar needed: just add your own button and a text view, or use our slick pop-up interface. The returned search results can be displayed in an existing table or used elsewhere. This is written without ARC for maximum compatibility but can be converted easily by our team or yours. Our code is commented to help you figure out what is going on under the hood as quickly as possible.

1 hour of tech support is included in the $75 tech support option purchase price, which is usually more than sufficient to integrate CephiSearch into your apps that display or manage data.

8Jan/122

16 Things To Do With Siri

Siri

For me, Siri was one of the things I was most excited about the iPhone 4S. For business, personal, and software development use I mainly used a 3GS, so the 4S was a big leap forward. Before I get started on all the things you can do with Siri, below are a few things to know first.

To use Siri just hold down the home button, then speak after Siri’s signature double ding. You can do this while the device is locked (asleep) or active, but not all the way off. When Siri determines you are done speaking it will sound another, lower double ding and then process what you said.

To work, Siri needs internet access, either though your cellular network or though Wi-Fi. This is because Siri is a large and powerful program that lives in part on a server somewhere, much like a more helpful version of Deep Thought from The Hitchhiker’s Guide to the Galaxy. If you know Douglas Adams's work you will appreciate the fact that Siri has not once told me it would have to think about it and to come back in eight and a half billion years. If there is a problem with your internet connection or the Siri servers are down for maintenance you will get a message along the lines of “I am sorry, I can not do that right now.”

If you find Siri is having trouble understanding you, make sure you are speaking clearly and are not speaking too quickly or running your words together. Also voice recognition software may give you some trouble if there is a lot of background noise like on a busy street, or next to a loud TV.

And now on to the list…

#1 Want to know the weather? Just ask. You can also ask it about the weather in other cities which is convenient for traveling.
•“What is the temperature?”
•“Is it windy?”
•“What is the temperature in Dallas Texas?”
•“What is the weather in Dallas Texas?”
•“When is sunset?”
•“When is sunrise?”

#2 You can search Wikipedia quickly and easily without going though the internet search engine:
•“Search for fish on Wikipedia”
•“Search Wikipedia for saturn”

#3 Setting and checking reminders is extremely handy if you use Apple’s new Reminders app. It is much faster than typing.
•"Remind me to check my email tomorrow"

For me the word tomorrow sets it to tomorrow at 9:00 am.

Or you can use:
•"Remind me to check my email tomorrow at 10 AM"
•"Remind me to buy some lettuce on Thursday 5 PM "

Then to check your reminders you can just say:
•“Reminders”

Or if you think it best to speak proper English to your computers:
•“Show me my reminders”

#4 You can search for various facts on Wolfram Alpha which is a conceptual knowledge engine (sort of like a smart encyclopedia)
•"Who is Demi Moore?" (not really sure why Demi Moore came to mind, but she did)
•“Why is the sky blue?”
•“What is the speed of light?”
•“What is the speed of sound?"

#5 Wolfram Alpha has information about animals:
•“Wolfram mice”
•“Wolfram giraffe”

#6 Wolfram Alpha can also answer math questions
•“How many centimeters in one inch”
•“What is 9 times 7”
•"What is 6 divided by 3"
•“What is 4.5 times 3.4?” (Division of decimals behaved a little wonky for me)
•“What is the square root of 42”
•“How do you calculate the area of a circle?”

#7 Wolfram Alpha also takes food questions:
•“How many calories in an apple”
•“How many calories in Blueberry pie”
•”What is the nutritional value of grapes”

Or more simply:
•“What is the nutrition of grapes”
•“What is the nutrition of a [insert your favorite band-name candy bar]”

#8 English word definitions:
•“What is bling” (Merriam-webster.com says “bling” is not a word, however “bling-bling” is.)
•“What is happenstance”

#9 Wolfram Alpha has added some integration with the Best Buy website so you can ask about:
•“Wolfram laptop computers”
•“Wolfram desktop computers”
•“Wolfram tablet computers”

Sometimes it may return a definition of a computer. This is a new feature so let them iron out the kinks.

#10 One of the coolest things, in my opinion, is that you can create documents via the Notes app. Try this:
•“Create a shopping list note”
•“Add grapes to shopping list note”

Once the note is open and displayed on the screen you can simply say:
•“Add chicken”

Then later on when you have found you have consumed the last drop of milk you can whip out your iPhone and say:
•“Add milk to shopping list note”

It is really pretty handy if you use lists. Siri won’t recognize every brand name, although it will recognize a wide variety and even some surprisingly obscure ones.

#11 Siri has nice integration with the Maps app:
•“Where am I?”
•“Where can I get some coffee?”

Or you can just grunt:
•“Burger”

..or if you are unsure what you want:
•“What should I have for dinner?”

Oddly it does not do well with medical facilities probably because their names and key words often don't include the words we use.
•“Where is a doctor office?” sends me about 70 miles away, and does not show me the doctor office I use that is about a mile away. Of course this could be because my doctor’s office has neither the word “doctor” nor “office” in its name.

However if you say…
•“I need a hospital my arm is chopped off." Siri did find the closest hospitals. (I would recommend dialing 911 if your arm is chopped off. Maybe yell for help too)

#12 Siri has some integration with the Apple store
•“What is an iPhone?”
•“What is a Mac?”

#13 You can check stock prices with Yahoo
•“What is the stock price of Apple?”

#14 You can check and set alarms though Apple’s Clock app:
•“Show me my alarms”
Or
•“Look up my alarms”
And
•“Create an alarm at 10 am“
Or
•“Make an alarm at 10 am”
To check the time you can just say:
“Time”
To search for the time in a different city / time zone:
•“What time is it in Tokyo?”

#15 Then there are goofy and fun things you can say to Siri. Try asking each of the these multiple times and you will get some different answers:
•“Siri what should I do?”
•“What is the meaning of life?”
•“Which religion is the correct one?”
•“Should I ask for a raise?” (The trigger seems to be “Should I…”)
•“Why am I here?”
•“Hello Siri”
•“Who is Siri?”

There are probably a lot more.

#16 Finally you can use Apple’s Messages app:
•“Show me my messages”
•“Send a text message to Bob” (Just use the name of someone in your address book)

Or even:
•“Message Bob hello”

If someone just sent you a message you can:
•“Reply OK I will pick up some milk”

And a very cool feature is:
•“Read me my messages” which will read aloud your unread messages

Although I use it a lot, and as said before using Siri is much more efficient than typing, I am not 100% sure about talking into a phone to send a text message. I can’t put my finger on it, but something about that just strikes me as a bit odd.

If you want to see some examples of what Siri can do or just a reminder on how to phrase things, just say:
•"help"

Siri is context sensitive to a degree, so sometimes it may try to fit your question into it’s current context which is what is displayed on the screen at the moment (reminders, maps etc). If this is causing your question to be misinterpreted close Siri and reopen.

Also if Siri displayed something like a note or reminder you can just tap it to open the full app.

If you have tried speaking more slowly and Siri still has some difficulty understanding you try enunciating each word carefully and separate each word with a brief pause. Also make sure your mouth is close to the mic… I don’t think it was designed to be yelled at from across the room. Given human beings often have a tough time understanding each other, there is no way a piece of software is going to be 100% accurate.

Siri did manage to decipher some more common bad enunciation such as:
•“How areyadoin’?”
And
•“whatchyadoin’?”
(Siri will respond to these by the way)

Siri is useful, fun to play with, and may even trigger a renaissance with speech recognition in consumer appliances and electronics. If you know of or find any Siri tricks share it with the rest of us and post it in the comments section below.

23Oct/112

Head First iPhone & iPad Development – 2nd ed

Head First Iphone & iPad Development by Dan Pilone and Tracy Pilone is aimed at guiding programmers new to development for iOS though the SDK tools, the fundamentals of Objective-C, and the app development and submission processes.

This is the fourth Head-First book I have read, and I am a fan of the series and of the communication style they use. They like to employ established cognitive science techniques that aid in understanding and retention, such as using an informal tone, humor, reiteration/rephrasing, active participation / exercises, and they facilitate visual-style learning.

While this particular book does not include a lot of introduction to computer science material, it does walk you through some interface design principles and introduces some of the Apple guidelines for iOS applications. Many of the other Head First books take time to explain some of the basics like how arrays work in a particular language, or the basics of objects in object orient programming, but this book mainly focuses on subjects unique to Objective-C programming for iPhone/iPad, with a some good examples of how to adapt an existing iPhone application to the iPad, or to support both the iPad / iPhone the from the get go and make a universal app.

While not current to iOS5, I am not aware of anything in this book that will not work with iOS5. The examples give a good starting point for people that want to learn Objective-C and include many commonly-used topics such as working with multiple views, the table view, and various UI elements. For storing your data they cover property lists and core data, both of which are pretty easy to get started with. Core data is powerful and makes saving and retrieving data from a MySQL database easy.

The book also covers integrating the camera into your apps, as well as map kit, and core location. It also briefly touches on animation and the accelerometer.

This is one of a handful of books that I would recommend for new or maybe even intermediate-level iOS developers. Here are some of my favorites books (in no particular order):

Beginning iPhone 4 Development: Exploring the iOS SDK (I actually read an earlier version but really enjoyed it)
Big Nerd Ranch Guide to iPhone Development.
Head First iPhone & iPad Development - 2nd ed.
Programming in Objective-C

New Objective-C programmers would probably benefit from reading at least a couple of these. There is some overlap amongst these books, but there is also some significantly different material, approaches and underling philosophy. Also there are not a lot of books out there dedicated to more advanced topics in Objective-C so sometimes you can find information you need towards the end of one of these beginner books. None of these books cover game development but that is really a topic worthy of a separate book.

25Sep/111

Property Lists in Objective-C

If you are new to Objective-C, property lists (plists for short) can be an unfamiliar concept. Opening a .plist file with a text editor will reveal that they closely resemble XML files. A plist is just a data file: it stores data in the form of serialized objects in a standardized format and structure. This standardization is important since plists can be read by any application designed to read them. Put another way, an application expects the data in the plist to be organized in a certain way (a structure). If the application does not see the plist in the correct structure then it will probably throw an exception.

Here is an example of the source code of a simple plist holding two people's personal information:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <array>
        <dict>
            <key>name</key>
            <string>Bob Johnson</string>
            <key>payGrade</key>
            <integer>5</integer>
            <key>weight</key>
            <real>175.5</real>
        </dict>
        <dict>
            <key>name</key>
            <string>Mike Smith</string>
            <key>payGrade</key>
            <integer>2</integer>
            <key>weight</key>
            <real>475.5</real>
        </dict>
    </array>
</plist>

When viewed as a plist file in Xcode, this plist will appear as follows:

Like XML files, plists consist of data elements which hold content (elements of your data). In the above example there is a hierarchy of data elements: an array as the root property-list object (the top-level container), then each individual person is represented by a dictionary object. Each dictionary then holds some data elements: a string for the person's name, a floating point number (the tag) for the person's weight, and an integer for their pay grade. Each element is denoted or wrapped by tags, and each must have an opening and closing tag or the application will consider the plist invalid.

Example:

<string>Bob Johnson</string>

So the tags are enclosed in the <>'s, with the opening tag coming first and the closing tag with a backslash being at the end of your content. When you instruct your application to reference the object corresponding to the name key, it will return a copy of the object between the tags, in this case Bob Smith (technically I believe it returns formatted data which is then converted into an object by the app/OS.) If you want to see more examples of how XML files are organized see the links at the end of this article.

Once your data is in a plist it can be written to disk, or sent across the internet to communicate with a another application or server. Plists are designed to be storable, transportable and easily accessible. Plists often hold a dictionary object such as with the Info.plist, but you can set your plist up to hold objects such as an array, an array of dictionaries, a dictionary of arrays, or whatever is convenient for you. When you create a plist in Xcode the default root property-list object (the top level or root container) is a dictionary ready to contain other objects. Through Xcode's plist editor you can add new rows that can be dictionaries, arrays, booleans, strings, dates, numbers, or data (NSData objects).

If you want something other than a dictionary as your root property-list object you cannot currently do this though Xcode's plist editor (as of version 4.0.2). You do this by editing the source code instead. This is done by right clicking on the Plist file in Xcode's project manager window and selecting “Open As” then “Source Code.” You then see the source code as shown at the top of this article. The default location for plist files is in the Supporting Files folder and they are identifiable by the .plist file extension.

In iOS devices, like the iPad and iPhone, applications have a default info-plist which stores information (metadata) about the application such as bundle names, its icon, and supported interface orientations. This plist is named [the application name]-Info.plist. This information is read by the operating system and is used to display and configure the application.

Having problems with your plist? This can be caused by the syntax being incorrect such as a misspelled or missing tags, putting a string inside an integer element, or an invalid character somewhere. When you try to build and run the application containing the plist, Xcode will give an “error: reading plist: The data couldn’t be read because it has been corrupted.” Checking the source code for the plist as explained above is a good way to see what the problem is.

Plists are pretty easy to use and are good for storing up to a few hundred kilobyets of data per Apple. You have a choice between saving your plist in either an XML or a binary format. The tradeoff between these two choices is XML formats can be manually edited, but binary formats have the advantages of being more compact, consuming less memory and they read/write faster, so binary formats may be better for working with larger amounts of data. You can also save your plists in an old-style ASCII format that is most commonly associated with the OpenStep API specification.

In addition to creating a plist in Xcode, plists can also be created programmatically. Below is a simple example of how to programmatically create, populate, and save a plist and then reference it by copying its contents to a dictionary:

-(void) createPlist
{
    //Get the path to the document directory in your app bundle:
    NSString *path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
    //Add the name your plist will be saved as:
    NSString *plistPath = [path stringByAppendingPathComponent:@"myPlist.plist"];
    //Make a dictionary that holds 2 strings
    NSDictionary *dictForPlist = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects: @"string 1", @"string 2", nil]forKeys:[NSArray arrayWithObjects: @"Key 1", @"Key 2", nil]];

    NSError *error;
    //Create a plist with the data from the dictionary
    //For the error we pass a pointer to a pointer so new NSError objects can be referenced rather than altering an existing NSError object.
    NSData *plistData = [NSPropertyListSerialization dataWithPropertyList:dictForPlist format:NSPropertyListXMLFormat_v1_0 options:0error:&error];
    
    //If plistData exists, save it as a plist file.
    if(plistData) 
    {
        [plistData writeToFile:plistPath atomically:YES];
        //This is written to the application bundle document directory:
        NSLog(@"plistPath %@",plistPath);
    }
    else 
    {
        NSLog(@"Something went horribly wrong: %@", [error localizedDescription]);
    }
    
    //Reterive the data from the plist, and put it in a mutable dictionary so we reference or manipulate the objects within:
    NSMutableDictionary *myDict = [[NSMutableDictionary alloc] initWithContentsOfFile: plistPath];
    NSLog(@"myDict %@",myDict);
    
    //Since we alloc'ed a mutable dictionary we should release it when done with it: 
    [myDict release];
}

Links:

More about XML: http://www.w3schools.com/xml/xml_syntax.asp

Apple's Property List Programming Guide:
https://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/PropertyLists/Introduction/Introduction.html#//apple_ref/doc/uid/10000048-CJBGDEGD

22Mar/110

Cooking with your iPad and iPhone

cooking iPad1

I don’t actually recommend cooking your favorite iDevice. I don’t believe it is edible or tasty. Also, it should also be noted that your devices do not emit enough radiation to really cook anything.

What can be done however is using your iPad, iPod, or iPhone to help you cook, mainly having your recipes at hand while cooking.

 

So today I have two tips on using your iDevice in the kitchen:

Tip number #1: Protect your device

iDevices are a high-end item with a high-end price tag, and the carriers do not give them away in two-for-one specials. Also, if you are like me, you have some emotional attachment to your device, and you would be upset if it was mutilated, lost, or destroyed.

The main hazard to your iDevice in the kitchen are liquids. Splattering your device with some tomato sauce or batter may not hurt it, but it will soil your device. No one wants a sticky, yucky phone.

The real liquid threats are things like things like knocked-over cans of liquids, pouring accidents, or dropping the device into a filled sink. These mishaps have the possibility of shorting your device and earning it a trip to Apple for repairs or possibly may require total replacement.

So what is the solution? I use zipper storage bags to help protect my devices in the kitchen.

The one gallon bags I have just fit the iPad, and any old little bag will fit an iPod or iPhone. You can still use the touch screen though the baggy so you can select and scroll around your recipe.

Now these are not 100% water-proof, and I would not submerge them. Also there is always the chance something will go terribly wrong and your device will get wet, but a zipper bag will go a long way in protecting you device from splashes and insidious expanding puddles from spills.

If your baggie does get wet or soiled, dry it off with a dry dish cloth before removing your device. I typically reuse my baggies several times at least.

Tip number #2: Gmail

There are a million ways to store your recipes on a computer or smartphone. I use a dedicated Gmail account to store mine. Just email your new recipes to your dedicated recipe email address, and soon you will have a long list of digital recipes. The iOS makes it easy to have multiple email addresses. You can also name the email account something easy to remember like BobJRecipes@gmail.com.

Why use an email account?

Because:

• For dedicated recipe apps, the software developer my discontinue support of the software you use to store your recipes. This could result in your recipes being isolated on your iPhone and inaccessible when you upgrade to the next iDevice.
• A Gmail account is easily accessible from PCs, Mac, your spouse’s iDevice, your computer at work, and other mobile devices.
• Gmail does not discard your old messages, and has built-in searching. So, for example, you could search for every recipe that has the word chicken in the title.
• It is easy to share recipes. Having your recipes on an email account makes it easy for them to be sent to other people.
• If you ever decide to switch to another electronic form of storage all you have to do is copy and paste the recipe text from your email.

Free apps that include cloud storage like Evernote would probably be good for this too. For recipe development I use RapidTask to store and edit the recipe then when I am happy with the final product I use the built-in email function to email the recipe to my recipe email account.