failed due to the following error: 80040154.

As a developer, I install and uninstall all sort of programs on my system so I am not surprised when some weird and random error message popped up. 

I ran into the following error dialog today when I was writing some .NET integration code with EMC AppXtender.

image

This exception was thrown when I was trying to create the AppXtender DBConnection object.  So I fired up the AppXtender Document Manager to verify my installation and it ran successfully.

Going back to my Visual Studio project, I verified the Interop.AEXDBLib reference and that seems right.  A quick search on MSDN on error code 80040154 showed a list of COM errors on 32-bit OS, and I am seeing this error on my 64-bit OS.

The fix is to change the Platform target of my .NET solution to x86. 

clip_image001[6]

Hope this helps.

Installing Windows 7 on a Netbook?

Below is an awesome tool to use if you are planning on installing Windows 7 on a machine that does not have a DVD drive.  This tool allows you to put Windows 7 on USB drive and run Windows installation from there.

If you got one those netbook with XP on it and the machine has at least 1GB RAM and 1.6 GHz, I would format it and install Windows 7 on it.

http://wudt.codeplex.com/

  

VB Coding in a .NET World

C# is the standard coding language for developers at ImageSource, but it wasn’t always that way.  Before, VB.NET was the predominant language of choice.  When converting some of the codebases over from VB.NET, we consistently run into areas where VB.NET specific commands have been used.  These commands either do not exist in C# or require use of the Microsoft.VisualBasic library.  Either make code conversion very frustrating when they are used.

Below are some examples of commands that should be avoided in .NET code:

  • Cint, Cstr, CDate, CDbl – Use the equivalent call in the System.Convert class.
    • CInt – Convert.ToInt32
    • CStr – Convert.ToString
    • CDate – Convert.ToDateTime
    • CDbl – Convert.ToDouble
  • IsDate, IsNumeric – This one is a bit trickier and requires more work, but can be a lot more useful.  C# does not have an equivalent type checker, but you can use the TryParse methods located in the primitive objects.  For example, the following VB.NET code can be used to check if a string is an integer value.
    • Dim i As Integer = 0
      Dim test As String = "213"
      If Integer.TryParse(test, i) Then
        'Hey, this check worked!
        'And the integer has already been converted so you
        'can start using it.
      End If
  • VBCRLF – The new line command in VB, necessary because VB.NET does not allow you to write special characters in strings, so special characters need to be concatenated onto the strings.  Instead of VBCRLF, use the Environment.NewLine command, as this exists in both VB.NET and C#.
    • Optimally, code converted to C# should convert any instances of VBCRLF to \n in the string.  However, using Environment.NewLine will at least get it to compile without need for the Microsoft.VisualBasic library.
  • With - Avoid the With statement, as it does not exist in C# and you’ll just end up having to put the object reference in anyway.  It is not that much harder to just write the objectName.Method or objectName.Property, and it makes the code easier to understand.

So hopefully this brief overview will help you to write better VB.NET code.  Remember, the .NET framework exists in both VB and C# form, and making the two easily compatible helps code maintainability and portability.

  

Installing Silverlight 4 Beta

If you are getting an install error while trying to install Silverlight 4 Beta on an existing machine with Silverlight 3 SDK installed, please verify that your Silverlight 3 SDK version is 3.0.40818.0.

If you have an older version installed, you can uninstall it and reinstall a newer version here.

clip_image001

Hope this helps.

Phong Hoang
ImageSource, Inc.

  

Microsoft Office Metadata Made Easy

Have you ever been writing an application and needed to retrieve or edit the properties of a Microsoft Office document?  Did the thought of having to write code to perform Word or Excel automation send chills down your spine?  Were you worried that your documents’ precious metadata would forever be trapped behind the taunting shield of the Windows Explorer property window?

FileProperties

So close yet so far.

Fear not, all hope is not lost.  For there is another way to retrieve and edit the details of your Office files without even needing a version of Microsoft Office installed on the PC.  Microsoft has been kind of enough to provide the dsofile.dll, a handy ActiveX component that allows easy manipulation of the file details.  There is even demo code provided for VB6 and VB.Net.

But you may be asking yourself, “How can I get such a mysterious and powerful tool to work?”  Fortunately, dsofile is simple to use, just add it to your project and your ready to go.  Check out the sample code below for an example of how to use dsofile to retrieve information out of our document.

private void ReadOfficeDocumentMetadata(string fileName)
{
   DSOFile.OleDocumentPropertiesClass document = new DSOFile.OleDocumentPropertiesClass();
   document.Open(fileName, false, DSOFile.dsoFileOpenOptions.dsoOptionOpenReadOnlyIfNoWriteAccess);

   //Display document metadata
   txtTitle.Text = document.Properties.Title;
   txtAuthor.Text = document.SummaryProperties.Author;
   txtSubject.Text = document.SummaryProperties.Subject;
   txtCategories.Text = document.SummaryProperties.Category;
   txtComments.Text = document.SummaryProperties.Comments;

   document.Close(false);
}

Wow, it’s just that easy!  Let’s see it in action:

Sample Application

Take a moment and savor the sweet smell of success.

But don’t just take my word for it, try out dsofile.dll yourself.  The download comes with couple of sample applications that are worth checking out and provide a more in depth look at what this tool can do.  ECM Developers at ImageSource have already found uses for this wonderful tool, and so can you.

  

LiquidOffice and Printing PDFs Using JavaScript

I recently helped a client work through a particularly tricky issue with a Liquid Office PDF form.  Normally a form is completed by an end user, possibly processed through a workflow and  finally released into an EDMS system with the help of a Connect Agent (for instance, ImageSource’s ILINX Connect for eForms product).  However in this case, the form is simply used for printing.

The form’s field elements consist of a drop down with a list of titles, text boxes, barcodes, and a big shiny print button.  When the user presses the print button, the form goes through each title defined in the drop down list, sets the few bar-code values based on the text boxes values, then calls the JavaScript print method.  The first print request displays the standard Print Dialog, and the rest print silently.  To print one batch of cover sheets, print is called ten times.  Using Form Designer’s preview functionality yields the expected results.  However, when the form is published to the Liquid Office server and the form launched from the Web Desktop, the first cover sheet is never printed.  Instead, two copies of the second cover page are.

So what is going wrong?  After judicious use of the JavaScript alert method, I was able to determine that there is a bug when scripting a print dialog while Adobe Reader is hosted inside of a browser window.  When this.print(true) is invoked, Adobe Reader continues executing any remaining scripts until the dialog is displayed or it reaches a statement that blocks script execution, like a message box or another print statement.  I tested multiple versions of Adobe (7,8 & 9) and several different browsers (IE, FireFox, Safari), but with each combination ran into the same bug.  A side effect of this bug, is that if you assign a variable to the return value of print, that value is always true, even if the print job was canceled!

To get around this bug, I took a page from the AJAX playbook.  Since I needed a way to block script execution until the print dialog was displayed, I used the JavaScript setTimeOut method.  If you don’t know what setTimeOut does, it invokes a function after a specified number of milliseconds.  You can find a more complete explanation here.  Once the print dialog has been displayed to the user, the Print Properties object must be set and passed into each successive print request.  Otherwise the settings selected by the user from the dialog will be ignored.  Here is the JavaScript code that makes the solution work.

setTimeOut sample code.

There are a number of tricks I tried that did not work.  For example, I wrote a function to pause execution by looping for a specified amount of time, but that didn’t work.  JavaScript also does not have a built in method to put the current thread to sleep.  A message box after the first print statement would have done the trick, but would have been confusing for the user.

Tyson Magney
Senior Developer
ImageSource, Inc.

Share on LinkedIn   Share on Twitter

ECM Best Practices: Unit Testing and NUnit

Everyone agrees that testing is a good thing. Not everyone agrees on how much testing is cost-effective and what exactly the kind of testing is right for a specific piece of software or product. But automated unit tests cam help you ensure your software is healthy.Software Unit Testing

Unit tests operate on the smallest possible section of code, on logical modules. In software design, a program of any decent size will be broken down into modules. These modules have inputs, outputs and behaviors. These inputs and outputs and behaviors are used by other parts of the program to perform work and can be monitored or tested by the test software.

Often, a software module is deeply bound up inside the containing framework and it is not obvious how to test a subset of the code in isolation. (Testing multiple modules together is referred to as “integration testing” and will be discussed in a later post). Fortunately, there are software constructs available to mimic or “mock up” objects which the module under test needs.

A case in point is a product we are revising called ILINX Release Script 9.0. The ILINX Release Script is a module which is run mainly inside the process space of Kofax’s Ascent Capture product. There are a number of complex environmental elements which supply runtime context for the various ILINX components.

Because we are developing in C#, and are using the NUnit testing tool, we are able to make use of the NUnit’s Mock objects to help in mocking up objects to test against.

By stubbing out the functionality of the execution context, we are able to exercise specific portions (or units) of code with very specific and controlled data and confirm the software’s behavior and output. If you are using .NET, I encourage you to look into NUnit (http://www.nunit.org/index.php) it’s ability to generate Mock objects.

Share on LinkedIn   Share on Twitte

ECM Best Practices: Integration with ERP

Integration with ERP is something most SE’s (Systems Engineers) and PMs (Project Managers) should keep in mind when designing a project.  ERP, or Enterprise Resource Planning, is the process of using modularized software and hardware within a centralized network and datastore.  In regards to ECM, proper integration with ERP is important for maintaining data integrity with the larger organization.  ImageSource has successfully incorporated ERP Integration with many of it’s customer partners.

As an example, ERP Integration can be done within an Oracle IPM Process Workflow, using a combination of scripts and forms to access the centralized data store for use within an IPM Package.  The centralized data is usually populated and maintained by sources within the organization, but external to Oracle IPM Process Workflow.

The following examples demonstrate how ERP Integration can be used to maintain data integrity.  In this example, we have a workflow package that requires 3 pieces of Vendor Information: the Name, Address and ID Number.  Information about all of our example organization’s Vendors is located in a pre-existing database.  We can harness this data within the workflow, using some techniques demonstrated below:

Script Screenshot

Oracle IPM Workflow Screenshot

The above screenshot illustrates one way that ERP Integration can be handled within a process workflow. The package would enter the workflow containing a rudimentary amount of metadata gathered during  the Document Capture phase.  It would then be processed by the Vendor Lookup Script, which would use data in the package (like the Vendor Name) to query the centralized data store for the appropriate vendor information (like Address and ID Number).  If matching data is successfully found, it would then populate the package with it.  From there, the package would move on to the Review Queue where all of that data would be made viewable to the user.

ERP Integration can also be handled within an IPM Process Workflow form.  Observe the ERP data lookup demonstrated below:

IPM Process Form with data populated from the Vendor Lookup Script.

If the user needs to change the Vendor Information, they can do so by clicking on the Vendor Name dropdown.  The dropdown list is populated with vendor names pulled from the centralized data store.

List of Vendor Names from the centralized data store.

Upon selecting a new Vendor Name, the workflow form performs a query against the data store for the matching vendor information, as pictured below.

Vendor Information after a lookup in the centralized data store.

As you can see, the only data that was needed was the Vendor Name.  The Vendor ID and Address were updated to reflect the change on the form.  This kind of ERP Integration keeps data intact and makes metadata capture easier for the user, as they do not need search through piles of paper or external applications to find the appropriate information.

Richard Franzen
ImageSource, Inc.

Share on Twitter

ECM Best Practices: Training

One of the most useful but less known trick in a fully managed Oracle UCM production site, for example ImageSource, Inc.,  is to prevent content editing on a web site.  By default, a managed or dynamic site allows the content owners to enter the contributor mode by navigating to web pages and hit a standard hot key Ctrl + Shift + F5.  This mode is all fine and useful in development and contribution servers, but it is a no no in a production environment. 

Below is a screen shot of how to disable the contributor mode on your UCM production server.  Navigate to Administration for Servers | General Configuration and add the highlighted text.

 disable contribution

Hope this helps.

Phong Hoang
Development Manager
ImageSource, Inc.

Share on Twitter

Posted in Technical. Tags: , . 1 Comment »