thevoidzero

joined 7 months ago
[–] [email protected] 2 points 23 hours ago

Yeah, doing that in build.rs seems like a reasonable solution. Since we can't do that using proc macros.

I don't know if language server will keep giving me errors if the files are only linked through build.rs.

[–] [email protected] 1 points 23 hours ago

Thank you. Yeah, something like this would work for me as I can add in a script and run it before compiling. But it won't be a cross platform solution and windows/mac users are probably not going to be able to do anything. Maybe if I do the same thing but from build.rs it'll work. I'll try that.

[–] [email protected] 1 points 23 hours ago

That seems like a good compromise if I don't find something better. Thank you.

I'm hoping to make it easy for people to add more functions, that's why I want minimal code change required to add more functions.

[–] [email protected] 1 points 23 hours ago

Thank you for your detailed response.

I am ok using macros. But even proc macro only get the tokens and using in on the whole mod is unstable unless you use use it on mod sth{...} instead of code being on in a different file (sth.rs).

The plug-in system is dynamic in a sense that my plans for it are loading them through shared libraries (.dll, .so) compiled separately by users. But I also have internally provided core plugins that come with the program. But rust ABI system is not that stable, so in worst case I might have to ask users to just add plugin code to some directory and re-compile program instead of loading from shared libraries. That's why I'm trying to make it as simple as possible. Asking users to modify the rust code somewhere else yo register the plugin might be met with resistance.

I was thinking that using build script to parse the source code and generating those codes could work, but that seemed hacky. So I was trying to see if there are better solutions, as it felt like a problem people might have come across themselves.

[–] [email protected] 21 points 1 day ago (4 children)

Hey this solution seems to work but it's not perfect; I don't know how we can improve it, and nothing to replace it with, but let's take it down asap.

[–] [email protected] 2 points 1 day ago (1 children)

He did not have to provide lifelong project and work on it. He just needed to donate his money and people in UN would have worked with that money. Even if it didn't work, he'd still have done a real great job by donating that much. And maybe we could have learn money is not the solution and we need to change approach.

[–] [email protected] 2 points 1 day ago (2 children)

Thank you. I just put the call with !, I don't necessarily want a macro solution. Any solution is acceptable, my requirement is that I can just keep adding more mods with functions in src/functions/ and not have to register each function.

Inventory seems like the solution I am looking for. Although in my case, instead of collecting different values of the same type, I want to collect different types that all have same trait. But maybe I can make a temporary struct with Box<dyn _> member to collect it if trying to collect it directly doesn't work. I do not plan to support WASM. I am planning to make C/C++ and Python API for the libraries though, so if it has problems with them, then I might have a problem.

 

Hi all.

I want to develop a plugin system within my program, and I have a trait that functions defined by plugins should implement.

Currently, my code gets all the functions in a HashMap and then calls them by their name. Problem is, I have to create that hashmap myself by inserting every function myself.

I would really appreciate it if there was a way to say, suppose, all pub members of mod functions:: that implement this trait PluginFunction call register(hashmap) function. So as I add more functions as mod in functions it'll be automatically added on compile.

Pseudocode:

Files:

src/
├── attrs.rs
├── functions
│   ├── attrs.rs
│   ├── export.rs
│   └── render.rs
├── functions.rs
├── lib.rs

Basically, in mod functions I want:

impl AllFunctions{
    pub fn new() -> Self {
       let mut functions_map = HashMap::new();[[
       register_all!(crate::functions::* implementing PluginFunction, &mut functions_map);
       Self { function_map }
  }
}

Right now I'm doing:

impl AllFunctions{
    pub fn new() -> Self {
       let mut functions_map = HashMap::new();[[
       crate::functions::attrs::PrintAttr{}.register(&mut functions_map);
       crate::functions::export::ExportCSV{}.register(&mut functions_map);
       crate::functions::render::RenderText{}.register(&mut functions_map);
       // More as I add more functions
       Self { function_map }
  }
}
[–] [email protected] 6 points 5 days ago

I'll repeat it as much as I can but we need yo open up new journals for these kind of things.

All we need is a good cloud for storage, and volunteers. I think comp-sci people do that with https://arxiv.org/

The journal should accept any user submitted papers but have ranking based on other people, like successful reproducible studies (which is also accepted in journal) will be linked to the original journal. Reviews and such can be their own articles but also linked to the journal.

That way, undergrads can do projects reproducing previous studies (given resources) which will still give them research credit. Failures and exploration will also give people credit as it helps other people's research. We can just tag papers for novel ideas,failures, reproducing old paper,reviews, etc.

I think it has a chance to be very useful if we can pull it off. Although it'll have the same problems as of social media with upvote system. So some more thoughts needs to be there for the actual implementation.

[–] [email protected] 1 points 1 week ago

I know it's an edge case. But the edge case of having to pay more on taxes on increasing income existing for incomes close to poverty line seems counterproductive, doesn't it?

[–] [email protected] 1 points 1 week ago

I guess yeah. In that condition the algorithm would probably destroy all universe. Although you might be able to set a threshold and not destroy when it is over the threshold.

But situation where you don't know the answer is not for this algorithm as this one came from sorting problem.

[–] [email protected] 1 points 1 week ago* (last edited 1 week ago) (2 children)

It's not fun when you have to explain it. But basically it is based on the infinite multiverse theory. Since the multiverse splits whenever you make choices, in this case the program would spawn a large number of multiverses each with different combinations of those bits, which means at least one of them would have the exactly the combination we want. If the program destroys the multiverse it is in after it determines it is not correct, only reality that remains is the one with correct combination of bytes. Making it that we will get the code we want on the first try.

[–] [email protected] 4 points 1 week ago

That seems like a wonderful function. Considering android support external mouse with cursors. I hope someone can make a FOSS version and put it in F-droid.

 

TLDR: I recently found out there is "deprecated" XFA format that acrobat still uses in their programs, and government forms have those for dynamic contents in the form that we cannot fill using other softwares. Looking for solutions.


This has been a problem since a long time. Back in 2020 I had dual boot because I needed acrobat to fill PDF forms, but after finding xournal++ program I nuked windows partition. Windows update messing up grub was one of the reason I decided to nuke windows and looking at the posts recently it's still a huge issue.

So the problem I recently encountered is that even the government issued PDF forms need acrobat reader (which is free software for PDF, but only available in windows and mac). Which I didn't think would be an issue and just filled the form in Firefox.

Turns out that was problematic as the PDF forms has fields that are automatically filled, calculated from other fields, only made available when certain checkboxes are checked, etc. and Firefox doesn't support that. Even trying to install the acrobat reader snap (which uses wine) in a VM and opening the PDF on it didn't work. The UI makes me think it's a really old version of the reader.

So without searching for other devices (and filling a PDF with my sensitive information) what solution is there? Installing windows is a hassle even in a VM, and it will use up precious SSD memory. But that's the only solution I can think of.

I also found masterpdf or something like that which the Arch wiki says has support for that, but it didn't work. It says XFA forms are converted to acro forms, and the dynamic part doesn't work. There are websites that promise to work for such forms, but I'm not going to be putting sensitive info on web apps.

 

Hi everyone,

I'm hoping there are people here who work on FOSS and have applied for grants to support their software financially. I am applying for a grant opportunity that is asking for a software from US gov agency.

My requirements:

  • I want to publish it under Open Source Licenses like GPL (not MIT) so other corps can't take this to use on their product,
  • The grant agency will get the source code, they can do whatever as long as the license is held,
  • I will develop the features they want, and request during the duration of grant,
  • I will want to continue development independently after the grant, or apply for more grants from other organizations,
  • To clarify the previous point, I do not want to give them the final product so they own it, and I can no longer do anything on the program.

So, if anyone has done similar things, please give me advice on this. Their requirement says "a web repository" should be provided at the end, so I think I can apply with the intention of giving them the software code while keeping the rights. But I don't want to make a mistake in application/contract and lost the rights to the program, I want to develop a lot further than just the features they want for their use case.

Or at least dual license to protect the Open Source Side while giving the grant organization rights to take the code for their other programs because of the money they spent.

 

cross-posted from: https://lemmy.world/post/18129059

This feels like it should already be a feature in a terminal. But I didn't find anything that let me do this efficiently.

I had a rust library for converting list like 1-4,8-10 into vectors, but thought I'd expand it into a command line command as well, as it is really useful when I want to run batch commands in parallel using templates.

I wanted to share it since it might be a useful simple command for many people.

 

This feels like it should already be a feature in a terminal. But I didn't find anything that let me do this efficiently.

I had a rust library for converting list like 1-4,8-10 into vectors, but thought I'd expand it into a command line command as well, as it is really useful when I want to run batch commands in parallel using templates.

I wanted to share it since it might be a useful simple command for many people.

 

cross-posted from: https://lemmy.world/post/17984566

Hi all,

mpv communities seem to be tiny in lemmy, so I'm sharing it here.

This is a program I made for music control from local network.

You can run it in a computer with some local media files, or youtube links or any other links yt-dlp supports. And then with the server, you can control the media player and the playlist from any devices in your local network. So that you can just show a QR code or something to house guests for parties, or have it bookmarked within family to control the music.

I wanted to make something similar to how youtube app let's you play in TV and such, but my skills were not enough to do that. So I tried a simple alternative that works with computers. In an ideal world, I could make "Play with local mpv server" option come while on other android apps, but I have zero experience in android app development and it looks complicated.

I know some other programs also give option to control media, but I wanted to give it a go with a simple implementation. Making the web-server was a tricky part. Only tutorial from the rust book was useful here as every other web server developement in rust seems to be async ones using libraries so I would have to make a complicated system to communicate with the mpv. Using the simple Tcp connection let me make a thread with mpv instance in the scope. I do need to support https and file uploads and other things, but I haven't had any luck finding a solution that works with simple Tcp connection like in the tutorial. Let me know if you know anything.

Github: https://github.com/Atreyagaurav/local-mpv

 

Hi all,

mpv communities seem to be tiny in lemmy, so I'm sharing it here.

This is a program I made for music control from local network.

You can run it in a computer with some local media files, or youtube links or any other links yt-dlp supports. And then with the server, you can control the media player and the playlist from any devices in your local network. So that you can just show a QR code or something to house guests for parties, or have it bookmarked within family to control the music.

I wanted to make something similar to how youtube app let's you play in TV and such, but my skills were not enough to do that. So I tried a simple alternative that works with computers. In an ideal world, I could make "Play with local mpv server" option come while on other android apps, but I have zero experience in android app development and it looks complicated.

I know some other programs also give option to control media, but I wanted to give it a go with a simple implementation. Making the web-server was a tricky part. Only tutorial from the rust book was useful here as every other web server developement in rust seems to be async ones using libraries so I would have to make a complicated system to communicate with the mpv. Using the simple Tcp connection let me make a thread with mpv instance in the scope. I do need to support https and file uploads and other things, but I haven't had any luck finding a solution that works with simple Tcp connection like in the tutorial. Let me know if you know anything.

Github: https://github.com/Atreyagaurav/local-mpv

 

cross-posted from: https://lemmy.world/post/11271385

Basically, you can choose some slides from an opened .tex file to copy. It also has the function to see which graphics files are included in the selected files, so you know which ones to copy.

Here is the Github link: https://github.com/Atreyagaurav/beamer-quickie

The PDF pages are shown using the SyncTeX (if available) so that you can visually choose the slides as long as there is a single .tex source file, (might still work without synctex for simple cases).

I've made it on Linux, so it hasn't been tested in windows. You probably will need to compile gtk on Windows if you want to make it work. So if someone is really interested let me know, I can give instructions. Even in linux you'll need to install dependencies.

 

Basically, you can choose some slides from an opened .tex file to copy. It also has the function to see which graphics files are included in the selected files, so you know which ones to copy.

Here is the Github link: https://github.com/Atreyagaurav/beamer-quickie

The PDF pages are shown using the SyncTeX (if available) so that you can visually choose the slides as long as there is a single .tex source file, (might still work without synctex for simple cases).

I've made it on Linux, so it hasn't been tested in windows. You probably will need to compile gtk on Windows if you want to make it work. So if someone is really interested let me know, I can give instructions. Even in linux you'll need to install dependencies.

view more: next ›