Browse Month: May 2012

Converting Sencha Touch 2 in Android.

Requirement  –Android SDK Tools

Steps to package your Android application

1-     Obtain an appropriate Android ready certificate (debug or release) for signing the application

2-     Install Sencha SDK Tools (SenchaSDKTools 2.0).

3-     Create a packaging configuration file to be use with the packager.

4-     Run the packager to create a packaged .apk.

Create a packaging configuration file to be used with the native packager.

Code- Packager.json


“applicationName”: “<AppName>”,

“applicationId”: “<AppID>”,

“outputPath”: “<AppPackageOutputPath>”,

“iconName”: “<AppIconName>”,

“versionString”: “<AppVersion>”,

“inputPath”: “<PathToWebApp>”,

“configuration”: “<Release | Debug>”,

“platform”: “<Android | AndroidEmulator>”,

“certificatePath”: “<certificatePath>”,

“certificateAlias”: “<certificateAlias>”,

“sdkPath”: “/android-sdk-mac_86”,

“orientations”: [






“deviceType”: “<Not applicable for Android>”


If Our Application Name ListDemo then Code-
















“orientations”: [







Run the packager to create a packaged ListDemo.apk

Command –

sencha package run packager.json

it will create ListDemo.apk

How to solve “extra qualification” compiler error of symbian 5th SDK

Error:extra qualification ‘CAknVolumeControl::’ on member ‘ScaledValue’
This problem is caused by CAknVolumeControl which is a part of the underlying Symbian SDK. The additional qualifier used on the ScaledValue() function does not compile with the GCCE compiler. This error should be reported to the Symbian Foundation so that they can change it in S60.

In the meantime, I believe you could just edit the header file locally to get you application to compile. Just open the aknvolumecontrol.h file and replace this line:-
TInt CAknVolumeControl::ScaledValue() const;

With this one:-
TInt ScaledValue() const;
That should be enough to get your application compiling.

How to record voice programatically and store on the server in iphone

#import <AVFoundation/AVFoundation.h>
#import <CoreAudio/CoreAudioTypes.h>
Add delegate
@interface VoiceRecord : UIViewController <AVAudioRecorderDelegate>
-(void) recordstart
AVAudioSession * audioSession = [AVAudioSession sharedInstance];

[audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error: &error];
[audioSession setActive:YES error: &error];

NSMutableDictionary *recordSetting = [[NSMutableDictionary alloc] init];
[recordSetting setValue :[NSNumber numberWithInt:kAudioFormatAppleIMA4] forKey:AVFormatIDKey];
[recordSetting setValue:[NSNumber numberWithFloat:44100.0] forKey:AVSampleRateKey];
[recordSetting setValue:[NSNumber numberWithInt: 2] forKey:AVNumberOfChannelsKey];

recordedTmpFile = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent: [NSString stringWithFormat: @”%.0f.%@”, [NSDate timeIntervalSinceReferenceDate] *     1000.0, @””]]];
NSLog(@”Using File called: %@”,recordedTmpFile);

recorder = [[ AVAudioRecorder alloc] initWithURL:recordedTmpFile settings:recordSetting error:&error];
[recorder setDelegate:self];
[recorder prepareToRecord];
[recorder record];
or if you want to Store on server then use below more code
-(void) Storeonserver
file1Data = [NSData dataWithContentsOfFile:[recordedTmpFile path]];
//Create web Service
NSString *urlString = @””;

NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];
[request setURL:[NSURL URLWithString:urlString]];
[request setHTTPMethod:@”POST”];

NSString *boundary = [NSString stringWithString:@”—————————14737809831466499882746641449″];
NSString *contentType = [NSString stringWithFormat:@”multipart/form-data; boundary=%@”,boundary];
[request addValue:contentType forHTTPHeaderField: @”Content-Type”];

NSMutableData *body = [NSMutableData data];
[body appendData:[[NSString stringWithFormat:@”rn–%@rn”,boundary] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[[NSString stringWithString:[NSString stringWithFormat:@”Content-Disposition: form-data; name=”userfile”; filename=””rn”]] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[[NSString stringWithString:@”Content-Type: application/octet-streamrnrn”] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[NSData dataWithData:file1Data]];
[body appendData:[[NSString stringWithFormat:@”rn–%@–rn”,boundary] dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:body];
NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
NSString *returnString = [[[NSString alloc] initWithData:returnData encoding:NSUTF8StringEncoding] autorelease];
NSLog(@”Return String= %@”,returnString);
//Play Recording
-(void) playback
//Play recoding from server
NSData *mydata = [NSData dataWithContentsOfURL:[NSURL URLWithString:@””]];
AVAudioPlayer * avPlayer = [[AVAudioPlayer alloc] initWithData:mydata error:nil];
[avPlayer prepareToPlay];
[avPlayer play];

//or use this code for latest recoding and play
AVAudioPlayer * avPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:recordedTmpFile error:&error];
NSLog(@”%@”, recordedTmpFile);
[avPlayer prepareToPlay];
[avPlayer play];

Asynchronous Download images from Url And Save into Documents Directory in iphone

@interface ViewController : UIViewController
UIActivityIndicatorView *ProccessIndicator;
NSMutableArray *imgnmarr,*imgurlarr;
– (void) loadImageInBackground:(NSArray *)urlAndTagReference
– (void) assignImageToImageView:(NSArray *)imgAndTagReference
– (void)viewDidLoad
[super viewDidLoad];
[self.view setBackgroundColor:[UIColor blueColor]];
[self LazyLoading];
– (void) LazyLoading
imgnmarr = [[NSMutableArray alloc] init];
imgurlarr = [[NSMutableArray alloc] init];

//Mutable Array of images Url
[imgurlarr addObject:@””];
[imgurlarr addObject:@””];
[imgurlarr addObject:@””];
[imgurlarr addObject:@””];

//Mutable Array of Image Names To Save In DOcuments Directory
[imgnmarr addObject:@”Paddy_dest_1.png”];
[imgnmarr addObject:@”Paddy_dest_2.png”];
[imgnmarr addObject:@”Paddy_dest_3.png”];
[imgnmarr addObject:@”Paddy_dest_4.png”];

int flag = 0;

for (int i = 0; i < 2; i++)
for (int j = 0 ; j < 2; j++)

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *savedImagePath = [documentsDirectory stringByAppendingPathComponent:[imgnmarr objectAtIndex:flag-1]];
UIImage *img1 = [UIImage imageWithContentsOfFile:savedImagePath];

if (!img1 || [UIImagePNGRepresentation(img1) length] <=0)
id path =[imgurlarr objectAtIndex:flag-1];
path = [path stringByReplacingOccurrencesOfString:@" "
NSURL *url = [NSURL URLWithString:path];
NSMutableArray *arr = [[NSMutableArray alloc] initWithObjects:url, [NSString stringWithFormat:@"%d", flag], nil];
[self performSelectorInBackground:@selector(loadImageInBackground:) withObject:arr];

ProccessIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
ProccessIndicator.frame = CGRectMake(55+ (140 * j), 99 + (125 * i), 68, 55);
ProccessIndicator.hidesWhenStopped = YES;
[self.view addSubview:ProccessIndicator];
[ProccessIndicator startAnimating];

UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(55+ (140 * j), 99 + (125 * i), 68, 55)];
imageView.tag = flag;

imageView.layer.masksToBounds = YES;
imageView.layer.cornerRadius = 15.0;
imageView.layer.borderWidth = 1.0;
imageView.layer.borderColor = [[UIColor blackColor] CGColor];

imageView.layer.shadowColor = [UIColor blackColor].CGColor;
imageView.layer.shadowOffset = CGSizeMake(0, 1);
imageView.layer.shadowOpacity = 1;
imageView.layer.shadowRadius = 1.0;

[self.view addSubview:imageView];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(55+ (140 * j), 99 + (125 * i), 68, 55)];
imageView.tag = flag-1;
imageView.image = img1;

imageView.layer.masksToBounds = YES;
imageView.layer.cornerRadius = 15.0;
imageView.layer.borderWidth = 1.0;
imageView.layer.borderColor = [[UIColor blackColor] CGColor];

imageView.layer.shadowColor = [UIColor blackColor].CGColor;
imageView.layer.shadowOffset = CGSizeMake(0, 1);
imageView.layer.shadowOpacity = 1;
imageView.layer.shadowRadius = 1.0;

[self.view addSubview:imageView];
– (void) loadImageInBackground:(NSArray *)urlAndTagReference
NSData *imgData = [NSData dataWithContentsOfURL:[urlAndTagReference objectAtIndex:0]];
UIImage *img = [[UIImage alloc] initWithData:imgData];

NSMutableArray *arr = [[NSMutableArray alloc] initWithObjects:img, [urlAndTagReference objectAtIndex:1], nil];

[self performSelectorOnMainThread:@selector(assignImageToImageView:) withObject:arr waitUntilDone:YES];
– (void) assignImageToImageView:(NSArray *)imgAndTagReference
for (UIImageView *checkView in [self.view subviews] )
if ([checkView tag] == [[imgAndTagReference objectAtIndex:1] intValue])
[checkView setImage:[imgAndTagReference objectAtIndex:0]];

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *savedImagePath = [documentsDirectory stringByAppendingPathComponent:[imgnmarr objectAtIndex:[[imgAndTagReference objectAtIndex:1] intValue]-1]];
UIImage* imageToSave = [checkView image];
NSData *imageData = UIImagePNGRepresentation(imageToSave);
[imageData writeToFile:savedImagePath atomically:NO];

How to create simple Tabs and Buttons in Sencha

Sencha Touch is used to create HTML5 based mobile apps that work on Android, iOS and Blackberry devices.

– To develope  Sencha Touch Applications,  two things are needed:

1. Sencha Touch 2SDK

2. SDK Tools

-There is a command to develop  Sencha Touch Application:

E:wampwwwsencha-touch-2.0.1>sencha generate app  <Application Name >../<Application Name>

-It will create a Directory-















We are editing in app.js file. it will create sencha tab-tools and button



name: ‘app’,


var container = Ext.create(‘Ext.Container’, {

fullscreen: true,

layout: {

type: ‘vbox’,

// align: ‘start’,

//pack: ‘start’


items: [


docked: ‘top’,

xtype: ‘titlebar’,

title: ‘VBox Layout’



docked: ‘bottom’,

xtype: ‘toolbar’,

items: [


xtype: ‘container’,

html: ‘Pack: ‘,

style: ‘color: #fff; padding: 0 10px; width: 85px;’



xtype: ‘segmentedbutton’,

allowDepress: false,

items: [

{ text: ‘Start’,  handler: function() { layout.setPack(‘start’) }, pressed: true },

{ text: ‘Center’, handler: function() { layout.setPack(‘center’) } },

{ text: ‘End’,    handler: function() { layout.setPack(‘end’) } }






docked: ‘top’,

xtype: ‘toolbar’,

items: [


xtype: ‘container’,

html: ‘Align: ‘,

style: ‘color: #fff; padding: 0 10px; width: 85px;’



xtype: ‘segmentedbutton’,

allowDepress: false,

items: [

{ text: ‘Start’,   handler: function() { layout.setAlign(‘start’); }, pressed: true },

{ text: ‘Center’,  handler: function() { layout.setAlign(‘center’); } },

{ text: ‘End’,     handler: function() { layout.setAlign(‘end’); } },

{ text: ‘Stretch’, handler: function() { layout.setAlign(‘stretch’); } }





{ xtype: ‘button’, text: ‘Btn 1’, margin: 2 },

{ xtype: ‘button’, text: ‘Btn 2’, margin: 2 },

{ xtype: ‘button’, text: ‘Btn 3’, margin: 2 }



var layout = container.getLayout();



And Last Run index.html file

How to add an audio file to a button in Unity3D

using UnityEngine;

using System.Collections;

using System;

public class MainMenu : MonoBehaviour {

public AudioSource audioSource;

public AudioClip palySound;

void Start ()  { }

public void OnGUI()

{  if(GUI.Button(new Rect(50,200,100,45),”Play”))  {

audioSource.PlayOneShot(palySound); }


when we attached the script in the inspector.

we have to attach the AudioSource  from the


to the inspector

Five ways to pull yourself out of workaholism

‘In sickness and in health and till death do us part’ – if these are the vows your family and friends think you have exchanged with your Blackberry/keyboard/iPad, then you are a certified workaholic.

The symptoms are many, but some of the significant ones are that you punch away nonstop, receive every call from office and take your meals at odd hours to finish that extra bit at work.

All this leads to anxiety disorders, repetitive stress injury, mental and physical fatigue, and this strong alliance with work is best severed at the start. ET suggests how you can do that.


Draw Clear Boundaries

Clocking out of work is just as important as clocking in. Working post-office hours is acceptable if there is an urgent assignment but if it becomes a habit, alarm bells should start ringing. It helps to unplug phones and computers during vacations and non-working hours.

Check on Employees

Employers need to look into the employees’ attendance sheets and office hours. Sabre, for instance, found that despite giving employees access to wellness centres, counselling sessions and discount coupons at gyms, they were still packing in extra hours at work. The firm, therefore, does not offer the option of carrying forward holidays .

Say a Firm ‘No’

‘Workaholics anonymous’ groups don’t exist, but instead, a simple ‘no’ can go a long way. Complete your tasks first, and only if there is time to spare, offer another a helping hand. Once the tasks are done, wait for the next day to start on the new list of chores.

Extra isn’t Always Healthy

The boss often thinks that those who work round the clock are the productive ones. But a smart worker can be someone who punches in the required hours, completes his work and leaves office on time too.

In a recent Randstad survey of state-owned companies, 80% of employees said they received work-related calls and emails beyond office hours. Nearly 69% said they volunteered to work post-office hours while 79% received work-related calls and emails on holidays. Long hours lead to a dip in productivity and creativity.

Watch your Schedule

Often, the employee in the cubicle next to you could be a night owl at the office, but that need not be your style. Excessive breaks, long water-cooler conversations will ultimately lead to more time in the office, and not a very fruitful schedule.

So what’s the moral of the story??
* Very clear, LEAVE ON TIME!!!
* Never put in extra time ‘ unless really needed ‘
* Don’t stay back unnecessarily and spoil your company work culture which will in turn cause inconvenience to you and your colleagues.

QR_CODE Scanner for Android

“QR Codes” also knows as “Quick Response Codes”. Its two dimensional code (also known as Matrix Barcode ), and can be read easily by a mobile phone.
They fetch piece of information from temporary media and push that in your mobile phone. The reason why they are getting popular than normal Barcode is because they are able to capture more information(data, urls, texts and geo coordinates). Another reason for this  to go popular is because it can be scanned easily by mobile phones. You don’t need to have hand-held scanners to scan them.

Sounds really cool but as a developer it is as complicated as qrcode itself  🙂 .

After lot of searching i came across ZXing application  which returns the result via Intent. Most important thing is this is an open source code (pls correct me if i am wrong)

There are two ways of integrating this app

1- import QRCode scanner app from and start it from some trigger function like button press within your code which will ask you to download Barcode Scanner app from market. download it  and grab the result from onActivityResult() method of your Activity.

2- Copy some of the packages to your project and using camera you can scan the QRCode directly from your app. ( Which i have used 🙂 )

For both of above options the important thing you should do is

* create a .jar file of the source from core folder retrieved from github repo and add to your eclipse project.

for second option you need to add two more .jar files android-integration.jar and android-support-V4.jar (which i have put in the libs folder)

and need to add 5 packages


From your Activity start the SCAN activity like

Intent intent = new Intent(“”);
intent.putExtra(“SCAN_MODE”, “QR_CODE_MODE”);
startActivityForResult(intent, 0);

And in onActivityResult method add following code

public void onActivityResult(int requestCode, int resultCode, Intent intent) {
 if (requestCode == 0) {
 if (resultCode == RESULT_OK) {
 String contents = intent.getStringExtra("SCAN_RESULT");
 String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
 // Handle successful scan
 } else if (resultCode == RESULT_CANCELED) {
 t.setText("Unable to scan the code");

That all you need to do to get it done :).

You can find the source code here.

Skype is conflicting Wamp server. OR Wamp server error – though it is online,it is not working properly and showing orange color on quick launch icon.

Wamp server showing above error massage- Could not execute menu item (internal error). [execution ] Could not perform service action: The service has not been started.

This error is fault of Apache  service of Wamp server.

To solve this error-

1. left click on quick launch icon of wamp server .

2.then goto Apache–> Service–>click on Test Port 80. the following screen will appear.


In my case the Skype Software is conflicting to Wamp Server .

Then, after Exiting the skype Software , my Wamp Server is working Properly .

Another solution  for this error is  –Change the port number of either Wamp or Skype.

Change Port No of skype–>

In skype if you click “tools ” then “options” and connection down the left,

untick the box ” use port 80 and 443 as alternative incoming ports”

then you wont have this issue anymore

Thanks ..!


Need more help?

Hi there, was your problem or query resolved? If not & need more assistance, please do reach out to us at, we'll be more than delighted to help. Nanostuffs has 7+ years of extensive Salesforce & iOS/Android experience.
Holler Box