Code Snippet of the Day - self-submissions for code snippets that shouldn't really exist.
304
Topics
11697
Posts
@izzion said in Visual Studio WTfs:
I wouldn't want to be on either side of the bet that Framework 4.8 is going to be available in Windows 12.
I can fairly confidently bet that it won’t be; if it ships with the OS it’ll be 4.8.1 or later.
(It will be… interesting… if they put .NET Framework 4.x on the standalone-component train like 3.5 but not the VB6 runtime.)
Error'd - features fun error messages and other visual oddities from the world of IT.
468
Topics
11404
Posts
Dropbox...
Then why did you try to open a preview for it? I just wanted to upload a file. Period. Full stop. And then I move on with my life. Absolutely nobody asked you to try and open a file that was never meant for any kind of human consumption whatsoever.
TL;DR: Dropbox decided to try and preview any and all files you drop into the WebUI from now on.
@djork said:Let's say our company writes software dealing in running a farmer's market, for anonymization purposes. You have farmers, farms, and stalls. The stalls at the market have numbers. Now let's say I want to go ahead and get the stall number for a particular individual farmer selling at this market. Considering these objects are all fairly common in our framework, you'd figure it would be a simple matter to get this number. No. After consulting with peers and spending a bit of time "engineering" a "solution" to this "business problem" the code looks like this (and yes, it's as simple as possible): int FarmID = Farmer.FarmID;
if (FarmID != 0) {
FarmController Controller = new FarmController();
IFarm[] FarmList;
IFarm SearchFarm = FarmersMarketClassFactory.CreateFarm();
SearchFarm.FarmID = FarmID;
Controller.SelectFarm(SearchFarm, out FarmList);
if (FarmList != null && FarmList.Length > 0)
{
StallNumberTextBox.Text = FarmList[0].StallNumber;
}
}
Could you make this any more enterprisey?
I certainly have had ideas on how to make this less enterprisey (Farmer.Farm.StallNumber properties, anyone?)... but I don't think I could go the opposite direction without a lot of effort.
Somewhere you have fallen off the road of good intentions, if you are running a farmers market you have a market of stalls, each stall is asigned to a farm, who has a farmer. Not sure why you would check if the length is greater than 0 then only return the first element, this lets bugs hide out undetected. Then you have GUI mixed in with logic, never very swift ... A factory should be assigning the stall ID to the farms when it creates them and I beleve you are creating a blank farm setting its farm ID and then pass it to a controller, which sends the same thing back to the FarmList. You are tyring to find the stall given the Farmers ID that's it, this value should be passed back not set to a text box value. It could be something as simple as
Enumeration/Iterator marketList = Market.enumeration/list/etc
while(marketList.has some more items) {
get the stall's Farm
get the Farm's Farmer ID
if(found) return that ID
}
of course ... this should most liekly jsut be SQL
SELECT Stall_id from Stall, Farm, Farmer WHERE Farmer.ID = FarmerID and Farmer.FarmID = Farm.FarmID AND Farm.ID = Stall.FarmID
It's funny... stuff like this gets declassified or leaked relatively frequently these days, and there are still people who doubt conspiracy theories. (No, I don't believe them all, but you've got to have better reasons to disbelieve than "that doesn't happen" because clearly it [i]does[/i] happen.)The CIA was willing to cause a huge explosion located at random. Depending on location, hundreds or thousands of people, maybe even tens of thousands if circumstances were right, could have been killed as a result. These people would have been innocent -- had nothing to do with the espionage or the decision to pump gas, but they would have died anyway. Which leads to the question "how many allies, or even U.S. citizens, would the CIA (and by extension the U.S. government) be willing to sacrifice to achieve its goals?" Clearly, the answer [url=http://www.commondreams.org/headlines02/0524-06.htm]is[/url] [url=http://stinet.dtic.mil/oai/oai?&verb=getRecord&metadataPrefix=html&identifier=ADA291587]not[/url] [url= http://en.wikipedia.org/wiki/Project_MKULTRA]reassuring[/url].
It seems like a WTF needs to have a certain connotation that the originator actually thought they were doing it right. This is pretty clearly somebody's last ditch effort to solve a problem... Of course I've written plenty of code under similar circumstances. I know it's crap, but people in the future wont always know that I knew it's crap. I guess some of the WTF code I've found was known to be a hack at the time it was written?
@Saladin said:...If I'm looking at the product page for a PS3, the last thing I probably care about would be that the processor was jointly devleoped by IBM or that the XDR memory was developed by Rambus.Sony doesn't have much else to sell you on other than impressive technical specs. Call of Duty and RFOM do not a console make. Although they do highlight the Blue-Ray playback support, which is primarily why we bought one (cheapest HD-format player on the market at the time)
My guess is that the person designing the queries couldn't figure out how to limit the number of records returned for whatever vendor he was using and so found some obscure JOIN that would do it for him, in conjunction with that table. So like WITH cte AS (SELECT 99 as qty, table.rowtoprint FROM table ORDER BY rowtoprint ASC) SELECT * FROM quantity LEFT JOIN cte ON quantity.qty=cte.qty WHERE quantity.qty=99Or something along those lines, instead of say SELECT * FROM table WHERE rownum < 100 for Oracle orSELECT TOP 100 rowtoprint FROM table
@joblini said:@GoatCheez said:@joblini said:Open the .dmp with C++, then start debug, but VC++ complains about the dump file format.I really want to know what you honestly thought would happen when you did this. What did you expect? This sticks out at me as being far more WTFy than anything else in the post. Allow me to quote from the MSDN site, the article can be found at http://msdn2.microsoft.com/en-us/library/bb204861.aspxAnalysis of a minidump Opening a minidump for analysis is as easy as creating one. Open Visual StudioSelect File->Open->ProjectSelect the minidump fileRun the debugger The debugger will create a simulated process. The simulated process will be halted at the instruction that caused the crash.<snip/> You can also use the Windows Debugging Tools to debug a minidump.
WinDbg is a debugger that comes with the Windows Debugging Tool set.
WinDbg allows a developer or tester to debug without having to use
Visual Studio.I just got served lol. It's a good thing though, as I had no idea such a nifty and useful thing could be done.
@dhromed said:@Einsidler said:http://youtube.com/get_video?video_id=gNqiSkd1M6k&t=OEgsToPDskJK3hApP5UYqmr56vaxCQ3l&sk=y6uaBQDsCwpxDB64juPIhQR instead of http://youtube.com/get_video?video_id=gNqiSkd1M6k&t=OEgsToPDskJbPZkCJIKljr7Gp9jDI2Mu&sk=y6uaBQDsCwpxDB64juPIhQR when used in ietabInteresting.Maybe that's salt based on the user agent. http://www.youtube.com/get_video?video_id=gNqiSkd1M6k&t=OEgsToPDskLUKow50QwlWF1J1Myv3Wnw - in my case - I don't know what "sk" is, but it doesn't matter for youtube really. t is time-based hash.It will just redirect you to nearest mirror - you can drop the t param there: http://chi-v198.chi.youtube.com/get_video?video_id=gNqiSkd1M6k
@pauluskc said:Even better, spend $349 and get all M$ software for one low price. Anyone need ten licenses of O2K7 Enterprise, 10 licenses of Vista Business, 10 licenses of Visio 2K7 and more? Direct from the horses mouth:
https://partner.microsoft.com/40016455
Woo-hoo!!
January kit contents: https://partner.microsoft.com/40013779
Nice!!
Yeah, but do they supply debs? I get a bit tired of compiling everything from source...
@Grauenwolf said:@tster said:There is no reason that (provided the exact schema is known) you couldn't perform random access into an XML file.
It would be kind of complex, but it would make it really easy to view and manipulate the database. Now if the database did something stupid like storing the number 32 as the char '3' followed by the char '2', that would be a WTF.
Also you have to disallow the <Tag/> notation for an empty value.
That is the stupidest thing I've heard all week. Of course the database would store the number as the string "23", that is the XML standard. Likewise the use of self-closing tags. What would you have them do, leave a buch of padding in case some values would need to be inserted. <Tag > </Tag>. I understand that my scheme on how to do this is not proper XML. I also understand that it would not be human readable or editable (for the most part). However, it could be done. And yes I would leave padding in case something needed to be added in later. However the padding would not be spaces, it would be a bunch of ascii '\0' characters written to the file. I didn't mean to imply that this was a good idea or should be attempted. I was just pointing out that random access was achievable using something very close to XML. Basically the space between tags would be binary data converted to ASCII characters...
@mattwho said:"The pen is blue, the pen is blue, the goddamn pen is blue!"
This just gave me a brilliant idea. An all new software package on a CD for $19.95 at your local <name_of_useless_idiotware_outlet/> called "Website Trimmer Fantasic!(tm)"
What it does is reads in a WYSIWYG page/site and converts it to a list of human readable instructions so that the author can follow the instructions and see how soon they get bored with following them.
eg.
Pick up the blue pen.
Pick up the blue pen and get ready to write in big letters.
Pick up the blue pen.
(etc)
They follow each instruction carefully, enter the time it took them to get really bored into the special "Optimized Method Factor Grading(tm)" tool, hand optimize the code and run it through the tool again. Each time they have follow the new instructions and enter the time it took before they get really bored, they get a new Optimized Method Factor Grading(tm).
Once they get a suitably high Optimized Method Factor Grading(tm), say in the order of 368 billion, their web site is ready to publish without any further checking. Website Trimmer Fantasic!(tm) would then search their computer and their hosting server for copies of the original version and overwrite them with the optimized one! Without even need the user to press a "Yes, I'm sure" button!!!
This would have the double advantage of reducing the size of a whole raft of WYSIWYG sites to a few hundred bites that gets rendered as unintelligible guff, reducing the bandwidth wasted on them and making them easier to spot PLUS making a crap load of cash off suckers.
@RevEng said:In that case, be sure to embed some inline <script> and <img> tags for the "postmaster" who receives your submission in his email. :)
Hrm... img == goatse?
Guarantee they'll be fixing said file the day the postmaster opens that sucker up in his inbox. *hee*
Seejay
@Pap said:@newfweiler said:Rhode Island is often used too, usually multiplied. A particular country or region is said to be "10 times the size of Rhode Island." This is particularly odd. Most people don't have much of a sense of the actual size of Rhode Island. It's the smallest state in the U.S. but how much smaller is it than Delaware, for instance, or Hawaii? Or is Hawaii really smaller? Rhode Island has that big crack running up the middle so it's a lot smaller than its bounding rectangle. How big would it be if it were pushed into a rectangular shape? How big would Hawaii be if all eight islands were pushed into a rectangle? The land area of Rhode Island is approximately 3 times the total area of New Orleans, and approximately 3 times the land area of Dallas. How all the islands of Hawaii rank when put together:US Rank | State | Land Area Sq Miles46 New Jersey 7,41747 Hawaii 6,42348 Connecticut 4,84549 Delaware 1,95450 Rhode Island 1,045I guess you could say Hawaii DWARFS Rhode Island in size!
Or to put it another way, you could fit six Rhode Islands onto Hawaii (which is something newspapers like to do in their illustrations, putting Iraq on top of Texas or something). Could you put one on top of each of the six biggest islands, or do you put two or three onto the big island?
I've been to Rhode Island and it's big. it has a lot of cities and towns and it takes about an hour to drive from Woonsocket to Westerly. I find it hard to picture the size of a city 1/3 the size of Rhode Island -- a city big enough to swallow Providence, Cranston, Warwick, Woonsocket and everything in between. Even if it takes only 1000 Airbuses joined nose to tail to stretch from Woonsocket to Westerly. Or if each Airbus requires a 300 ft by 300 ft parking place, you could park 323,000 in Rhode Island and only 107,000 in New Orleans.
@gpitou said:You dilettante types are a hoot. Instead of participating in the spirit of the blog with an open mind, you bring all the prejudices and empty rhetoric consistent with your small-minded world view. Statements like yours make me think you're the kind 'developers' that turn a 2 month project into a 9 month fiasco.
An open mind, curiosity and the willingness to say 'I don't know but I'll find out' are all attributes of intelligent people, attributes which show up in the blog in question. I can't say that for most of the comments about it.
This has to be auto-generated text.
@archivator said:You're all wrong! A true Christian would use [url=http://www.whatwouldjesusdownload.com/christianubuntu/2006/07/about-ubuntu-christian-edition.html]Ubuntu Chrisian Edition[/url]! The Real WTF of course is the name of the website: whatwouldjesusdownload.com. Here's a quick answer for you: nothing! I don't think they had the IP protocol back then. They might have had [url=http://www.faqs.org/rfcs/rfc1149.html]IP datagrams on avian carriers[/url], though.</attempt_at_a_clever_joke>It's probably just Ubuntu but without the daemons.
@Kyanar said:What, the haphazard replacement of "str" with "buf"? Find and replace again me thinks. Although I find it more likely, this example was typoed and it was meant to be "// override the foo done in the conbufor" - as I don't recall "str" being a valid C++ identifier but I know struct is.I think the function was initially "int foo(char *str)" and someone wanted to change the parameter's name to buf, and did a replace, changing constructor to conbufuctor.Being perpetually 12 years old, I find conbufuctor to be an inherently funny word.
@AssimilatedByBorg said:@operagost said:USAian? Is that like a UKian? A far more accurate, if grammatically abhorrent, short version of "citizen of the United States of America" than the typical meaning of the word, "American".
Only a USAian can lay claim to the word, "American"? Next thing you know, the yanks are going to start thinking that Columbus discovered their country.
(ha ha only serious)Well, true he didn't discover the land we currently call the United States of America, and I'm well aware that he wasn't the first to discover lands west of Europe, but in a practical sense the existence of the Americas at large were the result of his discoveries - any subsequent explorers owed him a debt for having found the explorable territories - and it made a difference to formal Science and to the world geopolitical scene like no other prior discoveries ever did. As such, I've found most jabs against Columbus to be perhaps technically correct, but overblown in and of themselves as well.I guess the real WTF is an artifact of the way they teach things in elementary schools, though.Want another WTF? My local economic historian assures me that the much-vaunted Triangular Trade they teach you of in middle/high school is about 95% bogus. But it's a neatly packaged concept, and since when have schools been about facts, anyway? :)
I've got my share of stupid user / IT colleague stories as well. Along time ago, I was working in a small 3 man IT Dept. Part of my duties was a helpdesk/technician and I got a call from one of the worker on the plant floor. The worker told me that the PC wasn't working. The conversation went something like this:Me: What do you mean the PC isn't working?Worker: The screen is blank.Me: Is the monitor connected to the PC?Worker: Yes.Me: Is the monitor plugged in?Worker: YesMe: Is there the light on the monitor on?Worker: No, the fuse just blew so there is no power back here.Me: Call the maintenance department. If the PC doesn't start after they fix the fuse, let me know.I really hope the worker wasn't that stupid expecting to magically replace the fuse over the phone, but my faith in humanity isn't that high.
@Saladin said:Next, we'll see:
"The Windows password you entered is incorrect. Now logging you in as Administrator so you can reset your password..."Didn't Microsoft Bob do something like that? After three login failures, it would let you reset your password?
@Jojosh_the_Pi said:Note that CNN was kind enough not to say, "John Smith, a 32-year-old computer technician, accidentally deleted..."
This is So-and-So from CNN-Live, at the home of John Smith, 123 Wtf Drive, Screwup, USA, phone (111) wtf-1111, a 32-year old computer "technician", accidentally...
@m0ffx said:I hate stupid farts like that. Or the site that has the following in its T%C's:You may not create a link to this website from another website or document without (URL)’s prior written consent.The URL contains the words 'beans', 'com', 'student' and '.', in some order ;) I remember a few years ago NPR tried to do the same thing.
If you do what I do, and miss the part about it being a pilot, then this is pretty funny. I thought it was just some guy, possibly a janitor, who showed up drunk, and for some reason they cared about the legal limit for flying a plane. THAT would be a WTF :)
@pauluskc said:@fennec said:@webzter said:@KattMan said:Wait, we have a tag cloud? Where? Who is the collective "we"?WHEEEEE! Want to play! Look on the side of each forum, there's a tag cloud. Promote different tags in your message to help construct hilarious resultsI invite you to join me in tagging posts ☕ (for chill-out comments) and stuff like ☠ or such for the deadly issues (also consider ☢ and ☣ perhaps?)either it's me or this stupid IE/MS software - but all I see are boxes. Which are hilarious in their own right here. :)I believe they're UTF-8 encoded Unicode - Use a proper browser/operating system :D
@GeneWitch said:@Cap'n Steve said:I'm sure the project has a nice goal, but whenever I've heard anyone describe it, it sounds pretty scary. They basically want to "take over" an entire state. What about the poor bastards currently living there because they [i]like[/i] the way it's run?
It's not really a take over. although when you describe it properly, the only idiom i can think of is "you gotta break some eggs to make an omelet."
I dunno, i'm mostly moving cause my friends are, and i don't like california, and i can't imagine living in the south for that long, so NH it is. :-)
I've been described as extremely liberal, and also tonight i was summed up as an anarcho-socialist.
Just to let you know, New Hampshire is becoming a suburb of Massachusetts. In 1996 "Buchanan for President" signs were everywhere. By 2004 they were John Kerry signs.
@nickfitz said:@HeroreV said:@mattwho said:Of course this was fixed with
theYear = today.getYear();ECMA-262 specifies that getYear() should return the number of years since 1900. Although Internet Explorer doesn't comply, Opera and Firefox do, so the code is still broken. The code aquanight posted works around this problem.The code aquanight posted solves the wrong problem. The real WTF is that getYear() is deprecated (and has been since about 1997), and getFullYear() should be used instead.Correct. Forget getYear. only use getFullYear. I'm not sure in what situation a two-digit year is useful -- especially since we still live near the millennium turn.Assuming javascript is sane and casts boolean true/false to integer 1/0 nicely (as opposed to VB's -1/0)Correct.Essay Answers!The sanity of implicitly casting a real, existing number to boolean is debatable. I'd prefer that if (0) { print "pass"; } would pass, because 0 exists, but an explicit (bool) 0; would create false. Because the thing is, sometimes 0 is a valid, informative value for a variable, and you only want the null value to fail the if.But perhaps that's largely academic, because a var that should contain a real number (such as a loopCount or priceMultiplier) should also, by proper program design, never contain null, and never exist alone in a cold if check.
@AI0867 said:what I'm guessing is that the results of this query were being used in two different languages, one having one-indexed arrays, the other (which the programmer never really learned), having zero-indexed arrays. The second column is simply a way to make result[1] return the right result.That's just about WTFish enough to be true!
I still think you're trolling, but how about these points:1. Smoking is not a natural bodily function.2. The average smoker probably emits 100 times as much pollution as the average farter.3. I'm no doctor, but I don't think you'll get cancer from smelling farts.
the real WTF is that you are supporting those money-grubbing anus eaters and not going straight to the outlet to buy the tickets and save yourself significant cash. LAZY PROGRAMMERS!!!!
:)
The Real WTF (TM) is that in the midst of pointing out the problem (no explanation, link to blog main page instead of entry), nobody has actually done anything about the problem. So, without further ado:
Fun little screenshot of an XP WTF (although some might argue that "XP WTF" is redundant). Possible fodder for Error'd?
Could you please stop changing the URLs in the RSS feed? It makes every post show up twice in my RSS reader. The last round changedhttp://forums.thedailywtf.com/forums/thread/*.aspxtohttp://forums.worsethanfailure.com/forums/thread/*.aspxbut only up to Vista Issue: Windows Defender "reinstall". The newer posts all point tohttp://forums.thedailywtf.com/forums/thread/*.aspxagain. Guess I'll soon have some more duplicates. This has been going on for some time now. Why the f... do you keep using the old domain for new posts if you are going to change it in a few days anyway? --phipps (I signed up to post this. And now I see why posters keep grumbling about the forum UI.)
Besides the obviously awful design, at least they're making an attempt to train employees on proper usage. I mean, I'm sure that they're going to have the same problems as untrained employees have, but even if it's just a tiny bit less likely that they'll run that "postcard.exe" attachment, then maybe it was worth it.
@GeneWitch said: Beryl, ubuntu, XGL for the win. now if only steam, EALink, and wow would run!WTF is compiz? i keep hearing about it. someday i'll look it up.Yeah, I use Beryl as well :)I've got some screenshots of mine (screenshots are a bit old, I've changed some stuff since then):And a screenshot of XWinWrap combined with the GLMatrix screensaver :D[UserJS ExtraLinks Img] Screenshot.png[UserJS ExtraLinks Img] Screenshot-12.png[UserJS ExtraLinks Img] Screenshot-4.png[UserJS ExtraLinks Img] Screenshot-5.png[UserJS ExtraLinks Img] snow.png[UserJS ExtraLinks Img] matrix2.png
@Carnildo said:Public-key encryption is so slow that nobody actually does this. What actually happens is something like this:Me: Generate a symmetric-encryption key. Use that to encrypt the message. Encrypt the symmetric-encryption key using your public key. Send both the encrypted key and the encrypted message to you.You: Decrypt the symmetric key using your private key. Use the symmetric key to decrypt the message.If you've got a reply:You: Encrypt the reply using the symmetric key. Send the encrypted reply to me.Me: Decrypt the reply with the symmetric key I already know.Even that is not what usually happens in SSL/TLS sessions. They begin with a Diffie-Helman handshake - this is a bizarre mathematical process by which two mathematicians (with no prior communication or secure channels) can each shout one large number across a crowded room, and after some computation they both know a shared secret that nobody else in the room can work out. That secret is used as a symmetric key, and then the certificates are used purely in signing mode to authenticate the hosts.This method is used because it makes the certificate authentication optional - you can use https with no certificates at all, and still be secure from eavesdropping (although not from man-in-the-middle attacks). It also has the advantage of providing "perfect forward secrecy": if the private key for the certificate is stolen, the attacker still cannot decrypt anything unless they perform a man-in-the-middle attack, so any sessions that happened before the certificate was stolen are still secure.The method you describe is commonly used for other purposes, such as pgp (and SSL/TLS do actually support it, primarily for compatibility), but it's not what usually happens for https.(The bit about using symmetric encryption for all the real data is still true though. Diffie-Helman is just a really perverse form of public-key encryption, so it's as slow as all the others)
@shadowman said:@marvin_rabbit said:To see if you do have a functional Anti-Virus, go to this page:Windows defender is anti-spyware software, not an anti-virus program. Having said that, it may still detect the EICAR file, but I'm not certain. There is a similar one called "Spycar" which is aimed at spyware solutions.Oops, thanks for straightening me out!I wasn't really familiar with 'Defender' (obviously!). Someone in the thread mentioned a/v, and I had basically only used the AVG Anti-Virus, not anti-spyware.So with my three shortcomings, I jumped to the wrong conclusion.Oh well... I've made worse errors.
It's not just governments, some corporations are sufficiently schizoid to do it. Sony in particular is notorious for frequently having one division of the company suing another.
@MasterPlanSoftware said:GAHHHHH!!! When is it gonna be MY turn to see the goddamn sailboat!!
[5 points to anyone else who know where that came from...]Oh come on! Maybe it's just because I've seen it like 10 times (like all of Smith's other movies), but I thought that was pretty obvious! :) *Hoards 5 points*
When i was younger i worked at burger king usually in the drivethrough counter. A customer made me extremely furious through the intercom and i repeatedly slammed my fists on the cash drawer, which happend to reset the Windows Based thin client that we took orders through and produced a BSOD, effectivly shutting down the Drive Through at peak lunch rush. ...I got to take orders by hand......With a very POed Store manager bagging my orders... fun.
@GettinSadda said:@RayS said:BTW, you can't meaningfully "double" temperatures. :-) Yes you can - 50K is twice as hot as 25K I meant not in C/F. Yes you can double Kelvins.
@Corona688 said:Stop doublespacing everything. Let me write!
In most WYSIWYG HTML editors you find on forum and blog software, Enter is a paragraph break and Shift+Enter is a line break. So a bare enter looks like
this, while shift+enter looks likethis.
Tribal knowledge. Ought to be documented somewhere, but apparently isn't.