Re: How to select the regex that matches the first token of a string?

2021-07-03 Thread vnr via Digitalmars-d-learn
On Saturday, 3 July 2021 at 09:28:32 UTC, user1234 wrote: On Saturday, 3 July 2021 at 09:05:28 UTC, vnr wrote: Hello, I am trying to make a small generic lexer that bases its token analysis on regular expressions. The principle I have in mind is to define a token type table with its correspon

How to select the regex that matches the first token of a string?

2021-07-03 Thread vnr via Digitalmars-d-learn
Hello, I am trying to make a small generic lexer that bases its token analysis on regular expressions. The principle I have in mind is to define a token type table with its corresponding regular expression, here is the code I currently have: ```d import std.regex; /// ditto struct Token {

Re: How to reset the website when the user leaves it, with vibe.d?

2021-06-29 Thread vnr via Digitalmars-d-learn
On Tuesday, 29 June 2021 at 20:40:29 UTC, Steven Schveighoffer wrote: On 6/29/21 4:25 PM, vnr wrote: [...] Has nothing to do with sessions, you are saving the text posted, and then making it the default text whenever the page is rendered. [here](https://github.com/noc-lang/playground/blob

Re: How to reset the website when the user leaves it, with vibe.d?

2021-06-29 Thread vnr via Digitalmars-d-learn
On Tuesday, 29 June 2021 at 19:05:43 UTC, WebFreak001 wrote: On Tuesday, 29 June 2021 at 16:25:09 UTC, vnr wrote: Hello 😊 I have a bit of a problem that seems simple enough, but I can't find an answer to my questions. On my website, I have two textareas that the user can write on. When the us

How to reset the website when the user leaves it, with vibe.d?

2021-06-29 Thread vnr via Digitalmars-d-learn
Hello 😊 I have a bit of a problem that seems simple enough, but I can't find an answer to my questions. On my website, I have two textareas that the user can write on. When the user reloads the page or closes it and then reopens it, the text he wrote is still written, which is quite annoying.

Re: Deploy vibe.d application on Heroku : App not compatible with buildpack

2021-06-28 Thread vnr via Digitalmars-d-learn
On Monday, 28 June 2021 at 16:14:07 UTC, Andre Pany wrote: On Monday, 28 June 2021 at 13:53:05 UTC, vnr wrote: [...] Hi, Heroku is Cloud Foundry? If yes, you can make use of the binary buildpack or deploying your app as container too. Kind regards Andre Thank you :) Via your explanation

Deploy vibe.d application on Heroku : App not compatible with buildpack

2021-06-28 Thread vnr via Digitalmars-d-learn
Hello, I'm trying to deploy my vibe.d application to Heroku via the GitHub deployment method, so that I can post the source code to my repo publicly, as well as use it so that Heroku can host it. I followed the instructions from Heroku and the vibe.d build pack, but unfortunately there seems

Re: Display a random image with vibe.d

2021-06-20 Thread vnr via Digitalmars-d-learn
On Sunday, 20 June 2021 at 14:28:26 UTC, jfondren wrote: On Sunday, 20 June 2021 at 13:58:22 UTC, vnr wrote: Thanks for the answers, I understand better what is going on. So, what should I do to make my server respond with a random image, and not the random image page? I'm fairly new to vibe

Re: Display a random image with vibe.d

2021-06-20 Thread vnr via Digitalmars-d-learn
On Sunday, 20 June 2021 at 13:06:20 UTC, jfondren wrote: On Sunday, 20 June 2021 at 12:34:33 UTC, vnr wrote: I don't understand why the image doesn't display, when I take an image from the internet and give the url, it works fine though. ``` $ curl -s http://127.0.0.1:8080/|grep img

Display a random image with vibe.d

2021-06-20 Thread vnr via Digitalmars-d-learn
Hello, I would like to display a random image each time a page is refreshed. I think my random function works, but the image does not appear on the page. I have this template: ``` /public /images /rndimg img1.jpg img2.jpg img3.jpg /source app

Re: Dub seems to be using an earlier version of the dependency that I tell it to use

2021-01-22 Thread vnr via Digitalmars-d-learn
On Friday, 22 January 2021 at 15:57:00 UTC, Steven Schveighoffer wrote: On 1/22/21 10:34 AM, vnr wrote: [...] It just needs a tag. delimited (for example) added here: https://github.com/DmitryOlshansky/pry-parser/commit/808d01c30b50a928f5795dab7e6c0a7a392899b0 May of 2017, Last tag was v0.3.

Dub seems to be using an earlier version of the dependency that I tell it to use

2021-01-22 Thread vnr via Digitalmars-d-learn
Hello 😊 I'm trying to use the combinator Pry parser library (https://code.dlang.org/packages/pry/0.3.2), but, as I'll explain in the rest of this message, it seems to be a bad version of the lib that dub downloads me. So, simply by adding pry as a dependency on a virgin project, and using f

Re: How to resize an image ? 🤔

2020-12-27 Thread vnr via Digitalmars-d-learn
On Sunday, 27 December 2020 at 16:49:49 UTC, Guillaume Piolat wrote: On Friday, 25 December 2020 at 20:59:03 UTC, vnr wrote: Hello 😺 For a small "script" that generates printable files, I would need to change the size of an image (which is loaded into memory as an array of bytes) to shrink it

Re: How to resize an image ? 🤔

2020-12-25 Thread vnr via Digitalmars-d-learn
On Friday, 25 December 2020 at 21:05:19 UTC, Ferhat Kurtulmuş wrote: On Friday, 25 December 2020 at 20:59:03 UTC, vnr wrote: Hello 😺 For a small "script" that generates printable files, I would need to change the size of an image (which is loaded into memory as an array of bytes) to shrink it

How to resize an image ? 🤔

2020-12-25 Thread vnr via Digitalmars-d-learn
Hello 😺 For a small "script" that generates printable files, I would need to change the size of an image (which is loaded into memory as an array of bytes) to shrink it to scale if it exceeds the A4 page size. To load the images into memory and generate a PDF, I use the "printed" package. I

Re: Writing a really fast lexer

2020-12-12 Thread vnr via Digitalmars-d-learn
On Saturday, 12 December 2020 at 16:43:43 UTC, Bastiaan Veelo wrote: On Friday, 11 December 2020 at 19:49:12 UTC, vnr wrote: For a project with good performance, I would need to be able to analyse text. To do so, I would write a parser by hand using the recursive descent algorithm, based on a s

Re: Writing a really fast lexer

2020-12-12 Thread vnr via Digitalmars-d-learn
On Friday, 11 December 2020 at 20:19:49 UTC, H. S. Teoh wrote: On Fri, Dec 11, 2020 at 07:49:12PM +, vnr via Digitalmars-d-learn wrote: [...] If you want a *really* fast lexer, I recommend using GNU Flex (https://github.com/westes/flex/). Unfortunately, AFAIK it does not support D

Writing a really fast lexer

2020-12-11 Thread vnr via Digitalmars-d-learn
For a project with good performance, I would need to be able to analyse text. To do so, I would write a parser by hand using the recursive descent algorithm, based on a stream of tokens. I started writing a lexer with the d-lex package (https://code.dlang.org/packages/d-lex), it works really we

Re: Automatic update system

2020-11-28 Thread vnr via Digitalmars-d-learn
Thank you for your suggestions :) I particularly appreciate the idea of making my program a dub package, it allows me to be cross platform and to have no dependencies other than those of the default D environment. To the detriment of automatically updating the application, I think that only c

Automatic update system

2020-11-26 Thread vnr via Digitalmars-d-learn
Hello, I have a program written in D which is open-source on GitHub. I would appreciate it if, when I release a new version, users would be notified by the program and that it offers an automatic update, i.e. the user doesn't have to reinstall the whole repository himself, but that it is upda