Re: how to send udp datagram?

2018-07-30 Thread euant
@mashingan the documentation explicitly contains the following as an example of using UDP, which is what @luntik2012 was referring to: var socket = newSocket() socket.sendTo("192.168.0.1", Port(27960), "status\n") Run I have submitted a PR to update the documentati

Re: Question about sockets

2017-11-24 Thread euant
Buffered sockets don't work with UDP due to the way that UDP works. Buffering only works with streaming sockets. If you need per-client buffering of data, you need to implement that yourself by determining how to represent each client.

Re: Editor profiles fo Nim

2017-08-30 Thread euant
Regarding a table of what editors can do with regard to Nim integration, see here: [https://github.com/nim-lang/Nim/wiki/Editor-Support](https://github.com/nim-lang/Nim/wiki/Editor-Support) As this is a GitHub wiki, anybody can feel free to update and ammend the entry with any other plugins/edi

Re: PolyConf Call for Proposals

2017-03-16 Thread euant
@Fungi YT = YouTube

Re: Exception Hierarchy Docs

2017-04-12 Thread euant
Looks like it's been fixed on the devel branch, so should be fixed next time the docs are regenerated (next release): [https://github.com/nim-lang/Nim/blob/devel/lib/system.nim#L424](https://github.com/nim-lang/Nim/blob/devel/lib/system.nim#L424)

Re: What are you writing using nim? :)

2017-08-29 Thread euant
I'm currently using Nim at work as a replacement for some old scripts, mostly for provisioning servers (as part of our Ansible deployment setup). The tools in question preform tasks such as creating MySQL databases and the required tables/relationships and importing initial data and downloading

Re: Nim Documentation - a GitBook version

2016-09-05 Thread euant
**@Kerp** Yep, you're correct, there are a couple of "Nim for X programmers" on GitHub in the Nim Wiki - they should probably be better surfaced: * [Nim for C programmers](https://github.com/nim-lang/Nim/wiki/Nim-for-C-programmers) * [Nim for Python programmers](https://github.com/nim-lang/

Re: Reproducible builds (stop mentioning nimble install)

2017-05-10 Thread euant
I think one thing that would hlp with your first point would be to add a new option to nimble, such as nimble install --save tempdir (using one of my packages for example). This is stolen from NPM (node's package manager) which uses both \--save and \--save-dev to mean that the package argument

Nim Documentation - a GitBook version

2016-09-04 Thread euant
As was made clear in the [community survey results](http://forum.nim-lang.org///forum.nim-lang.org/t/2512), many see the Nim documentation as being an area for improvement. I recently started a project to work on this exact area, by creating a version of the Nim guide/tutorial as a [GitBook](ht

Re: nim-random not that random at all?

2017-07-20 Thread euant
Depending on what you're using the random numbers for, I also have a library that makes use of system sources of random (arc4random on OpenBSD, RtlGenRandom on Windows and /dev/urandom elsewhere) that I've been working on: [https://github.com/euantorano/sysrandom.nim](https://github.com/euantora

Re: Thread-local persistence

2017-03-21 Thread euant
Maybe something like this? I haven't played much with threads in Nim yet: [https://github.com/nim-lang/Nim/blob/4f062c3be08fa2bc3e167e1a6b9842c92bc8c8f7/tests/threads/tonthreadcreation.nim](https://github.com/nim-lang/Nim/blob/4f062c3be08fa2bc3e167e1a6b9842c92bc8c8f7/tests/threads/tonthreadcreatio

Re: Please , can we stop spams?

2016-12-23 Thread euant
I agree that requiring a GitHub account will do more harm than good. It may be worth hooking in to the StopForumSpam API which would help block bots (but not much help for humans). Realistically, human spam is very difficult to combat without impacting the user experience for legitimate users.

Re: DEB & RPM packages

2016-08-18 Thread euant
@abbat Nice. I might look into doing some automated builds as having repositories would be pretty useful for me.

Re: How to compile only to C

2017-02-26 Thread euant
Hi, There are a few options. * To simply compile to C, use the "-c" option: nim c -c test.nim This will create a nimcache directory containing your C source. * To specify a specific C compiler, as described here: [https://forum.nim-lang.org/t/2387](https://forum.nim-la

Re: General Performance tips?

2016-09-29 Thread euant
**@OderWat**: I rarely ever write my test code inside modules, I use the _unittest_ module for that :) It all comes down to personal preference really, and my background and past experience makes me favour splitting my test code into other areas.

Re: Nim added to the CSV Game benchmark

2017-05-06 Thread euant
I wonder if changing the code to the following will help much? import os, parsecsv, streams proc main() = var fields = 0'i32 csv: CsvParser let stream = newFileStream(paramStr(1), fmRead) csv.open(stream, paramStr(1)) whi

Re: General Performance tips?

2016-09-29 Thread euant
**@OderWat**: I definitely see where you're coming from, but it would be hard for me to drop my bad habits now ;)

Re: Nim newbie request/challenge

2017-09-01 Thread euant
I've been considering creating a Snap package and/or AppImage for Nim for a while. Maybe I'll have a proper look at it after my holiday.

Re: dts2nim: A TypeScript -> Nim bridge

2016-08-26 Thread euant
Oh, wow that's neat. Nice work! I've been meaning to look at TypeScript for a long time now, but have never got around to it.

Re: Subrange field not initialized

2016-12-06 Thread euant
Hi, Personally, I would write your code [as follows](https://glot.io/snippets/ekzfjeht1v): type Keypad = ref object position: range[1..9] proc newKeypad(): Keypad = result = Keypad(position: 5) let keypad = newKeypad() Note that method isd

Re: In-Memory Database

2017-07-14 Thread euant
There are semi-official Redis bindings here: [https://github.com/nim-lang/redis](https://github.com/nim-lang/redis) Redis would probably be my recommended approach, as it can do replication and all sorts of fancy things. The semi-official just recently got async support too.

Re: Tutorials and documentation for a nim project

2017-07-07 Thread euant
I am still around and do plan to eventually find time to work further on the GitBook project I started, just been super busy at work for the last several months.

Re: Nim video tutorials

2017-02-27 Thread euant
Regarding the above comment about annunciation and making sure the audio is clear and easy to understand, it would be a good idea to make sure it's open for people to submit closed captions for other languages to help aid that effort.

Re: spawninig of more than 8 threads problem

2016-08-09 Thread euant
Hi, I believe the below code does the same thing as you're trying to achieve, though I think I might be misunderstanding your aim - as it stands, there seems to be no reason to use threads whatsoever? import unicode, threadpool, locks, os proc lenU*(s: string): int =

Re: General hacking in the Nim ecosystem.

2017-10-05 Thread euant
> Is there perhaps some kind of Nim equivalent to "Find something Rusty to work > on"? There is not, as far as I'm aware. It's been talked about a few times, but to my knowledge nobody has ever had a chance to work on such a thing. Would certainly be nice to have.

Re: Nim vs D

2017-07-07 Thread euant
The [recent blog post](https://nim-lang.org/blog/2017/05/25/faster-command-line-tools-in-nim.html) I wrot eon the Nim blog also explored performance and build times in D/Nim based upon a blog post on the D site. In it you can see that D and Nim achieve similar speeds in that particular benchma

Re: General Performance tips?

2016-09-29 Thread euant
**@OderWat**: True, I personally use it for sanity as it makes it easy to search within projects for things that may be ran globally.

Re: choosenim - the Nim toolchain installer/multiplexer

2017-05-06 Thread euant
Nice one, this should make life much easier, thanks!

Re: StackOverflow Nim Documentation Proposal

2016-07-21 Thread euant
@wulfklaue: I don't believe the intention is to replace the standard docs, but the StackOverflow docs would instead be more concentrated around providing examples, which I personally am all for.

Re: Announcing Karax -- Single page applications for Nim

2017-04-22 Thread euant
Looks neat, might have to give this a go for some upcoming stuff I was going to write in React. Can I ask what exactly the "Benchmark" graph is meant to show in the readme? Because this isn't very descriptive

Re: How to get the last error from db_mysql?

2018-03-26 Thread euant
**@luntik2012** use insertId rather than tryInsertId instead: [https://nim-lang.org/docs/db_mysql.html#insertId,DbConn,SqlQuery,varargs[string,](https://nim-lang.org/docs/db_mysql.html#insertId,DbConn,SqlQuery,varargs\[string,)]

prod. ready async PostgreSQL driver

2018-07-18 Thread euant
I started writing a Postgres client using asyncdispatch a while back, but never got around to finishing it: [https://github.com/euantorano/postgres.nim](https://github.com/euantorano/postgres.nim) It currently supports basic queries, but doesn't yet support prepared statements (well, it can pre

Re: Execution speed Nim vs. Python

2016-08-11 Thread euant
@didlybom: In C#, we call them IEnumerable which is quite a good name. Something like enumerable[int] or iterable[int] might make more sense than openarray does, though it's a fairly substantial change.

Re: Love nim but at the same time starting to hate it...

2016-07-07 Thread euant
I definitely agree the documentation needs a bit of work - some more examples certainly wouldn't hurt, and improving the search ability (not just on-site but via Google too) would be a massive bonus. For instance, it took me a while (and I eventually asked on IRC) to work out that indexOf in Nim

Re: Cross compile to OS X

2016-12-07 Thread euant
Pretty cool, thanks for sharing.

Re: New website released!

2017-04-19 Thread euant
If there's the possibility of a dropdown for the documentation, might also make sense for one for the Community tab to make the forum slightly more prominent.

Re: Nim Podcast

2017-01-10 Thread euant
I'd definitely be interested in something like "This Week in Nim", similar to "This Week in Rust". I already listen to a bunch of podcasts, and I find development focused podcasts difficult to concentrate to. I listened to the phptownhall podcast for a while, but eventually bounced off of the r

Re: Nim Documentation - a GitBook version

2016-09-05 Thread euant
**@honhon**: Actually, GitBook the tool is open source, but GitBook the commercial hosted company is not. We would be self hosting the actual generated documentation rather than using their hosted service :) And yes, Django has some of the nicest documentation I've seen. I'd love to see librari

Re: httpclient extraHeaders not working

2016-08-25 Thread euant
@dom96: That reminds me that I was going to submit a PR for that...

Re: Reproducible builds (stop mentioning nimble install)

2017-05-10 Thread euant
**@dom96** The idea is that any release zip of source code would contain the vendor libraries. Most of the time you wouldn't check them in. The NuGet package manager for .net does something similar (as does nom), in that packages for a project are local to the project, and stored in a "packages

Re: Question about sockets

2017-11-23 Thread euant
Yep, see the following example: import net let listener = newSocket(sockType=SOCK_DGRAM, protocol=IPPROTO_UDP) # listen on port listener.bindAddr(Port()) var data = newString(1024) # receive buffer of 1024 bytes senderAddress: string

Re: Progress Bar using stdout.write and eraseLine()

2017-06-22 Thread euant
I also have a handy library in Nimble to simplify creating progress bars that might help too: [https://github.com/euantorano/progress.nim](https://github.com/euantorano/progress.nim)

Re: General Performance tips?

2016-09-29 Thread euant
Use a main() proc combined with when isMainModule: rather than putting main code in the top level.

Re: Nim partners with Status.im

2018-08-07 Thread euant
Brilliant news, very excited to see what lies ahead!

Re: How do I compile an example with SQLite using db_sqlite?

2018-08-20 Thread euant
@pavil You need to install the sqlite librayr on your system. I assume you're running on Linux, judging by your error emssages. It depends on the distribution you use, but for Debian you will need to install the libsqlite3-dev package: apt install libsqlite3-dev Run

Re: Cross-compiling [Win->Lin]

2018-08-20 Thread euant
The easiest solution I've found for building for Linux on WIndows is using Docker. You can use one of the [official Nim Docker](https://hub.docker.com/r/nimlang/nim/) images to compile your program and create a Linux executable.

Re: How to run this language on Mac

2018-10-01 Thread euant
Or use Choosenim: [https://github.com/dom96/choosenim](https://github.com/dom96/choosenim) To install using choosenim, run the following in Terminal.app: curl https://nim-lang.org/choosenim/init.sh -sSf | sh Run

Re: Httpclient and hangs

2019-03-27 Thread euant
First point, why does your proc return a string, when no result is actually set? Second, why does it request the content twice, but only use it once? I'd rewrite your proc as follows: import httpclient, asyncdispatch, strutils const MAX_REDIRECTS = 5 TIMEOUT = 2

Re: Nim in CircleCI

2019-04-23 Thread euant
> But both examples say version: 2. Why are there 2 examples, and which is > better? I originally added the 2nd example as the firstw as for the old way that Circle CI did things (v1). It seems the other example has now been updated: [https://github.com/nim-lang/Nim/wiki/BuildServices/_compare/

Re: Proposal for a more reliable CI

2019-05-13 Thread euant
Circle CI certainly supports scheduled jobs that support a cron syntax for specifying the schedule. See the docs here: [https://circleci.com/docs/2.0/workflows/#scheduling-a-workflow](https://circleci.com/docs/2.0/workflows/#scheduling-a-workflow)

Setting up a FreeBSD VM for Nim development

2020-05-21 Thread euant
This post was requested by @timotheecour on [GitHub](https://github.com/nim-lang/Nim/issues/13166#issuecomment-631905175). In it, I’ll walk through my process of setting up a [FreeBSD](https://www.freebsd.org) Virtual Machine for the purposes of working on the Nim compiler and standard library.

Re: Setting up a FreeBSD VM for Nim development

2020-05-21 Thread euant
Note: One thing I purposefully missed out is assigning more CPUs to the VM. By default, VirtualBox seems to assign a single CPU on my machine, but my machine has plenty of resources to share some more, so I tend to ramp it up a bit in the VM settings to 4 cores.

Re: Setting up a FreeBSD VM for Nim development

2020-05-22 Thread euant
I'd be more than happy for it to become a blog post or wiki entry if it would be helpful.

Re: Setting up a FreeBSD VM for Nim development

2020-05-23 Thread euant
The NetBSD images are just linux running QEMU as a hypervisor to run a NetBSD VM. Last time I looked at it, the docker images were still using NetBSD 8.1, where NetBSD 9.0 is the current release (released 2020-02-14). I believe the containers also have to run in privileged mode with the KVM devi

Re: Setting up a FreeBSD VM for Nim development

2020-06-11 Thread euant
True, performance will obviously also depend upon the host OS performance as well. On a side note, I'm very happy to see your PR #14634, thanks for doing the investigative work necessary!