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
Head Bee Guy
Jun 12, 2011

Retarded for Busting
Grimey Drawer
Hey all, I'm teaching myself some webdev to hopefully switch careers to something data journalism adjacent. I've assigned myself a little project to build a React app to find how many car crashes have occurred on any given street or intersection in NYC. For the first proof-of-concept stage, it will just be a search bar that pulls data from NYC's open database API and returns the results in an HTML grid, and I'll be using this dataset of car-crashes. I got started using create-react-app, and I'm wondering how I should structure this.

Should the search bar be a separate component than what actually calls the API? Should I use Fetch API to retrieve data from the database? Are there any component libraries that streamline the process, avoiding unnecessary wheel re-invention?

Adbot
ADBOT LOVES YOU

prom candy
Dec 16, 2005

Only I may dance

Head Bee Guy posted:

Hey all, I'm teaching myself some webdev to hopefully switch careers to something data journalism adjacent. I've assigned myself a little project to build a React app to find how many car crashes have occurred on any given street or intersection in NYC. For the first proof-of-concept stage, it will just be a search bar that pulls data from NYC's open database API and returns the results in an HTML grid, and I'll be using this dataset of car-crashes. I got started using create-react-app, and I'm wondering how I should structure this.

Should the search bar be a separate component than what actually calls the API? Should I use Fetch API to retrieve data from the database? Are there any component libraries that streamline the process, avoiding unnecessary wheel re-invention?

react-query is currently the most popular data fetching library so it's probably worth using to grab your data. you'll have to use fetch or axios (just use fetch) alongside that. i'd probably structure it somewhat like this:

code:
function MyApp() {
  const [query, setQuery] = useState("");
  const { data, status, error } = useMyCustomDataFetchingQuery(query) // read the react-query docs for more on this

  return (
    <main>
      <SearchBar query={query} onChange={setQuery} />
      {status === 'loading' ? (
        <div>Loading...</div>
      ) : status === 'error' ? (
        <div>gently caress! {error}</div>
      ) : (
        <SearchResults results={data} />
      )}
    </main>
  )
}

Armauk
Jun 23, 2021


Head Bee Guy posted:

I'm teaching myself some webdev to hopefully switch careers to something data journalism adjacent.
Data journalism adjacent in what way?

worms butthole guy
Jan 29, 2021

by Fluffdaddy
my tip to anyone learning webdev:


learn how to filter and sort data


we've went through 3 indian dev shops in the past month who say they can do it but in fact actually can't. so it gets sent back internally.

I don't know why this is so hard for people.

MrMoo
Sep 14, 2000

That’s just “face” though, you have to get them to prove their ability, their word, alas, is meaningless.

prom candy
Dec 16, 2005

Only I may dance

worms butthole guy posted:

my tip to anyone learning webdev:


learn how to filter and sort data


we've went through 3 indian dev shops in the past month who say they can do it but in fact actually can't. so it gets sent back internally.

I don't know why this is so hard for people.

Also learn the difference between filtering and sorting and how to explain it to non-tech people. I get so many requests from people who conflate the two terms and if I just did exactly what they asked for I'd wind up with features that make no sense.

Oh and also don't just do exactly what you're asked to do because you'll wind up building the wrong thing. Figure out the "why" behind the ask and then work with the stakeholder to come up with the right approach. I'm not a great coder but I've gotten as far as I have in my career because I'm half-decent at talking tech with non-tech people without talking down to them and also making an effort to understand the business needs that are driving tech requests. Important skills imo.

Last Chance
Dec 31, 2004

prom candy posted:


Oh and also don't just do exactly what you're asked to do because you'll wind up building the wrong thing. Figure out the "why" behind the ask and then work with the stakeholder to come up with the right approach. I'm not a great coder but I've gotten as far as I have in my career because I'm half-decent at talking tech with non-tech people without talking down to them and also making an effort to understand the business needs that are driving tech requests. Important skills imo.

This is extremely good advice

Head Bee Guy
Jun 12, 2011

Retarded for Busting
Grimey Drawer

Armauk posted:

Data journalism adjacent in what way?

If not working directly for a publication/journalism outfit, then working for a company that makes similar tools.

camoseven
Dec 30, 2005

RODOLPHONE RINGIN'

prom candy posted:

Oh and also don't just do exactly what you're asked to do because you'll wind up building the wrong thing. Figure out the "why" behind the ask and then work with the stakeholder to come up with the right approach. I'm not a great coder but I've gotten as far as I have in my career because I'm half-decent at talking tech with non-tech people without talking down to them and also making an effort to understand the business needs that are driving tech requests. Important skills imo.

This has been my secret to not getting laid off. Except it's not a secret, it's the first thing I tell anyone looking for advice. Coding is obviously the job, but communication is what makes it work

kedo
Nov 27, 2007

Last Chance posted:

This is extremely good advice

Yes, this is amazingly good advice. The vast majority of lovely devs I've worked with were lovely not because they were bad coders, but because they were terrible at interacting with non-coders and took every single thing a client said absolutely literally. Don't do this.

e: I'll never forget a meeting I sat in where a client said, "...and then we want the app to take a picture so it can..." and this absolute neanderthal of a dev I am so happy I'll never work with again audibly scoffed and said, "an app can't take a picture, the camera takes the picture," and I just wanted to die right there.

kedo fucked around with this message at 20:20 on Dec 22, 2022

minato
Jun 7, 2004

cutty cain't hang, say 7-up.
Taco Defender
It's common to hear stakeholder feedback like "you gave me what I asked for, but not what I wanted", so yeah it's absolutely critical to understand the stakeholder's goal, not just their ask.

The Dave
Sep 9, 2003

Yeah the best thing I got out of my short stint in the consulting world was the skills in stakeholder management, pitching ideas, communicating our value, and deconstructing our designs into simple concepts they understand that backed up into goals/principles we established in previous sessions.

It's usually one of the big things that separates the entry level contributors from the leaders. It's also shocking when someone has been on the team for 5-10 years and they still haven't developed those skills at all.

Armauk
Jun 23, 2021


Head Bee Guy posted:

If not working directly for a publication/journalism outfit, then working for a company that makes similar tools.

In additional to web development, look into handling and processing election results. Scores of national news organizations need engineers to handle that work.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

Boba Pearl posted:

If anyone was wondering I gave up on Drupal, Hugo, Jekyll, and Wordpress, and now I'm just running pure html and js

https://bobapearlessence.com

I hate how much I had over complicated this process.

Heck yes, now if only "GitHub Pages" would do this.

Paul MaudDib
May 3, 2006

TEAM NVIDIA:
FORUM POLICE

Nolgthorn posted:

Heck yes, now if only "GitHub Pages" would do this.

what's wrong with jekyll? or is it just passé at this point?

prom candy
Dec 16, 2005

Only I may dance
Astro is the cool way to build those kinds of websites now

kedo
Nov 27, 2007

What sites are people looking at for jobs these days? I'm about to start hiring for a position pretty soon, and I've been out of the hiring loop for awhile.

Armauk
Jun 23, 2021


kedo posted:

I'm about to start hiring for a position pretty soon, and I've been out of the hiring loop for awhile.

Twitter. Lots of now-unemployed people tweeting about being laid off. Take your pick of people laid off from Meta, Twitter, Coinbase, Stripe, and, soon, Microsoft.

Methanar
Sep 26, 2013

by the sex ghost

Armauk posted:

Twitter. Lots of now-unemployed people tweeting about being laid off. Take your pick of people laid off from Meta, Twitter, Coinbase, Stripe, and, soon, Microsoft.

And Google. And salesforce. And every deadend VC-funded startup that had the rug pulled out from under them.

The Dave
Sep 9, 2003

There’s also a lot of that “I just got laid off” and “these places are hiring” conversations happening on LinkedIn.

teen phone cutie
Jun 18, 2012

last year i rewrote something awful from scratch because i hate myself
yeah i pretty much only browse linkedin these days

or peoplefirstjobs.com

The Dark Souls of Posters
Nov 4, 2011

Just Post, Kupo

Methanar posted:

And every deadend VC-funded startup that had the rug pulled out from under them.

Oh, hi

teen phone cutie
Jun 18, 2012

last year i rewrote something awful from scratch because i hate myself
this might be an extremely dumb question, but is there a way to set a cookie for https://www. and non-www. versions of your site?

currently, mine only will set for the one you're on

Last Chance
Dec 31, 2004

teen phone cutie posted:

this might be an extremely dumb question, but is there a way to set a cookie for https://www. and non-www. versions of your site?

currently, mine only will set for the one you're on

May not be an option for you but I’d settle on just one and redirect traffic to it and not have both.

CarForumPoster
Jun 26, 2013

⚡POWER⚡

Last Chance posted:

May not be an option for you but I’d settle on just one and redirect traffic to it and not have both.

I’ve always thought that’s better for SEO and users that way too.

teen phone cutie
Jun 18, 2012

last year i rewrote something awful from scratch because i hate myself
yeah that's what i figured i would have to do

so this is a snippet from my nginx config

code:
server {
    listen 443 ssl; # managed by Certbot
}

server {
    if ($host = site.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    if ($host = www.site.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


  listen 80;
  server_name www.site.com site.com;
}
which just has to change to this yeah? anything i'm missing?

code:
server {
    listen 443 ssl; # managed by Certbot

    if ($host = wwww.site.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot
}


server {
    if ($host = site.com) {
        return 301 https://site.com$request_uri;
    } # managed by Certbot


    if ($host = www.site.com) {
        return 301 https://site.com$request_uri;
    } # managed by Certbot


  listen 80;
  server_name www.site.com site.com;
}

minato
Jun 7, 2004

cutty cain't hang, say 7-up.
Taco Defender

teen phone cutie posted:

this might be an extremely dumb question, but is there a way to set a cookie for https://www. and non-www. versions of your site?

currently, mine only will set for the one you're on

If you explicitly set the "domain=blah.com" field in the cookie then it will be sent for blah.com, www.blah.com, and foo.www.blah.com. If you don't set the "domain=" field in the cookie, then the cookie will only ever be sent to the domain that it was originally set on.

teen phone cutie
Jun 18, 2012

last year i rewrote something awful from scratch because i hate myself
i ended up just opting to do the nginx redirect. bad seo is enough to convince me :shrug:

Roadie
Jun 30, 2013
The whole "www" subdomain concept is unnecessary and obsolete. Just redirect from www to the same path on the the domain for any oldbrains who haven't gotten the message yet.

marshalljim
Mar 6, 2013

yospos
A DNS CNAME for www would accomplish basically the same thing as setting 301 redirects, right? If so, is one of those preferable, in general, to the other with regard to SEO, performance, maintenance, or anything else?

ModeSix
Mar 14, 2009

marshalljim posted:

A DNS CNAME for www would accomplish basically the same thing as setting 301 redirects, right? If so, is one of those preferable, in general, to the other with regard to SEO, performance, maintenance, or anything else?

It's better to use a 301 redirect than using a CNAME for Google indexing really. Google in general prefers not www addresses. This is all from experience speaking and I have no hard evidence I can present one way or the other, just have had better results with non www indexing using 301s.

kedo
Nov 27, 2007

Apropos of nothing let me just say I really, truly loath GoDaddy. I'm in the midst of launching a site that required moving a client's nameservers from another host back to GoDaddy, and in the middle of the process, GoDaddy's control panel server kicked the bucket. So now the nameservers have updated and are pointing... nowhere... and I have no ability to change them. All of my client's various services that rely on the domain are down. GoDaddy support's best recommendation is "try back in a couple of hours."

:smithicide:

e: In a surprise to no one, GoDaddy support has no ability to update DNS records without using their web interface, which is broken. Why would they? After all, they only own the servers.

kedo fucked around with this message at 16:34 on Feb 16, 2023

America Inc.
Nov 22, 2013

I plan to live forever, of course, but barring that I'd settle for a couple thousand years. Even 500 would be pretty nice.

kedo posted:

Apropos of nothing let me just say I really, truly loath GoDaddy.

Why don't you use Netlify you boomer
https://docs.netlify.com/domains-https/netlify-dns/

E: actually it looks like anyone using GoDaddy should drop it like it's hot and run: https://arstechnica.com/information-technology/2023/02/godaddy-says-a-multi-year-breach-hijacked-customer-websites-and-accounts/

America Inc. fucked around with this message at 21:17 on Feb 18, 2023

Pekinduck
May 10, 2008
This seems like a silly question but I'm not getting anywhere searching for stuff. Is there a good place to get basic sets of CSS styled elements? I have a web interface I want to make more visually appealing. Nothing too complicated but a lot of tables and user inputs. Everything I find seems to be a completed website template. Thanks!

FISHMANPET
Mar 3, 2007

Sweet 'N Sour
Can't
Melt
Steel Beams
I think Bootstrap does that, there's probably others that do similar things.

America Inc.
Nov 22, 2013

I plan to live forever, of course, but barring that I'd settle for a couple thousand years. Even 500 would be pretty nice.

FISHMANPET posted:

I think Bootstrap does that, there's probably others that do similar things.

There's also Tailwind, if I'm correctly understanding your concern as being that you want to make your existing HTML look better and not just add premade components.

prom candy
Dec 16, 2005

Only I may dance
Tailwind doesn't come with any real styles. There's also shoelace https://shoelace.style

MikeJF
Dec 20, 2003




Here's a big framework list

If you just want something simple I'd go for one of the minimalist frameworks, less heavy than Bootstrap. Maybe Milligram or Pico.

If the page is simple enough you could even go for one of the classless ones that just applies styles to native element tags, like Water or MVP.

America Inc.
Nov 22, 2013

I plan to live forever, of course, but barring that I'd settle for a couple thousand years. Even 500 would be pretty nice.

prom candy posted:

Tailwind doesn't come with any real styles. There's also shoelace https://shoelace.style

TIL you can define your own custom HTML elements (aka Web Components). React and Vue are the kiddy pool - and yet so much of the ecosystem and job requirements are built around it.

Well now I know some skills I can learn to get away from the herd.

America Inc. fucked around with this message at 08:38 on Feb 23, 2023

Adbot
ADBOT LOVES YOU

MikeJF
Dec 20, 2003




Web Components is a thing that's been planned for a while but only phased in to standard everywhere a few years ago, it's an effort to bring all this framework-based stuff and library ecosystem under control and let people make components that are truly encapsulated and interoperative through a universal standard, so they can be used inside arbitrary other libraries or frameworks without causing a mess.

It's not explicitly a replacement for React and Vue and stuff, but it can take over some of their areas. Web Components are individual elements, while those frameworks are meant to then be raised to 'overall webapp management' level.

MikeJF fucked around with this message at 09:10 on Feb 23, 2023

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