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

Поиск сообщений в 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 ленты.
По всем вопросам о работе данного сервиса обращаться со страницы контактной информации.

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

CodeSOD: Sleeping In

Среда, 03 Июня 2015 г. 13:30 + в цитатник

Rebecca inherited some code thats responsible for gathering statistical data from network interface. It was original written a decade ago by one of those developers who wanted to make certain their influence was felt long after they left the company.

The code was supposed to write to one of two log files: a quick log, with 2-second resolution (but only for the last minutes data), and a full log, with 1-minute resolution.

Unfortunately, it would often fail to do anything with the full log. Frustrated that this code- which had lived in a shipping product for over a decade- was so unreliable, Rebecca dug in to see what the problem was.

#define FULL_SAMPLE_DELAY 60

void dostats(FILE *quicklog, FILE* mainlog) {
       //[code omitted for brevity]
        while(!done) {  
                sleep(2);
                if(!(times.now.t.tv_sec % FULL_SAMPLE_DELAY)) {
                        // main samples
                        stats.save(mainlog, times);
                }
                else {
                        // quick samples 
                        quickstats.summarise(quicklog, quickstats_top_n);
                }
        }
}

Rebeccas predecessor had the good sense to use sleep() to keep the loop from spinning the CPU, but made one major error: he assumed that calling quickstats.summarise took no time . Even if the loop started at exactly the right time, the amount of time spent executing quickstats.summarise guaranteed that eventually, the current time wouldnt line up with an even minute, and the full log would become unreliable.



[Advertisement] Release! is a light card game about software and the people who make it. Play with 2-5 people, or up to 10 with two copies - only $9.95 shipped!

http://thedailywtf.com/articles/sleeping-in


Метки:  

Welcome to the Real World

Вторник, 02 Июня 2015 г. 13:30 + в цитатник

You should get some real-world experience.

D.H. was in college to study video game programming, and his professors encouraged him to find an internship. The real programming business is nothing like these university assignments.

Fantasy cover with a dragon and a magical creature riding it.
What the real world doesn't look like

D.H. found a year long internship, ready to have his mind blown by how different it was, and his mind was certainly blown- but not for the reasons he was expecting…

On his first day, D.H. was shuffled into a conference room with 19 other interns for their orientation. The company was a large one, mostly doing IT and software consulting. With that many interns, most of them fell into the dreaded roles of donut-fetcher and coffee distributor, but D.H. lucked into doing some actual development work.

After a few weeks of getting to know things, Bernie, the lead developer, came by with a new assignment. Weve got some new validation rules in the application. Theyre pretty easy to follow, so why dont you help us out by doing the testing? If you find any bugs, feel free to take a crack at solving them yourself.

This was a dull line-of-business application, but his game development classes came in handy. In a world of online cheating, he knew better than to ever trust client input. His caution earned his coworkers respect. D.H. was excellent at finding and fixing issues ranging from simple mistakes, like not constraining the quantity field to an integer; poor design, like confusing and ineffective radio-buttons; and just plain bad coding, such as relying on thrown exceptions to recognize invalid inputs. By the end of his one-year internship, D.H. was the expert on not one, but three of their major applications.

It was D.H.s last week when Bernie came to him in a panic. D.H.! Before you leave, can you please take a look at bug #622512? This is causing a lot of problems. Ive had all of our experts look at it, and theyre stumped. Its causing reboots, and the server guys are ticked off!

Sure, D.H. replied.

D.H. opened up their internal bugtracker and read the issue. Multiple users had complained about the applications checkout page not working, specifically when they used promo codes. Even worse, when they had trouble with promo codes, the website became unresponsive. The server team was monitoring it, and automatically rebooted the server whenever the application crashed.

D.H. read the notes from the other developers, which all amounted to, Read the code, didnt see anything odd. So D.H. did what they hadnt- he fired up the checkout page and tried to reproduce the issue with a list of current promo codes. Before he got too far, he got sidetracked by other bugs on the page. Users with hyphenated last names couldnt make purchases. Selecting the radio button to decline an extended warranty didnt disable the extended warranty form, meaning users could actually decline a warranty at the same time as requesting a five-year warranty. Neither of those was related to the application crash, but they were easy enough to fix while he was in there.

Finally, he discovered how to trigger the crash. Specifically, he had to enter an invalid promo code, not a valid one. With this knowledge, he took another dive into the code with his debugger.

And found this:

	if (isCodeValid(promo_code) || !isCodeValid(promo_code))
	{
		addPromoToCart();
		displayPromoError();
	}
	else
	{
		addPromoToCart();
		displayPromoError();
	}

Sure, the if statements condition was a tautology, but the else (which was unreachable) did the same thing anyway. Even with a bad promo code, it would attempt to apply the promo code, and a stored procedure on the backend would crash and burn horribly. D.H. had seen the database code once- once- and dreaded the thought of trying to fix that, but fortunately, he didnt need to- it was blindingly obvious how to fix the code.

The next week, his internship was over, and he returned to school full time. He was older, wiser, and armed with real world experience, but he kept wondering: how would that company do without their resident Expert Intern?

[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/welcome-to-the-real-world


Метки:  

CodeSOD: The Busy Little Boolean

Понедельник, 01 Июня 2015 г. 13:30 + в цитатник

Booleans! What can you say? They're deceivingly complex features of any language, and only the most proficient among us is capable of using them properly.

Miss M. discovered that one of her cow-orkers found a new way to get the most mileage out of a single boolean variable named count in a single method to see if:

  • we're at the end of an enumerator
  • send-mail succeeded
  • the current job id <= zero
  • the length of an exception e-mail is < 2000 characters
  • the current job id <= zero (again)
  • the current enum enumerator has reached the end of the enum
public override SendMailLog SendEmail(MailInformation mailInfo, 
                                      JobWorkItems    recepients, 
                                      bool            testMode) {
  var sendMailLog = new SendMailLog();
 
  sendMailLog.SendStart = DateTime.Now;
 
  bool count = recepients.Items.Count != 0;

  if (!count) {
     throw new ArgumentNullException("
                 recepients", 
                 "Recipient collection is empty, there is no recipients to send to.");
  }

  count = !string.IsNullOrEmpty(mailInfo.From);

  if (!count) {
     throw new ArgumentNullException(
                "mailInfo", 
		"Missing from address. SMTP servers do not allow sending without a sender.");
  }

  IEnumerator<JobWorkItem> enumerator = recepients.GetEnumerator();

  try {
      while (true) {
        count = enumerator.MoveNext();
        if (!count) {
           break;
        }
        JobWorkItem current = enumerator.Current;

        var mailMessage = new MailMessage(mailInfo.From, current.EmailAddress);
        mailMessage.Subject = mailInfo.Subject;
        mailMessage.Body = PersonalizeEmail(mailInfo, current.EmailAddress);
        mailMessage.IsBodyHtml = true;

        try {
            count = !this.SendMail(mailMessage, testMode);
            if (!count) {
               sendMailLog.SuccessMessages.Add(current.EmailAddress);
               current.Status = JobWorkStatus.Complete;
               count = current.JobId <= 0;

               if (!count) {
                  current.Save();
               }
            }
        } catch (Exception exception) {
          string str = string.Format("Email: {0}\r\nException: {1}\r\n\r\n", 
                                     current.EmailAddress, 
                                     exception.Message);
          sendMailLog.ErrorMessages.Add(str);
          current.Status = JobWorkStatus.Failed;

          count = str.Length < 2000;
          if (!count) {
             str = str.Substring(0, 1999);
          }
          current.Info = str;
          count = current.JobId <= 0;
          if (!count) {
             current.Save();
          }
        }
      }
  } finally {
    count = enumerator == null;
    if (!count) {
       enumerator.Dispose();
    }
  }

  sendMailLog.SendStop = DateTime.Now;
  return sendMailLog;
}
The Count from Sesame Street counts to six.
Six! Six reuses of the same variable! AH HA HA HA HA!
[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/the-busy-little-boolean


Метки:  

Error'd: It's a Kinda Magic

Пятница, 29 Мая 2015 г. 13:00 + в цитатник

"One of the UK's leading motoring organizations needs a little help in wand waving on its route planning web site," Cameron wrote.

"This one showed up near my work," writes Bruno V., "Hopefully the Tech guy was only Googling something."

"I want to be really sure I like it before I buy it, so I think I'll take full advantage of the trial period," writes David G., "Once I've made up my mind, my grandchildren can pay for it."

Walton H. writes, "I feel like SQL Server Management Studio might not be looking hard enough."

"This web site had the same 'lets-not-focus-too-much-on-the-facts-feel' as most other websites in this category," wrote Karl J., "So I got to wondering - what happens when you enter an invalid date as your birth date for the psychic to make predictions from?"

Steve wrote, "Because your password didn't meet our strict criteria, we assigned a more secure, randomly generated password and answer to your security question."

"I work in the IT department at a rather prestigious public university and for reasons unknown to me somebody on high decided that imposing these password limitations would make our systems "safer". Despite the outcry from those of us a bit more technologically savvy, the policy has stood for years," Liam K. writes.

"I've never called my son Nicolas - I guess that I need to start," wrote Nick.

[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/it-s-a-kinda-magic


Метки:  

The Daily WTF: Live: Meeting Halfway

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

On April 10th, I hosted The Daily WTF: Live! in Pittsburgh. It was a blast. We had a great crowd, and some great performances.

John Lange attended the storytelling workshop I co-taught with Kevin Allison, of The Story Studio. His story- about gaming, and friendship, and technology- really struck a chord with me, and I wanted to make sure he got a chance to share it.

Direct Link(MP3)

This episode is brought to you by our sponsor, Puppet Labs. Check out their intro video, it gives a pretty good overview of how they help their customers get things done. Start a free trial today!

Tune in next week, Seth Peasely tells us about robots. Robots!

Transcript

Hello everyone, my name is John, and today I wanted to tell you about my friend Phil. I first met Phil at his gaming store that he runs in the North Hills. He runs a store that sells D&D games, board games. If you’re not familiar with D&D it’s pen-and-paper games that you play at a table, you’re sitting there with everyone, and everyone around the table is playing and talking and having a good time.

When I met Phil, I came into his shop and his shop is like a library, almost, with books all along the walls, and tables all through the middle, all round, so that everyone can sit around them and play games. It has the smell of a library, which is surprising- you’d think it would smell way worse than that. Less of a dusty, dry library, more of a lived in, used library, all the time.

I’m sure it was the first time I met him, Phil has this very distinctive laugh, that you walk in and you’ll almost always hear it’s like a: “Aaaahhhhahahaha”, and you’re just like, “What is that?” Over time, as you get to know Phil, and y’know he’s talking to people and laughing at what they say, or more often laughing at what he says, because he likes his own jokes. It’s a great thing.

Now, when I walk into his store, the first time I walked in there I had to be 16 or 17; he’s not much older than me and he runs this store. I’ve been going there for years and years though, and every time I walk in it’s like going back to my childhood almost, back in high school playing D&D with my brother and his friends. Every day, or every few days, after school we would play. Everytime I walk into the store, it’s the same feeling, the same smell of the books, and the games everywhere, and Phil there laughing at his own jokes- it’s awesome. It’s so great.

One of my favorite parts of it though, is whenever I go to the store I talk to Phil, because that’s what he does all day, he talks to people. We talk about games a lot, he has to talk about games, because that’s what he does. He’s also really good at it. He likes games a lot, he knows about them, he knows what makes individual games special. “What is great about this game or that game, what’s really fun about it?” You can go in there and ask for suggestions, and he always has great suggestions. You can say, “I’m going vacation with some family, we’re going to have 8 of us, and no one really plays games, but we want something to play that’s easy, quick, fun.” He’d say, “Oh yeah, here play this. It’s great.” Or, “I have these friends who are really hardcore into games, but we want something new,” and he’d say, “Oh, I have the perfect thing for you over here.”

Every time he suggested a game to me, it’s been great. There are always games being played around there. He and I talk a lot, because we’re both into how games are played, how people play games, what’s important about a game to people. And we really like talking about games, and we really like sharing games with other people. We talk about the games we play and how we play them.

Since I’ve been going there, over time, Phil has been losing his eyesight. When I first went in, he could tell who I was. At the time I had a long pony-tail, which is, y’know- surprising. 1990s game store, a big guy with a pony-tail, which is very distinctivie. I don’t know how he could tell it was actually me with his eyesight going, but he could.

Over time, his eyesight got worse and worse. At one point, he was holding bills up to his eye, pushing them up to his eyeball, getting them wet trying to read what the number was. At this point, he just says, “What are you handing me? How much does it say? What does it say on the register? What bills are you handing me? Ok, good, we’re fine.” And he used to be able to sorta see shapes, and at this point, he’s blind. That doesn’t really stop anything he does, he still talks about games all the time, he knows all the games that are coming in, he knows about the rules, he has people playing them all the time, he plays every game he can all the time.

So I go in and talk to him and we talk about stuff, share the things we’re doing, everything that we like to do, and y’know, he even does things that you would think are a little bit harder to do. Things that you would think are a little bit harder to do- like, he’s watching the “Walking Dead” and yelling at them for doing the stupid things they do all the time. Right, everyone yells at the screen when they’re doing that right? He can’t see the stupid faces they’re making when they’re making their terrible decisions, but he still yells at them just the same for what they’re doing.

So I was in his store, and he’s been trying to get more onto social media. He has an iPad, and he’s got it on Instagram and FaceBook and he can type updates and take pictures, and we tell him they’re fine- he doesn’t know- and do stuff for the store. It’s great.

The iPad has this screen reader feature that just tells you the text on the screen. It’s built in, apps just can plug into it if they want to do stuff with it. So he can get around on the iPad, on the Internet totally fine. The iPad reads to him everything that it has, and he doesn’t have any problems with it. At the time- this was a couple of years ago- a game had just come out, that I had heard of, and had played on the PC. It was an old 90s game that got a remake.

In this game, you’re the leader of this insane Viking band in this world where there are actual gods, and you’re trying to role-play as the chief of a clan that’s trying to become the “chief of chiefs”. There’s not clicking around play, it’s sort of like choose your own adventure. You come up to these problems, they have these ridiculous things, like you’ve met a village of Duck People, do you want to subjugate them or help them with trade… and you always help them. Don’t do anything bad to the duck people. It’s terrible later, trust me.

And, it’s great. It’s a really fun game to play, and it’s the perfect kind of game for Phil. One, because it’s all words and choosing, you don’t have to see what’s going on, you can just have it read to you. And the other, because he really likes this kind of roleplaying. In this game, you can’t have your current sensibilities on, how being fair works, or how justice works. This is a crazy world with crazy gods that are mad at you if you don’t slaughter enough sheep in their name.

It’s a lot of fun to play, and a lot of fun to roleplay. And it had just come out on the iPad, and I told him about. Look up this game, called King of Dragon Pass, and go there, and we’ll see if it works. So we look it up in iTunes, and it comes up and it’s there, and it’s talking about it, but it doesn’t say anything about accessibility for people with visual impairment.

I say, “Let me look up on the Internet, and maybe it says there.” At the time, there weren’t any reviews of it out yet, other than people that had played it in the 90s when it came out on the PC. There was nothing on it. They didn’t have a demo. It was $10. Phil said, “I’m sorry, I’m not going to waste $10 on something I don’t know that I can play.”

So I couldn’t share that with him. I couldn’t share that game with him, that I knew he would love, and that he would love to talk about with everyone that comes through. That was one of the first things that we couldn’t share. Even video games were something that we both enjoyed. Not just reading, not just RPGs, playing with people around the table, we enjoyed video games. He grew up in the Pac-Man, arcade era, where people were going to arcades back then. I grew up in the StreetFighter II arcade era, where again, people were going to arcades again fro a brief time.

http://thedailywtf.com/articles/meeting-halfway


Метки:  

CodeSOD: Reversing the String, Belaboring the Point

Среда, 27 Мая 2015 г. 13:30 + в цитатник

Метки:  

Take A Bold

Вторник, 26 Мая 2015 г. 14:30 + в цитатник

RTFM coffee mug

“Hello!” A perky voice chirped over Evan’s shoulder. “May I come in?”

It was unbearably early in the morning. Evan had yet to get into any sort of programming groove, and so swiveled away from his computer without difficulty. At the threshold of his cube waited a sunny young morning person he’d never seen before. Beside her rested a re-purposed overhead projector cart. Instead of AV equipment, it bore dozens of shiny new coffee mugs.

“Hi! My name’s Kelly.” Beaming, she stepped forward and offered the mug in her hands. “A little treat from the Marketing team! We’re celebrating the creation of a new recruitment bonus program!”

Bleary-eyed and far less enthusiastic, Evan took the proffered mug. Harsh florescent lighting glared off its glossy surface, which read:

Take A

“Cute, huh?” Kelly asked.

Evan managed a limpid half-smile, and nearly dropped the mug alongside the other glorified dust-magnets in his cubicle, before something made him do a double-take. “That’s the wrong tag.”

Kelly frowned in confusion. “What?”

“There’s a typo,” Evan said. “You wanted ‘Take A Break,’ right? That should be B-R-slash, not B-slash.” He pointed to the mug for emphasis. “Right now, it says ‘Take A Bold.’”

“Are you serious?” The smile vanished from Kelly’s face. Her eyes went wide.

“Yeah,” Evan said.

“Really?”

“Serious.”

“Really?” Kelly bit her lip, but her eyes betrayed her mirth. “Oh my goodness. You have no idea how many meetings we had. This slogan got batted around everywhere, up down and sideways, and no one ever said anything about that!”

How many developers were at those meetings?” Evan asked. The company offered hundreds to choose from.

“None. This was all within Marketing.” Kelly giggled freely. “This is everywhere! We’ve got posters, t-shirts, pens…!”

Evan joined in her laughter. “Of course. Printing promotional materials is our core business!”

“Don’t tell anyone else about this, OK? I’m kinda curious to see how long it goes before someone else brings it up.” Kelly returned to her cart and pushed it away, still red-faced and giggling. “Have a good one!”

Heh, typical. How often did Marketing ever vet anything with IT, or even think to? Evan couldn’t even think of any marketers or computer folk who had regular social contact with one another.

Well, maybe that’s about to change, he thought with another smirking look at his new mug. The two teams could bond over some nice coffee bolds.

[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/take-a-bold


Метки:  

CodeSOD: A Winning Strategy

Понедельник, 25 Мая 2015 г. 13:30 + в цитатник

Hey, Roberto said while pairing with an offshore programmer, this problem would be easier to solve with the Factory pattern.

Whats that?

Roberto explained both the Factory pattern and the idea of design patterns, and congratulated himself on helping a fellow developer improve their skills. Little did he know, he had created a monster.

Things started cropping up in his code base. For example, Roberto found this block:

	var SetInfoAsDateList = SetInfoList.Where(c => c.ValueType.Contains("Date"));
    foreach (var item in SetInfoAsDateList)
    {
    	//Use the Strategy pattern to find the correct date object.
        dateProcessor = GetDateProcessor(item.LabelName); 
        dateProcessor.ProcessDate(item, SetInfoList, criteria, 	agentInformation, agentOptions);
    }

Oh, the Strategy pattern? Lets go take a look at how GetDateProcessor was implemented.

	private static IDateProcessor GetDateProcessor(string value)
	{
	    IDateProcessor dateStrategy = null;

	    switch (value)
	    {
	        case "Change Date":
	            dateStrategy = new DateFormatProcessor();
	            break;
	        case "Contract Date":
	            dateStrategy = new DateFormatProcessor();
	            break;
	        case "List Date":
	            dateStrategy = new DateFormatProcessor();
	            break;
	        case "ListingUpdateType":
	            dateStrategy = new DateFormatProcessor();
	            break;
	        //case "Mobile Home Mfr. Date":
	        //    dateStrategy = new DateFormatProcessor();
	        //    break;
	        case "Sold Date":
	            dateStrategy = new DateFormatProcessor();
	            break;
	        case "Withdrawn Date":
	            dateStrategy = new DateFormatProcessor();
	            break;
	        case "Available Date":
	            dateStrategy = new DateFormatProcessor();
	            break;
	        default:
	            break;
	    }
	    return dateStrategy;

	}

Oh, like that. Its… extensible, at least, I suppose. At the risk of seeing yet another I wrote my own date processing engine WTF, should we take a look at what the DateFormatProcessor.ProcessDate function does?

	public class DateFormatProcessor : IDateProcessor
	{
	    public void ProcessDate(result DetailSet, List items, StatsCriteria criteria, login agentInformation, agent_options agentOptions)
	    {

	        var AvailableDate = items.Where(i => i.LabelName == "Available Date" && i.MlsNum == DetailSet.MlsNum && i.ColumnHeader != "META").FirstOrDefault();
	        var ChangeDate = items.Where(i => i.LabelName == "Change Date" && i.MlsNum == DetailSet.MlsNum && i.ColumnHeader != "META").FirstOrDefault();


	        var ContractDate = items.Where(i => i.LabelName == "Contract Date" && i.MlsNum == DetailSet.MlsNum && i.ColumnHeader != "META").FirstOrDefault();
	        var ListDate = items.Where(i => i.LabelName == "List Date" && i.MlsNum == DetailSet.MlsNum && i.ColumnHeader != "META").FirstOrDefault();


	        var ListingUpdateType = items.Where(i => i.LabelName == "ListingUpdateType" && i.MlsNum == DetailSet.MlsNum && i.ColumnHeader != "META").FirstOrDefault();
	        var MobileHomeMfrDate = items.Where(i => i.LabelName == "Mobile Home Mfr. Date" && i.MlsNum == DetailSet.MlsNum && i.ColumnHeader != "META").FirstOrDefault();


	        var SoldDate = items.Where(i => i.LabelName == "Sold Date" && i.MlsNum == DetailSet.MlsNum && i.ColumnHeader != "META").FirstOrDefault();
	        var WithdrawnDate = items.Where(i => i.LabelName == "Withdrawn Date" && i.MlsNum == DetailSet.MlsNum && i.ColumnHeader != "META").FirstOrDefault();






	        if (DetailSet.LabelName == "Withdrawn Date")
	        {
	            if (!String.IsNullOrEmpty(WithdrawnDate.LabelValue))
	            {
	                DetailSet.LabelValue = String.IsNullOrEmpty(DetailSet.LabelValue) ? "" : String.Format("{0:MM/dd/yyyy}", Convert.ToDateTime(DetailSet.LabelValue));

	                DetailSet.LabelValue = String.Format("{0:MM/dd/yyyy}", DetailSet.LabelValue);
	            }
	            else
	            {

	                DetailSet.LabelValue = "";

	            }
	        }

	        if (DetailSet.LabelName == "Sold Date")
	        {
	            if (!String.IsNullOrEmpty(SoldDate.LabelValue))
	            {

	                DetailSet.LabelValue = String.IsNullOrEmpty(DetailSet.LabelValue) ? "" : String.Format("{0:MM/dd/yyyy}", Convert.ToDateTime(DetailSet.LabelValue));

	                DetailSet.LabelValue = String.Format("{0:MM/dd/yyyy}", DetailSet.LabelValue);

	            }

	            else
	            {
	                DetailSet.LabelValue = "";
	            }

	        }


	     
	        if (DetailSet.LabelName == "List Date")
	        {
	            if (!String.IsNullOrEmpty(ListDate.LabelValue))
	            {
	                DetailSet.LabelValue = String.IsNullOrEmpty(DetailSet.LabelValue) ? "" : String.Format("{0:MM/dd/yyyy}", Convert.ToDateTime(DetailSet.LabelValue));

	                DetailSet.LabelValue = String.Format("{0:MM/dd/yyyy}", DetailSet.LabelValue);

	                               

	            }

	            else
	            {
	                DetailSet.LabelValue = "";
	            }
	        }




	        if (DetailSet.LabelName == "Contract Date")
	        {
	            if (!String.IsNullOrEmpty(ContractDate.LabelValue))
	            {
	                DetailSet.LabelValue = String.IsNullOrEmpty(DetailSet.LabelValue) ? "" : String.Format("{0:MM/dd/yyyy}", Convert.ToDateTime(DetailSet.LabelValue));

	                DetailSet.LabelValue = String.Format("{0:MM/dd/yyyy}", DetailSet.LabelValue);


	                
	            }

	            else
	            {
	                DetailSet.LabelValue = "";
	            }

	        }


	        if (DetailSet.LabelName == "Change Date")
	        {
	            if (!String.IsNullOrEmpty(ChangeDate.LabelValue))
	            {



	                DetailSet.LabelValue = String.IsNullOrEmpty(DetailSet.LabelValue) ? "" : String.Format("{0:MM/dd/yyyy}", Convert.ToDateTime(DetailSet.LabelValue));

	                DetailSet.LabelValue = String.Format("{0:MM/dd/yyyy}", DetailSet.LabelValue);

	            }

	            else
	            {
	                DetailSet.LabelValue = "";
	            }
	        }

	        if (DetailSet.LabelName == "Available Date")
	        {
	            if (!String.IsNullOrEmpty(AvailableDate.LabelValue))
	            {



	                DetailSet.LabelValue = String.IsNullOrEmpty(DetailSet.LabelValue) ? "" : String.Format("{0:MM/dd/yyyy}", Convert.ToDateTime(DetailSet.LabelValue));

	                DetailSet.LabelValue = String.Format("{0:MM/dd/yyyy}", DetailSet.LabelValue);
	             
	                 }

	            else
	            {
	                DetailSet.LabelValue = "";
	            }

	        }
	    }
	}

Maybe he should have used a few more design patterns…

[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/a-winning-strategy


Метки:  

Error'd: Tell QA They Missed One

Пятница, 22 Мая 2015 г. 13:00 + в цитатник

"You know, I've always wanted some sideways text that says 'not for sale'," writes Julie, "Too bad I'll never know."

James C. wrote, "When invited to sign up for the Microsoft Partner Research Panel, I was presented with a question that I couldn't quite answer."

"I canceled my U-Verse service today and went to check my online account," writes Bill W., "I'm not certain I'll be around on Nov 10, 2111 at 2pm or any other time for that matter."

Pius O. writes, "What do you know...White Night Melbourne exceeded its system power."

"Wow! I can type the exact same speed I do now if I just get some training!" wrote Abner Q.

"While trying to avoid doing work, I thought I would find something to get enraged at on the Internet and comment on it. I put in my more public email address and pressed 'Finish Sign Up' so I could comment on it, but their server has rejected it," Bob H. wrote, "Curses to us foreigners with our exotic email addresses!"

"I just wanted to report a bug on bugreport.apple.com," Simon E. writes, "now, I've gone ahead and made more work for myself."

"I snapped this picture while trying to refill my subway card in St. Eriksplan in Stockholm, Sweden," wrote Andreas, "It was unfortunate timing, but at least I know they're not using Vista."

[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/tell-qa-they-missed-one


Метки:  

CodeSOD: Sea of SQL

Четверг, 21 Мая 2015 г. 13:30 + в цитатник

Andy writes: “Operations reported that a query was taking a long time.  Even the 'developers' of this query didn't know why it was taking a long time.”

I tell ya, folks… some submissions, you just set down and back away slowly… then hunt up a magnifying glass and a bottle of aspirin.


SELECT /*+ optimizer_features_enable('9.2.0') */ N1.ORDER_ID AS ORDER_ID, N1.N1_STATUS_ID AS N1_STATUS_ID, N1.SKU_ID AS SKU_ID, O.SITE_ID AS SITE_ID, O.ORDER_DT AS ORDER_DT, O.D_TOTAL_PRICE AS PRICE, RS.LEGAL_NAME AS RESELLER_LEGAL_NAME, PRS.LEGAL_NAME AS PARENT_RESELLER_LEGAL_NAME, S.COMPANY_NAME AS SITE_COMPANY_NAME, O.ORDER_STATE_ID AS ORDER_STATE_ID, ITEM.COUNTRY AS ITEM_COUNTRY, E.COUNTRY AS E_COUNTRY, C.CUST_SERVICE_REGION AS REGION, RS.PARTNER_LEVEL, O.FOLLOWUP_DT, N1.APPROVER_CONFIRM_DT, 'N' AS REISSUE_IND, sign(nvl(sum(distinct(R.ORDER_ID * ( -(SIGN(NVL(R.OVERRIDE_PERSON_ID, 0)) -1)) )), 0)) AS RSRC_CTRL_VIOLATION, max(decode( p.email_address, :1, 'Y', 'N' )) AS MANUAL_APPROVAL_IND, max(nvl(R.RESOURCE_CTRL_TYPE_ID, 0)) AS RESOURCE_CTRL_TYPE_ID , nvl(CFA.POLL_STATUS, 'N/A') AS POLL_STATUS , CFA.APPROVE_METHOD FROM ORDERS_N1 N1, ORDERS O, ENTERPRISE E, ENTERPRISE RS, ENTERPRISE PRS, SITE S, ORDERS_RSRC_CTRL R, PERSON P, COUNTRY C, SITE_ITEM ITEM , C ERT_FILE_APPROVE_DV_T CFA WHERE N1.ORDER_ID = O.ORDER_ID AND N1.N1_STATUS_ID <> 3 AND N1.N1_STATUS_ID <> 10 AND O.CUST_ENTERPRISE_ID = E.ENTERPRISE_ID AND O.RESELLER_ENTERPRISE_ID = RS.ENTERPRISE_ID AND RS.RESELLER_REFERRED_BY_ENT_ID = PRS.ENTERPRISE_ID AND O.SITE_ID = S.SITE_ID AND O.ORDER_ID = R.ORDER_ID(+) AND O.ORDER_COMPLETE_IND = 'N' AND O.ORDER_ID = ITEM.ORDER_ID AND ITEM.ITEM_ID = CFA.ITEM_ID (+) AND (ITEM.COUNTRY IS NOT NULL AND C.COUNTRY_CD = ITEM.COUNTRY OR ITEM.COUNTRY IS NULL AND C.COUNTRY_CD = E.COUNTRY) AND O.ORDER_DT >= to_date(:2, 'mmddyyyyhh24miss') AND O.ORDER_DT <= to_date(:3, 'mmddyyyyhh24miss') AND BITAND(NVL(RS.ENTERPRISE_TYPE_BITMASK, 0), 32) = 0 AND C.CUST_SERVICE_REGION = :4 AND (P.PERSON_ID = ( select max(person_id) from contact_site cs where cs.site_id = o.site_id and cs.contact_type_id = decode( N1.SKU_ID , 5, 19 , 10, 20 , 11, 21 , 15, 25 , 36, 29 , 38, 33 , 40, 37 , 42, 41 , 44, 45 , 46, 65 , 140, 61 , 179, 69 , 185, 73 , 191, 77 , 310, 117 )) OR P.PERSON_ID = (SELECT PERSON_ID FROM ORDER_CONTACT_T WHERE ORDER_ID = o.ORDER_ID AND CONTACT_TYPE = 'COMPANY_APPROVER') OR (N1.SKU_ID = 191 AND P.PERSON_ID = (SELECT MAX(PERSON_ID) FROM PERSON)) ) AND O.D_PRIMARY_SKU_ID <> 220 GROUP BY N1.ORDER_ID, N1.N1_STATUS_ID, N1.SKU_ID, O.SITE_ID, O.ORDER_DT, O.D_TOTAL_PRICE, RS.LEGAL_NAME, PRS.LEGAL_NAME, S.COMPANY_NAME, O.ORDER_STATE_ID, ITEM.COUNTRY, E.COUNTRY, C.CUST_SERVICE_REGION, RS.PARTNER_LEVEL, O.FOLLOWUP_DT, N1.APPROVER_CONFIRM_DT, CFA.POLL_STATUS , CFA.APPROVE_METHOD UNION SELECT /*+ optimizer_features_enable('9.2.0') */ N1.ORDER_ID AS ORDER_ID, N1.N1_STATUS_ID AS N1_STATUS_ID, N1.SKU_ID AS SKU_ID, O.SITE_ID AS SITE_ID, O.ORDER_DT AS ORDER_DT, O.D_TOTAL_PRICE AS PRICE, RS.LEGAL_NAME AS RESELLER_LEGAL_NAME, PRS.LEGAL_NAME AS PARENT_RESELLER_LEGAL_NAME, S.COMPANY_NAME AS SITE_COMPANY_NAME, O.REISSUE_ORDER_STATE_ID AS ORDER_STATE_ID, ITEM.COUNTRY AS ITEM_COUNTRY, E.COUNTRY AS E_COUNTR Y, C.CUST_SERVICE_REGION AS REGION, RS.PARTNER_LEVEL, O.FOLLOWUP_DT, N1.APPROVER_CONFIRM_DT, 'Y' AS REISSUE_IND, sign(nvl(sum(distinct(R.ORDER_ID * ( -(SIGN(NVL(R.OVERRIDE_PERSON_ID, 0)) -1)) )), 0)) AS RSRC_CTRL_VIOLATION, max(decode( p.email_address, :5, 'Y', 'N' )) AS MANUAL_APPROVAL_IND, max(nvl(R.RESOURCE_CTRL_TYPE_ID, 0)) AS RESOURCE_CTRL_TYPE_ID , nvl(CFA.POLL_STATUS, 'N/A') AS POLL_STATUS , CFA.APPROVE_METHOD FROM ORDERS_N1 N1, ORDERS O, ENTERPRISE E, ENTERPRISE RS, ENTERPRISE PRS, SITE S, ORDERS_RSRC_CTRL R, PERSON P, COUNTRY C, SITE_ITEM ITEM , ITEM_FILE_APPROVE_DV_T CFA WHERE N1.ORDER_ID = O.ORDER_ID AND O.CUST_ENTERPRISE_ID = E.ENTERPRISE_ID AND O.RESELLER_ENTERPRISE_ID = RS.ENTERPRISE_ID AND RS.RESELLER_REFERRED_BY_ENT_ID = PRS.ENTERPRISE_ID AND O.SITE_ID = S.SITE_ID AND O.ORDER_ID = R.ORDER_ID(+) AND O.ORDER_ID = ITEM.ORDER_ID AND ITEM.ITEM_ID = CFA.ITEM_ID (+) AND ITEM.ITEM_STATUS_ID = 5 AND (ITEM.COUNTRY IS NOT NULL AND C.COUNTRY_CD = ITEM.COUNTRY OR C ERT.COUNTRY IS NULL AND C.COUNTRY_CD = E.COUNTRY) AND ITEM.START_DT >= to_date(:6, 'mmddyyyyhh24miss') AND ITEM.START_DT <= to_date(:7, 'mmddyyyyhh24miss') AND BITAND(NVL(RS.ENTERPRISE_TYPE_BITMASK, 0), 32) = 0 AND C.CUST_SERVICE_REGION = :8 AND (P.PERSON_ID = ( select max(person_id) from contact_site cs where cs.site_id = o.site_id and cs.contact_type_id = decode( N1.SKU_ID , 5, 19 , 10, 20 , 11, 21 , 15, 25 , 36, 29 , 38, 33 , 40, 37 , 42, 41 , 44, 45 , 46, 65 , 140, 61 , 179, 69 , 185, 73 , 191, 77 , 310, 117 )) OR P.PERSON_ID = (SELECT PERSON_ID FROM ORDER_CONTACT_T WHERE ORDER_ID = o.ORDER_ID AND CONTACT_TYPE = 'COMPANY_APPROVER') OR (N1.SKU_ID = 191 AND P.PERSON_ID = (SELECT MAX(PERSON_ID) FROM PERSON)) ) AND O.D_PRIMARY_SKU_ID <> 220 GROUP BY N1.ORDER_ID, N1.N1_STATUS_ID, N1.SKU_ID, O.SITE_ID, O.ORDER_DT, O.D_TOTAL_PRICE, RS.LEGAL_NAME, PRS.LEGAL_NAME, S.COMPANY_NAME, O.REISSUE_ORDER_STATE_ID, ITEM.COUNTRY, E.COUNTRY, C.CUST_SERVICE_REGI ON, RS.PARTNER_LEVEL, O.FOLLOWUP_DT, N1.APPROVER_CONFIRM_DT, CFA.POLL_STATUS , CFA.APPROVE_METHOD ORDER BY N1_STATUS_ID, ORDER_DT DESC

[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/sea-of-sql


Метки:  

Like a Well-Oiled Machine

Среда, 20 Мая 2015 г. 13:30 + в цитатник

It was Housekeeping Sunday in Dirks small IT shop, which usually meant taking their diminutive lot of servers down for routine maintenance. Dirk thought hed change it up this week and add some actual cleaning to their housekeeping tasks. He knew just the man for the job too - Andrew, the Big Bosss nephew.
Andrew couldnt be trusted with much, but he was assigned to work with Dirk on this Housekeeping Sunday so he would have to be assigned a task he couldnt possibly screw up. Several of the servers hadnt been physically cleaned in a while and their dust bunnies had evolved in to full-blown Killer Rabbits of Caerbannog.

Dirk dispatched Andrew to the IT closet that doubled as the janitors storage room. All the cleaning supplies you could possibly need are in there, Dirk assured him. Just use the cans of computer duster though. They should already have those little red straws jammed on to them and the label says Electronics Duster in big letters. When you see dust, just point and shoot.

YES SIR! Andrew shot back, with a sarcastic salute. Dirk brushed it off and went back to the remote firewall maintenance he was working on.

About half an hour later, Dirks phone buzzed on his desk with a text message from Andrew. CAN U COME IN HERE?? Comps r broken. It was immediately followed by a swarm of buzzes from email alerts about key servers not shutting down gracefully. Gravely concerned, Dirk rushed to the IT/Janitor closet in time to see Andrew stumble out of the room coughing and looking dazed.

I dont know what happened, man. I sprayed the stuff at the dust like you said, things started smoking, then the servers started crashing. Andrew recounted.

You should shut the servers down before you start opening them and spraying computer duster in there! Dirk said, peering inside the closet. His nostrils were greeted with the scent of burning chemicals that were not native to cans of air. On the work bench he saw empty cans of WD40 laying there, red straws and all.

We should get some different cleaning junk, I dont think that works right! Andrew blurted out from behind him.

For once, youre right about something Andrew& Dirk replied, as his head began to wrap around the fact that Housekeeping Sunday just became Disaster Control Sunday. But at least all the servers were now well-lubricated.

Ed. note: Someone (most specifically, me) did not get the next episode of TDWTF:Live! edited in time for this week. Our next episode, with John Lange, will appear next week. - Remy
[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/like-a-well-oiled-machine


Метки:  

CodeSOD: Recruiting Desperation

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

When hiring programmers, recruiters will often try to be clever. Sometimes, this results in a memorable trick, like EA Canadas job posting billboard.

EA Canada billboard which reads: char msg = {78,111,119,32,72,105,114,105,110,103,0};

Other times, these stunts dont go nearly as well. Andrea recently got this job posting from a recruiter. Note, theyre hiring for a PHP job.


using System;
 using Php;

namespace agency
 {
 class Senior Developer
 {
 static readonly uint THRESHOLD = 5;

     static uint Question(string text)
     {
         Console.WriteLine(text + ” [y/N]”);
         string answer = Console.ReadLine();
         return answer != null && answer.Equals(“y”) ? 1U : 0U;
     }

     static void Main()
     {
         string[] questionTexts =
             {
                 “Looking for a new challenge?”,
                 “Want to work in the heart of London?”,
                 “Do you enjoy solving hard problems efficiently and creatively in PHP?”,
                 “Would you like to work where you can make a difference?”,
                 “Want to work on building the latest interfaces with HTML, CSS & JavaScript used by millions of people?”,
                 “Would you like to know more?”
             };
         uint score = questionTexts.Aggregate(0, (current, text) => current + Question(text));
         Console.WriteLine(score > THRESHOLD
                               ? @”Contact JohnRecruiterGuy@AnonimizedEmailAddress.com today”

         Console.ReadLine();
     }
 }
}

Theres so much to hate here. Using C# code as a way to hire PHP candidates is bad enough, the fact that theyre hiring PHP developers is arguably worse (I wouldnt wish PHP on my worst enemy ), but this code wouldnt even compile.

I also have to wonder, do they think theyre being clever? Or maybe they think that theyre somehow weeding out candidates who couldnt figure out how to apply because theyve encapsulated the job posting in code, thus making it impenetrable to the normal run of man?

[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/recruiting-desperation


Метки:  

Pizza Hacker

Понедельник, 18 Мая 2015 г. 13:30 + в цитатник

...and at 10PM, see if the investigators can track a killer who hacks an online game and tricks children into delivering illegal weapons on the next episode of...

It was a quiet, lazy evening. Alan C. was in bed with his wife, getting his well deserved rest after a hectic week at work. Just as he picked up the remote to raise the volume, he was startled by a long, low growl.

"Hungry?" his wife muttered without opening her eyes.

"Guess so."

"No way I'm cooking anything today. Let's grab a pizza."

Alan sighed and picked up his laptop, looking for a pizza place nearby.

Mario's Pizza - the best pizza in town! the first Google result screamed at him. Order by phone or online!

Not wanting to disturb his half-asleep wife, he entered the website and clicked the big "ORDER ONLINE" button. After a few minutes of picking ingredients, sides, drinks, and sauces, he was ready to place his $50 order of "true Italian goodness". He scrolled down to the end of the form to submit it.

Then he scrolled up. Then he scrolled left, right, and sideways, but no matter where he looked, he couldn't proceed with his order. The submit button simply wasn't there.

But Alan wasn't a developer for nothing. A simple UI glitch wouldn't stand between him and his thin-crust treat. He fired up the console, opened the site's source, and typed:

He hit the button, and was instantly taken to the confirmation page. Patting himself on the back for his cleverness, he returned to watching TV.

A few minutes later, his phone rang.

"Hello, it's Mario's Pizza, the best pizza in town," a dull woman's voice announced. "Your order's ready, but we're not able to deliver it to your location. Would you like to pick it up yourself?"

Alan checked the website for the pizzeria's address. Just five minutes from here. Well, if that's what it takes... "Okay. I'll be there soon."


The counter propped up a bored-looking waitress. In the back, a man with a thick moustache, curly hair, and apron tended the ovens. Otherwise, the pizza place was deserted.

Alan approached the counter and pulled out his wallet. "Hello, I'm here to pick up an online order."

"An... online order?" The quiet blonde stared at him with wide-open eyes, like a deer caught in headlights.

By the looks of it, she's never seen a customer before, Alan thought. "That's right."

"I'll... get it right now."

She retreated into the back and whispered something to the aproned man- who frowned and shooed her back out.

"Sir, we apologize, but the order seems to be... delayed," she said upon returning. "If you wouldn't mind having a seat..."

"No, not at all." Alan was getting annoyed with the situation, but decided to bite the bullet. After all, a good pizza is worth the wait.

A minute later, the shop door chimed. Two policemen entered, both sporting slight looks of confusion. One of them- a short, black youngster with thin-framed glasses- stepped behind the counter with the waitress to examine a computer monitor. The other- buzz-cut, muscular, a head taller than Alan- struggled to get through the small door frame.

The man in the back ran out, pointing at a surprised Alan. "There he is! Un criminale!" he yelled with an Italian accent far too over-the-top to be genuine. "Arrest him now!"

"Sir." The taller policeman sat down with Alan. "We've received a report of cyber crime."

"Excuse me?" Alan struggled to make sense of what was happening.

"According to the owner of this establishment-" the policeman pointed at the Italian "-a security breach occurred on his website about an hour ago. Our technician is investigating. In the meantime, we'd appreciate you telling us what you know."

"Um, I... okay, I guess?" Alan's mind kept drawing blanks. Maybe it's some hidden camera show? Like, you help out and you get a million dollars? "I used the website to place an order..."

"A-HA!" the owner screamed loud enough to knock both Alan and the policeman out of their chairs. "You admit! You criminale! You assassino! The webmaster took the website down today! Nobody can order anything!"

"But the website's up!" Alan cried in protest.

"It does seem to be working," the other policeman called from the monitor.

"But you can't order!" The owner rushed to the computer, clicked "ORDER ONLINE" and turned the monitor. "See? See?!"

Something in Alan's mind fell into place. "The form was broken! There was no submit button, so I worked around it."

"A criminal, and a shameless one to boot!" the owner cried.

"What?! I just added a button that wasn't there!" Alan cried. "Anybody could do it!"

"Um, if I may?" the officer at the computer- obviously the more technical of the pair- said.

Angry half-Italian screams drowned him out. "He hacked us! He changed our code!" the owner cried. "Arrest him!"

"Sir, I-"

"Come on, what am I paying taxes for?! Put him in jail! Him, his sons, his son's sons, and-"

"Sir, I advise you to drop the matter!" the technician finally managed.

"Drop it? Pigliainculo, vai e fot..."

"Sir," he continued, "if you don't drop the charges, we'll have to report this incident to the Internet Police."

"Report?" the owner repeated with a quiet and much more New York voice.

Alan was about to protest, but at the last moment decided it was probably wiser not to.

"There are strict standard security protocols for taking down US-based websites. They've gone shamlessly ignored here," the technician said. "That's a serious offense, carrying a maximum fine of up to $500,000."

"Five... hundred...!"

Alan did all he could not to burst out giggling.

"However... if you don't press charges, we don't file paperwork, and this all goes away," the technician said. "So? What'll it be?"

"No, no, of course, no charges, no! Free of charges! Pizza too, free of charge! Just go!" The owner motioned to the waitress to grab some boxes from the kitchen and shove them into Alan's hands.


As the doors closed behind them, Alan handed two of the boxes to the policemen. "Wow, I owe you two big time. Internet police? Really?"

"I've always wanted to say that." The technician smiled. "When you see how stupid people can be with security sometimes..."

"Well, it's a good thing they don't give them guns," the other policeman chuckled.

"We're done here," the technician said. "Be safe, and don't go around hacking pizzerias!"

"Don't worry, never again!" Alan said.


"Hey, what took you so long?" his wife asked from under the covers.

"Oh, nothing really. I just had a little chat with the owner," Alan said. "He said they had some... website problems."

"Let me guess, you fixed it for them. You're so easily sidetracked."

"Guess you can say that." Alan picked up a piece of pizza and grabbed the remote. It was five to ten, and he wasn't going to miss a single second of the show.

[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/pizza-hacker


Метки:  

Error'd: BSOD Could Go All the Way This Year

Пятница, 15 Мая 2015 г. 13:00 + в цитатник

"Yes! I'm a huge fan of BSOD. I'm glad to see SportsCenter giving some well deserved recognition!," Mike writes.

"Found this while on a university's web page," writes Michael P., "So, does this mean that I might be using this page un-officially?"

Ben S. wrote, "Sure, it gets points for portability, but I'm concerned about how usable it is."

"I don't think that Unity understands what the word 'failed' means," writes Roman.

Ishan writes, "Looks like BitDefender is testing in production."

This is a blurb about the Error'd that Scott sent in.

Stefan wrote, "Even if you can't read Swedish, it's pretty easy to spot the WTF."

"I guess this is what I get for giving out my email address," wrote Andreas.

[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/bsod-could-go-all-the-way-this-year


Метки:  

CodeSOD: Happy Little (Read-Only) Trees

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

Blossoming tree - painting by L'aszl'o Medny'anszky

"Joey," asked Ross of the new contractor, in a slow, careful voice, as though trying to calm a large predator. "Explain to me why the data tree has this read-only flag?"

"It's more secure that way. Obviously, if it's read-only, arbitrary people can't write to it."

Deep inside our Jar? Are we afraid of our own code? Ross wondered, but he dismissed his doubts. Sure, let him have that one. "Okay, but why is there a flag at every single node of the tree?"

"Well, obviously, if only the root's protected, people can still edit the leaves and branches. We want to protect the whole tree."

"Okay, but that means to edit the setting you have to visit every single node, which is O(n) at best."

"Price of security, man."

"Okay, but even so, why do you flip the flag before every insert, only to set it again after? Doesn't that make building the tree painful?"

"You can never be too careful."

"Okay, even if I buy all that, and even assuming that this is the best possible way to solve this problem- which it's not- Why do you visit every node twice?"


class treeNode {
	bool readOnly;
	treeNode child, sib;

	void setReadOnly(bool ro) {
		readOnly = ro;
		if (child != null) child.setReadOnly( ro );
		if(sib != null ) sib.setReadOnly( ro );
	}

	void updateReadOnly(bool ro) {
		setReadOnly( ro );
		if (child != null) child.updateReadOnly( ro );
		if( sib != null ) sib.updateReadOnly( ro );
	}

	// call on root node
	void insert(treeNode parent, treeNode fng) { 
		updateReadOnly(false);
		if (parent.child == null) parent.child = fng;
		else {
			treeNode k;
			for (k = parent.child; k.sib != null; k = k.sib);
			k.sib = fng;
		}
		updateReadOnly(true);
	}
}

Faced with this evidence, even Joey was silenced, though not for long. "It's.... doubly secure?"

"It's taking upwards of twenty minutes to build the tree!"

Joey's face lit up. "Ah! Right! I was just reading last week, it turns out, slower code is more secure, cryptographically speaking."

Faced with stupidity this blinding, all Ross could do was walk away. Hopefully Monica, the real security expert, would fare better setting him straight...

"Hi Ross!" she said, glancing up briefly before turning back to her computer. "Can't talk now. The new guy forgot to secure the data endpoint for our web service. The whole tree's publicly accessible!"

Ross smiled to himself as he headed back to his own desk. At this rate, Joey wasn't likely to last long anyway.

[Advertisement] Release! is a light card game about software and the people who make it. Play with 2-5 people, or up to 10 with two copies - only $9.95 shipped!

http://thedailywtf.com/articles/happy-little-read-only-trees


Метки:  

The Daily WTF: Live: Fired Up

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

On April 10th, I hosted The Daily WTF: Live! in Pittsburgh. It was a blast. We had a great crowd, and some great performances.

You know him as the master of the Errords, the king of the CodeSODs, the Dev-Master of the Dev-Disaster, Mark Bowytz. Once upon a time, though, he was just another lowly office drone like yourself. This is his origin story: the WTF that launched a thousand head-desks.

Direct Link (mp3).

This episode is brought to you by our sponsor, Puppet Labs. Check out their intro video, it gives a pretty good overview of how they help their customers get things done. Start a [free trial](http://puppetlabs.com/download-puppet-enterprise) today!

Tune in next week, when John Lange tells us a little bit about his friend Phil, and a WTF we often don't think about enough.

Transcript

Whenever I write an article ­ its always based on a reader submission.

­ Ill draw from personal experiences or I might borrow names of people I know and turn them the hero/villain for my own amusement.
Hide in my kids birthdays in a CodeSOD.

BUT ONE THING THAT I NEVER DO ­ Tell my own WTF tale. Well, tonight Im going to bend that rule and tell you about the time &that I got fired.

Now, this was more than 10 years ago at this point and enough jobs ago that I dont list it anywhere so if theres any statute of limitations, I bet Im probably safe.

So, Initrode right ­ big local company; numero uno widget producer in the region ­ recruited me as a development intern my senior year of college. ­ Standardized aptitude test; two on­campus interviews&all very formal. They clearly only wanted the best.

After I passed my physical exam (You know ­ to make sure that I was fit enough to occasionally lift 5 pounds and remain seated for lengthy periods of time ­­ thats a quote there) I started out working downtown in the world HQ where I was handed a How to Program Oracle book (which I still have), given a few menial analysis jobs and told to have at learning the big nasty custom ERP system that sat on top of the purchased ERP system.

Then ­ following graduation, they officially offered me an entry level position (pretty much intern salary + bennies)

Know this ­ Everything was formal

­ Donut Club on Fridays was tracked by the PM (completely coincidental) ­ The Dress Code ­ Polos and khakis? Nope ­ slacks and ties for all. ­ You know, just in case a customer showed up at HQ, they didnt want to have unprofessional looking schmoes to give the wrong impression.

­ Program names were encoded to exacting standards ­ NO Widget Inventory Trackers here ­ oh no ­ ORMR0030 which would be completely clear as being the ORDER MASTER MODULE #30

­ This could then be cross referenced to the real name and links to where the source was in a master spreadsheet (which was pretty techy at the time; it replaced a 3 ring binder!)

One other thing that they were very formal on ­ separation between contractors and full time employees.

­ I was lucky! Being FT, I was invited to all the holiday parties and when they celebrated the construction of the new outdoor pavilion, well I was there at the celebratory cook out.

­ My contracting co­horts ­ well ­ they were welcome to partake in any of the leftovers that made it back to the office.

­ If youre thinking thats not very fair ­ well, youre absolutely right! But hey ­ nobody had a choice ­ thats just how it was. There simply wasnt enough $$ to handle the additional 5 to 7 headcount.

Then&in the first few years after the turn of the century, the so­called dot com bubble burst and well, no more room for discretionary spending&like contractors.

Our group had its own PC Tech (who I was friends with) so naturally, he was quick to be cut. Now, because we went out to lunch or grabbed the occasional coffee ­ the decision was made ­ HEY! Mark should be our new PC Tech. In addition to development!

Yay.

So, after a brief on­boarding to know how to get repairs expedited through the PC Support Group (remember Im still a dev), I was thrown into the mix supporting a fleet of Compaqs running NT 3.51 along with printers and other misc IT equipment as well as own my little corner of the messed up ERP system.

And so it continued.

Along the way, there was one occasional issue with accessing some part of the ERP system (client server all the way), that would be remedied by clearing out the computers temp folder. At first, Id walk over to peoples computers and clear out from there, but after I learned that I could do this remotely ­ well, shoot ­ why bother getting up? And well, why bother waiting for anybody ­ Ill just proactively delete their temp files. Talk about efficient!

Now the files that were there were usually named blahblah.tmp or foobar.dat&so, on the day that I was cleaning off the directors temp files , you can imagine how my interest was piqued when I saw Developer Employee Cost Cutting Plan.xls The thing was that after contractors were cut, rumors circulated that the next potential round of cuts xx were coming soon and that the list had been made. Pfft& theres no plan. Theres no list of people being laid off. Ignore the rumors!

Meanwhile, I was the only income in our family. We had a young kid and a baby on the way ­ So, naturally I wanted&no&NEEDED a peek before cleaning it out.

So, before deleting it, I printed out a copy. Looking it over, much to my surprise (my last performance review wasnt necessarily glowing ­ something had to give), I was NOT on the chopping block&but some of my close colleagues. Colleagues with KIDS were on the list. At this point ­ had kept it to myself, this story would have been over but no ­­ I gave a discrete heads up.

I felt good ­ a bit like Robin Hood. The myth of the non­existent spreadsheet was FALSE and the folks on the chopping block could look for other options before they were unceremoniously cut.

A few days later ­ a request for THE projector arrived. You see, this wasnt any ordinary piece of equipment ­ this was when projectors were expensive enough to warrant being stored in a locked case in a locked closet. &or at least mgmt felt this way. Normally, I would receive a formal request form but this time ­ it was a phonecall from my team lead. I was to haul the projector two floors up and bring it up ASAP! The one they had was broken.

No prob.

So I lug this case to the meeting room where Im greeted by my team lead and theres&nobody. Hmmmm&

Oh, sorry I was wrong ­ you need to come over t

http://thedailywtf.com/articles/fired-up


Метки:  

The Bureaucracy is Expanding…

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

Government Department prided itself on the precision of its process and procedures. Every function in the organization had its functionary, at least in theory. Joe had only been on the job a month when he discovered that figuring out which functionary would actually function wasnt as easy as it looked. The Department used a database known as CAS to track all its financial data, including wages and work orders. Since Joe intended to earn wages in return for coordinating those work orders, he was going to need access to CAS. His first inkling that there might be a problem with the pervasive process was that, despite all employees needing at least basic CAS access for the payroll system, it wasnt until his fourth week with the department that Terry, his team lead, gave him the good news.

Youve been cleared for a CAS userid, Terry said. Go ahead and call up the CAS service desk to request it.

So they havent created my ID yet, just cleared me to have one? Joe asked.

Thats right. The CAS desks extension is 8888.

Joe dialed the extension. At the other end was the cheerful recorded voice of one of those programs that asks you to say what you want instead of pressing buttons. Joe just blurted, CAS.

For new or returning Government Department employees, the voice said, contact the security unit at 8889, or speak to the CAS role 132 user from your local IT unit. Goodbye!

Joe muttered to himself and dialed the next extension. This time, the voice was neither recorded nor cheerful.

Security. What seems to be the problem?

Well, I need a CAS account-

You need to contact the CAS service desk. And Joe was hung-up on for the second time in five minutes.

The process having officially sent Joe in a circle, he tried the cheerful recordings alternative. He found his way to the local IT office and asked the team lead there about CAS. The response was cheerful, not recorded& but not helpful, either.

CAS? Oh, we cant give you that. The service desks extension is-

I already called them. They told me to talk to you& something about the CAS role 132 user?

The IT Team Leader chewed on that for a while, then turned and picked up his phone. While he dialed, he looked over his shoulder at Joe.

You know, its funny! I just finished getting CAS accounts for some new team members- took three days in the end!

Joe grimaced. The IT TL spent some time saying uh-huh into his phone, then hung up. He asked for Joes TLs number, and promised to walk Terry through the necessary process. Joe returned to his desk and waited. That afternoon, Terry popped in to give him the good news.

I sent an email to that address IT told me about, it bounced back saying we need to contact the local CAS coordinator. I just emailed her, so we should be good to go any time now!

Terry left, and Joe returned to his job of waiting to be allowed to coordinate work orders. Fortunately, it didnt take long to get a reply from the CAS coordinator. Joe was CCed:

Thank you for your email. I am out of the office on leave until August 30. For all enquiries and CAS account setup, please contact the CAS service desk at extension 8888.

Regards,

Jane Smith CAS Coordinator Government Department

August 30th was two weeks away. Prevented from taking his proper place in the process, Joe proceeded to take an early lunch.

[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-bureaucracy-is-expanding-


Метки:  

CodeSOD: And I Try, and I Try

Понедельник, 11 Мая 2015 г. 13:30 + в цитатник

If you want to put everything under test, you have to write code like this.

At least, thats what Alexs co-worker said to him, when Alex demanded an explanation for this block of code.

        public interface ITrier
        {
                void Try(
                        Action tryAction,
                        Func catchFunc)
                        where TException : Exception;

                void Try(
                        Action tryAction,
                        Func catchFunc,
                        Action finallyAction)
                        where TException : Exception;

                TReturn Try(
                        Func tryFunc,
                        Func catchFunc)
                        where TException : Exception;

                TReturn Try(
                        Func tryFunc,
                        Func catchFunc,
                        Action finallyAction)
                        where TException : Exception;

                TReturn Try(
                        Func tryFunc,
                        Func catchFunc,
                        Action finallyAction,
                        Func defaultReturnFunc)
                        where TException : Exception;

                TReturn Try(
                        Func tryFunc,
                        Func catchFunc,
                        Func defaultReturnFunc)
                        where TException : Exception;
        }

Now, this code doesnt precisely do anything, but dont worry- Alexs co-worker built an AbstractTrier class, which implements this interface, and can be inherited from in any situation where your testing patterns prohibit the use of try/catch blocks. Theres also a MockTrier, making this useful for testing, somehow.

And before you point out that theres a perfectly good language construct that could be used instead of this interface or its implementors, Alex warns us that the genius behind this code also has crafted ILooper, and IConditional.

[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/and-i-try-and-i-try


Метки:  

Error'd: You're Welcome...?

Пятница, 08 Мая 2015 г. 13:00 + в цитатник

"I clicked 'Yes' when asked if I wanted to send a report of VLC's crash, but apparently my attempted cooperation wasn't really appreciated," David K. writes.

"Well, I mean at least I have a map," writes Peter D.

Brian asks, "Wow! I guess this is how the 1% lives."

"Let me get this straight, Samsung. In order to connect my new Blue-ray player to the Internet, you want me to read a 338 page contract...Using my remote control...One page at a time...," writes Andrew A.

"I'm going to guess 'found' will complete this one," wrote Linus.

"I just installed Start Chart and this was the frist push I got," Evi V.

"Um, no Xerox, that's not what I meant at all," Anon wrote.

"I'm not sure that I'm ready for all these changes to the Star Wars universe," writes Chris.

[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/you-re-welcome-


Метки:  

Announcements: Help Us Back Programming Languages ABC++

Четверг, 07 Мая 2015 г. 21:35 + в цитатник

TLDR; I have another Kickstarter Project, this time it's a kids book about programming!

##

Last year, I put a project up on Kickstarter that was inspired by things I personally love: games and software. Release! was supposed to be a one-off, quick card game project, but thanks to all of your help, it got pretty popular, pretty fast. We're halfway through selling our second print run of the game, and while it'll never do well enough to pay the rent... it may just do sell enough to get us a nice bottle of scotch, which we sorely need.

I had such a great time with the whole venture that I wanted to put out another project. Which leads me to: Programming Languages ABC++. Here is the idea, it's an alphabet book which has a different code language for each letter: A is for Ada, B is for Basic, etc. Each page has a "Hello World" program in that letter's language, along with some facts about the language, and a colorful illustration of our mascot, the Computer Bug.

Before you say it, I do realize that a toddler won't understand the code. It's not about teaching a baby to make a program, it's about creating a way for us parents, uncles, aunts, etc. to connect with the kids in our life. You know, share a little about what we do, in a context that the kids will actually enjoy.

The whole thing started with my friends Michael and Martine Dowden, a pair of developers who had an idea to make an alphabet book that was all about programing. Within seconds of them explaining the idea to me I knew this would be the next fun project.

Anyway, the project is live, and you can score a book for just $15, or a number of other fun rewards. Even if you don't have any kids in your life, and you've mastered your ABCs, backing at a $1 is still a great way to show your appreciation -- which, of course would be much appreciated!

[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/help-us-back-programming-languages-abc


Метки:  

Поиск сообщений в rss_thedaily_wtf
Страницы: 124 ... 24 23 [22] 21 20 ..
.. 1 Календарь