cs50 ide
This is a topic that many people are looking for. is a channel providing useful information about learning, life, digital marketing and online courses …. it will help you have an overview and solid multi-faceted knowledge . Today, would like to introduce to you IDE. Following along are instructions in the video below:

[MUSIC PLAYING] 2 00:00:02,928 –> 00:00:04,817 DOUG LLOYD: All right, so welcome to the portion of CS50 where were going to begin to do transition our coding away from scratch and were going to start programming in c. In order to do that, we need to have a terminal-based environment where we can write commands at the command line, write our code, compile it, and execute it. The platform that we provide in CS50 is called CS50 IDE. And its entirely a cloud-based infrastructure that uses an implementation of Ubuntu, which is one flavor of the Linux operating system. The advantage here is it is cloud-based, which means that you can start your work on one computer, save, head home, switch to a different computer, use a friends computer, and all your work is saved remotely in the cloud. To get started, what I want to do is walk you through how to set up your CS50 IDE the very first time and walk you through some of the features that it has. So all you need to do to get started with your CS50 IDE is head to a web browser. And in the URL, just type in And just give that a second. Youll be prompted to log in using CS50 ID. The options that youll probably use are either Edx, Harvard, or Yale. So if you have an Edx account, youd use the Edx logins. If you have a Harvard credentials, youd use Harvard. If you have Yale credentials, youd use Yale. So Im going to set up with Harvard credentials, hit Submit. And you would enter your username and password here. And the very first time, if you havent done this before, what its going to do is create for you a brand new environment, pre-configured, ready to go, using CS50 IDEs framework within Cloud9. Now, I already have an implementation of CS50 IDE, but Im going to show you how to create another one using a different method. So alternatively, if you already have a CS50 IDE workspace and you want to, for example, create another one, which is what Im going to do here, or for example, the log in somehow didnt work, you can also create new workspaces from your Cloud9 dashboard. Im going to show you how to do that here. So what I did was I logged on to my IDE. And in the File menu, I just chose dashboard to bring me to the screen that youre seeing here. Then what I wanted to do is just create a new workspace, which I can do just by hovering over this button here. And then its going to ask me to provide some parameters. So my workspace name, lets call it demo. A short description of it, demo for CS50 IDE. Now in general, particularly if this is your first work space, youre actually going to want to choose private here. The way that this is set up, though, is that youre restricted to one private workspace. And I already have one in my example here. So Im going to choose public because I dont really have another option. But if this is your first workspace that youre using for CS50 IDE, you do want to create a private workspace if you can. And then at the bottom there, it gives you some options for different templates you can use. So this is not just restricted, necessarily, to CS50. But there is a CS50 template right here at the end, with happy cat, Harvard CS50. And I can just hit Create Workspace. Now, depending on how old your system is and the speed of your internet connection, this could take anywhere from a couple of seconds to maybe one or two minutes. So after about 45 seconds or so on my machine, I was brought to this screen, which is basically the CS50 IDE, what it looks like by default. The first thing youre going to want to

do, again, one more time sensitive step here, is as soon as you visit your IDE for the first time, or generally when youre visiting it as you go, youre generally going to want to check to see, make sure that you have the most up to date version of CS50 IDE. We occasionally will push updates to change some formatting things or to include some distribution, or sample code, or staff solutions. And those are pushed via updates. So youre going to want to, first, go to the terminal at the bottom here and type in the command update 50. And then hit Enter. And again, this will take about, possibly, about a minute or so, depending on the speed of your internet connection. And what its going to do is go through and download all of the packages and make sure that your system is fully up to date. So again, after about a minute or so, Im notified that the update has completed and Im prompted to close and reopen all terminal windows. So Ill just do that really quick. Ill just close to this terminal. Confirming. And I will reopen a new terminal here. And now we are good to go. So our CS50 IDE has three main areas. At the bottom, youve already seen me working here in blue. This sort of light bluish color is my terminal. These windows are also resizable, so I can make this bigger or smaller if I would like. Im going to keep it right about here for now. On the left over here is my file tree. As I add files and folders to my workspace, this will become larger and Ill be able to navigate this using just a GUI interface, being able to double click on files, double click on folders, as opposed to just having to do everything at the terminal window. Although as you become more acquainted with the Linux commands, you may want to just use the terminal window anyway because you may find it faster. And then at the top here is my main workspace, sort of area. This is where when Im opening files, where Ill see my source code and can edit it. And this is where the bulk of your work will take place when youre writing code. Im going to show you how easy it is to create a file in CS50 IDE. Theres a little icon here with a plus. All I have to do is click on that. Im asked if I want a new file or a new terminal. As you can see, I actually could put terminals at the top if I wanted to, generally not a good idea. I already have one at the bottom. So Im just going to create a new file. Doesnt have a name right now. You can see it created something for me called Untitled 1, but thats all right. And lets just quickly write a little Hello World program. So first I need to pound include standard I/O, which is where the print f function lives. Were going to need that to be able to print that out later. Int main void. 127 00:05:20,790 –> 00:05:23,400 And Ill tab in here and just print f, hello world. A little backslash character, close curly brace. Now nothing like syntax highlighted for me. Maybe youre familiar with this if youve used other editors before. And the reason for that is that I havent given this file a file extension or a name yet, so the IDE doesnt know what type of file it is. If I try and hit Save, so Control S on a Windows machine, Command S on an Apple machine, then Im prompted what file do I want to say this as. Well save it as hello.c, it as a C program after all. Hit save. Now notice that actually now that it knows its a C file, its going to syntax highlight it just

like a c file. So my pound include, my string there is in green, my keywords are in blue, and were ready to go. So Ive saved this file as hello.c. Now you may recall that in order to execute our programs, we dont just run the source code, we have to compile them from the source code into a binary file. And we do that using make. So we can go down to the bottom here. And I can type make hello. Hit Enter. So then some cryptic clang string ran for me. And then I can just type ./hello and Im told hello world at the bottom there. So that was how easy it was to get our first program set up. What else can we do here? Theres a lot of menu options at the top. Lets take a look at some of those really quick, so youre pretty standard CS50 IDE, which has a menu there. Files for opening and saving files and so on. One that you might definitely use is in this View tab. Theres a less comfortable option, which can abstract or hide away some of the menu options. You notice some stuff disappeared there. My screen got a little bit bigger. Im going to keep it in more comfortable mode for now, but this just hides away some of the menu options that you might not use quite as frequently. Another option that I personally really like, when Im coding, I actually like to be in night mode, which looks a little something like this. So it inverts all of my colors. I like to program on a dark background typing light colored text. But you might prefer the opposite. Im going to keep it as day view for purposes of this video. But know that that is an option. And there are other options as well you can do with themes. There are many, many different types of options here that you could use instead. So let me just quickly put this back into day mode. And then one that is going to be useful, and Im going to use it from this point forward in this video, is presentation mode. And presentation mode you would use when youre giving a presentation, which is what Im doing here. And youll see what it does is it actually makes the text a little bit bigger. It gets rid of some of the details in the corner there at the top right. Ill take this off again for a second to show you some of those things briefly near the end of the video. But its a useful tool when you want to show your code a little more– in a larger font size, to have your terminal window have a larger font size, so that people can read it a little more easily. And hopefully now you can read it a little more easily because I put the IDE into presentation mode. There are a couple of other ways to open files, though, besides just clicking on the plus icon at the top. So really quickly Im going to clear my terminal, which I do by typing control L. And it just kind of makes everything go away. And Im going to try and open a file using the Cloud9 file opening command, which is known as C9 open. So Im going to try and C9 open hello2.c, for example. Now you notice what it did there is it created a new tab for me at the top. And it already now has a name. So unlike before, where I had an untitled tab, now I have– now I have the– tab has a name in it. And were going to write a really similar program to the one we did before, with one little twist. Were still going to include standard I/O. Now were going to include CS50.h as well. CS50.h is a header file that contains some user input

functions that are quite handy for this example. Int main void. Now notice, unlike before, now that this file knows that Im working in C, you may have caught this. Ill go back and do it again. When I was writing the original hello, when I typed the open curly brace, it didnt do anything for me because it didnt know I was writing a c file. When I do it here and I hit Enter, notice it actually gives me a corresponding close brace already. This will also be done for for loops, while loops, if blocks, and so on, where it will automatically, if you open a parenthesis or open a curly brace, it will correspondingly close it for you so you dont have to go through the process of typing it out. Its not a huge deal but a lot of modern editors do this for you because it makes your life a little more convenient. So this time what were going to do is were going to have a variable where were going to capture the users name and were going to print their name out. So Im first going to prompt them by saying, enter your name. Then Im going to have a variable of type string called name that is going to be used to capture user input using get string. And then instead of printing out hello world, what I want to print out is hello %s, where %s is eventually going to be plugged in with someones name. So %s exclamation point, and were going to plug in whatever we just got there. So lets go ahead and try and compile this into a– wait a minute, whats this? So this is kind of a useful feature, as well. If you forget to– remember that youre not going to be able to compile a program if you havent saved the file. And what that was a little warning to me that if I left my code editor window and I switched, but I havent saved any of this file yet. And I have that little red dot in the tab corner as well to remind you. So thats just a little pop up reminder thats useful thats part of a CS50 IDE feature that just reminds you, oh right, before I go, I need to hit Save S, Control S, and save my file. So Ill do that here. Now I can make hello2, because this file is called hello2.c so I want to make hello2. Clear my terminal really quick again and run hello2. 250 00:11:12,850 –> 00:11:17,560 So thats my second program now that Ive written in CS50 IDE. All right, so what Im going to do now is Im going to turn presentation mode off really briefly, again, so I can show you some of the features that go around the perimeter of your IDE area. But youre pretty much familiar now with the basics here. We have our file tree, which now has our two files, two .c files and our two source files– or excuse me, our two binary files. We have our terminal area at the bottom and we have our code editing main area, sort of, at top right. So Im going to go ahead and turn presentation back off again and show you some of these things around the edge. So this CS50 IDE menu contains some things that will be mostly useful for you towards the end of the class, in particular, PHP, my admin, and web server, which will come in handy for the later portions of the class when were doing some web-based programming. Youll be able to figure out your PHP SQL password, username, and stuff here. And to be able to check any websites that you have created and are running by going to web server here. File has the basics if youve ever used like a Microsoft Word type thing where you can create files, open them,

and so on, pretty much all of those things are there. If you have any keyboard preferences, you can alter them in the Edit menu. View, again, has a lot of aesthetics changing things, for example, the presentation mode, the night mode, where you can set the way things look. You want to do that here. Go, Tools, Window, and Support you probably will not use quite as frequently. At the top here is the version number of CS50 IDE. Dont worry if your version number is different than mine. At the time were recording this in May of 2017, were at version 98. But if the aesthetics of things change a little bit here and there, totally nothing to worry about. It just lets you know what your version number is. Here is the memory CPU and disk area. It lets you know if you have too much data saved in your IDE. Right now, I have plenty of room. Im only using 153 megabytes of 5,000 or so. So Im in no danger. But if you write a lot of code and you eventually fill this up, this is still a cloud-based hard drive, but it is a hard drive nonetheless that youre using, so you have a limited amount of space. You have here the Share icon. So the share icon can be really useful if youre stuck and need to get some help, perhaps from a teacher, or a colleague, or a friend. You can actually share your workspace and give others read and read and write access to your workspace. If you click on the Share icon, youre popped up with awesome information here. Here is the information for this demonstration workspace. And if I know somebodys username– and you can tell, for example, that mine is Lloyd1 because that appears repeatedly in the URLs here. If you know somebodys Cloud9 CS50 IDE username, you can type that here and invite them. And theyll get a link to be able to access your workspace for read access or read and write access if you want to be able to collaborate remotely. Its a very useful feature. Once you are collaborating with someone remotely, you can usually collaborate tab here on the right. And what this will do is this will actually allow you to have a group chat. So Im not collaborating with anybody right now, but I could write hello, for example, or have any message of any kind to any of my collaborators. And if they were also currently viewing my workspace, they would see the chat. Theyd be able to participate. And so for example, if I was getting some debugging help from a friend, we could have a chat here on the window on the right and be able to help me figure out whats wrong with my code just to the left there. If you write more complex programs, the outline tab might be more useful. So really quickly, Im just going to create a dummy function that does nothing at all. But when I do, notice that now I have gotten this little extra item in my outline. And if I click on the different portions, it will jump me to that section of the code. So as my files get really, really big, and maybe I want to scroll quickly through them, I can use the outline tab to jump to different functions in my programs. Thats also pretty useful. And then finally, here on the right, is the debugger. And were going to cover that in a separate video on debugging shortly. But know that all these features and more, if you dig into some of the other things around the perimeter or dig into some of those menus at the top, are available to you in the CS50 IDE, trying to make your experience getting started writing code in a text-based programming language a little better. Im Doug Lloyd, this is CS50. 345 00:15:29,100 –> 00:15:30,710

cs50, harvard, computer, science, david, j., malan
Thank you for watching all the articles on the topic IDE. All shares of are very good. We hope you are satisfied with the article. For any questions, please leave a comment below. Hopefully you guys support our website even more.

Leave a Comment