|
private void toggleSwitch(bool? visible = false)
{
if (visible.Value) toggleState(visible);
}
|
|
|
|
|
Well, it is completely redundant, and why is it Nullable?
I guess the developer had a case of hypocaffenia and encountered a '404: Brain Not Found' error.
Bob Dole The internet is a great way to get on the net.
2.0.82.7292 SP6a
|
|
|
|
|
Zac Greve wrote: hypocaffenia
Love it!
|
|
|
|
|
It's entirely possible that they would pass null into toggleSwitch. Of course, it should be HasValue rather than Value.
|
|
|
|
|
It's not redundant at all. But it probably doesn't function the way the author intended. What the author probably had in mind was:
private void toggleSwitch(bool? visible = false)
{
toggleState(visible);
}
...which wraps a non-nullable toggle function with a nullable one.
But as it is written, the functionality that this method offers is actually:
1. If user passes toggleSwitch(True), then toggleState is toggled. BUT,
2. If user passes toggleSwitch(False) or toggleSwitch(), then NOTHING happens (because of the test).
|
|
|
|
|
Congrats. You have successfully installed bugs!
|
|
|
|
|
Granted you don't pass a null value, the component / control will always remain in
.Visible = false But if false is passed, there's nothing there that will turn the control /component back on again.
|
|
|
|
|
It throws an exception when visible == null .
|
|
|
|
|
I'm rebuilding an old web app from scratch and I found this. There's a page that has a bulleted list on it.
Here's an example of how this was acheived:
<table border="0" cellpadding="1" cellspacing="0" style="width: 690px; height: 297px">
<tr>
<td align="center" style="width: 20px; height: 28px; vertical-align: top; text-align: center;">
•
</td>
<td style="width: 715px; height: 28px; vertical-align: top;">Text in here for list</td>
</table>
Why use UL when you can use a table, and actually put the bullet in manually as a whole separate column!
The second TD being wider than the whole table is also a nice touch.
|
|
|
|
|
|
Maybe it was generated from a DB table and they already had a stock routine to convert a result set into a table?
call dump_table("SELECT '*', column1 from table1 where listName = 'first';");
There could also be javascript code that captures clicks on table cells?
|
|
|
|
|
There's nothing like that. It's a static FAQ page.
|
|
|
|
|
screen readers?
|
|
|
|
|
I like how there is no </tr> tag.
Bob Dole The internet is a great way to get on the net.
2.0.82.7292 SP6a
|
|
|
|
|
That's my fault when typing the example in here I missed it. In reality they did use a </tr> It might be the only thing that was done right in that code.
|
|
|
|
|
I guessed as much. I often miss out on things when I type, which is why I like autocompletion.
Bob Dole The internet is a great way to get on the net.
2.0.82.7292 SP6a
|
|
|
|
|
This actually makes a lot of sense. The <ul><li> elements are completely unreliable when it comes to CSS styling across different platforms, also <ul><li> (nearly) always indents within the enclosing element producing alignment issues, again inconsistent across different platforms. At the very least you have to set the indent to a negative value and that does not work consistently. Bottom line, its a formatting nightmare.
Having done a lot of html email programming in the past I have to say the use of table cells and inline styling is by far the most portable and reliable code.
Anyway, its a redundancy, you're not saving anything using <ul><li> to create a list once you've styled it up, unless you're going for the doc-prof look.
|
|
|
|
|
I was just thinkin the same thing. Although I'm a novice, I don't like the pre-formatted version of
<li><ul> and tables offer a convenient way to format things the way I want.
|
|
|
|
|
This is a static page that's 5 years old, on a website (no other platform). The table is being used to display a list, no javascript hooks, no fancy formatting. This could have been done with a UL so much cleaner, and would have remained semantically correct.
Also, I didn't display this code but this page uses the table rows to acheive paragraph breaks.
<div style="font-size: 10pt; font-family: Arial">
<table border="0" cellpadding="1" cellspacing="0" style="width: 690px; height: 297px">
<tr>
<td colspan="2" style="font-weight: bold; font-size: 10pt; width: 753px; font-family: Arial; height: 35px;">
User Agreement
</td>
</tr>
<tr>
<td colspan="2" style="font-weight: bold; font-size: 10pt; width: 740px; font-family: Arial; height: 50px">
To use this site, please read the following statements and indicate you agree...
</td>
</tr>
<tr>
<td colspan="2" style="width: 753px; height: 73px">
I understand that this is a sample paragraph of text and I agree
</td>
</tr>
</table>
</div>
Notice how they're all colspan="2" ? That's so later when we get to the "list" the first column can be used for the bullet. Which isn't done with an image, or even • but an actual text •
There might be legitimate uses for tables, but this isn't one.
|
|
|
|
|
throw new TableOverloadException();
Bob Dole The internet is a great way to get on the net.
2.0.82.7292 SP6a
|
|
|
|
|
private long _remainder = long.parse("0");
I wish I knew who wrote this. I would have recommended TryParse to him.
"Bastards encourage idiots to use Oracle Forms, Web Forms, Access and a number of other dinky web publishing tolls.", Mycroft Holmes[ ^]
|
|
|
|
|
What's the problem? He didn't use a Magic Number!
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
|
|
|
|
|
private long _remainder = long.parse(0.ToString());
Would have been better
|
|
|
|
|
This is correct implementation:
int tryCounter = 0;
x:
if(!long.TryParse("0", out _remainder) && (tryCounter < 100)) {
tryCounter++;
goto x;
}
else if(!long.TryParse("0", out _remainder) && (tryCounter > 100)){
_remainder = 0;
}
else{
}
"Bastards encourage idiots to use Oracle Forms, Web Forms, Access and a number of other dinky web publishing tolls.", Mycroft Holmes[ ^]
|
|
|
|
|
Finally someone using TryParse correctly!
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|