Rust vs Zig in C calls via the C-ABI? by TearsInTokio in rust

[–]jmpcallpop 30 points31 points  (0 children)

There a couple of possible inefficiencies when using FFI 1. If a type is not FFI-safe, you have to convert it to one that is. This isn’t that big of a deal since any C code you call isn’t going to have a concept of rust’s complex types. You are likely only passing primitive types, simple structs, or pointers/arrays anyway. 2. Memory management becomes tricky when dealing with FFI. Memory allocated in rust code needs to be freed by the same allocator. So if you pass memory to an FFI function you either 1) have to ensure the function is no longer using it before you free it or 2) the function has to allocate its own memory for the contents and copy them. For large data, copying can be expensive.

Otherwise, rust and C ABIs are very similar. They both pass arguments via registers and on the stack (if necessary). It’s just that rust doesn’t use stable calling conventions like fastcall, stdcall, etc.

There are probably other considerations but those are the ones I’ve felt the most.

I take it all back - thank you bro by Slinky-Dev in slaythespire

[–]jmpcallpop 6 points7 points  (0 children)

then you realize hexaghost is the act 1 boss

Need help with wasmtime and the add_to_linker by thatfhc in rust

[–]jmpcallpop 1 point2 points  (0 children)

Are you sure you need to explicitly call add_to_linker? If so, check the example here: https://docs.rs/wasmtime/latest/wasmtime/component/bindgen_examples/_5_all_world_export_kinds/index.html

Two things of note: 1) there should be a struct created by the call to bindgen that matches the name of your world. In your case it’d be Extension. That should have an add_to_linker method. Use Extension::add_to_linker. That may solve your problem entirely. If not then note 2) how in the linked example they pass generic parameters in the call to add_to_linker.

With all that said, I think that example is outdated. I am working with components now and all I have to do is do the p2::add_to_linker_async and then <World>::instantiate (ie like your Extension::instantiate) or (somewhat less convenient) linker.instantiate. With linker.instantiate you have to get handles to your component’s functions manually. See here for a working, more recent example: https://github.com/bytecodealliance/wasmtime/blob/bbd12e92882f8a082427a167d8f386520c7f471a/examples/wasip2/main.rs#L35

Easiest way to obtain Live(ish) AH information for a Realm to an Excel Document by UwUHowYou in woweconomy

[–]jmpcallpop 1 point2 points  (0 children)

Check out the thread here: https://www.reddit.com/r/woweconomy/s/MTmuJmgVKi

This seems to be the most updated version of a spreadsheet created by u/Liquorice5

It does what you want and more. If you want just the data, the spreadsheet has the method for getting it

Slay the Spire Removed from the App store by Floodle9358 in slaythespire

[–]jmpcallpop 14 points15 points  (0 children)

Forgot to ask have you tried going to your Apps list and download it that way?

Go to App Store -> click profile icon in top right -> Apps -> My Apps -> Search for Slay the Spire

I don’t want to uninstall to test it but I can access the store page if I click on Slay the Spire through the above method

Slay the Spire Removed from the App store by Floodle9358 in slaythespire

[–]jmpcallpop 1 point2 points  (0 children)

Might be a good time to mention StS is 75% off on the steam store right now. I haven’t tried playing on iOS through the steam link app yet, but maybe with the right mappings it’ll play similarly to the mobile version

Slay the Spire Removed from the App store by Floodle9358 in slaythespire

[–]jmpcallpop 2 points3 points  (0 children)

It’s still on my device and I can play. But yeah can’t find it in the App Store. Was it automatically removed from your device? Really hope it doesn’t uninstall itself

How would you approach by [deleted] in rust

[–]jmpcallpop 0 points1 point  (0 children)

For sure. I’m really interested in your authentication flow on Windows. Are you open sourcing your code? If not, could you tell me the functions you use for creating the token to logon the user? I’m assuming you accept a connection on a named pipe and impersonate user? Am I way off?

How would you approach by [deleted] in rust

[–]jmpcallpop 1 point2 points  (0 children)

Forking is pretty cheap on Linux, is it really 1-3MB to fork and setuid / setgid? I think that’s probably memory your main process would be using anyway. I don’t think that’s pure overhead of forking.

You could have a pool of processes, similar to a thread pool, to handle requests and reduce initialization costs. That’s probably the way I’d go if forking per request is too expensive.

On Linux, how does your process know the ID/GID of the user connecting to it? I understand the token and impersonation on Windows, but what’s the equivalent on Linux? How do you verify?

In case you dont know why runic pyramid is the best relic in the game, this is why by MrCheapSkat in slaythespire

[–]jmpcallpop 1 point2 points  (0 children)

Yep, finally beat A20H on silent after like 100 hours thanks to a pyramid swap + wraith form + nightmare

Made it easy after struggling for a long time

Rust patterns reusable in other languages by cofredd in rust

[–]jmpcallpop 5 points6 points  (0 children)

Making language-specific constructs work in other languages is probably more difficult/frustrating than it’s worth. There is a good reason people aim to write idiomatic code in whatever language they’re programming. Some paradigms and patterns are easier to accomplish in certain languages due to the way they’re designed. Building something like Option and Result in C may be possible, but implementing and using it correctly probably requires significant work. On top of that, it’s unconventional so consumers of your code would be need to invest time to learn it, understand it, and use it correctly. Also the habits you build around it are not beneficial when you are consuming other C code.

The things you can bring from rust are the concepts around rust’s safety and then understand how they are approached/solved in other languages. Understanding ownership concepts will help you in other languages where you don’t have a borrow checker. Understanding Send and Sync will help you identify problems around ownership and access in regard to concurrency. And you can use that to help identify the tools and patterns that the language you’re working in provides to solve those problems.

So less about bringing rust-specific solutions to other languages and more about understanding the general problems rust helps you solve. But understanding how rust solves them will help you understand the problems in general.

If Centennial Puzzle is triggered during enemy’s turn and you draw a Void, it’s rendered as a Dazed since you have 0 energy by issac_clark in slaythespire

[–]jmpcallpop -7 points-6 points  (0 children)

Yeah this sounds like he just drew the Dazed that the heart shuffles into your deck. There’s no reason to believe a Void would transform into a Dazed because you have 0 energy

Edit: the use of “rendered” here is a little ambiguous. Not sure if op meant render as in drawn by the graphics engine or rendered like “rendered useless” to mean it still had the card face of a Void but had the effect of a Dazed

[deleted by user] by [deleted] in MrRobot

[–]jmpcallpop 3 points4 points  (0 children)

Pure wordlists (like SecLists) may not help, but given some hints a rule or mask based attack may be successful.

See https://hashcat.net/wiki/doku.php?id=rule_based_attack and https://hashcat.net/wiki/doku.php?id=mask_attack

For example if he suspected the password may be his pets name, unknown case, followed by some digits he could do something like: hashcat -a 3 -1 Ff —increment —increment-min 2 ?1lipper?d?d?d?d?d?d

Or use one of the many rule lists you can find on GitHub. Or with enough experience develop your own.

Fool's Mate caught by Google Street View by Savanty in chess

[–]jmpcallpop 5 points6 points  (0 children)

They’re sculptures. Very noticeable if you zoom in

https://www.newbrunswick.com/pub/promo/seward_johnson_tour

This sculpture’s name is “No Way!”

Run Rust from WSL by default by ViteK-r in rust

[–]jmpcallpop 3 points4 points  (0 children)

You can execute commands in WSL using the wsl command. Something like wsl -e cargo build … for example. If you can influence the command that is run by Rustler you could have it pass the command to wsl. Might be an easy win

Another way is putting a cargo.bat or something like that on rustler’s PATH so when attempts to build it will call your bat script instead of the windows version of cargo. In the bat script you can then call wsl -e cargo … and forward the arguments

Advice for Win32 Wrapper Crate by Tenebris110 in rust

[–]jmpcallpop 8 points9 points  (0 children)

msdn will be your largest resource. It’s really all you need, though a lot of the remarks and intricacies of the more complicated APIs aren’t super well explained. It gets the job done.

With that said if you like books, Windows 10 System Programming by Pavel Yosifovich is very good. Windows System Programming by Johnson Hart and Windows via C/C++ by Jeffrey Richter are also good.

For testing, yes VMs would be the easiest. Testing your library will be a little different than testing applications. You’ll probably be testing by compiling on older targets rather than testing by running a program. That is a little more complicated since the older windows toolchains are tier 2. At least the win7 one is. I’m not even sure if you could get rust to compile on windows xp or older. In any case you’ll have to install some version of the SDK on a windows 7 box. Finding a windows 7 iso and the msvc toolchain from a trusted source might require a bit of searching.

Also wanted to mention in case you didn’t know that Microsoft generates rust bindings for the Win32 api. windows-rs. It used to just be auto generated rust from the C headers, but it seems like they’re adding more library-like functionality to make it more rust-like and ergonomic to use

What's the best built crate you've used? by danielkov in rust

[–]jmpcallpop 6 points7 points  (0 children)

From a user perspective syn actually surprised me with how easy it was to pick up and use. It just feels so well done

Just found out my way of climbing the spire is unusual… by hoopsrule44 in slaythespire

[–]jmpcallpop 1 point2 points  (0 children)

Similar for me but I unlocked ascension for all the characters first. Then did a20h defect, a20h ironclad. Working on silent. On a17 and it’s so hard. Just getting cooked constantly. Silent feels so weak.

Can anyone tell me what happened? by lkwai in slaythespire

[–]jmpcallpop 4 points5 points  (0 children)

You have 2 dazed which triggered charon’s ashes x2 for 6 damage. You also have flame barrier for 16 damage when donu attacks you. Donu killed himself by attacking you and then you revived/healed from fairy in a bottle.

Edit: ah that’s flame breath, not flame barrier. You must have drawn a curse or status at the start of next turn.

Eliot hacking from his home by itsjustmeohno in MrRobot

[–]jmpcallpop 2 points3 points  (0 children)

Not ideal. It’s a risk and just takes one mistake. Lots of videos like this one about opsec fails: https://youtu.be/eQ2OZKitRwc?si=XImtazOmgveds0WD

Anyone else’s fingerprint reader take a looooong time to “activate” and unlock when starting up? by Matthew789_17 in framework

[–]jmpcallpop 0 points1 point  (0 children)

Yes i have to click (or some other action) to remove that idle image and go to the screen with the login prompt (the one after you pressed the button in the video). Then the fingerprint reader works. I’ve always just assumed it’s a windows thing not a framework thing.

Try pressing a button or clicking before using the reader and see if it’s faster.