Feb 22

For a while now, I have been puzzled by the fact that Mobile Safari, the iOS version of Safari, opened any page on my web site at a much larger width than the CSS value for the main content area (570px).

It turns out, there are a number of Apple-Specific Meta Tags that can be used to provide background information for your web page, like how to scale it, or providing scaling limits.

To set the initial scaling of a window when presented on the iPhone or iPad, there is the viewport meta tag. If missing, a default width of 960 pixels will be used, or more if the web content is wider. Setting it to 590 pixels, thus adding a 10 pixel padding, works just fine for my particular case:

<meta name="viewport" content="width:590px">
Feb 18

For years, I have had a constantly growing list of shop opening hours in my notes on my iPhone. There has never been a proper place to put them. Until now.

The Open Times iPhone app makes it simple to store all my shop opening times and it is flexible enough to handle any custom combination of when a shop opens and closes (or is open for 24 hours). Best of all, the business hours are presented graphically in a calendar-like view which is an intuitive way to check which of the shops are currently open or closed.

Now that I have entered my data into the app, I have confidently deleted that long entry from my notebook. Success!

Feb 14

phpMyAdmin

Security Comments Off

I see from my web-server log that people like to guess the path to phpMyAdmin in all different variations, colours, shapes and sizes. Now, this is exactly why I have not installed it in a fashion that makes it visible to anyone other than me. Better yet, come to think of it, I have not installed it at all and I don’t think I ever will. But if I do, you should probably search for all variations, colours, shapes and sizes of phpMyNeatlyStashedAwayAndHiddenInstallationOfMyAdmin.

Jan 16

Wasted a couple of hours debugging an issue with the use of a custom font on a UILabel; the text simply wouldn’t show up on the iPhone Simulator.

No such problems with the (bold) system fonts of any size.

As it turned out, this is an issue (bug) with the iPhone Simulator; when running it on a device, the label is shown correctly.

Also note that there is a “fonts” app that show all the fonts that are available on the iPhone or iPad.

Dec 16

I have been wondering how to get any pictures onto the iPhone simulator for ages and have thought one would need to sync it with iTunes.

But no, I stumbled over the solution by accident: One simply uses Safari on the iPhone Simulator to navigate to an image and the uses the built-in controls to save it.

Hint: to navigate to an image that you have open in your browser on your desktop, simply drag and drop the image (or the URL) to the iPhone Simulator. The same works for any image in the Finder!

Dec 03

While it is convenient to add applications to the Login Items* list, it is also annoying when it takes ages for all of them to launch before you can do any meaningful work.

(*) In the Settings applications, select Accounts, your account and then the Login Items tab.

It occurred to me that one or the other application does not need to be available at login, but it would be nice to load it later. For instance, I don’t use Skype during the day, but more in the evenings to contact my friends. So how about launching Skype at 5 p.m.?

The following launchd specification will do exactly that: launch Skype at 5 p.m. (or when not possible, whenever you log in next time):

<?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">
<dict>
        <key>Label</key>
        <string>com.skype.skype</string>
        <key>ProgramArguments</key>
        <array>
                <string>/usr/bin/open</string>
                <string>/Applications/Skype.app</string>
        </array>
        <key>StartCalendarInterval</key>
        <dict>
                <key>Minute</key>
                <integer>0</integer>
                <key>Hour</key>
                <integer>17</integer>
        </dict>
</dict>
</plist>

Save this file as ~/Library/LaunchAgents/com.skype.skype.plist (note that the Label must correspond to the file name) and wait for magic to happen when you log in next time…

Sep 29

After having spent half an hour looking for a drawing program for vector graphics on the Mac, it occurred to me that I already had one: Keynote.

Obviously, it is aimed at creating stunning presentations, but there is no reason why it cannot be used for any other kind of drawing. When finished, a drawing can be exported as an image file (JPEG, PNG, or TIFF) or simply grabbed from the screen with a screen shot (just use shift-cmd-4 and draw a rectangle).

Keynote is part of Apple’s iWork office suite ($79) but it is now also available separately from the Mac App Store ($20). This price compares well to other graphics applications like OmniGraffle (standard $100, pro $200).

May 04

Trying to update Xcode 4.0.1 from within the Mac AppStore application, I was greeted with this error message:

You have updates available for other accounts
Sign in to (null) to update applications for that account.

There exist numerous forum entries on Apple’s discussion board on that subject and the recommended solution is to trash the “Install Xcode” application and then to re-launch the AppStore, selecting to re-install Xcode.

I trashed “Install Xcode” but AppStore produced the same message. Relaunched one additional time and it allowed me to update (note: not install). However, when it was finished, there was no new “Install Xcode” in the Applications folder!

It turns out, the AppStore had located and updated a different copy of the software on a separate drive where I had made a backup, even though I had renamed it to “Install Xcode-4.0.1″. Its info window revealed that it had been modified and that its version number now was 4.0.2.

Installation from that modified backup worked correctly.

The old backup could be restored from the version that I had put into the trash.

Feb 14

Compiling an application for the MacOX10.4u SDK (with Xcode 3.2.4, GCC 4.2.1) results in this linker warning:

ld: warning: object file compiled with -mlong-branch which is no longer needed. To remove this warning, recompile without -mlong-branch: /Developer/SDKs/MacOSX10.4u.sdk/usr/lib/crt1.o

This is not a critical issue and can be ignored. However, it can also be fixed as shown by an answer from Bernhard Baehr on lists.apple.com:

What needs to be done is to recompile the Csu package which can be found on Apple’s opensource archive, e.g. the one for 10.4.11 x86 where the -mlong_branch flag has already been removed:
http://www.opensource.apple.com/release/mac-os-x-10411×86/
http://www.opensource.apple.com/tarballs/Csu/Csu-71.tar.gz

Then it’s just a question of recompiling it:

cd ~/Downloads
tar zxvf Csu-71.tar.gz
cd Csu-71
make RC_ARCHS="ppc ppc64 i386 x86_64"

Then we can replace the (stripped) object file in the SDK:

cd /Developer/SDKs/MacOSX10.4u.sdk/usr/lib/
sudo mv crt1.o{,.org}
sudo strip -S ~/Downloads/Csu-71/crt1.o -o crt1.o
sudo chmod 644 crt1.o
Dec 24

Added this blog post to get that piece of scrap paper off my desk and also to remember these tips by means of typing them in.

apples oranges
Search for pages with both apples and oranges.
apples OR oranges -worms
Either or, not others.
“candied apples”
Exact phrase.
+fruit filetype:ppt
Only the exact word, in PowerPoint presentations.
~fruit site:meals.com
Include synonyms, but only on that site.
define:egoism
Search after definitions.
BMW 318…328
Search for ranges, e.g. not the bad 316 model.
link:macworld.com
Search after sites linking to macworld.com.
info:www.apple.com/se
Show information about apple.se.
related:cdon.com
Search for similar sites.
mac*
All words beginning with mac, e.g. macworld, macintosh
ARN BSL
Search for routes between airports.
Harry Potter
For books with harry potter, select the book icon.
stocks:AAPL
Stock information.
weather Stockholm
Search for weather information.
time Cupertino
Get the current time for other places.
sunrise Kuusamo
Get the sunrise times, try also “sunset”.
5*9+(sqrt 10)^3=
Evaluate calculations.
10.5 cm in inches
Unit conversions.
66 GBP in EUR
Currency conversions.
Shakespeare wrote *
Let Google fill in the blanks.

P.S. Of course, Google has its own help page on this topic.