2013 in review

The WordPress.com stats helper monkeys prepared a 2013 annual report for this blog.

Here’s an excerpt:

The concert hall at the Sydney Opera House holds 2,700 people. This blog was viewed about 12,000 times in 2013. If it were a concert at Sydney Opera House, it would take about 4 sold-out performances for that many people to see it.

Click here to see the complete report.

Advertisements
Posted in Uncategorized

Command line conversion of svg to png

Inkscape SVG plain

Here’s a little gem when you install Inkscape:

/Applications/Inkscape.app/Contents/Resources/bin/inkscape –export-png output.png -w 100 -h 100 noun_project_9206.svg

Tagged with: , , , , , , , , , , , ,
Posted in Code, Misc

Autobuild numbers in Xcode4

In Xcode 4 look in the Navigator pane, which is the pane on the left side of the Xcode screen. It has 7 icons across the top. Select the left-most icon (looks like a file folder) to get the Project Navigator pane.

Now click on the first item in that pane, which is the project itself. That opens a big window in the center with a narrow column to the left of it.

The narrow column has 2 sections: “PROJECT” AND “TARGETS”. Click on your project name in the “TARGETS” section. Now the center pane has 5 tabs along the top: “Summary”, “Info”, “Build Settings”, “Build Phases”, and “Build Rules”.

Click on the “Build Phases” tab. If your config is the same as mine you’ll now see 4 sections in the main window: “Target Dependencies”, “Copy Bundle Resources”, “Compile Sources”, and “Link…”. Click on “Add Build Phase” (at the lower right corner) and choose “Add Run Script”. A 5th section now appears in the center pane with the title “Run Script”. Drag the “Run Script” section up so it is the 2nd section from the top, just below “Target Dependencies”.

Now click on the disclosure triangle for the Run Script section. That opens a window where you can put a script. Copy and paste the following script into that window.

#!/bin/bash    
bN=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE")
bN=$((0x$bN)) 
bN=$(($bN + 1)) 
bN=$(printf "%d" $bN)
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $bN" "$INFOPLIST_FILE"

Be sure that “Run script only when installing” is NOT CHECKED.

That’s it! Now your build number auto-increments every time you build your project.

This script assumes you have a decimal build number in your Info.plist file and increments it as hex. The build number appears in Info.plist as “Bundle version”. The script doesn’t work if the build number is missing so be sure to enter a starting value. To enter a starting value go to the “Summary” tab in the same center pane you were using above and enter “1” (or whatever value you like) into the “Build” box (but not a formatted string like 1.0).

Tagged with: , , ,
Posted in Uncategorized

Splitview side bar hiding

So you have this splitview but you don’t want to show it all the time in landscape, but Apple never explained how to do that. Let’s make up on that:

First add some button logic in the app delegate:

– (IBAction)toggleSplitView:(id)sender {

    if ( [window.subviews containsObject:splitViewController.view] ) {

        [splitViewController.view removeFromSuperview];

        splitViewController.viewControllers = [NSArray arrayWithObjects:leftViewController, leftViewController, nil]; 

        [window addSubview:rightViewController.view];

        [(UIBarButtonItem *)sender setTitle:@”Show Sidebar”];

    } else {

        [rightViewController.view removeFromSuperview];

        [rightViewController.view setTransform:CGAffineTransformIdentity];

        [navigationController popToRootViewControllerAnimated:NO]; // make sure we are on top

        [navigationController setViewControllers:[NSArray arrayWithObject: leftViewController]];

        splitViewController.viewControllers = [NSArray arrayWithObjects:navigationController, rightViewController, nil]; 

        [window addSubview:splitViewController.view];

        [rightViewController.view sizeToFit];

        [(UIBarButtonItem *)sender setTitle:@”Hide Sidebar”];

    }

}

 

In the controller that handles your right view (detail) add a item:

    UIBarItem *toggleSidebar;

@property (nonatomic, retain) IBOutlet UIBarItem *toggleSidebar;

Insert the control when the controller is triggered during hide and show:

– (void)splitViewController: (UISplitViewController*)svc willShowViewController:(UIViewController *)aViewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem {

    NSMutableArray *items = [[toolbar items] mutableCopy];

    [items removeObjectAtIndex:0];

    [items insertObject:toggleSidebar atIndex:0]; // add additional control for hiding

    [toolbar setItems:items animated:YES];

    [items release];

    self.popoverController = nil;

}

Add a button in the load view that triggers the AppDelegate:

    toggleSidebar = [[UIBarButtonItem alloc] initWithTitle:@”Hide sidebar”

                                                     style:UIBarButtonItemStyleBordered 

                                                    target: [self appDelegate]

                                                    action:@selector(toggleSplitView:)];

And don’t forget to put in in the toolbar 🙂

    [items insertObject:toggleSidebar atIndex:0];

// set the bar

    [toolbar setItems:items animated:YES];

Oh and hide it in the willHideController

Dealoc it when done:

– (void)dealloc {

    [popoverController release];

    [toolbar release];

    [toggleSidebar release];

    [super dealloc];

}

 

Posted in Uncategorized

Dagbani Proverb

Ghana - Trees Ghana Samsam Odumase community f...

Image by treesftf via Flickr

I’m brushing up my dagbani, here’s what I’ve learned today: Read more ›

Tagged with: , ,
Posted in Ghana

Vulcan child logic

Vulcan child?

This night I was putting my son (3) to bed and asked him if he was given his vitamins by his mother, he assured me that this was not the case. Knowing his appetite for the tablets I told him it was vital he told me the truth since eating four additional tablets would make his nose fall off. To which he replied: “in that case I’ll have three”.

I guess he has his mothers sense of bargaining and his fathers sense of humor 🙂

Tagged with: ,
Posted in Family

Outlook .pst to .mbox conversion

An Outlook express icon that I made from scrat...

Image via Wikipedia

You will probably have followed a zillion links before you got to this page and the only reason I am blogging about it is because most of these links will provide you with useless information or point you to software which will only export the first few files.

If you, like I, have collected thousands of emails in your trusted .pst folders on Microsoft Outlook and you (like I) are moving to another platform such as Apple, you will quickly notice that taking your mail with you is not such an easy thing. Read more ›

Tagged with: , , ,
Posted in Misc
Categories