|
probably wasn't sure if he was coming or going?
|
|
|
|
|
Clearly the programmer was highly organized and wanted to keep all the RetryCount parameters in the same place
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
WilliamSauron wrote: If your bet was the [receive] section, you lose. It is of course in the [send] section...
Might be he was doing a mirror-coding.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep!
|
|
|
|
|
I am currently moving a powerbuilder application from a SQL server 2000 environment to SQL 2005. Easy you would think until I discovered the code was full of this sort of thing
select getdate() from sysobjects where id=1
simply to get the current date / time!! In SQL 2005 sysobjects does exist as a compatibility view however the data in it does not contain a record with an id of 1... the application fails in a big way..
Alex Baker
|
|
|
|
|
nasty! did the original programmer not realise that select getdate() would work too?
"An eye for an eye only ends up making the whole world blind"
|
|
|
|
|
Looks kinda Oracle-ish -- it could be Oracle ported to SQL Server... badly.
I worked for a company that had always used Oracle (on OpenVMS), but one customer wanted SQL Server (6) (on WinNT) so a bunch of PowerBuilder idiots were brought in to write some of the worst code I've ever seen. Data access in the UI?!
|
|
|
|
|
The wonderful thing about standards is that there are so many of them. If I recall, I create a variable (in vb.net) with the name of the SQL get-date function, and then I use that. I forget how I set it, but it was something pretty clunky like "If database type looks like SQL Server, set it to GETDATE() otherwise set to NOW()".
|
|
|
|
|
Hello,
How to get miliseconds form MS SQL Server using ADO and C++ ?
COleDateTime doesn't support miliseconds ...
Best Regards,
Irek
|
|
|
|
|
You can do it sql by using 'DatePart(ms,<dbColumnTime>)' function
|
|
|
|
|
--You can use 'set' instead of 'select'
declare @t as DateTime
set @t = getUtcDate()
-- Testing--
print @t
print DatePart(hh,@t)
print DatePart(mm,@t)
print DatePart(ss,@t)
print DatePart(ms,@t)
|
|
|
|
|
If I remember right, I think Oracle programmers had to do something like SELECT "Hello World" FROM DUAL because it wouldn't allow a SELECT without a FROM.
Could be a recent convert.
|
|
|
|
|
You do remember right, and I was trying to forget.
|
|
|
|
|
Was just asked to convert some VB6 code to C#.
The purpose of the code is to find anagrams. There is a database with a list of words. The input is a string of letters and the code is supposed to spit out any matching anagrams found in the word list.
The idea is to have a 'crossword puzzle' helper tool that can be downloaded from an ad-financed puzzle enthusiasts website, but the client felt it was too slow to use and wondered if C# might be faster.
This is what I found: All possible orders of letters in the input string are derived in a loop, then each one is searched against the database to see if it exists. As you might imagine, with anything except a very short input this yields gazzilions of combinations and takes forever (almost literally) to run.
The first thing I did was a run-once bit of code to sort the letters in each word in the database into alphabetical order, and stick that in as a key field.
To find an anagram, the letters in the input are also sorted into alphabetical order. We then match that to the indexed key field and pull out matching words in the blink of an eye.
The end result runs in milliseconds instead of centuries. Or as the client put it "That C#'s a bit faster than VB6, isn't it?"
Should I now point out that a downloadable C# app is not a good idea? Their user base (presumably little old ladies) would need the net framework on their Win98 PCs, and having downloaded once, they don't need to go back to click on the knitting pattern banner ads. It should run in a browser.
But what do I know? I'm just a stupid girl.
JustAStupidGurl
|
|
|
|
|
Very amuzing
The old algorithm does not hold into account possible typo's. Maybe it can be adapted to also check for every possible combination of 3 wrong characters in each word
GSoC 2009 student for SMW!
---
My little forums: http://code.bn2vs.com
---
70 72 6F 67 72 61 6D 6D 69 6E 67 20 34 20 6C 69 66 65!
|
|
|
|
|
Or make the input several MB.
It could then produce every possible C# source code file, not to mention every possible poem of that size.
Bound to be a few good ones
JustAStupidGurl
|
|
|
|
|
lol!
Mind if I put that in my collection of epic quotes?
GSoC 2009 student for SMW!
---
My little forums: http://code.bn2vs.com
---
70 72 6F 67 72 61 6D 6D 69 6E 67 20 34 20 6C 69 66 65!
|
|
|
|
|
|
? You seem reasonably intelligent to me... or was it tongue-in-cheek?
|
|
|
|
|
Please adjust your sarcasm detector
|
|
|
|
|
What do you think?
But then I'm JustAStupidGirl, so you never know.
JustAStupidGurl
|
|
|
|
|
The impressiveness of (for example) a 87,178,291,200-element search space for 14-letter anagrams should have gotten the original author to use less permissiveness in choosing an algorithm. If he could miss such an obvious rectification for the problem, he doesn't deserve to earn any kind of certification in software development.
|
|
|
|
|
JustAStupidGurl
|
|
|
|
|
*Stab*
|
|
|
|
|
Do point out that a downloadable C# app isn't the best idea. Why not just run it in asp.net? Even if the existing website is something else, like php, why not set up an asp.net server to run the anagram logic if nothing else? The site can then retrieve the anagrams (or even pre-rendered html) through ajax or some ajax-like mechanism and nobody has to download anything. Even people who have the framework installed may be somewhat sceptical to downloading and running executables directly from some small-name website. Though I guess if we look at how many people happily use things like TPB as their source of software my concern might seem exaggerated.
I've always been fascinated by the fact that somewhere in the digits of pi is a blue-ray encoded video with DTS surround sound of myself falling into a supermassive black hole, seeing past and future as I pass the event horizon, and then arriving at a concert where Mozart plays drums, Britney Spears plays a cello, Bono is a backing vocalist and the pope is making out with George Michael.
|
|
|
|
|
I've just found a another report query by my favourite genii, which gives call volumns per hour. You see, datetime columns are once again frowned upon, so we store the call time formatted as 'hh:mm:ss', then we 'group' by the call time as follows:
, CASE WHEN Sum(CASE WHEN TimeText>='01:00:00' And TimeText<='01:59:59' THEN Cost ELSE 0 END) IS Null THEN 0 ELSE Sum(CASE WHEN TimeText>='01:00:00' And TimeText<='01:59:59' THEN Cost ELSE 0 END) END AS T1_2
, CASE WHEN Sum(CASE WHEN TimeText>='02:00:00' And TimeText<='02:59:59' THEN Cost ELSE 0 END) IS Null THEN 0 ELSE Sum(CASE WHEN TimeText>='02:00:00' And TimeText<='02:59:59' THEN Cost ELSE 0 END) END AS T2_3
, CASE WHEN Sum(CASE WHEN TimeText>='03:00:00' And TimeText<='03:59:59' THEN Cost ELSE 0 END) IS Null THEN 0 ELSE Sum(CASE WHEN TimeText>='03:00:00' And TimeText<='03:59:59' THEN Cost ELSE 0 END) END AS T3_4
, CASE WHEN Sum(CASE WHEN TimeText>='04:00:00' And TimeText<='04:59:59' THEN Cost ELSE 0 END) IS Null THEN 0 ELSE Sum(CASE WHEN TimeText>='04:00:00' And TimeText<='04:59:59' THEN Cost ELSE 0 END) END AS T4_5
, CASE WHEN Sum(CASE WHEN TimeText>='05:00:00' And TimeText<='05:59:59' THEN Cost ELSE 0 END) IS Null THEN 0 ELSE Sum(CASE WHEN TimeText>='05:00:00' And TimeText<='05:59:59' THEN Cost ELSE 0 END) END AS T5_6
, CASE WHEN Sum(CASE WHEN TimeText>='06:00:00' And TimeText<='06:59:59' THEN Cost ELSE 0 END) IS Null THEN 0 ELSE Sum(CASE WHEN TimeText>='06:00:00' And TimeText<='06:59:59' THEN Cost ELSE 0 END) END AS T6_7
For each of all 24 freaking hours. And, BTW, we don't need no steenkin' isnull() function either.
JUST IN: There are 48 of these CASE lines, 24 for incoming calls, and 24 for outgoing calls. Last modified: 10mins after originally posted --
|
|
|
|