[-] Cyno@programming.dev 3 points 10 hours ago* (last edited 10 hours ago)

One more reason why Git-Fork is the GOAT - it does have separate subject and description fields. Don't lump all GUI tools in together and generalize

26
What exactly is GNOME? (programming.dev)

Dumb title but I didn't know how else to put this into words, bear with me for a sec - I am not just looking for the definition.

Years ago I tried Ubuntu which used GNOME and assumed that its desktop layout was "the default" GNOME. I later tried PopOS which also uses it and it was the same, and when eventually I installed Mint I saw that it's still fundamentally the same with some slight tweaks or different tools.

Well, few days ago I installed Bazzite (Fedora) which is also GNOME. It doesn't look anything like anything I've seen before, either in terms of mindset or technical layout. I've gone from an admittedly old-fashioned, but efficient and reliable!, layout and workflow to something that reminds me more of an apple product - its stylish, minimalist yet inefficient and utterly frustrating to get anything done with because of how opinionated it is.

When searching for common problems I often found comments saying stuff like "but try it out! it's in the spirit of gnome, it takes a while to get used to it but the philosophy is valid" and frankly I don't understand anymore what exactly gnome is and what are its design principles, if there even are any and every distro just does whatever the f it wants and call it "a gnome experience".

[-] Cyno@programming.dev 7 points 2 weeks ago* (last edited 2 weeks ago)

When you need more advanced stuff then GUIs tend to become more of a sticking point I find

What's stopping you just opening the terminal in those rare cases? For 99% of my daily needs I'm good with a good GUI

14

I need to remote desktop connect to a windows PC on a local network. This works flawlessly when done from my windows PC but I'm having issues on Linux Mint.

I'm using Remmina since it was the most common answer to a linux RDP client. I imported the RDP file from windows but I also created a connection with manually filled info.

First issue is that linux can't connect to the machine by its name - on windows ping MYPC-321 works, on linux mint it throws an error. However, ping MYPC-321.local does work, but if I try to use that as the address in Remmina, it fails again. Is there a way to connect using just name since I dont want to have to recheck the IP address every day?

But let's say this is for now resolved if I just use the local IP address. The second, main problem, is authentication. No matter what I put into the username and domain fields of Remmina's authentication GUI, it always instantly fails and Remmina reloads the screen without giving me any error. The credentials are the same as when connecting from the windows PC (although I dont have to specify the domain there) so I have no idea what could be the problem here.

Is there something else I'm missing, something fundamentally different about how this works on linux? I wasn't expecting for such a simple and straightforward thing to instantly cause issues.

[-] Cyno@programming.dev 11 points 3 weeks ago

Git Fork is absolutely amazing. It has a good (unlimited) free trial but it is well worth the one time purchase too.

[-] Cyno@programming.dev 6 points 1 month ago* (last edited 1 month ago)

But to truly master Linux, you need to understand its internals, like how the system boots, how networking works, and what the kernel actually does. In this third edition of the bestselling How Linux Works, author Brian Ward peels back the layers of this well-loved operating system to make Linux internals accessible.

Isn't it too advanced? Seems like a good book but like the opposite of what I meant - I'm curious about beginner resources that will get people interested, knowledgeable and comfortable about using linux on a daily basis as much as they are with windows after decades of using it, not to turn them into a "superuser familiar with internals like kernel, networking, LVM".

63

cross-posted from: https://programming.dev/post/18636248

I've always approached learning Linux by just diving into it and bashing my head against problems as they come until I either solve them or give up, the latter being the more common outcome.

I wouldn't take this approach with other pieces of software though - I'd read guides, best practices, have someone recommend me good utility tools or extensions to install, which shortcuts to use or what kind of file hierarchy to use, etc.
For example, for python I'd always recommend the "Automate the boring stuff with Python", I remember learning most Java with that "Head first Java" book back in the days, c# has really good official guides for all concepts, libraries, patterns, etc.

So... lemme try that with Linux then! Are there any good resources, youtube videos, bloggers or any content creators, books that go explain everything important about linux to get it running in an optimal and efficient way that are fun and interesting to read? From things like how the file hierarchy works, what is /etc, how to install new programs with proper permissions, when to use sudo, what is a flatpak and why use it over something else, how to backup your system so you can easily reconstruct your setup in case you need to do an OS refresh, etc? All those things that people take for granted but are actually a huge obstacle course + minefield for beginners?

And more importantly, that it's up to date with actually good advice?

37

I've always approached learning Linux by just diving into it and bashing my head against problems as they come until I either solve them or give up, the latter being the more common outcome.

I wouldn't take this approach with other pieces of software though - I'd read guides, best practices, have someone recommend me good utility tools or extensions to install, which shortcuts to use or what kind of file hierarchy to use, etc.
For example, for python I'd always recommend the "Automate the boring stuff with Python", I remember learning most Java with that "Head first Java" book back in the days, c# has really good official guides for all concepts, libraries, patterns, etc.

So... lemme try that with Linux then! Are there any good resources, youtube videos, bloggers or any content creators, books that go explain everything important about linux to get it running in an optimal and efficient way that are fun and interesting to read? From things like how the file hierarchy works, what is /etc, how to install new programs with proper permissions, when to use sudo, what is a flatpak and why use it over something else, how to backup your system so you can easily reconstruct your setup in case you need to do an OS refresh, etc? All those things that people take for granted but are actually a huge obstacle course + minefield for beginners?

And more importantly, that it's up to date with actually good advice?

11
submitted 1 month ago* (last edited 1 month ago) by Cyno@programming.dev to c/learn_programming@programming.dev

I understand the basic principle but I have trouble determining what is the hard line separating responsibilities of a Repository or a Service. I'm mostly thinking in terms of c# .NET in the following example but I think the design pattern is kinda universal.

Let's say I have tables "Movie" and "Genre". A movie might have multiple genres associated with it. I have a MovieController with the usual CRUD operations. The controller talks to a MovieService and calls the CreateMovie method for example.

The MovieService should do the basic business checks like verifying that the movie doesn't already exist in the database before creating, if all the mandatory fields are properly filled in and create it with the given Genres associated to it. The Repository should provide access to the database to the service.

It all sounds simple so far, but I am not sure about the following:

  • which layer should be responsible for column filtering? if my Dto return object only returns 3 out of 10 Movie fields, should the mapping into the return Dto be done on the repository or service layer?

  • if I need to create a new Genre entity while creating a new movie, and I want it to all happen in a single transaction, how do I do that if I have to go through MovieRepository and GenreRepository instead of doing it in the MovieService in which i don't have direct access to the dbcontext (and therefore can't make a transaction)?

  • let's say I want to filter entries specifically to the currently logged in user (every user makes his own movie and genre lists) - should I filter by user ID in the MovieService or should I implement this condition in the repository itself?

  • is the EF DbContext a repository already and maybe i shouldn't make wrappers around it in the first place?

Any help is appreciated. I know I can get it working one way or another but I'd like to improve my understanding of modern coding practices and use these patterns properly and efficiently rather than feeling like I'm just creating arbitrary abstraction layers for no purpose.

Alternatively if you can point me to a good open source projects that's easy to read and has examples of a complex app with these layers that are well organized, I can take a look at it too.

[-] Cyno@programming.dev 3 points 2 months ago* (last edited 2 months ago)

I'm not that familiar with newer c# code and only recently started with result pattern but tbh, I can't tell what is this code supposed to do. Does opt resolve to true or false in this case? Why do you want TestStringFail to always execute, and what should it return? Why is opt.None true when it was initialized with a valid string value, what does None even mean in this context?

[-] Cyno@programming.dev 5 points 2 months ago

I was so excited about Mint, seemed like the perfect distro to try but then I had nothing but issues on an laptop with nvidia. PopOS worked better right out of the box though

22

Let's say I am making an app that has table Category and table User. Each user has their own set of categories they created for themselves. Category has its own Id identity that is auto-incremented in an sqlite db.

Now I was thinking, since this is the ID that users will be seeing in their url when editing a category for example, shouldn't it be an ID specific only to them? If the user makes 5 categories they should see IDs from 1 to 5, not start with 14223 or whichever was the next internal ID in the database. After all when querying the data I will only be showing them their own categories so I will always be filtering on UserId anyway.

So let's say I add a new column called "UserSpecificCategoryId" or something like that - how do I make sure it is autogenerated in a safe way and stays unique per user? Do I have to do it manually in the code (which sounds annoying), use some sort of db trigger (we hate triggers, right?) or is this something I shouldn't even be bothering with in the first place?

[-] Cyno@programming.dev 28 points 2 months ago

You can kinda see this in things like modding communities or anything piracy related too. Users just want easy solutions even if it's at the expense of creators, and creators are doing it more and more for money rather than any personal drive or satisfaction. I can't believe we've reached a point where even mods are being locked behind paywalls, need to be commissioned or sometimes have entire teams funded by patreon to work on them, it's just another business nowadays.

5

Let's say I have a method that I want to make generic, and so far it had a big switch case of types.

For an simplified example,

switch (field.GetType()) {
case Type.Int: Method((int)x)...
case Type.NullInt: Method((int?)x)...
case Type.Long: Method((long)x)...

I'd like to be able to just call my GenericMethod(field) instead and I'm wondering if this is possible and how would I go around doing it.

GenericMethod(field)

public void GenericMethod<T>(T field)

Can I use reflection to get a type and the pass it into the generic method somehow, is it possible to transform Type into ?

Can I have a method on the field object that will somehow give me a type for use in my generic method?

Sorry for a confusing question, I'm not really sure how to phrase it correctly, but basically I want to get rid of switch cases and lots of manual coding when all I need is just the type (but that type can't be passed as generic from parent class)

17

To clarify, I mean writing scripts that generate or modify classes for you instead of manually writing them every time, for example if you want to replace reflection with a ton of verbose repetitive code for performance reasons I guess?

My only experience with this is just plain old manual txt generation with something like python, and maintaining legacy t4/tt VS files but those are kind of a nightmare.

What's a good modern way of accomplishing this, have there been any improvements in this area?

[-] Cyno@programming.dev 17 points 7 months ago

If our content gets federated to threads then it just means that google results will point to it first rather than to us, they will probably have better indexing and search features than the fediverse. People will also probably think the content originated on threads too (since that's where they see it and threads could easily obfuscate info like that) instead of who actually made it.

It could increase the short term engagement but in the long run, it will just serve to make threads better.

9

I don't have access to my router and my ISP charges for port forwarding (I think they might have a CGNAT setup?).

I'm trying to work around that since I want to start hosting some apps and game servers from my PC. I'm seeing a lot of talk about tailscale as a possible solution to this but honestly I'm a bit confused with all the options and whether this is actually the proper tool for the job.

Assuming it is, do I go the route of setting up a "tailscale funnel" or a "subnet"? Will other people have to install tailscale too if they want to join my servers? People also mention Netmaker or Cloudflared Tunnel, although it also seems like cloudflare doesn't want their tunnels used for game and media traffic?

The more expensive option I guess would be just paying for protonvp premium since it offers port forwarding in that case, but I'm not sure about performance and whether it's worth it, at that point I might just rent a server instead.

Hoping you folks at self-hosted have more ideas on how can I, well... self host instead of throwing money at the problem.

11

cross-posted from: https://programming.dev/post/6513133

Short explanation of the title: imagine you have a legacy mudball codebase in which most service methods are usually querying the database (through EF), modifying some data and then saving it in at the end of the method.

This code is hard to debug, impossible to write unit tests for and generally performs badly because developers often make unoptimized or redundant db hits in these methods.

What I've started doing is to often make all the data loads before the method call, put it in a generic cache class (it's mostly dictionaries internally), and then use that as a parameter or a member variable for the method - everything in the method then gets or saves the data to that cache, its not allowed to do db hits on its own anymore.

I can now also unit test this code as long as I manually fill the cache with test data beforehand. I just need to make sure that i actually preload everything in advance (which is not always possible) so I have it ready when I need it in the method.

Is this good practice? Is there a name for it, whether it's a pattern or an anti-pattern? I'm tempted to say that this is just a janky repository pattern but it seems different since it's more about how you time and cache data loads for that method individually, rather than overall implementation of data access across the app.

In either case, I'd like to learn either how to improve it, or how to replace it.

1
submitted 10 months ago* (last edited 10 months ago) by Cyno@programming.dev to c/csharp@programming.dev

Short explanation of the title: imagine you have a legacy mudball codebase in which most service methods are usually querying the database (through EF), modifying some data and then saving it in at the end of the method.

This code is hard to debug, impossible to write unit tests for and generally performs badly because developers often make unoptimized or redundant db hits in these methods.

What I've started doing is to often make all the data loads before the method call, put it in a generic cache class (it's mostly dictionaries internally), and then use that as a parameter or a member variable for the method - everything in the method then gets or saves the data to that cache, its not allowed to do db hits on its own anymore.

I can now also unit test this code as long as I manually fill the cache with test data beforehand. I just need to make sure that i actually preload everything in advance (which is not always possible) so I have it ready when I need it in the method.

Is this good practice? Is there a name for it, whether it's a pattern or an anti-pattern? I'm tempted to say that this is just a janky repository pattern but it seems different since it's more about how you time and cache data loads for that method individually, rather than overall implementation of data access across the app.

In either case, I'd like to learn either how to improve it, or how to replace it.

[-] Cyno@programming.dev 8 points 10 months ago

I agree completely. The discussion was what we replace English with however.

I'm not in favor of replacing English, I'm just saying if we want an alterantive I don't want it to be a nation-specific language again, so to speak.

[-] Cyno@programming.dev 6 points 10 months ago

I'm not disagreeing outright but... Why do we need more non English programming languages? Is there a specific practical reason?

The only language translation I'd maybe consider to accept in programming is Esperanto. Anything else just sounds like a terrible idea.

17

Was just wondering what's popular nowadays, maybe I find something new and better - what kind of tools are you using to access and manage databases?

I'm personally using Dbeaver a lot but honestly it feels increasingly more buggy and unreliable as time passes, every installation and update has had (unique) issues so far and there's little support. However the ease of use and some powerful, convenient, utilities in it make it preferable to others.

[-] Cyno@programming.dev 3 points 11 months ago

I use the CLI for simple commands, especially if helping someone on another PC and I don't have access to my preferred tool, but I honestly don't get people who use it religiously and never even try tools with GUIs. The convenience of being able to easily see the commit history, scroll through it, have a right click context menu or ability to just click it and see file changes (and then right click those files for additional options), is just something I can't abandon. Nowadays even the aliasing can be replicated in those tools if they support creation of custom commands so even that is a moot point - with some setup you can be as fast as with a CLI.

view more: next ›

Cyno

joined 1 year ago