Browse Month: March 2012

Maximum number of custom fields allowed for Developer’s edition of Salesforce.com

I was creating custom fields for a particular site and just got notification that the maximum number of custom fields reached. Please contact your administrator. The maximum number of custom fields allowed for developer’s edition are 500 fields/per object. Similarly for professional edition it is 100 fields/object.Additional restrictions apply for activities, long text area fields, relationship fields, and roll-up summary fields.

Which framework is best for PHP?

These days, Website Developer, Designer or Programmer asks a common question all the time-“Which framework is best for PHP?“. Because of availability of various frameworks like CodeIgniter, CakePHP, Zend, Symfony, Yii, etc., my answer is- its depends on following points(or we have to consider following points):

  • What is my application going to do?
  • which framework has a stable community?
  • which framework has a good resource available?
  • which framework is under solid development phase and not in “discontinued” mode?

Once you have the answer, you need to know that there are basically three types of framework though they offer MVC or HMVC work flow.

  1. Some frameworks are liberal.
  2. Some frameworks are too strict.
  3. Some of them are over strict and configuration junky.

Take a look, Codeigniter, It is extremely liberal, allowed me to write bad code. means we can called model inside view. Its a very light weight and good for small project or application.

Now take a look on CakePHP, as per conventions it is strict type. But as per standard and as a requirement for big application, it fits.

Take a look on Symfony, its a moving into strict and configuration junky type.

in short, if you are a beginner with MVC and want to learn a framework from the heart, start with Zend Framework or CakePHP. Soon you will realize that you may not have to move or use any other framework unless the situation requires it. Saying that, there are other very good frameworks out there like Yii, CodeIgniter and Kohana etc.

Getting a Maps API Key from Google in Andriod Application

The MapView class in the Maps external library is a very useful class that lets you easily integrate Google Maps into your application. It provides built-in map downloading, rendering, and caching of Maps tiles, as well as a variety of display options and controls.

Because MapView gives you access to Google Maps data, you need to register with the Google Maps service and agree to the applicable Terms of Service before your MapView will be able to obtain data from Google Maps. This will apply whether you are developing your application on the emulator or preparing your application for deployment to mobile devices.

Registering for a Maps API Key is simple, free, and has two parts:

  1. Registering the MD5 fingerprint of the certificate that you will use to sign your application. The Maps registration service then provides you a Maps API Key that is associated with your application’s signer certificate.
  2. Adding a reference to the Maps API Key in each MapView, whether declared in XML or instantiated directly from code. You can use the same Maps API Key for any MapView in any Android application, provided that the application is signed with the certificate whose fingerprint you registered with the service.

Getting the MD5 Fingerprint of the SDK Debug Certificate:

1. first get the full path of “debug.keystore” ,

By default, build tools create the debug keystore in the active AVD directory. The location of the AVD directories varies by platform:

  • Windows Vista: C:Users<user>.androiddebug.keystore
  • Windows XP: C:Documents and Settings<user>.androiddebug.keystore
  • OS X and Linux: ~/.android/debug.keystore
  • If you are using Eclipse/ADT and are unsure where the debug keystore is located, you can select Windows > Prefs > Android > Build to check the full path, which you can then paste into a file explorer to locate the directory containing the keystore.

2. then open command prompt, locate the keytool (which is present in C:\jdkbin> folder)

3. then run the following command.

$ keytool -list -alias androiddebugkey 
-keystore <path_to_debug_keystore>.keystore 
-storepass android -keypass android

here <path_to_debug_keystore > is replace by full path in above first step.
now press enter .

it will ask password.
do not write any thing in password just again press enter.

It will give MD5 fingerprint key , note down it.

 

Registering the Certificate Fingerprint with the Google Maps Service

When you are ready to register for a Maps API Key, load this page in a browser:

http://code.google. com/android/maps-api-signup.html

To register for a Maps API Key, follow these steps:

  1. If you don’t have a Google account, use the link on the page to set one up.
  2. Read the Android Maps API Terms of Service carefully. If you agree to the terms, indicate so using the check-box on the screen.
  3. Paste the MD5 certificate fingerprint of the certificate that you are registering into the appropriate form field.
  4. Click “Generate API Key”

use this unique key in your application .

You will get result ,

Thanks

Movement from Unity 3d into Unity 3D iOS or Android

if u want to using buttons use this it will work in unity 3d and ios

void OnGUI()
{
    if(GUI.RepeatButton(new Rect(50,210,40,40),"up"))
    {
       transform.Translate(Vector3.forward*Time.deltaTime*50); 

    }

    if(GUI.RepeatButton(new Rect(50,280,40,40),"down"))
    {
       transform.Translate(Vector3.back*Time.deltaTime*50);

    }

    if(GUI.RepeatButton(new Rect(10,250,40,40),"left"))
    {
       transform.Rotate(Vector3.down, 90*Time.deltaTime);
    }

    if(GUI.RepeatButton(new Rect(90,250,40,40),"right"))
    {
       transform.Rotate(Vector3.up, 90*Time.deltaTime);
    }
}

other wise,

u can use joystick for the movement in ios. the standard package is present in standard assets mobile in the unity itself.
so u try it once.
In menu->assets->import package->standard assets(mobile)

 

How To Update ProgressBar in iPhone

//———————
.h File
{
NSTimer *timer;
UIProgressView *myProgressBar;
int StartingValue;
}
@property (nonatomic, retain) UIProgressView *myProgressBar;

//————
.m File
@synthesize myProgressBar;

– (void)viewDidLoad
{
StartingValue = 0;

myProgressBar = [[UIProgressView alloc] init];
myProgressBar.frame = CGRectMake(25, 100, 235, 10);
myProgressBar.progress = 0.0f;
[self.view addSubview:myProgressBar];

timer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(updateProgressBar) userInfo:nil repeats:YES];
}
– (void) updateProgressBar
{
StartingValue ++;

float result =((float) StartingValue/(float)100)*100.0;
myProgressBar.progress = result/100.0f;
}

How to add an icon to your iPhone application?

In this post we will learn how to add icon file to iphone application.

First you must have icon file 57 x 57 pixels in png format.

Once your icon is ready in 57 x 57 pixels and named Icon.png, right click the resources folder and add the Icon.png to resources and do not forget to check the  ‘Copy items into Destination’s folder’ box. Then in Resources folder , find “YourAppName-Info.plist” and open it.

Edit the “Icon file” field and put the name of your icon in it i. e. Icon.png as shown in screenshot.

Now, you can run the application and can see the icon added by you for the application……

To get the Multiple Notification on android Device

use this code to get the multiple notification on Android Device

TO write this code on the set timer

Intent intent = new Intent(SecondActivity.this, MyBroadcastReceiver.class);   intent.putExtra(“ID”, 10);   intent.putExtra(“Val”, “me aahe”);   final int intent_id= (int) System.currentTimeMillis();
PendingIntent p1 = PendingIntent.getBroadcast(getApplicationContext(), intent_id,intent,PendingIntent.FLAG_UPDATE_CURRENT);   AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE);   Calendar calendar = Calendar.getInstance();   calendar.setTimeInMillis(System.currentTimeMillis()); //   calendar.add(Calendar.SECOND,i);   alarmManager.set(AlarmManager.RTC_WAKEUP,  System.currentTimeMillis()+ (10 * 1000),p1 );

 

And get the notification onRecive()

Bundle extra=intent.getExtras(); int id=extra.getInt(“ID”); String ab=extra.getString(“Val”); Toast.makeText(context,”To DeActivate coupon  ” +id +ab, Toast.LENGTH_SHORT).show(); NotificationManager mNotificationManager =(NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE); NotificationManager manger = (NotificationManager)      context.getSystemService(Context.NOTIFICATION_SERVICE); Notification notification = new Notification(R.drawable.icon, “”+id, System.currentTimeMillis()); PendingIntent contentIntent = PendingIntent.getActivity(context,id,new Intent(), 0); notification.setLatestEventInfo(context, “HELLO”,””+id, contentIntent); notification.flags = Notification.FLAG_INSISTENT; // notification.defaults |= Notification.DEFAULT_SOUND; notification.flags=Notification.FLAG_AUTO_CANCEL; //notification.number+=1; manger.notify(id, notification);

 

 

How to add MPMoviePlayerController in View

First Add Framework for MPMoviePlayerController : “MediaPlayer.Framework

.h File
#import <UIKit/UIKit.h>
#import <MediaPlayer/MediaPlayer.h>

@class MPMoviePlayerController;

@interface TestViewController : UIViewController
{
MPMoviePlayerController *moviePlayer;
}
—————————————————————————-
.m File
-(void)ViewDidLoad
{
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL      fileURLWithPath:[[NSBundle mainBundle]     pathForResource:@”Movie-1″      ofType:@”mp4″]]];

moviePlayer.view.frame = CGRectMake(0, 0, 320, 480);
[moviePlayer setControlStyle:MPMovieControlStyleFullscreen];
[moviePlayer setFullscreen:YES animated:YES];
moviePlayer.shouldAutoplay = YES;

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayer];
[moviePlayer play];
[self.view addSubview:moviePlayer.view];
}

-(void) moviePlayBackDidFinish:(NSNotification*)notification
{
[self dismissModalViewControllerAnimated:NO];
}

How to get Latitude,Longitude of two cities and Calculate Distance in iphone

import Framework
CoreLocation.framework
MapKit.framework

 
//————————————————————————
#import “ViewController.h”
#import <MapKit/MapKit.h>
 
NSMutableArray *citynamearray;
NSMutableArray *latarray,*longarray;
 

//————————————————————————
#import “ViewController.m”
– (void)viewDidLoad
{
[super viewDidLoad];
citynamearray = [[NSMutableArray alloc]init];
 
latarray = [[NSMutableArray alloc]init];
longarray =[[NSMutableArray alloc]init];
 
[citynamearray addObject:CityName1];
[citynamearray addObject:CityName2];
 
for (int i = 0; i < [citynamearray count]; i++)
{
NSString *urlpath = [NSString stringWithFormat:@”http://maps.googleapis.com/maps/api/geocode/json?address=%@&sensor=true”,[citynamearray objectAtIndex:i]];
 
NSURL *path = [NSURL URLWithString:urlpath];
NSData* data = [NSData dataWithContentsOfURL:path];
[self performSelectorOnMainThread:@selector(fetchedLatLong:) withObject:data waitUntilDone:YES];
}
 
[self CalculateDistance :[latarray objectAtIndex:0]  :[longarray objectAtIndex:0]  :[latarray objectAtIndex:1] :[longarray objectAtIndex:1]];
}
 
– (void)fetchedLatLong:(NSData *)responseData
{
NSError* error;
NSDictionary* json = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&error];
 
NSArray *items = [json objectForKey:@”results”];
 
NSArray *items1 = [items valueForKey:@”geometry”];
NSArray *items2 = [items1 valueForKey:@”location”];
 
NSString *latlongstr = [NSString stringWithFormat:@”%@”,[items2 objectAtIndex:0]];
latlongstr = [latlongstr stringByReplacingOccurrencesOfString:@” ” withString:@””];
latlongstr = [latlongstr stringByReplacingOccurrencesOfString:@”n” withString:@””];
latlongstr = [latlongstr stringByReplacingOccurrencesOfString:@”}” withString:@””];
 
NSArray *latlngarr = [latlongstr componentsSeparatedByString:@”;”];
NSString *lat = [NSString stringWithFormat:@”%@”,[latlngarr objectAtIndex:0]];
lat = [lat stringByReplacingOccurrencesOfString:@”{lat=”” withString:@””];
lat = [lat stringByReplacingOccurrencesOfString:@””” withString:@””];
 
NSString *lng = [NSString stringWithFormat:@”%@”,[latlngarr objectAtIndex:1]];
lng = [lng stringByReplacingOccurrencesOfString:@”lng=”” withString:@””];
lng = [lng stringByReplacingOccurrencesOfString:@””” withString:@””];
 
[latarray addObject:lat];
[longarray addObject:lng];
 
NSLog(@”Lat %@ Long%@=”,latarray,longarray);
}
 
– (void) CalculateDistance : (NSString *)a : (NSString *)b :(NSString *)c :(NSString *)d
{
CLLocation *location1 = [[CLLocation alloc] initWithLatitude:[a floatValue] longitude:[b floatValue]];
CLLocation *location2 = [[CLLocation alloc] initWithLatitude:[c floatValue] longitude:[d floatValue]];
 
NSString *Distance = [NSString stringWithFormat:@”Distance :%f meters”,[location1 distanceFromLocation:location2] * 0.001];
NSLog(@”Distance =%@”,Distance);
 
[location1 release];
[location2 release];
}

  • 1
  • 2