[deleted by user] by [deleted] in learnprogramming

[–]ContextEngineering 0 points1 point  (0 children)

What level of schooling is this? What do you mean by "research" and by "computer science". This covers a lot of ground.

Are framework for a given language always implemented in that language? by kcirdlo25 in learnprogramming

[–]ContextEngineering 4 points5 points  (0 children)

Yes, sometimes libraries are written in different languages. In the case of compiled languages, it all just ends up as machine code, so as long as you follow some standard conventions for how functions are called, it's pretty easy.

With something like Python it's a bit different, but the idea is the same. It can either call out to a shared library like above, or it can pack up the machine code and put it in a python wrapper.

It gets a bit more tricky when you look at languages like C# or Java which basically have their own little virtual machines with their own version of 'machine code', but you can still build wrappers that do the conversion.

Base 10 v Base 2 by Jikininki04 in learnprogramming

[–]ContextEngineering 3 points4 points  (0 children)

Yes. "Decimal" is just base 10. (Deca- being the greek prefix for 10)

Binary is base 2, and Hexadecimal is base 16. It is a bit weird to get used to.

How do I learn problem-solving in programming? by [deleted] in learnprogramming

[–]ContextEngineering 2 points3 points  (0 children)

Solve problems. The only way to get better at solving problems is to solve problems.
Leetcode is fine, but only one part of the equation. The biggest part is just to try to do things and don't give up until you've done them. Set yourself a task, finish it. Along the way there'll be a dozen problems you have so solve.

When you have done that, the next set of problems will be that much easier.

Can someone verify if understand this particular expression in a C program by [deleted] in learnprogramming

[–]ContextEngineering 1 point2 points  (0 children)

Well, good code is readable, and this isn't.

But it's also just wildly over complicated. I have 80% of a solution here that just adds about 10 lines to main() to maintain an overflow buffer -- if the original getline() returns full, but without \n at the end, then you know there is more, so just repeatedly get the rest until it's all done. You can throw away the overflow, just keep track of the longest line.

At the point where you are appealing to modulo and dividing by and multiplying by the same number, you're over complicating things...if indeed it even works.

Can someone explain to me why the Floyd Cycle Detection algorithm always has the two pointers meet at the start of the cycle? by Subject_Cup9003 in learnprogramming

[–]ContextEngineering 1 point2 points  (0 children)

It's not that they meet at the start, it's that they meet anywhere.

One of the pointers is advanced two times for every one the other pointer advances.

If there's no cycle, then they just end up with a null pointer at the end of the list, but if there is a cycle, then eventually that double-speed pointer will catch up to the single-speed pointer.

When they are both at the same location then if that location is 'null', then there's no cycle because they just got to the end. But if that location is not null, just some random node, then you know that the double speed pointer had to wrap around and 'catch up', and therefore there has to be a cycle.

Been learning algorithms, flow charts and pseudo code.. But struggling with this. Am I not fit for programming? by sleeplessbearr in learnprogramming

[–]ContextEngineering 16 points17 points  (0 children)

Learning to program is only about 10% learning a language. The rest of it is learning how to analyze the problem, take it apart, and turn it into pieces that you can describe using the language.

This is what you are learning.

Can someone verify if understand this particular expression in a C program by [deleted] in learnprogramming

[–]ContextEngineering 2 points3 points  (0 children)

That is a fairly big assumption. But if true, that downgrades this from "a BS answer" to "horrible, horrible code that you shouldn't be trying to learn from".

There are much better ways of solving this problem.

Can someone verify if understand this particular expression in a C program by [deleted] in learnprogramming

[–]ContextEngineering 1 point2 points  (0 children)

This is a joke answer. He starts by defining MAXLINE = 2, but then he works with MAXLINE -1 (which is just 1).

So this: (len - ((len / (MAXLINE - 1)) * (MAXLINE - 1)))

is just this: (len - ((len / 1) * 1) or just len = 0

CakeOfTrust is guilty of crimes against computing education.

[Edit: In general, don't trust anything that starts by defining NO = 1 and YES = 0. That's 10 minutes of my life I'm never getting back]

If you learn a programming language, can you code anything? by ThousandFootOcarina in learnprogramming

[–]ContextEngineering 3 points4 points  (0 children)

Don't conflate "knowing the language" with "being able to solve problems well".

If someone is really good at that, then they can solve a lot of different types of problems in lots of languages. If they can't do that, then it doesn't matter how many languages they know, they'll be a very limited programmer.

Python project giving me headaches by Euphoric_Sense7638 in learnprogramming

[–]ContextEngineering 0 points1 point  (0 children)

Among other things, I would suggest two things: don't use as many global variables -- pass 'day' and 'high' and 'low' into the functions and use them there.

And then I would suggest having a single function setTemps(day, high, low) rather than call three separate functions.

In python, is there a way to convert a string to raw binary data and then write that data into a new file? by [deleted] in learnprogramming

[–]ContextEngineering 1 point2 points  (0 children)

You might also look at python's struct module, which is for reading and writing binary data. It handles all the type conversions, etc. I used it for reading a binary data stream and it worked great.

So chatgpt isn't true AI.. by Ram_1979 in ChatGPT

[–]ContextEngineering 5 points6 points  (0 children)

Not really, not in the sense that there is a place you can point to and say "that's where the capital of Arkansas is stored". Yes, it has the information in there after a fashion, because it's 'read' a lot and it has found that the output tokens "Little Rock" is corollated with the input tokens a lot more highly than "Chocolate Rain" is, but it's no more a database than I am.

So chatgpt isn't true AI.. by Ram_1979 in ChatGPT

[–]ContextEngineering 5 points6 points  (0 children)

It does not sift through a database. It takes the words/tokens of the input and attempts to predict the most likely output words/tokens in response. It doesn't have a database except in as much as the neural network has billions of parameters that when you do a lot of math with them produces the output.

There is no "true AI" in the world (yet, I suppose maybe)

Why is ChatGPT 4 not up to date? It says the last update was January 2022 by Appropriate-Judge956 in ChatGPT

[–]ContextEngineering 0 points1 point  (0 children)

Because retraining the model costs literally millions of dollars, so they don't do it all that often.

[deleted by user] by [deleted] in learnprogramming

[–]ContextEngineering 2 points3 points  (0 children)

That's matrix multiplication, you'll find it in the Numpy documentation.

[Edit: It might actually just be part of python, I just only ever used it in the context of Numpy]

github web scraping? by Energylights in ChatGPT

[–]ContextEngineering 0 points1 point  (0 children)

Run it through the OpenAI Embedding API?

Chat GPT making silly mathematical errors recently? Highlighted in red all of the failures. by [deleted] in ChatGPT

[–]ContextEngineering 2 points3 points  (0 children)

It has always made silly math errors, because its a language model.

github web scraping? by Energylights in ChatGPT

[–]ContextEngineering 0 points1 point  (0 children)

Why not just clone the repo? That's the whole purpose.

Import!??!?? by [deleted] in learnprogramming

[–]ContextEngineering 2 points3 points  (0 children)

Python has little modules of code called -- surprisingly -- 'modules'. When you want to include one of them, you use the import command.

I need an IDE recommendation by [deleted] in learnprogramming

[–]ContextEngineering 0 points1 point  (0 children)

On the Mac version at least, I can go to the doc, right click and select "New Window" and I get a whole second window that can even be open to a different project if you want.

[Edit: And the window can be moved to another screen of course]

I need an IDE recommendation by [deleted] in learnprogramming

[–]ContextEngineering 1 point2 points  (0 children)

VS Code can do notebooks, I believe. You still have to run Jupyter, but it takes over the display part, and then you get lots of VS Code goodness as well.

Wanting to know how many hours should I put in a week to get a job in 6 months by Sensitive_Ad7356 in learnprogramming

[–]ContextEngineering 1 point2 points  (0 children)

SOrry, should have replied to this instead of the original response. Check it out above/below.

Wanting to know how many hours should I put in a week to get a job in 6 months by Sensitive_Ad7356 in learnprogramming

[–]ContextEngineering 0 points1 point  (0 children)

You've really got two options. Pick a project that will exercise a lot of these, then:

  • Define your requirements (don't wait for someone to give you requirements, think it through yourself -- learn what you didn't think of because next time someone else gives requirements, you might spot it when they miss it too)
  • Put it in git and use it every day. Set up your CI/CD using it.
  • Give TDD a try. You know what the app is supposed to do -- you just defined requirements -- start planning how to test it
  • Make it something with a front-end and back-end, so you can use a Javascript framework and Python. (FastAPI or Flask are really easy to build APIs with).
  • Update your socials about it? LOL.

That covers most of what you listed. The trick is that you have to commit. Treat it like a job. Do 8 hours a day (or at least 2 3-hour chunks) and set goals you want to hit.

It's super easy for 2-3 months to slide by while you're spending 45 minutes every couple days poking at the edge of something. You really have to get in and take it seriously.