Archive for the ‘iPhone’ Category

h1

Objective-C link to website

August 4, 2008

[[UIApplication sharedApplication] openURL:[[NSURL alloc] initWithString: @”http://www.mywebsite.com/”]];

h1

Objective-C format currency

August 3, 2008
Here’s the sample code to perform currency format in Objective-C
I realize the code is cut up on the right margin. You can’t read some of it but they are there, try copy-and-paste.


-(NSString*) formatCurrencyValue:(double)value
{
  NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init] autorelease;
  [numberFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
  [numberFormatter setCurrencySymbol:@"$"];
  [numberFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
  NSNumber *c = [NSNumber numberWithFloat:value];
  return [numberFormatter stringFromNumber:c];
}

-(NSString*) formatPercentValue:(double)value
{
  NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init] autorelease;
  [numberFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
  [numberFormatter setPercentSymbol:@"%"];
  [numberFormatter setNumberStyle: NSNumberFormatterPercentStyle];
  [numberFormatter setDecimalSeparator:@"."];
  [numberFormatter setGeneratesDecimalNumbers:TRUE];
  [numberFormatter setMinimumFractionDigits:2];
  [numberFormatter setRoundingMode: NSNumberFormatterRoundUp];
  [numberFormatter setRoundingIncrement:[[NSNumber alloc]initWithDouble:0.05]];
  NSNumber *c = [NSNumber numberWithFloat:value];
  return [numberFormatter stringFromNumber:c];
}

-(double) formatDoubleFromCurrency:(NSString*)value
{
  double ret ;
  if(value)
  {
    ret = [value doubleValue];
    if (ret == 0)
     {
      NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init] autorelease;
      [numberFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
      [numberFormatter setCurrencySymbol:@"$"];
      [numberFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
      NSNumber *c = [numberFormatter numberFromString:value];
      ret = [c doubleValue];
     }
     return ret;
  }
  else
    return 0.0;
}

h1

All-in-one Adium X

July 27, 2008

Adium is probably the most user friendly and powerful IM available for Mac users.

It’s the best messenger tool I’ve ever used, though adding new user contact (especially GoogleTalk) doesn’t always work properly.

I’m still searching for a similar (or comparable) application in the Windows Platform.

Searching…

h1

Nice Set of Tools – XCode

July 20, 2008

Apple XCode lacks of namespace support. Class names and structures become cluttered with cryptic prefixes and suffices

It is using less intuitive smalltalk message base syntax on invoking  method. Sometime, it is referred as sending message.

An interesting way to drag-and-map GUI controls with code behind delegates; though not as intuitive as the way Visual Studio does it

To develop effectively, developer needs a very large desktop area. A screen resolution with 1900pix or more is needed. It’s time to break the piggy bank.

more to discuss later

h1

mobileMe

July 19, 2008

iweb provides several beautiful and ready-to-use common themes. I immediately become a fan of it.

The downsize is the large graphic contents, which seem to cause a slower and longer loading time.  Poor performance on some slower PC with weaker video card.

Time saving is the key though, It was almost zero setup time to host my site. To that fact, iWeb is clearly a more superior web authoring tool for me.

h1

AirPort (Mac WIFI) frustration

July 19, 2008

The user-interface and form factor are very impressive on the Macbook. It’s cute and makes me want to hug it, kiss it and sleep with it. ( just kidding )

As like any other PC I’ve built in the past, first thing first, I need to update the system software on the machine. The OS is pretty intuitive and I got around to System Preferences where I found the software update icon.

After about few hours, I notice the connections were unstable when downloading update. This is when I spend most of my time watching the Activity Monitor (it is pretty cool, equivalent to Task Manager in Microsoft Windows). Then, I noticed that wireless connection was dropping out every few minutes. Needless to say, I was frustrated.

It’s supposed to be most simple, basic, no brainer type of operation. I was struggling with it and it lasted for 2 days. I was cursing Steve Jobs left and right at that point, wondering if I should call the help-desk. Noooo!

My good friend Tom finally came to rescue, suggested a few tricks on the configuration. About an hour of diagnostic, while I was chatting with him over MSN IM, the damn MacBoOk started to connect. The connection was stable and download byte size was consistent.

Yes, we found the cure. It was the way how router was configured. Mine was D-Link wireless with 802.11g. The MacboOk AirPOrt WIFI card works best when the router is set to WEP Open System (do not use shared key) with 128bit encryption key. After that, I was able to download the OS Updates  and iPhone SDK (1.2GB) overnight. It dropped the connection couple of times, but I can live with that. (BTW, who came with the idea calling WIFI device AirPort or Airport?! )

All in all, the MacBook is a pretty neat consumer gadget. It lacks the networking reliability that I take for granted in the Microsoft world. Yes, Gate scores a point when it comes to compatibility and cooper-ability with other hardwares. And Steve got points on better UI design and general usability.

MacBook surely is beautiful but it is not primary reason for me to get converted into the Mac world. Steve Jobs created a mobile platform, an intriguing new generation of computing that improves the user experience combining iPhone, Mac and MobileMe. So far, the experience is better then I expected.

h1

My first Macbook

July 18, 2008

This isn’t my first mac experience, but I’ve always been a PC kind of guy, and loving what Microsoft has done. =)

Now I’m ready to give it another try, a MACBOOK. So far, it’s been a mixed feeling.

Follow

Get every new post delivered to your Inbox.