Skip to content

A Short story by Heinrich Böll

An American businessman was standing at the pier of a small coastal Mexican village when a small boat with just one fisherman docked. Inside the small boat were several large yellowfin tuna. The American complimented the Mexican on the quality of his fish.
“How long it took you to catch them?” The American asked.
“Only a little while.” The Mexican replied.
“Why don’t you stay out longer and catch more fish?” The American then asked.
“I have enough to support my family’s immediate needs.” The Mexican said.
“But,” The American then asked, “What do you do with the rest of your time?”
The Mexican fisherman said, “I sleep late, fish a little, play with my children, take a siesta with my wife, Maria, stroll into the village each evening where I sip wine and play guitar with my amigos, I have a full and busy life, senor.”
The American scoffed, “I am a Harvard MBA and could help you. You should spend more time fishing and with the proceeds you buy a bigger boat, and with the proceeds from the bigger boat you could buy several boats, eventually you would have a fleet of fishing boats.”
“Instead of selling your catch to a middleman you would sell directly to the consumers, eventually opening your own can factory. You would control the product, processing and distribution. You would need to leave this small coastal fishing village and move to Mexico City, then LA and eventually NYC where you will run your expanding enterprise.”
The Mexican fisherman asked, “But senor, how long will this all take?”
To which the American replied, “15-20 years.”
“But what then, senor?”
The American laughed and said, “That’s the best part. When the time is right you would announce an IPO (Initial Public Offering) and sell your company stock to the public and become very rich, you would make millions.”
“Millions, senor? Then what?”
The American said slowly, “Then you would retire. Move to a small coastal fishing village where you would sleep late, fish a little, play with your kids, take a siesta with your wife, stroll to the village in the evenings where you could sip wine and play your guitar with your amigos…”

Don’t hunt for things you already have!

Programmatically show Mail settings in iOS

MFMailComposerViewController can’t handle a device without a mail account defined, a easy and nice way to get around it is to do like this:

if ([MFMailComposeViewController canSendMail])
  MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];
  mailController.mailComposeDelegate = (id<MFMailComposeViewControllerDelegate>) self;
  [mailController setMessageBody:@"Test Mail" isHTML:YES];
  [self presentModalViewController:mailController animated:YES];
  NSString *bodyText = @"Test Mail";
  NSURL *url = [[NSURL alloc] initWithString:[NSString stringWithFormat:@"mailto:?", 
      [bodyText stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]]];

  [[UIApplication sharedApplication] openURL:url];

By using the “mailto:” url, we can open the mail app and it will show the settings view where the user can add a account, and by specifying body (we can also specify subject) text we get a nice pre-filed in email ready to be sent.

Visual merge with Git on Mac OS X

Mac developer tools have a tool include called FileMerge + a command line based tool called opendiff to invoke it, to use this tool in Git, run this command:

git config --global merge.tool opendiff

then when you want to do a merge you can just use the command:

git mergetool

Easy and simple, the things you learn! :-)

War. War never changes.

War. War never changes. The end of the internet occurred pretty much as we had predicted. Too many legislations, not enough freedom or resources to go around.
The details are trivial and pointless. The reasons, as always, purely human ones. The internet was nearly wiped clean of life.
A great cleansing, a censoring spark struck by human hands, quickly raged out of control.
Spears of deletions fire rained from the DNS servers, entire domains were swallowed in flames and fell beneath the thriving redirects.
Freedom of speech was almost extinguished, their voice becoming part of the background noise that blanketed the internet.
A quite darkness fell across the tubes, lasting many years.
(Overheard on the intertubes)

Static (Read-only) text in Settings Bundle

Since I couldn’t find this anywhere else I will write it here on my blog, to add a static (read-only) text to the Settings Bundle add this to the plist (easiest using the source code editor).

<span style="font-family: monospace;">&lt;dict&gt;</span>
<span style="font-family: monospace;">&lt;key&gt;Key&lt;/key&gt;</span>
<span style="font-family: monospace;">&lt;string&gt;version_preference&lt;/string&gt;</span>
<span style="font-family: monospace;">&lt;key&gt;Type&lt;/key&gt;</span>
<span style="font-family: monospace;">&lt;string&gt;PSTitleValueSpecifier&lt;/string&gt;</span>
<span style="font-family: monospace;">&lt;key&gt;DefaultValue&lt;/key&gt;</span>
<span style="font-family: monospace;">&lt;string&gt;0.1&lt;/string&gt;</span>
<span style="font-family: monospace;">&lt;key&gt;Title&lt;/key&gt;</span>
<span style="font-family: monospace;">&lt;string&gt;Version&lt;/string&gt;</span>
<span style="font-family: monospace;">&lt;/dict&gt;</span>

Checking if preferences exists on iOS

If you have a settings bundle in your application, this is a good way to check if you can access them, if not you can set the default values for the preferences.

id testPreference = [[NSUserDefaults standardUserDefaults] objectForKey:@"sync_preference"];
if (testPreference == nil)
   [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"sync_preference"];

Translucent navigationBar with a UITableView

When using a translucent navigation bar, the content of the table gets “below” it, to fix the problem use this line of code.

tableview.contentInset = UIEdgeInsetsMake(navigationController.navigationBar.frame.size.height, 0,0,0);

It’s almost like magic, now the content of the table will not be “below” the translucent navigation bar.

Testing my new iPhone

Just a test of my new iPhone.

Why talk to a computer? Surely talking to a human is traumatic enough?

“A scientist sees a sliding door on the USS Enterprise, gets excited, tries to recreate one in reality, and before you know it you can’t even enter your local Tesco without passing through at least two of the bastards. This phenomenon also explains the invention of Laser Quest, the iPad and Soylent Green flavour Pringles.”

From a funny article in the Guardian:

Glad Midsommar (Happy Midsummer)

Happy Midsummer (or Glad Midsommar for the Swedish speaking) I hope it’s not going to rain to much this weekend.