Using SharePoint Online for InfoPath Forms Services

Using SharePoint Online for InfoPath Forms Services

Introduction Today I thought it would be fun to do more research on what InfoPath looks like in the cloud. There had been a few hints about Forms Services running on SharePoint Online and some people were suggesting that it would only work once Office365 came out. Today I started a BPOS trial at https://mocp.microsoftonline.com/site/services/bpos/signup.aspx?offer=suite&quoteid=067303dd-bef3-4bc9-8f95-2b24c6dae143and […]

PowerShell cmdlet for BizTalk db restore

Configuring the backup job for BizTalk is a fairly simple task, while restoring it is a bit more complicated. By default the BizTalk backup job makes a full backup once a day, and a log backup every 15 minutes. When backups are done, a mark is set on each file. This mark is the same across all databases, and should be used to restore all databases to the same point in time and keeping all databases in a consistent state. -Also, by default, all backups are made to the same directory folder.

The only supported disaster recovery procedure from Microsoft is log-shipping. Nick Heppleston has gone through the trouble of describing this in great detail, and I strongly recommend to read these post before you choose to use any other approach.

A few weeks ago, I sent out a question on twitter, asking whether people used log-shipping or not. I got 24 responses where only 4 used log-shipping.

Although log-shipping comes with many advantages, it is still expensive since it requires a secondary SQL cluster. Most of the people I asked confirmed this was the main reason why they had chosen other alternatives. Since BizTalk doesn’t come with any restore scripts/features other than log-shipping, everyone is left to fix this on their own.

If you’re in the same situation, feel free to download this sample. If it doesn’t fit your solution, it might at least be a good starting point.

The sample comes with two cmdlet’s: Get-Marks and New-RestoreDatabaseFromMark. The first one gives you a list of all marks from all log files. The second one, as the name implies, restores a database to a specific mark. When doing so, the database will be restored from the last full backup before the mark. After that, all log files will be restored in order from the full backup. The last log file will only be restored to the specified mark.

The Get-Mark cmdlet queries the backup output folder to retrieve all marks. The mark is part of the name of each backup file:

Each file is made up of the following parts:

[Server]_[Instance*]_[Database]_[Full|Log]_[Mark]

Eg: SERVER001_DTA_BizTalkDTADb_Log_BTS_2011_01_18_12_06_50_22.bak
* The instance is only present for none default instances.

You can use the New-RestoreDatabaseFromMark cmdlet with or without specifying the mark. Leaving the mark empty is eqvivilent to last mark.

The New-RestoreDatabaseFromMark cmdlet is called per database, why it's easier to create a script for restoring all databases together. The sample comes with a RestoreScript.ps1 script file, which could work as a good start:

$backupPath = "X:\BizTalkBackUp";
$dataPath = "E:\SQL Server 2008\MSSQL10.MSSQLSERVER\MSSQL\DATA";
$logPath = "E:\SQL Server 2008\MSSQL10.MSSQLSERVER\MSSQL\DATA";



$mark = Read-Host "Specify mark (use the Get-Marks cmdlet to get all marks or blank to use last mark)";

if ($mark.Length -eq 0)
{
Write-Output "Restoring to last mark...";
$mark="";
}

New-RestoreDatabaseFromMark SSODB $backupPath $dataPath $logPath $mark;
New-RestoreDatabaseFromMark BAMPrimaryImport $backupPath $dataPath $logPath $mark;
New-RestoreDatabaseFromMark BizTalkDTADb $backupPath $dataPath $logPath $mark;
New-RestoreDatabaseFromMark BizTalkMgmtDb $backupPath $dataPath $logPath $mark;
New-RestoreDatabaseFromMark BizTalkMsgBoxDb $backupPath $dataPath $logPath $mark;
New-RestoreDatabaseFromMark BizTalkRuleEngineDb $backupPath $dataPath $logPath $mark;

trap [Exception]
{
Exit;
}

Write-Output "Done restoring all BizTalk databases" -foregroundcolor "yellow";

The first section of the script defines a set of path variables. In my simple sample, all database files are located in the same folder. This is never a good practice, why you probably have different paths for data- and log files for each database.

To use the sample, open PowerShell and navigate to the sample output folder. Eg:

PS C:\> CD “c:\Program Files\bLogical.BizTalkManagement”

Before you can use the cmdlets, you need to install them. You can do this using the install script:

PS C:\Program Files\bLogical.BizTalkManagement> Install.ps1

After you’ve installed the snapins, you can start using the commands:

PS C:\Program Files\bLogical.BizTalkManagement> Get-Mark "X:\BizTalkBackUp"

or

PS C:\Program Files\bLogical.BizTalkManagement> MyRestoreScript.ps1

Downloads 

HTH

Sending Messages from BizTalk to Salesforce.com Chatter Service

Sending Messages from BizTalk to Salesforce.com Chatter Service

The US football Super Bowl was a bit of a coming-out party for the cool Chatter service offered by Salesforce.com. Salesforce.com aired a few commercials about the service and reached an enormous audience. Chatter is a Facebook-like capability in Salesforce.com (or as a limited, standalone version at Chatter.com)that lets you follow and comment on various […]

Timestamp to word phrase in C#

Ok, this is not rocket science topic, but when I looked for a sample I couldn’t find any decent one. With the popularity of facebook, twitter, stackoverflow etc its becoming more of a norm to represent the time stamp in words rather than simply date time value.

This is what I come up with, people simply forget how powerful the .NET programming stack is. It didn’t take more than 15 minutes to come up with this helper.

 public static string DateDiffInWords(DateTime dateTimeBegin, DateTime dateTimeEnd)
        {
            TimeSpan diff = dateTimeBegin.Subtract(dateTimeEnd);

            if (diff.Days > 10)
            {
                string s = string.Format("{0} '{1} at {2}"
                    , dateTimeEnd.ToString("MMM dd")
                    , dateTimeEnd.ToString("yy")
                    , dateTimeEnd.ToString("HH:mm"));
                return  s;
            }
            if (diff.Days > 1)
                return string.Format("{0} days ago", Convert.ToInt32(diff.Days));
            if (diff.Days == 1) 
                return "Yesterday";
            if (diff.Hours > 1) 
                return string.Format("{0} hours ago", Convert.ToInt32(diff.Hours));
            if (diff.Minutes > 1)
                return string.Format("{0} minutes ago", Convert.ToInt32(diff.Minutes));
            if(diff.Seconds > 1)
                return string.Format("{0} seconds ago", Convert.ToInt32(diff.Seconds));
            
            //we should not reach here
            return string.Empty;
        }
Few sample calls:
Console.WriteLine(Date.DateDiffInWords(DateTime.Now, new DateTime(2011, 2, 5, 14, 45, 45)));
Console.WriteLine(Date.DateDiffInWords(DateTime.Now, new DateTime(2011, 1, 28, 14, 45, 45)));
Console.WriteLine(Date.DateDiffInWords(DateTime.Now, new DateTime(2011, 2, 5, 05, 45, 45)));
Console.WriteLine(Date.DateDiffInWords(DateTime.Now, new DateTime(2011, 2, 4, 14, 45, 45)));
Console.WriteLine(Date.DateDiffInWords(DateTime.Now, new DateTime(2011, 2, 3, 14, 45, 45)));
Console.WriteLine(Date.DateDiffInWords(DateTime.Now, new DateTime(2011, 2, 2, 14, 45, 45)));
Console.WriteLine(Date.DateDiffInWords(DateTime.Now, new DateTime(2011, 1, 2, 14, 45, 45)));
And the Outcome:

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

Nandri,

Saravana
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

BizTalk: Instance Subscription: Details

BizTalk: Instance Subscription: Details

It has interesting behavior and it is not always what we are waiting for.
An orchestration can be enlisted with many subscriptions. In other word it can have several Receive shapes. Usually the first Receive uses the Activation subscription but other Receives create the Instance subscriptions. [See “Publish and Subscribe Architecture” in MSDN]
Here is a sample process.
This orchestration has two receives. It is a typical Sequential Convoy. [See “BizTalk Server 2004 Convoy Deep Dive” in MSDN by Stephen W. Thomas].
Let’s experiment started.
There are three typical scenarios.
First scenario: everything is working without errors
Activation subscription for the Sample message is created when the orchestration the SampleProcess is enlisted.
The Instance subscription is created only when the SampleProcess orchestration instance is started and it is removed when the orchestration instance is ended.
So far so good, the Message_2 was delivered exactly in this time interval and was consumed.
Second scenario:
Three Sample_2 messages were delivered. One was delivered before the SampleProcess was started and before the instance subscription was created. Second message was delivered in the correct time interval. The third one was delivered after the SampleProcess orchestration was ended and the instance subscription was removed.
Note:
%u00b7 It was not the first Sample_2 was consumed. It was first in the queue but in was not waiting, it was suspended when it was delivered to the Message Box and didn’t have any subscribers at this moment.
The first and the last Sample_2 messages were Suspended (Nonresumable) in the Message Box. For each of this message we have got two (!) service instances associated with this suspended message. One service instance has the ServiceClass of Messaging, and we can see its Error Description:
The second service instance has the ServiceClass of RoutingFailureReport, and we can see its Error Description:
Third scenario:
Two Sample_2 messages were delivered. Both were delivered in the same interval when the SampleProcess orchestration was working and the instance subscription was created and was working too.
First Sample_2 was consumed. The second Sample_2 has the subscription but the subscriber, the SampleProcess orchestration, will not consume it. After the SampleProcess orchestration is ended (And only after! I will discuss this in the next article.), it is suspended (Nonresumable). In this time only one service instance associated with this kind of scenario is suspended. This service instance has the ServiceClass of Orchestration, and we can see its Error Description:
In the Message tab we will see the Sample_2 message in the Suspended (Resumable) status.
Note:
%u00b7 This behavior looks ambiguous. We see here the orchestration consumes the extra message(s) and gets suspended together with those extra messages. These messages are not consumed in term of “processed by orchestration”. But they are consumed in term of the “delivered to the subscriber”. The receive shape in the orchestration is not received these extra messages. But these messages are routed to the orchestration.
Unified Sequential convoy
Now one more scenario.
It is the unified sequential convoy. That means the activation subscription is for the same message type as it for the instance subscription. The Sample_2 message is now the Sample message. For simplicity the SampleProcess orchestration consumes only two Sample messages. Usually the orchestration consumes a lot of messages inside loop, but now it is only two of them.
First message starts the orchestration, the second message goes inside this orchestration. Then the next pair of messages follows, and so on.
But if the input messages follow in shorter intervals we have got the problem.
We lost messages in unpredictable manner.
Note:
%u00b7 Maybe the better behavior would be if the orchestration removes the instance subscription after the message is consumed, not in the end on the orchestration. Right now it is a “feature” of the BizTalk subscription mechanism.

The Bing Sting – an alternative opinion

I know I’m a bit of an MS fanboy at times, but please, am I missing something here?Microsoft, with permission of users, exploits clickstream data gathered by observing user behaviour.One use for this data is to improve Bing queries.Google equips twenty of its engineers with laptops and installs the widgets required to provide Microsoft with clickstream data.It then gets their engineers to repeatedly (I assume) type in ‘synthetic’ queries which bring back ‘doctored’ hits.It asks its engineers to then click these results (think about this!).So, the behaviour of the engineers is observed and the resulting clickstream data goes off to Microsoft.It is processed and ‘improves’ Bing results accordingly.
What exactly did Microsoft do wrong here?

Google’s so-called ‘Bing sting’ is clearly a very effective attack from a propaganda perspective, but is poor practice from a company that claims to do no evil.Generating and sending clickstream data deliberately so that you can then subsequently claim that your competitor ‘copied’ that data from you is neither fair nor reasonable, and suggests to me a degree of desperation in the face of real competition. Monopolies are undesirable, whether they are Microsoft monopolies or Google monopolies. Personally, I’m glad Microsoft has technology in place to observe user behaviour (with permission, of course) and improve their search results using such data.I can only assume Google doesn’t implement similar capabilities.Sounds to me as if, at least in this respect, Microsoft may offer the better technology.