New around here? Register your SA Forums Account here!

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 $10! We charge money because it costs us money per month for bills alone, and since we don't believe in shady internet advertising, we try to make the money back through forum registrations.
 
  • Post
  • Reply
DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Corla Plankun posted:

this is a good strat but i feel obliged to tell you that you can do this with one branch (you can git reset to any commit in the git log, no branch names needed)

yeah tbh i do it your way but sometimes i'll do the wip branch if i want to be more organized.

Adbot
ADBOT LOVES YOU

Arcsech
Aug 5, 2008

Corla Plankun posted:

documentation is obsolete almost the second it is written and its a waste of time to try to fight technical debt with words nobody will ever read

oh, hi senior architect from $(JOB-1)

the guy who imposed that view on the team was the #1 by far source of bugs and awful code nobody understood. he would active delete any docs or unit tests he found and that fuckin job made me so mad

basically what I’m saying is, gently caress that attitude and I hope I never have to work with you

Xarn
Jun 26, 2015

Arcsech posted:

he would active delete ... or unit tests he found

:murder:
:murder:
:murder:

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
i've been the guy who writes pages of documentation at company where nobody writes any documentation and it was indeed a waste of time. the solution is to work someplace where documentation is valued.

Sapozhnik
Jan 2, 2005

Nap Ghost

hackbunny posted:

I wish there was an easy way to split a commit into multiple commits without a ton of amends and squashes, though

interactive rebase, edit the victim commit, git reset HEAD^, split into desired chunks and re-commit, git rebase --continue

Corla Plankun
May 8, 2007

improve the lives of everyone

Arcsech posted:

oh, hi senior architect from $(JOB-1)

the guy who imposed that view on the team was the #1 by far source of bugs and awful code nobody understood. he would active delete any docs or unit tests he found and that fuckin job made me so mad

basically what I’m saying is, gently caress that attitude and I hope I never have to work with you

deleting tests is brain damage, i'm not that guy at all

documentation is just pseudocode with no tests so there's never going to be a guarantee that its any good

tests are documentation that is guaranteed to be correct (or at least overtly incorrect when it is incorrect)

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
undocumented code is a far greater security issue than undocumented people imo

akadajet
Sep 14, 2003

Sapozhnik posted:

interactive rebase, edit the victim commit, git reset HEAD^, split into desired chunks and re-commit, git rebase --continue

and don't gently caress anything up along the way

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Sapozhnik posted:

interactive rebase, edit the victim commit, git reset HEAD^, split into desired chunks and re-commit, git rebase --continue

i easily manage this with the reset method i mentioned. i just craft multiple commits instead of a single commit.

Phobeste
Apr 9, 2006

never, like, count out Touchdown Tom, man

DONT THREAD ON ME posted:

i easily manage this with the reset method i mentioned. i just craft multiple commits instead of a single commit.

aren't you an emacs guy? if you're an emacs user and not using magit you're loving up. tbh it's legit to install emacs only to use magit, also

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Phobeste posted:

aren't you an emacs guy? if you're an emacs user and not using magit you're loving up. tbh it's legit to install emacs only to use magit, also

yah i started switching from spacemacs to real emacs a year ago and havent completed the transition. ive also been using a lot of langs where emacs isnt the best.

i will very much go back but focusing on other stuff. i miss magit.

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

Corla Plankun posted:

tests are documentation that is guaranteed to be correct (or at least overtly incorrect when it is incorrect)

code:
assert(true);

is a test guaranteed to be correct but has absolutely zero value and is one i would delete from a codebase in an instant if i found it

Arcsech
Aug 5, 2008

Corla Plankun posted:

documentation is just pseudocode with no tests so there's never going to be a guarantee that its any good

what the gently caress kinda docs are you writing that they’re “pseudocode”

good docs should tell you 1) why a thing is the way it is, 2) what guarantees it provides that can’t be expressed through types, and 3) if necessary why a thing is NOT a certain way.

the only time you should have pseudocode-y docs is in code that’s unintuitive for performance reasons, and this should be 1) rare, and 2) heavily reviewed and fail review if the docs aren’t updated when the code is

Corla Plankun posted:

tests are documentation that is guaranteed to be correct (or at least overtly incorrect when it is incorrect)

also for public-facing documentation you should have doctests wherever possible to help correct this

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
it really depends on the kind of team and project you work on. trying to document a garbage heap is a futile endeavor.

but like, don't spend your precious life energy on garbage heaps.

DONT THREAD ON ME fucked around with this message at 18:11 on Feb 16, 2019

Arcsech
Aug 5, 2008

DONT THREAD ON ME posted:

it really depends on the kind of team and project you work on. trying to document a garbage heap is a futile endeavor.

I mean yeah if you’re working on shittr.io’s crud app for checking in to your dumps then do whatever

but be more professional if you’re working on something that actually matters

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Arcsech posted:

I mean yeah if you’re working on shittr.io’s crud app for checking in to your dumps then do whatever

but be more professional if you’re working on something that actually matters

:agreed:

vodkat
Jun 30, 2012



cannot legally be sold as vodka
I've got an issue that is driving me crazy and I can't figure out what is causing it. I need to take a cell from a DataFrame, split it into a list it and then return copy of that DataFrame with a new row for each element of the split. At present I'm getting errors that the size of the new DataFrame and the size of the list don't match and I don't know how this can happen as all I am doing is row * size of list. Anyone got any ideas of what is going wrong here?

code:
def simple_splitter(row, column_name, string):
    column_list = re.split(string, row[column_name].values[0])  # splits cell of df based on string
    arr = np.array(np.concatenate([row] * len(column_list)))  # clones the row to the length of the list
    df = pd.DataFrame(arr, columns=row.columns)  #put back into a df, needed for column names
    df[column_name] = column_list # Adds in the split address <- somehow a mismatch between the length of the df and the column list keeps happening!
    return df

Powerful Two-Hander
Mar 9, 2004

Mods please change my name to "Tooter Skeleton" TIA.



I am almost certain nobody reads the docs I write.

much like my posts :negative:

cinci zoo sniper
Mar 14, 2013




vodkat posted:

I've got an issue that is driving me crazy and I can't figure out what is causing it. I need to take a cell from a DataFrame, split it into a list it and then return copy of that DataFrame with a new row for each element of the split. At present I'm getting errors that the size of the new DataFrame and the size of the list don't match and I don't know how this can happen as all I am doing is row * size of list. Anyone got any ideas of what is going wrong here?

code:
def simple_splitter(row, column_name, string):
    column_list = re.split(string, row[column_name].values[0])  # splits cell of df based on string
    arr = np.array(np.concatenate([row] * len(column_list)))  # clones the row to the length of the list
    df = pd.DataFrame(arr, columns=row.columns)  #put back into a df, needed for column names
    df[column_name] = column_list # Adds in the split address <- somehow a mismatch between the length of the df and the column list keeps happening!
    return df

Away from pc but I don’t think arr does what you think

vodkat
Jun 30, 2012



cannot legally be sold as vodka

cinci zoo sniper posted:

Away from pc but I don’t think arr does what you think

I will have a look at this again in the morning but I also tried pd.DataFrame([[row]] * len(column_list)) when trying to fix this and encountered the same error, so all I could think of was that for some reason the way in which the list is being counted is off? From having looked at some output this is normally by a factor of two, but not always, so totally baffled as to what this could be.

Soricidus
Oct 20, 2010
freedom-hating statist shill

Powerful Two-Hander posted:

I am almost certain nobody reads the docs I write.

much like my posts :negative:

there is a fundamental law of software that states that the only documentation that ever turns out to be important is the documentation that didn't get written

write docs? congratulations on wasting time, idiot.
didn't write docs? now everything is on fire and it's your fault, idiot.

the moral of the story is that programming was a mistake

Arcsech
Aug 5, 2008

Soricidus posted:

the moral of the story is that humanity was a mistake

Sapozhnik
Jan 2, 2005

Nap Ghost
I extensively document a piece of code one week before it gets deleted. Every time.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Soricidus posted:

there is a fundamental law of software that states that the only documentation that ever turns out to be important is the documentation that didn't get written

write docs? congratulations on wasting time, idiot.
didn't write docs? now everything is on fire and it's your fault, idiot.

the moral of the story is that programming was a mistake

if it takes the sting off, there’s probably a decent amount of (something that probably has a more official term but I’ll call) the sports referee effect: it’s only noticeable when there’s a problem. nobody thinks to mention the accurate, accessible, and timely documentation they just used to efficiently get their job done

Doom Mathematic
Sep 1, 2008

Sapozhnik posted:

I extensively document a piece of code one week before it gets deleted. Every time.

Hmm. That's a net gain. Maybe you should document more code.

akadajet
Sep 14, 2003

Doom Mathematic posted:

Hmm. That's a net gain. Maybe you should document more code.

yeah, i'd document the heck out of all of our code if I could get that kind of deal

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

Corla Plankun posted:

documentation is obsolete almost the second it is written and its a waste of time to try to fight technical debt with words nobody will ever read

quit your job

commit messages document intent and context, they're historical data and by definition can't ever get obsolete. it's vital irreplaceable information that degrades fast if not written down, and you'll be sorry six months from now when a complex uncommented line that's blatantly stupid but you can't tell if it's related to the bug you're working on was added in a commit with message "bugfixes"

in closing, quit your job

Sapozhnik posted:

git reset HEAD^

huh for no reason at all I thought you couldn't continue an interactive rebase after that

Powerful Two-Hander posted:

I am almost certain nobody reads the docs I write.

write documentation that will be useful for yourself

Qtotonibudinibudet
Nov 7, 2011



Omich poluyobok, skazhi ty narkoman? ya prosto tozhe gde to tam zhivu, mogli by vmeste uyobyvat' narkotiki
my current employer has a head of engineering that believes engineers should write documentation, as "they are the ones that understand the code". this has
* people good at writing code aren't necessarily, and often are not, particularly good with writing clear, readable prose. granted, half our engineering team are non-native english speakers and can't be blamed for this, but the native english speakers aren't much better.
* the original designers of a user interface/workflow tend to bake a lot of assumptions about how that interface should be used and what knowledge its users will already have into their documentation. this makes the documentation bad because those assumptions rarely line up with reality.
* any role whose primary responsibility is not documentation will focus on their primary responsibilities first. documentation is written in a rush before a release, exacerbating the above two issues.

i pray for us to hire a technical writer

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
my technical writing is more aptly described as technically writing.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
i try hard but bless my heart i will never be able to get tenses straight

mekkanare
Sep 12, 2008
We have detected you are using ad blocking software.

Please add us to your whitelist to view this content.
I like to write documentation because I'm going to be the one who maintains what I put in, and I would really enjoy knowing why the hell it's written like that come 24 hours later.

floatman
Mar 17, 2009
I like to think whenever debates about stuff like documentation, unit tests comes up, people usually present their points but what we fail to take into account is the circumstances in which they operate in:
A guy, who's codebase is testable and descriptive and logically constructed, "perhaps if we don't spend so much time on documentation that would be easily outdated if we forget to update them we can do other more productive stuff!"
Me, stuck in idiot hellscape where classes are so needlessly complex a class does logging via instantiating another class to hold log output statefully, and aforementioned class will actually change execution logic depending on the contents of the statefull logger instance, "DO YOU WANT IT ALL TO GO TO HELL?!?!?!"

Sapozhnik
Jan 2, 2005

Nap Ghost
JavaScript code:
const { promisify } = require("util");

const setTimeout = promisify(global.setTimeout);

async function inner(i) {
    for (let j = 0 ; j < 10 ; j++) {
        await setTimeout(1);

        if (i == 3 && j == 7) {
            throw new Error("oops!");
        }
    }
}

async function outer() {
    for (let i = 0 ; i < 10 ; i++) {
        await setTimeout(1);
        await inner(i);
    }
}

outer().catch(e => console.log(e));

quote:

$ node oops.js
Error: oops!
at inner (/home/james/Temp/oops.js:10:19)

i bet these are fun to debug

(the exact async operation that causes execution to suspend is unimportant, just that there's nested async calls wrapped up inside nontrivial flow control)

Powerful Two-Hander
Mar 9, 2004

Mods please change my name to "Tooter Skeleton" TIA.



hackbunny posted:




write documentation that will be useful for yourself

this is actually why I do it. anytime I've done something that I think is a) interesting/might be useful again or b) not particularly clear or described by comments in code I write it up


then every so often I go and read my own docs and am like "Heh that is pretty cool :3:"

vodkat
Jun 30, 2012



cannot legally be sold as vodka

vodkat posted:

code:
def simple_splitter(row, column_name, string):
    column_list = re.split(string, row[column_name].values[0])  # splits cell of df based on string
    arr = np.array(np.concatenate([row] * len(column_list)))  # clones the row to the length of the list
    df = pd.DataFrame(arr, columns=row.columns)  #put back into a df, needed for column names
    df[column_name] = column_list # Adds in the split address <- somehow a mismatch between the length of the df and the column list keeps happening!
    return df


vodkat posted:

I will have a look at this again in the morning but I also tried pd.DataFrame([[row]] * len(column_list)) when trying to fix this and encountered the same error, so all I could think of was that for some reason the way in which the list is being counted is off? From having looked at some output this is normally by a factor of two, but not always, so totally baffled as to what this could be.

Think I've got to the bottom of this, it wasn't this code that was the issue but the way in which I was applying the function using groupby, which due to a duplicate index or something (which I didn't bother trying to figuring out) it was sometimes passing more than one row to this function. I think I've fixed this by stopping trying to be clever with groupby and apply and using the much slower df.iterrows() instead.

Carthag Tuek
Oct 15, 2005

altid pamo når du går
veje du burd' kende
overleved' barneår
lig' til livets ende

i had a python question too but i just figured it out while typing it out

thx everybody lol

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
rubber duckie, you’re the one
you make debugging so much fun

bob dobbs is dead
Oct 8, 2017

Peeps are idiots, Leslie.
Nap Ghost

pokeyman posted:

rubber duckie, you’re the one
you make debugging so much fun

Elide the "you", then it scans

Schadenboner
Aug 15, 2011

by Shine

bob dobbs is dead posted:

Elide the "you", then it scans

Could do "you" as a semi-vocalized contraction? "Y'make"?

Adbot
ADBOT LOVES YOU

Carthag Tuek
Oct 15, 2005

altid pamo når du går
veje du burd' kende
overleved' barneår
lig' til livets ende

also ive been adding type annotations to as much as possible when im working on a file. helps a lot but its still ducky as heck

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply