Sunday, July 31, 2016

Zen of Ducati Fuel System Maintenance

So if you you were on my Facebook feed last last summer you would have seen this picture.  Yes, that is my 1999 Ducati 900 Supersport, not running.  I was about half way through a 30 mile round trip when the motor started to cough and sputter.  My main ride had just spent about 14 days in the shop with work related to a check-engine light coming on that turned out to be a bunch of work related to the variable timing.  With that thought in the back of my head I feared the worst.  Needless to say, it was the 4th of July, and I had to call my wife so she could borrow her girlfriend's pickup and we hauled the Italian artwork home.

So, did I say that I was completely freaked out, thinking it was the fuel injection computer, clogged injectors, or maybe some set of sensors out that I wouldn't be able to diagnose, because 1999 Ducati 900 Supersports don't have and ODB-II port as far as I can tell.  Obviously, this is more on the hardware side of things... And not really computer related.

Well, I let it set, and then took another look.  I had just replaced the nut that holds the fuel level sensor (a fuel sender in Ducati speak) in.  It had been leaking slowly, and although my wife complained of a gasoline smell, I never really could locate the leak, well until I did, and then well, three nuts later I finally found one that screwed on, sorta.

First step is to drain the tank.  I got it mostly drained with the handy little pump I picked up for about $7.00 at a local Harbor Freight tool store (don't try the tube and mouth method, don't ask me why I know not to do that, just don't).  Next I removed the cap.  There's four (4) screws that hold it on.   The ring actually has six (6) plus one one more near the hinge, but it turns out the twelve, four, and seven o'clock screws are the only ones that actually attach.  the other three are just for beauty.

Next, the fuel inlet is secured in place by a bunch of tiny hex (allen) screws.  I don't know if you have to take them all the way out but I did, because I pulled and pulled but that stupid thing wouldn't come out.  So, since I'm a tool using kind of sentient being, I used the handle of my mallet to give it some extra leverage.  It popped right out.

There are two hoses attached to the fuel inlet.  They are attached to pipes that terminate outside the tank, and in a diagram they were labeled over pressure lines.  Handily, the left one attaches to the left port and the right one on the right.  So no need to label.  I fully detached them so I could get my hands inside and dig around.  Turns out that was a pretty good thing...  (The picture to the right is actually as I was reassembling.)

 Once I got the inlet off, I found that the rubber extender had fallen into the tank.  So I grabbed that and reinstalled it on the inlet.  The o-ring looked like it was breaking down, but after removing it and giving it a closer look it just had some crud that rubbed off.
Inside the tank was a whole other story.  The reason I wanted to get in there was because the fuel lines had rotted down to the reinforcing braid.  The guy at the parts store said that these should be replaced every two years, and well this bike is 17 years old.  Silly me.  In the bottom of the tank was all of the rubber bits.  The bad part was that when I scooped them up, they turned into a black paste.

The job was then to get all of the gunk out.  I ended up taking the fuel pump out too.  Turns out that was a good decision.  There's no way I'd be able to clamp on that two inch piece of hose between the pump and filter.    On the right is a picture of the reassembled pump and filter.  Notice how different the new hoses look?

I re-used the hose clamps that were there.  Ones I've sen before either have a worm screw to tighten them down, or pinch together and use spring action to hold everything together.  Not these.  Instead of pinching the clamps to release them, they pinch and lock together.  Overall they give a tighter lock, but like I said before, I'd never have been able to install them inside the tank.

They all went back in pretty easy, and it was just a matter of reconnecting the fuel dump lines and replacing the inlet.  The picture to the right shows the fuel pump remounted and the fuel filter connected to the line that heads out to the fuel rails.

I'll give a big a shout-out to Blue over at Ducati Moster Forum for good instructions on how to replace the black beauty ring that goes round the outside of the fuel inlet.  That method of partially installing the inlet and then fitting the ring really did the trick.

The picture below shows my 1988 Honda Hurricane (CBR-600F), in the background.  It's got it's own fuel problems.  One day.  For now the Ducati is running again.  It's back to starting with one revolution of the motor, which it hadn't done since about 2004 (I bought it in 2001).  My guess is that the fuel inlet will be off the tank again sometime in the future.


So it pays to pay attention at the gas pump.  I only put enough gas in the tank to cover the fuel pump, then I was off to the gas station.  With the rubber guide back in the tank it was hard to see the bottom of the thank when I was filling it, especially from the left side.  As I was leaning in to take a look, my left leg got a little close to the exhaust.  Well at least it will be a nice scar.

Sunday, June 5, 2016

Just Released, 5 years in the making, SAFMQ 0.8.4

Hey, you can get your copy of SAFMQ version 0.8.4 on SourceForge.  I know 5.5 years is too long between releases but, I've been busy...

Release 0.8.4 comes with these updates:
  • Updated for compatibility with OpenSSL 1.0.2h (most recent)
  • Windows installer package is built with OpenSSL 1.0.2h
  • Updates for compatibility with g++ 5.4.8 and 5.3.1
  • Updated for compatibility with Visual Studio 2010
  • Test on:
    • Fedora 23 (g++ 5.3.1)
    • FreeBSD 10.6 (g++ 5.4.8)
    • Windows (32bit)
    • Cygwin (g++ 5.3.1)
So there you go, a fresh (incremental) release. The most important update is with OpenSSL, and the bug fixes to the TLS code.

Wednesday, April 6, 2016

Install a SharePoint Publishing Design Package with PowerShell

Microsoft didn't provide a PowerShell cmdlet to install publishing design packages, and the one in the design gallery is just kinda overkill.  So I took it upon myself to make a simpler version, albeit it did require calling a couple of "internal" methods from the Microsoft.SharePoint.Publishing library.  Well, here goes have at it (you'll also see some reflection examples for calling internal constructors and methods).

Oh, here's an important note.  NOTE: MAKE SURE PUBLISHING INFRASTRUCTURE IS ENABLED FIRST.  Otherwise it won't turn on, and you won't be able to access the Master page settings page even if you go directly to ChangeSiteMasterPage.aspx.

#  Install-PublishingDesignPackage -Site <site url> -Path <package path>

$DesignPackage = [Microsoft.SharePoint.Publishing.DesignPackage]
$DesignPackageInfo = [Microsoft.SharePoint.Publishing.DesignPackageInfo]
$BindingFlags = [System.Reflection.BindingFlags]

function _Using {
    param (
        [System.IDisposable] $inputObject = $(throw `
                  "The parameter -inputObject is required."),
        [ScriptBlock] $scriptBlock = $(throw "The parameter -scriptBlock is required.")
    Try {
    } Finally {
        if ($inputObject -ne $null) {
            if ($inputObject.psbase -eq $null) {
            } else {

function Call-InternalConstructor([System.Type]$Type, [Object]$Parms) {
    $ParmTypes = @()
    foreach($parm in $Parms) { $ParmTypes += $parm.GetType() }

    return $Type.GetConstructor($BindingFlags::NonPublic -bor $BindingFlags::Instance,`
                $null, $ParmTypes, $null).Invoke($Parms)

function Call-InternalStaticMethod([System.Type]$Type, [string]$MethodName, [Object]$Parms) {
    $ParmTypes = @()
    foreach($parm in $Parms) { $ParmTypes += $parm.GetType() }
    return $Type.GetMethod($MethodName, $BindingFlags::NonPublic -bor`
                   $BIndingFlags::Static, $null, $ParmTypes, $null).Invoke($null, $Parms)

_using($spsite = New-Object Microsoft.SharePoint.SPSite($Site)) {
    if ($spsite -ne $null) {
        $Path = [System.Io.Path]::Combine((pwd).path,$Path)
        $finfo = Dir $Path
        $pkg = Get-SPUserSolution -Site $Site $finfo.Name -ErrorAction SilentlyContinue
        if ( ($pkg -eq $null) ) {
            try {
                $pkgInfo = Call-InternalConstructor $DesignPackageInfo ($finfo.Name)
                _Using($fileStream = New-Object System.IO.FileStream($finfo.FullName,`
                           [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read)) {
                    if ($fileStream -ne $null) {
                        try {
                            Call-InternalStaticMethod $DesignPackage "Install" `
                                          ([Microsoft.SharePoint.SPSite]$spsite, `
                                              $pkgInfo, [System.IO.Stream]$fileStream)
                        } catch [Exception] {
                            Write-host -ForegroundColor Red $_.Exception.ToString()
                    } else {
                        Write-Host -ForegroundColor Red Unable to open $finfo.FullName
            } catch [Exception] {
                Write-host -ForegroundColor Red $_.Exception.ToString()
        } else {
            Write-Host -ForegroundColor Red $finfo.Name `
                               is already in the solution gallery of $Site
    } else {
        Write-Host -ForegroundColor Red "Unable to open site: " $Site