|
There seems to be a problem with the ASP.NET data repeating controls, Repeater and DataList. If a new DataSource is empty, the control appears to keep the rows of the old DataSource. While looking for a solution I stumbled upon this[^] gem:
<br />
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load<br />
repeater.DataBind()<br />
Dim record As String = repeater.Items.Count.ToString<br />
If record = 0 Then<br />
repeater.Visible = False<br />
Else<br />
repeater.Visible = True<br />
End If<br />
End Sub<br />
|
|
|
|
|
Wow! A three-fer!
|
|
|
|
|
What's a three fer?
|
|
|
|
|
I see this so much, it's sad
|
|
|
|
|
I met an int once... he was looking for the intwives.
|
|
|
|
|
that's art
(yes|no|maybe)*
|
|
|
|
|
Extracted from a really slow stored proc:
<br />
SELECT 0 * Sum(IIf([amortisedClosePriceIssueYld]=0 Or [amortisedClosePrice]=0,0,-[bsqflag]*[closedq]*[valpoint]*([amortisedClosePriceIssueYld]-[amortisedtpissueyld]))) AS LocalRealisedAmortIssue<br />
FROM ((((PL1RPLCloseOuts INNER JOIN seclocal AS sec ON PL1RPLCloseOuts.id = sec.id) LEFT JOIN SecTypeValidationRuleslocal AS SecTypeValidationRules ON sec.sectype = SecTypeValidationRules.sectype) INNER JOIN TradeFundlocal AS TradeFund ON PL1RPLCloseOuts.fund = TradeFund.fund) INNER JOIN tradetlocal AS TradeT ON PL1RPLCloseOuts.tt = TradeT.tt) INNER JOIN PL1RplTaxlots ON (PL1RPLCloseOuts.tnum = PL1RplTaxlots.tnum) AND (PL1RPLCloseOuts.tt = PL1RplTaxlots.tt)<br />
Yes indeed - do a huge amount of maths and multiply the resulting figure by zero...oh
|
|
|
|
|
You would think a product as sophisticated as SQL Server would be able to optimize that down...
|
|
|
|
|
Only if the SQL standard allows it to.
|
|
|
|
|
I suppose theoretically the maths calc could have side effects.
Bram van Kampen
|
|
|
|
|
I saw the "SELECT 0 * Sum" and immediately thought this was a joke.
Apparently I was wrong.
Please don't bother me... I'm hacking right now. Don't look at me like that - doesn't anybody remember what "hacking" really means?
|
|
|
|
|
Perhaps a marriage of SQLServer with Unix.
There is something in Unix where you can divert junk files (howmuch ever huge it is, even beyond the capacity of the disk) to an infine sink called /dev/null .
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
MySQL has a fantastic storage engine called "Blackhole" It supports Inserts only, not deletes, selects or Updates.
|
|
|
|
|
Vasudevan Deepak K wrote: something in Unix
DOS and OpenVMS also have null devices.
|
|
|
|
|
I came across the following function:
private static string[] SplitByString(string testString, string split)
{
int offset = 0;
int index = 0;
int[] offsets = new int[testString.Length + 1];
while (index < testString.Length)
{
int indexOf = testString.IndexOf(split, index);
if (indexOf != -1)
{
offsets[offset++] = indexOf;
index = (indexOf + split.Length);
}
else
{
index = testString.Length;
}
}
string[] final = new string[offset + 1];
if (offset == 0)
{
final[0] = testString;
}
else
{
offset--;
final[0] = testString.Substring(0, offsets[0]);
for (int i = 0; i < offset; i++)
{
final[i + 1] = testString.Substring(offsets[i] + split.Length, offsets[i + 1]
- offsets[i] - split.Length);
}
final[offset + 1] = testString.Substring(offsets[offset] + split.Length);
}
return final;
}
and just had to run it in order to make sure that this function was really only a rewrite of String.Split(string[] seperator, StringSplitOptions option) which was taken from some website.
|
|
|
|
|
I agree that it's not very well written, but when was it written?
Splitting on string was added in .net 2.0; this may have been written before that... as was mine.
Mine also has the benefit of honoring quotes and escapes within the string, so splitting
12345,"Coyote, Wile E.","\"Super Genius\""
on comma will return the proper results.
Reinventing the wheel is acceptable if (and only if) it results in a better wheel.
|
|
|
|
|
PIEBALDconsult wrote: 12345,"Coyote, Wile E.","\"Super Genius\""
If he was that much of a genius, why did he keep buying all this crap from ACME after everything he bought repeatedly failed??
|
|
|
|
|
They're the only ones to give him a credit card.
|
|
|
|
|
I don't know about the original website where it was copied from, but the code I found it in was written/targeted for .NET 3.5.....
|
|
|
|
|
|
string.Split() was available in framework 1.0 and 1.1 too..
|
|
|
|
|
But only with splitting on single-character delimiters, not multi-character (string) delimiters.
|
|
|
|
|
The split(string, delim) function from earlier VB versions is still available and accepts multi-character delimiter parameters.
|
|
|
|
|
Less subtle, and probably posted a thousand times:
bool b = whatever;<br />
<br />
switch(b)<br />
{<br />
case true:<br />
break;<br />
<br />
case false:<br />
break;<br />
}
Seen as PHP-Code...
This is completely unrelated, but it just came to my mind...
"Obstacles are those frightening things you see when you take your Eyes off your aim"
- Henry Ford
Articles
Blog
|
|
|
|
|
Sometimes I ask myself. What’s the real horror in this rubric?
The people that wrote the code or the people that are posting it and reading it?
I think the last ones.
Did you ever see on the internet a website where plumbers are smiling with the mistakes of “newbie’s” plumbers?
In my company we have a positive approach.
Dirk
ApTools.Net
|
|
|
|