Hardware Accelerated Execution Manager (HAXM) driver for Android

February 8, 2013

If you are frustrated by the dismal the performance of the Android emulator, you should try out Intel’s Hardware Accelerated Execution Manager (HAXM) driver.   Android and Intel have introduced an Acceleration mechanism named HAXM.   http://developer.android.com/tools/devices/emulator.html#acceleration

 The bottom-line is that your Android emulator will run much faster.   Bootup time is about 300% faster.   The Performance is about 700%.  Graphics acceleration will add another big boost.

Important Notes:

1) Download the driver through the Android SDK manager.   2) Must manually install the .exe file (or .dmg file for Mac) downloaded to the /extras/intel folder of your Android SDK installation

NOTE:  If you are using a Mac,  download the HAXM driver from here http://software.intel.com/en-us/articles/intel-hardware-accelerated-execution-manager?page=1   .  Download release_1.0.4-hotfix  for Mountain Lion.  If not, your Macbook kernel will crash.  

After you install the HAXM,  Create a new Android Virtual Device (AVD) and choose the type as the Intel x86 image.   Also enable GPU for graphics acceleration.

Run the emulator and run your app.   You will be pleasantly surprised at how must faster everything runs.   In the long run, the better performance will save you a lot of time.   Try it out.

REFERENCES:  http://www.developer.com/ws/android/development-tools/haxm-speeds-up-the-android-emulator.html

Advertisement

Eclipse (Android) and Mountain Lion – Problem with Java version

November 23, 2012

Eclipse stopped working after upgrade to Mountain Lion.  My initial guess was that it could be due to Java not being available.  I installed Oracle Java 7.

Even then, eclipse wasn’t starting up.   I tried changing eclipse.ini to set the VM.   No avail.

Finally,  I realised it could be due to the new security settings in Mountain Lion. To resolve this, go to System Preferences > Security & Privacy > General, and choose the check-box for “Anywhere.”  (You may need to unlock the settings before you can make this change)

Finally, Eclipse started working.

 

Other useful information I came across during my search:

[Thread from StackOverflow]

JDK 7 will be installed under /Library/Java/JavaVirtualMachines/1.7.0.jdk, JDK 6 under /System/Library/Java/JavaVirtualMachines.

To trick OS X to accept Java 7 instead of proposing to install Java 6 a simple symlink is enough:

sudo mkdir /System/Library/Java/JavaVirtualMachines

sudo ln -s /Library/Java/JavaVirtualMachines/1.7.0.jdk /System/Library/Java/JavaVirtualMachines/1.6.0.jdk

Most Java Programms will run with this little hack without the need to install Java 6.

[Edit eclipse.ini to specify a Java version]

http://wiki.eclipse.org/Eclipse.ini#-vm_value%3a_Mac_OS_X_Example


Disable Cross-domain Javascript security in Chrome for Development

March 13, 2012

This technique is very useful for writing Mobile apps and Ajax based apps.  Cross-domain Javascript security in all browsers will prevent you from making Ajax calls to other servers.   By passing the parameters to the browser, you can disable this temporarily.

For Windows:

1) Create a shortcut to Chrome on your desktop.  Right-click on the shortcut and choose Properties, then switch to “Shortcut” tab.

2) In the “Target” field, append the following:  –args –disable-web-security

For Mac, Open a terminal window and run this from command-line:
open ~/Applications/Google\ Chrome.app/ –args –disable-web-security

 


Get a Free Nokia Lumia for HTML5 developers! (Only for Singapore)

March 5, 2012

I wanted to share some new about this Free Windows Phone offer for developers in Singapore.  http://spiffy.sg/developers/lumia/

You need to submit 3 app ideas.  Once they are approved by the team, you will get a free phone.  You must submit 3 apps over 3 months to keep the phone.

I sent in my proposals and got approved for a free phone. I am going to write these apps with Sencha Touch and PhoneGap. You can give it a shot before all the phones are gone.

I previously tried a similar offer from Blackberry and got a Free Blackberry Playbook for submitting 1 app.   Seems like this is a great way for product vendors to increase the number of apps in their AppStores.

 


Spring Roo – Typicalsecurity Addon problem

January 15, 2012

I followed the steps to install this addon for Spring Roo.  But I kept getting this message.  “Command ‘typicalsecurity setup’ was found but is not currently available

I found that some generous developer provided a fix to this.  Install the new .jar file as per instructions here

http://code.google.com/p/spring-roo-addon-typical-security/issues/detail?id=17

After this, the addon ran successfully and created all the necessary Entities and scaffold artefacts.    One error I faced is  – “There is already ‘forgotPasswordController’ bean method”  I found that by explicitly adding @RequestMapping (value=”/forgotpassword/index”) to the controller classes, these issues were resolved and the application could be run.

Once issue remaining after changing the mapping to “/forgotpassword/index” I found that the links don’t work from the browser.  I must have missed something and will update this post once I find out the cause.

 


Why doesn’t my Spring Roo application not retain my data even after changing the persistence type?

January 14, 2012

In Roo, to change the persistence type, you issue the command.  But this doesn’t take effect and data is not retained for the next run.

jpa setup –provider HIBERNATE –database HYPERSONIC_PERSISTENT

 

Reason:

JPA uses the file – /src/main/resources/META-INF/persistence.xml to specify how existing data should be treated upon every restart of the server.

Solution:

Change the value of <property name=”hibernate.hbm2ddl.auto”>  to “update”

<!– value=”create” to build a new database on each run; value=”update” to modify an existing database; value=”create-drop” means the same as “create” but also drops tables when Hibernate closes; value=”validate” makes no changes to the database –>

<property name=”hibernate.hbm2ddl.auto” value=”update”/>


Add a task from QuickSilver to TaskPaper

July 23, 2011

A variation of the script from: http://blog.hogbaysoftware.com/post/62679297/quicksilver-to-taskpaper

This version has two enhancements
1) prefixes the entered text with a “-” so that it appears as a task
2) saves the file after adding the task.

To install it: (Full instructions in the link above)
Open Script Editor and paste in the script
Save the script as ~/Library/Application Support/QuickSilver/Actions/TaskPaper.scpt
Restart QuickSilver

using terms from application "Quicksilver"
on process text tasks_text
tell application "TaskPaper"
tell front document
if not (exists project named "Inbox") then
make new project with properties {name:"Inbox"} at front of projects
end if
tell project named "Inbox"
repeat with each in paragraphs of tasks_text
-- Add as a task by prepending with -
set myLine to "- " & each
make new entry with properties {text line:myLine}
end repeat
end tell
end tell
-- Autosave the file
front document save
end tell
end process text
end using terms from


Outlook 2007 – Prompt for Save to Folder before sending Email

November 30, 2010

1) Create a Macro using the VBA editor – Hit Alt+F11
2) Copy the following Code and Paste it into the ThisOutlookSession module. (You have to expand the items shown in VBA editor)
3) Save and test your code

Note: This code will work ONLY in the current session UNLESS you digitally sign it. (due to Outlook’s Macro security)
If you want to digitally sign the Macro, generate your own certificate and sign the macro.


Private Sub Application_ItemSend(ByVal Item As Object, _
Cancel As Boolean)
Dim objNS As NameSpace
Dim objFolder As MAPIFolder
Set objNS = Application.GetNamespace("MAPI")
Set objFolder = objNS.PickFolder
If TypeName(objFolder) "Nothing" And _
IsInDefaultStore(objFolder) Then
Set Item.SaveSentMessageFolder = objFolder
End If
Set objFolder = Nothing
Set objNS = Nothing
End Sub

Public Function IsInDefaultStore(objOL As Object) As Boolean
Dim objApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objInbox As Outlook.MAPIFolder
On Error Resume Next
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
Select Case objOL.Class
Case olFolder
If objOL.StoreID = objInbox.StoreID Then
IsInDefaultStore = True
End If
Case olAppointment, olContact, olDistributionList, _
olJournal, olMail, olNote, olPost, olTask
If objOL.Parent.StoreID = objInbox.StoreID Then
IsInDefaultStore = True
End If
Case Else
MsgBox "This function isn't designed to work " & _
"with " & TypeName(objOL) & _
" items and will return False.", _
, "IsInDefaultStore"
End Select
Set objApp = Nothing
Set objNS = Nothing
Set objInbox = Nothing
End Function


Dojo – Convert Strings to Dates and Sorting them in DataGrid

October 13, 2010

This sample code demonstrates how to use Dojo to convert strings to date objects. When used in this manner, you can sort the values as “dates” in Dojo DataGrid (otherwise grid handles them as strings)
Note: This code is based on a sample I found on another web-site. I enhanced it for use with dates returned from DQL and added comments to make the code clearer to understand.

WordPress may mess up the formatting: Click the link to get the HTML code as a MS Word file
DateSortingInDojo.docx


Sorted Date Grid

@IMPORT url("http://ajax.googleapis.com/ajax/libs/dojo/1.3/dojo/resources/dojo.css");
@IMPORT url("http://ajax.googleapis.com/ajax/libs/dojo/1.3/dijit/themes/tundra/tundra.css");
@IMPORT url("http://ajax.googleapis.com/ajax/libs/dojo/1.3/dojox/grid/resources/Grid.css");
@IMPORT url("http://ajax.googleapis.com/ajax/libs/dojo/1.3/dojox/grid/resources/tundraGrid.css");

djConfig = {
isDebug: false,
parseOnLoad: true,
baseUrl: "./",
xdWaitSeconds: 10
};

dojo.require("dojo.data.ItemFileReadStore");
dojo.require("dojox.grid.DataGrid");
dojo.require("dojo.date.locale");

function dateFormatterForDisplay(value, rowIndex) {
//Set the output date format
var aDate = dojo.date.locale.format(value, {datePattern:"dd MMM yyyy HH:mm:ss", selector:"date"});
console.log("formatMyDate():" + aDate);
return aDate;
}

var typeMap = {
"Date": {
type: Date,
deserialize: function(value){
//Parse the String into a date object. Your incoming data-string can be formatted differently from your output.
var aNewDate = dojo.date.locale.parse(value, {datePattern: "dd/MM/yyyy", timePattern: "HH:mm:ss"});
console.log("typeMap called:" + value + "|| converted: " + aNewDate);
return aNewDate;
}
}
};

Part Number Date


Dojo – DataGrid – Combining Field values in Formatter

August 6, 2010

I faced an interesting problem today. I was using a dojo Datagrid and wanted to display a different value in “Author” column if the author value was empty. All the samples I came across on the net were simple formatter examples which dealt with a single column.
Finally I found that the formatter function call has an “undocumented” 2nd argument “rowIndex”. Once I had a handle to this rowIndex, I could retrieve all the fields in the grid row using var rowdata = this.grid.getItem(rowIndex).

var layout = [{
field: “a_content_type”,
name: ‘ ‘,
width: “20px”,
formatter: getIcon
},
{
field: “author”,
name: ‘Author‘,
width: “25%”,
styles: ‘text-decoration:underline;’,
formatter: getAuthor
},……

//You can name the arguments anyway you want.
//You can call this function getAuthor(writer, rowNum), Javascript will pass the values to your arguments when formatter is called.
function getAuthor(author, rowIndex){
if( dojo.string.trim(author) == “”) { //author field was empty so use value from another field
console.debug(“Author was empty = ” + rowIndex);
var rowdata = this.grid.getItem(rowIndex);
return rowdata.owner_name;
} else {
return author;
}
}