Monday, November 30, 2009

Windows 7 on MacBook.




I used Windows 7 RC on my MacBook.
Few days ago, I purchase Windows 7 Ultimate K Edition for my laptop.

I installed it.
As RC version, it works perfectly and I totally satisfy with Windows 7.

Like others, Windows Vista make me down. But 7 is really good choice for people who don't want use 9 years old Windows XP.

I prefer that use Windows 7 than Mac OS X Leopard.
You should try it !!

Friday, July 31, 2009

[OSX] How to turn off beep sound in Terminal


Open Prefereneces of 'Terminal' menu.

Go to 'advanced' tab and uncheck bell item.

That's all :)


Friday, July 17, 2009

[iPhone] save image to Photo Library.

Hello, everyone.

Today, I'll see how I can save an Image to Photo Library.

Call 'UIImageWriteToSavedPhotoAlubm' method in UIImagePickerController.h with your 'UIImage object'.

That's all :) It's so easy, isn't it ?

Let me see the declaration of this method.

UIKIT_EXTERN void UIImageWriteToSavedPhotosAlbum(UIImage *image, id completionTarget, SEL completionSelector, void *contextInfo);



This method also adapt selector to inform complete ( or error).

A selector should be formed like....

- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo;

Have nice day, and wish your happiness :)


[iPhone] add info button to UIToolBar


How can I insert 'info button' to UIToolBar ?

You should use 'UIBarButtonItem' to add some item to UIToolBar.

In example you can create it like below code.

UIBarButtonItem *actionItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:nil];


You can use UIBarButtonSystemItem* but there is no info button.

I noticed there is other init method named 'initWithCustomView'
You can create customized BarButtonItem with it.

I created info button with UIButton like below code.

UIButton *button = [UIButton buttonWithType:UIButtonTypeInfoLight];


[button addTarget:self action:@selector(infoPressed:) forControlEvents:UIControlEventTouchUpInside];


UIBarButtonItem *infoItem = [[UIBarButtonItem alloc] initWithCustomView:button];

Let's do it !! :)



Sunday, July 5, 2009

[iPhone - cocos2d] execute N-actions at once.

Is there any way to execute N-actions at once ?

The answer is 'Yes, there is ".

There is a Class named 'Spawn' in Cocos2d library.

Let's see the Documentation of 'Spawn' Class.

@interface Spawn : IntervalAction
{
FiniteTimeAction *one;
FiniteTimeAction *two;
}

'Spawn' is an one of sub Class of 'IntervalAction'.
And basically it can have only 2 action.

But, as you can see, there is a class method names "actions:".
That method support N-Actions. How is it possible ?
The answer is simple, Spawn object can have other Spawn object as its property.

Let me show some example.

Action *action = [Spawn actions:[RotateBy actionWithDuration:aValue angle:180], [FadeIn actionWithDuration:aValue], [ScaleTo actionWithDuration:aValue scale:1.5],nil];

Spawn have 'RotateBy' and ' FadeIn' and 'ScaleTo'

And those actions will be executed at a time.

Enjoy your development :)

Thursday, May 28, 2009

[iPhone] XML parsing on iPhone SDK

There are 3 ways to handle XML document in iPhone SDK.

First of all, use NSXMLParser provided by iPhone SDK.
Rest of them, use library.

NSXMLParser use Event-Driven XML Parsing (async ).
I need a way to parse XML in sync.

So I checked the other ways.

There are 2 project that you can use.

'TouchXML' and 'libxml'.

'TouchXML' is works on the 'libxml'. So I skipped 'TouchXML' and I'll try with 'libxml'.

To use 'libxml' in your Xcode Project you have to add Framework.
And change build configuration.

Add 'libxml2.2.dylib' into your Project and

Add 'Header Seach Path' as '/usr/include/libxml2' like below image.

- Header Serach Path -


Now impoert header file for libxml(libxml/xmlmemory.h)

Use 'xmlParseMemory' to parse XML in memory.
Use 'xmlReadFile' to parse XML file.

Return type of these APIs are same 'xmlDocPtr'
You should call 'xmlFreeDoc' after finish your work.

I'll show you how we can see the elements in XML.

- (void)printElementName:(xmlNode *)a_node
{
xmlNode *cur_node = NULL;

for (cur_node = a_node; cur_node; cur_node = cur_node->next) {
if (cur_node->type == XML_ELEMENT_NODE) {
NSLog(@"node type: Element, name: %s\n", cur_node->name);
}
[self printElementName: cur_node->children];
}
}
- (void)applicationDidFinishLaunching:(UIApplication *)application {


NSString *path = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"test.xml"];
xmlDocPtr doc = xmlReadFile([path UTF8String], "UTF-8", 0);

xmlNodePtr root = xmlDocGetRootElement(doc);
[self printElementName:root];
xmlFreeDoc(doc);
}

Now, you can parse XML with iPhone SDK :)

Thank you for visit my Blog.

Tuesday, May 26, 2009

My First Post.


Hello, Everyone.

I'm Taehoon Koo who live in Seoul, Korea.

This is my first post on this Blog. So, I'll introduce my self.
I graduated Hongik University in Korea, and My major is compter engineering
Now I work for DGStation where make Digital Satellite Receivers.


Personally, I have a lot of interest on developing iPhone Apps, Website or Webserice.
I'm trying to release my first iPhone App.
I'll post the information, soon :)

Anyone who want be a friend with me, don't hesitate send an email to me, please :)

Thank you for visit my Blog and I hope you have a nice day :)