Re: Osproc input stream hang

2020-02-24 Thread cdunn2001
A hang in OS i/o can relate to buffering. You'd need to post a working 
(hanging) example.


Re: What prevents you from using Nim as your main programming language?

2020-02-24 Thread yewyy
So, I already attempted to make a reply to tell you guys why I'm not using Nim 
as my programming language, even though, I really would like too. I'm unable to 
describe the problem I have with Nim, but I don't have to, because somebody 
else already did and I'm so glad that I'm not alone with this thought and 
mindset.

I had planed writing a massive orchestration software and I'd love to write it 
in Nim. But as a maintainer of such a large-scale codebase I imagine it to be a 
nightmore doing code reviews on GitHub, not knowing what is coming from where. 
You could argue with "Use qualified imports blah blah blah" but who really does 
that. And it doesn't cooperate well with the general Nim coder with this 
"freedom mindset".

In my point of view Nim is great for prototyping, CLI tools, "scripting" and 
maybe even minor-ish web applications. But you just can't do large-scale stuff 
with it and I'm not gonna believe anything else if not proven otherwise. (And 
please don't come up with Status' Ethereum Client "Nimbus". Have a look first.)

It's actually pretty sad. I'd really like to use Nim for something large-scale 
but Nim, in its current state, feels more like a scripting language with a "AoT 
facade".


Re: Using async Nim procedures in Python

2020-02-24 Thread dom96
This is a cool idea and doing this might actually not be too difficult. The 
main pieces to get this working are likely:

  * Calling Nim's async event loop from Python's periodically
  * Interoperability between Nim's futures and Python's (not strictly 
necessary, but would allow awaiting Nim's async procs in Python which would be 
pretty nice)



I know that it is possible to ask epoll to let you know when another epoll FD 
is ready to be polled. Python should allow you to add arbitrary FDs to its 
event loop in order to receive readable/writeable events on it, you can then 
grab Nim's asyncdispatcher's FD and ask Python to tell when it should be 
polled. Then simply poll it. I take this approach in my HTTP server: 
[https://github.com/dom96/httpbeast/blob/master/src/httpbeast.nim#L168-L171](https://github.com/dom96/httpbeast/blob/master/src/httpbeast.nim#L168-L171).

Happy to help further if you're interested in pursuing this.


Re: question on autolayout in wNim

2020-02-24 Thread Ward
Your rule 2 and rule 4 have contradictions.

Rule 2: |-50-[text]| Rule 4: |[text]|


Using async Nim procedures in Python

2020-02-24 Thread ondrej_zapletal
Hello, I have been looking on Nim for couple of months now, and I have to say 
that I'm very intrigued.

I'm currently working for a company that is mainly using python. Our core 
application is almost entirely written in it (some small parts are written in 
cython). It is quite large (close to 100k lines of python).

Lately we have been having some difficulties with performance (we usually 
resort to horizontal scaling), but also with mypy (static typing).

We are using asyncio heavily, basically our entire application is asynchronus. 
We are utilizing static type annotations (mypy) extensively so our code 
sometimes comes close to Nim syntax (if you ignore usage of class hierarchies).

There are some parts that could be rewritten easily, but I'm afraid that we 
would inevitably run into limitations of missing support for async.

I'm aware of [nimpy](https://github.com/yglukhov/nimpy) and I was wondering if 
there is any way to write asynchronous Nim code that would be await-able in 
python. I'm guessing that general solution that would automagically allow usage 
of Nim async procedures to be run in python event loop would be to much to ask. 
But I was thinking that there might be something that can be implemented for 
specific use-cases.

Do you have any idea what it would entail? I was searching online and I think I 
found something analogues for rust lang, but I cannot find it now.

The similarity to python was the thing that brought me to Nim in the first 
place. So I would really like some more effort put towards interoperability 
with python. I think that many company's that are using python for something 
other than Django applications, would appreciated it. I think that there are a 
lot of potential Nim customers. 


Re: Help to create a template/macro that reads small chunks of data from a stream.

2020-02-24 Thread mrhdias
Thanks @Hlaaftana but, unfortunately it doesn't work!


/home/hdias/dev/tmp/test.nim(32, 25) template/generic instantiation of 
`async` from here
/home/hdias/dev/test.nim(43, 10) template/generic instantiation of 
`forStream` from here
/home/hdias/dev/tmp/test.nim(26, 24) template/generic instantiation of 
`await` from here
/usr/local/programs/x86_64/nim-1.0.6/lib/pure/asyncmacro.nim(448, 10) 
Error: Await only available within .async


Run

I don't know if 'async' and the 'await' works inside templates!


Re: question on autolayout in wNim

2020-02-24 Thread hed0nist
Most probably a typo error in your layout proc()


proc layout() =
  panel.autolayout """
H:|{groupButton:[btnClick(btnClose)]-[btnClose]}|
H:|{groupText:[-50-[text]]}|
V:|[label]-[groupText]-[groupButton]|
H:|[label, groupText]|


Run

This template works, at least no error after compilation. By the way not sure 
it is the layout you want. 


Is this a bug? result variable vs last statement

2020-02-24 Thread nim_zwei
Hello everyone!

I'm not sure if this is a bug, so I'm writing this post to avoid creating an 
unnecessary github issue.

In the following proc the result variable is being assigned to, but then there 
is a last statement that would act as the return value. This causes an error as 
expected: 


proc foo(name: string): string =
  result = "Hello " & name
  "this is an error"

echo foo("test")


Run

Output:

> Error: expression '"this is an error"' is of type 'string' and has to be 
> discarded

But when you change the assignment to .add, the last statement gets returned 
instead of causing an error: 


proc foo(name: string): string =
  result.add("Hello " & name)
  "this should be an error"

echo foo("test")


Run

Output:

> this should be an error


$ nim --version

Nim Compiler Version 1.0.6 [MacOSX: amd64]
Compiled at 2020-01-29
Copyright (c) 2006-2019 by Andreas Rumpf

active boot switches: -d:release -d:useLinenoise


Run


Re: Generate XML file with xmltree [nesting format issue]

2020-02-24 Thread kaushalmodi
I have attempted to fix this issue in this PR: 
[https://github.com/nim-lang/Nim/pull/13482/files](https://github.com/nim-lang/Nim/pull/13482/files)

XML/xmltree experts: Please review that PR and help me make it better!


ANY TWEAKERS IN THE HOUSE, GOT THAT FIRE CARTEL METH ON DECK DM ME

2020-02-24 Thread drugporn01
Are you just new into the dark web and wondering where and how to start going 
about buying drug stashes, then here’s the solution for you. Get your VPN 
connected and contact me for more details. Telegram: Drugporn01 WhatsApp: +1 
(408) 412-0793 Wickr: Drugporn01 Email: drugp...@protonmail.com I noticed many 
people don’t know how to use the Dark Web so I took it upon me and asides being 
a vendor in the various markets, (you can check me out in the following ) 
@Cryptonia -drugporn01 @Apollon \- drugporn01 @Grey Market drugporn01- (new) 
@Avior \- drugporn01 (new) @Empire\- drugporn01 I decided to go to forums and 
other onion sites which are easily accessible to put up an ad to make buying on 
the dark web easy . Not everyone can use the markets and all the processes so 
here’s the real deal for you guys. Are you looking to buy-Good quality crystal 
methamphetamine,|   
---|---  
-Sealed pints of Codeine cough syrup|   
-Pills, pops, tablets (ask for those available)|   
-Documentation services|   
-Getting a job done, then you’re at the right spot.|   
  
CONTACT ME THROUGH Telegram: Drugporn01 WhatsApp: +1 (408) 412-0793 Wickr: 
Drugporn01 Email: drugp...@protonmail.com


ROXICODONE/OXYCODONE- 30MG TOP GRADE 500 PILLS AVAILABLE. Telegram: Drugporn01

2020-02-24 Thread drugporn01
> If you lost your regular drug connect, he got killed, locked or jailed, went 
> missing or travelled and youre tired of waiting because you need your shit, 
> then i believe you need an honest, loyal, fast and trustworthy person to keep 
> supplying them to you no matter your location. Dont get scammed by these 
> scumbags online, Real should recognize real.

So here's the deal If you need some pretty bloody good cold ice packs for your 
esky (crystal meth not leaving out anything white), then get in touch,

ONLY MEANS OF CONTACT Telegram: Drugporn01 WhatsApp: +1 (408) 412-0793 Wickr: 
Drugporn01 Email: lemybea...@protonmail.com

Will sometime need a bit of notice depending on request. Karma is coming to all 
of us one day. You get what you give. Straight up no bs, smooth and effective 
from both me and you. The following can change, but is an example for the dusty 
and icey. 1/4 oz =$250

So don't come telling me ma price is too good to be true and vice versa cause i 
won't take that. This is no organization but a personal and recognized 
business- cartel on his own. The amount depends on how it rates and how much 
demand there is for a specific batch. E.g

-good batch= Inflated rates on|   
---|---  
-average batch= discounted rates.|   
  
ONLY Crypto payments accepted (bitcoin is an example) Those in LA can link up 
for the goodies. Happy to negotiate, PICK UP and DELIVERY. Happy to travel 
within season. (Meth head, others call it tweaker) Get in touch if you wanna 
get your toke on!

TAKE NOTE PLEASE A lot have been hitting me up to buy stuff. If you're hitting 
me up, be serious, don't waste my time. Like think to yourself for a brief 
moment that YOU'RE HITTING ME UP, not the other way around. How do you honestly 
think it will work? I'll give you my location and we can meet. UhNO. If you 
want something shipped, OBVIOUSLY payment is going to be needed first. I swear 
there are some mfs that can't use their heads. If you are going to a random 
stranger and asking for product, then you should have thought of everything 
including risk. I'm not trying to fuck anyone over. As ALL you can see I DON'T 
NEED TO based on my weekly pictures. I'M GOOD. If you think I got all these 
Pills, powder, and much more by fucking people over, then you trippin' Don't 
hit me up to tell me your previous stories with the play boys playing with your 
dollars or telling me how you been scammed before, like "motherfucker you were 
just so fucking dumb not to recognize real from a fake" If you serious let's do 
business, if not then keep moving along bro. F T P Stay wise Stay low Hit me up 
NB: Once you receive product, If not then keep moving 


Re: Osproc input stream hang

2020-02-24 Thread enthus1ast
Since the process streams has not implemented peak functionallity, it seems the 
only way to do this is with threads.


Re: question on autolayout in wNim

2020-02-24 Thread Araq
I suppose you should ask on wNim's github issue tracker.


Re: Capture Problem

2020-02-24 Thread dawkot
I realised you don't actually need toSeq here  


import random, sugar, math

proc foo[T, U](a: openArray[T], cdf: openArray[U]): auto =
  let (a, cdf) = (@a, @cdf)
  (() => random.sample(a, cdf.cumsummed))

echo foo([1,2], [1,2])()


Run


Re: Generate XML file with xmltree [nesting format issue]

2020-02-24 Thread kaushalmodi
It's probably because you are using `newXmlTree` for both **channel** and 
**rss** tags. May be you should use `newElement` for **channel** too?

_PS: I am just guessing; I haven 't used this library._


Re: How to use integer generics in types?

2020-02-24 Thread cblake
There's no easy way to provide default values for such integer generic 
parameters, is there? E.g. (this doesn't work): 


type MatchPool[N: static[int] = 3] = object 


Run


Re: Capture Problem

2020-02-24 Thread schmidh
Thanks a lot!!!


Re: Capture Problem

2020-02-24 Thread dawkot

import random, sugar, math
from sequtils import toSeq

proc test1[I, T, U](a: array[I, T], cdf: array[I, U]): auto =
  (() => random.sample(a, cdf.cumsummed))

proc test2[T, U](a: openArray[T], cdf: openArray[U]): auto =
  (() => random.sample(a.toSeq, cdf.toSeq.cumsummed))

assert compiles test1([1,2], [1,2])
assert compiles test2([1,2], [1,2])


Run

.


Capture Problem

2020-02-24 Thread schmidh
The following code


import random, sugar
from math import cumsummed

type
  Generator[T] = () -> T
  TrafficLight = enum
red, yellow, green

proc genCDF[T, U](a: openArray[T], cdf: openArray[U]): Generator[T] =
  assert(a.len == cdf.len)
  result = proc(): T =
random.sample(a, cdf.cumsummed)

proc sample[T](gen: Generator[T], len: Natural = 10): seq[T] =
  result = newSeq[T](len)
  for i in 0.. which cannot be captured 
as it would violate memory safety

Run

Is there any chance to solve this error?


Re: Modify old code using new/finalizer to compile with gc:arc

2020-02-24 Thread Araq
`defined(gcDestructors)` is fine, but undocumented.


Re: How to use integer generics in types?

2020-02-24 Thread Hlaaftana
To straight up give an example it's like this:


type MatchPool[N: static[int]] = object
  vals: array[N, int]

var mp = MatchPool[3](vals: [2, 4, 1])


Run


Re: Generate XML file with xmltree [nesting format issue]

2020-02-24 Thread Araq
Might be a minor bug, but does it matter? XML is not whitespace sensitive.


Re: How to use integer generics in types?

2020-02-24 Thread adnan
You use static[int], as answered in my thread.

If N is not a compiletime constant, you need to use seq or unchecked_array.