|
Yes, the enumerator of the root, but not the root itself.
|
|
|
|
|
PIEBALDconsult wrote: System.Windows.Forms.TreeNode nod = this.tvMain.SelectedNode as System.Windows.Forms.TreeNode ; Why do you complain? That cast is really safe, isn't it?
And I am nod ding my head for his great capabilities in naming of variables.
|
|
|
|
|
Yes, that cast is very safe. However, originally I was casting to a custom derived TreeNode type, I could probably remove it now.
|
|
|
|
|
var fieldName = attributeVal.substring(0, attributeVal.length - 1);
It is javascript.
___ ___ ___
|__ |_| |\ | | |_| \ /
__| | | | \| |__| | | /
|
|
|
|
|
Why making things simple when you can over-complicate them?
You always obtain more by being rather polite and armed than polite only.
|
|
|
|
|
phil.o wrote: Why making things simple when you can over-complicate them? Because we are men, not women.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Casual sexism alert.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
|
|
|
|
|
Well that will work, but it is another example of why I have the sig that I do.
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
Nice find. But what will happen when attributeVal is null?
|
|
|
|
|
Then run time error would occur.
Actually null value is not a problem. The problem is, the style of assigning a string variable value to another variable.
___ ___ ___
|__ |_| |\ | | |_| \ /
__| | | | \| |__| | | /
|
|
|
|
|
Maybe the author wants the original string left unchanged? It is no longer an attribute value but now a fieldname so it makes sense to use a different variable? Have to admit, I don't really get this one
|
|
|
|
|
Good catch. But there is nothing in code to keep string left unchanged. It was simple assignment. I think, first author had extract multiple values from the string but after some changes, the string was started giving single value. The second author may be don't want to change too much in code (specially substring function).
___ ___ ___
|__ |_| |\ | | |_| \ /
__| | | | \| |__| | | /
|
|
|
|
|
It's Javascript. You probably end up with fieldName == "undefine"...
|
|
|
|
|
How does it differ from JQuery?
I do not fear of failure. I fear of giving up out of frustration.
|
|
|
|
|
That allows for an easy performance improvement with V2.0
|
|
|
|
|
A real example of Weird and The Wonderful.
___ ___ ___
|__ |_| |\ | | |_| \ /
__| | | | \| |__| | | /
|
|
|
|
|
What if he didn't want the original string reference ? not a bad way to clone
TVMU^P[[IGIOQHG^JSH A#@ RFJ\c^JPL>;"[, /|+&WLEZGc
AFXc!L<br />
%^]*IRXD#@GKCQ R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_ADEPABIKRDFVS)EVLQK)JKQUFK[M UKs$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
That only applies to objects. For instance...
var a = 'howdy';
var b = a;
a = 'partner';
alert(b);
var x = {message: 'howdy'};
var y = x;
x.message = 'partner';
alert(y.message);
And even if that was the coder's intent, it would still be way more readable to do something like this...
var a = 'blah';
var b = new String(a);
a = 'yo';
alert(b);
Jeremy Falcon
|
|
|
|
|
Well, substring omits the character at the index specified by the second parameter, so the code you listed will return attributeVal with its final character removed.
Maybe that's not what this code should be doing in this case, but what you showed isn't obviously incorrect. It's exactly the code you'd want to use to remove the last character of a string, although
attributeVal.slice(0,-1) would work in this case too.
OTOH,
var fieldName = attributeVal.substring(0, attributeVal.length);
would be pointless, as it would just return attributeVal
|
|
|
|
|
Sanjay K. Gupta wrote: It is javascript. You don't say!
The language is JavaScript. that of Mordor, which I will not utter here
This is Javascript. If you put big wheels and a racing stripe on a golf cart, it's still a f***ing golf cart.
"I don't know, extraterrestrial?"
"You mean like from space?"
"No, from Canada."
If software development were a circus, we would all be the clowns.
|
|
|
|
|
That made my day.
Jeremy Falcon
|
|
|
|
|
There are increasing numbers of questions being posted with code similar to:
try {
callAPIMethodThatReturnsStatus(some parameters)
}
catch (SomeException e) {
take exceptional action
}
display ('The method completed successfully');
And yet they never check the returned status of the method call. Someone is teaching students/newbies that if it does not throw an exception then it must have worked. This seems most common with database update commands.
Get your money out of the bank quickly.
|
|
|
|
|
Maybe the return type of callAPIMethodThatReturnsStatus was poop and the programmer didn't want to deal with that s#!t.
Kitty at my foot and I waAAAant to touch it...
|
|
|
|
|
Not to mention the headless use of try-catch - I wonder who will pay the bill at the end...
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
Kornfeld Eliyahu Peter wrote: I wonder who will pay the bill at the end Oh, that will be us poor customers.
|
|
|
|