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
Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
Do they also define IS_THE_SAME because if so I'm behind them.

Adbot
ADBOT LOVES YOU

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

ultrafilter posted:

What Every Computer Scientist Should Know About Floating-Point Arithmetic

Coming in at a mere 45 pages, this should be top of your summer reading list.

Jesus the text is really small too

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
I've been really impressed with how big I can make Javascript arrays recently. I had to write a script that would do something to all the records in a table and I basically just went ahead and fetched them all. There were some few hundred thousand records Javascript totally dealt with it.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
Strip everything except brackets from the string, if it's an odd length fail, then match half the indexes against the opposite using a switch statement.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
Something like
JavaScript code:
function check(str) {
    const chars = str.split('').filter(char => '{}[]()'.includes(char));
    if (chars.length % 2 !== 0) return false;
    while (chars.length > 0) {
        const [start, end] = [chars.shift(), chars.pop()];
        if (start === '[' && end === ']') continue;
        if (start === '{' && end === '}') continue;
        if (start === '(' && end === ')') continue;
        return false;
    }
    return true;
}

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

Not in test cases, therefore not my problem.

In honesty 90% of a technical interview is seeing how you solve/iterate on problems. So add test case and fix.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
I'm sorry I cannot read your code because I am not a terminator.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
ma galaxybrain

JavaScript code:
const START = '{[(<';
const END = '}])>';

function check(str) {
    const buffer = [];
    for (const char of str) {
        if (START.includes(char)) {
            buffer.push(char);
            continue;
        }
        const index = END.indexOf(char);
        if (index > -1 && buffer.pop() !== START[index]) {
            return false;
        }
    }
    return buffer.length === 0;
}

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

Cuntpunch posted:

I know a developer who, after spending 3+ years working purely in C#, would still copypaste StackOverflow answers written in java - without realizing it was a different language - and then lose an entire day of work trying to figure out why the compiler kept bitching about the @SomeAttribute poo poo in his code, despite it CLEARLY working in the answer.

So if you're able to read a given piece of contextless code and realize whether or not it's even written in your use-case language. You're already doing better than *some* people who make a living developing software.

I worked with a guy who was convinced he improved Javascript with a horrendous utils directory. He obfuscated everything you could do in Javascript, if statements, filter, map everything, to the point where no code anywhere was anything more than function calls within function calls all the way down.

He was absolutely certain that it was superior to vanilla Javascript and wouldn't listen to a drat soul who told him to stop doing it. He worked at the company for like a year driving everyone insane.

Nolgthorn fucked around with this message at 21:36 on Jun 18, 2019

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

sunaurus posted:

Nobody can beat this guy

This is his best work, probably

Yeah that's the type of bullshit I was talking about. I'm pretty sure these people have brain damage, they certainly aren't self aware enough to avoid getting hired.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

poemdexter posted:

https://www.linkedin.com/in/jonschlinkert/

His linkedin profile is the best. president and founder of so many things, gives talks about entrepreneurship, and also somehow the #1 maintainer of npm with over 400 modules. Watch out Elon Musk!

His 'ansi-cyan' library is used in 223,321 other repositories. It's enough to make me quit programming.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
I'm pretty sure npm has given me extremely serious ptsd, in line with what soldiers returning from Vietnam must have experienced. Or maybe worse. I think all the blue haired developers working there should pay for my therapy, while a replacement is finally made. I suggest namespaces for one thing. The ability to delete repos, mainly just to discourage overuse of modules, and to encourage people to make their own forks. I think if your super popular library needed to manually stay up to date with dependencies which may or may not still exist, you'd feel encouraged to limit your use of them.

Nolgthorn fucked around with this message at 14:20 on Jun 20, 2019

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

There are a great deal of real concerns surrounding the use of 3rd party code no matter what. Most people do not check the code they are implementing and subsequently running on their server. The hope is that at least somebody out there is but there really are so many libraries that are used in so many places, it would be difficult to keep up with it.

Libraries are often dependencies of dependencies of dependencies and are always the latest patch version which isn't necessarily "only" a patch.

This isn't an issue with frontend either, quite probably much more damage could be done on the backend. Npm is fundamentally broken. And at the exact same time radically overused.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

xtal posted:

In a utopian future, we would all have a single left-pad or is-odd implementation that we decided was optimal as a community.

What? In a utopia I have to learn what implementation was decided on by a community for every stupid thing? If I want to add padding to a string, it might be my requirements for padding are very specific and easily described in code that I write myself.

What type of utopia is this imaginary hellscape? I feel like the suggestion itself is so bad that I'm already in hell.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
Here is a talk done about that npm fiasco.

https://www.youtube.com/watch?v=2cyib2MgvdM

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

xtal posted:

This is partly correct, and I encourage you to move it toward completely correct. If you have special requirements for string padding that aren't included in the One True Left Pad, send a patch. That would be a better idea than writing it yourself, forgetting the edge cases contributed by others in your same position, needing to write tests and maintain it and so on.

There is absolutely no reason to cover every single edge case. I know what my code is doing and what to expect out of it and if the requirements change I can easily change my code. There are very few packages that are justified such that they fulfil a relatively complex yet similarly specific task.

All the rest of it is people looking for projects to contribute to instead of building something.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

Ola posted:

A dumb question: Isn't there huge amounts of user friendly tooling that makes C easy and safe by now?

My understanding is that "user friendly tooling that makes C easy and safe" refers to every programming language that came after C since they are all built with C and you are not meant to ever actually use C.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

Junkiebev posted:

"Our logs don't show any errors"
:goonsay:

There isn't a court that wouldn't convict.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

wolfman101 posted:

This. Also, learn to love encapsulation and stateless functions if you want to get the most out of testing.

Stateless is the way. I don't understand why every classroom I ever attended tried teaching me object oriented.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

Presto posted:

I'm a battle-scarred old C programmer, and I will happily take smart pointers, because then the memory gets released automatically and that's one less thing I have to think about.

A C programmer who doesn't like memory allocation? What in the world

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
I don't think I'm complaining too much about my ORM having an 'engine' component written in rust that is 2.5GB in size and requires me to build it myself. My host where I'm trying to put it is running FreeBSD13 for which the ORM doesn't have pre-compiled binaries. I'm currently moving 2.5GB of who knows what onto the host so that I can pray that I can build it.

The ORM is Prisma by the way.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
Ok well I spent all day today trying to get a javascript npm module to run on node. I'll wake up with a brilliant idea I can try, I'll try it as a curiosity. Then I'll spend all day tomorrow replacing the ORM in the project.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

abraham linksys posted:

personally i would not use the ORM created by a company that originally raised money to be a GraphQL-based backend-as-a-service, then pivoted to being a GraphQL query engine as a serice for existing databases, then pivoted to being an ORM for all databases and languages, and now appears to have burned $40 million dollars in venture capital on building a TypeScript ORM

anyone remember "gatsby"? love that they got a bunch of people into their open source project, then when everyone started having more mature sites and their build times started creeping up, they introduced a paid gatsby cloud project that was the only officially supported way to do incremental builds, and then they got bought by netifly and now the entire project is very dead :allears:

I remember when a client wanted me to build them a gatsbe project and I did and then they had a bloated application that was way more complicated than what they needed.

Adbot
ADBOT LOVES YOU

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

GABA ghoul posted:

I think there is a very clever solution for this that could save a lot of work

code:
if (number < 0)
 number = int.Parse(number.ToString().Replace('-', ''))

I want to know if I can get this through code review, don't tempt me Satan.

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