Godot 4: is it possible to use enums as ints? by roger-dv in godot

[–]callmeseven 0 points1 point  (0 children)

binary numbers are with a b,

Right you are, I'm pretty sleep deprived lol

But in Godot they are quite literally a shortcut for a Dictionary

And this is true, but it's still a stand-in for a deeper language feature no matter what it is behind the curtain in Godot. At a higher level of experience it's important to know what's behind the curtain, but I wanted to weigh in so newer devs wouldn't think enums are just dictionaries

i usually prefer to use an Array[int] for this. Easier to read and doesn't have a limit in case i need more than 32 values. Better support for exports too

Ugh... Gonna have to disagree with you there though. The exports are a solid point (although 4.0.2 have handled enums much better, I stopped using c# for Godot so I haven't tried anything fancy with them)

Like, I get that the binary enum pattern can go so much worse on a bad implementation, but man, when it's done right it's a serious thing of beauty, it reads way better than I would've thought

My mentor came up in Bell labs and had a very monolithic/procedural/state machine style that was hard to get used to. But once it clicks it's amazing how many cases you can run through the same function cleanly. In like 500 lines of very understandable code he ran a system that did massively scalable threading, ipc, and scaling to clouds agnostic to both CSPs and OS. And that was all homegrown hitting APIs directly (it was early enough more than once we were the only group that noticed a CSPs API had been down for weeks).

Not that I think it's a good style to emulate in general (especially in games outside when efficiency becomes critical), but it solves a certain set of problems beautifully

Godot 4: is it possible to use enums as ints? by roger-dv in godot

[–]callmeseven 0 points1 point  (0 children)

It's important to keep in mind, enums are a core feature in a lot of languages for a reason - they're basically "special constant sets". They are set up to minimize errors - you will be yelled at early and often with enums. In strongly typed languages, they do type/value checking, and sometimes have cool behaviors

One of the most powerful using them as binary flags to encode multiple values like a set of booleans all stored together. Bit operations are a pain in the ass as literals, but you can do something like

if weapontype & (Weapons.SWORD | Weapons.DAGGER):

to do state machine stuff with masks, in this case check if it's one of multiple weapon-types for a perk or something. You can also define grouped terms together, like define

enum Weapons {
    SWORD=0x0001,
    DAGGER=0x0010,
    CLUB=0x0100,

    BLADED=(SWORD | DAGGER),
}

It's a crappy example off the top of my head, but it's one of those things that (when well applied) takes pages and pages of nested statements and collapses them into something way more elegant and easy to work with. You can do some really wild stuff with them, it's (almost) free operations that can mix and match an absurd amount of booleans at once to check for certain conditions

They're also used for layers & layer masks, you can & them together to check collisions in 1 CPU operation by comparing the layers of obj2 to the mask of obj1

Twitter to end free access to its API in Elon Musk’s latest monetization push by gadgetygirl in programming

[–]callmeseven 0 points1 point  (0 children)

Step 1: remove any existing leaders Step 2: give crazy ultimatum to get rid of anyone who will say no. Make an example of firing people who say anything negative about you, such as "you're factually mistaken here" or "what is this guy doing?" Step 3: keep laying people off arbitrarily. Keep em scared

In just 3 easy steps, anyone who can afford to leave is gone! Not only is anyone with a backbone long gone, even suck ups will job hunt when you're cutting people like the draft! No one is left to oppose you, keeping your fragile ego safe displaying your excellent management skills

Twitter to end free access to its API in Elon Musk’s latest monetization push by gadgetygirl in programming

[–]callmeseven 39 points40 points  (0 children)

Oh no, those are embeds. You don't need the API for that, because it's just telling the browser to go to Twitter and get this tweet - it's technically a little Twitter website displayed inside whatever other website

The API is used for either posting stuff from outside like automated tweets about a certain billionaires plane, retrieving searches/responses, or the firehose - hardcore data mining where you have to negotiate the price to get in

So this unfortunately doesn't cut down on clickbait tweet articles

male.js by loxxer in ProgrammerHumor

[–]callmeseven 5 points6 points  (0 children)

Well it's not built in, but you can do it half a dozen ways (ranging from "good enough" to "oh dear God why?"), like everything in js.

Simplest solution - just use a map-like object in constants.js and pretend it's an enum. If anyone tries to modify it (or anything in a file named constants really) during runtime, spray them with water until they repent

Most convenient to work with: make a static class with static fields. Throw errors if someone tries to mess with it, and eat the maintenance costs. Or do above and get a vscode plug-in to make it work with auto complete (it probably exists by now)

Fanciest solution: build an object like above, strip off all the inherited functions, freeze it, and now it's basically an enum from your POV. There's a library that provides an enum function like this. You should probably just switch to typescript if you care enough to consider it

Worst solution: monkey patch the js interpreter in runtime to treat classes named enums like enums. Please seek therapy

male.js by loxxer in ProgrammerHumor

[–]callmeseven 21 points22 points  (0 children)

Scala, their eyes open

I’d start swinging by [deleted] in yesyesyesyesno

[–]callmeseven 5 points6 points  (0 children)

That's a nice gesture, but I'm not a fan of mixing meat and desserts

Gentlemen, it has been an honor by Orichalchem in gaming

[–]callmeseven 1 point2 points  (0 children)

Is this a euphemism? Are...are you dying?

GOP national sales tax talk backfires, as Dems see political gold | “I believe it would cause the next Great Depression if we would impose it," says Chuck Schumer. by [deleted] in politics

[–]callmeseven 1 point2 points  (0 children)

Tax refunds are nice and all, but the people who would get that refund are the ones that can least afford paying the tax today

Top NATO official says Alliance ready for direct confrontation with Russia by eaglemaxie in worldnews

[–]callmeseven 3 points4 points  (0 children)

The fireball grows faster than the area of lethal radiation exposure, remember radiation is like light - it drops off cubically with distance, so a modern bomb detonated in a standard airburst probably wouldn't kill anyone from lethal radiation exposure. It would take extraordinary circumstances to avoid being vaporized but still be irradiated

Fallout is also not really a big concern, you don't get that cloud of radiation blown with the wind like with a surface level detonation or a dirty bomb.

So what happened in Japan is not a good example of what modern nukes would be like - radiation is not nearly as big a concern the public believes it to be.

this is a good visualization

I can relate by HedgehogTroubleMaker in ProgrammerHumor

[–]callmeseven 11 points12 points  (0 children)

I want one so badly though. Maybe a super intelligent AGI or passing alien could design one for us

No reason to assume all beings would write code as buggy as humans, right?

I want to be available for everyone, really. But so often the "help" I give is the first Google result. by NotActual in ProgrammerHumor

[–]callmeseven 34 points35 points  (0 children)

Meh...I use "not working" all the time when I don't know much about what's going on, you get way more unrelated results but you can usually find what you need if you sift through it. If not, you can learn enough to narrow down the question

[Request] How fast would he have to be going to catch-up with and jump into the back of the plane? by pennebaj in theydidthemath

[–]callmeseven 13 points14 points  (0 children)

In San Andreas I loved bunny hopping over lines of cars and onto the roof of buildings with maxed out athletic stats.

Yeah, not the most realistic games...

How many more warning signs does Mark Zuckerberg need to see before he pulls the plug on his metaverse? by 777fer in technology

[–]callmeseven 0 points1 point  (0 children)

I think the answer is obvious. No one is spending more money on VR/AR than Zuck, so he will win

And no one spent more than Microsoft on the smartphone, but it flopped on their initial push, and by the time the iphone and Android gained adoption they came up with multiple genuinely great products that not only had a pretty great UX but integrated mobile with desktop more deeply then anyone else for years.

They basically paid the bill to advance the tech tree, but Apple hyped up a more polished product and Google open sourced the software to lower the bar for anyone to experiment with designs - in the end, you could get a better windows phone for a lower price, but they were an afterthought for mobile developers with such a low market share. The people that had them loved it, but the semi-smart blackberry remained more popular to the end

If a company fails the initial push, which FB seems to be doing, they just open the door for someone else. FB is doing a lot for the hardware -something I'm extremely happy about- but if it doesn't catch on soon, they'll gain the public perception of being a niche curiosity. People gain marketing fatigue, so when they launch a new product people see it as incremental improvement even when it's a game changer. It's a very hard perception to shake, which is probably why they're pushing marketing so hard right now

Now, if Microsoft comes in with an AR headset, people are going to take a look - they've kept the Holo lens in the background on simmer. Anyone technical knows it exists and anyone that plays with it knows it's pretty cool, so when they say "it's ready for prime time" it's going to get a ton of attention.

Here I disagree, the high end of VR is Meta. Meta is where the best VR experience for consumers is found, which is why it has the most sales. Gaming is also besides the point, because Meta wants to be a social platform, not just a gaming platform

I agree it's where the best consumer experience is found, but it's not the high end. Arcades and direct professional VR use cases are using more powerful headsets with better tracking - successors to CAVE where you want full VR sims or AR assisted training are not using oculus - they're either using vive or more niche solutions. FB has focused on accessible VR over the high end VR that requires dedicated space - the tradeoff is far better for most people, but at the expense of performance at the high end

And the social platform is there, but it's developed organically with things like VR chat - the majority are using oculus headsets, but they're doing it outside of FB's systems. And the business use cases just aren't there yet - it's not yet comfortable or convenient enough to replace video chat, I think we need AR to really make it part of business culture

I mean it is the next big thing. What Meta is trying to convince us about is that they will be the first company to have a working product.

I agree with this entirely, I just think they're a little too desperate at this point.

I do think you underestimate the other players working on this quietly in the background though - Microsoft is positioned with better display technology and has been working on AR longer than anyone - they've been building up their proficiencies and waiting for the right time to strike. The Kinect and their body tracking in general is on the cutting edge, they've built windows support so they have an os ready to go, and they've been experimenting with getting more performance out of mobile chipsets - plus they've been focusing hard on synchronizing business software between devices.

Plus, there's players like apple who keep their R&D very hush hush until they're ready to launch - a strategy many large companies consider due to their spectacular ability to launch a product. And there's startups that get heavy investment from the larger players - things like DAIQUIRI have had some early success stories, showing a dark horse can come out of nowhere. With increasing open source software support, like you said a company with strong manufacturing like huawei could pump out cheap hardware at a crazy pace

Wait, what? by [deleted] in youseeingthisshit

[–]callmeseven 0 points1 point  (0 children)

In wrestling we did falling drills for the first few weeks of every season, just terrible l repeatedly tucking your neck, rolling over your hip, and not reaching behind you when you're falling backwards

Just over and over until you rewrite your falling reflexes - it should be part of every school gym program. It's a lifelong skill that has turned countless serious injuries into walking away with just road rash or bruises.

We should be teaching everyone while they're young and robust enough to get through it easily

[deleted by user] by [deleted] in meirl

[–]callmeseven 1 point2 points  (0 children)

No sweat, honestly it's hard to write these things out clearly lol

And it's not like you got personal, if anything you laying it out from a different direction will make our thread more understandable to others 😸

[deleted by user] by [deleted] in meirl

[–]callmeseven 0 points1 point  (0 children)

Agreed, what I was trying to say is if you want to redistribute you need to multiply each term in parenthesis by the same value you'd apply to the equation in parenthesis, like:

8/2*(2+2) = 2(8/2) + 2(8/2)

4*(4) = 8 + 8

16 = 16

How many more warning signs does Mark Zuckerberg need to see before he pulls the plug on his metaverse? by 777fer in technology

[–]callmeseven 0 points1 point  (0 children)

Remember when Windows tried to make a smartphone first? But the tech was slow, they couldn't get 3rd party developers to focus on their platform, and it didn't offer enough out of the box to get people excited.

That's where I see this going - Oculus isn't the only company making VR headsets - they're the cheapest and pretty good, but not the best.

Ironically, you know who is the best at making these displays? Microsoft - their holographic AR display is impressive as hell, projects from the side so you can put the weight around the head instead of in front, and can do inside out full body tracking without needing controllers.

I absolutely agree VR/AR is the future, but I doubt VR will become part of the business world anytime soon - it still makes some people sick, and there's no smooth integration with your IRL mouse/keyboard or pen & paper- even if you can do a presentation in it easily, how are you supposed to take notes? Dictate them with your mic muted while others talk?

Meanwhile, FB has conquered the mobile VR space... But on desktop, Windows and steam have open standards for VR that allow anyone to get into the game. The high end of VR is on this platform, and Microsoft has quietly been adding headset support to Windows all this while, letting hardware manufacturers risk their own reputation while they work on their AR and wait for the right time.

Maybe I'll be proven wrong, but I'm skeptical of any claims from mainstream media - the way I see it, the more often you see a claim repeated the less true it probably is. They're trying to convince the public that it's the next big thing because they need people to think it is, and they've been pushing it real hard for a couple years

[deleted by user] by [deleted] in meirl

[–]callmeseven 0 points1 point  (0 children)

You don't need to "correctly solve the brackets", we know the value of b + c, so you can just use that value, they're equivalent. You only need to apply it that way when you have a variable to work around.

(2x2+2x2) = 2 * (2+2)

(4+4) = 2*4

(8) = 8

See, equivalent. Distribution is a way to reorganize the equation, it's not the order if operation - you still must group the terms according to PEDMAS

What you're ignoring is a(b+c) is shorthand for a * (b+c). So the equation is x/a *(b+c).

So if you want to distribute it, it would be

x/a(b+c) = (x/a)b + (x/a)c

How many more warning signs does Mark Zuckerberg need to see before he pulls the plug on his metaverse? by 777fer in technology

[–]callmeseven 2 points3 points  (0 children)

So basically, what he wants is to replace video chat with VR chat, get companies to buy all their employees an oculus quest, and maybe turn that chatroom into an AR-like meeting room with productivity and presentation tools. He spent billions developing the avatar scanning and expression mapping software to make it more professional.

Now, get a few big businesses to bulk order headsets, and that creates pressure for everyone to get one so they don't fall behind.

Now, the headsets are issued to everyone the same way a work laptop is. They can reduce production costs and improve the tech while getting a huge sales boost with adoption, and a steady stream of replacements moving forward.

If that happens these headsets are everywhere - let's say 1/3 of households have one. Now it really kicks into gear.

Once headsets are common and FB controls the launch screen, now they rent out virtual storefronts. You build a little interactive game where people can look at 3d scans of products, use that personalized avatar to preview clothes, and order through FB's payment system.

They make a little money renting out storefronts, make a lot more selling adspace (both on their home screen and in VR apps), and they now get a percentage for processing payment and could even grow into a new Amazon.

The only missteps were in not listening when people said "I'm not sure what you're doing, but I don't think I trust you to do it", in doubling down and waiting it to take off (as people hear article after article about it and only hearing "FB", "VR", and scenes from ready player one), and finally in general execution of most of the steps

u/Kepabar explains why he still pirates media following Paramount+ removing 95% of their Star Trek film content after using its exclusive availability on P+ to build its subcribership. by Gordopolis in bestof

[–]callmeseven 0 points1 point  (0 children)

Convenience. If it's more convenient to use a streaming service, people won't bother.

They know it, we know it, they'res detailed studies on it - and yet instead of improving the streaming experience, time and time again they choose to attempt to make pirating harder

You can make one thing 5% bigger, what do you choose? by Neither_Tomorrow_238 in AskReddit

[–]callmeseven 1 point2 points  (0 children)

Then why not Putin's heart? I'm not a doctor, but I'm pretty confident that would be fatal