• 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

usea

Member
Everything says my username and "staff" except for this one:
It looks like you're trying to execute the file. You mentioned you're dragging the file over to the command prompt? Try not doing that.

Simply open terminal and type the commands. Don't drag a file over there.
 

Water

Member
What usea said. Just issue the commands, don't drag random stuff into the Terminal before you understand what you are doing.

The Terminal is always open at some specific folder. You can see the full name of that folder by typing "pwd". You can move to another folder with the "cd" command, for instance "cd /Users/You/Desktop". If you were already in /Users/You, you could just do "cd Desktop". "cd .." takes you to the parent folder of the current folder.

The underlying assumption in the compile command "g++ -o executable source.cpp" is that source.cpp is in the same folder where Terminal is open. So get to the same folder, and then issue the command. After the compilation succeeds, the compiled program, in this case "executable", will also appear in the same place. You can run it by typing "./executable". The "./" at the start means "the current folder"; without it the Terminal will not try to find the program from the current folder. (It's a security thing.)
 
Thanks guys. Dragging the file into the terminal window does seem to be what the problem was. I felt a little silly doing that anyway.

I was previously compiling my programs with SublimeText. Is there any major difference between compiling with an editor like that and with the terminal?
 

Water

Member
Thanks guys. Dragging the file into the terminal window does seem to be what the problem was. I felt a little silly doing that anyway.
What the dragging actually does is that it pastes the full path and name of the dragged file or folder into the Terminal window; it's a small convenience feature. So you can, for instance, type "cd " (note the space), drag a folder into the Terminal window to paste the folder's path, and then hit enter to go to that folder.
I was previously compiling my programs with SublimeText. Is there any major difference between compiling with an editor like that and with the terminal?
Typically an editor's "compile" feature just runs some external command, so there's no difference as long as you are just doing a straight compile. A terminal window gives you access to plenty of other tools though.
 

KageZero

Member
Hello i started learning js with html and i got stuck at this part
Code:
<!DOCTYPE html>
<html>
<head>
	<title >AnimeHQ</title>
	<link rel="stylesheet" type="text/css" href="maincss.css">
	<script>
		
			var del = document.getElementById("intro");
		del.parentNode.removeChild(del);
		
	</script>
</head>

<body>
	<img id = "img1" src="animebanner.png">
<h1>ANIMEHQ	</h1>
<div id = "linkdiv">
	<ul>
		<a href = "main.html"><li>Home</li></a>
		<a href = "anime.html"><li>AnimeList</li></a>
		<a href = "videos.html"<li>Videos</li></a>
		<a href = "images.html"><li>Images</li></a>
		<a href = "games.html"><li>Games</li></a>
	</ul>
	</div>
<div id="maindiv">
<p id = "intro">
Anime is primarily used for animated television series, featured films, and Internet-based releases. .</p>
</div>

<div id = "outside">
	<a href = "" ><img class = "ol1" src="b1.jpg"></a>
	<a href = " " ><img class= "ol1" src="b1.jpg"></a>
	<a href = " " ><img class= "ol1" src="b1.jpg"></a>
	</div>
</body>
</html>
And this doesn't work the paragraph remains when i open the page and it should have been delete. Now i tried to put the code inside a function and assigned it to a button and there it works when i click on it. The code is the same as on the first it's just inside a function that is assigned to a button and I don't understand why it won't work as a standalone code.

Code:
<!DOCTYPE html>
<html>
<head>
	<title >AnimeHQ</title>
	<link rel="stylesheet" type="text/css" href="maincss.css">
	<script>
		function aw(){
			var del = document.getElementById("intro");
		del.parentNode.removeChild(del);
		}
	</script>
</head>

<body>
	<img id = "img1" src="animebanner.png">
<h1>ANIMEHQ	</h1>
<div id = "linkdiv">
	<ul>
		<a href = "main.html"><li>Home</li></a>
		<a href = "anime.html"><li>AnimeList</li></a>
		<a href = "videos.html"<li>Videos</li></a>
		<a href = "images.html"><li>Images</li></a>
		<a href = "games.html"><li>Games</li></a>
	</ul>
	</div>
<div id="maindiv">
<p id = "intro">
Anime is primarily used for animated television series, featured films, and Internet-based releases. .</p>
<button type = "button" name = "lalal"onclick = "aw()"></button>
</div>

<div id = "outside">
	<a href = "" ><img class = "ol1" src="b1.jpg"></a>
	<a href = " " ><img class= "ol1" src="b1.jpg"></a>
	<a href = " " ><img class= "ol1" src="b1.jpg"></a>
	</div>
</body>
</html>
 
^put the function to the body-elements onLoad-eventhandler

Code:
<script>
		
		function onLoadHandler(){
                    var del = document.getElementById("intro");
		    del.parentNode.removeChild(del);
                }		
</script>


<body onLoad="onLoadHandler()"/>
 

APF

Member
Hello i started learning js with html and i got stuck at this part]

When you put DOM-manipulating code in the <head> you'll often run into the fact that the elements you're trying to do something with don't exist at the time the code is executing. Thus the common patterns are either to delay execution until the DOM is ready (https://developer.mozilla.org/en-US/docs/Web/Reference/Events/DOMContentLoaded), or until the page is completely loaded (window.onload or alternately putting the <script> block at the bottom of the page)
 
Finally found time to start transforming my CSS to SCSS. Praise Cthulu, this is amazing stuff.

Who else likes Bootstrap 3 like... 8 million times more than bootstrap 2?

Did they make row-fluid the only option? Seems that way in the examples.

Really digging the span -> col / col-lg changes.
 

Kinitari

Black Canada Mafia
Nervous, have a phone interview with a place I really want to work at (basically a pure javascript development mill, using angular in the front and node in the back). I've only JUST started to get into Angular and node, and I am actually on vacation this weekend - but I did pick up a node.js book to read so I guess that's what I am doing.

Hopefully he's impressed by my gumption and tenacity.
 

usea

Member
Nervous, have a phone interview with a place I really want to work at (basically a pure javascript development mill, using angular in the front and node in the back). I've only JUST started to get into Angular and node, and I am actually on vacation this weekend - but I did pick up a node.js book to read so I guess that's what I am doing.

Hopefully he's impressed by my gumption and tenacity.
Awesome. Good luck!
 
Nervous, have a phone interview with a place I really want to work at (basically a pure javascript development mill, using angular in the front and node in the back). I've only JUST started to get into Angular and node, and I am actually on vacation this weekend - but I did pick up a node.js book to read so I guess that's what I am doing.

Hopefully he's impressed by my gumption and tenacity.

Weird! I'm looking at the something that fits that exact description. Planning on writing something new in angular this weekend.
 

IceCold

Member
Anybody know how to use emacs? I'm using emacs24 and the way it automatically places brackets is super annoying. It's not that big of a deal when you add a bracket but removing them is a bitch.

So lets say I write this:

(println (first [1 2 3])


For every opening bracket, it adds a closing one. I can live with that. But if I want to delete the parenthesis before "first" I can't do it by just pressing backspace. For me to remove it I have to remove the entire "first" expression. It's super annoying. Anybody know how to disable this? This applies for any bracket.

edit: Nevermind. I found out to deal with this issue.
 
c++: why does

Code:
getline(cin, <string name>)

completely skip the input whilst

Code:
cin.ignore();
getline(cin, <string name>)

does not?

unless it's some kind of buffer issue? I am using cin >> to determine what it's being input beforehand so maybe that's the issue?

eh.
 

Slavik81

Member
From this discussion, it seems that cin >> leaves the '\n' in the input buffer, so when you use getline it's the only thing that's grabbed. ignore removes the leftover '\n' from the input buffer, so the getline returns what you expect.
 

Kinitari

Black Canada Mafia
So my phone interview went well I think, I have an actual in person interview tomorrow morning at 9:30am.

He mentioned that he might ask me to do a javascript test, which would be the first time I've ever had to do a test for a development job. Not sure what to expect, what does GAF think I'll be dealing with?
 

V_Arnold

Member
So my phone interview went well I think, I have an actual in person interview tomorrow morning at 9:30am.

He mentioned that he might ask me to do a javascript test, which would be the first time I've ever had to do a test for a development job. Not sure what to expect, what does GAF think I'll be dealing with?

The scope, man.

The scope.
 
So my phone interview went well I think, I have an actual in person interview tomorrow morning at 9:30am.

He mentioned that he might ask me to do a javascript test, which would be the first time I've ever had to do a test for a development job. Not sure what to expect, what does GAF think I'll be dealing with?

Angular in particular?
 
This is a shot in the dark, but it's worth a try. Does anyone here code with Monogame on Windows 8? If yes, does the 360 controller vibration work on your system?

So I want to learn C and then C++. I bought 4 books I thought would be good, what does GAF think about them?

The C Programming Language 2nd Edition
C++ Primer Plus 6th Edition
Beginning C++ Through Game Programming 3rd Edition
Accelerated C++

The first book is very highly regarded. I've seen more copies of the book around my company's cubicles throughout the years than any other. 2 & 3 will do the job, but expect to slug it out for 1K+ pages on C++ Primer Plus. If you are a beginner and have a lot of patience, the book is a perfect fit, as it goes into excruciating detail about the basics.

Lastly, Accelerated C++ is one of the best programming books I've ever read. It is the only book in my collection that has gotten dirty around the edges because of so much use. I don't work with C++ professionally, but whenever I need a quick refresh, it is my first resource. It is also the only book where I have done all the exercises and actually enjoyed the process. Very highly recommended to beginners and programmers looking to learn C++.
 

Kinitari

Black Canada Mafia
The scope, man.

The scope.

Variable scope is something I am pretty comfy with, but mostly from my days as a C# dev, I'll see if there is anything in particular about javascript scope that makes it unique. I know scope is an important part of angular.

Angular in particular?

He just said javascript. Since I am going for a junior position, I don't think he'll test me too rigorously, if he even decides to. I mentioned to him how much time I spend learning, and what resources I like to use and he seemed happy with that - he even emailed me after the interview with a good resource for learning Mongo + Node.
 

Jokab

Member
Variable scope is something I am pretty comfy with, but mostly from my days as a C# dev, I'll see if there is anything in particular about javascript scope that makes it unique. I know scope is an important part of angular.

Variable hoisting is a thing in Javascript. Maybe this link will help.
 

usea

Member
I'm pretty bad at javascript since I rarely use it and it's full of surprises and exceptions to rules, but here is an article about some js things from a C# dev perspective. There's a second article linked at the end http://enterprisejquery.com/2010/10/how-good-c-habits-can-encourage-bad-javascript-habits-part-1/

Here's a page on common javascript gotchas https://github.com/stevekwan/best-practices/blob/master/javascript/gotchas.md. There is some criticism of this page, although most of it is related to the negative tone the author uses.

And here is a site by John Resig and Douglas Crockford on advanced javascript http://ejohn.org/apps/learn/
 

Kinitari

Black Canada Mafia
Variable hoisting is a thing in Javascript. Maybe this link will help.

I'm pretty bad at javascript since I rarely use it and it's full of surprises and exceptions to rules, but here is an article about some js things from a C# dev perspective. There's a second article linked at the end http://enterprisejquery.com/2010/10/how-good-c-habits-can-encourage-bad-javascript-habits-part-1/

Here's a page on common javascript gotchas https://github.com/stevekwan/best-practices/blob/master/javascript/gotchas.md. There is some criticism of this page, although most of it is related to the negative tone the author uses.

And here is a site by John Resig and Douglas Crockford on advanced javascript http://ejohn.org/apps/learn/

Thanks so much you guys, all good info :)
 

V_Arnold

Member
Thanks for reminding me why I hate javascript.

Javascript is awesome, man. I banged my head against walls for so long because of the scope, but once I am getting shit done with it, it is just absolutely amazing, and hell, sometimes even brilliant.

And then I step away from the code for a few days or a week, and wonder why my newly made additions break it :p
 
So I have an idea for a custom keyboard for Android that would be kind of like Emoji's for iOS. Basically, I want to create a keyboard that has images that the user user can click on and send in a text message or use in a notepad app, for example. I haven't done too much research on it as I'm kind of just planning it out in my head. Is this a lot more work than it seems like? I'm not exactly sure where to start, but if any of you guys have some experience with this kind programming for Android, I'd love some advice! Btw, this is just something I think that'd be fun for a friend and I to mess around with, so it's nothing too serious.
 
fuck javascript and no i dont know jquery nor do i care to learn stop asking.

anyone know a good resource for learning tables, views, normalization, stored procs, functions and all that?
 
I think my school just perma-lost all the source code and other work files done in the past 6 years. Hooolyyy shiiit


edit: fuck yes, managed to save the work in process-files. All the legacy code is pretty much goooone

RAID is not a backup goddammit.
 

Chris R

Member
I think my school just perma-lost all the source code and other work files done in the past 6 years. Hooolyyy shiiit


edit: fuck yes, managed to save the work in process-files. All the legacy code is pretty much goooone

RAID is not a backup goddammit.

Wait... really? Just RAID? Not even backups of the server?
 

Kinitari

Black Canada Mafia
Awesome, I got the job! Thanks everyone. I'm really excited about this position, and my boss seems to know quite a bit about the tech we'll be using. Should be a great learning experience.

I start friday!
 

Kalnos

Banned
Awesome, I got the job! Thanks everyone. I'm really excited about this position, and my boss seems to know quite a bit about the tech we'll be using. Should be a great learning experience.

I start friday!

Congrats man! I just got one as well and start Monday.
 
Awesome, I got the job! Thanks everyone. I'm really excited about this position, and my boss seems to know quite a bit about the tech we'll be using. Should be a great learning experience.

I start friday!

Congrats!

Did you get any questions about the stuff mentioned above?
 
Wait... really? Just RAID? Not even backups of the server?

Our school is divided across like 9 cities and they decided in 2012 to centralize all the server farms to one city. So everything was moved there (and everything, including communications and all the computer janitor stuff slowed down 90%)... except for one of our servers, which they couldn't provide. So since that we've been saying that "yeah we really need something to backup the data to", which they wouldn't provide the funding for. So we were left with nothing (except maybe they have some old images from 2010 if they haven't deleted them in at the central IT fuckup) and now it's SNAFU.

O4Bsd.gif


At least we were able to save our current projects but really this shit is whack and it's not even our fault.

(To put things in perspective, when the servers were centralized they half-accitentally deleted all the local student files too
Q1n2T.gif
)


edit: woohoo, it managed to built itself up and everything is back to normal
 

Kinitari

Black Canada Mafia
Congrats man! I just got one as well and start Monday.
Thanks!

Congrats!

Did you get any questions about the stuff mentioned above?

A shitload, it was honestly really helpful reading up on it in advance. I mean a lot of the stuff posted was stuff I already knew, but the articles went into much more detail, and I ended up jumping around and reading other similar articles. In the end, probably 2/3rds of the questions that he asked I was able to answer better because of the help from this thread.

The dude tried to stump me with a few questions, because I was answering so many of them well. I think I fumbled a bit over promises and closures, but I was able to answer them reasonably well - mostly because of the articles here.

Regardless, now I need to study node and Mongo like crazy.
 

phoenixyz

Member
Guys I got this urge to learn programming and kinda wanted to start with Java. What IDE do you recommend?
None. At the very beginning I wouldn't use an IDE. Just choose an editor which suits you (for example Notepad++ on Windows), download the Java SDK and get started.
 
Why not with a IDE? You run in the same errors with just a notepad but running into those errors with an IDE makes it much much more less frustrating for a beginner. Something like Eclipse is simple enough even for someone that hasn't coded much before. After you get the syntax down you can do the things on paper and compile the projects in your mind if you want to, but doing it the other way for a beginner might be just frustrating.

It's like learning to ride a bicycle by piggybacking your best friend to the store.
 

Kinitari

Black Canada Mafia
Why not with a IDE? You run in the same errors with just a notepad but running into those errors with an IDE makes it much much more less frustrating for a beginner. Something like Eclipse is simple enough even for someone that hasn't coded much before. After you get the syntax down you can do the things on paper and compile the projects in your mind if you want to, but doing it the other way for a beginner might be just frustrating.

It's like learning to ride a bicycle by piggybacking your best friend to the store.

I learned jumping between IDEs and text editors, and honestly, I agree with you from my experience. Learning didn't seem to happen any faster or easier in Notepad++ than in visual studio.

Congrats on jobs, peoples.

Thanks! Hopefully in a years time I will be neogaf's designated javascript expert!
 
I've had some previous contact with programming but it was really light. I learned if, for, while and some cin, cout on C++ back in school. But this was like 12 years ago and done in Borland builder IIRC. That's why I asked for IDE as compiler would often help me understand what I was doing wrong (syntax or similar)

In any case I guess I'll settle on Eclipse or maaaaybe IntelliJ Idea (saw it recommended) on some blog.

Also would you recommend starting with Java as most people don't recommend using C++ to start and only programming I've ever had is in C++ (like I said 12 years ago in some course in school)

Thank you for your time!
 

Kinitari

Black Canada Mafia
I've had some previous contact with programming but it was really light. I learned if, for, while and some cin, cout on C++ back in school. But this was like 12 years ago and done in Borland builder IIRC. That's why I asked for IDE as compiler would often help me understand what I was doing wrong (syntax or similar)

In any case I guess I'll settle on Eclipse or maaaaybe IntelliJ Idea (saw it recommended) on some blog.

Also would you recommend starting with Java as most people don't recommend using C++ to start and only programming I've ever had is in C++ (like I said 12 years ago in some course in school)

Thank you for your time!

I really liked starting with C# - I played around with C++, Java and C# when I started to develop, and personally C# was the most user friendly. But I feel like whatever you want to do is more important at this point - learning a language becomes really easy once you understand development.
 

Water

Member
Why not with a IDE? You run in the same errors with just a notepad but running into those errors with an IDE makes it much much more less frustrating for a beginner. Something like Eclipse is simple enough even for someone that hasn't coded much before. After you get the syntax down you can do the things on paper and compile the projects in your mind if you want to, but doing it the other way for a beginner might be just frustrating.

It's like learning to ride a bicycle by piggybacking your best friend to the store.
If the language was C or C++, I'd recommend starting without an IDE too, because understanding the compilation model of those languages actually matters. But that doesn't apply to Java, so not much reason to avoid IDEs. Plus, Java's standard library and general naming practices give you RSI if you don't have an autocomplete to fall back on.
 

Kinitari

Black Canada Mafia
Holy crap am I cramming a lot of info into my head at once.

I am currently doing my best to study Node, Angular and Mongo - luckily the syntax is all similar and I have a lot of experience with javascript, but holy crap is it a lot to learn! I just want to do really good at this job. I've never had a job I've been so excited about.

My boss recommended I use 10gen as they have a new node/mongo course out (and it's really good so far, I'd recommend it, it's free). But I am also using tutsplus for their angular class, and codeschool for their node. I'm going HAM on this motherfucker.
 
Top Bottom