Author Archive

The javascript code is given below. It uses JQuery.

How to Check and limit the file upload size using PHP ?
We can check the file size uploaded to server using the script given below:

 
How to Limit File Upload Time Using PHP ?
We can limit the time taken to upload files to server by editing the pho.ini file. Edit the following line to set the upload time on your site:
ini_set(‘max_input_time’, 300);

Use Zend_Debug::dump($foo); instead of using var_dump($foo); or print_r($foo); it is essentially the same, just a wrapper with pre HTML tag for formatting and escaping of special characters.
 

However there will be times that simply dumping objects to the screen can be too much and cause browser hangups or even crashes. So the best practice is to always use the getData() method that Magento has built-in to the Varient Object, this will prevent redundant amounts of data dumped to the screen, but only the bits we really want.

Facebook, Twitter Sharing in Windows Phone

The easiest way to add Twitter and Facebook share buttons is to use the ShareLinkTask class. This class allows your Windows Phone application to launch a dialog that enables the user to share a link on the social networks (of their choice). All you need to do is to use the following code..

shareLinkTask.Title = “Article Title”;

shareLinkTask.LinkUri = new Uri(“http://www.microsoft.com“, UriKind.Absolute);

shareLinkTask.Message = “Some Message to be shared”;

shareLinkTask.Show();

 
 

Incoming search terms:

  • windows phone sharelinktask facebook

Implementing Confirm on exit in Windows Phone

Create a function for clear navigation history:

private
void
ClearBackEntries()
{
   while(NavigationService.BackStack != null
& NavigationService.BackStack.Count() > 0)
NavigationService.RemoveBackEntry();
}
Manage the phone BackKeyPress event in your MainPage.xaml
private
void
PhoneApplicationPage_BackKeyPress(object sender, System.ComponentModel.CancelEventArgs e)
{
    // TO DO
}

Insert a MessageBox dialog and use stop back event when the user don’t want exit the application
 
if(MessageBox.Show(“Are you sure?”, “Exit?”, MessageBoxButton.OKCancel) == MessageBoxResult.OK)
this.ClearBackEntries();
else
e.Cancel = true

Incoming search terms:

  • implementation of exit in html5 for wp7
  • ios how to confirm to exit
  • windows phone 8 confirm exit

Restore scroll direction in lion OSX

The new version of Mac OS ie Lion OS has reversed the scroll direction. It is useful only if we are using a touchpad. Scrolling with mouse in a different manner than we are used to is difficult. It is easy to restore the scroll direction to that of the scrollbar.

Open system preferences> select mouse> Uncheck ‘Move content in the direction of finger movement.

Adding a Custom UIBarButtonItem

We will use an image in the resources folder called “back.png”. To insert the image as the back button, add this piece of code to the AppDelegate.m file. This should be in the application:didFinishLaunchingWihOptions method.

Incoming search terms:

  • alphabet as a uibarbuttonitem

Multi Line Label in Cocos2d

If you need to add multi-line text on a dialog box, here’s how to do it.

 
 

Using CCLabel

CCLabel* myLabel = [CCLabel labelWithString: @"A Text" fontName: @"Arial" fontSize: 16];

 
 

Another way using CCLabel

CCLabel* myLabel = [CCLabel labelWithString:@"A text"

dimensions: CGSizeMake(200, 300)

alignment:UITextAlignmentLeft

fontName:@"Arial"

fontSize:16];

 
 

Using CCBitmapFontAtlas

-(void) setTipString:(NSString*)str {

 

NSInteger lineChars = 0;

BOOL isSpace = NO;

NSInteger index = 0;

NSInteger numLines = 0;

NSInteger LINE_LENGTH = 30; // this is each line’s length, in characters

NSMutableString *line = [NSMutableString stringWithCapacity:LINE_LENGTH];

 

while (index <= [str length]) {

if(index == [str length]) {

CCBitmapFontAtlas *tip = [[CCBitmapFontAtlas bitmapFontAtlasWithString:[NSString stringWithString:line]

fntFile:@”text.fnt”] retain];

[tip setPosition: ccp(30,210 - 20 * numLines)];

[self addChild:tip];        

[tip release];

return;

}

 

 

NSString *tmp = [str substringWithRange:NSMakeRange(index, 1)];

[line appendString:tmp];

 

if([tmp isEqual:@" "])

isSpace = YES;

else

isSpace = NO;

 

if(lineChars >= LINE_LENGTH && isSpace) {

CCBitmapFontAtlas *tip = [[CCBitmapFontAtlas bitmapFontAtlasWithString:[NSString stringWithString:line]

fntFile:@”text.fnt”] retain];

[tip setPosition: ccp(30,210 - 20 * numLines)];

[self addChild:tip];        

[tip release];

lineChars = -1;

[line setString:@""];

numLines++;

}

lineChars++;

index++;

}

}

 
 

 
 

 
 

 
 

 
 

Pop Over in Objective c

Incoming search terms:

  • eventi popover objective-c ios
Page 1 of 4212345...102030...Last »