Share Coding

Tutorials, Problems, Stuffs …

ACR122U FeliCa Reader with Raspberry Pi

apt-get install flex libpcsclite-dev libusb-dev checkinstall libusb-0.1-4 libpcsclite1 libccid pcscd pcsc-tools libcurl4-openssl-dev


cd ACR122_Driver_Lnx_Mac10.5_10.6_10.7_104_P
tar -jxvf acsccid-1.0.4.tar.bz2
cd acsccid-1.0.4
checkinstall -D -y –install


Download libnfc (1.7.1)
cd libnfc-1.7.1
./configure --prefix=/usr --sysconfdir=/etc --with-drivers=acr122_pcsc
make install




// If error message appear
No NFC device found.


// Use dmesg to check error
usb 2-1.2: usbfs: interface 0 claimed by pn533 while 'nfc-list' sets config #1


// Solution: Create /etc/modprobe.d/blacklist-libnfc.conf and type
blacklist pn533
blacklist nfc


// Save and run
modprobe -r pn533 nfc

Photobucket Album Downloader v2.0.1

To all who interested on my Photobucket Album Downloader Extension,

I am glad to introduce you the new Photobucket Album Downloader v2.0.1 extension.
Free version:
Unlimit version:


New features are listing below:
1. No longer rely on any server, no more SSL or speed issues.
2. No longer use popup dialog, it now embeds a “Download” button on photobucket website.
How to upgrade extension version:
1. Enter “chrome://extensions” on your chrome browser
2. Click “Update Extension” on the top right hand side
3. Done
Steps of downloading album: 
1. Go to any album, such as:
2. Find the Panel “Links to share this album” on the right and you can see a “Download” button
3. Click the “Download” button and you are now downloading photos

jQuery AJAX upload file

HTML form:

<form id="uploadForm">
	<input type="file" name="attachement" />



	type: "POST",
	url: "upload.php",
	data: new FormData($('#uploadForm')[0]),
	cache: false,
	contentType: false,
	processData: false,
	success: function (result) {

[joda time] Convert timestamp into “Posted 3 minutes ago”

DateTime myBirthDate = new DateTime(comment.getTime()*1000);
DateTime now = new DateTime();
Period period = new Period(myBirthDate, now);

PeriodFormatterBuilder builder = new PeriodFormatterBuilder();
if(period.getYears() != 0) {
	builder.appendYears().appendSuffix(" years ago\n");
} else if(period.getMonths() != 0) {
	builder.appendMonths().appendSuffix(" months ago\n");
} else if(period.getDays() != 0) {
	builder.appendDays().appendSuffix(" days ago\n");
} else if(period.getHours() != 0) {
	builder.appendHours().appendSuffix(" hours ago\n");
} else if(period.getMinutes() != 0) {
	builder.appendMinutes().appendSuffix(" minutes ago\n");
} else if(period.getSeconds() != 0) {
	builder.appendSeconds().appendSuffix(" seconds ago\n");
PeriodFormatter formatter = builder.printZeroNever().toFormatter();
String elapsed = formatter.print(period);

TextView txtComment_time = (TextView) comment_list_item.findViewById(;

Android WebView Upload Picture via Camera

When clicking an Input File button on webview,
we want to take a picture from camera and place the image to that input.

1. Declare instance variables

private final static int CAPTURE_RESULTCODE = 1;
private ValueCallback<Uri> mUploadMessage;
private String filePath;

2. Set custom webChromeClient to WebView

myWebView.setWebChromeClient(new WebChromeClient() {				
	public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) {

	public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType) {

	public void openFileChooser(ValueCallback<Uri> uploadMsg) {
		this.mUploadMessage = uploadMsg;

		File imageStorageDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "appName");
		this.filePath = imageStorageDir + File.separator + "IMG_" + String.valueOf(System.currentTimeMillis()) + ".jpg";
		File file = new File(this.filePath);

		Intent captureIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
		captureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
		MainActivity.this.startActivityForResult(captureIntent,  CAPTURE_RESULTCODE); 

3. Apply onActivityResult to handle the picture after capture

protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
	if (requestCode == CAPTURE_RESULTCODE) {
		if (null == this.mUploadMessage || (resultCode != RESULT_OK && !new File(filePath).exists())) {
		} else {
			ContentValues values = new ContentValues();
			values.put(MediaStore.Images.Media.DATA, this.filePath);
			this.mUploadMessage.onReceiveValue(this.getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values));
		this.mUploadMessage = null;

Get every new post delivered to your Inbox.