|
He fortunately missed the recent storm that's the reason.
"When you don't know what you're doing it's best to do it quickly"- SoMad
|
|
|
|
|
There is a certain whiff of the echo chamber here.
|
|
|
|
|
If m_bHistImportRunning Then
m_lHistCounter = m_lHistCounter + 79
Me.lblHistCounter.Text = m_lHistCounter.ToString
End If
oh wait...
|
|
|
|
|
I have an expression evaluator and, amongst other things, I'm extending it with function definition goodness.
Each expression takes a data set as input - name value pair type thing - and uses it to return a value:
Egg:
data {
a % 1
b % 2
}
expression - a + b
This would take the two values and return their sum [3 for the hard of thinking]
Now I started to get clever in defining the function to allow variable arguments and it seemed to be working well until I tried to some clever re-cursiveness:
function {
# ~ allows the function to take unlimited arguments as it just represents the data:
arguments - ~
function "
# if item 1 is null return item 0
[isNull ~1] ?
~0 :
(
# clone the input [~ is everything]
data = [data.clone ~];
# remove item 0
[data.remove data "~0"];
# and call back... with ... a ... single ... argument
max = [max data];
~0 > max ?
~0 :
max
)
"
}
So it compares a number with a data set and goes boom. Who'd have thunk it!
Stupid Vilmos, very stupid Vilmos!
I am now in the process or rewriting so that I must pass a fixed number of arguments, but by using a data set the arguments are variable.
[edit]
After fixing it, I then found that running the full test lots of previously fine tests now fail, total WTE ensues. I check the code, I check the functions in the test script, I even extend the logging to try and find what I've changed. What I did was change the block name for common functions so they wouldn't be loaded...
speramus in juniperus
modified 24-Oct-13 6:26am.
|
|
|
|
|
|
public static bool checkPolTime(string SFDCStartTime)
{
string configSFDCStartTime = string.Empty;
string configSFDCAMPM = string.Empty;
int len = 0;
len = SFDCStartTime.Length;
if (len > 7)
{
configSFDCStartTime = SFDCStartTime.Substring(0, 5);
configSFDCAMPM = SFDCStartTime.Substring(6, 2);
}
else
{
configSFDCStartTime = SFDCStartTime.Substring(0, 4);
configSFDCAMPM = SFDCStartTime.Substring(5, 2);
}
string systemSFDCStartMin = string.Empty;
string systemSFDCStartSec = string.Empty;
string systemSFDCAMPM = string.Empty;
string time = DateTime.Now.ToString();
string[] splitchr = { " " };
string[] strarr = time.Split(splitchr, StringSplitOptions.None);
string s = strarr[0];
len = s.Length;
if (len == 9)
{
splitchr[0] = ":";
strarr = time.Split(splitchr, StringSplitOptions.None);
s = strarr[0];
len = s.Length;
if (len == 11)
{
systemSFDCStartMin = time.Substring(10, 4);
systemSFDCStartSec = time.Substring(15, 2);
systemSFDCAMPM = time.Substring(18, 2);
}
else if (len == 12)
{
systemSFDCStartMin = time.Substring(10, 5);
systemSFDCStartSec = time.Substring(16, 2);
systemSFDCAMPM = time.Substring(19, 2);
}
}
else if (len == 10)
{
splitchr[0] = ":";
strarr = time.Split(splitchr, StringSplitOptions.None);
s = strarr[0];
len = s.Length;
if (len == 12)
{
systemSFDCStartMin = time.Substring(11, 4);
systemSFDCStartSec = time.Substring(16, 2);
systemSFDCAMPM = time.Substring(19, 2);
}
else if (len == 13)
{
systemSFDCStartMin = time.Substring(11, 5);
systemSFDCStartSec = time.Substring(17, 2);
systemSFDCAMPM = time.Substring(20, 2);
}
}
return true;
}
Zen and the art of software maintenance : rm -rf *
Math is like love : a simple idea but it can get complicated.
|
|
|
|
|
Your code snippet is not complete. You forgot e.g. systemSFDCStartHour and systemSFDCStartMilliSecond . Also code for non-American locales is missing. You can add several hundred lines more of useless code before that return true statement, there is a lot of space for future optimizations!
|
|
|
|
|
The original plan was to finish the method while poll isn't active. It just never happened since...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is (V).
|
|
|
|
|
Nope, no redundant code in there, nope, none. Nothing to see here, move along...:TunelessWhistleSmiley:
The only instant messaging I do involves my middle finger.
English doesn't borrow from other languages.
English follows other languages down dark alleys, knocks them over and goes through their pockets for loose grammar.
|
|
|
|
|
I can't for the life of me figure out why someone would do this. It's not awful or subtly wrong, just kind of deranged.
DocumentInformation ldocInfo = new DocumentInformation();
ldocInfo.DocumentID = Convert.ToInt32(agmTemplateId);
if (ldocInfo.DocumentID != 0)
{
section.Items.Add(PageHelpers.CreateSidebarItem("AGM plan", "/GetFile.aspx?DocumentId=" + ldocInfo.DocumentID, true, "cmdAGMTemplate", false));
}
ldocInfo.DocumentID = Convert.ToInt32(proposalTemplateId);
if (ldocInfo.DocumentID != 0)
{
section.Items.Add(PageHelpers.CreateSidebarItem("Proposal", "/GetFile.aspx?DocumentId=" + ldocInfo.DocumentID, true, "cmdProposal", false));
}
|
|
|
|
|
What does the DocumentInformation class/struct look like?
Keep Clam And Proofread
--
√(-1) 23 ∑ π...
And it was delicious.
|
|
|
|
|
It's just a data object with about 10 other properties. None of the getters or setters have any hidden side effects. My guess is that they thought they were going to have to use the object to do some kind of data lookup, but didn't switch it to an integer when they didn't have to.
|
|
|
|
|
I guess the author thought, that for some reason the variable name (DocumentID) must be the same as in the command string he assigns it to. Why someone would think that is beyond me.
The good thing about pessimism is, that you are always either right or pleasently surprised.
|
|
|
|
|
I am using this message in one of my applications for things that should never happen (but you never know what may happen with Windows), but I guard against anyways.
I also include a 'Guru Meditation GUID' so I can find where the issue happened and try and debug it.
An example issue: I put a service in a service manager (that uses Unity IoC Container) and get it out a few lines later. If the service is, for some strange reason, not there, I show a message and terminate the application, as something major went haywire.
Keep Clam And Proofread
--
√(-1) 23 ∑ π...
And it was delicious.
|
|
|
|
|
|
...haven't done it since college but I prefer:
Program faw down go "Boom!"
|
|
|
|
|
Certainly if it's going to "faw down", it should "go Boom!"; so many kids nowadays don't think it should "go Boom!".
|
|
|
|
|
I saw that in a Metro App on a friend's computer. I guess the developer agreed with the Fischer Price comparison.
Keep Clam And Proofread
--
√(-1) 23 ∑ π...
And it was delicious.
|
|
|
|
|
I got "Catastrophic Failure" right from MS: a VB6 app I made years (if not decades) ago, which tries to access a MS Access DB. There was a field with junck in it, making that message..
The same message occured in Access itself, so I believe it's an Access error message.
The signature is in building process.. Please wait...
|
|
|
|
|
What about : Welcome to Application suicide booth. Option 5 has been chosen : The user the is too dumb to close the app properly and that's why the application crashed.
Microsoft ... the only place where VARIANT_TRUE != true
|
|
|
|
|
|
I could use that in some old legacy software. It takes a while to shut down. Despite being told to wait, there are users who will use the task manager to force it to turn off immediately. This causes it to stop in the middle of saving settings to an Access DB which often corrupts the DB. So when the user restarts the program it isn’t happy about having a corrupted DB.
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
just hide the window and let the user think it has shut down.
<h>
I'm Brazilian; English and other human languages in general aren't my best skills so I apologise for my less than perfect English...
"Given the chance I'd rather work smart than work hard." - PHS241
"'Sophisticated platform' typically means 'I have no idea how it works.'"</h>
|
|
|
|
|
We mostly leave the window there so the users won't try to restart it while it is still shutting down. And, yes, they would do this. It really needs a better status report so users don't think it has frozen, but it is old software with no more updates planned.
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
Brisingr Aerowing wrote: I also include a 'Guru Meditation GUID'
Let me guess. you used to program Amigas years ago, right?
We can program with only 1's, but if all you've got are zeros, you've got nothing.
|
|
|
|