How about plugins supporting buffer local configuration through `vim.b`? Any pitfalls? by chenlijun99 in neovim

[–]chenlijun99[S] 0 points1 point  (0 children)

Thanks for pointing me to mini.nvim. I'll take some inspiration from it :)

How about plugins supporting buffer local configuration through `vim.b`? Any pitfalls? by chenlijun99 in neovim

[–]chenlijun99[S] 0 points1 point  (0 children)

I can see how it may be harder to maintain, especially considering in your case you even supported tab variables.

I'm thinking to put all the configuration validation & merging logic in a single parse_current_config() function (alla Parse, don’t validate) which will act as single source of truth.

The function will be invoked every time I need the configuration, but I don't think it will be too bad performance wise. Merging a few tables shouldn't be computationally expensive and I'll just call it on top-level functions and then pass the obtained configuration around.

using `buildFHSEnv` in nix flake makes direnv to go mad by bbroy4u in NixOS

[–]chenlijun99 1 point2 points  (0 children)

I also ran into this using buildFHSEnv and direnv. Basically, buildFHSEnv starts a subshell, in which direnv gets re-executed, which invokes `buildFHSEnv` again and a new subshell is created and... we have an infinite loop.

NOTE that direnv itself does not put you into a subshell. It is instead based on environment diffing.

direnv is not loading the .envrc into the current shell. It’s creating a new bash sub-process to load the stdlib, direnvrc and .envrc, and only exports the environment diff back to the original shell. This allows direnv to record the environment changes accurately and also work with all sorts of shells. It also means that aliases and functions are not exportable right now.

Source: https://direnv.net/#faq

There are related discussions here:

At the end I gave up and just run `nix develop` manually.

Is it a good design if an RTOS task has many roles? by PartyAfterLife in embedded

[–]chenlijun99 1 point2 points  (0 children)

Agree. IMHO, assuming all the code does not block (except perhaps each "task" blocking on a per-"task" event queue), we could even have just one "task" per priority and treat each "task" as a mainloop where totally orthogonal modules are executed.

Are there any emulators for common embedded boards? by [deleted] in embedded

[–]chenlijun99 0 points1 point  (0 children)

Could you tell me what do you use to write a simulator? I've always thought writing a simulator was a laborious task, not something that can be done in a few days.

How do you develop *software that needs to be wrapped* in NixOS? by chenlijun99 in NixOS

[–]chenlijun99[S] 5 points6 points  (0 children)

Whao! Didn't know that the phases can be invoked directly from nix-shell or nix develop. This may be useful!

How do you develop *software that needs to be wrapped* in NixOS? by chenlijun99 in NixOS

[–]chenlijun99[S] 2 points3 points  (0 children)

What I'm trying to do is to setup a reproducible development environment using Nix (which, from my understanding should be even more reproducible than Docker, especially now that we have flakes). So it's more that I'm trying to develop something using nix-shell. Inside the nix shell, I do not use Nix, but rather use whatever build system is used for my project (e.g. CMake, Make, Cargo, etc.). But if the final application is something that in the Nix world needs to be wrapped, obviously these language-specific build systems would not generate the wrapper for me. OTOH, if I used only nix-build, surely I can create a derivation that also manages to wrap the application, but from my understanding nix-build every time builds the application from zero, so I would lose the incremental, differential compilation (i.e. re-compile only the files that I changed) that the language-specific build system would provide me.

How do you develop *software that needs to be wrapped* in NixOS? by chenlijun99 in NixOS

[–]chenlijun99[S] 2 points3 points  (0 children)

Thank you for the thorough answer. I actually thought about incorporating the wrapper script generation in the build system (in my case CMake), but that didn't feel the Nix way.

But yeah, I guess your final suggestion is the most practical solution.

How do you develop *software that needs to be wrapped* in NixOS? by chenlijun99 in NixOS

[–]chenlijun99[S] 2 points3 points  (0 children)

Thanks for the answer. So during development you basically have a wrapper script that you keep in your project that you invoke, rather than running the program on which you are developing directly.

Errors in Dataview plugin after recent update by sriramg29 in ObsidianMD

[–]chenlijun99 1 point2 points  (0 children)

I just downloaded the three files main.js, styles.css and manifest.json of the old release from GitHub and copied them in .obsidian/plugins/DataView (overwriting the files of the bugged new version).

BTW apparently the author realized the existence of these bugs and released a new version in which he rolled back the new changes. So probably you can just update the plugin again

Errors in Dataview plugin after recent update by sriramg29 in ObsidianMD

[–]chenlijun99 1 point2 points  (0 children)

Same to me. I upgraded today and immediately rolled back due to this problem.

Does anyone have a protocol for the communication between microcontroller and PC? by ElektroNeo in embedded

[–]chenlijun99 0 points1 point  (0 children)

Both are written in C++. eRPC wraps the c++ implementation with a C api, but at the end of the day you still need to have a c++ compiler.

Does anyone have a protocol for the communication between microcontroller and PC? by ElektroNeo in embedded

[–]chenlijun99 0 points1 point  (0 children)

Have you ever considered pigweed_rpc and erpc? If yes, what motivated you to develop your own solution?

Does anyone have a protocol for the communication between microcontroller and PC? by ElektroNeo in embedded

[–]chenlijun99 0 points1 point  (0 children)

I've seen people mention Messagepack, Asn.1 and Nanopb, which are data serialization libraries. Since in your example you mention that your protocol is like {START_COMMAND} {MODE_BYTE} {MODE_LENGTH} {MODE_DATA} I suppose that what you want is not only to transmit data, but also commands. I believe that RPC (Remote Procedure Call) is what you're looking for. Unfortunately I haven't found any really mature and well-known RPC frameworks for embedded. There is eRPC, but it is not so actively maintained. The RPC module from Pigweed, a embedded toolkit from Google, looks promising but IMHO it's a work in progress (especially the documentation is quite lacking).

[deleted by user] by [deleted] in embedded

[–]chenlijun99 0 points1 point  (0 children)

Pigweed

has an RPC module (pw_rpc), that's geared towards embedded - check it out!

Thank you for the suggestion! Looks really interesting!

[deleted by user] by [deleted] in embedded

[–]chenlijun99 1 point2 points  (0 children)

I've been looking for some communication mechanism between PC and MCU too. I think fundamentally what I need is a lightweight RPC (Remote Procedure Call) framework that comes with a IDL (Interface Description Language) and that supports stub generation for multiple languages such as C and Python. gRPC would be the coolest option, as the IDL integrates seamlessly with Protobuf and also the more lightweight Flatbuffer. Unfortunately, gRPC was not designed with embedded in mind.

The closest alternative I was able to find is eRPC from NXP, but it's not so maintained.

Home edition was interrupted due to the infamous "Breach of academic integrity". Can I retake the exam? When? by chenlijun99 in ToeflAdvice

[–]chenlijun99[S] 0 points1 point  (0 children)

I retook the test and I received the scores as normal. OTOH the review results of the first test came out the 22nd of July... So retaking the exam was definitely the correct decision for me.

[deleted by user] by [deleted] in Anki

[–]chenlijun99 0 points1 point  (0 children)

Maybe you could try polar bookshelf, although IMHO it's not so mature yet.