Install OSX Mountain Lion 10.8.2 on Dell Inspiron 3520 with SSD. Windows 8/OSX UEFI dual boot. 99% Working, NO DSDT REQURED!!!

March 14, 2013 at 6:57 pmCategory:OSX

About this article

This article is a complete guide of installing OSX Mountain Lion 10.8.2 on Dell Inspiron 3520 (Purchased in Jan 2013) for experimental purpose only, before read this tutorial, you would need some basic knowledge as below:

1. Bios settings
2. OSX shell
3. Encourage and Patient
4. If you got kernel panic, don’t worry, just reboot couple of times.

I do not take any responsibility for any damage may occurred to your device, and you may be out of warranty if you replace the hardware  by yourself. So please use it at your own risk. 

Hardware Specification:

Intel i5 3210M  2.5GHz 3M

6GB DDR 3 1600MHZ

1TB SATA Hard Drive

8 x DVD Writer

Intel HD 4000 Graphic

Dell 1703 mini adapter

I bought some component for upgrade

Purchased components for upgrade (Optional):

1 x 4GB DDR 3 1600 memory
http://www.amazon.co.uk/gp/product/B004ZBAP64/ref=oh_details_o01_s00_i00?ie=UTF8&psc=1

1x SATA Caddy bay to replace DVD rom +
http://www.ebay.co.uk/itm/220940775746?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649

1 x Sandisk SATA III SSD
http://www.ebuyer.com/288065-sandisk-120gb-ultra-ssd-sdssdh-120g-g25

1x Atheros 9285 wifi mini card.
http://www.ebay.co.uk/itm/300708415248?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649

This model of Dell 3520 is very easy to replace components, you do not need to remove any screws on the back, all you need to do is use a flat screw driver to open the 4 holes on the top of the keyboard pad. Note: also you don’t have to remove the keyboard pad completely, all you need to do is replace the memory and wifi card and replace the cadday bay by remove 3 screws under the keyboard pad. I did not made a video for this section as I found this video on Youtube. NOTE: you do NOT have to add any memory, harddrive, or wifi mini card, you can use an OSX compatible USB wireless card if you wish.

1. Prepare Installation Media

Buy OSX mountain lion from Mac store. Install the Unibeast to your USB driver which has storage more than 8 GB.
You probably need a working Mac OS / OSX system to complete this step.

2. Installation

Reboot after installation is complete, press F2 on Boot and switch off the “Safe boot” option, save and exit then press F12 on boot  and in legacy boot section and select boot from USB drive.

After boot from the USB with Legacy USB Disk, use disk utility to format SSD drive, install OSX on the SSD disk. The installation should be no error as Dell 3520 has a very good compatibility for OSX.

3. Install Multibeast

Use this configuration

multibeast

The reason  to install Chameleon is  Chameleon is much more easier to configure and if you did anything wrong in Clover configuration, you can easily boot up from Chameleon with legacy option.

Please do NOT install any audio/video driver from Multibeast, they are a bit outdated, download the driver  as below.

4. Install Audio/Network Drivers

There are only a few kext needs to be installed, you can install them use Kext Utility. You can download them from here:

Audio Driver: Download

Wifi Driver: OSX has native support with Atheros 9285 mini wifi card. However you do need to rollback to this IO80211Family.Kext

Battery & PS2 Controller: Download

Restart your laptop after install these Kext

If you have experience with Chameleon, you can inject the device code for video in /Extras/org.chameleon.Boot.plist, and use PCIROOT=1 to enable Lan. This will make your Graphic card, App Store work, but Team Viewer and iMessage will not work we use Clover.

This is my version of org.chameleon.Boot.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EthernetBuiltIn</key>
<string>Yes</string>
<key>GenerateCStates</key>
<string>Yes</string>
<key>GeneratePStates</key>
<string>Yes</string>
<key>GraphicsEnabler</key>
<string>Yes</string>
<key>Graphics Mode</key>
<string>1366x768x32</string>
<key>Kernel</key>
<string>mach_kernel</string>
<key>Kernel Flags</key>
<string>darkwake=0 PCIRootUID=1</string>
<key>Legacy Logo</key>
<string>Yes</string>
<key>Timeout</key>
<string>2</string>
<key>UseKernelCache</key>
<string>Yes</string>
<key>device-properties</key>
<string>7f0000000100000001000000730000000200000002010c00d041030a000000000101060000027fff04002c0000004100410050004c002c00690067002d0070006c006100740066006f0072006d002d006900640000000800000003006601140000006800640061002d0067006600780000000d0000006f6e626f6172642d31</string>
</dict>
</plist>

NOTE: DO NOT USE GraphicsEnabler=Yes before you put the inject the device code, otherwise you will get a black screen after reboot

So far, you should have a working OSX installed, graphic card, network access, audios works etc.

Next we will need to install Clover and enable dual boot

5. Install Clover

Download Clover from http://sourceforge.net/projects/cloverefiboot/ and install as “Unpack” to your OSX disk.
Next you need to mount the EFI drive to a folder.

Open Application->Utilities->Terminal and input

mkdir ~/efi
sudo mount_msdos /dev/disk0s1 /Users/saga/efi
cp -R /EFI ~/efi/

modify ~/efi/EFI/config.plist with text editor
This is my config.plist file

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ACPI</key>
<dict>
<key>DsdtName</key>
<string>dsdt.aml</string>
</dict>
<key>Graphics</key>
<dict>
<key>CustomEDID</key>
<string>00FFFFFFFFFFFF0030E4DC020000000000140104902213780A09159D5F599B2719505400000001010101010101010101010101010101B01D56C650002A302430350058C210000019EC1356C650002E302430350058C210000019000000FE00394858584A803135365748340A0000000000004131960100000001010A202000F7</string>
<key>GraphicsInjector</key>
<string>Yes</string>
<key>InjectEDID</key>
<string>Yes</string>
<key>VRAM</key>
<string>512</string>
</dict>
<key>PCI</key>
<dict>
<key>DeviceProperties</key>
<string>7f0000000100000001000000730000000200000002010c00d041030a000000000101060000027fff04002c0000004100410050004c002c00690067002d0070006c006100740066006f0072006d002d006900640000000800000003006601140000006800640061002d0067006600780000000d0000006f6e626f6172642d31</string>
<key>HDAInjection</key>
<string>No</string>
<key>LpcTune</key>
<string>No</string>
<key>PCIRootUID</key>
<string>1</string>
<key>StringInjector</key>
<string>Yes</string>
<key>USBInjection</key>
<string>No</string>
</dict>
<key>SMBIOS</key>
<dict>
<key>BiosVendor</key>
<string>Apple Inc.</string>
<key>BiosVersion</key>
<string>CHANGEME</string>
<key>Board-ID</key>
<string>CHANGEME</string>
<key>Family</key>
<string>MacBook Pro</string>
<key>ProductName</key>
<string>MacBookPro6,2</string>
<key>SerialNumber</key>
<string>CHANGEME</string>
</dict>
<key>SystemParameters</key>
<dict>
<key>DefaultBootVolume</key>
<string>CHANGEME</string>
<key>InjectSystemID</key>
<string>Yes</string>
<key>LegacyBoot</key>
<string>PBR</string>
<key>boot-args</key>
<string>npci=0x2000 slide=0 darkwake=0 PCIRootUID=1</string>
<key>prev-lang:kbd</key>
<string>en:0</string>
</dict>
</dict>
</plist>
you need to change DefaultBootVolume to the volume of your OSX.
Also you need to get the legal information for the OSX such as bios version or serial number, you can use other software to generate it.

IMPORTANT For Dual BOOT

Download these files and copy them to ~/efi/EFI/drivers64/ , This contains HFS and NTFS driver for clover, they are not included in Clover installer by default.

http://adfoc.us/1350271

Open ~/efi/EFI/BOOT/refit.conf

this is my configure file

#
# refit.conf
# Configuration file for the rEFIt boot menu
#

# Set desired screen resolution if enabled
screen_resolution 1366x768

# Timeout in seconds for the main menu screen.
# Commenting the timeout option or setting it to -1
# disables automatic booting (i.e., no timeout).
# Setting it to 0 enables direct boot to default volume.
# timeout 5 - enter menu and wait for 5 sec to boot default Volume
# timeout 0 - boot into default volume without GUI
# timeout -1 - enter GUI without default booting
#
timeout 5

# Mouse pointer settings:
# Set mousespeed to adjust mouse cursor sensitivity.
# Common values are between 2-8.
# To disable mouse, set mousespeed to 0.
mousespeed 0
#mousemirror
dblclick 500

# Disable menu options for increased security. These are intended for a lab
# environment where the administrator doesn't want users to mess with the
# operating system. List the names for the options you want to hide from
# the boot menu. Currently supported:
#  shell       - remove the EFI shell
#  tools       - remove all EFI tools (shell and gptsync)
#  optical     - no booting from optical drives
#  external    - no booting from external disks or USB flash drives
#  internal    - no booting from internal disks; this setting is not
#                 recommended because it locks you out of all operating
#                 systems installed on the internal hard disks.
#  singleuser  - remove the submenu options to boot Mac OS X in single-user
#                 or verbose modes
#  hwtest      - remove the submenu option to run Apple Hardware Test
#  all         - all of the above, except for 'internal'
#
#disable external optical shell singleuser

# THEME SET
#theme metal
theme mrengles

# Hide volumes. Moved here from config.plist
# Available options:
#  hidevolumes osx osxinstall recovery duplicate
#		windowsefi opticaluefi internaluefi externaluefi legacy
#		grub gentoo redhat ubuntu mint fedora suse
# It is also possible to hide volumes by device path, GUID, or
# any subtring found in device path
# Look into your boot.log to find a string like that:
#  hidevolumes HD(1,MBR,0x223EE178,0x1,0x6689F)
# be sure the string is unique
#hidevolumes fedora
hidevolumes legacy
hidevolumes duplicate
hidevolumes recovery
hidevolumes internaluefi
hidevolumes externaluefi

# Disable display of text-mode output when in graphics mode. This
# option is unnecessary on Macs, but without this option, UEFI-based
# PCs tend to display text-mode messages relating to boot loader probing
# over the GUI display.
#
quiet

# Enable the use of the log file (for debug purpose)
# This will make boot process much slower, so it should be stay disabled in most cases.
# Log will be outputted to /EFI/misc/
# Make sure /EFI/misc/ directory exists when enabling this.
#systemlog

# List legacy options first. When enabled, legacy BIOS based boot options
# (e.g. Windows, Linux via LILO or GRUB) will be listed first. This is
# intended as a quick fix to change the default boot choice until full
# configurability arrives.
#
#legacyfirst

# EOF

6. Change Bios Setting to add UEFI option and boot from Clover

In Dell 3520 bios , you are able to add additional UEFI boot file without using EFI Shell, which you can add Clover to your bios boot list easily. Simply select add UEFI boot file in bios setting and choose the SSD disk -> /EFI/BOOT/CLOVERX64.efi, give it a name “Clover UEFI” or whatever, change the boot sequence in UEFI boot section, make it on the top of the list, save and exit. You will find on your next boot you will find the Clover boot loader screen and your OSX driver is selected as default boot device.

Finally you got a 99% working OSX working on DELL inspiron 3520, the only thing not working is the sleep, however you may resolve it with DSDT but this will not be introduced in this tutorial.

Use clipboard in Android

February 2, 2013 at 2:10 pmCategory:Android

You can access the clipboard ClipboardManager service

Main code is as follows: 

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.text.ClipboardManager;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class ClipboardTestActivity extends Activity implements OnClickListener {

	private EditText editText;
	private Button copyButton;
	private Button pasteButton;
	private Button clearButton;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        editText = (EditText) findViewById(R.id.editText1);
        copyButton = (Button) findViewById(R.id.button1);
        pasteButton = (Button) findViewById(R.id.button2);
        clearButton = (Button) findViewById(R.id.button3);

        copyButton.setOnClickListener(this);
        pasteButton.setOnClickListener(this);
        clearButton.setOnClickListener(this);

    }

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.button1:
			copy("Number:" + Math.random() * 100);
			break;
		case R.id.button2:
			paste(editText);
			break;
		case R.id.button3:
			clear();
			break;
		default:
			break;
		}
	}

	private void clear() {

		ClipboardManager clipboardManager = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
		clipboardManager.setText(null);

	}

	private void paste(EditText editText) {

		ClipboardManager clipboardManager = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
		CharSequence text = clipboardManager.getText();
		if (TextUtils.isEmpty(text)) {
			Toast.makeText(this, "The clipboard is empty!", Toast.LENGTH_SHORT).show();
			return;
		}
		editText.setText(text);

	}

	private void copy(String text) {

		ClipboardManager clipboardManager = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
		clipboardManager.setText(text);

	}

}

Steps:

  1. Copy: Produce a number randomly, install clipboard next;
  2. Paste: Obtain data from clipboard,  installing EditText;
  3. Clear: Clear empty clipboard—-Stopped with Copy principle actually;

 

PS: Detailed content asks referenced developer documentation! : )

Get Android WiFi Status in Android

February 2, 2013 at 2:10 pmCategory:Android

Pass WifiManager to be able to obtain the state information of Wifi, these information are enclosed in WifiInfo, can obtain material state information from inside WifiInfo.
The means that obtains WifiManager is:
WifiManager WifiManager = (WifiManager)getSystemService(Context.WIFI_SERVICE);
The snippet that obtains WifiInfo is:

WifiInfo Info = WifiManager.getConnectionInfo();

The Wifi state information that can obtain has:

  • SSID;
  • BSSID;
  • MacAddress;
  • HiddenSSID;
  • IpAddress;
  • LinkSpped;
  • NetWorkId;
  • Rssi;
  • SupplicantState;

About detailed information, referenced Android SDK! : )

Get screen resolution

February 2, 2013 at 2:10 pmCategory:Android

The following code is to get screen resolution, through WindowManager.

WindowManager Wm = (WindowManager) Context.getSystemService(Context.WINDOW_SERVICE);
Display D = Wm.getDefaultDisplay();
MScreenWidth = D.getWidth();
MScreenHeight = D.getHeight();

//The following code gets condition column height
Resources Res = Context.getResources();
MStatusBarHeight = Context.getResources().getDimensionPixelSize(Com.android.internal.R.dimen.status_bar_height);
//The following statement gets current configuration 
ConfigurationGetResources().getConfiguration()

Phonegap Sqlite (android)

February 2, 2013 at 2:10 pmCategory:Android

Below Android environment use Phonegap operates Sqlite, code sees accessory.

(function(){
$('#main').live('pageshow',function(){

$('#createBtn').bind('click',function(){
create('test','1.0','testDb',1000000);
});

$('#DropBtn').bind('click',function(){
dropTable('DEMO','test','1.0','testDb',1000000);
});

$('#selectBtn').bind('click',function(){
select('test','1.0','testDb',1000000);
});

$('#insertBtn').bind('click',function(){
$('#addWindow').popup('open');
});

$('#saveBtn').bind('click',onSaveBtnClick);

$('#deleteBtn').bind('click',onDeleteBtnClick);
});

function onSaveBtnClick(){
var id = $('#idfield').val();
var data = $('#datafield').val();
if(id!=''&& data!=''){
var db = getDb('test','1.0','testDb',1000000);
db.transaction(function(tx){
tx.executeSql('INSERT INTO DEMO (id, data) VALUES (?, ?)', [id,data]);
}, errorCB, function(){
$('#addWindow').popup('close');

Alert(' adds successful
'); newly
$('#selectBtn').trigger('click');
$('#msgdiv').empty();
$('#idfield').val('');
$('#datafield').val('');
});
}else{

$('#msgdiv').text(' inputs Id
and Data please! ! ');
}
}

function onDeleteBtnClick(){
var db = getDb('test','1.0','testDb',1000000);
db.transaction(function(tx){
tx.executeSql('DELETE FROM DEMO');
}, errorCB, function(){

Alert(' deletes overall record
successfully! ');
$('#resultList > tbody').empty();
});
}

function getDb(dbName,dbVersion,dbDisplayname,dbSize){
return window.openDatabase(dbName, dbVersion,dbDisplayname, dbSize);
}

function select(dbName,dbVersion,dbDisplayname,dbSize){
var db = getDb(dbName,dbVersion,dbDisplayname,dbSize);
db.transaction(queryDB, errorCB);
}

function dropTable(tableName,dbName,dbVersion,dbDisplayname,dbSize){
var db = getDb(dbName,dbVersion,dbDisplayname,dbSize);
db.transaction(function(tx){
tx.executeSql('DROP TABLE IF EXISTS '+tableName);
}, errorCB,function(){

Alert(' deletes a success,
tableName='+tableName);
$('#resultList > tbody').empty();
});
}

function queryDB(tx) {
$('#resultList > tbody').empty();
tx.executeSql('SELECT * FROM DEMO', [], function (tx, results) {
var len = results.rows.length;
var html = [];
for (var i=0; i tbody').append($(html.join('')));
},errorCB);
}

function create(dbName,dbVersion,dbDisplayname,dbSize){
var db = getDb(dbName,dbVersion,dbDisplayname,dbSize);
db.transaction(function(tx){
tx.executeSql('DROP TABLE IF EXISTS DEMO');
tx.executeSql('CREATE TABLE IF NOT EXISTS DEMO (id unique, data)');
tx.executeSql('INSERT INTO DEMO (id, data) VALUES (1, "First row")');
tx.executeSql('INSERT INTO DEMO (id, data) VALUES (2, "Second row")');

Tx.executeSql('INSERT
INTO DEMO (Id, data) VALUES (3, "Phonegap Sqlite
checks ")'); } , errorCB, function(){
Alert(' establishs a
success, dbName='+dbName);
$('#selectBtn').trigger('click');
});
}

function errorCB(err) {
alert("Error processing SQL: "+err.code);
}
})();

Output array that contains Unicode characters in JSON format

December 14, 2012 at 11:10 amCategory:PHP

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

December 14, 2012 at 10:26 amCategory:Others

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, and type

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

2. Open the Control Panel->Network and Internet->Network Connections
Right click the internet connection adapter and choose Property, click Sharing tab, and 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 and 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 but internet does not work, try to uninstall any third party VPN software and try again.

5 things you need to know before buying an Android device

September 27, 2012 at 4:05 pmCategory:Android

5 things you need to know before buying an android device
1. APP resolution
There are a lot of different resolution Android devices that produced by mobile phone manuafactories, thus you may find some app does not fit your screen resolution.

2. Too many background programs
Likeless iPhone, Android support multi process which is a pros of Android phones, however nowadays too many programs are running in background now make this feature as a disadvantage, you need to kill processes regularly to keep the phone responsive and avoid the battery drain quickly

3. Android requires a very high spec / expensive hardware to make the system runs smooth
As the Android application are mainly written by Java lanuage, you will need more powerful CPU and memory to keep the system and app running smoothly, the cost of a high spec Android phone normally is the same price as an newest iPhone

4. Android does not support ADHoc
This is the another reason make me walked away from Android, ADHoc is a nice feature which allows you to connect internet through your laptop when you only got a cable connection in working environment. However the lastest Android system 4.1 Jelly Bean still does not support ADHoc connection.

5. Normally no continues upgrade
Upgrade Android OS to an old device is normally does not support by manuafactories due to the hardware requirement or manuafactories are lack to resource to do so. Thus you may get no upgrade or maybe only one or two upgrade after you purchase the device.

You may never have been told these things above before you purchase an Android phone, I hope this article can help you to know more about Android before purchase it.

Glassfish stream mp3 for HTML5 audio to IE 9

September 27, 2012 at 10:28 amCategory:Others

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 change it to


    mp3
    audio/mpeg

Restart the glassfish and 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>

Launch RDP from Web Browser

September 25, 2012 at 11:33 amCategory:PHP

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 and click \"sites\" button.\n"+
			  "3. Add *.your_domain to trusted site\n"+
			  "4. Click Custom Level and find the section \"ActiveX controls and plug-ins\"\n"+
			  "5. Select Enable for \"Initializing and Script ActiveX controls not marked as safe\"");
	}
}