Programming Confessions Thread
-
@HardwareGeek said in Programming Confessions Thread:
@loopback0 said in Programming Confessions Thread:
better meetings
What Earth-# do you live on?
It's the one with the blue grass on the other side...
-
@Gąska ORM: not even once.
I have the joy of Hibernate at work. It can be a bit of a pain sometimes, but if you have to support multiple databases (so you can't just write the queries yourself without SQL extensions - even stuff like limit) then an ORM is a good thing.
And some kind of database to domain object (and vice versa) mapping framework is essential to avoid having to write all the resultset-to-object marshalling and object save code manually for every database table.
-
@bobjanova yeah, I love Hibernate. It can't do everything with the DB that I need to do but it takes care of so much of the boring crap that it's totally worth it.
-
I didn't know you could hibernate at work and still get paid.
-
@HardwareGeek said in Programming Confessions Thread:
@loopback0 said in Programming Confessions Thread:
better meetings
What Earth-# do you live on?
I said better, not good.
-
@Zerosquare said in Programming Confessions Thread:
I didn't know you could hibernate at work and still get paid.
It's that what we've all been doing since March?
-
Spent about a half hour on this. I added a new REST method. Something like:
@GET @Path("/foo/{fooNumber}/bar/{barName}/blah{") public Flah getFlah(....)
...but I'd get errors trying to call it. Went over the URL I was using...pasted it on the line above that to make sure I didn't mess anything up. Started searching for the RESTEASY error I was getting because it just wasn't making any sense to me.
Finally...I saw it. The extra
{
at the end of the path.
-
Reminder that it's a bad idea to interrupt your code monkeys with an urgent problem while they're in the middle of typing a half-assed kludge to fix your previous urgent problem.
What should have been:
public void FrobKnobs(ICollection<long> knobIds) { if (knobIds == null || knobIds.Count < 1){ return; } try { ...
became:
public void FrobKnobs(ICollection<long> knobIds) { if (knobIds == null || knobIds.Count < 1) try { ...
Filed under: code will work, but only if it runs, what's this "code review" thing I keep hearing about?
-
@Zecc At least the unit test caught it, right? :)
-
@bobjanova said in Programming Confessions Thread:
@Zecc At least the unit test caught it, right? :)
How can the unit tests or code reviews catch anything when the codebase uses Egyptian braces?!?!? We clearly need to convene an emergency meeting of the architects’ council to
updatedevelop the style guideline handbook!
-
@izzion said in Programming Confessions Thread:
We clearly need to convene an emergency meeting of the architects’ council to update develop the style guideline handbook!
That's easy:
git add .clang-format
and ENABLE AUTO-FORMAT in you're editor or your fired!
-
@bobjanova said in Programming Confessions Thread:
@Zecc At least the unit test caught it, right? :)
I tried to come up with a funny response to this, but I only ended up sitting in the bathroom, weeping.
@izzion said in Programming Confessions Thread:
How can the unit tests or code reviews catch anything when the codebase uses Egyptian braces?!?!?
Egyptian braces were only part of the anonymization though.
-
Five minutes later, it suddenly became clear why my attempts to use
ALTER TRIGGER ix_oldtablename_columnname ON newtablename RENAME TO ix_newtablename_columnname
were failing to rename an index, despite my many checks on whether all names were spelled correctly.
ALTER INDEX
worked much better..
-
Must be late Friday.
for(int i = 1; i <= count; count++)
-
@Zecc if you can afford it, that's some excellent confusion to leave in for the Next Poor Bastard. Use a short or something and leave it in, I'd say, just make sure the loop body has a modulus operation in it to absorb the extra iterations and that the overall operation is idempotent. Try to get an interest in a liquor store nearby.
-
@Zecc said in Programming Confessions Thread:
Must be late Friday.
for(int i = 1; i <= count; count++)Yeah, that's terrible code, obviously you should have used pre-increment instead of that abomination.
...
...Ah, you meant the range of
i
, well that could be a problem too.
-
@ixvedeusi said in Programming Confessions Thread:
obviously you should have used pre-increment instead of that abomination.
Because we‘re still using compilers from 1840!
-
Here's your , it fell off your belt.
-
Someone on my project, let's call him Kevion, was working on getting data from our core C++ calculation library back into the VB.NET UI so that the UI could check if it needed to raise a warning to the user based on the calculations library result. The C++ had an integer value for the index of what object just got modified (or would return -1 for nothing that got modified), and the intermediate C++ function that called the modification function 0 or more times needed to return that back out to the VB.NET code.
So Kevion looked at making an int[] return type, but saw that involved pointers and would be a mess... so he created a CSV list of the integers and returned a string instead, then did trim and split and cast hijinx in the VB.NET code to get to a List<int>.
If I see Kevion in a nearby mirror I'm going to punch him in the nose...
-
@izzion never String. never ever ever String.
ed. no, not even for naming things. fuckit.
-
@izzion he didn't even use json? I mean, unnecessary use of json aside, at least transport/serialization/interchange, etc is what it's for...
-
@Captain well, I mean interchange is a tall order. probably want SGML for that.
-
@Gribnit said in Programming Confessions Thread:
never ever ever String
No, you just need an actually fast string implementation. They are not at all easy to write, but are perfect library-bait.
-
@dkf said in Programming Confessions Thread:
@Gribnit said in Programming Confessions Thread:
never ever ever String
No, you just need an actually fast string implementation. They are not at all easy to write, but are perfect library-bait.
Cock that in the balls. It's a fine type for about 1/10th of what it gets used for.
There's a place for yon types well out of the reach of CRUD application developers, sure, for editors and such. A very fast string elsewhere means, "hey, fuckit, the application state is just this JSON string now".
first the users fuck the API, then they stick a severed pig's head on it, then they fuck it again with the pig's head.
-
Been going back and forth between java and typescript code lately. This morning was the second time this week that I'd been writing java and fucked up string equality comparisons.
if( aString == anotherString ) // instead of: if( aString.equals( anotherString )
-
@boomzilla switch to Scala, == there always means .equals
-
@boomzilla said in Programming Confessions Thread:
Been going back and forth between java and typescript code lately. This morning was the second time this week that I'd been writing java and fucked up string equality comparisons.
if( aString == anotherString ) // instead of: if( aString.equals( anotherString )
Your second if statement isn’t going to work either
-
@boomzilla said in Programming Confessions Thread:
Been going back and forth between java and typescript code lately. This morning was the second time this week that I'd been writing java and fucked up string equality comparisons.
if( aString == anotherString ) // instead of: if( aString.equals( anotherString )
Unbalanced parenthesis on line 3.
-
I guess it would disappoint me if you guys didn't point out the anonymization errors.
-
@boomzilla said in Programming Confessions Thread:
I guess it would disappoint me if you guys didn't point out the anonymization errors.
You use custom closing parens?
-
@PleegWat said in Programming Confessions Thread:
Unbalanced parenthesis on line 3.
I missed that, but I missed a lot of unbalanced parentheses in the python I've been writing for the last 2 or 3 days, too. Also used the wrong string comparison operator.
-
@HardwareGeek said in Programming Confessions Thread:
Also used the wrong string comparison operator.
+
is the wrong string comparison operator, yes. And yet Python will only complain about it when one side is not a string…
-
@Gribnit said in Programming Confessions Thread:
@boomzilla said in Programming Confessions Thread:
I guess it would disappoint me if you guys didn't point out the anonymization errors.
You use custom closing parens?
You don't?!?!?
-
I've managed to write the following (incorrect) formula for calculating the average of two numbers multiple different times now without noticing the typo until much later:
var averageX = (x2 - x1) / 2;
A big part of the problem is that
x1
is quite frequently a small number close to zero. Half the time, the results are close enough to correct that I don't notice. Half the time, the results are very, very wrong. Both times this has happened, it has taken an embarrassing amount of time to track the issue down to this little typo.
-
@Placeholder said in Programming Confessions Thread:
var averageX = (x2
-+ x1) / 2;https://youtu.be/sBtAGxBh-XI?t=277s
The simple problem of computing the value between two other values is surprisingly subtle in general.
This overflow bug existed in Java's binary search for more than a decade. [...]
-
@topspin good video. Luckily for me the domain I'm working in effectively guarantees that I'll never need to worry about this kind of overflow. Just you wait though. Given enough time I'm sure I'll eventually run into this problem.
-
@Placeholder images are no longer large, they became small (relatively) lately. Is this a GIS app tho?
-
Wasted probably about an hour on something like this:
<app-foo> [bar]="theBarToPassIn" [baz]="theBazToPassIn" [bat]="theBatToPassIn' </app-foo>
...and wondering why
bar
,baz
andbat
in theFooComponent
were undefined.
-
@boomzilla said in Programming Confessions Thread:
Wasted probably about an hour on something like this:
<app-foo> [bar]="theBarToPassIn" [baz]="theBazToPassIn" [bat]="theBatToPassIn' </app-foo>
...and wondering why
bar
,baz
andbat
in theFooComponent
were undefined.With practice, you could probably get that up to 2 hours.
-
This post is deleted!
-
This library that the entire app depends on to maintain state consistency demands an entirely unreasonable level of knowledge from the applications programmer. It handles all the invariants but leaves the app code painfully confused by its subtlety.
-
@boomzilla IDGI
Did you mean that you needed to define those properties as e.g. XML attributes while you put them as text?
-
@JBert said in Programming Confessions Thread:
@boomzilla IDGI
Did you mean that you needed to define those properties as e.g. XML attributes while you put them as text?
They need to be inside the brackets of the opening tag, not between the opening and closing tags.
-
@boomzilla said in Programming Confessions Thread:
Wasted probably about an hour on something like this:
<app-foo> [bar]="theBarToPassIn" [baz]="theBazToPassIn" [bat]="theBatToPassIn' </app-foo>
...and wondering why
bar
,baz
andbat
in theFooComponent
were undefined.Is it fair game for me to be the first to point out the anonymization errors two times in a row?
mmm, unbalanced quotes
-
@boomzilla said in Programming Confessions Thread:
@JBert said in Programming Confessions Thread:
@boomzilla IDGI
Did you mean that you needed to define those properties as e.g. XML attributes while you put them as text?
They need to be inside the brackets of the opening tag, not between the opening and closing tags.
My first thought (even though it's wrong) was "what unholy marriage of XML and JSON is that?"
-
@dcon said in Programming Confessions Thread:
@boomzilla said in Programming Confessions Thread:
@JBert said in Programming Confessions Thread:
@boomzilla IDGI
Did you mean that you needed to define those properties as e.g. XML attributes while you put them as text?
They need to be inside the brackets of the opening tag, not between the opening and closing tags.
My first thought (even though it's wrong) was "what unholy marriage of XML and JSON is that?"
Looks more like YAML trying to fuck a web page.
-
@dcon said in Programming Confessions Thread:
@boomzilla said in Programming Confessions Thread:
@JBert said in Programming Confessions Thread:
@boomzilla IDGI
Did you mean that you needed to define those properties as e.g. XML attributes while you put them as text?
They need to be inside the brackets of the opening tag, not between the opening and closing tags.
My first thought (even though it's wrong) was "what unholy marriage of XML and JSON is that?"
It's an Angular template, so mostly html.
-
Wasted about 45 minutes figuring this out...
Had updated some of the Angular stuff and went to test it...was getting a compile error about not being able to find
expect
in a file that had stubs for testing. Went in and added it to theexclude
section oftsconfig.app.json
. Nothing. Lots of searching ensues...anger...frustration...Finally it occurs to me...checks for references to the file...oops...apparently at some point during my editing VS Code had auto imported something from there and I didn't notice what it had done.
-
Someone resurrecting that thread reminded me of my most recent self- (yesterday).
I had an application where I'm developing additional plugins. And on the new version, I often got an error when saving a project, so I thought the persistence layer of my plugin was causing it. Started again with an empty project, ok, this works. Use an existing project with some data in it, fails. Try the same project on a Linux computer, works. Try again on Windows, fails. Breakpoints don't indicate any obvious problem. Weird. Very weird.
Then yesterday I got another bug (a typo in a label), yeah, no problem, I'll fix it right now, and oh wait I can't save the source file because VS says my disk is full, oh I hadn't noticed it was that full but never mind, just empty the bin and it's done.
It's now too late to come back to this project-saving issue, I'll try again and keep looking at it tomorrow, but what the hell is happening...?
...
Yes, that's really how my thought process went. It took me several hours after getting home to finally put one and one together.
-
I must confess--I can never remember which way the @#$#@$#@ arrows in a dependency graph go.