Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Search - "booleans"
-
Me: "can we go to the cinema this weekend?"
gf: "uhm, maybe if blablabla..."
Me: "boolean!"
gf: "true"
...9 -
What?!?
There is an ^= operator in Java for booleans. I have been programming in Java for 4 years now and never knew this. Like b ^= true will flip b.
Mind blown; this is the greatest thing ever14 -
Why yes, it makes total sense for a variable called `$connectionString` to only accept either booleans or integers ... wat
Also beware the beauty on how well that names conveys the variable's intent.
FML3 -
I try and try and try to teach my coworker critical thinking skills, proper programming techniques, and standard git etiquette. Then I add 4 booleans to solve one problem, use strings instead of ints to find unique SQL Server entities, and push right to the development branch.
I am a real asshole, but at least I am not fake.4 -
Spent hours trying to figure out why API calls to a third party service weren't working.
Hit up their support and find out the following:
"Hi there, we can only take true and false as strings."
"Uhmm... Does it take anything apart from true or false?"
"No, but they must be sent in as strings"
"Any reason why you don't take booleans if it's just true or false?"
*crickets chirping*
GFG2 -
Teaching new devs, hired straight from India.
This is today.
Bug1: We have four lists, each item in these lists has a variable called "Charge". This var is a double and we need to convert it to currency.
Dev creates fifth list called "All lists" and converted it's charge to currency then questioned why it didn't work.
I explained, his solution? Convert each list into currency.
I explained that's wrong and told him what he needed to do. He did List1:Charge into currency, but left his other conversion in place just in case.
I walked him through fixing it which took 10 times as long as necessary, only to find out he randomly converted four booleans into currency for no reason.
Bug2: we take integer, convert to string and concat "Months" on the end.
Doesn't work for him, tells me he doesn't know why.
I told him that he's not outputting the variable that we did it to, he is instead outputting a custom variable he made and didn't do anything to.
Bug 3: followup to #2, he fixed it as I instructed, but then added months as static text to the output so now it reads "Months months".
Bug 4: to make his code cleaner, he presses enter in the text box. Unfortunately he did that IN A STRING so his output is full of random /r/n
How do you guys deal with coworkers like this? He isn't new, this is supposed to be an experienced developer. Im only in my 2nd year23 -
Me : I'm afraid of booleans. My friend said that you can help me !
Therapist: ya, that's TRUE
Me: 😥😐4 -
Booleans that are hardcoded as true for a test, that you don't change the value at all
But they still switch to false by itself
Can I go to bed pls I don't want to deal with that3 -
Legacy code huh?
Well i'd say it would be when i was workng on an old java app that was apparently written by a retard.
He had used strings to represent booleans for no apparent reason. As if that wasn't bad enough he would use different strings too:
Y N true false 1 0
He used them randomly too , y and 0
N and true
😡
I sense it was done on purpose
Perhaps he knew he was leaving soon2 -
Pulled into an 'emergency' meeting with a group of web designers deeply concerned a particular service wasn't going to meet all their requirements.
DevA: "For each page, Its going to be A LOT of work to retrieve all the data and store it's state. Every page load will require a round trip to the service."
DevB: "Yes, we aren't sure how the service should be changed to do what we need."
Mgr: "What is it not doing now? Doesn't the service already returns all the necessary data?"
DevA: "Well...um...its all the boolean fields. Some may be defaulted from the database or false because the user unchecked the box. We have to know which is which"
Me: "Why? Are you doing anything different in the UI? Checkbox will be true or false. What or who set that value is irrelevant"
DevC: "Well, it matters if the user didn't fill out all other other values."
Me: "How so?"
DevA: "Its matters because the values in the other fields. Its going to be A TON of work to figure out."
<mgr goes to the white board>
Mgr: "Lets map this out...what fields are you needing to trigger the state on?"
DevA: "Um...uh...the 'Approved' field...and um...'OK to Contact' field"
Mgr: "Just those two?"
DevA: "Yea..um...there are other fields, but whether or not to show the edit box depends on those two."
Me: "The service already returns data, you only have two fields to check? I don't see a need to change the service at all."
DevA: "Returning all that data, we are going have a serious scaling problem. We'll be hitting the service A LOT. All that javascript could cause performance problems too"
Me: "How much data are we talking about? Name, address, couple of booleans?"
DevA: "I have to serialize the data. All that logic is going to be reeeaaallly complicated. It might be better if the service returned only the data I need."
Me: "$64,000 question, how often is this feature going to be used on the web site? Maybe once? Few hundred a week?"
Mgr: "We have no idea. A lot of the data will be pre-populated and we're only sending out a few thousand invitations. More around the holidays...but honestly, not very many."
Me: "Changing that service only for this particular area of the web site isn't going to happen. Changing the UI is the only course of action."
DevA: "Oh frack I can't wait until this project is over."
DevA...how the funck do still have a job here? You wasted about half-hour of my time with your cry-baby crap. Where is my hammer...no...no..don't go there...ahhh...thanks devrant. Prison sentence diverted.2 -
Serious question: If a highly intelligent being, better than humans, is about to code something, how would they probably do it?
Will they use the same concepts like control flow, iterations, types, operators, object inheritance, etc?
If they are quantum capable, how can they code with booleans when it can be both true and false at the same time? Will they code truthy and falsy with another dimension like time-space temporality?
Do their code simultaneously modify the hardware or bio-hardware as it iterates over the outcome of the code?
Does input and output even relevant to them?
How do they represent infinites?
Do they have similar github workflows or they telepathically update the source code?
Do they embed their program in their DNA? Then pass to offspring the codes they already created?
Do they code using a language or do they use some frequencies and material science that simultaneously show real world output?
And do they have their version of devRant?16 -
Oh come on, checkboxes are for booleans, buttons for actions... *hrmpfgrmlwtfisthisshit*
(note: the resizing is not a ui failure but from cropping two screenshots handsfree)3 -
Unpopular opinion.
TOML sucks
* it does not claim to care about indentation but it actually does
* nested datastructures are a nightmare, especially 'inline' for 'readability'
* oh fuck me everything must be "double quotes"
* booleans always lowercase, there is no "truthy" here.
* Tables are not intuitive at all.
And all this from working with it first time because I had the silly idea to modernize a python project to use pyproject.toml
Oh and don't get me started on pyproject.toml files. The documentation sucks!6 -
So at work, there is this class/model thing that's for storing translated strings. It also supports n-level nested macros, cascading lookup (e->d->c->b->a->blank), and I've added transforms too. The code is a bloody mess and very inefficient (legendary dev's code), but it's useful.
You call methods with a symbol representing one of the strings, and it does... whatever you ask, like return text, booleans, expand macros and submacros, pass in data to interpolate, etc.
But I just learned something today.
Its `.html` method... doesn't support html. In fact, calling it strips out all html, takes whatever is left, and attempts to convert that back into html. Because that makes so much sense. So, if you have an html string? Don't call html on it.
Also, macros use the same <angle brackets> as html tags, and macro expansion eats unknown macros, so... you can't mix html and macros, meaning you cannot inject values into your markup. That's a freaking joy to work around. (You end up writing a parser every time.)
So no, if you have an html string, you need to get the raw data out and handle it yourself. Don't reach for that shiny .html method; it'll just ruin your day.
It's the little things that make my day so terribly long.rant it really isn't so bad principle of most surprise poor design but it could be ever so much better8 -
Why would anyone use -1 for true and 0 for false in a database.
Booleans people!!! FFS
Making migration of old project a real PITA4 -
generally, the quality of code is inversely proportional to the number of public booleans
thing.IsThatTypeOfThing
thing.IsAVerySpecificTypeOfThatThing
thing.CanDoSomething
thing.EnableSomething
apparently that's where we're heading now :/ -
Snartsheet requires checkbox values of "true" or "false"
Microsoft Flow only passes booleans as "True" and "False" so the API rejects the data.3 -
one boolean can change your Life 😂😂
Ever think a life without booleans? Share your views on same.
A true developer better knows it!! 👀7 -
Microsoft Dynamics NAVision DB Backend - 22000+ Columns of pure cancer. 7 booleans for determining what day it is... fuck off...4
-
When elements of an union are distinguished by a boolean, VSCode's Typescript plugin can only do type elimination if I branch by "== true" and not if I just branch by the boolean.
This is because Typescript treats booleans as an union of the constants "true" and "false", and compile-time elimination can only be done if I use syntax that makes sense with unions. Logical evaluation, for some reason, doesn't.
The fact that this issue can even appear is deeply concerning.1 -
Probably a veery long time ago, but being able to use what you use in if(...){} for e.g. booleans like "bool(ean) isX = a == x;".
And than reusing that value in if again and so on.
Even if it sounds trivial, there was a time where it was not and "==" was only associated with "you use that in if/while only" rather than "a == b" returns a bool(ean)/int.
Same goes for other arithmetic operators and && / || ofc.6 -
One of the worst practices in programming is misusing exceptions to send messages.
This from the node manual for example:
> fsPromises.access(path[, mode])
> fsPromises.access('/etc/passwd', fs.constants.R_OK | fs.constants.W_OK)
> .then(() => console.log('can access'))
> .catch(() => console.error('cannot access'));
I keep seeing people doing this and it's exceptionally bad API design, excusing the pun.
This spec makes assumptions that not being able to access something is an error condition.
This is a mistaken assumption. It should return either true or false unless a genuine IO exception occurred.
It's using an exception to return a result. This is commonly seen with booleans and things that may or may not exist (using an exception instead of null or undefined).
If it returned a boolean then it would be up to me whether or not to throw an exception. They could also add a wrapper such as requireAccess for consistent error exceptions.
If I want to check that a file isn't accessible, for example for security then I need to wrap what would be a simple if statement with try catch all over the place. If I turn on my debugger and try to track any throw exception then they are false positives everywhere.
If I want to check ten files and only fail if none of them are accessible then again this function isn't suited.
I see this everywhere although it coming from a major library is a bit sad.
This may be because the underlying libraries are C which is a bit funky with error handling, there's at least a reason to sometimes squash errors and results together (IE, optimisation). I suspect the exception is being used because under the hood error codes are also used and it's trying to use throwing an exception to give the different codes but doesn't exist and bad permissions might not be an error condition or one requiring an exception.
Yet this is still the bane of my existence. Bad error handling everywhere including the other way around (things that should always be errors being warnings), in legacy code it's horrendous.6 -
Grrrrrrr!!!!!!! How you frustrate me SQL SERVER REPORTING SERVICES! Designing a report changed query on dataset to include new field, fields started displaying all sorts of random stuff, booleans in text fields etc. Just spent 20 mins "checking" by rebuilding the first few bits of report and first dataset it's something weird with SSRS. Bye bye Sunday evening!!!