r/AskProgramming

Why was it decided that we make inner escapes inherit escape depth, thus requiring rework of inner escapes as add additional escapes? Why not carry the escape depth thru the argument's wrapper symbols? (Example Inside)

I am just a tinkerer, no formal education or tech related job, so my understanding comes purely from shell operations (specifically fish shell).

Is there an elegant reason we do it the way we do other than "that's how we've always done it, and now it's easier just if we just keep on keeping on"


Instead of: "foo \"bippity \\"yo gabba \\\"example\\\" gabba\\" boppity\" baz"

why don't we have something like: 【3】foo 【2】bippity 【1】yo gabba 【 example 】 gabba 【1】 boppity 【2】 baz【3】


to further escape this you do not modify any of the contents, you just escalate your arguments final wrapping to the 4th degree with 【4】 as the delimiters.

The tradeoff being that you can no longer use arbitrary 【n】inside strings parsed by your shell as arguments, but that is why i chose some uncommon symbol (it could be anything, idk what these brackets are actually used for).

It would still support parallel nests in the same argument, you just have to ensure each "escape well" keeps its ranks non-overlapping and sequentially increasing in the outer direction. If you unescape a layer and that causes the parallel escapes to become their own highest degree, then you now have an array of arguments with any text between them that was entirely unescaped becoming command/builtin syntax (flags, subcommand, etc) that consume the args that follow them.

reddit.com
u/teleprax — 3 hours ago

What do I need to know to write a full fledged kernel.

I want to understand more of computer and I figured what's better method to understand how computer work if not write your own kernel.

The kernel is just supposed to be learning tools for me.

## About me
I do have some background in programming

  • I can write basic c program
  • know computer component
  • know a bit in how cpu work

I use mintos with kde so I wasn't a hardcore linux user at the moment.

reddit.com
u/Zolve-Glitch — 11 hours ago

Is it worth pursuing career in tech with no/less prior knowledge in maths (cloud and all)

Cloud, DevOps, Platform, Infrastructure, MLOps, AI Infrastructure, or perhaps software engineering (need maths for se i guess)

My math is really weak. I'll improve it, but it'll take too much time and I don't want to risk my career cuz of it. I wanted to pursue ML/AI, but ofc w/o math I don't think it's for me. So I've shortlisted the careers I mentioned and want smtg with less maths.

Ik intermediate Python, basic C, some Linux, and I'm doing CS50x. I'll be 19 this year, took a 1-year gap after school (humanities, no math), and recently joined an online BCA (DSA, DBMS, OS, Networking, Web Development, CS fundamentals).

I want a kinda secure career cuz i don't think I can give more than 1-2 years before I need to land my first job because of family forcing 🥀 but I'm confused about which path to choose rn,

reddit.com
u/Due_Butterscotch243 — 6 hours ago

Code architecture to support input actions being interrupted, overridden etc

What's a good architecture to be able to have a hierarchy of input actions, actions being interupptable by certain actions, but not by others etc. My example is in the context of game development, but the concept still applies.

Let's say the player is carrying a box. They can drop the box by pressing [E]. They carry this box up to a door. Upon pressing [E] while looking at the door, the door should open, the box should not drop

For this example, I can simply code that if the player is looking at a <Door>, then open the <Door>, otherwise if the player has a box in hand, and the player is not looking at a <Door>, drop the box

This is a good solution for this situation, however, how does someone design a system that allows for this sort of hierarchy of action, hierarchy of inputs. I can do it with a long (loooooong) list of if-else statements, however that is not scalable

Since there are only a limited number of keys, and sometimes it's preferred to use only a small set of them, there will be many situations where pressing a key can perform many actions.

Obviously the actions have conditions to them (If looking at door, keypress opens it. If looking at box, keypress picks it up. If holding box, not looking at door, key press drops it), however as stated above, this will result in a long list of if-else statements

I'd appreciate if someone can point me in the right direction, provide some examples where one keypress can do many actions, show me some code etc

Thank you

reddit.com
u/LifeExperienced1 — 13 hours ago

Advice for a last year high school student

I’m a last year high school student, and I’ve been feeling really overwhelmed lately and could use some advice.

I’m studying computer science and putting a lot of effort into it. I joined CS50x and I’m also working toward projects in deep learning. The problem is that I have my final exams in a week, and I honestly don’t feel ready. After that, I have an entrance exam too, and I still don’t feel prepared. I’m stressed because I focused so much on learning computer science that I didn’t study my school subjects as much as I should have, and now I’m wondering if I made the wrong choice by taking that risk. At the same time, I do have some skills, I know web development with HTML, CSS, and JavaScript, and I’m currently learning data structures and algorithms too. I’d really appreciate advice from anyone.

reddit.com
u/Efficient-Gain2561 — 17 hours ago

Non-technical person looking for advice on the simplest way to build this

I’m hoping someone technical can point me in the right direction because I’m going round in circles.

I need to create simple mobile-friendly pages for different clients. Each page would use the same basic structure — a photo/logo and around 8 sections containing text, photos, links or documents.

I need to be able to duplicate the setup for each new client and just replace the content. I don’t want to manually design a new website every time.

I’m completely non-technical and have a very limited budget, so a custom build isn’t an option at this stage.

I’ve looked at Linktree, Taplink and Bio Sites, but I genuinely don’t know if I’m looking at the right type of software.

What would you use for this?

reddit.com
u/bluetrousersmoment — 1 day ago

Can i go from a text based game to a graphical game (Python)

Hello, i started making my own Text-based Game And i have been learning! Just a week ago i only knew Print ()

But i have a question: Can i Make In the Future a Graphical game? Does anyone Have a earlier Experience with this?

Edit: yes i use Pygame

reddit.com
u/Castman18 — 2 days ago

Why are people so quick to dismiss optimization as "premature" without knowing the use case or bottlenecks?

I have seen several people online say that using C, C++, Zig, or Rust in the modern day for anything other than embedded programming is "premature optimization".

I know that choosing a horrible algorithm can impact performance much more than choice of language, and I also know that most high performance libraries for "high-level" languages like Python are written in faster languages like Fortran. However, when looking at the frequently viewed Wikipedia pages with the "Programming Languages" template, I noticed that the article claims that an idiomatic Python program being interpreted with CPython is "typically" worse than an equivalent C program by a large margin. The article claims 75.88 time more energy usage, 71.9 times slower, and 2.4 times more average RAM usage. Looking at the cited source, which is a paper from the "Proceedings of the 10th ACM SIGPLAN International Conference on Software Language Engineering", it seems like they used GCC to compile the C, and the computer was running "Linux Ubuntu Server 16.10 on a computer with 16GB of RAM and a Haswel Intel i5-4660 CPU at 3.2 GHz".

I know that we need to take anything that we read from people in academia with a grain of salt. However, the paper has already undergone peer-review, and if it is even anywhere close to the truth, then that would seem to imply that there is a massive difference between Python with CPython and C with GCC. Also, I know that alternative implementations of Python exist, several of which are more than ten times as fast as CPython. (like Codon, Cython, etc). However, surely there are some people who have use cases other than embedded yet have a reason to favor "system-level" languages like C, C++, Zig, and Rust over "high-level" languages like Python, Javascript, PHP, Perl, etc.

Also, the dismissal of optimization goes beyond just choice of language. I saw a Stack Overflow question asking about optimization, and it had a response of someone giving an anecdotal about how they sped something up from originally taking 48 seconds to taking 1.1 seconds. (without even changing the language). Out of the 46.9 seconds that he sped it up by, diagnostic printing accounted for 3 seconds and unnecessary memory allocations accounted for 1.4 seconds. 3 seconds might not seem like a lot for a program that takes 48 seconds. However, in a program that takes 7 seconds total, it seems like a lot.

The pages that I am directly referencing are the following.

https://en.wikipedia.org/wiki/Python_(programming_language)

https://stackoverflow.com/questions/926266/performance-optimization-strategies-of-last-resort

u/InfinitesimaInfinity — 2 days ago

Best formats to visually represent large codebases

Hi r/AskProgramming

I recently got a job in a firmware team writing C++. I joined at the tail end of a big project and have been mainly tackling bugs (either directly or when trying to implement new features).

This codebase uses a lot of asynchronous programming and has layers upon layers of state machines all interacting with each other. We have teams in different countries contributing and share modules with other projects. It seems to be a common issue that keeping track of the dependencies and behaviour is getting more and more tedious.

I been tasked with creating an internal tool that can visually represent the codebase to assist devs in ramping up when tackling a new issue.

I’m looking for advice on what formats are best for representing this information. I am currently planning to generate flow and sequence diagrams but was wondering if there were any way to holistically integrate all these discrete diagrams into a larger overview that can be explored easily.

Also suggestions for how to store this information in the intermediate phases would be greatly appreciated.

I will have to rely on coding agents to both explore the codebase and generate the diagrams. Hopefully splitting this task into phases will limit hallucination.

TLDR Any suggestions for how to visually represent a large codebase holistically so that it can be a starting point for dev work?

reddit.com
u/freshbread19 — 1 day ago

How to find a CTO for my startup?

I got a small startup in the AI analytics space and we've shipped quite a few features but the backend lead engineer is still in school and I'd like to give him the bandwidth to excel at it. As a result I now I have to find a CTO for my startup to lead the 8 engineers and prevent delays.

Capital markets seem to be absolutely frozen for startups. Investors arent even taking inital calls. My background is in investment banking and seems like lots of people getting margin called on their investments. And the IPOs aim to suck out any remaining capital.

I need to put my team in demon mode and focus on getting customers.

How do I find a production-grade CTO that has Demon mode in him, that can lead this team, and can tie up the loose ends?

reddit.com
u/AnalyticsDepot--CEO — 3 days ago

Which job that needs programming is the most future proof?

Hey,I am 16 and pc's and programming have been a passion for a while , and i want to do that in the future,but sadly since AI takes over a lot of jobs in this domain it's a bit tricky,I'd love to know where should i be looking so i dont waste my time for nothing.

And which is a safer route for that job? (bootcamp/college )

Thank you very much in advance🙏

reddit.com
u/Proper-Picture-7959 — 3 days ago
▲ 308 r/AskProgramming+12 crossposts

CTOs, engineering managers, and staff engineers are rushing to deploy autonomous AI agents across their businesses – either through their own volition or because of the clamor of demand from rank-and-file workers. However, they should think twice, a new study shows.

Enterprise large language model (LLM) agents are likely leaking company secrets, and throwing more compute at the problem is only making it worse, the study finds.

In part, that’s because of the AI’s ability to retrieve and synthesize vast amounts of internal data, from Slack messages to board transcripts, to automate tasks. By gathering that information, they also create issues with contextual integrity.

When retrieving dense corporate data, these agents routinely fail to disentangle essential task data from sensitive, contextually inappropriate information. Higher task completion rates often directly correlate with increased privacy violations.

Read the full story: https://leaddev.com/ai/frontier-ai-models-haemorrhage-sensitive-data

u/OfficialLeadDev — 4 days ago

What path should I take as someone who is self learning C++ and C#? (Open to start learning new languages after)

I am a sophomore in high school and am self learning the basics C++ and C# (Not at the same time of course) and was wondering what I should do after. What libraries should I use? What type of projects should I work on? Should I do app, web, game, cloud, or some other development? There's so many things to choose and yet I don't know what to go for, my first plan was to do C++ and try to learn the things needed to work at Google, but then 2 people who work/used to work as programmers told me to do C# instead, and yet all I ever hear about is people using and needing C++ developers. I just need some help to decide one final path that I can try and go for the rest of my life starting as soon as possible. Any advice on what I should do using whatever languages and libraries and for what type of development it would be for? Please and thank you.

reddit.com
u/Careless_Bobcat_6730 — 3 days ago

Are you prompting AI with Pascal-case contrived nouns and verbs?

Hello. I'm an experienced programmer with little AI experience.

It would seem that if I want a scrolling view of objects that are cars, it might be advantageous to the programmer and the AI if it were consistently referred to as CarScrollView rather than variations of the "scrolling window of cars" or the "car menu".

Have you had generally positive experiences prompting AI with Pascal-case and camel-case contrived nouns and verbs or do you stick to natural language?

My project ... MAUI, CSharp, mobile and desktop. I'm likely to use an Anthropic product but I haven't committed to that choice yet. I hoping to stay inside Visual Studio.

reddit.com
u/greyHumanoidRobot — 3 days ago

Does Floyd Warshall assume paths of three?

Can someone explain intuitively how the Floyd Warshall algorithm actually doesn’t assume path of just three

I understand what optimal substructures are, however, how does this algorithm apply that

Where exactly in the code does it allow us to build paths longer than 3?

reddit.com
u/LifeExperienced1 — 3 days ago

Best validation practices for APIs?

I’m working with a team and implementing a new feature. We’re getting info from a call and will be storing it in a new field in our db. The team has been saying things like “we don’t need to validate accuracy for the new field bc the call to this other service will do the validation for us”. I’m of the mind that we should still validate for edge cases or abnormal errors, but technically this other service should validate first and we’re only getting the info from them.

What are people’s thoughts? Am I being overly cautious?

reddit.com
u/AloyAce — 4 days ago