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
teen phone cutie
Jun 18, 2012

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

davey4283 posted:

Hit me with some words of wisdom.

my company just told us they had to close one of our programming job recs after a week because there was 1400 applicants

so my words of advice now are you're going to have to accept the fact that you're going to have to put out 300+ applications to get a job. I think I did something like 250 to get my first dev job.

Adbot
ADBOT LOVES YOU

teen phone cutie
Jun 18, 2012

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

Sab669 posted:

Is there a better place to ask Dumb Angular Questions?

I have some function which uploads a file to my .NET API and either refreshes the page if the file is valid, or presents a list of errors if the file is invalid. For the latter, the C# code is just a simple:

return StatusCode(500, listOfErrors);


My Angular function is basically just:

code:
foo(){
  this.uploadService.upload(file).subscribe(
  next: success => {
    //refresh the page
  },
  error: err => {
    //present the list of errors
  }
  ;)
}

upload(file: Blob): Observable<string>
{
  //creatiion of some objects
  return this.http.post<string>(apiUrl, formData, HeaderObject).pipe(catchError(this.handleError<string>('File Upload')));
}
But despite the API returning a 500 error, the code still steps into the "next" block. I feel like I've gotta be missing something absolutely stupid but I cannot seem to figure it out today :sigh: Any ideas?

i don't know angular at all, but my guess would be either catchError or this.handleError is swallowing the exception and instead returning a value that doesn't trigger the error block to run

teen phone cutie
Jun 18, 2012

last year i rewrote something awful from scratch because i hate myself
just throwing out ideas but maybe you could save the response to a database somewhere and instead open in a new tab a page with the response ID, which the newly opened page will query and display the databased-saved results

or maybe tokenize the payload that's being sent in the url and untokenize it in the new tab and make the request.

idk man

teen phone cutie
Jun 18, 2012

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

America Inc. posted:

Thanks for these links! I've been taking some things for granted with React, so I should refresh on the basics.

For this particular case, I found that I could add a useEffect to reset the page number on query change. It's not elegant, but it works.
code:
useEffect( () => { setPageNo(1); }, [query] )

you want to call setPageNo(1) in the same place where you call setQuery() because it's more performant

The reason is because react batches state updates so if you have 1 function that updates 3 pieces of state, the component only gets rendered once.

https://react.dev/learn/queueing-a-series-of-state-updates

with your useEffect, you're creating an extra render unnecessarily.

teen phone cutie
Jun 18, 2012

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

CarForumPoster posted:

There’s lots of ways to do this

This was the advice I always got when going to my computer science professor's office hours and I always left his office more confused than when I walked in

Adbot
ADBOT LOVES YOU

teen phone cutie
Jun 18, 2012

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

EpicCareMadBitch posted:

Wondering as someone that has little knowledge on web development as to how do i sit down and create the website I envision? Would site builders be a better option? Or even Fiverr? I would like full control though. Just asking as a n00b here, it would be a blog setup by the way.

if you want something minimal with very little setup (but still giving you full control over the look/styles), I can't recommend bearblog or pika enough:

https://bearblog.dev (I use this personally and I love it)
https://pika.page

but if you're looking for something a little more powerful, I've had success with Ghost CMS:

https://ghost.org/

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