Better HN
topnewbestaskshowjobs
Log inSign up

codebje

1,356 karma · joined Jun 19, 2017 (9y ago) · 591 submissions

Submissions

comment 4y ago · link · parent

I meant that rationals are a subset of the reals, and while floats are also a subset of exact reals a "typical" fixed bitwidth implementation will have a significantly greater range in floats than rationals.

I don't know that it's necessarily as significant a difference as I'd first considered it to be, though.

comment 4y ago · link · parent

General purpose programming languages are complex tools.

In this specific case representing non-integer numbers effectively on a binary device is complex. If you use a different representation than IEEE floats you just give a different set of corner cases and unexpected outcomes.

Don't let a novice build software you need to be correct without supervision, and if you are a novice expect to make mistakes, just like if I were to build a website I wouldn't expect my style choices to render appropriately on a wide range of devices... that's complex too!

comment 4y ago · link · parent

In a broad sense, sure.

comment 4y ago · link · parent

Every option here has tradeoffs and drawbacks: fixed point arithmetic suffers from a very limited precision range, rationals aren't even the same number set, cauchy sequences are precise but comparatively very slow… there's no one size fits all solution that's right in every circumstance.

Except, of course, at lower levels of abstraction - where IEEE floats are what the hardware implements. Lower level languages use 8-, 16-, 32-bit integers, they use IEEE floats and doubles, and they make these choices for pretty solid reasons.

Higher level languages make different choices (arbitrary precision integers are common in interpreted languages, eg). Libraries support all kinds of options up and down the stack.

comment 4y ago · link · parent

> IMO it's unfortunate that most languages default to floating-point. Most beginning programmers would be better served …

Most languages, most of the time, are not used by beginners.

comment 4y ago · link · parent

What happens when someone loses the key to their house NFT?

comment 4y ago · link · parent

Are the exchanges local, or is he doing an international money transfer from the exchange anyway? Trying to find where the value offered by the crypto is, but every way I can see for this to work still involves an international transfer.

comment 4y ago · link · parent

How do you convert that received crypto into spendable cash?

comment 4y ago · link · parent

"Effect" is perhaps a broader notion than one might think: it's an effect to write to a file or mutate some variable, sure, but it's also an effect to raise an exception, goto a label, raise an exception, execute asynchronously, be one of a set of possible outcomes, and plenty of other notions.

There's a name for the monad in which there is no effect: the identity monad.

The heart of a monad is the bind/flatMap/and_then interface, in which the value contained in the monad is computed on to produce a new monadic value. This is where the effect occurs: something other than just running the function happens.

If the bind implementation only runs the provided function then there's no effect, and it's the identity monad.

comment 4y ago · link · parent

If you're not even slightly familiar with that branch of mathematics it's still a perfectly good and descriptive name, because you can search for the term and get loads of relevant information from the programming side of things.

(The mathematical basis helping you get deeper insights into it is just a bonus, albeit IMO a valuable one.)

comment 4y ago · link · parent

Names certainly do matter: they're how we effectively communicate with each other. If you call it a mappable, and someone else calls it a chainable (as was said elsewhere in this comment thread), how have we eased confusion? If I try to google what a chainable is, what will I find?

On the other hand, if I say "it's a monad" then people who have encountered the term before know what I mean (even if they've had no need to understand monads in depth) and people who have not will successfully find information about the right thing if they search for it.

Monads have a particularly bad reputation for being hard to learn, despite appearing in non-general form in every modern language. Since people seem to have little trouble grasping the way in which futures, streams, and options work I don't think there's really such a great challenge involved - but the culture of running screaming from the mere word doesn't help matters in the least.

comment 4y ago · link · parent

In general you can't take the value from the box: you can't make an async computation non-async; you can't make a non-deterministic function deterministic; you can't make a possibly-failed result successful.

The await keyword might make it look like you can escape the box - but in effect a statement like "let x = await y" is just expanding the async box around y to also be around the bock containing that statement.

Since we already have a function to take a plain value to one in a box ((1) above) and a way to apply a function that turns a value from a box into another boxed value, lifting is just function composition:

    box.lift(f) = box.map(val -> from(f(val)))

comment 4y ago · link · parent

If there is a word for it I don't know it, sorry.

comment 4y ago · link · parent

I am a mere vegetarian but I justify it by aiming for generally better, not perfect.

(Also I adopted my cat about a decade before I became a vegetarian, it doesn't seem morally superior to destroy her because I had a change of heart.)

comment 4y ago · link · parent

> That said, I've mostly reached the conclusion that much of this is unavoidable. Systems languages need to have lots of detail you just don't need in higher level languages like Haskell or Python, …

I am not convinced that there's so more to Rust than there is to GHC Haskell to justify so much dense syntax.

There's many syntax choices made in Rust based, I assume, on its aim to appeal to C/C++ developers that add a lot of syntactic noise - parentheses and angle brackets for function and type application, double colons for namespace separation, curly braces for block delineation, etc. There are more syntax choices made to avoid being too strange, like the tons of syntax added to avoid higher kinded types in general and monads in particular (Result<> and ()?, async, "builder" APIs, etc).

Rewriting the example with more haskell-like syntax:

    Trying::to_read::<&'a heavy>(syntax, |like| { this. can_be( maddening ) }).map(|_| ())?;

    Trying.to_read @('a heavy) syntax (\like -> can_be this maddening) >> pure ()
It's a tortuous example in either language, but it still serves to show how Rust has made explicit choices that lead to denser syntax.

Making a more Haskell-like syntax perhaps would have hampered adoption of Rust by the C/C++ crowd, though, so maybe not much could have been done about it without costing Rust a lot of adoption by people used to throwing symbols throughout their code.

(And I find it a funny place to be saying _Haskell_ is less dense than another language given how Haskell rapidly turns into operator soup, particularly when using optics).

comment 4y ago · link · parent

You don't need to get in actual contact with support. It's not clear from the linked page, but when you go to the (?) icon on your admin page there's an automated click-through flow to revert to legacy - I just did it for my account.

comment 4y ago · link · parent

WoW was accessible in a way that previous MMOs were not: instead of repetitive grinding from the very start players are hand-held through levelling with the quest system and a story line. The levelling dungeons have comparatively generous static loot tables, with the rare drops from those dungeons just a nice little bonus. It's not until endgame that WoW reverts to genre.

WoW IMO killed Star Wars: Galaxies, which was exploring a more "open world" style of game; subsequent expansions progressively dialled back the classless system and player generated content.

More traditional repetitive grind MMOs remain popular in some parts of the world, but it's either EverQuest style or WoW style MMOs now.

comment 4y ago · link · parent

> In the Web PKI thanks to Certificate Transparency we can measure, the typical X509 certificate was issued by ISRG (Let's Encrypt) and thus cost well under one dollar (free to the subscriber, that cost is borne by the donors) and has a lifetime of precisely 90 days.

Yes, it's true that in the past few years Let's Encrypt has substantially altered the typical lifetime of web server certificates, as well as substantially eased the burden of refreshing a certificate in what I would guess to be the majority of use cases.

Revocation, however, is still a mess. OCSP services are slow and a privacy leak, and are largely ignored by browsers - in 2021 Firefox was still checking OCSP services but given they're so unreliable if it can't contact a service it assumes the certificate is fine. OCSP winds up being a trade-off between allowing an attacker to conduct a denial of service on all certificates or blocking revocations.

In practice the major browser vendors all do more or less the same thing - build their own proprietary list of revoked certificates and distribute it to browsers from time to time, with varying sources and granularity on what they will and won't include in their centralised CRLs. I would have little faith in a timely revocation of a compromised server certificate.

comment 4y ago · link · parent

JWT is just a container for authenticated data. it's comparable to the ASN.1 encoding of an x509 certificate, not to the entire x509 public key infrastructure.

You could compare x509 with revocation to something like oauth with JWT access tokens, though.

In that case, x509 certificates are typically expensive to renew and have lifetimes measured in years. Revocation involves clients checking a revocation service. JWT access tokens are cheap to renew and have lifetimes measured in minutes. Revocation involves denying a refresh token when the access token needs renewing. Clients can also choose to renew access tokens much more frequently if a 'revocation server' experience is desirable.

Given the spotty history of CRLDP reliability, I think oauth+JWT are doing very well in comparison. I'm pretty damn confident that when I revoke an application in Google or similar it will lose access very quickly.

comment 4y ago · link · parent

"examine computer" is a nice touch :-)

comment 4y ago · link · parent

https://xn--wxa.bje.id.au/

It's mostly for project logs I can refer back to. I wanted a site that would load reasonably fast, but it's clearly not as aesthetically powerful as other sites posted here.

comment 4y ago · link · parent

Flow typing is purely a static analysis process. The representation of the type doesn't change, just the range of possible values in a scope constrained by some runtime condition.

Some things that might have triggered warnings no longer need to, because if the runtime conditional evaluated to true there's no way the warning could take effect.

Consider this little bit of C code:

  void foo(int x, unsigned y) {
    if (x > y) {
      printf("but it's bigger!?");
    }
  }
Due to the idiosyncrasies of C if you call foo(-1, 1) the test will promote x to an unsigned and the test will say x is bigger than y. There's a warning in most C compilers for it, because it's the sort of invisible bug that'll wreck your code.

What's annoying, though, is if you do this:

  void foo(int x, unsigned y) {
    if (x >= 0 && x > y) {
      printf("but it's bigger!?");
    }
  }
And still get the warning. The compiler should be able to infer that the test x >= 0 means there's no fault path any more. Clang 13, at least, still warns.

A C compiler using flow typing would not issue a warning for the second implementation of foo. Neither x nor y change representations. The execution path through your compiler for producing byte code doesn't change. A few of your tree structures might pick up an extra annotation for the provable facts the warning generator can use to improve its output, that's all.

comment 4y ago · link · parent

I have a laptop exclusively for work and one exclusively not for work, and at the end of the day the work one gets closed and put away until the next working day.

Junk like HN serves well enough for endless procrastination in or out of the office. Having my toys near me has been no worse - if anything my personal projects have suffered because they largely got attention during the commute.

comment 4y ago · link · parent

While integers with addition are an additive monoid and thus commutable it's still also a valid multiplicative monoid (or semigroup as described in the parent) and handy to be able to be passed to code that just needs an associative closed operation, maybe with an identity value.

Integer addition is a magma, semigroup, monoid, and group. It's _also_ a commutative version of each of those structures, but we can still definitely use it with functions only expecting multiplicative structures just fine.

The issue I take with using + for a multiplicative monoid like string concatenation is that readers of code should expect it to be commutative. Using x or * is probably better, using ⓧ is mathematically nice but a pain to type, so something like ++, <>, .., or some other new operator just for concatenation is imo best.

comment 4y ago · link · parent

No language will tell you at compile time whether an arbitrary list filter operation will have an effect or not. If it can, it's because the list filter isn't arbitrary, it's probably always a no-op.

The generalisation is that you have some type parent with a way to select a type child, plus a function that modifies a child, you want to lift your child -> child function to a parent -> parent function.

Optics help a lot with this class of problem.

Because you're in the world of persistent data structures, and you're doing a modify operation, there is no avoiding the 'modify hashtable' part of 'modify an element within a hashtable'. You always create a 'new' hashtable.

If it's common that your update operation has no effect it may be worth switching to a function like child -> Modified child for Modified a = NoOp | Mutated a, so the hashtable modify function can determine if it can skip its own update. A list filter is a trivial thing to write, and one that can return NoOp if no elements are filtered is no less efficient.

comment 4y ago · link · parent

I've had several upgrade issues. Once several configuration settings were deprecated then removed... Silently. It was difficult to discover why it would no longer start. Another time a bunch of repositories only partially migrated, and appeared empty on clone.

Mostly it's the frequency of updates that's a pain, there are enough critical vulnerabilities that you have to stay on top of it.

I am the dog lying on a nail and occasionally whimpering at the moment though.

comment 4y ago · link · parent

Yeah, but the question was why buy the stamp when smaller boards exist. You won't get much smaller than the stamp with so many exposed pins, since it's basically just 2mm pitch pads packed on every edge.

I'd probably say suck it up and solder the QFN directly if you need all the GPIO in minimal space, though.

comment 4y ago · link · parent

Exposed pins, for one. There's 30 GPIOs on an RP2040, only having 12 or so of them available is a weakness of rhe tiny boards.

comment 4y ago · link · parent

Super admins can set a temporary password. But they can also change a user's email address, disable password and email change notifications, lock out all other admins... They have complete control of the org.

It's pretty clear there is no super admin breach here. None of the screenshots show an admin interface - the app portal shot clearly shows a distinct lack of the "Admin" button. No user directory shots. There is a single image of a password reset confirmation, but those are also in documentation so it's hardly a smoking gun.

It seems far more likely that a support engineer had their laptop compromised and their limited access was used to try and make a mountain out of a molehill. Not like a ransomware group would have reason to over-exaggerate their access and ability, right?

comment 4y ago · link · parent

I wouldn't expect to have professional development overtly included in a short term contract, either. I'd expect a much higher hourly rate to pay for it though, amongst other things.

I'd expect if the plumber worked for a plumbing company they'd probably invest some time and money into skills growth, and pay for it out of the money they charge you.

1
121314
20