Posts Tagged ‘problem’
Can’t run Explorer under different credentials?
I have a DB application running under appropriate credentials on my server. It tries to launch explorer to show the files it cannot process. This works fine in Windows Server 2003, but not in Windows Server 2008. In 2008 the Explorer window never appears.
I tried replicating the process – just to test it – in Windows 7
Hold the shift key and right click on CMD, choose Run as a different user.
Complete the sign on
In the Command prompt type Start Explorer.
This is the message I get:
I tried “Launch Folder Windows in a different process” – it made no difference at all.
So now what?
code execution has been interrupted
After running my macro like this:
set apExcel = CreateObject(“Excel.Application”)
set wkBook = apExcel.Workbooks.Add (“C:\SpreadSheet.xls”)
apExcel.run “A_Macro”
wkBook.Close
apExcel.Quit
It stopped with the message “code execution has been interrupted” next time I ran it in Excel on my desktop. I’d not seen this message before. Clicking ‘Continue’ worked the macro executed that line of code and many more until it got back to that line later, then the message appeared again. About four lines exhibited the problem, I recognised them as lines I had se breaks on during development. I have occasionally experienced a problem where breaks don’t actually leave the code, even though the markers do. So I hit F9 twice – to set and unset the breakpoint – to no effect. I tried ‘clear all breakpoints’ – to no effect.
I found a solution here, which seems to have worked. The entry is Oct 13th, 2009, 02:35 PM, by akforsyt. IT is simple to go into debug and press Ctrl+break.
A transport-level error has occurred when sending the request to the server. (provider: TCP Provider, error: 0 – An existing connection was forcibly closed by the remote host.)
msdn seems to have a reasonable description of the problem here. However my SQL Server log does not contain any entries for the time of the failure.
The last message in the latest SQL ErrorLog file is at 04:29:58.48
My application reports the connection status as open at 05:21:37.781
The failure occurs at 05:21:37.875 – less than 0.1 seconds later!
There are no messages in the eventlog in this time period.
Function optional variable as integer = nothing defaults to zero
The following code does not work because the value of ‘places’ is zero not nothing
Sub Main()
Dim a As Double = 1.034567
Dim b As Double = 1.434588
If DeciUnEq(a, b) Then
Console.WriteLine(“a:” & a.ToString & ” NOT EQUALS b:” & b.ToString & ” to five decimal places”)
Else
Console.WriteLine(“a:” & a.ToString & ” IS EQUAL b:” & b.ToString & ” to five decimal places”)
End If
a = b
Console.WriteLine(“Complete, press return to exit”)
Console.ReadLine()
End Sub
Public Function DeciUnEq(ByVal Vala As Double, ByVal Valb As Double, Optional ByVal places As Integer = Nothing) As Boolean
‘ Check numbers for inEquality at the specified precision level
‘ This is either passed to the routine or taken from a public variable Precision, or defaulted to 5.
If IsNothing(places) Then
places = 5
End If
If Math.Round(Vala, places) Math.Round(Valb, places) Then Return True
Return False ‘ They are equal!
End Function
‘Public Property Left() or Right() As Integer’ has no parameters and its return type cannot be indexed
The message appears against x = Left(a,2) – all of them.
The problem goes away if I comment out the line:
Imports System.Collections.ObjectModel
but I need that in order to define a variable as
ReadOnlyCollection(Of String)
There are some sites that suggest the Left is deprecated as a function, but this does not appear to be the case. (http://msdn.microsoft.com/en-us/library/y050k1wb(VS.80).aspx)
Resolution
This appears to be a poor piece of decision making by the compiler. Left can be qualified as strings.left, in which case the interpretation is explicit and correct.
e.g.
x = Strings.Left(a,2)
