Options

[Programming] Initial commit

145791020

Posts

  • Options
    EchoEcho ski-bap ba-dapModerator mod
    it's aliiiiive

    I do 2ms delay between each step, giving about 18 seconds per rotation, which feels a bit off according to my math.

    Then it stopped working.

    Right now I get 6.77V out from the 9V battery that's powering this, so I guess I'll buy a fresh one tomorrow.

  • Options
    EchoEcho ski-bap ba-dapModerator mod
    Phyphor wrote: »
    Bitwise operators are lower than equality so the compiler sees (magnet & (mask != 0)) != 0

    You would have been fine if you'd used the implicit test by leaving out the !=

    Ha. Yeah, I'm definitely not used to throwing bits around.

  • Options
    OrcaOrca Also known as Espressosaurus WrexRegistered User regular
    Echo wrote: »
    Phyphor wrote: »
    Bitwise operators are lower than equality so the compiler sees (magnet & (mask != 0)) != 0

    You would have been fine if you'd used the implicit test by leaving out the !=

    Ha. Yeah, I'm definitely not used to throwing bits around.

    The secret is to always use parenthesis everywhere to enforce a particular order of operations, and to use intermediate variables to break up complicated expressions.

    Some bitwise and logical operators have lower precedence than checking for equality, which WILL screw you, as you found out. If you're in the habit of excess parenthesis, that's never a problem. Can look a little ugly however.

  • Options
    schussschuss Registered User regular
    So, these rejected GitHub achievements had me laughing.

    I'm going to see if we can get these implemented on our enterprise instance

  • Options
    zerzhulzerzhul Registered User, Moderator mod
    Orca wrote: »
    Echo wrote: »
    Phyphor wrote: »
    Bitwise operators are lower than equality so the compiler sees (magnet & (mask != 0)) != 0

    You would have been fine if you'd used the implicit test by leaving out the !=

    Ha. Yeah, I'm definitely not used to throwing bits around.

    The secret is to always use parenthesis everywhere to enforce a particular order of operations, and to use intermediate variables to break up complicated expressions.

    Some bitwise and logical operators have lower precedence than checking for equality, which WILL screw you, as you found out. If you're in the habit of excess parenthesis, that's never a problem. Can look a little ugly however.
    I think my love for excess parentheses is why I enjoy Scheme so much...

  • Options
    AnteCantelopeAnteCantelope Registered User regular
    Woo, app successfully deployed on AWS
    49ubp8horu93.png

    Now all I have to do is turn my CLI program into a website. That should be quick and easy, right?

  • Options
    Ear3nd1lEar3nd1l Eärendil the Mariner, father of Elrond Registered User regular
    You get all the fun ones man.
    Orca wrote: »
    Echo wrote: »
    I'm dabbling with an Arduino experiment where I need to address four individual magnet coils for a stepper motor. I've never had to do much of anything with flipping individual bits before, so this is a very fun learning experiment.

    There is a stepper driver library for Arduino, but where's the fun in that? Because the Arduino IDE sucks and has a long feedback cycle to test stuff, I'm writing a prototype in Go first.

    ...

    Success!

    ...but then I ran into problems where I want to define full steps and half steps, which requires running a combination of magnets, because I suck at bitwise ops. To the google machine!

    If you're messing in embedded, now is the PERFECT time to get comfortable with bit twiddling.

    Bit twiddling is how you talk to the hardware!

    Do you have anything else running on the Arduino? What do you have the stepper attached to?

    That sounds like something people get arrested for.

  • Options
    admanbadmanb unionize your workplace Seattle, WARegistered User regular
    it's fine as long as you're not bit twiddling in public

  • Options
    OrcaOrca Also known as Espressosaurus WrexRegistered User regular
    admanb wrote: »
    it's fine as long as you're not bit twiddling in public

    If you can't see it, it's not public right?

    *puts on trenchcoat*

  • Options
    dporowskidporowski Registered User regular
    Woo, app successfully deployed on AWS
    49ubp8horu93.png

    Now all I have to do is turn my CLI program into a website. That should be quick and easy, right?

    Actually tbh if it's Python, you can grab flask/bootstrap and be up in a few hours probably. (IDK I don't do web stuff that's just what I used last time. :p)

    Fancy? Nope. But works decently out of the box for the basics, and I'm sure can be fancied up later if you actually do web stuff/CSS/etc.

  • Options
    thatassemblyguythatassemblyguy Janitor of Technical Debt .Registered User regular
    Orca wrote: »
    Echo wrote: »
    Phyphor wrote: »
    Bitwise operators are lower than equality so the compiler sees (magnet & (mask != 0)) != 0

    You would have been fine if you'd used the implicit test by leaving out the !=

    Ha. Yeah, I'm definitely not used to throwing bits around.

    The secret is to always use parenthesis everywhere to enforce a particular order of operations, and to use intermediate variables to break up complicated expressions.

    Some bitwise and logical operators have lower precedence than checking for equality, which WILL screw you, as you found out. If you're in the habit of excess parenthesis, that's never a problem. Can look a little ugly however.

    Using parenthesis, especially in embedded, is considered best practice. We had a team that didn't use them, and yes, they had many hidden bugs.

  • Options
    LD50LD50 Registered User regular
    I like to use them just to improve readability.

  • Options
    OrcaOrca Also known as Espressosaurus WrexRegistered User regular
    LD50 wrote: »
    I like to use them just to improve readability.

    I like using named intermediate values for readability, but that doesn't seem to be as common a convention as I might expect.

  • Options
    InfidelInfidel Heretic Registered User regular
    LD50 wrote: »
    I like to use them just to improve readability.

    Absofuckinglutely.

    Even if your order of operations is correct, I don't want to stop and have to think about it.

    OrokosPA.png
  • Options
    InfidelInfidel Heretic Registered User regular
    Especially since I bounce between like a dozen different languages that have order of operations rules.

    OrokosPA.png
  • Options
    EchoEcho ski-bap ba-dapModerator mod
    Infidel wrote: »
    Especially since I bounce between like a dozen different languages that have order of operations rules.

    It never even occured to me that there is the concept of things having lower precedence than equality. Brain still can't quite accept it.

  • Options
    PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    Echo wrote: »
    Infidel wrote: »
    Especially since I bounce between like a dozen different languages that have order of operations rules.

    It never even occured to me that there is the concept of things having lower precedence than equality. Brain still can't quite accept it.

    You probably used it all the time without realizing it.
    if(a == b && c == d)
    
    relies upon && being lower than ==

  • Options
    OrcaOrca Also known as Espressosaurus WrexRegistered User regular
    Phyphor wrote: »
    Echo wrote: »
    Infidel wrote: »
    Especially since I bounce between like a dozen different languages that have order of operations rules.

    It never even occured to me that there is the concept of things having lower precedence than equality. Brain still can't quite accept it.

    You probably used it all the time without realizing it.
    if(a == b && c == d)
    
    relies upon && being lower than ==

    I see that and want to group the sub expressions to make sure :p

  • Options
    EtheaEthea Registered User regular
    C++ custom operator rules just entered chat. What you think that && is going to short circuit :lol:

  • Options
    OrcaOrca Also known as Espressosaurus WrexRegistered User regular
    Ethea wrote: »
    C++ custom operator rules just entered chat. What you think that && is going to short circuit :lol:

    *inserts a mutating operation into the && operator for giggles*

  • Options
    EtheaEthea Registered User regular
    Even better when == is stateful as well.

  • Options
    OrcaOrca Also known as Espressosaurus WrexRegistered User regular
    Ethea wrote: »
    Even better when == is stateful as well.

    If anyone did that to my codebase I would cut them

  • Options
    thatassemblyguythatassemblyguy Janitor of Technical Debt .Registered User regular
    LD50 wrote: »
    I like to use them just to improve readability.

    This is precisely one of the ways it reduces bugs. Readable code means it's easier to review, and remove bugs before a commit goes into the repo.

    Readable code tends to also be code that is well understood by the author and has fewer problems before review, also.

  • Options
    PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    Orca wrote: »
    Ethea wrote: »
    C++ custom operator rules just entered chat. What you think that && is going to short circuit :lol:

    *inserts a mutating operation into the && operator for giggles*

    Pfft, do a mutating operator bool

  • Options
    gavindelgavindel The reason all your software is brokenRegistered User regular
    Programming is the art of looking at a piece of code 200 times and not seeing the bug until it smacks you in the face with a breakage.
    Entity myEntity;
    myEntity.Field = "Whatever";
    entityframeworkdatabasecontext.add(myEntity)
    ...
    myEntity.FieldYouReallyShouldFillOut = "Important thing";
    
    entityframeworkdatabasecontext.savechanges()
    

    Gavindel's brain: This is fine. We called save!

    I will cut myself a small amount of slack for the real code being split across two methods, but come on! This is why I'm a big fan of doing all entity changes at the same place and then immediately either saving to DB or adding for save later and treating the object as immutable.

    Book - Royal road - Free! Seraphim === TTRPG - Wuxia - Free! Seln Alora
  • Options
    AngelHedgieAngelHedgie Registered User regular
    We're doing code review of code that is older than our interns.

    I'm going to cry now.

    XBL: Nox Aeternum / PSN: NoxAeternum / NN:NoxAeternum / Steam: noxaeternum
  • Options
    EchoEcho ski-bap ba-dapModerator mod
    And now for something completely different! Changelogs/release notes, how do you people handle them?

    I've recently switched teams at EchoCorp, from a domain team to what is tentatively called a backend platform team (population: me, though I do a lot of work together with our cloud ops team).

    We use Renovate for automatic dependency version checks, which works nicely. It does MRs with great summaries of what changes in dependencies, including their changelogs when available.

    So basically we're looking for something that can automatically make decent-looking changelogs for us to help us do automatic versioning and documentation.

    For my personal stuff I've been using Semanticore, which works really nice at handling automatic versioning, and if you do conventional commits, then commits are separated by the type of commit/MR.

    But at the end of the day that's still just a list of commits. Our frontend platform team uses changesets, which seems really nice for their monorepo -- you make a new changeset that includes your description of the feature, that eventually gets merged, and when you're ready for a release, changesets reads the changeset files, figures out what the new version should be, and makes a nice changelog combining the info from the changeset files. This decouples features/fixes from one or more commits.

    Not sure how well that would work outside of a monorepo though, and it seems a bit coupled to the JS/TS world.

    Anyone have any suggestions here?

  • Options
    dporowskidporowski Registered User regular
    We have one we make you update--via like, CI rules, IDK how it works--manually when you want to release a thing. As in "put some notes in, monkey". CI will yell until you do it properly.

    Really depends what level of granularity you want. We don't care about "every individual commit", just "bugfix/enhancement/feature" and whether it's breaking or not, so it's easy enough to fill out.

  • Options
    TelMarineTelMarine Registered User regular
    edited July 2023
    Echo wrote: »
    And now for something completely different! Changelogs/release notes, how do you people handle them?

    I've recently switched teams at EchoCorp, from a domain team to what is tentatively called a backend platform team (population: me, though I do a lot of work together with our cloud ops team).

    We use Renovate for automatic dependency version checks, which works nicely. It does MRs with great summaries of what changes in dependencies, including their changelogs when available.

    So basically we're looking for something that can automatically make decent-looking changelogs for us to help us do automatic versioning and documentation.

    For my personal stuff I've been using Semanticore, which works really nice at handling automatic versioning, and if you do conventional commits, then commits are separated by the type of commit/MR.

    But at the end of the day that's still just a list of commits. Our frontend platform team uses changesets, which seems really nice for their monorepo -- you make a new changeset that includes your description of the feature, that eventually gets merged, and when you're ready for a release, changesets reads the changeset files, figures out what the new version should be, and makes a nice changelog combining the info from the changeset files. This decouples features/fixes from one or more commits.

    Not sure how well that would work outside of a monorepo though, and it seems a bit coupled to the JS/TS world.

    Anyone have any suggestions here?

    We just manually update a changelog and enforce it before merging. Honestly, I feel like unless the amount of check-ins on a project is huge and constant, all these automated tools are overkill and just add unnecessary complexity. I wouldn't be surprised if more time is wasted, on average, configuring them and fixing them when they break than if someone just did the work manually.

    TelMarine on
    3ds: 4983-4935-4575
  • Options
    JasconiusJasconius sword criminal mad onlineRegistered User regular
    Echo wrote: »
    Anyone have any suggestions here?

    i track most of my bugs and features in a trello board in a fashion reminiscent of kanban, and when its time to release I just go through everything in the "ready for deployment" column and write a note (if it needs to have a note written)

  • Options
    electricitylikesmeelectricitylikesme Registered User regular
    We're doing code review of code that is older than our interns.

    I'm going to cry now.

    I love old code archeology though. It's great! Comment lines like "this used to be to save memory, but the server has over 1gb of memory now so we don't need it".

  • Options
    DisruptedCapitalistDisruptedCapitalist I swear! Registered User regular
    So they remove it but then memory usage goes O(n!)

    "Simple, real stupidity beats artificial intelligence every time." -Mustrum Ridcully in Terry Pratchett's Hogfather p. 142 (HarperPrism 1996)
  • Options
    jothkijothki Registered User regular
    I'm brushing up on React now, and I see that Javascript hasn't magically become sane in the years since I last touched it.

  • Options
    DisruptedCapitalistDisruptedCapitalist I swear! Registered User regular
    I suppose that's why libraries like React exist.

    "Simple, real stupidity beats artificial intelligence every time." -Mustrum Ridcully in Terry Pratchett's Hogfather p. 142 (HarperPrism 1996)
  • Options
    EchoEcho ski-bap ba-dapModerator mod
    I get a lot of comedy value out of having "Javascript: The good parts" in my shelf, and how thin it is.

  • Options
    TelMarineTelMarine Registered User regular
    jothki wrote: »
    I'm brushing up on React now, and I see that Javascript hasn't magically become sane in the years since I last touched it.

    To me, it's just hacks on top of hacks.

    3ds: 4983-4935-4575
  • Options
    AngelHedgieAngelHedgie Registered User regular
    jothki wrote: »
    I'm brushing up on React now, and I see that Javascript hasn't magically become sane in the years since I last touched it.

    As I've said in the past, Javascript is a horrible language written by a horrible person.

    XBL: Nox Aeternum / PSN: NoxAeternum / NN:NoxAeternum / Steam: noxaeternum
  • Options
    bowenbowen How you doin'? Registered User regular
    Infidel wrote: »
    LD50 wrote: »
    I like to use them just to improve readability.

    Absofuckinglutely.

    Even if your order of operations is correct, I don't want to stop and have to think about it.

    At the recommendation of a company testing our internal code for security vulnerabilities I installed SonarQube.

    It complains so fucking much about "code smells" with nesting ifs and parenthesis. My brothers in christ, this is how heartbleed came to be, stop that shit, you're not making code safer by consolidating blocks to save visual space.

    The dumbest part is it didn't even bitch about anything security, just this code smell shit.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • Options
    NaphtaliNaphtali Hazy + Flow SeaRegistered User regular
    complaining about javascript and bowen re-appears?

    coincidence? or not...

    Steam | Nintendo ID: Naphtali | Wish List
  • Options
    Ear3nd1lEar3nd1l Eärendil the Mariner, father of Elrond Registered User regular
    I don't have much to say about SonarQube, but it really doesn't like TODOs in code.

Sign In or Register to comment.