- 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
Admin
Yeah. Usually you can get it (or get very close) by doing something like
double pi = 4 * atan(1);
or whatever the equivalent is in your language of choice.
Admin
Just use (HOURS_IN_DAY - 1 - 1)/DAYS_IN_WEEK
Rik
Admin
GOOD ONE!!! HAHA!!
Admin
Pressing <enter> in the editor creates a new paragraph (thus the P -tag). <shift+enter> creates a line break (br -tag).
Paragraph1
line1
line2
Paragraph2
Admin
You can use the monte carlo method to approximate pi: Imagine a quarter of a circle, with the center at (0,0) and radius 1. Randomly pick points between (0,0) and (1,1). Count how many of the points are inside and how many outside.
After a few thousand random samples, you know how many landed inside and therefore the 'area' of the quarter circle. multiply the whole thing times 4 and use the formula for circle-area to extract PI. done.
I'm sure if you google you can find lots of sample implementations. Shouldn't be more than a few lines, but on a quick look and without PI in the variable names it just looks like lots of random numbers :P
Admin
Not to mention cpu-time needed for meaningful approximation. Hardware vendors are happy again. And you as the programmer can sleep you night well knowing you have utilised you precious cpu which otherwise would just sit useless.
Admin
Me me me! No one could ever be as smart as me! I'd like to take this opportunity to tell everyone how smart I am.
Admin
you didnt read the rest of his comment then, dickhead?
anyway... VB, VBA... all much of a muchness aren't they?
Admin
<font size="2">that was excellent, but incomplete. what we need is a function that will incorporate the last 50 daily wtfs.
(gears start turning inside brain)
</font>
Admin
Gnuplot?
Admin
There's a project management anti-pattern I like to call the DisAccess Antipattern. Through most of the 90s I dealt with it at a 20,000 user site in San Antonio. It goes something like this:
Access is a useful tool for less educated users, for people who want to get things done in a small environment. In a large organization given enough time, eventually someone will write something useful (maybe 1 in 40 database projects). Thanks to email and Lan Manager shares, use of database starts to spread and grow like a worm.
Before too long, you have a lot of users trying to manage the same Access database file concurrently over a network--and you know what that is like.
I've worked in large organizations where the IT dept was stuck in analysis paralysis for so long, these little Access nightmares started to grow and fester by the dozens. After a long period of time, when IT has no control over HR, the business ultimately put out job postings for "Access Experts" behind everyone's back and mini programming shops dotted around the organization start to appear.
Ultimately. once the Access app suffers a massive crash, gets severely corrupted or users accidentally wipe out sections of the database, the blame goes directly to the in-house IT people for all the chaos and destruction--and not listening to user's requirements and implementing or buying a solution in the first place, not to mention causing embarrasement to the CIO who is then seen by his/her peers as incompetent or inept at being able to satisfy the business... so much so that departments have taken programming work away from IT and are doing it themselves.
C'est la vie.
Admin
I recently had to OOP'ify in .NET / SQL Server 2000, some Access stuff. It kind of went like this:
Some button invokes an "Update Query". The Update Query refers to a VBA function, passing it a "Mode" parameter, which is a "smart string", where the first n characters represent one meaning, and the next m characters represent another meaning. This way, the VBA function called by the SQL can work in the number of n*m different modes.
Then inside the VBA function there is a Select Case block with a Case block for each possible combination. Each Case block was about two pages long dynamically building Strings with Left$(), Right$() Mid$(), Replace() and so forth, such that the resulting string was the name of another Update Query, which, when executed called other VBA functions that did something similar.
I spent over a week in the debugger with lots of breakpoints and Debug.Print statements, just to figure out that all it was doing was updating different blocks of recods in a table based on their status column. SHEESH!
I can definately identify with this Brian Peterson's suffering.
Peace & happy computing,
~~ vbSensei ~~
Admin
> At first this appeared brillant until I noticed that if you were a Professional VBA programmer you have not included enough job security. Making it blantantly obvious that you are comparing to Pi is too straight forward. Anyone know of a good complicated and convoluted algorithm to determine Pi?
4 * ATN(1)
Peace, & happy computing,
~~ vbSensei ~~
Admin
ATN() has been used as the name of the arctangent function in various BASICs for, oh, thirty years or more.
Sincerely,
Gene Wirchenko
Admin
Has anyone EVER used the arctangent function for any purpose other than calculating pi?
Admin
Admin
My shame is that I once wrote a VBA mini-app where the flakiest part was the print/fax/pdf output. (Well, upgraded from a small wtf to a bigger wtf; the vb half was much worse when I got it and much nicer when I was done. I need to find and submit that someday.) It was actually the most useful part. But once day I fixed a printing problem on the guy's computer by upgrading to a PCL6 driver.... aaaaand it stopped working. It was using the name of the printer directly, of course. ;_;
Would the monte carlo method work? It has the added advantage of requiring a "Wait, Calculating..." screen every update, as well as occasionally mysteriously failing. (Check whether it's within 2% of the PI constant in T22.) "Server failure. Please retype."
Damn, just noticed someone else mentioned it.
Admin
I once worked for a company that had an API that clients would call through Excel (though the smart clients would use the API in a real language). They'd create some scenario where their Excel macros would get kicked off by a Scheduled Task every few minutes and download a TON of data. They wouldn't put a single line of error handling in the damn things and then they had the nerve to complain that the API was the problem when it choked occasionally on the sheer amount of data that was being downloaded. It never ceases to amaze me what people try to do with Office applications. Scheduled Task + Excel + VBA != Production Application
The trick to escaping the VBA trap that Alex talks about is to be a competent programmer. You can write solid code in VBA if you know what you're doing. Get out of VB altogether by learning another language (Perl, C#, C++, whatever). Learning VB.NET doesn't count. Once that's done, never, EVER mention that you know anything about VBA, Excel or Office. "Excel? What's that? Is that one of those newfangled scheduling suites?"
btw, if you think Excel's object model is bad, try Word's! At least Excel is essentially coordinate based. Word is based on paragraphs, sentences, lines, words, etc. Ug.
Admin
Yeah. When screwing around with various graphics programming you use those a bit. Not just the obvious 3d stuff, but it comes in handy for image processing. Other sorts of signal processing use it a lot as well, like audio processing and such.
So don't be maligning arctan! arctan makes your life better! [:P]
arccos, on the other, is about useless. [;)]
Admin
I haven't used atan a lot, but only because atan2 is in general much preferable.
Admin
As far as I'm concerned, saying "In the original coder's defense, he was not very experienced writing VBA" is wrong. I would be more forgiving if he HAD been writing VBA for a long time... Longer for the brain-rot to set in!
Admin
<FONT style="BACKGROUND-COLOR: #d3d3d3">arccos, on the other, is about useless.</FONT>
Never had to calculate an inverse dot product?
n \dot l = |n| * |l| * arccos( \theta ), and that theta can be mighty useful!
Admin
<FONT face="Courier New" size=2>are you a fan of 'vlad! from molvania'?</FONT>
<FONT face="Courier New" size=2>like a lion kills an antelope /
like a hammer hits a catalope /
i am the anti-pope</FONT>
Admin
I bet the T8 = 5 bit is actually the year; if you look he saves the day and the month and then 5. On the cell, it is likely that T8 is formatted with a leading 0, i.e. "05" and viola, you have the day, month and year - but only for 2005!
Admin
Now I know! You are the Pushme-Pullyu from Ultima VI. "East lie beasts, so go quest west."
Admin
Cheers for that. I did try ctrl+Enter...
Obligatory comment about wtffery of forum software
Admin
<FONT face="Courier New" size=2>no. my friends call me "non-sedentary" and never find me playing some MMORPG online.</FONT>
Admin
Are you sure your friends don't call you smokey?
I'm referring to the bong and the drugs dude.
Admin
<FONT face="Courier New" size=2>"smokey's a pacifist, walter!"</FONT>
<FONT face="Courier New" size=2>let's put the matter of drug use aside for a minute here. it's always really bothered me here in america that people have a culture of anti-imagination. if a kid has a hyper-active imagination, they're either exorcised or put on ritalin, depending on the parent's persuasion. when a teenager has an active imagination, they're stuck rolling 20-sided die or arrested as a vandal for trying to spraypaint a mural. when an adult has an over-active imagination, that's the drugs talking - or she's the unmarried fruity lady with the 12 cats.</FONT>
<FONT face="Courier New" size=2>by and far, the most popular drug is alcohol: the complete anti-thesis to imagination. art classes in school? baby, please.</FONT>
<FONT face="Courier New" size=2>have you ever asked a guy in his 40s if any zany thoughts were going through his head? i get many interesting responses. people have the innate ability to use their own imagination, but they're blind to it. most of the time, they just let the tv or movies decide imagination for them.</FONT>
<FONT face="Courier New" size=2>america has me depressed in so many ways. :(</FONT>
Admin
I have little to add except that this WTF was featured the same week I got pressganged into doing work on an enormous VBA app in Word for my company. If I reread the first two paragraphcs enough times, maybe it will turn into a block of words praising the VBA app and saying what a joy it is to work on one.
... :cry:
Admin
It's moments like these, when I can't stop laughing, that I live for =D