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
Munkeymon
Aug 14, 2003

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



Main Paineframe posted:

or remove the video.

Removing an element isn't guaranteed to stop playback :spergin:

And that's not just me being all well technically, it's a reply I got to a bug report I submitted to Microsoft some years ago.

Adbot
ADBOT LOVES YOU

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

McGlockenshire posted:

Are those numbers in concurrent connections, concurrent users, or just some number pulled out of a hat? 500 concurrent users engaging in normal ecommerce activity is going to average out to a few requests a second, and if you're struggling to serve that on a CPU-heavy enough VPS with Wordpress then something has gone very wrong, especially if you're running it under PHP7. On the other hand, if you're expecting 500 concurrent connections, what are you doing hosting that kind of Wordpress site on only one VPS?

if you're only expecting some vague form of traffic, it's time to measure everything that you can. Make sure you can monitor and log performance on the server at the application level, at the web server daemon level, at the PHP level, at the MySQL level, at the disk I/O level, at the CPU level, at the network connection level. If you're getting slammed, you should be able to easily tell where the bottleneck is by monitoring the server, so you can figure out what exactly to take action on. Do not simply throw more hardware resources at the site without knowing that it'll help a specific problem.

If performance is normally not a concern and they're sending out newsletters or somesuch and they expect an immediate burst of traffic, your priority becomes doing as much as you can to stop users from hitting CPU-heavy application pages. One way to do this would be adding a caching proxy server in front. You can do this yourself (pain in the rear end) or use Cloudflare's higher level paid plans (quick, easy, and probably a NSA front :tinfoil:). Alternatively, see if it would be possible to direct as much incoming traffic as possible to regular plain old static HTML pages. I know there are static site generators for Wordpress, but I don't know that any of them work with woocommerce pages. Look at WP Super Cache if you have to.

Would agree with most of this, except for the recco on WP Super Cache. I've tried several caching plugins with WooCommerce and so far, all of them break it in some way. The way Woo injects HTML and other content into serialized arrays gets messed up something fierce by most auto-minify stuff, and that's just the start.

In my situation where I'm in at HostGator (not my decision) I'd move up to the top tier of their VPS, which would quadruple my my RAM and double my cores and if that didn't work get into dedicated.

But as McGlockenshire says you should identify where bottlenecks are occurring, which off the top of my head would be:
- MySQL
- RAM/Disc throughput
- Processes/CPU
- Bandwidth saturation

You should have tools to check each of those. For a relatively light load like 500-1000 I'm not sure if I'd get into static pages and Cloudflare/proxy server stuff.

melon cat
Jan 21, 2010

Nap Ghost

Main Paineframe posted:

That snippet just gives you the ability to control the video by triggering the YouTube API. You still need to add the actual Javascript to invoke the YT API to tell the video to stop; go look at Youtube's documentation for what exactly to do there.

Basically, just hiding the container the video is in doesn't make the video stop. The video is hidden, but it doesn't actually know it's hidden, so it won't stop automatically - it's up to you to use Javascript to either stop the video or remove the video.
I see what you're saying. I've checked the YouTube iFrame API guide (I've read it from start to finish about 4 times, now) but it doesn't include any parameters relating to my modal window issue. And all solutions I've found online apply to people having modal window issues with their Bootstrap sites (mine isn't a Bootstrap). I hate to throw in the towel, but I'll probably just end up hyperlinking an image to the actual video source. Which is a drat shame, because it's going to pull visitors away from my site each time they click a link.

melon cat fucked around with this message at 01:05 on Oct 25, 2017

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

melon cat posted:

I see what you're saying. I've checked the YouTube iFrame API guide (I've read it from start to finish about 4 times, now) but it doesn't include any parameters relating to my modal window issue. And all solutions I've found online apply to people having modal window issues with their Bootstrap sites (mine isn't a Bootstrap). I hate to throw in the towel, but I'll probably just end up hyperlinking an image to the actual video source. Which is a drat shame, because it's going to pull visitors away from my site each time they click a link.

Really? You can't see anything on that page that would allow you to pause the currently playing Video?

melon cat
Jan 21, 2010

Nap Ghost

Jabor posted:

Really? You can't see anything on that page that would allow you to pause the currently playing Video?
:doh:
Let's pretend that this never happened. This is my first time really working with JavaScript/APIs so... we'll see how this goes.

melon cat fucked around with this message at 01:55 on Oct 25, 2017

Love Stole the Day
Nov 4, 2012
Please give me free quality professional advice so I can be a baby about it and insult you
Look at me, I made a thing!

https://github.com/wanderrful/membercount-scraper

It's a worker bot that persistently scrapes a given steam group's main page, recording how many people are online and stores it into a database with a timestamp for analysis purposes. I made it so that I can figure out when the best times to host events might be. You can specify the steam group to monitor and how often to monitor it via environment variables.

Used TypeScript, PostgreSQL (my first time ever doing anything database-related), and node-scrapy. Took me about 8 hours of effort.

Hopefully one day I'll have enough stuff on my Github page to be able to get an interview and switch to the tech industry.

Love Stole the Day fucked around with this message at 06:29 on Oct 25, 2017

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
The best part about open source software are all the wonderful feature requests you receive. Therefore allow me to contribute the idea, not code mind you, that I be able to monitor multiple groups at the same time with the same process.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Nolgthorn posted:

The best part about open source software are all the wonderful feature requests you receive. Therefore allow me to contribute the idea, not code mind you, that I be able to monitor multiple groups at the same time with the same process.

... a new GitHub Issue appears:

:smug: "I need your software to do ___, when will you add it?"

:smith: "Pull requests are welcome!"

:smug: "I thought this project would be helpful, but I guess not."

- Every open source thing I have made.

qsvui
Aug 23, 2003
some crazy thing
what if you're not good enough to contribute :(

porksmash
Sep 30, 2008

qsvui posted:

what if you're not good enough to contribute :(

If you're not an entitled rear end in a top hat nobody should mind.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

porksmash posted:

If you're not an entitled rear end in a top hat nobody should mind.

Yep. Asking for a new feature is fine. Demanding it and giving a deadline for it... not so much.

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

Lumpy posted:

... a new GitHub Issue appears:

:smug: "I need your software to do ___, when will you add it?"

:smith: "Pull requests are welcome!"

:smug: "I thought this project would be helpful, but I guess not."

- Every open source thing I have made.

Don't get too down on yourself. Your posts are sometimes useful!

Odette
Mar 19, 2011

qsvui posted:

what if you're not good enough to contribute :(

Open a PR and ask what needs to be done. If they're a good maintainer, they'll walk you through what needs to be done.

Data Graham
Dec 28, 2009

📈📊🍪😋



That would be a strange pull request

Tei
Feb 19, 2011

I made a open source game engine modification, and some dude governed over a retexturing project over the game. It happens that some textures where inverted by a mistake of the original developers.

I was too concerned about that. He submitted a request to fix it, and I had no idea how to fix it, so he submitted the actual code, and I merged it wrong so it did not fixed the mistake, until he told me how to merge it.

I wish I where better programmer, sometimes.

Anyway this was the only time somebody had a actual feature request that deserve that name.

My engine was experimental and I completely changed the look and feel of the particle engine many times, and sometimes people hate them, sometimes love these changes. I made lots of features for developers, that few or nobody used. I think when comes to open source usability and documentation is actually more important than features (for users).

This was before Youtube was important, and before Github existed. So it was a different world.

Tei fucked around with this message at 11:50 on Oct 26, 2017

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Newf posted:

Don't get too down on yourself. Your posts are sometimes useful!

Only sometimes??

:cry:

:suicide:

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

Lumpy posted:

Only sometimes??

:cry:

:suicide:

Best one yet!

my bony fealty
Oct 1, 2008

McGlockenshire posted:

Are those numbers in concurrent connections, concurrent users, or just some number pulled out of a hat? 500 concurrent users engaging in normal ecommerce activity is going to average out to a few requests a second, and if you're struggling to serve that on a CPU-heavy enough VPS with Wordpress then something has gone very wrong, especially if you're running it under PHP7. On the other hand, if you're expecting 500 concurrent connections, what are you doing hosting that kind of Wordpress site on only one VPS?

if you're only expecting some vague form of traffic, it's time to measure everything that you can. Make sure you can monitor and log performance on the server at the application level, at the web server daemon level, at the PHP level, at the MySQL level, at the disk I/O level, at the CPU level, at the network connection level. If you're getting slammed, you should be able to easily tell where the bottleneck is by monitoring the server, so you can figure out what exactly to take action on. Do not simply throw more hardware resources at the site without knowing that it'll help a specific problem.

If performance is normally not a concern and they're sending out newsletters or somesuch and they expect an immediate burst of traffic, your priority becomes doing as much as you can to stop users from hitting CPU-heavy application pages. One way to do this would be adding a caching proxy server in front. You can do this yourself (pain in the rear end) or use Cloudflare's higher level paid plans (quick, easy, and probably a NSA front :tinfoil:). Alternatively, see if it would be possible to direct as much incoming traffic as possible to regular plain old static HTML pages. I know there are static site generators for Wordpress, but I don't know that any of them work with woocommerce pages. Look at WP Super Cache if you have to.

Scaramouche posted:

Would agree with most of this, except for the recco on WP Super Cache. I've tried several caching plugins with WooCommerce and so far, all of them break it in some way. The way Woo injects HTML and other content into serialized arrays gets messed up something fierce by most auto-minify stuff, and that's just the start.

In my situation where I'm in at HostGator (not my decision) I'd move up to the top tier of their VPS, which would quadruple my my RAM and double my cores and if that didn't work get into dedicated.

But as McGlockenshire says you should identify where bottlenecks are occurring, which off the top of my head would be:
- MySQL
- RAM/Disc throughput
- Processes/CPU
- Bandwidth saturation

You should have tools to check each of those. For a relatively light load like 500-1000 I'm not sure if I'd get into static pages and Cloudflare/proxy server stuff.

Thanks y'all, this is very helpful! The 500 - 1000 number was basically pulled out of a hat ostensibly based on past product launches, so I was rather concerned that the site couldn't handle that many people just visiting it; turns out it is almost definitely a MySQL issue because yeah, trying to have WooCommerce create that many sessions at once does not play nice with a single VPS. It's a situation where the site doesn't need to handle near that amount of stuff 99% of the time, just every once in a while, so hopefully my host has some options for scaling upwards during those times.

To elaborate, WooCommerce creates a new wp_woocommerce_sessions row every time the 'Add to Cart' button is clicked, if it doesn't have one from the source already, so having hundreds of these trying to 'Add to Cart' at once does not work with my current setup.

my bony fealty fucked around with this message at 18:53 on Oct 26, 2017

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

I'm assuming the "rush" hasn't hit yet, maybe clear out some existing transients? It might be that creating new sessions is slow because there are already a heckuva load of old sessions that haven't been cleared properly.

McGlockenshire
Dec 16, 2005

GOLLOCKS!
Creating a row in a table is a trivial event. Creating a thousand rows in a table in a few seconds is a non-trivial but still pretty small event. You may have misidentified your problem.

Are you sure that it's the actual insert that's the problem, or is it the code running that leads to the insert that's the problem?

Ruggan
Feb 20, 2007
WHAT THAT SMELL LIKE?!


McGlockenshire posted:

Creating a row in a table is a trivial event. Creating a thousand rows in a table in a few seconds is a non-trivial but still pretty small event. You may have misidentified your problem.

Are you sure that it's the actual insert that's the problem, or is it the code running that leads to the insert that's the problem?

Also, if you’re inserting data via a stored procedure (you should be), make sure you don’t have any crazy logic in there.

Inserting a bunch of records in a table should take almost no time, but it’s quite possible the stored proc does a bunch of poorly optimized validation.

Also if you’re working with databases you ought to read up on table / row locking. Generally speaking you can’t concurrently read from and write to a table. You can get around this with stuff like NOLOCK hints that lead to dirty reads, or SNAPSHOT ISOLATION which tells select statements to look at the state of the db at the last fully committed transaction, but there are caveats involved there too.

In your example, this might mean that inserting rows into your table is being blocked by another unrelated operation that is also touching the table. This becomes a bigger problem as you scale.

McGlockenshire
Dec 16, 2005

GOLLOCKS!

Ruggan posted:

Also, if you’re inserting data via a stored procedure (you should be)

Well we're talking about wordpress + woocommerce on mysql in this case so there's a 0% chance of this or most of the other stuff in your otherwise correct post applying.

The Dave
Sep 9, 2003

Who wants to see the worst job description ever?

https://careers-comcastspectacor.ic...jun1offset=-240


quote:

Responsibilities

Create memes, graphics and digital assets across all digital channels (emails, web, and advertising) to drive engagement
Help manage and monitor team social media accounts, insuring very active profiles
Operate the team’s content management system to update and maintain official site including designing and building new site pages, special sections, multimedia applications, registration forms and sponsored content for the team’s digital platforms
Execute branding initiatives through content creation
Assist with the development, implementation and rollout of new technologies, such as: mobile applications, gaming, social media platforms
Coordinate marketing efforts around team news and website content
Support publicity and grassroots promotions via website and social media
Lead quality assurance initiatives regarding team digital media and sponsored products
Respond to inquiries submitted through the website & social
Be current with best practices and emerging offerings across all consumer brands
Pull and review website/email analytics from multiple resources, and produce regular reports for department and key players in an effort to present insights into the usage, performance and success of digital initiatives and digital revenue generation
Other duties as assigned by supervisor
Game night and/or weekend participation required

Please note, hourly rate for this position is approximately $17/hour.

Qualifications

Detailed understanding of the interactive marketing, website management, email marketing, and social networking

Proficiency in HTML, CSS, Java Script, or other Web Design CMS platforms is required

Knowledge of effective web design and user experience

Excellent technology and communication skills

Sharped witted, comedic & energetic personality

Advanced proficiency in Adobe Creative Cloud

Ability to travel and work nights, weekends and select holidays, in addition to traditional business hours, is required

Overwatch, esports, and gaming expertise

Ability to repell trolls and fire off witty responses & ice cold burns

Philadelphia eSports Franchise is an Equal Opportunity Employment Employer.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
Looks basically like the job description of a professional blogger, there's tons of people who do that kind of work. I bet many would enjoy $17/hr to do it too.

melon cat
Jan 21, 2010

Nap Ghost

The Dave posted:

Who wants to see the worst job description ever?

https://careers-comcastspectacor.ic...jun1offset=-240
I really do wonder who writes these job descriptions. Because if anyone told me that they're a high level web developer + graphic designer + digital marketer I'd just assume that they dabble a bit in each but don't have a deep skillset in any particular field.

melon cat fucked around with this message at 06:23 on Jan 10, 2024

The Dave
Sep 9, 2003

Nolgthorn posted:

Looks basically like the job description of a professional blogger, there's tons of people who do that kind of work. I bet many would enjoy $17/hr to do it too.

If you expect a blogger to know front end dev, graphic design, ux design, marketing, and have around the clock availability, AND you want to only pay them $17/hr... you are only going to get candidates that are not good at any of those things. I get that it's really just a problem with a lovely job description and they just need someone to manage social media accounts and generate memes.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.
Anyone know any good guides for html/css that prints well straight from the browser?

reversefungi
Nov 27, 2003

Master of the high hat!

Newf posted:

Anyone know any good guides for html/css that prints well straight from the browser?

The Shay Howe material seems to print just fine (judging from a quick print preview) and that's easily the best guide on HTML/CSS I've seen as of the moment.

Love Stole the Day
Nov 4, 2012
Please give me free quality professional advice so I can be a baby about it and insult you
A bit stuck here with an attempt at a portfolio project and was hoping my problem is a common one you guys have run into when you were newer to this stuff. Hoping to get a bit of advice:

I completed making the back-end for a simple "video game server browser" project. Problem is, I cannot find a "good" way to reliably communicate the results of a "get rows of server data from the database" function from the back-end to the front-end. Here are the relevant code bits:

  • I use the following function to retrieve rows of relevant parsed server data from Steam, like so:

  • At the moment, I am using this "server-data" variable as a sort of reference to save the current set of information so that I can pass it into the front end upon client request, like so:

  • Unfortunately, doing it this way does not require the use of a database at all... so I'm sure that I'm going about this the wrong way. My problem, though, is that I cannot find a better, more appropriate way way to query the data, after storing the rows of returned data, so that I can pass it to help with the rendering of a client's GET request. As you can see in the image below, I am not able to return the appropriate data from a callback function:

  • Because the returned data is stored in a callback function, I cannot simply call this function in the handling of the GET request and therefore rely on the fact that it will return the rows of data that I need.

I'm trying to think of how to go about this in a better way. This is my first project involving databases and every tutorial I've seen or done so far have revolved around the storing and manipulating of data... but never with actually querying and rendering the results for front-end display, which is what I'm trying to do here. I'm sure that I'm going about this in the absolute dumbest way possible.

The Fool
Oct 16, 2003


One way to do this would be to have three components.

1. Server side, queries steam and stores the data in a database for caching

2. Server side, provides a REST api interface to the database

3. Front end, queries your api and displays the results to the user


There is very likely a simpler way do to this, but this is how I would put it together.

Boosh!
Apr 12, 2002
Oven Wrangler
React newbie here, playing around with the Bungie API as practice. App has a state called characters, which is passed as a prop to my CharacterList component: <CharacterList characters={this.state.characters}/>

Now, when the character state gets updated, the CharacterList html doesn't render with the new information even though, it is correctly logging the updated prop in the console.

I have a dummy button in App that just merely sets the character state to itself and voila, the html in CharacterList gets rendered.

FWIW, here is what's getting logged. The first array is when character state gets updated naturally (but the html isn't rendered)), the second is when I hit my dummy button to set character state to itself and is correctly rendered.



I notice the 2nd array (3 objects) is slightly different than the 1st, even though the contents are the same.

darthbob88
Oct 13, 2011

YOSPOS
Accessibility: Is there a way to announce when visibility changes on a page? aria-live works when the actual content changes, but it's less helpful when I just toggle visibility on the same set of elements, without actually changing anything.

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

Boosh! posted:

React newbie here, playing around with the Bungie API as practice. App has a state called characters, which is passed as a prop to my CharacterList component: <CharacterList characters={this.state.characters}/>

Now, when the character state gets updated, the CharacterList html doesn't render with the new information even though, it is correctly logging the updated prop in the console.

I have a dummy button in App that just merely sets the character state to itself and voila, the html in CharacterList gets rendered.

FWIW, here is what's getting logged. The first array is when character state gets updated naturally (but the html isn't rendered)), the second is when I hit my dummy button to set character state to itself and is correctly rendered.



I notice the 2nd array (3 objects) is slightly different than the 1st, even though the contents are the same.

Are you mutating this.state or are you using this.setState({characters: newCharactersList})? Because the former won't trigger react to do anything.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

darthbob88 posted:

Accessibility: Is there a way to announce when visibility changes on a page? aria-live works when the actual content changes, but it's less helpful when I just toggle visibility on the same set of elements, without actually changing anything.

Can you stick the live region on whatever contains the stuff you're toggling?

darthbob88
Oct 13, 2011

YOSPOS

Jabor posted:

Can you stick the live region on whatever contains the stuff you're toggling?
That was the first thing I tried. The problem is that it only fires when you have new content, not when you just change the visibility attributes on current content.
E: I can't easily test it right now, but on this Codepen, a screen reader would happily announce "0, 1, 2, 3, etc", while ignoring the "Foo"/"Bar" down below.

It just occurred to me that I can just change it from toggling which div is visible, to toggling which content element is displayed in the div. The only reason I didn't do that in the first place was that I was concerned about the cost of re-rendering everything, but that's not so big an issue anymore, is it?

darthbob88 fucked around with this message at 04:31 on Nov 1, 2017

Boosh!
Apr 12, 2002
Oven Wrangler

Maluco Marinero posted:

Are you mutating this.state or are you using this.setState({characters: newCharactersList})? Because the former won't trigger react to do anything.

The latter.

I think my data isn't getting to setState quickly enough. I looked up why the first array in the image is empty (but had values if I expanded) and it seems like logged data in console is "live" but not available at the time of console.log (also when setState is supposed to execute).

It looks like I should read up on component life cycles before I continue.

IAmKale
Jun 7, 2007

やらないか

Fun Shoe

Boosh! posted:

I think my data isn't getting to setState quickly enough. I looked up why the first array in the image is empty (but had values if I expanded) and it seems like logged data in console is "live" but not available at the time of console.log (also when setState is supposed to execute).
this.setState() is asynchronous so I'm not surprised you're having this issue. I'm not sure how long setState waits before it updates the state, but it's definitely not synchronous. Here's a good, succinct description of what goes on under the hood when you attempt to update a component's state: https://reactjs.org/docs/react-component.html#setstate (I'm not trying to be flippant by linking you the docs, it's just a really good description :shobon:)

As a tip, data logged to console via something like console.log(someObj); points to a reference to that object. When you expand it later and there are values you weren't expecting within, it's because that object was updated from the time it was logged - you end up viewing the "live" version of that object, not what it was at the time it was logged.

A simple way to log a "snapshot" of an Object is to do something like console.log(Object.assign({}, someObj)); instead. That'll output what someObj looked like at the time the console.log() was executed.

IAmKale fucked around with this message at 18:04 on Nov 1, 2017

Boosh!
Apr 12, 2002
Oven Wrangler
That was extremely helpful, thank you.

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

darthbob88 posted:

That was the first thing I tried. The problem is that it only fires when you have new content, not when you just change the visibility attributes on current content.
E: I can't easily test it right now, but on this Codepen, a screen reader would happily announce "0, 1, 2, 3, etc", while ignoring the "Foo"/"Bar" down below.

It just occurred to me that I can just change it from toggling which div is visible, to toggling which content element is displayed in the div. The only reason I didn't do that in the first place was that I was concerned about the cost of re-rendering everything, but that's not so big an issue anymore, is it?

Coding horror thread answer: add &nbsp; to the div every time you toggle it ;)

Adbot
ADBOT LOVES YOU

darthbob88
Oct 13, 2011

YOSPOS

Scaramouche posted:

Coding horror thread answer: add &nbsp; to the div every time you toggle it ;)
Tempting, but that'd probably run into the other problem I found, that aria-live needs to go on the actual element with the changing content, not just on any wrapper divs.

code:
<div aria-live="assertive" role="alert"><div>{New text}</div></div>
won't say anything, but
code:
<div><div aria-live="assertive" role="alert">{New text}</div></div>
will. This is a lot of nonsense and we really need a better way for providing content to disabled customers.

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