Posts

Parsing Word Document XML via MsXml in VBA

Image
An old friend ping me because while having some success loading word documents saved as xml in his VBA routines in word, he was having massive problems getting XPATH to work. I resolved the basic issue and then asked him to give me his hardest issue for me to show some example code for. I think that the last time that I did this was a few years ago, MsXml was (and is) a bit lame compared to later implementations, so his troubles were very reasonable to have.   Declaring name spaces You can’t use XPath on a document with namespaces without providing the name spaces. The process is pretty simple, just convert the namespaces declare at the top of the XML document to a VB String. There happen to be many of them in a word xml document..   Dim domPrefix As String domPrefix = "xmlns:wpc='http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas' " domPrefix = domPrefix + "xmlns:mc='http://schemas.openxmlformats.org/markup-compatibility/2006...

Merging two AspNet Profiles–more complex then one would think!

During recent code revision, a developer accidentally removed in Web.Config, the applicationName on the SQLProfileProvider element. The consequence became apparent when support started to report customers saved-reports-definitions(which was stored here) had disappeared. < add name ="ErrorProfileProvider" connectionStringName ="LocalSQLServer" type ="System.Web.Profile.SqlProfileProvider" /> The problem was identified, but there was a second problem… We had a significant number of new customers that also saved reports-definitions to this error profile provider. A simple switch back by adding the applicationName would mean that these reports-definitions would disappear (which customer support did not want to see happen to new customers – a rather bad experience). My initial take was “Oh, I have used multiple membership providers in one web application in the past, so we just need to use the same pattern…” Oops that pattern did not w...

Converting SalesForce SOQL results to a Linked Dataset for use by C#

Image
In my last post, I illustrated the 'simple' way of getting the data back - by just creating a Xml Document from the results. This is not always efficient -- in fact, I have gotten out of system memory errors on some queries. In this post I will take the same query and show a little slight of code. The query was: SELECT Name,    (SELECT Name, Email FROM Contacts),    (SELECT CaseNumber, CreatedDate, Subject, Status, Resolution__c,  ClosedDate, SuppliedEmail,SuppliedName FROM Cases    WHERE CreatedDate = LAST_N_DAYS:366     AND Origin != 'Internal'     AND OwnerId !=     '00G40000001RTyyEAG'     AND RecordTypeId IN ('01240000000UTWP', '01240000000UWxM', '01240000000UWxl', '01240000000UWxb')   )   FROM Account    WHERE ID IN (SELECT AccountId FROM Contact Where Email in ({0})) Extension Method to Handle SOQL Result Columns The code ...

Handing Salesforce SOQL Relationship aka Joins in C#

Image
Salesforce SOQL is not SQL which often causes great frustrations to experienced database developers when they work with it. Being of the generation that worked with Network Data Models and Hierarchical Data Model  - i.e. pre-Relational Databases! (as well as database on Tape!), I actually find a lot of "familiar tones" in SOQL. Recently I was needing to build a query that in SQL would be: SELECT Account.Name AS AccountName,    Contact.Name, Contact.Email,    Case.CaseNumber, Case.CreatedDate, Case.Subject, Case.Status, Case.Resolution__c,  Case.ClosedDate, Case.SuppliedEmail,      Case.SuppliedName   FROM Account  JOIN Case ON ... JOIN Contact ON ....  WHERE Contact.Email in ({0})   AND Case.CreatedDate = LAST_N_DAYS:366     AND Case.Origin != 'Internal'     AND Case.OwnerId !=     '00G40000001RTyyEAG'     AND Case.RecordTypeId IN ('0124000000...

Doing Tests and Unit Tests of AspForm Web Applications: Setup

Image
This is the beginning of a series of post dealing with AspForm unit tests. We have two options for running Unit Tests. Both have advantages and disadvantages. Running Unit Tests Against your local development Box Running Unit Tests Against a Development Server Gotcha of this approach Recommended Approach Running Unit Tests Against your local development Box A test would be written as shown below This will produce a result such as To have the test work we MUST configure IIS to provide the appropriate site, for example on 666 Check list: Physical Path is pointing to the image you wish to test IIS port and path are matching IIS Server is running Running Unit Tests Against a Development Server Note: You need to STOP the above server for the following to work. Our test is now written as: The  AspNetDevelopmentServerHost must be pointing at the source folder you wish to test. We must now change the Web Application project to be found and ...

Missed placed your installation MSI and need to move Application to another machine?

Image
I was working away from my home office and my library of MSIs was not accessible. I wanted to install some software on a new machine NOW, instead of waiting until I got home in a few weeks.   I remembered that everything that is installed has a copy of the installation MSI copied to C:\Windows\Installer (so programs can be uninstalled later). looking in this folder, I saw {temp file names}.msi and not the original MSI names – rats!  Wait a minute, the MSI’s likely contains information on what it is in its properties. Left clicking on the file list allows you to select what is displayed. Clicking More… gives you “Subject” which is what I am looking for: Now I see what all of the MSI are! Now, I just copy (NOT move) the desired MSI’s to another folder, and renamed them appropriately.  If you move them, then you will cause problems if you wish to adjust features at a later time.   I can now install the stuff that I want, now!

Android Low Energy Bluetooth or a feature that I would love to see in C#

Recently I have been playing with BLE on Android (Samsung S3). One of the issues is no exposed BLE API in the current version of Android. I said, exposed, because by reflection you can find them! Or at least some of them, in some cases, you need to access the BLE library that was supplied to the phone (but not connected to the Android OS.   The process is very simple to identified the library:   First, add the following to the manifest:   < application android:allowBackup = "true" android:icon = "@drawable/ic_launcher" android:label = "@string/app_name" android:theme = "@style/AppTheme" > < uses-library android:name = "com.broadcom.bt.le" android:required = "false" /> < uses-library android:name = "com.csr.bluetooth.BluetoothExt" android:required = "false" /> < uses-library android:name = ...