|
There's nothing wrong with concise and useful documentation. But he included 25 pounds of it to ask the vaguest of questions:
help me in getting the output.
Isn't that what every single question here is ultimately about, getting the correct output?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
That was the question!? Wow I got completely lost before I ever understood that! Still interesting stuff - it sounded like it would make a good article!
|
|
|
|
|
One thing is for sure... No one should ask him to provide more detail...
|
|
|
|
|
First you get the Windows Installer dialog displayed for ages apparently doing nothing then you get the "Configuring Visual Studio 2003" dialog for ages. Combined time is about 15 minutes. Then you get a message asking if you want to install Visual Studio 2003 SP1! Well,I'd never have guessed!
(IIRC VS 2005 SP1 behaves similarly. However, I've not noticed it as I've only ever installed it from the command prompt in quiet mode.)
Kevin
|
|
|
|
|
See old regular Heath Stewart's blog[^] for why this is. Basically it boils down to Windows Installer having a damn stupid piece of code in it which loads the entire patch into a contiguous block of virtual memory before trying to run signature validation over it.
What it should be doing is either memory-mapping the file or reading a small block at a time. This is what deserves 'WTF' status.
Presumably they assumed that patches would be small, not 500MB in the case of VS2005.
|
|
|
|
|
|
I appreciate that this isn't directly a coding WTF, but it's related and I'm sure many people have done something similar, so I thought I'd share it anyway.
Many years ago I was developing on a Solaris machine. One day in the middle of an intense period of coding I realised that the C runtime library on my machine was several years old. 'Gosh', I thought, 'Id better update that. It's bound to make me more productive'.
So I downloaded the C library source and compiled it. Being Unix there was no real installation method so I took it upon myself to just copy the runtime over the existing one (excuse the command-line usage but I'm sure you get the meaning - ls is dir and mv is move ).
cp newruntime.so /usr/lib/oldruntime.so
cp: failed, file is in use
Oh. A problem. In a moment of temporary insanity I thought 'I bet that moving it would work. But I should be careful and keep the old library, just in case'.
mv /usr/lib/oldruntime.so /usr/lib/oldruntime.so.backup
mv successful
Great! Let me just have a look to check:
ls
ls: dynamic library c-runtime failed to load
Maybe some extra arguments will do the trick...
ls -la
ls: dynamic library c-runtime failed to load
Crap. Better try and restore the old version...
mv /usr/lib/oldruntime.so.backup /usr/lib/oldruntime.so
mv: dynamic library c-runtime failed to load
A perfectly idiotic way to hose a machine due to versionitis!
Exact messages have been changed for brevity.
|
|
|
|
|
your toe after shooting yourself in the foot like that? Could you restore from a backup tape, or something like that.
Chris Meech
I am Canadian. [heard in a local bar]
I agree with you that my argument is useless. [Red Stateler]
Hey, I am part of a special bread, we are called smart people [Captain See Sharp]
The zen of the soapbox is hard to attain...[Jörgen Sigvardsson]
I wish I could remember what it was like to only have a short term memory.[David Kentley]
|
|
|
|
|
I shiftily passed it on to IT support saying it had 'mysteriously stopped working', whereupon they somehow divined the problem, booted from an install CD, and managed to have that 'ahh programmers' look while putting the original library back in place.
|
|
|
|
|
OK - I'm just QAing some code, and I've come across the following (variable names changed to protect the innocent):
bool isValue = (instance.Variable == 1 ? true : false); <Ironic>I can only assume that this is to protect from that other non-nullable boolean condition of "maybe(ish)".</Ironic>
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Pete O'Hanlon wrote: variable names changed to protect the innocent
What innocent?
|
|
|
|
|
Without knowing the 'typeness' of instance.Variable, what makes this code particularly shameful?
Chris Meech
I am Canadian. [heard in a local bar]
I agree with you that my argument is useless. [Red Stateler]
Hey, I am part of a special bread, we are called smart people [Captain See Sharp]
The zen of the soapbox is hard to attain...[Jörgen Sigvardsson]
I wish I could remember what it was like to only have a short term memory.[David Kentley]
|
|
|
|
|
What happens if you simply leave out the "? true : false" part?
...
..
.
got it?
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
OK - that sig alone gets my 5. It actually made me laugh.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Well, this code is 100% correct imo (under some conditions).
If Variable is an Integer, the Visual Studio C++ compiler shows a warning (C4800, type' : forcing value to bool 'true' or 'false' (performance warning)) when you use the following code:
int i = 1;<br />
bool c = i;
So, I guess the guy only wanted to get rid of the compiler warning
|
|
|
|
|
While it may be correct, it could also have been written:
bool isValue = (instance.Variable == 1); . The true/false at the end is redundant.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Ah, now I understand, thx
Shame on me
|
|
|
|
|
Pete O`Hanlon wrote: . The true/false at the end is redundant.
But hardly "Hall of Shame" worthy.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
It is when there are about 30 of these tests in the same routine.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I have to disagree. Amongst beginners tertiary operators are notoriously hard to read. Anybody who adds them superflously does deserve the hall of shame.
|
|
|
|
|
Pete O`Hanlon wrote: bool isValue = (instance.Variable == 1 ? true : false);
AFAIK, there is just one single value (for a 'bool') that's really defined, and that is the value for false (0).
True is defined as 'not false', so it can be any value, except for 0.
In Win32, there are cases where 'true' can be either 1 or -1.
An example:
TRUE is 1
VARIANT_TRUE is -1
So IMO, the code would be useful if it looked like this:
bool isValue = (instance.Variable == 0 ? false : true);
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
kakan wrote: bool isValue = (instance.Variable == 0 ? false : true);
Better still:
bool isValue = (instance.Variable != 0);
To me this is clearer.
Failure is not an option - it's built right in.
|
|
|
|
|
I would do it the same way you do.
I had two reasons for responding the way I did:
1.
I wanted the smallest possible alteration to the original code.
2.
In the past, I have given "smartcoded" examples and has been flamed for it, with comments like "unredable" and "impossible to understand". (My response that the compiler could handle my source code yielded heaps of "1" votes.)
So now I try to keep my code examples as easy to understand as possible.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
I actually posted this because I didn't see the need for the true/false test. The result of the equality test is a boolean condition, so either the item is equal to 1 (true) or it isn't (false). It just seemed that the coder had put in unnecessary code because he thought it was clever.
What made it worse, was that there were about 30 of these tests in one routine. Argggh.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Yes, under normal circumstances, it's a total waste, I agree.
The reason why I responded in the first place was that I once spent quite some time to figure out why a function (that turned out to want a VARIANT_BOOL) didn't react when I sent a (BOOL) TRUE to it.
Then I learned the difference between (BOOL) TRUE (1) and (VARIANT_BOOL) TRUE (-1).
And after that, I always test for false or not false. It can't go wrong. All versions of false *is* 0 and nothing else.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|