good day everyone does jester have support for google oauth?

2024-04-14 Thread boia01
Or you can just use a reverse proxy that does authentication in front of jester. This makes it more of a configuration job than a development pursuit. If you're not set on a particular reverse proxy, I'd recommend you take a look at Caddy as a simple-to-deploy-and-configure solution:

a chat app please recommend necessary libraries

2024-03-07 Thread boia01
As a starting point, you can also check out this [nice blog post](https://arhamjain.com/2021/11/22/nim-simple-chat.html) that details the creation of a simplistic chat app in Nim.

Atlas shrugged...

2023-05-29 Thread boia01
I'm curious what people think about Atlas optionally setting up [git submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) instead of cloning repos wholesale. It seems it could avoid having atlas reimplementing what's already offered by git natively.

Atlas shrugged...

2023-05-29 Thread boia01
To add a bit of nuance to the min-vs-max debate, and following the SemVer spec, a relatively safe middle-ground default policy could be: * pick the minimum MAJOR version to avoid incompatible changes * pick the minimum MINOR version since new features are not needed * pick the maximum PATCH

Platonic: core math concepts

2023-05-28 Thread boia01
It's not the same because Nim is a much smaller community (than JS, Rust, Python, ...). Fragmentation introduces friction, confuses people, increases uncertainty, and divides the community and its efforts. In the absence of a killer app/framework, what Nim needs most is an ecosystem of libraries

Usability of ARC/ORC in multi threaded code.

2023-05-06 Thread boia01
I don't know if it's the best example, but it's one example: The Node ref could be a global protected by a read/write lock.

Usability of ARC/ORC in multi threaded code.

2023-05-06 Thread boia01
One question that's been on my mind regarding multithreading with ARC/ORC (without atomic refcount) is the relation with `lent T` return type. What I mean is that with [strict funcs](https://nim-lang.org/docs/manual_experimental.html#strict-funcs) we already have a nice way to prevent mutation

State of HTTP Servers in Nim

2023-04-08 Thread boia01
FWIW, [GuildenStern](https://github.com/olliNiinivaara/GuildenStern) \-- already mentioned in this thread -- supports streaming of requests. See the [ctxstream](https://olliniinivaara.github.io/GuildenStern/ctxstream.html) documentation. It also supports pluggable protocol handlers in case you w

Javascript backend and implicit cstring conversions

2022-12-26 Thread boia01
I'm updating some little hobby project that uses the Javascript backend and I'm noticing some new warnings: > Warning: implicit conversion to 'cstring' from a non-const location: ...; > this will become a compile time error in the future (I'm using Nim 1.6.8 and this warning may have been intro

Show Nim: Mummy, a new HTTP + WebSocket server that returns to the ancient ways of threads

2022-12-03 Thread boia01
Just for awareness, I'll mention another, relatively mature, select + threads-based HTTP server with websocket support:

Forum subscription feature

2022-12-03 Thread boia01
My workaround has been to use the forum's RSS feed and to email posts. Disclaimer: I am not affiliated with Blogtrottr and its free tier is ad-supported. Also, you will get some spam because the RSS feed includes out all new posts, including yet-to-be-moderated posts.

Atomic ARC option?

2022-11-26 Thread boia01
The concurrency model that I'd like to see better supported in Nim is something along the lines of persistent data structures that support multiple-readers and a single-writer: * Imagine an isolated graph of objects (refs). * This graph is be accessed through something like `SharedPtr[ref T]

how to switch nim version for vscode extension

2022-06-18 Thread boia01
Howdy neighbor! First, I would recommend you use this extension instead since it's actively maintained: >From my understanding, you would use the PATH environment variable (as it >exists when you start VSCode) to determine

How to avoid memory capture violation during addExitProc capture?

2022-05-25 Thread boia01
Oh sorry I missed that in your code you had changed History to be a `ref`. Ignore my last message then...

How to avoid memory capture violation during addExitProc capture?

2022-05-25 Thread boia01
It all depends on the behavior that you want. Do you want what's saved upon exit to be the value of your global `history` variable _at the time of exit_? Or do you want it to be the value at the time you called the `persistence()` proc? If you use the `let history = history` trick, you're makin

How to avoid memory capture violation during addExitProc capture?

2022-05-22 Thread boia01
Short answer: You need to use `ref History` instead of `var History`. Longer answer: A `var` argument is only valid for the duration of the call to the proc. This is why it cannot be captured by a closure (your nested proc) -- there's no guarantee that the argument would still be available upon

Setting finalizer on object hierarchy won't compile with --gc:arc

2022-01-19 Thread boia01
This works with `--gc:arc`: type Parent* = object of RootObj Child* = object of Parent proc `=destroy`*(self: var Parent) = echo "Parent delete" proc `=destroy`*(self: var Child) = echo "Child delete"

Topfew - a Nim port of Tim Bray's logfile utility

2022-01-16 Thread boia01
Hey Nimians, Over the holidays I started a port of Tim Bray's topfew logfile utility for fun and educational purpose. with the intent of comparing Nim's relative performance against the original Go implementation. Github link: If you're not familiar wi

Is there a multithreaded HTTP library?

2021-11-03 Thread boia01
You may also want to check out GuildenStern

when to use 'ref object' vs plain 'object'

2021-08-26 Thread boia01
> I meant - supported automatically by compiler or VM, not human written hooks. It's not a perfect solution but you could use a `CoW` type to wrap your objects, you don't have to write hooks for every object. You just have to declare your objects as `CoW[MyObject]`. It's not compiler support bu

Guidance on Isolating Memory Leak

2021-07-20 Thread boia01
FYI, I've had the best luck finding memory leaks using Valgrind (. Requires the use of `-d:useMalloc` and I suggest combining with ARC (if you can) or ORC.

Awaitable threadpools

2021-07-06 Thread boia01
This is very exciting! Maybe a dumb question -- can threadpool-backed Futures be passed to other threads to compose arbitrary multi-threaded computation graphs? Are the futures thread-safe in that sense?

Transpile Nim to Dart/Flutter?

2021-05-20 Thread boia01
Flutter is a _big_ stack, which includes both C/C++ ("the engine") and a Dart framework ("the framework"). Trying to recreate either the engine or the framework alone is a massive undertaking. Reusing the engine seems like a viable app

How does Nim ARC/ORC compare to Rust?

2021-05-02 Thread boia01
On the subject of "no refcount", I have a slightly tangential question... Strings and seqs in Nim are refs (with refcounts, albeit with copy semantics). As discussed in different threads, including [Multi-threaded features needed for Server](https://forum.nim-lang.org/t/7751) it is often desirab

Nim on raspberry PI

2021-04-18 Thread boia01
And, just for what it's worth, if you didn't know where to start, you could just have used `c2nim` on `wiringPi.h` (now installed by default on Raspian) and you would have gotten this: which worked great for

Generic type parameters and inheritance

2021-04-15 Thread boia01
Here's a working example without refs: type Foo = object of RootObj Bar = object of Foo Baz[T: Foo] = object myAttribute: T # define your own initializer proc initBaz[T: Foo](attr: T): Baz[T] = result.myAttribute = attr

Multi-threaded features needed for Server

2021-04-09 Thread boia01
> I ended up implementing a my own version of C++'s shared_ptr, with a few > differences. It supports custom destructor (for cleaning up resources), acts > as a read-write mutex, and can be safely moved and copied across threads. If > anyone is interested in seeing the code, I will be more than

static tuple generic parameter

2021-04-02 Thread boia01
The first one doesn't work because the `options` generic is instantiated with the type `tuple` and that type doesn't contain a value for `name`. You can fix this by specifying the tuple's fields: type Foo[options: static tuple[name: string, value: int]] = object Run T

How to use global immutable variables in Threads?

2021-03-28 Thread boia01
@alexeypetrushin Unfortunately, accessing any graph containing ref objects using multiple threads is generally unsafe. This is true even if the access starts through a pointer; the pointer doesn't make it any safer, even if the graph is immutable. It would work if it was just a plain object stru

Initializing subclassed objects, like C++ Constructors

2021-03-28 Thread boia01
Nice pattern! I will be using it too.

How to use global immutable variables in Threads?

2021-03-26 Thread boia01
@alexeypetrushin Sorry I missed reading your postscriptum: > P.S. There's also a way to use {.threadvar.} and keep separate copy for each > thread. But it defeats the whole point of having multi threaded server that > could optimise memory by sharing some common data between threads. Yes, you'r

How to use global immutable variables in Threads?

2021-03-26 Thread boia01
The general rule is to avoid sharing refs across threads. Nim's main GC algorithms (ARC, ORC) do not provide the guarantee that reference-counting is thread-safe. And more specifically, even protecting access to the root of an object graph through a lock is generally insufficient, because even

Found article on concurrency: "Go statement considered harmful"

2021-03-20 Thread boia01
For those you don't want to read the entire article, I'll try to summarize this model of "structured concurrency". I won't try to describe what minimally constitutes structured concurrency, instead I'll try to describe an idealized realization based on fibers. I'll use the term _fiber_ to descr

Nimview - a lightweight UI helper

2021-03-18 Thread boia01
Zoom probably has the best known security vulnerability reported regarding the use of an unsecured HTTP server running on localhost:

How do I share a hash table among multiple processes to store temporary http sessions?

2021-03-18 Thread boia01
The Nim equivalent is `sharedtable`: Just make sure you use non-GC backed data values, i.e., avoid refs, strings, seqs.

Criticism of Parallel Nim

2021-03-16 Thread boia01
Yes, I can write a blog post about this. I won't be able to share the specific code (it's proprietary) but I can create an example project that looks pretty close to it. It's a web server that receives/sends json and does postgres database calls. Not very fancy but overall representative of a lo

Criticism of Parallel Nim

2021-03-14 Thread boia01
I'd like mention that I've also agonized (perhaps too strong of a way to put it) between async and threads. I had difficulty in particular using async and wrapping spawn in the async model, not in the coding but in getting reliable results. I was getting server crashes -- which were probably ent

how to convert @[1..5] to @[1.0,2.0,3.0,4.0,5.0]?

2021-02-24 Thread boia01
It's because `@[1..5]` is not equivalent to `@[1, 2, 3, 4, 5]`. It's actually a sequence of one element of type `HSlice`: echo @[1..5].type# prints seq[HSlice[system.int, system.int]] Run This is why you'd want to write `(1..5).toSeq` to obtain `@[1, 2, 3, 4, 5]`,

how to convert @[1..5] to @[1.0,2.0,3.0,4.0,5.0]?

2021-02-24 Thread boia01
Something like this? import sequtils let a = (1..5).toSeq echo a.mapIt(1.0*it.float) Run

Help needed: Deadlock during allocShared0

2021-02-04 Thread boia01
Thanks for all the replies! This helps a lot. I had a suspicion the signal handler was trying to print a stack trace. Per @leorize' and @shirleyquirk's comments, it seems I stumbled on a stdlib bug. Should I file a bug report? I'll try `c_malloc` to try to work around the issue and better unders

Help needed: Deadlock during allocShared0

2021-02-03 Thread boia01
@leorize It's not my signal handler. It must be one of Nim's default.

Help needed: Deadlock during allocShared0

2021-02-03 Thread boia01
Hi folks, I have a multi-threaded application that deadlocks during processing. The deadlock involves Nim's own allocator, through `allocShared0`. One weird thing is that it only seems to happens when a signal handler is called during allocation, see stack entry #6 below: [Switchi

Help with Nim concurrency – data not persisted

2021-01-17 Thread boia01
Your program is non-deterministic. There is no enforced sequencing between the writers, so the behavior you get is "last writer wins", as it's commonly called. All the spawned writer tasks are "racing" to make their respective changes, but there is no guarantee as to which order they'll proceed.

Call `result.new` automatically in `proc`?

2021-01-16 Thread boia01
I would suggest that what we really want here is not implicit initialization with `new` but rather a warning that a `ref` is being accessed / assigned into without having been initialized previously.

Isolated [T]

2020-10-26 Thread boia01
I think you're thinking about the term "back pressure".