Re: Please , can we stop spams?

2016-12-23 Thread Libman
I'm not saying that having a GitHub account should be a _requirement_ for 
joining, but it could be a part of the "business logic" for new account 
validation. It's very easy to implement. If you're an established Nim 
developer, the forum rolls out a red carpet. If you're not, your first X posts 
are hidden until a moderator validates them. Or something like that.

Linking forum profiles to GitHub is a good idea for a number of other reasons 
as well: keeping track of who is who, who wrote what, etc.


Re: Please , can we stop spams?

2016-12-23 Thread Atlas
The admins have to set some rules about posting.


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.


Nim with gcc 5.4 SIMD auto-vectorization

2016-12-23 Thread Stefan_Salewski
Yesterday I did a very short test. Generally SIMD (Single instruction, multiple 
data) may work best with 16 byte aligned data and restrict modifier to indicate 
non overlapping data. But even without there is some SIMD available in Nim 
indeed.

First we make gcc output visible with &> output redirection and enable 
vectorization:


cat nim.cfg
path:"$projectdir"
nimcache:"/tmp/$projectdir"
gcc.options.speed = "-save-temps -pipe -march=native -O3 -ftree-vectorize 
-fopt-info-vec -fno-strict-aliasing &> gcc.log"


We may also specify "-fopt-info-vec-missed" to see where vectorization failed, 
but that will generate much noise for all the libs. "-march=native" is used to 
ensure optimization for current CPU, and "-save-temps" outputs assembler 
listings. Test with


import random
proc test =
  var a: array[128, int]
  for i in 0 .. random(128):
a[i] = i
  echo a[7]

test()



cat gcc.log
gcc: warning: -pipe ignored because -save-temps specified
/tmp//home/stefan/simd/simd.c:59:8: note: loop vectorized

cat simd.s
callrandom_99297_4293377359
testq   %rax, %rax
js  .L13
leaq-3(%rax), %rcx
leaq1(%rax), %rdi
shrq$2, %rcx
addq$1, %rcx
cmpq$3, %rax
leaq0(,%rcx,4), %rdx
jle .L14
vmovdqa .LC1(%rip), %ymm0
xorl%esi, %esi
vmovdqa .LC3(%rip), %ymm1


"vmovdqa" seems to be SIMD instructions. So even with a non fixed upper bound 
for the for loop it works. I don't know if there is any benefit in real life :)


Re: Sequence is unchangeable when passed to a spawned proc

2016-12-23 Thread pegra
Thank you for your posts.

I think the behavior is a matter of the Nim compiler. aSeq is deepcopied into 
aSeqPar and aSeqPar behaves as if it is declared locally within workerTread as 
"let aSeqPar = aSeq". But I would prefer: "var aSeqPar = aSeq". Obviously there 
exists no suitable pragma too.


Re: Please , can we stop spams?

2016-12-23 Thread flyx
Having a GitHub account should not be required to participate in the community 
and I think it's harmful to make people with few original Nim code second-class 
citizens.


Re: Please , can we stop spams?

2016-12-23 Thread Libman
Another idea is GitHub integration. Make each new user authenticate with 
GitHub, scan his/her repos for original Nim code, assign reputation rank based 
on star count. 8)


Re: GTK 3.20 Nim wrapper

2016-12-23 Thread vlad1777d
No, please, do not create RSVG wrapper =) Take your time for rest and making 
other useful things.

Thanks for pointing me to that. I'm confused in all that 
pointer-reference-object_itself stuff =) I'll try to check this tomorrow.

SVG works, I created GdkPixbuf from it with: 


fill_cell_with_new_image(color_cells[index], 
"/images/cells/general_dark.svg")

proc fill_cell_with_new_image  (cell:ref cell_type,  image_name:string)  
{.discardable.} =
#[ Fills given cell's image field with specified in "image_name".
]#

var image = gtk3.newImage()
var pixbuf: gdk_pixbuf.GdkPixbuf =
gdk_pixbuf.newPixbufFromFileAtSize(os.getAppDir() & 
image_name, cell_size.cint(), cell_size.cint(), dummy_error)

image.setFromPixbuf(pixbuf)

cell.image = image


and all worked and displayed.

I have many books on my PocketBook reader: about Java, Javascript, Python (near 
7 pieces), many other =) But I have no books about Nim, Gtk. Besides, the only 
book I read - Mark Lutz - Learning Python =)

Thanks for help and suggestion, I'll try to fix this tomorrow.


Re: GTK 3.20 Nim wrapper

2016-12-23 Thread Stefan_Salewski
Generally you should check the result of functions which returns a pointer like 
the "newFromFile" ones. That functions generally return nil if something went 
wrong, in that case you can find error info in the error var. And you may look 
for C examples. Do you have the Krause book?

And, as GTK messages tells you, you should not reuse the same error var when an 
error has occurred.

I have to admit that I am currently not too much motivated doing the RSVG 
wrapper. Currently you are the only active NIm GTK3 developer, you may loose 
interest or have no spare time soon, so there will be no RSVG user left.

But maybe I will do, I may have some free days between Christmas and new year. 
But of course also many other task, Araq asked me to make nimble packages for 
GTK3...

For your bugs, maybe your wrapper is wrong, or maybe your SVG file is invalid? 
Can you test with another SVG file? Maybe write some C code and try to use your 
SVG file?