-Поиск по дневнику

Поиск сообщений в rss_thedaily_wtf

 -Подписка по e-mail

 

 -Постоянные читатели

 -Статистика

Статистика LiveInternet.ru: показано количество хитов и посетителей
Создан: 06.04.2008
Записей:
Комментариев:
Написано: 0

The Daily WTF





Curious Perversions in Information Technology


Добавить любой RSS - источник (включая журнал LiveJournal) в свою ленту друзей вы можете на странице синдикации.

Исходная информация - http://thedailywtf.com/.
Данный дневник сформирован из открытого RSS-источника по адресу http://syndication.thedailywtf.com/thedailywtf, и дополняется в соответствии с дополнением данного источника. Он может не соответствовать содержимому оригинальной страницы. Трансляция создана автоматически по запросу читателей этой RSS ленты.
По всем вопросам о работе данного сервиса обращаться со страницы контактной информации.

[Обновить трансляцию]

We're Not Gonna Pay It..Anymore

Понедельник, 26 Января 2015 г. 14:30 + в цитатник

TWISTED SISTER!! DEE SNYDER!!!!In the world of software development, you have customers, who request and ultimately use the software, and development organizations, who build and test said software. Of course, it's never that simple. At some point, the customer has to try using the software in order to sign off on it.

At least in a sane business arrangement. Sometimes, things get all twisted around.

TS found himself in the middle of a mind-bending dispute with a client.

You see, the client provided specifications as to what the software should do. TS' developers built the software to do exactly that. Afterward, the developers and QA folks did assorted rounds of testing. The package was then provided to the client so that they could do UAT. If all was well, the product would be deployed for general use.

This normalcy continued for several releases of the product.

Until...

One day, after invoicing the client for the work. the client responds with a check, and an invoice of their own for the time they put in to perform UAT on the software!

Wait, wha? TS called the client and inquired WTF they were talking about. After all, who accepts custom software without at least making sure it does what it was requested to do? The conversation left TS befuddled...

  TS:  Why are you billing us for acceptance testing? Only the customer can accept
       the software!
  Clt: It's taking us all kinds of time to verify your software does what we requested
  TS:  We do testing too, but ultimately you need to verify we did our jobs properly 
  Clt: Irrelevant: if we have to put in this much time to verify that your software
       works properly, then we should be reimbursed
  TS:  Wait, let me get The Big Boss in on this...

At this point, TS sent an email to The Big Boss with the subject:

   Urgent: Client wants to bill us for time they spent doing UAT

Needless to say, The Big Boss was equally befuddled, and set up a call with the customer.

  TS:  Client, this is The Big Boss, Big Boss, this is the Client...
  TBB: I understand you want to bill us for time you spend doing UAT?
  Clt: That's right; it's taking a lot of our time. The software should just work!
       We have been paying the cost of doing this testing since the inception of this
       contract and feel that we shouldn't pay for it any more!
  TBB: Ok, no problem. We will no longer ask you to do UAT, as long as you agree,
       in writing, that you'll accept our testing as sufficient and definitive;
       Any issues that crop up will be considered changes and/or enhancements and will
       be billed accordingly
  Clt: Unacceptable! We need to make sure your software works before we will accept it
  TBB: That is responsible thinking. Of course, it's also your responsibility, which is
       why we will not pay you to do it

This went around and around for a while until the client finally saw the light and rescinded the invoice.

[Advertisement] Use NuGet or npm? Check out ProGet, the easy-to-use package repository that lets you host and manage your own personal or enterprise-wide NuGet feeds and npm repositories. It's got an impressively-featured free edition, too!

http://thedailywtf.com/articles/we-re-not-gonna-pay-it-anymore


Метки:  

Error'd: Flying is Easier than Math

Пятница, 23 Января 2015 г. 14:00 + в цитатник

"I travel a lot for work and watch my 'premier (elite) qualification' with United fairly closely," writes Lincoln, "Imagine my surprise when I was looking at my account and United was showing 4,100 qualifying segments as my beginning balance. Sadly, like many aspects of the new United, 4100 plus 37 equals....78."

"Hmmm...I wonder if my eStatement is really ready though?" writes Dave T.

Gabriel wrote, "Gotta love strings...especially those that shouldn't happen."

"I don't care what anybody says. I think Ram-square-root-greater-than-or-equal-to-n is a great name for a baby boy!" writes Danny B.

"I wanted to know how to import settings into the new release of Opera. I didn't get an answer, but I'm comforted that Opera understands recursion, I suppose,"Rob H. writes.

"The Norwegian newspaper Osloby (Oslo city) have a webpage where you can submit stuff you want Oslo city to fix, like faulty street lights and so on... but when you try to use the web page (fiksdette.osloby.no) with Internet Explorer...," Philip O. wrote.

"Hmmm...I'm not a mechanic but I think that the bus needs a reboot," writes Marco.

Honestly, I'm surprised that Jack N.'s submission from League of Legends didn't result in a division by null error.

[Advertisement] Use NuGet or npm? Check out ProGet, the easy-to-use package repository that lets you host and manage your own personal or enterprise-wide NuGet feeds and npm repositories. It's got an impressively-featured free edition, too!

http://thedailywtf.com/articles/flying-is-easier-than-math


Метки:  

CodeSOD: Backwards Interview

Четверг, 22 Января 2015 г. 14:00 + в цитатник

There are a lot of different schools of thought on administering programming tests to new hires. On one hand, youre hiring them to program, so it might be nice to see if they can actually do it. On the other hand, given the time constraints of most interviews , its nearly impossible to give them a meaningful test.

Rot a renegade, wed a generator

From that conflict grows tests like FizzBuzz. Greg Qs company uses the old reverse a string method. Neither of these is a good test of an experienced programmer, but its a quick way to weed out the worst incompetents.

Like, for example, this applicant for a Senior Developer position:

private void button1_Click(object sender, EventArgs e)
{
        string a = "A";
        string b = "B";
        string c = "C";
        string d = "D";
        string f = "E";

        MessageBox.Show(a + ", " + b + ", " + c + ", " + d + ", " + f + ", \n"
                + f + ", " + d + ", " + c + ", " + b + ", " + a);
        }
}
[Advertisement] Use NuGet or npm? Check out ProGet, the easy-to-use package repository that lets you host and manage your own personal or enterprise-wide NuGet feeds and npm repositories. It's got an impressively-featured free edition, too!

http://thedailywtf.com/articles/backwards-interview


Метки:  

FAP it Good

Среда, 21 Января 2015 г. 14:30 + в цитатник

Francis was at the start of what was sure to be a challenging and rewarding journey towards a degree in Computer Science. One of his first classes was a group study course built around cross-departmental education. It forced together a Business major named Suzanna to play the role of Project Manager, Francis and Carlos, another CS student, as developers, and a Music major named Johann, as a tester. Assignments and interaction with the instructor were all online, but the group met in person to work on their project.

The parameters were simple: over a semester, the group would develop a fully functional Public Administration website for a fake city to allow its fake citizens to pay their fake utility bills with fake money. The biggest wrinkle was that they had to use a home-grown application framework the professor built called the Framework Application Provider, or FAP. FAP was supposed to be easy to get a handle on, and would allow n00bs like Francis to easily crank out whatever they wanted, whenever they wanted. The problem was that FAP was actually a big, sticky mess.

Francis instructor, Doctor Wacker, forced them to buy FAP licenses as part of their course materials, which promised extensive documentation and demos for all things FAP. This extensive documentation took the form of a single tutorial video on creating a FAP object which had all the quality of a scrambled cable TV channel, circa 1996.

Francis tried emailing Doctor Wacker about the lack of assistance, and got no response for two weeks. When a response arrived, it was a brief, You shouldnt need me to hold your hand! FAP is so easy to use, it practically does everything for you! I expect a working demo by mid-terms. While Suzanna typed away at dull requirements documents, Francis and his fellow programmer were left to dig through the FAP source and try and understand it with their limited experience.

I dont even… Francis said. He tried to run his sample programming inside of FAP. Im sure I understand the syntax, but these functions dont do what theyre supposed to do.

Oh, I know, Carlos said. You know commitDataChanges? It opens a print dialog.

Doctor Wacker is a real jerk.

As the semester wore on, Francis and Carlos beat FAP around and eventually figured out how to get FAP to turn input into output that wasnt total garbage. Their progress wasnt much: a login page and a basic account page. Bill Pay was just a fantasy. The week before the demo was due, they handed it off to their tester Johann, who was so busy tuning his g-string that he couldnt be troubled to show up for their group meetings.

Francis and Carlos emailed a URL to Johann with explicit instructions on how to access their demo site and test it. Ten minutes later, he surprised them with a works fine response. Clearly, Johann hadnt tested anything, because works fine would never have been uttered by anyone who actually used the site.

Suzanna set up a meeting for Francis and Carlos to submit their mid-term demo to Doctor Wacker, along with her carefully handcrafted requirements. She insisted they read them over first. The requirements were 200 pages of promises of functionality that would never be delivered and werent close to what the program actually did. Francis and Carlos were just learning to be developers, but Suzanna had already mastered the fine art of project management.

Whatever, Francis muttered to Carlos. I dont give a FAP anymore. Lets turn this in and spend the rest of the semester to polish it up. Off it went to the professor, requirements bible and all, to be judged.

Two weeks later, the group received feedback. Off to a good start! This really shows the power of what FAP can do for you! B+ work. Add in all the features listed in the requirements, and it becomes an A for your final.

Suzanna took Wackers response as a mandate that her requirements document was golden, and now it was only up to her developers to make it happen. Francis and Carlos knew that it wasnt going to happen, so they spent the rest of the semester hacking away at FAP and whacking out the handful of requirements they could meet from the list. What they wound up with was exactly what they set out to make- a website where John Fakington could create an account and pay any bills associated with his account number. It wasnt pretty, but it worked.

Doctor Wacker wasnt pleased. Upon receiving the final project, he called it, sloppy and an embarrassment to FAP. Suzanna screamed at them over the grade, Johann complained that "C is such a dull key," but Francis and Carlos were perfectly happy to live with the C- they got, only because it meant they were done with FAP forever. At least until they registered for their next semester. The university had rolled out a new registration website with online payments, that allowed any student to create an account and pay any outstanding bills with their account number. It wasnt pretty, but it worked.

At the bottom was a prominent banner, Powered by Doctor Wackers FAP. Wacker happily stole their work to stroke his own ego, and it left a bitter taste in their mouths.

Image from Batman: Beyond

[Advertisement] Release! is a light card game about software and the people who make it. Order the massive, 338-card Kickstarter Edition (which includes The Daily Wtf Anti-patterns expansion) for only $27, shipped!

http://thedailywtf.com/articles/fap-it-good


Метки:  

CodeSOD: Images...Why Settle for Just One?

Вторник, 20 Января 2015 г. 14:00 + в цитатник

Grab a handful...you know you want to!We've all seen folks who have trouble dealing with for-switch statements, exception handling, dates/times and so forth. As such, it should come as no surprise that people have at least as much trouble dealing with images.

In practice, there are only so many things you can do with an image. You can load it from a file or URL. You can calculate its size. You can stuff it into some buffer. You can even display it in a variety of ways. As long as you have a graphics library handy, one would think that these things would be fairly straightforward tasks.

One would think.

Thomas works on a system that extracts images from a PDF, uses a third-party product to process them, and them puts the processed images back into the original PDF.

Of the many tasks involved in this process, he encountered two that stuck out as particularly well-designed...

First is the complex task of determining the number of bytes in an image. While:

  return Imgbyte.Length;

...would make most people happy, the author of this ingenuity decided that a whole lot more was required:

private static int GetPhysicalFileSize(byte[] Imgbyte, string InputObject, string OutFolder) {
  int PhysicalFileSize = 0;
  try {
      ExtractImage(Imgbyte, "Photo_" + InputObject + ".jpg", OutFolder);
      var Outfile = OutFolder + "\\Photo_" + InputObject + ".jpg";
      if (File.Exists(Outfile)) {
         FileInfo fi2 = new FileInfo(Outfile);
         PhysicalFileSize = (int)fi2.Length;
      }
      if (File.Exists(Outfile)) {
         File.Delete(Outfile);
      }
  } catch (Exception ex) {
    Trace.WriteError(ex);
  }
  return PhysicalFileSize;
}

Of course, When this developer went to actually process the image, he went a little bit further off the deep end, and passed an image by ref, copied it into another bitmap, read it into a memory stream, saved it on disk, and then copied it into a byte array...

private static byte[] ProcessImage(Bitmap bm, int Imageid, out bool processResult) {
  byte[] bmpBytes = null;
  // [snip]
  EncoderParameters eps = new EncoderParameters(1);
  eps.Param[0] = new EncoderParameter(Encoder.Quality, Config.CompressionRatio);
  var jpegCodecInfo = GetEncoderInfo("image/jpeg");
  try {
      using (Bitmap bmp = new Bitmap(bm)) {
        using (MemoryStream ms = new MemoryStream()) {
          bmp.Save(ms, jpegCodecInfo, eps);
          if (Config.ImplementEnhancedImage) {
             bmp.Save(Config.TempImageProcessing + 
                      "\\Output from Perfect Clear_" + 
                      Imageid + ".jpg",
                      jpegCodecInfo, 
                      eps);
          }
          bmpBytes = ms.GetBuffer();
        }
      }
  } catch (Exception ex) {
    processResult = false;
  }
  return bmpBytes;
}
[Advertisement] Use NuGet or npm? Check out ProGet, the easy-to-use package repository that lets you host and manage your own personal or enterprise-wide NuGet feeds and npm repositories. It's got an impressively-featured free edition, too!

http://thedailywtf.com/articles/images-why-settle-for-just-one-


Метки:  

The Backend

Понедельник, 19 Января 2015 г. 14:30 + в цитатник

Andrei had just moved to a new country, and was looking for work. With the ideal job not immediately forthcoming, he jumped when an interesting opportunity opened at a small tech company: OldIsNewCo.

OldIsNewCo was one of the pioneers bridging the gap between old methods of communication (e.g. paper) and new methods of communication (i.e. the Internet), and was looking to overhaul their entire infrastructure. Their existing backend was built in C++, and according to The Big Boss: “C++ developers are expensive and hard to find. PHP developers are plentiful and cheap. Therefore, we need to re-implement everything in PHP.”

This seemed fishy to Andrei right from the start, but he figured it would be a good opportunity to brush up on his C++ and PHP skills and experience, and “a job’s a job”. So he accepted the position and met with his development tour guide to start diving into the sources and seeing how the backend applications worked.

Or, he tried - only to quickly discover Problem #1: There wasn’t a complete version of the source code in any single location. The sources for the backend were spread out over different production machines (i.e. the machines running the compiled code). Because these machines had variations, building was done on each machine locally, since the code might not build on a different machine with different software or configuration. This contributed to Problem #2: Making modifications to some of the backend was done by editing code on the same machine where that component ran.

As Andrei wrapped his head around those concerns, he began to wonder how the developers tested their changes. His development tour guide responded: “Oh, we don’t have a testing environment. We just deploy the new version to the live servers.” Deploying to production consisted of: waiting until the night when the system was mostly free of clients, compiling the code on the same machine it would then run, and hoping for the best. If the new build crashed the next morning when users returned, they would just revert to the old build and repeat the attempt the next evening.

But project organization, testing and deployment were far from the only concerns. As he finally began to dig into the code and architecture itself, Andrei discovered that the existing C++ backend had a few problems of its own:

  • The core backend app simply operated on files - it read them in, processed the contents, and output data to a database and other machines via the network. But this was implemented in the most complicated way possible, with numerous multithreading issues that resulted in the deployed application crashing frequently
  • It crashed so frequently, in fact, that it was one employee’s main job to watch the servers, wait for the app to crash, and manually restart it.

http://thedailywtf.com/articles/the-backend


Метки:  

Error'd: For Those Who Insist on Zapping Their Tongues

Пятница, 16 Января 2015 г. 14:00 + в цитатник

"Cool! Amazon now apparently offers a battery that comes in various flavors to enhance the experience," writes Evan C.

Niels R. wrote, "Finally. A website for when you absolutely, positively need a mouse that rates 2.1428571428 stars out of 5."

"With many systems that get butchered over the days/weeks/months/years certain columns, once used solidly for single responsibility, get hacked and overtaken by sales people. So instead of just having an error message, they started to report on a confirmation status because the Status of OK wasn't enough. A Bit like when people press a button that is already lit. (You never know it really might be broken)," writes Simon M., "Anyway, I found this gem of a status update on one of the schedules."

"I sense quite a bit of irony in this error," wrote TJ S.

"I was looking at the specs of a DVI extender when I noticed that the operating humidity of the device was 'Mozilla 1.4 or later',"Peter W. writes, "I'm not really sure that the air conditioner in our server room can provide that."

"Just saw this latest build result on my CI server. Apparently the test results come and go as they please," Tom C. wrote.

"I followed an ad link in http://www.smithsonianmag.com/ with the promising headline 'Non-existent Code Doesn't Crash'," Vince writes, "Unfortunately I ended up with some real code which (though it didn't actually crash if I'm being fair) certainly didn't work."

Aaron wrote, "Woo hoo! Check it out. My phone has a direct link to the CLOUD, baby!,"

[Advertisement] BuildMaster is more than just an automation tool: it brings together the people, process, and practices that allow teams to deliver software rapidly, reliably, and responsibly. And it's incredibly easy to get started; download now and use the built-in tutorials and wizards to get your builds and/or deploys automated!

http://thedailywtf.com/articles/for-those-who-insist-on-zapping-their-tongues


Метки:  

CodeSOD: The Java Purist

Четверг, 15 Января 2015 г. 14:30 + в цитатник

THIS IS PUREAli was what they like to call "Purist". You know the type by now: the man who's never met a piece of Java code that didn't need a refactor for the sake of "style". Too bad for him he was assigned to work on some code that had been ported to Java from other languages. It worked, but it wasn't Pure.

Nor was he sensitive to budget constraints or scheduling issues. On one fateful Friday afternoon, he couldn't take the impurity any longer. Over the course of around 6 hours, he committed dozens of minor revisions to source control, touching nearly every file in the codebase:

Revision Author Message
2345 Ali Replacing underscores with mixed case function names, as per Java standards.
2346 Ali Renamed function today() to now(), to better document the functionality of the code.
2347 Ali Replacing spaces with tabs, as per Java standards.
2348 Ali More replacement of spaces with tabs, as per Java standards.
2349 Ali Removed spaces at the ends of lines, as per Java standards.
2350 Ali Renamed unclear variables trigger_nm and table_nm to trigger and table.
2351 Ali Variable names MUST begin with a lowercase, as per Java standards.
2352 Ali Constants declared with final MUST be all uppercase, as per Java standards.
2353 Ali Alphabetized table listing, for readability.
2354 Ali Mass correction of indentation using Eclipse, as per Java standards.
2355 Ali Alphabetized function listing, as per Java standards.

The real kicker? The code didn't work anymore. Not only did he accidentally erase some crucial lines, but see commit 2353? That was the database creation script. Instead of creating tables in the sensible order that they depended on each other, instead, they were being created with invalid foreign key restraints but in perfectly alphabetical order. Couple that with deleting the backup in an attempt to save disk space and you have some very pissed off coworkers pulling a weekend shift to repair the testing environment.

[Advertisement] Use NuGet or npm? Check out ProGet, the easy-to-use package repository that lets you host and manage your own personal or enterprise-wide NuGet feeds and npm repositories. It's got an impressively-featured free edition, too!

http://thedailywtf.com/articles/the-java-purist


Метки:  

You Will Be Admin-similated

Среда, 14 Января 2015 г. 14:30 + в цитатник

Come and join the flock!Peter Drucker said "Culture eats strategy for breakfast," and you'll never see a better example of what that means than when a big company tries to digest a small one. As a helpdesk support tech, Woody had a front-row seat for the merger between his employer, a 100-person shop named Initech, and Megatrode, a hulking giant of a corporation that saw Initech as (according to the stirring on-boarding speech given to Woody's team by one of Megatrode's seven-dozen VPs) "a strategic acquisition in the enterprise space." Drucker's remark became more than just a pithy witticism when the time came to bring Initech's systems in line with Megatrode's Byzantine corporate policies. First on the long list of blanket edicts: "local admin rights for all users".

Woody's boss, Ryan, stumbled into Woody's cube and poured himself into the spare chair. He delivered the new policy with a cheerful "what could go wrong?" But Woody had never seen him look less cheerful: since the merger, Ryan's days had been an endless series of conference calls with Megatrode's Hydra-headed IT departments, trying to address their disparate and frequently contradictory support procedures. Woody was sorry to burst his boss's bubble. "Something already has," he said, pointing to his inbox. "Eleven—make that twelve—users have reported that the shortcuts to the network databases have gone missing from their desktops."

Ryan blinked his dark-rimmed eyes. "What?"

"I'm going to push out a quick batch file to fix the issue. With any luck, it's gremlins." Ryan waved him on, and wheeled himself back in the direction of his own desk.

But it wasn't gremlins. A week later, Woody and Ryan were both peering at their monitors late into the evening, scouring event logs, logon scripts, GPO lists, even antivirus reports. All had been well until that Tuesday morning, when the support inbox had once again become a flood of complaints. Desktops were going databaseless, and their users were stumped. Ryan and Woody were stumped as well, until, admitting defeat, they Googled the problem. The answer had been but a search query away: It turns out Windows knows how much you hate broken shortcuts, and is willing to take matters into its own hands. The guilty maintenance task was run once a week on startup, before the network drives were mapped, dutifully cleaning up the "broken" links.

"Glad we found the problem, and your solution seems to have worked," Ryan told Woody a week later, "But Megatrode's IT Governance committee is anxious to know why we'd never had this problem before. Have you figured that out?"

"It's easy," Woody said: "Windows Computer Maintenance needs local admin rights to delete desktop icons. You can tell them it's one more reason not to let the users be admins."

Ryan waved the proposed argument away. "Thanks, Woody. I'll tell them it's just one more corporate policy successfully implemented. You should know by now that the Megatrode IT group prides themselves on a culture of success."

[Advertisement] BuildMaster is more than just an automation tool: it brings together the people, process, and practices that allow teams to deliver software rapidly, reliably, and responsibly. And it's incredibly easy to get started; download now and use the built-in tutorials and wizards to get your builds and/or deploys automated!

http://thedailywtf.com/articles/you-will-be-admin-similated


Метки:  

CodeSOD: Today is Special

Вторник, 13 Января 2015 г. 15:30 + в цитатник

march-2011-whateverShawn's company needed a critical piece of software developed ASAP. The development team estimated six weeks of time to build it from scratch, but those in charge felt that was far too excessive. The devs had a track record of missing features--"Management NEVER told us we needed that feature!", botched rollouts--"What?! You told $newClient their site would go live on Monday? The product won't be ready until August and it's only February!", and going over-budget--"We developed it for SQL Server Express, I don't know why $phb bought us an enterprise Oracle instance."

Against the objections of everyone who did the actual work within the company, management partnered with the local University to have graduate students, most of whom had zero experience outside of academia, develop the new system for internship credit. Unpaid, of course. The plan then was that Shawn would spend "an hour or two" to polish the code up a bit and get it going in production.

After a full two semesters of development, Shawn finally received the code from the intern team and began preparing it for production. While attempting to get index.php to load without blowing up, he found this representative line that perfectly describes the overall code quality:

$closeDate = date( 'Y-m-d', strtotime(date("Y-m-d", strtotime($currentDate)) ));

After a week of analysis in which Shawn, unsurprisingly, found horrible coding standards, SQL injection vulnerabilities with every page, and features which were only vaguely similar to those outlined in the product requirements, he sent his estimate up the chain of command. It would take four to six weeks to fix the student-quality code enough to be production-worthy and deploy it.

The next day, he learned in a meeting that the company wouldn't afford the time to fix it. Instead, they would partner with the local University and hire a new team of unpaid interns to fix the system up.

[Advertisement] Use NuGet or npm? Check out ProGet, the easy-to-use package repository that lets you host and manage your own personal or enterprise-wide NuGet feeds and npm repositories. It's got an impressively-featured free edition, too!

http://thedailywtf.com/articles/today-is-special


Метки:  

Getting the Green Light

Понедельник, 12 Января 2015 г. 15:30 + в цитатник

greenlightTests. What can you really say about them? They are a royal pain to write and an even bigger pain to keep current as code changes. Nevertheless, we all (should) write them because they help verify that changes to the code don't break something and that the code works properly.

Of course, in order to be of any real value, the tests need to be useful tests. For example, a test to verify that setting the value of an integer to 5 and then immediately reading that integer to see if it's actually 5 doesn't really add any value. The same applies to tests like this:

  @Test
  public void invalidValueCausesExceptionTest() {
    try {
	// do something that causes an exception
    } catch (Exception e) {
      // log that you got the exception
    }
  }

It will always pass because nothing is done to handle the lack of the expected exception.

Numeric tests are interesting beasts. Precision matters. Dividing 4.0 by 2.0 will give a number that can be exactly matched, as-is. Dividing 1.0 by 3.0 without specifying the number of digits of precision, or rounding thereto will likely not match any reasonable value used for comparison.

Derek worked on an extremely high profile two man project that involved pulling together a number of engineering calculations into a single project. The calculations already existed in legacy FORTRAN code which had been written decades earlier in the 70s for mainframes that had less memory than digital watches. To say the code was a nightmare would be an understatement. The programmers did what they could with the resources they had at the time.

Derek was tasked with porting the code and a colleague was tasked with writing all of the tests.

They created a test suite to ensure that all of the ported code produced the same results as the old legacy code. This was their highest priority as these calculations were the backbone to a number of other engineering systems. The results of the new code HAD to be EXACTLY the same as the old results, or at least within reasonably tight tolerances. Otherwise everything the company did (based on those calculations) would be invalid and hence extremely costly.

The legacy code was an out-of-control birds-nest; everything was global and appeared to be dependent upon everything else. It was hard going, and time and time again the tests failed. The reasons why they failed were investigated and solutions implemented. Unfortunately, because most of the calculations were dependent upon each other, tests that once passed would fail when other calculations were ported. It was a nightmare and it was all because of the old coding style.

Although it was very frustrating, over time they started winning the battle; more and more tests were coming up green. More importantly, they were staying green. They started printing off the test reports in all their green beauty and pinned them to the wall for all in the department to see. It was visual evidence that progress was being made and things were getting better. Success was reported up the ladder of management.

There was a new sense of optimism, hope, and happiness. The worst was over. They were on the right track. They could see that there was a light at the end of the tunnel.

Or perhaps it was an on-coming speeding locomotive.

One day while updating the test scripts, Derek noticed something odd in the test output. The calculated values differed between the new code and the old code. The tests were passing and showing up green, but the results were not the same!

When, what, who, why, erm... WTF?!

It turned out that his counterpart, in order to impress his boss, had been increasing the size of the test tolerances on each of the failed calculations in order to make the test pass. In other words rather than fix the calculations, he kept loosening the tolerances of the tests until they passed. It was all a lie. Derek had no idea how long this had been going on, but once the correct tolerances were restored the whole code base failed. Big time!

While management did the right thing and red-lighted fired the tester, they then proceeded to overreact and red-lighted the entire project, thus ensuring that the legacy FORTRAN code lives on.

[Advertisement] Release! is a light card game about software and the people who make it. Order the massive, 338-card Kickstarter Edition (which includes The Daily Wtf Anti-patterns expansion) for only $27, shipped!

http://thedailywtf.com/articles/getting-the-green-light


Метки:  

Error'd: Savings That You Wouldn't Believe

Пятница, 09 Января 2015 г. 14:00 + в цитатник

"Apparently this subscription service will stop at nothing to keep my business," writes Mike F.

"All I wanted was a Pepsi, I didn't plan on making first contact...," writes Tracy M..

Matt L. wrote, "NuGet gave me an opportunity to respond to the exception unknown by clicking the unlabeled button."

"Ok...so, now what am I supposed to do?," wrote Steve K.

Kevin W. writes, "I was trying to create an account on the IKEA website but I don't think they can make up their mind about password security."

"Whenever someone asks if we were justified in the multi-million dollar purchase of our new ERP software, I show them this," Tomasz wrote.

Mark Y. writes, "While working on a scholarship application, I was relieved to see that they covered my studies in Test and Test Major2!"

"Tiger Direct and Western Digital announce the advent of the variable sized hard drive," John writes.

[Advertisement] Use NuGet or npm? Check out ProGet, the easy-to-use package repository that lets you host and manage your own personal or enterprise-wide NuGet feeds and npm repositories. It's got an impressively-featured free edition, too!

http://thedailywtf.com/articles/savings-that-you-wouldn-t-believe


Метки:  

CodeSOD: Structured Exceptions

Четверг, 08 Января 2015 г. 15:30 + в цитатник

These days, most languages have some variation on the structured exception handling concept. Exceptions get thrown inside of a try block, and then a search begins for a matching catch block, specific to that kind of exception. cru d'exceptionEach type of exception can be handled differently, which allows minor errors to print messages for the user, while fatal, state-corrupting errors can lead to the application exiting and hopefully not damaging any data.

A good developer catches all of the possible exceptions. By that standard, the contractor who gave Martina this code must be one of the best :

 #region Catch clauses
            catch (AmbiguousMatchException ex)
            {
                OnErrorOccurred(new ErrorOccurredEventArgs("An error occured during backup process.", ex));
            }
            catch (TargetException ex)
            {
                OnErrorOccurred(new ErrorOccurredEventArgs("An error occured during backup process.", ex));
            }
            catch (WaitHandleCannotBeOpenedException ex)
            {
                OnErrorOccurred(new ErrorOccurredEventArgs("An error occured during backup process.", ex));
            }
            catch (AbandonedMutexException ex)
            {
                OnErrorOccurred(new ErrorOccurredEventArgs("An error occured during backup process.", ex));
            }
            catch (TypeLoadException ex)
            {
                OnErrorOccurred(new ErrorOccurredEventArgs("An error occured during backup process.", ex));
            }
            catch (IndexOutOfRangeException ex)
            {
                OnErrorOccurred(new ErrorOccurredEventArgs("An error occured during backup process.", ex));
            }
            catch (KeyNotFoundException ex)
            {
                OnErrorOccurred(new ErrorOccurredEventArgs("An error occured during backup process.", ex));
            }
            catch (InvalidCastException ex)
            {
                OnErrorOccurred(new ErrorOccurredEventArgs("An error occured during backup process.", ex));
            }
            catch (MemberAccessException ex)
            {
                OnErrorOccurred(new ErrorOccurredEventArgs("An error occured during backup process.", ex));
            }
            catch (SecurityException ex)
            {
                OnErrorOccurred(new ErrorOccurredEventArgs("An error occured during backup process.", ex));
            }
            catch (SharpZipBaseException ex)
            {
                OnErrorOccurred(new ErrorOccurredEventArgs("An error occured during backup process.", ex));
            }
            catch (ArgumentException ex)
            {
                OnErrorOccurred(new ErrorOccurredEventArgs("An error occured during backup process.", ex));
            }
            catch (OverflowException ex)
            {
                OnErrorOccurred(new ErrorOccurredEventArgs("An error occured during backup process.", ex));
            }
            catch (System.Configuration.ConfigurationException ex)
            {
                OnErrorOccurred(new ErrorOccurredEventArgs("An error occured during backup process.", ex));
            }
            catch (ExecutionEngineException ex)
            {
                OnErrorOccurred(new ErrorOccurredEventArgs("An error occured during backup process.", ex));
            }
            catch (FormatException ex)
            {
                OnErrorOccurred(new ErrorOccurredEventArgs("An error occured during backup process.", ex));
            }
            catch (InvalidOperationException ex)
            {
                OnErrorOccurred(new ErrorOccurredEventArgs("An error occured during backup process.", ex));
            }
            catch (OutOfMemoryException ex)
            {
                OnErrorOccurred(new ErrorOccurredEventArgs("An error occured during backup process.", ex));
            }
            catch (NotSupportedException ex)
            {
                OnErrorOccurred(new ErrorOccurredEventArgs("An error occured during backup process.", ex));
            }
            catch (NullReferenceException ex)
            {
                OnErrorOccurred(new ErrorOccurredEventArgs("An error occured during backup process.", ex));
            }
            catch (OperationCanceledException ex)
            {
                OnErrorOccurred(new ErrorOccurredEventArgs("An error occured during backup process.", ex));
            }
            catch (RankException ex)
            {
                OnErrorOccurred(new ErrorOccurredEventArgs("An error occured during backup process.", ex));
            }
            catch (TransactionException ex)
            {
                OnErrorOccurred(new ErrorOccurredEventArgs("An error occured during backup process.", ex));
            }
            catch (UnauthorizedAccessException ex)
            {
                OnErrorOccurred(new ErrorOccurredEventArgs("An error occured during backup process.", ex));
            }
            catch (XmlException ex)
            {
                OnErrorOccurred(new ErrorOccurredEventArgs("An error occured during backup process.", ex));
            }
            catch (IOException ex)
            {
                OnErrorOccurred(new ErrorOccurredEventArgs("An error occured during backup process.", ex));
            }
            catch (Exception ex)
            {
                OnErrorOccurred(new ErrorOccurredEventArgs("An error occured during backup process.", ex));
            }
            finally
            {
                CleanUpCancelledBackup();
            }
[Advertisement] BuildMaster is more than just an automation tool: it brings together the people, process, and practices that allow teams to deliver software rapidly, reliably, and responsibly. And it's incredibly easy to get started; download now and use the built-in tutorials and wizards to get your builds and/or deploys automated!

http://thedailywtf.com/articles/structured-exceptions


Метки:  

Stalled for Time

Среда, 07 Января 2015 г. 15:00 + в цитатник

Drew worked for a petite e-commerce company, where his primary responsibility was to keep everything running. He saw to day-to-day maintenance, as well as backup and disaster recovery.

The small shop’s resources were limited. Critical data remained tied up in onsite legacy systems- and of course, the “supply closet” was full of relics from a clunkier, floppier era. Drew did the best he could to shield the company from server outages, power outages, backup failures, and other common scenarios.

Then one day came the emergency neither Drew nor anyone else had ever anticipated…

Men's toilet (room 115, representing room 117), looking north. - California State Office Building No. 1, 915 Capitol Mall, Sacramento, Sacramento County, CA HABS CAL,34-SAC,65-14

A “resolved” dispute with a vendor from the previous year had abruptly evolved into “Pay us lb15k immediately.” Drew’s company had agreed to pay that coming Friday, when they’d actually have the funds. It was only Wednesday. Nevertheless, bailiffs had pulled up outside of the office suite where the company was based, with orders to confiscate “all computer-related items.”

Drew’s boss called him from reception, and quickly explained the issue. “Hide the computers!” he finished with a hiss.

There were 7 workstations within the suite. Drew’s pulse began to race. “Where? The offices and closets are crammed full. I cant take them out the front or the back without being spotted.”

“I don’t care- get creative!” his boss replied. “Those machines house all our email, code, and project deliverables. We’re dead in the water without them! I’ll stall them as long as I can- now go!” Click.

Drew had only moments to think, but desperation hatched an ingenious emergency backup strategy.

A bathroom stall on the 3rd floor became the business’ new center of operations; it was the only bathroom Drew had keys for. Reluctant to use the elevator for fear of running into the bailiffs, he lugged the desktops up the stairwell by hand, one or two at a time, piling them around a sensor-rigged toilet that awarded each deposit with a loud flush.

Once all the machines were secure, Drew taped an “out of order” sign to the stall door, and used a pair of scissors to lock the door from the outside.

Sweaty and out of breath, he stumbled back down to the office- but his work was far from over. If the bailiffs saw desks adorned with monitors and keyboards and mice attached to nothing, they’d surely get suspicious.

Again, hurried inspiration provided the answer: the supply closet.

Within minutes, the office fell into an alternate reality where desktop technology had peaked in 1985. Drew was about to swap out the modern monitors for CRTs when the bailiffs finally barged in with a police escort- Drew’s red-faced, shouting boss on their heels.

Drew hurried back to his own desk and held his breath.

“What is this rubbish?” one bailiff wondered aloud.

“It’s what we have,” Drew’s boss returned defensively.

The bailiffs laid claim to everything in sight- including Drew’s own personal USB hubs.

“Hey, those are mine!” he cried.

"Theyre connected to the computer, so they fall under the remit of items to collect,” the bailiff explained.

“I bought these with my own money. They don’t belong to the company. I’ll be damned if you take them!” Drew accidentally brandished the scissors he’d used to lock up the bathroom stall.

“Put those down, sir,” a nearby police officer requested. “They’re making me nervous.”

Drew and the other lower-level minions were sent to wait things out at the pub, because the UK is rather brilliant like that. In the end, the bailiffs decided hauling off a few hundred quid worth of junk wasn’t worth the trip, and wound up seizing nothing.

A great deal of celebration ensued, culminating in the boss agreeing to reward Drew with shares in the company. Afterward, Drew went back to the office to perform disaster recovery, so everyone could start work the next day as normal.

An office worker from a different suite was present in the mens’ room. Drew tore down the “out of order” sign, forced open the lock with scissors, and entered the stall. One noisy automatic flush later, he walked out with one of the desktops propped on his shoulder.

"Dont ask,” Drew told the other gentleman.

"I&dont want to know,” he replied.

[Advertisement] Manage IT infrastructure as code across all environments with Puppet. Puppet Enterprise now offers more control and insight, with role-based access control, activity logging and all-new Puppet Apps. Start your free trial today!

http://thedailywtf.com/articles/stalled-for-time


Метки:  

CodeSOD: Jack and the Beanstalk

Вторник, 06 Января 2015 г. 14:00 + в цитатник

beanOnce upon a time, in a far off kingdom named 1996, there was a developer named Jack. Jack worked for a poor company that could barely afford to buy grain with which to bake objects; they had to make do with Delphi forms, pinching and scraping what they could into an application. Instead of methods, they were stuck with button events, from which they milked database tables.

One day, Jack came to realize that the button events were growing old, and soon, no more good could be wrung from them. Sadly, he knew it was time to retire his old Delphi code. But what could he live on?

"I will help you," said Jack's neighbor, another developer. "Take these magic variables and plant them in the soil, and soon you will have a beautiful garden of maintainable code instead of the dried-up old husk you milk." And so Jack planted the variables and went to sleep.

When he woke up, he found an amazing sight:

 
TForm1.Button131Click(Sender: TObject);
var
 Row1Type1Count, Row2Type1Count, Row3Type1Count, Row4Type1Count, Row5Type1Count,
 Row1Type2Count, Row2Type2Count, Row3Type2Count, Row4Type2Count, Row5Type2Count,
 Row1Type3Count, Row2Type3Count, Row3Type3Count, Row4Type3Count, Row5Type3Count,
 NoOfItemsRow1, NoOfItemsRow2, NoOfItemsRow3, NoOfItemsRow4, NoOfItemsRow5, NoOfItemsRow6,
NoOfItemsRow7,
 NoOfItemsRow8, NoOfItemsRow9, NoOfItemsRow10, NoOfItemsRow11, NoOfItemsRow12, NoOfItemsRow13,
NoOfItemsRow14,
 NoOfItemsRow15,
 WT_ItemsRow1, WT_ItemsRow2, WT_ItemsRow3, WT_ItemsRow4, WT_ItemsRow5, WT_ItemsRow6,
WT_ItemsRow7,
 WT_ItemsRow8, WT_ItemsRow9, WT_ItemsRow10, WT_ItemsRow11, WT_ItemsRow12, WT_ItemsRow13,
WT_ItemsRow14,
 WT_ItemsRow15
 , Position: integer;
 NofBagParcelRow1, NofBagParcelRow2, NofBagParcelRow3, NofBagParcelRow4, NofBagParcelRow5,
NofBagParcelRow6,
 NofBagParcelRow7, NofBagParcelRow8, NofBagParcelRow9, NofBagParcelRow10, NofBagParcelRow11,
NofBagParcelRow12,
 NofBagParcelRow13, NofBagParcelRow14, NofBagParcelRow15: integer; 2
 WtofBagParcelRow1, WtofBagParcelRow2, WtofBagParcelRow3, WtofBagParcelRow4, WtofBagParcelRow5,
WtofBagParcelRow6,
 WtofBagParcelRow7, WtofBagParcelRow8, WtofBagParcelRow9, WtofBagParcelRow10, WtofBagParcelRow11,
WtofBagParcelRow12,
 WtofBagParcelRow13, WtofBagParcelRow14, WtofBagParcelRow15: Double;
 WtofItemAndBagRow1, WtofItemAndBagRow2, WtofItemAndBagRow3, WtofItemAndBagRow4,
WtofItemAndBagRow5, WtofItemAndBagRow6,
 WtofItemAndBagRow7, WtofItemAndBagRow8, WtofItemAndBagRow9, WtofItemAndBagRow10,
WtofItemAndBagRow11, WtofItemAndBagRow12,
 WtofItemAndBagRow13, WtofItemAndBagRow14, WtofItemAndBagRow15: Double; begin ... 
 
 

That's right: The tiny method had grown until it was 700 lines long! Not only that, but it had attracted friends: 60,000 lines in total, all squished into a few button events.

And so Jack went off in search of an axe with which to prune his massive garden...

[Advertisement] Release! is a light card game about software and the people who make it. Order the massive, 338-card Kickstarter Edition (which includes The Daily Wtf Anti-patterns expansion) for only $27, shipped!

http://thedailywtf.com/articles/jack-and-the-beanstalk


Метки:  

Papers, Please

Понедельник, 05 Января 2015 г. 14:00 + в цитатник

Border Guard"Glory to Arstotzka!"

It was already 7pm, and Jeff was almost finished packing his things and heading home. He was looking forward to a nice can of local beer and a video chat with his girlfriend, which he had to leave a few timezones away when an unexpected government contract popped up. American at heart, but eager to explore different cultures, he agreed to provide technical support for Arstotzkan foreign affairs department – and a hefty pay helped to seal the deal.

As much as he enjoyed the job, the sight of his boss peeking into his office just when he was about to leave was never a welcomed sign.

"Yeah, hi Boss. What's the matter? Another problem at the border?"

"Umm, no, well... " – Jeff looked at the formidable, over six feet tall man and saw him almost shrinking with every word he said. Definitely not a good sign, he thought.

"You... do you remember that trade agreement with Kolechia we struck a few days back?" – he finally managed to mutter.

Unfortunately, Jeff did remember. It was quite a big piece of news – the talks lasted for months, and at stake was not only a sizable amount of national treasury, but also the already tense relationship between the two countries. Many observer nations were engaged, many threats of breaking the negotiations, or even war, were made – but finally, the two countries reached what might be called an agreement.

"Yeah. So?"

"We were just about to e-mail the last batch of papers, but we found a little... mistake."

"A... mistake."

"Yes, um, you see... there was a last minute change with the payment amount, and somebody, well... punched in a few zeroes too many."

The last sentence sent a jolt through Jeff's body. "A few zeroes too many" meant the difference between a reasonable offer and an outright mockery – and Kolechians did not take mockery lightly.

"Somebody what? Okay, okay, I'll get it fixed right now. Just give me the papers."

"Here" – said the boss, passing Jeff an USB stick. "The amount is correct here, but those are all Word documents, and we need them in PDF, that's the law. If you could just convert those..."

"Fine, don't worry, I'll get it done in no time. See you tomorrow, Boss."

"You will? Oh, that's great! Just send them over as soon as you're done, we need them by tomorrow morning. See you then!"

Jeff watched the boss leave. He might miss the Chyetiryoh Tankistov rerun on TV, but he could still get the job done in a few minutes. He just needed one thing, and knew when to find it...

* * *

"Glory to Arstotzka! Have you tried turning it off and on again?" – a stern, disciplined voice yelled at Jeff through the receiver.

Some things never change.

"Hi Ivan, it's Jeff. Quick question – can you get me a PDF converter license, stat?"

"Oh, hi Jeff!" – the voice responded, now much happier and calmer. – "Yeah, no pro... oh. I guess we run out of those. Sorry."

"Uhhh... well, I guess that's not a big deal, I'll just grab something off the net. Thanks anyway!"

"...wait, what? No, no, no, no, stop, STOP! You can't do it!" – Ivan yelled, as if Jeff had his hand on some big red button.

"What? What do you mean ‘I can't'?"

"You have to go through proper channels! You can't just use unapproved tools on department's hardware! They find out – and they will find out, with all the network sniffing – and you're done for good!"

Jeff's heart sank immediately. He knew what "going through proper channels" meant here – an enormous amount of paperwork, stamps, signatures, rejections and corrections. There was no way he could get that done by tomorrow morning – and since he also knew what being "done for good" stood for, there was no way to circumvent this.

"Sorry, Jeff... I mean, you know how it is here. Nothing short of nuclear war will save you from the bureaucracy."

"Ivan! There will be a nuclear war if I don't get those papers done!"

"Oh... oh. I don't think they actually accounted for that... Sorry. I'll let you know if I figure something out. Good luck."

"I can't believe it! That's just wrong! You're all wrong, you hear me? YOU'RE ALL DOING IT WRONG!" – Jeff slammed the receiver and buried his head in his hands. His mind was blank. He tried to find a solution desperately, but nothing came to his head – everything would either take too long, require much more human resources, or violate the laws of physics. He found himself looking around the office, searching for a way out, until suddenly, an epiphany hit him.

On a nice, polished, wooden table stood the office machine.

* * *

Jeff went to it, pushed a few buttons – and sure enough, there was an option to generate a PDF from scanned documents. It even helpfully merged them together – as long as you put every page on the scanner glass, closed the lid and hit the button.

He rushed to his laptop and plugged the USB stick in. I'll just print those documents, scan them back in and that's it! It can't be that bad, can it?

His moment of happiness didn't last long. Jeff could even pinpoint the very second it ended – right as he opened the drive and realized that trade agreements are long. And can span multiple documents. And also need to be translated to official languages of every single nation involved in the process – and by that time, probably half of the world put their hands on the negotiation.

There was no other way, though. Nothing else he could do. He opened Skype, clicked on his girlfriend's portrait and typed in:

"Honey, I'll be a little late today."

* * *

And so, he printed. And he scanned. And he merged. And he put every sheet through the shredder, doing everything by the books, saving the country of Arstotzka and its cogs and wheels of bureaucracy page by page, armed with nothing but a trusty office machine.

It wasn't until 4 AM, when he was finishing his fourth and last ream of paper, when the phone on his desk suddenly rang.

"Glory to Arstotzka! You still here, Jeff? It's Ivan, telling you we just got a fresh batch of license keys for the PDF converter! Want me to send one out?"

[Advertisement] Release! is a light card game about software and the people who make it. Order the massive, 338-card Kickstarter Edition (which includes The Daily Wtf Anti-patterns expansion) for only $27, shipped!

http://thedailywtf.com/articles/papers-please


Метки:  

Error'd: Everything Californian Be Found On The Internet

Пятница, 02 Января 2015 г. 14:00 + в цитатник

"You wouldn't think that anyone would ever make such a clbuttic mistake as replacing every instance of 'ca' with 'California' on a page, yet, here we are," John S. writes.

"I bet it's a pretty bad situation when an error handler can give up," writes Andrey.

Matt L. wrote, "So, let me understand this - I can't change my password because my current password isn't strong enough?"

"Brrr! Weather Underground says it's pretty cold in southern Mexico...not Vostok Station cold, but pretty close."

"I was browsing through Microsoft's Tutorials for Windows Forms for a new assignment when I came across this gem," wrote Markus H., "Having already completed the 'Simple Windows Form' I don't think you really need five walkthroughs for it."

"If you ask me, I think TightVNC wants to make sure nobody reads their EULA," J. J. wrote.

"If this is the version without ads, I don't think I want to use the version with them!" Chris writes.

"You might think the right answer is answer 3 ('Answer 4'), but you'd be wrong," Mike writes, "I tried that one and was told the correct answer was one not shown: Disable logging to improve performance -- which appears to be an answer to a different question."

[Advertisement] BuildMaster is more than just an automation tool: it brings together the people, process, and practices that allow teams to deliver software rapidly, reliably, and responsibly. And it's incredibly easy to get started; download now and use the built-in tutorials and wizards to get your builds and/or deploys automated!

http://thedailywtf.com/articles/everything-californian-be-found-on-the-internet


Метки:  

Coded Smorgasbord: Classic WTF - The Long Way

Четверг, 01 Января 2015 г. 16:00 + в цитатник

2014 was a great year for us and hopefully for you too! Happy 2015 everybody! Enjoy this popular WTF from all the way back in May.


Sometimes, a developer just needs to take the long way around. Sure, a line of code like DateTime StartTime = DateTime.Now looks simple and readable, but what happens if you want the StartTime variable to be not exactly now?

Craigs co-worker figured out a better solution:


public string SomeFunc() {
  DateTime StartTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 
    DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Millisecond);
  //… do stuff
}

So much better.

Now, though, we have a string thats guaranteed to exist and be at least 6 characters long. We need to get the last six characters of that string. We could use a substring function, but that wouldnt give us an opportunity to use our knowledge of LINQ functions. Kelly found this superior solution:

public string LastSixDigits
{
 get
 {
   if (string.IsNullOrWhiteSpace(this.Number) || this.Number.Length < 6)
     return string.Empty;
   return this.Number.Reverse().Take(6).Reverse().Aggregate(string.Empty, (s, c) => s += c);
 }
}

Finally, one of Jonathans peers needed to store a pair of strings as a single object. They could have used one of the many built-in types for that task, like a Tuple or KeyValuePair, but would that have provided a suite of overridden operators?

  public struct StringString
   {
       public string Key;
       public string Value;

       public static bool operator ==(StringString dataItem1, StringString dataItem2)
       {
           return (dataItem1.Key == dataItem2.Key && dataItem1.Value == dataItem2.Value);
       }

       public static bool operator !=(StringString dataItem1, StringString dataItem2)
       {
           return (dataItem1.Key != dataItem2.Key || dataItem1.Value != dataItem2.Value);
       }

       public override bool Equals(object obj)
       {
           if (!(obj is StringString))
           {
               return false;
           }

           return (this == (StringString)obj);
       }

       public override int GetHashCode()
       {
           return (Key.GetHashCode() + Value.GetHashCode());
       }
   }
[Advertisement] Use NuGet or npm? Check out ProGet, the easy-to-use package repository that lets you host and manage your own personal or enterprise-wide NuGet feeds and npm repositories. It's got an impressively-featured free edition, too!

http://thedailywtf.com/articles/classic-wtf-the-long-way


Метки:  

CodeSOD: Classic WTF - A Pentester's Paradise

Четверг, 01 Января 2015 г. 14:30 + в цитатник

To help ring in the new year, here - enjoy this "Best of WTF" classic that ran in 2014!


Tom works as a pentester and, as such, gets paid big bucks for finding flaws in his clients' websites usually because he has to find less than obvious 'gotcha'-level flaws.

While testing a critical web application for a very large corporate client, he noticed some odd behavior surrounding a page that validates user logins.

Apparently, the original developer decided that it would be a good idea to send the database credentials to the client in a snippet of JavaScript and then use them to formulate a GET request to the server, presumably where the user is validated.

I'm not sure what other surprises Tom found while working for this particular client, but I hope the developer's reach was mercifully limited.

[Advertisement] Release! is a light card game about software and the people who make it. Order the massive, 338-card Kickstarter Edition (which includes The Daily Wtf Anti-patterns expansion) for only $27, shipped!

http://thedailywtf.com/articles/classic-wtf-a-pentester-s-paradise


Метки:  

Announcements: Happy New Year Everybody!

Четверг, 01 Января 2015 г. 14:00 + в цитатник

happy-new-year-gentlefolk

Wow! Awesome! This is the year we finally get the flying cars and hoverboards that we were promised. I can't wait! It's officially the future.

To mark the occasion, coming up later today are two classics from 2014 that were the highest viewed of the year. ENJOY!

[Advertisement] Use NuGet or npm? Check out ProGet, the easy-to-use package repository that lets you host and manage your own personal or enterprise-wide NuGet feeds and npm repositories. It's got an impressively-featured free edition, too!

http://thedailywtf.com/articles/happy-new-year-everybody-


Метки:  

Поиск сообщений в rss_thedaily_wtf
Страницы: 124 ... 19 18 [17] 16 15 ..
.. 1 Календарь