|
O M G !!!!
Aside from the fact that it is a massive table of text.....WHY WHY WHY WHY WHY do people design G.D. databases with an incremental ID as the mother fracking key!!!!! AHHHHHH I want to shoot that designer.
[deep breath...pause... nope I still want to shoot the designer]
[Buddhist chants...meditation...an hour of tai chi....hmmm nope I still want to shoot the designer]
Oh well.
|
|
|
|
|
LongRangeShooter wrote: WHY do people design G.D. databases with an incremental ID as the mother fracking key
I'm not sure what you mean by "incremental ID" here. Do you mean auto-incrementing?
|
|
|
|
|
LongRangeShooter wrote: WHY WHY WHY WHY WHY do people design G.D. databases with an incremental ID as the mother fracking key
This bugs me too, sometime you find that such people grew writing VBA apps on Accees, which natually makes them database designers . Occaisionally technology "forces" it see: http://en.wikipedia.org/wiki/Surrogate_key#Compatibility[^] Genuinely, I blame lack of training as people often grow up hacking databases together, istead of understanding the theory behind them.
To me, surrogate keys are a sign of bad normalisation, can lead to duplicates more easily, and increases the likelyhood of bad join conditions. I'm fascinated by the internicene warfare around relational database design, as these directly correlate to set theory and therefore we should largely agree about the principles at least. I mooted this point in the C# forum and got an immediate long rant informing me how a properly normalised database is too hard to use, I didn't even argue back as the guy was obviously too stupid to bother with.
I worked in a company that collapsed because they bought a 3rd party software. The vendor pitched it "We handle all the information checking in code [i.e. referential integrity, duplication protection, orphaning protection etc], so our system is more flexible. Net result: Orphaned records, lost records, duplicate jobs, all because it is "too difficult" to normalize.
Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.
|
|
|
|
|
jeroen de dauw wrote: EDIT: Check out my blog post[^] about this
Dude. Who told you that black text on a dark grey background made for a good, READABLE, website?
|
|
|
|
|
Dark Gray background? What browser are you using?!!
Jeroen De Dauw
--- Forums ; Blog ; Wiki---
70 72 6F 67 72 61 6D 6D 69 6E 67 20 34 20 6C 69 66 65!
|
|
|
|
|
Wow. IE7 at work.
I fired up IE7 at home and it looks OK now. Back at work, it was all dark gray, except for the code snippets.
|
|
|
|
|
I can second that. I am using IE7 and it's a grey background, black text. Very hard to read. The code snippets show up OK, with a white background.
EDIT:
Just tried it in FF3 and it's a white background. In IE7 there is a background image showing which is sort of a dark greyish colour. In FF3 that image is not displayed, so you only see the default browser back colour (i.e. a plain white background). It looks like some problem with the CSS file that defines the class for the box where you are showing your text. IE likes it, FF doesn't.
Welcome to the world of cross-browser support.
|
|
|
|
|
FF3.0: OK
IE7: bad
|
|
|
|
|
CSS Fail!
|
|
|
|
|
Found in production code:
The standardTimer is the number of minutes. The result is the number of millideconds (standardTimer * 60000)
// Specified delay... Start every xx minutes
System.TimeSpan duration = new System.TimeSpan(0, 0, standardTimer, 0);
DateTime dtStart = new DateTime();
dtStart = DateTime.Now + duration;
string sDate = dtStart.ToString();
// Calcul delay
string sCurrent = DateTime.Now.ToString("HH:mm:ss");
string sStart = dtStart.ToString("HH:mm:ss");
System.TimeSpan tsCurrent = System.TimeSpan.Parse(sCurrent);
System.TimeSpan tsStart = System.TimeSpan.Parse(sStart);
tsStart = tsStart - tsCurrent;
return (int)tsStart.TotalMilliseconds;
|
|
|
|
|
Nothing wrong with that code - perfectly good approach!
I particularly like the DateTime -> TimeSpan conversion via parse - classy.
I do however feel that he has missed an opportunity to save some code space:
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
TimeSpan duration = new TimeSpan(0, standardTimer, 0);
sw.Start();
System.Threading.Sleep(duration);
sw.Stop();
return sw.ElapsedMilliseconds;
Perhaps you should use this method instead?
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
Perhaps the coder thought it was necessary to convert a DateTime into a TimeSpan before subtracting to yield a TimeSpan? In fact, the difference between two DateTime values is a TimeSpan.
Not sure how to explain some of the other ugliness in the code, though. I can understand cases where one might want to e.g. calculate the number of milliseconds until the start of a minute 'n' minutes from now, but I'm unclear how any of the cases where this function wouldn't return StandardTimer*60000 would be useful.
|
|
|
|
|
Elegant or not, the code has a bug actually. It's using DateTime.Now in two places. Because the code is not saving that first value off to use later, it will be unreliable.
|
|
|
|
|
Andrew Rissing wrote: it will be unreliable
Yes, but you can rely on it to be unreliable.
|
|
|
|
|
Indeed. Lets just hope it doesn't become unreliable to rely on its unreliability.
|
|
|
|
|
it is a very mild form of unreliability, as you can perfectly predict when it will be shaky and when not.
I did mention it in my datetime compendium[^] though.
|
|
|
|
|
Nice little collection of useful DateTime snippets. I added that to my bookmarks. Thanks.
|
|
|
|
|
One of our users was sent to a client's site to upload some work files for review. She got a message that said something like:
This website requires an HTML 4.0 compliant web browser with Javascript enabled. You are using a browser version that does not meet these requirements. It is recommended that you use either Internet Explorer versions 5.5/6.x/7.x, or Netscape version 7.x. Refer to your browser's online help for specific instructions to enable Javascript.
Yet we are using IE 7 with JavaScript enabled. So I went digging through their page to see what triggered that message and found this little gem:
function browserSupported()
{
var agt=navigator.userAgent.toLowerCase();
var agt=navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);
var is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
&& (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
&& (agt.indexOf('webtv')==-1));
var is_nav62up = (is_nav && (is_major >= 5) && (is_minor >=5) && (agt.indexOf("gecko")!=-1) );
var is_ie = (agt.indexOf("msie") != -1);
var is_ie3 = (is_ie && (is_major < 4));
var is_ie4 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")==-1) );
var is_ie4up = (is_ie && (is_major >= 4));
var is_ie5 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
var is_ie5up = (is_ie && !is_ie3 && !is_ie4);
var is_ie55 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5")!=-1) );
var is_ie55up = (is_ie && ((!is_ie3 && !is_ie4 && !is_ie5) || is_ie55));
var is_ie6 = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.0")!=-1) );
var is_ie6up = (is_ie && ((!is_ie3 && !is_ie4 && !is_ie5 && !is_ie55) || is_ie6));
var is_opera = (agt.indexOf("opera") != -1);
if (is_nav62up || is_ie55up || is_opera || is_ie6up || is_ie6)
{
return true;
}
return false;
}
Note the complete and utter lack of a check for "msie 7.0", let alone the horrible combination of and's and not's to set all those is_<browser> flags. -Greg
|
|
|
|
|
It seems some rookie has coded that script...
|
|
|
|
|
Wow, talk about how times change. I bet I could dig up a curses lib file that does the same thing for DEC VT-xxx terminals. 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]
|
|
|
|
|
It took me about 20 minutes to work out what the heck this For/Next loop was doing. The programmer must not have heard of .Split.
It takes a key from an INI file (vkeys) and if it is formatted as such:
SERVICES = Service1, Service2, Service3, Service4 ...
it puts the list of services into an array for later use..
If vkeys(lval, 0) = "services" Or vkeys(lval, 0) = "SERVICES" Then
totallength = Len(vkeys(lval, 1))
For searchstring = 1 To totallength
tempcounter2 = tempcounter2 + 1
If Mid(vkeys(lval, 1), searchstring, 1) = "," Then
servicecount(X) = servicecount(X) + 1
nodeservices(X, servicecount(X)) = Mid(vkeys(lval, 1), _
tempcounter1, tempcounter2 - 1)
If Right(nodeservices(X, servicecount(X)), 1) = "," Then
nodeservices(X, servicecount(X)) = _
Left(nodeservices(X, servicecount(X)),_
(Len(nodeservices(X, servicecount(X))) - 1))
End If
tempcounter1 = searchstring + 1
tempcounter2 = 1
End If
If searchstring = totallength Then
nodeservices(X, (servicecount(X) + 1)) = Mid(vkeys(lval, 1),_
tempcounter1, tempcounter2 - 1)
End If
Next searchstring
servicecount(X) = servicecount(X) + 1
tempcounter2 = 1
End If
|
|
|
|
|
It's a horror right from the first line
If vkeys(lval, 0) = "services" Or vkeys(lval, 0) = "SERVICES" Then
...what about "Services"
|
|
|
|
|
Release 1.01: Added support for "Services".
|
|
|
|
|
Bug report: it fails with "serviceS". You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
OriginalGriff wrote: Bug report: it fails with "serviceS".
Dear Mr./Ms. User,
We are currently offering support for "services", "Services", "SERVICES" (based on user skill - does not know about text formatting rules, knows about text formatting rules, does not know about CAPS LOCK key) and we plan to support "sERVICES" (for users who know formatting rules but forgot about CAPS LOCK key) in future releases.
As far as we see, "serviceS" is an anomaly and it should not be considered a bug.
Yours trully,
Programming Team Leader.I have no smart signature yet...
|
|
|
|