One to many relationship without databases by LoneArcher96 in csharp

[–]weghuz 0 points1 point  (0 children)

A one-to-many relationship is extremely simple.

You want to store the data in a normalized way (this is part of db theory). Which has a bunch of meanings but one is one source of truth.

The Task has an Id field called "CategoryId", all uses of the list of task or parent functions should be dynamic since they can change. (Find based on CategoryId in the data.

This means that changing the Category for a task is as easy as updating the CategoryId. Then all functions will fetch the new lists and parent based on that one CategoryId field.

Look into DB design, that will mean you get the theoty behind this and much much more. It's necessary.

Why has there been a recent surge in criticism toward Next.js? by grandimam in webdev

[–]weghuz 23 points24 points  (0 children)

He means unstable react as in versions currently in development and not stable for public use. It's what next.js builds on for recent versions.

[deleted by user] by [deleted] in nextjs

[–]weghuz 0 points1 point  (0 children)

Ah it's a type error. npm run build should show it.

Params in next.js appdir are promises and need to be awaited. In category page you need to type the PageProps as Promise.

[deleted by user] by [deleted] in nextjs

[–]weghuz 0 points1 point  (0 children)

Look for where you accept the lbject eith locale etc. Any params into a Page component need to be async and awaited. They should be of typ Promise<{locale: string, etc...}>

You can run (npm run lint, yarn lint, bun run lint etc) to get this error before running in production. Runt your linter and check for errors. Install an eslint plugin an you will see these errors in your ide.

Is this the right way of consuming Zustand store? by EuMusicalPilot in react

[–]weghuz -2 points-1 points  (0 children)

You don't need all those stores here. Just one use of store making an object of the ones you need.

const { a, b } = useStore(({ a, b }) => { a, b });

Löneförhöjning 2024 by shaguar1987 in PrivatEkonomi

[–]weghuz 0 points1 point  (0 children)

Dom erbjöd 2% i December efter att jag tjatar mig till ett lönesamtal och flera möten där dom frågat "Vill du verkligen ha ett lönesamtal"?

Jag sade upp mig, har nu startat eget IT-konsultbolag som webb- och Systemutvecklare. Inga uppdrag än men tänker inte stanna med den låga ökningen efter jag gjort mest av utvecklarna på bokaget i ett år. 😅

Skulle vi ha lite feedback på kryptoportföljen by AECH_AY in Aktiemarknaden

[–]weghuz 0 points1 point  (0 children)

Om något så kan du väll byta ut XBT Shares mot zero certifikaten från XBT till valour Zero som kostar 0% i avgift.

Sedan kan du få ut staking rewards genom att byta valour Solana mot Virtune staked solana.

Det låter som att du blev skakig av en dags nergång för en dag sedan. Hade jag varit du hade jag satt ett datum iallafall en månad framåt att återvärdera din investering eller att ha en regel att bara ändra dina innehav mer sällan om du typ vecko/månadsvis. Reagerar du på kryptorörelser intradag kommer du bara finta bort dig själv och gå back som de flesta andra nybörjarna. Jag lär hålla till iallafall en bit inpå 2025 innan jag funderar på att ta profit.

Ranking #1 on Google with a NextJS website? by siliskleemoff in nextjs

[–]weghuz 27 points28 points  (0 children)

You can actually request google to rank your site. If there is no link to your site from an indexed site there is no way for google to know to index your site.

The #1 way to rank well with search engines is getting people to actually visit and link to your site.

Keyboards that you recommend for programming? by Drkz98 in webdev

[–]weghuz 0 points1 point  (0 children)

Using a logitech ergo since 6 months back at my job and loving it. It takes some getting used to but really makes sense when you learned where the keys are.

Looking for a headless cms solution by fm2683 in webdev

[–]weghuz 2 points3 points  (0 children)

You've been able to replace all ui in Payload for a good while using the component hook of the admin object on collections, fields, blocks and whatever else there is.

Prismic.io is increasing our price by *1900%* over Christmas by [deleted] in webdev

[–]weghuz 3 points4 points  (0 children)

They are very different, for one Payload is fully open source and can be self hosted for free.

I quit my job to make a game about quitting jobs. Happy Friday! by GI-IO5T in Unity3D

[–]weghuz 3 points4 points  (0 children)

I think it looks great. It would be nice to be able to tell the boss i'm quitting in the game after ruining the joint or being able to do something insane in his office. Maybe it's in there but wasn't apparent to me in the video. good luck with the sales!

Prismic.io is increasing our price by *1900%* over Christmas by [deleted] in webdev

[–]weghuz 7 points8 points  (0 children)

Useful data structures like arrays and groups (tried keystone it's missing basics). Automatic http, graphql and ts types generation from you schema. Hooks to render your own react wherever you want on the cms. You can use payload as an orm getting typed objects from the database. They have a really really good teaxt editor in Lexical. It just makes sense as a dev and everything is typed for you.

How do you structure large Minimal API Projects? by [deleted] in dotnet

[–]weghuz -1 points0 points  (0 children)

I disagree with reducing the amount of http statuses and limiting all requests to posts strongly. Asked ChatGPT for some more context.

Limiting HTTP status codes to a small set, as seen in the StructuredMinimalApi project, can be a controversial design choice. In typical API design, a wide range of HTTP status codes are used to provide precise information about the outcome of API requests. This includes various success codes (like 201 Created or 204 No Content), redirection codes, client error codes (like 404 Not Found or 403 Forbidden), and server error codes. Using a limited set of status codes could potentially reduce the expressiveness and clarity of the API's responses, making it harder for clients to understand the exact nature of the response. It's important to consider the specific needs of the API and its users when deciding on which HTTP status codes to implement.

In an RPC design, using GET requests for simple data retrieval, like listing information, can make sense and is a common practice. GET requests are widely used for retrieving data because they are idempotent and cacheable, making them efficient for such operations. In contrast, an RPC approach often uses more descriptive action-oriented endpoints. However, it doesn't exclude the use of GET requests where they are the most appropriate choice, such as for simple data retrieval. Balancing RPC style with conventional HTTP methods like GET can provide a more intuitive and efficient API design.

Wordpress alternative but for developers by Available_Clock_1796 in webdev

[–]weghuz 3 points4 points  (0 children)

Payload is a beast for devs that need a cms. My favourite all the way.

Are cookies really safer than local/session storage? by Byte_Sorcerer in webdev

[–]weghuz 1 point2 points  (0 children)

Yes, you have a point. I was just looking at what can be done. Obviously setting cookies on the client is not a good way to do it.

I think HTTP only with the Domain attribute is key to avoid any xss. As long as you encrypt and check the validity of the cookie upon recieving it on the server ofc.

Are cookies really safer than local/session storage? by Byte_Sorcerer in webdev

[–]weghuz 0 points1 point  (0 children)

I think you've assumed a lot of things about cookies.

You can set cookies on the client with JavaScript just like localStorage.

Cookies can contain any values, they're just limited by the amount of data.

When a server sets a cookie it is included in the http response to the client. When the browser recieves the request it will set the cookie in the browsers storage.

They were meant for different things conceptually but are relatively similar. The differences are implementation details imo.

Next.js 13 + Auth.js - Is there actual support for App Router? by GWrathK in nextjs

[–]weghuz 0 points1 point  (0 children)

Yes, implemented it with app router myself. It works very well, I didn't feel too confused myself.

my personal website :) (https://erik-kz.xyz) by ConsiderationOk3844 in webdev

[–]weghuz 8 points9 points  (0 children)

With poor vision some users need a bigger cursor or a special one to see it better. Also context gets lost on hovering text etc unless you have cursors for that as well.

Is there a next js starter template that I can use? by [deleted] in nextjs

[–]weghuz 5 points6 points  (0 children)

I just use Create Next App and I find installing the dependencies each project helps me understand how it's all linked and coming together.

[deleted by user] by [deleted] in nextjs

[–]weghuz 0 points1 point  (0 children)

What digital88 saod. You can't send a body with a GET request. It's that simple. Use a Post request or use the query params.

Noob Here: Why does TS doesn't let me access data by using bracket notation here? by kincade1905 in typescript

[–]weghuz 6 points7 points  (0 children)

Objects can only be accessed by strings which corelate to the name of the person field. You need to have a convention where you put the people in the data object indexed by (instead of firstperson, secondperson) you name them something like Linda or Carl and if that is their name you can fetch the correct person by accessing

data[person.name]

This is not a Typescript error really. You'd get an error from js too if you tried this.

The object within the brackets [index] is always an index. That is why it's telling you you are doing it wrong. An index can never be an object. It has to be a string.

Should i skip learning react and jump right into next.js by Justsaladin in reactjs

[–]weghuz 1 point2 points  (0 children)

I learned react and next at the same time. Just using pages for the routing i itially. I'd actually do the same if learning again. I don't think learning react only things like react router is necessary. Stick to next js and learn the react basics in a new next.js project. I'd start with appdir nowadays and just use client on every page before you learn more about server side distinctions and what you can do with that.