Friday, December 14, 2012

Output array that contains Unicode characters in JSON format

Output array that contains Unicode characters in JSON format (for PHP5.3 or above)

   array_walk_recursive($array_has_unicode_charaters, function(&$item, $Key){	if(is_string($item)){	     $item = urlencode($item);	}   });   $json->data=$array_has_unicode_charaters;   echo urldecode(json_encode($json));

Create Access Point in Windows 7 For Android Device instead of ADHoc

This tricks shows how to create a Access Point instead of ADHoc network on your Windows 7 in order to allow the user to create
For those user who need Android device to connect to ADHoc network, this is the best alternative way to connect internet through your laptop. NO ROOT Required

1. Create a hosted network
run CMD as administrator, & type

netsh wlan set hostednetwork mode=allow ssid=SSID key=PASSWORD 

2. Open the Control Panel->Network & Internet->Network Connections
Right click the internet connection adapter & select Property, click Sharing tab, & tick allow other network users to connect through this computer’s internet connection. Select the connection name of Microsoft Virtual Wifi Miniport Adapter. Normally, it is namely “Wireless Network Connection 2” or “Wireless Network Connection 3”

3. In command prompt in step 1. type

netsh wlan start hostednetwork

This will create a Access Point instead of ADHoc & it is connectable by any Android Device.

In future, after you restart your computer, you can always run “netsh wlan start hostednetwork” to start the Access Point.

Trouble Shooting:
If you installed some third party VPN software it may breaks the connection, if you find you can connect to the network yet internet does not work, try to uninstall any third party VPN software & try again.

Sunday, October 14, 2012

Simple Linux VPN server configuration on CentOS 6

Installation

I consider install from yum is the best way.

rpm --import http://poptop.sourceforge.net/yum/RPM-GPG-KEY-PPTPrpm -Uvh http://poptop.sourceforge.net/yum/stable/rhel6/pptp-release-current.noarch.rpmyum install ppp pptpd -y

Thursday, September 27, 2012

Glassfish stream mp3 for HTML5 audio to IE 9

By default, Glasshfish handle the MIME-TYPE as audio/x-mpeg for mp3 file, thus IE 9 can not play the mp3 with HTML5 audio object.

The solution is:

Open the Glassfish/domain/domain1/config/default-web.xml

Find

    mp3    audio/x-mpeg

and alter it to

    mp3    audio/mpeg

Restart the glassfish & now IE 9 should be able to play mp3 file without problem.

Don’t forget to define following tag in your HTML file

<!DOCTYPE html>

Tuesday, September 25, 2012

Launch RDP from Web Browser

This script allows you create a link that can open a RDP session by passing a server address parameter

eg.

Open RDP

function rdp(address){	try{		var rdpexe = 'C:\\WINDOWS\\system32\\mstsc.exe';		var ws = new ActiveXObject('WScript.Shell');		ws.Exec(rdpexe + " /v:" + address);	}	catch(e){		alert("This link will try to launch RDP session from web browser\n"+			  "1. Please use Internet Explorer 7.0+\n"+ 			  "2. Go to Tools > Internet options > Security > Trusted Sites & click \"sites\" button.\n"+			  "3. Add *.your_domain to trusted site\n"+			  "4. Click Custom Level & find the section \"ActiveX controls & plug-ins\"\n"+			  "5. Select Enable for \"Initializing & Script ActiveX controls not marked as safe\"");	}}