Live data from Hacker News

Show HN: I made a web-based notepad with a built in unit calculator

numpad.io

211–220 of 246 posts

Re: Show HN: I made a web-based notepad with a built in unit calculator

#212

One thing that I haven't found supported in other calculators is returning the min or max between two values

If you have abs(), you can use the following as a fallback:

min(a, b) = (a + b - abs(a − b)) / 2

max(a, b) = (a + b + abs(a − b)) / 2

Re: Show HN: I made a web-based notepad with a built in unit calculator

#213

Earlier quoted context omitted.

Thanks! You can use the web version, it's all offline and saved in localStorage. Works well in mobile too and can be "installed" as an app from there. https://filipesabella.com/CalcPad

I wanted to see how this would run in redbean[1], and it runs fantastically! If you wanna see this in a little executable that you can pass around to your friends, check out this repo I threw up: https://github.com/shmup/redbean-calcpad This is now essentially an offline CalcPad that still leverages LocalStorage, since the UI is your browser. I've configured this specific build to automatically launch your default br…

Hadn't heard about redbean, quite cool. I've added a link on my README to your repo, thanks!

Re: Show HN: I made a web-based notepad with a built in unit calculator

#214
Super cool and congrats on shipping! Something I'd love to see is the ability to embed a document on other sites via iframes a la GitHub Gist embeds. That way I could, say, write a blog post describing an algorithm, embed an example of the calculations, and allow visitors to tweak the values and see how they affect the output. Well done!

Re: Show HN: I made a web-based notepad with a built in unit calculator

#215

There is something wrong with the order of operations. When I type 2+2*2-6 i get -6 which should be 0.

It looks like APL order? Right-to-left.

No. It’s not right to left. It’s just weird:

  3 ^ 1 * 2   6
  3 ^ 1 / 2   1.73205
  3 ^ 1 + 2   5
  3 ^ 1 - 2   1

Re: Show HN: I made a web-based notepad with a built in unit calculator

#217
post #57

This looks pretty cool. I've long been looking for something similar to Soulver ( https://soulver.app/ ) that I can use on Linux. This seems promising. One small criticism: In my opinion, no web-based writing app is useful unless the tab key inserts a tab. The default behavior of most browsers to move focus to the next field is tremendously infuriating in this context. Unfortunately, that's what happens here, at leas…

Couldn't agree more with the last two paragraphs. Web standards purists will trot out a reference to some standard and point out the imagined (and terrifying) consequences of making the TAB or ENTER key behave just as they would in a non-web application, AKA a real data-entry program. This is just a version of the "lest thou cause thy brother to stumble" club used to nudge the religious into compliance with strictures that make no sense to them (and yeah, the quote is probably not verbatim, but hopefully the gist of it is clear).

Example: I (who am not a programmer) once wrote a tangled mess of HTML and JavaScript to accept, and tabulate data entry for rebar (reinforcing steel) estimates. I was inordinately proud of it, bird's nest of bad programming practice that it was. I could TAB or ENTER-key my way through all fields, the up and down arrows performed the same tasks as the TAB-key, just like on a desktop program.

So why was it important to do things this way, and break the conventions so dear to the heart of the standard's purist? Because this is how I (and many others) estimated rebar in the 1990's:

You sat at a wide desk or table with a set of plans 30" to 48"-wide spread out to your left (if you were lucky) and another 30"-48" of table was needed to catch the plan pages turned to reveal the one you were working on. You right hand rested on the keyboard's ten-key pad some 3-5 feet away. You didn't look at your right hand -- you looked at your left hand index finger which was glued to (and rarely left) the large page at precisely the item you wanted to enter into your tabulation program, as you entered the SAC code, the qty per unit, the number of units, the bar size number, the bend category, the grade of steel, and the total length. Your eyes never left the drawing as you did this, and immediately upon completing that line item, your left hand picked up a yellow highlighter and highlighted that item -- one of many hundreds or thousands that would be necessary in a materials take-off of any appreciable size. To force the use of the TAB-key, or the mouse to move through data-entry fields would simply guarantee that no one would use your program. Ever.

But the purist says, "Someone may stumble." Aunt Loreen said, "Sometimes the 'You shoulds' are the sh-ts."

Re: Show HN: I made a web-based notepad with a built in unit calculator

#218
I'm trying to figure out how many "miles per hour" I get while charging my vehicle. I have a 3.3KW charger and I average 3.1 miles per KWh while driving. I expect that I am charging at a rate of 10.23 miles per hour.

So

    3.3 KW * 3.1 miles per KWh
Says "3.3". The math is wrong and the units are gone.

Actually, it doesn't seem to understand the concept of a KW. I'll try "kilowatt" and "kilowatt-hour" respectively.

    3.3 kilowatt * 3.1 miles per kilowatt-hour
Says "Incompatible units".

The closest I got was

    3.3 kilowatt * 3.1 miles per kiloWh
Says "10.23 kW mi".

insect.sh is able to do that last one.

    3.3 kilowatt * 3.1 miles per kiloWh
    3.3 kW × (3.1 mi / kW·h)
    = 10.23 mi/h

Re: Show HN: I made a web-based notepad with a built in unit calculator

#219

Why limit it to arithmetic? Looks much like the original idea behind lighttable IDE which is basically a REPL plugin that allows to evaluate certain lines within it. There are several similar projects around.

Because Turing completeness scares me! I was a big fan of Light Table when it first came out and the developers behind it have gone on to do some really interesting things, but I want to keep this project more limited in scope for now.

Coding comes with the implicit responsibility over one’s mess. Everyone understands that hanging your computer for your own actions it’s own’s fault.

That can be an issue if you provide a limitless cloud instance, but you can roll the ball to user’s roof with client a side engine, either JS or a local instance, depending your vision for such an app.

Re: Show HN: I made a web-based notepad with a built in unit calculator

#220

I'm trying to figure out how many "miles per hour" I get while charging my vehicle. I have a 3.3KW charger and I average 3.1 miles per KWh while driving. I expect that I am charging at a rate of 10.23 miles per hour. So 3.3 KW * 3.1 miles per KWh Says "3.3". The math is wrong and the units are gone. Actually, it doesn't seem to understand the concept of a KW. I'll try "kilowatt" and "kilowatt-hour" respectively. 3.3…

The "kilo" prefix is a lowercase k. If you fix that, it works perfectly: "3.3 kW * 3.1 miles per kWh"

Gives "10.23 kW mi / kWh" as you expected

I guess ideally you would want it to factor out the kW.

Post reply on HN