var panel = new Ext.Panel({
fullscreen: true,
items: [{
xtype: 'map',
useCurrentLocation: true
}]
});
source: sencha.com
var panel = new Ext.Panel({
fullscreen: true,
items: [{
xtype: 'map',
useCurrentLocation: true
}]
});
source: sencha.com
For loading a scene using storyboard class in Corona SDK,
local storyboard = require "storyboard" storyboard.gotoScene( "MenuScene" )
Here ‘MenuScene’ is the scene you want to get loaded.
For replicating strings in Corona SDK,
Syntax:
string.rep( s, n ) s:rep( n )
Example:
print (string.rep ("Hai ", 3))
Output- Hai Hai Hai
For reversing a string in Corona SDK,
Syntax: string.reverse( s ) s:reverse()
Example:
print( string.reverse ("Cat") )
OutPut: taC
Consider a UITableVIew, myTableView and a UITableViewCell object, named myCell, representing a cell of myTableView.
Now you can get the indexpath of myCell as follows:
NSIndexPath *indexPath = [myTableView indexPathForCell:myCell];
Consider a NSMutableString object mutableStr.
NSMutableString *mutableStr = [ [NSMutableString alloc] initWithString:@"My name is Happy and I'm very happy."]; // Creating and initializing NSMutableString object.
Now if you want to replace the “happy” in the string to “sad”, then
[mutableStr replaceOccurrencesOfString:@"happy" withString:@"sad" options: NSCaseInsensitiveSearch range:NSMakeRange(0, [mutableStr length])]; // This will replace all both "Happy" and "happy" in the string to "sad".
Now the mutableStr value will be as follows:
My name is sad and I’m very sad.
If you want to replace only the “happy”, then you should do as follows:
[mutableStr replaceOccurrencesOfString:@"happy" withString:@"sad" options:NSLiteralSearch range:NSMakeRange(0, [mutableStr length])]; // This will replace only "happy" to sad.
Now the mutableStr value will be as follows:
My name is Happy and I’m very sad.
The following code snippet will give you the device ID your Blackberry Phone:
String deviceID = Integer.toHexString(DeviceInfo.getDeviceId());
That’s it!
String stringAudio = "";
byte[] voice;
voice = getAudioBytes();
try {
stringAudio = Base64OutputStream.encodeAsString(voice, 0, voice.length, false, false);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
** This is useful at the time of sending audio video files to web server. **
Network connection fail frequently especially for mobile clients. For example if you switch from Wifi to 3G then an existing network connection will break and you need to retry the request.
The Apache HttpClient has an default DefaultHttpRequestRetryHandler object registered which will per default 3 times retry a failed connection. The problem is that switching from one network to another make take a little while and DefaultHttpRequestRetryHandler will retry immediately.
To work around this issue you can implement your own version of DefaultHttpRequestRetryHandler in which you wait a pre-defined time.
For example the implementation could look like:
AbstractHttpClient client = (AbstractHttpClient) new DefaultHttpClient();
DefaultHttpRequestRetryHandler retryHandler = new DefaultHttpRequestRetryHandler() {
@Override
public boolean retryRequest(IOException exception, int executionCount, HttpContext context) {
if (!super.retryRequest(exception, executionCount, context)) {
return false;
}
// Retry but wait a bit
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
return true;
}
};
client.setHttpRequestRetryHandler(retryHandler);