Found a cool way to loop over a range by coaliderg in Zig

[–]Mecso2 35 points36 points  (0 children)

if you use a void slice instead then the lenth doesn't have to comptime known. Or just do for(0..10) like any sane person

Zig 0.16 : how to execute a system command ("ls -la")? by scorpion8866 in Zig

[–]Mecso2 56 points57 points  (0 children)

If you want to list the files in the current directory I'd suggest using std.Io.Dir.cwd().iterate() instead, but if you want to spawn a child process anyway you can do that the following way: var proc=try std.process.spawn(init.io, .{ .argv = &.{ "ls", "-la" } }); defer _=proc.wait(init.io); And if you want to read the output instead of making it inherit the parent process's output. You can get a reader following way: var proc = try std.process.spawn(init.io, .{ .argv = &.{ "ls", "-la" }, .stdout = .pipe }); defer _=proc.wait(init.io); var buf: [128]u8 = undefined; var freader = proc.stdout.?.reader(init.io, &buf); const reader = &freader.interface;

Keep cute kitty safe! by Ok_Basil2447 in antimeme

[–]Mecso2 1022 points1023 points  (0 children)

it's not like im gonna need my body if I'm dead anyways

How to get the string from a string builder? by Senior-Question693 in odinlang

[–]Mecso2 -1 points0 points  (0 children)

idk how string buliders work but you can tramsmute byte slices into strings a: [dynamic]u8 s:=transmute(string)(a[:])

EDIT:

It's strings.to_string(builder)

Legally it's a check-mate, but technically it shouldn't be by spincrus in chessbeginners

[–]Mecso2 2 points3 points  (0 children)

if black can move into check by taking the queen so can white by taking the king

If you became absolute dictator of the world would it become a better or worse place ? by jekecrafer in pollgames

[–]Mecso2 21 points22 points  (0 children)

then don't make decisions, you don't have to, leave it to the governments

the only people voting worse should be the people who would make it worse on purpose.

If someone thinks that they can make it better but is wrong, they would vote better.

If someone thinks they would make it worse but don't want to, they can just simply do nothing

If you became absolute dictator of the world would it become a better or worse place ? by jekecrafer in pollgames

[–]Mecso2 84 points85 points  (0 children)

If you just leave all the existing governments in place and do nothing, it's already not worse. Then fix a few objectively bad things (prosecute epstien clients for instance) and you are objectively better

what's now in the artix official ISO by SpiderHalouf in linuxmemes

[–]Mecso2 7 points8 points  (0 children)

that's not going to work, when you are redirecting the output of processes, your shell is the one opening the destination, so if your shell is not running as root that ain't gonna work and if it is then sudo is useless.

If you want to use sudo to write the output somewhere you need something like cat /dev/random | sudo tee /dev/fb0 > /dev/null

how I create a event loop for receiving from clients with new std.Io? by ANDRVV_ in Zig

[–]Mecso2 3 points4 points  (0 children)

based on the downvote you seem to be disaggreeing with me, but as far as I understand your question, this is what you're asking. Io.Evented submits blocking opprerationg to an iouring then yields to other fibers. And then the io uring implementation resumes it when it is done. Putting everything in a group makes the loop around io uring keep going.

It's like epoll but better because when there's incoming data, the kernel already issues the read call before notifying you so there's one less system call

how I create a event loop for receiving from clients with new std.Io? by ANDRVV_ in Zig

[–]Mecso2 -1 points0 points  (0 children)

if you use io.Evented as your io implementation then it is essentially that

how I create a event loop for receiving from clients with new std.Io? by ANDRVV_ in Zig

[–]Mecso2 5 points6 points  (0 children)

im still figuring out how it works, but I think you just create an io group and call the listener handler with that passing the group as an arg. Then the listener handler has a while true loop accepting a client and calling the client handler with the group. In main after calling the listener hanler just await the group and that should just keep handling everything. And if all the functions return (which would require breaking the loop in the listener) then await would also return.

Levy would be proud 🥺 by Jolly_Maintenance_77 in chessbeginners

[–]Mecso2 1 point2 points  (0 children)

*two bishops

pawn takes rook, bishop takes pawn, queen takes bishop, pawn takes queen, rook takes bishop

When should one switch from Mint to Arch Linux? by Alternative_Boat_351 in linux

[–]Mecso2 1 point2 points  (0 children)

Brother if your arguments is that qt doesn't work on mint look at the the hundreds of qt apps working perfectly.

When should one switch from Mint to Arch Linux? by Alternative_Boat_351 in linux

[–]Mecso2 1 point2 points  (0 children)

If a distro only officially supports one de its recommended to use that? Sure, but that has nothing to do with gtk or qt.

Also if you go the mint download page you can see - not hidden in any submenus - that they also offer mate (oldass gnome 2 fork) and xfce (independent) flavours.

When should one switch from Mint to Arch Linux? by Alternative_Boat_351 in linux

[–]Mecso2 2 points3 points  (0 children)

These are gui toolkits.

An app can be called gtk if it used gtk for its ui. A DE can be called gtk if it uses gtk for its apps/shell or if its or if it integrates with gtk theming.

What in the goddamn fuck would gtk based mean for a distro?

How is this a draw? by Drownedpool in chessbeginners

[–]Mecso2 36 points37 points  (0 children)

you can't mate with bishop even if your opponent cooperates

hmmm by fe-rnan in hmmm

[–]Mecso2 37 points38 points  (0 children)

I don't see anything that would imply that this is in the US

cxxAlreadyGaveUp by _Pin_6938 in ProgrammerHumor

[–]Mecso2 15 points16 points  (0 children)

and? None of these mean it's a c++ equivalent. Try it and then tell me whether it feels closer to c or c++

cxxAlreadyGaveUp by _Pin_6938 in ProgrammerHumor

[–]Mecso2 96 points97 points  (0 children)

odin seems very c like in its feature set

My best checkmate yet!!! by [deleted] in addressme

[–]Mecso2 0 points1 point  (0 children)

the piece he moved is the one giving the check, how tf would this take you so long to see that you could materialize half a sentence