Monday, July 31, 2006

SQL Mobile Size Limit

Ginny Caughey, a Device Application Development MVP, wrote about SQL Mobile size limitations in the microsoft.public.sqlserver.ce newsgroup (direct link here):

The limit for a SQL Mobile database is 4 gb, so unless my math is wrong, you shouldn't have any problems at all with 80,000 records of that size assuming you enough space on the device. I have a production app that handles 65,000 records and on a mobile device seeking to a unique key using the table's index is almost instantaneous. One thing I have found with big databases is that sometimes queries get very slow because the query processor apparently wants more memory for its own work than I have available. I've been able to reduce a 30-minute query to well under a second by switching from using SQL syntax to TableDirect in situations like that.

One other point with large amounts of data - don't try to load all that data into a DataSet. Use SqlCeResultSet and only load the data you need at any given point in your app.

VS2005 Debugging Problem, Breakpoints AutoDisabling Themselves

I posted today to microsoft.public.dotnet.languages.csharp about a VS2005 debugging problem that my colleague is experiencing (direct link).

My colleague is having problems debugging in VS2005. When he sets
breakpoints in his code and launches his application via Debug->Start
New Instance, the breakpoints autodisable themselves and the
"breakpoint icon" switches from being filled in to outlined with a
warning glyph on the bottom right hand corner. When moused-over, the
icon reads "The breakpoint will not currently be hit. The specified
module is not being loaded." I checked the loaded modules list via the
Debug->Windows->Modules interface and the specified module was, indeed
loaded, with a pointer to a valid pdb (as far as I can tell).

I even started a brand new Form application from scratch and ran it in
debug mode without adding any new code. I set a breakpoint at the first
line in Program.cs but this too was autodisabled with the same "module
is not being loaded" warning.

I Googled around the newsgroups/web for a while but did not find
anything that directly related.

I should note also that: setting a breakpoint via
System.Diagnostics.Debugger.Breakpoint() works as does Debug->Step Into
new instance.

Thursday, July 27, 2006

Benchmarking StringBuilder vs. String

A recent CodeProject post compares StringBuilder vs. String across varying degrees of usage.

In the following article I will show you the numbers for StringBuilder vs String which I did measure with .NET 2.0 a P4 3.0 GHz and 1 GB RAM. Every test was performed 5 million times to get a stable value.
(link)

I wonder if the same performance would be observed on Windows Mobile Devices.

Wednesday, July 26, 2006

MSDN Library Free Download

According to some msdn blogs (e.g., Rob Caron), MSDN June 2006 is a free download. Get it here.

Saturday, July 15, 2006

TextBox OnPaint in .NET CF 2.0

Is it possible to override the OnPaint and/or OnPaintBackground methods in the System.Windows.Forms.TextBox class in .NET CF 2.0?

Sadly, no. See here and here.

SqlServer Mobile Edition, In-Proc Database

I just posted the following to microsoft.public.sqlserver.ce:

On Sriram Krishnan's blog he writes, "Sql Mobile is a super-lightweight, in-proc database that runs on devices. The key phrase for me personally is 'in-proc'. This means that there is no IPC involved and as a result, performance is blindingly fast."

This is really the only discussion I could find about in-proc databases via a quick Google search. Can anyone provide me with any more information on what an "in-proc database" is and how it differs from an "out-of-proc?" database. The implication of Sriram's post is that SqlMobile is efficient because it doesn't use interprocess communcation (assuming that's what IPC stands for). Do most databases use IPC?

(direct link)

(Update: 07/16/2006 1:37PM) I received the following response from Ginny Caughey, a Device Application Development MVP.

Some databases such as SQL Server run as services in their own process space, often on a different machine from the apps that consume those services. Others such as SQL Server Everywhere/SQL Mobile are DLLs that run in the same process space as the application that uses them. Not only does this imply that there is no process boundary to impact perforamance, but also when the hosting application ends, so does the database engine so there is no service running to serve as a potential security threat. There are advantages to client/server databases such as SQL Server, but for stand-alone and mobile apps, there are also advantages for an in-process database such as SQL Mobile/Everywhere.

(direct link)

Thursday, July 06, 2006

Purchased OpenNetCF SDF 2.0

I finally went ahead and purchased the SDF 2.0 Extensions for Visual Studio 2005 from OpenNetCF.org. It's only fifty bucks and you get the source code, which, for me, is mostly useful for educational purposes. I'm always wondering if my coding style, design, etc. are up to par. You can also use the free version of the SDF 2.0, which isn't crippled but doesn't include the source here. I used it for quite a while before deciding that I should support the OpenNetCF team.

Oh and by the way, the installer for the purchased version of SDF 2.0 takes about 15 minutes on my 3Ghz HT 1.5GB RAM Pentium 4 machine to complete. I was almost going to e-mail support that their installation package was broken but then I discovered the h2reg process, which is started by the installer, was just taking forever. I believe this is because of some of the integrated VS2005 stuff they've done in SDF 2.0. Note that the free version installs rather quickly.

Tuesday, July 04, 2006

ActiveSync, A Lesson Learned

At the risk of jumping the gun here, it appears that my ActiveSync woes were not due to Microsoft's negligence or poor programming (though, I suppose, they really should have had the ActiveSync troubleshooter page much earlier, circa 4.0 or even 3.X). In fact, it was my own fault for not noticing that my IT department at work packaged BlackICE (a firewall program) with our VPN software. So, simply by installing our VPN (a rather innocuous gesture), I created a firewall that prevented TCP traffic over port 990.

Now, I'm not 100% confident that this will solve all of my ActiveSync issues but it appears that, at the moment, I've figured out the connection problem.

Sunday, July 02, 2006

ActiveSync Connection Problems Continue

I finally decided to post to the ActiveSync newsgroup about my ActiveSync issues (here). Here's a copy of the post:

My laptop will not connect to any of my WM 5.0 devices (including the i-mate KJAM, the Cingular 2125, and the T-MOBILE SDA). Though I've experienced this problem in the past, I've been able to uinstall and reinstall ActiveSync 4.2 and restart my computer to solve the problem.
I've been blogging about my problematic encounters with ActiveSync for a while now but have never sought the expertise of this newsgroup. I'll provide a quick summary of my ActiveSync issues here. You can visit my blog for more details: http://csharponphone.blogspot.com/2006/05/activesync-41-sit-spin.html

Basically, I plug-in my WM 5.0 device, the little networking animation starts up in the taskbar (and says acquiring network address, etc.). This icon dissapears and then the ActiveSync icon in the taskbar turns green and starts to spin. This continues until a timeout is reached at which point I'm given a choice of visiting Microsoft's troubleshooter webpage (it then forwards me on to the "If ActiveSync Cannot Receive Data Through Port 990" page). I've tried following all of the previous advice posted here and on the web, but to no avail. My laptop is running Windows Firewall and McAfee VirusScan Enterprise 8.0.0.

Any help from MVPs, Microsoft employees, or anyone with a clue into what might be happening would be much appreciated.

NETSTAT RETURNS:
Active Connections

Proto Local Address Foreign Address State
TCP 127.0.0.1:1150 127.0.0.1:1151 ESTABLISHED
TCP 127.0.0.1:1151 127.0.0.1:1150 ESTABLISHED
TCP 192.168.2.76:1038 64.233.167.125:5222 ESTABLISHED

IP-CONFIG RETURNS:
Ethernet adapter Local Area Connection 16:

Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Windows Mobile-based Device #14
Physical Address. . . . . . . . . : 80-00-60-0F-E8-00
Dhcp Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : No
IP Address. . . . . . . . . . . . : 169.254.2.2
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
DHCP Server . . . . . . . . . . . : 169.254.2.1
Lease Obtained. . . . . . . . . . : Sunday, July 02, 2006 1:53:41 PM
Lease Expires . . . . . . . . . . : Tuesday, August 01, 2006 1:53:41 PM

Update: 07/04/2006 11AM: Here's my follow-up to the post above:

I'm ashamed to admit this, but it never occurred to me to check my
process list to see if there was any networking software running on my
computers that I did not know about. Imagine my surprise when I saw
blackd.exe (part of the BlackICE firewall package). As soon as I
noticed this, I figured this might be the root of my problem. It seems
the company that I work for includes a custom install of the BlackICE
installation with their VPN software. I force closed the process in
Task Manager, plugged in my WM 5.0 device and, what do you know,
ActiveSync turns green immediately and says connected.

I probably would have thought of this earlier on, but ActiveSync would
occassionally work--it wasn't a consistent problem. This maybe more an
issue with BlackICE however.
Unfortunately, the install of BlackICE that I have does not include a
frontend, so I must manually edit their configuration file to open the
ActiveSync related ports (despite warnings in the file itself against
it).

So, in the end, it appears my frustration was misdirected at Microsoft.
It really should have been at my IT department for not disclosing that
BlackICE was packaged with our VPN.

Hopefully now my ActiveSync problems are solved.

Two Inch View

Just added an RSS feed to a new blog called "The Two Inch View," which is dedicated to "Windows Mobile media and entertainment." The site design is crisp and very readable and the author has a long history with WindowsCE/Mobile (a former MVP). The site is actually sponsored by Windows Mobile, which hopefully implies a strong foundation and dedication to frequent updates. It currently has some posts on the Windows Mobile Device Center, which looks like a new skin on top of ActiveSync (and, hopefully, includes some bug fixes to ActiveSync as well).