Share Coding

Tutorials, Problems, Stuffs …

Cannot SSH while server connected VPN

Esxi 5.0 Server has a CentOS vm.
Once it connected outside VPN, it then cannot SSH because they are not the same gateway.
So we need to add route to whitelist our host IP to connect our gateway first.

Assume our gateway is, and we would like to allow all my subnetwork to pass through:

route add -net netmask gw

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) {

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;