Programming thread

and?

Completeness and usefulness are two distinct things. You can do everything in Brainfuck, but you probably shouldn't.
That's actually my point lol.


became very handy for throwing HTML together.
This reminds me, I learned how to use a library called cheerio and it's super useful. I can insert the header into my html files server side instead of inserting it with a template literal.

Extremely fucking useful, and far less niggerlicious than what I was doing before.
 
If my choices were still either just Perl or one or more of C, $SHELL, sed and awk I would absolutely be writing tons of Perl today. I've fixed ./configure scripts by hand before. Shell (which IIRC used Perl to do some heavy lifting in those scripts) is an abomination in comparison.
Personally, I blame the abysmal Unix shells for the modern Tower of Babel of shitty low-effort scripting languages that are largely indistinguishable. It's very easy to make something better if your point of comparison is Bourne shell.
 
I finally have a new phone that's not a piece of shit and I was wondering if anyone knows if there is a way I can access vs code remotely and work on my project while I'm smoking a cigarette.
 
Not sure about vs code but you could just ssh into your dev machine with termux, then use a normal text editor of your choice.
I've never used VS Code, preferring Vim and now Neovim, but you can do SSH with VS Code apparently:
EDIT: I realized ${Sandy} doesn't want this exactly but rather wants to code on their phone. Maybe one could use AnyDesk or something from a phone to control VS Code elsewhere but I don't recommend coding with a smudgy tap-and-pray keyboard even with a decent phone.
 
Last edited:
  • Thunk-Provoking
Reactions: Zeftax and y a t s
Not sure about vs code but you could just ssh into your dev machine with termux, then use a normal text editor of your choice.
I'll have to look into that.

Also, I'm working with express and cheerio and I wanted to try and make a universal get method for site navigation and it worked on the first try. I thought my idea wasn't gonna work properly because programming can be fickle. So I'm proud that this worked.

JavaScript:
app.get('/:path', (req, res) => {
    const Sandy = req.params.path;
    const path = `${_dir}${Sandy}.html`;
    const $ = loadHtml(path);
    $('#header').replaceWith(req.headerHTML);
    res.send($.html());
})
 
  • Feels
Reactions: Belisarius Cawl
Maybe one could use AnyDesk or something from a phone to control VS Code elsewhere but I don't recommend coding with a smudgy tap-and-pray keyboard even with a decent phone.
I think just using plain text connection as I described will be more comfortable than trying to go visual and tapping on stuff (although apparently an X server for android does exist https://f-droid.org/en/packages/com.stripe1.xmouse/). I have used the setup I described many times to either control inaccesible raspberries with no interface equipment or to fix something on my website when I am not at home and have nothing but my phone. Typing obviously isn't as easy as on a normal keyboard but sometimes I don't have a laptop on me... I also prefer neovim btw. although I have been toying with emacs a bit lately - that would be a true nightmare on a phone keyboard though lol.
 
I think just using plain text connection as I described will be more comfortable than trying to go visual and tapping on stuff (although apparently an X server for android does exist https://f-droid.org/en/packages/com.stripe1.xmouse/). I have used the setup I described many times to either control inaccesible raspberries with no interface equipment or to fix something on my website when I am not at home and have nothing but my phone. Typing obviously isn't as easy as on a normal keyboard but sometimes I don't have a laptop on me... I also prefer neovim btw. although I have been toying with emacs a bit lately - that would be a true nightmare on a phone keyboard though lol.
JuiceSSH has an inexpensive one-time upgrade to Pro for all devices
 
  • Like
Reactions: BIG BILL HELL'S
Dicking around in SWI-Prolog, randomly wondered how to write a binary float. The language's author: "That's too low-level for me to care about." The community: "Use [Google's] Protocol Buffers." There's a predicate to convert float to codes in the protobuf package. This is reassuring to me; the author is truly committed to the bit, and protobufs are a great approach for binary work.

 
What are some good C++ IDEs (ideally foss)? I use nvim for most of my personal projects (and I have that set up for minimal distractions just text editor and want to keep it that way) and VS at work. But now I want to patch some SW that is not mine so I'd appreciate symbol definition and usage seek across the whole project to orientate myself. I think I'll try this guide to set up emacs as a C++ ide, but I'm interested what other people use.
 
What are some good C++ IDEs (ideally foss)? I use nvim for most of my personal projects (and I have that set up for minimal distractions just text editor and want to keep it that way) and VS at work. But now I want to patch some SW that is not mine so I'd appreciate symbol definition and usage seek across the whole project to orientate myself. I think I'll try this guide to set up emacs as a C++ ide, but I'm interested what other people use.
I use clangd with nvim.
BTW. You can force neovim to load different configs using nvim -u "path" if you like it, but would like to have config for it as basic text editor and IDE separately.
 
What are some good C++ IDEs
If you do something vaguely serious, you will want very good debugging tools. Visual Studio is very good. JetBalls is fine. Visual Studio Code is less good.
If you really want foss than just vim/emacs, but the tooling will be worse than a complex GUI IDE.
 
  • Thunk-Provoking
Reactions: Belisarius Cawl
If you do something vaguely serious, you will want very good debugging tools. Visual Studio is very good. JetBalls is fine. Visual Studio Code is less good.
If you really want foss than just vim/emacs, but the tooling will be worse than a complex GUI IDE.
I do have experience with visual studio from work (C#), but I really don't want to shit up my main computer with proprietary software. I use nvim as my main text editor, but never needed more complex feature built in because I can find my way around my files and I do building/debugging from a console separate from the editor. I have minimal experience with emacs. I really just need the symbol seeking in the actual editor.

The nvim custom config file seems really nice for some of my work, but so far I think I will try out the emacs plugin I linked, without the autocompletion though, I always found that very annoying in the "complex" IDEs, who wants some random popups obscuring the source file or even influencing the way you type?
 
I do have experience with visual studio from work (C#), but I really don't want to shit up my main computer with proprietary software. I use nvim as my main text editor, but never needed more complex feature built in because I can find my way around my files and I do building/debugging from a console separate from the editor. I have minimal experience with emacs. I really just need the symbol seeking in the actual editor.

The nvim custom config file seems really nice for some of my work, but so far I think I will try out the emacs plugin I linked, without the autocompletion though, I always found that very annoying in the "complex" IDEs, who wants some random popups obscuring the source file or even influencing the way you type?
If you're already using NVIM, you likely have a good understanding of configuring it. I'd probably go for Clangd as a language server and call it a day.
 
I'm job hunting, and some recruiter called me and quizzed me on some random programming factoids. I got most of them right, but that sort of shit is so pointless.

Like, to be sure, when you're actively employed, it's good to have most of the basics of your current job's toolset on the brain, in your immediate memory, just for efficiency's sake. The obscure stuff you'll probably look up in the documentation on the fly, but knowing how to handle common database fuckups or weird common corner cases with a given library, blah blah blah, it's probably good to be familiar with your tools in that sense.

But while I'm unemployed? Job hunting? The quizzicles don't really tell you anything. Right now I'm interviewing for basically any job I can get. I have bills to pay. I'm hoping for Golang, but I'll take Python or Node JS if necessary. If you asked me about some weird corner behavior of Python's object model, I'd say "lol I don't know" and write up a quick script and test it.

The only people who are good at these quizzicles are those dumbass pajeets who memorize dictionary definitions of encapsulation and inheritance. The types of programmers who can recite to you the blurbs almost verbatim from the textbooks, but who are incapable of actually putting together a sane design in practice.

The questions were:
1. In C++, can a constructor call a virtual method? I didn't know this one.
2. In C++, what's the performance of a lookup for the standard map container? I 100% guessed at this, that it was O(log n). That's the only thing that would make sense for a map structure with arbitrary key types.
3. In Linux, what's the standard process to spawn a subprocess? This was easy, fork() then exec().
4. Also in Linux, what are your options for inter process communication? This was also easy, sockets, pipes and mmap.

The last two are pretty reasonable questions, but the first two are stupid and I really doubt they're useful at sussing out actually good programmers vs someone who can just memorize bullshit.
 
Julia is a fantastic language btw, very nice, consistent, fundamentally functional, and fast, with a nice type system while staying familiar to anyone who has done a bit of Python.
I remember reading about problems in paradise. Julia allows a lot of flexibility, but it doesn't work well:
https://yuri.is/not-julia/ (archive)
Given Julia’s extreme generality it is not obvious to me that the correctness problems can be solved. Julia has no formal notion of interfaces, generic functions tend to leave their semantics unspecified in edge cases, and the nature of many common implicit interfaces has not been made precise (for example, there is no agreement in the Julia community on what a number is).
I've never used Julia, but I learned a little from the discussion about that piece too:
https://news.ycombinator.com/item?id=31396861 (archive)
StefanKarpinski said:
Several of the bugs that Yuri reported are a very specific case of this: there's a lot of generic code that assumes that array indexing always starts at one, but that's not always the case since OffsetArrays allow indexing to start anywhere. The older code in the stats ecosystem is particularly badly hit by this because it often predates the existence of OffsetArrays and the APIs that were developed to allow writing efficient generic code that works with arrays that don't start at the typical index (or which might even want to be iterated in a different order).

Fixing these specific OffsetArray bugs is a fairly straightforward matter of searching for `1:length(a)` and replacing it with `eachindex(a)`. But there's a bigger issue that this general problem raises: How does one, in general, check whether an implementation of an abstraction is correct? And how can one test if generic code for an abstraction uses the abstraction correctly?
I can only explain how Ada does this. Basically, Ada defines a few kinds of types and their attributes. For any one-dimensional array A, I can use A'First to get its first index, and A'Last similarly for the last. I can use A'Length to gets its length as an integer. Ada doesn't require arrays to be indexed by integers, merely anything isomorphic to integers. Of course, in Ada Land, I don't think the term isomorphism ever comes up, since it's actually a simple concept.

Ada doesn't make it easy to write extremely generic code for types that don't have a common shape like an array or the other common kinds of types, but that's a minority of code in Ada Land. It can still be fucked up in Ada, but the language makes it harder to do. I'm clearly biased as hell, but Ada really made me appreciate interface design more.

So, tell me more about Julia. I'm curious if any of these problems pop up regularly for most people using the language or not.
 
So, tell me more about Julia. I'm curious if any of these problems pop up regularly for most people using the language or not.
That does sound pretty bad, though I am not a regular user and have not run into things like this. My experience is a physics simulation for uni and a little serial RPC controller for fun, both of which seem to work fine and which liked writing more than I did Python as I vastly prefer Julia type system to Python intrinsic OOP. I can also say anecdotally that some people in my field adopted it for their own larger projects as well. Superficial search around for correctness discussions brings up threads from around 2023 so I would hope :optimistic: things have improved significantly
 
Last edited:
Found this reply and was curious what uv was.
I think using a venv, containers, or multiple versions are definitely skills anyone dabbling in python should understand. If you don't understand library conflicts or issues with different library versions you've definitely got a bunch left to learn
>except for where it isn't because python is slow
Except that languages are just tools and fanboying or hating on a language is autistic. Have you ever seen handymen simp their tools? "Oh I don't use that pussy ass screwdriver, a hammer is all I need baby". That sounds dumb? Exactly! Now before you yell, yes, I hate javascript developers too, but not because of the language, because they're fucking retarded.

Python is very easy to understand, very easy and fast to write, and as any other language in this world you can call outside programs with it, including C, Rust and any other fast language you want. LLMs are also highly trained on it, so they can speed up work by dealing with annoying boilerplate for you similar to how IDE autocomplete does. There's plenty of reasons to use python, and if you have 2 brain cells you can figure out using C bindings or whatever else for speed.

The point of programming is problem solving, so if your problem is "I need to do this thing fast, but my language is slow" then to solve it you replace the slow part with a binding to another language. Done! And what does slow even mean? For the things I've needed Python I've never hit any sort of ceiling in performance, and if I do I can just use existing bindings or make myself some C/Rust/Go/etc code

I don't even write in python that much, I just think it's very easy and convenient, and most people complaining about speed probably have never made software that other people use.

I'd assume anal rapist is just kidding around, but the general sentiment online really is "haha imagine using <tool>"
 
Back