Skip to main content

Posts

Showing posts from April, 2013

iOS Dev: When to use Delegation, Notification, or Observation in iOS

When to use Delegation, Notification, or Observation in iOS A common problem that we often experience when developing iOS applications, is how to allow communication between our controllers, without the need to have excessive coupling. Three common patterns that appear time and time again throughout iOS applications include: Delegation Notification Center, and Key value observing So why do we need these patterns and when should and shouldn’t they be used? The following discussion of the three patterns are purely from my own experiences of developing iOS applications. I’d like to discuss why I feel a particular pattern is better than another and why I believe certain patterns are better in certain circumstances. The reasons I give are not gospel, and are just my personal opinions. Please feel free to argue and provide me with reasons and experiences you’ve had. What is it about these three patterns? The three patterns chosen are all ways for one object to ...

iOS Dev: Encryption in Objective-C

Hello Friends: In this Article/Post, I introduced the one encryption technique in Objective-C.  Encryption Component Features in all  Symmetric Encryption: AES, Blowfish, Twofish, RC2, ARC4, DES, 3DES, PBES1, PBES2. Hash Algorithms :  SHA-1 , SHA256, SHA384, SHA512, MD2, MD4, MD5, HAVAL. Hash Algorithms: RIPEMD128, RIPEMD160, RIPEMD256, RIPEMD320. Encoding: Base64, hex, quoted-printable,  URL-encoding . HMAC with any supported hash algorithm: HMAC-MD5,  HMAC-SHA1 , etc. Password-based Key Derivation Functions: PBKDF1, PBKDF2 PKCS7 -- P7S and P7M creation, decryption, verification. Public key encryption/decryption with digital certificates. Digital signature creation/verification with digital certificates. Bzip2 in-memory compression. Encrypt / decrypt strings or byte data. Return encrypted data as Base64, quoted-printable, or hex-encoded strings. Hash strings or binary data using SHA1, MD2, MD5, HAVAL, SHA384, or SHA512. Public-key encryp...

True difference between Hash Table and Dictionary

S.No. Dictionary Hash Table 1 A dictionary is a data structure that maps keys to values. A hash table is a data structure that maps keys to values by taking the hash value of the key (by applying some hash function to it) and mapping that to a bucket where one or more values is stored. 2 Dictionary is not a threadsafe. Hashtable is threadsafe. 3 Dictionary is types means that the values need not to boxing. Hashtable values need to be boxed or unboxed because it stored the values and keys as objects.         4 When you try to get the value of key which does not exists in the collection, the dictionary throws an exception of 'KeyNotFoundException'. When you try to get the value of key which does not exists in the collection, the Hashtable returns a NULL value. 5 When using large collection of key value pairs dictionary is not as good as Hashtable. When using large collection of key value pairs hashtable wou...

iOS Dev: Guidelines for Apple iOS Developer

Here the some concern, which is always in your mind as a developer: Apple’s iPhone – Memory Constraints The most visible aspect for any mobile application, other than its look and feel, is the speed in terms of user interface’s responsiveness. This performance may be impacted not only by hardware constraints like processing power or available memory but also due to network delays while pulling data. Apple’s iPhone provides 128MB of RAM (iOS5 have a quad-core chip with 1 GB of RAM ), part of which is dedicated for user interface only. Even though only one user application is running at a time, still there are a bunch of applications (like mail, clock, push, music) that are running in the background consuming additional memory. Your application must be able to run under the presumption of low memory and the fact that an incoming phone call or text message will further decrease the available memory, potentially resulting in a memory warning to your application. The applicatio...

How to call Commands from UI Control in MVVM pattern

We will use RelayCommands to register Execute and CanExcute command handlers in MVVM pattern. To achieve this we will create a class RelayCommand.     /// <summary>     /// To register commands in MMVM pattern     /// </summary>     public class RelayCommand : ICommand     {         readonly Action < object > _execute;         readonly Predicate < object > _canExecute;         /// <summary>         /// Constructer takes Execute events to register in CommandManager.         /// </summary>         /// <param name="execute"> Execute method as action. </param>         public RelayComm...