December 21, 2007

TYPE_E_CANTLOADLIBRARY

Note to self: for error TYPE_E_CANTLOADLIBRARY (happens on Windows 2000)

Make sure the version of ASP.DLL in your system is 5.0.2195.6982

Another workaround is adding AspCompat="true" in your aspx page directive.

Share |

December 20, 2007

Calling COM object methods with extra parameters from C#

I am working on an ASP.NET app that is calling existing COM objects. A wrapper for the COM objects has been created using tlbimp, and that wrapper is referenced in my project.

One of the issues I am seeing is that the method signatures are occasionally different when calling the bridge in C# than in the sample classic ASP code that calls the same objects. One good example is with the Add method on VBA.Collection.

In classic ASP, you can simply call [class].[VBA.Collection].Add("mystring"). However, when calling the bridge in C#, the signature for this method shows up as [class].[VBA.Collection].Add(ref item, ref key, ref Before, ref After). No overloads, this is the only signature available. The actual parameter you want to use is the first one: "item", but what values/types do you pass for these parameters to make the equivalent call?

For the actual value you want to pass, you'll need to create a variable of type object to pass by ref into the first (item) parameter:

object item = "texttext";

for the other three, I tried passing various values, nulls, and types with no success, failing sometimes compile time, sometimes run time:

Exception from HRESULT: 0x800A0005 (CTL_E_ILLEGALFUNCTIONCALL)

the answer is to use System.Reflection.Missing.Value to represent the missing parameters. The called object will now use the default parameter values for key, Before, and After, and successfully add your item to the collection. Here's the code:

object m = System.Reflection.Missing.Value;
object name = "testtext";

oCOMClass.VBACollectionProperty.Add(ref name, ref m, ref m, ref m);

Share |

November 30, 2007

ASP.Net web application template missing from Visual Studio

I recently installed Visual Studio 2005 on a Virtual PC and opened an existing solution from Source Control and got an application type not supported error for one of the projects in the solution (it was an ASP.NET Web Application project). It seems to be a common problem, and a lot of people are able to easily resolve it by recreating the Project and Item template caches using the following command:

devenv /installvstemplates

Another possible cause for this issue could be that the templates are not in the right place - occasionally they are installed under My Documents.

To make sure they are in the right place, in VS go to Tools..Options..Projects and Solutions and make sure the project and item templates are in C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\. (that's where the above script will put them).

If you still have an issue you can download and install the VS 2005 Update to Support Web Application Projects here.

...after that File..New..Project should now show "ASP.NET Web Application" and "ASP.NET Web Service".

Share |

November 07, 2007

Floppy disk = SAVE

Right now I'm working on a SilverLight scheduling application for a 3-day event this January. I'm working on the "Save" functionality, where an attendee can store the itinerary of sessions they would like to sign up for. Most of the attendees for this conference are software engineers, architects and developers, probably familiar with the MS Office suite of applications where the Save button is a 12x12 pixel image of a floppy disk:

There is a lot of value in that image, since anyone who has used MS Office products, will intuitively recognize it as a save button, without a second thought. Lotus apps use the same symbol for saving, as well as many others. It's right up there with the red stop sign octagon, or the man/woman pictogram symbol on restroom doors when it comes to instant understanding of a graphic symbol.

But I'm sure there's a better visual representation of the Save function than something as obsolete as a 3.5" floppy - I mean I haven't had a floppy drive on my computer since 3 machines ago. Plus, why does a 3.5" floppy mean "Save" anyway?

The attendees for our conference are all familiar with software development, and one of the ubiquitous symbols in software application maps and network diagrams is the 3-D cylinder, which represents a database/datastore. So here's my thoughts on an equally intuitive Save icon.


For our application, that's exactly what we're doing - storing it in a database.

Another feature is the ability to email your itinerary to another attendee - again, "Email" functionality has been represented in multitudes of applications with the obvious envelope graphic, and that's such a simple, intuitive indicator that I wouldn't think of messing with that. We have a bit more graphical capabilities, so here's my treatment of Email functionality:

Share |

October 24, 2007

Moving Functoids & Links to new page

I had a complex map and wanted to make it easier to read by separating links and functoids into several pages within that map. BizTalk makes it extremely simple, but it took me a few minutes to get it...

1) Create a new destination page within the map.

2) Select the desired functoids and it's links from the old page.

3) Drag the functoid and links to the new destination page tab and keep holding the left mouse button down... you should see the arrow & grey box cursor... if you get the circle with the slash through it, you didn't correctly select all the functoids and links.

4) Now the new empty page is activated... but don't just drop the functoids on the tab, move the cursor back up into the grid, then drop them on the grid... they now are moved to the new page.

Share |

October 19, 2007

NHL Points projecter

Here is a js utility that will project the total points at the end of the season based on the team's current record. Next step is to find a good feed for team records.

Wins:
Losses:
OT Losses:
SO Losses:
Projection Text:

Share |

October 04, 2007

Expression Blend 2 Resize Page Canvas

Using Expression Blend 2 September Preview, I needed to make my application larger than the default size of 640 x 480. After changing the main canvas's height and width to 800 x 600, the XAML validated, but when I went to deploy, I got the message "The name 'Initialize Component' does not exist in the current context". In fact, even once I switched back to 640 x 480 mode, I still got this message.

The default .html file in the project has a css style sheet that has 640 x 480 coded in it that also needs to be revised. But even if this changed, the error message remained.

What I found was that this style sheet needs to be revised in Visual Studio first, then built in Visual Studio before you even touch Blend if you need to change from the original size defaults.

Share |

September 18, 2007

Burn VOB to DVD playable on TV

I had multiple .vob video files on multiple dvds that I wanted to be able to burn to a DVD that was viewable on TV via DVD Player. I am using CyberLink Power2Go, which came pre-installed on my laptop to burn the DVD. When I go to add the vob files to the disk compilation, I couldn't do it, as the .vob (Video Object) format is unsupported. Finally I found the program TMPGEnc which allows you to select multiple .vob files and converts them to MPEGs, which then can be burned to DVD via Power2Go. I was able to successfully view the videos on my TV via DVD player. The TMPGEnc trial version is disabled after 14 days.

Share |

September 11, 2007

BizTalk Orchestration Error "Parameter name: val"

I ran across this error message in an orchestration recently (in a Message Assignment shape). It didn't tell me a whole lot, and as of right now, doesn't give me many Google results.

OrchestrationValue cannot be null.
Parameter name: val

...and there is no parameter named 'val' in the Orchestration.

In the offending Message Assignment shape I have created a new message, and in that message I assign values based on distinguished fields in another message, so at first I thought maybe one of the nodes in my new message was MinOccurs=1 by default, and not being created, but no, they were all there. The problem ended up being that one of the Distinguished Fields I was referencing did not exist - the map that created the message had no source link to that field.

Share |

September 04, 2007

Error TF10121

Error TF10121 can happen in Visual Studio 2005 when you try to add a project to TFS source control that has the same name as a previously deleted project. Often, closing and re-opening the solution resolves the issue.

Share |

BizTalk SQL Adapter schema generation wizard confusion

As I was attempting to generate some schemas in BizTalk based on the results of a stored proc, I was having problems passing the necessary parameters to the procedure - even though I specified valid param values in the wizard, the generated SQL script always passed NULL for every parameter every time. Here's how the params are initially set in the wizard once you select the desired proc:



...and once you check the value box, the string NULL is initially populated as the value.


Now, here's where the problem occurs - if you set the values you actually want, and click generate, the generated script still has null values for all params, like

EXEC UpsertGlobalHeader @ContentType=NULL, @CustomerId=NULL,...

even though valid values are specified:


I finally found the answer here. Apparently, checking the checkbox in the Value column means set to NULL no matter what value you enter in the text area. So you need to UNcheck the value box, enter the text value you want for that param's value, and click generate. That sets the desired value in the script. In the case below, the @ContentType param would be set to 'PROD', all others would be still set to NULL.


http://msdn2.microsoft.com/en-us/library/aa578440.aspx

Share |

August 27, 2007

Restricting values in a BizTalk XML schema element

If you need to limit the range of values in an element in an XML schema select the element and under properties, select Restriction. An Enumeration property now appears below it. Enter the values you would like to limit your field to.

The Enumeration property is enabled in the mapping tool as well, so you can view the allowed values from there.

Share |

Logical existence, IsNil, Empty String comparison

In a BizTalk Map, a logical functoid evaluating whether the field value = "" (empty string) always evaluates to true for empty nodes, even if that field doesn't exist in the source schema.

<xsi:nil="true"></>
-isNil = TRUE, Logical Existence = TRUE, Logical = [Empty String] = TRUE

<></>
-isNil = FALSE, Logical Existence = TRUE, Logical = [Empty String] = TRUE

NO ELEMENT
-isNil = FALSE, Logical Existence = FALSE, Logical = [EmptyString] = TRUE

Share |

August 22, 2007

BizTalk Table Looping functoid scenario

Recently, I was mapping one schema to another using the BizTalk mapping tool, and I came across a transformation requirement that was a good case for using the Table Looping and Table Extracting functoids:

The source schema contained a product entity and this entity had multiple (up to 3) vendors in the product schema like:

<product>
<productId>1>/productId>
<globalVendorRelatedInfo>vendorInfo>/globalVendorRelatedInfo>
<otherProductInfo>info>/otherProductInfo>
<vendorCode1>1>/vendorCode1>
<vendorCode2>2>/vendorCode2>
<vendorCode3>3</vendorCode2>
<product>


the destination schema required that the vendors be a repeating element inside a vendors parent element. So basically the xml data needed to be normalized. Below is the mapping grid required:
TableLooping01

The first parameter is the scoping parameter... for these purposes, I just have it hard-coded to 3, since there are 3 vendors. The second parameter specifies the number of columns per row. After that, any fields or values required must be added. Make sure to name your links, otherwise, the field parameter names will default to the unwieldy xpath query string. Drag a link from the Table Looping functoid to the target element in the destination schema.
TableLooping02

After that, configure the columns to contain the required data. If you require that no destination record be created, select the Gating checkbox, and give the first column a boolean value. If the first column is false, no destination record will be created for that row.
TableLooping03

Then create a Table Extracting functoid for each column and specify the Table Looping functoid, and column number.
TableLooping04

Share |

August 18, 2007

Text editor comparison

I was on a project recently where I found that I needed to be able to open and save extremely large (>500 MB) files, and easily preserve the formatting and line endings. After much research and testing here's what I found:
(This was on a Dell desktop w/2GB RAM)

The standard Windows editors, NotePad and WordPad were way too slow once the files were > ~200MB. Plus WordPad reformatted the document to replace individual [CR]s or [LF]s with [CR][LF]s - no matter what format type was selected.

The Visual Studio 2005 editor was very good about not reformatting the line endings... it gives an initial alert asking if you want to reformat them, then preserves them correctly when you click No. Unfortunately, this editor is also very sluggish opening large files.

You can preserve formatting also with NotePad++, and UltraEdit fairly easily, but again, when it comes to very large files they just don't cut it. My perennial favorite, PFE (Programmer's File Editor), also starts to choke once the files get large.

Finally, there's across TextPad5... It is amazing how fast it not only opens but saves gigantic text files in a matter of seconds. The only issue I have with it is that the format type reverts to the first type in the list every time, rather than the most recent choice, but IMO if you need to read/save really large text files, TextPad5 is so much faster than anything else, that it is easily the way to go. Special thanks to Matt Casto for recommending it.

Share |

August 08, 2007

BizTalk replace functoid trick

Here's a neat trick I stumbled on in the BizTalk 2006 mapping tool:

If you need to change a functoid that has many links associated with it, instead of deleting the functoid and creating a new one and re-adding all the links, you can just drop the new functoid on the old functoid in the grid. All links and parameters are preserved, just the functoid changes. Here's an example:
FunctoidTrickBefore
Say you want to change the Not Equal functoid to an Equal functoid

FunctoidTrickAfter
Dropping the Equal functoid changes the functoid type, but preserves the links and parameters.

I even tried replacing a functoid with another functoid requiring limited parameters and it still preserves everything even if there are illegal parameters.

Share |

May 15, 2007

PGPBlackBox Decryption Memory Issue

I'm using EldoS PGPBlackBox to decrypt a PGP file in a BizTalk pipeline. A pipeline component at the Decode stage calls the DecryptAndVerify(stream, count) method of PGPBlackBox to decrypt the stream, and returns that decrypted stream.

It works fine until the incoming file is > 15 Mb or so, then the call to DecryptAndVerify causes a System.OutOfMemoryException. One of the tech support suggestions from EldoS was to try to reproduce the issue using their PGPFilesDemo app. The first run through did not reproduce the error, however in the demo app, it is decrypting to a FileStream by default, not a MemoryStream. If no target file is selected when running the app however, it does try to use a MemoryStream and the error is reproduced - it causes a System.OutOfMemoryException. (Not selecting a target file causes the pgpReader_OnCreateOutputStream() event handler to execute the else{} clause).

So for now decrypting to a FileStream gets around the OutOfMemory exception, but unfortunately the workaround will be having a separate receive port for decrypting to a file, then picking that decrypted file up by another port for the rest of the processing.

The ticket's still open so hopefully we can improve the workaround...


 

Share |

April 07, 2007

Voice-to-text experiment

As I am trying out the voice to text feature of Windows, I am discovering enough interesting aspects/problems/features that I thought I'd share it.

My original intent was to use the dictation feature of Windows Speech Recognition with MSOffice OneNote and basically dictate a Blog as I encounter interesting and informative things. In speech recognition training, it explains that the recognition initially will start around 80-90% accuracy, and end up around 95% after completing all of the training sessions.

I've gotten through 5 of the 8 sessions at this point, and 95% is about right, but I've found that it's not just the sound of the words, but the context of the sentences that it uses to convert the audio to text. Here's an example of the recognition, with my spoken word(s) in quotes, followed by the actual recognition text:

'cup' top
'cup' The
'cup' Company
'cup' Come
'cup of coffee' cup of coffee

So it won't recognize it the word 'cup' by itself, but it recognizes the entire phrase 'cup of coffee'. I have even specifically recorded the word 'cup' in Speech Tools. It is substituting words that would more logically occur as the first word in a sentence.

The training also appears to be having an effect - when I said 'cup of coffee' above, I used my actual speaking voice that I used in training, so it was really like 'cuppa coffee'. If I use exaggerated enunciation, it doesn't work:

'cup of coffee' Couple of coffee

And even when it goes totally haywire, the gibberish does have somewhat of a logical sentence structure to it. So if this blog ever seems psychadelic, you'll know I'm trying it out again. Here is this same paragraph using unedited voice-to-text:

And even when it goes totally a long DJ version does have somewhat of a logical sentence structure to solve this ballgame ever seen psychedelic you'll know I'm trying it out and here's the same

Using unedited voice to tax

Funny it didn't recognize the phrase voice-to-text.

So anyway, I'm not sure how usable this is right now, but maybe it could be used to record notes to self reminders etc. I'll try more after finishing training.

Share |