It is easier to optimize correct code than to correct optimized code. - Bill Harlan

1
454
submitted 18 hours ago by [email protected] to c/programmer_humor
2
21
submitted 2 hours ago* (last edited 2 hours 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!

3
1109
submitted 1 day ago by [email protected] to c/programmer_humor
4
17
submitted 13 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.

5
3
submitted 1 hour ago by [email protected] to c/vuejs

I was just thinking it would be cool if at conferences the @vuejs team gave out little bottles of condiments to attendees - Vue Sauce

Who doesn't like sauce?

6
17
submitted 5 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.

7
12
submitted 5 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

8
218
Go vs Rust learning (programming.dev)
submitted 1 day ago by zinderic to c/programmer_humor
9
1
submitted 2 hours ago by SmartmanApps to c/dotnet
10
20
submitted 22 hours ago by [email protected] to c/terraform
11
144
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?

12
77
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

13
15
Raspberry Pi Ltd is considering an IPO (www.londonstockexchange.com)
submitted 15 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")."

14
6
submitted 5 hours ago by [email protected] to c/demoscene
15
7
wxWidgets 3.2.5 Released (www.wxwidgets.org)
submitted 6 hours ago by lysdexic to c/cpp
16
3
submitted 5 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?

17
7
submitted 7 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.

18
5
submitted 7 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! :)

19
56
submitted 1 day ago by ChubakPDP11 to c/rust

I thought this might interest you Rust folk. This is kinda like an LLVM bitcode to JVM bytecode translator. So run rustc with --emit=llvm-ir (I think that's the flag) and then pass the bitcode image to this program, then get JVM bytecode which you can make a JVM bytecode archive (JAR) from it. Could be an interesting? The author says it can JVM code from Clang output, so why not Rustc?

Keep in mind that these are two different beasts, JVM is designed for a safe virtual machine and LLVM is chiefly used to be translated into machine code. However, stupider and more wonderful things have been done with LLVM and JVM, for example, there's an LLVM to 6502 translator, so you could be making NES games with Rust.

I will test this in a few days, busy implementing my own JVM (hope I can do it) and I don't have the Rust toolchain installed on my system. But hey maybe someone can make a Cargo plugin from it (is it possible?)

Thanks, later.

20
11
submitted 18 hours ago by nieceandtows to c/meta

Invalid SSL certificate Error code 526

Including for me.programming.dev

21
13
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.

22
7
submitted 1 day 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

23
75
submitted 1 day ago by ChubakPDP11 to c/programmer_humor
24
500
submitted 2 days ago* (last edited 2 days ago) by [email protected] to c/programmer_humor
25
7
Day 9 - Diving into networking (linuxupskillchallenge.org)
submitted 9 hours ago by livialima to c/linuxupskillchallenge
view more: next ›

programming.dev

8,236 readers
459 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