Android emulator won’t start

July 16th, 2013

Sometimes the x86 Android emulator would not start on my MacOS laptop. The MacOS Console contained these errors:

7/16/13 9:12:15.000 AM kernel[0]: haxm_error: log_vmoff_no 0
7/16/13 9:12:15.000 AM kernel[0]: haxm_error: log_vmoff_err 0
7/16/13 9:12:15.000 AM kernel[0]: haxm_error: HAX: vmxon failed (7c33f000). Is that another VMM running?
7/16/13 9:12:15.000 AM kernel[0]: haxm_error: The VMXON err: 1
7/16/13 9:12:15.000 AM kernel[0]: Panic:load_vmcs fail on vcpu_set_regs: 1
7/16/13 9:12:15.000 AM kernel[0]: haxm_error: log_host_cr4_vmxe: 1
7/16/13 9:12:15.000 AM kernel[0]: haxm_error: log_host_cr4 1626e0
7/16/13 9:12:15.000 AM kernel[0]: haxm_error: log_vmxon_err 1
7/16/13 9:12:15.000 AM kernel[0]: haxm_error: log_vmxon_addr 7c33f000
7/16/13 9:12:15.000 AM kernel[0]: haxm_error: log_vmxon_err_type1 1
7/16/13 9:12:15.000 AM kernel[0]: haxm_error: log_vmxon_err_type2 0
7/16/13 9:12:15.000 AM kernel[0]: haxm_error: log_vmxon_err_type3 0
7/16/13 9:12:15.000 AM kernel[0]: haxm_error: log_vmclear_err 0
7/16/13 9:12:15.000 AM kernel[0]: haxm_error: log_vmptrld_err 0

I did some googling on the errors, but did not find anything helpful so I decided to dig a little bit of digging myself. HAX is a hardware-assisted virtualization engine (hypervisor) from Intel which is used to let the Android emulator take advantages of the Intel VT CPU extensions. Since there are a lot of hax error’s and it is telling something about an other VMM, I stopped VirtualBox. This solved the issue.

Later after reading the documentation again it became clear that running VirtualBox next to a hardware accelerated Android emulator is unsupported.

Loading assets from APK with the Android NDK

February 15th, 2013

I am working on a game engine which is build in C++ and runs natively on Android devices. Thanks to the major improvements to the NDK from last year this is going quite well. One problem I hit however was the loading of asset files from the APK file. Searching for this did give a lot of hits, but the solutions were opening the APK file directly as  a zip file or using Java code to get to the AssetManager from the SDK. Both options did not seem very optimal for me and with a little bit of help from a colleague I created a native only solution.


/**
 * Read the first 10 characters of the textfile.txt asset
 */
void load_asset(struct engine* engine) {
    char apkFilename[] = "textfile.txt";
    AAssetManager *mgr = engine->app->activity->assetManager;
    AAsset* asset = AAssetManager_open(mgr, apkFilename, AASSET_MODE_UNKNOWN);
    if (asset) {
        char dst[10];
        LOGI("Asset is opened.");
        int bytesread = AAsset_read(asset, dst, 10);
        if (bytesread) {
            LOGI("bytesread: %d.", bytesread);
            LOGI("text: %s.", dst);
        }
        AAsset_close(asset);
    }
}

This function can be used in the NativeActivity sample from the NDK. Simply call it from android_main like this.

load_asset(&engine);

In the asset folder you should create a text file called textfile.txt with at least 10 characters in it. Now run the app and you should be able see the characters with logcat. I use this method to load PNG files. I hope this saves somebody some time.

Sokoban game

February 2nd, 2013

I created a Sokoban game in Unity. In the main menu the name of the player can be entered. This is used for keeping track of the levels that are unlocked and generating the leaderboard. The character moves from one tile to another and has to move the wooden crates to the drop points. During the game the camera follows the character and with a pinch gesture the camera can zoom out to give an overview of the level. It has Skeletal animations, basic physics and sounds.  It works on mobile devices in all kind of resolutions. The main menu and the game automatically scale to the resolution of the device.

I borrowed the character its animation from a Unity tutorial. I started working on my own character but that is not finished yet.

 

PHP, OData and SSL

April 7th, 2012

I am doing some PHP development at the moment. The main goal is to create a simple web based frontend for an application that comes with an OData webservices. I am using XAMPP 1.7.7 on my development machine. After did some tests with the OData SDK for PHP and found the following problem. PHP crashes when I do a request to a OData services over HTTPS. Luckily a meaningful Event Log is created along with the crash.

So it seams php_curl.dll has caused the crash. This problem is solved in the latest version of PHP 5.3 which contains a newer build of this file. At moment the latest version is 5.3.10.

Is geen geldige datum in NAV2009 R2

January 17th, 2012

One of our customers had an issue with classic reports from the role tailored client. When a report was opened, the following error occured.

2012-01-16T00:00:00+01:00 is geen geldige datum.

After looking at their NAV installation I noticed the service tier had an other version number as the client executables. I did a demo installation of NAV 2009 R2 on a virtual machine and updated the RTC and classic client to build 6.0.3.32228. The service tier was already on the same build as the customer (6.0.32012). With this combination of versions I could reproduce the problem in my virtual machine. Upgrading the service tier to the same build as the clients resolved the problem.

Word leaves Dynamics NAV unresponding

January 2nd, 2012

Today I had an issue with the interaction log entry functionality of Dynamics NAV. This issue was occurring on only one of our terminal servers. With interaction functionality it is possible to create Word templates and do mail merges from NAV. After creating a new Interaction Template and creating a new attachment for it, a new Word document is opened. When word closes, NAV should notice this and process the Word document. In my case Word was closed but NAV did not respond. By stepping through the code in NAV with the debugger I determined the statement at which NAV was hanging.
NewFileName := wrdHandler.WaitForDocument(wrdDoc);

Ok, so wrdhandler keeps waiting for a result from Word which is already closed. I checked if Word is really closed with the processes tab of taskmgr. One of the things I did to find the cause of this problem was logging into the server with a new userprofile. When I closed the Word document in this situation, Word showed a warning about macro support not being installed. So, looking at the installation options of Office on this machine revealed the ´Visual Basic for Applications´ feature was not installed.

After installing the feature the interaction log functionality from NAV worked again.

Forefront TMG error

May 25th, 2011

Today I installed Microsoft Forefront TMG 2010 on a new Windows 2008 R2 SP1 virtual machine. The installation itself went fine. However after a reboot I opened the Forefront TMG Management Console and received the following error.

An error has occurred in the script on this page.
Line 283
Char 13
Error: Invalid argument

The server is running the English version of Windows. The only thing I had changed on this machine were the regional and language settings. To solve this error I had to change the format from Dutch to English (United States) in the Region and Language settings.

Dynamics NAV 2009 R2 COMException

May 3rd, 2011

Today I had an issue with a new test database I created. I could open the database with the classic client. The role tailored client gave an exception error as soon as the Role Center was showed.

The stack trace shows the following information:

Type: System.Runtime.InteropServices.COMException
ErrorCode: -2147467259
Message: Exception from HRESULT: 0x80040F07
StackTrace:
at Microsoft.Dynamics.Nav.Client.ExceptionHandler.<>c__DisplayClass2.<DoRethrowWithCatchException>b__0()
at Microsoft.Dynamics.Nav.Client.ExceptionHandler.ExecuteAndCatchExceptions(Func`1 execute)
at Microsoft.Dynamics.Nav.Client.ExceptionHandler.DoExecute(Func`1 execute)
at Microsoft.Dynamics.Nav.Client.ExceptionHandler.DoRethrowWithCatchException(Exception exception)
Source: Microsoft.Dynamics.Nav.Client
———————————-
Type: System.Runtime.InteropServices.COMException
ErrorCode: -2147217657
Message: Exception from HRESULT: 0x80040F07
StackTrace:
at Microsoft.WindowsAPICodePack.Taskbar.ICustomDestinationList.CommitList()
at Microsoft.WindowsAPICodePack.Taskbar.JumpList.Refresh()
at Microsoft.Dynamics.Nav.Client.Controls.NavNavigationFormAdapter.CreateJumpList(CommandBarLogicalControl commandBar)
at Microsoft.Dynamics.Nav.Client.Controls.NavNavigationFormAdapter.OnCreateJumpList()
at Microsoft.Dynamics.Framework.UI.Windows.LogicalFormAdapterBase.CreateJumpList()
at Microsoft.Dynamics.Framework.UI.WinForms.LogicalFormAdapter.FormTaskbarButtonCreated(Object sender, EventArgs e)
at Microsoft.Dynamics.Framework.UI.WinForms.FormWindow.OnTaskbarButtonCreated()
at Microsoft.Dynamics.Framework.UI.WinForms.FormWindow.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Source: Microsoft.Dynamics.Framework.UI.WinForms

I needed some time to figure this one out. After eliminating several possible problems it suddenly worked. A few minutes later it appeared the shortcut name was the problem. I used a shortcut to start the client and open the correct database. This shortcut was called ‘Ketentest nieuwe installatie RTC’ . This name contains the word ‘install’ which caused the issue. We have a lot of this kind of shortcuts and never had this problem before (incl. NAV 2009 SP1). Since the R2 release of NAV2009 you cannot use shortcuts with the word install in the name.

Type: System.Runtime.InteropServices.COMException
ErrorCode: -2147467259
Message: Exception from HRESULT: 0x80040F07
StackTrace:
at Microsoft.Dynamics.Nav.Client.ExceptionHandler.<>c__DisplayClass2.<DoRethrowWithCatchException>b__0()
at Microsoft.Dynamics.Nav.Client.ExceptionHandler.ExecuteAndCatchExceptions(Func`1 execute)
at Microsoft.Dynamics.Nav.Client.ExceptionHandler.DoExecute(Func`1 execute)
at Microsoft.Dynamics.Nav.Client.ExceptionHandler.DoRethrowWithCatchException(Exception exception)
Source: Microsoft.Dynamics.Nav.Client
———————————-
Type: System.Runtime.InteropServices.COMException
ErrorCode: -2147217657
Message: Exception from HRESULT: 0x80040F07
StackTrace:
at Microsoft.WindowsAPICodePack.Taskbar.ICustomDestinationList.CommitList()
at Microsoft.WindowsAPICodePack.Taskbar.JumpList.Refresh()
at Microsoft.Dynamics.Nav.Client.Controls.NavNavigationFormAdapter.CreateJumpList(CommandBarLogicalControl commandBar)
at Microsoft.Dynamics.Nav.Client.Controls.NavNavigationFormAdapter.OnCreateJumpList()
at Microsoft.Dynamics.Framework.UI.Windows.LogicalFormAdapterBase.CreateJumpList()
at Microsoft.Dynamics.Framework.UI.WinForms.LogicalFormAdapter.FormTaskbarButtonCreated(Object sender, EventArgs e)
at Microsoft.Dynamics.Framework.UI.WinForms.FormWindow.OnTaskbarButtonCreated()
at Microsoft.Dynamics.Framework.UI.WinForms.FormWindow.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Source: Microsoft.Dynamics.Framework.UI.WinForms

Inkscape join path

April 4th, 2011

I am currently working on a Phone 7 game. One of the programs we use for content creation is Inkscape. I traced some bitmaps to vector images and needed to optimize the trace output a bit. One of the things I did was removing and joining some parts of the created paths. I will show you how the joining can be done. In this example image both green areas are a part of the same path and I want to join these parts.

Inkscape can only combine end nodes. Since the path’s created by the trace are closed we have to open them up. Select the two upper nodes and click the ‘Delete segment between two non-endpoint nodes’ button.

Notice that when you select the path, the red line is interrupted between the nodes. Now do the same thing for the lower two nodes. Select the left two nodes and click ‘Join selected endnodes with a new segment’ button.

After you repeat the last step with the two right nodes selected, the path is connected and clossed.

Audio problem on OpenSUSE 11.3 MythTV

January 3rd, 2011

I had the a strange problem on my frontend machine. This is a slow core2 machine with a NVIDIA GForce 210 running MythTV 0.24 on OpenSUSE 11.3.

This setup did work ok for a while. Suddenly the audio droped out frequently on all hd recordings. Sd recordings did not have this problem. I am running MythTV with VDPAU (cpu not running higher than 5%) so I did not think it was performance related. Also the old hd recordings which played well a week ago now had this problem. My frontend log file showed the following errors.

2011-01-03 21:10:43.171 Player(2): Video is 3.31093 frames behind audio (too slow), dropping frame to catch up.
2011-01-03 21:10:43.172 Player(2): Video is 4.15193 frames behind audio (too slow), dropping frame to catch up.
2011-01-03 21:10:43.172 Player(2): Video is 4.53267 frames behind audio (too slow), dropping frame to catch up.
2011-01-03 21:10:43.173 Player(2): Video is 4.56825 frames behind audio (too slow), dropping frame to catch up.
2011-01-03 21:10:43.174 Player(2): Video is 4.34492 frames behind audio (too slow), dropping frame to catch up.
2011-01-03 21:10:43.174 Player(2): Video is 3.92742 frames behind audio (too slow), dropping frame to catch up.
2011-01-03 21:10:43.175 Player(2): Waiting for video buffers…
2011-01-03 21:10:43.206 Player(2): Video is 3.3643 frames behind audio (too slow), dropping frame to catch up.
2011-01-03 21:10:43.207 Player(2): Waiting for video buffers…
2011-01-03 21:10:43.390 Player(2): Video is 3.8748 frames ahead of audio,
doubling video frame interval to slow down.
2011-01-03 21:10:43.446 Player(2): Video is 5.12485 frames ahead of audio,
doubling video frame interval to slow down.
2011-01-03 21:10:43.586 Player(2): Video is 5.24363 frames ahead of audio,
doubling video frame interval to slow down.

After trying changing some settings I remembered I disabled the KDE compositing setting a while ago. I thought disabling this setting would improve speed and stability. I decided to enable this setting again to see if this had anything to do with the audio problem. To my surprise it turned out this was the problem. I turned compositing on and off a few times and could reproduce the problem. Somehow the combination of my soft/hardware won’t work optimal when compositing is turned off.