While discussing mobile web frustrations with Rob, we hit on an idea to reclaim a few pixels for sites that we visit regularly enough to have added them to our device’s home screen.
Having been working a lot with HTML 5 for mobile app development recently (which Rocks, with a capital ‘R’) I suggested that we recycle Rob’s home screen icon injecting bookmarklet to add Apple’s web app meta tag to the document’s head, so that a site could be forced to run ‘full screen’ when added to your device’s home screen… Simple but effective!
Here’s the code, for anyone interested:
So, just save the above as a bookmark in Mobile Safari (or just bookmark this) and ‘go to it’ before adding a site to your home screen… and, hey presto, your newly book marked site will run full screen when you go to it!
This is very easy to do - and the documentation is bang on the money… but as always, there are no examples!
So without further a do…
Create a bb-proctab file in the etc folder in your Big Brother’s home folder with the following syntax:
<host name>: <yellow alert processes> : <red alert processes>
Processes are space delimited (enclosed in quotes where necessary) and can be followed by a semicolon if you want to specify a minimum or maximum of times it should be running.
The example below will issue a yellow alert if myscript.pl is running more than 8 times (to check for over forking or excessive load) and then a red alert if cron, bbrun or myscript.pl stop running.
localhost: "myscript.pl;=1 bbrun;>=1 “myscript.pl”
So, what have I been doing lately? Well I’ve been wrestling with my first Mobile App in Objective C and the Cocoa Touch frame work for every bodies’ favourite mobile platform!
Between a day job, a social life and a couple of other projects, I haven’t really had the time I need to really get to grips with iPhone as a development platform yet… one of the biggest things that is holding me (and I’m sure a lot of other developers) back is the limited documentation that’s available.
What you get from Apple with the SDK (both actual documents and help given by XCode’s research assistant) is very good but it suffers from being single sourced. That is to say that there are no other contributors in the periphery giving comments, suggestions or even pointing out mistakes with the official docs. This is partly because of the infamous iPhone SDK NDA (which fortunately as now being lifted) but it’s also down to the fact it’s a relatively new and proprietary technology…
A good example of this is the problem I had getting the UIScrollView class to work. The documentation was accurate to a ‘T’ and Apple even provided some fairly complex implementations to demonstrate how to use it with paging and zooming… but there was no example or explanation of how the fundamentals worked. I was left with the impression by the sample code that I needed to set up a delegate to handle all the events that the class actually does straight out the box! An hour later I was still playing around with implementations of the UIScrollViewDelegate protocol, trying to get my scroll bars to work when, all the while, all I needed to do was tell my UIScrollView the full dimensions of its content!
All I’d have needed to see was the 4 line example I’ve drawn up below, in the absence of Head First iPhone Development, I’ve even made a simple colour diagram showing the relationship between the two areas you have to specify! I doubt something so simple will help many people in the future, but you never know… and I hope this will be just the first example I write up for my blog!
//all variables are of type CGFloat, unless named otherwise! UIScrollView *myScrollViewObj = [ [UIScrollView alloc] initWithFrame: CGRectMake(frameX, frameY, frameWidth, frameHeight) ]; [myScrollViewObj setContentSize: CGSizeMake(contentWidth, contentHeight) ]; [myParentViewObj addSubview:myScrollViewObj]; [myScrollViewObj release];
PS. Hey Steve, please don’t sue me! The NDA’s being lifted anyway right?
So, how this for an interesting interview question:
You have two variables with integer values, without creating a third variable exchange their values.
At first it sounds fairly simple, but then it hits you that it’s actually not… there’s no simple ‘exchange value’ function. Here’s how I solved it:
list($a, $b) = array($b, $a);
My answer provoked a surprised (if not bemused) Yeah, that’d work… I’ve never heard that one before look. After a little conversation it turned out that the answer they were expecting but rarely got was:
$a = $a + $b; $b = $a - $b; $a = $a - $b;
My answer is of course better, because it works with any type of variable, but what they were actually testing for was a logical brain that would solve the problem with simple maths… The fact that most candidates don’t even try answering the question goes to show how dastardly it is!
Saturday morning I attended the Friends and Members preview of the Royal Academy’s Summer Exhibition and was faced with my annual choice between spending £12 on two glasses of Pimms or going whole hog, spending £18 on a jug and getting sloshed.
The Summer Exhibition is something I always approach with some trepidation as it can get quite overwhelming. With two or three galleries crammed full of paintings and people it is very easy to tire yourself out trying to see everything or just get frustrated and steam on through to larger stuff at the end. Although, I’m pleased to say that this wasn’t the case this year.
The standard at the ‘low end’ was phenomenal, not that I’ve ever seen any bad work before but there has been a lot of unremarkable paintings in the past. What was missing this year was the celebrated ‘high end’ work, there was no naked Tony Blair getting expelled from paradise or anything that you could really latch on to as being the centre or highlight of the exhibition.
I think what will stick out for people is Tracy Emin’s gallery. The very fact that it’s darkened sets it apart from the rest of the bright Summer Exhibition, then there’s the rather understated notice (pictured above) out side… and then there’s its content. This is not a collection of Emin’s work but rather her personal choice of things she wanted included (mainly from her friends and colleagues.) The content is definitely shocking and a few a pieces are definitely not for the faint hearted!
Despite a slightly awkward journey I was very impressed with the venue. Its white brick walls and concrete floor gave it a blank canvas feel that made it seem anything was possible in its confines (although I’d imagine this might be an acoustical nightmare for anything in the direction of a drum kit.) On the menu was the usual selection of bottled organic beers and wines, although I seemed to drink the ginger beer for most of the night - it was really amazing ginger beer, after all.
Isnaj Dui gave a beautiful recital of haunting flutes and electrodulcimer which caused quite a stir amongst the audience. On second was Suzy Mangion whose melancholy vocals and sombre rendition of Down Town sent many a shiver down my spine.
All in all a very interesting if not off beat evening.