202 Accepted - ๐Ÿฑ

1
10
submitted 3 hours ago by [email protected] to c/vscode

Is there an extension that allows for automatic stashing on branch switch like GitHub desktop does?

There was an a proposal about it, but it got declined: https://github.com/microsoft/vscode/issues/86668

2
1
submitted 18 minutes ago by SmartmanApps to c/dotnet
3
4
submitted 20 minutes ago* (last edited 12 minutes ago) by [email protected] to c/programming

So I've come to the point where I've wanted some to see some features on the software I regularly use and I feel confident enough that I can pull it off. However, once I start getting into it, it all becomes so overwhelming that it's hard to get anything done.

For instance, on more than one occasion I had trouble getting the projects to build on my machine (eg., unsupported OS, lack of documentation, etc.) and it left me unable to write a single line of code making the experience frustrating from all the time wasted that I had to move on.

Other times, I recognize some the patterns and get the general gist of some snippets, but the overall code seems so convoluted to me that I don't even know where to start to analyze a solution, even though if it'd probably take ten lines to implement.

For context, I've been more of a hobbyist programmer for the great majority of my life with a bit of schooling. I do have various finished apps under my belt so I'm definitely not new. But I have no reference for how long a feature should take to implement in someone else's code for the average Joe who does this for a living.

So I'm left wondering: What advice do you have that could make this all more accessible to someone like me? Do you have a general strategy to get started? How long does it take you from start to finish? And if you run into issues, where do you seek help without nagging the devs about their code who may take too long to respond to be of use?

Many thanks for the feedback in advance!

4
428
submitted 16 hours ago by [email protected] to c/programmer_humor
5
16
submitted 11 hours ago by [email protected] to c/ask_experienced_devs

Hello. Like many of you I've been affected by the wave of layoffs and am struggling to even get a response for most of my applications.

I've recently been talking to a local manufacturing plant about employment regarding full stack development, but they told me they would only be willing to contract me. While this still leaves me without health insurance (USA), beggars can't be choosers.

The issue is, I'm early in my career and have never dabbled in contract work. They haven't been specific about what they want to contract me for as well, just asked me for an hourly rate.

I unfortunately have to dox myself, but I would really appreciate if anyone could take a look over my portfolio/resume and let me know what my worth is. Granted I would likely charge more if I was writing them a high performance Rust program as compared to some Python scripts, but I don't think I have the luxury of nuance.

Thank you, I appreciate it.

https://johnrigoni.me

Aside: I have an appointment to get a professional headshot next week, I know it's not great.

6
1105
submitted 1 day ago by [email protected] to c/programmer_humor
7
15
submitted 3 hours ago by [email protected] to c/programming

Thanks to the current SEO nightmare, I can no longer use search engines the same reliability as before. Stackoverflow is too toxic and often all I need is to properly look up some more obscure stuff about some API, which "could just be googled". AI, of course, is very unreliable.

Searching code on Github, then adjusting it in many ways to my needs (like to a different language, renaming variables to make more sense, additional optimizations, etc.) seems way more feasible nowadays. However, while there's a lot of code with very permitting licenses (including public domain licenses), others are not so much, and I don't want to argue against them, often I'm even understanding the reasons behind their decisions. I even try to give credit wherever I can, or look up the original source of an algorithm I find being referenced by someone else.

8
5
submitted 3 hours ago by [email protected] to c/demoscene
9
6
submitted 22 hours ago by [email protected] to c/visualstudio

Is there an extension that allows for automatic stashing on branch switch like GitHub desktop does?

There was an a proposal about it, but it got declined: https://github.com/microsoft/vscode/issues/86668

10
3
submitted 3 hours ago by secana to c/nix

Hi,

I want to sort my bookmarks in Firefox with home-manager into folders, but fail.

Simple example:

firefox = {
      profiles."user" = {
        bookmarks = [
          {
            name = "Nix";
            toolbar = true;
            bookmarks = [
              {
                name = "NixOS Search";
                url = "https://search.nixos.org/packages";
              }
              {
                name = "NixOS Options";
                url = "https://nixos.org/manual/nixos/unstable/options";
              }
              {
                name = "Home-Manager Options";
                url = "https://nix-community.github.io/home-manager/options.xhtml";
              }
              {
                name = "Home-Manager Options Search";
                url = "https://home-manager-options.extranix.com/";
              }
            ];
          }
        ];
      };

My assumption was that I get a folder "Nix" in the bookmarks toolbar that contains the four bookmarks. But instead the four bookmarks are added to the toolbar side-by-side without being in a folder.

How can I achieve that?

11
16
submitted 20 hours ago by [email protected] to c/terraform
12
4
submitted 5 hours ago by [email protected] to c/javascript

I can do this manually using the following: Right-click on the video player, copy debug info, paste into text editor, and Ctrl+F for "addocid".

What is the best way to do this automatically?

By modifying an ad accelerator I found, I can reliably detect when a pre-roll ad is playing:

function handleVideoAd() {
	const video = document.querySelector('video');
	const adElement = document.querySelector('.video-ads.ytp-ad-module');
	if (video && adElement && adElement.children.length > 0) {
		alert('advertisement found!')
	}
}

function initializeAdHandling() {
	handleVideoAd();
	const observer = new MutationObserver(handleVideoAd);
	observer.observe(document.body, { childList: true, subtree: true });
}
initializeAdHandling()

If I had the video ID, I could then open the video in a new tab using something like:

window.open('https://www.youtube.com/watch?v=adVideoID');

However, I am at a bit of a loss as to how to extract the ad video ID itself.

In the browser inspector, the only places I can find the ad video ID are:

  1. Within the URL for ytp-cued-thumbnail-overlay-image
  2. As adVideoId within var ytInitialPlayerResponse, which itself is within <script nonce="rwc3vYf3vRLEyNQKsJOgig">, where rwc3vYf3vRLEyNQKsJOgig changes with every video.

What would be the best way to extract the advertisement video ID?

Apologies for if I'm going about this the wrong way. I am (very!) new to JavaScript, but interested in learning. Please let me know if I've broken any community rules, or committed any other sort of faux pas. Thanks! :)

13
6
wxWidgets 3.2.5 Released (www.wxwidgets.org)
submitted 4 hours ago by lysdexic to c/cpp
14
217
Go vs Rust learning (programming.dev)
submitted 1 day ago by zinderic to c/programmer_humor
15
14
Raspberry Pi Ltd is considering an IPO (www.londonstockexchange.com)
submitted 13 hours ago by [email protected] to c/raspberry_pi

"Raspberry Pi Ltd, a leader in low-cost, high-performance computing, announces that it is considering an initial public offering (the "IPO" or the "Offer") and that it intends to publish today a registration document (the "Registration Document"). The Company is considering applying for admission of its ordinary shares to the premium listing segment of the Official List of the FCA and to trading on the Main Market of the London Stock Exchange ("Admission")."

16
6
submitted 5 hours ago by [email protected] to c/latex

cross-posted from: https://beehaw.org/post/13830031

Just learning LaTeX; apologies for the noobie-type question.

17
76
submitted 1 day ago by onlinepersona to c/programming

I've heard it thrown around in professional circles and how everybody's doing it wrong, so.. who actually does use it?

For smaller teams

"scaled" trunk based development

18
143
submitted 1 day ago by [email protected] to c/programming

Start learning at 50

I've always wanted to learn programming. I've read a blog post saying that at this age it was to late . Then I read a post here in saying the opposite. I've found a site that was learn x in y minutes where it has a bunch of languages there. After reading them, the languages that caught my attention were Julia, Clojure and Go. Are any of these good for a beginner or should I start with something else? I know what are variables, can spot an if/else statement but that's about it. What are some good resources for someone like me who likes to learn by doing things?

19
3
submitted 16 hours ago* (last edited 16 hours ago) by Hammerheart to c/linux4noobs

I have been using sway (basically i3 for Wayland) instead of a traditional desktop environment because it really makes a difference in my laptops performance.

But apparently sway ignores .desktop files which was how i was autostarting things on KDE.

Is the best way to handle this by going through the sway config? If not, how would you do it.

Bonus points if you can tell me how to get the autostart programs to also open in specific workspaces.

20
10
submitted 16 hours ago by nieceandtows to c/meta

Invalid SSL certificate Error code 526

Including for me.programming.dev

21
143
submitted 3 days ago by [email protected] to c/programmer_humor
22
6
Day 9 - Diving into networking (linuxupskillchallenge.org)
submitted 8 hours ago by livialima to c/linuxupskillchallenge
23
11
submitted 1 day ago by ChubakPDP11 to c/rust

Over the years, up until Rust, there were 4 ways to have a 'safe' language:

  • A virtual machine (e.g. most languages today)

whether it's a high-level (scripting languages) one or low-level one (JVM, CLR)

  • What C++ and similar languages do, destructors, compile-time bound checks, make a global heap and shit in it, make a local stack and piss in it, etc (basically my AllocPPx.pl but baked into the language)
  • Bake the VM in with the machine code. That's what D and Go do, and I think Nim does that too. This will make the point of your language being compiled entirely moot imo.
  • Finally, the most 'controversial' decision for imperative-loving chuds: make a functional language. ML/Scheme/CLisp achieve memory safety through closures. Haskell achieves this through Monads. Functional languages have a property which allows them to be be both compiled into machine code and bytecode, and also, interpreted like an scripting language.

The problem with all these approaches is the trade-off between safety and speed. There's another factor, and that is low-level access to the system. Languages like OCaml came close to achieving a balance, and that's why Rust bassed itself on it.

Most imperative languages have 'operational semantics', but not 'denotational semantics'. You can't describe what C does with math. What C does depends on the platform, the CPU, etc.

Rust's safety is achieved by 'flattening out' the memory model of a functional language like Ocaml. OCaml is a language with denotational semantics, because it's a functional language. Rust is an imperative language but it has denotational semantics. At least when comes to memory management.

I am not going to even attempt to describe the denotational semantics of Rust because I am just an amatuer and i don't have a master's in LDT. But if someoen tries, they could.

I think people might have already done it. I am not sure.

If you tell me no, and Rust does not have denotational semantics, I stand by my great-great grandfather's barber's grave that yes, it does!

So why do I say Rust 'flattens out' the functional model for memory management? It does at least with lifetimes. So imagine this: lifetimes are just 'let' bindings, but with a different syntax.

OCaml:

let rec factorial = function
  | 0 -> 1
  | n -> n * factorial (n - 1);;

Scheme

; This uses `let` under the hood
(define (factorial n)
  (if (<= n 1)
      1
      (* n (factorial (- n 1)))))  

So these two in Rust would be:

fn factorial<'a>(n: u32) -> u32 {
    match n {
        0 => 1,
        _ => n * factorial(n - 1),
    }
}

I know 'a is almost useless here, but what I meant was, that 'a makes it similar to the 'let' bindings in the prior to examples!

Semantics here is clear. Right?

But C:

int factorial(int n)  {
   if (n == 0) return 1;
   else return n * factorial(n - 1);
}

We do have operational semantics here, but who's to say what are the denotational semantics? Right? What is a 'function' in C? Well most C compilers translate it to an Assembly subroutine, but what if our target does not support labels, or subroutines?

You see what I am arriving at?

Conclusion

Rust is a semi-functional, semi-imperative language, but the difference between Rust and other languages with functional aspects is: denotional semantics!

Note: A language having lambda closures does not make it 'functional', you can do that in GNU C too ffs! Denotational semantics make it functional.

24
5
submitted 1 day ago by ChubakPDP11 to c/c_lang

TCC fails with GNU's regex.h:

echo '
                                              #include <regex.h>

                                              int main() { return 0; }' | tcc - -run
In file included from -:2:
/usr/include/regex.h:682: error: '__nmatch' undeclared

Would building it from source fix the issue? I know from my experience that Pop_OS! apt repositories are not very up-to-date with smaller apps. For example, NekoVM is from 2017, the latest one is from 22 I believe.

25
32
submitted 2 days ago by ICastFist to c/programming

Video is nearly 3 years old now, but I think it's worth watching. Her presentation starts at around 2:30.

Basically, she explains how Redbean, a tiny (~450kb) and very fast C http server, works and how the same executable can be used to deploy it on most operating systems (she starts explaining that around 14:30)

Justine is also the mind behind Sector LISP, Lambda Calculus in 383 bytes, considerable optimizations to LLamaAI, plus several other things.

view more: next โ€บ

programming.dev

8,236 readers
419 users here now

Welcome Programmers!

programming.dev is a collection of programming communities and other topics relevant to software engineers, hackers, roboticists, hardware and software enthusiasts, and more.

The site is primarily english with some communities in other languages. We are connected to many other sites using the activitypub protocol that you can view posts from in the "all" tab while the "local" tab shows posts on our site.


๐Ÿ”— Site with links to all relevant programming.dev sites

๐ŸŸฉ Not a fan of the default UI? We have alternate frontends we host that you can view the same content from

โ„น๏ธ We have a wiki site that communities can host documents on


โš–๏ธ All users are expected to follow our Code of Conduct and the other various documents on our legal site

โค๏ธ The site is run by a team of volunteers. If youre interested in donating to help fund things such as server costs you can do so here

๐Ÿ’ฌ We have a microblog site aimed towards programmers available at https://bytes.programming.dev

๐Ÿ› ๏ธ We have a forgejo instance for hosting git repositories relating to our site and the fediverse. If you have a project that relates and follows our Code of Conduct feel free to host it there and if you have ideas for things to improve our sites feel free to create issues in the relevant repositories. To go along with the instance we also have a site for sharing small code snippets that might be too small for their own repository.

๐ŸŒฒ We have a discord server and a matrix space for chatting with other members of the community. These are bridged to each other (so you can interact with people using matrix from discord and vice versa.

founded 11 months ago
ADMINS