- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Need URGENT code to Count off business days between two dates for school and find yor saite in googles, PLEAZE SEND TEH CODEZ!
Admin
Admin
My guess is that it's supposed to indicate whether or not a ticket will be closed out in the required maximum number of weeks based on priority: med <= 5 weeks, low <= 10 weeks.
Would I be the only one who thinks that the use of spaces and such in the column names (so the query results have a nice header layout) is a bigger WTF than the code logic? How can somebody write something like this and not know how to use an aliases in a query?
Admin
this cant be real...
Admin
This is actually the first WTF that makes me want to go back to programming in Z80 Assembler.
Any chance of storing it under "Classics?"
Admin
That's not the only valid way. Consider a regexp A. If A matches against valid emails, so does A.{0}. By induction, there are infinitely many valid regular expressions to accept the grammar of emails.
Admin
FILE NOT FOUND On a wooden table For Paula (Brillant) Bean With XML Not in VB
Admin
At least the regex wasn't generated by hand, but rather coded up by following the patterns in the RFC. And, weirdly enough, there's nothing unnecessary in it.
Doesn't stop it from looking scary, though!
Admin
Damn you! Here I thought the 500 line SELECT I helped write was bad. I am obviously spoiled.
Admin
Admin
I don't have any pencils. Is whiteboard marker okay?
Admin
uhhhhh...[rocks back and forth slowly]...I just died a little on the inside. Even using only the w3 SQL tutorial, someone should be able to write better code than that...I did (clarification, I'm not in IT, it was for a personal project).
Admin
Here's the logic in compressed form. Yeah, on reflection, it looks like N represents the number of non-work days to subtract.
You could combine DATEDIFF and DATEADD, but it would still be kind of ugly. The old-schoolers on Usenet suggest the following alternate approach:
Create a table containing all dates over a suitable range (e.g. 2000 through 2099). Make sure no one but the sysadmin can delete rows from it.
Flag weekends and holidays (using computed columns when feasible, manual flags otherwise).
Count the number of flagged dates falling within the time period in question, and subtract that from the total number of days.
Admin
Um... uh... dies
Admin
I came up with this a while back. It sticks to the RFC, except for the obvious mistake (where a quoted-pair matches text of any length beginning with a backslash and not containing a a CRLF pair). My code almost certainly has errors, but the point is that even without errors it wouldn't be very long at all.
Admin
Admin
@ Quietust: Your indenting is a lot better yeh, I kinda gave up trying to fix it all halfway through it :S
Admin
Please explain to me how proper indentation made that suck less? ;-)
Admin
(GIR 0AA)|((([A-Z-[QVX]][0-9][0-9]?)|(([A-Z-[QVX]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVX]][0-9][A-HJKSTUW])|([A-Z-[QVX]][A-Z-[IJZ]][0-9][ABEHMNPRVWXY])))) [0-9][A-Z-[CIKMOV]]{2})
Yes, UK post codes suck. "GIR 0AA" is a historic post code that is valid, although it does not follow the slightly more structured rules for the remaining codes.
Admin
Sure? My guess would have been:
public static bool ApproveLoan() { return Borrower != null; }
Admin
Hej, it is impossible to check for a valid email address with RegEx. Email addresses may contain multiple comments in brackets which can't be checked by a regular grammar (Chomsky-3 type). You need at least a context free grammar for that (Chomsky-2, e.g. BNF).
Admin
No, the !HasPulse cases require the SecretIllegalOverride() method.
Admin
You are in a maze twisty of predicates, all different.
Admin
I think I just died a little inside.
Admin
Why anybody would want to do this with a regexp (see Jon, above), if indeed at all, in the first place is an exercise left for the reader.
Admin
I remember looking up some example SQL code a few days back and saw a 4 like query with 4 aggrigate functions and could count business days between any 2 dates. Although, it didn't keep track of holidays. Best part is it was small enough to memorize and type down in ~10 seconds.
Admin
Sorry, this regex is incomplete - it doesn't allow for comments, which have to be removed in preprocessing step. (yes, you can put a friggin comment anywher inside your e-mail address).
Admin
and last time I checked the O'Reilly book that has this regex, they state that it still isn't 100% for matching valid email address patterns (no regex will tell you if the account behind the address is legit).
Admin
the missed a semi-colon
Admin
That is not "the only way". That is a relatively famous computer-generated regular expression that mostly matches a string if and only if it is a valid email address.
(?:[a-z0-9!#$%&'+/=?^_
{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_
{|}~-]+)|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\[\x01-\x09\x0b\x0c\x0e-\x7f])")@(?:(?:a-z0-9?.)+a-z0-9?|[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-][a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\[\x01-\x09\x0b\x0c\x0e-\x7f])+)])Should match RFC 2822 compliant email addresses, though it wont validate the domain name or even the TLD. Its a very different but equally valid solution to the problem.
Admin
To coin a phrase, WTF? You mean there's more to coding than digging holes? NOW he tells me, thirty years on!
Oh. You mean dirt holes, not schedule or budget holes. Sowwee.
Admin
WTF!!!
and you're answering F, E...????
I can't see it clearly... maybe 5??
Admin
I challenge you to a game of trivia! Click here to battle against me online at ConQUIZtador. Let's see who's the winner... https://conquiztador.com/?a=26041