The Glade 4.0

"Turn the lights down, the party just got wilder."
It is currently Mon Aug 20, 2018 10:21 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 67 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Microsoft Visual Studio
PostPosted: Mon Feb 29, 2016 8:40 pm 
Offline
Commence Primary Ignition
User avatar

Joined: Thu Sep 03, 2009 9:59 am
Posts: 15600
Location: Combat Information Center
I bought a book on programming in C++ for beginners that came with a copy of this. Is it any good, or should I look for a different compiler? The book discusses right at the outset that it has a few minor idiosyncrasies.

I haven't done any programming in 20 years; the last time was a course in True Basic I took in college, and before I did that and Turbo Pascal in high school, but I thought it might be a good time to start learning it again.

_________________
"Kind-hearted people might of course think there was some ingenious way to disarm or defeat an enemy without too much bloodshed, and might imagine this is the true goal of the art of war. Pleasant as it sounds, it is a fallacy that must be exposed" - On War


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 29, 2016 9:41 pm 
Offline
Web Ninja
User avatar

Joined: Wed Sep 02, 2009 8:32 pm
Posts: 8244
Location: The Tunt Mansion
I hear the new version is pretty good.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Mar 01, 2016 10:17 am 
Offline

Joined: Thu Sep 03, 2009 10:03 am
Posts: 4922
If you are doing development on Windows, then Visual Studio is the standard for C++. If you're on Linux, then use whatever the most popular open source compiler is.

C++ isn't a very good language though unless you're making native video games. I'd go with Python for general use. PHP if you want to make a quick website. Just my 2 cents.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Mar 01, 2016 11:47 am 
Offline
User avatar

Joined: Wed Sep 02, 2009 10:49 pm
Posts: 3439
Location: St. Louis, MO
gcc

You can install Cygwin/X and get a full POSIX-compliant environment on your windows machine.

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject: Re:
PostPosted: Tue Mar 01, 2016 12:13 pm 
Offline

Joined: Thu Sep 03, 2009 10:03 am
Posts: 4922
shuyung wrote:
gcc

You can install Cygwin/X and get a full POSIX-compliant environment on your windows machine.


Technically I think you should use g++, not gcc.

Quote:
The main differences: gcc will compile: *.c/*.cpp files as C and C++ respectively. g++ will compile: *.c/*.cpp files but they will all be treated as C++ files. Also if you use g++ to link the object files it automatically links in the std C++ libraries (gcc does not do this).


Top
 Profile  
Reply with quote  
 Post subject: Re:
PostPosted: Tue Mar 01, 2016 11:25 pm 
Offline
Commence Primary Ignition
User avatar

Joined: Thu Sep 03, 2009 9:59 am
Posts: 15600
Location: Combat Information Center
shuyung wrote:
gcc

You can install Cygwin/X and get a full POSIX-compliant environment on your windows machine.


What does that mean?

Quote:
If you are doing development on Windows, then Visual Studio is the standard for C++. If you're on Linux, then use whatever the most popular open source compiler is.

C++ isn't a very good language though unless you're making native video games. I'd go with Python for general use. PHP if you want to make a quick website. Just my 2 cents.


At this point I'm not really doing much of anything - I'm literally re-learning how to do things like define variables, if-then statements, while loops... I remember doing all these things years ago but I don't know the syntax in C++ at all and I'm not familiar with how to do things like print text on the screen. It's going to be a long time before I develop much of anything.

_________________
"Kind-hearted people might of course think there was some ingenious way to disarm or defeat an enemy without too much bloodshed, and might imagine this is the true goal of the art of war. Pleasant as it sounds, it is a fallacy that must be exposed" - On War


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Mar 02, 2016 1:48 am 
Offline
User avatar

Joined: Wed Sep 02, 2009 10:49 pm
Posts: 3439
Location: St. Louis, MO
So, rather than installing Linux, you can simply install Cygwin (I recommend Cygwin/X, mostly because it's always nice to tunnel any sort of X session to your local desktop) and get a full shell environment (and X-windows environment, if installing Cygwin/X) on your otherwise dull or infuriating Microsoft machine. Many packages are compiled to run under Cygwin, and are installable, most notably just about every coding environment you could want. gcc is the GNU C Compiler, the single most prevalent compiler. Both things have the benefit of being free.

_________________
Image


Top
 Profile  
Reply with quote  
PostPosted: Wed Mar 02, 2016 8:42 am 
Offline
Manchurian Mod
User avatar

Joined: Fri Sep 04, 2009 9:40 am
Posts: 5844
DE and I had a conversation a little while ago where I suggested learning to write code. I don't know to what extent that has motivated him to go out and learn programming, but here are some of the points I presented.

It's fairly easy to pick up some basic skills. The resources are readily available. He can practice at home in his spare time.

It's low cost. Most of what he needs can be obtained on the Internet for free. If it's not his bag, he's not wasting a lot of money to find that out.

It's an in-demand skill that can be leveraged for financial gain. It also doesn't require you to have a four year degree in programming.

Once you know one programming language, learning another is not difficult. If he picks the "wrong language" to learn, he can just learn another one. Most programmers know and use several languages.

_________________
Buckle your pants or they might fall down.


Top
 Profile  
Reply with quote  
 Post subject: Re: Re:
PostPosted: Wed Mar 02, 2016 10:25 am 
Offline

Joined: Thu Sep 03, 2009 10:03 am
Posts: 4922
Diamondeye wrote:

What does that mean?



GNU/Linux (usually just called "Linux", to the annoyance of pedantics) is an operating system. You can install a special build of Linux inside of Windows without disturbing the rest of your Windows OS. You do this using something called Cygwin. Now inside of this, you can use open source tools such as GCC to compile C++.

Quote:
At this point I'm not really doing much of anything - I'm literally re-learning how to do things like define variables, if-then statements, while loops... I remember doing all these things years ago but I don't know the syntax in C++ at all and I'm not familiar with how to do things like print text on the screen. It's going to be a long time before I develop much of anything.


In my opinion you should start with Python or Java. Both are very popular languages that are much easier to jump into than C++, which has more flaws than other common languages. A disproportionately large amount of programmers hate C++. You should see how much people talk **** about it on popular programming forums.

Python is possibly the best language to start with because you can say "print variable_name_here" to print out the contents of any variable. And the syntax is very easy to understand. However, in college programming courses, Java is the most common language taught to beginners.

For the record, Python, Java, and C++ all look perhaps equally good on resumes.


Top
 Profile  
Reply with quote  
PostPosted: Wed Mar 02, 2016 10:42 am 
Offline
Commence Primary Ignition
User avatar

Joined: Thu Sep 03, 2009 9:59 am
Posts: 15600
Location: Combat Information Center
Corolinth wrote:
DE and I had a conversation a little while ago where I suggested learning to write code. I don't know to what extent that has motivated him to go out and learn programming, but here are some of the points I presented.

It's fairly easy to pick up some basic skills. The resources are readily available. He can practice at home in his spare time.

It's low cost. Most of what he needs can be obtained on the Internet for free. If it's not his bag, he's not wasting a lot of money to find that out.

It's an in-demand skill that can be leveraged for financial gain. It also doesn't require you to have a four year degree in programming.

Once you know one programming language, learning another is not difficult. If he picks the "wrong language" to learn, he can just learn another one. Most programmers know and use several languages.


Actually, that conversation was pretty instrumental in me deciding to try it out. I mentioned it to some IT/automation specialists here at work too, and they said similar things, so I figured why not go to the book store and get a book on it?

I picked C++ because the book they had on that seemed to be the best-written from a "teach a beginner from the beginning" standpoint; it wasn't just a reference book and didn't assume any real baseline knowledge - it explains things in pretty plain English.

It also moves things along in the later chapters. Looking back, one of my big frustrations with programming in high school was that we never really learned anything new in TrueBasic or Turbo Pascal even though TP was supposedly and AP course - we just did longer and more involved versions of "put in X, eventually get out Y" using the same very basic structures. I think we simply were at the limit of the teacher's knowledge who was a math teacher that had some interest in computers. I don't think learning it this way will suffer that limitation - plus, I have the benefit of the internet which we definitely didn't have in 1991 at home or at school.

Quote:
So, rather than installing Linux, you can simply install Cygwin (I recommend Cygwin/X, mostly because it's always nice to tunnel any sort of X session to your local desktop) and get a full shell environment (and X-windows environment, if installing Cygwin/X) on your otherwise dull or infuriating Microsoft machine. Many packages are compiled to run under Cygwin, and are installable, most notably just about every coding environment you could want. gcc is the GNU C Compiler, the single most prevalent compiler. Both things have the benefit of being free.


I'm still a bit mystified, but "free", "most prevalent compiler" and "you don't have to install Linux" area ll things I understand so I'll check this out. Where is the best place to obtain this?

_________________
"Kind-hearted people might of course think there was some ingenious way to disarm or defeat an enemy without too much bloodshed, and might imagine this is the true goal of the art of war. Pleasant as it sounds, it is a fallacy that must be exposed" - On War


Top
 Profile  
Reply with quote  
 Post subject: Re: Re:
PostPosted: Wed Mar 02, 2016 10:46 am 
Offline
Commence Primary Ignition
User avatar

Joined: Thu Sep 03, 2009 9:59 am
Posts: 15600
Location: Combat Information Center
Lex Luthor wrote:
Diamondeye wrote:

What does that mean?



GNU/Linux (usually just called "Linux", to the annoyance of pedantics) is an operating system. You can install a special build of Linux inside of Windows without disturbing the rest of your Windows OS. You do this using something called Cygwin. Now inside of this, you can use open source tools such as GCC to compile C++.

Quote:
At this point I'm not really doing much of anything - I'm literally re-learning how to do things like define variables, if-then statements, while loops... I remember doing all these things years ago but I don't know the syntax in C++ at all and I'm not familiar with how to do things like print text on the screen. It's going to be a long time before I develop much of anything.


In my opinion you should start with Python or Java. Both are very popular languages that are much easier to jump into than C++, which has more flaws than other common languages. A disproportionately large amount of programmers hate C++. You should see how much people talk **** about it on popular programming forums.

Python is possibly the best language to start with because you can say "print variable_name_here" to print out the contents of any variable. And the syntax is very easy to understand. However, in college programming courses, Java is the most common language taught to beginners.

For the record, Python, Java, and C++ all look perhaps equally good on resumes.


I can always pick up a book on those as well. I've obviously heard of Java quite a bit, and Python is something I've heard of through EVE - it was evidently originally written in Stackless Python (whatever that is) and "legacy code" is an ongoing joke in the community since apparently it greatly slows down a lot of upgrade efforts. Apparently the original code has some pretty bad inefficiencies, and the actual code-writer developers regularly curse it. They occasionally reveal some details about it which sound pretty bad even to a novice.

_________________
"Kind-hearted people might of course think there was some ingenious way to disarm or defeat an enemy without too much bloodshed, and might imagine this is the true goal of the art of war. Pleasant as it sounds, it is a fallacy that must be exposed" - On War


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Mar 02, 2016 10:58 am 
Offline
User avatar

Joined: Wed Sep 02, 2009 10:49 pm
Posts: 3439
Location: St. Louis, MO
A disproportionately large amount of programmers hate C++ because it's the single language that every programmer is familiar with. Most languages have a user population in the 10s of thousands, maybe 100s. C/C++ has everybody.

Do not bother to work with Java. Due to fundamental security flaws, no one is recommended to have it in any production environment, ever. It is dying, and it cannot decay into compost fast enough.

Python is very popular, it's a more "natural" language. You can mumble to yourself what you want your code to accomplish, and that's pretty much how you type it out (without the profanities). Due to this, it's also one of the leading languages for web development. It works very well with SQL DBs. The other two languages in the trifecta are PHP and Perl.

Diamondeye wrote:
I'm still a bit mystified, but "free", "most prevalent compiler" and "you don't have to install Linux" area ll things I understand so I'll check this out. Where is the best place to obtain this?

cygwin.org

You'll download the setup executable, and then upon running that, you'll go in and select the packages you want to install. You can leave most things at the default, but you'll want to drill into the development environment or programming languages subsection and select everything that looks interesting. Later on, when you get a better feel for what it's got, you can add more stuff.

_________________
Image


Top
 Profile  
Reply with quote  
PostPosted: Wed Mar 02, 2016 11:29 am 
Offline

Joined: Thu Sep 03, 2009 10:03 am
Posts: 4922
Well a nice thing about Java is that it constrains the way you code. It's easy for beginners to write really bad or illegible Perl or C++, but for Java that won't happen as much by accident. So Java is good for large teams of programmers who might be inexperienced. Basically anyone can understand anyone else's Java.

I don't think Java is dying. It remains one of the most widely used languages, and not just for legacy projects. I think it's used mainly by big corporations that are well funded, rather than open source projects. It also has high performance so it can be useful for projects that need to scale.

If you want to just get something working, then Perl, Python, or PHP are the way to go. Those languages are probably the easiest to develop in.


Top
 Profile  
Reply with quote  
 Post subject: Re:
PostPosted: Wed Mar 02, 2016 12:33 pm 
Offline
Commence Primary Ignition
User avatar

Joined: Thu Sep 03, 2009 9:59 am
Posts: 15600
Location: Combat Information Center
shuyung wrote:
cygwin.org

You'll download the setup executable, and then upon running that, you'll go in and select the packages you want to install. You can leave most things at the default, but you'll want to drill into the development environment or programming languages subsection and select everything that looks interesting. Later on, when you get a better feel for what it's got, you can add more stuff.


Thanks, I'll try this out.

I did not realize that there were such strong opinions on languages, especially Java. I do remember reading some Java end-user agreement a long time ago (10 years or more, probably), when downloading it for some program or other that required you to have it installed that said something along the lines of "don't use Java for anything involving failsafes" and went on to give a long list of thins like air traffic control and nuclear reactors where you weren't supposed to use it.

:shock:

_________________
"Kind-hearted people might of course think there was some ingenious way to disarm or defeat an enemy without too much bloodshed, and might imagine this is the true goal of the art of war. Pleasant as it sounds, it is a fallacy that must be exposed" - On War


Top
 Profile  
Reply with quote  
PostPosted: Wed Mar 02, 2016 8:09 pm 
Offline
Commence Primary Ignition
User avatar

Joined: Thu Sep 03, 2009 9:59 am
Posts: 15600
Location: Combat Information Center
cygwin seems to have a fascinating array of tools but I'm not sure what 99% of them even are. I downloaded a few that I could sorta kinda identify and as I move beyond "make ascii characters appear on a screen" I'll start using it more.

_________________
"Kind-hearted people might of course think there was some ingenious way to disarm or defeat an enemy without too much bloodshed, and might imagine this is the true goal of the art of war. Pleasant as it sounds, it is a fallacy that must be exposed" - On War


Top
 Profile  
Reply with quote  
 Post subject: Re: Re:
PostPosted: Wed Mar 02, 2016 8:13 pm 
Offline
Web Ninja
User avatar

Joined: Wed Sep 02, 2009 8:32 pm
Posts: 8244
Location: The Tunt Mansion
Diamondeye wrote:
I did not realize that there were such strong opinions on languages, especially Java.


Oh boy, debates about the best languages are as numerous as any other nerd debate you can imagine.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Mar 02, 2016 10:57 pm 
Offline
Deuce Master

Joined: Thu Sep 03, 2009 9:45 am
Posts: 3028
I will throw in for python as well. Pretty easy to pick up, free, and tons of resources for learning. Code Academy has modules on it.

_________________
The Dude abides.


Top
 Profile  
Reply with quote  
 Post subject: Re: Re:
PostPosted: Thu Mar 03, 2016 12:19 pm 
Offline
Commence Primary Ignition
User avatar

Joined: Thu Sep 03, 2009 9:59 am
Posts: 15600
Location: Combat Information Center
Lenas wrote:
Diamondeye wrote:
I did not realize that there were such strong opinions on languages, especially Java.


Oh boy, debates about the best languages are as numerous as any other nerd debate you can imagine.


I suppose I shouldn't be surprised. I always thought that each language was for certain purposes and it was a matter of using the right tool for the job.

_________________
"Kind-hearted people might of course think there was some ingenious way to disarm or defeat an enemy without too much bloodshed, and might imagine this is the true goal of the art of war. Pleasant as it sounds, it is a fallacy that must be exposed" - On War


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Mar 03, 2016 5:13 pm 
Offline
Manchurian Mod
User avatar

Joined: Fri Sep 04, 2009 9:40 am
Posts: 5844
A little from column A, a little from column B.

As to Java, here are the arguments for both sides.

Pro: Java is easy to learn, easy to use, and is very prevalent in devices that are connected to the Internet. Everybody knows Java and likes writing Java because it's such familiar, well-traveled ground.

Con: Java contains security holes big enough to drive a truck through. Oracle has a notoriously poor track record for handling these security vulnerabilities.

_________________
Buckle your pants or they might fall down.


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 03, 2016 6:43 pm 
Offline
Commence Primary Ignition
User avatar

Joined: Thu Sep 03, 2009 9:59 am
Posts: 15600
Location: Combat Information Center
This is the level I'm at. I produced this solution for a program that will produce a factorial using a function:

Code:
#include "stdafx.h"
#include <iostream>
using namespace std;
int i = 0;
int n = 0;
int x = 0;
int result(int x, int n);

int main()
{
   int f = 0;
   cout << "To determine the factorial, input an integer greater than 1: ";
   cin >> f;
   i = f;
   x = f;
   cout << endl;
   for (i = f; i >= 2; --i) {
      n = i - 1;
      result(x, n);
      x = result(x, n);
   }
   cout << "Factorial of " << f << " is: " << result(x, n) << endl;
   return 0;
}

int result(int x, int n) {
   return (x * n);
}


It took me 45 minutes to get that to work right - almost all of which was it running fine but giving an incorrect result.

_________________
"Kind-hearted people might of course think there was some ingenious way to disarm or defeat an enemy without too much bloodshed, and might imagine this is the true goal of the art of war. Pleasant as it sounds, it is a fallacy that must be exposed" - On War


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Mar 03, 2016 10:00 pm 
Offline

Joined: Thu Sep 03, 2009 10:03 am
Posts: 4922
Glad you got it working. Here's some feedback:

1. You shouldn't be using global variables for this.
2. Your variable names are not descriptive (on second thought, this is probably fine here).
3. You're calling result(x, n) twice and only using the return value the second time.
4. The result() function is unnecessary and should be removed.

Corolinth wrote:

Con: Java contains security holes big enough to drive a truck through. Oracle has a notoriously poor track record for handling these security vulnerabilities.


I disagree about Java containing security holes. I'm sure many Java frameworks, libraries, and applications have security issues but I don't think the problem is the Java language or the Java virtual machine. You can write very secure software with Java.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Mar 03, 2016 10:21 pm 
Offline
Manchurian Mod
User avatar

Joined: Fri Sep 04, 2009 9:40 am
Posts: 5844
Use of global variables is a bad habit that is quite common among beginning programmers. Early in one's foray into programming, it is difficult to understand why you should avoid them, and when it is appropriate to use them.

_________________
Buckle your pants or they might fall down.


Top
 Profile  
Reply with quote  
PostPosted: Fri Mar 04, 2016 12:37 pm 
Offline
Commence Primary Ignition
User avatar

Joined: Thu Sep 03, 2009 9:59 am
Posts: 15600
Location: Combat Information Center
Thanks for the feedback. I don't actually know what a "global variable" is yet, although the name gives some clues. I believe it's in a chapter coming up shortly though.

As for the unnecessary function, the program was an exercise from the book to write it using a function so I did it - but I see what you mean about it not being required.

_________________
"Kind-hearted people might of course think there was some ingenious way to disarm or defeat an enemy without too much bloodshed, and might imagine this is the true goal of the art of war. Pleasant as it sounds, it is a fallacy that must be exposed" - On War


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Mar 04, 2016 1:17 pm 
Offline
Sensitive Ponytail Guy
User avatar

Joined: Fri Sep 04, 2009 10:18 pm
Posts: 2765
Global variable = one whose value can be manipulated by any function or subroutine that wants to mess with it.

In really small programs (like the kind you write as homework assignments), it's really easy to keep track of everything that's being done to your variable. In larger programs, you may find yourself searching through 200,000 lines of code to find out how/where/why the value changed.

Global constants, on the other hand, are wonderful.

_________________
Go back to zero, take a pill, and get well ~ Lemmy Kilmister


Top
 Profile  
Reply with quote  
PostPosted: Fri Mar 04, 2016 3:07 pm 
Offline

Joined: Sun Sep 06, 2009 12:09 pm
Posts: 733
shuyung wrote:
Do not bother to work with Java. Due to fundamental security flaws, no one is recommended to have it in any production environment, ever. It is dying, and it cannot decay into compost fast enough.
That's not really true. There is a huge desire by companies that do software development for Java developers, especially in the companies that do contract work for the govt (and the intelligence community specifically). They also do a lot of work in Python, C/C++, and (yuck) Fortran.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 67 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group