@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
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.
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
@Fungi YT = YouTube
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)
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
**@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/
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
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
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
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
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.
@abbat Nice. I might look into doing some automated builds as having
repositories would be pretty useful for me.
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
**@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.
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
**@OderWat**: I definitely see where you're coming from, but it would be hard
for me to drop my bad habits now ;)
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.
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.
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
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.
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.
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.
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 =
> 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.
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
**@OderWat**: True, I personally use it for sanity as it makes it easy to
search within projects for things that may be ran globally.
Nice one, this should make life much easier, thanks!
@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.
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
**@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,)]
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
@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.
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
Pretty cool, thanks for sharing.
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.
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
**@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
@dom96: That reminds me that I was going to submit a PR for that...
**@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
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
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)
Use a main() proc combined with when isMainModule: rather than putting main
code in the top level.
Brilliant news, very excited to see what lies ahead!
@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
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.
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
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
> 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/
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)
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.
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.
I'd be more than happy for it to become a blog post or wiki entry if it would
be helpful.
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
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!
55 matches
Mail list logo