Spell checkers should still work in other countries, shouldn’t they?

The rechargeable battery for my Dell Axim X51V was looking a bit puffy, so I ordered a replacement battery pack off of Amazon.

Batteyr Pack

Batteyr Pack

BTW, happy birthday to Niecy Nash. Tempestt is doing ok, but we miss the special energy and chemistry you had with your co-hosts.

Cool baseball app

It’s about time that somebody did something awesome with the retrosheet data…

Pennant for iPad (link removed, app is no longer available)

I wish I had an iPad.

BTW, happy birthday to Joel Hodgson, one of the true geniuses of our time.

OK, you may have had a tough coach at some point growing up, but you have to let it go…

A co-worker found this nice little nugget in one of our sports web site applications:

Dim isAssHeadCoach As Boolean = Session("IsAssHeadCoach")

I hope it is meant to check for an assistant or associate head coach.

Code 39

Did you ever get the dreaded “Windows cannot load the device driver for this hardware. The driver may be corrupted or missing. (Code 39)” message in your Device Manager for your DVD/CD-ROM drive?

This happened to a computer here at our office, and it did this for both the internal drive and for an external USB drive that we hooked up to it as well.

Well, to solve the problem, we found this link and ran a neat little automated program from Microsoft that went in and fixed up the drivers for both the internal and external drives.

Your CD or DVD drive can’t read or write media

Very cool. This was way easier than some of the other solutions that we were seeing.

Compound comparison in a LINQ join statement

I’ve been doing pretty much iPhone only postings recently, so this might change it up a bit.

So I am trying to go into our web application’s C# code to make some changes to the administration area of the web site.  (This is usually the only place I feel comfortable making changes, as this is not an area that customers actually use.)  We have a page that uses a store procedure to pull data from our SQL Server database and presents it on the page.

I needed to get more information out of the database than the store procedure was giving me, and I didn’t feel like modifying the procedure and then trying to rebuild the DBML, so I decided to convert it to a LINQ statement and bind to that instead of binding to the results of the stored procedure.

These things never go as planned.  I took a similar LINQ statement that I found in the application, but it did not do exactly what I wanted to do.  Basically, the LINQ statement I found used a simple comparison.  I needed to check for two different things in my comparison, so after a bit of research and trial and error, here is what I came up with:

var p = (from ord in dc.orders
    join ordSt in dc.orderStatus on 
        new { ord.orderID, b = true } equals new { ordSt.orderID, b = ordSt.isDeleted }
    where ord.customerID == custID
    select
        new { ord.orderID, ordSt.deletionDate } );

I had to add the little “b = true” and “b = ordSt.isDeleted” parts because it would not let me use just the “true” in the comparison.  Ah, isn’t it great that LINQ is so simple?

Double tap a table view cell on a UITableViewController

So I have one of those nifty UITableViewController views in my application, and since the app is now starting to get a bit more complex, I wanted to have a quick way to be able to do multiple things with a cell from that view.  Unfortunately, if you use the UITableViewCellStyleDefault style to create your cell, there is not much you can do with it, other than to have an accessory type.  This is how I started using the cells, allowing the user to set a cell to be selected or not selected (setting the cell accessoryType to UITableViewCellAccessoryCheckmark or UITableViewCellAccessoryNone).

In order to perform a different function on the cell, I figured that it couldn’t be too hard to allow the user to double tap the cell to do something other than turn the check mark off and on again or vice versa.  As per usual with the iPhone platform, it took a bit of digging.

At first, I thought I could use a UIGestureRecognizer to detect the double tap.  Unfortunately, our apps are still trying to support 3.1.3 OS users, and the UIGestureRecognizer requires 3.2.

So with a bit more digging, I found a solution on Stack Overflow that I “borrowed”.  Unfortunately, that code was a bit rough and required some minor tweaks and fixes, so here below is how to do this.

First, you need to make sure to add the necessary ivars to your class header file:

int tapCount, tappedRow, doubleTapRow;

Then, here is the code that you will need in your implementation file.  Those of you familiar with the UITableViewDelegate will see something familiar and something to extend it.

#pragma mark -
#pragma mark Table view delegate
 
- (void)tapTimerFired:(NSTimer *)aTimer
{
    // timer fired, there was a single tap on indexPath.row = tappedRow
 
    // do something here with tappedRow
 
    [cell setSelected:NO animated:YES];  // maybe, maybe not
 
    if (tapTimer != nil)
    {
        tapCount = 0;
        tappedRow = -1;
    }
}
 
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
 
    // checking for double taps here
    if (tapCount == 1 && tapTimer != nil && tappedRow == indexPath.row)
    {
        // double tap - Put your double tap code here
        [tapTimer invalidate];
        tapTimer = nil;
 
        //NSLog(@"double tapped the cell");
        doubleTapRow = tappedRow;
 
        [cell setSelected:NO animated:YES];  // maybe, maybe not
 
        // do something here with doubleTapRow
 
        tapCount = 0;
        tappedRow = -1;
    }
    else if (tapCount == 0)
    {
        // This is the first tap. If there is no tap till tapTimer is fired, it is a single tap
        tapCount = 1;
        tappedRow = indexPath.row;
        tapTimer = [NSTimer scheduledTimerWithTimeInterval:0.2 target:self 
                selector:@selector(tapTimerFired:) 
                userInfo:nil repeats:NO];
    }
    else if (tappedRow != indexPath.row)
    {
        // tap on new row
        tapCount = 0;
        if (tapTimer != nil)
        {
            [tapTimer invalidate];
            tapTimer = nil;
        }
    }
}

As it says in the code, you may or may not want to turn off the cell selection, it is up to you whether you need to do that or not. Also, you may want to play around with the time factor where the tapTimer is created if it does not work as well as you would like.

Missing GCC 4.2 options in Xcode Build tab

I was missing some GCC 4.2 options (such as a nice way to do some preprocessor definitions) in an older project of mine, and I knew that I had done something similar on a newer project.

As it turns out, for some reason it seems to put these options back in the Project Info window if you change your Code Signing Identity option.  I changed it (and the Any iOS option below it) to a different profile, then changed them back to iPhone Developer, and the missing options suddenly appeared in my older project.

Here is a link to the Stack Overflow question and answer:

Missing GCC 4.2 options in Project Info / Build tab in Xcode 3.2.5

By the way, Happy New Year everyone.  I hope you all had a nice 2010 holiday season.

Rejection

It had to happen sooner or later.  The dreaded red light of rejection descended on one of my new application submissions.

They got me on the old “App Store Review Guidelines, Metadata section, 3.5: Small and large app icons should be similar, so as to not to cause confusion” gambit. (By the way, there is no need to read that twice, the seemingly grammatically incorrect wording above is straight from the e-mail I received as well as being on the App Store Review Guidelines web site. Go to https://developer.apple.com/appstore/resources/approval/guidelines.html to see for yourself after you have logged into your developer account.)

It is true, the 57×57 icons I used for the two applications were not just scaled down versions of the 512×512 images that I put on iTunes Connect, I wanted to use smaller images for the app icons, and scaling them up would have made for a couple of messy images for the iTunes App Store.

Strangely enough, I submitted these two similar applications at the same time, and the other one managed to make it through, despite the fact that the application’s 57×57 icon was not very similar to the 512×512 icon I uploaded to iTunes Connect.

Oh well. The offending app has been resubmitted, hopefully it will get approved before they take the Christmas break.

More iPhone code signing issues

Here’s a little nugget that I just learned about code signing your iPhone app that I probably was able to get around before by the  bumble-around-trying-everything-under-the-sun-before-stumbling-on-the-right-combination method.

Your build settings in the Target override your build settings in the project.

This is obvious to me now looking back at it, but I am very nearly 100% sure that this was tripping me up on the previous projects that I have tried to submit to the App Store.

It probably says this somewhere in the Apple documentation, but I am too tired to look for it to verify that it is in there.  Now if I can just get the UIAutomation tool in Instruments doing what I need it to do.  I used to remove the logElementTree function out of the js file after I figured out how deep something was buried in the hierarchy, but I got tired of retyping it so I just leave the line in there now and just move it down to the next block of new functionality I am trying to exercise.

Moving a SQLite database from device to simulator

I was working with my app on the device, and had built up some data that I wanted to get over to the simulator. Being the lazy developer that I am, I thought for sure that there should be a way to do this, and lo and behold, there is indeed.

To get the file from your device, open the Organizer window in Xcode, select your device from the left hand panel under Devices, and then find your application in the main part of the Organizer window under Applications. If you click the arrow next to your application, there should be an Application Data item that appears, and there is a down pointing arrow to the right. Click this arrow, and it will ask you to save the files from the device to a folder somewhere on your Mac hard drive.

Inside of this folder, you will see a Documents folder, and you should see your SQLite file there. You can then copy this file to the appropriate area for your simulator, which for me is:

~/Library/Application Support/iPhone Simulator/4.2/Applications/Your_application_UUID_here/Documents

After I copied the SQLite file to this location, I fired up the simulator, and all my data was there. Nice!