Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
CRIP EATIN BREAD
Jun 24, 2002

Hey stop worrying bout my acting bitch, and worry about your WACK ass music. In the mean time... Eat a hot bowl of Dicks! Ice T



Soiled Meat

HoboMan posted:

just managed to take 3000 line sql query no one ever wanted to look at that is central to how our poo poo works and make it go from 15 second run time to sub 1 second.
guess how? if you guessed removing code where it was filling a temp table with a full copy of one of the largest tables in our database you win

i had to yell at everyone because they were pulling related entities one by one in a for loop instead of getting all the IDs and pulling it in a single call.

went from 45 seconds to 30ms.

Adbot
ADBOT LOVES YOU

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

ThePeavstenator posted:

cjs: bringing speakers to work to plug into your computer should be a crime punishable by death



what????

JewKiller 3000
Nov 28, 2006

by Lowtax

CRIP EATIN BREAD posted:

i had to yell at everyone because they were pulling related entities one by one in a for loop instead of getting all the IDs and pulling it in a single call.

went from 45 seconds to 30ms.

this is a constant struggle here

ThePeavstenator
Dec 18, 2012

:burger::burger::burger::burger::burger:

Establish the Buns

:burger::burger::burger::burger::burger:

When you plug speakers into a computer, it's able to better project sound in a larger area.

Headphones/earbuds also allow you to get more volume while not forcing your coworkers to hear your Irish pirate metal playlist. No I did not pull that example out of my rear end.

GenJoe
Sep 15, 2010


Rehabilitated?


That's just a bullshit word.
do u just mean he played that one irish pirate metal song on loop like every uninspired bar does on st pattys day

although that song makes me want to watch the departed again

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
[quote="“ThePeavstenator”" post="“476588170”"]
When you plug speakers into a computer, it’s able to better project sound in a larger area.

Headphones/earbuds also allow you to get more volume while not forcing your coworkers to hear your Irish pirate metal playlist. No I did not pull that example out of my rear end.
[/quote]

i get it im just stunned that anyone would do this

cinci zoo sniper
Mar 15, 2013




MALE SHOEGAZE posted:

i get it im just stunned that anyone would do this

just lol if you don't practice on bagpipes while your programs are compiling

ThePeavstenator
Dec 18, 2012

:burger::burger::burger::burger::burger:

Establish the Buns

:burger::burger::burger::burger::burger:
This is from the same person who defended google memo guy. I'm glad that I barely have to be in the office anymore.

HoboMan
Nov 4, 2010

i am terrified of the day i accidentally unplug my headphones and my shameful taste in music is blasted across the office

cinci zoo sniper
Mar 15, 2013




HoboMan posted:

i am terrified of the day i accidentally unplug my headphones and my shameful taste in music is blasted across the office

im p sure my music taste matches with head legal in our office so i got this scenario covered. now if dude who watches kripparian videos at work will unplug his by accident though...

Hunter2 Thompson
Feb 3, 2005

Ramrod XTreme
team lead is out on vacation this week and his manager is trying to force me to make database schema changes to enable AUTOINCREMENT of primary keys in client databases

the client database records, including the id, get uploaded to a server :/

the manager looks at the server database frequently and orders by client db id when he wants to see what's happening in client logs

when ids recycled he got confused and was convinced there's a bug in sqlite until I showed him the docs.

I told him ids are an opaque identifier that shouldn't be depended on to have any property except uniqueness in a specific table and that it's a mistake to send them to the server.

manager is like nah it's fine since it's only humans that rely on ids to be sequential, I'm going to change the schema myself!

this just feels like awful duct tape over larger issues with our client databases and a piling on of more technical debt

I already found db purging code that assumes lower ids are older records

am I in the wrong here?

Asshole Masonanie
Oct 27, 2009

by vyelkin

HoboMan posted:

i am terrified of the day i accidentally unplug my headphones and my shameful taste in music is blasted across the office

my old headphones were garbage and one day i was cranking painkiller and was asked very nicely to turn it down because everyone could hear it. i should have said "you're welcome" though

FamDav
Mar 29, 2008

meatpotato posted:

am I in the wrong here?

yes because you continue to work there

suffix
Jul 27, 2013

Wheeee!

meatpotato posted:

am I in the wrong here?

not entirely but it sounds like the damage is done
like if you can go back and make the keys *obviously* not monotonically increasing and then fix any breakage then fine, but why have something that looks deceptively like an unique increasing id but is not when you can fix it with a schema change? people will just write more code like the purge code you found

jony neuemonic
Nov 13, 2009

FamDav posted:

yes because you continue to work there

ohhhhhhhhhhhhhhh.

jony neuemonic
Nov 13, 2009

not that i can say a drat thing, our db is super shameful.

Hunter2 Thompson
Feb 3, 2005

Ramrod XTreme

FamDav posted:

yes because you continue to work there

I know, I've been trying to leave for two years :(

necrotic
Aug 2, 2005
I owe my brother big time for this!
we abuse the gently caress out of jsonb for all sorts of poo poo. supposedly we're going to talk about formalizing the schema but im not holding my breath

Phobeste
Apr 9, 2006

never, like, count out Touchdown Tom, man
ctps: spent five hours tracking down a weird bug to me forgetting a break in a switch statement

redleader
Aug 18, 2005

Engage according to operational parameters

HoboMan posted:

just managed to take 3000 line sql query no one ever wanted to look at that is central to how our poo poo works and make it go from 15 second run time to sub 1 second.
guess how? if you guessed removing code where it was filling a temp table with a full copy of one of the largest tables in our database you win

this, but two table variables and from 45 min to effectively instantaneous. it wasn't 3000 lines though

i'm dealing with a totally loving inscrutable 1500 line function, which implements some core functionality. i alternate between fantasizing about just walking out and never returning, and praying for death

Uncle Enzo
Apr 28, 2008

I always wanted to be a Wizard
got shown the head programmer's c++ program to create a single master record of every device on the (extremely complex) network:


1. do a full sql dump of every record in every table of all our different monitoring softwares, DO NOT USE THEIR APIs. tab-delimit everything, including the manual entries

2. make sure that the first row in the giant table is the name of the text file that the sql dump went to, named useful things like acronym1.txt, acronym2.txt, acronym3.txt..... acronym22.txt

3. include every column from every table. so we have 3-6 different "IP" fields, across the giant table, which is of course mostly empty. no, we can't just grab the records one by one from each table and try to do something useful with them

4. apparently making sense of this and figuring out what rows/records match what? that's where i come in


met with another programmer on the project (more of a DB person these days) and we shared our deep misgivings

also i freely admit i have essentially zero c++ , but is this kind of thing... idiomatic?

code:
	char *s = 0;
	const char *spanp = 0;
	int c = 0;
	int sc = 0;
	char *tok = 0;
	if ((s = *stringp) != 0)

Uncle Enzo
Apr 28, 2008

I always wanted to be a Wizard
like i got no idea what variable "sc" is, but is this considered kinda par for the course in c++ ?

jony neuemonic
Nov 13, 2009

that's a c programmer who happens to be using a c++ compiler for sure.

Luigi Thirty
Apr 30, 2006

Emergency confection port.

okay Jaguar, now that I know translation and scale matrix multiplication works, let's try rotation. rotate this square 45 degrees on the Z axis



no. that is completely wrong.

Uncle Enzo
Apr 28, 2008

I always wanted to be a Wizard

Luigi Thirty posted:

okay Jaguar, now that I know translation and scale matrix multiplication works, let's try rotation. rotate this square 45 degrees on the Z axis



no. that is completely wrong.

i'm the texture from wolfenstein 3d

Luigi Thirty
Apr 30, 2006

Emergency confection port.

terrible programmer status: confused about fixed point again

I need to multiply a positive number by a negative number.

sin(45 degrees) = 0.707 = 0x0000B504
X coordinate = -20 = 0xFFEC0000

0000B504 * FFEC0000 = B4F5 DBB00000

it overflows and shifting the result 16 bits to the right results in garbage (-20 * 0.707 is not 14,000-something)

what do I need to do to counteract the overflow?

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

HoboMan posted:

i am terrified of the day i accidentally unplug my headphones and my shameful taste in music is blasted across the office

let me guess, vengaboys on repeat?

JawnV6
Jul 4, 2004

So hot ...

Luigi Thirty posted:

terrible programmer status: confused about fixed point again

I need to multiply a positive number by a negative number.

sin(45 degrees) = 0.707 = 0x0000B504
X coordinate = -20 = 0xFFEC0000

0000B504 * FFEC0000 = B4F5 DBB00000

it overflows and shifting the result 16 bits to the right results in garbage (-20 * 0.707 is not 14,000-something)

what do I need to do to counteract the overflow?

what's the answer you want

-0xE2450 = FFF1DBB0?

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
Are you sign-extending the negative number when you convert it to 64 bits for the multiplication?

Xarn
Jun 26, 2015

Uncle Enzo posted:


also i freely admit i have essentially zero c++ , but is this kind of thing... idiomatic?

code:
	char *s = 0;
	const char *spanp = 0;
	int c = 0;
	int sc = 0;
	char *tok = 0;
	if ((s = *stringp) != 0)

Thats C and probably unidiomatic because it needlessly initializes all variables. :v:

Sweevo
Nov 8, 2007

i sometimes throw cables away

i mean straight into the bin without spending 10+ years in the box of might-come-in-handy-someday first

im a fucking monster

Luigi Thirty posted:

okay Jaguar, now that I know translation and scale matrix multiplication works, let's try rotation. rotate this square 45 degrees on the Z axis



no. that is completely wrong.

maybe the code is right, but the jaguar does it wrong because of a hardware bug...

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slćgt skal fřlge slćgters gang



Sweevo posted:

maybe the code is right, but the jaguar does it wrong because of a hardware bug...

this seems likely lol

Luigi Thirty
Apr 30, 2006

Emergency confection port.

Jabor posted:

Are you sign-extending the negative number when you convert it to 64 bits for the multiplication?

no and this is probably it

[quote="“JawnV6”" post="“476608027”"]
what’s the answer you want

-0xE2450 = FFF1DBB0?
[/quote]

yes, it's twos complement

floatman
Mar 17, 2009
I just tried running unit tests for an open source project using MySQL. 2 hours later and it's not even halfway done.
I had to switch to postgres (which then ran to completion in 45 minutes)
Why is MySQL so ShitSql?

Shaggar
Apr 26, 2006
what are you testing that takes that long? are you moving a bunch of data?

VikingofRock
Aug 24, 2008




Uncle Enzo posted:

like i got no idea what variable "sc" is, but is this considered kinda par for the course in c++ ?

Not really. That person is programming C++ as if it were C, which is really only idiomatic if you are using some library which only has a C API. Usually you would use a std::string (or something similar) instead of a char pointer, and you would be declaring your variables close to when you first use them, instead of all at the top of the function. IMO the fact that this person does that latter part kind of outs them as someone who learned K&R C and never really updated their programming style since.

Sapozhnik
Jan 2, 2005

Nap Ghost
the idiomatic way to solve this problem in c++ would be to not use c++ because querying a bunch of heterogeneous databases and then assembling text records that summarize the results is one of the worst uses of c++ i can think of

Luigi Thirty
Apr 30, 2006

Emergency confection port.

[quote="“Sapozhnik”" post="“476619279”"]
the idiomatic way to solve this problem in c++ would be to not use c++ because querying a bunch of heterogeneous databases and then assembling text records that summarize the results is one of the worst uses of c++ i can think of
[/quote]

I'd use REXX before I used C++ for database manipulation

HoboMan
Nov 4, 2010

ctps: just learned about blue-green deployment and i feel like a idiot for not thinking of this myself

it solves basically all of our deployment problems

Adbot
ADBOT LOVES YOU

Zaxxon
Feb 14, 2004

Wir Tanzen Mekanik

HoboMan posted:

ctps: just learned about blue-green deployment and i feel like a idiot for not thinking of this myself

it solves basically all of our deployment problems

depending on a few things about your system it can be real hard to pull off in practice but it's great when you can do it.

  • Locked thread