Re: Blog tools - Nim

2020-03-23 Thread Divy
Also consider this: 
[https://github.com/divy-work/bloom-nim](https://github.com/divy-work/bloom-nim)


A Nim blogging engine :)

2020-03-19 Thread Divy
Bloom is a pretty small blogging engine I made in Nim. It is a great project to 
study after reading @dom96 's Nim in Action book.

[Github 
repo]([https://github.com/divy-work/bloom-nim.git](https://github.com/divy-work/bloom-nim.git))

PR's and Issues are welcomed :)

Happy Coding 


Re: nimkernel capabilities

2020-03-04 Thread Divy
Oh wow! I should have searched more I guess. Thanks


Re: How to get immidiate disk-usage

2020-03-04 Thread Divy
Dude...you just copy pasted the whole question from 
[https://forum.nim-lang.org/t/5861](https://forum.nim-lang.org/t/5861)

Can moderators delete a thread? Then plz


Re: nimkernel capabilities

2020-03-04 Thread Divy
Alright, thanks.

But is it recommended to use nim for stuff like that? (since I haven't seen any 
other kernel on internet...most of them use C or Rust)


nimkernel capabilities

2020-03-02 Thread Divy
So I'm new to Nim and OS development. The nimkernel seems exciting... 
[https://github.com/dom96/nimkernel](https://github.com/dom96/nimkernel)

Though I would like to know...

  1. how can I handle keyboard input?
  2. how to do some networking with it?




Re: Doubt! Proc and import

2020-02-28 Thread Divy
Yup. But I guess I want to use the compiler api instead... I'll use it to 
compile the file provided prior creating a server. Then, I'll store the 
exported proc in a global variable. And use it. Will that work?


Re: Doubt! Proc and import

2020-02-28 Thread Divy
Here's the code: 


import asynchttpserver, asyncdispatch

var givenByUser = "test.nim"

var server = newAsyncHttpServer()

proc cb(req: Request) {.async.} =
  # import user.nim
  # use it's main proc
  await req.respond(Http200, procInFile())

waitFor server.serve(Port(8080), cb)


Run

The code that user might provide: 


proc procInFile*():string =
  return "hello"


Run


Re: Gedit syntax highlighting.

2020-02-28 Thread Divy
Oh well, that "shouldn't" be hard? lol


Re: Doubt! Proc and import

2020-02-28 Thread Divy
Oh ok! Is it fast enough? I'll be using it for a REST api


Re: Doubt! Proc and import

2020-02-27 Thread Divy
@kidandcat, I discovered the nim compiler api which seems perfect for my use.

[https://forum.nim-lang.org/t/5994](https://forum.nim-lang.org/t/5994)

Also, the example you provided just calls out the nim compiler without 
returning any exported proc inside it. (Because it's runtime)

Is there any particular reason why I shouldn't use the nim compiler API? Any 
cons?


Gedit syntax highlighting.

2020-02-27 Thread Divy
Ubuntu's inbuilt text editor Gedit is quite good for quick coding.

I use the Python 3 highlighting for Nim but it would be good if we have one for 
Nim too.

Or, is it already there?


Re: Is this possible?

2020-02-27 Thread Divy
Ooh! That seems perfect...I'll test that out. Thanks.


Re: Is this possible?

2020-02-27 Thread Divy
Alrightyy! Thanks all for the answer.


Re: Is this possible?

2020-02-27 Thread Divy
@yglukhov, I am keen to understand the embedding of nim compiler. Could you 
give a example for the same?


Re: Is this possible?

2020-02-27 Thread Divy
Thanks that helped me understand it better :) What do you have to say about 
@juancarlospaco 's answer?


Re: Doubt! Proc and import

2020-02-27 Thread Divy
That isn't what I wanted @kidandcat. To better explain my question:


proc importNewModule(module: string) =
  import module # this is just for illustration, it won't work I know. How 
do I do that?
  something()


Run

And the module is something like this... 


proc something() = echo Hi


Run

All I need to know is how do I import the module and use it in runtime. 


Doubt! Proc and import

2020-02-27 Thread Divy
So here is my code:


proc runNimProcFromAnotherFile(filename: string) =
  #[ I need to import the filename and use the proc defined inside it...]#


Run

How do I import the file and return the proc inside it?

Thanks.


Re: Is this possible?

2020-02-27 Thread Divy
Alright thanks anyway for the answer :) That atleast got me halfway...


Re: Is this possible?

2020-02-27 Thread Divy
How can I return the value that is returned in a proc inside the 
timeit_temp.nim?


Re: Is this possible?

2020-02-26 Thread Divy
Thanks! I'll try that


Is this possible?

2020-02-26 Thread Divy

var module = "jester"
import module


Run

If not, how do I implement something like this?


Re: A 'made with Nim' website?!

2020-02-26 Thread Divy
@JohnAD Consider adding a submission form for developers to submit their games. 
You could manually verify the submissions and add them. Or Open a GitHub repo 
with the list of games and encourage devs to add their in a yml file or 
something.


Re: Interlanguage communication

2020-02-26 Thread Divy
I figured out the same too. But is there any other–a more straightforward way 
to do this?

Thanks


Re: Nim's float issue?

2020-02-25 Thread Divy
The answer is really good but please respect that everyone here is learning and 
some might not be from a CS background! I'm 15 and certainly not yet graduated 
yet I code and love Nim. I guess it would be really nice if we leave arrogance 
and so called "CS degrees" aside and talk Nim :)


Re: Interlanguage communication

2020-02-25 Thread Divy
It basically executes the command node script.js It isn't complete yet. I just 
wanted to know the basic idea behind communication between languages


Re: Weird Behaviour

2020-02-25 Thread Divy
Make sure you are not having any extra whitespace at the end of lines. If not, 
then check for indentations and replace them with spaces.

If done correctly, your program should work fine.


Interlanguage communication

2020-02-25 Thread Divy
I have a Node.js program and a nim program. When a nim procedure is called, it 
triggers the js script with input as argument. How do I get back the output to 
nim?


Re: func/proc blocks

2020-02-23 Thread Divy
But we do have,


import module1, module2


Run


Re: A 'made with Nim' website?!

2020-02-22 Thread Divy
Thank you :) I'll start work on it pretty much soon. Will share the link too... 
Btw, Nice website @JohnAD


Why doesn't jester compile to js?

2020-02-22 Thread Divy
I tried my jester server to compile to javascript and it won't work. I probably 
know the reason but can there be a feature wherein it can compile to run for 
Node.js with Express?

I might be talking wrong, please correct me. Thanks.

PS:


Re: I have a super doubt

2020-02-22 Thread Divy
The book 'Nim in Action' has helped me a lot in learning Nim! :) Definitely 
recommended!!


A 'made with Nim' website?!

2020-02-20 Thread Divy
Hi, I'm really interested in making a website showcasing projects made with 
Nim. What do you all say?