- 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
Looks like source code for the original zune...
Admin
I absolutely love the "dayinmonth_function" definition. Find the day of the year, keep subtracting the length of the months from it, until the number is <= 31..
There are times when
just doesn't cover all your needs.
Admin
Macros are fast! Mostly because everything written in a preprocessor macro is translated into inline code. How you use them is of course up for debate.
It may just be years of experience, but stuffing recurring, trivial, space consuming, hard to read code like :
which turns out like
That's easy to read, but if it occurs 50 times in your code, i'd rather see this:
Admin
This may be the clearest requirement specification I've ever seen from a customer, even if it was written 450 years ago in a dead language. I am impressed and a bit envious. (Also, disappointed that we in the development community can still screw up the implementation.)
CAPTCHA: "mara". Which is either Hebrew for "bitter" (the life of a requirements analyst), a Scandinavian folkloric wraith which causes nightmares (like most customers), or a large mammal related to a guinea pig (which is how our developers feel).
Admin
Admin
Actually it's quite easy to fix; the solution's even in the damn code; just pass in Feblength which should be determined by something like
IF (Year mod 4) = 0 Then //I'm substituting mod for whatever your desired modulus or "remainder" operator is. {FEBLENGTH = 29} Else {FEBLENGTH = 28}
Or did the original programmer miss that in highschool?
Now that said I'm sure there's a less messy way to implement that but, um, yeah.
Also; please don't shoot me; I've been doing IT work for the last 3 years instead of programming like I was taught in college.
Admin
I won't shoot if you promise not to ever implement any version of that algorithim, because the leap rule is much more arcane than that. It's on a 4, 100, and 400 year cycle.
bLeap = Not (iYear Mod 400) Or ((iYear Mod 100) And Not (iYear Mod 4))
Admin
...and then the next guy taking over your code for some reason needs to call x = NEXTVAL(x, y, j+1, z); and will get a nice lesson in using a debugger. Unless he's been burned by this before and before using a macro checks that all parameters are really protected as they should be.
Admin
Admin
T
Which is exactly why a site such as this exists :)
Admin
cialis cause hiccups buy generic cialis
Admin
cialis poveikis cialis professional cheap
Admin
pharmacie en ligne avec ordonnance http://kamagraenligne.com/# п»їpharmacie en ligne france