If File exist
-
I am supporting a legacy asp/vb COM app X| with little or no documentation I upgraded a server with some bug fixes, as usual something did not work. roll sleeve up and let us dig for clue. The COM app logs extensively to the event log, but there is no single entry. I checked all settting and there is no configuration issues. I gave up and started to look into the code why it is not logging and I came across
If FileExists("C:\WriteLog.Txt") Then
Dim objData As New Data
Dim icnt As Integer
icnt = 0
Do While Not FileExists(uploadPath) Or FileLen(uploadPath) = 0
If Not FileExists(uploadPath) Then
Call objData.WriteToNTLog("No file", 2)
Else
Call objData.WriteToNTLog("Length 0", 2)
End If
Loop
' note that path to exe is quoted to allow spaces in path spec
Call objData.WriteToNTLog("""" & GetImageMagickPath() & "convert"" """
& uploadPath & """" & opStr & " """ & thumbPath & """", 4)
End IfWHY:confused: check C:\WriteLog.txt before wrting to the event log. I am sure the app use to log to that file then they changed it to log to the eventlog. But why leave the file check there? The app has a configuration file and why not set logging flag in the app configuration file. :confused: X| :mad:
Yusuf
-
I am supporting a legacy asp/vb COM app X| with little or no documentation I upgraded a server with some bug fixes, as usual something did not work. roll sleeve up and let us dig for clue. The COM app logs extensively to the event log, but there is no single entry. I checked all settting and there is no configuration issues. I gave up and started to look into the code why it is not logging and I came across
If FileExists("C:\WriteLog.Txt") Then
Dim objData As New Data
Dim icnt As Integer
icnt = 0
Do While Not FileExists(uploadPath) Or FileLen(uploadPath) = 0
If Not FileExists(uploadPath) Then
Call objData.WriteToNTLog("No file", 2)
Else
Call objData.WriteToNTLog("Length 0", 2)
End If
Loop
' note that path to exe is quoted to allow spaces in path spec
Call objData.WriteToNTLog("""" & GetImageMagickPath() & "convert"" """
& uploadPath & """" & opStr & " """ & thumbPath & """", 4)
End IfWHY:confused: check C:\WriteLog.txt before wrting to the event log. I am sure the app use to log to that file then they changed it to log to the eventlog. But why leave the file check there? The app has a configuration file and why not set logging flag in the app configuration file. :confused: X| :mad:
Yusuf
Why? Wouldn't be fun if everything was working perfectly.
-
I am supporting a legacy asp/vb COM app X| with little or no documentation I upgraded a server with some bug fixes, as usual something did not work. roll sleeve up and let us dig for clue. The COM app logs extensively to the event log, but there is no single entry. I checked all settting and there is no configuration issues. I gave up and started to look into the code why it is not logging and I came across
If FileExists("C:\WriteLog.Txt") Then
Dim objData As New Data
Dim icnt As Integer
icnt = 0
Do While Not FileExists(uploadPath) Or FileLen(uploadPath) = 0
If Not FileExists(uploadPath) Then
Call objData.WriteToNTLog("No file", 2)
Else
Call objData.WriteToNTLog("Length 0", 2)
End If
Loop
' note that path to exe is quoted to allow spaces in path spec
Call objData.WriteToNTLog("""" & GetImageMagickPath() & "convert"" """
& uploadPath & """" & opStr & " """ & thumbPath & """", 4)
End IfWHY:confused: check C:\WriteLog.txt before wrting to the event log. I am sure the app use to log to that file then they changed it to log to the eventlog. But why leave the file check there? The app has a configuration file and why not set logging flag in the app configuration file. :confused: X| :mad:
Yusuf
-
A silly oversight perhaps, but not really a horror. On a really bad day i might have committed the same "atrocity" :laugh: A public-opinion poll is no substitute for thought.
Søren Turin wrote:
A silly oversight perhaps, but not really a horror. On a really bad day i might have committed the same "atrocity" Laugh
I agree. The code it self is not horror. But debugging why the application is not logging with is horror. This was a code I inherited and I was not aware of this piece of code. I found it out after spending 2 days to figure out why the app was not logging to the eventlog. :sigh:
Yusuf
-
Søren Turin wrote:
A silly oversight perhaps, but not really a horror. On a really bad day i might have committed the same "atrocity" Laugh
I agree. The code it self is not horror. But debugging why the application is not logging with is horror. This was a code I inherited and I was not aware of this piece of code. I found it out after spending 2 days to figure out why the app was not logging to the eventlog. :sigh:
Yusuf
-
I am supporting a legacy asp/vb COM app X| with little or no documentation I upgraded a server with some bug fixes, as usual something did not work. roll sleeve up and let us dig for clue. The COM app logs extensively to the event log, but there is no single entry. I checked all settting and there is no configuration issues. I gave up and started to look into the code why it is not logging and I came across
If FileExists("C:\WriteLog.Txt") Then
Dim objData As New Data
Dim icnt As Integer
icnt = 0
Do While Not FileExists(uploadPath) Or FileLen(uploadPath) = 0
If Not FileExists(uploadPath) Then
Call objData.WriteToNTLog("No file", 2)
Else
Call objData.WriteToNTLog("Length 0", 2)
End If
Loop
' note that path to exe is quoted to allow spaces in path spec
Call objData.WriteToNTLog("""" & GetImageMagickPath() & "convert"" """
& uploadPath & """" & opStr & " """ & thumbPath & """", 4)
End IfWHY:confused: check C:\WriteLog.txt before wrting to the event log. I am sure the app use to log to that file then they changed it to log to the eventlog. But why leave the file check there? The app has a configuration file and why not set logging flag in the app configuration file. :confused: X| :mad:
Yusuf
Classical! Presumably the dev didn't understand or did not care to understand what the old code was doing and decided to leave it there "just in case". At my company we've got the full source history in a sourcesafe database (though we are finally moving on to Team System now), but a lot of people still attempt to keep a full version history in the latest version of the code - never removing anything, but commenting it out and usually adding their initials and the date and time, as if this would actually help anyone later on. In my view it just distracts, and is never really useful since it's far easier to compare versions in sourcesafe than comparing the comments to the current code. Well, at least they comment it out rather than leave the old code in there...
-
Classical! Presumably the dev didn't understand or did not care to understand what the old code was doing and decided to leave it there "just in case". At my company we've got the full source history in a sourcesafe database (though we are finally moving on to Team System now), but a lot of people still attempt to keep a full version history in the latest version of the code - never removing anything, but commenting it out and usually adding their initials and the date and time, as if this would actually help anyone later on. In my view it just distracts, and is never really useful since it's far easier to compare versions in sourcesafe than comparing the comments to the current code. Well, at least they comment it out rather than leave the old code in there...
dojohansen wrote:
but a lot of people still attempt to keep a full version history in the latest version of the code - never removing anything, but commenting it out and usually adding their initials and the date and time, as if this would actually help anyone later on. In my view it just distracts
sometime, only on certain conditions, I leave old code behind commented out. Such as if I am making major logic change and what is change is not big piece of code I leave it for historical comparison. Beyond that I don't get it what the code needs to be polluted with old code. :|
Yusuf Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]