GMail + Vim

Link. June 30, 2008. Comments [5]. Posted in: Vim

I've been a big GMail user ever since I got my first account and I've gotten very used to it. About a year ago I switched the email for my website and our corporate email over to Google Apps and eventually was able to drop Outlook completely [1].

I've been extremely satisfied with this setup and don't regret it at all. However, as much as I like GMail and all, it's sometimes a drag when actually editing new emails or responses to existing ones. It's not really GMail's fault; it's just that a TEXTAREA isn't really a good editor for email (I try to stick to plain text email only as much as possible).

IAT Fortunately, I discovered a while ago the It's All Text! extension for Firefox. This little extension gives you a small button next to textareas; when you click it, it will open your favorite text editor to edit the text, and then replace it with whatever you saved before closing it.

Now, I can just use this to edit complex/longer emails in gVim, and get all the text-editing goodness I'm used to!

Firefox did have one nice feature I missed at first: Spell checking. This wasn't always useful, though, as it only really supports a single language at a time, and I regularly use both Spanish and English, but it was better than nothing.

Vim, however, also supports spell checking! I just had never bothered setting it up correctly. I've now configured my .vimrc file so that I can enable/disable spell checking for English or Spanish with a few key-presses. Here's how I configured mine:

map <Leader>se :setlocal spell spelllang=en_us<CR>
map <Leader>ss :setlocal spell spelllang=es_es<CR>
map <Leader>sn :setlocal nospell<CR>

Now I can just press \se in normal mode to start the spell checker in English or \ss for Spanish, and then \sn to disable it later on, if I want to. Otherwise I just keep spell checking disabled so that it doesn't get in the way of my coding sessions.

VimSpell

The combination of It's all Text!, Vim and its spell checker makes for a much nicer GMail experience for me.

[1] I still need to migrate some old personal email over to my GMail account, which I haven't done because I'm lazy, but I should definitely get around to that some day.

Controlling BizTalk Orchestrations with PowerShell

Link. June 26, 2008. Comments [1]. Posted in: BizTalk | PowerShell

Here's a sample PowerShell script/functions to start/stop BizTalk orchestrations. This is an extended version of the Stop-Orchestration VBScript included in the BizTalk 2006 SDK, which I hope someone finds useful :-).

The script can be used to start or stop either a specific orchestration or a group of orchestrations defined in a BizTalk assembly. For example, to stop and unenlist all orchestrations in a given assembly, you could use this:

stop-orch -assembly 'MyProject.BizTalk, Version=1.0.0.0, Culture=neutral, PublicKeyToken=50b7b2906e3f8aa5' -unenlist

Here's the code for the script:

$script:bound = 2
$script:started = 4
$script:controlRecvLoc = 2
$script:controlInst = 2

function script:get-assemblyfilter([string]$assembly) {
   # The BizTalk WMI provider uses separate properties for each
   # part of the assembly name, so break it up to make it easier to handle
   $parts = $assembly.Split((',', '='))
   $filter = "AssemblyName='$($parts[0])'"
   if ( $parts.Count -gt 1 ) {
      for ( $i=1; $i -lt $parts.Count; $i += 2 ) {
         $filter = "$filter and Assembly$($parts[$i].trim())='$($parts[$i+1])'"
      }
   }
   return $filter
}
function script:find-orch([string]$name, [string]$assembly) {
   # We want to be able to find orchestrations by
   # name and/or assembly. That way we can control
   # all orchestrations in a single assembly in one call
   $filter = ""
   if ( ![String]::IsNullOrEmpty($name) ) {
      $filter = "Name='$name'"
      if ( ![String]::IsNullOrEmpty($assembly) ) {
         $filter = "$filter and $(get-assemblyfilter $assembly)"
      }
   } else {
      $filter = $(get-assemblyfilter $assembly)
   }
   get-wmiobject MSBTS_Orchestration `
      -namespace 'root\MicrosoftBizTalkServer' `
      -filter $filter
}

function start-orch([string]$name, [string]$assembly) {
   $orch = (find-orch $name $assembly)
   $orch | ?{ $_.OrchestrationStatus -eq $bound } | %{
      write-host "Enlisting $($_.Name)..."
      [void]$_.Enlist()
   }
   $orch | ?{ $_.OrchestrationStatus -ne $started } | %{
      write-host "Starting $($_.Name)..."
      [void]$_.Start($controlRecvLoc, $controlInst)
   }
}

function stop-orch([string]$name, [string]$assembly, [switch]$unenlist = $false) {
   $orch = (find-orch $name $assembly)
   $orch | ?{ $_.OrchestrationStatus -eq $started } | %{
      write-host "Stopping $($_.Name)..."
      [void]$_.Stop($controlRecvLoc, $controlInst)
      if ( $unenlist ) {
         [void]$_.Unenlist()
      }
   }
}

BizTalk Filters not Getting Imported

Link. June 21, 2008. Comments [1]. Posted in: BizTalk

... or how automatic formatting of XML files can make you miserable.

During the last few days I've been helping out a client get ready for deploying a BizTalk solution. One of those things this involved was taking the existing BizTalk Binding XML files and making minor edits to them so they would match the new environment.

I did the changes, and the BizTalk Administrator used the updated Binding Files to import them into the new BizTalk Servers. They imported without any errors at all. A couple hours later he noticed some test messages were getting incorrectly routed to the wrong send ports (there's a lot of messaging only stuff in this solution)., so he checked the send port configuration.

There were no filters defined at all! We checked the Binding files again, and yes they were clearly defined there. Why were they not getting imported?

The culprit turned out to be Visual Studio. I had edited the binding files in VS and, for several reasons, this involved doing copy-and-pasting the entire XML content of the binding files between machines. Normally this isn't a problem, but this time it was.

VS will reformat XML content when you paste it into VS. This is usually a welcomed feature, but not now. Turns out that VS reformatted the <Filter> elements of the Send port configurations like this:

<Filter>
   &lt;?xml version="1.0" encoding="utf-16"?&gt;
   &lt;Filter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
...

See anything weird? I didn't see it either at first. The problem is the line break and extra white space caused by the indentation between the opening <Filter> element and the actual string-encoded XML of the filter expression.

Apparently, BizTalk can't deal with this at all and simply treats it as if the <Filter> element had been empty when it imports the binding file. No warnings, no errors, it simply ignores it silently.

I removed the space leaving it like this:

<Filter>&lt;?xml version="1.0" encoding="utf-16"?&gt;
   &lt;Filter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
...

And now it was imported correctly and all the Filters were recreated successfully. This was maddening to say the least, and it's one of those pesky bugs that can make deploying BizTalk solutions an even more miserable experience than it already is. Definitely a very annoying bug in the Binding importer code.

403 Forbidden in Reporting Services

Link. June 11, 2008. Comments [1]. Posted in:

I just spent a good chunk of time fighting a problem with my SQL Server 2005 Reporting Services installation. I had not previously used it on this machine so it should've been exactly as the SQL Server (and SP2) installation program configured it.

I started by deploying a new set of reports from Visual Studio over to the server, which worked straight away. I then went to the Web-based Report manager and could see my reports deployed, but as soon as I tried actually rendering one of the reports, I'd get an error like this one:

Remote server returned an error: (403) Forbidden

Long story short, the problem was in how the /Reports application references the services in the /ReportServer application, and I fixed it by going to IIS and modifying the /ReportServer application configuration to add "ReportService2005.asmx" as a possible default content page under the "Documents" tab of the application's property page.

PipelineTesting 1.1.3.0 Released

Link. June 8, 2008. Comments [0]. Posted in: BizTalk

I just uploaded a new update to my PipelineTesting library. This one comes courtesy of Gregory Van de Wiele, who kindly made me aware of a nasty bug: The library wasn't handling schemas with no targetNamespace correctly when adding them to the pipeline context.

Because of this, you needed to specify the documentSpec name as "#root" instead of simply "root". This has now been fixed in this version and I added a new unit test to make sure it doesn't come up again. Thanks a lot Gregory!

As usual you can download the updated code/binaries from here.

Updated PS & BizTalk Posts

Link. June 4, 2008. Comments [0]. Posted in: BizTalk | PowerShell

I just took a few moments to update some of my old posts on administering BizTalk Server using PowerShell:

Here are some of the changes:

  • Reformatted code samples so that they were nicely readable using the current blog theme
  • Fixed some code that still used InvokeMethod() on WMI objects. This was the big change, since the old code was written with one of the PowerShell betas and didn't work anymore on RTM.

If anyone notices any other problems with the samples, let me know!

Syndicate

About

Tomas Restrepo is a software developer located in Colombia, South America. His interests include .NET, Connected Systems, PowerShell and lately dynamic programming languages. More...

tomasrestrepo @ twitter My Flickr photostream My saved links on delicious My Technorati Profile

email: tomas@winterdom.com
msn: tomasr@passport.com

View my profile on LinkedIn

MVP logo

Ads


Links

Categories

Statistics

Total Posts: 1032
This Year: 102
This Month: 1
This Week: 1
Comments: 801

Blogroll

Archive

Other

Copyright © 2002-2008, Tomas Restrepo.

Powered by: newtelligence dasBlog 2.1.8139.823

Sign In