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 - "foo"
-
This code review gave me eye cancer.
So, first of all, let me apologize to anyone impacted by eye cancer, if that really is a thing... because that sounds absolutely horrible. But, believe me, this code was absolutely horrible, too.
I was asked to code review another team's script. I don't like reviewing code from other teams, as I'm pretty "intense" and a nit-picker -- my own team knows and expects this, but I tend to really piss off other people who don't expect my level of input on "what I really think" about their code...
So, I get this script to review. It's over 200 lines of bash (so right away, it's fair game for a boilerplate "this should be re-written in python" or similar reply)... but I dive in to see what they sent.
My eyes.
My eyes.
MY EYES.
So, I certainly cannot violate IP rules and post any of the actual code here (be thankful - be very thankful), but let me just say, I think it may be the worst code I've ever seen. And I've been coding and code-reviewing for upwards of 30 years now. And I've seen a LOT of bad code...
I imagine the author of this script was a rebellious teenager who found the google shell scripting style guide and screamed "YOU'RE NOT MY REAL DAD!" at it and then set out to flagrantly violate every single rule and suggestion in the most dramatic ways possible.
Then they found every other style guide they could, and violated all THOSE rules, too. Just because they were there.
Within the same script... within the SAME CODE BLOCK... 2-space indentation... 4-space indentation... 8-space indentation... TAB indentation... and (just to be complete) NO indentation (entire blocks of code within another function of conditional block, all left-justified, no indentation at all).
lowercase variable/function names, UPPERCASE names, underscore_separated_names, CamelCase names, and every permutation of those as well.
Comments? Not a single one to be found, aside from a 4-line stanza at the top, containing a brief description of that the script did and (to their shame), the name of the author. There were, however, ENTIRE BLOCKS of code commented out.
[ In the examples below, I've replaced indentation spacing with '-', as I couldn't get devrant to format the indentation in a way to suitably share my pain otherwise... ]
Within just a few lines of one another, functions defined as...
function somefunction {
----stuff
}
Another_Function() {
------------stuff
}
There were conditionals blocks in various forms, indentation be damned...
if [ ... ]; then
--stuff
fi
if [ ... ]
--then
----some_stuff
fi
if [ ... ]
then
----something
something_else
--another_thing
fi
And brilliantly un-reachable code blocks, like:
if [ -z "$SOME_VAR" ]; then
--SOME_VAR="blah"
fi
if [ -z "$SOME_VAR" ]
----then
----SOME_VAR="foo"
fi
if [ -z "$SOME_VAR" ]
--then
--echo "SOME_VAR must be set"
fi
Do you remember the classic "demo" programs people used to distribute (like back in the 90s) -- where the program had no real purpose other than to demonstrate various graphics, just for the sake of demonstrating graphics techniques? Or some of those really bad photo slideshows, were the person making the slideshow used EVERY transition possible (slide, wipe, cross-fade, shapes, spins, on and on)? All just for the sake of "showing off" what they could do with the software? I honestly felt like I was looking at some kind of perverse shell-script demo, where the author was trying to use every possible style or obscure syntax possible, just to do it.
But this was PRODUCTION CODE.
There was absolutely no consistency, even within 1-2 adjacent lines. There is no way to maintain this. It's nearly impossible even understand what it's trying to do. It was just pure insanity. Lines and lines of insanity.
I picture the author of this code as some sort of hybrid hipster-artist-goth-mental-patient, chain-smoking clove cigarettes in their office, flinging their own poo at their monitor, frothing at the mouth and screaming "I CODE MY TRUTH! THIS CODE IS MY ART! IT WILL NOT CONFORM TO YOUR WORLDLY STANDARDS!"
I gave up after the first 100 lines.
Gave up.
I washed my eyes out with bleach.
Then I contacted my HR hotline to see if our medical insurance covers eye cancer.32 -
Received "emergency update" code from internal enterprise security team. Wasn't given time to do code review; was assured code was reviewed and solid.
Pushed code to over 6k lower-level servers before finding this gem buried deep within:
...
cd /foo; rm -rf *; cd /
...
(This ran as root, and yes, the cwd was / from earlier in the code).
/foo, of course, did not exist on some servers.
Now, it is those servers which do not exist.
FMLundefined security root linux file not found directory structure rm -rf / directory not found fml rm15 -
Fullstack dev: Hey I need your help with one of this method in the service layer (We use Java).
Me: Sure. What’s up!
Fullstack dev: When you get a user ....blah blah blah...
Me (typing code):
if (user != null) { ... }
Fullstack dev: Wait! This won’t work. You need to write this:
if (null != user) { ... }
In Java, you write like this. In JS it’ll work, not in Java.
Me: (also fuck this guy)
He’s among the famous devs in the company - (A very very very famous European bank).
I checked his commits for the frontend (React Native)
switch (some_expr) {
case foo:
return stuff()
break // <— note this
case bar:
return moreStuff()
break // <— note this
// more cases here with break after return statements
}
Me: Hey if you’re returning from a case why are you using a break. It’s dead code.
Fullstack dev: It’ll fall through otherwise.
———————
You’re a fucking dunce! Please drink a litre of Carborane in a rusty HIV infested container! Cheers!
PS More to come!33 -
Anybody else here has a coworker who insists on having comments everywhere and writes code like this?
// Get foo
foo = getFoo();
// Check if foo is greater than bar
if (foo > bar)
Or is it just me?22 -
Void foo() {
try {
//Try something
} catch(exception e) {
foo();
}
}
When I saw this in production I cried a little...9 -
Listen. Use invariants. If you can do
if(!x) {
return foo;
}
...rest of function logic...
Instead of
if(x) {
...some long branch with more tests...
} else {
return foo;
}
Please do. It's so much easier to read when all of your conditions are tested in a line at the top instead of nested 8 layers deep in if-else blocks.
Thanks14 -
That time when you code up something really cool (to you, that is...) and none of your friends understand.
Me: "Look at this cool thing!"
Them: "Looks like a bunch of numbers."
Me: "But they mean foo, bar, and baz!"
Them: "Whatever."
:(3 -
!rant
Thinking about quitting my job and opening a bar named "foo" where the walls have a tapestry of random foo-bar code examples. (Easy conversation starter for programmers)8 -
A CMS raping WordPress so hard up the ass till there is no tomorrow. I hate that bastardized piece of fuck. “Hey I want you to fix my page and its wordpress. I pay 20 bucks.“ Well fuck you too sir. Wordpress is no cms you wanna be coders. Get back to your fucking photoshop and design something original! Every fucking wp page looks the same. Every “nice feature“ is some kind of monkeypatched workarround. No problem i set preview pictures for every post just to enable some weird slider to function.
I also love those buttfucked files with just a “require foo“ which also just requires “bar“. Drop that fuck. Implement autoloading. Nobody uses php4 anymore step into the future. “easy to learn“ fuck me and fuck you untill you vomit jizz! Clusterfucked spaghetticode thats easy, easy to put another rotten load of clusterfuck on top. Also those security features. I put an empty index.php to prevent directory traversal. N I C E! Stop using wordpress as CMS, its a blog engine. Nothing great has every been written on top of wordpress and never will. I dare you to deny everything related to it and if you are one of those designer guyd, you can gargle my jizz you fucknut!
Starting 2017 i will start a counter and rape every 10th Wordpress which gets abused as cms i encounter into oblivion on their 0,99$ webhosting shit.
Fuck this I'm so mad about that crap17 -
Noob: I hate $foo language! It sucks!
Me: Have you used the language before?
Noob: no because it sucks!
Me: have you tried using it?
Noob: no because it sucks!
Me: so how do you know it sucks?
Noob: because all my friends that use $baaa says it sucks.
Me: ........ I see your point... sheep 🐑8 -
*Doesn't have Internet and bored as hell*
*Starts to program something random with Python*
*Wants to write something to a file, doesn't know how*
*Intuition starts...*
"foo = open('test.txt', 'w')
foo.write('hello\n')
foo.close()"
*Runs program*
*It actually fucking worked*
Tell me something more simpler than Python.13 -
First time ranter here..
So I started to work in this big company with allegedly many talented devs.
All excited to start and learn a whole bunch of new stuff.
There was this dev, with gazillion years of experience.
We were working on a similar parts of the code base and he told me I should be reusing his module.
I opened the module sources to learn about its internals.
Oh boy...
To illustrate it best, Let’s say there was a function called foo.
It was doing one thing. There was also a function called foo1. Doing almost exactly the same thing. There was also fooA.
And I kid you not, there was a fooA1.
All of them were doing almost the same thing.
Almost all of the functions were documented. The documentation for foo would be:
“This does X. I don’t like how it does it, so there is foo1 which is better.”
Additionally, only 1 of the functions was in use...
It doesn’t end here.
There were functions named like:
cdacictad
You ask what it means?
Well it means “clean directory a copy it’s contents to another directory” of course...
Months later he is no longer with us. I deleted this module.
PS
Glad to be here ;)16 -
In 2018, while working in Tokyo for a Fukuoka-based startup, one of my co-workers insisted that he wanted an SSL certificate installed on his local dev machine, but he didn't know how to do that. So I created and self-signed one for him. When our CEO came to visit our Tokyo office from Fukuoka, the coworker proudly showed him how his browser would display that green lock icon when visiting localhost:3000. This apparently impressed my CEO, because a few days later the coworker was invited to work at the HQ in Fukuoka while everybody else at the Tokyo office (incl. me) was let go.
This coworker would also only copy whole open source repositories, foo/bar/g all occurrences of the project name with our company name, and tell our CEO that he wrote that code.
I don't know how to deal with this bullshit.9 -
"Use a .dev domain? Not anymore."
Just read a medium article and thought some would be interested in reading it too, as I personally didn't know many of the information published there, for example:
- .dev gTLD belongs to google and nobody can register one
- .dev TLD are required to have a secure connection in chromium/chrome from now on, forcing you to use self signed certs across all development machines
"When applications opened for gTLDs in 2012, Google didn’t just apply for .dev. They applied for 101 gTLDs, including .google, .play, and .app. However, Google wasn’t the only company to apply for many of these gTLDs. For some applications, it took years for applicants to negotiate who would end up with the rights to the name. Google’s application for .dev was pending for over a year. Finally, in December 2014, their application for .dev was granted."
"In 2015, Chromium added the entire .google TLD to the HSTS preload list with little fanfare. It was the first and only TLD entry in the list for two years, until .dev was added in September and shortly followed by .foo, .page, .app, and .chrome — all Google-owned gTLDs."
Source: “Use a .dev domain? Not anymore.” @koop https://medium.engineering/use-a-de...33 -
How i used to toggle a boolean:
foo ? false : true;
How i decided to toggle a boolean last night:
foo = !foo
I wondered why i only just thought of that.18 -
*Starts compile*
...
...
can't find function foo
ld exited with status code 1
*confused*
*Reruns qmake*
*Compiles again*
...
...
can't find function foo
ld exited with status code 1
*very confused*
*switches compilers*
*compiles*
...
...
Worked!
*dafuq*
*switches back to the first compiler*
*compiles*
...
...
Worked!
*tries not to cry*12 -
“Never,never, never, NEVER eat raw userinput“
Referring to stuff like “insert into foo (bar) values ($_POST[username])“2 -
I'm planning on making a band called Bar Fighters and will play songs like Integer Or Long, The Renderer, Test of U nit, Learn to Try ( catch )5
-
So my boss copied a code from stackoverflow and thought "foo" was a function or something... It was just an alias to a SQL select...2
-
Interviewer: So which university are you from?
Me: I am from "foo" university.
Interviewer: So why did you not go to "bar" university?
Inner Me: Wtf kind of a question is that. Why the fuck aren't you a unicorn with pigs flying out of your ass and a globally reknowned researcher at Stanford?
We all end up where destiny takes us. Some of us try very hard but things don't magically happen for us. We keep trying but at the end of the day you end up where you end up.
Real Me: I just finished my High School and had the entry test the next day. I was not prepared at all.4 -
For a developers ranting social media platforms, it sure seems strange that we can't format code snippets... 🤔
At least something like `foo(bar){}` would be awesome!3 -
there are three kinds of programmers
foo () {
// those who use this
}
foo ()
{
// those who do this
}
for () { } // and theres this14 -
Ok so this happend in the last 3 days, I didn't post it till now because I had to seriously take a rest with all the bullshit and stress that came with it...
(Legacy project I have the lead in called: "Foo")
Monday:
Management decided it would be effective to add a senior and a junior to Foo, which would make (together with me) to be 2 juniors and one senior developer
Well I've spend most of that day helping both the junior and the senior to setup "Foo" on their local development machines... So I could not do any programming myself
tuesday:
The senior wanted to refactor EVERYTHING... and I had to stop him multiple times because we simply do not have the time to do that...
The junior tried to work on other things as much as he could, and after he had run out of things to do, asked me for EVERYTHING... EVEN WHERE TO FUCKING CHANGE SOME GOD DAMN STRINGS!....
Also he did in total 3 commits, two of which existed of my code (because I had to "help" him
wednesday:
Both the junior and senior were removed from the project and I got another senior.. who fucking deleted the production database on accident
god damn rough few days man...7 -
Does anyone else really dislike "foo", "bar" and "baz"? Because fuck me I do. My brain can't process that stuff, I need some actual real world context.
or, maybe i'm just dumb.8 -
Oauth2 examples.
Seriously all examples I found use library that use library that use library to just build url encoded parameters like this
client_secret=foo&code=bar
Got me 5 hours to dig going trough couple of github repos with implementation to see that shit at the end.
Seriously people !!!
Start thinking before you write single line.
I don’t want to download 10 dependencies and 100MB+ just to send 2 requests with url encoded parameters.
It’s in every - literally every language.
I know you’re stupid but please just try to understand how things work instead of copy paste another stackoverflow and medium snippet.4 -
A typo today has rendered me the joke of the office... 😂
Almond's PR: "Added missing unit testes to classes Foo and Bar"
----
Bob: "LGTM. Bet that took some balls."
Craig: "LGTM. Missing unit testes drive me nuts."
Ian: "LGTM. Write your testes with your code guys, a bit bollocks to have to add them afterwards." -
When you go make coffee and return to your code and see
let foo =
and you have no idea wtf was going to come next...4 -
One of our devs seems to love "attribution" comments in anything he writes.
private void foo() { //Author: John Cribbins
...public static final int FOO_BAR = 21; //Author: John Cribbins
I mean, I get it for an author tag at the top of a file, but certainly not on every field or method. Is this some kind of weird thing newer devs are encouraged to do these days?!9 -
A recipe for COMPLETELY hacking me off - ask for help, pretend my advice is bollocks, then rephrase it as your own and follow it up with a smart arse comment.
"Almond, could you lend me a hand with this regex? I'm trying to match this particular group, but only if it doesn't have 'foo' after it."
"Sure, take a look at negative lookaheads - that sounds like it's exactly what you need"
"Nah that won't work for me, because I need to check for more than one character after it, I need to check for 'foo'"
"What? That doesn't make sense, you can..."
"Ah don't worry, I've found the answer by myself now, I can actually just add '?!' before the text I don't want to match and it'll do it - I'm fast becoming a regex expert here! Let me know if you want me to explain this to you"
DAHHHHHHH THAT IS A NEGATIVE LOOKAHEAD YOU CRETIN2 -
So I was reviewing my old code. Refactoring and improving the documentation.
This is a production app that is being used 24/7/365.
I see myself using "bar = foo" and there's even an explanation of what it does.
Apparently I resolved a relatively difficult Date object issue and had to use temporary variables.
Didn't know how to call them and ended up with these jewels.3 -
So I finished uni three weeks ago. Interview for a my first junior web developer position a week ago.
Received news yesterday that I got the job. It’s been a good couple weeks I’d say.3 -
Huh. ES6's variable destructuting on objects is actually pretty cool.
var {foo, bar, baz} = obj
Is functionally equivalent to this:
var foo = obj.foo
var bar = obj.bar
var baz = obj.baz
I like it! Makes things simpler.3 -
you know you should go home when you write "public private foo()".
it's public ... but private ... but still public
I'M DONE FOR THE DAY5 -
What's wrong with this code?
std::pair<float, float> foo() { return { 0, 0 }; }
"Nothing," would you say.
That's because you're normal.
But the most stupid C++ compiler ever (M$ VS)
issues an ERROR that converting 0 to float incurs possible "loss of data". So you have to write "0.f".
BTW, "0." is a double, so you really have to write "0.f". Or "static_cast<float>(0)" if you like ugly, impossible-to-read code.16 -
I think I just blew my own mind here.
Look at this:
Class SomeClass
{
_call($functionName, $arguments)
{
return call_user_func(array('SomeClass','uselessMethod'), 'method');
}
method($foo)
{
return new Adapter($foo)->execute($this);
}
uselessMethod()
{
return $this->method(__FUNCTION__);
}
}
so __FUNCTION__ resolves to
Caller:
You can run that code, whether you comment out uselessMethod, or not.
Adapter is a function that looks for what class to call depending on a database value
and execute the call.
So api basically uses a chain call to do stuff like this in controllers, here's how
I call the above:
$someObject = (new Class($object))->uselessMethod()->doSomething()->doSomethingElse();
But like, eventually my code matured to where all those methods in the chain call have the same one line return that calls my adapter to find the logic to run.
So, basically, I can now have a class with headless function calls that calls a directory of other classes, that are all defined in a contract somewhere. So as long as those classes
all adhere to the contract, it will never return an error.
I can't think of any reason to do this, other than my setup, and I have a sneaky feeling,
as dirty as this trick is, that there's a bad reason my code has come to being able to do this.
Maybe wrong strategy pattern from the beginning?
I'm sure it'll come to me like 3 days from now..3 -
I've got a puzzle! How well do you know the weird GNU coreutils error messages?
$ rm foo/
rm: cannot remove 'foo/': Is a directory
$ rm -r foo/
rm: cannot remove 'foo/': Not a directory
What am I?7 -
Working on my Google Foo Bar level 4 challenge.
9 days past figuring out how to solve this problem..
And finally reached on a working solution. When started compiling my solution.
And then i Find out, the fucking Google tool is facing some bug and not allowing compilation. Tried hard to do everything but still getting errors...
And after searching on Google just found I'm fucked up.. It's on Google's end and they are not fixing it since so many days..
Just 5 days left to complete.. And i have no idea what should i do...
4 month work just fucked up9 -
Master Foo and the Script Kiddie
(from the Rootless Root Unix Koans of Master Foo)
A stranger from the land of Woot came to Master Foo as he was eating the morning meal with his students.
“I hear y00 are very l33t,” he said. “Pl33z teach m3 all y00 know.”
Master Foo's students looked at each other, confused by the stranger's barbarous language. Master Foo just smiled and replied: “You wish to learn the Way of Unix?”
“I want to b3 a wizard hax0r,” the stranger replied, “and 0wn ever3one's b0xen.”
“I do not teach that Way,” replied Master Foo.
The stranger grew agitated. “D00d, y00 r nothing but a p0ser,” he said. “If y00 n00 anything, y00 wud t33ch m3.”
“There is a path,” said Master Foo, “that might bring you to wisdom.” The master scribbled an IP address on a piece of paper. “Cracking this box should pose you little difficulty, as its guardians are incompetent. Return and tell me what you find.”
The stranger bowed and left. Master Foo finished his meal.
Days passed, then months. The stranger was forgotten.
Years later, the stranger from the land of Woot returned.
“Damn you!” he said, “I cracked that box, and it was easy like you said. But I got busted by the FBI and thrown in jail.”
“Good,” said Master Foo. “You are ready for the next lesson.” He scribbled an IP address on another piece of paper and handed it to the stranger.
“Are you crazy?” the stranger yelled. “After what I've been through, I'm never going to break into a computer again!”
Master Foo smiled. “Here,” he said, “is the beginning of wisdom.”
On hearing this, the stranger was enlightened.2 -
So I'm not sure whether this actually is a believable story or not but I think I'll just share the saddest moment in my life with you.
So.... I've been working with a boy 0.5years younger than me on a project in Java so he could learn something about programming. I was actually dictating him code because he wasn't able to JUST WRITE ONE SINGLE LINE OF CODE WITHOUT ASKING ME HOW TO DO SHIT!!! So I dictated him a for each loop:
Me: "for ( Foo foo colon foos ) {doSomeShit();}"
Him: "for ( Foo foo .. foos ) {doSomeShit();}
For your understanding: in German colon means doppel punkt / double dot. I didn't think someone actually writes two dots... THIS IS SO FUCKING SAD
Please don't blame me for being a bad teacher. I'm inn a class with him and I know we did that in class. I also thought it multiple times to him6 -
I swear to god you'll never feel more epic while coding than when you listen to the dovahkiin song.3
-
Strings in most languages:
(☞゚ヮ゚)☞ foo: string = "bar"
Strings in rust:
(╯‵□′)╯︵ AHHHHHHH!
borrowed value does not live long enough
types differ in mutability
cannot assign twice to immutable variable22 -
God, Allman indentation style is such pain... God bless K&R...
For those who don't know, Allman is this:
void foo(void)
{
statement;
statement;
}
and K&R is this:
void bar(void) {
statement;
statement;
}12 -
Really now?
AWS, #1 cloud provider with their #1 cloud database DynamoDB, all shiny, highly dynamic NoSQL, your data schema could change any second...
then DynamoDB errors out when one of your values is an empty string? {"foo":""} is impossible to store?
Like nobody ever saw or used empty strings a a value or what? There are tons of upvotes to fix this.
I just have to imagine the Product owner standing there: "No,no,no. They are just using it wrong if their data has empty strings as value. Won't fix!"4 -
Yesterday
Boss: Can you export the foo data and send it to me?
Me: Sure
Me (later): Ok, just shared foo.csv with you. It should have everything you need, just let me know if you need the bar data.
Boss: OK, thanks.
Today
Boss: Did you get the foo data exported?
Me: Yes, I shared that with you yesterday
Boss: What did you name it?
This is all in a chat, by the way, not in person. Scrolling for 1.5 seconds reveals all the relevant information.
How do I respond in a way that is not sarcastic and does not belittle my boss? I'm not sure it's even possible.2 -
Your choice. Select one
1.
foo (bar) {
return true;
}
2.
foo (bar)
{
return true;
}
3.
foo (bar) { return true; }
4.
foo (bar)
return true;
5. Collapse
|-------------------|
| foo (bar) ... |
|-------------------|
6.
#define foo boo
#define bar par
#define ( `
#define ) '
#define return go_home
#define true false
#define { ☞
#define } ☜
6-1.
boo `par' ☞
go_home false;
☜
6-2
boo `par'
☞
go_home false;
☜
6-3.
boo `par' ☞ go_home false; ☜
6-4.
boo `par'
go_home false;
6-5.
|--------------------|
| boo (par) ... |
|--------------------|
Select and Comment below.
Or add your own.27 -
Find the odd one out :
a) const int * foo
b) int const * foo
c) const * int foo
d) int * const foo7 -
Boss: I want feature foo!
Me: that will be a bit tricky because bar...
Boss: It's easy, you just baz!
Me: ok boss :) *hax around bar*4 -
So someone decides that the employees need to do these stupid Web-based training's that not even high school kids should be looking into.
What is about ?
Security and Cryptography, and now event the real stuff.
What it covers?
Alice and Bob, Bob and Alice.
Alice wants Bob some pics/messages that she suspects someone else will see. DDDDDDAAAAAAAFFFFFFFAAAAAAAAAKKKKKK
A total of 7 useless time wasting interactive and annoying training's, 20+ min each.
But someone forgot that please do not send this shit to engineers of your company, specially Software/Network engineers. Oh another subset, specially not to those who work deeper into the domain.
I'm getting paid to do this time wasting activity, and still.
I also may come back and remove this BUT FOR NOW I NEED TO RANT.rant alice time_waste boolsheet web_training useless fake_security demotivators bob corporate_crap foo -
Java: String foo =“bar”;
C#: var foo = “bar”;
Go: var foo string = “bar”
I just started learning Go and I’ve been cringing since.19 -
I almost got caught by this during an interview:
const foo = ['a', 'b'];
const bar = foo.findIndex(x => x === 'a'); // 0
if (bar) { // I'm an idiot
console.log('Do something');
}
🤦♂️23 -
"Hello, the drive of your XYZ server is getting full, would it be possible to prune some of the unused and/or old docker images and layers there please? Alternatively, we can offer to replace the drives with a higher capacity models for FOO extra per month"
"Hello, the disk use keeps growing and has reached the 95% mark, please prune some of your images to make space for new. If you wanted to choose the alternate option of disk capacity increase, we would have to do that as soon as possible, otherwise you may run out of space before the RAID array rebuilds"
"Hello, your server XYZ has completely ran out of disk space. Any changes that would require data being saved on disk may and probably will fail. Please free some space as soon as possible"
Ugh, I hate clients that just don't cooperate until shit hits the fan...
And no, we could not prune the space ourselves, its not our data to delete whenever we think it necessary.
We merely manage the machine's operation, keeping it online and its services running.2 -
When you want only 10 rows of query result.
Mysql: Select top 10 * from foo.... 😁
Sql server: select top 10 * from foo.. 😁
PostgreSQL: select * from foo limit 10.. 😁
Oracle: select * from foo FETCH NEXT/FIRST 10 ROWS ONLY. 🌚
Oracle, are you trying to be more expressive/verbose because if that's the case then your understanding of verbosity is fucked up just like your understanding of clean-coding, user experience, open source, productivity...
Etc.6 -
A piece of code someone just pushed:
In pseudocode
------------------------
Function foo()
Result = GetFoo()
If result != null
DoStuff()
Return result
Else
Result = null
--------------------------
Ffs.
It's written in a strongly typed language, and the whole function is in a try with an empty catch and inside yet another try with an empty catch. Guess he wanted to be sure no error got away....
Oh, and he has 9 years of experience, and since all paths don't return something it does not compile12 -
Things that seem "simple" but end up taking a long ass time to actually deploy into production:
1. Using a new payment processor:
"It's just a simple API, I'll be done in 2 hours"
LOL sure it is, but testing orders and setting up a sandbox or making sure you have credentials right, and then switching from test to life and retesting, and then... fuck
2. Making changes to admin stats.
"'I just have to add this column and remove that one... maybe like a couple of hours"
YOU WISH
3. Anything Javascript
"Hah, what, that's like a button, np"
125 minutes later...
console.log('before foo');
console.log(this.foo)
etc..2 -
This customer's dev is going to be the end of me. I had to explain to him why it doesn't make any sense to return a value after throwing an exception.
In a function that was supposed to insert a record amd return its id, in the error handling code:
catch(Exception ex) {
//logs the exception
throw ex;
return - 999; //this code will NEVER be reached, and why the f.... - 999?
}
The customer wants us to develop the project together, but he won't listen and always write whatever he wants. Some might be differences in taste. Like me preferring
if(condition) {
return a;
}
return b;
And him preferring :
Foo result = null;
if(condition) {
result = a;
} else {
result = b;
}
return result;
Ok, that I can accept. But things like the one I'm ranting about... I wont.
I'm starting to wonder what was he doing during his "9 years of coding experience"10 -
I lost points for not including the following comment:
//Declaring variables
int foo, bar;
I already knew how to code, and I completed the assignment in the fewest number of lines needed while still being well commented explaining my logic. I lost points because I didn't say what everyone understood.4 -
Am I the only one who doesn't know where foo bar came from? I see it all the time but have no clue :/3
-
My favorite command of day is 😂
rm -rf {foo}/{bar}
Reference if you don't know what happened today:
http://independent.co.uk/life-style...2 -
Being told code is "production ready" only to find this:
if name == 'foo' or name == 'bar' or name == 'someothershit'
What's wrong with:
if name in ['foo','bar', 'someothershit']?
Oh and they had 10 different values they were matching, not just 3. What kind of joker am I dealing with?1 -
Sprint 0: This design is the appropriate amount of engineering abstraction.
Sprint 2: This is over-engineered, too much work
Sprint 5: This is under-engineered, too many edge cases
Sprint 10: This is over-engineered, component Foo could be replaced by a bash script
Sprint 42: Foo is now the cornerstone of half our business logic2 -
I can not fuckin stress how goddamn annoying it is to work with strings in C++. I'm not talking about std::string, those are bearable. But fucking char foo[number], char* foo, and const char* foo. AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA17
-
Metasyntactic variables, you use them, but do you know their origin?
This should be essential programmers knowledge:
https://ietf.org/rfc/rfc3092.txt/1 -
Bug I had to fix today: some elements in our React app were being swapped with other elements.
We had `<foo>bar</foo>` on the component but on the html `foo` was being swapped with some other element in our app. It's contents ("bar" in the example) were being left in place, though, so we were getting `<baz>bar</baz>`.
This would only happen when running on production mode. On development everything was fine.
Also, everything seemed fine on the React dev tools. `foo` was where it was supposed to be, but on the html it was somewhere else.
Weirdest shit I ever saw when using React. I found a way to go around it and applied that fix, but I'm still trying to track this down to the source.
The worst part was waiting for fucking webpack to finish the production bundle on every fucking change I wanted to test. I didn't miss the change-save-compile-test flow at all.
What a shit day.4 -
did not expect the stickers would actually arrive! you sent it all the way half of the earth. the stickers earn a deservedly special space on my laptop and phone. Kudos to you devRant!2
-
Every website we craft at work has some email substitution logic so that addresses you see on the site don't actually exist in the HTML source like that (you wouldn't find them in a format like "foo@example.com").
Instead the @ and the period right before the TLD get replaced with something else (to prevent (dumb) spam bots from using that address and blast it with junk).
Some people replaced them with images in the past (ew), replaced the @ with "(at)" or other stuff.
I made it a habit to render the @ and . by replacing them with span tags which then get a ::before in CSS that contains "content: '@';", so that the @ is visible but is not actually inside the HTML source code.
The classes for these spans then have a random name (persistent for that website though). The first one was called "move-along-nothing-to-see-here", but then I started naming them after Star Wars quotes.
One website's @ class is called "that-s-no-moon" (Obi Wan), others are called "i-have-a-bad-feeling-about-this" (Han Solo), "powerful-you-have-become-the-dark-side-I-sense-in-you." (Yoda) and "these-are-not-the-droids-you-are-looking-for" (Obi Wan).12 -
There should be a post type “facts” || “dev hints” || something like that where we can post cool stuff we figured out..
Like how to replaceAll in JS?
“Hello ranters”.split(“e”).join(“foo”);
JS devs probably know this but I didn’t, so yeah..3 -
Alright since I have to deal with this shit in my part time job I really have to ask.
What is the WORST form of abusing CSV you have ever witnessed?
I for one have to deal with something like this:
foo,1,2,3,4,5
0,2,4,3,2,1
0,5,6,4,3,1
bar,,,,,
foobar,,,,,
foo can either be foo, or a numeric value
if it is foo, the first number after the foo dictates how many times the content between this foo and the next bar is going to be repeated. Mind you, this can be nested:
foo,1,,,,
1,2,3,4,5,6
foo,10,,,,
6,5,4,3,2,1,
bar,,,,,
1,2,3,4,5,6
bar,,,,,
foobar,,,,,
foobar means the file ends.
Now since this isn't quite enough, there's also SIX DIFFERENT FLAVOURS OF THIS FILE. Each of them having different columns.
I really need to know - is it me, or is this format simply utterly stupid? I was always taught (and fuck, we always did it this way) that CSV was simply a means to store flat and simple data. Meanwhile when I explain my struggle I get a shrug and "Just parse it, its just csv!!"
To top it off, I can not use the flavours of these files interchangably. Each and everyone of them contains different data so I essentially have to parse the same crap in different ways.
OK this really needed to get outta the system6 -
How many devs here got hired through Google's Foo Bar challenge or got the invitation?
I got the invite and have sent my assignments for review. Anyone know what happens next.20 -
Other Team: "our builds don't clean up properly"
*docker rm -f $(docker ps -a)*
Other Team: "our builds keep filling up machines"
*docker rmi $(docker images -q)*
Random Team Member: "My builds keep failing on service foo randomly exiting"
Other Random Team Member: "Why is there no caching on our builds"
...
team panics thinking it's their fault as our main job still passes, as it's on another machine.
...
When we find out after tracking build history
KMS2 -
Well that would probably be my classmate. He sucks at programming but I wanted him to do at least something. So I dictated him code he should simply type down: "for ( blah foo colon foos ) { ..." And he's like "for ( blah foo .. foos ) {". Colon means " Doppelpunkt" in German which means "double dot" if translated literally. So he wrote ".." instead of ":".
Fuck meh2 -
The people that religiously put "missing docstring" on code reviews... Like, I get why but... Who hurt you? Especially in typed languages, where there's a function called "can compute stuff" with a foo type, and I add a docstring that's "whether we can compute stuff for the given foo"...5
-
When coworkers leave the co. for a better paying job and leave this kind of code after themselves:
int foo = 1;
String.format("blabla %s", Integer.toString(foo));
fml6 -
Laravels error reporting is sometimes fucking useless. Yesterday it wrote into the logs "class foo doesn't exist". I triple checked the including of this class. Checked the namespaces. Checked the classnames. Everything was ok.
Today I removed the content of this particular class, which returned an array. And the error was gone...
After further search I realized I was missing commas within the array deceleration...
Why the fuck you don't just tell me this????!?4 -
One of my coworker change the code from
```
void foo() {
if (condition)
{
}
else
{
}
}
```
to
```
condition ? ifTrue : ifFalse;
```
and add it to changelog
```
- fix bugs // yes with an "s"
- feature added
- some list of the bug fixed.
```
I refer back to the commit, only one Fucking commit and on changes. Bro, what the fuck?8 -
During one of our 'pop-up' meetings last week.
Ralph: "The test code the developers are checking in is a mess. They don't know what they are doing."
ex.
var foo = SomeLibrary.GetFoo();
Assert.IsNotNull(foo);
Fred: "Ha ha..someone should talk to HR about our hiring practices. These people are literally driving the company backwards."
Me: "I think unit testing is complete waste of time."
- You could almost see the truck hit the wall and splatter watermelon everwhere..took Ralph and Fred a couple of seconds to respond
Fred: "Uh..unit testing is industry best practice. There is scientific evidence that prove testing reduces bugs and increases code quality"
Ralph: "Over 90% of our deployments are rolled back because of bugs. Unit testing will eliminate that."
Me: "Sorry, I disagree."
- Stepping on kittens wouldn't have gotten a worse look from Fred and Ralph
Fred: 'Pretty sure if you ask any professional developer, they'll tell you unit testing and code coverage reduces bugs.'
Me: "I'm not asking anyone else, I'm asking you. Find one failed deployment, just one, over the past 6 months that unit testing or code coverage would have prevented."
- good 3 seconds of awkward silence.
Ralph: "Well, those rollbacks are all mostly due to server mis-configurations. That's not a fair comparison."
Me: "I'm using your words. Unit tests reduces bugs and lack of good tests is the direct reason why we have so many failed deployments"
Boss: "Yea, Ralph...you and Fred kinda said that."
Fred: "No...we need to write good tests. Not this mess."
Me: "Like I said, show me one test you've written that would have prevented a rollback. Just one."
Ralph: "So, what? We do nothing?"
Me: "No, we have to stop worshiping this made up 80% code coverage idol. If not, developers are going to keep writing useless test code just to meet some percent. If we wrote device drivers or frameworks for other developers maybe, but we write CRUD apps. We execute a stored procedure or call a service. This 80% rule doesn't fit for code we write."
Fred: "If the developers took their head out of their ass.."
Me: "Hey!..uh..no, they are doing exactly what they are being told. Meet the 80% requirement, even if doesn't make sense."
Ralph: "Nobody told them to write *that* code."
Boss: "My gosh, what have you and Fred been complaining about for the past hour?"
- Ralph looks at his monitor and brilliantly changes the subject
Ralph: "Oh my f-king god...Trump said something stupid again ..."
At that point I put my headphones on went back to what I was doing. I'm pretty sure Fred and Ralph spent the rest of the day messaging back-n-forth, making fun of me or some random code I wrote 3 years ago (lots of typing and giggling). How can highly educated grown men (one has a masters in CS) get so petty and insecure?7 -
Just got off the phone with a csr about a bug they found. No biggie, I said I'd fix it. Basically until it gets fixed I told them that when they do their process to make sure to do "foo" first, then "bar" second. As soon as I got off the phone, had to poop so I went to the bathroom, and as soon as I sat down I get a message from the same CSR, "Hey I did bar first, can I type foo then bar again?"
WTF DID I JUST SAY LITERALLY 2 MINUTES AGO ON THE PHONE. TBH IT WOULD BE BETTER IF YOU JUST DIDNT DO ANYTHING FOR 15 MINUTES BUT NOW I HAVE TO COMB CLOUD FUNCTION LOGS, FIND THE DOC UID YOU CREATED, FIND THE DOC YOU MADE, DELETE IT, DELETE THE ASSIGNMENT IN YOUR TRASH ASS WORKPLACE PORTAL, AND STILL FIX THE SAID BUG3 -
Reporting is not fun..
Scenario 1:
* A user says they need to export certain data from our system..
* Developer W makes report called "Foo detail report"
Scenario 2:
* A user says they need this report to also show some extra fields
* Developer X makes a new report called "Foo detail report (extra fields)"
Scenario 3:
* A user says they need this report to be run with a different search criteria
* Developer Y makes a new report called "Foo detail report (extra fields) by bar"
Scenario 4:
* A user says they need this report show data grouped in a different way
* Developer Z makes a new report called "Foo detail report (extra fields) by bar- new grouping"
The above scenarios happened over and over for several years in no particular order...
Current Day:
* Some users have certain reports they use and rely on but we don't know which ones
* Nobody really knows what all of the reports do or what is the difference between them without looking at the sql
* If we want to change data structures we have many reports to update
* I have a request from a user to add an extra column to one of the reports1 -
Working on an Android app for a client who has a dev team that is developing a web app in with ember js / rails. These folks are "in charge" of the endpoints our app needs to function. Now as a native developer, I'm not a hater of a web apps way of doing things but with this particular app their dev teams seems to think that all programming languages can parse json as dynamically as javascript...
Exhibit A:
- Sample Endpoint Documentation
* GetImportantInfo
* Params: $id // id of info to get details of
* Endpoint: get-info/$id
* Method: GET
* Entity Return {SampleInfoModel}
- Example API calls in desktop REST client
* get-info/1
- response
{
"a" : 0,
"b" : false,
"c" : null
}
* get-info/2
- response
{
"a" : [null, "random date stamp"],
"b" : 3.14,
"c" : {
"z" : false,
"y" : 0.5
}
}
* get-info/3
- response
{
"a" : "false" // yes as a string
"b" : "yellow"
"c" : 1.75
}
Look, I get that js and ruby have dynamic types and a string can become a float can become a Boolean can become a cat can become an anvil. But that mess is very difficult to parse and make sense of in a stack that relies on static types.
After writing a million switch statements with cases like "is Float" or "is String" from kotlin's Any type // alias for java.Object, I throw my hands in the air and tell my boss we need to get on the phone with these folks. He agrees and we schedules a day that their main developer can come to our shop to "show us the ropes".
So the day comes and this guy shows up with his mac book pro and skinny jeans. We begin showing him the different data types coming back and explain how its bad for performance and can lead to bugs in the future if the model structure changes between different call params. He matter of factually has an epiphany and exclaims "OHHHHHH! I got you covered dawg!" and begins click clacking on his laptop to make sense of it all. We decide not to disturb him any more so he can keep working.
3 hours goes by...
He burst out of our conference room shouting "I am the greatest coder in the world! There's no problem I can't solve! Test it now!"
Weary, we begin testing the endpoints in our REST clients....
His magic fix, every single response is a quoted string of json:
example:
- old response
{
"foo" : "bar"
}
- new "improved" response
"{ \"foo\" : \"bar\" }"
smh....8 -
Hiii devRanters, I have a TypeScript question for you...
How do I dynamically import classes?
I have a class like this:
export default class Foo implements Bar {
...
....public getName(): string {
........return this.name;
....}
}
and then I have another file with this:
import(`./class-cmd/${file}`).then((command) => {
....winston.debug(command);
....winston.debug(command.getName());
});
the first command spits out something like this:
debug: default=class Foo {
....constructor() {
........this.name = "foo";
....}
....getName() {
........return this.name;
....}
}
and I would expect that the second command will work, however it throws this:
UnhandledPromiseRejectionWarning: TypeError: command.getName is not a function
Any idea what I might be doing wrong?18 -
For a long time I was of the opinion that pointer variables in C/C++ should have the asterisk immediately after the type name (e.g. int* foo).
Eventually I became convinced that it makes more sense to have it before the variable (e.g. int *foo).
Now I find routines that return pointers look weird, e.g.: void *allocate_something() so I am considering adopting the original style I used.
The only advantage of having the asterisk before the variable name I am aware of is that it is easier to remember to add an asterisk if you define more than one pointer on that line.
Anyone else find it hard to settle on code style guidelines for their own personal projects?12 -
Still find it amazing how archaic command prompt is, why do we still need to manually select which drive we want before cd'ing into the directory...
Why can't we just do cd D:/foo/bar, I understand you want us to use PowerShell Microsoft but you are the company that still ships internet explorer so please at least bring it up to standard a little -,-2 -
Somebody ranted about his teacher showing windows presentation and teaching nothing. I wanted to comment that post but i have enough material to make the whole rant out of it.
Well at least you have those presentations! In my school we have 2 IT classrooms one with win xp, 1ghz cpu, 0,5gb ram computers and one with win vista, 2 core 2ghz cpu and 2gb of ram PCs.
Guess what room our teacher is using... of course the worse one! The second one is fine, few years ago another theacher had been using it!
I tried to convince him to change rooms but he is coming up with silly exciuses! (like "server is not working here!", well i fixed it with my friend but why are you even talking about it when you are not using yours in old class!)
PS. That server is useless anyway, every pc is connected to router that is connected to internet so supervisor pc is not mandatory, only acces restriction is enforced by win accounts.
I heard from students from my class (that picked that optional IT course) (i'm in high school) that gimp is not working because pc's are so bad!
Sometimes even notepad frezzes.🤔
Not only class is shite but teacher clearly has no idea what is he doing. (in order to pass the final from IT you need to learn simple C++, up to simple foo objects) and of course he isn not even talking about that! On one lesson about sorting algorithms he gave everybody 10 small pieces of paper with numbers on them and told everybody to sort them manualy, because he didnt know how to do it himself! So there is no doubt they wont be able code it.
I need to mention that i volontered to "clean, fix" that classroom (in order to convince teacher to move). And in that class i saw programms written in c++ on every computer! That means somebody was teaching propely before! 😣
I feel sorry for those guys, they are just waisting time. I would fall for it as well but i decided i can learn coding in home ;).
Well, results are shocking, after 1 month of coding i learned C# and i can basicly make any algorithm i ever wish. I learned about computer operation so well that i can nearly teach computer science. (i helped my friend in usa that is a electronic student with that and i'm very proud of it 😁) and it class still can't even use all 3 loops correctly... 😥 Ok i must admit i have been coding for a looooong while so i had time to learn basic c,c++ and pc operations before, but point still stands.
Why the hell are you wasting life of those studends? Why are you giving them a choice to learn coding WHEN YOU CANT EVEN USE PC YOURSELF?! (that it course is optional so you can apply if you want so)
I dont regret not bothering about it.1 -
Public REST (-inspired) API. Should I skip numeric IDs because it's easy for consumers to snoop around?
Example:
POST api/foo
201 Created api/foo/69
Uh, I'll get 68 just because I can. Hopefully it returns Unauthorized, unless we some kind of bug.
Is it just security by obscurity if I use, like, guids or something instead of sequental IDs?17 -
My whole workflow for HTML is frustrating. I rather write pug, because it has mixins, includes and isn't that fucking repetitive. But to write pug within Laravel blade views, I have to preprocess it too blade. Then sometimes the syntax gets crazy because of escaping blade loops like an insane guy ('| @foreach($foo as $bar)'), but you get used to it after time.3
-
There's two types of people:
if ($foo == $bar) {
// Something...
}
AND
if($foo==$bar)
{
// Something...
}11 -
The document.getElementbyId function . It is so long.
Aldo this probably poes not count but the export function does not accespt whitespace before and after the = sign
So instead of
export PATH = "$PATH:/foo/bar/baz"
You need to write
export PATH="$PATH:/foo/bar/baz"8 -
Quickly coming to the terms with the fact that software development inside companies is just the perpetual motion of putting out fires as quickly as possible just so customers can still be ignorant cunts.
-
so a colleague of mine, which is fresh out of Uni. as software engineer has no clue of what Foo and Bar stands for...7
-
That moment where you see code of someone who riddles their code with nested if-else and if-elseif statements.
I don't remember writing an else statement for years. It almost always can be avoided (and the rare cases where it makes sense I prefer the switch statement).
Yet I never grasp why people do:
```
if(someCondition) {
// huge nested code block
} else {
throw new Error();
}
```
Instead of
```
if (!someCondition) {
throw new Error();
}
// continue in the normal scope
```
And then we have experts that like doing:
```
if(someCondition) {
if (bar) {
$foo = 'narf';
} else {
$foo = 'poit';
}
// huge code block
if($foo == 'narf') {
if(yetAntherCondition) {
// huge code block
} else {
throw new Error();
}
// huge code block
} else {
throw new Error();
}
} else {
throw new Error();
}
```
Help!
If ever was to design a programming language, I'd forbid the `else` and `elseif` keywords. I have yet to find an instance where I could not replace some `else` by either a guard or an early return or introducing some polymorphism.1 -
Freenas update from 11.1 to 11.2 beta 2
They added experimental smb direct / multichannel support, yay.
Me tries to connect to the smb share:
->Connection timed out 🤔
Tries something.
->Connection refused 😐
Google foo ....
->Nope, no connection 😔
"Failed to retrieve list of shares from server"
Reinstalls freenas to be sure it's not some janky install.
->Nope.
Google some more
->Nope 😭
*Like a year later*
Look into /etc/samba/smb.conf
Client max protocol = NTLM1
Motherfucker! 😬
Who thought that to be a good Idea!?
😠
It's the default Manjaro smb conf from the official repository by the way.
Seriously.
Didn't even know there was a setting for max client protocol.
Thought it was a server only config.
😵
Nope, some motherfucker trolled me long and hard this time. 😩
But back to getting smb direct working on my setup.
Thunar gvfs is like it's own completely separate thing.
Smb status, and all the other commands don't see any open connections anywhere.
Gvfs still connects fine to the share even though the smb.conf is deleted and everything else is complaining that there is no config.
On the one hand, it uses samba, on the other it's not actually.
Where the heck can I see the connection properties and wether rdma works or not?
Mother trucking, fracking, leg breaking piece of a dance type.1 -
Null-propagation operator and null coalesce all in one line makes me tingly.
return registryKey.GetValue("foo")?.ToString()??"bar"; -
Saw this in the Python project codebase today:
arg = '\"foo\"'
Which is funny, because '\"foo\"' == '"foo"' -
In one session 36 hours. I lost someone close to me and I kinda didn't leave my office for any form of social interaction for three weeks.
-
Do you prefer?
var foo = true;
if (some condition){
var foo = false;
}
Or
if (some condition){
var foo = false;
}
else{
var foo = true;
}9 -
Client be like:
Pls, could you give the new Postgres user the same perms as this one other user?
Me:
Uh... Sure.
Then I find out that, for whatever reason, all of their user accounts have disabled inheritance... So, wtf.
Postgres doesn't really allow you to *copy* perms of a role A to role B. You can only grant role A to role B, but for the perms of A to carry over, B has to have inheritance allowed... Which... It doesn't.
So... After a bit of manual GRANT bla ON DATABASE foo TO user, I ping back that it is done and breath a sigh of relief.
Oooooonly... They ping back like -- Could you also copy the perms of A on all the existing objects in the schema to B???
Ugh. More work. Lets see... List all permissions in a schema and... Holy shit! That's thousands of tables and sequences, how tf am I ever gonna copy over all that???
Maybe I could... Disable the pager of psql, and pipe the list into a file, parse it by the magic of regex... And somehow generate a fuckload of GRANT statements? Uuuugh, but that'd kill so much time. Not to mention I'd need to find out what the individual permission letters in the output mean... And... Ugh, ye, no, too much work. Lets see if SO knows a solution!
And, surprise surprise, it did! The easiest, simplest to understand way, was to make a schema-only dump of the database, grep it for user A, substitute their name with B, and then input it back.
What I didn't expect is for the resulting filtered and altered grant list to be over 6800 LINES LONG. WHAT THE FUCK.
...And, shortly after I apply the insane number of grants... I get another ping. Turns out the customer's already figured out a way to grant all the necessary perms themselves, and I... No longer have to do anything :|
Joy. Utter, indescribable joy.
Is there any actual security reason for disabling inheritance in Postgres? (14.x) I'd think that if an account got compromised, it doesn't matter if it has the perms inherited or not, cuz you can just SET ROLE yourself to the granted role with the actual perms and go ham...3 -
int* foo(); and int& foo();
if you're a
int *foo(); and int &foo();
kinda guy, you're fucking weird. And also wrong12 -
When the previous developer doesn't appear to know what casting is...
var foo = Convert.ToBoolean(objDictionary["someKey"].ToString());1 -
I just reviewed a pull request with a test case like (pseudo code):
# Test MyService
const mock = createMock(myService.myMethod)
.whenCalledWith("foo")
.returns("bar");
assert(mock.myMethod("foo") === "bar"));
Why though? Why are we testing the mock? What is happening here? This test has no reason of being there instead of a fuzzy feeling that we now have unit test to lure us into a false sense of security.
I asked why we don't do an integration test. Response was: "They are slow."
Well, duh, but at least they would actually test something.
What do you gain by asserting that the mock is working the way you set it up?3 -
Having a fantastically shitty day and it’s currently only 08:05.
Last night spent the entire evening moving into my flat and building the colossal amount of Ikea furniture, ended up going sleep around 3am.
Because of my fabulous two and a half hour work commute to work everyday I have to leave my house at 6am. Three hours sleep? Excellent start.
Leave my house at 6am good start, manage to get on my first bus no problem, bus driver being the horrendous cunt he is slams on his brakes because going round a sharp corner at 40 mph when the speed limit is 20mph is a fucking brilliant idea you cunt, consequently it sends my protein shake all over me, my clothes and my laptop. Cheers cunt.
So now it’s half 7 and I’m at the train station & I realise I’ve left my wallet at home. You’ve. Got. To. Be. Fucking. Me.
8 o clock roles over train inductor comes round asking for tickets and the power hungry scrotum drops a £60 fine on me. Cheers. You. Cunt.
So now I’m wondering whether I should just save myself the hassle get off the train at the next stop and jump in front of an incoming train.
Today can suck a fat meaty fiery cock from hell. -
try{
someObject.someAttribute = (int?) reader["columnName"];
}catch{
someObject.someAttribute = null;
}
Or, same coworker, another piece of code:
if(((int?)reader["foo"]).HasValue){
bar = (int?)reader["foo"];
}else{
bar = null;
} -
And here I am again, reading test cases that basically boil down to:
$testCase->foo = "bar";
$this->assertEquals($testCase, "bar");
$testCase2->foo = null;
$this->assertNull($testCase2->foo);
Why would anyone feel the need to write these kind of tests? They don't do anything. If I set up my mock a certain way, of course I will have that data, esp. if the unit under test only applies the data AS IS. (Funily enough through another component that already has the relevant dummy tests in place making these tests extra redundant and obsolete.)
You would think that one test case with dummy data suffices, yet no, there are like 30 examples that lie to you about apparent business logic cases, yet in the end the way you set up the mock decides what you will or won't get.
What's the point?6 -
I don't know how it's out there, but where I'm from, we don't get a lot of practical classes. The curriculum has tried to include practical alongside theory but its just not working. All we do is theory and more theory. Maybe include a major portion of marks for practicals rather than theory. And yes, please no coding in paper.
Another major thing we lack is teaching logical thinking. I have met final year under grads who find using a (!foo) to invert the value of foo mind blowing. They would rather use a full blown if-then statement to do the same. I think we need to incorporate chapters that motivates students into logical thinking to make better programmers.
Another essential part CS education around here lacks is in relevant examples and chances for internship. If you're studying something, I believe you would understand it much better if you see and experience it. Curriculum should include a real world project that you would use in a daily basis. Maybe break down and analyse a successful application and its component. -
Just starting with scala. And while I dig the more functional programming approach I am having the hardest of times dealing with naming higher-ordered functions, in my case a function returning another function.
Started out as `foo`, went through quite a lot of changes, and now it has become the beast: `createReplacePriceByPassengerConfigurationMapperFunction`. It won't stay that way but: GOSH! Naming. It's hard! Or I might as well suck at functional programmig. It's not like that these two things are necessarily mutually exclusive. -
Just learned the "hello world" of foo language.
Super cool...let's make some changes:
"Foo Programmer and Developer.
23 years of experience,
2 gazillion Foo projects in production" added to bio.1 -
Guess I'm getting old (school) outputting foo, bar and baz for testing purpose. Does anyone still using those too?5
-
How to know if someone is C# ninja?
when you read his code you’ll find a lot of Foo<T> , TModel, TKey and a lot of reflection5 -
LPT you can just write debug(foo) and it'll break as soon as chromium debugger hits a foo function call. Undoable by using undebug(foo).2
-
I really want my dev team to ask me to go to happy hour so I can suggest meeting at Foo Bar. Though, that may be why no one's asked..3
-
While everyone is hating proper programming languages... Let's talk about quotes in batch files.
What the actual fuck did Bill smoke while developing this boolshit?2 -
Not loving the implicit return statement within Scala. I like to avoid else statements to keep the level of nesting low and do early return yet Scala doesn't allow that.
(I am aware that I should flatMap that shit though in some cases I just want a simple if not foo then throw exception line. And continue with the next block until I return something.)
So you either have to create if-else-nesting beats or use pattern matching. The latter seems overly complicated for this use case (though it has its moments).
I know that I can make the return explicit yet the linter warns against that. It feels so verbose and I currently do not see any benefits and would argue that the code becomes both harder to read and maintain.3 -
Approaching the end of my first week as a junior web dev.
Spent the week writing automatic web suite tasks for an entire e-commerce platform.
Arguable the best way I could have been introduced to the code base 10/10 would recommend. -
There are few things I hate more in software development than writing mappings from shitty SOAP apis to JSON.2
-
Last week I was working on a web development assignment (php and bootstrap).
I had a few problems but the most annoying was that bootstrap didn't want to apply to one specific element.
I sat there, looking for the error for about 2 hours. When I finally found it I was raging inside. I mistyped a - instead of an = after the class attribute (i.e. class-"Foo").
The mistake was hard to spot because of a combination of the font and the low screen resolution - 2 hours wasted because of that shit -
'cat file | grep foo' .... For some unknown reasons, too. It sends shivers down my spine all the time
-
What the f*...
SomeType {
var something = {
somethingElse: "blah",
whatever: "halb"
}
var doStuff = function() {
this.something.whatever = "foo";
}
}
Based on what fucking logic are you claiming "something" is _undefined_ while running doStuff()??? What the fuck is wrong with you??? It's a freakin' static context!!!! "SOMETHING" IS DESIGNED TO BE DEFINED ! ! ! ! !8 -
Our software outputs some xml and a client has another company loading this xml into some data warehouse and doing reporting on it. The other company are saying we are outputting duplicate records in the data.
I look and see something like this:
<foo name="test">
<bar value="2" />
<bar value="3" />
</foo>
They say there are two foo records with the name test..
We ask them to send the xml file they are looking at. They send an xlsx (Excel!) file which looks like this:
name value
test 2
test 3
We try asking them how they get xlsx from the xml but they just come back to our client asking to find what we changed because it was working before. Well we didn't change anything. This foo has two bar inside it which is valid data and valid xml. If you cant read xml just say so and we can output another format! -
Sure, languages with automatic conversion to truthy and falsy values can be a pain in the ass, but in languages without that feature you need to use foo != true to see whether foo is either false or null. How fucking ugly is that?9
-
package bar;
public class Foo {
public static void main(){
System.out.println("Hello, World!");
}
}
I still wonder why I didn't start with Python, print('Hello, World') is a god damn one-liner7 -
Is writing hand-optimized SIMD code even still worth it? Thinking about writing my own little math library for my game engine but I've tried writing a hand-optimized `dot(normalize(b - a), foo) >= bar` and somehow it's actually slower than writing the same thing using a math lib which is implemented exclusively with scalar math and auto vectorized by llvm
LLVM... I kneel5 -
EDITOR=nano sudoedit foo
Spare me please…
It's not that I don't know how to use vim/vi, I'm just lazy to get used to it…1 -
Came to the realisation that I wasted three years in uni, today my final grades were released - for those who give a shit I got a first
I was happy till I realised I got my dev position without them even knowing my final grade.3 -
Found myself in a career predicament.
I’m currently working at a tech startup and it really does have the potential to really take off.
But recently the CEO has taken compressed working and remote working off the table for the most part which at this stage in my life is quite important.
Today I was offered a position at a different company with 4/5 days a week with a 10% pay increase.
Now the time has come to make a decision and I really don’t know what to do because I’m pretty sure the worst thing for me to do is make the wrong choice and end up kicking myself in a years time.
Was wondering if any of y’all have had to make a similar choice in your career7 -
I’m done with people who claim they don’t have time to do something.
Constantly hearing people complain they don’t have time to do things, oh fuck off you cunt. You work a nine to five, you get home at half five and you sit at home doing fuck all while you complain that things aren’t going your way.
Doesn’t even have to be about developing, lost count with the amount of people who claim they don’t have time to go the gym. Dickhead, you have a 24 hour gym three minutes away from your house. You could go after work, instead you’ll sit on your ass, eat a load shit and then complain you’ve put on weight.
If you’re doing fuck all to make things happen then you lose the right to complain about your circumstances. Stop blaming other people for your fuck ups because you ‘don’t have time’ to get shit done you absolutely holocaust of a human being.
While I’m at, fuck people who think it’s my soul mission in life to fix their shit, believe it or not I don’t give two flying fucks about your circumstances if you’re doing fuck all to help yourself.
Do me a favour and kindly drink some bleach.13 -
Still as a scholar who has had his intership I decided that I was finally confident enough in my ability to apply for a small part-time programming job. I had an internship at a cool exhausting place with tons of expertise and I've proven myselve over there. So now I wanted a job on the side. Nothing special, just something that would make a little money with programming instead of washing dishes at the restaurant.
So I started at this small internet based startup (2 or 3 progammers) as a backend-oriented programmer. The working hours were amazingly compatible with my school schedule.
The lead dev also sounded like a smart guy. He had worked as a backend guy for years and had code running on verry critical public infrastructure that if it were to fail we'd be evacuated from our homes.
As a first asignment I got an isolated task to make an importer for some kind of file format that needed integration. So I asked for access to the code. I didn't get it since they were going to re-do the entire backend based on the code I wrote. I just needed to parse the file in a usable object structure. So I found out that the file format was horrible and made a quite nice set of objects that were nice. At the end of the first week or so I asked if I could get access to the code again, so I could integrate it. Answer was no. The lead dev would do that. I could however get access to my private repository.
Next week a new intern was taken to build a multiplatform responsive app. Only downside was that all the stuff he had ever done was php based websites. It wasn't going anywhere anytime soon, but I figured that that was where internships were for. So I ended up helping him a lot and taught him some concepts of OOP and S.O.L.I.D. and the occasional 30 minute rants of IndexOutOfRangeException, ArgumentException and such.
So one day he asked me how to parse a json string and retrieve a specific field out of it.
I gave him something like the following to start with:
"
JObject json;
if(!JObject.TryParse(jsonString, out json))
{
//handle error
}
string value;
if(!json.tryget("foo", out value).../// code continues
"
but then the main dev stepped in and proposed the following since it wouldn't crash on an API change:
"
dynamic json = new JObject(jsonString);
string value = json.myJsonValue;
"
After me trying to explain to him that this was a bad choise for about 15 minutes because of all kinds of reasons I just gave up. I was verry mad that this young boy was forced to use bad programming pracises while he was clearly still learning. I know I shouldn't pick up certain practises. But that boy didn't.
Almost everytime the main dev was at the office I had such a mindboggling experience.
After that I got a new assignment.
I had to write another xml file format parser.
Of course I couldn't have any access to our current code because... it was unnecesary. We were going to use my code as a total replacement for the backend again.
And for some reason classes generated from XSD weren't clear enough so after carefull research I literally wrapped xsd generated code in equivalent classes.
At that moment, I realized I made some code that was totally useless since it wasn't compatible with any form of their API or any of the other backend code. (I haven't seen their API. I didn't have access to the source.) And since I could've just pushed them generated XSD's that would've produced thesame datastructure I felt like I was a cheat. I also didn't like that I wasn't allowed to install even the most basic tooling. (git client or, Ide refactoring plugins, spelling checker etc...)
Now I was also told that I couldn't discuss issues with the new guy anymore since it was a waste of my valuable time, and they were afraid that I taught him wrong concepts.
This was the time that my first paycheck came in so I quitted my job.
I haven't seen any of the features that I've worked on. :) -
So apparently the variable names foo and bar come from an old military term FUBAR which means f-ed up beyond all recognition.... Those OG UNIX guys hid their memes really well
-
If you want this app better, stop posting crappy content or content you have to end up explaining.
Simple, isn't it?3 -
-Recently started a new job so I’m new to the infrastructure-
Spent the vast majority of the day trying to SSH into one of my company servers to sort some random bug out on the website & the connection kept being rejected despite the day before it working when passing the .pem key into the SSH along with the ip & my username, nothing new there.
Anyway, everyone’s mad busy so I don’t wanna bother anyone to ask why, so I check confluence, no documentation for SSHING into our scheduler or the code the server I need to access. Never-mind.
Spend another couple hours trying debug it on my own, no luck. Never-mind.
Finally seize my opportunity and ask for help; ‘Oh the server IP changes daily so you need to run a task through our scheduler that you need to SSH into to return the list of IPS and that dynamically changes so that’s how you get the IP’
Oh ok. Why is there no documentation for that again? I mean. Thats generally some pretty important information you’d pass onto your starters.
At least I can say I won’t be making that same mistake again.5 -
#Suphle Rant 9: a tsunami on authenticators
I was approaching the finish line, slowly but surely. I had a rare ecstatic day after finding a long forgotten netlify app where I'd linked docs deployment to the repository. I didn't realise it was weighing down on me, the thought of how to do that. I just corrected some deprecated settings and saw the 93% finished work online. Everything suddenly made me happier that day
With half an appendix chapter to go, I decided to review an important class I stole from my old company for clues when I need to illustrate something involved using a semblance of a real world example (in the appendix, not abstract foo-bar passable for the docs)
It turns out, I hadn't implemented a functionality for restricting access to resources to only verified accounts. It just hasn't been required in the scheme of things. No matter, should be a piece of cake. I create a new middleware and it's done before I get to 50 lines. Then I try to update the documentation but to my surprise, user verification status turns out to be a subset of authentication locking. Instead of duplicating bindings for both authentication and verification, dev might as well use one middleware that checks for both and throws exceptions where appropriate.
BUT!
These aspects of the framework aren't middleware, at all. Call it poor design but I didn't envisage a situation where the indicators (authentication, path based authorisation and a 3rd one I don't recall), would perform behaviour deviating from the default. They were directly connected to their handlers and executed after within the final middleware. So there's no way to replace that default authentication scheme with one that additionally checks for verification status.
Whew
You aren't going to believe this. It may seem like I'm not serious and will never finish. I shut my system down for that day, even unsure how those indicators now have to refactored to work as middleware, their binding and detachment, considering route collections are composed down a trie
I'm mysteriously stronger the following day, draw up designs, draft a bunch of notes, roll my sleeves, and the tsunami began. Was surprisingly able to get most of previous middleware tests passing again before bed, with the exception of reshuffled classes. So I guess we can be optimistic that those other indicators won't cause more suffering or take us additional days off course2 -
Our #bigtech repo is like 19 billion LOC so how am I the first one to try to do simpleThing with obviouslyRelatedThing?
My search foo yields nothing and I fear its not supported yet.
fml4 -
Looking at jest errors and loads of GitHub and StackOverflow issues, it's no surprise that people claim they don't like testing.
Maybe they would if we got our tooling right.
import { foo } from 'bar';
Nah, that's an unexpected token, jest does not like this syntax.
Using require, like in jest's getting started tutorial isn't compatible with my existing JS libraries exports.
Adding type: "module" in package.json just makes another error message appear instead.
Fucking developer experience!
Why bother with unit tests at all?
How come PHP is 10 years superior to JS when it comes to code quality, unit tests, and static code analysis?
I don't even care about "ES modules". I don't want to "mock" anything either. All I want to do is import a handful of JavaScript functions into another file.
Overengineered web dev stack sucks!3 -
TFW you know you're going to be seen as a sort of code anarch or unenlightened (foo)barbarian for even suggesting that there are other git workflows more suitable than GitFlow, but you do it anyway.
Saying that I keep my master unprotected feels like telling Grandma I worship Satan.
I work with a very small team that's always physically nearby, we all get along well, trust each other and communicate to know what everyone is up to, which I guess is hard to believe in and of itself, but is it so fucking hard to believe that we'd be okay without redundant eternal branches or a vomitload of unbisectable history-warping merge commits? -
Reading code and getting that face palm moment
String code = customer.getCode();
customer.setAccount("foo");
customer.setGroup("bar");
customer.setCode("new code");
Ok this is preparing the customer obj makes sence.
Some 20 lines later
customer.setCode(code);...... Wtf1 -
Do you write your comments before or after you write the code?
Do you write var foo = 1; and then go back a line above it / beside it to comment, or do you write the comment line / block first prior to writing the code statement?6 -
I hate when I visit a new web framework's site and see documentation that promotes HTML tags like this:
<input type='text' name='foo' value='{{val}}' />
If you don't know enough about which quotes you should use and why... I have no faith in the quality of your software solution. -
*Python:*
```
d = json.loads(str)
d['foo'] = bar
json.dumps(d)
```
*Scala:*
```
Caused by: TimerException{org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `scala.collection.immutable.Map` (no Creators, like default constructor, exist): abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information
at [Source: UNKNOWN; line: 1, column: 1]}
... 15 more
```2 -
<?php
// This is the demo code of a PHP gotcha which took me some hours to figure out
$hr = "\n<hr>\n";
$JSON = '{"2":"Element Foo","3":"Element Bar","Test":"Works"}';
$array = (array)json_decode($JSON);
echo "Version: " . phpversion() . $hr;
// Tested on: 5.5.35 and 7.0.15
var_dump($array);
// Prints: array(3) { '2' => string(11) "Element Foo" '3' => string(11) "Element Bar" 'Test' => string(5) "Works" }
echo $hr;
var_dump($array['Test']);
// Prints: string(5) "Works"
echo $hr;
var_dump($array[2]);
var_dump($array['2']);
var_dump($array["2"]);
var_dump($array[3]);
var_dump($array['3']);
var_dump($array["3"]);
// Prints: NULL + Notice: Undefined offset ... in ...
echo $hr;
$newArray = array();
foreach ($array as $key => $value) $newArray[$key] = $value;
var_dump($newArray[2]);
var_dump($newArray['2']);
var_dump($newArray["2"]);
// Prints three times: string(11) "Element Foo"
var_dump($newArray[3]);
var_dump($newArray['3']);
var_dump($newArray["3"]);
// Prints three times: string(11) "Element Bar"1 -
Talking about software engineering. probably everyone has a slightly different understanding of it, but I wonder who is still using UML or similar tools.
I'm asking cause I see only few who are capable of using it.
There might be tons of other ways of achieving things for what UML is meant for, but I got the impression that software designing /architecture isn't a thing at all. It's not only that I see a lack of collaboration efficiency, but I'm also afraid that it's more about hacking things together (maybe even by just smashing SO comments together)
Thanks, looking forward to read your opinions !
PS: if my suspicion was correct, than this would have been a rant 😁9 -
(Warning, wall of text)
Settle an argument for me. Say you have a system that deals with proprietary .foo files. And there are multiple versions of foo files. And your system has to identify which version of foo you are using and validate the data accordingly.
Now the project I was on had a FooValidator class that would take a foo file, validate the data and either throw an error or send the data on its merry way through the rest of the system. A coworker of mine argued that this was terrible practice because all of the foo container classes should just contain a validate method. I argued that it was a design choice and not bad practice just different practice. But I have also read that rather than a design choice that having a FooValidator is the right way to do OOP. Opinions?1 -
I'm reading some react/typescript code and I haven't work much with any other language or paradigm where I might have a function return multiple objects that are different types
e.g.
const { sna, foo, bar } = useWhatever();
I mean I guess it's just unpacking properties from the actual return object but that isn't apparent to a newcomer at a glance (if I remember correctly)
https://softwareengineering.stackexchange.com/...
Looking for additional insights from the wise devrant community30 -
My regex foo has gotten really weak. It took me unholy number of attempts to get ^\n{1,}$ right 😞.1
-
We are launching a new product soon. The C-levels have decided to call it "Foo Bar" (fictive name).
Now all our products are called:
"Foo Desktop"
"Foo Mobile"
"Foo Bar"
Nearly all internal & external reports previously was that "Foo" has problems. We nearly never know if they are talking about the desktop app or mobile app. Soon we will not know for sure if they report a problem about "Bar", Desktop or Mobile.
All 3 applications uses a different tech stack with their unique problems :') -
soo, i am unknowledgeable of ALL best practice.
lets say i call a php file called loader.php with a $_GET['type'] parameter, then after i check if type is actually set i switch the parameter and my logic then does stuff appropriate for $type..
do i create a lot of sub files with the program logic in it or do i just create subfunction (which i have to pass variables if necessary)?
Switch( $_GET['type'] ) { case 'foo': include "logic/foo.php"; break; default: echo "error"; break; }
or is the whole concept totally alien and stupid? i most honestly say that i dont know exactly what i could google to find an answer3 -
Using variables names like asd, qwe, a, x in demo/tests. But using "Foo, bar" before shoeing to anyone.1
-
Ok so I got namespace N.
And namespaces N\a and N\b.
I would like N\a\foo() to call N\b\bar().
But no matter what I do it says \N\b\bar() does not exist. What am I doing wrong??
I've tried including, using, requiring but nothing.8 -
I really am in a love/hate relationship with programming...
I had some free time so I decided to do the Google foo bar challenge. For testing purpose, I code in sublime text and then copy the code in the browser.
Yesterday, I spent most of the afternoon doing one challenge. I figured out how to approach the problem, which was kinda easy, and coded it in about 10 minutes. For some reason, what worked perfectly in sublime text worked without throwing any errors in the browser, but 4 of the 5 test done by Google failed.
Today, after spending a good hour tweaking some stuff in the hope that it would work, the browser editor started throwing indentation errors...
Deleted the code in the browser, copy-pasted the exact same code from sublime : All test passed!
That's a couple of hours I'm never getting back. -
Here's a fun fact (which actually will be accompanied with a source) about node.js. When you import or require a module it will be imported as a singleton. Or put another way, ```export const Foo = { };``` is one of the simplest* and most readable singletons you can have in that runtime. And of course here's the thing you always should be asking for when people make a claim like this https://nodejs.org/api/...
So why write this? Well some of you might feel inclined to write a medium (or other) post about "design patterns in Javascript" where you basically just translate the GOF book from Java to Javascript and now you have something that isn't just awkwardly translated Java code! -
I took a long time to use prepared statements in a production php application instead of directly constructing the SQL query with the variables I had...
Like $sql = 'SELECT * FROM foo WHERE y = '.$search; -
Colleague tells me that, in PHP, this is an unsafe selector.
$a = $some_array['foo']['bar'];
And that if ['bar'] has no value, $a will default to $some_array['foo']
Is this right?, because that doesn't seem right to me...9 -
It's always a matter of much is there to do and in what language...
There is the IDE-Zone, which is dominated by IntelliJ (CLion be praised when you do Rust or C++) for large stuff and heavy refactorings.
Always disputted by VS Code with synced settings. It's nice and comfy and has every imaginable language supported good enough, especially when its smaller change in native code or web/scripting stuff.
Then there is the "small changes" space, where Vim and VS Code struggle whos faster or which way sticks better in my brain...
might be you SCP stuff down from a box and edit it to re-upload, or you use the ever-present vi (no "m" unfortunately)
sometimes things are more easy for multi-caret editing (Ctrl-D or Alt-J), and sometimes you just want to ":%s/foo/bar/g" in vim.
I am sure that each of these things are perfectly possible in each of the editors, but there is just reflexes in my editor choices.
I try to stay flexible and discover strenghts of each one of my weapon of choice and did change the favorites. (Atom, Brackets, Eclipse, Netbeans, ...)
However there are some things I tried often and they are simply not working for me...
might for you. I don't care. and I'll just use some space to piss people off, because this is supposed to be a rant:
nano just feels wrong, emacs is pestilence from satan that was meant for tentacles instead of fingers, sublime does cost money but should not, gives me a constant guilty feeling (and I don't like that) that, and all the editors from various desktop environments are wasted developer ressources. -
As hard as I fucking try, my stumbling block, every fucking time is exports/imports. I can't wrap my head around them, at all.
What do you use in browser vs in node?
Whats the *most commonly used standard*?
Whats the difference between "modules.export = Foo;"
vs "exports.Foo = Foo;"
what about
export class Foo? Is that the same as modules.export or export.Foo?
Look at this shit...
import FooComponent from "./Foo";
export default Foo
const Foo = require("./foo")
const Foo = require("./foo.js").Foo
import { Foo } from "./Foo.js";
And probably a dozen others I don't know about.
Why does there have to be so many fucking ways to do a fucking import/export?
What the fuck is going on here?8 -
Your branch and 'origin/foo/bar' have diverged,
and have 2 and 1 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
git pull
hint: You have divergent branches and need to specify how to reconcile them.
git merge origin foo/bar
Already up to date.5 -
Just saw a production website where the routing looked like this:
https://domain.tld/Default.asp/... -
Failing to self study because i always get stuck on tutorials like so:
Do a, now do b. You should now get C. You can then proceed with d etc.
BUT I DON'T GET C. WHY NOT?! I FOLLOWED ALL YOUR FUCKING STEPS YOU SHITTY GUIDE/BOOK/ASSHOLE.
So i had to get basics from school where i could ask questions to such stupid things. It got better, but i sometimes still run in to it, and still can't google foo my way out of it. -
OOP is all about code reusability until you really want exactly the code Foo with non-pure functions in all your classes. You end up almost rewriting all subclasses' properties into the superclass to silence typecheckers. Is there no "I know what i'm doing, please just transpile/compile this piece of logic into these 20 places I need?" You end up doing it the functional way, dumping refs and params into some shared util function and have it do the job. I know, might as well have that one inherited also, but what's the point of adding more mess just for that ?2
-
package main
// go is very frustrating. in their efforts to keep the language simple, they've broken its consistency :(
// A A is just some arbitrary interface
type A interface {
Foo()
}
// B is an interface requiring a function that returns an A
type B interface {
Bar() A
}
// Aimpl implements A
type Aimpl struct{}
// Foo is Aimpl's implementation of A
func (a Aimpl) Foo() {}
// Bimpl attempts to implement B
type Bimpl struct{}
// Bar is Bimpl's attempt at implementing B.
// problem is, if Bar returns an Aimpl instead of A, the interface is not satisfied
// this is because Go doesn't support implicit upcasting on returns from interfaced objects.
// if we were to simply change the declared return type of Bar() to 'A', without changing
// the returned value, Bimpl will satisfy B.
func (b Bimpl) Bar() Aimpl {
return Aimpl{}
}
var _ B = Bimpl{}
func main() {
}2 -
I'll listen to an album, try and understand the story, and search for the truth.
I use to let musicians guide me. I'd look to them..
Search for interviews and repeat songs to stay high.
Musicians are great marketers. They're compelling, emotionally intelligent, and spiritual.
What I'm trying to say is, I learned a lot of game from musicians.
Seduction..
and that'll only get you so far.
I just became aware of programming not to long ago.
I have a mentor on money real estate, seduction, fashion, marketing, but I don't know anyone who is the guro of programming and development.2 -
TypeScript has two levels of private values (at least in the beta):
private foo = false; // Cannot be accessed outside the object in TypeScript
#bar = false; // cannot be accessed outside the object in both TypeScript and JavaScript.2 -
Okay, so, I have a functional snort agent instance, and it's spewing out alerts in it's "brilliant" unified2 log format.
I'm able to dump the log contents using the "u2spewfoo" utility (wtf even is that name lol... Unified2... something foo) but... It gives me... data. With no actual hint as to *what* rule made it log this. What is it that it found?
All I see are IDs and numbers and timings and stuff... How do I get this
(Event)
sensor id: 0 event id: 5540 event second: 1621329398 event microsecond: 388969
sig id: 366 gen id: 1 revision: 7 classification: 29
priority: 3 ip source: *src-ip* ip destination: *my-ip*
src port: 8 dest port: 0 protocol: 1 impact_flag: 0 blocked: 0
mpls label: 0 vland id: 0 policy id: 0
into information like "SYN flood from src-ip to destination-ip" -
How bash does not support redirecting stderr to /dev/null when using read redirection inside command substitution is F*CKING ANNOYING.
x=$(</foo/non_exitence_file.txt 2>/dev/null)
Why do people still use this shit of a shell?2 -
http://website.com?foo=bar&baz=bin039;m trying to map, for example, something like http://website.com?foo=bar&baz=bin to something like http://website.com/bar/bin. I'm pretty sure its doable but I'm having a terrible time getting it to work.3
-
Golang: It's stupid that the language doesn't allow the variable 'result' to be used out of the if scope, although it's been declared outside the if scope:
if result, err := foo(bar); err != nil {
// do something with err
}
// no err, so do something
// with result.
// But No! you can't.3 -
SO TIRED of the typescript generics system. I get why you can't assign Thing<Foo> to Thing<any>, I do. But also, WHAT THE FUCK!? This is such a giant waste of time having to fix everything to pass around generics that I don't care about.
I've probably spent ~500 hours of my life wrestling this stupid ass type system.11 -
We have a huge domain model in Java and something is really fucked up with our equals/hashcode implementations and know body can track it down.
I have suggested Lombok/Groovy several times but they didn't listen.
Anyways it is so fucked up, that map.contains(foo) returns false, although it is part of the map.
So we wrote something like this:
for (Entity e: map.keyset) {
if (foo.equals(e) {
return true;
}
}1 -
identify foo/*/img/header-logo-1.png
foo/de-de/img/header-logo-1.png PNG 75x150 75x150+0+0 8-bit sRGB 11.4KB 0.000u 0:00.000
foo/en-au/img/header-logo-1.png[1] PNG 69x69 69x69+0+0 8-bit sRGB 5.7KB 0.000u 0:00.009
foo/fr-fr/img/header-logo-1.png[2] PNG 69x69 69x69+0+0 8-bit sRGB 3.37KB 0.000u 0:00.000
foo/it-it/img/header-logo-1.png[3] PNG 69x69 69x69+0+0 8-bit sRGB 6.38KB 0.000u 0:00.000
foo/nl-nl/img/header-logo-1.png[4] PNG 69x69 69x69+0+0 8-bit sRGB 10.2KB 0.000u 0:00.000
foo/pt-br/img/header-logo-1.png[5] PNG 69x72 69x72+0+0 8-bit sRGB 10.8KB 0.000u 0:00.000
foo/ru-ru/img/header-logo-1.png[6] PNG 71x72 71x72+0+0 8-bit sRGB 10.1KB 0.000u 0:00.000
Because fuck consistency. -
And here comes the next solution ...
exec("wget ".$foo." > /dev/null 2>&1 &");
$foo contains data from the users query ...1 -
I have a readonly object property foo on a typescript class. When I create an instance bar by calling the constructor, bar.foo doesn't compare equal to this.foo as seen from within bar several async calls later. What could I have possibly fucked up?4
-
https://symfony.com/doc/3.4/...
Look at how they write docs:
"->atPath('foo')"
how can I fucking know what to pass instead of foo? I cannot make show fucking error message near the field.
Are they writing such doc so that we would spend more time searching how to make show fucking simple error message?
"The atPath() method defines the property which the validation error is associated to. Use any valid PropertyAccess syntax to define that property."
Property on my entity is collection of $values . Tried passing 'values' - no effect.2 -
One dev at the company I work is developing an API and the response for all the requests are basically the same.
However, for example, if you request a login and your credentials are wrong the response gives you:
{
'foo':[],
'var':[],
'msg':'credentials error'
}
But if the credentials are correct, the response gives you:
{
'foo':[
'stuff1':1,
'stuff2':2,
'stuff3':3
],
'var':[
'var1':1,
'var2':2,
'var3':3
],
'msg':'logged in!'
}
Is that correct? I mean, does that compromises security?5