|
It looks to me like the "Do not press" red button
I have no smart signature yet...
|
|
|
|
|
Abhinav S wrote: Anyone else came across any class / namespace MS provides that says "Do not use".
The whole of VB? At least it should .
Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.
|
|
|
|
|
Ahhhhhhhhhhh bite me.
Sorry, just a VB.NET user starting the day out in a bad mood already. Nothing personal
|
|
|
|
|
No problem, can't expect to make a statement like that without comment from the VBers knocking around
Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.
|
|
|
|
|
Lots of places; especially where a class/method has been deprecated in favour of a newer version.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Should they not say 'Deprecated' instead.
"Do not use" makes me want to use it.
|
|
|
|
|
If a can of gasoline had a picture with a lit match with an X through it, would that mean you would want to throw a lit match in the can.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
|
|
|
|
|
I think there is an ObsoleteAttribute to handle this situation, isn't it ?
|
|
|
|
|
|
Cool - thanks.
I somehow missed this link earlier.
|
|
|
|
|
So in other words, instead of a "Do not use" comment, it really should say, "Don't forget to cast".
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
|
|
|
|
|
|
Here is a code sample from Q&A. Obviously a beginner (so I won't say where or who to spare the OP's blushes) but "How not to do it: convert from ascii to an array of bits":
array< array< int >^ >^ chartobin(array^arr,int length,int imgsize1)
{
int ascii;
array< array< int >^ >^ messag= gcnew array< array< int >^ >(imgsize1);
for(int i=0;i<imgsize1;i++)>
{
messag[i] = gcnew array(8);
}
for(int x= 0;x<length;x++)>
{
ascii =(int) arr[x];
int* binary_reverse = new int [9];
int* binary = new int [9];
int y = 0;
while(ascii != 1)
{
if(ascii % 2 == 0)
{
binary_reverse[y] = 0;
}
else if(ascii % 2 == 1)
{
binary_reverse[y] = 1;
}
ascii /= 2;
y++;
}
if(ascii == 1)
{
binary_reverse[y] = 1;
y++;
}
if(y < 8)
{
for(; y < 8; y++)
{
binary_reverse[y] = 0;
}
}
for(int z = 0; z < 8; z++)
{
binary[z] = binary_reverse[7 - z];
if(binary[z]==0)
{
binary[z]=-1;
}
}
for(int z = 0; z < 8; z++)
{
messag[x][z]=binary[z];
}
delete [] binary_reverse;
delete [] binary;
}
return messag;
}
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
Yes a bit of a horror, but, yes there is a but, without knowing what was the driver for this question or what the OP was upto, they might have been forced to do it this way, particularly if they are on a programming course etc.
I am currently doing a degree with the OU, and it is all based around Java. The question papers etc, sometimes tell you must do some things a certain way and not use other methods (or built in libraries/extensions etc.
The last paper I was doing was based around threads, it had the 'main' thread, and 3 other worker threads. We had to use semaphores/countdown latches etc. to ensure the workers were finished before the main thread did something, rather than a simple join.
|
|
|
|
|
I know what you mean, but I think what got me was the way you could see the OP original thought process run through the whole thing:
"Good that works."
"Damn, forgot the last digit. That fixes it"
"Bugger, forgot the zeros if there are any left over...better put them in."
"What do you mean its back to front - sod it!"
"Oh, yes, I had better include it in the output..."
Without at any time wanting to change what the OP already has that is working (sort of)!
I do find that a reluctance to look back and change partly broken code does cause a lot of horrors...
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
On a different note from my other post on this, i am a hobbyist programmer and do not do it as my day-to-day line of work. As a result of this i have many many times found myself producing completely bizarre code to do a task, only to find out that there a specific classes/methods available within the .net framework, usually resulting in me giving myself a slap.
Its one of those......experience makes a difference.....kind of things i guess.
|
|
|
|
|
One of the first things I did wen I learned C# was to translate a bunch of my C routines -- only to find that a lot of them were already built-in.
|
|
|
|
|
I also loved:
int* binary_reverse = new int [9];
int* binary = new int [9];
...
|
|
|
|
|
I almost read it as "Beginners Suck"
Two heads are better than one.
|
|
|
|
|
Why did the hair on the back of my neck stand up when I looked at this?
Dim IsPresCheck As CheckBox = CType(FormView1.FindControl("IsPrestigeChkBx"), CheckBox)
If IsPresCheck.Checked = "True" Then
SqlDataSource1.SelectParameters.Add("IsPrestige", System.TypeCode.Int32, 1.ToString)
Else
SqlDataSource1.SelectParameters.Add("IsPrestige", System.TypeCode.Int32, 0.ToString)
End If
Steve Wellens
|
|
|
|
|
Do you have stringy hair?
|
|
|
|
|
Because they couldn't take it sitting down!
*rim shot*
|
|
|
|
|
That reminds me of a coding horror I experienced long ago.
The value of an option was set on the server side, and that should determine if a checkbox on the client side was already checked or not. It worked well on all development computers, only on one terminal server - which was used for testing - that failed. I checked if the value was translated correctly from server to client ("false" was always a 0, but "true" was usually -1, sometimes +1, and rarely something else) - I got the correct bool value. I drilled further down the code and eventually stumbled over a great function (I am not sure if I reproduce that correctly, as I wrote vb code only several years ago):
Sub ApplyOptionValue(Value as String)
Value = Uppercase(Value)
If Value = "WAHR" Then
checkBox1.Checked = 1
Else If Value = "FALSCH" Then
checkBox1.Checked = 0
Else
checkBox1.Checked = 0
End If
When you pass a bool to a function which expects a string, VB just translates that bool to a string. On our development machines, we had the German version of Visual Studio, so a "True" was translated to "Wahr", but on the test machine, the relevant dll was in US English version, and hence the true value was "True", not "Wahr".
Also note that the original programmer already considered such a case where the value was neither true nor false...
|
|
|
|
|
Who came up with the notion that implicit conversions should be anything other than culture-invariant? That's a "coding horror" right there, IMHO.
|
|
|
|
|
You can use GEL to hold your hairs
|
|
|
|