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

prom candy posted:

Being able to do something yourself is not in itself a reason to do something yourself

I'm not familiar with some of the solutions mentioned but when faced with kitchen-sink equipped, or bloated libraries I always prefer to just write it purpose built.

Adbot
ADBOT LOVES YOU

Thermopyle
Jul 1, 2003

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

Nolgthorn posted:

I'm not familiar with some of the solutions mentioned but when faced with kitchen-sink equipped, or bloated libraries I always prefer to just write it purpose built.

This kind of dogmatism is cancer to projects.


The correct and way to evaluate implementing a solution:

"Library A does implement the functionality we need, but the layer it occupies in our project is particularly security-sensitive. After evaluating Library A we've determined that it is too complex to thoroughly audit with our available resources. On the other hand, the functionality we require is just complex enough that we can't ensure to a high-enough level of confidence with our available resources that we won't introduce our own vulnerabilities. Given the track record of Library A we've decided that the course leading to the least likelihood of a security incident is to implement Library A instead of rolling our own."

Insert all the other domains outside of security...performance, maintenance, etc.

This is the kind of analysis that gets glossed over by many or most of the developers who insist on rolling their own. They're just cargo-culting.


In this specific case, where we're talking about ways to host content, your comment is exactly the opposite of what the original user should be doing. You're not going to implement security, performance, or features better than, netlify/DO/AWS.

Ruggan
Feb 20, 2007
WHAT THAT SMELL LIKE?!



Yeah exactly, especially for hosting solutions and the like.

I do draw a line in the sand for UI component libraries that seem like they fit the requirements but that you'd have to spend excessive effort bending to your will.

That said, some things are never worth rolling yourself - date/timezone code, csv/json/xml/html parsers, and other things in the same spiritual vein. I'm not going to go roll my own moment.js or d3.js for instance. But usually in those cases, if a popular library doesn't fit the use case, you're probably doing something wrong.

Thermopyle
Jul 1, 2003

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

Ruggan posted:

I do draw a line in the sand for UI component libraries that seem like they fit the requirements but that you'd have to spend excessive effort bending to your will.

Yeah, it's often too easy up-front to just get going with something someone else has built but further into your project you start running into the friction of adapting a foreign API to your own project's way of doing things.

Though, weighing your expected costs of rolling your own vs the expected costs of bending the library to your will is the same sort of analysis I described.

Yeah, adapting a foreign API to your projects way of doing things is often fraught. But so is implementing a complete set of components. If your required number of components is small then you might go with rolling your own. But then you've got to also weigh inevitable feature creep that causes you to need more and more components.

Anyway, not saying you do or don't need a third-party component library, just that it's the same sort of analysis as the security example I give above.

Sometimes they make sense and sometimes they don't.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
I almost never meet developers that roll their own. I meet exclusively developers that insist that if a module exists it should be installed immediately and used no matter what it is and that a node_modules directory being thousands of libs large is totally fine.

Moment isn't my favourite date library, but a date library is sufficiently complex and already purpose built, especially useful if you're working with a lot of dates so go ahead and use one.

BonoMan
Feb 20, 2002

Jade Ear Joe
I have a crazy problem that I can't figure out.

I have a simple site built on a SquareSpace template.

In Chrome, on Mac OS or Windows, we have a site with *one specific page only* where the links won't load on initial load. The second you: grab the page window and move it, resize it, or just plain refresh it - they all of a sudden spring into action. But never on initial load.

Edge and Safari work fine. It's *just* on Chrome.

What the hell could be going on?

HexiDave
Mar 20, 2009

BonoMan posted:

I have a crazy problem that I can't figure out.

I have a simple site built on a SquareSpace template.

In Chrome, on Mac OS or Windows, we have a site with *one specific page only* where the links won't load on initial load. The second you: grab the page window and move it, resize it, or just plain refresh it - they all of a sudden spring into action. But never on initial load.

Edge and Safari work fine. It's *just* on Chrome.

What the hell could be going on?

Anything in the console (hit F12, Console tab)? Any ad-blockers or other plugins going?

BonoMan
Feb 20, 2002

Jade Ear Joe

HexiDave posted:

Anything in the console (hit F12, Console tab)? Any ad-blockers or other plugins going?

Nope. Seems to be the same across everyone's computers here and at home. Only on Chrome. Even mobile chrome (when viewed as desktop) does it. Of course in mobile mode it auto resizes the page so that kicks the links into active mode.

HexiDave
Mar 20, 2009

BonoMan posted:

Nope. Seems to be the same across everyone's computers here and at home. Only on Chrome. Even mobile chrome (when viewed as desktop) does it. Of course in mobile mode it auto resizes the page so that kicks the links into active mode.

Have you tried making a copy of that page and testing it? If it's the same after a copy, start disassembling the copy to see if something on it is busted. Or maybe the page is haunted.

Thermopyle
Jul 1, 2003

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

Nolgthorn posted:

I almost never meet developers that roll their own. I meet exclusively developers that insist that if a module exists it should be installed immediately and used no matter what it is and that a node_modules directory being thousands of libs large is totally fine.

Oh, well then doing the exact opposite is the appropriate strategy.

Ruggan
Feb 20, 2007
WHAT THAT SMELL LIKE?!


The Web Design & Development Megathread: node_modules are like pokemon - gotta install em all

Data Graham
Dec 28, 2009

📈📊🍪😋



Ruggan posted:

The Web Design & Development Megathread: node_modules are like pokemon - gotta install em all

Literally what this page I was looking at earlier this evening says https://medium.com/the-vue-way/my-favorite-vue-js-nuxt-js-packages-for-2019-639dbbfe699e

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

BonoMan posted:

I have a crazy problem that I can't figure out.

I have a simple site built on a SquareSpace template.

In Chrome, on Mac OS or Windows, we have a site with *one specific page only* where the links won't load on initial load. The second you: grab the page window and move it, resize it, or just plain refresh it - they all of a sudden spring into action. But never on initial load.

Edge and Safari work fine. It's *just* on Chrome.

What the hell could be going on?

Sounds like a resource is not loading so the page is still loading. I would check network resources first to see if is the case. Maybe change the event that trigger these links generation.

It may also be a css problem if the links are not generated.

some guy i guess
Jan 31, 2011
I'm having trouble achieving a specific responsive layout using just CSS. Here's what I want, with the mobile layout on the left and larger devices on the right.



I haven't been able to make any progress on this using 'display: flexbo'x, and would rather stay away from 'display: grid' because of compatibility issues. I thought I had a solution involving 'flex-direction: column' and 'flex-wrap: wrap' in combination with a class to force the flex container into a new column combined with the 'order: ' property to create the order of 1-3-column wrap-2, but had no success making a column-wrapping class.

Please save me, CSS wizards!

sunaurus
Feb 13, 2012

Oh great, another bookah.

some guy i guess posted:

I'm having trouble achieving a specific responsive layout using just CSS. Here's what I want, with the mobile layout on the left and larger devices on the right.



I haven't been able to make any progress on this using 'display: flexbo'x, and would rather stay away from 'display: grid' because of compatibility issues. I thought I had a solution involving 'flex-direction: column' and 'flex-wrap: wrap' in combination with a class to force the flex container into a new column combined with the 'order: ' property to create the order of 1-3-column wrap-2, but had no success making a column-wrapping class.

Please save me, CSS wizards!

This is exactly the problem that `display: grid` solves, and it has very good compatibility nowadays. What devices are you worried about?

sunaurus
Feb 13, 2012

Oh great, another bookah.
Just an example of how easy it is to do with grid:

code:
.container {
  display: grid;
  grid-template-areas: "header" "content" "footer";
}

@media screen and (min-width: 70em) and (orientation: landscape) {
  .container {
    grid-template-areas: "header content" "footer content";
  }
}

.red {
  grid-area: header;
}

.green {
  grid-area: content;
}

.blue {
  grid-area: footer;
}
(+ you can specify column/row widths and heights of course)

some guy i guess
Jan 31, 2011

sunaurus posted:

What devices are you worried about?

IE. The website is targeted at academics (including old people plus people browsing from ancient university IT systems stuck on IE), and I've read that even with prefixing, IE still stumbles on some grid properties. I feel like forcing the small amount of IE users to the single-column mobile layout and using grid for the rest may be the best option now.

I really, really like using grid in my own projects but this is for a client and I'm concerned about compatibility.

The Dave
Sep 9, 2003

Do you have the actual analytics of the browser break down or is it heresay? Not that I'm doubting you, I've just personally been on projects where big efforts to support IE were made then when we looked at analytics the IE users were <1%.

some guy i guess
Jan 31, 2011
No analytics unfortunately, the site is for a small business with no existing web presence. The tiny percentage of IE users are just gonna have to deal with a single-column layout :colbert:.

RobertKerans
Aug 25, 2006

There is a heppy lend
Fur, fur aw-a-a-ay.

Evergreen response: https://twitter.com/garybernhardt/status/1034519171986423809

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

some guy i guess posted:

No analytics unfortunately, the site is for a small business with no existing web presence. The tiny percentage of IE users are just gonna have to deal with a single-column layout :colbert:.

IE11 (and to some degree) 10 actually have prefixed grid support, so if you have a basic grid layout, it's very likely it's adding a couple extra lines of -ms-grid stuff for full support for them as well.

prom candy
Dec 16, 2005

Only I may dance
I'm totally blanking on the right way to solve a problem here. I want to display a modal of a specified aspect ratio that fills up as much room as possible, but I also want it to be locked to the viewport so that it always fits on screen. So for example, if it was a 16:9 modal then on a 21:9 screen I would need to leave some space on the left and right, but on a 4:3 screen it would leave some space on the top and bottom.

I created a simple codesandbox to display the problem: https://codesandbox.io/s/sparkling-paper-crj5n

If you drag the browser pane so that it's wider than 16:9 you can see the issue, the box just continues to grow, whereas I'd like it to max out at 100% height. Can this be done with CSS or am I going to need to clock the window size with JS and do some calculations to get it where I want it?

edit: I think Facebook's photo modal is almost exactly what I'm trying to build, and it looks like they use JS to achieve that so maybe that's my solution

prom candy fucked around with this message at 16:17 on Aug 29, 2019

Ruggan
Feb 20, 2007
WHAT THAT SMELL LIKE?!


What about something like this?

https://codesandbox.io/s/hopeful-darkness-quk3d

Ruggan
Feb 20, 2007
WHAT THAT SMELL LIKE?!


double post

prom candy
Dec 16, 2005

Only I may dance
Oh drat, didn't even think of using vh/vw! That's a pretty nice solution, gonna see if I can get that to work for me before I go down the JS road, thanks!

Thermopyle
Jul 1, 2003

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


That's wrong.

They're both liabilities and assets.

They're liabilities because they introduce maintenance (and other) costs/risks. They're assets because they enable you to do things you couldn't do with available resources before.

Unnecessary dependencies are another story.

Volguus
Mar 3, 2009
Hi,
I have a question regarding mobile cameras on the web:

I have a web application (simple, 2 react components, nothing fancy) that's accessing the browser's webcam with the following constraints:
code:
var constraints = {
	audio: false,
        video: {
            width: { min:320, ideal: 640 },
            height: { min:240, ideal: 480 },
            facingMode: "user"
         }
};  
Then, it builds up an RTCPeerConnection and sends that video stream to the server. It's all good. On the desktop, I properly get the desired 640x480 resolution in the client and the video is sent with the same dimensions to the server. On a mobile phone (Android tested only so far), I get on the webpage the 640x480 resolution (I display it on the page), but when it gets to the server the frames are 480x640. The width gets flipped with the height.
The orientation of the device doesn't matter, it's always 480x640 by the time it gets to the server. Has anyone encountered something like this?

Vincent Valentine
Feb 28, 2006

Murdertime

Dependencies in my personal projects are badass.

Dependencies at my professional job are almost always a problem.

I can update my personal app to use hooks, context and whatever other cool poo poo is in react 16.9 and have an easy time doing it. If a module becomes a problem, I can usually replace it pretty well. My development time is greatly reduced and it's almost always a lengthy series of wins that greatly outweigh any losses.

But no client is going to request we spend time upgrading our dependency versions without delivering new features. And so we don't, since upgrading versions has breaking changes that need to be addressed and that time needs to be spent on client requests instead. And so now the react dev tools chrome extension breaks one of our applications because it uses react 14.9.

Thermopyle
Jul 1, 2003

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

Vincent Valentine posted:

Dependencies in my personal projects are badass.

Dependencies at my professional job are almost always a problem.

I can update my personal app to use hooks, context and whatever other cool poo poo is in react 16.9 and have an easy time doing it. If a module becomes a problem, I can usually replace it pretty well. My development time is greatly reduced and it's almost always a lengthy series of wins that greatly outweigh any losses.

But no client is going to request we spend time upgrading our dependency versions without delivering new features. And so we don't, since upgrading versions has breaking changes that need to be addressed and that time needs to be spent on client requests instead. And so now the react dev tools chrome extension breaks one of our applications because it uses react 14.9.

Now imagine if when you were developing those projects you had to implement react from scratch!

Gildiss
Aug 24, 2010

Grimey Drawer

Thermopyle posted:

Now imagine if when you were developing those projects you had to implement react from scratch!

B but the size of the node_modules directory!

Thermopyle
Jul 1, 2003

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

FWIW, it's almost always a huge hassle on my personal projects if I set them aside for a year and come back to them.

On frontend projects in particular, I'll spend a week updating all of the dependencies and resolving conflicts and changing my code as required. That's excluding if I want to keep up with paradigm changes like class-based components to function components to hooks.

Data Graham
Dec 28, 2009

📈📊🍪😋



No see if I start my project late enough in internet history, all the modules I need will become Done and I won’t have to worry about keeping them up to date anymore

Thermopyle
Jul 1, 2003

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

Data Graham posted:

No see if I start my project late enough in internet history, all the modules I need will become Done and I won’t have to worry about keeping them up to date anymore

That's what I always tell clients when they ask why their project isn't done.

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb

Vincent Valentine posted:

But no client is going to request we spend time upgrading our dependency versions without delivering new features.

Your clients don't care about CVEs?

Vincent Valentine
Feb 28, 2006

Murdertime

You would think that, but no. We have a big list of huge clients, and only one was concerned and only with one module (jQuery 1.1).

It's extremely embarrassing all around.

Null of Undefined
Aug 4, 2010

I have used 41 of 300 characters allowed.
Dang folks it’s almost like there are occasions that using third party libraries are appropriate and times when they aren’t.

Tei
Feb 19, 2011
Probation
Can't post for 5 days!
I was not happy when I found one dev was writting code using syntax from the last version of the language. Syntax that adds nothing, just make code more sucint. It always make me angry when dependencies are added for no reason. Dependencies have a cost, so they must give some benefict back to make sense

RobertKerans
Aug 25, 2006

There is a heppy lend
Fur, fur aw-a-a-ay.

Thermopyle posted:

That's wrong.

They're both liabilities and assets.

They're liabilities because they introduce maintenance (and other) costs/risks. They're assets because they enable you to do things you couldn't do with available resources before.

Unnecessary dependencies are another story.

No, he's being flippant, but he is right: dependencies are always liabilities, it is just whether the trade-off implicit in relying on them is worthwhile. A particular dependency should always reduce the complexity in some way, but ideally it wouldn't be there. Every dependency adds something uncontrolled [and with its own API, and if you're unlucky its own special build rules, etc] to the overall system.

Cue "why not write everything in assembly then" or something to that effect, but that would be reductive, there's a baseline. If I move up a few layers of abstraction: saying that you wouldn't want to have to write the equivalent of React every time is true. But that's also a bit of a non-sequitur, because the application is often going to be a React application, that's the baseline, you build from that

Thermopyle
Jul 1, 2003

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

RobertKerans posted:

dependencies are always liabilities, it is just whether the trade-off implicit in relying on them is worthwhile. A particular dependency should always reduce the complexity in some way, but ideally it wouldn't be there. Every dependency adds something uncontrolled [and with its own API, and if you're unlucky its own special build rules, etc] to the overall system.


Yes, that's what I said.

Adbot
ADBOT LOVES YOU

Ruggan
Feb 20, 2007
WHAT THAT SMELL LIKE?!


Thermopyle posted:

On frontend projects in particular, I'll spend a week updating all of the dependencies and resolving conflicts and changing my code as required. That's excluding if I want to keep up with paradigm changes like class-based components to function components to hooks.

I spent all day updating two of our internal websites dependencies and rewriting all the react class components to function components with hooks. Still not quite done - need to test and expect to find some issues. But I’ll be happy when it’s done.

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