Programming thread

  • 🐕 I am attempting to get the site runnning as fast as possible. If you are experiencing slow page load times, please report it.
Something that I found especially annoying is the need to keep around opened files even if they are unlinked from the file tree itself. You could of course give an I/O error if an operation is performed on a "deleted" file (or vice versa: prevent deleting open files) but it will break a lot of programs (even coreutils!) if you try to do that.
While annoying to an implementor, this is extremely useful for the user because it means deletion essentially can't fail. Windows actually allows you to prevent deletion of a file if you open it in the right mode and it's infuriating to have to hunt down that one nigger program that's keeping an irrelevant file handle around or add error handling for this anti-feature.
 
Thx for the answers, as for what @macrodegenerate said I actually do agree that dependecy injection and TDD are goats if not a little bit slow sometimes, I'll be checking out kotlin. As for what @Marvin said, I might finally stop being lazy and learn GO, I was always kind of intimidated by syntax and the general way of doing things, it seemed overcomplicated but performance is really good too so it might be worth it.
If you're open to a more functional language, you may take a look at Elixir. I think the learning curve might be hard, but for webapps and everything to do with networking it's a beast.

Elixir is btw where most Ruby developers went to.

While I don't program PHP myself, I heard multiple people around me that it got very nice and readable with newer versions. So if you're not a functional language person, you could give PHP another chance. With Laravel etc it's a whole different experience.
Surprised to see an Elixir recc here, always thought it was memey and a fad, I'll be checking it out! I have horrible PHP and vanilla java memories from uni, hope laravel and kotlin change that.
 
The only problem with kotlin is being stuck with jetbrains ide, there's no official LSP implementation, also the memory usage and CPU usage is higher for compilation obviously (in our project it went so high as to error out and require a special Gradle flag to increase the compilation heap size to 4gb). Putting that aside, the language itself is great and if you're using Java there's no reason not to use Kotlin due to the near? 100% interoperability. My favorite feature is fixing Java's generics type erasure with the reified keyword.
 
The only problem with using the road is that you are stuck with a car if you want to go fast.
I've used jetbrains products for years, they're fantastic, but if your going to be forced into using a specific ide by choosing kotlin it's relevant to the pros and cons. One thing I will say is intellij has the best tooling for Java/Kotlin and it's not even close, I've never experienced another ide that has such power with any language. I use codium/vscode because it just werks but I would much sooner switch to nvim if I wanted a different ide unless I was doing Java specifically, but to each their own.
 
I've used jetbrains products for years, they're fantastic, but if your going to be forced into using a specific ide by choosing kotlin it's relevant to the pros and cons. One thing I will say is intellij has the best tooling for Java/Kotlin and it's not even close, I've never experienced another ide that has such power with any language. I use codium/vscode because it just werks but I would much sooner switch to nvim if I wanted a different ide unless I was doing Java specifically, but to each their own.
In the context of Android Development is there even another IDE someone would use? Android Studio is Jetbrains/intellij and I haven't seen anything even remotely within the same realm of use for Android Development. Assuming Android Development is what you mean for kotlin/java.
 
I've used jetbrains products for years, they're fantastic, but if your going to be forced into using a specific ide by choosing kotlin it's relevant to the pros and cons. One thing I will say is intellij has the best tooling for Java/Kotlin and it's not even close, I've never experienced another ide that has such power with any language. I use codium/vscode because it just werks but I would much sooner switch to nvim if I wanted a different ide unless I was doing Java specifically, but to each their own.
Idea Ultimate is legit the best IDE I've ever used bar none. It seemlessly supports every language except for C and the Microsoft shit. Being able to do everything from coding to database management to endpoint testing and S3 storage in a single program is absolutely nuts. It even let's you generate database ORM objects automatically in some cases. The only problem is that it can get kind of beefy at times.

Edit:If you want to buy and you don't care about C or the Microsoft or iOS stuff, you can save $100 by just buying ultimate and using plugins instead of the whole products pack.
 
Last edited:
to have to hunt down that one nigger program that's keeping an irrelevant file handle around or add error handling for this anti-feature.
Even on Linux there's lsof, so this shouldn't be a problem.

Also, another problem with keeping files around if a process has them open is that disk space doesn't get freed. Particularly annoying if you have a VPS with a tiny amount of disk space and you want to delete e.g. a bloated log file, only to find disk usage isn't going down. (lsof helps with resolving such cases too).

(IMO the right thing to do would be to allow deleting the file at any time, but return an error to whatever processes have it open and try to perform I/O on it instead of keeping it around)
 
Last edited:
Even on Linux there's lsof, so this shouldn't be a problem.

Also, another problem with keeping files around if a process has them open is that disk space doesn't get freed. Particularly annoying if you have a VPS with a tiny amount of disk space and you want to delete e.g. a bloated log file, only to find disk usage isn't going down. (lsof helps with resolving such cases too).

(IMO the right thing to do would be to allow deleting the file at any time, but return an error to whatever processes have it open and try to perform I/O on it instead of keeping it around)
The Windows method is a problem because the removing program now has to care about a situation that it can't possibly resolve, requiring user intervention. This is why you regularly see these pointless "Well fuck, wanna try again?" popups.

Your method wouldn't be the worst, but I still think it's inferior to the Unix method because its only advantage is that you can be sure disk space is reclaimed immediately, which rarely matters. When it does matter, a human who can simply check lsof if necessary will already be involved because ensuring enough space is an administrative task.

Turning deletion during use into an error doesn't really add anything to the affected programs either. Does a program care that the data it's reading or creating has been made unavailable shortly before close(), as opposed to shortly after close()? Not really. This just makes deletion slightly more fragile because it's more likely to cause problems in other programs now. It's the equivalent of turning pointers with reference counting into weak pointers.
 
While annoying to an implementor, this is extremely useful for the user because it means deletion essentially can't fail. Windows actually allows you to prevent deletion of a file if you open it in the right mode and it's infuriating to have to hunt down that one nigger program that's keeping an irrelevant file handle around or add error handling for this anti-feature.
And the worst is when Windows itself has a bunch of file locks that are held by sihost.exe because whatever the fuck it needs to do with the files got deadlocked for some reason and the only way to release the files is to kill it.
 
Man back at square one but this time learning phyton. Gonna try to make simple pinball game. I hate programing with my burning passion but i keep coming back to it for some reason
I tried quitting at least 4 times and every time i come back randomly to try and make some kind of game regardless with each attempt giving me some form of progress even if i relied on tutorials
The most i did was tried making a tower defense game and made enemies walk down paths and come in rounds but that was long ago when i was younger and it was on baby shit programs (Roblox studio)
 
Last edited:
Man back at square one but this time learning phyton. Gonna try to make simple pinball game. I hate programing with my burning passion but i keep coming back to it for some reason
I tried quitting at least 4 times and every time i come back randomly to try and make some kind of game regardless with each attempt giving me some form of progress even if i relied on tutorials
The most i did was tried making a tower defense game and made enemies walk down paths and come in rounds but that was long ago when i was younger and it was on baby shit programs (Roblox studio)
Speaking of Python game dev I liked this guy's video about his journey using Python for games
 
Just steal a bootstrap template, and mod it to get what you want.
Well, fortunately what I'm doing now is just a very minimal demo. It's just that any time I touch HTML/CSS I end up shitting out some geocities tier garbage that I know looks bad but I cannot figure out how to fix
 
Well, fortunately what I'm doing now is just a very minimal demo. It's just that any time I touch HTML/CSS I end up shitting out some geocities tier garbage that I know looks bad but I cannot figure out how to fix
Use tailwind, its the best CSS library and makes building modern web uis easy without forcing you to use pre built components like bootstrap. The default styling is also sane so if you just add some text or normal HTML noob shit without using tailwinds CSS primitives or any custom css it'll come out looking like you know what you're doing even if you don't.
 
A bit of a noob question, but does anybody know the best way to cache a large amount of URLs in Python? I wanted to improve image loading for previously loaded images for a project I'm working on.
 
A bit of a noob question, but does anybody know the best way to cache a large amount of URLs in Python? I wanted to improve image loading for previously loaded images for a project I'm working on.
Are you the server or the client?
 
A bit of a noob question, but does anybody know the best way to cache a large amount of URLs in Python? I wanted to improve image loading for previously loaded images for a project I'm working on.
If you're reading and serving images from files then you're not going to get anything better than the filesystem cache that your OS already has by default.

If you want to try though, extend the default dict, use the URL as a key and overload __missing__ to fetch the image if it's not already in there. This will keep them in memory forever until you specifically go in and set the value of a key to None so the garbage collector picks it up next run.
 
  • Agree
Reactions: y a t s and Marvin
Back