ArchiveApril 2012

Servlet Lifecycle

S

Hi friends,  in this post we will take an overview of servlet lifecycle. First of all lets just know what is  servlet? Servlet is a java program which runs on server side. Servlet interacts with the client via request-response. It is nothing but HTML code embedded into java code. When any servlet get called container first checks that whether the object of requested servlet is already exists, if...

How to make an AI Enemy Car in which it follows the track during the Race ?

H

The AI for enemy car can be done by using waypoints method.. the following code is used var waypoint : Transform[]; var speed : float =20; private var currentWaypoint : int; var loop : boolean = true; function Awake() {waypoint[0]=transform;} function Update () { if(currentWaypoint < waypoint.Length) { var target : Vector3 = waypoint[currentWaypoint].position; var moveDirection : Vector3 =...

How to move the image on touch in android

H

image.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { layoutParams1 = (RelativeLayout.LayoutParams) image.getLayoutParams(); switch(event.getActionMasked()) { case MotionEvent.ACTION_DOWN: break; case MotionEvent.ACTION_UP: x_cord = (int) event.getRawX(); if (x_cord la.getWidth()) { x_cord= la.getWidth();...

How to pick music file from music library in iPhone application

H

Like UIImagePickerView to pick image from image gallery we can also pick up any music file from the music gallery of the device and can use it in our application with the help of MPMediaPickerController. For that you need to add AVFoundation framework in your application. also to play the picked file we need to add MediaPlayer framework. and to use them just import them in respective view...

Custom Fonts in Blackberry Application

C

Download the .ttf (True Type Font)file and include it in src folder. Include this code into the constructor. EditField edField1 = new EditField (“”, “TestEditField”, 30, EditField.READONLY| EditField.FIELD_VCENTER){ protected void layout(int width, int height) { super.layout(customWidth, customHeight); setExtent(customWidth, customHeight); } }; Font fo3 =...

How to get parameters passed to a URL in salesforce apex

H

If we pass parameter while creating a page in salesforce apex like this public PageReference setParameter() { public papageReference ref = new PageReference(‘/apex/print?email=’ + textEmail1);    ref.setRedirect(true); return ref; } where email is the parameter. Then using the following function we can get the value of the parameter passed public getParameter() { email = ApexPages...

Function For returning Multiple values in iphone

F

Function For returning Multiple values in iphone – (void)viewDidLoad { [super viewDidLoad]; //Return In Dictionary NSDictionary *FullName = [Self FullnameDict:@”AAAA,BBBB”]; NSString *FName = [Name objectForKey:@”firstame”]; NSString *LName = [Name objectForKey:@”lastname”]; //Return In Array NSArray *FullName1 = [Self...

Conversion of NSString to NSDate and NSDate to NSString

C

  Here is the way to convert NSDate to NSString in objective C Conversion of NSDate to NSString : NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; [dateFormat setDateFormat:@”yyyy-dd-MMM”]; NSString *dateString = [dateFormat stringFromDate:today]; NSLog(@”date: %@”, dateString); [dateFormat release]; Note that today should be your NSDate object which you...

Extracting data from Apple iTunes

E

I tried a lot to find RSS feeds for latest apps getting posted on Apple iTunes store under all categories but couldnt find anywhere, not sure why Apple does not provide such feed. So I decided to write one of my own and below is how I accomplished the task using curl in php. Through httpfiddler I first out request headers sent by iTunes software and used the same.   <?php function...

Category