Windows Presentation Foundation Host Has Encountered a Problem

Problem:

Every now and then we run across a weird deployment issue where certain XP machines are not able to run ILINX Content Store with the weird exception below

 

 

 

 

 

 

Solution:
The issue is caused by either an incorrect/corrupted permissions set on the user working folder or the registry key.  The fix is to run the tool below from Microsoft.

http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=5766


Phong Hoang
ImageSource, Inc. 

 

 

 

 

 

How to Count Multi-Page TIFF Files

Here is the simple TIFF file page counter using TiffBitmapDecode.

This code works for most cases. Some TIFF file compression may not work.

 

Kyoungsu Do
Software Quality Engineer
ImageSource, Inc. 

 

IE9 RC

Microsoft has just released IE9 Release Candidate.  There is a lot of things I like about this version, but most of all I like how simple the new UI is.  Thanks to Chrome for starting this trench.

Here’s ILINX Content Store running inside IE9 with all default settings

image

And here is ILINX Capture

image

As for browsing and internal web apps, everything appears to be working and working fast.

Building Out Distributed Apps (Big Data)

Yesterday, I attended a webinar by O’Reilly on how to reduce the pain of building out distributed applications. The focus was on scalability, which makes sense, since this is why you would want to distribute your applications.

Apart from the host’s unfortunate resemblance to Little Lord Fauntleroy, there was some interesting observations to be made. To wit:

Engineers versus Ops

When there’s an issue affecting your customer in large systems, it is most likely an engineering issue, especially in emerging products. You need to staff up on Engineering talent for your projects at a much greater rate than Ops.

Data is not always relational

Data these days is more than OLAP stuff. Things being captured and crunched include data graphs, key-value pairs, etc. So, something non-SQL based might be called for as a datastore. Only a handful of SQL features are used in most large data projects. As the data sets get larger, SQL gets less useful.

Real-time versus Batch Processing

Something to consider. How is your data being created, in one-sy/two-sy fashion online, or in large grabs of data. This will affect your basic understructure.

Cost of Research

It is very easy to under-estimate the cost of research when moving into a new area. Executive management wants hard numbers to be able to plan and manage costs, but anybody who’s developed new systems knows that costs tend to be unpredictable because you just don’t know what you don’t know yet.

What is your experience involving Big Data and Distributed Applications?

Using the ‘using’ keywork in C#

C# Super HeroIn the System.Data.SqlClient namespace, SqlConnection and SqlCommand are two examples of managed types that use unmanaged resources down in the COM layer of the run-time. Microsoft says that all of these types must implement the IDisposable interface.

Also from Microsoft:
As a rule, when you use an IDisposable object, you should declare and instantiate it in a using statement. The using statement calls the Dispose method on the object in the correct way, and …it also causes the object itself to go out of scope as soon as Dispose is called. Within the using block, the object is read-only and cannot be modified or reassigned.
using (SqlConnection conn)
{
//do work
}

The using statement ensures that Dispose is called even if an exception occurs. This is the same as wrapping it in a try/finally block:

SqlConnection conn;
try
{
    conn = GetConnection();
    // do work
}
finally
{
    conn.Dispose();
}

What I like to do is to nest my SqlClient objects in using statements:

string sqlString = "select * from myTable";
using (SqlConnection conn = GetConnection())
{
    using (SqlCommand cmd = new SqlCommand(sqlString, conn))
    {
        // do work, like add params, execute the statement
        // read the results, etc

        // even if you return from inside this nested using statement
        // both the cmd and conn objects are disposed properly

    } // cleans up cmd
} // cleans up conn

Javascript escape() and C#

Recently, I needed to transmute a Web form into Windows form for a client. There was a subtle issue involving parameters to a SQL stored proc; the stored proc returned matches and near matches to the input values. The return values were missing special characters like ampersand (&).
I kept looking at the output routine trying to figure out where the data was getting cooked. I walked back up the execution chain, checking the inputs until I found a call to escape() in the JavaScript on the original web form.
The solution was to import the Microsoft.JScript assembly and call the Microsoft.JScript.GlobalObject.escape() method.
Another good day at ImageSource, Inc.

  

When In Doubt – Log Out

Recently, while working on a project for ImageSource, I ran into a bit of problem that pretty much had me stumped.  I had written a .NET library to integrate with a 3rd party COM dll.  The code looked correct, it passed all of its test cases and ran just fine when compiled in Debug mode.  I created a test application to use this library and stress test it.  Everything checked out.

Then I compiled it for Release and obfuscated it.  Suddenly it did not run fine anymore.  The test application would consistently give me errors of varying severity.  Everything from Automation error The server threw an exception to The remote server machine does not exist or is unavailable.

Error Message

An always unwelcome message.

I could get various errors depending on my input parameters, but they didn’t always occur at the same time.  Sometimes I would get a COM exception after 10 iterations of a loop, other times it would be 20.

At first, I thought the issue was that the code was obfuscated.  I’ve run into some small bugs in the past when obfuscating code, and thought this was no different.  However, testing a non-obfuscated Release build of the code produced the same problem.  Only switching back to the Debug build fixed the issue.  Lots of head banging ensued.

After trying to figure out error messages that seemed to have little  rhyme or reason, I finally went back and looked at sample code provided by the 3rd party.  After testing their code and finding that it run fine in Release mode, I had to figure out what this code was doing that mine was not.

Their code called a logout method in the API and mine didn’t.

Looking at my own code, I had completely missed making that call and it made all of the difference in the world.  My code was staying logged into the server, or at least causing problems server-side because I wasn’t disconnecting.

One added line later and the Release build of my library was working perfectly.  In fact, even the obfuscated version worked without a problem.  All of that grief and headache caused by one line of missing code.

So I guess the moral of this story is this: Make sure that you close you connections, you release your objects, that you make sure you clean up your mess.  Because if you don’t, it could come back to bite down the road.  Also, don’t be ashamed to go back and look at sample code when you’re stuck.  Sometimes the answer is right in front of you.

  

The death of Windows Forms and the rise of XAML

A little history

Microsoft technologies move in decades.  Every 10 years or so Microsoft introduces a better way to write Windows applications.  My programming experience goes back to Win32 APIs and MFC in the 90s and .NET in the 20th.  (Yes, I know Java come before .NET and I actually work with that platform for a numbers of years, but let’s just leave Java out of this discussion.)  So here we are in 2010, starting a new decade, is there a better way to write Windows apps?

Windows Forms

Windows Forms for .NET dominate thick client applications in the last decade and Microsoft has said that they will continue to support Windows Forms for the foreseeable future.  However,  three technologies/application types that would put Windows Forms to bed are rich internet apps, cloud apps, and phone apps.   The main problem with Windows Forms is that you cannot easily adapt those apps across different devices/app types and that is where XAML shines.

XAML

Extensible Application Markup Language (XAML) simplifies creating a UI in .NET.  Both WPF and Silverlight use XAML, but the biggest promise for XAML is that XAML-based apps can easily be adapted to different devices.  Microsoft has indicated that they want to control 3 screens: PC, TV and phone.  Whether or not they will succeed that vision is another story, but I believe that XAML will be the delivery mechanism for these next generation apps.

Summary

I don’t see Win32, MFC and Windows Forms for .NET apps going away anytime soon.  In fact, I don’t see them going away at all because that’s what Windows is built on.  That said, XAML is the better way to write Windows apps for this coming decade.  If you are a Windows developer and don’t get to work with XAML in your day job, you should learn it at night.

Visual Studio 2010 and .NET 4.0 RC Now Available

You can download the RC here

This version fixed a lot of performance issues in the Beta 2 and like the beta 2 version, it also carried a go-live license for production use.

Downloading the RC now…

  

ILINX Capture 4 Web Client Enhancements

Welcome to 2010!  Hope you all had a great holiday

Below are two of my most favorite features in ILINX Capture 4 web client.

clip_image001[5]

Detachable Viewer

ILINX Capture 4 now supports detachable viewer – enabling the indexing panel to be on one screen and the image on another screen.

image

Personalization

ILINX Capture 4 enables more configuration settings on the web client.  Both scanning options and confirmation prompts are now configurable

image

There also a tons of other improvements under the cover both on the client and server, but I find myself using these two features above the most.

Hope this helps.

  

Follow

Get every new post delivered to your Inbox.