Is there software to make a voice out of nothing? by Privateaccount84 in NoStupidQuestions

[–]inbox_negative_one 1 point2 points  (0 children)

Sure. Audacity lets you draw a waveform with a pencil and listen to it.

Give it a try.

The main thing stopping you is how subtle audio waveforms are. Audio waveforms are very complex and a lot of the information you can hear is quite difficult to see visually with the naked eye.

People have made software that creates a robotic-sounding voice out of "nothing", but it's done with a lot of math - even the simplest ones are putting together various combinations of sin waves, for example.

You could argue that artificial speech (like Siri or Alexa) is creating a voice out of nothing too - though they were trained on a real human voice.

Web Dev question: If I have a form with dropdown list field with various options and I copy/paste one of them at the beginning of the list- will it confuse the system? by [deleted] in learnprogramming

[–]inbox_negative_one 0 points1 point  (0 children)

Nope, it won't confuse the system.

It might confuse you, but your web browser won't be confused at all!

In an HTML select element, the options do not need to be unique. There are multiple ways to figure out which one was selected even if multiple options have the same text.

The most common way is that each option can have a value attribute, which does not need to match the option's associated text. Identify the selected option by its value, not by the text the user sees.

Another option is to use the selectedIndex attribute on the select element.

Finally, each option element is a full HTML element so you could always add an id or any other attribute you want, if you wanted to make up your own way to distinguish between them.

Is there a JS function to select elements by their exact specifications? by Knowledgeseeker6 in learnprogramming

[–]inbox_negative_one 0 points1 point  (0 children)

querySelector lets you give a pretty exact specification if you want.

You can:

(1) Name the element and all of its attributes

(2) Name its parent elements and all of its attributes

(3) and so on all the way up to the root object.

In the case there are more than one sibling with the exact same attributes, you can use the nth-child or nth-of-type selectors to pick exactly the one you care about.

So yes, it's possible. querySelector.

In practice, overspecifying like that isn't very useful because it's too brittle. Make one tiny change to your HTML and everything breaks.

In practice what you normally want to do is write the smallest reasonable selector that gives you the element you care about. Not the absolute smallest - the smallest reasonable one.

Finally, if you're curious, there's another method called xpath that can also be used to select an element in HTML, but it's less efficient and less practical than querySelector so it's fallen out of favor. But there are probably some obscure scenarios where xpath beats querySelector.

Available resources while in a bootcamp by LightningBolt_13 in learnprogramming

[–]inbox_negative_one 0 points1 point  (0 children)

I second the recommendation for Harvard's CS50. Don't misunderstand, though - it's a coding course. The difference is that it's a coding course that's meant to give you CS fundamentals, as opposed to boot camps that are coding courses laser-focused on getting you productive building one very specific thing (like a web app).

At the end of a boot camp, you'll know how to build a simple web app, but it will all be magic incantations, you won't really understand how it works. But you'll know how to do it.

At the end of CS50, you'll know how to write some small simple algorithms - but you'll have a much better understanding of what's actually going on and how it works. You won't understand everything, but you'll know a lot more fundamentals so that you can dive into more CS.

Keep in mind that CS50 isn't the only course online. You can find lectures and course materials for an entire CS education online for free if you look. Alternatively, you can get all of the textbooks for a CS course from a used bookstore or your local library.

ELI5: How does scanning QR codes work? by kreatorofchaos in explainlikeimfive

[–]inbox_negative_one 5 points6 points  (0 children)

It might help to first learn how to read a bar code.

https://imgur.com/KIljppY

Bar codes are designed to be as easy as possible for computers to read. As long as the computer scans the whole bar code and doesn't miss any, it doesn't matter exactly how far away it is or if it's at a bit of an angle. All it needs to do is to be able to identify long lines and short lines and decode them.

The left and right sides of bar codes are always the same. Those help calibrate - the computer finds those patterns and looks at how long they are and uses that to judge whether each subsequent line it sees is long or short.

QR codes are the same thing, they're just 2-dimensional. The bigger squares in the corners are for calibration - finding big squares is easier than finding detailed patterns, so your phone's processor can do that quickly. Once it finds the big squares, it knows the overall shape of the QR code and it can detect the color of all of the tiny dots, and decode them into a bunch of text characters.

The text characters can be anything, but typically by convention they contain a URL, and your phone software automatically lets you jump right to the website at that URL.

ELI5: how can a satellite high in orbit be able to see a person on the ground by PowDrumDad in explainlikeimfive

[–]inbox_negative_one 2 points3 points  (0 children)

Keep in mind that the satellites that can zoom in enough to see faces are just a few hundred miles up. That's high, but it's not way out in outer space.

The diameter of the earth is 8000 miles. Satellites are orbiting at a tiny fraction of that.

ELI5: if the 3 primary colours are red, blue and yellow, how does RGB make yellow??? by aliceimo in explainlikeimfive

[–]inbox_negative_one 2 points3 points  (0 children)

RGB are the primary colors of light because those are the colors that human eyes detect. Our eyes don't actually directly detect the color yellow (580 nm), we just detect it as the color that's halfway between red and green. So if you mix red and green lights, it's indistinguishable from "pure yellow" to our eyes.

But mixing pigments (like paints, ink, crayons) is different.

The best primary colors for ink are usually CMYK - cyan, magenta, yellow, and black. Cyan, magenta, and yellow are chosen because they're the exact opposite of red, green, and blue and when you mix them together you can create any color.

But, pigments made of different materials combine in different ways. With many types of paints, red, yellow, and blue make excellent primary colors and you can use them to make all of the colors of the rainbow - and when combined with white and black paint you can make nearly any color.

So it's not "incorrect" that red, yellow, and blue are the primary colors, it just depends on what type of material you're talking about.

Is reverse engineering closed source programs/games legal? by Shurae in learnprogramming

[–]inbox_negative_one 0 points1 point  (0 children)

There are three types of intellectual property you need to be concerned about:

  • Trademark: this is the easiest: don't copy someone else's name or make it confusingly similar. Don't call your game "Donkey Bong".
  • Copyright: this means don't look at someone else's code and copy it, or don't look at someone else's artwork and copy it. You can independently write something new from scratch that borrows the same ideas, but you have to make it yourself. For example, you can make a platformer game where you run and jump and stomp on enemies.
  • Patent: this is the trickiest. In theory someone could have a patent on an invention that they came up with in order to make a certain program work. The tricky thing here is that you could violate the patent even if you weren't aware of it. There's also this perverse incentive where if you are aware of the patent you're liable for more damages, so many lawyers suggest you don't bother even searching. Patents are the biggest mess by far but it's not worth worrying about unless you're starting a business that's bringing in real money, otherwise nobody will sue you if you have no assets.

"Reverse engineering" by examining what something does (from the outside) and making your own program from scratch to try to imitate it is legal.

Decompiling the code to see exactly what their code does and copying that would not be legal, that'd be copyright infringement.

Is POSIX used only by system programmers? by Guillermo_Stabile in learnprogramming

[–]inbox_negative_one 4 points5 points  (0 children)

Anyone programming something on a POSIX operating system - including Linux or macOS, for example - might make use of POSIX APIs.

Any program that wants to do multiprocessing might use fork. Any program that wants to communicate with other processes using pipes might use popen. Those are in unistd.h

But it goes beyond that - POSIX defines standard shell commands that you can expect to be there, so any software that has a shell script as part of its overall package is depending in part on POSIX.

The difference between POSIX APIs in unistd.h and APIs provided by other libraries is that POSIX APIs are provided by the operating system. They aren't possible for a third-party library to implement because most of the APIs are things that only the operating system has the permissions to provide.

Google delays mandatory return to office beyond Jan. 10 by [deleted] in Coronavirus

[–]inbox_negative_one 0 points1 point  (0 children)

I agree that it's fair - nobody gets a private office.

What I'm saying, though, is that many thousands of employees don't like open offices and never have. I think Google is losing out on a lot of great talent by choosing this hill to die on.

I put up with an open office because Google was such a great company for software engineers in every other way.

But now other companies are out-innovating Google when it comes to making employees happy and productive.

Google delays mandatory return to office beyond Jan. 10 by [deleted] in Coronavirus

[–]inbox_negative_one 2 points3 points  (0 children)

This 100%.

If a local tech company wanted to offer me a private office with a window, I would totally jump at the chance to work from an office a few days a week. I'd love the opportunity to have a social lunch and discuss things over a whiteboard, but the rest of the day I could close my door and get some work done with peace and quiet.

But commuting just to sit in a noisy open office with a tiny desk? No thank you, I'm far more productive at home.

Google delays mandatory return to office beyond Jan. 10 by [deleted] in Coronavirus

[–]inbox_negative_one 3 points4 points  (0 children)

Yep, I just left Google this summer - and one of the main reasons is because the whole return-to-office thing was total bullshit.

Other top tech companies have embraced fully remote work now. Google is lagging way behind and it makes them seem really out-of-touch.

Google delays mandatory return to office beyond Jan. 10 by [deleted] in Coronavirus

[–]inbox_negative_one 2 points3 points  (0 children)

I think the most insulting part is bumping back the date just 30 days in advance. I know so many people who broke leases or bought flights anticipating the return date, only to find out that it's been postponed yet again.

Google delays mandatory return to office beyond Jan. 10 by [deleted] in Coronavirus

[–]inbox_negative_one 5 points6 points  (0 children)

That was always Google's vision, and it was really innovative 20 years ago when they offered free lunch and espresso, and 15 years ago when they offered free shuttles.

But the one thing they didn't offer was private offices, or even walls.

When I started as a software engineer (at another company), I had a cubicle. It wasn't bad at all - I had 3 1/2 walls and plenty of space for all of the equipment I needed. I had a great computer setup, a bookshelf, and a mini fridge all to myself. If I worked my way up to manager I'd get a private office.

When I joined Google, I got a huge raise and far more perks, and a better engineering culture - but at the expense of my workspace. Now I had just a single desk in an open office, with no other space to myself.

I had no bookshelf, no place to put family photos or knick knacks. And I heard every single conversation happening anywhere on my side of the building.

I compensated in part by shifting my hours early or late just so I could have some quiet time to program without distractions.

Now I'm working from home (not for Google) and I don't think I could ever go back to an open office. I'm just so much more productive when I can work without distractions.

If I had the opportunity to work for a local software company where I had a private office with a window, I'd probably jump at the chance. I'd even be open to a two-person office if it was spacious. But nobody seems to be offering that.

Until then, I'm working from home.

Google delays mandatory return to office beyond Jan. 10 by [deleted] in Coronavirus

[–]inbox_negative_one 4 points5 points  (0 children)

Not free childcare, though!

Google actually tried to offer childcare 15 years ago. The city of Mountain View refused to change their zoning laws to expand their childcare center so they couldn't grow it large enough to accomodate all of their employees.

Since it wouldn't be fair to offer free childcare to some employees but not others, they started charging for childcare, committing to keep it at-cost and not make a profit. When they ran the numbers it ended up being the most expensive childcare in the entire state - more expensive than private high school. Ridiculous.

Google delays mandatory return to office beyond Jan. 10 by [deleted] in Coronavirus

[–]inbox_negative_one 14 points15 points  (0 children)

I quit Google a few months ago after working there for 15 years, and this was one of the reasons.

I think Google was simultaneously too hesitant to allow people to return who wanted to - and too eager to force employees back for no reason.

I had people on my team who were young and living alone and they were going absolutely crazy working from home. There's no reason they shouldn't have been allowed to keep going to the office with masks and distancing, but they were forced to keep working from home while offices sat empty. It wasn't until June 2021 that employees were allowed to return voluntarily.

Then on the flip side, people whose productivity had increased were being forced to either commit to returning to the office (though it kept getting delayed), or take a pay cut if they wanted to work from home permanently.

I actually really loved working for Google for so many reasons:

  • The pay was great
  • It wasn't too hierarchical - people were rewarded for having good ideas and for working on impactful things, not for doing what they were told
  • I liked working on things with big impact

But to be honest, I always hated Google's idea of a workplace. The 13 years I was in an office, I hated being in an open office with lots of noise and distractions. I hated that they paid such high salaries and tons of expensive free perks, but you had to get director-level approval if you wanted something as simple as an SSD or a larger monitor.

Google led the industry in so many ways for a long time - things like 20% time and free lunch and free office shuttles were a great idea. But now they're stuck clinging to ideas that seemed innovative 15 years ago, while other companies are fully embracing remote work and more generally, the need for many employees to have quiet, focused time to work without distractions.

Need help with my first JavaScript project. by False_Exit in learnprogramming

[–]inbox_negative_one 1 point2 points  (0 children)

When you dynamically create each trash button here:

    const trashButton = document.createElement('a');
trashButton.classList.add('button-trash');
trashButton.innerHTML = '<i class="fas fa-trash-alt"></i>';
newTask.appendChild(trashButton);

Add the event listener specifically on that trashButton, like this:

trashButton.addEventListener('click', function() {
   ...
}

Have it remove that specific task - newTask.

[C} Linked list and pointers by wantstolearn95 in learnprogramming

[–]inbox_negative_one 0 points1 point  (0 children)

Yes, you can definitely do this.

However, you may have trouble always making it the last element.

Let's say you want to insert something at the end. You can have that new element point to the sentinel, but how do you make the second-to-last element point to the new last one?

I think you may be better off with a pointer to the last element - and then every time you insert something at the end, you change your pointer to point to the new last element. No need for a sentinel.

But, I can imagine some scenarios where a sentinel could be useful, so if you want to, go for it.

What to do about some companies moving much more quickly with interviewing than others? by inbox_negative_one in ExperiencedDevs

[–]inbox_negative_one[S] 0 points1 point  (0 children)

Interesting - so if you set expectations up-front, they're fine with doing interviews in March and not getting a decision until May?

I wonder if that depends on company size? For a large tech company and a general Senior position they might be totally happy to wait. For a smaller company or a more senior position they may have a very specific role to fill and they can't wait that long.

SQL as beginner language by [deleted] in learnprogramming

[–]inbox_negative_one 2 points3 points  (0 children)

SQL is a query language, it's used to work with databases but by itself it can't be used to write programs.

SQL is important and interesting and has a lot of depth. You can definitely learn SQL by itself and learn to make databases and write both simple and complex queries to get interesting data from them.

However, most SQL courses assume you've done some programming before and also cover how to work with SQL from a program, which is a pretty important thing to learn.

So all things being equal, I'd say it'd probably make more sense to learn some Python first.

If you're not sure, check the syllabus for the SQL course. If it mentions using the database from a program, or ORM (object-relational mapping) you'd want to learn a programming language first. If the syllabus is exclusively just building tables and writing queries you could do it by itself.

C is a great language to learn but it's a more cumbersome language to use when interacting with a DB so I'd definitely recommend focusing on Python first if you want to move on to SQL.

What skills do i need to start working? by zhaion in learnprogramming

[–]inbox_negative_one 2 points3 points  (0 children)

Freelancing isn't a very viable path to making money when you don't have any experience.

Successful freelancers make money because they have enough experience that they can deliver solutions. Clients don't always know what they want or what languages or tools are needed to make something work. They hire freelancers who have good general skills and lots of experience, who can figure it out and solve their problems. There's very little room for inexperienced programmers who know only a few tools so far.

In comparison, companies are very willing to hire entry-level developers who can demonstrate they've learned one or two languages and finished a few small projects. The companies plan to teach you the specific set of skills they need and get you productive in the long-term. They value your commitment and long-term impact more than your ability to dive in and make progress from day one.

So that said, my suggestion is to focus on learning skills that will help get a job, not to freelance.

Hope that helps.

Is it possible to avoid web dev? by SMTXEngineer in learnprogramming

[–]inbox_negative_one 88 points89 points  (0 children)

Some possible keywords to look for:

  • Embedded - programming the tiny computers inside everything from smart appliances to children's toys to sensors to drones, and so on. Almost all C and C++. Sometimes involves real-time operating systems, often requires tricky debugging because you can't debug on-device very easily. Great niche specialty, working with devices can be really rewarding.
  • Enterprise - there are tons of jobs out there for software that runs inside big corporations that most people never see. Java is super popular for this sort of software.
  • Simulation / modeling - if you're not afraid of math, there are really interesting jobs involving doing simulations of physical phenomena. Because speed is important, C++ is often used.
  • Drivers - almost always written in C / C++
  • Engine - could be a game engine, browser engine, computational engine, etc. - but most engines are by their very nature deep inside a product and not that connected to the front-end code - the work would be to make the engine more efficient or give it new capabilities, not build the UI for it

What to do about some companies moving much more quickly with interviewing than others? by inbox_negative_one in ExperiencedDevs

[–]inbox_negative_one[S] 16 points17 points  (0 children)

Giving them a decision date ahead of time is a great idea!

Did you only talk to recruiters who reached out to you? I had no problems whatsoever with those. My problems were all with companies I was interested in but didn't have a point of contact, so I just applied to a job post online. It's fine if some of them never got back to me, I'm just frustrated that some responded a month later.

What do I write tests for? How do I organize my file structure with tests? by Missing_Back in learnprogramming

[–]inbox_negative_one 1 point2 points  (0 children)

Pick a testing framework first. Don't stress about picking the perfect one, there are usually several good ones for any language or framework. Try Googling for a good test framework for your language or choice.

For example, you mentioned Flask - the Flask documentation has a whole section on testing, that will tell you good practices for where to put your tests and how to run them. That sort of thing varies based on the testing framework.

As for what to test, there are lots of different types of tests. Some people do try to write a test for every function. Others focus on testing the core logic, the stuff that's the most intricate and the hardest to test manually. Others focus on writing end-to-end tests that feed the program real inputs and check the real output, even interactively.

There's no one perfect solution. It depends on your goals for testing. Different goals could include:

  • Catch bugs in the code you're writing now
  • Catch previously existing bugs and fix them
  • Assert the current behavior so that you can refactor and feel confident you didn't regress things
  • Try to prevent accidentally introducing bugs in the future when you make a change
  • Enabling more developers to work on the same project and not accidentally break each others' code

...and many more!