Use sequences/arrays newMultipartData()

2023-01-11 Thread scroot
Convert to string

Use sequences/arrays newMultipartData()

2023-01-11 Thread luqaska
Hello, I'm trying to interact with an API that needs the usage of arrays. var status = newMultipartData() status["media_ids"] = [imageId] Run But `[]=` only supports strings. How should I send this data? Thank you, @luqaska.

What would be the bast way to get parsing and validation of parameters (option:value)

2023-01-11 Thread Araq
Just use my solution and get on with more interesting things in life. I know how to design and use DSLs and gave you a good solution for your problem under the assumption that you would not only be the user of the DSL, but also its implementer.

What would be the bast way to get parsing and validation of parameters (option:value)

2023-01-11 Thread void09
Hm no, in this case I want to simply ensure the parameters that I get, from any external source, are valid in their context. They won't be used as parameters in a nim program, but to eventually execute an external binary. So cligen is not of any help. Araq's way, "default design procedural prog

The WASM Revolution

2023-01-11 Thread arik
I agree, Nim is one of the languages that can take advantage of it to the fullest, and C# is mediocre when it comes to slimness, megabytes of difference in a hello world executable even with AOT.

The WASM Revolution

2023-01-11 Thread ShalokShalom
Considering that the amount of languages who can sensibly deploy to WASM, I can imagine that from a purely 'popularity' perspective, it can make sense, to support WASM. Not that I am a huge fan of it - there are obvious downsides to it - assuming there is a crowd outside, that waits for a prope

This Month with Nim: November and December 2022

2023-01-11 Thread ducdetronquito
Great stuff, thanks for creating this recap :)

Trying to make a lexer, stops if it hits an operator.

2023-01-11 Thread Araq
lexbase is not "line based", use the `refillChars` optional parameter: proc open*(L: var BaseLexer, input: Stream, bufLen: int = 8192; refillChars: set[char] = NewLines) Run You need to call `handleRefillChar` for every char that is in your `refillC

Trying to make a lexer, stops if it hits an operator.

2023-01-11 Thread axyz
may have to dig deeper in the `BaseLexer` source, but I think the problem is not about reading a large file, but the fact that the lexer buffers one line at the time and has this `BufLen` limit instead of having something like a moving window or similar. My assumption is that this works well for

Trying to make a lexer, stops if it hits an operator.

2023-01-11 Thread georgelemon
Ah, that makes sense now. What about `len(fileContents)`? Anyway, for really big files there is `std/memfiles`

How do you write a test with mock?

2023-01-11 Thread hamidrb80
you can use [mockingbird](https://github.com/PhilippMDoerner/mockingbird) but [I suggest not to use this approach to test your app](https://dpc.pw/my-case-against-mocking-frameworks)

Trying to make a lexer, stops if it hits an operator.

2023-01-11 Thread axyz
Thanks for the extensive example, I will have a look in detail. Maybe, though, my problem was not too clear. I have no problem in ignoring the new lines or white spaces. My issue is that when using the `open` method of `BaseLexer` with the default `BufLen` and I try to parse a file where all the

This Month with Nim: November and December 2022

2023-01-11 Thread pietroppeter
new post on nim blog!🚀 ### [This Month with Nim: November and December 2022](https://nim-lang.org/blog/2023/01/11/this-month-with-nim.html) Cliche, WebRTC, Nimrun Action and p5nim **reminder** : to have your activity showcased in the monthly blogpost just add an issue here:

What would be the bast way to get parsing and validation of parameters (option:value)

2023-01-11 Thread xigoi
I'm not sure what exactly you're asking, but maybe [cligen](https://github.com/c-blake/cligen) would work?

What would be the bast way to get parsing and validation of parameters (option:value)

2023-01-11 Thread Araq
The default design is always procedural programming: import std / [strformat, strutils, tables] proc error(msg: string) = echo msg proc wantNumberBetween(field, s: string; a, b: int) = try: let x = parseInt(s) if x < a or x > b: error(