htmlparser bug? Help with my web scraper

2020-08-21 Thread Araq
htmlparser was written before there was a standard that explained how to repair broken HTML and most HTML out there is broken.

htmlparser bug? Help with my web scraper

2020-08-21 Thread Salient
\---Code Update--- The code below has a working version now and able to find my links. But still... what could be going on with that parseHtml() proc? import httpclient, nimquery, xmltree, htmlparser, strtabs, strutils proc googleSearchQuery(query :string,results :int

nim.town is a shared domain for nim projects, developers, organizations, etc

2020-08-21 Thread Salient
Dude this is awesome! I'll be adding my stuff soon!

htmlparser bug? Help with my web scraper

2020-08-21 Thread Salient
Hey guys, I think the parseHtml() proc in the htmlparser module may have a bug in it. So I'm building a web crawler for scraping the Organic results in a Google Search Results Page and I ran into an issue sometimes when scraping. Example (for those of you in the United States at least), if you

nim.town is a shared domain for nim projects, developers, organizations, etc

2020-08-21 Thread moigagoo
docs.nim.town gives me a 404.

Nim feedback by al6x

2020-08-21 Thread jibal
People get misled by these toy examples with object hierarchies where the only operation being done is `echo`. `echo` implicitly applies `` $ `` to all of its arguments. Where's your `$` methods for `TextDoc` and `TodoDoc`? I don't see them anywhere, and neither does the compiler, so it applies

Nim feedback by al6x

2020-08-21 Thread anentropic
First of all thanks to OP redditor and everyone else for this thread. I have been curious about Nim for a long time and interested in its balance of great features, nice syntax and maybe some rough edges. Please forgive my completely uninformed participation, as someone entirely new to Nim, but

Nim feedback by al6x

2020-08-21 Thread jibal
The compiler can infer the kind through flow analysis, and my understanding is that it does ... the docs imply that, anyway.

Nim sighted in the wild

2020-08-21 Thread Yardanico
Yeah, it's by Dm Knight from our Telegram chat :)

Nim sighted in the wild

2020-08-21 Thread qqtop
[https://www.parrotsec.org/blog/parrot-4.10-release-notes](https://www.parrotsec.org/blog/parrot-4.10-release-notes)/

Nim feedback by al6x

2020-08-21 Thread shirleyquirk
What about the object variant safety issue? type DocKind = enum text, todo Doc = object case kind: DocKind of text: text: string of todo: todo: string let doc = Doc(kind: text, text: "some doc")

Using the compiler API for hot code reloading

2020-08-21 Thread sekao
Thank you very much i'll give that a try. I was originally trying to make a change like that by forking the compiler -- i never thought of using `include` that way. Definitely a nicer way of doing it (albeit probably will be broken at some point). Very neat!

execvp / fork in 1.3.5

2020-08-21 Thread tmsa04
That does look simpler :) * * * import osproc let (outp, errC) = execCmdEx("makepkg --printsrcinfo") echo "outp = ", outp, "nerrC = ", errC

execvp / fork in 1.3.5

2020-08-21 Thread Araq
Tried the `osproc` module too? I see no need for your Posix specific code.

nim.town is a shared domain for nim projects, developers, organizations, etc

2020-08-21 Thread cricket
woah! ascii.town is really cool, haven't seen that one before

Nim feedback by al6x

2020-08-21 Thread alexeypetrushin
Thanks! Yes, I updated note about JSON.

nim.town is a shared domain for nim projects, developers, organizations, etc

2020-08-21 Thread cricket
doc.nim.town, docs.nim.town, doc.nim.land, docs.nim.land, all redirect to the nim documentation page now

nim.town is a shared domain for nim projects, developers, organizations, etc

2020-08-21 Thread dom96
Awesome! Reminds me of [https://ascii.town/](https://ascii.town/). Maybe a project to have the same thing written in Nim is in order? :D

execvp / fork in 1.3.5

2020-08-21 Thread tmsa04
This works in Nim 1.2.6 but not in 1.3.5 and it behaves in an apparently illogical way. It's a simplified standalone example from Pakku, the actual option to makepkg causing the problem is --printsrcinfo but --version does the same. Perplexingly, -V does work. And running just the exec part work

Nim feedback by al6x

2020-08-21 Thread dom96
Please see my comment on that stackoverflow answer as well as your thread on this forum. That Stackoverflow answer is 6 years old at this point, things change. Although I would say that even then it wasn't a correct answer. Please downvote it accordingly.

Nim feedback by al6x

2020-08-21 Thread Yardanico
It does not propose to generate JSON manually: import json type Person = object name: string age: Natural let a = Person(name: "Someone", age: 18) echo %*a Run

nim.town is a shared domain for nim projects, developers, organizations, etc

2020-08-21 Thread cricket
oh! good idea! apologies for the late response, yes, i can set that up

Nim feedback by al6x

2020-08-21 Thread alexeypetrushin
Also, about the json \- I may be missing something, but it proposes to manually generate JSON. That's not a good option, JSON should be generated automatically. You may need some tools to alter the default behaviour of Object to JSON conversion and fine-tune it, but the default behaviour should

Nim feedback by al6x

2020-08-21 Thread alexeypetrushin
Hmm, I understand what you are saying, but seems like people still use marshal for JSON conversion, and this StackOverflow question has the most votes on using marhsal :) [https://stackoverflow.com/questions/26191114/how-to-convert-object-to-json-in-nim](https://stackoverflow.com/questions/26191

Nim feedback by al6x

2020-08-21 Thread Yardanico
Reposted from Reddit: Hi, thanks for answering my questions for a week, while I studied Nim. I wrote the second version of my feedback about using Nim [http://al6x.com/blog/2020/nim-language](http://al6x.com/blog/2020/nim-language) I wrote it for myself as a note to check Nim against it in a co

Nim feedback by al6x

2020-08-21 Thread Yardanico
Some of my comments: > "The standard library Nim documentation suggest us to generate JSON by hand > with JsonNode . And we absolutelly not going to do that, nobody generates > JSON by hand these days. Not good, when official docs promoting inconvenient > way to do things." Marshal shouldn't b

How to operate on tabular data in Nim?

2020-08-21 Thread halloleo
Great tip @spip! I had a look at [NimData](https://github.com/bluenote10/NimData) and it seems to be pretty suitable.

SciNim / Nim-science: IRC-Discord-Gitter bridge

2020-08-21 Thread hugogranstrom
I agree, it would make it easier for people new to Nim to see that there is a Science community here. Right now you have to be lucky to find it basically :P

nim.town is a shared domain for nim projects, developers, organizations, etc

2020-08-21 Thread moigagoo
Pretty cool! Norm has a new home at [https://norm.nim.town](https://norm.nim.town) now.

Empty c-style array

2020-08-21 Thread shirleyquirk
You can trust the compiler a bit more. If you follow along with [http://zevv.nl/nim-memory/#_lets_talk_about_seqs](http://zevv.nl/nim-memory/#_lets_talk_about_seqs) and use that technique to look under the hood of an empty seq, youll see it's a nil pointer until you add data So really, just use

nim.town is a shared domain for nim projects, developers, organizations, etc

2020-08-21 Thread moigagoo
Can we have docs.nim.town redirect to [https://nim-lang.org/documentation.html](https://nim-lang.org/documentation.html)?

Empty c-style array

2020-08-21 Thread lscrd
There are also `uncheckedArray`. See here: [https://nim-lang.github.io/Nim/manual.html#types-unchecked-arrays](https://nim-lang.github.io/Nim/manual.html#types-unchecked-arrays)

Targeting JavaScript

2020-08-21 Thread halloleo
Hey, the comparison with Typescript is quite enlightening! Thanks. :-)

nim.town is a shared domain for nim projects, developers, organizations, etc

2020-08-21 Thread moigagoo
Nice idea! I've sent you a request for norm.nim.town.

Empty c-style array

2020-08-21 Thread Stefan_Salewski
The value "nothing" does not really exist in computer science. Of course in C we have NULL and in Nim we have nil for ref and pointer types. NULL and nil are special well defined values, often binary zero, which have a special meaning by definition: The absence of a value. In Nim we have the se

Empty c-style array

2020-08-21 Thread ElAfalw
OK, let's say I have a array-type variable. Is it possible to set it to... nothing? I mean let's say a function takes an array parameter, with some (or no) values. I could obviously declare it as a seq, but then we would deal with memory allocation. I can also declare it as an openArray, and th

How to operate on tabular data in Nim?

2020-08-21 Thread oyster
since you know pandas, the answer depends on the definition of "comprehensive": the kind of data file, operations. No one can suggest if the conditions are missing. And, I believe that, there is no library which can compete against pandas for static language

SciNim / Nim-science: IRC-Discord-Gitter bridge

2020-08-21 Thread mratsim
We have a budding community of people building Nim library for science over here: * [https://gitter.im/SciNim/community](https://gitter.im/SciNim/community) I think it would be worthwhile to bridge with a corresponding channel on Discord and IRC as it already has some regular activity.

Table with different types of values?

2020-08-21 Thread Araq
Use Nim's type system. type Keys = enum key1, key2 Value = object param1: string param2: int const table = array[Keys, Value] = [ key1: Value(param1: "a string", param2: 100), key2: Value(param1: "another string

Table with different types of values?

2020-08-21 Thread ElAfalw
OK, this is not so important, but I still thing I'm missing something. I want to create a **const** table (meaning: only for compile-time, in order to have things better organised). It's like that: const TABLE = { "key1" : { "param1": "a string