NAVmoble - the pocket-sized ERP
Optimized for Microsoft Dynamics NAV and Windows Mobile powered devices

Thursday, March 29, 2007

Sofia .NET User Group meeting summary

We had our regular monthly meeting in the local Microsoft office.
Galin Iliev[Galcho] made a great session about the dark side of Office 2007 Add-ins.:)
We had a lot of fun, combined with snacks and beer kindly provided by Microsoft.

I've never seen so much people before! May be the rumours about the beer played their part.
There were presents for everyone this time provided by MS again:

If you'd like to attend to our meetings go and regitster on the Sofia.NET User group web site

I took few pictures (I hate my phone's camera already). Enjoy!

Sunday, February 25, 2007

Sql Server 2005: Change schema for all tables

I recently needed to change the schema for all the tables in a Sql Server 2005 database.
Sql Server 2005 provides a T-SQl statement capable to change the schema for a given object called ALTER SCHEMA
You may use the following syntax to change the schema for all the tables in a database. Just change the "new_schema" string with the desired one:

exec sp_MSforeachtable "ALTER SCHEMA new_schema TRANSFER ? PRINT '? modified' "


Enjoy!

Friday, February 16, 2007

“How to” Series: Automating Windows Mobile with Windows PowerShell

A lot of noise is going around the Windows PowerShell these days. I like this tool and definitely it may be of use even for the embedded developer.

Are you having some repeating tasks in your daily dev activities? Are you copying files on/from the device, manipulating registry keys, start /stop processes, etc... All these may be automated using Windows PowerShell.

I'll give 2 short examples, here – just to illustrate the idea.

Microsoft provides API called Remote Applications Programming Interface - a.k.a. RAPI. It allows to "touch" the device from the desktop machine, when the device is cradled. It works via ActiveSync or Windows Mobile Device Center on Vista. Unfortunately the RAPI itself is unmanaged and will be a little tricky to use it from a PowerShell script. So, here comes the RAPI class from the OpenNETCF.Desktop.Comunication library - a managed RAPI wrapper.

Example 1: Copying pictures from the device

The following example connects to the cradled device and copies all the pictures located on the device (\My Documents\My Pictures\) in the current location on the desktop

Note that in this example you should have
OpenNETCF.Desktop.Communication.dll placed
in D:\RAPI. You may change the path or think about a smarter assembly loading scheme.

[System.Reflection.Assembly]::LoadFrom("d:\RAPI\OpenNETCF.Desktop.Communication.dll") |Out-null

$rapi = New-Object OpenNETCF.Desktop.Communication.RAPI

$desktopPath = Get-Location

$desktopPath = $desktopPath.Path

$devicePath = "\My Documents\My Pictures\"

echo "Connecting to device..."

$rapi.Connect()

$pictures = $rapi.EnumFiles($devicePath+"*.jpg")

$pictures.Count.ToString()+" pictures found"

echo "-------------------------------"

foreach($f in $pictures)

{

  $remoteFile=$devicePath+$f.FileName

$localFile=$desktopPath+$f.FileName;

"Copying "+$remoteFile+" to "+$localFile

$rapi.CopyFileFromDevice($localFile,$remoteFile,1)

}


 

Example 2: Creating a registry key

This example reads and displays a list of registry keys on the screen – the installed applications in this case. Then it creates a new registry key called "My Key"

Note that in this example you should have
OpenNETCF.Desktop.Communication.dll placed in D:\RAPI. You may change the path or think about a smarter assembly loading scheme.

[System.Reflection.Assembly]::LoadFrom("d:\RAPI\OpenNETCF.Desktop.Communication.dll") |Out-null

echo "---------------------------"

echo "Installed applications list"

echo "---------------------------"

[OpenNETCF.Desktop.Communication.CERegistry]::LocalMachine.OpenSubKey("SOFTWARE\Apps").GetSubKeyNames()

echo "---------------------------"

echo "Create new key "

echo "---------------------------"

[OpenNETCF.Desktop.Communication.CERegistry]::LocalMachine.OpenSubKey("SOFTWARE\Apps").CreateSubKey("MyKey")|Out-Null

echo "My Key" created


 

You may think about automating even more useful and boring tasks - task that you do not want to do manually every day. Explore the OpenNETCF.Desktop.Comunication library to discover even more useful features.

Links:

Windows PowerShell Team's Blog

OpenNETCF.Desktop.Communication library downloads

OpenNETCF.Desktop.Comunication Docs

Enjoy.

Thursday, February 08, 2007

Windows Mobile 6

I've just bouth a new WM5 device for personal use and ops -
Windows Mobile 6 was announced

So what's new there?


Dev's bits

  • Sql Server in ROM
  • CF2 SP1 in ROM
  • New APIs(WISP,New Sound API)
  • New developer tools(Cellular Emulator, FakeGPS, CabToolSigner,...)
  • Security Improvements(checkout this post via Daniel Moth)

    Check out this post at Loke's blog for details on the dev's bits


End-User pearls

Monday, February 05, 2007

Resolved: Explorer crash on Vista

I have Windows Vista on my dev box for quite some time and I felt just fine with it.
The Problem
I' had a real fun with Vista, until the day my explorer started to crash every time I tried to open the Control Panel or Network and Sharing Center . I tried to remember the things I've installed or changed recently, but without success. Then I tried to find solution by googling - failure again. I've found that sometimes explorer crash may be experienced due to enabled-by-default DEP in Vista. I've disabled it, following these instruction, but no luck. I've tried to update my drivers, disable some services and so on.
The Solution
It took me few days to realize the real reason:
I've installed Firebird 1.5 few days ago. After removing it , everything was just fine. My further investigation revealed that the problem is caused by the .cpl applet installed by the Firebird Installer. Fortunately, there was a option to omit the Firebird .cpl. installation.

Conclusion
Are you experiencing strange explorer crashes? Are you having crashes, while trying to open Control Panel or Network and Sharing Center? Try to remember, what you've installed recently. Check if these apps install Control Panel Applets (*.cpl)
You may search for *.cpl in Windows\System32. You may uninstall apps by launching Windows Explorer(assuming it does not crash) and navigating to MyComputer/Control Panel/Programs and Features. Do not click over Control Panel - just click over the arrow next to the Control Panel text to expand it in the folder view.