News for hackers. Stuff that matters.
Re:Delphi still exists and is actively developed by jkaptur on Thursday August 18, 2022 @11:24AM (#32510948)
I get a little frustrated, because the web is AMAZING for this. Type this in anywhere. Anywhere!

  <input id=foo></input>
  <input id=bar></input>
  <button onclick="sum()">sum</button>
  <div id=result></div>
  <script>
    function sum() {
      result.innerText = parseFloat(foo.value) + parseFloat(bar.value);
    }
  </script>
That's full of "bad practices" but for the use case you're talking about, who cares?
Re:Delphi still exists and is actively developed by robin_reala on Thursday August 18, 2022 @11:42AM (#32511181)
Side note, but can I introduce you to the <output> element? You can just set its value instead of its innerText. It’s perfect for calculators.

https://html.spec.whatwg.org/multipage/form-elements.html#th...

Re:Delphi still exists and is actively developed by robocat on Thursday August 18, 2022 @01:29PM (#32512530)
Re:Delphi still exists and is actively developed by noSyncCloud on Thursday August 18, 2022 @02:04PM (#32512921)
Not supported by IE so we can't use it :(

/s

Re:Delphi still exists and is actively developed by hasperdi on Thursday August 18, 2022 @05:35PM (#32515181)
IE is outdated and unsupported by the maker. Time to let it die.
Re:Delphi still exists and is actively developed by radiojasper on Friday August 19, 2022 @08:43AM (#32520274)
Please learn what /s means :)
Re:Delphi still exists and is actively developed by hasperdi on Friday August 19, 2022 @09:13AM (#32520555)
/shutup?
Re:Delphi still exists and is actively developed by radiojasper on Saturday August 20, 2022 @06:10AM (#32530835)
Lead by example.
Re:Delphi still exists and is actively developed by jkaptur on Thursday August 18, 2022 @11:57AM (#32511357)
TIL - thanks!
Re:Delphi still exists and is actively developed by gavinray on Thursday August 18, 2022 @01:23PM (#32512451)
What?! TIL, thanks.
Re:Delphi still exists and is actively developed by arghwhat on Thursday August 18, 2022 @11:33AM (#32511063)
Unfortunately, nobody codes web apps like that. If they did they web probably wouldn't be that bad.

Instead they whip out React and because native browser elements apparently are the devil they add tailwind/material design/bootstrap/whatever on top.

Once you do it that way, the web approach honestly ends up as complex or worse than many of the alternatives...

Re:Delphi still exists and is actively developed by SCLeo on Friday August 19, 2022 @01:44AM (#32517843)
Actually I do. Whenever I need a small tool like a calculator for a video game or a simple GUI program for processing images, I always go for a barebones single html file web application.

For example, this is a simple visualizer for different numerical integrators that I wrote in a day or two for a college course: https://scleox.github.io/integrator-visualizer/index.html. The the source code is just one single html file: https://github.com/SCLeoX/integrator-visualizer/blob/master/...

Re:Delphi still exists and is actively developed by hasperdi on Thursday August 18, 2022 @05:40PM (#32515219)
That way doesn't scale well. Things become very messy and unmaintainable really quickly. This is how people code in the past, and there are good reasons why people moved on.
Re:Delphi still exists and is actively developed by arghwhat on Saturday August 20, 2022 @04:26AM (#32530351)
Code becomes unmaintainable when it was organized poorly and grows or if discipline was not maintained during growth.

React projects are just as susceptible to that, and "modern" web development is quite frankly a larger maintainability headache due to the dependency hell they bring.

Re:Delphi still exists and is actively developed by SCLeo on Friday August 19, 2022 @01:49AM (#32517865)
Just one more quick tip, you should probably use the unary operator "+" to convert strings to float. `parseFloat('2,000')` gives 2, which is probably not expected, while `+'2,000'` gives NaN indicating the input format is not recognized.