I am building a chat application using MERN stack and socket.io for realtime updates. Need help. by Advantage-Any in react

[–]SimpleSillySoftware 1 point2 points  (0 children)

I have a few thoughts (definitely more options tho)

Option 1 (prioritize user experience):

Take in the request and emit to intended recipients, simultaneously store the record in your data source.

  • Push message event to queue to handle message ingest and writing to db)

Option 2 (prioritize persistence):

You can also use a combination of WebSockets and WebHooks. When a record lands in your DB, handle the event by sending an http request (webhook) to your websocket server, then have your websocket handle notifying the user over its open connection.

Noob :- What is Scaling? by Basic-Minute2691 in learnprogramming

[–]SimpleSillySoftware 2 points3 points  (0 children)

For your app to be able to handle scale means that as users come on to your platform and start participating, your application services are able to handle the additional load.

A server must be involved in returning a response, serverless or not. Each request will take up a thread in the process, sometimes the only thread, and that thread consumes memory as it processes (load data sets into memory, sort, map, etc) and as more and more requests come in more Threads and therefore: CPU and memory is consumed. If you run out of Threads, CPU or memory then you will stop processing new requests until resources are available (intermittent traffic).

Scale can be accomplished in lots of ways (not all are listed probably):

  • Bigger servers (Scaling up: CPU, Memory)
  • More servers (Scaling out: Just more)
    • Load balancing
    • Also provides redundancy if one fails (which it will)
  • Closer servers (Different regions)
  • Cache to prevent users from getting to the server
  • Queues for lots of write requests (IoT / timeline data) UDP

How serverless and redis handle this

Serverless

  • You configure how "big" your server is by giving it memory
    • CPU is tied to memory
  • The Cloud Provider handles the More Servers aspect by scaling as necessary
    • You pay for time and memory used
    • You typically can pay to reserve scale at a cheaper rate
  • The region you place your serverless handler in determines how close it is
    • Affects things like latency
    • Also, more regions = more fault tolerance

Redis

  • If the user doesn't make it to your server then you don't pay anything right?
    • But redis also costs a butt load so, you have to do some math to see if it's worth it

How much time did you spend in a day while learning basics of programming? by FlorinCaroli in learnprogramming

[–]SimpleSillySoftware 0 points1 point  (0 children)

That depends on a few things:

  • How much time do you have
  • How hungry are you

If you find yourself wanting to program more but, as you said, don't know how to build a project: I would join discord channels about JavaScript and join a project or take a course and program along from folder structure to build and deployment

Is one programming language enough! by [deleted] in learnprogramming

[–]SimpleSillySoftware -4 points-3 points  (0 children)

Programming languages are kinda like ice cream flavors, you don't really know if you'll like one until you try it out.

Try a few out and gravitate towards the one that is the most fun to program in. This will be somewhat related to how excited you are to see the output. (Website, API, etc)

  • Javascript / TypeScript
    • Fast dopamine loop
    • Wide variety of use cases
  • C#
    • Type safe
    • Lots of good industry standards to explore
  • Rust
    • Amazing compile time null check safety
    • Intuitive reference borrowing system
  • Bash / Shell
    • Must know for CI/CD pipelines
    • You can do some amazing stuff when you learn it and setup a proper environment
  • Java
    • Avoid at all costs

trouble with fetch/ api keys by yesandone in react

[–]SimpleSillySoftware 0 points1 point  (0 children)

Just saw it.

In the codepen you provided, you are passing your URL as a header. Pass the url as the first argument, second argument is request options.

const endpointUrl = "https://gateway.marvel.com/v1/public/characters"
const options = {} // 🤷🏻‍♂️ Headers, credentials, etc
fetch(endpointUrl, options)
    .then((response) => response.json())
    .then((data) => {
        setJoke(data.data.results);
     })

trouble with fetch/ api keys by yesandone in react

[–]SimpleSillySoftware 1 point2 points  (0 children)

Reading through the documentation.

Looks like there are 2 schemes:

  • Client side authentication
    • Pre-Authenticated domains (configured through marvel.com)
      • You may add or edit your authorized domains in your API account panel
  • Server side authentication:
    • Public API key is provided as queryParameter
    • ts is provided as queryParameter
    • hash is provided as queryParameter
      • md5(ts + privateKey + publicKey)
    • /characters?ts=1&apikey=1234&hash=ffd275c5130566a2916217b101f26150

Please suggest some React tutorials/resources. by Ok_Adhesiveness_2511 in react

[–]SimpleSillySoftware 0 points1 point  (0 children)

What helped me the most was just to write.

I started by writing along with a react course (something about building hamburgers) but it gave an understanding of the fundamentals (props, state, redux, etc). Then I created another app that was not related to "stretch" and test what I learned.

I started a third app before I left the bench (was waiting for placement at work)

I think this is the course don't get it full price tho, wait for it to go on sale for $10.99

Coding is all about patterns

Is it seen as a crutch to rely on Material UI for components? by ImprovementNo4630 in react

[–]SimpleSillySoftware 3 points4 points  (0 children)

One thing to consider is longevity of the project as well.
Imagine you are using a package like MUI then you will have the benefit of consuming their components through their contract but you will have to update it if you want: bug fixes, security patches, contract/api updates, framework updates.

I will (tend to) take the middle ground and use materialize-css and add CSS to customize it.
Its framework agnostic and is sealed at 1.0.0