Hi everyone, so this idea started when I was stressed with school but also finishing up CS50. I needed a way to get rid of stress, but going to a rage room was not feasible (too expensive). Other "smash" simulators simply had you tap on a screen, which did not cut it for me. So I decided to make Plate Shatter, where you can physically shake the device and get vibrational feedback and satisfying shatter noises to relieve stress. I submitted it as my final project, but after that made a lot of improvements to finally publish it on the app stores. Without CS50, I wouldn't have been able to come nearly as far as I did. Being able to put all of my anxiety into a plate and then watching it shatter is pretty relieving. I am proud to say that it really has helped me cope with my tension and I hope it does the same for you too :)
ps - this is my first actual app that is being published so feedback and reviews would be greatly appreciated!
ios link: https://apps.apple.com/us/app/plate-shatter/id1565913452
google play link: https://play.google.com/store/apps/details?id=com.asgames.PlateShatter&hl=en\_US&gl=US
Hey man! I used bootstrap to help me with this:
Look at the source of this example page, the third example (Responsive left-aligned hero with image): https://getbootstrap.com/docs/5.0/examples/heroes/
Specifically this line:
<div class="row flex-lg-row-reverse align-items-center g-5 py-5">
flex-lg-row (you probably want it without the reverse) is the class that switches to flex row, once the screensize goes to ‘lg’ or lower. See https://getbootstrap.com/docs/5.0/layout/grid/ for more info.
No plans for CS51 on edX just yet, but see https://www.edx.org/course-list/allschools/computer-science/allcourses for other edX courses. After CS50, though, you might like Princeton's Algorithms, Part I!
It's great that you are learning about Linux. If you want to dive deeper into the Linux world, check out Linux from Scratch. This gets to the "guts" of the Operating System.
They actually have books they mentioned that can be of interest. Books mentioned
I also heard the book ‘The C Programming Language’ by Kernighan and Ritchie is a good book on C. I haven’t read it myself yet, but many programmers and software engineers I know swear by that book. I mean how bad can it be, it was written by the creator of C.
If you search on github, they have many links to free resources and books to learn C.
In my opinion CS50 (taking now) is a really good source to get an intro to C, then you can move on from there. I think CS50 concentrates more on teaching you problem solving and how computers work while giving you a nice intro to some languages. I would highly recommend going with it as your first course. It becomes more interesting after the second week because you start to get it.
Got it working for you now that I'm in front of my computer.
var menu = document.getElementById("submit"); console.log(menu); menu.addEventListener("click", function(event) { if (document.getElementById("dropdown").value == "nothing") { event.preventDefault(); } });
Per the request, my programming experience before starting CS50x has almost entirely been hobby programming (a few scripts here and there at work to generate quotes and such, but nothing more). Have been playing with C# for a couple years, and have touched on VB and Ruby before that.
EDIT: For those in need of sounds, Freesound.org is a good first stop. Got all 3 of the sounds I used there.
Love2D released a new version on April 1 2018 (version 11.0)
https://love2d.org/forums/viewtopic.php?t=85051
some of the changes were
so for the edx course starting on July 1 2018 should we use this new version or should we the version before that -- (version love-0.10.2)
Honestly, its better for learning if you keep failing and trying new methods vs just looking at how someone else did it (you master skills through experience, not by knowledge). That being said... if you're at a point where you're about to give up, its probably a lot better to look at how someone else did it vs giving up all together:
You can use a C decompiler called boomerang (https://stackoverflow.com/questions/193896/whats-a-good-c-decompiler) if you really wanna know how the instructors solution was done. The binary files for the solutions is kept in /home/cs50/ BUT doing it this way means you'll have to learn assembly language.
Alternatively you can just google "cs50 github" to find student solutions to the pset you are having problems with. Doing it this way allows you to leave comments on the students github source code to ask them why, how, and what the line of code does.
Error: Ask is not defined :D forgot to include the header or proto... couldnt compile .... But Im just gonna guess what you wanna know, As for the courses, Im taking the 6.00.1x from MIT on EdX :) it good :) not quite as CS50 but i love the PSets there. Also there is http://www.codecademy.com/ with some nice stuff :) Udacity is also nice :) just try any of them, you cannot do anything wrong :) its all about what you make of them :)
Is there a stack trace to help pinpoint where the fatal error occurred?
The only obvious thing I can ask about is "what is $acc?" because it's not given a value anywhere and it's use means you are passing query 13 entries instead of just 12 that you have ? for it to replace...
btw, (disclaimer: personal opinion), I'd look into php's call_user_func_array... it makes the query much cleaner.
maybe this can help: https://stackoverflow.com/questions/10529214/how-to-use-php-with-visual-studio
Honestly I've no idea why anyone would want to use a giant piece of software like VS for php, but...whatever.
As for databases: https://www.google.com/search?espv=2&q=visual+studio+sql+database
https://stackoverflow.com/questions/14747803/how-to-send-radio-button-value-in-php
says that each radio button needs a value and then you access it in php based on the radio button's name in $_POST.
don't make helpers
, make find
. "helpers" is just part of a program called "find", if you looked at the makefile you'd see that the command for making find actually passes all of the c files to clang, because it needs all of the files that make up the program for the program to be compiled.
... /u/delipity any way cs50 staff could add something like this to the makefile?
helpers: echo "use 'make find' !" echo "helpers is just part of the overall program!"
edit actually, according to this, more like:
helpers: $(error use 'make find', helpers is just part of the overall program!)
or
helpers: $(warning helpers is just part of the overall program!) $(error use 'make find'!)
I used Flask sessions (They're like built on top of cookies).
You could also have a look on LocalStorage.
I asked for help in CS50 facebook comunity and Kareem Zidane came up with the solution. I'll post it here because Google can find this post, but won't find facebook:
>Kareem Zidane Oh interesting! What happens if you add the following line right after app = Flask(name)? > > app.config["JSONIFY_PRETTYPRINT_REGULAR"] = False > >save and try again?
And then he explained:
>Kareem Zidane Seems to be an issue with Flask like Maged said. Long story short the JSONIFY_PRETTYPRINT_REGULAR configuration causes jsonify to respond with pretty JSON if the HTTP request is not an AJAX request, which it tries to detect using the is_xhr which is now deprecated, hence the warning. > >I hopes Flask fixes this in the next version. In the mean time, I think we'll just change our distribution code to contain this line by default. > >Cf. https://github.com/pallets/flask/issues/2549 >http://flask.pocoo.org/docs/0.10/config/...
It worked for me!
You absolutely have to try Codecademy. It's a phenomenal resource for HTML and CSS. It tracks your progress along a well-though out path. You get instant visual feedback (which is crucial since HTML and CSS are visual languages) and there's lots of help. Some lessons are tricky, but it's really really really well done.
PyCharm is cool, but pretty expensive. I'd recommend giving atom a chance. It's a free text editor/ide developed by Github. It has a lot of add-ins that do things like autocomplete, running scripts to browser and much more.
Sounds like this class would be more useful to you.
https://www.coursera.org/course/cs101
It's an intro to computer science for absolute beginners, taught by a Stanford professor, but is not the actual class that they teach at Stanford. It's a subset and introductory. My kids all did the class when it was first offered in 2012. It doesn't require anything beyond grade school mathematics (my son is in grade school!) :)
Taking that course is what whetted my daughter's appetite to learn more; a few months after completing stanford cs101, she took CS50x.
From what I have read whats happening is when you declare the variable inside the loop, the brackets {} denote scope, and the while statement is outside of it so cannot find the variable.
You could also use Virtualbox for mounting the appliance image. I didn't want to mess with the VMware licensing trials and jumped straight to it. I haven't had any problems with it.
I think that valgrind does not examine things that are not allocated dynamically. If you change
char c[1];
to
char *c = malloc(1);
it catches the illegal access immediately.
I did find this mention of an experimental extension to valgrind, on the official (?) valgrind pages:
http://valgrind.org/docs/manual/sg-manual.html
but I wasn't able to make it work for your case.
Yes they all mean "fix it". The selection actually varies with the compiler and the edition of c you're using. here's the clang manual http://clang.llvm.org/docs/UsersManual.html that may shed a little light
Yes, in fact you can do this all in one loop declaration. You don't need to limit yourself to simply incrementing each loop control variable by 1 each time around, either; see the following example:
The below loop:
int i, j, k; for (i=0, j=5, k=12; i<5; i++, j+=2, k-=4) { printf("i=%i, j=%i, k=%i\n", i, j, k); }
Gives this result:
i=0, j=5, k=12 i=1, j=7, k=8 i=2, j=9, k=4 i=3, j=11, k=0 i=4, j=13, k=-4
the error message is telling you that the for
for(int=0);
needs to look like this for(int=0;)
also a for has more components than what is show but the error detection may only be showing us part of your code
look at http://www.tutorialspoint.com/cprogramming/c_for_loop.htm
a credit card number is the kind of number that is not. it should come into the program as a string and then be manipulated as needed. This particular problem is a great teacher, string manipulation is tedious in C, few automatic conversions. Study the string conversion functions there are a bunch of them. <stdlib.h>
I've found this documentation for the C Standard Library quite helpful. If you scroll down to the library functions section for <stdio.h>, you can click through to pages with detailed information on each function, for example fopen(). These pages feature quite a few examples for each function.
Hope this helps!
If you are looking to learn a specific programming language, CS50 can help by giving you general guidance applicable to many programming languages.
If you are looking to learn about CS while getting a little overview of C, and web programming, then CS50[x] will be good for you and right on target.
I have not used any book while working on the C portions of the course. I instead refer to the provided resources.
Years ago I did use an early (1st) edition of Kernighan and Ritchie's "The C Programming Language" for some simple code maintenance. It was easy to read and follow.
Start the course and restart in January if you do not complete it by years end. You will have a head start on the next iteration of the course.
no it isn't. scratch has a global high score built in. You just make a variable a cloud variable. You do need to not be 'New to Scratch' however
​
https://scratch.mit.edu/discuss/topic/115958/?page=1#post-1033646
The 2 arguments in the slice function are the starting index where the slice will start (i) and up to the index at which you wish to end the string, exclusive (j).
To start slicing a string 'x' at index 0 (the first character) and slicing it after len(x) characters, it's going to give you back the string you entered because nothing has been sliced.
If the string was 'check', the function would be x[0:5]
C | h | e | c | k |
---|---|---|---|---|
0 | 1 | 2 | 3 | 4 |
Because the 2nd argument is exclusive, it only goes up to, not including the 5th index. So the function is going to start slicing at 0 and stop slicing before the 5th index. Which is why nothing is happening!
As you need to slice substrings, why don't you include length n into your helper function?
I used these to help me get my head around slicing, hopefully they'll be of use to you too:
https://www.pythoncentral.io/how-to-get-a-substring-from-a-string-in-python-slicing-strings/
I'm right there with you. There's some basic stuff that I know I should know, but just need a refresher. I had been just googling what I need when a problem comes up but I'm going to be trying Khan Academy to fill in the gaps I forgot since high school. It looks promising though to be honest I just started using it.
I ran across this the other day. I haven't done it yet (and don't know that I will since I already have the VM installed), but I saved the link.
https://medium.com/@gjdaniel1999/how-to-compile-c-on-a-mac-and-use-cs50-library-20eaff1bbfaa
Xcode just feels like such overkill for a simple C program.
Just as a sanity check:
You followed the instruction here?
Also take a look here, someone showed how he did it, with a lot of screenshots.
disable the warning beep you can do so by editing your /etc/rc.local file. Open the file in your editor of choice and go all the way to the bottom of the file. At the bottom there should be a line which reads exit 0. Add a new line directly above this one and put this on that line:
modprobe -r pcspkr. Save the file and this will turn off the system beep. If you want to turn the system beep back on, just edit this file again and remove the line that was added.
(OR)
You can disable this by editing a file and entering two simple lines.
gedit /etc/modprobe.d/blacklist And then add:
silly speaker beep
blacklist pcspkr Save your file and the speaker beep will be gone when you reboot.
If you don’t want to wait until a reboot, simply type:
sudo rmmod pcspkr (OR)
You can disable system bell if in the Terminal you go to Edit->Current Profile->General and uncheck the Terminal Bell Or in the Configuration editor go to apps->Gnome-Terminal->Profiles->default check silent Bell.
(OR)
Edit the .inputrc file in your home directory (create it if needed) and add the line
set bell-style visible You can also add (or uncomment) this line in the general /etc/inputrc file to set the bell-style for all users (overriden in ~/.inputrc).
(shamelessly stolen from Stack Exchange)
It almost certainly would be complex enough for PSET0. So long as it fulfils the criteria listed on the problem.
Last year, I made a silly game (with no end state or levels) and that passed.
So i went for something complex at first and got stuck. I spent 4 days trying to think about how to draw a line that recorded the angle, distance and then calculated the co-ordinate.
​
In the end I went for something super simple and just made loads of sprites dance :D.. It got me 100%... I think the idea is you just dip your toes in the water with scratch. Do the more complicated stuff in Pyton and C which is where you want to do most of your learning.
​
https://scratch.mit.edu/projects/471799206 this was my project - I was going to have the wizard shoot a bolt and kill all the sprites but I submitted it before finishing just to see if it would pass and it did.
I have the same issue > edit: It actually works when running the link provided in the instructions (https://ide50-username.cs50.io/articles?geo=02138), although an error still appears in the ide.
It actually doesn't work for me. The JSON given by /articles?geo consists entirely of theonion.com articles regardless of location because this line isn't executed due to syntax error.
feed = feedparser.parse("http://news.google.com/news?geo={}&output=rss".format(urllib.parse.quote(geo, safe="")))
Please don’t buy anything from this person. Anything they teach, you can learn for free from better resources. They want to scam you off your money under the guise of “I love teaching and sharing knowledge with people”. They’re using a fake account now because their old one was banned in many subreddits for spamming their “amazing” offers.
P.S. This course has a lecture on git. Alternatively, read this comprehensive and not at all difficult to read documentation book.
I spend some minutes searching stuff related to this. I found a comment here in reddit where a programming book is recommended to someone who don't have access to a computer and stuff on it can be done by pen and paper, the Book is : The Little Schemer By Daniel P. Friedman and Matthias Felleisen " The notion that "thinking about computing is one of the most exciting things the human mind can do" sets both The Little Schemer (formerly known as The Little LISPer) and its new companion volume, The Seasoned Schemer, apart from other books on LISP. The authors' enthusiasm for their subject is compelling as they present abstract concepts in a humorous and easy-to-grasp fashion. Together, these books will open new doors of thought to anyone who wants to find out what computing is really about. The Little Schemer introduces computing as an extension of arithmetic and algebra; things that everyone studies in grade school and high school. It introduces programs as recursive functions and briefly discusses the limits of what computers can do. The authors use the programming language Scheme, and interesting foods to illustrate these abstract ideas. The Seasoned Schemer informs the reader about additional dimensions of computing: functions as values, change of state, and exceptional cases. The Little LISPer has been a popular introduction to LISP for many years. It had appeared in French and Japanese. The Little Schemer and The Seasoned Schemer are worthy successors and will prove equally popular as textbooks for Scheme courses as well as companion texts for any complete introductory course in Computer Science "
I also found out that it is available to download here : The Little Schemer pdf
Remember that pset7
is accessed as a "virtual host". That's why you edited the /etc/hosts
file in the appliance to add the line
127.0.0.1 pset7
Suppose the IP address displayed on your appliance screen is, say, 192.168.56.101. Then if you make a similar addition to /etc/hosts
on your host computer, you may be able to connect to http://pset7/
from your real machine. The line you'd insert (substituting the actual address from your appliance's screen) would be
192.168.56.101 pset7
This article describes how to augment /etc/hosts
on a Windows system.
The academic honesty thing - in the beginning, you will copy parts all the time, learn from the copied code, adapt it to your situation. Which is not bad if you then understand the code, and attribute the parts that are mostly copied to their source (like a hash function for speller
, no need to invent your own).
I started with typing game sources printed in books, and fiddling with those. From some game published in source (the matching QBASIC interpreter was part of MS-DOS), I learnt how to access the mouse driver. After reading another book, I actually understood what the code did. Many experiments in between, and many started around copied code.
About posting code: On reddit, indenting code with four spaces in front of each line makes it a code block. For example, code
char *str = "Hello, World!"; printf("%s\n", str);
has four spaces in front of both lines. This helps preserve the indentation in the code. I use the Reddit Enhancement Suite which adds a button for this indentation thing.
And your pseudocode is already flawed. You want take an input line and write it f times, not f times write all input lines. So swap the first two loops (and adjust your content).
When writing pseudocode, step through as if you were the computer. Don't execute what you meant, but what you wrote. This should help with such a simple mistake.
I don't know, but you could use something like https://theia-ide.org/ to run inside the container. There are a lot of tutorials and guides, but it's getting complicated, especially since all you need is just the dependencies.
you can just treat query
as the function that call_user_func_array
will call back :)
Though now that I think about it, I left out a key point lol array_merge... which simplifies it to just call_user_func_array("query", array_merge( ... ))
. INSERT INTO is still an eyesore but... I suppose you could make that a variable (or a constant) so you don't have to look at it lol, but it has to be specified somehow.
None of the class/object stuff is needed for CS50 :)
this should work great /u/rss81
OP's /u/Nico-la <?= print("Symbol: ". $symbol); ?>
should be <? printf and when corrected needs the missing placeholder %i %s
<?= ?> is a shortcut for echo <? echo"something" ?>
php print only prints strings
Go to piratebay and get win7 for "educational purposes" and follow this guide to install it in a virtual machine http://www.howtogeek.com/forum/topic/how-to-install-windows-7-in-virtualbox-guide-hatryst
What version of MSVC?
this stack overflow post, which I found from a simple google search of "MSVC stdbool.h" says that MSVC 2010 doesn't fully support the c99 standard and this msdn blog post from the same search, seems to imply that it's supported in 2013.
I know this isn't what you're looking for, but I compiled the lecture notes and PSet instructions into some pdfs.
Here they are. There's a separate one which includes the hacker edition as well.
Codecademy has short, elementary courses/tutorials on all of the subjects you mentioned. They start from first principles and build up on them, but the final problems are not quite as challenging as the CS50 problem sets, especially dictionary
.
This is a divisive question and you'll find that some people think it's OK while others will argue it's not. In general, I think people will agree that personal projects are more favored than academic projects because A) they're original and show more about who YOU are and B) the tech community believes personal projects is more valuable in assessing candidates than the classes or school projects they built (YMMV).
There is no hand holding with making your own projects and you have to grind through all kinds of problems that you usually don't run into when building an academic project that comes with freebies like clearly articulated goals, requirements, etc. And there isn't a support structure for personal projects as there is in academics (help from classmates, teaching assistants, lab hours, etc.).
In my opinion, it's up to you on how you want to represent yourself on a resume and ANY project that you feel taught you something and demonstrates your ability to do X (code, learn, work through challenges, etc) is fair game. Read this FreeCodeCamp blog post - they suggest junior devs use academic projects if they have nothing else. Just keep in mind that a candidate who mirrors you in every other way except they have more personal projects will likely have a leg up on you.
I know you've already had your answer on Facebook, but in case anyone else is reading this.
Keep in mind what it says on the final project specs:
>Though do beware if using PHP in some environment other than the CS50 Appliance. The CS50 Appliance supports (and Problem Set 7 assumes) PHP 5.5, whereas some commercial web hosts only support 5.3 or earlier. Realize that syntax like
> $variable = ["a" => 1, "b" => 2, "c" => 3]; was introduced in PHP 5.4. In earlier versions of PHP, you’ll need to use syntax like
> $variable = array("a" => 1, "b" => 2, "c" => 3); instead. See http://php.net/manual/en/migration55.changes.php for other differences.
Also, $rows is also an array of arrays, right? I heard Zamyla saying that in the video. I was having trouble imagining that, but I found a page that shows how that is possible : http://php.net/manual/en/reserved.variables.post.php
In the comments section of that page, a user explain some details of $_POST. Then that user shows this :
array ( 0 => array('first_name'=>'john','last_name'=>'smith'), 1 => array('first_name'=>'jane','last_name'=>'jones'), );
So, when we want $rows[0], we want the the first array at index 0 (because when we query the database for the information, the information is returned in a form of an array).
Thought this was useful in helping me understand. :)
For those of you downloading vmware fusion by following the directions in the appliance manual, note that when the vmware site asks for a usename and password, you can use these dummy accounts so you don't have to make your own.
on a *nix machine it's as easy as typing ssh -X
to forward X over the network.
To get X to work on Windows, you'd need an X server like Xming http://www.straightrunning.com/XmingNotes/
I've never used it myself, it was just something I found when I was googling for a solution for you, so I don't have any advice on how to set it up. I suggest you RTFM if you wish to use it.
there is software that allows you to load a distro onto a usb stick and then you can choose to run it off of that OR install it directly to a machine. I did this once with linux live usb think it works with the cs50 file but maybe not.
Fun game, I would slow down the ships a little as it's a little hard on the eyes to follow what's happening. Also maybe some sound effects. http://www.bfxr.net/ is a cool site where you can make your own video game style sounds. I think both those things would add tons of the game in terms of fun.
Yes! The music is by Setuniman, who posted it over on Freesound.org. You can listen to and download it at the following URL: http://www.freesound.org/people/Setuniman/sounds/201060/
He has a lot of other music loops on there, many of which are just as good!
If you don't want to make an account, let me know and I will send it to you via private message.
That link takes you straight to the class, or a nondescript login page for people who haven't signed up for it.
The course information page can be viewed at https://www.coursera.org/course/android.
Because the appliance stores several essential settings within VirtualBox, you'd need to run a portable version of VirtualBox of the usb, (http://portableapps.com/node/8191). Edit: Whoops! Right link: http://www.vbox.me/
However, you would only have to import once.
Secondly, every time you switch computers, you'd have to go into the settings for the appliance inside VirtualBox, and change the network adapters. (Just use the drop-down menu.)
Other than that, it sounds like it would work.
I was having trouble with vmware as well, so I just installed virtual box instead. It allows for the mounting of the cs50 appliance image, so it worked out.
And as a bonus, no licensing issues or trials to mess with :)
It sounds like you've imported the same appliance that you were trying to use with VMware. You really ought to invest the time to download the up-to-date appliance image that is built to run under VirtualBox.
Please show us the full transcript of your attempt to run update50
.
For full screen mode and other display adjustments, you'll need to install the VirtualBox guest additions, as described here. (This will be unnecessary if you download the appliance customized for VirtualBox.)
Well all the passwords are stored by Dashlane and I can export them if I chose so that I can file them locally.
Check out their encryption stuff
https://www.dashlane.com/security
Edit: Oh wait I just realized you may have been talking about the security risk.
Well in order to gain access to my passwords, they'd first have to log into my computer account. My hard drive is encrypted, and the login for my computer is the same as my Apple ID. Meaning that I can reset it at any time.
If they do log in, they'll need my master password in order to be able to launch Dashlane. If my computer is stolen, I can reset my Dashlane master password.
If they do somehow get my new master password, Dashlane will require a second form of authentication when logging in. For example it'll send an email to my personal email account with a 6 digit code.
If you don't "return search()" you are simply calling your search function and throwing away what it has returned (the true or false). So at the end, you will return false since that is your default. In a recursive function, which you've written, you need to return the results of the function back to itself so it can keep doing the search.
Maybe a visual will help? There's a website that lets you visualize your code (it's experimental for the C language, but I tried it and it works for this example.) Here's [the link to it](http://www.pythontutor.com/visualize.html#code=%0A++++%23include+%3Cstdio.h%3E%0A++++%23include+%3Cstdbool.h%3E%0A%0A++++bool+search(int+value,+int+values%5B%5D,+int+min,+int+max%29%0A++++%7B%0A+++++%0A++++++int+midpoint+%3D+(max%2Bmin%29/2%3B%0A+...) If you step through the execution (using the forward button under the code) you can see exactly what is happening.
This a computer science course and not a graphic design one so I highly doubt you'd have to create sprites yourself from scratch. Also, pset0 says we should add notes and/or credits, which I see as the approval of using media from other sources, otherwise who do we give credit to? Lol! Try Open Game Art they have a nice collection of sprites.
JS is not like C, "undefined" is actually a kind of value, anything that's not declared is undefined but so is anything that hasn't been given a value (or explicitly given the value undefined).
Hey!
Let's do first things first. ccn % mod / divide
works the way it's intended to, but only because both operators happen to share the same precedence level. It's certainly better style to use brackets here, if only to make immediately clear to a reader what's going on.
From what point onward would ccn % mod / divide
return 0
, no matter what? (Remember that /
is floor-division.)
No need to actually get the length of the ccn at this point. You might need it later on, depending how you solve the length / signature check.
A long long
stores no leading zeros, so these are stripped when reading the input.
You could work something out with %
and /
. Also, what's the maximum value for any single digit multiplied by 2? Just in case you stick with if (i > 9) { ... }
. (Note the extra parentheses.)
As the numbers can have either and odd or even amount of digits, it's easiest to count "every second digit from the end" when beginning right there, at the end.
As this course is self-paced, take your time to get comfortable with each subject. If you finished the last problem set, but are struggling with the next one, don't push yourself until you're all frustrated.
Go back a step and try to really delve into the previous subject, ideally finding additional applications. If you don't have any own ideas on what to do, try solving some problems from Project Euler, Code Wars or some similar site.
All the best and don't give up!
Okay, maybe CS50.io specifically is not something we could have used, but that is merely because of the applications that are required in an office are different from what is required in software development.
More than 90% is not from CS50 anyway. The cloud based VM is an Amazon service which is used by CS50. CS50 installed some additional apps on it, but otherwise it's the same.
What kind of people/companies use Cloud 9 and for what purpose, I'm not entirely sure, but apparently there's enough market for it that Amazon has decided to step in the business.
And cloud computing is only becoming more and more common. Maybe most people/companies will not use Amazon's Cloud 9, but fact is that most servers run on Linux based systems and Linux is quite ubiquitous throughout the computer science world. So maybe, Cloud9 would not specifically be what you have to deal with in your job, odds are that if you want to become a computer scientist, you'll have to deal with a similar system sooner or later, no matter what.
> you can add ints and chars as if they are ints because they are.
To be more clear, for those learning (like /u/whitemoongurl), they are both number types, in fact, they are both number types which only store whole numbers (generically integers, but int is short for integer so...). The difference here is that an int uses more memory and so can store more values (4 or 8 bytes depending on OS/hardware vs 1 byte (ASCII chars are always 1 byte)), and the implication of using a char is that it will store an ASCII value (though it does not have to).
Since the compiler understands that they are both integer types (though of different sizes) it will allow you to add the two by converting the smaller-range type (char) to the larger-range type (int) for the addition (if it used the smaller type then you might lose value without meaning to, a char can only store up to 128 or 255 if it's unsigned whereas an int can store up to about 2 billion or 4 billion unsigned).
I used -range type above because the compiler also does this for floats and doubles which, while being number types, are not integer types and an int will be converted to a float even though they typically use the same memory because a float can store fractions and an int can't (so adding 1.5 + 3 by converting the 1.5 to an int would lose information because it'd become a 1, thus an answer of 4 instead of 4.5).
further reading for those interested: http://www.tutorialspoint.com/cprogramming/c_type_casting.htm
You're missing something :) I 'd suggest that you read this: http://www.tutorialspoint.com/cprogramming/c_file_io.htm
and for more infos:http://www.tutorialspoint.com/c_standard_library/stdio_h.htm
It will clear things up
////// take a look at how this is slightly different than your present code snippet ////// in your example, you create a more global "num", set it to 0, and then inside the for loop, a local "num" is created and set to the legth of that text string.
refer to this link: for loops in c tutorial
int num = strlen(text); for (int i = 0; i < num; i++) { // you code goes here }
Do you check for the correct return value of ispunct? See: http://www.tutorialspoint.com/ansi_c/c_ispunct.htm
Else you could use isalpha, and rework your if statements etc. If you want to show your code, you could always send me a PM :)
You can use fseek to change the file position indicator. Specify the offset in bytes and the position to start from. You can use a negative number to go back in a file.
https://cs50.harvard.edu/resources/cppreference.com/stdio/fseek.html
man fseek
http://www.tutorialspoint.com/c_standard_library/c_function_fseek.htm
> int fseek(FILE *stream, long int offset, int whence)
Thank you Glenn. So if SEEK_CUR is the "current position of the file pointer", how can it always be 1? What is a flag?
I tried ftell(), works ok.
#include <stdio.h> #include <stdlib.h>
#include "bmp.h"
int main() { FILE* inputBMP = fopen("clue.bmp", "r"); BITMAPFILEHEADER infileFileHeader; printf("The file pointer is now at %ld.\n", ftell(inputBMP)); fread(&infileFileHeader, sizeof(BITMAPFILEHEADER), 1, inputBMP); printf("The file pointer is now at %ld.\n", ftell(inputBMP)); }
Prints:
The file pointer is now at 0. The file pointer is now at 14.
When you add a number to a pointer, it calculates how many bytes to move over based on the datatype of the pointer.
So if you add 1 to an integer pointer, it will automatically take you 4 bytes over to where the next integer is. You don't have to use sizeof().
This might help: http://www.tutorialspoint.com/cprogramming/c_pointer_arithmetic.htm
Hi, i don;t think it would matter since you can re-name the sprite. Basically all you need for your pset0 is to use atleast 2 sprites, 3 scripts, and 1 sound. Scratch is actually a lot of fun and you'll find that once you play with it... you'll most likely get carried away. This was my first scratch project https://scratch.mit.edu/projects/164751294/ I went a little too far as far as the scope for pset0 was concerned. I think for me, making the game was more fun than playing it lol
Try to use Scratch - https://scratch.mit.edu/
Or if you want you can start to read this book:
C Programming Absolute Beginner’s Guide, Third Edition Greg Perry, Dean Miller Pearson Education, 2014 ISBN 0-789-75198-4
For the health glitch just check health < 1
As for the aiming not working when moving diagonally, this is the best I could come up with on scratch: https://scratch.mit.edu/projects/94434766/#editor
Otherwise nice game :)
I thought an auto-aiming feature would be nice, but it's semi-difficult with clones (since scratch doesn't have a way to loop through existing clones, you'd have to manually create a list of clone positions... a bit of a pain).
Nicely done!
disclaimer: -v switch has been enabled (typically is for me lol, -v = verbose)
1 - I remixed a game that had a similar thing where it was using a bunch of events based on an opponents health, if you look at the smartBomb sprite you'll see I used broadcast "join 'healthAt' 'round "orangeHealth" ' "
(scratch is SO not meant for text lol) https://scratch.mit.edu/projects/52757480/#editor I think you could use the same 'trick' here. Unfortunately you still have to receive each of the events individually, but you could also clean the 'code' up so that there is a "waveNum" variable and a "startingTime" variable and have the events just call a custom method that sets the timer to startingTime + (waveNum * 5). Then instead of broadcasting which wave ended, since you already have a variable that states which wave your on, you just broadcast that the wave ended and you can have one event that handles setting up for the next wave. Or if you like it separate you could broadcast 'End Wave ' joined with the waveNum :)
2 - then... you need to know how many enemies are on the screen and only broadcast endWave if both the counter and the enemyCount are less than or equal to 0.
3 - The problem is that the "click" can happen multiple times (especially if you don't just click but click and hold...). I'm really not sure what the best way to solve that is (had the same issue in the above remixed game with only wanting to release one bomb at a time but the key would be triggered multiple times...).
5 - It'd be awesome if it took more than just one click for some of the enemies (especially if RollyRider was actually two sprites that moved in the same path)... but not sure how much work that would actually take to implement (should be just a local variable for the enemy HP and decremented when they are 'clicked' and die only when that's < 0, but... not sure about RollyRider lol).
so 4.2 * 100 really is 419.999...
you can have a look at the round() function in the math.h library
Here is how one might do it:
You are seeing the effect of bilinear interpolation, or whatever the default graphics filter is.
You need a line somewhere in load to set the graphics mode to "nearest"
love.graphics.setDefaultFilter("nearest", "nearest")
Without that, love is blurring the edges of the two tiles and your background color value. With that line you get the nearest pixel to an edge...see Coltons description in lecture 1.
I'm another learner, but I ran into that issue too and found it easier to just download the old 10.2 version. You can find it on the Other Versions link at love2d.org. Just search 10.2 until you see the version with your operating system after it.
​
While they could update the repo, then it wouldn't quite sync with the video, so my guess is they'll just leave it as is for the time being.
Interesting question. Depending which model of nook, it may be possible, but it would involve an awful lot of experimentation and likely a fair chance of bricking your nook. Full linux distro on a nook color as proof of concept.
Practically speaking, you should probably consider the answer to be, "No."
I'm a COBOL developer and each one of the c problem sets took me between 6 and 10 hour on average to complete. So, I think your doing ok. Take your time, if you think you are going in the wrong direction, start over again, it isnt a race.
Today I finally finished the Speller program and it was a nightmare. Valgrind is probably something devil himself created. It complains A LOT about your code. I struggled a lot on the crack programa too.
Something which could help is reading the Brian Kerninghans book, The C Programming Language. I read it when I was in the school and most of you would need is there.
Best Regards.
I was teaching myself programming for 3 years before undergoing CS50. I definitely would have had more trouble with the learning curve had I began here in CS50, but by all means I can confidently say CS50 is entirely doable for a fresh starting beginner.
My approach is to watch the lectures, take notes, read the entire Pset (perhaps taking notes on them). Then I watch the "shorts", take more notes, (are you noticing a trend?) until diving into the Pset.
Notes, lots of notes. Sometimes I require more detail, so I google topics or refer to some of the books I've collected over the years. Brian Kernighan and Dennis Ritchie's "The C Programming Language" has been massively helpful; not in solving Psets, but improving the efficacy of my codes logical flow.
most compilers will let you get away without explicitly declaring the argument list as void. Lot's of older books don't use void in the argument list of a function that takes no arguments. (K&R The C Programming Language even possibly, but i'd have to go check to be sure and its late)
This is actually the preferred way to write code in C++ ... (that is e.g. int foo_function()
)
if something is declared without an explicit type, then it will implicitly be assumed to be of type int
You could always retake the course next year. Personally i semi agree with you, its a crammed course and a prior experience would be nice. Having said that, i can suggest buying the books recommended by the course and as far as C goes, the Dennis Ritchie one, The C Programming Language, is your bible. There are many online tutorials that can also help you. If youd like i can dig up some of those i found helpful and explanatory in an eli5 way. Also, as many have told me, use pen and paper as much as you can. Start by breaking down your problem, then writing pseudocode for it and then the actual code. After all this, transfer it to the pc. Also, try using intermittent prints of your variables to see what their values are, do you have the correct ones or do you need to do sth?
Hope i helped some!
Glad to be of help! The only two books I know well are
The original K&R book "The C Programming Language" by Brian Kernighan and Dennis M. Ritchie.
"Learn C on the Mac" by Dave Mark.
The first is a little dry, but not terribly so. It does not use analogies: it specifies compiler behavior in clinical terms. I like it a lot, because I like to know the definition of the language. Whether you use it to learn the language or not, the last third of the book is a pure definition of the language elements and their behavior, so it makes a great long-term reference book. It's also slim, cheap, and plentiful. The language has evolved since the first edition of the book, and I don't know if there is an updated version that addresses C99 or C11 (the two newer version of the language). But those changes are small enough to be learned outside the book.
The Dave Mark book I haven't looked at in a long time, but I remember it as being ok. It is targeted at the Mac only in so far as it used to come with a disc that had the compiler on it, so you could get up and running. After that it was all terminal (printf / scanf) programs, I think.
So I'm not much help on book recommendations.
If you know any other programming language, the K&R book should be a breeze and a good way to get going fast.
i++ and ++i are postfix and prefix increment operators. With a postfix increment the value is incremented after it is used in the expression, and with a prefix increment the value is incremented before it is used.
As far as the values printed, K&R, 202, has "The order of evaluation of arguments [i.e., in a function call] is unspecified; take note that various compilers differ." This means that in this function call to printf you have no idea what the order of the evaluation will be, it's compiler dependent. I'm pretty sure if you compile this on the appliance, Clang will give you at least a warning and probably an error.
K&R is a reference to: The C Programming Language (by Brian Kernighan and Dennis Ritchie)
>This doesn't always help, though. For example, if I'm trying to remember about the atoi or isupper or islower functions, I can't find it through the search here.
No one thing is going to do it all. You are going to need an arsenal of reference material. Make a bookmarks folder. Print out some cheat sheets.
For standard library functions like atoi(), fread(), etc. I use www.die.net They have a search function that brings up the manual pages. It's quick and to the point.
For language features like syntax, I have a copy of the Kernighan and Ritchie book "The C Programming Language". It's a little dry for most people, but it is definitive. For quick-glance refreshers on syntax, try this:
I also often have the experience you describe, where it's "I know they mentioned this in one of the lectures, but I don't remember which one (or where in the lecture)". I think that downloading the transcripts would be super useful for these moments. I haven't done it yet, but I think I will. It won't take that long and I think it will pay off many times over.
Also: don't forget Google. Searching for "c language bitwise operators" will almost always get you two hits very close to the top: Wikipedia and StackOverflow. One of those two is going to very (very) helpful. Wikipedia can be a bit scholarly sometimes; if you need a quick answer it can be too much. StackOverflow usually has a good answer in the top 2 answers.
For a reference book, you can't beat the original "The C Programming Language" by Brian W. Kernighan and Dennis M. Ritchie. They invented the language.
The first half of the book is a very accessible tutorial. The second half is a definitive language reference.
ISBN 0-13-110362-8
My favorite: Introduction to Algorithms by Cormen, Leiserson, Rivest, and Stein.
A more recent book by Cormen, Algoritms Unlocked, is aimed at a broader audience. I'll bet it's good, but I haven't read it.
I made an Asteroids-inspired game where the asteroids are crypto-currencies floating through space... Silly concept - but a fun experience for a first time scratcher.
My first game ever. Give er a whirl? @ Crypto Commander
The app is a plain web wrapper so the page change isn't as smooth. Though it's much better after using preload and prefetch. There was a problem in scaling and required fixing postgress connection leak in the CS50 library. For user email, its hash is stored and UUID is used for user sessions. Couldn't make it more anonymous though. Any ideas?
Web-version: f00die.herokuapp.com
Android (better UI): tinyurl.com/foodieapp
You'll have to enter the full email unless you're from IITG. In the latter case Hi there!
Why +1
in the line
temp[(values[i]+1)]++;
?
temp[(values[i])]++;
should work.
That said, I guess your code doesn't work because temp
array is not initialized to all zeros, it contains garbage values and the program remains stuck at the while loop:
}while(temp[i]!=0);
because temp[i]
could contain a negative value (temp[i] > 0
could be a better test).
A shorthand to initialize temp
to all zeros would be:
int temp[LIMIT] = { 0 };
and you should turn limit
into a constant, something like:
#define LIMIT 65536
at the beginning of the file, otherwise the shorthand will not work (at least on my machine).
https://stackoverflow.com/questions/2589749/how-to-initialize-array-to-0-in-c
When you add new nodes to the frontier you should also specify the parent and the action (last rows of the code).
But please at least try to test/debug your code before posting. Visual Studio Code is very simple to use and effective, I suggest to read the doc for python https://code.visualstudio.com/docs/python/python-tutorial. In 10 minutes you will have a lot of nice feature while writing and be able to debug very easily
https://code.visualstudio.com/docs/python/tutorial-flask
Have you tried tutorials? Haven’t got as far in CS50 to use flask but for instance theirs a link. First step is making sure python is installed and environment path is setup. Just make sure a hello_world example works.
Another option is wsl2, you end up running a Linux kernel on windows. For instance I got C and and using -lcs50 setup on wsl2 in a few command lines.
I agree with you that it is a good book, but I don't think it's suitable for OP as he seeks for fundamental concepts, this book was mostly on good programming habits.
On the other hand, I recommend books focusing more on introduction to programming languages, here are some that I really like
Can you copy/paste your entire code into here and share the link? https://hastebin.com/
From what I can see in the screenshot, you could (maybe should?) remove the declaration on line 7, the error on line 18 could be because you are technically printing nothing instead of a " " - but I don't know for sure. It would be helpful to see the whole code and be able to try and compile it myself to see what I can find.
Here is a cleaned up and easier to read version of your code: https://hastebin.com/amirufitel.c
My suggestion is to start with pseudo code. Start by writing down each step of the process in English:
After you've written full pseudo code, work on implementing, debugging and getting each step individually working(and making lots of good comments along the way). Doing these steps one at a time and confirming they work make it easier to track down where your bug lies. Also breaking these steps into functions might help keep your code organized, and may make it easier to find where things are going wrong.
Thanks for the suggestions! Here is a recap of the changes I made:
line 73-77: I commented out these seemingly gratuitous header files for now, because I already had that exact code on lines 95-99.
line 84: I uncommented the code I wrote the determine the height.
line 92: I accounted for absolute value by adding abs in front of the newPadding value.
My code compiles, but it is still getting stuck in gdb. Is my logic from 101-133 correct? Here's my updated code: http://pastebin.com/bqhe7gmD
Also, here's a pic of what it looks like when I run ~cs50/pset4/peek student.bmp staff.bmp : http://tinypic.com/r/300dwrq/8
I don't know about the git module in CS50, but I think these are good resources to learn git:
https://learngitbranching.js.org/
https://www.udacity.com/course/version-control-with-git--ud123
I hope this helps! :)