There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

lemmy.ml

cm0002 , to linuxmemes in Please help

Me who lives in the black abyss of the terminal

Wtf is Hyprland? Waybar Rice?

turbowafflz , to linuxmemes in Please help

I switched to hyprland over christmas when I didn’t have much I actually needed to do and now I definitely do things more efficiently because of it. You just need to pick the right time to switch

DeaDvey OP ,

I LOVE Hyprland

Safipok , to memes in Pokemon - US Edition

I upvoted, but maybe !comics or !webcomics

wise_pancake , to programmer_humor in You can certainly change it. But should you?

Some people hate that C is dangerous, but personally I like its can-do attitude.

“Hey C, can I write over the main function at runtime?”

Sure, if you want to, just disable memory protection and memcpy whatever you want there! I trust you.

It’s a great attitude for a computer to have.

mox ,

This is sometimes practical, too. For example, hooking and extending functions in compiled code that will never be updated by the original author, while preserving the original executable/library files.

huginn ,

You can do that in memory safe languages too. Kotlin extension functions, for example.

RonSijm , (edited )
@RonSijm@programming.dev avatar

Extension functions are not the same at all. Extension functions are syntactic sugar. For example if you have an extension function like


<span style="color:#323232;">public static class ObjectExtension
</span><span style="color:#323232;">{
</span><span style="color:#323232;">    public static void DoSomething(this object input) { }
</span><span style="color:#323232;">}
</span>

You can call that function on an object by doing object.DoSomething() - Yes. But underneath it’s the same as doing ObjectExtension.DoSomething(object)

That function does not actually become part of the object, and you can’t use it to override existing functions

A closer example of how to do something similar in a memory safe language would be - in C# - using something like Castle DynamicProxy - where through a lot of black magic - you can create a DynamicProxy and fool the CLR into thinking it’s talking to an object, while it’s actually talking to a DynamicProxy instead. And so then you can actually intercept invocations to existing methods and overrule them

Generally overruling existing functions at runtime is not that easy

huginn ,

Ah my bad, misunderstood the use case.

I thought you were talking about keeping an unmaintained library intact but building onto it.

I thought C was a really dangerous way to use that syntactic sugar pattern. Actual manipulation of the bytecode to maintain and extend a compiled binary is wild

mox ,

Actual manipulation of the bytecode to maintain and extend a compiled binary is wild

Just wait until you learn about machine code. :)

huginn ,

I do have a degree in this. I am aware.

This is sometimes practical, too. For example, hooking and extending functions in compiled code that will never be updated by the original author, while preserving the original executable/library files.

Your original comment made it seem more like extensions - extend and preserve. That’s the misunderstanding.

When I said it’s wild to manipulate bytecode I means “wow that’s a terrifying practice, I would hate to check that PR”

mox , (edited )

Fair enough. What threw me is that you said “bytecode”, which is generally not used when referring to hardware machine instructions. My original comment is about patching the in-memory image of a running program or library, replacing machine instructions in order to intercept certain calls and extend their behavior.

I thought my phrase “compiled code” would convey this, but I guess nowadays bytecode-compiled languages are so common that some people assume that instead.

huginn ,

Yeah and part of this is that the domain I’ve been working in for years now is very far from machine code, and I’m probably overly lax with my language here.

The result of being in very corporate app dev - I’m usually talking in much higher level abstractions. My bad on conflating bytecode and machine code

mox ,

Ah, corporate work. I hope they’re treating you well.

huginn ,

Different strokes - some would find what I’m doing hell. I personally love it.

The 260k/yr salary may help alleviate the pain.

wise_pancake ,

That actually sounds pretty cool

Sometimes what I’d like to be able to do is treat part of an app as a core and the rest like user provided scripts, but written and evaluated in the host language and not running an embedded scripting language like lua with all the extra burden.

E.g. you have an image editor and you want the user to be able to write native functions to process the image. Or you have a game engine and you want to inject new game code from the user without the engine being a compiler or the game logic being bundled scripts.

RonSijm ,
@RonSijm@programming.dev avatar

You’d probably use a different approach for that. Like you’d make your program dynamically load all the .dlls in a “plugins” folder -

Then you’d provide some plugin interface for the users to create plugins, for example:


<span style="color:#323232;">public interface IImageEditorPlugin
</span><span style="color:#323232;">{
</span><span style="color:#323232;">    public void BeforeImageEdit(int[,] imageData);
</span><span style="color:#323232;">    public void AfterImageEdit(int[,] imageData);
</span><span style="color:#323232;">}
</span>

And then you can load plugin classes from all the dlls with dependency injection, and execute them though something like this:


<span style="color:#323232;">public class ImageEditor(IEnumerable<IImageEditorPlugin> plugins)
</span><span style="color:#323232;">{
</span><span style="color:#323232;">    public void EditImage(int[,] imageData)
</span><span style="color:#323232;">    {
</span><span style="color:#323232;">        foreach (var imageEditorPlugin in plugins)
</span><span style="color:#323232;">        {
</span><span style="color:#323232;">            imageEditorPlugin.BeforeImageEdit(imageData);
</span><span style="color:#323232;">            // Do internal image edit function
</span><span style="color:#323232;">            imageEditorPlugin.AfterImageEdit(imageData);
</span><span style="color:#323232;">        }
</span><span style="color:#323232;">    }
</span><span style="color:#323232;">}
</span>

This is a very simple example obviously, normally you’d send more meta-data to the plugins, or have multiple different interfaces depending on the kinda plugin it is, or have some methods to ask plugins when they’re suitable to be used. But this way a user can provide compiled versions of their plugins (in the same language as the core application) - instead of having to provide something like lua scripts

SubArcticTundra ,
@SubArcticTundra@lemmy.ml avatar

Agreed. It’s a very adult approach. C hands you a running chainsaw and whatever happens after that is your responsibility. It is also your responsibility to decide when it’s not the right time to use C.

mindbleach ,

C is dangerous like your uncle who drinks and smokes. Y’wanna make a weedwhacker-powered skateboard? Bitchin’! Nail that fucker on there good, she’ll be right. Get a bunch of C folks together and they’ll avoid all the stupid easy ways to kill somebody, in service to building something properly dangerous. They’ll raise the stakes from “accident” to “disaster.” Whether or not it works, it’s gonna blow people away.

C++ is dangerous like a quiet librarian who knows exactly which forbidden tomes you’re looking for. He and his… associates… will gladly share all the dark magic you know how to ask about. They’ll assure you, oh no no no, the power cosmic would never pull someone inside-out, without sufficient warning. They don’t question why a loving god would allow the powers you crave. They will show you which runes to carve, and then, they will hand you the knife.

5C5C5C ,

You have a talent for metaphor.

AVincentInSpace , (edited )

Rust is like a paranoid overprotective guardian. A “mom friend”, of sorts. Always the designated driver of the group, keeps you from staying up too late, stops you from eating things that might be choking hazards without proper precaution, and so on and so forth. You’ll never meet a person more concerned with your health and safety – until, that is, you say the magic word “unsafe”. Suddenly the alter ego that their hypnotist implanted gets activated, and their entire demeanor changes on a dime. BMX biking? Bungee jumping? Inline assembly? Sounds like a great idea! Let’s go, man! Rules are for NERDS! Then the minute the unsafe block ends, they’re back to normal, fully cognizant of the adventure they just went on and thinking absolutely nothing of it. “Whitewater rafting with you guys was really fun, especially the part where Jason jumped into the water and I went after him! I’d best go get the first aid kit, though – that scrape he got when he did that looks like it might get infected. I know he said it didn’t hurt, but better safe than sorry!”

They kinda scare you when they’re like that, if you’re honest.

mindbleach ,

I tried thinking of one for Rust, and ‘the mom friend with a safeword’ is alarmingly accurate.

The secret basement is never locked. It’s fine to go down there, alone. You’ll only be scarred on the inside.

It’s when you go down together that all bets are off.

derpgon ,

I loved C/C++ in university, finally the damn piece of rock we forced into thinking was doing exactly what I told him to do, no more and no less.

le_throosh , to memes in Pokemon - US Edition

Omg, I love this

fl42v , to linuxmemes in Please help

For me it’s not about efficiency (although tiling somewhat improves it) but rather basic comfort. With stacking wms windows constantly overlap each other, and then I have to constantly re-arrange them, alt-tab like 75 times to find the one I need, etc, and tiling does solve this issue pretty damn well.

possiblylinux127 , to linuxmemes in Please help

Or you could just use GNOME

Bipta ,

I hate myself, but I don't hate myself.

Diplomjodler , to linuxmemes in Please help

I changed the font sizes in Cinnamon, so i can totally relate.

floofloof , to worldnews in Recent Ipsos poll shows that most people in western countries think that their country is headed in the wrong direction.

Problem is, in several of these countries half the people are unhappy with a lurch towards fascism, while the other half are unhappy their country is not fascist enough.

yogthos OP ,
@yogthos@lemmy.ml avatar

It’s so optimistic of you to think there’s an even split here.

velox_vulnus , to worldnews in Recent Ipsos poll shows that most people in western countries think that their country is headed in the wrong direction.

Which is actually a good thing. When people are aware that their system is screwed, there’s a room for growth. As an Indian, all I can see is nothing but grim future for ourselves. Maybe we’ll experience the most extreme forms of late-stage capitalism, maybe our country might break, maybe there could be a genocide. I hope that the syndicalist movement grows more powerful - perhaps the South would be a proper pocket for leftist movement?

yogthos OP ,
@yogthos@lemmy.ml avatar

For sure, people becoming aware that there is a problem with their governance is the first step towards actually doing something about it.

brenticus , to linuxmemes in Please help

If I would stop spending so much time modifying (read: breaking) it it probably would be more productive. I love the ergonomics of my setup.

But also wouldn’t it be cool to add just one more fancy widget to my already janky-as-fuck eww bar? No? Well I’ll do it anyways.

grue , to memes in W.W.J.D.

Q: WWJD?

A: (╯°□°)╯︵ ┻━┻

Sanctus , to memes in W.W.J.D.
@Sanctus@lemmy.world avatar

The issue today is Jesus was washed away in mainstream media as a rebel against Rome. They didn’t want to sell that part of the story because, well, the Lord whipped and cursed them and they’re still doing it.

novibe , to worldnews in Recent Ipsos poll shows that most people in western countries think that their country is headed in the wrong direction.

Fucking scary seeing almost 80% of Indians believe they’re going in the right direction, ngl

FuckyWucky ,

ikr, embarrassing. corporate propaganda works i guess.

i do wonder about the sampling bias. usually these surveys bias towards urban college educated top 25% upper caste people, they should ask lowest income quartile.

novibe ,

The sampling bias makes sense actually… I bet it’s even more of a thing in India than most places.

mr_MADAFAKA OP , to steam in Free point shop items for Deckbulders Fest
@mr_MADAFAKA@lemmy.ml avatar
  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • lifeLocal
  • goranko
  • All magazines