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
abraham linksys
Sep 6, 2010

:darksouls:

Nolgthorn posted:

It seems like, using this tool, and I could be wrong... is it possible, that a library as large and as popular as knexjs is the culprit? I would love to say no but when I inspect this it seems like knexjs leaves an open socket and one of its dependencies leaves a running interval.

What the heck??

God I feel like I hate this industry sometimes.

Interesting! I use knex and I don't think I've had this problem, but I also use this trick to ensure all db interactions are captured in a rolled back transaction, which might help?

https://github.com/thomasboyt/jam-buds/blob/master/api/src/__tests__/index.spec.ts
https://github.com/thomasboyt/jam-buds/blob/master/api/src/db.ts

Adbot
ADBOT LOVES YOU

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
Thank you for the suggestion. I'm using mysql with knexjs, I've just tried using mysql2, I've also tried using a transaction, but it's the same result unfortunately. It seems to be the resource pool, combined with mysql, somehow because when I eliminate the use of any sql queries the tests don't hang.

I also limited the connection pool to `{ min: 1, max: 1 }` and have the same result.

Ghost of Reagan Past
Oct 7, 2003

rock and roll fun

my bony fealty posted:

Does anyone have a Windows bash client they particularly like? I tried out Hyper and it's great except for the fatal flaw that killing a server or webpack watch via keyboard doesn't work. Well, sometimes it does...after hanging for several minutes. I'm using git bash with it which by itself does not have that problem.
Do you have Windows 10?

If you do, welcome to the future, just run Ubuntu in Powershell.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
I need an article explaining how to stay calm in programming, and also why. I can't wait to eventually figure out that I did something wrong, if not I am paring this down to the exact commit that is wasting all of my brain energy.

teen phone cutie
Jun 18, 2012

last year i rewrote something awful from scratch because i hate myself

We use this at work, but I have yet to install on my machine at home.

What are the advantages of this over Git Bash?

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Grump posted:

We use this at work, but I have yet to install on my machine at home.

What are the advantages of this over Git Bash?

WSL is basically a full Ubuntu install, so you have The Power of a full linux install available inside Windows.

code:
> apt-get install lynx

teen phone cutie
Jun 18, 2012

last year i rewrote something awful from scratch because i hate myself
yeah - I guess I should have been more clear.

I've only ever used Windows my entire life, so I'm not really sure what's actually available on Linux

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Grump posted:

yeah - I guess I should have been more clear.

I've only ever used Windows my entire life, so I'm not really sure what's actually available on Linux

That's kind of a difficult question to answer. It's like asking "what good is the internet?". The easiest and most general answer is that most tools that you use in web development are built for linux and then shoehorned back into Windows, so the experience is often just better. Faster updates, less bugs, most help/tutorials/faqs you encounter is focused on linux or mac (which is linuxy-enough in most cases).

I spent years running Ubuntu in a VM on my windows host to do my development in because it was that much better.

On top of that, many people are more productive working from the command line, and the command line on linux is vastly more capable than cmd.exe.

All of that being said, I no longer use a linux VM and develop straight on windows because the situation has improved enough that it's not really an issue for me.




IN OTHER NEWS...

I stumbled across this article that I wish I had read back in the day when I was first getting forced into using browserify (and then webpack):

Why would I use a Webpack?

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

Nolgthorn posted:

I need an article explaining how to stay calm in programming, and also why. I can't wait to eventually figure out that I did something wrong, if not I am paring this down to the exact commit that is wasting all of my brain energy.

It is supposed to keep running indefinitely. And I am supposed to know that and if I want for whatever crazy reason, like I'm writing tests or something like that for it to stop then I should call `knex.destroy()` in my after hook.

duh

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.

Anyone have experience running docker on this Ubuntu shell install?

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

Nolgthorn posted:

It is supposed to keep running indefinitely.

I think if I were writing a library that depended on essentially a server instance running in the background. I wouldn't make it magically start the first time the library is used, I'd make that explicit and give the dev access to and control over it. But that's just me.

my bony fealty
Oct 1, 2008


Really cool, I'd heard vague stuff about this but didn't really know it was so full-featured. I don't think I need to full power of this currently, but I have been doing more Ubuntu stuff on Digital Ocean recently so might explore it more in Windows.

Decided to use VS Code's integrated terminal for now and loving it. The convenience and terminal splitting is really great. Only wish you could have more than 2 split panes.

The Fool
Oct 16, 2003


I use ConEmu in quake mode.

Tabbed powershell, cmd, bash and even putty always on top.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

The Fool posted:

I use ConEmu in quake mode.

Tabbed powershell, cmd, bash and even putty always on top.

"quake mode" reminded me of a Quake (the game) mod that added an enemy for each PID on a machine and to kill the process, you'd shoot the grunt with the PID you wanted on his chest. I can only find screens of the original DOOM version though. Or maybe it was DOOM only and my :corsair: brain is confused....

Tei
Feb 19, 2011
Probation
Can't post for 3 days!

Lumpy posted:

"quake mode" reminded me of a Quake (the game) mod that added an enemy for each PID on a machine and to kill the process, you'd shoot the grunt with the PID you wanted on his chest. I can only find screens of the original DOOM version though. Or maybe it was DOOM only and my :corsair: brain is confused....

I think it was doom. Not that they could have made with Quake, but it was the Doom modders that had the idea and implemented it.

Capri Sun Tzu
Oct 24, 2017

by Reene

Lumpy posted:

"quake mode" reminded me of a Quake (the game) mod that added an enemy for each PID on a machine and to kill the process, you'd shoot the grunt with the PID you wanted on his chest. I can only find screens of the original DOOM version though. Or maybe it was DOOM only and my :corsair: brain is confused....
This would be so much more metal as a virus that deleted files for each enemy killed. Like an amped up version of the Casino malware.

The Fool
Oct 16, 2003


Capri Sun Tzu posted:

This would be so much more metal as a virus that deleted files for each enemy killed. Like an amped up version of the Casino malware.

https://kotaku.com/5400213/the-dangerous-video-game-you-werent-supposed-to-play

Skandranon
Sep 6, 2008
fucking stupid, dont listen to me

quote:

"I think the people who've played it have added an important element to it," he said "In demonstrating that they value their data differently."

Or they are playing it inside a VM for the purpose of them being deleted? Wtf is this nonsense?

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
I built file roulette a really long time ago. You could set it to play with a specific file or any random file on the system, 1 in 6.

huhu
Feb 24, 2006
Not sure if there's a better place to post this, I looked around but I didn't see any other good threads.

What is the best way to deal with data in a React Native app these days? I'm coming from React and Redux. My searching says Redux and Realm could be a solid choice. My app is only going to store a small collection of data per user so I'm wondering if I could even get away with Async Storage.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

huhu posted:

Not sure if there's a better place to post this, I looked around but I didn't see any other good threads.

What is the best way to deal with data in a React Native app these days? I'm coming from React and Redux. My searching says Redux and Realm could be a solid choice. My app is only going to store a small collection of data per user so I'm wondering if I could even get away with Async Storage.

My personal experience is that Async Storage is the way to go until your data gets so big it's not viable any more.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Anyone here using a comment system for a gatsby site that they like?

I'd like to avoid Disqus because they kinda suck and I'd prefer something self-hosted. Talkyard seems ok...

Honest Thief
Jan 11, 2009
Have a bit of an production pipeline upgrade problem, the current project I'm on is a tad outdated and currently the frontend pipeline, without getting into how it handles CSS and resource files, is something like this:

Gulp creates a bunch of page specific scripts, which scripts go into which bundle is maintained on a json config file, afterwards it runs uglify and so on.
The problem I'm facing is that the scripts only solve their interdependencies on the client side since require.js is served alongside other clientside frameworks; to be more clear, page specific scripts have require calls spread around in their code, and during gulp bundling is all good because gulp doesn't care if homepage.js needs some module defined on some other script.

As a first step I wanted to keep most scripts as-is while solving the interdependencies on build time, which was something not done before. The idea was to improve build times on the legacy project and keep it more in line with the more recent version, which does away with it all.. but it seems not such an easy task.

Honest Thief fucked around with this message at 17:46 on Apr 4, 2018

Hadlock
Nov 9, 2004

I have a need for a way to visualize a json file as one box per nested json object on the screen using css grids. Basically the page would request/receive two identical, or nearly identical json files, like a daily report in json format, each root (level 0) and level 1 nested object(s) would be boxes, and where the json objects matched, they would be gray, and when a difference in the object was detected, it would be red. Json objects without a correlation in the other file would be orange.

Where would I go to farm this kind of job out, what should i expect to pay etc. Seems like maybe 8 hours of work for a performant system that could handle 50,000 nested json objects max 4 levels deep. Or am I way off base here.

Hadlock fucked around with this message at 20:10 on Apr 5, 2018

Capri Sun Tzu
Oct 24, 2017

by Reene

Hadlock posted:

I have a need for a way to visualize a json file as one box per nested json object on the screen using css grids. Basically the page would request/receive two identical, or nearly identical json files, like a daily report in json format, each root (level 0) and level 1 nested object(s) would be boxes, and where the json objects matched, they would be gray, and when a difference in the object was detected, it would be red. Json objects without a correlation in the other file would be orange.

Where would I go to farm this kind of job out, what should i expect to pay etc. Seems like maybe 8 hours of work for a performant system that could handle 50,000 nested json objects max 4 levels deep. Or am I way off base here.
So like a merge diff tool for your JSON docs. I would pad that out to around 20-30 hours. And are you trying to display 50k object diffs on a webpage?

e. and that hourly number could go way up depending on how complex it is to find differences between your objects

prom candy
Dec 16, 2005

Only I may dance
I'm having a weird issue with scroll behaviour on mobile safari within a single page app, but only on iPhone Plus and X sizes. I have a <ScrollToTopOnMount /> component that I put inside routes that I always want scrolled to the top when loading, it looks like this:

code:
import React from 'react';

class ScrollToTopOnMount extends React.Component {
  componentDidMount() {
    console.log('srolling to top');
    window.scrollTo(0, 0);
    console.log('scrollY immediately', window.scrollY);
    setTimeout(() => console.log('scrollY after 50ms', window.scrollY), 50);
    setTimeout(() => console.log('scrollY after 150ms', window.scrollY), 150);
    setTimeout(() => console.log('scrollY after 250ms', window.scrollY), 250);
  }

  render() {
    return null;
  }
}

export default ScrollToTopOnMount;
When I navigate into certain routes, the page doesn't scroll to the top, but instead scrolls to somewhere between 14 and 30 pixels from the top. Even stranger, based on my console logs it seems like it scrolls to the top, and then bumps down, leading me to believe that it has something to do with content being loaded into the viewport after the initial call to window.scroll(0, 0).

My output in the console goes something like this:

code:
scrollY immediately – 0
scrollY after 50ms – 0
scrollY after 150ms – 7
scrollY after 250ms – 28
This only happens if I click in from a page that's already scrolled down. It almost seems like the phone is trying to return to the previous scroll point after content is added, but I honestly have no idea why this is happening. I found this StackOverflow post from a guy who seems to have the same problem, but there's no resolution and he can't seem to reproduce it with jsfiddle. Has anyone else experienced this? Any theories on why it might be happening?

Edit: Figured it out kinda, I guess don't use 100vh with mobile safari because it has to do weird calculations under the hood

prom candy fucked around with this message at 19:36 on Apr 13, 2018

reversefungi
Nov 27, 2003

Master of the high hat!
Anyone have any good articles about writing large React/Redux applications? Like, 100+ pieces of state potentially and how to manage it all could be super helpful.

huhu
Feb 24, 2006

The Dark Wind posted:

Anyone have any good articles about writing large React/Redux applications? Like, 100+ pieces of state potentially and how to manage it all could be super helpful.

Personal opinion but I feel like all you'd really need to do is map out the structure of everything. Think about how to group things (i.e. users, posts, etc.) and then within those groups sub groups (i.e. users would be active user, other users, etc.) you'll probably have standard ways of accessing stuff (all items, selected item, etc.).

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

The Dark Wind posted:

Anyone have any good articles about writing large React/Redux applications? Like, 100+ pieces of state potentially and how to manage it all could be super helpful.

Flat state, break things up into lots of reducers, and NONE OF YOUR COMPONENTS REFERENCE STATE DIRECTLY. Use selectors for *everything*, even if it feels "boilerplatey" to have selectors that just look like aThing = state => state.part.aThing. Because things will change, and you just saved yourself a huge headache by doing that. Ask me how I know! :suicide: I also find it helpful to have an action that is app-wide that every reducer listens to that resets state back to each reducer's initialState.

Take a look at redux-first-router instead of React Router if you need routing. I absolutely love it.

Ape Fist
Feb 23, 2007

Nowadays, you can do anything that you want; anal, oral, fisting, but you need to be wearing gloves, condoms, protection.
Anyone tried to fiddle with MEAN? This quick tutorial looks good:

https://scotch.io/tutorials/mean-app-with-angular-2-and-the-angular-cli

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

MEAN means mongo which means no

darthbob88
Oct 13, 2011

YOSPOS
Mongo and Node, which means I want nothing to do with it. JS is bad enough on the front-end, why would you ever use it in the backend when there are actual good languages?

my bony fealty
Oct 1, 2008

In theory your team doesn't have to be split up, your front end people can write your back end too! It's just JavaScript, right? In practice...this means you get a team of mediocre front-end devs who call themselves full-stack because they can throw up an Express server.

I say this as someone who does the 'MERN' stack mostly. I like Node because of how easy it is to get set up, and it's real nice to be able to power up little projects with Express. Mongo fits in naturally - it's easy and loose and plays by whatever rules you want it to. But I am under no illusion that this is a replacement for a 'proper' back end for a large application that needs to scale.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

my friend, let me introduce you to postgres's jsonb and now you never have to touch mongo again!

(To be fair, mongo is actually fine for small little projects...but then again so is postgres)

darthbob88
Oct 13, 2011

YOSPOS
The rule I've heard is that Mongo, and presumably NoSQL in general, is fine for data where you don't really care about what's inside the document you store, but breaks once you do care. If you want to store a list of butts and their poops, it's fine. If you want to sort and group butts by their poop, or by whether they've had corn in their poops, then you run into problems.

Capri Sun Tzu
Oct 24, 2017

by Reene
NoSQL is great when you have deeply nested data or object structures. SQL is better suited to tabular data or transactions. NoSQL beats the hell out of SQL when you have to run analysis on say half a billion records. NoSQL also requires you to spend a lot more time thinking about how to structure your data for efficient querying.

Skandranon
Sep 6, 2008
fucking stupid, dont listen to me

darthbob88 posted:

The rule I've heard is that Mongo, and presumably NoSQL in general, is fine for data where you don't really care about what's inside the document you store, but breaks once you do care. If you want to store a list of butts and their poops, it's fine. If you want to sort and group butts by their poop, or by whether they've had corn in their poops, then you run into problems.

Mongo is just a bad NoSQL database, don't use it. Postgres can do everything Mongo can, better, and also has a proper relational model when you do realize you need more than just NoSQL, which you probably will.

Capri Sun Tzu
Oct 24, 2017

by Reene
My favorite thing about JSON stores is fetching a record for your web app and BAM you just stick that sucker right into your model, no mapping needed because its all javascript

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Capri Sun Tzu posted:

My favorite thing about JSON stores is fetching a record for your web app and BAM you just stick that sucker right into your model, no mapping needed because its all javascript

Many people probably thought the same thing about SQL Server's XML column spec and now look where we are :ohdear:

Adbot
ADBOT LOVES YOU

Roadie
Jun 30, 2013

Ahz posted:

Depends on your requirements. Having access to the context doesn't mean you're getting unidirectional data flow like you would with flux/redux patterns. The pattern itself is quite useful for making sense of data changes from all over the place in large apps, and redux pretty much forces you to be a little more strict and explicit about it.

What I'd be happy to see is a react-redux variant that uses the new Consumer stuff to provide the store and dispatch rather than needing a HOC.

Actually, the same thing could go for a lot of stuff that needs HOCs right now.

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