Col (7) [Avatar] Offline
#1
Having
requires "nim >= 0.13.1, jester >= 0.0.1"
in Tweeter.nimble wouldn't compile. It failed with the following error:
FAILURE: Could not read package info file in /home/colin/Documents/devel/nim/mia/Tweeter/Tweeter.nimble;
  Reading as ini file failed with: 
    Invalid section: .
  Evaluating as NimScript file failed with: 
    Unable to parse dependency version range: Unexpected char in version range: ,.


I changed the requires over two lines which fixed that particular problem.
requires "nim >= 0.13.1"
requires "jester >= 0.0.1"


Compiling Tweeter via nimble as instructed then download and installed jester but failed later with the following error:
Error: cannot open 'httpcore'
FAILURE: Execution failed with exit code 1


Any advice how to fix this greatly appreciated.
dom96 (75) [Avatar] Offline
#2
Hi there,

You will need to upgrade your Nim installation.
dom96 (75) [Avatar] Offline
#3
Sorry about the short reply earlier, I was on my phone.

To give you a bit more info: a new version of Nim was released recently (v0.14.0) with some breaking changes (HTTP headers are now handled via a new module called httpcore), Jester was also updated to make use of this new httpcore module. Because your current Nim version is likely 0.13.0, it does not have that module in its standard library and so Jester fails.

Easiest way to resolve this is to upgrade to Nim 0.14.0 or later (v0.14.2 now exists too smilie): http://nim-lang.org/download.html

Hope this helps!
Col (7) [Avatar] Offline
#4
You're spot on Dom. Upgraded to 0.14.2 and all is working well. Thanks for your support.
Col (7) [Avatar] Offline
#5
Hi Dom,

I have continued working through Tweeter and found a couple of syntax & logic errors:

Listing 7.14 - syntax error
SELECT username FROM Following

should be
SELECT follower FROM Following


Listing 7.17 - logic error
Messages are inserted into the table as follows:
db.post(Message(username: "nim_lang", time: getTime() + 4.seconds, msg: "Hello Nim in Action readers"))
db.post(Message(username: "nim_lang", time: getTime() + 2.seconds, msg: "99.9% off Nim in Action for everyone, for the next minute only!"))

However, db.findMessages(...) returns messages in time ascending order so the messages will be returned in the opposite order as current shown in the doAssert statements:
doAssert(messages[1].msg == "Hello Nim in Action readers")
doAssert(messages[0].msg == "99.9% off Nim in Action for everyone, for the next minute only!")


Well done on a great product. Easy to read with great examples. Keep up the good work.
Col (7) [Avatar] Offline
#6
I edited my previous message to remove a mistake I made with the table names. This mistake stems from references to the Follower table in Figure 7.11 and Listing 7.13 ("INSERT INTO Follower VALUES..."). I believe these should reference the Following table.
dom96 (75) [Avatar] Offline
#7
Thank you for letting me know. Will fix it ASAP!