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
The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

Lutha Mahtin posted:

make the HQ in MSP and i will work for you. and/or i will be an unpaid hype-man because i do not have actual job experience touching codes

i suggest this because wisconsin is still a bit :chloe: atm

Lol at suggesting i voluntarily become a snowback

Adbot
ADBOT LOVES YOU

Mao Zedong Thot
Oct 16, 2008


qhat posted:

If you don't like the default latex font just use lmodern sans, it's much better.

why would you not virtue signal with the latex font, thats like the entire point of it

born on a buy you
Aug 14, 2005

Odd Fullback
Bird Gang
Sack Them All
posted this in the pl thread but probably better here

born on a buy you posted:

this person makes six figures
code:
await Promise.all(
        await Object.keys(packageLockObj.dependencies).map(async e => {
            if (packageLockObj.dependencies[e].dependencies && Object.keys(packageLockObj.dependencies[e].dependencies).length > 0) {
                await Promise.all(
                    await Object.keys(packageLockObj.dependencies[e].dependencies).map(dependency => {
                        if (dependency === dependencyVersion.dependencyName
                                && getVersionWithoutTag(packageLockObj.dependencies[e].dependencies[dependency].version)
                                    === dependencyVersion.dependencyVersion) {
                            console.log(`Deleting ${dependency} at version ${dependencyVersion.dependencyVersion} of ${e} in ${directory}.`);
                            delete packageLockObj.dependencies[e].dependencies[dependency];
                        }
                    })
                );
            }
        })

prisoner of waffles
May 8, 2007

Ah! well a-day! what evil looks
Had I from old and young!
Instead of the cross, the fishmech
About my neck was hung.

Bloody posted:

ctps:
code:
using System.Linq;
using System.IO;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = File.ReadAllLines(@"C:\a.txt");
            var b = File.ReadAllLines(@"C:\b.txt");
            File.WriteAllText(@"C:\c.txt", b.Except(a).Aggregate("", (x, y) => x += y + "\r\n"));
        }
    }
}
there is probably a trivial tool for this, isn't there
Yeah

Unixy way:
code:

comm -13 <(sort a.txt) <(sort b.txt)

comm takes 2 sorted files and produces 3 columns of output in the order of the file: lines only in the first file, lines only in the second file, and lines in both (prefixed with 0, 1 and 2 tabs respectively). You can suppress one or more of those columns w/ -1 -2 -3 switches


code:

comm -12 a b #show only lines that are in both
comm -3 a b #show only lines in a xor b

It's basically the Unix text processing filter program for doing set operations on lines of text.

It will complain if your inputs are not sorted. It's probably loving ancient

cinci zoo sniper
Mar 15, 2013




born on a buy you posted:

posted this in the pl thread but probably better here

10 AWAIT
20 GOTO 10

Lutha Mahtin
Oct 10, 2010

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

jit bull transpile posted:

Lol at suggesting i voluntarily become a snowback

the term is frostback how dare you use such an ugly slur

p.s. also it refers to canadians

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

Lutha Mahtin posted:

the term is frostback how dare you use such an ugly slur

p.s. also it refers to canadians

Minnesota is just Canadian infiltrators

Lutha Mahtin
Oct 10, 2010

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

so there is actually a town here called "little canada"

tinaun
Jun 9, 2011

                  tell me...

MALE SHOEGAZE posted:

also tinaun plz explain pinning tyvm

ok. but first lets talk about mem::replace

code:
pub fn replace<T>(dest: &mut T, src: T) -> T
mem::replace is the best tool i know for fighting the borrow checker, for one simple reason. it allows you to move out of a borrowed reference, giving you an owned value you can do whatever you want with, and you can even put it back in the ref when you're done. but it also gets at something about rust which i feel is often hinted at, but never really stated explicitly. moves aren't exclusively semantics. when you get right down to it, you need to copy bytes around when you move a value. of course, elision and optimizations mean that moving isn't always a memcpy, but its useful to think that any move could be one.

the concepts of "mutability" and "can be moved" are linked in rust - it is always safe to take a mutable reference to a value, it is always safe to move a value you own (and haven't loaned out via shared / mutable borrow), and mem::replace allows you to always move out of a mutable reference safely as long as you can construct a dummy value of type T. but what if there's a type where you want to mutate it, but don't want to move it? what if you can't move it without breaking everything?

a PinMut<T> is like a &mut T - but it cares about whether you can move a value of T. the property "can a value of T be moved safely" is represented by the Unpin trait. if T is Unpin, a PinMut<T> (or, a pinned reference to T) exactly the same as a &mut T, and you can convert &mut T <-> PinMut<T> freely and safely. if T is not Unpin, the pinned reference will not allow you to mutate/move the referent safely - if you want the pinned reference to decay to a mutable reference, you have to explicitly call an unsafe function - promising to the compiler that while you might mutate the data, you would never move the data.

basically everything you can think of implements the Unpin trait - except, crucially, the anonymous generator types created by async functions. because the generators save their environment + suspend execution between yield points, internal references in the environment (aka: local vars that are refs to other local vars) suddenly become a problem. if the generator is moved (read: copied to a new memory location) while it still has yields to process, suddenly all the refs in its environment are invalidated and point who knows where, leading to the dreaded Undefined Behavior. viewing these generators through pinned references only (as in the Future traits) lets you reason about mutation and moves explicitly, without accidentally invalidating the generator with an errant move in safe code.

HoboMan
Nov 4, 2010

Lutha Mahtin posted:

make the HQ in MSP and i will work for you. and/or i will be an unpaid hype-man because i do not have actual job experience touching codes

i suggest this because wisconsin is still a bit :chloe: atm

yeah this except i am the codemaster :c00lbutt:

cinci zoo sniper
Mar 15, 2013




interactive text magister

redleader
Aug 18, 2005

Engage according to operational parameters
imagine developing software that people actually care about

SmokaDustbowl
Feb 12, 2001

by vyelkin
Fun Shoe

cinci zoo sniper
Mar 15, 2013




redleader posted:

software that people actually care about

whats that

gonadic io
Feb 16, 2011

>>=

ty for this. is there an equivalent in c++ or is it just a bunch of types that are like "lol i've got an internal pointer to myself and you moved me time for ub"

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

tinaun posted:

ok. but first lets talk about mem::replace

wow thanks! im taking a break from computer today but ill be working through this tomorrow!

Slurps Mad Rips
Jan 25, 2009

There's No Guarantee

gonadic io posted:

ty for this. is there an equivalent in c++ or is it just a bunch of types that are like "lol i've got an internal pointer to myself and you moved me time for ub"

short answer: no

long answer: moves in c++ aren't destructive, so moving an object into another one requires the moved-from object be in a "valid but unspecified state". This typically means that the object will be in its default constructed state (e.g., std::unique_ptr and friends), but for small builtin types that aren't used to modify state in the destructor it's cheaper and faster to not move them or reset their value. If performing an operation on an object would cause UB (for instance, dereferencing a std::unique_ptr), that operation is not protected against, but is antithetical to the idea that you're working with a different object, as the original one was moved elsewhere.

as for rvalue references in general, they're basically a special tag in the type system. I can technically move a value into a function that is then moved into a function (repeat several times) but as long as I don't move said rvalue reference into another object (either via construction or return), its lifetime is unaffected and its scope doesn't change. That said, when an rvalue reference is moved into a function, you need to then explicitly move it once more as it has become an xvalue which has the lvalue property of identity (its named or how else would you interact with it), but also has the prvalue property of safely moving from.

basically this isn't a property of c++, though there are some that wish we could have destructive moves, but that would break a shitload of code as existing code would for the most part continue to compile correctly, but destructors would be secretly reordered and that could cause a huge headache for people that depend on our existing operations. That said, there's a concept being put forth now of relocation which will be the closest thing c++ might get to destructive moves

Also just nipping this in the bud, but c++ value categories are kind of a mess to understand in full legalese so i might have gotten the specifics of lvalue vs glvalue wrong for the second paragraph

Luigi Thirty
Apr 30, 2006

Emergency confection port.

the Russians used a pointer

Soricidus
Oct 21, 2010
freedom-hating statist shill

Luigi Thirty posted:

the Russians used a pointer

Kuvo
Oct 27, 2008

Blame it on the misfortune of your bark!
Fun Shoe

Powerful Two-Hander posted:

born to script
type safety is a gently caress
eval em all 2018
i am js man
410, 757,864,530 ignored warnings

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Powerful Two-Hander posted:

born to script
type safety is a gently caress
eval em all 2018
i am js man
410, 757,864,530 ignored warnings

it's so weird how memes work

i first saw this one you know like, 6mo-1yr ago in this thread.

and i didn't get it. so i looked it up and i thought "ok, whatever"

then i saw a few more and they didnt do anything for me

but now this one is funny.

memes are weird.

mod saas
May 4, 2004

Grimey Drawer

Powerful Two-Hander posted:

born to script
type safety is a gently caress
eval em all 2018
i am js man
410, 757,864,530 ignored warnings

Chopstick Dystopia
Jun 16, 2010


lowest high and highest low loser of: WEED WEE
k

Powerful Two-Hander posted:

born to script
type safety is a gently caress
eval em all 2018
i am js man
410, 757,864,530 ignored warnings

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
Woo, got kleisli compose and monad working with futures. It required wrapping the stored closure in the kleisli in an Rc, but the more I think about that the more it makes sense.

code:
    #[test]
    fn test_kleisli_map_and_compose() {
        let parse = kleisli::run(|s: &str| {
            // I think it's possible to get around the type annotations here but I need to redesign
            // a few things.
            let l: Lifted<FutureKind, i32, Nothing, Nothing> =
                future::lazy(move |_| s.parse::<i32>().unwrap()).lift();
            l
        });

        let reciprocal = kleisli::lift(|i: i32| future::lazy(move |_| 1.0 / i as f32));

        let parse_and_recriprocal = reciprocal.compose(parse);

        assert_eq!(
            block_on(parse_and_recriprocal.runlift("123")),
            0.008130081f32
        );
        let doubled = parse_and_recriprocal.map(|f| f * 2f32);
        assert_eq!(block_on(doubled.runlift("123")), 0.016260162f32);
    }
I think I'm going to do EitherT now, then I'll be able to do redo this example without unwrapping the results.

also i've been switching between RLS and Intellij a lot and RLS feels like it's catching up. It's a lot better at dealing with macros than intellij which is super important because a lot of the std lib stuff is macro based. For instance, intellij just doesn't understand futures v3, because a lot of the definitions are inside macro blocks. However, intellij can implement traits which is a majorly killer future for what I'm doing.

DONT THREAD ON ME fucked around with this message at 16:47 on Jul 29, 2018

Captain Foo
May 11, 2004

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

kleisli :3:

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
true story i had no idea how to pronounce kleisli until i saw rob norris do a talk where he said it. i was saying something closer to khaleesi in my head.

also if you're interested in FP stuff I'd definitely recommend rob norris' talks / blogs, he's responsible for any of the understanding i have. i dunno that he's a guru but he's really likable and accessible.

https://tpolecat.github.io/presos.html

DONT THREAD ON ME fucked around with this message at 17:00 on Jul 29, 2018

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

tinaun posted:

ok. but first lets talk about mem::replace

thanks again for this. reread it a few times. i'll need to experiment before it really clicks but it's not a mysterious and scary as it was at first.

redleader
Aug 18, 2005

Engage according to operational parameters
terrible programmer question: why do people love ~the cloud~ so much?

gonadic io
Feb 16, 2011

>>=

redleader posted:

terrible programmer question: why do people love ~the cloud~ so much?

other people do your server janitoring for you.

docker means not worrying about dependencies on your server, and kubernetes means not worrying about deployment*, running, restarting, etc etc.

yes there are absolutely downsides but in terms of letting devs care about less poo poo, cloud is king.

* of the image itself i mean. yes there's still environment deployment of configs, secrets, images etc

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS
no outlay for hardware. no need to anticipate hardware purchases. built in orchestration apis versus implementing something like esxi.

Captain Foo
May 11, 2004

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

if all you know how to do is code then you don't understand the importance of non-code things

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
there's a very small number of companies these days that can justify running their own hardware.

anyone who argues otherwise are people whose sole skill is running such hardware, and are terrified of becoming obsolete, despite the fact that it already happened.

Chopstick Dystopia
Jun 16, 2010


lowest high and highest low loser of: WEED WEE
k

redleader posted:

terrible programmer question: why do people love ~the cloud~ so much?

Less poo poo to worry about and lower entry costs.

Lower operating costs over time if you do it "right" but it's easy to gently caress that part up.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
less poo poo to worry about is huge. even if you do want to run on your own hardware for some reason, you should probably structure it as an internal cloud so that the people developing your applications don't need to care about managing actual machines, and the people taking care of the machines don't need to care about what the developers are doing.

(if you're small enough that that sounds way too complicated for you, you should probably just be using someone else's cloud)

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 9 years!)

Jabor posted:

less poo poo to worry about is huge. even if you do want to run on your own hardware for some reason, you should probably structure it as an internal cloud so that the people developing your applications don't need to care about managing actual machines, and the people taking care of the machines don't need to care about what the developers are doing.

(if you're small enough that that sounds way too complicated for you, you should probably just be using someone else's cloud)

the hot poo poo new product our org has released is literally software to create an on-prem private cloud

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
the biggest thing i miss about red hat is the big on prem private cloud we had in lower environments for testing/validating pocs/etc. so nice, even if the UI was garbage.

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
you shouldn't be using whatever UI a service provides to manage your cloud infrastructure.

might as well just use the compaq stuffed under an interns desk at that point.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

CRIP EATIN BREAD posted:

you shouldn't be using whatever UI a service provides to manage your cloud infrastructure.

might as well just use the compaq stuffed under an interns desk at that point.

obviously but this was for loving around / PoCs. there was no management involved. and afaik UI was the only option.

our pre-prod environments were of course configured properly.

gonadic io
Feb 16, 2011

>>=
60 line type signature: https://github.com/http4s/rho/blob/master/core/src/main/scala/org/http4s/rho/Result.scala#L7-L70

And they didn't even include 418 or 420

gonadic io fucked around with this message at 15:13 on Jul 30, 2018

Adbot
ADBOT LOVES YOU

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

lol

the russians used an enum

DONT THREAD ON ME fucked around with this message at 14:33 on Jul 30, 2018

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