How to close a Logger

2023-07-31 Thread FabienPRI
Hi all, I got a multi-threaded app, all threads have their own Logger using newRollingFileLogger as first action in the thread As I am using a DB, each night there is a Vacuum on the sqlite DB and I close all threads to be sure the GC could handle any possible things. Then I restart threads af

Wishlist: Ideal UI library for Nim

2023-07-25 Thread FabienPRI
Things not to forget about Qt is that all Qt libs are not GPL/LGPL. Quite a lot of them are GPL only. And the commercial licence is quite costly for small company. So Qt is not that evident for any commercial software. MoreOver, Qt licensing has evolved in the past, and could so in the future.

noob question exception and await

2023-04-12 Thread FabienPRI
Hi, Let say I have this code : proc handler(req: Request) {.async.} = if req.url.path == "/hello-world": let msg = %* {"message": "Hello World"} let headers = newHttpHeaders([("Content-Type","application/json")]) await req.respond(Http200, $msg, headers)

How to get exe name from pid under Windows

2023-03-24 Thread FabienPRI
thanks a lot

How to get exe name from pid under Windows

2023-03-21 Thread FabienPRI
Hi, I've tried to use pid_name from psutil using the corrections proposed in But even if it compiles I get an empty string each time whereas I am sure of the process ID. Anybody know if there another way to get the name of a running proces

compilation error from nim 1.4 to 1.6.6

2022-06-29 Thread FabienPRI
Hello, I have a project done with nim 1.4, compilation and run is ok. When I tried on another machine to compile it using last nim 1.6.6, I've got a compilation error: psutil_wind.nim(151, 30) Error type mistmatch: got but expected one of: proc GetModuleBaseName(hProcess: HNDLE, hModule: HMODU

dynamic shared libs

2022-03-28 Thread FabienPRI
Hi, It is 3 times I wrote a nim web server with basic functions: * render pages, load the static part in a file, then replace some variables with dynamic content * trigger some function that the user asks when clicking some buttons on the web page or submitting form I'd like to do the we

How to make Nim more popular

2021-09-01 Thread FabienPRI
Hi, I do not have any answer better that what have been told. But I use nim for about 2 years at my job for small to mid size projects. I think it could be better to focuss on points that can bother any dev or slow the process of creating softwares with NIM (which I find a great language): *

WriteLine end the line by \n Why not by \p (platform specific)

2021-08-24 Thread FabienPRI
It is your opinion, but it could be understand as I don't care of Windows users (I stay polite). IMHO not a good message for a language that aims to be multi OS friendly. And there are a lot of (maybe bad) tools remaining used in the huge liste of Dos / Windows softwares still used by companies

WriteLine end the line by \n Why not by \p (platform specific)

2021-08-23 Thread FabienPRI
Hi all, Not sure to be right but it seems that on Windows WriteLine end line by a n, which is not aligned with platform convention. May be it should be better to end by p which is platform specific, cn on Windows. May be I missed something and it is not the good function to write lines in a t

zip error code

2021-07-12 Thread FabienPRI
Hi, I am using zip/zipfiles as shown in the help: import zip/zipfiles # Opens a zip file for reading, writing or appending. var z: ZipArchive if not z.open(filename): echo "Opening zip failed" quit(1) # extracts all files from archive z to the d

atomic and threads

2021-05-31 Thread FabienPRI
Hello, I am using a var closeProgram : Atomic[bool] to know between my threads and the main thread to know if if it time to exit properly. By if I try to extend a string atomic variable I've got the error: var atomicStr: Atomic[string] Error: 'foo' is not GC-safe as it accesses 'atomicStr' w

setControlCHook

2021-05-06 Thread FabienPRI
Thank you for the help, I will try this way.

setControlCHook

2021-05-05 Thread FabienPRI
@ggibson : I tried your code and with nim 1.4.6, ctrl_c_handler is not called, under Windows 10 I am not sure to be clear. So let's try to explain it another way: I have a web server in the main thread, that uses a sqllite db I need to create a thread as a background worker that do heavy work,

nim update & choosenim

2021-05-05 Thread FabienPRI
No worry, just a miss of luck to be the one that experienced this issue, bit it gets fixed quickly, so that's ok. For production use, be able to do an update to the last stable version from an existing installation is a real need, because most of the time, that is what NIM users need to do, eve

nim update & choosenim

2021-05-05 Thread FabienPRI
I've copied include/zconf.h include/zlib.h lib/libz.a and it seems to work again. Did try yet the compile part of my project but should work I will try it later. updating compiler within the same 1.4 version list is quite a big change, may be it could be better to postpone this type of update f

nim update & choosenim

2021-05-05 Thread FabienPRI
OK, before my choosenim try, I've got all in C:\nim-1.4.0 now it seems that choosenim put things in C:\Users\xxx\\.choosenim\toolchains I will try to copy missing parts from older mingw install to C:\Users\xxx\\.choosenim\toolchains\mingw64, is it the right thing to do? I like a lot the languag

nim update & choosenim

2021-05-05 Thread FabienPRI
I was running nim 1.4.0, so I decided to move to 1.4.6 using choosenim It seems to work weel but in fact when I tryed to compile my software, I've got an error from gcc: C:Userspoirier.nimblepkgszip-0.3.1zipprivatelibzip_all.c:34:10: fatal error: zlib.h: No such file or directory 34 | #in

nim update & choosenim

2021-04-30 Thread FabienPRI
I use NIM for some times now, and until now I do updates of NIM version "by hand" (Windows). I've tried once choosenim, which seems a great idea, but I did not get to make it work, so it was quicker for me to do the update manually. It could be very nice if there was a way to do a proper upgrad

setControlCHook

2021-04-29 Thread FabienPRI
Hi, I use setControlCHook to handle the close of a sqlite db, after doing some logs about running time. I moved to Nim 1.4, and in the same time I add a thread to my code, in fact this is a web sever, but there is a background task that handle CPU demanding work (zip of thousands of file and s

global var & thread

2021-04-27 Thread FabienPRI
Hi, I created a thread that needs to access global variable (specific dir path during init of the main thread). I marked the global var with {.threadvar.} at declaration. But in the created thread, the global var is empty at runtime. Do I need to re init this var in the created thread? If yes

unzip multipart zip file

2021-04-27 Thread FabienPRI
Thank you, it works once files merged. I tested it under dos first > copy /b xxx.zip.001 + xxx.zip.002 + xxx.zip.003 + xxx.zip.004 xxx.zip then test the merge in nim, perhaps not the shortest way, but it works: var files: seq[string] for kind, path in walkDir "C:\\tmp\\testzip"

unzip multipart zip file

2021-04-26 Thread FabienPRI
Hi all, I'd like to unzip some multiple zip files ( xxx.zip.001, xxx.zip.002, etc) that I've created using 7zip splitted in small file sizes. I am using the following code: for kind, path in walkDir "C:\\tmp\\testzip": if "zip.001" in path: echo path

string concat I don't understand

2021-04-09 Thread FabienPRI
OK ok for splitting lines, but I though my issue was more about string concatenation. Does it mean there was a remaining c at the end of the string that made the concatenation behave that strange, replacing the string from the beginning???

string concat I don't understand

2021-04-09 Thread FabienPRI
OK I will try this, but I've worked a lot with text files under windows and did massive use of split("\n") Run with Windows text files that was #13 #10 ended without any issue, but that was prior to nim 1.4

string concat I don't understand

2021-04-09 Thread FabienPRI
Yes I saw strutils.splitLines recently reading the doc, did not remember to see it before, should I have to update old code to use it, is there a reason to prefer strutils.splitLines over split, which is not clear in the doc?

string concat I don't understand

2021-04-09 Thread FabienPRI
Hello, I've got a text file containing 2 lines, forced to use code mode to show the exact content: \\ciosrv034\status\ 3 Run I've got the following code: let argv = commandLineParams() let contentO = readFile(my_file).split("\n") var pa

Performance comparison of various compilers

2021-03-15 Thread FabienPRI
Hi, please see I think there are several benchs of this type but in this one there is nim but not really well placed : comments says it is not optimized for nim, but how to make it quicker? Just a question, just want to se

Dividing duration

2020-12-17 Thread FabienPRI
I am on a 64 bits system (nim 1.4.0). If I undestood this thread, on 64 bits system int64 should be supported. Whatever the underlying system, it seems strange such behavior for basic type, that is used for Duration, so no direct operation on duration are possible, not that fun in real life. Re

Dividing duration

2020-12-17 Thread FabienPRI
Hi all, I'd like to do something like that: ... lastAlarm = content.parse("-MM-dd HH:mm:ss") # get last alarm date from a file let delayAlarm = now() - lastAlarm # duration between now and last alarm # trying to get the number of nbMin minutes in this delay

use of zip fails with 1.4

2020-10-26 Thread FabienPRI
ok found, already fall in this one

use of zip fails with 1.4

2020-10-26 Thread FabienPRI
Hi, I moved a 1.0 project to 1.4. This project uses zip. When I compile it, I've got a set of errors: libzip_all.c.o:libzip_all.c:(.text+0x117): undefined reference to 'zError' libzip_all.c.o:libzip_all.c:(.text+0x2dc1): undefined reference to 'crc32' libzip_all.c.o:libzip_all.c:(.text+0x2e67)