> On 13 May 2020, at 12:04, Cédrick Béler <cdric...@gmail.com> wrote:
>
>
>>>
>>> PS: btw Sven, we (with a group of students did a naive and simple url
>>> shortener that would fit nicely to default zinc demos ;-)
>>>
>>> Here is the script for accessing registered urls (sweet):
>>>
>>> server := (ZnServer startDefaultOn: 9999)
>>> onRequestRespond: [ :request | | key |
>>>
>>> key := request requestLine uri segments last.
>>> dataBase at: key
>>> ifPresent: [:val | ZnResponse redirect: val ]
>>> ifAbsent: [ZnResponse badRequest: request].
>>> ].
>>
>> Yes, that does look nice: it is very concise.
>
> Yes, the concise code was what I liked and this is because of your design.
>
> I was doing it live with students in something like 10 minutes… so thanks for
> making me feel like a magician to them ;-)
>
>
>>
>> I would like to see the whole code, any pointers ?
>
>
> We finish the project in two weeks time, so I’ll send the resulting code. We
> need to do the shortUrl registration page.
> Basically, for now, this code snippet only need : dataBase :=
> (Ordered)Dictionary new.
>
> I want to keep it concise. One objective is keeping the dictionary
> (dataBase) size controlled as it’s intended to be a demo app.
>
> I’m thinking of limiting this size (dataBase) to n entries (100, 1000 ?).
> There could be eventually be an option to grow the size (but by validation).
>
> Another objective (but they won’t do it if I don’t do it myself) is to keep
> track of the history of clicked url for statistic purposes (probably one of
> next semester projet ^^).
>
> It’s kind of a very nice and simple example to show students client/server
> concepts, hashing techniques, QRcode usage (short-url are a must-have for
> them), etc… and so concise in Pharo… probably a good candidate too for the
> dev-blog.
>
> I’ll keep you informed - maybe by PR as I finally start to get my head around
> git :)
No need for that, at the moment, I would just like to see what you did.
I would like to see if it would be a good demo candidate.
In any case, the focus of the examples should be on HTTP, not the stuff around
it.
> Cheers,
> Cédrick
>
>
>>
>> Sven
>>
>>>> Le 12 mai 2020 à 10:06, Sven Van Caekenberghe <s...@stfx.eu> a écrit :
>>>>
>>>> Hi,
>>>>
>>>> So here is a little anecdote from the real world. I was planning to update
>>>> the OS on my Linux server, from Ubuntu 18.04 LTS to 20.04 LTS (Long Term
>>>> Support). This small (Digital Ocean, 1GB RAM, 1 Core) cloud server runs 3
>>>> Pharo images with public facing web sites.
>>>>
>>>> The machine itself reports:
>>>>
>>>> $ uptime
>>>> 12:37:50 up 530 days, 21:46, 1 user, load average: 0.02, 0.04, 0.01
>>>>
>>>> which means it hasn't been powered down or didn't restart in 530 days.
>>>>
>>>> I was surprised to discover that 2 of the Pharo images on that machine did
>>>> just as well:
>>>>
>>>> $ ./repl.sh
>>>> Connecting to Telnet REPL at locahost:41011
>>>> Trying 127.0.0.1...
>>>> Connected to localhost.
>>>> Escape character is '^]'.
>>>> Neo Console
>>>> Pharo-7.0+alpha.build.660.sha.2eb9bd2f41e7b0bd8f9f4190906910f83c178ab1 (32
>>>> Bit)
>>>> pharo> get system.uptime
>>>> 405 days 20 hours 29 minutes
>>>> pharo> quit
>>>> Bye!
>>>>
>>>> $ ./repl.sh
>>>> Connecting to Telnet REPL at locahost:41001
>>>> Trying 127.0.0.1...
>>>> Connected to localhost.
>>>> Escape character is '^]'.
>>>> Neo Console Pharo4.0 of 18 March 2013 update 40620
>>>>> get system.uptime
>>>> 530 days 21 hours 44 minutes
>>>>> quit
>>>> Bye!
>>>>
>>>> So both Pharo 7 and Pharo 4 kept on doing their jobs for a very long time.
>>>> I think this is a testament to the stability of Pharo and to what is
>>>> possible.
>>>>
>>>> Regards,
>>>>
>>>> Sven
>>>>
>>>> --
>>>> Sven Van Caekenberghe
>>>> Proudly supporting Pharo
>>>> http://pharo.org
>>>> http://association.pharo.org
>>>> http://consortium.pharo.org
>>>>
>>>>
>>
>>
>
>