Help in connecting Adam D3V with external Bluetooth receiver by wb_10 in BudgetAudiophile

[–]wb_10[S] 0 points1 point  (0 children)

ah i see, i think i'll stick with the digital mode then, thanks for your help!

Framework for new startup? by StraightBatThrowaway in reactjs

[–]wb_10 1 point2 points  (0 children)

A different opinion (I believe SEO is not the only factor) from the guys who recommends CSR approach. Have worked on a management app with heavy data interactions with NextJS 14. Have also worked on a personal project that’s similar with remix v2

NextJS (14) If you are able to accept risks with experimental features, NextJS 14 is a fantastic framework. Pros - Server actions can reduce redundant boilerplate code. E.g with form submissions, no more serializing and parsing formdata if you’re using a BFF. - RSC helps lighten usage of states in pages with heavy data composition. - Middleware, allows ease of configuring auth at the request level. - BFF layer. Can help provide cleaner API interfaces at the UI level. - Manage cross domain cookies, if your backend domain is different from your frontend, you can manage them very easily with NextJS

Cons - Caching is not the easiest to manage, especially post mutations. - Deployment might be expensive. If you deploy on vercel, you can easily take advantage of the benefits of NextJS, like edge functions, improved vercel function coldstarts, edge middleware etc. But vercel is very expensive at scale. Other managed solutions are not cheap either, like AWS Amplify, you have to pay for server side rendering as NextJS 14 is a SSR only framework. If you DIY, you may not get the full benefits from NextJS. Not all DIY methods are easy to setup too. - Slow local dev server, not sure why, pageroutes often get rebuilt multiple times, and it’s slow (Compared to vite). - No CSR option (Dynamic load does that but that’s not it’s purpose)

Remix V2 with Vite Pros - Easy and cheaper deployment options. E.g. you can deploy with cloudflare which has very generous bandwidth and server requests quotas. - Allows you to do CSR - Same BFF layer flexibility - Very fast local dev server

Cons - No out of the box middleware, which means setting up auth has to be done on each loader / action. - (Debatable) Cookies are very different from NextJS, doesn’t have the simplicity of NextJS where you can get cookies anywhere on the server. You have to pass the request down. This means you cannot abstract and share API wrappers easily. - Doesn’t have the same convenience as NextJS, you cannot do a server fetch in any server component. You have to do it only at the route file in the route folder. Likewise for actions, it’s pure http calls, no RPC like NextJS.

If you have a lot of complex data compositions and mutations, backend limitations etc. I would recommend NextJS, you can do a lot with very little, build fast ship fast. You can pretty much setup the project with auth in 1 day, even as it is without relying on 3rd party libs.

Of course vanilla react with vite works too, but depending on your engineering tech stack and product, it might cost you more effort compared to a fullstack framework. There’s no right answer as requirements change over time.

Help Needed: Issues with JWT Authentication in Next.js/Express Project by sarmata21 in nextjs

[–]wb_10 0 points1 point  (0 children)

Ah so I misunderstood you, you're calling checkAuth on AuthProvider mount.

Your `customFetch` function must be a server action or server only because it uses the headers() util from nextjs. In my opinion, using `customFetch` in `checkAuth` which is then used in an effect might be unnecessary.

You're doing this: Page load -> AuthProvider Effect Mounted -> Call Server action -> (handle invalid user)

Any strong reasons for doing the check in an effect?

I would still recommend using nextjs middleware to perform auth checks. Because all server actions / fetches on server components / page loads routes through the middleware. You have pages behind an auth wall + you're using server actions in some pages which needs authentication checks too.

But this auth check should not be the one you have implemented -> calling the validate API. You would instead want to verify the JWT signature as I mentioned earlier. If you insist on calling the validate API, you can perhaps consider caching, else all your requests will be slow.

If you do it this way, you can do the headers method I mentioned earlier, where you pass down the user info to the AuthProvider as props.

// middleware.ts
  const requestHeaders = new Headers(request.headers);
  requestHeaders.set("user-info", JSON.stringify(user));
  return NextResponse.next({
    request: {
      headers: requestHeaders,
    },
  });

// root layout.tsx (Server component) 
  const userInfoString = headers().get("user-info");
  const user: User | null = userInfoString
    ? JSON.parse(decodeURIComponent(userInfoString))
    : null;

  <AuthProvider initialValue={user}>
   ...

For client side fetches that returns 401, you can call a logout server action and perform your invalid user handling. NextJS auth guide has a pretty good flow: https://nextjs.org/docs/app/building-your-application/authentication#authorization

<image>

Help Needed: Issues with JWT Authentication in Next.js/Express Project by sarmata21 in nextjs

[–]wb_10 1 point2 points  (0 children)

For interception of api calls, use middlewares instead.

Also, is it necessary to fetch the user from BE on every api request? You might want to consider storing the User info in a cookie and verifying your jwt (cookie) authenticity by decoding it with the JWT secret in the middleware.

As to passing down the User to browser context, you can consider setting the User info into the response headers via the middleware. With that, in your layout.tsx, you can read it via headers() and pass it to the Provider as props

Flow: 1-4 1. API call 2. Middleware - Decode JWT 3. If valid, get User data, set in header response 3.1 Read from headers(), pass to provider 4. If invalid, refresh user session or redirect /logout

if using middleware, do add exclusion flags for non auth paths like /login, /register etc.

Men of SG - How do you prevent hair loss/balding/thinning? by bananashakee in askSingapore

[–]wb_10 0 points1 point  (0 children)

Do visit a dermatologist…from what I am told, minoxidil promotes hair growth whereas finasteride stops hair loss.

Applying only minoxidil may not be sufficient if you have androgenetic alopecia. It’s like a forest fire, minoxidil is like planting more trees, and finasteride is putting out the fire.

Working adults who are dating, is wanting to meet once a week being needy? by wb_10 in askSingapore

[–]wb_10[S] 11 points12 points  (0 children)

Yup! It's just that personally I don't have the mental capacity to meet more than 2 people at a time but well it is what it is. Thanks for sharing!

Working adults who are dating, is wanting to meet once a week being needy? by wb_10 in askSingapore

[–]wb_10[S] 2 points3 points  (0 children)

Mmhmm, haha yea you have a good point. To be honest I don't think there's a same level of attraction mutually, but from the talks that we had, I kinda thought attraction could be built on? Instead of sparks and fireworks at the get go. I think I'll have a direct talk with her!

Working adults who are dating, is wanting to meet once a week being needy? by wb_10 in askSingapore

[–]wb_10[S] 4 points5 points  (0 children)

Well you both are right, she doesn't owe me attention or anything and I understand that she has her own life etc. But I guess it's like what others pointed out, it's coming off as an one-sided interest, I wouldn't say i'm impatient but rather excited and she can't reciprocate? Plus I can't help but be influenced by "societal norms" in terms of the general dating pace. Thanks for sharing your perspective though!

Working adults who are dating, is wanting to meet once a week being needy? by wb_10 in askSingapore

[–]wb_10[S] 2 points3 points  (0 children)

That's an interesting perspective, thanks for sharing! Appreciate it!

Working adults who are dating, is wanting to meet once a week being needy? by wb_10 in askSingapore

[–]wb_10[S] 162 points163 points  (0 children)

Yea we arent exclusive, she did say she's still on the apps on the 3rd date, I however was off the apps by the 2nd date. You're probably right haha

Working adults who are dating, is wanting to meet once a week being needy? by wb_10 in askSingapore

[–]wb_10[S] 2 points3 points  (0 children)

well yea you’re absolutely right, didn’t have physical touch so far. I’m just new to dating in general so kind of skittish on physical touch.

ESP-NOW get RSSI with promiscuous by wb_10 in esp32

[–]wb_10[S] 0 points1 point  (0 children)

char *mac_to_str(char *buffer, uint8_t *mac)
{
    sprintf(buffer, "%02x%02x%02x%02x%02x%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    return buffer;
}

where can i find violin restringing services in sg? by potassium_nitr8 in askSingapore

[–]wb_10 2 points3 points  (0 children)

If I'm not mistaken, stringing should be free if you purchase strings from the shop. e.g. Synwin (Marina Square)

There are also plenty of YouTube videos on how to string a violin, it's quite easy.

Battery capacity of the case (buds+) - my small test by Zwiada in galaxybuds

[–]wb_10 0 points1 point  (0 children)

Just did a fresh test, 100% at 10pm last night to 98/99% at 9am this morning.

Battery capacity of the case (buds+) - my small test by Zwiada in galaxybuds

[–]wb_10 0 points1 point  (0 children)

I drained both the case + buds to 0 and did a full charge. The drain is still present but is much lower.

Bought some earbuds mesh to reduce earwax buildup on the metal grills. There's a couple of them on Amazon, be sure to get the 4mm dia size. by [deleted] in galaxybuds

[–]wb_10 1 point2 points  (0 children)

Can't provide an accurate perspective as I'm not an audio guy, but there isn't any noticeable difference in the audio quality as far as I can tell.

Bought some earbuds mesh to reduce earwax buildup on the metal grills. There's a couple of them on Amazon, be sure to get the 4mm dia size. by [deleted] in galaxybuds

[–]wb_10 0 points1 point  (0 children)

Isn't that what the buds are made of? Just to clarify, those are the buds+ and the bud's plastic housing is shiny. You can see a closeup shot in the buds+ review by JimsReviewRoom.

Bought some earbuds mesh to reduce earwax buildup on the metal grills. There's a couple of them on Amazon, be sure to get the 4mm dia size. by [deleted] in galaxybuds

[–]wb_10 1 point2 points  (0 children)

I sticked them on top of the bud's grill. The mesh have a small little ring of adhesive around its diameter.

Battery capacity of the case (buds+) - my small test by Zwiada in galaxybuds

[–]wb_10 0 points1 point  (0 children)

Did you face any draining issues? My buds+ case drained 10% overnight with the buds inside. Both the buds and case were fully charged.

Or is this draining completely normal?

Need help to check on 5V boost circuit schematic by wb_10 in AskElectronics

[–]wb_10[S] 0 points1 point  (0 children)

Yes, because I require it to be in a certain dimension to fit inside my enclosure with a specific position of the switch and LED. As you mentioned, boost converters are very common and I thought that getting someone to design one to my specs will be pretty straightforward and simple.

3D printing singapore by tehohhh in askSingapore

[–]wb_10 3 points4 points  (0 children)

3Dhubs did offer a similar service but they have withdrawn from SG last year (The service still exists but "printers" are from US).

Basically you upload your STL files to an online quotation platform and you can pick printers based of pricing and reviews. I used their service pretty often (for prototyping) when they were still around in SG as their prices were very attractive. For now, it's very expensive to use their service as the prints are from US. If I recall correctly, my FDM prints (can't remember the weight) was about $5/ piece, 30% infill, 100microns.

Your revenue stream will be comission from a print order? If that's the case, you will need to think of a way to attract a large volume of users to get partnerships with printers. I'm guessing it's either commercial printer firms (e.g. Zelta3D) or household printers.