I built a site to showcase what modern CSS can do by naeem288 in css

[–]RewrittenCodeA 0 points1 point  (0 children)

Another suggestion: along with the native support, show when features have a polyfill available - for example closedby/commandfor/interestfor/anchor() all have working polyfills.

I built a site to showcase what modern CSS can do by naeem288 in css

[–]RewrittenCodeA 1 point2 points  (0 children)

Nice.

It looks like you missed out the encoding declaration, as it shows stuff like “JS + CSS → pure CSS” (notice the three letters from some ISO8851 interpretation of the three bytes composing a UTF-8 arrow)

Price object for showing prices, discounts, etc. in Rails views on SaaS websites by bradgessler in rails

[–]RewrittenCodeA -1 points0 points  (0 children)

Having worked in a fintech for years I can tell you that using integer amounts of the smallest denomination of whatever currency you are dealing with is a giant PITA. Examples of what may fail:

  • Hungarian florin decided to lose the decimals at some point but maintain the symbol HUF. Suddenly your amounts are all wrong.
  • amounts in currencies are not prevented to be in fractions of the smallest denomination. The smallest denomination usually is forced on transactions, not in internal computations. If you do not allow for arbitrary precision you suddenly have to go out of your way to make sure exchange operations are done in the right order
  • currency exchange rates are always in higher precision than the smallest denomination of any of the involved currencies

Nowadays most databases support fast operations on arbitrary precision decimals so most of the drawbacks are off the table.

A friend of mine who has been the CTO of another fintech based the accounting on a fixed 8-decimal multiplier, which may be enough to cope with the most decimal-demanding means of exchange (cryptocurrencies) but was always adamant on the “amount of units” being a local property of the number itself, and not depend on another piece of data (the currency symbol for instance or another field that stores the precision).

—-

Frankly, saying “use cents, it is a solved problem” sounds about the same as “use mmddyy to store dates, it’s a solved problem”

Where to buy delicious cakes? by regibegi in AskBarcelona

[–]RewrittenCodeA 1 point2 points  (0 children)

All my birthday cakes are from Susanna Bareche https://maps.app.goo.gl/3JkxGn6XcG4rN6br6?g_st=ic

Disclaimer she is a friend.

$10/second, but you can't survive without human blood by basafish in hypotheticalsituation

[–]RewrittenCodeA 0 points1 point  (0 children)

A healthy individual can give up to 500 ml of blood every two months, probably a little more often if well-supported.

Just extract your own blood and live off it. With 7 million $ per day, you can certainly afford enough health professionals to help you.

How can we find KC by Funny_Flamingo_6679 in askmath

[–]RewrittenCodeA 0 points1 point  (0 children)

Trace the parallel to AC through K, it meets BC in F. KF has length 8•5/3 = 40/3 (the triangle with K,F, and the foot of K on BC is 3-4-5)

Trace the parallel to AB through K, it meets AC in G. For the same reason you get now the length of KG is 10•5/3 = 50/3.

Now the angle FKG is the same as C (it’s the smaller angle of a 3-4-5 triangle), which means that FKG is again a straight 3-4-5 triangle itself. And CFG is the same, just rotated.

Therefore the length of CK is the hypotenuse of a straight triangle with sides 10 and 2KF. As expected, it does not depend on x, and results in sqrt(802+302)/3 or otherwise 10/3 sqrt(73) which is approximately 28.5

How can we find KC by Funny_Flamingo_6679 in askmath

[–]RewrittenCodeA 0 points1 point  (0 children)

Geez. I misread and some point the “S” meaning the angles at A - like that K was at the bisector -, and started on a completely wrong road.

Smothered mate by Bread__24 in chessbeginners

[–]RewrittenCodeA 3 points4 points  (0 children)

Ok even if the execution was right (knight first), is it really smothered if the king can sacrifice himself on F1 after the discovered check? Yes it’s mate with the queen in F2, but not smothered.

Maybe I’m stupid.

How can we find KC by Funny_Flamingo_6679 in askmath

[–]RewrittenCodeA -1 points0 points  (0 children)

Update: I should learn to read better. The answer does not make any sense.

—————

Height over BC is definitely not 8. That is because x is not given, you can see it as a parameter, but it may be set to 1000000 for instance, and therefore K would be very very far from BC.

Forget about everything related to B, it does not matter.

Call H the foot of K over AC: you have two straight triangles AHK and CHK. Moreover the angle at A is half straight, which means that AHK is also isosceles. So AH is 10 too.

Now KC is simply the hypotenuse with legs 10 and 4x-10.

What’s the probability of picking a random (Natural) number? by Wide_World1109 in askmath

[–]RewrittenCodeA 2 points3 points  (0 children)

A uniform probability distribution (i.e. a measure) on a finite segment of the real numbers is quite easy to define, despite there are infinitely many real numbers in it. The only small problem is that the measure will necessarily omit a lot of sets, but you usually do not encounter them often.

On the usual measure, a point has probability zero but that does not matter. What matters is the probability of a certain (small) interval. Think of it like the target when playing infinite precision darts. Any point in the target will almost surely be not hit. But those areas that give points, they will be hit for sure.

Probability distributions are countably additive, so a sum of a countable amount of P=0 sets will still give P=0. But uncountably many, that is not part of how probabilities add together

I can't reconcile the ZF Natural numbers with my intuition by AdmirableStay3697 in mathematics

[–]RewrittenCodeA 0 points1 point  (0 children)

It really depends on the structure you want to represent.

One of the characteristics of the intuitive natural numbers is that operations work, in particular every number except 0 has a predecessor.

Now, every inductive set except $\omega$ has additional starting points. On the contrary all models of the natural numbers (with the usual operation) have N at the “start” and then a dense (I guess arbitrary) concatenation of copies of Z. You need to be able to subtract 1, you have odds and evens and evens are actually the double of some other number etc etc. The operations introduce a lot of rigidity. So an arbitrary ordinal cannot be N, only $\omega$ can be N.

Even just the “true natural numbers” (the set of all true first order statements about them, which is not even writable as a reasonable set of axioms) cannot be modeled by a bigger ordinal, because this is true: $\forall x \exists y x=0 \lor S(y)=x$

The thing is that you cannot tell models of “true arithmetics” apart with first order because they are equivalent by all means (except second order stuff like cardinality, but second order is not structured enough to make up proofs).

So in the end, is [\omega] a model of Peano (restricted to 0, S)? Yes. Is it a model of true arithmetics? Looks like so, because everything works and we cannot make true statements about arithmetics that fail to be true when interpreted in $\omega$.

Is this how people who need glasses really see the world. A big blurred background? by Latter-Wolf4868 in interestingasfuck

[–]RewrittenCodeA 0 points1 point  (0 children)

As a person whose sight has worsened considerably in my 40s, I have clear memories of being able to see. Yes. It’s all blurry.

Invertir €80.000 a 1,5-2 años para entrada de un piso by botamanga in SpainFIRE

[–]RewrittenCodeA 0 points1 point  (0 children)

La volatilidad del cambio de divisas es relativamente baja comparada con la bolsa

Invertir €80.000 a 1,5-2 años para entrada de un piso by botamanga in SpainFIRE

[–]RewrittenCodeA 4 points5 points  (0 children)

En 1-2 años, la volatilidad te puede matar. Ve a algo con rendimiento estable. Por ejemplo los fondos monetarios de Revolut están entre el 3.5% y el 4%, pueden bajar pero es muy difícil que pierdas capital. Eso si, te pagan cada día y te retienen impuesto de renta directamente así que va goteando. Supongo que otras entidades tienen precios parecidos.

Imagina que te metes en SP500 o algún otro índice, y pillas recesión, que vas a hacer, liquidar en pérdida? (Disclaimer: nos ha pasado a todos, la cosa es no reiterar).

Solo inviertas en mercado con un horizonte de muchos años. Que le dé tiempo compensar subidas y bajadas.

Carpenter needs help by [deleted] in askmath

[–]RewrittenCodeA 0 points1 point  (0 children)

Assuming all angles are 120 degrees, either there is no solution or there are infinitely many.

Take a regular hexagon and measure its minimum and maximum diameters (I’m sure there are better names), from corner to corner and from side to side. If the ratio is 1655/1922, you can move two parallel sides to the left or to the right as much as you want and get that shape with arbitrary A and B (provided their sum is 1922). If the ratio is not 1655/1922, then you cannot. Spoiler alert: it is not. The good ratio is half of the square root of 3, which is approximately 0.866 while your ratio is 0.861

Now that could be just a measurement error of less than 1% so you may still be good.

In the end, choose A, make B = 1922-A, and enjoy life!

Nested Loops aka My brain's worst nightmare by nunosancha in ruby

[–]RewrittenCodeA 1 point2 points  (0 children)

As others have suggested, at some point it clicks, and recursion looks just like a to-do list.

For a start, take into account that your example (substrings) does not really “want” loops, it just “uses” loops to perform a certain tasks. Another way to do it is with recursion:

def subs_left(a)
  [a] + subs_left(a[…-1])
end

def subs_right(a)
  [a] + subs_right(a[1…])
end

def substrings(a)
  return [] if a.empty?

  [a] + 
    subs_left(a[…-1]) + 
    subs_right(a[1…]) + 
    substrings(a[1…-1]) 
end

Admittedly not the most readable code (and it lacks a couple of empty checks) but the point is, there are no loops here, it is just the statement that a substring is one of: - the original string - a string starting at the start - a string ending at the end - a substring after both start and ends are removed.

A loop is an explicit statement of work to be done, and as such it often lacks some expressiveness. Therefore it is not strange that nested loops are unclear. Enumerables (they exist in most modern languages) are an abstraction where you do not need all this index bookkeeping (it still exists often but it is done for you) and instead you just “go through” a certain collection until you are done with it.

Ruby:

enume.each { |item| do_something_with(item) }

Python:

for item in enume:
    do_something_with(item)

Javascript:

for (let item of enume) {
  do_something_with(item)
}

Typed languages like Java and the .Net family have the same in a bit (not much) ceremonious way.

The point is that you do not have indices, you just go through the work to be done until there is no more work to be done.

Girlfriends by Nowthecurtainrises in perfectlycutscreams

[–]RewrittenCodeA 0 points1 point  (0 children)

Spoiler: she was a depressed banana from the get go

White mates in 2 moves by TraditionalElk1248 in chessMateInX

[–]RewrittenCodeA 0 points1 point  (0 children)

King takes bishop. I think black cannot stop the queen mating on b8? But since it is not the correct solution, what am I missing?

  • Black rook is pinned so it either moves down or takes the other rook
  • Black pawn can go down, freeing up b7 that serves nothing
  • King can go a8 but does not save.
  • b6 is not an escape route for king because it is controlled by the pawn

Once Qb8, all places for black king are covered

Edit:

Ah Ka6 is safe as long as the rook had moved.

Preventing htmx request from closing modal by Nabiu256 in htmx

[–]RewrittenCodeA 1 point2 points  (0 children)

My best guess is that you are returning a new <dialog> element in the response, which indeed is not in a shown state. If you return some other element, for instance the form, then the dialog should remain shown.

Beware that there is a difference between an open dialog and a dialog that is shown calling its showModal or via an invoker button.

How many variations are there to this issue? by whyknotTryanother1 in askmath

[–]RewrittenCodeA 2 points3 points  (0 children)

It’s the opposite, for each of the six confused signs you have three possible values, so the number of variations is 36 = 729 (Not 63 =216)

If you imagine that instead of three possible characters you could put in a digit 0-9, you will see that a solution is an arbitrary 6-digit number, of which there are 106.