-
11 votes
-
AT Protocol (Bluesky): Call for Developer Projects
15 votes -
Good software development habits
22 votes -
Why I will always be angry about software engineering
34 votes -
Moving my game project from C to Odin language
15 votes -
Cmake strategies or alternatives for building (different) code for different platforms
Okay, so this is getting really long, I'll put the ask up front: I have a strategy, I think it is reasonable. Now is a point where I can easily change things, and it won't be so easily later. So...
Okay, so this is getting really long, I'll put the ask up front: I have a strategy, I think it is reasonable. Now is a point where I can easily change things, and it won't be so easily later. So I'm looking to see if anyone has trod this road before and can recommend any of:
- a different build system that will be easier to manage for this use case
- a different strategy for using cmake that will be easier to manage
- any gotchas I should be aware of, even if you don't have better solutions.
Background
I have a project I'm working on where the ultimate deliverable will be a hardware device with 3-4 different microcontrollers coordinating with each other and interacting with a PC-ish platform. This is a clean rewrite of a C++ codebase. Due to the microcontroller (and some of the PC APIs) being C++, the language of choice for most of it is likely to remain C/C++.
I'm succeeded in setting up a build system for embedded code. The old code was arduino, so it relies a lot on those libraries, but I've managed to set up enough custom cmake to get off of the ardunio tools altogether, even if I am borrowing their libraries and some of the "smarts" built into the system about setting build flags, etc. So far, I have a dockerized toolchain (cmake + make + gcc-arm-none-eabi) that can successfully build ARM binaries for the target platform.
The thing that I'm up against now is that I'd like to have a robust off-target unit testing infrastructure. My ideal case is that everything in the embedded system will be broken down into libraries that have clear interfaces, then to use unit tests with mocks to get high coverage of test cases. I'll still need some HIL tests, but because those are harder to set up and run, I want to use those for integration and validation.
In terms of OSes available, we're mostly working on Windows systems using WSL for linux. I'd like things to be as linux-based as possible to support CI on github, etc.
Goals and Cmake limitations
I started out using cmake because I hate it least of the tools I've used, and I am at least pretty far up the learning curve with it. But a limitation I'm hitting is that you can't do a mixed compile with two different toolchains in one build. The reasons why cmake has this limitation seem reasonable to me, even if it is annoying. You can easily change the toolchain that your code is built with, but that seems to be largely targeted at cross-compiling the same binaries for different systems. What I want to do is:
- build my code libraries with embedded settings for linking to the embedded binaries and build those embedded binaries (the end product)
- build my code libraries with linux-ish tools and link them against unit tests to have a nice CI test process
- (eventually) also be able to build windows binaries for the PC components -- when I get to that point, I'd like to get away from the MSVC compilers, but will use them if I have to
Current strategy
My current plan is to configure a library build like this (pseudocode):
add_library(mylib sources) if (BUILD_TYPE STREQUAL BUILD_TYPE_EMBEDDED) <embedded config> elseif (BUILD_TYPE STREQUAL BUILD_TYPE_LINUX) <linux config, if any> endif() #unit tests are built for each library if (BUILD_TYPE STREQUAL BUILD_TYPE_LINUX) add_executable(mylib_test sources test_sources) target_link_libraries(mylib gtest etc.) endif()
For the rollup binaries, I make the whole target conditional
if (BUILD_TYPE STREQUAL BUILD_TYPE_EMBEDDED) add_executable(myembedap sources) target_link_libraries(mylib) endif()
Then the build script (outside cmake) is something like
cd build/embedded cmake <path to src> <set embedded toolchain> -DBUILD_TYPE=embedded make cd ../../build/linux cmake <path to src> -DBUILD_TYPE=linux make
Things I like about this strategy:
- It's relatively simple to do all the builds or just one of the builds (that control would go in the shell script)
- I have one source tree for the whole build
- It lets configuration be near code
- It lets tests be near code.
- I think it's extensible to cover the PC component builds in the future
Things that worry me:
- It feels like a hack
- Support for off-target tests feels like it should be solved problem and I'm worried I'm missing something
Thanks for reading. If you made it this far, you have my gratitude. Here's a video with funny out of office messages that I enjoyed.
6 votes -
Best solution to extract PDF data?
Hi folks-- To those more knowledgeable than I am: What would be the best local solution to extract numerical data from a batch of PDF file reports? The values I want are interspersed among word...
Hi folks--
To those more knowledgeable than I am:
What would be the best local solution to extract numerical data from a batch of PDF file reports? The values I want are interspersed among word processor formatted tables and irrelevant text. The text and table formatting are (nearly) identical across reports. The data I want vary across reports. The PDFs are not of images...I can select and copy text without OCR. I have thousands to process, and the data themselves are confidential (I have clearance) and cannot be shared. I can use Windows or Linux but no MacOS.
I am technically inclined, so I bashed my head against regular expressions just enough to use notepad++ to find and delete most of the irrelevant stuff and make a CSV, but it's a hacky, imprecise method and not nearly automated enough for batches. For reference, I don't code for a living or even as a hobby, but I use R and bash, am familiar with IDEs, and can follow pseudocode well enough to edit and use scripts.
Any thoughts? Thanks in advance!
24 votes -
What the hell is a Typescript or: Creation ideas above my skill level
I'm a graphic designer. I've been working in the field for nearly seven years now, two of which in an actual agency. One afternoon I started on a project that was born of more or less pure spite -...
I'm a graphic designer. I've been working in the field for nearly seven years now, two of which in an actual agency. One afternoon I started on a project that was born of more or less pure spite - I love the annual art trading game Art Fight, but absolutely loathe how the game is run, how it comes completely crashing down every year due to people trying to access the site all at once and them not having any contingencies in place, and how the leadership there is apparently only concerned with donations and little community outreach. If you're unfamiliar, artists get sorted into one of two teams, upload their original characters with reference sheets and then draw characters belonging to the opposing team's members. It's great fun, and I tried volunteering for them, but the fact that I'd've to sign an NDA just to be a moderator is just a step too far. For those unaware, the Art Fight team was also caught embezzling donations in one of the last fights, 2022 if memory serves.
So I did what I do best. I started drafting user stories, did UX research, sketched, drew and designed what I'd think would solve all the problems with Art Fight. The result I called PICTOCLASH, and while the process to make and prepare the design took me about four weeks from start to finish, I knew I couldn't actually make the thing work. Disregarding the fact that the Art Fight platform is anaemic and runs on outdated PHP, has no optimisations for image storage or user content and does not buffer or queue database interactions, it's still a massive lift. We don't have numbers on how large AF is, but suffice it to say that it's far larger than any hobbyist project can be without VC involvement.
I was convinced, though, that if one just... approached the problem differently, maybe with modern technologies, the Next.JS I kept hearing about from my web design peers, maybe a shiny new database like Postgres, state management, all the things I know next to nothing about, this could work. My project could work. Yes, it's a lot of work, but it wouldn't be impossible. With a team of developers, all believing and contributing to the project in an open-source way, that's doable. Eminently realisable, even.
So I started. I began reading documentation for TS, Next, React, Prisma, Postgres and all the other things I'd need to read up on. This was maybe half a year ago. But damn, programming got hands. Even the Me-ChatGPT-Dream-Team wasn't enough to have me wrap my head around so many concepts here. I'm a front-end guy, that's for sure. I got my ass handed to me, and in a month, I barely have a login system, and looking at GitHub I could have just went with any of the many pre-rolled solutions.
Which just led me back to my original point. I have three hundred-odd lines of barely functional typescript that holds up an incredibly slow login system. I'm not cut out for this project, and I need to accept that. I'm a designer, I know PHP, I can write valid JavaScript, but... application development? That'll forever be a realm locked off to me.
And of course, the easy way out would just be to look for developers. But I can't do that, at least not without significant risk of falling into the "I had an idea for an app, you wanna make it?" brand of parasite. I'd feel dirty doing that, even if I know that I could more or less to front-end and every visual component by myself. In fact, I have done that. It's just the app part that's missing, and that's unfortunately the major lift.
How do you people cope with this? Because it's not been the first time this happened to me. I keep putting off learning 3D modelling out of exactly that reason, that I could just hit a wall no matter how hard I try. It's frustrating, and looking back how easily I picked up other disciplines in university it really makes me wonder if there are some things my brain just can't learn. I don't think I'm ready to accept that.
Edit: For anyone interested, I uploaded the abridged design document to my website.
20 votes -
Using AI generated code will make you a bad programmer
38 votes -
What was your first programming language, what languages do you know now, and what tips do you have for those trying to learn any of those?
What was your first programming language, what other languages (if any) do you know now, and what tips do you have for those trying to learn any of those? Whether those tips are for beginners or...
What was your first programming language, what other languages (if any) do you know now, and what tips do you have for those trying to learn any of those? Whether those tips are for beginners or even advanced, to do with APIs, or if you've got a good library to share.
53 votes -
Everything I built with Claude Artifacts this week
10 votes -
Gamedev in Lisp. Part 1: ECS and metalinguistic abstraction
9 votes -
Programming/gaming monitor recommendations
I'm a work from home software engineer, I spend most of the day at my desk staring at my dual monitor setup. There are some specs I'd like to upgrade based off what I've read online, but I want to...
I'm a work from home software engineer, I spend most of the day at my desk staring at my dual monitor setup. There are some specs I'd like to upgrade based off what I've read online, but I want to hear if any tildes users have strong opinions about the hardware.
My primary display is a Dell S2719DGF (1440 144hz), and my secondary display is a Dell P2719H (1080 60hz). My primary display is for programming & gaming, and I want to upgrade to 4k 144hz. My secondary display is my primary display for work, only used for programming. I want to upgrade it to at least 1440, maybe 4k if it's as good as they say. I also need 100x100mm vesa mount support, though I think most monitors have that these days.
A few points that I'm not certain about:
-
I've read that 4k is better for reading and writing code because the higher pixel density makes text sharper. I definitely prefer 1440 over 1080, but is the jump from 1440 to 4k as noticeable? I've never used a 4k monitor.
-
My current primary display has a low response time. I don't play fast-paced PvP games anymore, is this something I can give up and not notice?
-
I think IPS panels are the move for both displays, for better contrast and to avoid burn-in, but I'm no longer well educated on the current landscape of panels. MiniLED? QLED? QD-LED? What'sNextLED??
-
Both of my displays are 27 inches. I'm hesitant to upgrade to something larger like 32 inches and lose pixel density. Is the difference between 4k@27in and 4k@32in negligible?
-
I just moved my office into a loft with poor lighting. I read that dark rooms require better contrast but I'm not sure what good or poor contrast looks like.
-
Is my fps going to take a hit from increasing the resolution of my secondary display? I don't know if there's a lot of extra overhead from the increased resolution. AMD GPU/Gnome/Wayland btw.
If you're a programmer/gamer with a hill to die on regarding monitors please share it with me!
9 votes -
-
I am disappointed by dynamic typing
22 votes -
How to make Racket go (almost) as fast as C
2 votes -
How to write a blog post about how to monetize a blog
5 votes -
Advanced debugging technology in practice
4 votes -
Debugging by querying a database of all program state
4 votes -
Get me out of data hell
30 votes -
Time spent programming is often time well spent
6 votes -
SpaceTraders — A unique multiplayer game built on a free Web API
62 votes -
More powerful mods coming to Dwarf Fortress via Lua
9 votes -
Performance Improvements in .NET 9
15 votes -
Django for Startup Founders: A better software architecture for SaaS startups and consumer apps
4 votes -
Sanding UI
14 votes -
US judge rules $400 million algorithmic system illegally denied thousands of people’s Medicaid benefits
27 votes -
Air Con: $1697 for an on/off switch
40 votes -
Property-based testing against a model of a web application
7 votes -
Zig and emulators
14 votes -
Why not just do simple C++ RAII in C?
10 votes -
What is a software you wish existed?
I've been feeling pretty bored for a while and my job isn't really giving something fulfilling to do, So I want to make something. However, I don't want to make something useless. unfortunately, I...
I've been feeling pretty bored for a while and my job isn't really giving something fulfilling to do, So I want to make something.
However, I don't want to make something useless. unfortunately, I can't think of any software I'm in a particular need for. I would love to make something that solves a real problem for a real human.
So, please tell me, what's something that you wish existed because it would reduce suffering in your life that little (or big) bit?
Edit: Wow wow and wow, I didn't expect this thread that I made on a whim to blow up so much. So many idead!
69 votes -
FauxRPC: Easily turn protobufs into fake gRPC, gRPC-Web, Connect, and REST services
5 votes -
10 years of Dear ImGui
15 votes -
Zig: The small language (2022)
17 votes -
HTTP/1.0 From Scratch
4 votes -
User-defined Order in SQL
23 votes -
Breaking my hand forced me to write all my code with AI for 2 months
14 votes -
We need visual programming. No, not like that.
17 votes -
Plain Vanilla — An explainer for doing web development without tools or frameworks — just HTML, CSS, and JavaScript
35 votes -
Get roasted based on your Github username and public contributions
20 votes -
Cables — interactive visuals, made from cable salad
11 votes -
First impressions of Gleam: lots of joys and some rough edges
9 votes -
Y’all are sleeping on HTTP/3
20 votes -
Struggling with first dev job - seeking advice
This is my cry for help. I'm a newer programmer who just got hired for my first actual programming job a few months ago. Before now the only things I really made were simple python scripts that...
This is my cry for help.
I'm a newer programmer who just got hired for my first actual programming job a few months ago. Before now the only things I really made were simple python scripts that handled database operations at my last job. I live in an area with no opportunities, and so this new job I got is my saving grace at this point. For the first time in my life I can have actual savings and can actually work on moving to an area with opportunities. However...
Everything is falling apart. I have no idea how this place has survived this long. There is no senior dev for me to go to. There are no code reviews. There is no QA. There is a spiderweb of pipelines with zero error handling or data-checking. Bugs are frequent and go undetected. The database has no keys or constraints, and was designed by a madman (so it's definitely not normalized whatsoever). I already have made a bunch of little scripts handling data-parsing tasks that are used in prod, and I've had to learn proper logging and notifications on errors along the way, and have still yet to learn how to do real tests (I ordered a book on pytest that I plan on going through). I am so paranoid that at any moment something I made does something unexpected and destroys things (which... kinda actually happened already).
We're in the long and arduous process of moving away from this terrible system to a newer, better-designed one but I'm already just so lost and... lonely? There's a few separate dev "teams" but one is outsourced and the other is infamously unapproachable and works on a completely different domain. There's no one there to catch me if/when I make mistakes except myself. The paranoia I have over my programs is really getting to me and already affecting my health.
I guess I just want advice on what I should do in this situation. Is this a normal first experience? I care deeply about making sure the things I make are good and functional but I also don't have the experience to forsee potential issues that may come up due to how I'm designing things. And how can I cope with the paranoia I'm feeling?
EDIT: It takes me a while to write responses, but I want everyone to know that I really appreciate all your advice and kind words. It does mean a lot to me! I'm doing my best to take in what everyone has said and am working on making the best of an atypical situation. I'm chronically hard on myself, but I'm gonna try to give myself a bit more grace here. Again, thanks so much for all the thoughtful replies from everyone. :)
34 votes -
HTTP/0.9 From Scratch
11 votes -
Generating sudokus for fun and no profit
26 votes -
Solving a couple of hard problems with an LLM
13 votes -
Taking my diabetes treatment into my own hands
17 votes -
Yarn, React, and Udemy. Help requested.
My apologies if this kind of content is not allowed here. Mod(s) please feel free to delete it if it is not without any butthurt on my part. I'm new to React Testing, so I am taking an Udemy...
My apologies if this kind of content is not allowed here. Mod(s) please feel free to delete it if it is not without any butthurt on my part.
I'm new to React Testing, so I am taking an Udemy course on it. The Udemy course uses yarn, so I would like to stick with that though I do know yarn isn't the top accepted tool in the React community.
I've posted this question elsewhere, I haven't gotten any responses, so I am posting it here ( costs nothing ).
I am getting this error when executing yarn build:
$ yarn build yarn run v1.22.22 $ react-scripts build Creating an optimized production build... Failed to compile. TS2305: Module '"web-vitals"' has no exported member 'ReportHandler'. > 1 | import { ReportHandler } from 'web-vitals'; | ^^^^^^^^^^^^^ 2 | 3 | const reportWebVitals = (onPerfEntry?: ReportHandler) => { 4 | if (onPerfEntry && onPerfEntry instanceof Function) { error Command failed with exit code 1.
I've tried installing web-vitals over what is already in the modules section, but that hasn't helped.
Any clues appreciated!
Update: the tip about ReportHandler being deprecated helped. I ran create react app in a new folder, did NOT run yarn update as the instructor called for,moved my work over, and now everything runs fine.
7 votes -
Where is the programmer inspo?
13 votes