MavEtJu's Distorted View of the World - iPhone

Seeing IR with digital cameras
iPhone dock bar
Online newspapers, waiting on the iPhone to load them
FreeBSD laptop as a Wireless Access Point for an iPhone
iPhone - Change the colour of the SMS backgrounds
Updated iPhone apps
iPhone / iPad development
3, iPhone and international roaming
The FreeBSD Project app
Jailbreak, yes or no?
PDA addictiveness
Apple iPhone guidelines train lazy programmers
I got an iPhone!

Back to index

Seeing IR with digital cameras

Posted on 2012-08-08 17:00:00
Tags: iPhone, Hardware

In the past I have always been able to see if a infra-red remote control works (or a IR laser :-) by holding a digital camera in front of it and see the flashing of the IR LED on the screen.

However, after having purchased a TVB-Gone (which doesn't seem to work here....), I found out that the camera on the iPhone 4 and iPhone 4S don't pick up the flashing of the IR LED. How annoying. The Samsung Galaxy does still show it.

However, this is only limited to the main camera on the iPhone 4S! The camera on the screen-side still shows the IR flashes on the screen.


No comments | Share on Facebook | Share on Twitter


iPhone dock bar

Posted on 2011-09-08 08:00:00
Tags: iPhone, Happiness

The iPhone home screen has four icons stuck at the bottom of the screen. For the last year I had there Safari, Mail, Phone and Facebook.

Yesterday I swapped Facebook for Podcaster, which I have been using more frequent in the last four months.

Facebook is for people who are bored.
Podcasts are for people who want to learn!


No comments | Share on Facebook | Share on Twitter


Online newspapers, waiting on the iPhone to load them

Posted on 2011-03-02 18:00:00
Tags: Mass Media, iPhone

One of the uses of my iPhone is as a replacement for the newspapers and other news sources. Yes, I can do this on the computer too, so far nothing new. The thing which fascinates me is how much time I spend on waiting for the data to be retrieved.

Take the ABC app. On it, I only read two sections: The Just In section and The Drum. I open the app, have to wait for the Latest News section (which is not the Just In section) has been loaded, then I tap for the overview of the sections (which is instantly) and then tap on the Just In section, for which the overview gets loaded. To read an article, I tap on that article which then gets loaded. So I have to wait three times before I can read a single article, and every other article I need to wait again. Even after having read the ABC news this way for about a good year now, it still doesn't remember which news sections I'm interested in and doesn't pre-load them.

Take the SMH app. It is a little bit nicer, you can tell it which sections you are interested in and only shows those. It opens the one you opened last time up first. Could be close to a winner! But then it has the same cons as the ABC app: It loads the index and when you tap on the article you want to read it loads that one. Waiting twice again.

Take the Volkskrant app. It has two major sections, the Just In section and the Opinion section. When you start the app, the index of the Just In section gets loaded together with the text of all the articles. When you tap on an article, it comes up immediately and then loads any images: You can read it immediately. So you only wait once.

Take the BBC app. Just like the Volkskrant app, it loads the index and contents of the main sections at startup, which also has a lot of images on it. When the article gets loaded, it will load the image on the article.

The method of loading of content done by the BBC app and the Volkskrant app is by far the most ideal way of using an online news app. I am not yet sure if I prefer the sober layout of the Volkskrant or the smooth horizontal scrolling layout of the BBC. But overall, I am looking forward to the day the Australian news apps have caught up!


No comments | Share on Facebook | Share on Twitter


FreeBSD laptop as a Wireless Access Point for an iPhone

Posted on 2011-01-12 18:00:00
Tags: FreeBSD, 3G, Networking, Free Internet, iPhone

Recently I was on a holiday where the provider of my iPhone had no signal, but where the provider of my 3G modem for the laptop did have a signal. At least my glass was half-full!

In the past I have tried to setup Bluetooth between my laptop and my iPhone, and that resulted in a night of hard work and no effort. This time I tried a different approach: Instead of using Bluetooth for communication, I transformed the FreeBSD laptop into a wireless access point.

The command to change the wireless card from a normal client to a wireless access point are:

[~] edwin@lappie>cat wlan-iphone
#!/bin/sh

ifconfig wlan0 destroy
ifconfig wlan0 create \
	wlandev ath0 \
	wlanmode hostap \
	bssid \
	authmode open \
	ssid "My iPhone WiFi"

ifconfig wlan0 up
ifconfig wlan0 inet 10.0.0.1 netmask 255.255.255.0
sleep 1

sysctl -a net.inet.ip.forwarding=1

service isc-dhcpd restart

Notes:

The 3G connection is setup via ppp(8) and to enable NAT on the outgoing packets, you need to enter the following command or add it to the right label in your ppp.conf:

ppp ON lappie> dial
Ppp ON lappie>
PPp ON lappie>
PPp ON lappie> Warning: 0.0.0.0/0: Change route failed: errno: No such process
PPP ON lappie> nat enable yes
PPP ON lappie> 

And to make sure that the connected clients get their IP address, you should run the ISC DHCP server with for example the following configuration:

option domain-name "";
option domain-name-servers 8.8.8.8;

default-lease-time 150;
max-lease-time 300;

ddns-update-style none;

authoritative;

log-facility local7;

subnet 10.0.0.0 netmask 255.255.255.0 {
        range 10.0.0.10 10.0.0.99;
        option routers 10.0.0.1;
}

Notes:

Everything is working now, your glass is full again! :-)


Show comment | Share on Facebook | Share on Twitter

iPhone - Change the colour of the SMS backgrounds

Posted on 2010-08-22 08:00:00
Tags: iPhone

Whoever designed the background colours of the iPhone SMS application should think about it once again. The standard background of the window is white, the background of the incoming messages is white, the background of the outgoing messages is green. Which background is your eye drawn to first? The green background, thus your own message. Which colour makes you go "Hey, I got something on the screen?"? The green one.

This issue can be fixed on a jailbroken iPhone if you have either SSH access to it or via a terminal program:

iPhone:~ root# cd /System/Library/PrivateFrameworks/ChatKit.framework
iPhone:/System/Library/PrivateFrameworks/ChatKit.framework root# ls -al Balloon*
-rw-r--r-- 1 root wheel 1502 Jun  1 13:40 BalloonInputField.png
-rw-r--r-- 1 root wheel 1907 Jun  1 13:40 Balloon_1.png
-rw-r--r-- 1 root wheel 1805 Jun  1 13:40 Balloon_2.png
iPhone:/System/Library/PrivateFrameworks/ChatKit.framework root# cp Balloon_1.png Balloon_1.old
iPhone:/System/Library/PrivateFrameworks/ChatKit.framework root# cp Balloon_2.png Balloon_2.old
iPhone:/System/Library/PrivateFrameworks/ChatKit.framework root# cp Balloon_2.old Balloon_1.png
iPhone:/System/Library/PrivateFrameworks/ChatKit.framework root# cp Balloon_1.old Balloon_2.png

People with graphical skills can download, enhance and upload the images themselves to fit their needs :-)


No comments | Share on Facebook | Share on Twitter

Updated iPhone apps

Posted on 2010-08-19 18:10:00
Tags: iPhone, FreeBSD, L-Space

iPhone apps updated:


No comments | Share on Facebook | Share on Twitter

iPhone / iPad development

Posted on 2010-08-19 18:00:00
Tags: iPhone, Coding

Until the release of the iPad the world was very easy for an iPhone programmer: The screen was 480 x 320 pixels. You substract a number of pixels for the banner at the top with the carrier, time and battery level on it, and depending of the style of your application substract some for the menus at the top and bottom. The leftover area is for you! Oh, if you hold it landscape, you end up with a screen of 320 x 480, minus a couple of pixels for everything described before.

Then came the iPad with a muuuuch larger screen and the iPhone4 with a little bit bigger screen. And all the hardcoded values of the screen size, banner, menu areas etc were suddenly invalid! Oops.

To be honest, that are easy things to fix. Instead of using hardcoded values (which should have been #define's in the first place anyway), you just call a function which return the values based on the environment you are living in. Problem resolved. Maybe...

Not only were the dimensions of the screen wrong, also the look-and-feel of the screen now looks wrong. On a small iPhone screen, this is how for example a list entry looks: A three word name, plus an > to indicate that if you touch this that that there is more to see about "Foo bar quux".

+--------------------------+
| Foo bar quux          >  |
+--------------------------+

Now we increase the dimensions to the iPad:

+--------------------------------------------------------------+
| Foo bar quux                                              >  |
+--------------------------------------------------------------+
Instead of a nicely filled line, it is now a short text on the left, a lot of white in the middle and an > at the end.

How can we overcome this? Maybe we shouldn't try to get iPhone applications directly ported to the iPad... The iPad has a iPhone compatibility mode for iPhone apps: Instead of using the whole screen it uses only a middle part of the screen, with the same dimensions of the iPhone. Hardware compatibility via software, everything still works!

That works fine for the old apps, but what about the new apps? Before the iPad came out, the SDK version was 3.1. To make programs work on the iPad, you need to use the SDK version 3.2 which supports programs on both the iPhone and the iPad. To make programs which work on the iPhone4, you need to use the SDK version 4.0, which only supports programs on the iPhone and iPhone4.

So, the questions these days are: Which SDK do we use, which hardware do we develop for and how do we make it look good?


No comments | Share on Facebook | Share on Twitter

3, iPhone and international roaming

Posted on 2010-07-18 23:00:00, modified on 2010-07-18 18:00:00
Tags: iPhone, 3G, Travelling

While being in San Francisco this week and in Sunnyvale next week, I informed with my provider, 3 in this case, about the charges for access to the 3G network internationally. That was kind of a shock, they wanted to have AU$ 20 per megabyte. I quickly rejected that option :-)

But I did enable roaming for my voice calls, so imagine my annoyance when I came here and the telephone said "No Carrier" (which brought a lot of memories back about the time I played with modems :-). So I called the 3 helpdesk (via Skype, charging me 10 cents per minute (still cheaper than the GSM call :-) and they said I had to change from "Automatic selection" to a manual select of "AT&T" and it all worked.

still some wires which need to be crossed manually for this, but at least I am reachable again!

Next trick is to find out why I'm awake in the middle of the night. Oh yeah, jetlag :-(


Show 4 comments | Share on Facebook | Share on Twitter

The FreeBSD Project app

Posted on 2010-06-09 18:00:00
Tags: iPhone, FreeBSD

When exploring the features of the iPhone SDK, one of the things which you can't go around is the "How do I access the Map feature?". Not that I have much to map, I know where I live and that my parents and my/their family lives on the other side of this planet. But there is a different community I still am a member from: That one of the FreeBSD Project!

One of the things that a new committer on the FreeBSD Project does do is to add his name to the astro/xearth port, with the right coordinates so other people know more or less where you live. I feel a map coming up!

But the FreeBSD community is larger than just a map of the committers. There is a Newsflash on the website so you can see what is happening inside the project, there is a list of events related to (Free)BSD on the website, there is of course Planet FreeBSD, an aggregator of the various blogs of people related to the FreeBSD Project and there are videos of conferences on YouTube.

Put all together in a small app which collects all that data and presents it to the person holding the iPhone et voila, the FreeBSD Project app is here.


Show comment | Share on Facebook | Share on Twitter

Jailbreak, yes or no?

Posted on 2010-06-01 08:00:00
Tags: Apple, iPhone, jailbreak

One of the issues people have with the iPhone is that is a black box fully controlled by Apple. For developers they control access to the API, for end users they control access to the software. If they don't like the software you submit to them (for various reasons, from "It doesn't follow our user interface guidelines" to "It uses an undocumented call in our private API" to "It duplicates features in software we provide"), they will reject the submission and you are stuck with software..

The same people say that Apple should open their iPod/iPhone/iPad like they did in the past with the Apple ][ and although I agree with them, it is not the same Apple. Just like SCO was a respected Unix implementation before it was bought by Caldera who renamed itself into SCO afterwards, Apple today is a harsh business company instead of a hackers group. Same name, different attitude.

So, what can you do about it, if the creator of the hardware wants to bake the cake, cut it and then eat it too? Leave it over to people who are much smarter than me :-)

Jailbreaking is a term based on the way third-party software on the iPhone runs: It runs in a jailed environment, where it can't access anything else except the data it has provided or downloaded itself. That keeps an iPhone safe, because if you can't access something, you can't do any damage there. By breaking the jail, you will be able to access the place where the iPhone installs software and thus install more software. Software which didn't go through the rigorious screening of Apple, software which does do things that Apple doesn't like. Google for "apple iphone jailbreak", it is not that difficult to find and works quiet well.

So, once you have jailbroken your iPhone, what do you get. Access to a different version of the App Store app called Cydia sto start with. Just like the App Store app is the way to install Apple sanctioned software, Cydia is the way to install the free software.

For the rest I have installed so far:

The iPhone can offer more than Apple is willing to show. Thanks to the hard work of a few individuals, it can be made available.


No comments | Share on Facebook | Share on Twitter

PDA addictiveness

Posted on 2010-05-31 08:00:00
Tags: Apple, iPhone, Mobile phones, Addiction, Words with Friends

As described earlier, I am now owner of a Apple iPhone. So far nothing new. The thing which was new for me is the portability of addictiveness.

The first, and until recently, last pocket computer I had was a Palm III which was great: Two AAA batteries which lasted months, brilliant input method, simple screen (plus a software development kit available, which ran under Linux and FreeBSD). It lost its attractiveness when after a cold day outside it didn't want to turn on anymore and lost all the contents in it. Oops.

Fast forwarding to twelve years later. In the mean time I've only had simple telephones and faster more capable computers, nothing which stands in between or merges the capabilities of each other.

Long term addiction to computer games has so far for me been limited to playing MUDs in the early 1990s, after that it had not touched me much. True, I've played games like Bejeweled on Yahoo! Games for a couple of afternoons, but the realization that I wouldn't get anywhere near the global Top 1000, let alone the global Top 10, nor that anybody would care me being there, that made me give up pretty fast. The other factor of success is that my machines were not running MS Windows nor MacOS/X and therefore successfully limiting the amount of addictive programs capable of running on it.

But with the purchase of the iPhone that layer of protection had gone and now I've wasted most of the train trips towards and from work and the walking towards and from the trainstation with looking at the little screen and wondering when the next opponent in Word with Friends (a non-realtime multi-opponent version of the Scrabble game) will lay their word so I can place my next set of tiles.

I couldn't remember what was happening between the moment I stepped on the train in Townhall till I got off at Caringbah. And I could't remember what was happening between the moment I started walking at the station till I was home. There are two big roads to be crossed and I couldn't remember if the light on the crossings was red or green when I crossed. Etc.

That was my state of mind until my wife started to play the game on my iPhone and the game wasn't fully mine anymore. Is it the being dragged back to reality? Is it jealousy? I don't know but I'm glad she did.

Except that she now owns my iPhone with her games of Words with Friends from the moment I'm back from work till we go to bed. Until the next addictive game comes up on my iPhone, then it's all mine again.


Show comment | Share on Facebook | Share on Twitter

Apple iPhone guidelines train lazy programmers

Posted on 2010-05-20 08:00:00
Tags: Apple, iPhone, Objective-C, Rant, Coding

As stated before, I am pretty new to Objective-C programming. Normal C? Not a problem at all! But this object memory management process in Objective-C still gives me a hard time.

The first attempt was simple: I added a lot of NSLog() messages in my dealloc() methods and see which ones I expected to see were not showing up. That were for example all my inherited UIViewControllers... They were not released after they were closed. It is a hard way to do it like this, but it gives you a feel of what you are are really doing wrong.

Then I had a look at the "Leaks" analyze tool in Objective-C (Run -> Analyze -> Leaks) and ran my program. At the end, after a couple of refreshes, it consumed 5 Mb of memory. 5 Mb, is that such a deal? Yes, it is when all the program does is retrieve an XML feed and extracts some data. Oh, and every time it refreshed it lost another huge chunk of memory. Yes, that is a big deal. Luckely the "Leaks" analyze tool tells me which kind of objects it is leaking and when, so you might be able to plug them if you go methodically through the features of your program.... Checking the retainCounters is the way to go.

The next step was to implement a button which terminates the program. Apple doesn't permit you to have apps in their AppStore which have this feature, their usability design is: "If you want to terminate a program, you press the big round Home button at the bottom of the screen.". This breeds lazy programmers, there is no way to properly deallocate all the objects you have. And the excuse you read on the forums about it is "When you terminate your program, the operating system will take care of that.". Absolutely correct, but with some-form-of-multitasking around the corner the current system of "Short living apps won't be able to hog a lot of memory" is over. Plus that it will not show the lazy programmer that he has a serious problem in his code!

And the last tool I thought about was something like a static analysis tool, like Clang (I didn't know this at that moment, and have not used it yet, but it is included in XCode these days). I found a front-end for it called the Analysis Tool at http://www.karppinen.fi/analysistool/ and ran my code through it. Four hundred warnings, and most of them related to objects not being freed.

What I learned from this was: Always "autorelease" the local objects. Assignments increase the retainCounter. Check the retainCounters of the objects you release in your dealloc() methods. Don't trust yourself. And wait for the day that you will be able to see at termination of your program what you have leaked.

To be continued.


No comments | Share on Facebook | Share on Twitter

I got an iPhone!

Posted on 2010-05-04 08:00:00
Tags: iPhone, Apple, Objective-C, Coding, L-Space

And so do 50 million other people on this planet. So far nothing exciting :-)

The first impression is good (just as everybody else says): Works intinutive, apps are great. Addiction factor: High. Very high unfortunately.

As a hardcore tinkerer, of course I'm interested in how to make apps for it. And so the drama began: You need an iMac, and one one with an Intel chip in it (the one we have here has a PowerPC), so I needed to buy a Mac mini. And then I needed to buy a digital certificate from Apple so I could store the programs on the physical iPhone instead of on the iPhone Simulator (great piece of software BTW!). And then I needed a book, so I got Erica Saduns 'The iPhone Cookbook' (after taste-testing a downloaded copy). And then I had to learn Objective-C...

Objective-C, according to Wikipedia, is "a reflective, object-oriented programming language which adds Smalltalk-style messaging to the C programming language.". Although never used C++, I can handle object-oriented programming from my history with TurboPascal in a previous life and PHP and Perl from more recent lives. Smalltalk messaging is, as far as I use it but in reality much more, a way to call functions in other objects.

Compared with C++, I like the style of the Smalltalk message passing to call an other object's function: It makes the difference between the properties of an object (foo.bar) and the functions ([foo bar]) clearer. Also the nested way of messaging makes the code simpler ([[[[ClassFoo alloc] init] randomfunction] release]).

The way functions in objects in Objective-C are defined and called is a large improvement over C++ (unless I've totally missed this feature in C++): A function definition is like (void)displayString:(char *)text withStyle:(int)style centered:(bool)centeredText and function calls to it are like [displayString:"Foo" withStyle:UNDERLINED centered:FALSE]. That makes it easy to make sure you a. have all the parameters in the right order and b. you can have multiple functions with the same order of types (char *, int, bool) but with different names for the arguments.

Good, now the things which don't work out so well yet... Memory management! It is a drama in every language, although I had it pretty much under control in OO-Pascal and C, here it goes a little bit further with garbage collection. I don't mind garbage collection for the things that Apple provides inside the iPhone SDK, but I like to keep track, and the clean-up afterwards, of my own garbage: The following initializes a string and automatically releases it when nobody is using it anymore: NSString *s = [[[NSString alloc] initWithString:"Foo"] autorelease]. Every object, in this case the NSString object, has a counter which keeps track of the amount of references to it. Once the counter is zero, the object gets cleaned up. So the option "autorelease" used earlier, that feature should automatically release, unless there are other references to it, the NSString object when the function has ended (at least that is how I see it). But does this magic really happen? There is no way to check it, we just have to believe the system wrks. For the simple NSString object here it is not so much of an issue, except when I believe it should be still there and it has been released. In pure C you would get a segfault if you do something on invalid or NULL pointers, but in this messaging system you can easily send messages to nil objects without things falling apart. So the protection I had as a C programmer during the development (when you run the program and something doesn't initialize properly, it aborts the moment you try to do something with that piece of data) is now gone because the place it goes wrong might only show up in the output to the user instead of as an interruption of the program.

So, how am I going so far? With regarding to the GUI objects that the iPhone provides (views, input fields, scrolling), I have most of it under control. The rest is learned when required: Thanks to the power of the Google search engine and the various iPhone development communities, all the questions I come up with are already asked and answered.

Right now I have released one app called L-Space. I use it to keep track of collection of Discworld books, to find out which ones I already own and which ones I haven't read yet. You can find it in the iTunes store or in the iPhone Apps program. A bigger version will allow more book-series and maybe the option to edit them.

The next one I'm working on is an aggregator (more an advocacy thingie) for information about the FreeBSD Project: It shows the YouTube videos, the Planet FreeBSD feed, the News Flash and the location of FreeBSD Commiters in the map.

Oh, and about the addiction: I manage to keep it quite well under control, except for the Words with Friends (a non-realtime version of scrabble) and Bridges (Also known as Hashiwokakero), with which I waste hours and hours on in the train.


No comments | Share on Facebook | Share on Twitter