Posts

Showing posts from March, 2013

Where in Mac OS X 10.8 does your backup iOS apps(*.ipa files) are stored?

In case you're wondering where the heck these apps are being stored. I just found this inside this directory, $HOME/Music/iTunes/iTunes\ Music/Mobile Applications  Where your $HOME is the shell environment defined variable like /Users/geeko. Hope this does helps.

TCP vs UDP

I wanted to make this notes into my blog so I won't go afar from my blog when people asked me the different of these two. From  http://www.diffen.com/difference/TCP_vs_UDP

iOS/Objective-C: Use "oneway" keyword for asynchronous call on methods and usage of in, out, byref, bycopy keywords

Just encountered this "oneway" keyword in iOS when I was trying to implement a Singleton Pattern. So here is the example, - ( oneway void ) release ; -(oneway void) giveMeAnObjectWhenAvailable:(bycopy out id *)anObject; The use of "oneway" keyword above simply tells that, it is asynchronous (the result is not immediately expected) - hence it must return void . It is used with the distributed objects API, which allows use of objective-c objects between different threads or applications. It tells the system that it should not block the calling thread until the method returns. Without it, the caller will block, even though the method's return type is void. Obviously, it is never used with anything other than void, as doing so would mean the method returns something, but the caller doesn't get it. For clarification on the second method above, keywords " bycopy " and " out " simply means that, bycopy - parameter is transmitted ...

How much is the size the file stores per character and how does it is stored?

Image
Well, not sure if this is interesting but just wanted to share for people who are not that nerdy geeky in the inside. Anyhow, file system recognizes the characters base on bytes when it's being stored like ASCII character which takes a byte in every character and UTF-8 character takes 2 bytes. Specifically, I'm using Mac OS X, so I'm on HFS+ filing system. Try creating a file with, $> vim test In your file, insert character "p". If you check the file size by "ls -alth test", you'll notice it takes 2B of size. It's because the character "p" takes a byte, while it also inserts the line feed , which takes now 2B of the size including the inserted character (line feed). If you try to edit/open the file in a hex application like Hex Fiend, you'll notice that in the left side, it has a hex value of "50" plus the inserted "0A" (it has the value of "500A") which has the value of 10 in decimal...

iOS: _block keyword

I have seen this sample code on " How To Use Blocks in iOS 5 Tutorial – Part 2 ". To take not of myself, I want to use their block of code that uses the _block keyword. - ( float ) totalOrder { // 1 - Define and initialize the total variable __block float total = 0.0 ; // 2 - Block for calculating total float ( ^ itemTotal ) ( float , int ) = ^ float ( float price, int quantity ) { return price * quantity; } ; // 3 - Enumerate order items to get total [ self.orderItems enumerateKeysAndObjectsUsingBlock :^ ( id key, id obj, BOOL * stop ) { IODItem * item = ( IODItem * ) key; NSNumber * quantity = ( NSNumber * ) obj; int intQuantity = [ quantity intValue ] ; total += itemTotal ( item.price, intQuantity ) ; } ] ; // 4 - Return total return total; } From the site I have linked or referenced above, going step-by-step, their explanation on using _block keyword   We define...