May 2012 | Coding Cluster - using asp.net, c#, mvc 4, iphone, php, ios, javascript, in asp.net mvc 3 & more
 

Solution-iphone - UIImagePickerController memory warning("Received memory warning")

Friday

Iphone crash report - Low Memory Warning:  while using UIImagePickerController :
                                                                                              In one of my Iphone project I've  a UIImagePickerController as a synthesized property of my view controller. In general it works fine  for taking/picking photos.  If  I choose/take photos continuously  then I received a memory warning and  the UIImageView become empty(without image).  Some times the app was automatically closed.  I have tried to setting self.imageView.image = nil in viewDidUnload but I got the same "Received memory warning" message. Finally I got the following solution from web.
                   The  solution for UIImagePickerController memory warning is the imagePicker/imageView  wasn't being set to nil in viewDidUnload, but  it needed to remove/dismiss it in didReceiveMemoryWarning method.



Issue:

Solution:
-(void)didreceivememorywarning {
// Release anything that's not essential, such as cached data (meaning //instance variables, and what else...?)

self.imageView.image = nil;

// Releases the view if it doesn't have a superview
[super didReceiveMemoryWarning];

}

                      


Demo/Download:Javascript slider control for numeric inputs

Tuesday

Javascript Slider Control - Example:

         In one of my client's project I need a slider control for change the light's intensity by using slider control. The intensity range from 0 to 100. But don't allow the user to give intensity bellow 30. This means prevent the user to move the slider bellow30.

          So I got a slider control from web and modified with the above requirement. It's done by following way, I create two div elements  first div contains the value 0...30 and its height is 4px(slider height) with green static background which means the user can't move the slider up to 30(a small trick!).

        The second div contains the original slider control and its value from 30...100. If  you face any div height problem with IE you can find the solution for div height not work with IE from here.

         In this following example i'm showing three types of slider control. The first one is normal slider control with number( 0 to 100). Second one is  slider control with number( 0 to 100) and minimum level validation. Finally Javascript slider show in popup.

Javascript slider control with number( 0 to 100):
                           This type of slider start with 0 and end with 100. And there is  a text box to shown your changed values. The text box value is automatically changed while you move slider handle. See the first slider of the following picture.

Javascript  slider control with number( 0 to 100) and minimum level validation:
                             This type of slider start with 30(you can change this ) and end with 100.  That means  you can't move slider to bellow 30(or your wish). simply said, you can disable your user to move slider under  a minimum level. Also  there is  a text box to shown your changed values . The text box value is automatically changed while you move slider handle. See the second  slider of the following picture.

 Javascript slider show in popup:
                                The above slider also shown in a popup control. See the third slider of the following image

                           

Download Javscript slider control from here.

If this post was help to you. Then  Share this to your friends. Thanks!

iPhone:Create a unique identifier (UUID) for ios using CFUUIDCreate

Friday

 How to Create Unique identifier for an iPhone app:
                                                                      The UIDevice uniqueIdentifier property is deprecated in iOS 5 and above and it raise the following questions in our mind.

How to create a GUID/UUID using the iPhone SDK?

iOS 5 deprecates UDID as identifier for developers - What To Do Now?  


                                            The answer is simple and same for all above questions. That is, we can create UUID by our own code to solve this problems. Call the CFUUIDCreate function to create a UUID.
Because,

[[UIDevice currentDevice] uniqueIdentifier];

   used to returns the Unique ID of our iPhone. This is now deprecated and apps are being rejected from the App Store for using it. Create UUID is now the preferred approach.

                       The UUID created by CFUUIDCreate is unique if a user uninstalls and re-installs the app, you will get a new one each time. It means the newly created UUID doesn't change until you delete the app. If you delete the app the UUID also gone and get new one when you re-install the app (It will not change while close and re-open the apps).

Create a UUID, and write it to the defaults database using the NSUserDefaults class:
                      To create a unique identifier specific to your app, you can call the CFUUIDCreate function to create a UUID, and write it to the defaults database using the NSUserDefaults class.

Here is a code for create UUID,

// Create unique identifier for this app(UUID) by using CFUUIDCreate and stored into the NSUserDefaults

- (NSString *)createUUID { 
    
    NSString *uIdentifier = [[NSUserDefaults standardUserDefaults] objectForKey:@"Unique identifier for myApp"];
 
    if (!uIdentifier) {
        
        CFUUIDRef uuidRef = CFUUIDCreate(NULL);
        
        CFStringRef uuidStringRef = CFUUIDCreateString(NULL, uuidRef);
        
        CFRelease(uuidRef);
        
        uIdentifier = [NSString stringWithString:(NSString *)uuidStringRef];
        
        CFRelease(uuidStringRef);
        
        [[NSUserDefaults standardUserDefaults] setObject:uIdentifier forKey:@"Unique identifier for myApp"];
        
        [[NSUserDefaults standardUserDefaults] synchronize];
        
    }
    
    return uIdentifier;    
}

And get the UUID,

NSString *myAppUniqueID =[self createUUID]; 


If this post  useful to you :  like codingcluster on face book . Thanks!.

Solution:The type or namespace name 'List' could not be found (are you missing a using directive or an assembly reference?)

Thursday

How to fix - The type or namespace name 'List' could not be found - error in ASP.NET?
                          "The type or namespace name 'List' could not be found (are you missing a using directive or an assembly reference?)" error means you just missed to add appropriate namespace. To fix this issue you just add  Generic Collections namespace in your page top.

                   using System.Collections.Generic;

 
 
 

RECENT POSTS

Boost

 
Blogger Widgets