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.
 
  • Post
  • Reply
cinci zoo sniper
Mar 15, 2013




Janitor Prime posted:

We have all the threads you want and they operate in the way you describe.

1. the CJS thread, get to know the other yosposters
2. this one, help with the newbies
3. The PL (Programming Language) thread, the try hard programming thread
+
The Picture thread for funny computer

These are the 4 main YOSPOS threads IMO that see lots of posts every day, but there are of course all the individual topic threads like Security, Android/Mac/Windows/Google, Buttcoin, Interviewing, SciFi/Fantasy Nerd poo poo, yosqueer hangout


Also it sounds like your FP post should go in the The PL thread where it would be well received by all the PL weenies.

there is also cat thread that is literally 2nd largest thread in forums, also has literal hundreds of gigabytes of homegrown cat jpegs

Adbot
ADBOT LOVES YOU

gonadic io
Feb 16, 2011

>>=

cinci zoo sniper posted:

there is also cat thread that is literally 2nd largest thread in forums, also has literal hundreds of gigabytes of homegrown cat jpegs

including mine :3:

mystes
May 31, 2006

Phobeste posted:

- 6.5 figgies means whatever you want it to mean above 100k
Lies! But this is the terrible programmer thread so I guess it's ok.

Captain Foo
May 11, 2004

we vibin'
we slidin'
we breathin'
we dyin'

cinci zoo sniper posted:

there is also cat thread that is literally 2nd largest thread in forums, also has literal hundreds of gigabytes of homegrown cat jpegs

what's the biggest thread if not catte thread

gonadic io
Feb 16, 2011

>>=

Captain Foo posted:

what's the biggest thread if not catte thread

Cspam trump non-lol thread is loving absurd, a good few thousand posts a day

Captain Foo
May 11, 2004

we vibin'
we slidin'
we breathin'
we dyin'

gonadic io posted:

Cspam trump non-lol thread is loving absurd, a good few thousand posts a day

:psypop:

cinci zoo sniper
Mar 15, 2013





yes, election season trump thread did smash through 10000 pages in a few months i think. it was basically so big the page count dropdown element was a few megabytes large list of page numbers and everything. uspol always was spammy but since trump its absolutely something else

cinci zoo sniper fucked around with this message at 19:09 on Jul 31, 2018

cinci zoo sniper
Mar 15, 2013




yeah i looked up and the election thread was closed at 14088 pages and tehre are like 50 thousand trump pages combined across all threads

Bloody
Mar 3, 2013

c tp s: fighting with the float_cmp library for fuzzy float comparisons. for some reason my floats are a surprising number of ulps apart!

Bloody
Mar 3, 2013

also, using debug_asserts for test-time invariants has been beneficial

gonadic io
Feb 16, 2011

>>=

cinci zoo sniper posted:

the election thread was closed at 14088 pages

Lol nice

Lutha Mahtin
Oct 10, 2010

Your brokebrain sin is absolved...go and shitpost no more!

Bloody posted:

is there a term for shoehorning systems into the same interface even if it doesnt make any sense

other than square peg, round hole

shoehorning :v:

also: pigeonholing

Captain Foo
May 11, 2004

we vibin'
we slidin'
we breathin'
we dyin'


serious lomarf

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

cinci zoo sniper posted:

there is also cat thread that is literally 2nd largest thread in forums, also has literal hundreds of gigabytes of homegrown cat jpegs

I'm allergic to cats :smugdog:

ThePeavstenator
Dec 18, 2012

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

Establish the Buns

:burger::burger::burger::burger::burger:
Every single one of our automated UI tests are now failing because they can't create test accounts and users. Turns out the tests are somehow coupled to the implementation details of our Users API and broke when a change was made to it :suicide:

Doom Mathematic
Sep 2, 2008

ThePeavstenator posted:

Every single one of our automated UI tests are now failing because they can't create test accounts and users. Turns out the tests are somehow coupled to the implementation details of our Users API and broke when a change was made to it :suicide:

Sounds to me like the tests are working correctly? You almost shipped a breaking API change, well caught.

ThePeavstenator
Dec 18, 2012

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

Establish the Buns

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

Doom Mathematic posted:

Sounds to me like the tests are working correctly? You almost shipped a breaking API change, well caught.

The UI hits an orchestration/gateway layer, so the tests shouldn't have needed to be updated when changes underneath that layer were made. Also when I say "coupled to implementation details" I'm saying I was treated to discovering that the tests literally insert records into the user DB and fire the same events as the Users API.

ThePeavstenator
Dec 18, 2012

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

Establish the Buns

:burger::burger::burger::burger::burger:
The good news is that I'm not the person that has to fix this.

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost

cinci zoo sniper posted:

yeah i looked up and the election thread was closed at 14088 pages and tehre are like 50 thousand trump pages combined across all threads

metafilter also has about 40% of their comment volume talkin orange dipshit now

it's the fate of all internet things just as it is now the fate of all the world

tinaun
Jun 9, 2011

                  tell me...

gonadic io posted:

I'm attempting to use rust's async/generators stuff so my delay(1ms) don't block but just yield in the control loop to allow other processor going on and jeez I don't really get how the nb (non blocking) library's await macro interacts with the rust generator await poo poo

i've been playing around with this here if you want to take a look - theres multiple ways of handing this stuff. the main problem is that the await!() macro from `nb` is generator aware but not async function aware, as async functions have to notify their runtime that they want to be polled again. the runtime (called an Executor) doesn't poll every future in a loop constantly - it uses a waker to organize scheduling.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
i've tried twice to make my inconsistent type param and variable lettering more consistent and each attempt has covered my project in slurs and MAGAs

gonadic io
Feb 16, 2011

>>=

tinaun posted:

i've been playing around with this here if you want to take a look - theres multiple ways of handing this stuff. the main problem is that the await!() macro from `nb` is generator aware but not async function aware, as async functions have to notify their runtime that they want to be polled again. the runtime (called an Executor) doesn't poll every future in a loop constantly - it uses a waker to organize scheduling.

gonna take a while to digest the futures part of this BUT if i'm making a custom future executor wouldn't it just be easier to do the same to generators instead? or are generators obseleted by the await async stuff?


MALE SHOEGAZE posted:

i've tried twice to make my inconsistent type param and variable lettering more consistent and each attempt has covered my project in slurs and MAGAs

lenses in haskell have 4 type params that are generally called s, t, a, and b

AWWNAW
Dec 30, 2008

ThePeavstenator posted:

Every single one of our automated UI tests are now failing because they can't create test accounts and users. Turns out the tests are somehow coupled to the implementation details of our Users API and broke when a change was made to it :suicide:

i have inherited a project in hwich someone thought good testing required reproducing the state of the whole loving company. every little change breaks multiple tests that each implicitly test all sorts of magical horeshit. the tests are way more complicated, and poo poo probably more lines of code than the actual system

gently caress these people

Bloody
Mar 3, 2013

AWWNAW posted:

and poo poo probably more lines of code than the actual system

that's not really a bad smell though

Shaggar
Apr 26, 2006
yeah unless their test cases are invalid that sounds pretty nice

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
That sounds horrible.

The point of tests is to help you tell when something is an (unexpectedly) breaking change. If you need to change the tests for every single non-breaking change as well, the tests are providing no value.

Bloody
Mar 3, 2013

tests are to prove correctness of your code

floatman
Mar 17, 2009
I have tests for a codebase with no abstractions, no dependency injections. Imagine MVC, but no models so controllers and views are directly touching database tables.
"Tests" are set up by loading XML files which contain database state before the tests are run. These XML files are loaded into a database which is complicated and many foreign keys, therefore if I "test" a feature that touches table A that has a dependency on table B, my XML file needs to have table A and table B state/data in it. If table B has dependency on table C, then XML file has A,B and C in it. And so on so on.

All these XML files are produced by hand. There is no way to use a tool.

The XML files load directly into the database. This means that when I load a state on which I perform my tests, there is no guarantee that this database state is actually legitimate in the application itself. There are no factories or repositories where I can use the same logic that production code uses to create conceptual data entries in a test environment.

As expected, this leads to developers hand crafting application state XML documents that serve as basis for tests cases that are impossible to ever happen in production, but these tests are apparently what is used to show that the feature works.
The sheer expense involved in writing these XML files also mean at most, only the happy path test is written and edge cases are manually tested by some QA on staging environments.

CPColin
Sep 9, 2003

Big ol' smile.
I recently discovered the joy of injecting mock services into other services for the purposes of testing. I was all groaning about setting up a user just right so the call to PermissionService.hasBoner() would return true when ButtService.getAvailableButtTypes() called it. Then I just mocked PermissionService so hasBoner() would return what I wanted and injected that into ButtService. It was good poo poo.

My controllers still have too much stuff going on, though, with little coverage.

ThePeavstenator
Dec 18, 2012

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

Establish the Buns

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

CPColin posted:

I recently discovered the joy of injecting mock services into other services for the purposes of testing. I was all groaning about setting up a user just right so the call to PermissionService.hasBoner() would return true when ButtService.getAvailableButtTypes() called it. Then I just mocked PermissionService so hasBoner() would return what I wanted and injected that into ButtService. It was good poo poo.

My controllers still have too much stuff going on, though, with little coverage.

This is why you make an orchestrator layer that you have your controller make one call to. It makes your controllers a lot cleaner and easier to test because you just need to mock one service and make sure the controller returns the right response type. It also makes it easier to test all the stuff injected into your orchestration layer because you're just testing plain old methods now.

Our UI tests are a completely separate code repo that are basically supposed to be more robust smoke tests. They use Selenium to actually run a browser and click through the app, which is why it's all the more :psyduck: that the tests were ever coupled to any APIs, especially ones under the gateway layer, and especially especially the database implementation of those APIs.

ThePeavstenator fucked around with this message at 06:17 on Aug 1, 2018

cinci zoo sniper
Mar 15, 2013




today i tried to push file through sftp in python, and it worked with first stack overflow copy paste, so 20 minute effort where most was waiting for pycharm to index paramiko and pysftp.

we have an entire development team of a product saying “it’s endpoint fault” for 3 weeks because their phpile throws a key exchange error

:suicide:

cinci zoo sniper fucked around with this message at 14:25 on Aug 1, 2018

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.

MALE SHOEGAZE posted:

i've tried twice to make my inconsistent type param and variable lettering more consistent and each attempt has covered my project in slurs and MAGAs

perfect description of js with proptypes

toiletbrush
May 17, 2010

floatman posted:

...hell...
This sounds absolutely horrendous, like potentially worse than no tests at all.

My current project (JSON web-api + async messaging + rules engine + sql db) has ~100 unit tests, about the same number of 'integration' tests although these are more tests that external APIs and interfaces haven't changed or broken, but then ~4000 specflow end-to-end tests with about as close to 100% coverage as realistically possible, with all the happy paths, unhappy paths, edge cases, boundary conditions etc we can think of.

Writing them takes longer than the code they're testing, they take about 20 minutes to run, and there's a fair amount of duplication in setup between them, but they're literal walkthroughs of exactly how external systems talk to the API both in how they set up db state, do what's being tested and assert. What's also nice is you can generally do massive refactorings without having to update any tests, and also prove that your API hasn't changed - or at least know what has changed if it's necessary. It's the first time I've seen specflow/cucumber style tests genuinely work as both tests and reasonable documentation.

It's all fairly standard stuff, but works amazingly well. I guess the only controversial bit is the lack of unit test coverage (Thoughtworkers hate us)

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

floatman posted:

I have tests for a codebase with no abstractions, no dependency injections. Imagine MVC, but no models so controllers and views are directly touching database tables.
"Tests" are set up by loading XML files which contain database state before the tests are run. These XML files are loaded into a database which is complicated and many foreign keys, therefore if I "test" a feature that touches table A that has a dependency on table B, my XML file needs to have table A and table B state/data in it. If table B has dependency on table C, then XML file has A,B and C in it. And so on so on.

All these XML files are produced by hand. There is no way to use a tool.

The XML files load directly into the database. This means that when I load a state on which I perform my tests, there is no guarantee that this database state is actually legitimate in the application itself. There are no factories or repositories where I can use the same logic that production code uses to create conceptual data entries in a test environment.

As expected, this leads to developers hand crafting application state XML documents that serve as basis for tests cases that are impossible to ever happen in production, but these tests are apparently what is used to show that the feature works.
The sheer expense involved in writing these XML files also mean at most, only the happy path test is written and edge cases are manually tested by some QA on staging environments.

why you should define an xsd schema for your xml documents.txt.doc.zip.exe

gonadic io
Feb 16, 2011

>>=
ctps:
blocking code:
code:
impl <'a> Stepper<'a> {
  fn move<D: Delay>(&mut self, steps: u32, delay: D) {
    for _ in 0..steps {
      self.step.pin_low();
      delay.delay_ms(1);
      self.step.pin_high();
      delay.delay_ms(1);
    }
  }
}
non-blocking code:

code:
impl<'a> Stepper<'a> {
    fn move_steps<'b, 'c, T: CountDown<Time=Hertz>>(&'c mut self, timer: &'b mut T, steps: u32) -> MoveStepsGenerator<'a, 'b, 'c, T, Hertz> {
        MoveStepsGenerator {
            stepper: self,
            timer,
            remaining_steps: steps,
            pin_low: false,
            delay: 1000.hz(),
            waiting: false,
        }
    }
}

struct MoveStepsGenerator<'a: 'c, 'b, 'c, B: 'b + CountDown, P: Into<B::Time> + Clone> {
    remaining_steps: u32,
    stepper: &'c mut Stepper<'a>,
    timer: &'b mut B,
    pin_low: bool,
    waiting: bool,
    delay: P,
}

impl<'a, 'b, 'c: 'a, T: CountDown, P: Into<T::Time> + Clone> MoveStepsGenerator<'a, 'b, 'c, T, P> {
    fn poll(&mut self) -> Result<(), !> {
        // Make sure we're done waiting (by yielding)
        if self.waiting {
            match self.timer.wait() {
                Ok(()) => {},
                Err(Error::WouldBlock) => return Err(Error::WouldBlock),
                Err(Error::Other(_)) => unreachable!(), // Countdown::wait has error type `!`
            }
        }
        // If we get here then we're done waiting
        self.waiting = false;

        if self.remaining_steps == 0 {
            Ok(())
        } else {
            if self.pin_low {
                self.stepper.step.set_high();
                self.remaining_steps -= 1;
                self.timer.start(self.delay.clone());
                self.waiting = true;
                Err(Error::WouldBlock)
            } else { // self.pin_high
                self.stepper.step.set_low();
                self.timer.start(self.delay.clone());
                self.waiting = true;
                Err(Error::WouldBlock)
            }
        }
    }
}

gonadic io fucked around with this message at 17:26 on Aug 1, 2018

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.

CRIP EATIN BREAD posted:

why you should define an xsd schema for your xml documents.txt.doc.zip.exe

That has almost nothing to do with why this is horrible.

gonadic io
Feb 16, 2011

>>=
also terrible programmer question:
i have a file consts.rs. i want that file to exist in git so people can checkout my project and run it.

i then want to make changes to that file that don't get copied to git - only the initial state should ever be committed

so i made the file, committed it in, added to gitignore, committed that. no problem so far.

but now my changes to the file are still shown in git diff and presumably will be committed if i do commit -am. is there a better solution?


stack overflow told me to use `git update-index --assume-unchanged` which worked great

gonadic io fucked around with this message at 17:21 on Aug 1, 2018

ThePeavstenator
Dec 18, 2012

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

Establish the Buns

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

Finster Dexter posted:

That has almost nothing to do with why this is horrible.

IDK what you're talking about, a good test is one that passes when I run it and makes the code coverage metric go up.

CPColin
Sep 9, 2003

Big ol' smile.
A good test is any test you can walk away from.

Adbot
ADBOT LOVES YOU

JawnV6
Jul 4, 2004

So hot ...

gonadic io posted:

ctps:
blocking code:
code:
impl <'a> Stepper<'a> {
  fn move<D: Delay>(&mut self, steps: u32, delay: D) {
    for _ in 0..steps {
      self.step.pin_low();
      delay.delay_ms(1);
      self.step.pin_high();
      delay.delay_ms(1);
    }
  }
}
you're controlling a motor and can yield to the scheduler? does anything bad happen if someone else takes a long time and you miss pulling the pin back low until, say, 5ms? 20ms?

you're on some kind of m4f, right? ~100mhz? you can approximate how many instructions before you'd have to preempt a task if you just want to get close

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