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 http://code.google.com/p/zxing/source/browse/trunk 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(“com.google.zxing.client.android.SCAN”);
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 ..!


Uploading a document in apex salesforce using custom controller

sometimes you may want to create a process where uploading a document is mandatory. You can create a single Visualforce page with all of the fields for the record plus the field required to upload a document. code  below is an example

<apex:page controller=”docex”>
<apex:outputLabel value=”Document Name”/>
<apex:inputText id=”name” value=”{!d.name}”/>

<apex:outputLabel value=”Upload Document”/>
<apex:inputFile value=”{!file}” />
<apex:commandButton value=”Save” action=”{!insert}” id=”save”/>

public class docex
Document d{get;set;}
public ID folderid{get;set;}

public docex
d= new Document();
public void insert()
folderid=UserInfo.getUserId();    //uses the current user id as folder id
d.body=file;            // body field in document object which holds the file.
d.folderid=folderid;        //folderid where the document will be stored
insert d;


for further reference you can store the id of an document along with other fields in your custom object . and retrieve the contents of the document object by using soql query:

document d=[select body, id , name from document where id=”<stored 18 character id>”]

Add UIButton on UITableView when drag , Swipe or touches moved on Cell Using UIGestureRecognizerDelegate in iPhone

UIButton *YourButton;

– (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
static NSString *SimpleTableIdentifier = @”SimpleTableIdentifier”;

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:SimpleTableIdentifier];

if (cell == nil)
cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:SimpleTableIdentifier] autorelease];
UISwipeGestureRecognizer *gestureL = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(didSwipeL:)];
gestureL.direction = UISwipeGestureRecognizerDirectionLeft;
[cell.contentView addGestureRecognizer:gestureL];
[gestureL release];

UISwipeGestureRecognizer *gestureR = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(didSwipeR:)];
gestureR.direction = UISwipeGestureRecognizerDirectionRight;
[cell.contentView addGestureRecognizer:gestureR];
[gestureR release];

YourButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[YourButton addTarget:self action:@selector(YourButtonMethod:) forControlEvents:UIControlEventTouchDown];
[YourButton setTitle:@”MyButton” forState:UIControlStateNormal];
YourButton.frame = CGRectMake(320, 12.5, 104, 35);
[cell.contentView YourButton];

-(void)didSwipeL:(UIGestureRecognizer *)gestureRecognizer
CGPoint p = [gestureRecognizer locationInView:AppsTable];

NSIndexPath *indexPath = [AppsTable indexPathForRowAtPoint:p];
if (indexPath == nil)
NSLog(@”long press on table view but not on a row”);
NSLog(@”long press on table view at row %d”, indexPath.row);
UITableViewCell *cell = [AppsTable cellForRowAtIndexPath:indexPath];

CGPoint newLeftCenter = CGPointMake( 198 + AddToFavorities.frame.size.width / 2.0f, AddToFavorities.center.y);
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0f];
YourButton.center = newLeftCenter;
[UIView commitAnimations];
YourButton.tag = indexPath.row;
[cell.contentView addSubview:AddToFavorities];

-(void)didSwipeR:(UIGestureRecognizer *)gestureRecognizer
CGPoint p = [gestureRecognizer locationInView:AppsTable];

NSIndexPath *indexPath = [AppsTable indexPathForRowAtPoint:p];
if (indexPath == nil)
NSLog(@”long press on table view but not on a row”);
NSLog(@”long press on table view at row %d”, indexPath.row);
UITableViewCell *cell = [AppsTable cellForRowAtIndexPath:indexPath];

CGPoint newLeftCenter = CGPointMake( 320.0f + AddToFavorities.frame.size.width / 2.0f, AddToFavorities.center.y);
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0f];
YourButton.center = newLeftCenter;
[UIView commitAnimations];
YourButton.tag = indexPath.row;
[cell.contentView addSubview:AddToFavorities];

– (void) YourButtonMethod : (id) sender
//[self retriveAPps];

UIButton *clickedbtn = (UIButton *)sender;
NSLog(@”Added to favorities %d”,clickedbtn.tag);

Launch the app store app from your application


Step 1: Create an empty iPhone application with and add the UIViewController subclass to it.

Step 2: Create a view just like the one given below and the add the view of this view controller into the iPhone window.

Step 3: Create a function for the button and this function will contain the code for launching the app store application of the iOS device from your application. So declare a function with proper name into the your ViewController.h file and implement the same in the yourViewController.m file given below is the code for the same.


MyViewController.h file 


MyViewController.m file


Code Explanation: In the above code since we want to launch the app store we have used the itms-apps: in place of http followed by your application link which is present on the app store.
Step 4: Build your project and deploy the project into the iOS device.
Step 5: After you touch the button you will see the app store app is launched with the application details who’s link you have provided.
You can download the sample project from here.


Note: This demo cannot be tested in the iPhone simulator for the testing of this demo you require this application to be deployed into your iOS device.

This kind of requirement is mostly used when a client requests that he wants a review section in his application. You may also use the link maker from apple to get your application url link.


How to export leads to excel sheet in salesforce apex

Here is the code for exporting leads to excel in salesforce apex

Class Code:

public class exportExcel {

public string header{get;set;}

public List<wrapper> lstwrapper {get; set;}

public class wrapper{

public string Id{get; set;}

public string Name{get; set;}

public string Email{get; set;}    }

public string Filetype{get;set;}

public boolean isExcel {get;set;}

public boolean isCsv {get;set;}

public exportExcel(){

Filetype = ”;

lstwrapper = new List<wrapper>();

header = ‘Id,Name,Email’;


public void exportToExcel(){

string queryString = ‘Select Id, Name, Email from Lead’;

List<Lead> lstLead = DataBase.Query(queryString);
if(lstLead.size() > 0) {

for(Lead ld : lstLead)


wrapper w = new wrapper();

w.Id = ld.Id;

w.Name= ld.Name;

w.Email = ld.Email;







Page Code:

<apex:page controller=”exportExcel” action=”{!exportToExcel}” readOnly=”true”  contentType=”application/vnd.ms-excel#ConsignmentSearchData.xls”>          <apex:pageBlock >

<apex:pageBlockTable value=”{!lstwrapper}” var=”x”>

<apex:column headerValue=”Id”>



<apex:column headerValue=”Name”>



<apex:column headerValue=”Email”>






To get geo location OR longitude and latitude current location OR current Location of user

To get longitude and latitude of current location there is simple java script function given below —

/*Location functions here*/

function getUserLocation() {

//check if the geolocation object is supported, if so get position
if (navigator.geolocation)
navigator.geolocation.getCurrentPosition(displayLocation, displayError);
document.getElementById(“locationData”).innerHTML = “Sorry – your browser doesn’t support geolocation!”;

function displayLocation(position) {

//build text string including co-ordinate data passed in parameter
var displayText = “” + position.coords.latitude + ” ” + position.coords.longitude;

//display the string for demonstration
document.getElementById(“locationData”).innerHTML = displayText;


function displayError(error) {

//get a reference to the HTML element for writing result
var locationElement = document.getElementById(“locationData”);

//find out which error we have, output message accordingly
switch(error.code) {
locationElement.innerHTML = “Permission was denied”;
locationElement.innerHTML = “Location data not available”;
case error.TIMEOUT:
locationElement.innerHTML = “Location request timeout”;
case error.UNKNOWN_ERROR:
locationElement.innerHTML = “An unspecified error occurred”;
locationElement.innerHTML = “Who knows what happened…”;

<div id=”locationData” align=”center”>


By using this script you can get current Geo location .
to display  massages or  longitude and latitude to user , here i used last div.

Thanks ..!!


To add Print button on your web page.

Adding Print Button on your web page is very simple .

I am giving you following simple example.

<title>Print Test</title>
<h1>Print Test</h1>
<input type=”button” onClick=”window.print()” value=”Print This Page”/>
The most important is ‘on click ‘event  , window.print () function is ready made function  of  operating system .
In this way you can add print button on your web page.


How to add share buttons on web Page .or To add plugin of social networking site to your web page .

It is very very simple work to add share button on your webpage . there are ready made code available for that .

you have to just go to this

url:- https://www.addthis.com/get/sharing?lb=1&flag=register#.T6S7X1JEjIU.

in this url , you will find the  code of all  share button like facebook,twittrer, google+,gmail ,yahoomail and lots more near about there are 50 to 60 share button on this page .

you have to just copy and paste these buttons code.

You have privilege to add your custom button in that .

Adding “share button” is only matter of copy and paste , nothing else.

Thanks !!!!


Could not load file or assembly ‘MySql.Data, Version=, …” [Solved]

If you are accessing MySql from your ASP.NET code and getting this error after uploading code to Server:

Parser Error Message: Could not load file or assembly ‘MySql.Data, Version=, Culture=neutral, PublicKeyToken=c5687fc88969c44d’ or one of its dependencies. The system cannot find the file specified.

Make sure /bin/MySql.Data.dll exists on root folder.

I was accessing the code from url http://demos.nanostuffs.com/SomeFolder/Default.aspx

So MySql.Data.dll should be present at location:

Even if you place the .dll in /SomeFolder/bin/, it does not work.