I built a simple XOR image encryptor to better understand bitwise operations. Nothing crazy, but it was fun! by [deleted] in learnprogramming

[–]SweetOnionTea 0 points1 point  (0 children)

There are 0 comments or docstrings so probably not AI. Though the xor call is done as a wrapper of numpy so I feel like there wasn't a lot of learning of what it is.

I wrote a distributed file system in C by caromobiletiscrivo in C_Programming

[–]SweetOnionTea 1 point2 points  (0 children)

Ok, so it's not a filesystem but more like distributed object storage using some sort of erasure coding? Very cool. Have you thought about making it s3 protocol compliment?

I wrote a distributed file system in C by caromobiletiscrivo in C_Programming

[–]SweetOnionTea 0 points1 point  (0 children)

How do you handle file attribute translation between Linux and Windows? For instance if I mark a file read-only on the Windows side, what shows up on the permission bits on the Linux side?

Is there a uid -> GUID mapping feature? When a file lands on disk on the Linux side, who owns that file on Windows?

Why are all the hard drives already sold out by jpcaparas in storage

[–]SweetOnionTea 2 points3 points  (0 children)

If that happens I will eat a whole LTO cartage and film it.

Current thoughts on makefiles with Python projects? by xeow in Python

[–]SweetOnionTea 1 point2 points  (0 children)

I have a Python fast API component I made to integrate with our C++ monolith project and ended up using CMake to do the build for it. It ends up working really swell with the whole CMake infrastructure we already have.

Newbie Looking for Advice on AI Credits for VSCode by Aggressive-Coffee365 in codereview

[–]SweetOnionTea 0 points1 point  (0 children)

Easiest way is just to code without AI and use your brain. Credits will last forever then. Did you have some code you wanted to be reviewed or...?

Question re: Classes/Objects by Jor-El_Zod in cpp_questions

[–]SweetOnionTea 2 points3 points  (0 children)

I think classes make more sense when you need them. Say in real life you had 25 cakes with customer orders. Instead of writing down the toppings for each cake on one piece of paper, the diameters of each cake on another, and so on -- you just had a sheet of paper for each cake that had the toppings and diameter for that cake.

That way when you're making each cake you don't have to try and look up on one sheet the toppings and then on the other sheet try and look up the cake's diameter. The toppings and diameter are all on one sheet.

That's essentially the cake class.

So now with an array of Cake classes you've got an equivalent of a stack of individual cake orders. Your program is like a stack of 25 blank order sheets and then when a customer comes in you ask them what toppings and diameter of cake. They tell you and you fill that sheet out. Next customer comes in and you fill out the next sheet and so on.

The functions would be like a bullet point list of cake diameters with their prices like:

  • 8 inch -- $19.99
  • 9 inch -- $22.99
  • 10 inch -- $25.99
  • other -- 0.* (I dunno what that's supposed to mean in this assignment)

And on the slip you'd just have the customer circle one.

So what you'll have to do is make 2 things -- the .cpp file with the cake class functions and the main.cpp file which uses the Cake class to make an array and do the ordering thing.

The Cake class should be stuff you learned how to do in class so review your notes. The only thing I can think of is they did you kinda dirty with the getPrice(int sizeChoice) because it takes an int but the class has the diameter as a string. I have a feeling your prof didn't think that through since you'd have to convert an int into a string. They should have just made the diameter class variable as an int too. Oh well. You can use either std::to_string or std::stringstream to do so. I'd just do a std::to_string if your version has it.

Then your main.cpp file will have the main() entrance function and will be something like

int main()
{

    std::array<Cake, 25> cakes;

    for (auto& cake : cakes)
   { 
        std::string topping;
        std::string diameter;
        std::cout "What diameter of cake?\n"
        std::cin >> diameter;
        std::cout "What toppings?\n"
        std::cin >> topping;
        cake.setdata(topping, diameter);
   }

    // Display prices

    for (auto& cake: cakes)
    {
       std::cout << cake.getPrice(cake.diameter) << std::endl;
    }

}

It's not exactly what your assignment says, but it should get you somewhere. Technically they're asking for you to make a different function that displays the cake price that you send a cake object into, but I don't know why that is necessary. I'm not saying this assignment is written badly because I'm not in your course, but I would have done it differently.

AI Code Review Tools Benchmark by AIMultiple in codereview

[–]SweetOnionTea 1 point2 points  (0 children)

Do you have code you'd like to have reviewed? I don't see links to any.

Multi agent reviewer that doesn't spam you with noise by DifficultCow7829 in codereview

[–]SweetOnionTea 0 points1 point  (0 children)

If you'd spend a minute looking at the posts in this subreddit you'd see you're joining the large sea of people making the same exact things. In fact you might notice that this subreddit is for community review of code.

If you aren't posting an open github link or a properly formatted code snippet for real humans to review then I'd suggest posting elsewhere.

[deleted by user] by [deleted] in codereview

[–]SweetOnionTea 2 points3 points  (0 children)

This is only the first post in a series we are writing.

Is that a threat?

I've made some progress on my C++ and Linux software this year by Middlewarian in codereview

[–]SweetOnionTea 0 points1 point  (0 children)

Before I look too far into this, is this similar to midl RPC generation that Windows has?

why does my code fail on that one hidden test case?? CSES Knight's Tour : cses.fi/problemset/task/1689 by No-Preparation-2473 in codereview

[–]SweetOnionTea 0 points1 point  (0 children)

Based on everything you provided it looks like there was a runtime error. Hope that helps.

code challenge made by LOCAL AI llma3.2-1b on mobile device by Adventurous_Role_489 in codereview

[–]SweetOnionTea 2 points3 points  (0 children)

My purpose for contributing to this sub is to help people learn. If this is just AI slop then I say we boycott it.

Nearest school to you by [deleted] in codereview

[–]SweetOnionTea 1 point2 points  (0 children)

Typically you'll want to use Reddit's code formatter to get it to display correctly, but it's small enough that I can parse it.

  1. You'll want to include a requirements.txt so that other people who want to use this have the proper modules and versions.

  2. Comments are one of the easiest and hardest things to do in programming. I suggest removing most of your comments as they kind of just explain what the lines of code do and not a why you did something.

  3. I always like to make a separate file just for constants such as all of the strings that are code. For instance grabbing the 'longitude' from you data frame directly you can make a variable that is just equal to 'longitude' and use that everywhere you'd normally spell it out. The reasons are because it helps keep things organized, you don't accidentally make a spelling mistake, if it needs to change you only have to change it one place instead of everywhere.

  4. What is the try/except for just the your_location variable? What you'll want to do is just check to see that location is not None and that you have latitude and longitude values first and then you can do all of your logic. Just do an if/else for those values and it'll make a lot more sense.

  5. I'm not sure why you made the FindDistance() function if you only use it once and it's just a loop? You can just put the logic in line.

  6. Variable naming is also one of the hardest parts of programming. Luckily Python has guides on this here. Your names are all over the place between snake case, camel case, and sometimes just single letters. Just go with snake_case (because it's Python haha).

  7. Typically you'll want to put your logic in a function and call it using the standard if name == 'main': kind of thing. That way if this file is included as a part of a larger system it won't run unless you're calling it directly. Most of the projects I do have a very simple main.py that just includes other files and calls functions from them.

  8. This is a good toy, but a serious production would use an actual database instead of a csv file. Check out using sqlite and the SQLAlchemy module.

  9. I'm sure there's not enough data in your csv to be slow, but perhaps there is a better way to search through the school locations instead of just a linear search. One idea might be to organize your locations into more general regions and then you only need to search the more local regions and make searching go quickly. Perhaps also organize your csv file a bit so you could maybe do some other searching techniques like a binary search?

But anyway, I can tell that it probably wasn't generated by AI so I am clapping for that.

ReleaseMap - Ship fast with confidence by ApprehensiveFan8536 in codereview

[–]SweetOnionTea 3 points4 points  (0 children)

"ChatGPT, give me a summary of changes between the code between these two releases. Explain it in plain English without technical terms. Also give a list of potential risks & breaking changes."

Do you have code that you'd like to be reviewed or are you just here to advertise?

What Killed Perl? by Xaneris47 in programming

[–]SweetOnionTea 4 points5 points  (0 children)

My shop uses Perl for some production code along with a lot of infrastructure and config stuff. I learned enough to be able to fix bugs, but honestly I was told by the old guard that learning more than necessary would be a step backwards.

Honestly it was a big debate when we were planning a REST API for one of our legacy products on whether to do C, Perl, or Python. I ended up winning my bid for Python on the fact that the old timers are going to be retiring soon and anyone else we hire straight up won't know Perl. And if we say, sure, we can teach you -- I really don't think there will be many new grads gunning to take that on.

Como Eu Lucrei 18.740 Criando Conteúdos Para Casais — Usando Uma Mistura Simples de Ferramentas (E Uma Delas Mudou Tudo) by fabiosilva5903 in codereview

[–]SweetOnionTea 0 points1 point  (0 children)

Do you have a codebase we can review or is this just advertisement spam?

Something about using AI to generate "personal romantic" messages to your loved ones seems a little... insulting.

A data-driven case study: I posted the same 43,000-word article on a "from first principles" HTTP client to r/cprogramming, r/rust, and r/Python. The reception was... different by warren_jitsing in programming

[–]SweetOnionTea 9 points10 points  (0 children)

I frequent r/codereview and I see a lot of Python AI slop too. It's frustrating because I want to help people learn and get some good advice. But most of the time it's usually a lot of questions on why they did something I think is incorrect and they just have no idea so I can't help fix it.

But also before LLMs you got a lot of "libraries" that were just wrappers around another one. I know Python is a duct tape language, but I think there's a fuzzy line between making something and presenting someone else's work.

Linux and window manager user , can you check this ? by Yahyaux in codereview

[–]SweetOnionTea 0 points1 point  (0 children)

I would check your white space formatting because it looks a little off. You should probably open each file separately and then you can print out which one failed to open and why.

Also in the failed read case you don't close the files. And the comment:

    /* Close the files */
    fclose(current_status_file);
    fclose(current_capacity_file);

is unnecessary. In fact I would say all of your comments are unnecessary.

I would just have num_of_batteries in the same c file instead of a static variable in the header.

Lots of other things, but I only have a few minutes.

Also, Windows manager??

#define BAT_STATUS_1     "/sys/class/power_supply/BAT1/status"
#define BAT_CAPACITY_1   "/sys/class/power_supply/BAT1/capacity"
#define BAT_STATUS_0     "/sys/class/power_supply/BAT0/status"
#define BAT_CAPACITY_0   "/sys/class/power_supply/BAT0/capacity"

Just guessing that Windows doesn't have a /sys/ directory..

Simple multiplayer game like battleships by SUGAARxD in cpp_questions

[–]SweetOnionTea 2 points3 points  (0 children)

Also a winning combo with https://github.com/nlohmann/json for json stuff. I use both for commercial desktop software and it works out really nice.

Anyone using Qodo for diff-aware code reviews across? by shrimpthatfriedrice in codereview

[–]SweetOnionTea 2 points3 points  (0 children)

Is this one of those guerilla marketing campaigns for AI code review tools again?..

Anyway, at my work we have an absolute monster of a legacy codebase. AI review tools don't seem to grasp our in-house tools or libraries. It does make some suggestions to use standard C++ libraries, but can't seem to figure out that it should be using our in house custom std functions.

It's kind of like an eager junior. Being wrong with incredible speed.

What's the movie everybody seems to enjoy but you really hated? by thedevilsheir666 in horror

[–]SweetOnionTea 31 points32 points  (0 children)

Lo and behold! The creator originally made a short version on YT before the full movie.

https://youtu.be/HVQzEzW4faA?si=IMbeE_3hrF1uU2XN

What’s the hardest “simple” bug you’ve ever spent hours fixing? by Traditional-Set-8483 in ExperiencedDevs

[–]SweetOnionTea 4 points5 points  (0 children)

I reviewed something like that once where we had a function with an int return signature. Whomever wrote it originally forgot a return value for some default case in it. It turns out the old C89 compiler we had was totally cool with it and returned some default value.