Skip Navigation

InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)SW
Posts
2
Comments
310
Joined
2 yr. ago

  • Classes are Data plus the code required to modify that Data. The idea is to encapsulate data modifications into one thing (a Class) that knows how to modify all the Data as a single unit. This lets us write some code to describe, say, a Scrollbar widget. The Class for the widget combines all the Data for a Scrollbar (position, orientation, bar size, total size, etc) with the methods that read or modify that data (scroll up/down, change size, draw, etc).

    That's the first Big Idea of OOP - that data should be grouped with the functions that modify it. If you don't have that - as in C - you have to write functions that only work on a given data type but which are namespaced separately. You get functions like void set_scrollbar_pos(void* scrollbar, word pos) which become verbose in a large project. (I'm not saying this is the worst thing in the world, just a different style.)

    The second Big Idea of OOP is message passing. Now that we have code and Data bundled together, it would be nice if Objects that share functions of the same essential type and intention could be swapped out interchangeably. So instead of directly invoking a function on an Object, we send a 'message' that says something like 'if you know how, please draw yourself on screen, relative to X,Y'.

    Of course, since plain English is hella verbose, the actual message is going be something like "draw, X,Y" and the Object receiving the message then sorts out if it has a method called "draw" that can use the provided X and Y. If so, it runs the code to do so. If not, you get an error.

    Messages like this mean that you can swap out compatible Classes for one another. E.g. you can ask any collection of widgets to .draw themselves with a single method and let the compiler/interpreter generate the machine code as needed. That reduces the amount of boilerplate for engineers by a lot! Otherwise, trying to work with any collection of heterogeneous Objects (like a List of every Widget contained in a Window) would need to have essentially the same code rewritten for every different Type needed - a combinatorial explosion of code!

    Tl;Dr -

    • Classes help organize code and simplify state management by combining data with the functions that manipulate that data.
    • Classes reduce the amount of boilerplate code needed by allowing methods with the same "shape" to be called interchangeably.

    Everything else about OOP is essentially built off these two ideas. I hope that helps.

  • How do y'all solve that, out of curiosity?

    I'm a hobbyist game dev and when I was playing with large map generation I ended up breaking the world into a hierarchy of map sections. Tiles in a chunk were locally mapped using floats within comfortable boundaries. But when addressing portions of the map, my global coordinates included the chunk coords as an extra pair.

    So an object's location in the 2D world map might be ((122, 45), (12.522, 66.992)), where the first elements are the map chunk location and the last two are the precise "offset" coordinates within that chunk.

    It wasn't the most elegant to work with, but I was still able to generate an essentially limitless map without floating point errors poking holes in my tiling.

    I've always been curious how that gets done in real game dev though. if you don't mind sharing, I'd love to learn!

  • Once upon a time, I was fairly strong but I couldn't touch my toes. That full deep stretch was just a little beyond me. It always had been, as long as I could remember in my adult life. Throughout years of martial arts and parkour that moderately normal level of flexibility eluded me.

    Then I quit my job at Amazon. I was so burned out I ended up taking 6 months off. During that time I mostly hung out around the house. Played with my kid. ... played a ton of Minecraft.

    The point is, I wasn't doing any new exercise. I was just doing things other than hunching in a chair all day. And just before I started a new job I discovered that I could touch my toes again!

    I asked my new job for a standing desk - and I've kept that practice up at every job since. I alternate between standing and sitting on a tall office chair. I estimate that I stand a little more than half the day all in, but being able to transition has made a huge difference for me.

    I'm in my forties now and I can grab my feets no problem. I don't do any dedicated stretching - I'm just not hunching all day.

  • Yep. And it was great. My wife and I married young - only in our early twenties. Because of reasons both us had grown up a little too fast and as young adults we mourned the fact that we'd never really gotten to enjoy our childhoods.

    So we decided to hunt down all the crap we wanted as kids. We hit antique shops and thrift stores, eBay and garage sales. We found a ton of the things we'd always wanted.

    Popples and Rainbow Bright dolls.
    Kenner Star Wars action figures.
    Video game consoles.
    Transformers.

    We bought the crap our inner children still wanted and gave ourselves permission to enjoy it - and then let it go.

    Ultimately, we didn't keep much of it - though we've still got a box of a few favorite dolls, games and action figures somewhere. A few toys even got passed down to our own kids.

    I don't regret a moment of it. Giving ourselves a belated childhood was fun - and it helped us move on and say goodbye to that part of our lives.

  • It's not as good, but running small LLMs locally can work. I've been messing around with ollama, which makes it drop dead simple to try out different models locally.

    You won't be running any model as powerful as ChatGPT - but for quick "stack overflow replacement" style of questions I find it's usually good enough.

    And before you write off the idea of local models completely, some recent studies indicate that our current models could be made orders of magnitude smaller for the same level of capability. Think Moore's law but for shrinking the required connections within a model. I do believe we'll be able to run GPT3.5-level models on consumer grade hardware in the very near future. (Of course, by then GPT-7 may be running the world but we live in hope).

  • My dude - eye patches are cool. I only had to wear one for a few weeks, story in my other comment, but for real an eyepatch is an awesome opportunity.

    Get - or make - yourself a nice eye patch. Own it. Don't settle for plain black or tan. Get it embroidered. Bedazzle it. Get yourself patches in different colors and patterns.

    An eyepatch is always gonna be noticed, so don't try for subtle. Lean into it instead and make it fucking awesome.

  • Oh man, story time!

    I like to stab people competitively. One of the risks you run is that they stab you back.

    About 20 years ago now I was sparring with a pal of mine. We were using shinai - a Japanese sparring sword made of four slats of bamboo lashed together with leather. My pal drew back for a pull thrust and I deflected it with a move where I stepped back and lifted my blade to direct the thrust above my head.

    ... Only I forgot to step back. Instead of redirecting the thrust harmlessly above myself, I brought the tip of his shinai directly into my right eye. (Stupidly, I wasn't wearing any protective gear.) The inch-wide tip smashed my eye down and collided with the back of my eye socket.

    I hit the ground, blind, weeping blood and in the most pain I've ever experienced.

    Fortunately, I kept the eye.... but I was seeing triple due to the swelling in my socket. So I bought an eye patch and wore it until I healed.

    During my convalescence I happened to have a really shitty day. It was a cold winter day and I was running late to work. My car ran out of gas a mile short. I had to run the last mile in the cold and wet, already late and getting more frustrated every moment.

    By the time I reached the parking lot for my shitty retail job, I was in a foul mood.

    ... Now at this point in my life I wore a frankly excessive amount of black leather. Black leather boots. Black leather jacket. Black leather gloves. My pants were black too, but they were at least denim.

    So imagine if you will - a six foot tall man, wearing all black leather and an eyepatch, stalking angrily across the parking lot with a baleful expression.

    People were getting the fuck outta my way. Gazes averted, people turned their heads and just dipped.

    ... Until The Boy. A pale haired kid of about five or six was being towed out of my path by his mushroom- haired mother - but he was rooted to the spot. Staring at me with unabashed excitement, he slipped free of his mother's grasp and shouted, "Look Mom! A Pirate!"

    I started guffawing, bad mood instantly gone. Mushroom-Mom grabbed her kid and started dragging him away. I called after them "It's okay!" But with a mumbled "No, it's not", she dragged the boy into their car and fled.

    ... And I went to work, Pirate King of the K-Mart.

  • I used to work for an imaging satellite company. And yes - spy satellites are crazy powerful. The real problem is one of bandwidth. Crazy powerful spy satellites are expensive - and there aren't a lot of them.

    So everybody is competing for time on them. Satellite images have been traditionally expensive and rare. We web intelligence agencies have to take turns and sometimes miss important events due to scheduling or timing conflicts.

    The thing these new satellites offer is broad coverage. When you have a few hundred small-sats there's just many, many more opportunities to have eyes on the part of the world you're interested in.

    All that said, you want to pay attention to the resolution of the images. The place I worked for was providing imagery about 1-meter resolution. E.g. each pixel in the image corresponded to about 1sq-meter of earth. We figured this was a good compromise between image quality and privacy. Enough to count cars, see weather patterns, make out groups of people, but identifying any given person was right out.

    So if you see an imaging company throwing a bazillion imaging small-sats up - its worth checking what their reported resolution is. 0.5m means a real tall dude would still only be 2 pixels. But 1cm resolution means you could count their teeth.

  • Compilers are a specialized topic - and syntax design is fiddly - but it really is no harder than any other sort of program. A lot of the hard theoretical work was done back in the sixties and seventies. You don't have to start from scratch. These days it's "only" a matter of implementing the features you want and making sure your syntax doesn't leave itself open to multiple interpretations. (just as arithmetic, e.g. '5 × 4 - 1' requires some rules to make sure there's only one correct interpretation, so do language syntaxes need to be unambiguous to parse. )

    Don't get me wrong - writing a language is a lot of work and it's super cool that OP has done this! I just want to stress that language development is 100% doable with an undergrad degree. If you understand recursion and how to parse a string you already have all the theory you need to get started.

  • I legit think that Secret Hitler should be a required part of high school government classes. It so perfectly demonstrates the risks of both government action and inaction.

    You can pass a law with the best of intentions, trying to root out dangerous elements but those same laws can be turned against you. Think about what your worst enemy could do with a given law before you demand its passage.

  • You sound like a great person working hard to build yourself a bright future. The best thing you can do for your teacher is to keep at it.

    I used to teach (martial arts) and there's nothing a good teacher loves more than to see a student applying themselves and growing - even if it's outside of their subject (Though that's nice too.)

    Others' advice here is spot on. You can love/respect/ appreciate someone in an entirely non-romantic way. That's normal. I have teachers in my past that I still think about gratefully 30+ years later. Teacher-Student relationships can be very healthy mentorships, but due to the handful of pedos taking horrible advantage of the students in their care, it's safest for students (and schools) to ban overt friendships. (And it is depressingly common. I was student to three teachers in three schools - in different states even - who were eventually arrested for abusing their students.)

    So - to avoid accidentally getting your teacher in trouble - you should avoid using the L-word. But 100% write then a letter or note thanking them for their positive impact and encouragement.

    For the rest - do your best to learn at school, even if you get a bad teacher and your old friends try to drag you down. It's going to suck sometimes. You can do it. Do your best to keep learning, in or out of school. Everything you learn - from algebra to making a killer peach cobbler - will help you somewhere down the line.

    I know because I've seen it firsthand.

    My Dad came from an abusive household. (His dad liked to use baling wire as a switch.) By the end of his high school career, Dad was heavily into drinking, he'd lost multiple jobs by getting into fist fights with coworkers and was only on track to graduate because he lived in CA during a time where the school system literally refused to fail anybody. So Dad graduated with a D average and swore he'd never set foot in a school again.

    ... And then he decided he wanted to do better. At 18, he gave up his entire friend group and started hanging out with some people who were more like he wanted to be. It was awkward at first - he was coming from a very different perspective than these other dudes had. To their credit, they always included Dad and let him hang out with them. And slowly, Dad began to change. He mellowed out and quit drinking and fighting.

    Dad worked in factories after high school. Eventually he and my Mom married and I came along. Dad worked a number of blue-collar jobs for the first years of my life. Iremember him saying though that when he had downtime at work, he made a point of going to other parts of the factory and asking to watch and learn their tasks. As a result, he survived a number of layoffs through the years and for those times he didn't, Dad was often rehired at better pay in better roles shortly afterward.

    Eventually, he tired of factory jobs and decided to return to school. To become a lawyer. That became the next 12 years of our lives. There were whole years where I'd see Dad only first thing in the morning at breakfast. He'd go to school all morning, work swing shift into the night and get home long after little I was already in bed.

    It was an incredible amount of work. But he stuck to it.

    I was sixteen when Dad finally graduated and became a lawyer. He's a pretty damn good one too.

    I'm definitely not saying you should become a doctor or lawyer or whatever - do what you want to - but please know that you don't have to listen to people who want to drag you down. You can work hard and wring what you want out of life.

    Surround yourself as much as you can with people who encourage and support each other. Learning that people can encourage and help each other purely for the pleasure of seeing the other pain succeed - that may be the best lesson you can learn from your teacher's example. Lean into it. Find good people. Make yourself one too.

    And you will do amazing things.

  • How much time does he have to prepare?

    Batman is not only a world class fighter, he also owns weapons, chemical and biotechnology manufacturing companies. And as a billionaire anything he can't build he can probably buy. He's also paranoid and clever AF and has made multiple contingency plans to take down not only villains but every hero he's come across.

    Batman can take down anyone the current writers want him to.