Monday, April 30, 2012

AR companies

1) http://www.bbc.co.uk/news/technology-13558137 Aurasma , UK
2) Blippar , UK
3) http://technode.com/2011/05/06/china-is-catching-up-with-augmented-reality/ (everywhere)

4) mobile monday http://technode.com/2011/04/10/announce-the-first-augmented-reality-demo-event-in-china/
5) PEREY research and consulting
6)

AR apps

http://onebiginternet.com/2011/01/11-most-useful-augmented-reality-apps-for-iphone-and-android/
http://onebiginternet.com/2012/02/how-augmented-reality-will-change-the-future-of-internet-browsing/

My current Interest - AR

http://mobile.tutsplus.com/tutorials/android/android_augmented-reality/

And to research : cross platform?
http://en.wikipedia.org/wiki/Cross-platform

Tuesday, April 24, 2012

Bitmap in ZXing (how to encode QR)

// this is from QREncoder.java from ZXing

  static Bitmap encodeAsBitmap(String contents,
                               BarcodeFormat format,
                               int desiredWidth,
                               int desiredHeight) throws WriterException {
    Hashtable<EncodeHintType,Object> hints = null;
    String encoding = guessAppropriateEncoding(contents);
    if (encoding != null) {
      hints = new Hashtable<EncodeHintType,Object>(2);
      hints.put(EncodeHintType.CHARACTER_SET, encoding);
    }
    MultiFormatWriter writer = new MultiFormatWriter();   
    BitMatrix result = writer.encode(contents, format, desiredWidth, desiredHeight, hints);
    int width = result.getWidth();
    int height = result.getHeight();
    int[] pixels = new int[width * height];
    // All are 0, or black, by default
    for (int y = 0; y < height; y++) {
      int offset = y * width;
      for (int x = 0; x < width; x++) {
        pixels[offset + x] = result.get(x, y) ? BLACK : WHITE;
      }
    }

    Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
    bitmap.setPixels(pixels, 0, width, 0, 0, width, height);
    return bitmap;
  }

//This is how you can generate normally:
private Bitmap generateQRCode2(String data)
    {
        //Size of the image generated.
        int h = 100;
        int w = 100;
        Config conf = Bitmap.Config.RGB_565;
        Bitmap bmp = Bitmap.createBitmap(w, h, conf); // this creates a MUTABLE bitmap
       
        Charset charset = Charset.forName("UTF-8");
        CharsetEncoder encoder = charset.newEncoder();
        byte[] b = null;
        try {
            // Convert a string to UTF-8 bytes in a ByteBuffer
            ByteBuffer bbuf = encoder.encode(CharBuffer.wrap(data));
            b = bbuf.array();
        } catch (CharacterCodingException e) {
            System.out.println(e.getMessage());
        }

        String data1;
        try {
            data1 = new String(b, "UTF-8");
            // get a byte matrix for the data
            BitMatrix matrix = null;
            // Size of the QR code
           
            com.google.zxing.Writer writer = new QRCodeWriter();
            try {
                Hashtable<EncodeHintType, String> hints = new Hashtable<EncodeHintType, String>(2);
                hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
                matrix = writer.encode(data1, com.google.zxing.BarcodeFormat.QR_CODE,w, h);
            } catch (Exception e) {
                System.out.println(e.getMessage());
            }
           
            //generate an image from the bit matrix
            int width = matrix.getWidth();
            int height = matrix.getHeight();
           
            try {     
                for (int x = 0; x < width; x++)
                {
                    for (int y = 0; y < height; y++) {
                        bmp.setPixel(x, y, matrix.get(x, y) ? BLACK : WHITE);
                      }
                    }
                           
            } catch (Exception e) {
                System.out.println(e.getMessage());
            } 
        } catch (UnsupportedEncodingException e) {
            System.out.println(e.getMessage());
        }
       
        return bmp;

            // change this path to match yours (this is my mac home folder, you can use: c:\\qr_png.png if you are on windows)
            //String filePath = "/Users/shaybc/Desktop/OutlookQR/qr_png.png";
            /*
            String filePath;
            File file = new File(filePath);
            try {
                MatrixToImageWriter.writeToFile(matrix, "PNG", file);
                System.out.println("printing to " + file.getAbsolutePath());
            } catch (IOException e) {
                System.out.println(e.getMessage());
            }
        } catch (UnsupportedEncodingException e) {
            System.out.println(e.getMessage());
        }*/
    //}




Data Storage in ZXing

I realized that ZXing didnt store the QR code created at all. But here is the internal memory of the android
http://developer.android.com/guide/topics/data/data-storage.html

Encoding ZXing with Intent


Android : http://stackoverflow.com/questions/2489048/qr-code-encoding-and-decoding-using-zxing

(for iOS) http://dev4mac.blogspot.co.uk/2011/10/qr-using-zxing-zebra-crossing.html

My code: package com.thetmonaye.ucl;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import android.view.View;


public class EncoderActivity extends Activity {


@Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.encoder);
   
     
       //Pointers to Text fields
final EditText receive_amount = (EditText) findViewById(R.id.receive_amount);
final EditText emailAddressField = (EditText) findViewById(R.id.emailAddress);
final EditText memoField = (EditText) findViewById(R.id.memo);
final EditText barcodeField = (EditText) findViewById(R.id.barcode);


Button qrButton = (Button) this.findViewById(R.id.create_QR_button);
qrButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {

// getting the values from the EditText Fields
String amount = receive_amount.getText().toString();
String email = emailAddressField.getText().toString();
String memo = memoField.getText().toString();
String barcode = barcodeField.getText().toString();

if (amount != null && email != null && memo != null && barcode != null)
{
// URI to be encoded as a QR code
String uri = "thetUcl:"+"amount="+amount+"&"+"email="+email+"&"+"memo="+memo+"&"+"barcode="+barcode;

generateQRCode(uri);

}
}
});    
}


private void generateQRCode(String data) {
// call it simply by Intent and you don't need to add library or any codes
Intent intent = new Intent("com.google.zxing.client.android.ENCODE");
intent.putExtra("ENCODE_TYPE", "TEXT_TYPE");
intent.putExtra("ENCODE_DATA", data);
intent.putExtra("ENCODE_FORMAT", "QR_CODE");
startActivity(intent);
}

}

About Sharing function in ZXing


I found this :
 Bitmap bitmap = QRCodeEncoder.encodeAsBitmap(contents, format, pixelResolution, pixelResolution);
      Message message = Message.obtain(handler, R.id.encode_succeeded);
      message.obj = bitmap;
      message.sendToTarget();
in the Intent.java class.
So, I somewhat understand that it sends to the "Handler" by "sendToTarget" method in handler class.  Then the 
In that
  final void shareByEmail(String contents) {
    sendEmailFromUri("mailto:", null, activity.getString(R.string.msg_share_subject_line),

        contents);
  }

Monday, April 23, 2012

Selenium IDE

http://seleniumhq.org/projects/ide/

iOSDK native (to check how to listen if the users have used the app or not)
call with REST to listen to the calls from the website and print it to native html

Saturday, April 21, 2012

Android Malloc or Gabage Collection Handling (for infinite loop)

http://groups.google.com/group/android-developers/browse_thread/thread/79a9b5352cef9146

Cryptography

Cryptography is needed for the making the sender's or receiver's information eg. bank acc or credit card number, unknown.
http://h2g2.com/dna/h2g2/A1315919

https://play.google.com/store/apps/details?id=de.schildbach.wallet&hl=en

Popular Cryptography :http://www.bouncycastle.org/wiki/display/JA1/Frequently+Asked+Questions

Eclipse Tips

Very very useful ECLIPSE TIP : click on method, CLt+ALT+H (for tracing the history / hierarchy of the method)
http://www.vasanth.in/2009/03/10/eclipse-tip-trace-method-call-chains/

Friday, April 20, 2012

creating QR with zxing in iphone

https://github.com/joelind/zxing-iphone/tree/master/zxing.appspot.com

ZXing Encoding Method

Calling Encoder with Intent: http://code.google.com/p/zxing/issues/detail?id=1032

When you want to use libraries: http://www.vineetmanohar.com/2010/09/java-barcode-api/

Amazon Search Operation Documentation

http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/SearchOperations.html

similar apps (read UPC or barcode, then display the info about it)

http://delicious-monster.com/

App using Amazon AWS


How to host the pictures in amazon AWS
https://github.com/kwliou/SmartNature/blob/a9b8daae06102c427a429a39c415cb757488f55f/src/edu/berkeley/cs160/smartnature/ShareGarden.java

App search for Amazon items (using php) :https://github.com/whoisstan/Buy-It-Later-Hybrid-Stores-QR-Code-Generator/blob/master/lib/AmazonECS.class.php

Amazon API & in iOS

this is not a free API cos AWS set up needs to register with your credit card
http://docs.amazonwebservices.com/mobile/sdkforandroid/gsg/Welcome.html?r=4295

Writing Amazon Product Search in iOS
https://github.com/jugend/amazon-ecs

augmented reality try it out :)

To inspire:http://www.youtube.com/watch?v=jU6PcBS1pWw
http://www.tinkernut.com/forum/video-tutorial-help/how-to-create-augmented-reality/

JSP

Learning how to start: Simple JSP: http://www.youtube.com/watch?v=kESqSdgbvUo

SQL embed in Java:  http://www.youtube.com/watch?v=C5PQ86nWMkM&feature=related

Why? :
http://crypto.stanford.edu/cs155old/cs155-spring09/lectures/17-web-site-sec.pdf

Security Papers (Research) from Stanford:Automatic Generation of XSS and SQL Injection Attacks with
Goal-Directed Model Checking:
http://suif.stanford.edu/papers/sec08martin.pdf

Android Radio Button Tutorial

http://www.thetekblog.com/2010/07/android-radiobutton-in-radiogroup-example/

Thursday, April 19, 2012

interesting facts for QR

http://blogs.imediaconnection.com/blog/2011/08/01/qr-code-density-and-url-shorteners/ (why we need URL shorteners)

Wednesday, April 18, 2012

QR Generating Journey


Similar one (research from Stanford)

Step By Step: http://www.thonky.com/qr-code-tutorial/introduction/#general-overview-of-creating-a-qr-code

To make QR, we have to know :
1) The choice of characters eg. UTF8 or ISO-8859-1
2) Byte array to UTF8(but now we have to use ISO-8859-1)because UTF 8 has some non-decodable characters by ZXing library (because we are using ZXing for this app)   WHY WE CHOOOSE ZXING?
3) Storage is small so, we need URL shortening technique.

===========================
QR code future is

Next QR Code Generations
1) Microsoft Tag (write details about it like detecting the areas that which QR code is scanned most, etc)
2) Dynamic QR Code (where information changes from time to time by scanning it)
3) Designer QR Codes

Resolving Conflicts with Git in X-code

http://www.jiahaoliuliu.com/

Very good blog for other topics as well

Tuesday, April 17, 2012

Generating QR code - Tutorials

1) For Android (reading QR code and sharing it in social network like facebook and twitter): http://stackoverflow.com/questions/6493623/tutorial-to-learn-how-to-read-and-generate-a-qrcode

2) For iOS : https://github.com/kuapay/iOS-QR-Code-Generator

3) Structure Guide: http://qrdroid.com/services/android-developers

4) QR Android Code Sample (using bitmap): http://www.qrme.co.uk/qr-code-news/3-newsflash/138-qr-code-android-code.html

all about QR codes

1) How a QR code installed data?
http://www.swetake.com/qr/qr3_en.html

2) ISO/IEC 18004/2000 QR code (all about standards in a QR code)
http://raidenii.net/files/datasheets/misc/qr_code.pdf

3) Fancy about Dynamic QR code? 1 QR code with changeable info : http://wayne-doucette.blogspot.co.uk/2011/01/dynamic-qr-code-generator-jquery-google.html

4) some professionals doing dynamic QR :http://trakqr.com/

5) animated QRs:http://blog.qr4.nl/Animated-QR-Samples.aspx
Also we have designed QR codes too (eg a QR code in Japan from LV)

Monday, April 16, 2012

for conflicts between Barcode Scanner App and Zxing Scanner

users don't have to select between the barcode scanner app and my app for scanning if they have Zxing's apk installed
http://stackoverflow.com/questions/7945951/integrating-zxing-barcode-scanner-with-my-android-app-custom-action-name-issue

Design Pattern

For Designing your code from prototype: HeadFirst Design Patterns by Eric Freeman & Elisabeth Freeman

Publisher : O'Reilly
Shop : You can buy in amazon or if you are in UK, check out in Waterstones

Dealing with Amazon Web API

Register -> https://developer.amazonservices.co.uk/index.html

The Developer guide ->https://images-na.ssl-images-amazon.com/images/G/01/mwsportal/doc/en_US/bde/MWSDeveloperGuide._V161845402_.pdf

3 Types of developer access
I want to access my own Amazon seller account with MWS.— Select this option when you sign up to use
Amazon MWS for your own Amazon seller account, Amazon MWS will assign a developer account identifier
to you. When you make Amazon MWS requests, you'll use the developer account credentials that are associated
with your developer account, plus the merchant Id for your seller account.
I want to use an application to access my Amazon seller account with MWS.— Select this option if you
want to use an application to access your Amazon seller account using Amazon MWS. When you register, you
must enter the developer account identifier for the application you will be using. The final page of the Amazon
MWS registration process shows your merchant Id. You will use this identifier in the application you use.
I want to give a developer access to my Amazon seller account with MWS.— Select this option when you
want to authorize a third-party developer to access your account with Amazon MWS.

ListView Tutorial

http://codehenge.net/blog/2011/05/customizing-android-listview-item-layout/

static classes(when dealing with adapters)

you might normally come across when you call the adapter from another class, they ask the class to be static

eg: private TescoJsonParser TJP= new TescoJsonParser();
String sessionkey= TescoJsonParser.login("youremail@gmail.com","password");
ProductDetails parsedResult=TescoJsonParser.getProductByBarcode(contents,sessionkey );
products.add(parsedResult);
productLists.setAdapter(new ProductViewAdapter(this,products));

I cannot use TJP.login(....,...);
here is why:
http://www.javaworld.com/javaworld/javaqa/1999-08/01-qa-static2.html

HTTP Post

http://stackoverflow.com/questions/6786246/viewstate-value-in-the-httppost

HTTP Post can accept more than HTTP get. Since HTTP get only accept for 256 chars

Spinners

http://stackoverflow.com/questions/9699864/select-item-in-spinner-android

Friday, April 13, 2012

More to GO

Woot ! I was so happy 3 days ago about my app that has done and now I look back, it is just a child play ! god, I wish I knew that 3 days ago.

Anyway, time has spent, and I cant get back my slacking times. So, I focus on this NOW!!

More to come: Really connect with the TESCO CHECKOUT

Thursday, April 12, 2012

QR code Generator

This is how you can make a QR code .For my case, when you can scan the QR code and you will reach to the PayPal link with the total sum of the product in it)


Firstly by using ZXing you can create by using their ZXing web link : http://zxing.appspot.com/generator
or
you can write by using QRcodeWrite class:http://zxing.org/w/docs/javadoc/com/google/zxing/qrcode/QRCodeWriter.html
http://code.google.com/p/zxing/source/browse/trunk/core/src/com/google/zxing/qrcode/QRCodeWriter.java?r=1028

But first one is very limited.

1)Step by Step: notice the ZXing package: http://stackoverflow.com/questions/6376400/zxing-android-generate-1d-barcode
Then details inside : http://stackoverflow.com/questions/2489048/qr-code-encoding-and-decoding-using-zxing


3) QR code writer in ZXing
http://cfsearching.blogspot.co.uk/2010/04/coldfusion-zxing-read-write-qrcode.html This is the CFC extention (not related with project)

4) Java android encoder (without using ZXing)



Encoding and Decoding through a web service:


BitMat (bit matrix) documentation

Monday, April 9, 2012

SQLite notes

http://coderzheaven.com/2011/04/using-sqlite-in-android-a-really-simple-example/3/

SQLite manager : http://coderzheaven.com/2011/04/sqlitemanager-plugin-for-eclipse/

some new findings (BigDecimal, onResume)

BigDecimal= to get the rounded double value eg. from 2.5555555 to 2.56

onResume => I was having problems with SQlite database for not updating my scanned values into total, but I realized I was calling the total in onCreate, but not in onResume
After I call it in onResume, everything is perfect ! :)

why SQL not visible in the database?
Cos' of security issue and so we need to reboot the android
http://stackoverflow.com/questions/3810710/why-cant-data-folder-be-displayed-just-like-in-ddms-file-explorer
how to? http://forum.unity3d.com/threads/112703-Override-Unity-Data-folder-path


REBOOTING : http://www.tomsguide.com/us/Root-Your-Android-Phone,review-1688-2.html

Saturday, April 7, 2012

SQLite Implementation and Understanding

SQLite Table creation : http://www.sqlite.org/lang_createtable.html

Some SQLite Video: http://www.video2brain.com/en/videos-4429.htm (just explaining basic things)

How to create Database: http://www.youtube.com/watch?v=bF1sxGfNz-o



Wednesday, April 4, 2012

Json Parser

References

1) http://damonsk.com/2010/01/jsonarray-httpclient-android/





about static classes
session and key access

about Gson


For database problems close() during the parser problem :

RESTFUL web service

http://www.ibm.com/developerworks/webservices/library/ws-restful/

best tutorial !! (for using TESCO API )

http://www.abdn.ac.uk/~csc228/teaching/CS4032/practicals/practical-9.shtml