Things Programmers Shout #808
*tests code* âYes it works!â *tests code with other variables* âNevermind, it just keeps returning â2â which just happened to be the right answer the first time.â // submitted by @broadwayuponastar
RMH

ellievsbear

Aqua Utopiaď˝ćľˇăŽĺşă§č¨ćśăç´Ąă
almost home

oozey mess
đŞź
One Nice Bug Per Day

#extradirty
wallacepolsom
Misplaced Lens Cap
Xuebing Du

taylor price
todays bird
h
$LAYYYTER

Product Placement

seen from United States
seen from T1

seen from United Kingdom
seen from Germany

seen from Malaysia
seen from Netherlands
seen from United Kingdom

seen from Malaysia
seen from Canada

seen from France

seen from United States
seen from United States
seen from Switzerland
seen from United States

seen from TĂźrkiye

seen from Malaysia

seen from Ghana

seen from Malaysia
seen from Belgium

seen from Netherlands
@fyeahcode
Things Programmers Shout #808
*tests code* âYes it works!â *tests code with other variables* âNevermind, it just keeps returning â2â which just happened to be the right answer the first time.â // submitted by @broadwayuponastar

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch ⢠No registration required ⢠HD streaming
327 Checkboxes for EU GDPR
If youâre living in the EU, Tumblr had to tell you what theyâre doing with your data when you recently logged in. They also gave you the choice to disable data sharing with all their partners â for that, you just had to untick 327 checkboxes.
But fear no more, because with a bit of JavaScript I just wrote, they all untick immediately!
If you already left the page crying and screaming and with anger on your face, getting it back to apply the JavaScript is simple. On your dashboard, click on Account â Settings â Privacy and uncheck âCookie Consentâ:
Then, when on the page, click Manage Options â Manage â Show.
Open the developer console (*), paste the following snippet and press enter:
Array.prototype.forEach.call( document.querySelectorAll("[type='checkbox']"), (e) => e.checked = false );
And all your 327 problems are suddenly gone!
* How to open the console:
Chrome: Ctrl+Shift+J (Windows), Ctrl+Option+J (Mac)
Firefox: F12
Edge: F12
Safari: Go to Preferences â Advanced â tick âShow Develop menu in menu barâ; open Develop menu; click âShow Error Consoleâ
Catching yourself writing unit tests as a method of procrastination.
I think the best piece of advice I have got ever was in my third year of CS, in an algorithms and complexity class. I remember when we went up to the blackboard and someone was stuck in some part of a problem, the professor always told us to take a step back. Literally. So I remember people took a step back (even, sometimes some people returned to their seats to see the whole blackboard) and it seemed, they magically got the answer. In those times I questioned that. How someone who has been stuck in the same problem for a long time, take a step back and then see whatâs the problem?
Then, one day, I was in the blackboard and was stuck somewhere, the professor gave me that advice. One step back and I saw the blackboard in a different way. I was able to keep on writing a solution for the problem.
After that, I found it doesnât need to be a literal step back. It can be going for a walk, drink or eat something, whatever. You know that, if you ever feel stressed and you can keep going on, relax, but you seldom do that. At least, I donât.
So, today, I was programming something, but it didnât work. I was 100% sure, I understood what I needed to code, but it wasnât still working. I decided to brush my teeth and drink water; meanwhile I was summing up what I had done. I rethought the whole problem for a moment, and I got it! I was focused in the details, instead of the whole picture.
âHow much is accidentally switching two OpenGL statements around?â
âThat would be five hours of total despair, trying to find the cause without any errors or actually any output at all. Have fun.â

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch ⢠No registration required ⢠HD streaming
Unit tests
If you were asking me about THE one thing Iâd suggest to every programmer, itâs this: Write unit tests.
Everybody knows they should, but many still donât. Just do it. Learn the framework for your language, itâs worth it. Not only does it help you save possibly many hours of painful debugging in the long term, it also makes you rethink how you structured your code, rethink what it should be doing in the first place.
So go ahead. Pick some project, and create some tests for it. Or do it with the next project ahead. It feels good having something that works reliably, and even better being able to prove that it does.
Meanwhile in C#
(via Filip W)
Yeah. Of course. I mean, why not ;)
Debugging be like
Worst feeling: Realizing the reason for your Batch process not completing for 30 minutes was that a piece of text inside the window was selected. WHY DID I WASTE MY TIME ON THIS ?!
And yes, if you havenât noticed, execution stops when thereâs a selection in the prompt.

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch ⢠No registration required ⢠HD streaming
Not programming related, but THIS IS THE REAL ORIGINAL iPhone. Yes, that thing existed. Thereâs even a November 2, 1998 CNN article about it: http://edition.cnn.com/TECH/computing/9811/02/netphone.idg/
Apparently it had a â(6-by-4-1/2 inches) touchscreen with stylus, Internet scroll keys, and a retractable QWERTY keyboardâ. Wow.
Consider going into a classroom and looking around, and youâre the only man there. Even if youâre totally ok with that (heck, you expected it), you notice. You feel all the women in the room notice you and see that a lot of them are glancing over at you or making comments about your presence. Ok, you knew that might happen. A woman next to you says, âHey, cool, a guy in a CS class, good for you.â When it comes time to form a study group, half the women in the class donât want to work with you because they assume men arenât as good at CS. The other half jockey to work with you, some for the novelty (âHey, Iâm in a group with the guy, â) and half because they want to ask you out. When you go to apply for an internship, a lot of companies seem really interested in you, but youâre not sure if itâs because they like your resume or just because youâre a guy in CS and they want to look open and forward thinking by having lots of male interns coding. You meet up with a group of female interns and one makes a slightly sexual joke. Everyone freezes and looks at you - are you one of those guys in CS that is serious and canât take a joke, or will you be one of the girls? At your job after you graduate, itâs naturally not ok for a woman to say outright that sheâs prejudiced against male coders⌠But maybe your boss gives you slightly different work, or it takes longer for you to get a promotion because they need more proof that you are good - you donât get the benefit of the doubt the way the girls do. When you express a strong opinion about a tough problem, the women write it off as you being sensitive and emotional - men often are, you know. When discussing your career ambitions, your coworkers often ask you how children play into that - I mean, youâre probably looking for a wife and plan to have kids since youâre in your late 20s. Everyone knows itâs a safe bet that kids are going to derail your career at least temporarily, if not permanently. You frequently police how often you mention family at all for fear people will assume youâre expecting a kid soon⌠⌠Does this begin to explain it, at all? Even when a company is open to women working in all areas and no one is a dick, there is still a lot of pervasive bias that affects how women are treated and perceived. Why would you notice? It doesnât affect you.
Electrostaticrain (Reddit)
Programmers nowadays have to...
... write 100%-covering unit tests;
... set up continuous integration, linters, hinters, style checkers, ...;
... follow style guides for every language;
... meet impossible deadlines;
... meet impossible management/customer/end user expectations;
... read through terrible code others made;
... read through terrible documentation others made;
... make terrible documentation themselves;
... fight with the IDE;
... fight with the build tools;
... deal with unreproducible crash reports coming in from everywhere;
... debug code written at 2am (by themselves AND others);
...
...
...
... KNOW HOW TO PROGRAM.
Seriously: First âwhatâ, then âwhyâ
TL;DR: Before you try to fix the error, know for certain where it comes from.
Now, this seems obvious, right? And it is. Yet, I didnât follow this principle a few days ago, and I beg you not to make the same mistake.
A little backstory. I deployed a rather huge web app Iâm writing on a brand-new server. After I had set up the database, I gave it a quick test-run and Node.JSâs generic ECONNREFUSED error popped up. Now, due to the fact that I had just worked on the database, my brain made a connection where there shouldnât be one.
I proceeded to work on âfixingâ the database for the following 7 hours, ripping every last nerve of mine out in the process, without any result. Could connect via CLI, via telnet (even remotely!), via the web interface, only my code kept endlessly throwing the same error.
Then it dawned on me. I added another string to the statement that prints database errors â and it didnât appear, the message stayed unchanged. How could this be possible?
Well, I hadnât yet installed the mail servers, and that was where the error actually came from, since Node couldnât connect to those (which makes total sense, right?). But, never had I spent a single thought on just trying out whether the database worked; never had I spent a thought on the fact that the message was so generic and could come from literally anywhere.
Seven hours lost fixing a bug that did not exist in the first place. Never will I make the same mistake again, I had learned my lesson. Hopefully you can do so, too.
Never interrupt a programmer.

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch ⢠No registration required ⢠HD streaming
What's the coolest thing you've coded for?
There were many things that I found to be âsuper coolâ when they happened. Yet, it doesnât feel like Iâm at the point already where I can look back and say that something absolutely killed it.
Up until a few months ago, I worked mostly on rather small projects, although lots of them. I am just now starting to focus more on big ones, so maybe in a few years I could give you a proper response.
Developing
Making software, nowadays, is just 20% code â the remaining 80% is fighting with the countless tools over the way you want it to crash.