Saturday, August 30, 2008

Using Fast Enumeration

Using Fast Enumeration
The following code example illustrates using fast enumeration with NSArray and NSDictionary objects.

NSArray *array = [NSArray arrayWithObjects:

        @"One", @"Two", @"Three", @"Four", nil];

for (NSString *element in array) {

    NSLog(@"element: %@", element);


NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:

    @"quattuor", @"four", @"quinque", @"five", @"sex", @"six", nil];

NSString *key;

for (key in dictionary) {

    NSLog(@"English: %@, Latin: %@", key, [dictionary valueForKey:key]);


You can also use NSEnumerator objects with fast enumeration, as illustrated in the following example:

NSArray *array = [NSArray arrayWithObjects:

        @"One", @"Two", @"Three", @"Four", nil];

NSEnumerator *enumerator = [array reverseObjectEnumerator];

for (NSString *element in enumerator) {

    if ([element isEqualToString:@"Three"]) {




NSString *next = [enumerator nextObject];

// next = "Four"

For collections or enumerators that have a well-defined order—such as NSArray or NSEnumerator instance derived from an array—the enumeration proceeds in that order, so simply counting iterations will give you the proper index into the collection if you need it.
NSArray *array = /* assume this exists */;

NSInteger index = 0;

BOOL ok = NO;

for (id element in array) {

    if (/* some test for element */) {

        ok = YES;





if (ok) {

    NSLog(@"Test passed by element at index %d", index");


Tuesday, July 22, 2008

iPhone SDK installtion on PowerPC G4 Mac Mini (Non Intel Mac)

These are contents from different blogs,sites and forums combined together for a successful installation of iPhone SDK on PowerPC G4 which I've used to install iPhone SDK.

I managed to install the SDK completely (in the right place) without using Pacifist, fully working on a Mac Mini PowerPC G4 32 Bit. My root partition is still spammed with 5 gb of redundant crap for following this "Tip", but thats why i decided to let others know there's another better way of getting it to work:

Pre Installation Steps( Create Installation Package for PowerPC G4)

1. Make the iPhone SDK.dmg read/write-able with Disk Utility using convert -> to read/write.
2. Mount the R/W dmg.
3. You need to delete some unneccessary file so that you can modify the installer config file, because the image is completely full. I choose the PDF in the root of the dmg.
4. Modify iPhone SDK/iPhone SDK.mpkg/Contents/iPhoneSDK.dist :(Right Click on "iPhone SDK.mpkg" from the Mounted disk ans Selelct "Show Package Contents"

Once we Select this menu, We will get a list of files . From this list ,Select iPhoneSDK.dist and edit with any text editor and you have to edit three functions from this file as follows..

- Goto Line number 70 and

function agreedToSLA()
var res ="tempfileexists", "insttmp_37253734");
if( res == 0 ){ return true; }
my.choice.tooltip = system.localizedStringWithFormat('TT_NOIPHONESDK');
return true; // By default it is false

function SDKPresent()
var res ="tempfileexists", "insttmp_37253735");
if( res == 0 ){ return true; }
system.log("To install the iPhone SDK you need to agree to the iPhone SDK License agreement through the GUI interface.");
return true; // By default it is false


function isIntel()
var res = (system.sysctl('hw.byteorder') == '4321');
// by default is 1234 change this to 4321

if( !res ){ my.choice.tooltip = system.localizedStringWithFormat('TT_NOINTEL'); }
return res;

/// End of File
Note :
- Line 71 ( in function agreedToSLA() ) - modify "return false;" to "return true;"
- Line 81 ( in function SDKPresent() ) - modify "return false;" to "return true;"
-Line 103 (in function isIntel() change var res = (system.sysctl('hw.byteorder') == '1234'); to var res = (system.sysctl('hw.byteorder') == '4321');

Save this File, Now we are ready for installation

Once we completed this step, we can directly install IPhone SDK into Power PC . From the Installation Screen do not select Mac OS X 10.3.9 Support and Web Objects (
Web Objects is Optional if you want you can select)

Post Installation Steps

1. Once we completed the installation we have to replace a configuration file, which is used to identify the Architecture ( Make sure backup of original) as follows

Once you've moved the iPhone platform directories to their appropriate location under /Developer/Platforms, drill into: /Developer/Platforms/iPhoneSimulator.platform/Developer/

In this directory, you will find a file called "iPhone Simulator Architectures.xcspec" Make a backup of it and open the original in your favorite editor

Replace the file contents of "iPhone Simulator Architectures.xcspec" with the following line

// 32-Bit
{ Type = Architecture;
Identifier = Standard;
Name = "Standard (iPhone Simulator: i386)";
Description = "32-bit iPhone Simulator architectures";
ListInEnum = YES;
SortNumber = 1;
RealArchitectures = ( i386, ppc7400 );
ArchitectureSetting = "ARCHS_STANDARD_32_BIT";

// Old-style Debug
{ Type = Architecture;
Identifier = Native;
Name = "Native Architecture of Build Machine";
Description = "32-bit for build machine";
ListInEnum = YES;
SortNumber = 101;
ArchitectureSetting = "NATIVE_ARCH";

// G3
{ Type = Architecture;
Identifier = ppc;
Name = "Minimal (32-bit PowerPC only)";
Description = "32-bit PowerPC ";
PerArchBuildSettingName = "PowerPC";
ByteOrder = big;
ListInEnum = No;
SortNumber = 201;

// G4
{ Type = Architecture;
Identifier = ppc7400;
Name = "PowerPC G4";
Description = "32-bit PowerPC for G4 processor";
ByteOrder = big;
ListInEnum = NO;
SortNumber = 202;

// G5 32-bit
{ Type = Architecture;
Identifier = ppc970;
Name = "PowerPC G5 32-bit";
Description = "32-bit PowerPC for G5 processor";
ByteOrder = big;
ListInEnum = NO;
SortNumber = 203;

// Intel
{ Type = Architecture;
Identifier = i386;
Name = "Intel";
Description = "32-bit Intel";
PerArchBuildSettingName = "Intel";
ByteOrder = little;
ListInEnum = NO;
SortNumber = 105;

Location of Configuration File
iPhone Simulator Architectures.xcspec

Xcode Location after iPhone SDK installation

Friday, May 02, 2008

Windows Mobile and Fring

Take all your buddies mobile with fring™, call and chat with them for free and see who’s online before dialling!

fring™ is a mobile internet service & community that enables you to access & interact with your social networks on-the-go, make free calls and live chat with all your fring, Skype®, MSN® Messenger, Google Talk™, ICQ, SIP, Twitter, Yahoo!™ and AIM®* friends using your handset’s internet connection rather than costly cellular airtime minutes.

Bringing PC-benefits to the mobile, fring will empower you with mobility and availability as never before, integrating all contacts in to one, searchable buddy list, allowing you to see who’s online before dialing with contact availability indicators, engage in multiple conversations simultaneously, send & receive files and more.

You can even make affordable local and international calls to landline and regular cellular numbers using your SkypeOut/SkypeIn account or almost any internet voice service (SIP) such as SIPNET, EuteliaVoIP, VoIPVoIP and VoIPTalk, even from non-SIP enabled handsets.

take all IM buddies mobile and view them from one, integrated contact list

free calls

live chat instead of SMS

call landlines and regular cellular contacts using SkypeOut or SIP

view call history

invite friends to fring

send & receive files

choose incoming call and message tones

auto-roam in and out of WiFi hotspots

* fring is compatible with Symbian 8, 9.1, 9.2, Windows Mobile 5 & 6 and UIQ handsets.
** Voice for Yahoo!TM and AIM® is still not enabled.

HTC Touch Review - Skype


We are not pleased with the operating speed of HTC Touch, the fault for which lies with the 200 MHz processor used in most 2G other manufacturer’s phones. Yet it has been optimized for the device and there are no serious delays, but you often have to wait a little when moving trough the menus and applications. Symbian S60 OS which is much faster in the new smart-phone models of N76, 6120, N95 has a serious advantage here.

We are happy that the Touch can use Skype application for VoIP calls. The processor is not very fast and the system lag when you are during a call, but still you will be able to switch to different tabs and send a chat message for example, while you talk. The Voice is not lagging if you are using fast internet connection. For Skype calls, Touch uses the loudspeakers and you will not be impressed by its quality, but it is still usable. The other party hears you clear, but some echo also appears. For the test, we used WiFi connection.

We also installed Fring application, which connects to both Skype and Google Talk, but strangely, we weren't able to do a call. The application said that the phone has to restart in order to do a voice call, but after a few restarts nothing changed. In order to get installation file for Fring, we had to choose the phone model from the Fring's webpage. The Touch was not listed, so we selected an another HTC smartphone with touch-sensitive display.

We used Spb Benchmark to compare the Touch system performance with other PocketPC Phones. We are pleasantly surprised by the results, showing way better performance than the Wizard, although the two have similar system resources.

During our typical test with decreasing signal Touch did not perform very well and the grade mark we give it is 3.75/10, which places it in the category of Poor, below the standard level. The manufacturer claims 5 hours of talk time, but we are surprised that in our test it scored 6 hours of continues talk time. This is just an excellent result!

We are disappointed by the incoming sound during conversation and particularly by its volume: the loudspeaker is not heard very strongly and as the one for music snuffles at ‘max’ position and has to be turned down. On the other hand, voices through it sound very close to reality, clear and distinct.

Not so however in the opposite direction – you are heard just perfectly, very strongly, clearly and realistically. We have no remarks in this respect.


We remain with mixed feelings about Touch – the Touch Flo technology is a good idea, but poorly realized and its actual functionality is quite limited opening only one shortcut menu and scrolling through long pages. To be competitive to what iPhone will be, a number of new extras should probably be added, such as a new way of imputing text with fingers, a more innovative display locking/unlocking, menus handling (back/forward), photos handling (zoom in/out, previous/next), etc.

On the other hand, Touch is a small and beautiful WM6 phone with the full functionality of the operating system and with all personalization possibilities, which, on functional level, places it to some extent above iPhone, PRADA and Samsung F700 which are not smart phones. Unlike them, Touch is very flexible thanks to a heap of 3rd party applications. Its interface may be not as interesting and beautiful as that of the competitors – the fashionable PRADA and the innovative iPhone, but if you want a really good-looking small phone using Windows Mobile 6 Professional, Touch is your perfect choice.