After upgrading to iOS 4.0 SDK, iPhone OS 3.0 is no longer a valid “Base SDK”. Naively switching to iPhone 3.2 prevents deployment to a 3.0 device.
But such “Project -> Edit Project Settings” work out fine:
After upgrading to iOS 4.0 SDK, iPhone OS 3.0 is no longer a valid “Base SDK”. Naively switching to iPhone 3.2 prevents deployment to a 3.0 device.
But such “Project -> Edit Project Settings” work out fine:
just downloaded and installed the iOS 4 SDK and as my root OS X partition is rather (too) small, I put it into a custom location /Users/Developer.Snowleopard/.
This causes the iPhone Simulator to crash and compiling gives an error like:
ibtool failed with exception: Interface Builder encountered an error communicating with the iPhone Simulator. If you choose to file a crash report or radar for this issue, please check Console.app for crash reports for "Interface Builder Cocoa Touch Tool" and include their content in your crash report. ... dyld: Library not loaded: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib Referenced from: /Users/Developer.SnowLeopard/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib Reason: image not found
The cure – a softlink:
$ ln -s /Users/Developer.SnowLeopard/Platforms /Developer/Platforms
when developing for long-term use, you want to use APIs that aren’t likely to be removed soon, a.k.a. “deprecated”.
So, don’t use downward compatible calls below a point you really aim for.
XCode helps with compiler warnings about “deprecated” calls – if “Project -> Edit Project Settings -> GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS” is set:
But be careful, this complains e.g. here only once while initWithFrame: is also deprecated (compiling for iPhone OS 3.0):
As Kevin Ballard pointed out at Stackoverflow, this is because [AnyClass alloc] returns a type id – which doesn’t know about it’s interface.
To get this kind of compiler warnings, you have to type-cast the [AnyClass alloc] like this:
[(AnyClass*)[AnyClass alloc] initXY];
Maybe time for a macro?
The macro could look like
// http://blog.mro.name/2010/06/xcode-missing-deprecated-warnings/ #define alloc(c) ((c*)[c alloc])
Migrate your codebase via XCode “Edit -> Find in Project” with search pattern \[\s*([^\[\]]+)\s+alloc\s*\] and replacement pattern alloc(\1).
sometimes you may want to lock down RESTful APIs or plain HTTP GET resources for authorised access by your own client software only, without requiring authentication. You don’t know who (not authenticated), but you know she may access (is authorised).
If the server has a valid SSL certificate based on a root certificate pre-installed on the iPhone among the simplest ways to do it are:
.htaccess configuration setting and you’re done..htaccess rewrite setting required:
RewriteEngine On
RewriteCond %{HTTP:My-Secret-Token} !=WRdsWXwwTZjEIRrgD5tODVf0U
RewriteRule ^.*$ - [forbidden,last]
# Test: $ curl --header "My-Secret-Token:WRdsWXwwTZjEIRrgD5tODVf0U" http://myserver.example.com/demo/Decompiling an App may raise the bar high enough though hard-coded secrets surely aren’t bulletproof Secret Service grade quality. If you don’t want the password or secret token as literal string inside the App, synthesize it at runtime.
If your transport channel isn’t confidential (e.g. plain HTTP, not HTTPS) you might think about Digest Authentication or a custom implemented CRAMish mechanism which I will not go into in this post.
after failing and failing again in the last months, I finally got it with the help of http://www.debian-administration.org/articles/137
The .htaccess configuration
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/javascript
requires Apache’s mod_deflate enabled via
$ a2enmod deflate Module deflate installed; run /etc/init.d/apache2 force-reload to enable.
Check the result with http://www.gidnetwork.com/tools/gzip-test.php
Caution: There seems to be an If-Modified-Since/Last-Modified HTTP 304 bug in mod_deflate, so better don’t use it for large, rarely changing files.
Having a validating parser in place can reduce the required code to parse XML a lot – you know very well what you actually get. As mentioned in my last post about RELAX NG & trang, I prefer RELAX NG over W3C XML Schema – which doesn’t matter anyway because Apple’s suggested XML parser doesn’t validate at all.
So we have to go one level deeper and have a look at libxml2.
Apple’s example “XmlPerformance” helped to get started, but didn’t do the trick because libxml2 allows validation for xmlDocPtr or xmlTextReader but not for SAX parsers as used in the example.
The libxml2 examples didn’t help me too much either, but luckily there’s xmllint available in source (OSS just rocks) which does almost what we want. It first parses the XML into a xmlDocPtr and validates afterwards – and it does so for a reason:
You can have a validating xmlTextReader (via xmlTextReaderRelaxNGSetSchema), but it won’t detect IDREFs missing their referred to ID and the error messages lack the name of the failing item. BTW – when validating against a W3C schema this ID/IDREF check isn’t available yet.
I finally discarded streaming XML parsing in favour of validation and “push” parsing (nice for data coming in over the wire) and did:
relaxngschemas) – similar to xmllint schema loading,xmlDocPtr (xmlCreatePushParserCtxt) exactly like xmllint,xmlRelaxNGValidateDoc),xmlTextReader,Wrap up:
xmlTextReader if you want a SAXish programming model.I may prepare and publish a MroLibxml2Parser inheriting NSXMLParser and firing it’s callbacks in order to easily switch validating and non-validating parser implementations, but this has to wait a bit. Stay tuned.
e.g. when handling RESTful APIs you may want to validate the response XML – a custom one in most cases.
I typically use tools already installed on every Mac and fire a http GET request with curl and immediately check it with xmllint like
$ curl http://www.heise.de/newsticker/heise-atom.xml | xmllint --format --schema myschema.xsd -
But I just don’t like to create and edit W3C XML Schemas – the notorious angle brackets hurt my eyes and the redundant element names hide the real stuff in tons of ever same text. Neither do I like to click through graphical schema editors and getting lost hunting for hidden settings and property dialogs.
A minimal and naive schema validating the above example Atom feed (and simply created from the feed itself with trang, see below) as W3C Schema looks like this:
Here comes in RELAX NG, especially it’s “compact form“, which is just what I like – a concise, BNF-ish syntax. It was designed by Murata Makoto and James Clark, Technical Lead of the XML Working Group back when XML was created and father of the famous expat parser.
The very same schema as above as RELAX NG boils down to ½ the lines and about ⅓ of the characters without a single angle bracket:
default namespace = "http://www.w3.org/2005/Atom"
start =
element feed {
title,
element subtitle { text },
link+,
updated,
element author {
element name { text }
},
id,
element entry { title, link, id, updated }+
}
title = element title { text }
link =
element link {
attribute href { xsd:anyURI },
attribute rel { xsd:NCName }?
}
updated = element updated { xsd:dateTime }
id = element id { xsd:anyURI }And as libxml2 and therefore xmllint supports RELAX NG, you can use the regular syntax to validate like in the beginning, but with a much more editable schema:
$ curl http://www.heise.de/newsticker/heise-atom.xml | xmllint --format --relaxng myschema.rng -
is a schema converter for RELAX NG written in Java which I wrapped inside a bash script:
#!/bin/sh java -jar `dirname $0`/trang-20090818/trang.jar $@
Writing a new schema from scratch can be much more convenient if you have a bunch of XML files you can feed into trang:
$ trang *.xml myschema.rnc
then refine the resulting schema in compact form and finally turn it into the regular form:
$ trang myschema.rnc myschema.rng
Trang also serves me as a schema indenter by converting from compact to regular and back.
BUT: trang converts RELAX NG into W3C but not vice versa.
Validating XML documents shouldn’t stop with elements and attributes but rather leverage XML Schema Datatypes and apply e.g. regular expressions
element uuid {
xsd:string {
## A UUID
pattern =
"[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"
}
}or range constraints
element year {
xsd:unsignedShort { minInclusive = "1900" maxInclusive = "2100" }
}P.S.: For a more complete Atom RELAX NG schema see here or ask your search engine of choice.
as I didn’t get TidyService to work correctly with UTF8 umlauts, I created a UNIX Shell Script wrapper for html tidy as it comes with OS X that does the job at least for TextWrangler:

#!/bin/sh # run "tidy" on the file given as 1st (and only) parameter. # /usr/bin/tidy -utf8 -asxhtml -indent -wrap 100 -quiet "$1" 2> /dev/null
tidy on files opened in TextWrangler, even remote files.
auf Wohnungssuche begegnet man lustigen Sachen. Da war dieses extrem billige Angebot (2 Zi, 80m² für 550€) mit spannender Adresse, aber fragen kostet ja nix.
Die erste Mail der Anbieterin war dann:
Hi,
Thanks for your interest. The apartment is still available. I moved recently with my job in London, United Kingdom, but the rent is high here, I decided to offer to rent the apartment I have in Munchen . I rented the apartment for maximum 10 years … This is the period that I have a contract here, but I can rent it for a shorter period also. I own the ground and is exactly as in the photos. The rent for 1 month is 550 EUR and does not include all the utilities you (water, electricity, Internet, cable). You can enter the apartment on the same day when receiving the keys .. The only problem is that i had to move with my job to United Kingdom, London where i am now and i left the keys and contract already signed by me at a company called Rent.com and they will handle the payment and delivery for us. If you want to know more about how this deal can work please get back to me ASAP and i will send you the details step by step. Thank you and hope to hear back from you.
My German is limited at just a few words so i wish a lot to continue our conversation in English.
dann ging’s 2x per Mail hin und her,
Hello,
If we decide to proceed with this transaction, I will have to contact Rent.com and provide them all the necessary information, so they can start the process right away. I will need your full name and address for that. You will receive a notification from Rent.com shortly after that, together with all the instructions to follow and the invoice as well.
Regarding the payment, you will be instructed to deposit the money to a Rent.com account. They will hold and insure your money until you check the apartment and decide if you want take it or not. That is how their buyer protection policy works. As far as my concerns, I will be glad to know that Rent.com has the possession of the money during the delivery period. That is my insurance.
As soon as the funds have been deposited into their account, they will immediately start the shipping process.
The keys and rental contract will be delivered at your address in no more than 3 working days. You will be given a ten days inspection period from the day you receive the keys and contract at home. If you decide to hold the apartment, then you will have to authorize Rent.com to release the funds to me, and the transaction will be completed. If you will not be satisfied with the apartment, you will be able to send the keys and contract back through the same service and ask Rent.com to return the funds to you.
Through I am sure you will love the apartment, it is good to know that you do have this second option available. If you wish to proceed with renting the apartment, please provide me your full name and address so I can initiate the deal through Rent.com right away.
I am looking forward to hearing from you.
Regards,
die Anbieterin wollte nicht anrufen aber eine Zahlungsanweisung kam, die mich dann richtig stutizg machte, weil



Nach meiner Frage nach dem Namen des Hausmeisters war dann Funkstille in London.
Zu guter letzt hat mich Immoscout24 heute nochmal per Mail vor Betrügern gewarnt.
ojeoje, ist das so abseitig oder hab’ ich’s nicht verstanden? War jedenfalls komplizierter als erwartet:
mailserver_* Zeilen in der Tabelle wordpress_options,fertig. Aber wieso so kompliziert?