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
cinci zoo sniper
Mar 15, 2013




Symbolic Butt posted:

you gotta float like a butterfly with returns man, don't let variables weigh on you (imo)

*with thick latvian accent* idgi, unless this is another way of saying "dont let it run too long". nothing against it, but will need some time to think how to better do this when i have all the loving branches of potentially broken things

Adbot
ADBOT LOVES YOU

gonadic io
Feb 16, 2011

>>=
c tp s:

:sigh:

i'm currently using firacode, going to switch to gnu unifont to see if it's a problem with the text library im using or the font simply lacking the characters

cinci zoo sniper
Mar 15, 2013




gonadic io posted:

c tp s:

:sigh:

i'm currently using firacode, going to switch to gnu unifont to see if it's a problem with the text library im using or the font simply lacking the characters

:smith: getting caught up in some ancient font thing sounds terrifying

gonadic io
Feb 16, 2011

>>=

cinci zoo sniper posted:

:smith: getting caught up in some ancient font thing sounds terrifying

to be fair, im trying to render weird symbols. i could very easily switch to ascii letters, or even just draw the symbols myself if i give up

gonadic io posted:

terrible hobby programmer status:

cinci zoo sniper
Mar 15, 2013




gonadic io posted:

to be fair, im trying to render weird symbols. i could very easily switch to ascii letters, or even just draw the symbols myself if i give up

just channel your inner luigi and find some dusty manual that says your ram stick doesn't support venus symbol as string so you have to draw it with tiny lines instead

ultravoices
May 10, 2004

You are about to embark on a great journey. Are you ready, my friend?
python raises exceptions internally for everything, I wouldn't worry about the performance too much & the hit only comes when you hit the except portion of the block.

premature optimisation is no one's pal.

Mao Zedong Thot
Oct 16, 2008


i'm the terrible python programmer using locals() and isinstance() and concerned about if vs elif performance

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost

InfrastructureWeek posted:

i'm the terrible python programmer using locals() and isinstance() and concerned about if vs elif performance

gonadic io
Feb 16, 2011

>>=
lmao one of our servers just threw oom and crashed the app because somebody was ssh'd into it and looking at logs to investigate a previous crash. `less` was one of the processes using the most memory when it oom'd

gonadic io
Feb 16, 2011

>>=
also ctps:

> 5 failed tests
me: oh I see what the problem is, let me just fix that
> 6 failed tests

CPColin
Sep 9, 2003

Big ol' smile.
Progress!

ynohtna
Feb 16, 2007

backwoods compatible
Illegal Hen
less needs more!

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

i don't understand why people ask questions and then argue with every answer but maybe it's cause i'm a tp

cinci zoo sniper
Mar 15, 2013




InfrastructureWeek posted:

i'm the terrible python programmer using locals() and isinstance() and concerned about if vs elif performance

are you stupid, since when a genuine "by the way i wonder if" is a concern? in terrible programmer of all places? did you break out of your containment greythreads?

gonadic io
Feb 16, 2011

>>=

carry on then posted:

i don't understand why people ask questions and then argue with every answer but maybe it's cause i'm a tp

because they are asking the question as a vehicle for you to validate them, not because they want the answer.

bonus points if they ask the question, then say the answer, and then say something like "is this correct"

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost

cinci zoo sniper posted:

are you stupid, since when a genuine "by the way i wonder if" is a concern? in terrible programmer of all places? did you break out of your containment greythreads?

the secret is that ctps turned into a greythread a long time ago

CPColin
Sep 9, 2003

Big ol' smile.

gonadic io posted:

terrible hobby programmer status:


Does anybody else tend to flip stuff like this around so it's all "SYMBOL_*" instead of "*_SYMBOL"?

cinci zoo sniper
Mar 15, 2013




carry on then posted:

i don't understand why people ask questions and then argue with every answer but maybe it's cause i'm a tp

i just have a weird rear end situations at work and asking specifically about them is not possible whereas asking generally end up meeting "just read xml from sql" with "im sorry it's actually a malformed json on mongo", im sorry. besides i did agree with a fair share of things, just wasn't convinced instantly, in general and because i actually have reasons to post here unlike half of the people with impostor syndrome

gonadic io
Feb 16, 2011

>>=

CPColin posted:

Does anybody else tend to flip stuff like this around so it's all "SYMBOL_*" instead of "*_SYMBOL"?

it is slightly more pleasing to the tisims i guess. but then you'd have to line up the rest of the line so that everything after that lines up too

CPColin
Sep 9, 2003

Big ol' smile.

cinci zoo sniper posted:

i actually have reasons to post here unlike half of the people with impostor syndrome

Are you suggesting that we're not all terrible programmers here!?

gonadic io
Feb 16, 2011

>>=

cinci zoo sniper posted:

i actually have reasons to post here unlike half of the people with impostor syndrome

new thread title please

Mr SuperAwesome
Apr 6, 2011

im from the bad post police, and i'm afraid i have bad news

InfrastructureWeek posted:

i'm the terrible python programmer using locals() and isinstance() and concerned about if vs elif performance



e: isinstance is ok tho

Mr SuperAwesome fucked around with this message at 18:05 on Nov 13, 2017

Mr SuperAwesome
Apr 6, 2011

im from the bad post police, and i'm afraid i have bad news

ultravoices posted:

python raises exceptions internally for everything, I wouldn't worry about the performance too much & the hit only comes when you hit the except portion of the block.

premature optimisation is no one's pal.

agreedo, dont bother optimizing until a) you know you need it and b) you can prove you need it with real data from prod

if you can't be bothered to get the data to prove you need it, you don't need it and are just speculating

i run into this a bunch with people saying "let's use flashy new service and write a new bunch of poo poo because postgres is slow!!!" and they have no proof at all, invariably gently caress things up and write terrible code and its pretty dumb. (and postgres isn't slow according to the people i asked about the numbers, not me because i am lazy)

Ellie Crabcakes
Feb 1, 2008

Stop emailing my boyfriend Gay Crungus

CPColin posted:

Are you suggesting that we're not all terrible programmers here!?
some of us are lovely programmers.

Mr SuperAwesome posted:

(and postgres isn't slow according to the people i asked about the numbers, not me because i am lazy)
Postgres was slow, a million years ago.

Mr SuperAwesome
Apr 6, 2011

im from the bad post police, and i'm afraid i have bad news
according to our numbers guy postgres is actually faster than redis which is kinda surprising but w/e

cinci zoo sniper
Mar 15, 2013




im sorry my unamerican curiosity without being balls deep into the subject matter has stirred such controversy in thread about asking questions, i should have known better than doing just that

cinci zoo sniper
Mar 15, 2013




Mr SuperAwesome posted:

according to our numbers guy postgres is actually faster than redis which is kinda surprising but w/e

last job postgres ran our bi for 50+ financial "markets" and it was ok. it only couldn't do real time (duh, not at that config), and becoming friends with power bi (which crashed instantly on connection attempt, invariably)

Ellie Crabcakes
Feb 1, 2008

Stop emailing my boyfriend Gay Crungus

cinci zoo sniper posted:

im sorry my unamerican curiosity without being balls deep into the subject matter has stirred such controversy in thread about asking questions, i should have known better than doing just that
Stuff your sorries in a sack mister

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

cinci zoo sniper posted:

i just have a weird rear end situations at work and asking specifically about them is not possible whereas asking generally end up meeting "just read xml from sql" with "im sorry it's actually a malformed json on mongo", im sorry. besides i did agree with a fair share of things, just wasn't convinced instantly, in general and because i actually have reasons to post here unlike half of the people with impostor syndrome

i wasn't referring to you it's just something i've noticed lately

gonadic io
Feb 16, 2011

>>=

carry on then posted:

i wasn't referring to you it's just something i've noticed lately

yeah me neither, sorry. i presumed we were talking about some stack overflow question. honestly i haven't even been reading this python poo poo because i could not care less.

Sapozhnik
Jan 2, 2005

Nap Ghost
"An incorrect but fast program is infinitely slow"

Arcsech
Aug 5, 2008

Mr SuperAwesome posted:

according to our numbers guy postgres is actually faster than redis which is kinda surprising but w/e

that is surprising, I'm curious what ops it's faster on

HoboMan
Nov 4, 2010

SQL code:
SELECT 
    MAX(tm.CreatedBy) AS CreatedBy,
    MAX(DATEADD(HOUR, tz.GMTOffset, DATEADD(HOUR,-tzc.GMTOffset, tm.CreatedDate))) AS CreatedDate
FROM dbo.TurdMound tm
INNER JOIN dbo.PoopLocation pl ON tm.LocationNo = pl.LocationNo
INNER JOIN dbo.TimeZone tz ON pl.TimeZoneID = tz.ID

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
daylight savings time is not a thing

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
wait why is "created by" using MAX?

Sapozhnik
Jan 2, 2005

Nap Ghost
if you store timestamps in anything other than utc then u hosed up son

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
they are UTC, but he's calculating the returned local time based off a timezone offset, instead of using timezones

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

cinci zoo sniper posted:

the problems is i have hundreds of thousands of multi-megabyte jsons as a result of broken xml-to-json conversion by our idiot it that ends up spitting lists for multiple arrays, dictionaries for single arrays, and empty or missing elements for when there is no data. i would very much like to do like you say, but that does not appear to be possible within reason

btw the usual "convention" to work with json that you don't have much control over is to wrap non-lists into a list.

Python code:
data = json.loads(s)
if not isinstance(data, list):
    data = [data]
this kind of "normalization" is common in databases. so now starting the data processing with a for loop is guaranteed to work at least. :q:

it's stuff like this that shows that json is not a very good format.

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
json is absolutely terrible for every use case and the fact that it's popular just goes to show how terrible programmers really are

Adbot
ADBOT LOVES YOU

cinci zoo sniper
Mar 15, 2013




Symbolic Butt posted:

btw the usual "convention" to work with json that you don't have much control over is to wrap non-lists into a list.

Python code:
data = json.loads(s)
if not isinstance(data, list):
    data = [data]
this kind of "normalization" is common in databases. so now starting the data processing with a for loop is guaranteed to work at least. :q:

it's stuff like this that shows that json is not a very good format.
gdi, i guess now i have found a reason for a major code review that i wanted (kinda fml but not :v:). that should be a reasonably fast applymap too, although there will be some weirder edge cases to settle when im not instapicking first/last of a bunch.

  • Locked thread