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
fritz
Jul 26, 2003

Soricidus posted:

if you don't think other people's coding is offensive then I don't even know what to say

'other people's coding' includes 'your own code from six months ago'

Adbot
ADBOT LOVES YOU

hobbesmaster
Jan 28, 2008

fritz posted:

'other people's coding' includes 'your own code from six hours ago'

triple sulk
Sep 17, 2014



hobbesmaster posted:

'other people's coding' includes 'your own code from six minutes ago'

Bloody
Mar 3, 2013

defensive semicolon

aardvaard
Mar 4, 2013

you belong in the bog of eternal stench

hey terrible game programmers: the guy behind open.gl just made a vulkan tutorial and it's good
https://vulkan-tutorial.com/Introduction

tef
May 30, 2004

-> some l-system crap ->

anthonypants posted:

never go on reddit

can't hear https://www.youtube.com/watch?v=DOqb_UzJSUQ

Luigi Thirty
Apr 30, 2006

Emergency confection port.

Uh oh open watcom's sampler doesn't support dos32a, just dos4g and phar lap

how am I going to profile my rasterizer now

Bloody
Mar 3, 2013

Luigi Thirty posted:

Uh oh open watcom's sampler doesn't support dos32a, just dos4g and phar lap

how am I going to profile my rasterizer now

time to make a profiler

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

MALE SHOEGAZE posted:

i am getting mad at a stupid discussion on reddit

these morons are discussing ruby on rails speed and this guy says 'yes you can easily handle 50k requests' and i'm like 'what that's ridiculous what does that even mean' and everyone seems to be agreeing that claiming a web framework can handle 50k requests is a meaningful and reasonable thing to do.

well back in the early days you had to restart rails every 200 requests due to all the memory leaks, so being able to make it to 50k sounds impressive to people used to that

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Luigi Thirty posted:

Uh oh open watcom's sampler doesn't support dos32a, just dos4g and phar lap

how am I going to profile my rasterizer now

there's a guy on SO who would be happy to tell you to just run it in a debugger and pause the program's execution occasionally

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Plorkyeran posted:

well back in the early days you had to restart rails every 200 requests due to all the memory leaks, so being able to make it to 50k sounds impressive to people used to that

sure if you count a request as something that doesnt do anything, which is a stupid way to measure the performance of a web application.

Bloody
Mar 3, 2013

mongodb benchmarks against /dev/null do whatever you want

Deep Dish Fuckfest
Sep 6, 2006

Advanced
Computer Touching


Toilet Rascal
for performance or durability?

anthonypants
May 6, 2007

by Nyc_Tattoo
Dinosaur Gum

YeOldeButchere posted:

for performance or durability?
yes.

Zemyla
Aug 6, 2008

I'll take her off your hands. Pleasure doing business with you!

Bloody posted:

mongodb benchmarks against /dev/null do whatever you want

Except you're more likely to get data out of /dev/null than MongoDB.

LordSaturn
Aug 12, 2007

sadly unfunny

haha, python lets you do THIS

>>> a = 0
>>> b = 1
>>> a, b = (b, a)
>>> print a, b
1
0

gently caress swap routines forever

Bloody
Mar 3, 2013

What's wrong there

GameCube
Nov 21, 2006

hobbesmaster posted:

skip to the end of terrible .net decisions and just use c++/cli

trigger warning this poo poo please, being forced to use c++/cli is what made me leave my previous job

GameCube
Nov 21, 2006

"why would we use c# when we already know c++?" lomarf. what a freaking pile of lomarf that place was

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

Bloody posted:

What's wrong there

my guess is that syntactically it looks a bit like an intrinsic way to do assignments serially on a line so you might expect that both values would end up the same due to one operation being done first. instead it's actually a swap which is a little surprising to see come out of a plainish looking assignment statement.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

fritz posted:

'other people's coding' includes 'your own code from six keypresses ago'

comedyblissoption
Mar 15, 2006

the python destructuring swap seems fine to me

although usually if youre using a swap in any language and it's not some low level optimization poo poo youre probably doing something hosed up

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

comedyblissoption posted:

although usually if youre using mutability in any language and it's not some low level optimization poo poo youre probably doing something hosed up

elite_garbage_man
Apr 3, 2010
I THINK THAT "PRIMA DONNA" IS "PRE-MADONNA". I MAY BE ILLITERATE.
picked up an old book



Principles of Interactive Computer Graphics

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?

abraham linksys posted:

i mean what's the other option, design a new compile-to-js language? write a new browser that runs ocaml natively?

just ship apps and stop trying to cram "apps" into the browser

you don't think Facebook would be where they are today if they didn't have a native iOS app on day one, do you?

Soricidus
Oct 21, 2010
freedom-hating statist shill
pretty sure the fb apps use react native or whatever

it's browsers al the way down

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

cram apps into the browser crammed into an app imho

cinci zoo sniper
Mar 15, 2013




saw in picture thread

how does this even happen

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

kalstrams posted:

saw in picture thread

how does this even happen

I'm guessing machine translation

ahmeni
May 1, 2005

It's one continuous form where hardware and software function in perfect unison, creating a new generation of iPhone that's better by any measure.
Grimey Drawer

LeftistMuslimObama posted:

my guess is that syntactically it looks a bit like an intrinsic way to do assignments serially on a line so you might expect that both values would end up the same due to one operation being done first. instead it's actually a swap which is a little surprising to see come out of a plainish looking assignment statement.

I would be super confused if the state of a variable changed halfway through a statement

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

LeftistMuslimObama posted:

my guess is that syntactically it looks a bit like an intrinsic way to do assignments serially on a line so you might expect that both values would end up the same due to one operation being done first. instead it's actually a swap which is a little surprising to see come out of a plainish looking assignment statement.

i wouldnt expect that both values end up the same. mumps broke your brain.

gonadic io
Feb 16, 2011

>>=
is that even mutation, or is that shadowing? it's been a while since i've done python

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

fart simpson posted:

i wouldnt expect that both values end up the same. mumps broke your brain.

lol it's too late LMO, you're already unemployable everywhere!

ahmeni
May 1, 2005

It's one continuous form where hardware and software function in perfect unison, creating a new generation of iPhone that's better by any measure.
Grimey Drawer

gonadic io posted:

is that even mutation, or is that shadowing? it's been a while since i've done python

i dont think its anything fancy
resolution of variables is left to right, except in assignment where the right hand side is resolved first

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#keyword-names

quote:

Keyword names used in the test data are compared with method names to find the method implementing these keywords. Name comparison is case-insensitive, and also spaces and underscores are ignored. For example, the method hello maps to the keyword name Hello, hello or even h e l l o. Similarly both the do_nothing and doNothing methods can be used as the Do Nothing keyword in the test data.

in other words to be pretty sure that touchButt method is not used anywhere, you have to grep for (case insensitevely)
code:
t(?:\s|_)*o(?:\s|_)*u(?:\s|_)*c(?:\s|_)*h(?:\s|_)*B(?:\s|_)*u(?:\s|_)*t(?:\s|_)*t

LordSaturn
Aug 12, 2007

sadly unfunny

Bloody posted:

What's wrong there

sorry for being vague about that. the idea is that it swaps the value of two variables without requiring me to declare a third variable, because the syntax forms and then unpacks an anonymous tuple with the results. you couldn't do that with 1-to-1 assignments.

E: I was using it to do a really short fibonacci thing:

Python code:
def yield_fib():
	x0 = 0
	x1 = 1
	while True:
		yield x0
		x0, x1 = (x1, x0 + x1)

LordSaturn fucked around with this message at 13:17 on Jul 18, 2016

vodkat
Jun 30, 2012



cannot legally be sold as vodka
Hello thread, can I post some bad code for you to tell me what I'm doing wrong/how to make it better?

Im currently trying to clean a list of names in a database. Since I'm just a stupid grad student (a social sciences one at that) something like the code bellow has always been good enough for what I want to do but now I'm trying to use it on a larger dataset its taking loving ages and its clear that I am probably doing this in a horrendously inefficient way.

code:
def clean_names2(name):
    if type(name) == str:
        name = name.upper()
        name_list = re.split(' ', name)
        name_list = set(name_list) - set(prefix)
        name_list = set(name_list) - set(postfix)
        name = ' '.join(name_list)
        return name

for n in data['col']:
        data.loc[n, 'col'] = clean_names2(data.loc[n, 'col')])
I'd really appreciate any advice you guys have since most of my programming knowledge comes from googling things and stack exchange so I really have no idea how to start about making something work better.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

vodkat posted:

Hello thread, can I post some bad code for you to tell me what I'm doing wrong/how to make it better?

Im currently trying to clean a list of names in a database. Since I'm just a stupid grad student (a social sciences one at that) something like the code bellow has always been good enough for what I want to do but now I'm trying to use it on a larger dataset its taking loving ages and its clear that I am probably doing this in a horrendously inefficient way.

code:
def clean_names2(name):
    if type(name) == str:
        name = name.upper()
        name_list = re.split(' ', name)
        name_list = set(name_list) - set(prefix)
        name_list = set(name_list) - set(postfix)
        name = ' '.join(name_list)
        return name

for n in data['col']:
        data.loc[n, 'col'] = clean_names2(data.loc[n, 'col')])
I'd really appreciate any advice you guys have since most of my programming knowledge comes from googling things and stack exchange so I really have no idea how to start about making something work better.

how are you loading the data? you need to be loading the data in batches, processing a batch, outputting a batch, and loading the next batch.

it looks like you're loading everything into the data variable and then processing in one go, which won't for large datasets


also it could be something dumb in your code but i don't know Python well enough to tell you

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

kalstrams posted:

i love that c++ has a thing outright called "defensive coding" :gonk:

C too. for example if a function returns -1 for failure, you don't check == -1, you check < 0. if it returns 0 for false and 1 for true, you check != 0 instead of == 1. also when a function returns both a success flag/error code and a value through a pointer, you don't trust the returned value if the function reports success, you explicitly check that it's valid/non-null/etc. which can turn a crash into a controlled failure

Adbot
ADBOT LOVES YOU

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

kalstrams posted:

i love that c++ has a thing outright called "defensive coding" :gonk:

so does ruby, to be fair

  • Locked thread