💾 Archived View for gemi.dev › gemini-mailing-list › 000186.gmi captured on 2023-12-28 at 15:42:50. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-11-04)

🚧 View Differences

-=-=-=-=-=-=-

[Ann] An online arithmetic calculator for Gemini

1. Luke Emmet (luke (a) marmaladefoo.com)

Q: Did you leave your calculator at home before entering your 
Geminispace capsule?

Perhaps not, but in case you did, there is now a Gemini arithmetic 
calculator to get you out of your pickle.

This is another CGI test application - I wanted to test the process of 
getting input from the user.

The calculator itself:

=> gemini://gemini.marmaladefoo.com/cgi-bin/calc.cgi?0

You should be able to throw any simple arithmetic calculation at it, 
including brackets, scientific notation etc. It will try to help you out 
if you feed it nonsense or invalid input. It doesn't have any inbuilt 
functions like sine, or mathematical constants like e, i, pi though. So 
it's kinda basic, but fun.

There is also a short blog post walking through the high level logic

=> gemini://gemini.marmaladefoo.com/blog/6-Jun-2020_CGI_with_input.gmi

Best Wishes

  - Luke

Link to individual message.

2. Sean Conner (sean (a) conman.org)

It was thus said that the Great Luke Emmet once stated:
> 
> You should be able to throw any simple arithmetic calculation at it, 
> including brackets, scientific notation etc. It will try to help you out 
> if you feed it nonsense or invalid input. It doesn't have any inbuilt 
> functions like sine, or mathematical constants like e, i, pi though. So 
> it's kinda basic, but fun.

  So at first, I tried:

	3*2+1

It failed, saying I needed to space the operands.  Okay.  I then tried:

	3 * 2 + 1

And it still failed.  I wonder if you aren't decoding the query properly.

  -spc

Link to individual message.

3. Luke Emmet (luke (a) marmaladefoo.com)


On 06-Jun-2020 22:56, Sean Conner wrote:
> It was thus said that the Great Luke Emmet once stated:
>> You should be able to throw any simple arithmetic calculation at it,
>> including brackets, scientific notation etc. It will try to help you out
>> if you feed it nonsense or invalid input. It doesn't have any inbuilt
>> functions like sine, or mathematical constants like e, i, pi though. So
>> it's kinda basic, but fun.
>    So at first, I tried:
>
> 	3*2+1
>
> It failed, saying I needed to space the operands.  Okay.  I then tried:
>
> 	3 * 2 + 1
>
> And it still failed.  I wonder if you aren't decoding the query properly.

That should work. It works for me:

gemini://gemini.marmaladefoo.com/cgi-bin/calc.cgi?3%20*%202%20+%201

Is your client url escaping the request?

There could be a mismatch between client and server (molly brown) 
regarding query params.

Best wishes

  - Luke

Link to individual message.

4. Sean Conner (sean (a) conman.org)

It was thus said that the Great Luke Emmet once stated:
>
> On 06-Jun-2020 22:56, Sean Conner wrote:
> >It was thus said that the Great Luke Emmet once stated:
> >>You should be able to throw any simple arithmetic calculation at it,
> >>including brackets, scientific notation etc. It will try to help you out
> >>if you feed it nonsense or invalid input. It doesn't have any inbuilt
> >>functions like sine, or mathematical constants like e, i, pi though. So
> >>it's kinda basic, but fun.
> >   So at first, I tried:
> >
> >     3*2+1
> >
> >It failed, saying I needed to space the operands.  Okay.  I then tried:
> >
> >     3 * 2 + 1
> >
> >And it still failed.  I wonder if you aren't decoding the query properly.
>
> That should work. It works for me:
>
> gemini://gemini.marmaladefoo.com/cgi-bin/calc.cgi?3%20*%202%20+%201

  That did not work.  What did work?

        "gemini://gemini.marmaladefoo.com/cgi-bin/calc.cgi?3 * 2 + 1"

That is, when I *did not* encode the query [1], it worked.

> Is your client url escaping the request?

  Define "url escaping the request".  Because a query like "3 * 2 + 1" needs
to be esscpaed to "3%20*%202%20+%201"---it can also be escaped as
"%33%20%2A%20%32%20%2B%20%31".  It's that escaped string that is sent to the
server.

  -spc

[1]     I have a *very* basic Gemini client that sends verbatim what I tell
        it to send.

Link to individual message.

5. Luke Emmet (luke (a) marmaladefoo.com)

On 06-Jun-2020 23:16, Sean Conner wrote:
> <snip>
>    That did not work.  What did work?
>
>          "gemini://gemini.marmaladefoo.com/cgi-bin/calc.cgi?3 * 2 + 1"
>
> That is, when I *did not* encode the query [1], it worked.
>> Is your client url escaping the request?
>    Define "url escaping the request".  Because a query like "3 * 2 + 1" needs
> to be esscpaed to "3%20*%202%20+%201"---it can also be escaped as
> "%33%20%2A%20%32%20%2B%20%31".  It's that escaped string that is sent to the
> server.
>
>    -spc
>
> [1]     I have a *very* basic Gemini client that sends verbatim what I tell
>          it to send.
Thanks for the feedback.

I'll investigate further and try to get to the bottom of this...

  - Luke

Link to individual message.

6. Luke Emmet (luke (a) marmaladefoo.com)

On 06-Jun-2020 23:28, Luke Emmet wrote:
> On 06-Jun-2020 23:16, Sean Conner wrote:
>>    Define "url escaping the request".  Because a query like "3 * 2 + 
>> 1" needs
>> to be esscpaed to "3%20*%202%20+%201"---it can also be escaped as
>> "%33%20%2A%20%32%20%2B%20%31".  It's that escaped string that is sent 
>> to the
>> server.
>>
>>    -spc
>>
>> [1]     I have a *very* basic Gemini client that sends verbatim what 
>> I tell
>>          it to send.

I'm now decoding the query on the server side. Does it work for you now?

This may have revealed a client bug I need to fix

thanks

  - Luke

Link to individual message.

7. Sean Conner (sean (a) conman.org)

It was thus said that the Great Luke Emmet once stated:
> On 06-Jun-2020 23:28, Luke Emmet wrote:
> >On 06-Jun-2020 23:16, Sean Conner wrote:
> >>   Define "url escaping the request".  Because a query like "3 * 2 +
> >>1" needs
> >>to be esscpaed to "3%20*%202%20+%201"---it can also be escaped as
> >>"%33%20%2A%20%32%20%2B%20%31".  It's that escaped string that is sent
> >>to the
> >>server.
> >>
> >>   -spc
> >>
> >>[1]     I have a *very* basic Gemini client that sends verbatim what
> >>I tell
> >>         it to send.
>
> I'm now decoding the query on the server side. Does it work for you now?

  Yes it does.
> 
> thanks

  You're welcome.

  -spc

Link to individual message.

8. int 80h (int (a) 80h.dev)

On Sat Jun 6, 2020 at 7:37 PM EDT, Luke Emmet wrote:
> I'm now decoding the query on the server side. Does it work for you now?
>
> This may have revealed a client bug I need to fix

Just a heads up, bombadillo doesn't encode the query string.

int 80h

Link to individual message.

9. Luke Emmet (luke (a) marmaladefoo.com)

On 07-Jun-2020 00:38, int 80h wrote:
> On Sat Jun 6, 2020 at 7:37 PM EDT, Luke Emmet wrote:
>> I'm now decoding the query on the server side. Does it work for you now?
>>
>> This may have revealed a client bug I need to fix
> Just a heads up, bombadillo doesn't encode the query string.

I noticed this when testing with bombadillo. I think it probably should, 
if I understand things correctly.

It seems it isn't something that is consistently done by the various 
clients. Might be good to have a stress test page on this somewhere.

  - Luke

Link to individual message.

10. colecmac (a) protonmail.com (colecmac (a) protonmail.com)

As far as I can tell, Bombadillo *is* encoding the query string. Make
sure you're on the latest version.

I think the problem is that Bombadillo is encoding spaces as %20 and pluses
as just a +. This is correct, but I think the server interprets a plus and a
%20 as a space, when it should only be doing the latter.

makeworld

??????? Original Message ???????
On Saturday, June 6, 2020 7:38 PM, int 80h <int at 80h.dev> wrote:

> On Sat Jun 6, 2020 at 7:37 PM EDT, Luke Emmet wrote:
>
> > I'm now decoding the query on the server side. Does it work for you now?
> > This may have revealed a client bug I need to fix
>
> Just a heads up, bombadillo doesn't encode the query string.
>
> int 80h

Link to individual message.

---

Previous Thread: favicon.txt?

Next Thread: [ANN] demifiend.org and starbreaker.org