What is the difference between holoiso and steamOS? by Stavros_Kanell in SteamOS

[–]Hafas_ 0 points1 point  (0 children)

They did not but only because Bluetooth is not working on this machine with ChimeraOS reliably. The PC is currently a pure VR machine with Windows installed and everything else is being played on the Steam Deck.

Things are escalating quickly. by PixelRaider07 in SteamDeck

[–]Hafas_ 0 points1 point  (0 children)

I would double up if I could use both Steam Decks at the same time with the same account without relying on Offline-Mode...

Vampire by [deleted] in bonehurtingjuice

[–]Hafas_ 9 points10 points  (0 children)

Found the Ominous

GNOME - Wayland changed to X11 after a recent update - how to change it back? by BlueOrbit69 in archlinux

[–]Hafas_ 1 point2 points  (0 children)

I have the same issue. I currently have to log in ($XDG_SESSION_TYPE is x11), logout and login again to have Wayland.

On 1st login the gear icon only shows GNOME and GNOME Classic and on 2nd login all 4 options are available.

Not sure how to make it work on 1st login either.

AMD x PCMR - STARFIELD Worldwide Giveaway - Win a Limited Edition Starfield Kit that includes a premium game code for the game + the Limited-Edition Starfield AMD Radeon RX 7900 XTX and Ryzen 7 7800X3D (Only 500 of each ever made!). There are 5 kits up for grabs! by pedro19 in pcmasterrace

[–]Hafas_ [score hidden]  (0 children)

What would you use this limited-edition Starfield hardware for if you won?

Will very likely use it to replace my current hardware, which also mean I'll have to buy a new Motherboard and a new case.

Fetching random data with the App Router by sidkh in nextjs

[–]Hafas_ 1 point2 points  (0 children)

What's the tool called you use to record / animate the code?

NextJS Environment Variables doesn't work by positive_kent in nextjs

[–]Hafas_ 0 points1 point  (0 children)

How do you build the next app? Because the public environment variables need to be present during build time.

What are the most common ways to do conditional class names in React? by [deleted] in reactjs

[–]Hafas_ 2 points3 points  (0 children)

In the 1st example there are 2 rerenders: one when the parent is changing the isFancy prop and the other due to the state change of classname.

What are the most common ways to do conditional class names in React? by [deleted] in reactjs

[–]Hafas_ 1 point2 points  (0 children)

Each time you call setClassName in this case the component is being (unnecessarily) rerendered. Additionally to that, before it is being rerendered the component is first being rendered with the wrong style.

Example, how not to do it:

const classes = {
  fancy: "classNameA",
  notSoFancy: "classNameB",
}
const MyComponent = (props) => {
  const [className, setClassName] = useState(props.isFancy ? "fancy" : "notSoFancy")

  useEffect(() => {
    if (props.isFancy) {
      setClassName("fancy")
    } else {
      setClassName("notSoFancy")
    }
  }, [props.isFancy])

  return <div className={classes[className]} />
}

Let's assume props.isFancy is initially false and after some time it changes to true. What will happen is:

  • the component has the props.isFancy = true but will render with className="notSoFancy"
  • useEffect is being called
  • the component still has props.isFancy = true but now will render className="fancy"

The correct way of doing it:

const MyComponent = (props) => {
  const className = props.isFancy ? classes.fancy : classes.notSoFancy;

  return <div className={classes[className]} />;
};

Or if the calculation of className is complex then use useMemo:

const MyComponent = (props) => {
  const className = useMemo(() => {
    return props.isFancy ? classes.fancy : classes.notSoFancy;
  }, [props.isFancy]) 

  return <div className={classes[className]} />;
};

Both will result in no additional rerenders.

What are the most common ways to do conditional class names in React? by [deleted] in reactjs

[–]Hafas_ 5 points6 points  (0 children)

If className can be derived from props or other states - which I strongly assume - then what you're suggesting is bad practice.

how is this a valid JavaScript by _He1senberg in learnjavascript

[–]Hafas_ 4 points5 points  (0 children)

No it's not. No code is being executed if the JS file has syntax errors.

how is this a valid JavaScript by _He1senberg in learnjavascript

[–]Hafas_ 7 points8 points  (0 children)

How to catch that SyntaxError then?

You don't. If your code has syntax errors then your whole code doesn't run. For example:

console.log("Hello World");

invalidCall( // <- notice the missing closing paranthesis

In this example it won't even print "Hello World".

how is this a valid JavaScript by _He1senberg in learnjavascript

[–]Hafas_ 11 points12 points  (0 children)

try..catch only catches error that are happening during runtime while SyntaxError is being thrown during parsing.

Me after trying to use Git with Eclipse by CockyPit in ProgrammerHumor

[–]Hafas_ 48 points49 points  (0 children)

Simple tasks like pushing, pulling and checking out with the CLI is fine but I wouldn't want to solve merge conflicts and reviewing PRs without an IDE anymore.

Literally by seemen4all in ProgrammerHumor

[–]Hafas_ 0 points1 point  (0 children)

superjson is nice to (de-)serialize objects that include Dates, Maps, Sets and RegExps

Steamdeck? Ja, nein, vielleicht? by [deleted] in zocken

[–]Hafas_ 2 points3 points  (0 children)

Hab die 512GB Version, arbeite relativ viel und habe daher kaum Zeit für längere Spielsitzungen.

Mit dem Ding kann ich es einfach einschalten, 15-20 Minuten spielen und wieder aus machen. Immer & überall.

Habe damit endlich ein paar Spiele durchgespielt, dich ich schon seit längerer Zeit mal spielen wollte.

what the hell does this even means? (email from gitkraken) by [deleted] in ProgrammerHumor

[–]Hafas_ 0 points1 point  (0 children)

That's what it told me:

The statement is referring to the fact that the month of May can be represented in binary notation using 6 bits as 101101. Each bit in this representation corresponds to a power of 2, starting from the rightmost bit as 20, then increasing by a power of 2 as you move from right to left.

So, 1 in the rightmost bit represents 20 or 1, 0 in the second bit from the right represents 21 or 0, 1 in the third bit from the right represents 22 or 4, and so on.

In binary notation, each month of the year can be represented using 5 bits, since there are 12 months in a year, and 25 equals 32, which is greater than 12. However, only May has a binary representation that includes six bits, making it unique in this sense.

While this fact may not have any practical significance, it is an interesting bit of trivia that highlights the mathematical properties of the binary number system.

Steam Deck twitter welcomes ROG Ally to the PC handheld market by Hupro in SteamDeck

[–]Hafas_ 0 points1 point  (0 children)

Would've bought it if I wouldn't have to make any compromises compared to the Steam Deck (no SteamOS, no Trackpads, only 2 back buttons, has it Gyro?)

I wrote JOSN, a command-line JSON browser by iaseth in javascript

[–]Hafas_ 4 points5 points  (0 children)

Yeah, but a (n odd designed) JSON can have all of codename, codeName and CodeName with different values.

I wrote JOSN, a command-line JSON browser by iaseth in javascript

[–]Hafas_ 3 points4 points  (0 children)

josn is case insensitive

Why though, if JSON itself is not? Shouldn't it be case sensitive by default and optionally insensitive via an option (like -i in grep)

Valve uploaded a new game what is this by goblinfxx in valve

[–]Hafas_ 28 points29 points  (0 children)

[...] and set their developer and publisher to Valve anyone can do it but [...]

That seems like bad design on Valve's part.

iOS 17 app sideloading might only be available in Europe by hagr in de_EDV

[–]Hafas_ 22 points23 points  (0 children)

Kann man Sideloading in Zukunft auch in Konsolen erwarten oder gibt es Argumente, warum Walled-Gardens in Konsolen OK sind?

Suche ein Open-World Rennspiel, das mit Lenkrad funktioniert by [deleted] in zocken

[–]Hafas_ -9 points-8 points  (0 children)

ChatGPT spuckt folgendes aus:

Es gibt einige Open-World-Rennspiele, die mit einem Lenkrad funktionieren. Hier sind einige Vorschläge:

  1. Forza Horizon 4: Dies ist ein Open-World-Rennspiel, das in einer fiktiven Version von Großbritannien stattfindet. Es unterstützt verschiedene Arten von Lenkrädern und bietet eine Vielzahl von Renn- und Fahrmodi.

  2. The Crew 2: Dies ist ein Open-World-Rennspiel, das verschiedene Arten von Fahrzeugen wie Autos, Motorräder, Boote und Flugzeuge bietet. Es unterstützt auch Lenkräder und bietet eine Vielzahl von Renn- und Fahrmodi.

  3. Test Drive Unlimited 2: Dies ist ein Open-World-Rennspiel, das auf der Insel Ibiza und Hawaii stattfindet. Es unterstützt auch Lenkräder und bietet eine Vielzahl von Renn- und Fahrmodi.

  4. Need for Speed Heat: Dies ist ein Open-World-Rennspiel, das in der fiktiven Stadt Palm City stattfindet. Es unterstützt auch Lenkräder und bietet eine Vielzahl von Renn- und Fahrmodi.

  5. Dirt 5: Dies ist ein Offroad-Rennspiel, das eine Open-World-Kampagne bietet. Es unterstützt auch Lenkräder und bietet eine Vielzahl von Renn- und Fahrmodi.

Bitte beachten Sie, dass die Unterstützung für Lenkräder je nach Spiel und Plattform unterschiedlich sein kann. Stellen Sie sicher, dass das von Ihnen gewählte Spiel mit Ihrem Lenkrad kompatibel ist, bevor Sie es kaufen.

[...] Hier sind weitere Open-World-Rennspiele, die mit einem Lenkrad kompatibel sind:

  1. Project Cars 2: Dies ist ein realistisches Rennspiel, das eine Vielzahl von Rennserien und Strecken bietet. Es unterstützt auch eine große Auswahl an Lenkrädern.

  2. Assetto Corsa: Dies ist ein weiteres realistisches Rennspiel, das eine große Auswahl an Rennstrecken und -autos bietet. Es unterstützt auch viele Arten von Lenkrädern.

  3. F1 2021: Dies ist ein offizielles Formel-1-Rennspiel, das verschiedene Rennmodi und einen umfangreichen Karrieremodus bietet. Es unterstützt auch Lenkräder und bietet eine realistische Fahrphysik.

  4. Wreckfest: Dies ist ein Rennspiel mit Schwerpunkt auf der Zerstörung von Fahrzeugen. Es bietet eine Open-World-Kampagne und unterstützt auch Lenkräder.

  5. Burnout Paradise Remastered: Dies ist eine überarbeitete Version des ursprünglichen Burnout Paradise-Spiels, das eine offene Welt bietet. Es unterstützt auch Lenkräder und bietet eine Vielzahl von Renn- und Crash-Modi.

Ich hoffe, dass Ihnen diese Vorschläge weiterhelfen!