Tuesday, October 25, 2011

.Net using 2.0 dll in 4.0

Using a dll compiled in 2.0 in a 4.0 project and your into trouble.
You will get the following error:
Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.

The fix:
In your App.Config file add following at the end but before </configuration >
<startup uselegacyv2runtimeactivationpolicy="true" >
    <supportedruntime version="v4.0" >
    <requiredruntime version="v4.0.20506" >
  </requiredruntime >
</supportedruntime >
</startup >

Tuesday, October 11, 2011

App Inventor

I just discovered a great tool to make Android Apps App Inventor
It uses graphical programming ala Scratch.

Nice tool if you want to try out sesnsor etc on your phone without going through the pain of writing java code.

Wednesday, August 10, 2011

Visual Studio 2010 versus COM-Object fails

When converting an VB2008 application to VB2010 I run into trouble regarding COM objects while compiling.
 you get errors like:
Error    1    Encountered multiple versions of the assembly with GUID 'ef3dc09d-efed-470b-bc2a-77aafb60e544'.  Try pre-importing one of these assemblies.    C:\..........\db_logger\TlbImp    GUI_Creator
I got two COM object CANoe and Canalyzer both fails. The COM object failure is known my MS and wasn't fixed in VS2010 SP1.
The problem is due to problem to build InterOp wrappers for the COM-object.
I managed to fix it by manually creating InterOp wrappers using tlbimp.exe

For CANoe.exe you open a commando prompt window in the same directory as the COM object in this case canoe32.exe:
C:\Program Files\Vector CANoe 7.5\Exec32>"C:\Program Files\Microsoft SDKs\Window
s\v7.0A\bin\tlbimp" canoe32.exe /out:CANoeInterOp.dll


For Canalyzer:
C:\Program Files\CANalyzer 7.1\Exec32>"C:\Program Files\Microsoft SDKs\Windows\v
7.0A\bin\tlbimp.exe" canw32.exe /out:canalyzerInterOp.dll

Then remove reference to CANoe in you application and add the reference to CANoeInterOp.dll instead.
In the code I also had to change ....CANoe.Application....  to CANoeInterOp.Application


Links: Microsoft Connect, Understand COM interop

Wednesday, March 16, 2011

Android development installation

It was a bit confusing trying to install all software for developing android apps. The installation instructions on the net is a bit messy.
Here is a quick how-to (WinXP):
  • Get the latest Java JRE, install it.
  • Get the latest Java JDK, install it.
  • Add path to Java JDK directory to Environment Variable PATH (C:\Program Files\Java\jdk1.6.0_24\bin)
  • Install Android SDK (this step failed for me due to Java JDK path wasn't set acc. to point above)
  • Install eclipse, The "Eclipse Classic" version is recommended.
  • Open Eclipse -> menu Help -> Install New Software..
    Follow the instruction here how to install ADT plug-in.
  • Install google USB driver.
That should be all!

Tuesday, March 08, 2011

Fubar, trying to develop Android apps.

I got myself a Nexus One phone. Next you start to write apps (at least try to).
I have struggled to get eclipse setup for Android and trying out some tutorials.
got the app running on the virtual phone, next step put it on the phone.
Search how to do it ended up with that you need a special Google USB driver.
Followed the installation instruction  for it, when done it required that the PC was restarted.
Restarted the PC then whammooo, Blue Screen Of Death.
Thinking Ok I got a bad driver, lets restart in safe mode and remove it.
Restarted in safe mode, still BSoD, heeelp!
Tried 'Last good something', still BSoD.
Now I really got upset, oh no reinstall the damn thing.
Booting up WinXP CD thinking maybe run a recovery.
The XP setup program listed the harddisk as type:unknown.
Ok, I got a dual boot (same HD) with Pinguy Linux, it works okay, it hasn't any problem
browsing through the WindowsXP partition.
Then I remembered that I got ERUNT installed in WinXP that makes backup of Registery.
Searching for 'ERUNT restore', bingo!
It describes some scenario, how to fix stuff if you cannot boot in Safe mode.
On of the scenario described using 'Bart's PE', yes I got that installed on an other PC.
Burnt a CD with Bart's PE, booted up the hurt PC trying to run ERUNT from c:
Got the message cannot read from c:, corrupted. What now, browsing through the menus in Bart's PE
and found ChkDisk, ran that. Then using the command prompt in Bart's PE and a success, C: is now readable.
Restarted the PC in Safe mode first, no problems here!
Restart in Windows, yes it running Okay now in this late houre 2:48 AM.
So my heroes of today is creator of ERUNT and Bart's PE, thanx.
ERUNT http://www.larshederer.homepage.t-online.de/erunt/
Bart's PE http://www.nu2.nu/pebuilder/

Tuesday, March 01, 2011

Changing default listrow in grub2

When running dual boot Windows and Linux the Grub bootloader default settings gets wrong after installing a new linux kernel. Before you updated menu.lst in /boot/grub but now with grub2 you do as follows:

As admin open file /etc/default/grub
Change row reading GRUB_DEFAULT=X
Set X to what ever row you want as default (start counting from 0)
In my case I want Windows as the default on this machine so I set
GRUB_DEFAULT=4

My boot list:
0 Linux kernel
1 Kernel safemode
2 memtest+
3 Memtest serialport something
4 Windows XP

Save the file and goto a console and write: sudo update-grub.

If want to remove old Linux-images: Open Synaptic Package Manager and set old linux-image.xxx for removal. then run: sudo update-grub.


Done!

Maybe I will remember this until the next time, memory getting shorter.

Monday, February 28, 2011

unity error CS2034

I got some stubborn error when trying to link in a dll in a unity project.

Assets/Scripts/cls_PLC.cs(3,14): error CS0234: The type or namespace name `TwinCAT' does not exist in the namespace `System'. Are you missing an assembly reference?

I'm making some test how to use unity as GUI for a TwinCAT PLC project.

I finally hit the jackpot at http://forum.unity3d.com/threads/13548-Type-or-namespace-name-compilation-issue


Solution: Add the Dll as plugins.


In Unity create a folder named Plugins under Project.
Open the folder in explorer and paste in your dll.



Friday, February 25, 2011

More COM Object problem

This time Vector CANoe. I had a reference for CANoe 7.1 then I upgraded to 7.5 and made some cleaning of the regristry. Whammoo, the vb.net program accessing CANoe compiled nicely but when it runs and tried to access CANoe I got following error:
Unable to cast COM object of type 'CANoe.ApplicationClass' to interface type 'CANoe.IApplication6'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{4A0D68E0-E2E0-4260-A5EE-2363AD2BDB4B}' failed due to the following error: Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)).

My memory is short, all you had to do was:
Open a console at where CANoe is installed then type canoe32 -regserver
Yes, RTFM

MySQL to MariaDB

 Here is a good description how to migrate to MariaDb MySQL to MariaDb Example of how to dump data from MySQL port=3307: mysqldump --user=ro...