Programming Confessions Thread
-
@Karla said in Programming Confessions Thread:
@Polygeekery said in Programming Confessions Thread:
I would guess that if it were based on that alone the answer would probably be no.
Does "how to interview for a dev job" count?
You'd definitely not get a job if you admitted to that.
-
@Polygeekery said in Programming Confessions Thread:
I would guess that if it were based on that alone the answer would probably be no.
My last was to check the parameters of a git command. I'm sure they'd understand.
-
@Polygeekery said in Programming Confessions Thread:
I would guess that if it were based on that alone the answer would probably be no.
I couldn't figure out why
Files.createNewFile
threw aNoSuchFileException
, and had forgotten that you first had to callFiles.createDirectories
.
-
@Gąska said in Programming Confessions Thread:
Last problem I've googled for was for college work. How to use a function returning a cursor in PL/SQL.
Last problem I've googled for at work was to find out whether Scala has this very cool feature I've seen in other languages that would really help me at the moment. Of course, I found out it doesn't. Every fucking time.
What was the feature?
-
@pie_flavor said in Programming Confessions Thread:
@Gąska said in Programming Confessions Thread:
Last problem I've googled for was for college work. How to use a function returning a cursor in PL/SQL.
Last problem I've googled for at work was to find out whether Scala has this very cool feature I've seen in other languages that would really help me at the moment. Of course, I found out it doesn't. Every fucking time.
What was the feature?
I don't remember; it's a different feature every week. Scala has a lot of missing features.
-
@Gąska said in Programming Confessions Thread:
@pie_flavor said in Programming Confessions Thread:
@Gąska said in Programming Confessions Thread:
Last problem I've googled for was for college work. How to use a function returning a cursor in PL/SQL.
Last problem I've googled for at work was to find out whether Scala has this very cool feature I've seen in other languages that would really help me at the moment. Of course, I found out it doesn't. Every fucking time.
What was the feature?
I don't remember; it's a different feature every week. Scala has a lot of missing features.
There's a lot of things I could say about Scala, but 'missing a feature' isn't one of them.
-
@pie_flavor pattern matching in method argument list. Multiset and multimap. Making an item-defining macro. Binding a variable on both sides of
|
in a pattern. Just off the top of my head.
-
@Polygeekery Probably not. "Manually refresh the first BindingExpression in a PriorityBindingExpression". Naturally, they'll ask: Why? "Because I'm too lazy to implement INotifyPropertyChanged."
I did eventually implement INPC to help support another feature (dirty detection), but because I'm lazy I'm using T4 to write the code to deal with that feature. Somehow me being lazy just leads to more difficult, cumbersome work...
-
@TwelveBaud said in Programming Confessions Thread:
Somehow me being lazy just leads to more difficult, cumbersome work...
Filed under: Future me's problem
-
@Polygeekery said in Programming Confessions Thread:
I looked up how many bits you need to count to 999999. Specifically, I asked Google to give me the result for log2(999999). Our application has hand-rolled time functions, and a feature request came in to add microsecond support. Our time structure uses bitfields to encode the second, minutes, hours, day, month and year, and had enough bits left over for my needs.
I also checked what the latest supported version of GCC was in our oldest supported OSes, debian6. It is lower than 4.8, so no std::chrono for us, or any modern c++ for that matter.
I would hope they understand why I'm looking for work :P
-
@Kian said in Programming Confessions Thread:
I also checked what the latest supported version of GCC was in our oldest supported OSes, debian6. It is lower than 4.8
I'm sorry for your pain.
-
I've just written this quick fix:
- sql += " WHERE id = '" + primaryKey +"';"; + sql += " WHERE id = '" + primaryKey.Replace("'", "''") +"';";
This SQL string is being passed to an
ExecuteSQL()
function, which uses a prepared statement to call a sp_DoExecute stored procedure with the SQL string as single argument. This prepared statement is defined like so:ALTER PROCEDURE [dbo].[sp_DoExecute] @sql nvarchar(max) AS BEGIN SET NOCOUNT ON; exec sp_executesql @sql; -- Ed. note: sp_executesql is defined by SQLServer END
Now I've seen this code I think I need to go lie down and stare at the ceiling for a bit.
-
Just came to the realization that the reason I'm struggling with "is that really the right class to perform this action?" (e.g. having a parent method modify properties in the child object based on whether a certain type of grandchild object exists) is because my script is calling a stored procedure that's denormalizing some pretty well normalized data, and then taking that denormalized table and iterating through it to generate normalized JSON output to send on to the consumer.
I blame Agile development methodology for why I didn't catch this in the first iterations
-
@Zecc said in Programming Confessions Thread:
I've just written this quick fix:
- sql += " WHERE id = '" + primaryKey +"';"; + sql += " WHERE id = '" + primaryKey.Replace("'", "''") +"';";
This SQL string is being passed to an
ExecuteSQL()
function, which uses a prepared statement to call a sp_DoExecute stored procedure with the SQL string as single argument. This prepared statement is defined like so:ALTER PROCEDURE [dbo].[sp_DoExecute] @sql nvarchar(max) AS BEGIN SET NOCOUNT ON; exec sp_executesql @sql; -- Ed. note: sp_executesql is defined by SQLServer END
Now I've seen this code I think I need to go lie down and stare at the ceiling for a bit.
TRWTF is that the table's primary key
id
field is not an integer.
-
@anotherusername The next layer of this is that the
id
field contains SQL queries
-
@Polygeekery For me it was undoubtedly regex or .NET string format codes. Those seem enough like trivia that no one would be upset.
-
@ben_lubar said in Programming Confessions Thread:
@Onyx said in Programming Confessions Thread:
R"
what is this
Loss.
Actually, I think it's a specifier for a "raw" string, so backslash-escaping won't occur.
-
@anotherusername said in Programming Confessions Thread:
TRWTF is that the table's primary key
id
field is not an integer.I lied. The field is not simply called
id
and, while it is used effectively used by the application as the primary key, it's a natural key and not the actual database table's primary key.
-
@Zecc said in Programming Confessions Thread:
which uses a prepared statement to call a sp_DoExecute stored procedure with the SQL string as single argument.
Looks like someone's heard that you should use prepared statements to avoid injection issues, but doesn't understand why or how.
Also reminds me of the old Access VBA object model, in which nearly everything that one might want to do was accomplished by calling Application.DoCmd with a suitable list of arguments. (My life has been thankfully Access-free in recent years, so I don't know if they ever made it more sensible.) That always surprised me since the Word and Excel VBA object models were very good.
-
@Zecc said in Programming Confessions Thread:
I've just written this quick fix:
- sql += " WHERE id = '" + primaryKey +"';"; + sql += " WHERE id = '" + primaryKey.Replace("'", "''") +"';";
Oh gods, I've found places where the escaping is done the other way around. Edit: to be clear I mean
.Replace("'", "")
"Quotes in values giving you trouble? Throw them away!"
-
@Zecc
Poor Bobby, always getting his first name printed asRobert); DROP TABLE Students;--
on official school documents.
-
I may have forgotten logic to avoid traveling players from a dying server to another instance on said dying server...
-
@Gąska said in Programming Confessions Thread:
Last problem I've googled for was for college work. How to use a function returning a cursor in PL/SQL.
Last problem I've googled for at work was to find out whether Scala has this very cool feature I've seen in other languages that would really help me at the moment. Of course, I found out it doesn't. Every fucking time.
-
@masonwheeler If it works, though, am I crazy or is the world crazy?
-
@Kian said in Programming Confessions Thread:
If it works, though, am I crazy or is the world crazy?
Random configurations can be annoying…
-
Recently, while fixing a bug in an application I wrote a while ago, I found a 40 line-of-code regex that I wrote.
-
@mott555
So you got to fix two bugs?
-
@izzion Actually, the bug had nothing to do with the regex and the regex is working perfectly. I just scrolled past it and felt one of my brain lobes rupture.
-
@mott555 said in Programming Confessions Thread:
Recently, while fixing a bug in an application I wrote a while ago, I found a 40 line-of-code regex that I wrote.
Sometimes it's very healthy to forget something you've done. BTDTHTSTPI
-
@dcon said in Programming Confessions Thread:
BTDTHTSTPI
Been
There
Done
That
Had
To
Stop
To
Parse
It?fake edit: well I guess not.
-
@masonwheeler said in Programming Confessions Thread:
@Gąska said in Programming Confessions Thread:
Last problem I've googled for was for college work. How to use a function returning a cursor in PL/SQL.
Last problem I've googled for at work was to find out whether Scala has this very cool feature I've seen in other languages that would really help me at the moment. Of course, I found out it doesn't. Every fucking time.
A thing that was never said by Einstein
-
-
@Jaloopa The quote is still true; it's just misattributed.
-
-
@hungrier
Go or do not Go.
There is no try-catch.
- Go developers
-
-
/me hands @boomzilla a roll of garbage bags
-
@PleegWat I think that actually calls for a visit from @Polygeekery.
-
@boomzilla send me an address, I will do this one pro bono.
-
@boomzilla
Or a scientific study to determine how quality of LOC correlates with consumption of beer, Powerade, Red Bull, or soda pop.
-
@izzion excluding the cigarettes would be a mistake, I think.
-
@boomzilla Yikes! You can't even see some of the keyboard keys under the layer of cigarette ash.
Also, the yoghurt containers becoming microbiology experiments. I also find the bottle of yellow water rather disturbing.
-
-
Why is there a bottle of Urine near the cigarette butts?
-
@stillwater so you don't have to get up, duh
-
@Gribnit Fair enough. I also noticed there is not just one but a whole collection of em. Also they are not closed. What if it spills over? People just don't think things through. SMH.
-
@boomzilla said in Programming Confessions Thread:
Google suggests this is the original image.
Which is quite odd, considering yours appears to have FL Studio open on it, while the one I found is showing Chrome on Windows Vista...
I don't know which is worse, actually.
-
@HardwareGeek said in Programming Confessions Thread:
@boomzilla Yikes! You can't even see some of the keyboard keys under the layer of cigarette ash.
You need to see the keys to use keyboard? Pussy.
-
How many of you can smell the picture?
-
@stillwater said in Programming Confessions Thread:
How many of you can smell the picture?
I can't. PRAISE GOD!