1. QR Code on business cards.
Rather than overload a business card with all of your contact info you could include the bare minimum for reaching you, then create a QR code that leads people to your Twitter, Facebook, LinkedIn, YouTube profiles.

2. Labeling
Take customers to a page with more detailed information that wouldn’t easily fit in a print ad

3. Storefront displays.
Few retail businesses are open 24/7. Do not disappoint potential customers after you’ve left for the day. Create a Shop Online Now! QR code and put it in your storefront window. One quick scan and you’ve turned a potential lost sale into an online customer who’s going to share a lot more of their contact information with you.

4. Promotions, discounts and giveaways.
If you want to encourage patronage from the iPhone and Android set, you could create discounts that are specific to the QR codes. You could run these codes in advertisements or post them throughout your store. You could even turn them into a “retweet” so that your shoppers share their discount with their followers.

5. Laptop stickers.
Slap a QR sticker of your vCard or website to your laptop, making it easier for other geeks to connect with you when you’re at the local coffee shop.

6. T-shirts.
Put your QR code on your t-shirt for some shameless self-promotion. Or, make a bigger impression by printing up 100 t-shirts and put them on 100 interns and have them attend a public event. For more engagement from the crowd, put different messages on the shirts, so people take more scans of more of your codes.

7. Use QR code to get Likes and Follows.

8. Supplement your retail space.
QR codes next to pieces of art could help art galleries move more art, or museums replace those aging audio tape tours. Hardware stores could link to how-to videos on YouTube of how to use specific power tools. Groceries could link to pages that talk about how their products were sourced, and perhaps to interviews of the farmers who grew the food. Electronic shops could bring visitors to review sites so they could get unbiased reviews of stocked products. Or to an e-commerce site where shoppers could buy out-of-stock items. Book stores could link to their own reviews of books on their blog.

What are some of the most creative uses of QR codes you’ve found? Have you used a QR code yourself in a promotion? What sort of results did you get? Share your thoughts and ideas in the comments below!

As an android developer, you always wish that your application run smooth and fast. There are many ways to improve performance of the application by coding as well as layout design.

Layouts are a key part of Android applications because that directly affect the user experience. If implemented poorly, your layout can lead to a memory hungry application with slow UIs. As most Android phones run on less powerful CPUs and GPUs, we developers should make sure the application we develop does not overload both the processors with unwanted and/or repetitive instructions.

GPU stands for Graphical Processing Units, architecture of GPU is not differed too much from CPU. One of the main functions of the GPU is to lighten the load on the CPU, especially when running graphics intensive applications like hi-res games or 3D graphics apps.

How to avoid layout rendering issue?

When building your views, it is important to look at the Component Tree in the upper-right of the IDE screen. The more nested your views become, the more complicated the View Tree becomes, and the longer it will take to render.

For each view in your app, Android goes through three steps to render on the screen: Measure, layout, and draw.

Measure: Measured start as the top of the layout and start measuring the dimension of each view to be displayed on the screen.

Layout: After measured, each view will layout its children, and pass the child view to its parent (all the way back up to the root view).

Draw: Once the layout is completed, each view will be drawn on the screen.

The more views your app has, the more time it will take to measure, layout, and draw. To minimize the time, it is important to keep the render tree as flat as possible.

Measure + layout + draw should be = 16ms in order to run at 60fps.

Slow Layout rendering issues can have many root causes but a common one is overdraw.

What is overdraw?

Overdraw means how many times a pixel on the screen has been redrawn in a single frame.

When it occurs?

Overdraw happens every time the application asks the system to draw something on top of something else. i.e, a window with a white background and a single button on top of it. When the system draws the button, it draws over the existing white background. That’s overdraw.

Is Overdraw avoidable?

Yes. But too much overdraw can be an issue. Because devices have limited memory bandwidth and if overdraw causes your application to require more bandwidth than available, performance will degrade.

Problems with overdraw

With overdraw in Android we waste GPU time by coloring the pixels on the screen that end up being colored again by something else later.

How to identify?

There are many ways to identify and fix it, but following Three are most popular:

Hierarchy Viewer

Tracer for OpenGL

Show GPU overdraw.

The first two can be found in ADT or the stand-alone monitor tool. The last tool is part of Android Developer options.

API (Application Programming Interface) is a particular set of rules (‘code’) and specifications that software programs can follow to communicate with each other. For example, you have a hardware button on your TV which turns it ON/OFF. Now suppose you want to turn ON the TV from a distance. You just press the ON/OFF button on a remote control and the TV set action on the command given by the remote control. This is how API works! Think of TV as a software program having services and resources, and the TV Remote control as another software program which use these resources. The method (or radio/infra red waves) through which a remote control communicates with a TV set is an API.

When and where it is used?

It’s used when 2 or more separate application need to work together to achieve something they can’t do alone.When interaction involve sending data over network, at that moment Web Service comes into the picture.

What is Web Service?

As the word sounds, they are not new fundamental business concept, it just a technology which permits old business concept to work together over the internet using some protocol. i.e. Oxford Dictionary API, in which you will send word, and in return it gives meaning of that word.

In simple way Web Service is nothing but a message passing (In XML & JSON format) between two machines. A client sends request over the Internet and a server receives that request, processes it and returns a response. When a browser makes a request for a webpage, it receives HTML and other related content in the response. But when it just asks for data and uses JavaScript or other client-side code to process the response, a web service has been used.

Modern web service communications are nearly always handled over HTTP. But the format of the message that are being sent and received can be different. Let’s consider one scenario for more understanding,

One service provider (A) is building application which shows latest designer clothes like amazon. For that he need to set up database to add products information (maybe it’s price, product name, images etc.) and one program to get that resources and display on application(Android, iOS, Web client) which is called as API call.

Fig 1. Understanding of web service

Note: Mark that this is limited to his application only, this will not allow other application to access his local data.

There are basically two different ways of implementing server side authentication for apps with a front end and an API:

Session Based System

In session based system like social networking system, e-commerce system or net banking system, the user data are stored on server side in a text file in temporary directory when user logged into the system which is called session data. The server generates the unique session ID for each user’s session data and send back to the user.

User can store that Session ID in cookies so that it can be used for further communications. When user requests for particular data after login, user has to send the session ID with each request from the cookie, so server can authenticate the user. And according to that session ID, server gives response to that user.

Session based system is STATEful as the server has to store the session for each user at server side and also user has to store session id in cookies. So if there are number of users then it is very difficult to maintain scalability and performance of the system and it will use extensive memory.

To overcome this scenario, token based system comes into the pictures.

Token Based System

Token based system is stateless, means no user data are stored on the server side, only user has to store token at client side which improves the performance and scalability of the system. When user sends the subsequent request after login, user has to provide token to the server. And from the token, server identify the user and give response to user.

Caching is used to store the data which are frequently used. The main advantage of caching is that it increases the performance of the site or an application by decreasing the load on to the server like database.

There are different caching methods to cache the data like caching content in file, memory or database. Memcached is one type of memory caching system. It is very useful when large number of data you want to cache.

It is distributed memory caching system. Memcached is key-value store for caching small chunks of data from result of database, API or page rendering. Basically it can cache anything if you can turn it into key => value. Memcached solves many problems related to large data caching.

Memcached is better because of the following reasons:

It’s REALLY fast – Everything’s in memory, and it’s highly optimized for situations just like yours (and caching in general )

It’s distributed – This means that if you have multiple web / app servers running, they can all access the same cache

You can pool multiple servers for memcached – If you’ve got a few servers that are relatively underutilized (or several dedicated cache servers), you can pool them all together into one big cache

It’s super-scalable (for the reasons mentioned prior)

It’s got great PHP support – The PECL package for memcached was recently updated with a lot of new goodness

You can even store your user sessions in memcached – just set it up in your php.ini file. This is much faster than storing sessions in databases, and allows your sessions to persist across multiple web hosts (if you’re in a load balanced situation). This will also give your site a bit of a performance boost as there’s no need to hit the file system / database for session info on every request.

Twitter.com provides an API for developers to interact with twitter data in their own application,products and services. the twitter API.
is basically a webservice. A developer has to log in or sing up with the twitter platform,register for an API key for his/her application
and use that key to drive interaction on behalf of an authenticated user. visit twitter API Documentation for lmore information on how to utilize the offered service.

Twitter uses OAuth 1.0 Protocol to authenticate API calls of third party applications. OAuth Authentication in twitter API describe how the authentication flow should be.

In this post i’m going to describe how to generate the oauth_signature for twitter request according to The OAuth 1.0 Protocol Section 3.4 Signature in Core Java(mainly for JAVA 1.4 or higher).
The oauth_signature parameter is generated by applying a signing algorithm on all the other request parameters and two secret values.This signature is used for below purposes.

To verify the request has not been modified in transit.

To verify the application sending the request.

To verify that the application is authorized to interact with the resource owner’s account.

Here are the steps of oauth_signature generation algorithm for twitter.

Step 1: Collecting the request method and URL

The first step is to determine the HTTP method and Base URL of the request. For twitter, the HTTP method will either be GET or POST.

The base URL is construced by removing any query string or hash parameters from the URL to which the request is directed. For example consider the following URL which is used as a GET request.

The OAuth protocol enables websites or applications (Consumers) to access Protected Resources from a web service (Service Provider) via an API, without requiring Users to disclose their Service Provider credentials to the Consumers. More generally, OAuth creates a freely-implementable and generic methodology for API authentication.

An example use case is allowing printing service printer.example.com (the Consumer), to access private photos stored on photos.example.net (the Service Provider) without requiring Users to provide their photos.example.net credentials to printer.example.com.

Authenticating with OAuth

OAuth authentication is the process in which Users grant access to their Protected Resources without sharing their credentials with the Consumer. OAuth uses Tokens generated by the Service Provider instead of the User’s credentials in Protected Resources requests.