#programmers-off-topic

1 messages · Page 32 of 1

rotund violet
#

Oh, I know what chu's talking about now. The lookup table is a highly optimized version, but division and string are... fine.

#

It's micro-optimization at best.

ivory shadow
#

Yeah, the division is less of an issue than the iterator overhead

#

I just find it funny that this code runs faster than the other code. ```cs
int[] NumberArray(int num) {
if (num == 0)
return new int[]{0};

var numSpan = num.ToString().AsSpan();
int len = numSpan.Length;
int[] digits = new int[len];

for(int i = 0; i < len; i++)
    digits[len - i - 1] = numSpan[i] - '0';

return digits;

}

#

That subtraction is some JavaScript tier nonsense

rotund violet
#

You're sure that it's faster? Converting an integer to a string has to do pretty much all the same work, plus the work of allocating the string and looking up character equivalents (very trivial work, but hard to see how it could end up being less overall).

ivory shadow
#

Tested with numbers of every length. ```cs
static int TestValue = 1234567890;

[Benchmark]
public void BenchmarkDemo1() // Benchmark methods must be public.
{
int x = 0;
foreach(int val in Number(TestValue))
x += val;
}

[Benchmark]
public void BenchmarkDemo2() // Benchmark methods must be public.
{
int x = 0;
foreach(int val in NumberArray(TestValue))
x += val;
}

#

At least it has way more memory allocation so it isn't just better in every way, lol

#

If that shitpost was better in every way I would be very sad for C#

rotund violet
#

The implementation lives here: https://github.com/dotnet/runtime/blob/d2c458727ea78f8ff427d498842866a1f53ea5a1/src/libraries/System.Private.CoreLib/src/System/Number.Formatting.cs#L1680

There's a lot going on with caching, inlining, unsafe code, etc., so it's kind of noisy, but if you don't get one of the happy paths then you end up here: https://github.com/dotnet/runtime/blob/d2c458727ea78f8ff427d498842866a1f53ea5a1/src/libraries/System.Private.CoreLib/src/System/Number.Formatting.cs#L1657

Which is... a DivRem implementation, same as the first one chu/e posted.

#

Profiling stuff like this can be a challenge because so much depends on the inputs chosen, the jitter, the GC, and all kinds of esoteric stuff I know exists but don't really understand that well like CPU caching.

#

That said, if I had to try to design a benchmark for this then I'd probably start up a random seed, generate 100,000 random integers, and run each of the cycles several thousand times with each method. And then run the entire benchmark 5 or 10 times to make sure the results are consistent. Should at least come close to a repeatable answer.

cinder karma
#

(Fun fact.)

#

There is no division here

#

Sure, you see two. But the compiler will easily make that multiply and shift

rotund violet
#

It will do that with the lookup version too of course, since it's all division by constants.

#

But yes, that is technically correct (the best kind of correct).

#

Khloe is probably right that the enumerator overhead cancels out any gains from a lookup. That being said, the code isn't doing any of those things on every draw call, it's only doing them when the value actually changes. Which is a whole assload more efficient than Stardew's version which does that horrific Math.Pow implementation on every single frame. (Maybe the compiler knows how to optimize that, but I wouldn't trust it to)

cinder karma
#

I don't actually know the context lol

rotund violet
#

And I'll admit it's maybe a silly optimization given the context. Though it's not like it cost a lot to implement anyway.

cinder karma
#

Yeah, if it's cached it's probably irrelevant

rotund violet
#

Have you looked at the implementation of drawTinyDigits though? It's... fun.

cinder karma
rotund violet
#

So I think my mental frame at the time (though it was 2 months ago) was something like: "well, I'm sure as hell not going to use that implementation, so I'll just go with the fastest one I know". It didn't really occur to me to compare, benchmark, worry about the exact speed vs. simplicity, etc.

cinder karma
#

Eh, if it works it works

#

Caching is by far more important.

rotund violet
#

It is, and SDV's isn't caching, it's doing that work on every draw.

#

In the grand scheme of things, is it going to cause jank? Well, probably not, but all these little things add up.

#

(and this is why a 10-year-old game still lags on a 1-year-old PC)

#

All this talk about caching made me realize that I just added another invalidation bug yesterday. I really need to come up with an analyzer that verifies, "if you check some flag here, you need to clear it there".

cinder karma
#

None of y'all clicked on that reddit link 😦

#

It's such a great bit of python

safe dragon
#

production ready

rain apex
#

Upon reflection the actual diff between what I did and what focustense did is that I was output digits in little endian order

primal shore
#

Coding boot camp recs?

safe dragon
#

spans are witchcraft

#

they're starting to feel like some kind of performance hack

#

throw in a span and even if it feels like it would never be faster it will somehow be like 3 times faster

#

I just realized this is actually pretty topical for a recent conversation even though this was unrelated

rotund violet
cinder karma
#

(So are mutable strings)

safe dragon
#

mutable strings?

#

there's no mutable string type is there

#

you could do that I suppose, once again through spans

#

that feels like a code smell though unless you're really hyper optimizing

safe dragon
#

I am a little salty

#

my work recently introduced a step to our pipeline where SonarQube analyzes our PRs and adds comments for things it believes we should fix

#

one of those things is to switch away from LINQ methods to list/array specific methods

#

this used to be good advice but as it turns out, from my testing anyway, the LINQ methods are(as of the .NET 9 previews) generally faster than the type specific methods

#

they let Stephen Toub loose on them and now the linq methods use spans everywhere

#

they did not let him loose on the type specific methods

cinder karma
#

One day we'll have a simd accelerated dictionary

safe dragon
#

I've wondered what FrozenDictionary does

#

it's notably faster than normal ones

cinder karma
#

Pretty insane

safe dragon
#

benchmarks could definitely be improved

#

a lot of this is actually the cost of allocating a new list for the result

cinder karma
#

Hmm

#

And how big is the value type

safe dragon
#

an int

#

gonna do a test where the Where/FindAll methods actually return an empty list

#

should minimize allocations on that front

#

wonder what that does

#

tbh the test is inherently flawed because FindAll always returns a List<T> which isn't optimal to begin with but I'm also sticking with that in the Linq version for fair comparison

#

alright here's a version where the resulting list of the queries doesn't contain elements

#

interestingly the FindAll has fewer allocations in this scenario

#

but it's slower nonetheless

#

FindAll with reference types seem to scale really poorly if there's a lot of results

cinder karma
#

Does findall always allocate

safe dragon
#

yes

#

it initializes a new List<T> first thing

cinder karma
#

Ok

#

Hmm

#

The 32 bytes has to be the empty list then

safe dragon
#

.NET 9 vs .NET 8 for a list of 1000 elements where exactly 1 element matches

#

Where got a serious glowup

cinder karma
#

When do we clone stephen

safe dragon
#

this is the benchmark code btw if you see anything that should be changed

safe dragon
rotund violet
rotund violet
safe dragon
#

don't remember. Might give that a quick test later

#

I haven't looked into it very much

rotund violet
#

Faster than ImmutableDictionary?

safe dragon
#

I believe it should be

#

I'll give it a test after I finish this one for Exists vs Any

#

jesus

#

Exists vs Any for .net 9 vs .net 8

cinder karma
#

That's awesome

safe dragon
#

in both cases the one that matches is right in the middle of a list of 1000 elements btw

#

alright lemme try out the dictionary stuff

rotund violet
#

Ha, I didn't even know there was an Exists method, for the longest time I've been using FindIndex(...) >= 0

safe dragon
#

doubt there is much of a difference

rotund violet
#

I'm sure it's the same underneath, yes.

#

Guess it's time to switch back to Any which I like better anyway. Though that's only for the newer projects... anything still stuck in .NET 6 is another story.

safe dragon
#

yeah .NET 9 isn't even out yet

#

the dictionaries

rotund violet
#

How on earth is the immutable dictionary the slowest? Is this for creating or for lookups?

safe dragon
#

lookups only

cinder karma
#

Isn't immutable the red black tree or something

#

Weird like thar

rotund violet
#

Mind you, although a 50% improvement is nothing to sneeze at, it's not as dramatic as the 80-90% differences in some of the other cases.

safe dragon
#

added ConcurrentDictionary even though this is very obviously not the intended usecase for it

#

though FrozenDictionary is also thread safe

cinder karma
#

For a value not in the dictionaries

rotund violet
#

The tricky thing about ConcurrentDictionary is that it actually can slow down a bit during concurrent operations. But it's always been more or less equivalent to Dictionary in terms of lookups.

cinder karma
#

And for one that is

#

It should be about the same

rotund violet
#

The moral of the story is... don't use ImmutableDictionary ever, apparently.

cinder karma
#

Yeah I think it's like

#

A red black tree

#

For some reason

safe dragon
#

I assume it has some niche usecase but yeah

#

running TryGetValue now

#

for non-existent key

rotund violet
#

Ah, it's got a ToBuilder method, that's why.

#

So you can create an immutable dictionary, convert back to a builder, add one or several keys, and then make a new immutable dictionary relatively cheaply.

safe dragon
#

the way functional programming intended

rotund violet
#

With regular/frozen dictionary you'd have to recreate and repopulate an entirely new dictionary.

cinder karma
rotund violet
#

So yeah, if you've got a dictionary of a million elements and actually need immutability then it's still better, but only in that specific case.

safe dragon
#

uh

#

I feel like my test has to be flawed

#

oh

#

yeah ok gotta fix this

#

I got this which makes no sense

#

that's make TryGetValue faster than regular indexing

cinder karma
#

Not hugely surprised tbh

rotund violet
#

Indexing has to validate, right?

safe dragon
#

maybe it actually is faster hmm

rotund violet
#

Indexer properties generally do have overhead vs. regular methods.

cinder karma
#

Read the bug report I linked

rotund violet
#

That's an old report though, it seems like it was already mostly obsolete in .NET 5?

#

I think I actually remember reading it back in the day.

cinder karma
#

Can you also do collectionsmarshall

safe dragon
#

what part of collectionsmarshal. I'm only familiar with it for turning lists into spans

rotund violet
#

That's an interesting API, almost works like Rust.

#

(almost)

safe dragon
#

TryGetValue is jsut faster as far as I can tell. I thought I might've made a mistake by not actually using its output value but even when I do it doesn't change the result

rotund violet
#

I'm not surprised by that at all. It's the same reason why manipulation of large buffers (like image pixels) is always done with unsafe code; the range checking on every access gets expensive over millions of calls.

#

TryGetValue almost certainly does a cheaper version of the range checking.

#

(I know "range checking" isn't a perfect description of what's going on with a dictionary or other hash structure but it's close enough)

#

Doing for (int i = 0; i < array.Length; i++) { Foo(array[i]); } is way, way slower than the pointer equivalent.

cinder karma
rotund violet
#

Rust: "You want to mutate two elements of this map? Screw you!"

cinder karma
rotund violet
#

Oh, I have no idea, that knowledge long predates spans.

cinder karma
#

It should be able to elide the bounds checking in that simple case

rotund violet
#

Probably Spans are very close since they're doing the same sort of thing underneath, providing direct memory access.

cinder karma
#

Although I've been side eying stardew rain lately

safe dragon
#

running an adjusted variant now with the CollectionsMarshall included

cinder karma
#

(Don't think bounds checking explains the slow down though)

rotund violet
#

You mean doesn't explain it in the game or doesn't explain it in general?

safe dragon
#

hmmm...

rotund violet
#

That's... helpful.

cinder karma
#

There is far more slowdown wrt to rain than just bounds checking can explain

safe dragon
#

let me try with something that is actually nullable

rotund violet
#

Oh, well yeah, I think the difference between index accessors vs. unsafe/span access is very low on the list of Stardew's performance concerns.

#

Some of what's in there is just wack. Maybe contractor code, or maybe early-development "just hacking away and will totally clean/optimize this later" code, who knows.

safe dragon
#

clearly I don't know how to use the collectionsmarshall

cinder karma
#

ref (string id, bool duplicate) val = ref CollectionsMarshal.GetValueRefOrAddDefault(mapping, name, out bool exists);

#

It's not actually a nullable, just a possible null pointer iirc

#

There is another function in Unsafe you're supposed to call over it

#

Null reference

#

Not actual pointer

safe dragon
#

alright let's try this again

#

I've at least verified that it shouldn't crash

#

had to make some changes so all the results are different but here you go

#

call me out if this is just wrong lmao

supple ether
#

What's the difference between frozen and immutable that has such a performance impact

rotund violet
#

Not terribly shocking I guess; I imagine most of the gains for the Marshal version are not for lookups but for mutations.

cinder karma
#

And in particular, only if the value is a value type

rotund violet
#

It's the use case for Immutable - it's meant to be built up iteratively, repeatedly made into X and then back into XBuilder and then into X again. Can't do that with the mutable types.

#

But that imposes constraints on the data structure.

#

(i.e. it has to be a tree, not a hash table)

cinder karma
#

Get value ref or add default is slightly different behavior

safe dragon
#

for the dictionaries nothing has really meaningfully changed between .NET 8 and 9. 9 is very marginally faster

#

but roughly the same for all of them

cinder karma
#

Frozen dictionary is pretty cool though

#

Pun intended

safe dragon
#

my favorite new thing is SearchValues<string>

rotund violet
#

Definitely a useful feature if you're writing lexers or parsers. Kind of niche though, no?

safe dragon
#

very

#

but it's neat

safe dragon
#

reading through the performance improvements blog from stephen toub and I find this one pretty amusing

#

some scenario where what was a boxed nullable type comparison is now optimized to just a single null check

pliant snow
#

... doesn't 0.0006 ns require a like 5000 GHz processor

safe dragon
#

considering it compiles down to a singular line of machine code I'd take the actual number with a grain of salt

#

measuring the performance of a singular null check line of machine code is probably not really feasible

#

or stephen toub just has a 5000 GHz cpu

cinder karma
#

I see your "foreach loop and then switch over the possibilities" and raise you "python for loop and then elif tree over the possibilities"

safe dragon
#

wtf

cinder karma
#

Wait is the blog post out??????

safe dragon
#

this is for the scenario when one of the sequences is a list and the other is an array

#

has been for 6 days yeah

#

stephen's post that is

#

my biggest takeaway is honestly that I can stop feeling guilty for using LINQ in hot code paths

rotund violet
safe dragon
#

I'm going with stephen having a magical cpu

rotund violet
#

Right. Quantum perhaps, just ran every benchmark input at the same time in a different universe.

cinder karma
#

He did a SIMD didn't he

safe dragon
#

that he did

#

especially if we pretend stephen personally implemented every optimization mentioned

#

even though the entire list of AVX512 changes were made by a guy called Egor Bogatov

cinder karma
#

My laptop is about to take flight

safe dragon
#

some powerful fans

rotund violet
#

I thought AVX512 had a reputation for slowing things down due to forced downclocking and such.

safe dragon
#

I imagine it has its uses

#

and I'd assume modern cpus are better at it

#

idk what it is but seeing big performance optimizations just makes me happy

#

even when it has nothing to do with me

rotund violet
#

I guess so. But Intel actually killed AVX512 on the newer processors and who knows when they'll bring it back.

safe dragon
#

I'm not really interested in the AVX512 section tbh

#

I don't even know if my cpu supports it

#

it does not

cinder karma
#

I'm glad linq is seeing some love

#

I love the idea of linq

safe dragon
#

I've been using LINQ extensively for years so seeing it get some very major performance improvements is nice

rotund violet
#

I really never found it slow in the first place unless it was being used for SQL/EF and generating awful queries. But it is indeed great to see it being optimized so much, so that the naysayers won't have any excuse to stay in the stone age.

safe dragon
#

we've had many improvements in the past but this one feels different since it hits the really major linq methods you'll have littered around your entire codebase like FirstOrDefault, Where, Any etc

#

the original LINQ implementation was very slow

#

it has come a long way

cinder karma
#

Fwiw, in my experience it's not linq that is slow

#

But more that it is easy to write slow code in linq

rotund violet
#

It's just very rare I've had to deal with code that is even CPU-bound to begin with. Only times I run into that are on mobile and embedded.

cinder karma
#

So easy to accidentally quadratic yourself

#

I mean

#

Do some crimes against tables

safe dragon
#

do more crimes

cinder karma
#

(In particular, write your pandas column lookup quadratic)

#

There we go

safe dragon
#

tbh almost all issues I've had in the past were more with memory than cpu but the improvements to linq and really everything else also improve that drastically

rotund violet
#

Yes, memory I can understand more easily here because all the deferred execution can accidentally create leaks.

#

Enumerable.Reverse - just say no. (Or maybe yes in .NET 9, who knows)

safe dragon
#

though our most performant critical application at work is really just limited by te data access layer with the database

#

entity framework is partially to blame but also just a lot of really bad queries. Many of which impossible to fix because of fundamental design mistakes in the database tables

rotund violet
#

Yep, most slow code is slow because of I/O. Either because of the I/O itself or because the code chooses to wait for it when it doesn't have to.

safe dragon
#

almost all our hot paths at work involve recursive db queries of some kind

rotund violet
#

Slow database queries are in that weird hybrid category of I/O and code. System-level issues, maybe solved by better queries or maybe can only be solved with a different database design.

safe dragon
#

soon it will no longer be my problem

#

4 weeks left at this company

#

instead I will have to deal with an oracle database

rain apex
#

how come it takes 4 weeks to quit ur job

rotund violet
#

Eww... well I guess a change is a change.

safe dragon
#

legal requirement in the netherlands that after you hand in your resignation you have to work for at least 1 more calendar month before stopping

#

same if you're fired, though then it can be more than 1 month depending on how long you worked there

rotund violet
#

We might not have to here, but I've always given several weeks notice. Though typically I haven't left on negative terms.

safe dragon
#

4 weeks instead of 6 weeks for me because I have 2 weeks of time off I haven't used that I have to use

rotund violet
#

It is incredibly difficult to find a replacement, and 2 weeks is hardly enough time to even get all the tribal knowledge on paper or disseminated to teammates.

safe dragon
#

I also won't really be leaving on negative terms

rotund violet
#

I figured not, that was just my perspective on "why leave more than 2 weeks notice" - that the bare minimum notice period in US is kind of an f-you situation and while it's sometimes totally justified, it's not a nice thing to do for very niche or highly skilled positions.

safe dragon
#

at least I made sure to not leave behind any project I was the sole contact person for

cinder karma
#

Enjoy oracle!

safe dragon
#

thanks

#

my job position stated C# developer though

#

we'll see how much I actually deal with the database directly in practice

#

a lot I'm guessing

rotund violet
#

If it is just an Oracle database and not an entire Oracle consulting farm then you might be OK.

safe dragon
#

it's just a database

#

a self hosted one

rotund violet
#

That's definitely the best possible Oracle scenario, so good luck. Don't forget to heap on the strategic incompetence if they ask you to do any DB stuff.

safe dragon
#

of course

#

sorry I only know sql server

rotund violet
#

"Oops, I just deleted the main transaction table and all backups. Ha ha! Aren't I a character. You probably shouldn't let me near the database ever again."

safe dragon
#

what's oracle

#

Oops I accidentally added a new trigger to production that brought down the entire server

#

lemme just order by these unindexed fields

rotund violet
#

I anonymize of course, but I really have done that type of thing. It's the most effective way of crystalizing one's job description. Refusing to do something always breeds ill will, but simply failing at it (while continuing to be very good at your actual responsibilities) is just a "learning experience".

safe dragon
#

from what I've gathered, the team lead has been the database guy at this company for decades

#

so he'll probably end up doing most of the db work

rotund violet
#

With any luck, he'll turn out to be good at it and not need outside help.

safe dragon
#

sure hope so

#

they do know I'm fairly experienced with sql server so I can't really feign incompetence

#

I'll find out I'm sure

rotund violet
#

They know you have experience, but they don't know whether it's the good kind of experience.

#

I mean, unless you put a lot of DB accomplishments on your resume.

safe dragon
#

I barely mentioned it

rotund violet
#

I don't advocate feigned incompetence - it's no substitute for the real thing. The sweet spot is a problem that makes everybody else work overtime for one night trying to fix it, but doesn't cause any severe or irrecoverable damage or financial loss.

#

i.e. just enough pain to want to keep you away from that area, but not enough to make people suspect malice or generalized rather than localized incompetence.

safe dragon
#

knowing me I won't be able to help myself and start doing database work just to speed up the process

rotund violet
#

Haha, that's definitely one of those things that came to me with age, or maybe age-adjacent cynicism. I used to want to fix all the problems, eventually got used to the idea of staying in my lane.

safe dragon
#

I'll get there I'm sure

rotund violet
#

Project takes 20 minutes to compile? No problem, I'll just go for a walk / another coffee / etc.

#

There's a fine line between being highly competent/loyal and being an enabler of bad corporate habits.

#

The one I'm sure we're all familiar with is the boss sitting on an issue for 2 weeks and then saying it's an emergency.

safe dragon
#

yeah I've had to learn that already

#

product owner realized he could get a lot of stuff done much quicker if he just asked me directly to look into it for a bit

#

had to put the brakes on that

rotund violet
#

Yup, that's another big one, PMs and sales guys and other non-tech staff trying to bypass the triage and go straight to devs.

#

Early career I tried to please them all; mid career I made a lot of mistakes by being grumpy and resisting it; late career I hit the zen approach of cheerfully accepting all of it and then inexplicably forgetting to do it.

safe dragon
#

definitely still in that early career part even though I'm supposedly a senior now

rotund violet
#

"You are 8 months overdue for this training" - "Gee, it couldn't possibly have been that long, could it?"

#

"Don't worry, I'll get it done this week!"

cinder karma
#

Interesting

leaden marsh
#

lol it's almost like we're going back in time

#

(writing downward counting loops was faster on older compilers because comparison with 0 is faster than the check for branch-if-less-than)

#

I am probably recalling incorrectly, but I think the same also used to hold true on older JavaScript engines

cinder karma
#

I think downward has always been easier in assembly

#

It is definitely in ARM where your previous sub would set the metadata register nicely

#

Status register

#

You know what I mean

#

Just interesting that the JIT can reverse loops noe

#

God thus blog post has so many bounds checks in it

cinder karma
#

O.O

rotund violet
#

That's Interlocked, right? I was just dealing with that issue last week. Although I think they still don't support Java-style atomic updates using callbacks.

cinder karma
#

Huh, rust style string splits at last

#

SpanSplitEnumerator goooo

#

Thank you

#

Holy fuckkng shit

sand frost
#

mind you, i have no ideas what a readonlyspanchar is other than that you like them

rotund violet
#

It's a "string slice". Like all spans, it's a ranged view of some other data.

#

Essentially - a way to get a substring without making an actual copy of those chars.

ivory shadow
#

(Quick someone convince them to port Stardew to .NET 9...)

thin estuary
#

oh, it's the blog page that straight up crashes the web browser on iOS

hallow marsh
#

Converting to 1.6 I started using enums more

#

using them as dictionary keys lol

safe dragon
pliant snow
#
If (is_ios()) {
    crash()
}
safe dragon
#

the first bit of code I write for any website

cinder karma
#

But I'm pretty happy with net9

#

It's taken a lot of little annoyances I've had with the language and fixed them

#

Now if they would give me const fn lol

safe dragon
#

guess you'll forever have something to wish for

pliant snow
#

wouldn't want everyone to be completely happy

cinder karma
#

I've always wondered just what makes AI produce code like this

safe dragon
#

ah I use this regularly in production

#

o screenshot that had my name on there

#

copilot once tried to generate this for me

#

would've been one fucked up email

pliant snow
cinder karma
#

.....maybe I should make code not quadratic

#

Problem - it will take me a few hours to do that

rain apex
#

it can always become worse ✨

safe dragon
#

is that an option

cinder karma
#

I just need one successful run lol

rain apex
#

by quadratic u mean its O(n^2) time complexity right

safe dragon
#

is this one of your scenarios where it's quadratic complexity but like 8 elements

cinder karma
#

(Yes, it is quadratic due to table crimesl

#

No, n=600

safe dragon
#

okay then a better time complexity would usually be worth it

worn remnant
#

yeah but if you only need it to run once then whatever

sand frost
#

Make it cubic instead 😛

safe dragon
#

unless this is one of your scenarios where the contant time per 1 is like 15 minutes

cinder karma
#

Yeah, excspr it would take like three hours for me to unspaget the code

#

And then all I need is one successful run anyways

#

Each run is 5 min, I just hope the next is the winner

#

I've gotten coffee three times already

safe dragon
#

oh stephen has written a book about this

cinder karma
#

Do I have nom in python or am I writing a bullshit regex

safe dragon
#

surely python has tons of parser combinator libraries

#

not nom though

cinder karma
#

Bullshit regex it is

cinder karma
#

"Does python have an immutable static dictionary" I ask like a loon

pliant snow
#

Python doesnt have constants let alone anything more

cinder karma
#

Sock progress today: my code takes too to run

#

But every time I'm like "this run will succeed so no point in optimizing"

rain apex
cinder karma
#

Sad

cinder karma
#

Ugh

#

Pandasssssss

sleek wolf
#

Hey, maybe an unusual question
I dont know how the Stardew Valley developer team hires people, but if I were to want to be a part of it, what would be some of the qualifications I would need?

austere comet
#

I don't believe they're looking to hire anyone at the moment, as for qualifications we don't know, I believe most/all people who are/have been working on the game have been reached out by CA himself.

#

Though this is more a question you might want to email contact@stardewvalley.net for.

thin estuary
#

obviously you need to work your ass off for 5+ years, make and maintain a mod loader for the game for that amount of time and create the most popular and most important mods that are out there, and only then you'll get contacted /s

austere comet
#

Time to develop NotSMAPI and then make NotSpaceCore for NotSMAPI so I get invited to work on the game /j

hallow marsh
#

only to be offered 1/3 of the renumeration you get for the soulless commercial work you're currently doing but at least you'll be living the dream and not having to put post-it note scribbles on anymore grimy whiteboards /j

sand frost
#

or being the 2nd most prolific mod author for stardew 😛

raw pelican
#

who's the first? Casey?

austere comet
#

I think the 2nd is Casey, cause you can’t get any more prolific than Content Patcher tbh

safe dragon
#

suspiciously modding related

earnest cairn
#

mew just rewrote the entire multiplayer backend + encoding stuff and they were hired :^)

sand frost
#

1st is Aedenthorn

#

Though they may one day be surpassed

#

It probably will take a long time given their sheer prolificness

sand frost
rain apex
#

i wonder if they are hire for haunted chocolatier blobcatgooglyblep

safe dragon
#

the fact that I don't think I've ever heard of them probably tells me how out of the loop I am on sdv modding

raw pelican
#

oh my word Aedenthorn has 630 mods, 275 for SDV.

safe dragon
#

that's a few

pliant snow
candid pilot
#

i’ve got everything figured out for a non O(n!) algorithm for fish probabilities. i think it can be represented as a piecewise based on the parity of n (len of list) atm

#

it’s not amazing? probably some quadratic complexity (O(n^2) related) but it took 10 seconds for an n of 50 which is unthinkable with brute force (O(n!))

#

i’ll write up smth for the math later :)

cinder karma
#

Somehow I managed to pull my right arm out of it's socket

#

(It's a shallow socket. It happens. Still hurts )

pliant snow
rotund violet
#

I don't think all the 1.6 devs are prolific modders? At least, I don't recognize all their names, aside from the obvious two or three. I imagine they have some sort of connection to CA, though.

leaden marsh
#

Other than Pathos, we don't list our screen names

#

But admittedly yes, I do not qualify as a prolific modder lol

rotund violet
#

I guess that makes sense. Don't want every random user out there spotting your name on a mod and then seeking you out here as a dev.

sand frost
#

GRANGE is a registered trademark of National Grange of the Order of Patrons of Husbandry, used under license. All rights reserved.

Huh, I hadn’t noticed this before (Stardew website home page)

cinder karma
#

Is this just a known thing?

pliant snow
#

I was once writing a comment at the top of a file beginning with Author: and it suggest some random GitHub user's name, as it had scraped that pattern from one of their files

sand frost
#

Wasn’t there one time someone had it spit out something straight up directly copied from pathos’ mods when it was asked for a Stardew mod?

candid pilot
#

was writing documentation for something once and it just gave me some random person's name

rotund violet
raw pelican
#

which makes sense, most stardew mods are novel material, not boilerplate.

#

which begs the question, if AI code is only good for established boilerplate code, why waste the power in generating it when you can copy paste it from elsewhere.

frosty echo
#

Because lazy

sand frost
#

!chatgptcode

indigo mistBOT
#

Please stop trying to get ChatGPT to write your C# mods for you, especially if you don't know how to write C#. It won't work without heavy editing, and it wastes everyone's time.

Large language models fundamentally are reguritating something from their input—which is roughly speaking, the written output of humanity up until 2021 or so, for ChatGPT. For specific, niche topics like "is this framework going to do what I want" or "which things does Game1.cs have access to", it probably has no idea! But it's good at detecting that people in the past have....said things about frameworks and written things in C#, so it does its best to assemble words and symbols into a nice order for you. Sometimes it tells you true things, and sometimes it tells you false things, and if you can't detect when, you're in trouble. When you're writing code, this usually produces garbage, because you can't be "sort of similar", you have to be exactly correct or it won't work.

rain apex
#

the "mod" is load texture and vague attempt to set farmer texture bolb

#

minimum api version 3.0.0

cinder karma
#

Those five lines of code are correct!

#

I assume it goes weird later

rain apex
#
using StardewModdingAPI;
using StardewModdingAPI.Events;
using StardewValley;

namespace CrowTransformationMod
{
    public class ModEntry : Mod
    {
        public override void Entry(IModHelper helper)
        {
            // Hook into the game events
            helper.Events.GameLoop.DayStarted += OnDayStarted;
        }

        private void OnDayStarted(object sender, DayStartedEventArgs e)
        {
            // Replace the player's sprite with a crow sprite
            TurnPlayerIntoCrow();
        }

        private void TurnPlayerIntoCrow()
        {
            // Check if the player exists in the game
            if (Game1.player != null)
            {
                // Load the crow sprite from your mod's assets
                var crowTexture = Helper.Content.Load<Texture2D>("assets/crow.png", ContentSource.ModFolder);

                // Apply the crow texture to the player
                Game1.player.FarmerSprite.setTexture(crowTexture);
            }
        }
    }
}
#

it does make sense that chatgpt consumed enough open source mods to get the boilerplate correct

worn remnant
#

ContentSource.ModFolder is sending me

safe dragon
#

I've only once seen someone post chatgpt made code for a mod cause I think they posted it here.

I know nothing about sdv modding but even I could tell it was total nonsense

austere comet
#

Helper.Content.Load sounds like it combined Game1.content.Load and Helper.GameContent/ModContent.Load

safe dragon
#

Game1? is sdv using some default generated class name

rain apex
#

yea

safe dragon
#

nice

rain apex
#

i respect that, i often feel unmotivated on project until i come up with good module names

austere comet
#

Can’t wait for 1.7 where we get Game2 /j

cinder karma
tender heath
#

Hello, im having some serious issues with steam. I've uninstalled it and reinstalled it. This is what it does. I'm on windows 10.

#

And it's only the steam app that does that

safe dragon
#

might want to mess with the hardware acceleration setting assuming you can reach it

#

or update gpu drivers

#

if hardware acceleration is on

rotund violet
# sand frost !chatgptcode

Props for the clear, concise, and incisive explanation, though I fear that the people who need to hear it most will be incapable of even reading it in one sitting, let alone understanding it.

safe dragon
#

it’s ok

#

they’ll copy the text into chatgpt to generate a summary

fleet wren
#

'don't, no work, even if look correct'

safe dragon
#

just keep asking for a summary till chatgpt narrows it down to 1 line

#

at which point it has distilled down to “don’t mod”

rotund violet
#

Can you ask it to summarize its summary? I wonder how many iterations that could go on for and what happens when it gives up.

safe dragon
#

I’m curious so I’ll test

#

obviously I don’t pay for gpt 4 so 3.5 will have to do

#

step 1:

If you're unfamiliar with C#, it's best not to rely on ChatGPT to write your mods. While it can be helpful for general guidance, large language models like ChatGPT pull from a broad range of past information (mostly pre-2021), and may not have precise knowledge about specific frameworks or coding details. This means it might generate code that looks correct but isn’t. When you're working with code, accuracy is crucial—being “close enough” won’t cut it. If you're unable to spot mistakes, this approach could lead to frustration and wasted time. Instead, focus on learning C# or seeking advice from experienced developers.

#

step 2:

If you're new to C#, avoid relying on ChatGPT for mod writing. It may give guidance, but its outdated knowledge can lead to incorrect code. Precision is key in coding, and if you can't spot errors, it could waste time. Focus on learning C# or ask experienced developers for help.

#

step 3:

If you're new to C#, avoid relying on ChatGPT for mod writing as it can lead to errors. Focus on learning C# or seek help from experienced developers instead.

#

we’re down to a pretty short message…

#

idk if this is really a step 4 I had to really really ask for this one

If new to C#, learn the basics or ask experienced developers instead of using ChatGPT.

#

lmao

#

If new to C#, learn or ask experienced developers.

#

chatgpt is no longer part of the message

#

it has been boiled down to its purest essence

#

Learn C#

fleet wren
#

further

austere comet
#

Just Learn /s

safe dragon
#

it’s perfect

#

I like how it never at any point complained

austere comet
rain apex
#

crumble going on chatgpt 9000's hitlist

austere comet
#

But what would chatgpt summarize . as

fleet wren
safe dragon
#

manipulate someone else into violence

safe dragon
fleet wren
#

do it 999 times and it outputs the AM monologue

violet gale
#

(oh i'll ping @hoary oasis here since i recall the 'you're making me rethink going to college: found out my cs professors are using chatgpt to create our assignments)
green is the pdf with the skeleton, black is chatgpt because it was throwing an error that literally nothing i googled could find
tldr; i'm no longer going to complete this degree, i'm finishing this semester and giving my uni the middle fingy

sand frost
#

Damn

#

I’m lucky to be at a place that really emphasizes quality of teaching

rain apex
#

how many dollaroos r u pay for this yggy

violet gale
#

me, technically, i'm living off of financial aid and my $1k sub student loan
but my 3 classes cost $3480 usd

hoary oasis
#

My problem is that I kind of need the degree to get a job that would offer the level of physical exertion I'm capable of these days, combined with not having to interact with customers. I can be nice in text, I am not so capable over the phone

rotund violet
# safe dragon Learn C#

Well what do you know, ChatGPT is capable of real intelligence if you just ask it enough times.

sand frost
#

Like every time someone blindly assumes chatgpt stuff works, I’m shocked

#

Especially code: the obvious test is to just run it!

safe dragon
#

in rare cases I do still see job postings that only request a “university level thinking level” instead of explicitly a degree but tbh as far as I can tell they still end up asking for that diploma

violet gale
#

in my city you can get away with a portfolio, so usage may vary

sand frost
#

I get the sense that hiring profs in CS is sort of wonky because they often get poached, so the instructional quality can vary wildly

safe dragon
#

I’ve never run my code ever in my life I know it is correct

hoary oasis
#

Looks like it would work, ship it

rotund violet
#

(Managers don't care about credentials, only HR does.)

safe dragon
#

tbh I have at times pushed a bugfix without actually verifying that it worked

#

for extremely obvious clear cases

hoary oasis
#

Fix it forward programming

#

If it's still broke, just fix it again

safe dragon
#

“the tester will catch it”

#

“why should I test my code when that’s their job”

rotund violet
#

That's not entirely a joke, you know. A lot of shops emphasize MTTR over MTBF, so to speak.

hoary oasis
#

"So-and-so approved it, why didn't they say it was broken?"

safe dragon
#

mttr… money transaction throughput rate

rotund violet
#

Mean Time To Recovery (vs. Mean Time Before Failure)

safe dragon
#

ah

rotund violet
#

If a mistake is not going to cost you millions of dollars, and takes only 10 minutes for someone to correct, is it worth spending 10 hours to prevent it?

#

It's a legit question.

safe dragon
#

that’s some high stakes I am not yet mentally ready for

#

🙏

rotund violet
#

Haha... well unfortunately, most businesses also have a terrible MTTR. But depending on the business (i.e. not quantitative finance) it can be more productive to invest in faster recovery than fewer errors.

violet gale
#

(i'mma throw this in before i go back to letting my brain relax, but a lady went around getting surveys that people had to waive their rights for about how cs majors at my uni has the lowest graduation rate and this really just made me go, "wow you wonder why?")

safe dragon
#

they haven’t figured out yet how to make gpt generate diplomas

rotund violet
#

Lower graduation rates are a positive signal to those hiring, to the extent they care about it at all.

safe dragon
#

I’m a little glad I graduated university before the release of chatgpt

#

for my job out of uni they just asked if I had a degree

#

not much beyond that

#

I didn’t even actually have the diploma yet cause covid had just started which had completely shut down the graduation process

rotund violet
#

Yeah, that's HR ticking the box. Everything's changed. Hiring managers usually don't bother digging into it because the degree is 99% useless.

safe dragon
#

for my soon to be current job I don’t think they even asked

#

knowing about what I did at my previous employer was a lot more interesting

rotund violet
#

Even back when I was a recent grad (no points for guessing how long ago that was), we knew that the degree was only relevant for your very first job out of university.

sand frost
#

My first job was “grad student” 😛

rotund violet
#

Though in a lot of cases, HR still insists on ticking the box.

sand frost
#

But yeah, CS in particular it’s not always clear to me the degree helps

safe dragon
#

idk how I got my first dev job tbh. They asked what REST was in my technical interview and I had no idea. Writing apis was part of the job function. I guess I was cheap enough to gamble on with the lack of other options

rotund violet
#

University used to be a place to either (a) network or (b) become a researcher. I think that was a good system. The "education-to-corporate pipeline" is... not ideal.

sand frost
#

I’m in engineering, where there are stricter rules around accreditation if you want to practice

#

I think that there is value in a CS degree in the sense that learning fundamentals should in theory make you better and more flexible, but the value there is partially just putting together a course of study, since there’s so much online these days

rotund violet
#

Indeed. It's not that there's no useful information in a CS program, just that it's hardly the most efficient way to pick up those skills.

sand frost
#

I also think some universities are more useful than others and it’s not very clear which to a bunch of 18 year olds trying to wade through them

rotund violet
#

(And the credentialization of programming jobs is doing far more harm than good)

safe dragon
#

the value in a cs degree is more the piece of paper than what you learnt there.
For me the biggest value of the CS degree was simply that it forced me through the very awkward beginning phase where doing anything useful feels really daunting

#

I’m guessing for some that access point is writing mods considering the server I’m in

rotund violet
#

For me it was writing cheesy games on 8-bit hardware.

violet gale
#

i think the problem with my uni is that the first two cs classes is only c++, i get that oop is important, c++ is core, but it's definitely one of those "lecture goes over one thing and the assignments are 9 steps ahead"

rotund violet
#

Mods are probably a lower barrier to entry, but I'd still consider them somewhat more illuminating than a standardized CS degree.

#

I doubt very much that C++ is oriented around OOP, in fact it's probably wanting to de-emphasize that particular aspect.

rain apex
#

i learned a fair bit from writing bad php for my friend's wordpress blog

safe dragon
#

C++ was not part of my CS degree at all

#

neither was C

rain apex
#

i did not know php had classes long after i stopped maintaining those scripts

rotund violet
#

Learning C++ requires you learn things that are not simply OOP in the dull Java style, like pointers.

#

Or templates. Or any of the other interesting C++ stuff that's not just classes and methods.

safe dragon
#

C# is where I started in uni and it’s still most of what I do though I enjoy dabbling in other languages in my free time

rotund violet
#

(Though they should be using Rust instead. I'm required to point that out at every opportunity.)

safe dragon
#

of course

#

everyone knows Rust is strictly better than C++ with no downsides

cinder karma
#

Yes

#

Perfect

safe dragon
#

god the amount of people who do genuinely believe this in the bevy server

cinder karma
#

Rust can do no wrong

#

I will not listen

fleet wren
#

did someone mention rust

safe dragon
#

yes

rotund violet
#

I sort of empathize because Bevy really is a very impressive framework. But I mean, so is OpenGL and you don't have the same sort of fanaticism.

#

(or maybe you do. I should ask the graphics guy.)

safe dragon
#

Bevy is really cool which is why I follow its progress but its discord community at least is full of people who genuinely could not imagine anyone preferring any language over rust for any usecase

#

maybe vulkan has some fanaticism but I doubt opengl has any

rotund violet
#

In fairness, I get a similar vibe about Godot.

#

It's the Unity and Unreal guys who go "eh, it's just a tool".

cinder karma
#

I'm going to go throw out all this verilog and write it in rust

safe dragon
#

godot is in that phase rn with all the unity refugees justifying their choices

cinder karma
#

.....I am being told things about what rust does not do

safe dragon
#

idk what verilog is but I had to write prolog for uni and I remember being very confused

rotund violet
#

DiD yOu KnOw RuSt HaS nO-sTd

#

100% perfect for embedded systems

safe dragon
#

just need to interface with C for everything to do anything

#

tbh I don’t really know that I have never touched an embedded system in my life

rotund violet
#

I was half-joking because an FPGA isn't really an "embedded system". But it's the type of thing you'd expect to hear.

safe dragon
#

verse is the future

cinder karma
#

To be fair maybe a rusty variant of verilog would be nice

#

Like clash

rotund violet
#

That's testing the limits of my engineering esotericism. Never heard of clash and have no mental image for Rustilog.

safe dragon
#

I looked up verilog and I saw the

if
begin
…
end
else
begin
..
end```
#

reminds me too much of T-SQL

#

I always forget the end and begin around the else

rotund violet
#

Hey now. Programmers trying to avoid T-SQL have caused immeasurably more damage than T-SQL ever did.

#

If you need a script, you should just write a script.

fleet wren
rotund violet
#

It is definitely more like Pascal. Were it like T-SQL there'd be a "commit" or "rollback" in there.

safe dragon
#

shoutout to the tsql sprocs we rewrote to a series of entity framework queries that ended up being ridiculously slow causing us to need to spend ages figuring out what to do

rotund violet
#

I'm glad I don't really have to deal with trad databases anymore, but when I did, I pretty much always came back to "screw this ORM, I'm just writing SQL".

#

I could spend the next 3 weeks trying to figure out how to make Hibernate do this or... 3 hours rewriting it with a couple of sprocs/functions.

safe dragon
#

tbh I might be faced with making a choice for database interface at the new job and I’m not 100% sure yet what to go with

#

personally I am also really just in the “write some sql” camp

rotund violet
#

The ORM always looks sexy, from far away and after a few beers, but you'll hate yourself when you wake up the next morning.

safe dragon
#

after I spent ages once trying to make entity framework understand where to put a full text search query only for it to generate queries that would crash

#

wondering if I should just pretend I’m stupid and just use LIKE

rotund violet
#

I never had a good experience with FTS in relational databases anyway... though my experience was many years ago. We generally preferred to separate the FTS into something actually designed for it, usually Lucene or something based on it like ES.

safe dragon
#

that’s also what we ended up doing here but there’s some old stuff that was never changed

#

might look into a dapper a bit while I have time off in between the jobs

#

the main other dev is a database guy I could probably convince him not using EF is a good idea

rotund violet
#

The only Oracle guys I've worked with in the past didn't need any convincing at all for that sort of thing, they hated the very idea of an ORM or doing anything important outside the database.

safe dragon
#

yeah I don’t think it’s going to be difficult

#

but I’ll have to check first that I actually like dapper

#

I’ve used it once for like 1 query

rotund violet
#

If it's the same Dapper I remember from like... 2014? Then it's been around for a very long time!

safe dragon
#

oh yeah it’s far from new

#

dapper has always been what everyone tells you to use when you complain about EF (core) being slow

#

that’s where we’ve used it at the current workplace as well

#

replaced some EF stuff that was being slow

rotund violet
#

It's just a result set mapper, isn't it?

#

Doesn't care about your schema.

safe dragon
#

it has some convenience built in and deals with stuff like connection pooling for you but the main use is just for taking the result of a query and mapping it yeah

rotund violet
#

I'm sure there are other tools that do the same type of thing, but that is the general idea. Do the SQL in SQL and use some lightweight thing to handle the transition to Objects.

safe dragon
#

yeah at the bare minimum you can just use the bare ADO.NET the rest is built on top of

#

which I have done but it’s not very ergonomic

#

tbh I don’t see why I wouldn’t pick dapper but I should give it a shot first

rotund violet
#

Back in those days, you could probably argue that one of the major strengths of ORMs was some measure of compile-time safety, i.e. you couldn't crash the system by way of some random typo in the query. But today, I'll bet there's a Roslyn analyzer for that.

safe dragon
#

for some of it yeah

rotund violet
#

And if so, the ergonomics argument is becoming increasingly moot.

safe dragon
#

not quite the level of sqlx in rust though for which the macro version actually asks a configured database if it’s a valid query during compilation

rotund violet
#

Well, we use the tools we've got.

safe dragon
#

also, anything the compile time safety could guarantee can also be guaranteed by making sure you have some unit tests set up which you should have regardless

#

hmm that might be a pain point for dapper

#

it doesn’t seem too easy to unit test

rotund violet
#

I'm not sure how you'd unit test database queries anyway, unless it's really a small-scale integration test with a fake/in-memory copy of the database.

safe dragon
#

sqlx essentially runs your migrations and spins up temporary test versions of your database

#

which does get close to just being an integration test

#

not that I’m one to fuss too much about the difference as long as it tests what it needs to test

cinder karma
#

Tbh I still don't know the difference between unit and integration test

rotund violet
#

Yeah, if you can enforce that all changes to DB schema be done through migrations then that's fine. Don't see how Dapper would get in the way, though.

cinder karma
#

One test is bigger

rotund violet
#

Seems pretty straightforward to me. Unit test is for one essentially indivisible part of a system, integration test is for the whole system or larger combinations of components.

#

Integration tests are "bigger" but it's not their size that makes them integration tests, it's the kind of scenarios they cover.

safe dragon
#

alright most of what I can find for true “unit” tests for dapper come very very close to writing tests that test that your test is working

#

gotta love tests that mock basically the entire process it’s supposed to be testing

#

best to just keep those queries in their own methods isolated away and verify their functioning with regular integration testing you’d do for an api

rotund violet
#

I don't really see what would be different about testing with Dapper vs. any other DB testing. Either way, presumably you are going to spin up some kind of fake database and run a real query against it. So either you test the result without Dapper (running assertions on the ADO object), or you run it through Dapper and run your assertions on the model.

#

I would just consider it to be part of the query?

safe dragon
#

for EF you pretty much have to tell it how your whole db works and it fully understands the query you’re sending so it can mimic the response correctly like 99.99% of the game

#

it just uses an in memory version for the test

#

tbh I’ve never found them particularly useful

#

usually the queries themselves don’t end up being too complicated and you’d write the in between procedural logic in regular C# which you can test just fine

#

I’ll have to just try it out

#

it’s not a dealbreaker beyond hitting some arbitrary code coverage target

#

knowing the company, most of the more complicated queries live in sprocs anyway

#

which EF can’t test either

safe dragon
#

alright yeah this is a nonissue

#

excuse my wall of text

raw pelican
#

speaking of SQL.

#

Spent 5 hours on R homework doing what my knowledge of SQL could have done in 5 minutes, to find out that Alaska Airlines is the worst.

#

I find it very funny that the R developers decided to recreate SQL but worse in R instead of just exporting their dataset, doing SQL on it, and re-importing it, but I have a big bias that I have 8 years of SQL experience and 1 year of R.

safe dragon
#

more balanced than for me

#

I have like 2 months of R experience

#

and most of that was just pipelining data from 1 function to the next

raw pelican
#

well that's most of R from what I've seen so far.

safe dragon
#

I kind of assumed all the preprocessing of data would still be done on sql and only the actual analysis part would be handled by R

#

it's not a field I'm all too familiar with

floral parcel
#

I've been using R for a college class, not really a fan of it. Lmao

hoary oasis
#

As per atra's request: Ew python SDVkrobusgiggle

cinder karma
#

I'm not python's biggest fan but I do like it for tossing together quick little scripts I don't have to maintain in the future

#

My annoyance with python is that it can be quite a difficult language to maintain

hoary oasis
#

I probably should at least learn it, I know basically nothing about it at this point

cinder karma
#

If you can program at all you can program python

#

I promise you that

hoary oasis
#

Lol, that tracks, I kinda feel like most programming languages give that vibe as is

worn remnant
#

as i said, i have no real complaints about it. i only dislike it for vibe reasons. i have never enjoyed writing python, so i eschew it

red crest
#

my only complaint with python is in being forced to use it for a group project this semester for something that id just much rather not use python for

#

which is not the fault of python. but i will take it out on python

safe dragon
#

to me the biggest sin of python is that it plays very loosely with the rules of variable scope

#

I think it’s a pretty bad thing to have for a language that a lot of people start with

#

magically access variables from inside a function that live somewhere outside it

safe dragon
#

because I’ve been looking into C# stuff a lot lately I’ve now been getting spammed with videos about C#

#

mostly tutorials for absolute beginners

#

“what is a singleton”

cinder karma
#

Interesting

safe dragon
#

the next revolutionary research will say maybe

#

having used copilot myself for a while I think mostly just saves me some keystrokes here and there and have found myself “expecting” it complete it so I just wait there for the completion to come in

#

anything beyond letting it finish a section of code has always had really bad results for me though

#

it wrote an ffmpeg command for me once though which I am forever thankful for

safe dragon
#

the sheer number of articles I’ve now found while reading up on a bunch of libraries that I’m like 90% sure were AI generated

rotund violet
rotund violet
# safe dragon because I’ve been looking into C# stuff a lot lately I’ve now been getting spamm...

YouTube's recommendations are the desperate, needy kid you knew in high school who would cling like a lamprey to anyone who made the rookie mistake of acknowledging his existence.
"Oh, you play games too? I love games! I have 500,000 videos on games! Would you like to hear my 30-minute analysis of the story of a game you played and forgot about 12 years ago? I see you listen to music too, I'll bring over my 400 hours of recordings of video game music!"

#

Whatever eventually replaces YouTube is going to have to understand a little thing called "context".

cinder karma
#

YouTube is full of nerds yes

#

Where else can I get comparisons between 36 different brands of silk mohair yarn lol

#

I also like yoga with Adrienne

rotund violet
#

There's no problem with those people being on YouTube; it's YouTube itself that's being the creepy nerd with its recommendations.

#

The YouTube nerds aren't personally going after me and trying to get me to watch their nerd videos. They're just uploading stuff they're interested in. That part's just fine.

rain apex
#

I would like there to be less 5hr long essays about anime characters whose shows are less than 5hr long

safe dragon
#

too bad

cinder karma
#

It's also great for convincing you that you indeed have the skills to diy plumbing

rotund violet
#

In-house plumbing I can sort of deal with, but I'm still afraid to mess around down in the crawl space, despite what YouTube might have to say about it.
Fixing a broken toilet, no problem. Re-piping the entire house with PEX... I think I'll let the pros handle it.

candid pilot
#

i've always hated showing my work idk how to write a coherent math writeup with latex this sucks

safe dragon
#

I tried to fix a leak from my kitchen sink like 3 times

#

it'd work for a little while each time

#

ultimately ended up just getting a plumber...

safe dragon
candid pilot
#

i solved the math problem and it works and i understand the entire process. why can't other people just understand inherently too

cinder karma
#

You could try

#

Giving me or Elizabeth broad

#

Strokes to see if we get it

candid pilot
#

the problem was the one that romayne brought up a while ago. I've had it solved i just want to be able to explain my process 😭

#
Let $c_1, c_2, c_3, ..., c_n$ be rational numbers between 0 and 1. The following process is applied to them:

\begin{enumerate}
    \item Randomly shuffle the numbers.
    \item Select the first number.
    \item Generate a random rational number between 0 and 1.
    \item If the random number is less than the selected number, the selected number is the output. If not, select the next number and go to step 3.
    \item If no more numbers can be selected from the list, no item is selected.
\end{enumerate}

Given the above process, for all possible random shuffles, what is the percentage (expressed as a number between 0 and 1) that you will get each number from the list?
#

here's a bit of the writeup for it

rain apex
#

discord latex support when

candid pilot
#

LITERALLY

#

i think bots exist. whatever

#

i wrote a kind of rant-y overview of the problem. i'll just send that.

#

I rely on the wealth of symmetry this problem has. let's focus on a single value, $m$.
let all other values be represented as $x_1, x_2, x_3, ..., x_{n-1}$. for all $j$, let $d_j = 1 - x_j$.

lets start by analyzing how the probability of getting $m$ is affected by its index in the random shuffling.

If $m$ is first, the chance of getting $m$ is just $m$ itself. This happens $(n - 1)!$ times, given all possible random shuffles.

if $m$ is second, there is a number before it in the list. that means that the chance of getting $m$ is $m(1 - x_1)$ or $m*d_1$. Any $x_j$ can be in front of $m$ in the list, meaning across all random permutations every other value has an effect on the probability of $m$. The amount of times a specific value appears in front of $m$ across all random shuffles is $(n - 2)!$. So the probability of getting $m$ across all shuffles where it is in the second index of the list is $(n - 2)! * m * (d_1 + d_2 + d_3 + ... + d_{n-1})$.

#

for further indexes, i'm going to need to use elementary symmetric polynomials. Let $e_{k}(S)$ be the elementary symmetric polynomial of degree $k$ of $S$. We also let $D = {d_1, d_2, d_3, ..., d_{n-1}}$. We will let $e_0(...) = 1$. We can now rewrite the previous calculated probability as $(n - 2)! * m * e_1(D)$

for $m$ in index 3, there are two unique values in front of $m$ at any time. The probability for $m$ is therefore $d_1 * d_2 * m$. The amount of times a specific set of 2 values (accounting for multiplicative commutativity) appears in front of $m$ is $(n - 3)!$. Accounting for multiplicative commutativity, there are $2!$ unique orderings of the same values in front of $m$. We can find the probability of getting $m$ when it is in the 3rd index across all possible random orderings is $2! * (n - 3)! * m * e_2(D)$.

this finding can be generalized. for an index $i$, the probability of getting $m$ in that index across all possible random orderings is $(i - 1)! * (n - i)! * m * e_{i - 1}(D)$.

we can sum that up across all indexes:

$\sum^n_{j=1} (j - 1)! * (n - j)! * m * e_{j - 1}(D)$

we can factor m out, getting:

$m * \sum^n_{j=1} (j - 1)! * (n - j)! * e_{j - 1}(D)$

now, we average it across all possible random orderings:

$\frac{1}{n!} * m * \sum^n_{j=1} (j - 1)! * (n - j)! * e_{j - 1}(D)$

and this should solve for the probability of any value in the list, given an input of $m$ being that specific value, and $D$ being the set of all values that aren't $m$ run through the function $1 - x$.

#

SORRY

#

a ton of unformatted latex

sand frost
#

What’s the problem you’re having? This looks like a reasonably plausible writeup módulo the part where I stopped bothering to do the math in my head partway through.

sand frost
#

I always told my students that if they could convince me something was true, that’s a proof

candid pilot
#

i've never written something formal/rigorous. does it need to be all serious or is this fine 😭

sand frost
#

Is this for a proof-based math class? In general this seems pretty decent

candid pilot
#

no this is for my own purposes i just wanted to solve the problem romayne brought up

sand frost
#

The “if m is first” chance explanation I’m not fully sure on

#

Ohhh, if it’s just for you then this is totally fine

candid pilot
#

i've never written up anything before and wanted to try it out and it was a lot harder than i thought

sand frost
#

It gets easier with practice

candid pilot
#

ok i think i'll use this, i'll definitely edit it a bit for clarity but if it doesn't need to be like super serious that's good to hear

sand frost
#

Writing something you can understand is way more important than writing something formal

#

In fact, writing something that is formal and impossible to understand is bad

#

Formality should be used as a tool to achieve rigor, not just for its own sake

candid pilot
#

thank you :)

loud zealot
#

Is this the place to ask non-modding related Stardew Valley stuff

fleet wren
#

not really? there's at least 5 other channels

#

though this channel do have a common tendency to swirl into on topic stuff

loud zealot
#

oh hang on, no, I meant non-modding related SDV programming stuff.

#

I'm not really modding the game, but working on something related to SDV.

fleet wren
#

that's indeed a gray topic, but usually we also use making-mods-general for that

rain apex
#

Sdv talk is banned here \j

fleet wren
#

is talking about talking about SDV banned

rain apex
#

I second usage of #making-mods-general even if it's not a game mod, that is what happened with the fishing stats math in the end

loud zealot
#

okay then

safe dragon
#

this is for non sdv nerd stuff

#

the fishing stats scared me

#

nothing more frightening than statistics

cinder karma
#

Peak changelog

#

Never a more honest or better changelog

pliant snow
#

Fixed known bugs, added exciting new unknown ones

cinder karma
#

It's actually a pretty good watch but the app is super unstable

pliant snow
#

oh its kinda fitbit esque

cinder karma
#

Yup! But I really like the built in GPS, it's quite accurate

cinder karma
#

The nerd posted!

raw pelican
#

have yall ever seen Oracle documentation?

#

It's so hit and miss but it's always frustratingly vague as to what actually got fixed and if it is actually fixed.

#

And every single update has a line that says "fixed security vulnerabilities against blind queries". Maybe one day they'll finally close it off.

candid pilot
#

n is the length of the list
e_x(S) is the elementary symmetric polynomial of degree x of S
D is every item in the list that isn’t c_k run through 1 - x

safe dragon
#

I've certainly seen worse

#

do I know what a symmetric polynomial is? no

#

but I have seen worse

candid pilot
#

symmetric polynomials are actually really cool i learned about them for this project

bitter kiln
candid pilot
#

oh hi romayne. the perpetrator of all of this

bitter kiln
#

yar

safe dragon
#

functions per minute is an interesting metric

candid pilot
#

indeed

bitter kiln
#

yeah lol it was just what i felt like doing

candid pilot
#

i get like 30-40 hz on a list of length 20 ish

bitter kiln
#

i also did just run a test for time to complete function for list lengths 10-68

#

horrible formatting but i did just throw it together for the sake of it

candid pilot
#

oooh the slope

safe dragon
#

atra wishes they had runtimes this short

candid pilot
#

this is in python so

bitter kiln
#

yea

candid pilot
#

i imagine its better on an actual fast lang

bitter kiln
#

it could do better in a different lang but honestly for the use case thered be no need to port it

candid pilot
#

i could make that fishing probability mod without sampling

bitter kiln
#

yeah!!

#

just need one thing to actually do that proper

#

targeted bait

candid pilot
#

eventually

bitter kiln
#

;o

#

tbh id be content with there being a solution to that

pliant snow
#

some day I should learn some sort of server side language other than just PHP

#

but the web confuses me and php you just kinda... stick in there and it do things

rain apex
#

I mean doesn't every language has some kinda rest api library think

pliant snow
#

see thats already more complicated, im retreating back under my rock

#

im like a hermit crab, living in 1990s webland

rain apex
#

I POST u pls respond

pliant snow
#

im just a humble soldier making websites that are just barely above static pages

#

html that just occasionally calls a function, thats my jam

worn remnant
#

the modern web is a hellhole and i respect you for hiding under your rock

pliant snow
#

I know just enough to get simple websites working, and I see everyone else bemoaning it and I wonder what Im missing out on

worn remnant
#

overengineering, terrible performance, and antifeatures

cinder karma
#

Tbh I used to know django

#

My last attempt at web was years ago, involved Ajax, and betrays my age

#

Also tbh all I want for myself is a nice little sexy static site

#

Anyways

pliant snow
#

My personal site is static with just a touch of javascript so I could reuse the header bar because I couldn't figure out how to do it without it

cinder karma
#

I am soooooooo close to finishing this cardigan

#

Literally just the shoulder caps to go

pliant snow
#

but for stuff where I just need basically a static site that accesses a database, I just always use PHP and thats it, and wonder if theres not a greater destiny out there

cinder karma
#

And some detailing like elbow patches

#

Unfortunately I am not capable of staying awake any longer

#

Night night!

worn remnant
pliant snow
#

thats not peak website

#

maybe ruby on rails would be worth looking into...

#

then id move into hiding under a 2000s rock

cinder karma
#

Django

#

Unless you really want ruby

rain apex
#

I enjoy the Index of /path page

pliant snow
#

im having chatgpt show me examples of each lol

rain apex
#

Streaming services should just be that tbh

pliant snow
#

django seems like it has a lot of fiddly config stuff

#

god php is still so much simpler than the others

#

i regret nothing

#

its the children who are wrong

rain apex
#

Do you have actual need of fancy one page app or whatever LilyDerp

#

If not then php just werks

pliant snow
#

No, I literally just need to make SQL queries and thats it lol

safe dragon
#

ruby on rails would be so overkill

#

I don't think you'd even like having to use active record instead of just slapping together a sql query

safe dragon
#

there's lots of good simple server side options available though they're not hip rn

pliant snow
#

I was mainly annoyed fighting with PHP in docker, but I think it's all still way better than the alternatives I've seen

safe dragon
#

a lesson forgotten by web devs

#

if you're not building a website with complex interactivity requirements, don't choose your tech as if you are

#

people building regular fuckin company websites that could be achieved with nothing but html and css deciding to load in several MBs worth of Javascript dependencies just to render the page

pliant snow
#

I think their tutorials are better now, but when I first starting looking into webassembly, all the guides went into seting up NPM and adding hundreds of dependencies to get it running. I eventually figured out the correct incantation to just have it compile into a single blob and autogenerate like 50 lines of JS bindings instead

#

its a goofy language, but PHP seems to do exactly what I want it to do

safe dragon
#

could even decide to switch to laravel...

#

stick with php...

pliant snow
#

ive heard the name before but know nothing about it

#

is svelte useful for this, i also donno its benefits either

safe dragon
#

svelte's main selling point is having the website automatically respond and update to state changes while mostly sticking to regular Javascript

#

svelte itself isn't even on the server though

#

that's a client side framework

#

sveltekit is the standard server framework part you'd use to deploy svelte with

#

not technically required tho

#

what is the thing you need that php isn't giving you

pliant snow
#

noting at all

#

im just seeing if the grass is greener

safe dragon
#

it is if you actually have complex requirements

#

but your usecase is more on the side of looking into what they call "static site generators"

pliant snow
#

This is somewhat unrelated, but it's always annoyed me that HTML doesn't have any sort of "import" mechanism. That way you could define like a header bar in one file and just import it elsewhere. It has to be done in JS or on the serverside

#

yeahhhhh

#

My requirements are "read from a SQL database and render basic bitch HTML from it" lol

safe dragon
#

you want components in your html hc_pensive

pliant snow
#

who doesnt

safe dragon
#

good question

#

I think essentially every single modern web framework adopted the component model

#

in some form

#

okay maybe not htmx

#

htmx' wild innovation is simply being html in a world where http requests weren't limited to forms

#

I don't think it does anything else

safe dragon
#

this is a very cryptic thumbnail

#

I can't immediately see what it might be about

#

well

#

the answer is apparently just "by making projects"

#

with a few examples given in the video

pliant snow
#

as opposed to what

safe dragon
#

endlessly watching tutorials

#

I have known a few people who did that

#

just endlessly following tutorials and online courses but never building anything

pliant snow
#

they are accumulating knowledge

#

preparing for the day to harvest it

safe dragon
#

they will enter the job market knowing everything and having never touched a keyboard

pliant snow
#

theyre a theoretical engineer

raw pelican
#

Fill your github with something, and make a tiny change every day so you have a big green board.

#

Employers love that. They won't look at details.

pliant snow
#

employers LOVE this ONE EASY TRICK

#

repository FIVE WILL SHOCK YOU

safe dragon
#

reminds me of when a bunch of repos I followed all got "spelling fix" changes which was some bot farm trying to create github accounts with good stats

raw pelican
#

My commit history is just an easy way to track when I have free time.

safe dragon
#

mine is a great indicator of when advent of code is going on

pliant snow
#

its interesting how mine has similar patterns year after year

#

like im always less active in the fall for some reason

safe dragon
#

I'm not consistent enough to even have any pattern beyond "suddenly in december he has started doing commits daily"

#

maybe someday I will work on some github project where I can use my personal account and my activity will look incredible

raw pelican
#

I have bursts, a big chunk of commits when I get the itch and then months of silence. Only recently (last two months) it's been getting more consistent.

safe dragon
#

my soon to be employer also works azure devops just like my last one though so no github contributions

#

a shame smh

raw pelican
#

I got 8 years of sql experience and very hard to show examples.... our work has a weird open source system where we can freely share with other institutions of a certain type but can't share outside of that.

safe dragon
#

everything I've worked on has been locked away for no one else to ever lay their eyes upon

pliant snow
#

if you write code, but dont post it to github to show off, did you really have a job

safe dragon
#

I will make sure to publish my company's codebase when I leave so that I have proof I did something

#

actually

#

there's a risk they'll actually look at it

#

which is a bad idea

pliant snow
#

squash all, make yourself the author

safe dragon
#

I don't want to be attributed to 99% of the code in that codebase

#

including my own

raw pelican
#

I've never applied to places that asked for code so the github is more for building a grad school application portfolio, which means besides the R things I need to make a personal project in Python.

safe dragon
#

time for a django website just to fit some random criteria

raw pelican
#

I do have an idea for one, need to write it down.
Or just re-do more Euler's problems but in Python, that's the lazy way.

safe dragon
#

euler problems hc_pensive

#

advent of code for people who understand math

raw pelican
#

It was a good way to dip into a language when you don't know what to start with.

#

Spent a long time making a palindrome finder in R and then after submitting the answer, found that R has a rev() [reverse] function.

safe dragon
#

lmao

#

I had to make one in prolog once I think

raw pelican
#

the prime-checker ones were also fun to try to figure out before knowing that the sieve of eratosthenes exists.

cinder karma
#

Lol

raw pelican
#

I had not heard of advent of code, I'll have to check that one out.

safe dragon
#

join us in december...

#

I will probably be very busy this december so I don't actually know if I will have the energy for it this time

raw pelican
#

I will probably have time since classes end early december. Does it have a desired language or are they agnostic to anything you want to try it in?

safe dragon
#

you don't actually submit the code, just your answer so you could write it in whatever you desire

#

some have opted to try and solve them in vimscript or excel before

raw pelican
#

ok that's like Euler then, each problem you just submit the numerical answer and then you get access to the secret forums where people post their code if they want.

safe dragon
#

in this case the secret forums is just a reddit thread

#

advent of code basically starts super easy on day 1 and then progressively ups the complexity (and time commitment...) till the 25th

#

like a strange advent calendar

#

the 25th one is usually fairly easy and quick to solve

raw pelican
#

makes sense, gotta let you open your presents.

safe dragon
#

it's fun

#

I've been doing it with a bunch of friends every year for a while now

rain apex
#

Exciting, I'll see if I can rope anyone into doing it with me

safe dragon
#

usually people start to fall off near the last few days as they get more time consuming to complete

pliant snow
#

the first week is trivial, then by week three you're spending 6 hours a day on it

safe dragon
#

or you know exactly what to do and it takes 10 minutes

cinder karma
#

Lol

pliant snow
#

or you know exactly what to do and it takes 6 hours

safe dragon
#

yes

#

spend 3 hours cause you get the wrong answer not knowing what you fucked up

candid pilot
#

bc like. (1 + a)(1 + b)(1 + c) = 1 + e_1(a,b,c) + e_2(a,b,c) + e_3(a,b,c)

rotund violet
# safe dragon people building regular fuckin company websites that could be achieved with noth...

Not exactly that simple anymore. Even a small business usually needs some kind of social media BS, an appointment system, analytics, maybe a payment processor... and normal humans being the fickle beings they've always been, you get more click-throughs when you've got carousels and parallax and junk. This is descriptive, not prescriptive, by the way; I'm not arguing for what should be mandatory for a typical website, only what is.

#

SSGs are fine and good, but I consider the comparison to frameworks like Svelte/Next/etc. to be a category error. SSGs are an alternative to CMSes and database-driven sites, regardless of how the frontend is done.

safe dragon
#

I was mostly thinking of the website my company has which is unimaginably slow despite having nothing I can find that should require more than a few lines of javascript at most

#

but I just checked to see if I could figure out the tool that was used and it's wordpress

#

makes me wonder why it's so sluggish

pliant snow
#
for (i = 0; i < 10000000; i++) {
    // If the boss ever demands we speed up the app, delete another zero
}
safe dragon
#

at least the SEO score is good

#

wtf

pliant snow
#

your company's website?

safe dragon
#

yeah

#

their marketing website essentially

#

seems like there is 7.5 MB of javascript and 12 MB of "typed arrays"

#

also 1MB of strings

pliant snow
#

thats... a lot of text

lethal walrus
#

20mb.. per load?

safe dragon
#

yes

#

well

#

30 MB per load

worn remnant
#

it's nine years old! the numbers in it seem charmingly small by today's standards

pliant snow
safe dragon
#

lighthouse

#

built into chromium browsers

safe dragon
pliant snow
safe dragon
#

well at least you score very well on peformance!

pliant snow
#

thats stardew.chat

#

my own site is both better and worse

#

its all about how i handle images

safe dragon
#

you score better cause I told you years ago to use webps you're welcome

pliant snow
#

and its still complaining about the ones that arent

safe dragon
#

complaining about the gifs

pliant snow
#

you know what, fine, i'll make them webps

#

no theyre pngs still lol

#

actuallly i dont think anything is a webp, i used svg instead

safe dragon
#

svgs are nice

pliant snow
#

you know what

#

im gonna get all 100s

#

i'll show you chrome

safe dragon
#

reach that arbitrary 100 goal

pliant snow
#

that way my SEO will be good

#

even tho i think it only checks the homepage

safe dragon
#

every page would get a different score

pliant snow
#

most of its complaints are my header bar, so actually it would improve a lot across the site

safe dragon
#

lighthouse hates my own website cause i added a robot.txt blocking web scrapers

#

smh

pliant snow
#

im here to give AI bad ideas

safe dragon
#

on your own front page it seems pretty straight forward

#

add caching headers to the served images, replace the pngs, add a viewport meta tag

#

and stop being hostile to people with disabilities smh

#

my company's website is an enigma though

#

I can't tell what it's even using all this for

pliant snow
#

its mining crypto for your pension

safe dragon
#

a full 1 second is spent during loading simply on firing timers

#

it's all minified so idk what it does

cinder karma
#

Lol

#

Fuck wordpress

#

It is my nemesis today

#

(I will not elaborate)

#

(Not sorry)

safe dragon
#

there's so many plugins on this website

#

let me see if my new employer's website is better

#

it will be the sole metric I will be judging them by to see if I picked right

#

ok good

pliant snow
#

your first job is to get that into the 90s

safe dragon
#

as far as I can tell this one is manually written with no dependencies other than jquery and slider.js

cinder karma
#

What's best practices here

safe dragon
#

same for both, chrome is warning about the fact that 3rd party cookies are used which will be phased out

#

but

#

ironically

#

in both cases those cookies are coming from google analytics