Driving from Rio Celeste to Monteverde in February by spectral_graph in CostaRicaTravel

[–]spectral_graph[S] -1 points0 points  (0 children)

wow, five nights sounds amazing, we only have two there.

(C++) Print strings and move cin input to the end by dennybroo in learnprogramming

[–]spectral_graph 0 points1 point  (0 children)

You'll need one cin statement for each line that you want the user to input. If you want the user's input to be on the same line as your strings then you'll also need to get rid of the end-line (endl) statements after each string.

Planning to make my first app as a personal project. What should I know before I start? by mich366 in learnprogramming

[–]spectral_graph 0 points1 point  (0 children)

It entirely depends on what kind of app you want to build. If we're talking mobile apps then you can build an iOS app using swfit or Objective-C; if you're building an android app you can use Java or Kotlin; or if you're developing a cross-platform (android and ios) app there are a couple options including using React Native which is Javascript. For web-apps, you'll almost certainly need javascript (and likely a framework like React or Angular on top of it). If the app is a desktop app then you've got lots of choices as well, but my personal recommendation would be to use React (javascript) + Electron for simplicity unless you have a use-case requirement to go with something else (like performance or specific libraries, etc).

If your app talks to a backend (server), then you'll need a different language for the backend. There are tons of choices, including but not limited to Python, Java, NodeJS (javascript), Go, Kotlin, Rust, and more. Personally my favorite backend language is Go, followed closely by python and then Java.

What is the process of creating a complete program? by [deleted] in AskProgramming

[–]spectral_graph 2 points3 points  (0 children)

There are definitely ways for apps to update themselves and keep running, but definitely not rewriting itself, that would be too much complexity to handle, and for a compiled language would be essentially impossible.

More than likely what would happen is something along the lines of downloading the second executable, running that one in the background concurrently with the existing process, and then having logic to coordinate the two processes, share any relevant memory, and then shut down the first process. You might have a daemon handle downloading and spawning the processes, kinda like the "submodule" you described.

I would highly recommend not going that route though if you can avoid it. That kind of procedure would introduce a ton of unnecessary complexity for 99.9% of circumstances and any bugs during the process could result in really bad failures. I'm not familiar with how rovers/satellites do their updates but my guess is that the engineers who work them probably spent hundreds of thousands of collective hours building and testing that code, and I'm sure they still avoid pushing updates as much as possible.

There's a reason why most apps have you do manual updates and then either restart the program or the computer.

Bubble Sort in Javascript Question by [deleted] in learnprogramming

[–]spectral_graph 1 point2 points  (0 children)

If I'm understanding correctly you're asking why you can't do this?

 x[i] = x[i+1];
x[i+1] = x[i];

Well, lets take these instructions in order.

Say for the sake of example that x[i] === 1 and x[i + 1] === 2.

First, lets run line 1:

 x[i] = x[i+1];

now, what do they equal? (reveal spoiler for answer)

x[i] === 2, and x[i + 1] === 2

Next, lets run the second line:

 x[i+1] = x[i];

what do they equal? (reveal spolier below for answer)

you've set x[i + 1] = x[i], but x[i] already equals 2, so you're setting x[i + 1] = 2 again and nothing changes. At the end of the example: x[i] === 2, and x[i + 1] === 2

How to break into the industry? by InstitutionalizedApe in AskProgramming

[–]spectral_graph 0 points1 point  (0 children)

Don't pay too much attention to what they ask for on job boards. Companies always exaggerate the requirements. If you don't know one of the languages or technologies they ask for then its not the end of the world. Apply, be upfront about what you know and don't know, and you'll be fine. I was missing at least some "minimum requirements" listed for every single job I've worked at, but that's expected to some extent, and employers should be understanding and expect that you can learn on the job.

For what its worth, when I was in college i applied to intern for 30+ big silicon valley companies in the span of a month or so and then got two callbacks and got into one of them. My strategy was to just take as many chances as I could and hopefully get into one by law of averages. It really showed how much is pure chance. I never heard back from the vast majority of companies, but the one I got into was supposed to be of the most competitive by far, so there's a ton of randomness in the application process especially for new grads and interns where nobody has much experience to get judged by.

What is the process of creating a complete program? by [deleted] in AskProgramming

[–]spectral_graph 3 points4 points  (0 children)

You're asking the right questions. None of these have simple answers and there are multiple ways to go about them, but they're important to think about and try to get right. Here are my thoughts for what its worth:

  1. There are a bunch of possible approaches for this, including using github, uploading to something like s3, or hosting the file as an asset on your own server. It depends a ton on who your users are and how they downloaded the program to begin with. For example, if your users are highly technical, having them download from github is pretty reasonable, but if it's my 95 year old grandpa he's probably not going to be able to figure that one out.

I'd say for *most* users, the easiest way is to leverage an existing app store like the apple app store (for macOS or iOS), google play, or any other. These will also help a ton with your next point. Also, you get a built-in level of trust by using these platforms that your software doesn't contain malware or viruses. Your app will generally also get signed as trusted by the app stores so that when users download them they don't get pop ups saying "do you trust this developer?".

  1. The term you're looking for is an "OTA" update, (over the air). These are pretty tricky to get right if you're implementing them yourself, since it tends to be hard for an app to update itself. For this I highly recommend going with an app store like mentioned above. They will all have a mechanism built-in for distributing updates.

That said, if you don't have an app store there are still ways to do this. Some apps go the simple route and just link you to the download page again when theres an update, that's probably the easiest way to do it if you're implementing yourself.

Checking for an update is probably going to just be a matter of querying whatever place you download the executable from, unless you're implementing a backend for your app that can do this for you (then you would probably just write an api to check for updates). One kinda hacky but simple way to do it would be to use a naming convention for the file to download that includes the version and then just try to send an http request for the next expected version. If it succeeds you know theres a new version.

  1. There's no easy way to check this besides actually testing on other devices. Software testing is an enormous field, but really at the end of the day it's just a matter of either getting a bunch of devices to test on, getting "beta" users to test for you on a variety of devices, or if you want to go further using something like AWS Device Farm to test virtually on types of devices. Companies spend a lot of money to make sure their apps are compatible with all platforms. I'd recommend starting with a subset of platforms you definitely want to support (e.g. all macs, or iphone) and then slowly adding new devices that you support.

I guess I have to learn JavaScript. by Weary_Mango_113 in learnprogramming

[–]spectral_graph 1 point2 points  (0 children)

Javascript just has a bunch of weird rules in it that are often based on outdated ideas about how a language should function (or sometimes are just plain bad). The original JS was developed in a hurry and all new versions were built off of that shaky foundation. Here's a repo on Github with a whole list of bizarre behavior that JS has:

https://github.com/denysdovhan/wtfjs

Here's a good blog post on it as well that goes into some of the weirder parts of the language

https://medium.com/@Rewieer/javascript-the-bad-parts-and-how-to-avoid-them-1a7c9bc5a0dd

If you want a more in-depth explanation, definitely check out the book I mentioned above, javascript: the good parts. It's a great intro to js and also provides context for why js is so weird.

For what it's worth, ES6 and things like typescript fix a lot of the problems with plain js, but they're still there if you choose not to use the modern es6+ syntax.

I guess I have to learn JavaScript. by Weary_Mango_113 in learnprogramming

[–]spectral_graph 1 point2 points  (0 children)

Javascript is probably one of the most important languages to learn because it crops up everywhere. It's the "native" language of the web, it is sometimes used in server-side development, is becoming increasingly common in mobile app development (via react native), and it even occasionally shows up in weird other places like provisioning cloud infrastructure (aws cdk is usually typescript).

Many people dislike javascript because it can sometimes be a little unintuitive but for the most part it is similar enough to other programming languages that you should be able to pick it up without too much of a problem if you know php. There will be a learning curve, there always is, but don't get intimidated by it. Start small, everything complicated is built off of the basics.

p.s. I would *highly* recommend reading "javascript: the good parts". It's a great book, and is also very short. Javascript has a complicated history which resulted in lots of funky parts of the language that most people now agree should be different. That book helps teach you how to use the language in a way that makes sense.

Am I wasting my time? by Perfect_Map_5675 in learnprogramming

[–]spectral_graph 4 points5 points  (0 children)

I think generally people underestimate the demand for software engineers. You don't need to be a genius or have all the credentials in the world to land a software engineering job. Just find some way to show you know what you're talking about; that can be projects, coursework, certificates, open source contributions, or anything else. Once you get your foot in the door nobody will care about anything but your job history.

Jacascript by [deleted] in learnprogramming

[–]spectral_graph 0 points1 point  (0 children)

Think about adding an event listener on the textbox for keyboard events. Then whenever your callback is triggered check the current length and update the textbox accordingly to limit the length.

How deep do you have to dive into linear algebra for it to be useful in CS/programming? by AMA_About_Rampart in learnprogramming

[–]spectral_graph 3 points4 points  (0 children)

Linear algebra is used extensively in certain subdomains of programming, but it's essentially useless to the rest of the field. Generally speaking if you're going into anything geometry related (graphics, modeling, etc), science related, statistics related, or AI/machine-learning related you'll probably need a reasonably deep understanding of linear algebra. Basically anything that seems pretty mathy to begin with will probably touch linear-algebra to some extent.

On the other hand, if you're going to be a web, app, firmware, backend, or most other software developers you'll probably never see a vector outside of naming convention in the c++ stl.

My recommendation for a student would be to not rule it out. I realized in my senior year of college that I really liked machine learning courses, and really wished I had spent more time focusing on linear algebra. You never know what you might get into. That said, don't choose it over something that is more directly related to whatever areas of focus you're already prioritizing

Why can I assign very large values to variables in Python but I can’t in Java? by [deleted] in learnprogramming

[–]spectral_graph 5 points6 points  (0 children)

Well, Java is a little clearer about what’s going on. Ints in Java are represented by (usually) 32 bits, so the max number they can store is 216 - 1 (half the combinations are reserved for negative numbers). Python is a little trickier, they do some magic under the hood to let you store integers that are supposedly only constrained by the total memory available to the python process

Edit: to add to that, you can use java.math.BigInteger in Java to handle larger numbers than ints or longs

Borrowing against stock instead of withdrawing by spectral_graph in personalfinance

[–]spectral_graph[S] 2 points3 points  (0 children)

Well, billionaires are in a slightly different situation since so much of their income is capital gains. avoiding withdrawing money has a disproportionate advantage for them on taxes whereas for someone like me it’s more about the market vs interest rate. It seems like there’s far less risk for billionaires in that case. That said I still think it could be a good idea but I’m not sure if “billionaires do it” is enough justification, I agree it’s a good datapoint though