• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

Programming |OT| C is better than C++! No, C++ is better than C

Defiantly will get those. My school is not a technology school, it's a business school. They have a small CS department and CIS wasn't actually offered up until a few years ago. They are more focused on business side of the school so it's really hard to get help for internships, getting more classes etc. My only other option was a top tech school that was 40k a year, no thanks lol.

You'll make it, just be persistent, as I said earlier.

I was CIS, too (although at my school, it was ISOM, for Information Systems/Operations Management), and it was also part of the business school. In retrospect, I wish I had pursued CS, just for mostly nerdy reasons. But I didn't decide until late in my collegiate career that I even wanted to do anything "IT related." I was pre-business at one school, transferred closer to home and stayed in business, declared for Marketing and decided within a week of the first course that I hated it, then started checking into the ISOM department. It was the smoothest transition, given my completed coursework.
 

sans_pants

avec_pénis
FizzBuzz test seems really simple if you have any mathematics background whatsoever.

I used to think a lot of the branches of mathematics were a waste of time until I took my first programming course this year.

Code:
for number in range(1, 101, 1):
    
    if number%3 == 0 and number%5 == 0:
        print("FizzBuzz")
    elif number%3 == 0:
        print("Fizz")
    elif number%5 == 0:
        print("Buzz")
    else:
        print(number)


do you guys think khan academy would be good for someone who was never really that into math and hasnt done much since high school? what basic stuff to learn, like algebra or geometry?
 

pompidu

Member
You'll make it, just be persistent, as I said earlier.

I was CIS, too (although at my school, it was ISOM, for Information Systems/Operations Management), and it was also part of the business school. In retrospect, I wish I had pursued CS, just for mostly nerdy reasons. But I didn't decide until late in my collegiate career that I even wanted to do anything "IT related." I was pre-business at one school, transferred closer to home and stayed in business, declared for Marketing and decided within a week of the first course that I hated it, then started checking into the ISOM department. It was the smoothest transition, given my completed coursework.

Gonna try to be persistent lol. Yeah were really heavy on the business side, so hopefully if I stay motivated I can get a decent job when I'm done, hopefully around where I am.
 

jokkir

Member
Anyone know why this isn't changing the value?

Class:
Code:
class Test{
	private:
		char rawData[];
		char signal[];
		int frequency;
		int a;
		int b;
	
	public:
		Test();
};

And .cpp file:
Code:
Seti::Seti(){
	strcpy(rawData,"");
	strcpy(signal,"TEST-CONSTRUCTOR");
	frequency = 0;
	a = 32;
	b = 126;
}

It's not changing the value of signal to TEST-CONSTRUCTOR. Anyone know why?

EDIT - Nevermind, I'm dumb >_> I had to set a size for signal
 

poweld

Member
Anyone know why this isn't changing the value?

Class:
Code:
class Test{
	private:
		char rawData[];
		char signal[];
		int frequency;
		int a;
		int b;
	
	public:
		Test();
};

And .cpp file:
Code:
Seti::Seti(){
	strcpy(rawData,"");
	strcpy(signal,"TEST-CONSTRUCTOR");
	frequency = 0;
	a = 32;
	b = 126;
}

It's not changing the value of signal to TEST-CONSTRUCTOR. Anyone know why?

EDIT - Nevermind, I'm dumb >_>

Always share the solution.
 

leroidys

Member
So somehow I've made it almost two years in my program without ever having to use emacs, and am now finally going to be using it this quarter. Going through a tutorial... why is this a popular thing? They keep talking about how great it is that you can use a keystroke combo to move characters and stuff like that. I dunno, just a bunch of stuff that I can do with a mouse or arrow keys, or other commands in any text editing program. I guess I don't see how this would increase my productivity all that much.
 

usea

Member
So somehow I've made it almost two years in my program without ever having to use emacs, and am now finally going to be using it this quarter. Going through a tutorial... why is this a popular thing? They keep talking about how great it is that you can use a keystroke combo to move characters and stuff like that. I dunno, just a bunch of stuff that I can do with a mouse or arrow keys, or other commands in any text editing program. I guess I don't see how this would increase my productivity all that much.
It's terrible. Don't get sucked into the bs. (I've never used it before)

I feel like I'm very effective with the keyboard in Windows editors. Most of them have the same hotkeys to jump around text, and I've been doing them for 10 years so I'm pretty good at them. There's a lot of keyboard shortcuts in Windows that are useful, but people don't know about them because they just use the mouse or whatever instead.
 
It's terrible. Don't get sucked into the bs. (I've never used it before)

I feel like I'm very effective with the keyboard in Windows editors. Most of them have the same hotkeys to jump around text, and I've been doing them for 10 years so I'm pretty good at them. There's a lot of keyboard shortcuts in Windows that are useful, but people don't know about them because they just use the mouse or whatever instead.

That is all true. However when you are working over ssh remotely, emacs or vim (the one true god) skills are going to win the day.

One or the other is well worth learning.
 

usea

Member
That is all true. However when you are working over ssh remotely, emacs or vim (the one true god) skills are going to win the day.
When I am working remotely, I do my work locally and have the file sftp automatically whenever I save. But yeah, sometimes you just have to use a terminal.
 

leroidys

Member
That is all true. However when you are working over ssh remotely, emacs or vim (the one true god) skills are going to win the day.

One or the other is well worth learning.

That's an interesting point. I don't do ssh work often, but when I do, yeah its a total PITA.

It's terrible. Don't get sucked into the bs. (I've never used it before)

I feel like I'm very effective with the keyboard in Windows editors. Most of them have the same hotkeys to jump around text, and I've been doing them for 10 years so I'm pretty good at them. There's a lot of keyboard shortcuts in Windows that are useful, but people don't know about them because they just use the mouse or whatever instead.

Yeah, I know tons of shortcuts that work in normal text editors, and the great thing is that they mostly are usable in word documents, webpages, etc. It blows my mind when I'm helping someone else debug something, and they're a senior CS student highlighting a function name with a mouse and then going right click -> copy, or whatever. I could see how emacs/vim would increase someone's productivity if that was where they were coming from, but I feel pretty proficient in terms of jumping through a document already.
 
So somehow I've made it almost two years in my program without ever having to use emacs, and am now finally going to be using it this quarter. Going through a tutorial... why is this a popular thing? They keep talking about how great it is that you can use a keystroke combo to move characters and stuff like that. I dunno, just a bunch of stuff that I can do with a mouse or arrow keys, or other commands in any text editing program. I guess I don't see how this would increase my productivity all that much.

It's a sexy editor and the keystroke combos make you look bad-ass. Why would you not use it?
 
That's an interesting point. I don't do ssh work often, but when I do, yeah its a total PITA.

Ssh over dial up was the glory days. Counting your keystrokes and vi commands in your head exactly as you type them and then waiting 30 seconds for it all to happen was a true art.
 

usea

Member
Here are some text-related hotkeys. Sorry if this is well-known stuff, but if it helps just one person it's worth it. They work in most windows editors, and some others too (sublime text on linux, etc). They work in visual studio, notepad++, etc etc.

basic stuff: please do not right click to copy, paste, etc. This is horrible :( you kill babies every time you do it. There are hotkeys for those operations. In fact, using the mouse when editing text is way too slow 99% of the time. There are occasions where it'll be faster, but they're not the majority.

If you hold shift, moving the cursor will highlight text. This is usually faster than moving your hand to the mouse to highlight text, especially combined with some extra hotkeys below. Shift+up to highlight from your cursor to the line above, etc.

In most editors, you can indent multiple lines at once by highlighting some text on each line and pressing tab. For example, hold shift and press up 3 times. Then press tab. This should indent the line you started on, plus the 3 lines above it. You can un-indent with shift+tab.

Most editors have a hotkey for commenting out any lines you have highlighted. Often it involves ctrl+k.

ctrl+arrows moves the cursor by word instead of by character. If you want to highlight a word before your cursor, press ctrl-shift-left. Done. Using ctrl to modify the way you move around the cursor will change your life.

Similarly, ctrl+delete and ctrl+backspace will get rid of a single word.

Use the home and end keys a lot. Like, all the time. Don't hold the right arrow key to move to the end of a line, just press end. If you need to highlight the whole line you're on, press home, then shift+end. Also, home will alternate between the very beginning of the line and the beginning of the indented text.

There's usually a hotkey for cutting an entire line. It's ctrl+L in most things I've tried, but sometimes ctrl+K.

In visual studio ctrl+W will select the word around your cursor, which can be useful sometimes. But in most other places that will the child window / tab.

ctrl+home and ctrl+end will go to the very beginning or very end of a document. So naturally, ctrl+shift+end will highlight all the text after your cursor until the end of the document.

Most good editors have an amazing feature called multi-line editing. You can expand your cursor to cover multiple lines and edit on all of them at the same time. Often times this is the hotkey alt+shift+up/down.
 
Jesus do I have a lot I have to learn.... At a 'hackathon' and a lot of these people are really good.

Talk about a blow to your ego.

Yup, a formative learning experience for most CS grads is the first time they attend an event of that sort or something similar like a programming competition. It usually really shows them how much they don't know. First time I did a programming competition I really learned how little I knew in the scheme of things. Use it as a motivator to learn more.
 
Yup, a formative learning experience for most CS grads is the first time they attend an event of that sort or something similar like a programming competition. It usually really shows them how much they don't know. First time I did a programming competition I really learned how little I knew in the scheme of things. Use it as a motivator to learn more.

Oh god it made me feel fucking stupid.... Hah. I basically spent the last 24 hours playing with python and some api in iOS and I feel a lot more comfortable with objective-c now so it wasn't all a wash.

Also a lot of this one was centered around front end stuff, which I literally have 0 experience in.
 

Harpuia

Member
There's some major weirdness going on here and I'm not quite sure what it is.

Code:
void fillLogs(log logArray[], ifstream& file, int& finalCountL)
{
    while(! file.eof() )
    {
        cout << finalCountL << endl;
        logArray[finalCountL].assignID(file);
        logArray[finalCountL].assignDate(file);
        logArray[finalCountL].assignStart(file);
        logArray[finalCountL].assignEnd(file);

        finalCountL++;
    }
        logArray[finalCountL].setID(-1);
}

My member functions seem to be working correctly, but I think it's the weirdness of counting the times this while loop runs. So pretty much the first iteration will be 0, then 1 during the next one, and 2 at the end of that one.
 

Bear

Member
I'm trying to get an animated 2D grid of tiles in python that updates the plot in each loop. The animation works fine, but when the program is finished running it always locks up. From what I understand, the draw() function is left hanging until it is closed with show(), but even after including that I still get the same problem.

The code in question is:

Code:
from pylab import *
from scipy import *

ion()
image = imshow(grid, interpolation ='none', animated = True)

for n in range(0,100):
    random_add()
    image.set_data(grid)
    draw()
    pause(0.25)

show()

The random_add() function is what changes the value of the grid using an Abelian sandpile model. Everything relating to the model and the plot values work just fine. I just don't want it crashing every time it finishes, and I haven't been able to find any fix on Google yet.
 
Hey Programming GAF. I have a VBA question.


I have two columns of names. I want to write a function that uses a single argument that searches both columns and finds an exact match. If there is a match I should display a msgbox telling me I found it.

I can do a lookup for one column but when pairing it with another column I get all kinds of confused.
 

LukeTim

Member
Hey Programming GAF. I have a VBA question.


I have two columns of names. I want to write a function that uses a single argument that searches both columns and finds an exact match. If there is a match I should display a msgbox telling me I found it.

I can do a lookup for one column but when pairing it with another column I get all kinds of confused.

Wait, so you want both columns to match the parameter?
 
I'm not as experienced with VBA as with other languages, but I can give it a try... Could you show your code?

Sure. I'm about ready to give up on it. I don't have any code as its just this one function checking for the input value. It can be any two columsn of data though. Create a column with A, B, C, D and another with A, B, E, F just to test the function.
 

LukeTim

Member
Sure. I'm about ready to give up on it. I don't have any code as its just this one function checking for the input value. It can be any two columsn of data though. Create a column with A, B, C, D and another with A, B, E, F just to test the function.

I'm not sure what your problem is...

Does the match have to be on the same line in each column? Or any combination of lines?

Is it how to access the columns in VBA that is the problem?
 
Sure. I'm about ready to give up on it. I don't have any code as its just this one function checking for the input value. It can be any two columsn of data though. Create a column with A, B, C, D and another with A, B, E, F just to test the function.


Why not use a bool flag like bool listOneFound and listTwoFound.
First search list one then list two.
Before returning the answer test if both listOneFound and listTwoFound are true.

Have no experience with VBA.
 
I'm not sure what your problem is...

Does the match have to be on the same line in each column? Or any combination of lines?

Is it how to access the columns in VBA that is the problem?

No, they can be on any row. I was trying to do a lookup for each column and if a boolean was true for both then the msgbox would display. But I couldn't ever get it to work.

F7BvFgx.png


I just need the function to check both columns for an input name and then respond that it exists in both or it does not. If I used an inputbox and put "Dove" it should give me a msgbox saying "Match found" (or whatever).

Sorry, I never know how to explain stuff. I dont know what to assume :(

Why not use a bool flag like bool listOneFound and listTwoFound.
First search list one then list two.
Before returning the answer test if both listOneFound and listTwoFound are true.

Have no experience with VBA.

Thats what I thought I should do. I'll go back and try that approach again.
 

raphier

Banned
Finally trying to make an OpenGL renderer from scratch (that means no GLUT, GLFW, etc) and my god is window programming horrible and bloated in window headers. Any experiences with something else? I refuse to use WinMain() as an entry point.
 

LukeTim

Member
Why not use a bool flag like bool listOneFound and listTwoFound.
First search list one then list two.
Before returning the answer test if both listOneFound and listTwoFound are true.

Have no experience with VBA.

How about making it simpler still...

loop through list one, if you find a match start going through list 2... if you find a match there, return a positive result... if you get to the end of list 2 without, return a negative result...

If you get out of list one without finding a match, return negative.

Code:
for i in listOne:
   if listOne[i] == param:
         for j in listTwo:
              if listTwo[j] == param:
                    msgbox('Matched!')
                    return true
             return false
return false
 
Finally trying to make an OpenGL renderer from scratch (that means no GLUT, GLFW, etc) and my god is window programming horrible and bloated with WGL. Any experiences with something else? I refuse to use WinMain() as an entry point.

I dont know but most of the dx11 tutorials just use Win32API.
I have no experiences with OpenGL so dont know if you can just create a context and give it a window handle.

How about making it simpler still...

loop through list one, if you find a match start going through list 2... if you find a match there, return a positive result... if you get to the end of list 2 without, return a negative result...

If you get out of list one without finding a match, return negative.

Code:
for i in listOne:
   if listOne[i] == param:
         for j in listTwo:
              if listTwo[j] == param:
                    msgbox('Matched!')
                    return true
             return false
return false

That is a better more elegant solution and less bruteforce solution.
Not used to VBA syntax where are my brackets and semi colons :p
 
How about making it simpler still...

loop through list one, if you find a match start going through list 2... if you find a match there, return a positive result... if you get to the end of list 2 without, return a negative result...

If you get out of list one without finding a match, return negative.

Code:
for i in listOne:
   if listOne[i] == param:
         for j in listTwo:
              if listTwo[j] == param:
                    msgbox('Matched!')
                    return true
             return false
return false

Yep, you and dragon were right. I had a bogus parameter in my count. Thanks a lot, guys!
 

KorrZ

Member
I'm running through Head First C# and using Visual C# Express 2010 as the book recommends. I have to say...coming off of using Java w/ Notepad++ for 90% of my applications so far, this feels like cheating.

I just don't feel like I'm actually making these programs myself when the compiler is generating 90% of the code on it's own. (Learning "Windows Form" applications) Java swing GUIs aren't exactly all that difficult, but at least I'm writing the code myself. Am I completely off base in feeling this way?
 

LukeTim

Member
I'm running through Head First C# and using Visual C# Express 2010 as the book recommends. I have to say...coming off of using Java w/ Notepad++ for 90% of my applications so far, this feels like cheating.

I just don't feel like I'm actually making these programs myself when the compiler is generating 90% of the code on it's own. (Learning "Windows Form" applications) Java swing GUIs aren't exactly all that difficult, but at least I'm writing the code myself. Am I completely off base in feeling this way?

I'm not sure what you mean... Do you mean because you are using libraries?

EDIT: really stupid question... I just meant that .NET offers a hell of a lot of tools prebuilt... I am not so familiar with what Java has to offer.
 
I'm running through Head First C# and using Visual C# Express 2010 as the book recommends. I have to say...coming off of using Java w/ Notepad++ for 90% of my applications so far, this feels like cheating.

I just don't feel like I'm actually making these programs myself when the compiler is generating 90% of the code on it's own. (Learning "Windows Form" applications) Java swing GUIs aren't exactly all that difficult, but at least I'm writing the code myself. Am I completely off base in feeling this way?

I don't know much about C# but can you just write the GUI code yourself? Isn't it just a Visual Studio thing? (Sort of like the Netbeans IDE lets you build Java GUIs using drag and drop)
 

LukeTim

Member
I don't know much about C# but can you just write the GUI code yourself? Isn't it just a Visual Studio thing? (Sort of like the Netbeans IDE lets you build Java GUIs using drag and drop)

OOOH

That's what he means...

Yeah, the WYSIWYG stuff is not necessary. You can do everything yourself if you want.

I've made a few applications in WPF, the first one I wrote the XAML and code mostly by hand, but for the next ones I began to use the WYSIWYG stuff a bit more for the sake of speed.
 
Hey guys,
So I'm about 2 years post-degree, working with PeopleSoft. I love my company and I get paid really well. I just feel like I'm going to lose my skills if working with such an archaic language. I just wanted to know what I should be doing to keep myself marketable. My college career consisted of mostly C++, with a little assembly,java, and objective C thrown in. What should I be learning on the side? I was thinking of picking up a C# book and learning it, I've never touched the language.
 

LukeTim

Member
Hey guys,
So I'm about 2 years post-degree, working with PeopleSoft. I love my company and I get paid really well. I just feel like I'm going to lose my skills if working with such an archaic language. I just wanted to know what I should be doing to keep myself marketable. My college career consisted of mostly C++, with a little assembly,java, and objective C thrown in. What should I be learning on the side? I was thinking of picking up a C# book and learning it, I've never touched the language.

With C++ and Java experience, picking up C# should be easy enough... it's basically an amalgamation of the two.

C# is definitely a language worth knowing, too. There are quite a lot of companies that use it, Unity game engine uses it, so plenty of game devs do... and it's used in aspx web technologies, too.

What is PeopleSoft like? I've not heard of it.
 
Hey guys,
So I'm about 2 years post-degree, working with PeopleSoft. I love my company and I get paid really well. I just feel like I'm going to lose my skills if working with such an archaic language. I just wanted to know what I should be doing to keep myself marketable. My college career consisted of mostly C++, with a little assembly,java, and objective C thrown in. What should I be learning on the side? I was thinking of picking up a C# book and learning it, I've never touched the language.

What language do you use at work?
 
I'm running through Head First C# and using Visual C# Express 2010 as the book recommends. I have to say...coming off of using Java w/ Notepad++ for 90% of my applications so far, this feels like cheating.

I just don't feel like I'm actually making these programs myself when the compiler is generating 90% of the code on it's own. (Learning "Windows Form" applications) Java swing GUIs aren't exactly all that difficult, but at least I'm writing the code myself. Am I completely off base in feeling this way?

This feeling of cheating will go away when you start writing non-trivial applications. Don't worry about it.
 

KorrZ

Member
I don't know much about C# but can you just write the GUI code yourself? Isn't it just a Visual Studio thing? (Sort of like the Netbeans IDE lets you build Java GUIs using drag and drop)

OOOH

That's what he means...

Yeah, the WYSIWYG stuff is not necessary. You can do everything yourself if you want.

I've made a few applications in WPF, the first one I wrote the XAML and code mostly by hand, but for the next ones I began to use the WYSIWYG stuff a bit more for the sake of speed.

Yes, this is what I mean...Head First C# book is teaching by using the drag and drop method (at least for the first few chapters) which feels like I'm not learning anything when I'm not writing any of the code really. I guess my complaint is with the book.

Head First Java was great so this is kind of disappointing so far.

This feeling of cheating will go away when you start writing non-trivial applications. Don't worry about it.

Thanks
 
What language do you use at work?
I use PeopleSoft. The actual code part is called PeopleCode. Its pretty much an in house language used by the system. The system is web based, and the language resembles C++/Java without libraries. It's owned by oracle and had been used since the 60s I believe. If it tells you anything, some of the processes are still based off of COBOL.
 
Top Bottom