Re: cast ptr ptr to Nim array

2019-12-29 Thread seves
i used c2nim with importc but no header pragma ... maybe is that my problem. will try it later. thx

Re: Simple excel/xlsx reader, support some basic operators.

2019-12-29 Thread treeform
Nice! It's libraries like this make a language "batteries included". Good job.

Re: which XML parser is recommended?

2019-12-29 Thread treeform
It looks like xmlparser uses parsexml. I think it boils down which API is more convenient for your use case. Probably xmlparser. If you have a choice use JSON.

Re: Evaluate nim-lang

2019-12-29 Thread zetashift
I don't understand your question really, are you looking for a library that transforms Nim code into C/Java/C# code? Are you looking for a library that evaluates Nim code during runtime?

FFI constants

2019-12-29 Thread belamenso
How do you import a constant over FFI? This works: var PI {.importc.}: cdouble Run This doesn't (Error: 'let' symbol requires an initialization): let PI {.importc.}: cdouble Run

Re: Sqlite: unfinalized statements error

2019-12-29 Thread mikra
Nim's db-api is nice but unfortunately the prepared statement is not exposed (so no bulk bind/fetch possible). You could call sqlite's internal "sqlite3_next_stmt" to see which preparedStatement is still open and not finalised and close these statements manually.. The runtime-error you are

Re: Sqlite: unfinalized statements error

2019-12-29 Thread mikra
it could be a bug. if there are still some statements open (unfinalized) you will get this error while trying to close the db. I have started to develop an interchangeable sqlite-api a while ago (I use it for some tooling ) - unfortunately the work is pending because I like to finish the

Re: can use zip library on Linux but not on Windows

2019-12-29 Thread marks
That link is helpful, thank you. For anyone else who hits this, I added these two lines after the imports: when defined(windows): {.passl: "-lz".} Run It now compiles & runs & lists zip contents on Windows and Linux. And the executable doesn't seem to depend

Evaluate nim-lang

2019-12-29 Thread piotr0101
I have a question, is there any library implementing nim-lang as evaluator to the c++/c/java/c#?

Re: Sqlite: unfinalized statements error

2019-12-29 Thread sky_khan
You better know the tool you're working with. Check "INSERT OR IGNORE ..." and "INSERT OR REPLACE..." statements.

Re: Sqlite: unfinalized statements error

2019-12-29 Thread JPLRouge
nim does not substitute for SQL statements

Re: Nimble broken for pre-built binary installs

2019-12-29 Thread dom96
That's a poor error from Nimble, can you report this as an issue? IMO we need a better error message here.

Re: can use zip library on Linux but not on Windows

2019-12-29 Thread Stefan_Salewski
See [https://forum.nim-lang.org/t/5353](https://forum.nim-lang.org/t/5353) (I just asked google)

Re: Sqlite: unfinalized statements error

2019-12-29 Thread stbalbach
Alright, I thought SQL gracefully ignored adding a duplicate key but guess not. I've added this function: proc exists(database: Database, id: string): bool = result = if len(database.db.getValue(sql"SELECT id FROM Pages WHERE id = ?;", id)) > 0: true else: false

Re: Using a Case Statement inside a template

2019-12-29 Thread Araq
Use an `if` statement instead, `case` is mostly for exhaustive enumerations.

can use zip library on Linux but not on Windows

2019-12-29 Thread marks
On both Linux and Windows `nimble list -i`'s output includes: `zip [0.2.1]`. On Linux the program listed below compiles & runs & lists a zip file. On Windows I just get error messages (shown after the program). nzip.nim {.experimental: "codeReordering".} import os

Re: Sqlite: unfinalized statements error

2019-12-29 Thread JPLRouge
you want to insert the same thing twice then you have duplicate keys you should read a simple book on sql ;) it doesn't have the wrong program but knowing SQL would have allowed you to avoid this kind of error.

Sqlite: unfinalized statements error

2019-12-29 Thread stbalbach
I'm new to SQL so don't know if I'm doing something wrong or this is a bug. The following produces runtime error: "Error: unhandled exception: unable to close due to unfinalized statements or unfinished backups [DbError]" The code is mostly adapted from 'Nim in Action'. The first run on db

Simple excel/xlsx reader, support some basic operators.

2019-12-29 Thread xflywind
I write a simple excel reader.It can read xlsx file, support some basic operators. Still WIP. [https://github.com/xflywind/xlsx](https://github.com/xflywind/xlsx) You can read docs in [https://xflywind.github.io/xlsx/xlsx.html](https://xflywind.github.io/xlsx/xlsx.html) `parseExcel` to get

Re: Translating C# code to Nim code. Help needed

2019-12-29 Thread Pixeye
Thank you very much, dawkot. So I've ended up with something like this import macros import strutils import strformat export actors ### Entities type ent* = object id*:

Re: Using a Case Statement inside a template

2019-12-29 Thread mashingan
Very likely the of-branch cannot evaluate iterator and/or template. The `..<` not defined as proc, the workaround is template test(v: typed) = case v of low(int) .. pred(5): echo "under 5" else: echo "5 or above" Run

Using a Case Statement inside a template

2019-12-29 Thread phillvancejr
I'm messing around with templates and can't get passed this template/generic instantiation of 'test' from here. What is wrong with this code? let val = 10 template test(val: typed) = case val: of low(int)..<5: echo "under 5" else:

Re: Nimble broken for pre-built binary installs

2019-12-29 Thread wesleyyue
Dumb mistake. I fixed the issue by copying the entire uncompressed directory to somewhere and adding nim-1.0.4/bin and ~/.nimble/bin to my PATH as described in the install page and that fixed the issue.