Biblicious Bible Trivia for Mac OS X

After nearly a year and a half of after-hours working, working when I didn’t have client work, and shelving it for awhile… Biblicious for Mac is finally finished. Here is a small confession… Biblicious Bible Trivia was originally destined to be a desktop application. I had started designing the game and had made the database editor. Then the iPhone SDK came out and I knew it would be a great game for that platform. When the iPad was announced, I began working on the iPad version. But, something was always missing… the desktop version.

Biblicious Bible Trivia for Mac OS X plays almost exactly like the iOS version. The main differences are that there is no opening dialog explaining game play, and there is currently no multi-player capability. I spent a lot, and I mean A LOT of time coding the multi-player functionality and no one ever played it. Probably because there were not enough people playing at the same time.

There are actually two versions of Biblicious Bible Trivia for Mac OS X. There is the Mac App Store version, and the non-Mac App Store version. So what’s the difference? The Mac App Store version is tied to Apple’s GameCenter for high score storage. The non-Mac App Store version does not save the high scores anywhere. Back before Game Center, I was saving high scores to my own server, but it confused people. They assumed their score was in the top X of scores and get upset. I didn’t want to deal with that again.

A Future For Elastic Window / Elastic Web Page?

In July I began shopping around Elastic Window & Elastic Web Page to see if any developers were interested in buying and maintaining them. Elastic Window has a special place in my heart & I would hate to see them abandoned. I had the idea to build Elastic Window ever since I saw something similar done in Visual Basic. I had discussed its development with some of the REALbasic “old guard” who provided pointers on the architecture. I even went in to the labs at REAL World in Austin for pointers on building the Elastic Canvas aspect of Elastic Window to make it easier on users. A lot of love has gone into Elastic Window over the years.

I loved REALbasic since the early days. I was happy that I had found a VB for Mac. I think my first version was 2.1, all the way through the 2005 IDE change, the rebranding from REALbasic to Real Studio, and again the rebranding to Xojo.   At one time I was the biggest proponent of REALbasic that I knew. I promoted it at the VB6 shop where I used to work. I even mentioned it at other programmer meetings & conferences. I’ve been a customer for over a decade. I was part of ARBP, used to help people on the NUG & the forums, and I’ve attended and spoken at REAL World conferences. I remember hanging out at a REAL World conference saying “why would anyone use anything else?”

So what’s changed? Mostly it’s been death by 1,000 paper cuts if you will. Most of the problems I dealt with in stride. I did blog/complain about bugs and other issues not getting the attention that was important to me as a professional developer. (See this post, this post, this post, this post and this post in which I took a lot of flack! OK, this post and finally this post.) In the early days of the NUG I had some mildly offensive “turn or burn” taglines at the end of my e-mail signature. One actually was “turn or burn”. The NUG members didn’t like that and voiced their opinion. I was threatened with removal from the NUG by REAL Software. Interesting times. To help my REALbasic consulting service search ranking, I bought a few domain names with “realbasic” in them. I was threatened with lawsuits which never came about because I was not infringing on their copyright or trademark by explaining what my business was doing.

The final 1 2 punch came early last year after beginning my RS to Xcode tutorials (now Xojo to Xcode after their name change). First the Xojo IDE makes coding not fun anymore. When the first edition of Xojo came out I would literally yell at the computer screen because of what the IDE was doing. Second RS banned me from their social networking “groups” on LinkedIn & Facebook. And I received the following email:

“Your recent blog posts comparing Real Studio with xcode/Obj-C have come to our attention. Since your blog posts are suggesting people use tools other than Real Studio, we have decided that we can no longer support your third party tools in our store. Per the agreement, “Real Software Third Party Sales Agreement” (section 16a, which I pasted below for your convenience), your products will be removed from our store in 5 days.”

They were hoping to strong-arm me into changing one sentence where I state to only use their product for cross-platform & to use native tools when not targeting multiple platforms. After some semi-heated discussion and condescending responses from RS, I went ahead and pulled my products from their store… not waiting the 5 days. (I was actually thanked by them for that, no, really!) When I mentioned to them all the things they had done to me over the years (above), the response back was

“I can’t think of anyone who has been the target of so much. You should ask yourself why that is … The thing is Christian, we almost never have had to take this kind of action because the vast majority of our users are reasonable people.”

I told them if this was a relationship I’d be an abused spouse. I could go on (I have 15 pages of saved emails to refer to), but I won’t. Simply, I’m done doing business with them.

So how did this post come about? After shopping Elastic Window around I had mentioned that I hadn’t been to the Xojo forums in months. Afterwards, without signing in, I began looking around the forums and saw a post that pointed to another blog post titled Xojo Considered Harmful. The original poster on the Xojo forum reminded me of me years ago. The blog post referenced is sort of how I feel now.

Five years in the making, this battered spouse left last year. Since my Xojo subscription has expired and I don’t intend to pay for it again, at this time I won’t be fixing any Elastic Window nor Elastic Web Page bugs caused by Xojo updates. I have received exactly 2 customer support requests since Xojo 2014R2 was released. One bug having to do with a WebTimer when using Elastic Web Page and another odd-sounding resizing issue when using Elastic Window.

If you would like to step up & take over Elastic Window & Elastic Web Page development, please contact me. If no one steps up, they’ll either collect dust or I’ll open source them where they may collect dust anyway. Until then, you’re a programmer. You have the source code if you have a recent license. Figure it out. ;)

 

 

Porting my app Biblicious from iOS to OS X, Part 4

In July I didn’t have much time to work on Biblicious as I had client work to get done. With that big project out of the way, I was able to work on Biblicious the first week of August and finish up  the game for OS X. Some things needed to be redesigned for the different platform. I decided to use WebViews on the screen with a “close” button in the corner since there isn’t really a way to push views onto the stack with a navigation controller. If a player gets the question wrong & chooses the “Show Me” button, a WebView covers the screen. After the user closes the WebView, the game continues. I did the same thing on the main menu screen. Instead of shelling out to Safari, a WebView appears. I also added GameCenter integration for  score board (Manna Leaderboard).

Another thing better on the iOS version is the SocialNetworking sharing feature. In iOS, you can find out which services the user is logged into via the device & pop up an appropriate share dialog. Under OS X, that is entirely taken out of the programmer’s hands. All you can do is pop up a menu that is supposed to be displayed after the user presses a button (on mouse down, not mouse up). The menu contains all networks the OS is logged into (possibly more) along with e-mail & messaging options. After the user chooses the network, the proper dialog appears. What I had to do was to make a global variable that holds the last played score, and provide a sharing button on the main menu. Not the best UX, but the best I could think of under the circumstances.

 

On August 1st I submitted Biblicious for Mac v1.0 to the App Store for review. On August 6th, it was rejected due to a “crash” when the Print option was chosen from the File menu. To be honest, I hadn’t even thought about the menus all this time. And, when I tested it & chose the Print option, the app did not crash, but I did get a permissions dialog most likely due to the lack of proper entitlement. Why would someone want to print from the game anyway? So, I ripped out all the menus except the File->Close & Biblicious->Quit and resubmitted.

Porting my app Biblicious from iOS to OS X, Part 3

Biblicious for Mac has been slow going. I’ve had some time to devote to it recently, and it has been frustrating.

On the plus side, I was able to fix the bug where the game would start, play for about one second and tell you that your time was up. I suppose I could have left that bug in there, called it a feature, and changed the name to Biblicious Masters Edition. :D

The main problem I am having right now is finding a good replacement for UIAlertView on iOS. NSAlert just won’t cut it. I need a view that will display & then close after a defined amount of time. Some people use NSAlert and have the default button automatically “click” but then the user has to see the button. Ugly.

I decided to create my own view. I opened interface builder & in the same xib as the game view added my new “dialogView”, designed with a label for a title, a label for the message, and two buttons.  I also added a test button on the game screen next to the “Escape” button called “Test”. In Test’s action, I instantiated my view & added it as a subView. Good. Run the project, start a game, click “Test” and nothing. The game keeps playing as normal. I decide to try showing the view as a sheet on the window. A sheet rect looked like it was displaying but I saw nothing.

My next step was to create a new window in the xib & toss the view in there. I did that and when “Test” was clicked, tiny square came down as a sheet. I went back and init’d the window with a Rect and this time I had a blank sheet of the correct proportions! After a few iterations I removed the view from the new window & placed all of the controls from the view directly on the window. This time when the sheet displayed, it was transparent but still no controls were visible.

I switched back to the view method and here we are. If you have any suggestions for displaying a “modal” view on top of another view, I’d love to hear it. Here is the code as it stands now:

- (IBAction)testButtonPushed:(id)sender {

    _dialogView = [[NSViewalloc] initWithFrame:NSMakeRect(0, 0, 712, 416)];

    [self.viewaddSubview:_dialogViewpositioned:NSWindowAboverelativeTo:self.view];

}

 

Porting my app Biblicious from iOS to OS X, Part 2

With WWDC 2014 coming up, this post probably won’t get read very much, but here it goes…

The first game view hurdle was fixed. In my last post I mentioned that one doesn’t get as many event notifications when a view on OS X is about to display as compared to iOS. My main problem here was that the four NSButtons would not slide off of the screen when the view first became active. They would slide off just fine when one clicked an answer. I determined that the issue was one of timing, between the view being created and me telling the buttons to move when they hadn’t actually been created since the view wasn’t displaying. I was right. This little snippet of code at the end of initWithNibName did the job:

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, .0625 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{

            [self moveOut:kBUTTON_ALL shouldHide:YES];

            [selfgameInitialization];

        });

After the view is created, all I do is wait approximately 600th of a second and then tell the buttons to move out & to start the game.

 

The second hurdle wasted hours of my time. I increased the font size for all of the controls on the main game view to 36pt. Everything looked good, even the sample text on the four buttons. When I ran the game, the text of the buttons were tiny again, while the rest of the controls were at 36pt font size. I tried everything I could think of, searched StackOverflow, iPhoneDevSDK, and Apple’s own developer forums to no avail. I removed the default dummy text from Interface Builder, I removed the background image of the button, changed the type of button, set the font in code (multiple ways!) using NSAttributedString, tried with setFont, accessed the NSButtonCell property directly and used setFont. I even tried telling the OS to redraw the button by calling the button’s needsDisplay method. I couldn’t change the font size nor the color. I went to the “main menu” of Biblicious and put some code in so if I pressed a button, its text color would change. It worked. I put code in to change the text color of a button if a different button was pressed. It worked, too. I ripped all of that test code out and went to Interface Builder again. I was going to check the font settings in the NSButtonCell instead of just the NSButton. I selected the cell and as I was clicking on the different property inspectors, I saw something weird: BibliciousButtonCell : NSButtonCell. What?!?! When I first started this port back in (apparently) August of 2013, I subclassed the NSButtonCell to properly manage the word-wrapping. All of my hard work was being overwritten by the code in my subclass. In particular, the line that reset the font changes I was making:

NSFont *sysFont = [NSFont systemFontOfSize:16];

To fix the problem, I changed the 16 to 36 in order to match the rest of the game interface. As you can see, the subclass still needs a little work, but at least the text is larger now. I had to get this post out while the frustration was still fresh. Learn from my mistakes. :)

First screen with large text

First screen with large text

 

Porting my app Biblicious from iOS to OS X, Part 1

We have been spoiled by UIKit. I hadn’t realized how spoiled I had become until I started to port my iOS trivia game from iOS over to OS X. One would think that since it’s all Objective-C under the hood, it would be a fairly simple task. It is not. UIKit for iOS gives us Layers automatically which are great for interface manipulation. Need to push a new view on to the screen? The UINavigationController handles that for you: “Here, show me this view. Thanks!” Using Core Animation is easier, and even more convenient thanks to the new Facebook POP Animations. My game used the basic UIKit controls on iOS and therefore, I thought doing the same on OS X would be simple.

On iOS, the user is presented with a TableView of options, one of which is to start the game. Once they choose to start the game, a Game Setup view is pushed onto the navigation stack. Since the app is a Bible trivia game, the player can choose which parts of the Bible to receive questions as well as how long of a game to play.

Since there is no concept of the UINavigationController on OS X, I had to change up the design. To make things easier on me, I have a static sized window that is the same size as the iPad screen when turned horizontally. Instead of a UINavigationController, I have NSViews created in Interface Builder that I swap out in order to update the screen. I also created a “MasterViewController” that uses delegation so child views can tell it when they are done and be popped off the “stack”.

Integrating Facebook’s POP into iOS was quite simple and I’ve taken to using it quite a bit. It really brings the interface to life. When controls slide in, they can extend past their end location slightly and bounce back simulating inertia. Pushing a button can look like it has been pressed. Also, if you want to catch the user’s eye, you can make the icon or text periodically “twitch” for example instead of throwing a modal UIAlertView in the user’s face when asking for a review. In my reading, it looked like POP was able to be used in OS X applications, but I can’t get it to work. When trying to slide an NSButton on or off my view, it crashes with an “unrecognized selector sent to instance”. I’ve made sure the QuartzCore & CoreGraphics frameworks are linked to the project but no joy. Right now I’m using the old school setFrame: method to move the controls around. (Hey, just like iPhoneOS v2!)

The other problem I’m having is that with UIKit, one can display a UIAlertView with no buttons & have it automatically dismiss after a certain amount of time. I have yet to find a solution using NSAlert with AppKit & am afraid I might have to roll my own.

Another plus with UIKit is that there are a bunch of events when a view is instantiated and about to become visible or just became visible… We have initWithNibNameviewDidLoadviewWillAppear, and viewDidAppear. Good things to know! With AppKit, the only events I seem to get are initWithNibNameawakeFromNib. On iOS my game used each of those UIKit events to perform certain actions for either continuing a game after another view was displayed such as the web view, sharing a score, multi-user score board, and the modal blocking “introduction view”. The first OS X release won’t be multi-player so I won’t need to deal with that, but I am currently having game start up issues due to lack of events.

BibliciousWelcome

Biblicious Main Screen

So far the main screen looks like this. (Click the thumbnail to get the full size.) I’d like the buttons to fly in from off the screen using POPAnimation, but again, on OS X, it’s just crashing. Once the player has chosen a single-player game or a single-player-practice game, they are taken to the game settings screen.

 

 

 

Biblicious Settings

Again, I’m just swapping out the views to show the settings screen. This is where the using can choose the number of questions and which part of the Bible to use. Clicking on the thumbnail will give you the full size image.

 

 

 

 
Biblicious Game ScreenAnd then here is the in-progress game screen. Notice the programmer “escape” button in the upper-left corner. You can also see that the text is way too small. I haven’t made a decision about the background image yet. Right now I’m just trying to get the game to function. Again, click on the thumbnail to see the full size image.

Companies that give programming challenges to new hires are doing it wrong.

I’ve been a freelance developer for 10 years. Work has been slowing down a little bit lately so I began applying for full-time telecommute or remote work to test the waters. I’m not sure what the deal is, but 99% of the companies I’ve contacted either want me in the same area as them or want me to come in to the office at least once a week. In this internet age with Google Hangouts & Skype, it seems quite antiquated to require someone to be on-site for a programming gig. I could probably go in for a few hours once a week, but my personal situation requires that I work from home. The “face to face” interviews haven’t been that great either: One interviewer didn’t like that my wife was watching TV in the other room. Another interviewer balked at my salary requirement to sustain my household. He didn’t even attempt to offer me less, he basically stated they had to get their money’s worth from their developers.

Occasionally I get to the point where a potential employee wants a code sample. Picking out a sample of code to impress someone I don’t know, stinks. Over the years as I’ve entertained full-time employment, I apparently never pick out the “right” sample of code. I can only assume something I think is interesting, isn’t to them, or they don’t like my coding style. I have no clue. They may be part of the problem… programming has always come naturally to me, so what’s cool or interesting? I started programming in the 4th grade (think 1982). I’ve done BASIC, Perl, Visual Basic, REALbasic, Pascal, Java, C, C++, Objective-C, PHP, and more. I enjoy some languages more than others, and some I don’t “do” at all. These days all of my front end stuff is done in Objective-C and back end code in PHP. For one of my iPad apps, I came up with a pretty ingenious chained menuing system for the TableView. I’ve been sending that code… maybe they just don’t understand it.

And here’s my big peeve, the so-called “programming challenge”. I’ve been told that they are not necessarily about programming… it’s about asking for help, seeing how well one works under pressure, understanding one’s thought process… blah blah blah. As someone who is consulting for a living, you potential employer, are not valuing my time. Do you think my client list is fake? How have I been in business for a decade & not able to problem solve? Who do you think made the desktop & mobile apps that I sell? Here is some information you may not realize about me… If you count hobbyist programming, I’ve been coding for 32 years. Hired directly out of college, I’ve been a professional programmer for 15 years. I’ve been running my own business for 13 years, and have been freelance consulting full-time for 10 years. I’ve been a system administrator for every current platform, I’ve been a database administrator, and I can do web programming if I have to; I don’t like it.

When I was hired directly out of college, I started out at a lower rate, with benefits, and was on a three-month probation. If I couldn’t prove myself after three months, I would be let go. After two months I was given a raise and removed from probation. That is the way to do it employers. Allow the coder learn your coding style guidelines, get to know your existing employees, and prove himself. All of your under-pressure non-real-world coding challenges suck.

Finally, here are some examples:

Please Solve this Programming Challenge:

Given a definition for data within a table structure of:

[["1","2"],["3","4","5"]]

with cellspan information represented as:

[{"1":[2,1]},{“2″:[1,3]}]

where each member of the array is a value that represents the data that spans multiple columns and the value is the cell span information [rowspan, columnspan]

The above data is equivalent to the table described in HTML as:
<table>
<tr><td rowspan=”2″>1</td><td colspan=”3″>2</td></tr>
<tr><td>3</td><td>4</td><td>5</td></tr>
</table>

Write an algorithm that will calculate the final table as a two dimensional array with empty values (null, nil, etc.) for blank spaces.


Write one’s own number formatter without using built-in functions. (20 minutes)


Your goal is to create 115 equal-width columns. The width of each column should be (Window width / 115), and the columns should dock to fill all available width. (60 minutes)

Inside each column, create 12 boxes – one for each “Box0-Box11” value in the .CSV file. The value determines the height of the box – 0.24 means that the box should take up 24% of the column height. If you add up all Box0-Box11 values, you’ll see that they add up to 1.0 (or 100%).

In addition to drawing 12 boxes inside each column, please color them according to their Box number. Box0 should be Red, Box1 should be Orange, et cetera. The actual colors don’t matter – just make sure that Box0 is the same color in every column.

 

Since there are 115 columns, and 12 boxes in each, you’re drawing a lot of objects on the screen. Your goal is to make this code as high-performance as possible, especially when the window is being resized.

And there are 2 others I can’t think of right now. What a waste.