Faster Euclidean algorithm

2024-08-23 Thread ingo
multiple runs of @mratsim version. Win10, VCC gcd in stdlib: 1540 micro second gcdLAR:1294 micro second gcdLAR2: 1794 micro second gcdLAR3: 1650 micro second gcdLAR4: 1289 micro second gcdSub:918 micro second gcdSub2: 161

Which IDE to use in 2024?

2024-08-22 Thread ingo
The same as a decade ago, or two?

Malebolgia & VCC, does not always finish

2024-08-14 Thread ingo
@Araq when time permits, could you have a peek at this?

Malebolgia & VCC, does not always finish

2024-07-30 Thread ingo
As there are problems using gcc and avx(2) on windows I switched to VCC. Now I noticed with an other program that it did not "finish" execution. So I modified the Malebolgia demo program a bit, with the same result. It just uses processors to the max and does not progress and has to be terminate

How to open an sqlite3 database query_only?

2024-07-29 Thread ingo
there is the [query_only Pragma](https://www.sqlite.org/pragma.html#pragma_query_only) , it's not really read only but may be sufficient for your use case. You set it per connection.

Requirements for an imperative language amenable to sql-like optimizations

2024-07-28 Thread ingo
in SQLite, remove all but that one index and use [INDEXED BY](https://sqlite.org/lang_indexedby.html) ?

nim simd (avx2) How to get going?

2024-07-28 Thread ingo
changed to `cc = vcc` in `nim.cfg` and it seems to work, with and without the `when defined(vcc)`. import nimsimd/avx2 when defined(gcc) or defined(clang): {.localPassc: "-mavx2".} when defined(vcc): {.localPassC: "/arch:AVX2".} func mm256_

nim simd (avx2) How to get going?

2024-07-28 Thread ingo
Thanks, I'll experiment a bit with that. I also came across this, don't know how relevant this (still) is:

nim simd (avx2) How to get going?

2024-07-28 Thread ingo
Thanks, that helped a bit, but I'm not fully there. For now the first one works: import nimsimd/avx2 when defined(gcc) or defined(clang): {.localPassc: "-mavx2".} proc test(vals: seq[float32])= let a = mm256_loadu_ps(vals[0].addr) b =

nim simd (avx2) How to get going?

2024-07-27 Thread ingo
Two questions for now, what to do to fill the data from `vals` into `a` import nimsimd/avx2 when defined(gcc) or defined(clang): {.localPassc: "-mavx2".} proc test(vals: seq[float32])= let a = mm256_load_ps(vals.what_goes_here_??) b =

Tooling update

2024-07-24 Thread ingo
just moved the newly compiled `nimble.exe` from `.../.nimble/pkgs2/...` to `.../.nimble/bin` All fine.

Tooling update

2024-07-24 Thread ingo
.Sorry if this question is obvious, but how do you update nimble independently of nim? install nimble Run it said it installed nimble@0.16.0, but nimble -v Run results in nimble v0.14.2 compiled at 2024-07-03 01:22:18 git hash:

The lowest possible module(s) of graphics in Nim?

2024-07-23 Thread ingo
> Create some graphics on the boundary of math and art You can sample a function row by row and write the result to an image file, write multiple files and you can create an animation. Or go beyond that and write a ray tracer. It all depends op your goal. #renders 'frames' images,

The lowest possible module(s) of graphics in Nim?

2024-07-23 Thread ingo
Not what you ask for, I think, but the "lowest" would be to "render" a script to file. Something like and the open the result in inkscape A nice library for pixel based images is

How to Efficiently Implement Microservices with Nim?

2024-07-22 Thread ingo
> > If your timing can afford to be off by a 20ms or so [...] Yes. Too often I see aiming for high end. "What, you can do only 100 db insert per second?" In my brewery controller the PID RPi had nothing to do. It controlled the temperature of 7 vessels and 2 chillers. The temperature of a 1

How to Efficiently Implement Microservices with Nim?

2024-07-22 Thread ingo
Sorry, never used pg with Nim, only with python. ` Mummy, happyx` Why use a (full blown) web server. When using Pub/Sub there's 'no' request/reply. Wouldn't [Harpoon](https://github.com/juancarlospaco/harpoon) be enough?

How to Efficiently Implement Microservices with Nim?

2024-07-22 Thread ingo
or, ;)

How to Efficiently Implement Microservices with Nim?

2024-07-21 Thread ingo
with some 50 esp8266's and two RPi's I've build a small brewery automation where each sensor or actuator was a server with a microprocessor doing it's task(s) and communicated using MQTT for PUBSUB. One RPI was a PID-controller server and one a MQTT-broker and SQLite storage. Took some time to f

How to open an sqlite3 database query_only?

2024-07-21 Thread ingo
execute the query "PRAGMA query_only;" after creating the connection.

How to open an sqlite3 database query_only?

2024-07-21 Thread ingo
sorry, that's for checking "read_only". It depends a bit on the library how to do it. When the library accepts a connection uri use `'file:mydatabase.db?mode=readonly'` to open in read only mode.

Small libraries you'd like to see ported to Nim?

2024-07-19 Thread ingo
Seems like a fun thing, write data to a Sqlite file without Sqlite:

StableSeq

2024-07-01 Thread ingo
> But my question was actually about the Seq suffix. As it's not in a single > linear storage and as it doesn't convert to openArray, maybe a different > suffix would be better but I don't have an idea. `Chain` ? `inertChain`

StableSeq

2024-06-30 Thread ingo
inert: lacking the power to move, be moved. Resilient to influences from outside. 'inertSeq'

Claude 3.5 (Sonnet)

2024-06-30 Thread ingo
Since the "discovery" of fire I think, humanity has solved every problem by using more energy. Be glad you remember the shovel when tractors have gone out of fuel. (I asked one of these AI tools to create Python code for a binary search tree, without oop, without (external) libraries, without c

Introducing an async library inspired by Go in Nim

2024-06-17 Thread ingo
A beautiful fiber that threads and yarn are produced from is Silk, Seta in Interlingua SetaFile, SetaSoccet SilkFile, SilkSoccet

Why not use AI to create momentum in Nim?

2024-05-27 Thread ingo
> And the more computing pawer you can utilise, the smarter the AI and better > the result. That I doubt. You can throw all the raw power you have at it, but the result is bad if the training set is bad. Simple thing? How often does one of these things answer with "I don't know ..."? Seldom. Wh

find field value object in seq and declared object in seq

2024-05-20 Thread ingo
Thank you both. Enough to fiddle with. The goal is to find the index of the first occurrence of Box(food: value), if at all. Like `seq.find(value)` Cheers.

find field value object in seq and declared object in seq

2024-05-20 Thread ingo
How does one find out whether a field in an object in an array exists? The commented out `echo declared(c1.content[0].thing)` errors. How do I find whether a value in a field of an object in an array exists using a proc, or template? The commented out code shows my failure. type

Why not use AI to create momentum in Nim?

2024-05-18 Thread ingo
> Anthropic's claude 3 opus Tried it with something I know, POV-Ray scenes. It actually explained my FABRIK inverse kinematic macro's properly. Nice.

forward declare and extend object (I know it does not work)

2024-05-10 Thread ingo
seems to work as a first step. macro genHedgeprop*(field: static seq[tuple[field:string, fieldtype:string]]): void = var source = """ type HedgeProp* = object """ for f in field: source &= "" & f.field & "*: " & f.fieldtype & "\n" echo sour

forward declare and extend object (I know it does not work)

2024-05-09 Thread ingo
Forward declaring an object won't work, I know, but it describes kind of what I want. In the code below I (at some time will) have in a library objects and procs for defining and working on a half edge based polygon datastructure. The user (I) can define properties for the connection elements i

Fake Nim books an Amazon, which ones are real?

2024-04-30 Thread ingo
[This GPT created site](https://nimprogramming.com/books/allbooks/) has quite a few AI books listed, it seems.

What's the best way to match a standard file into a single data structure for editing it?

2024-04-21 Thread ingo
Not sure what a single structure is, FileType below?: type FileHeader = object # stuff about the file construction DataHeader = object #stuff about the data construction MetaData = object #metadata about the filedata

Sum types, 2024 variant

2024-04-13 Thread ingo
As I now little of these things, this I would understand without thinking too much, type Option[T] = object of either Some: T or None: discard Either[A,B] = object of either Le: A or Ri: T Run type O

Fake a file?

2024-04-08 Thread ingo
> As far as I remember, it just needs to open the pipe with the appropriate > call (CreateFile). Basic Windows tools like the type command should have no > problem reading from the pipe. the main problem is that the `ncks` tool expects a file. it results in: `Get-Content: All pipe instances are

Fake a file?

2024-04-07 Thread ingo
a followup. Windows' named pipes do not seem to be the thing to use in this case. It seems that the consumer on the other side of the pipe also needs some fitting machinery. Something that is seldom available. The alternative route seems to be virtual temp files, that under the right circumstanc

Fake a file?

2024-04-05 Thread ingo
Thanks! Enough to chew on for now.

Fake a file?

2024-04-05 Thread ingo
`cat somefile.nc | ncks --jsn` errors with: `ncks: ERROR received 0 filenames; need at least one` using Nim to call `ncks` works fine this way let fn = "somefile.nc" let tenminfile = execProcess("ncks", args = ["--jsn", fn], options={poUsePath}) Run this works fi

How do you handle incomplete nimble packages?

2024-03-25 Thread ingo
It's not a Nim specific problem. It's GitHub. It's not a coders community, it's (has become) a dumping ground for code. The beautiful idea that a passer by contributes is a folly. Also the idea that you can there create a community around your work does not work. Pure users have nothing to contr

Custom type conversion

2024-03-13 Thread ingo
maybe have a look at

Is there a plan to make Nim a language for normal businesses?

2024-03-10 Thread ingo
What niche are you looking for? You could use Nim to write a DSL for it. Then again, many niche languages can do "everything" but are hampered outside of their niche. What is a "bus factor"?

Have I written a silly program or is there a "controlled" memory leak?

2024-03-06 Thread ingo
> > database OT for the question, as you use the SQLite library you don't need to open and close the 'connection' to it every time. You can open it once an leave it open until the program finishes, the close it. `setControlCHook()`

Download nim-2.0.2_x64.zip for windows 11 will be blocked by Windows Defender.

2024-02-26 Thread ingo
> Widows defender has a built in facility that allows the user to disable it > for a short period. It also allows you to flag directories to not be scanned. So, create a special download dir for nim then download it to there. Then you have to create all the dirs Nim uses and flag those. Then yo

leave parenthesis for procedures that take 0 parameters like Ruby

2024-02-23 Thread ingo
> > evil paramCount() is explicit paramCount is ?

create ungraceful exit program

2024-02-16 Thread ingo
Thanks. It's what I kind of imagined. In the mean time the nil pointer trick helped me find a part of the problem, I think. Last will issues with nmqtt.

create ungraceful exit program

2024-02-15 Thread ingo
Taskkill does not trip the server when it kills the client. Dusting of the old labtop to test with that. Thanks.

create ungraceful exit program

2024-02-15 Thread ingo
That kills the client. Now the question is does Windows "clean things up"? The server continues without problem. When I run the client on a laptop over wifi and I switch of the wifi, the server crashes. Same with an appliance that has a client, when I pull the plug the plug, the server crashes.

create ungraceful exit program

2024-02-15 Thread ingo
> BSOD That's a bit too much, I'd like only the program to disappear, not the OS. I tried it with an external program, but it is not enough: #let s = fmt"winapiexec64.exe CreateRemoteThread ( OpenProcess 0x1F0FFF 0 {pid} ) 0 0 0xDEAD 0 0 0" #let a = execCmd(s)

create ungraceful exit program

2024-02-15 Thread ingo
How does one create a program (on windows) that quits after some time in the most ungraceful way. It is to simulate the disappearance of a client as if the power was shut down.

2D sequence setter

2024-02-02 Thread ingo
maybe `newSeqWith` from `sequtils`?

What would happen if a time traveler took Nim source code to the 70s or 80s or 90s?

2024-02-01 Thread ingo
Don't woory about Nim in the past. Worry about the tools of old on our systems. If you travel there, please bring me the source code of WP 4.2, Lotus 123, AutoCad 10/11 and 3D studio. It still amazes me what they achieved on the 268/386 hardware of that day while I wait for a Word of OpenOffice

punctuations rituals

2024-01-25 Thread ingo

can't run nim

2024-01-05 Thread ingo
in your AV exclude all the directories where Nim installs something (is there a list?). Also exclude the directories where you keep your projects an build. (it can be worse, currently MS Defender flags about 10% of FireFox's chache2 as a trojan :( )

Maybe nappgui is best cross platform gui lib for nim

2024-01-04 Thread ingo
>I'm over the native GUI thing for a few reasons: * An App Gui should be targeted at the task on hand. Not the OS. Think 3D modellers, FocusWriter, GohstWriter, DAWs and DAW plug ins, CAD. Old school music trackers. etc. * Native may waste screen estate that, despite the current monitor size

Nim Tooling Roadmap

2023-12-29 Thread ingo
So the `nph` opinonated formatter could be adapted to work with an LSP instead of being a vscode plugin?

Nim Tooling Roadmap

2023-12-29 Thread ingo
Just a question, we have Language Servers. Could we also have a Tooling Server Protocol? (or does it exist?)

Package-Rot as growth hindrance

2023-12-11 Thread ingo
If you want some kind of metric, look in to lifetime/cycle of issues and pulls, number of issues and pulls, all versus size of code base. Complexity of code base, number of maintainers, numbers of committers as weight factors. But what does it all mean in the end? There's software that gets upda

What's stopping Nim from going mainstream? (And how to fix it?)

2023-11-19 Thread ingo
To be honest, I don't see a problem. Yet that won't hinder me to dream. There is the NIR survey. I don't understand half the options, but they make me think: If it can offer a REPL and that REPL runs everything written in plain NIM as if it where a scripting language, what could be done with tha

Small change, big slowdown. Why?

2023-11-12 Thread ingo
Ah. Thanks Jaap.

Small change, big slowdown. Why?

2023-11-12 Thread ingo
@mratsim gave me a lot of [reading home work](https://forum.nim-lang.org/t/10552#70563). Is ["Good cache coherence"](https://stellar.mit.edu/S/course/6/sp15/6.815/courseMaterial/topics/topic2/lectureNotes/14_Halide_print/14_Halide_print.pdf) (PDF) related?

Small change, big slowdown. Why?

2023-11-12 Thread ingo
applied both your suggestions, with the same result. Thanks

Small change, big slowdown. Why?

2023-11-12 Thread ingo
A small change in my code resulted in a big slow down. The simple question is why? Changeing this: func next(osc: var GSinOsc){.inline.} = if osc.n > 0: let d0 = osc.multiplier * osc.current - osc.previous osc.previous = osc.current osc.current = d0

Labelled exceptions for smoother error handling

2023-11-01 Thread ingo
> Or did you mean something else? Just that most of the time I see them as three different things, that can "flow together" at times. In that case one does not want to see a whole line of symbols. > `superlog` Bookmarked.

Labelled exceptions for smoother error handling

2023-11-01 Thread ingo
Nice. Could logging or debug messages be done in a similar way? € for try except, Đ for debug, ₺ for logging ;)

Why is building the community and ecosystem such a struggle?

2023-10-30 Thread ingo
Write an essay. you can't write. You don't know how to structure an essay. You know nothing about the given subject. I give you pen and paper, clay tablet and nails, laptop and word processor. Can you write an essay now?

threaded updates to sequence in objects?

2023-10-23 Thread ingo
Thank you. Following @Araq 's lead I did the same to `weave` and came up with the code below. It works with both spawn and parallelFor. But it means doing away with the `var`. Is the `syncRoot` then still needed? import weave type Count = object n: int

threaded updates to sequence in objects?

2023-10-20 Thread ingo
Thank you. Now the question, how should/could I know, before I start, that I need a `ptr`, `addr` and not `ref` and/or `var`? In the error messages there where hints to it.

threaded updates to sequence in objects?

2023-10-20 Thread ingo
compiles but, SIGSEGV: Illegal storage access. (Attempt to read from nil?) import weave type Count = object n: int v: int nseq: seq[int] func initCount(n, v: int): ref Count {.inline.} = new(result) result.n = n result.

threaded updates to sequence in objects?

2023-10-20 Thread ingo
Thank you. The current Malebolgia state: import malebolgia type Count = object n: int v: int nseq: seq[int] func initCount(n, v: int): Count {.inline.} = #new(result) result.n = n result.v = v result.nseq = newSe

threaded updates to sequence in objects?

2023-10-20 Thread ingo
Again struggling with threads. My goal is to do multi threaded updates to sequences in many objects. The first attempt using `threadpool` is successful, then I noticed it will disappear sooner or later. Attempts using `Weave` or `malebolgia` fail. The code are just examples of many attempts. (`

ugly code or concepts?

2023-10-18 Thread ingo
> reverse-mode autodifferentiation Thank you. That's quite a bit to read up upon and digest.

ugly code or concepts?

2023-10-17 Thread ingo
Although the code works (not the extract below) but I don't realy like it. Then, reading the docs again I noticed `concepts`. Would that be a better choise than the current type? In the complete code the pattern is added to a `tile` that sets the duration of the pattern and the start time on a

How to echo from a proc correctly?

2023-10-16 Thread ingo
format the string at its source and pass it as one whole thing?

set global for all libraries

2023-10-13 Thread ingo
> What is your usecase for this, though? I'm writing a little additive synth. In some libraries there are some stray functions that need a sample rate set. There are a few objects that need a samplerate set but that don't inherit from or build upon each other. When creating textures/patterns fo

set global for all libraries

2023-10-13 Thread ingo
> "used by all included libraries" Hah, three decades of POV-Ray shows, libraries are `include files`. I wasn't aware of Nim's `include`, can be useful but I'll try with `const samplerate {.intdefine.} = 0` first and add the `-d:samplerate=100` to the `nim.cfg` Thanks.

set global for all libraries

2023-10-13 Thread ingo
Is it possible to set a "global" variable form the main "program" that is then also used by all included libraries. An example would be the samplerate for audio that is used all over the place.

Why is building the community and ecosystem such a struggle?

2023-10-05 Thread ingo
Fragmentation, not in the sense of communication channels. Fragmentation in, lets say responsibilities. The late Pieter Hintjens of zeromMQ has some good videos on that. and for example. Then, regarding

Why is building the community and ecosystem such a struggle?

2023-10-05 Thread ingo
> Why is building the community and ecosystem such a struggle? Fragmentation.

system.string

2023-10-03 Thread ingo
just a little update on the thing, ditched the strings as table keys. That made it a second faster from 1.5 seconds. import std/[monotimes, random, tables] let t0 = getMonoTime() type Box = object x, y, w, h: uint n:uint func isqr

system.string

2023-10-02 Thread ingo
Thank you all, looking in the wrong places.

system.string

2023-10-02 Thread ingo
type Box = object x, y, w, h: int var layer = initTable[string, seq[int]]() Run is just above the `func toLayer`.

system.string

2023-10-02 Thread ingo
system.string? What is it? Why is it? How do I get rid of it? func toLayer(layer: var Table[string, [seq[int]]], b:Box)= var k = "" for j in b.x..

Improving Examples and Documentation

2023-09-29 Thread ingo
> Hahaha yeah, another Supercollider user! I do extremely silly stuff in it, nothing like "music" and the "hundreds of levels" deep OOP drive me nuts. Everything points to everything ... If we put the docs & tuts in a "universal" format in a small db, SQLite, DuckDB, others, one could do versio

Improving Examples and Documentation

2023-09-25 Thread ingo
> I don't know where this aversion to writing documentation comes from. "Read the source, Luke!". :(

Which tools do you use to code in Nim?

2023-09-21 Thread ingo
Sublime Text + LSP + nimlsp But most important: Firefox

Using Result library

2023-09-21 Thread ingo
there is std/options where you return some(result in Bytes32) or none(Bytes32) but no string. That than should be a separate message to logger or stderr or ...

Pure Nim FFT library

2023-09-21 Thread ingo
Just playing with fftr I noticed two things, When going back from the frequency domain to signal, I have to divide the real part of the result by the length of the signal. Is it the convention that I do that, or should the library? It seems that depending on the length of the signal, the `ifft`

Pure Nim FFT library

2023-09-21 Thread ingo
> # false for forward FFT, true for inverse (TODO flip it? separate names?) i.m.h.o separate names: fft, ifft

Malebolgia & Pixy problem: expression has no address

2023-09-15 Thread ingo
> Huh, I guess that's something that was fixed / changed on Nim devel then. :/ update devel fixed it. It renders in 2897ms. Thanks.

Malebolgia & Pixy problem: expression has no address

2023-09-15 Thread ingo
Got to start somewhere. The first step was to get it working and to learn. Next will be block rendering and anti aliasing in a thread. Then image composition using various functions and maybe rendering sound from the image.

Malebolgia & Pixy problem: expression has no address

2023-09-15 Thread ingo
> Here's one way you could do it. Thank you @Vindaar Sadly it errors: `funcfuncfunc.nim(54, 21) Error: 'toTask'ed function cannot have a parameter of nnkTupleConstr kind` Nim2.0.0 Malebolgia 1.3.0 (I think) Looking at what you do is what I called block rendering. The `{.sendable.}` I'll have t

Improving Examples and Documentation

2023-09-13 Thread ingo
In the days of old, I did a lot of process technology tests in an industrial environment. About 80% of the report on the results of tests was written before the test was done. How do programmers work? Imho documentation on libraries should be relative sparse, but still usable, readable and to t

One language to rule them all.

2023-08-26 Thread ingo
> "good for everything" "good for getting things done" would be enough for me.

Wishlist: Ideal UI library for Nim

2023-08-11 Thread ingo
> Out of curiosity, did you have any use cases in mind? the first that came to mind is to use it to feed data from several source to a single SQLite writer connection. No clue if it is suitable for that.

Wishlist: Ideal UI library for Nim

2023-08-11 Thread ingo
> implemented a signal / slot mechanism similar to QT instead of callbacks! Would it make sense to peel that out at some time and turn it into it's own library, for other use cases?

Trouble Porting to FreeBSD

2023-08-04 Thread ingo
@nealie Thank you for working on this, much appreciated.

Nim version 2.0.0 is here

2023-08-04 Thread ingo
Thank you all Nim-team!

Wishlist: Ideal UI library for Nim

2023-07-27 Thread ingo
> [...] no instant visual response [...] Your clearly not a fan of ray tracing :) The response can take days. When I design a scene, in code, in POV-Ray, I don't need much interactivity as one keeps the whole composition in one's head. Same as in the past using AutosCAD, all done through the co

0 copy transfer of strings and blobs to SQLite?

2023-07-27 Thread ingo
Don't know, I only stay very much at the surface of Nim, as an eternal noob.

0 copy transfer of strings and blobs to SQLite?

2023-07-27 Thread ingo
[This thread on SQLite](https://sqlite.org/forum/forumpost/284d557096) peaked my interest. Especially post 6.1 pointing [to a Rust library](https://github.com/vlcn-io/sqlite-rs-embedded) . Is this done in Nim / can it be done in Nim? (not a (library) feature request, purely interest)

  1   2   3   >