|
CDO. It's like OCD, just in alphabetical order like it should be!
Bob Dole The internet is a great way to get on the net.
2.0.82.7292 SP6a
|
|
|
|
|
|
Select Case dataSetNPReport1.Spider.Rows.Count
Case 0
xrRichText1.Text = String.Format("Fråga {0}Landsting{0}Riket{0}Frågetext{1}A3{0}{0}{0}{0} - - {0} - {0}{0} - ", Chr(9), Chr(13))
Case 1
xrRichText1.Text = String.Format("Fråga {0}Landsting{0}Riket{0}Frågetext{1}{2}{0}{4}{0}{0}{5}{0}{3}", Chr(9), Chr(13), dataSetNPReport1.Spider.Rows(0).Item(0), Replace(dataSetNPReport1.Spider.Rows(0).Item(2).ToString, "*", ""), dataSetNPReport1.Spider.Rows(0).Item(5), dataSetNPReport1.Spider.Rows(0).Item(6))
Case 2
xrRichText1.Text = String.Format("Fråga {0}Landsting{0}Riket{0}Frågetext{1}{2}{0}{4}{0}{0}{5}{0}{3}{1}{6}{0}{8}{0}{0}{9}{0}{7}", Chr(9), Chr(13), dataSetNPReport1.Spider.Rows(0).Item(0), Replace(dataSetNPReport1.Spider.Rows(0).Item(2).ToString, "*", ""), dataSetNPReport1.Spider.Rows(0).Item(5), dataSetNPReport1.Spider.Rows(0).Item(6), dataSetNPReport1.Spider.Rows(1).Item(0), Replace(dataSetNPReport1.Spider.Rows(1).Item(2).ToString, "*", ""), dataSetNPReport1.Spider.Rows(1).Item(5), dataSetNPReport1.Spider.Rows(1).Item(6))
Case 3
xrRichText1.Text = String.Format("Fråga {0}Landsting{0}Riket{0}Frågetext{1}{2}{0}{4}{0}{0}{5}{0}{3}{1}{6}{0}{8}{0}{0}{9}{0}{7}{1}{10}{0}{12}{0}{0}{13}{0}{11}", Chr(9), Chr(13), dataSetNPReport1.Spider.Rows(0).Item(0), Replace(dataSetNPReport1.Spider.Rows(0).Item(2).ToString, "*", ""), dataSetNPReport1.Spider.Rows(0).Item(5), dataSetNPReport1.Spider.Rows(0).Item(6), dataSetNPReport1.Spider.Rows(1).Item(0), Replace(dataSetNPReport1.Spider.Rows(1).Item(2).ToString, "*", ""), dataSetNPReport1.Spider.Rows(1).Item(5), dataSetNPReport1.Spider.Rows(1).Item(6), dataSetNPReport1.Spider.Rows(2).Item(0), Replace(dataSetNPReport1.Spider.Rows(2).Item(2).ToString, "*", ""), dataSetNPReport1.Spider.Rows(2).Item(5), dataSetNPReport1.Spider.Rows(2).Item(6))
... You get the pattern...
People say nothing is impossible, but I do nothing every day.
|
|
|
|
|
I think I threw up in my mouth, a little.
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
|
|
|
|
|
A: It goes BOOM!
<context>SQL Server 2008 R2
I was just altering some of my code to choose betewen two values via COALESCE. Then I decided I might want to back out the change, but I wanted to leave the existing code in case I wanted to reapply the change later. So I had something like COALESCE ( /* X , */ Y ) Z -- of course, it makes no sense to COALESCE on one value, but I was only going to leave it there momentarily and I don't mind causing errors in order to advance my knowledge of the syntax.
The result is Incorrect syntax near ')'. -- I thought that was an odd message.
I checked the documentation: COALESCE ( expression [ ,...n ] ) -- so the syntax should be legal!
But it also goes on to say that COALESCE is equivalent to a CASE and my attempts at
CASE (WHEN Y IS NOT NULL) THEN Y END Z
CASE ELSE Y END Z
have been unsatisfactory.
|
|
|
|
|
Here's a single line from a horribly formatted SQL view (copied verbatim, minus 58 leading spaces):
WHERE (MarketingGroupAutoID IN (42))))))) OR
Now that you know the answer (42), we just have to figure out the question. Any theories?
|
|
|
|
|
The answer to life, the universe, and everything else?
Bob Dole The internet is a great way to get on the net.
2.0.82.7292 SP6a
|
|
|
|
|
|
How many roads must a man walk down?
Don't comment your code - it was hard to write, it should be hard to read!
|
|
|
|
|
(SQL Server 2008 R2.)
(CASE WHEN cTT.Total IS NOT NULL THEN cTT.Total ELSE 0 END) as 'Total_Total'
A dozen of these in a view...
|
|
|
|
|
What exactly are they selling? Give me the URL. Please. I would like to buy that Mars rover for null.
"Bastards encourage idiots to use Oracle Forms, Web Forms, Access and a number of other dinky web publishing tolls.", Mycroft Holmes[ ^]
|
|
|
|
|
I'm sure you can just go pick one up; there's no security around.
|
|
|
|
|
PIEBALDconsult wrote: Total_Total
What's the second "total" for? Did the programmer have total recall?
|
|
|
|
|
Normal people might call it a "Grand total".
|
|
|
|
|
Nope. It's a symbol for Total/scoreTotal. He's calculating GPA or something.
"Bastards encourage idiots to use Oracle Forms, Web Forms, Access and a number of other dinky web publishing tolls.", Mycroft Holmes[ ^]
|
|
|
|
|
There are plenty of dumb things done in SQL. Could be the coder never heard of ISNULL. Could be he came from a programming background. Could be he doesn't realize ISNULL is more efficient than a case statement. Could be a misapplication of "don't execute a function in a where clause" rule. Could be he forgot about ISNULL. Could be he's in the "Let's obsfucate this code as much as possible" club.
At least it isn't SUM(CASE WHEN cTT.Total IS NOT NULL THEN cTT.Total ELSE 0 END) as 'Total_Total'
|
|
|
|
|
KP Lee wrote: At least it isn't ...
I think that's in a few other places.
This is an improvement over some earlier code by the same guy that is something like:
SELECT
(SELECT COUNT(*) FROM T WHERE ... ) A ,
(SELECT COUNT(*) FROM T WHERE ... ) B ,
(SELECT COUNT(*) FROM T WHERE ... ) C ,
...
|
|
|
|
|
Maybe he wants the code to be ANSI compatible.
In which case I would use COALESCE.
People say nothing is impossible, but I do nothing every day.
|
|
|
|
|
A few years ago, I was working on some very legacy code that required a temporary array in a function. The array size would never, ever change and could be hard coded.
The legacy code:
char* pData = new char[4];
delete[] pData;
When I mentioned this recently to a colleague, he said that a smart pointer should have been used. Today that would be:
std::unique_ptr<char> pData = new char[4];
Last week, I ran across a web site discussing optimizations that a similar concept, though with more items. Applied to the legacy code, this this "expert's" solution was:
std::vector<char> data(4);
Why not just my solution:
char data[4];
Have people gotten so accustomed to complexity that they think of only complex solutions?
(I have other examples, the second funniest was when someone suggested using a boost function instead of three lines of elementary C code.)
|
|
|
|
|
Was it possibly an aversion to placing items on the stack versus the heap? I can't imagine that four bytes (or perhaps even 8) would be enough to warrant the overhead of using the heap.
Perhaps, they just like to build in complexity as a job protection kind of thing. The times are rough, now a days.
|
|
|
|
|
We make it complex because mere mortals should never be able to understand us! Heh, heh, heh.....
Bob Dole The internet is a great way to get on the net.
2.0.82.7292 SP6a
|
|
|
|
|
People have become so used to using frameworks, the primitives that the framework is built on, no longer has meaning to them. It is both a shame but also a measure of the quality of the some of the frameworks being used.
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]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
The days programmers could understand and master their programming languages are just over.
|
|
|
|
|
YvesDaoust wrote: The days programmers could understand and master their programming languages are just over.
Nonsense. A thorough understanding of the tools is, in fact, something that separates the top devs from the wannabes.
It does take a few years to achieve this mastery. The impatient recent grad or mediocre developer may delude themself that understanding cannot be achieved, but this is just an excuse.
That said, some tools do make it harder than others.
|
|
|
|
|
You have punched one of my hottest hot buttons: the tendency among far too many engineers to eschew the simple path.
My theory of the thing goes as follows: There are three stages in a software engineer's development / three types of software engineers / three phases to a life in software engineering:
1. The beginner: This engineer has little knowledge and less experience. That combination inclines him toward simplicity, for he hasn't the tools to get deep into the thickets, nor would he be confident of coming out alive. His programs tend to be easy to read, if sometimes a bit "naive."
2. The intermediate engineer: This engineer has begun to "feel his oats." He's learned quite a lot about various programming languages and fundamental algorithms, and he wants to show it off! So he embeds as much of what he "knows" in every program he writes as he possibly can. (Cf: "A Real Programmer knows every nuance of every instruction and uses them all in every Real Program.") His programs are next to illegible. After the passage of a few months, he won't want to admit to authoring them, much less maintain or debug them.
3. The senior engineer: This engineer is a grizzled, battle-scarred veteran. He's been around the block more times than you can count without taking off your booties. And while he can be a bit of a bore about those scars and how he earned them, his programs are a pleasure to read and maintain, because he's learned the virtues of simplicity. He never over-complicates a solution, because he's well aware that should it come apart under stress in a year's time, the most likely stuckee will be himself -- and remembering the rationale for excess complexity, and how to unsnarl it, is just too much like real work.
When I interview a fresh young candidate, I routinely describe the three types of engineers to him, and I ask: "Which sort of engineer do you aspire to be?" There are only two acceptable answers:
- A senior engineer, wise in the ways of the bits and a staunch foe of excess complexity;
- Hey, man, this engineering crap is just a stop along the way to the stars; I want to be the CEO of this place!
Food for thought.
(This message is programming you in ways you cannot detect. Be afraid.)
|
|
|
|
|