^Does Eclipse work with C? If not Code::Blocks is another big one. I honestly just use a terminal with vi and syntax highlighting and gdb.
Yes, via a plugin.
I don't use it either, though. gvim + YouCompleteMe + Syntastic for me.
^Does Eclipse work with C? If not Code::Blocks is another big one. I honestly just use a terminal with vi and syntax highlighting and gdb.
I didn't know about either one of those add ons but now I can't wait to write some code with them. Any other good mentions?Yes, via a plugin.
I don't use it either, though. gvim + YouCompleteMe + Syntastic for me.
How important is Linux to programming?
Just asking because it's a course I'm taking in my Computer Programming and Analysis program and they say that eventually once you start working you pretty much have to be familiar with linux and how to use its terminal.
Or just Debian if you want a more extensive desktop environment.Honestly, I jumped into Linux earlier this year with Ubuntu but I started noticing the bugs so I jumped into Crunchbang.
How important is Linux to programming?
Just asking because it's a course I'm taking in my Computer Programming and Analysis program and they say that eventually once you start working you pretty much have to be familiar with linux and how to use its terminal.
Linux is shit. No one should be forced to use it. At least contain it in a VM so you can get rid of it with a click.
How many sequence numbers are consumed by a SYN segment?
How many sequence numbers are consumed by an ACK segment?
How many sequence numbers are consumed by a SYN-ACK segment?
Linux is shit. No one should be forced to use it. At least contain it in a VM so you can get rid of it with a click.
Need some help understanding what my teacher is asking of me here.
I'm not really sure how the term "consumed" is being applied here.
What even
"Use up". E.g if you send a SYN with sequence number x, the SYN-ACK response will send an acknowledgement number x+1, which means that the next sequence number received should be x+1. There has been no actual data transmitted, but it was acknowledged that the SYN package was received by the receiver.
Here's a fairly good explaination: http://taosecurity.blogspot.de/2004/01/tcp-sequence-numbers-explained-today-i.html
I guess it was a response to the "Unix based systems are better for development anyway" post, which is equally meaningless.
If you're looking for a linux C/C++ development IDE, you probably want QtCreator.
All of the others are basically garbage.
Linux is shit. No one should be forced to use it. At least contain it in a VM so you can get rid of it with a click.
This is definitely true. I chose Crunchbang because it appeared pretty stripped down (in UI terms) making me learn how to use the terminal and its commands. The first week was hell and I wanted to switch back to something else but I stuck with it and now I love it.Or just Debian if you want a more extensive desktop environment.
A lot of people love Linux and it is used absolutely everywhere from warships to supercomputers. If you're going to call it shit, at least say why.
You shouldn't take my comment seriously. It was a response to the people saying that it is better without saying why, and a personal opinion.
If you want to know why i think it's shit, then:
1: Unfortunately i don't have a warship or a super computer.
2: I mainly develop Visual Studio on Windows for Windows, and Linux is pretty much useless for that.
3: It seems like every time I start Linux for something I run into some weird problem that apparently only applicable to my situation, and therefore is ungoogleble.
#include <iostream>
#include "ClassManager.h"
#include "Student.h"
using namespace std;
void ClassManager::menuDisplay(){
int itemSelection;
do{
cout << "-------------------------------\n" << endl;
cout << "\nWelcome to the class manager \n" << endl;
cout << "-------------------------------\n" << endl;
cout << "Please enter a menu item: " << endl;
cout << "1) Create a class " << endl;
cout << "\n" << endl;
cin >> itemSelection;
}while(itemSelection > 0 || itemSelection < 1);
menuSelection(itemSelection); //Invoke the menuSelection function
}
void ClassManager::menuSelection(int item){
switch(item)
case 1:
startClassCreate();
}
void ClassManager::startClassCreate(){
classCreate();
}
void ClassManager::classCreate(){
//char selection;
cout << "Enter how many students in the class" << endl;
cin >> numOfStudents;
//cout << "The number of students in this class is" << numOfStudents << ". " << "Is this correct?" << endl;
if(numOfStudents){
char fn[30];
char ln[30];
int studentAge = 0;
int nrStudents = 0;
students = reinterpret_cast <Student *> (malloc(sizeof(Student)*numOfStudents));
for(int i = 0; i < nrStudents; i++){
cout << "\n------------------------------------\n" << endl;
cout << "\nPlease enter the students first name: ";
cin >> fn;
cout << "\nPlease enter the students last name: ";
cin >> ln;
cout << "\nPlease enter the students age: ";
cin >> studentAge;
new(&students[i]) Student(ln, fn, studentAge);
}
}else{
cout << "There are no students in the class" << endl;
}
}
void ClassManager::classDisplay(){
if(students){
cout << "\n------------------------------------\n" << endl;
cout << "\nThis is the full class list ";
for(int i = 0; i < numOfStudents; i++){
cout << "Class list " << endl;
//cout << i+1 << ") " << students[i].lastName << ", " << students[i].firstName << " " << "Age: " << students[i].age << endl;
}
}else{
cout << "There needs to be students in the class\n" << endl;
}
}
class ClassManager{
private:
Student *students;
int numOfStudents;
public:
void menuDisplay();
void menuSelection(int item);
void classDisplay();
//Start functions
void startClassCreate();
//Functions
void classCreate();
};
#include <iostream>
using namespace std;
class Student{
private:
char *lastName;
char *firstName;
int age;
int numOfStudents;
public:
Student(char *ln, char *fn, int studentAge);
~Student();
//Getter
const char* getLastName();
const char* getFirstName();
int getAge();
int getNumOfStudents();
//Setter
void setLastName(const char* ln);
void setFirstName(const char* fn);
void setAge(int num);
void setNumOfStudents(int num);
};
By using std::vector instead of arrays everywhere. There's no good reason for that code to contain even a single pointer, malloc, new, delete, etc. All of those are contributing to the awfulness of the code. In the same spirit, use std::string instead of char* everywhere. C++ is not C.I'm having a bit of trouble. I'm trying to create an array of class objects then passing the array to functions. How do I do that exactly?
You shouldn't take my comment seriously. It was a response to the people saying that it is better without saying why, and a personal opinion.
If you want to know why i think it's shit, then:
1: Unfortunately i don't have a warship or a super computer.
2: I mainly develop Visual Studio on Windows for Windows, and Linux is pretty much useless for that.
3: It seems like every time I start Linux for something I run into some weird problem that apparently only applicable to my situation, and therefore is ungoogleble.
By using std::vector instead of arrays everywhere. There's no good reason for that code to contain even a single pointer, malloc, new, delete, etc. All of those are contributing to the awfulness of the code. In the same spirit, use std::string instead of char* everywhere. C++ is not C.
(You don't usually pass the vector into a function by value, which would cause it to be copied. Pass it as const reference (const std::vector<Student>&) when you only intend to read from it, and as a reference (std::vector<Student>&) when you intend to modify the original.)
C++ has about 500 ways of doing things. It's a huge language with tons of features and quirks and stuff. Most of those ways are horrible or wrong in one way or another, but you kind of need to know many of them anyway. They can't teach you everything, so even a good class will just start at what they think is a good spot.Thanks I'll try this. I haven't been taught vectors before actually... >>
EDIT - I'm so confused. If vectors seem so great and manages its own memory and stuff (or that's what I understand about this after a few quick google searches), why am I being taught about allocating memory for array of class objects using arrays?
You shouldn't take my comment seriously. It was a response to the people saying that it is better without saying why, and a personal opinion.
If you want to know why i think it's shit, then:
1: Unfortunately i don't have a warship or a super computer
Which isn't the point. The point is that Unix/Linux is everywhere. I work for a rather large company and at least half our applications run in a Unix/Linux environment with at least 3 additional major initiatives in POC at this moment. Good luck avoiding it because "I use Visual Studio". I'm sure that goes over swell in interviews.
There's a lot of things I miss about college, but the disconnected from reality Linux vs. Windows vs. Etc discussions is not one of them.
I can only offer guesses.Thanks I'll try this. I haven't been taught vectors before actually... >>
EDIT - I'm so confused. If vectors seem so great and manages its own memory and stuff (or that's what I understand about this after a few quick google searches), why am I being taught about allocating memory for array of class objects using arrays?
Bitmap b = new Bitmap(size, size); // size = 16000 or so
. . . then later
Graphigs g = new Graphics( . . . );
g.DrawImage(b, [new dimensions]); // MEMORY GOES OUT NOES
So, I tried using a fairly large image in C#, but the program breaks into an OutOfMemoryException.
Code:Bitmap b = new Bitmap(size, size); // size = 16000 or so . . . then later Graphigs g = new Graphics( . . . ); g.DrawImage(b, [new dimensions]); // MEMORY GOES OUT NOES
Not sure if there's a lighter way of doing this.
C++ has about 500 ways of doing things. It's a huge language with tons of features and quirks and stuff. Most of those ways are horrible or wrong in one way or another, but you kind of need to know many of them anyway. They can't teach you everything, so even a good class will just start at what they think is a good spot.
If it were me, I'd just do it the way they teach in class because of stupid things like teachers trying to catch cheaters or whatever.
Arrays are super mega bad though. I almost never use them directly, whether it's C++, Java or C#. They're especially bad in C++ because it's just raw memory (afaik). You don't even get the size, much less any bounds checking or whatever. It's just "Oh hey there's some stuff in memory over there somewhere. You figure it out." Thanks a lot, C++.
I can only offer guesses.
1) You are in an electrical engineering program or similar, and it's assumed this might be your first and last programming course, so they want to teach you nuts-and-bolts level C++ (basically C) because you'll need to be able to program low-level stuff, and they don't care about making you a decent C++ programmer.
2) They understand C++ but are bad teachers and do not understand it's a pedagogically unsound idea to teach you the wrong way first.
3) They are bad at C++.
Knowing the context would make things a bit clearer: is this your first programming course, are more courses going to follow, do you have explicit orders to use arrays rather than vectors/strings/etc.?
Thanks I'll try this. I haven't been taught vectors before actually... >>
EDIT - I'm so confused. If vectors seem so great and manages its own memory and stuff (or that's what I understand about this after a few quick google searches), why am I being taught about allocating memory for array of class objects using arrays?
I know you understand how stuff works, but the first part of what you wrote is wrong and confusing. Arrays can't be inserted into, constant time or otherwise - they are fixed size. std::vectors have virtually the same performance if you create them directly to desired size, but building them up from an empty vector by appending one thing at a time to the end is pretty fast too (amortized constant time) and good enough for anything a beginner would want to do.There are reasons why an expert programmer may prefer to use an array under certain circumstances:
1. Arrays have deterministic, constant-time insertion complexity. Vectors do not. Inserting to a vector may require a malloc and a copy. You can get around this using pre-reservation and bounds checking for vectors, but at that point you may as well just use an array.
So I got QT Creator up and running and it seems that whenever I try to compile and debug my code I get hit with this:
http://i.minus.com/jNhUKbQaErp2O.png[./IMG]
Anyone know why this is happening?[/QUOTE]
Looks like your ptrace scope is wrong. [URL="http://www.deder.at/wordpress/?p=307"]Try[/URL] setting kernel.yama.ptrace_scope = 0 in /etc/sysctl.d/10-ptrace.conf.
So I got QT Creator up and running and it seems that whenever I try to compile and debug my code I get hit with this:
![]()
Anyone know why this is happening?
I know you understand how stuff works, but the first part of what you wrote is wrong and confusing. Arrays can't be inserted into, constant time or otherwise - they are fixed size. std::vectors have virtually the same performance if you create them directly to desired size, but building them up from an empty vector by appending one thing at a time to the end is pretty fast too (amortized constant time) and good enough for anything a beginner would want to do.
And regarding the second part, a distinction has to be made between C style arrays and a proper container like std::array. The latter is technically optimal, but if it's not available to you or you haven't learned to use it yet, a fixed size std::vector is much nicer to use than a C array. A beginner should stick everything to a vector until they understand exactly why they are choosing to use some other container. Even after you know what you are doing, you'll probably end up using a vector most of the time. This is what Bjarne Stroustrup says, and this is what I tell my students.
UPDATE a SET a.salary = a.salary * 1.1
FROM staff a, branch b
WHERE b.city='London' AND b.staffno=a.staffno;
Okay I have to ask, why are you using an ide?
And if you HAVE to, why not eclipse?
What's wrong with an ide? I'm a newbie programmer who just moved from Windows to Linux since I reformatted and VS was comfortable to me. I just want an experience similar to that of VS to ease me into using Linux.
I installed QT creator based on a suggestion in the thread. What makes it inferior to Eclipse?
I didn't get such an impression.You seem to be interpreting my comments as a judgment that arrays are strictly better than vectors; that is not the case.
The problem with that is he's not an expert and won't be any time soon, and the question he actually asked was "why am I being taught about...". Your replies have been very informative and detailed, and we're agreeing on all the facts - I'm just trying to supply him with an answer more appropriate for his situation and skill level, and point out what stuff isn't so relevant to him at this point so it doesn't confuse him. I'd say the short answer to the question is teacher error; there's no good reason to teach arrays before vectors.I was responding to a question about why anyone would ever need to use or understand arrays by giving some practical use cases where arrays are better. I also think that beginners should stick to vectors, which is why I led off the previous post saying that "experts" may want to use arrays in "certain circumstances".
There's nothing wrong with an IDE at all. Do not put any stock into what a person says if they're telling you not to take advantage of tools.What's wrong with an ide? I'm a newbie programmer who just moved from Windows to Linux since I reformatted and VS was comfortable to me. I just want an experience similar to that of VS to ease me into using Linux.
I installed QT creator based on a suggestion in the thread. What makes it inferior to Eclipse?
I think you should examine your own perspective before espousing about disconnection from reality. There are a massive number of jobs out there where you may not have to ever touch linux in any capacity. The reality is that every job is different, and radicalism is always wrong. Saying that your environment or experience is true everywhere, for everyone is a great demonstration of a reality disconnect. That includes your view that linux is everywhere and ubiquitous, and that visual studio is not a good reason to use windows. You're wrong.Which isn't the point. The point is that Unix/Linux is everywhere. I work for a rather large company and at least half our applications run in a Unix/Linux environment with at least 3 additional major initiatives in POC at this moment. Good luck avoiding it because "I use Visual Studio". I'm sure that goes over swell in interviews.
There's a lot of things I miss about college, but the disconnected from reality Linux vs. Windows vs. Etc discussions is not one of them.