ronreiter / interactive-tutorials Goto Github PK
View Code? Open in Web Editor NEWInteractive Tutorials
License: Apache License 2.0
Interactive Tutorials
License: Apache License 2.0
The closing ?> has plagued php forever causing headers to be sent and bugs to be had.
PSR-0/1/2, pear, and zend all require closing tags be omitted unless you're including some sort of markup.
Noticed some of the pages such as Abstract_Classes.md and the ones after aren't linked on the website.
C and python c++
The original url for learn python homepage is https://www.learnpython.org/en/Hello%2C_World%21 .
However if I manipulate it to https://www.learnpython.org/en/Hello%2C_Wdfdforld%21 by putting any random variables in between; the site will give internal server error.
I believe it should efficiently filter the user input. :)
Hi @ronreiter. Are changes to the tutorials on master
automatically deployed?
A pull request of mine was merged in recently #324 but the changes haven't appeared on <learn-c.org>. I just want to make sure that I didn't make a mistake or if it just takes a while before the changes get deployed.
Hello
When trying to compile on windows, it fails due to issues with a text file in the PHP folder of learn-php.org
WARNING:root:loading data for domain: learn-php.org
Traceback (most recent call last):
File "main.py", line 200, in <module>
init_tutorials()
File "main.py", line 163, in init_tutorials
tutorial_dict["page_title"] = tutorial.decode("utf8")
File "C:\Python27\lib\encodings\utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe0 in position 9: invalid continuation byte
The solution code gives this error:
prog.cs(3,24): error CS0542: `Main.Main()': member names cannot be the same as their enclosing type
prog.cs(2,14): (Location of the symbol related to previous error)
Compilation failed: 1 error(s), 0 warnings
Changing one of the "Main"s to something else doesn't allow you to pass.
When you take a look at the German version of the website, there are no tutorials available (click a link in the TOC of the Welcome page and the tutorial comes up empty).
But there are German translations available in the repo.
After a quick look it seems the link text/target in the TOC links are mixed up.
I will try to submit a pull request in the next days.
Hello,
I started translating the C tutorials and will see how far I will come and I noticed, that the solution for the Array is the same as the tutorial code.
Am I missing something?
Update: This is already addressed by this pull request.
Update2: No it isn't. Will make my own solution, then. #135
Where I put an asterisk for muliplication, at my *= /= -= += shortcuts, you made it italic, so now it makes no sense.
I cloned interactive-tutorials locally and installed Flask with the intention to verify my contributes.
When I start Flask with
FLASK_APP="main.py -d learnpython.org" flask run
I got the error
File "/home/fabrizio/interactive-tutorials/main.py", line 152
except Exception, e:
I'm using Python 3.5.2
Some pages can't be found. Like this:
https://www.learnjavaonline.org/en/Collections
int main() {
/* define first_name /
/ define last_name */
char name[100];
/* testing code */
if (strncmp(first_name, "John") != 0) return 1;
if (strncmp(last_name, "Doe") != 0) return 1;
last_name[0] = 'B';
sprintf(name, "%s %s", first_name, last_name);
if (strncmp(name, "John Boe", 100) == 0) {
printf("Done!\n");
}
return 0;
}
This is the pull request > #109
In this example, the game.py script may look something like this:
# game.py # import the draw module import draw ...
...
In this example, the
game
module imports theload
module.
draw
vs load
.
In here at the tutorial of the topic 'Basic Operators' , example 3rd,
viz. Using two multiplication symbols makes a power relationship.
The print (squared)
print(cubed)
is missing.
Probably added a lot more detail than needed, but here's a solution
package arrays;
public class Arrays
{
public static void main(String[] args)
{
// TODO code application logic here
// create the array
int[] numbers = {1,2,3};
// setting length to spot 2 as array counter starts at 0. [0]=1, [1]=2,
// and [2] = 3
int length = numbers[2];
// Declare variable chars of type char
// at this point length should = 3 and chars will have 4 spots
char[] chars = new char[length];
System.out.println(numbers.length);
// original line: chars[numbers.length+4='y'
// this will fail due to the array length on being set to 3 and
// adding 4 will send the array out of bounds.
chars[numbers.length-1] ='y';
System.out.println(chars[numbers.length-1]);
System.out.println("Done!");
}
}
OUTPUT:
run:
3
y
Done!
BUILD SUCCESSFUL (total time: 0 seconds)
In the tutorial, the code block in the tutorial part says ruby
It should not say ruby. The tutorial I made does not have that error, so I think the ```ruby is not working on the site.
How can I run the server locally, sorry have not done a lot of work with python but ver interested in what you have put together here, would love a chance to contribute!
Cheers,
Otis Wright.
I would like to translate some tutorial to Spanish. I expect you could give me some feedback about this.
Thank you.
By the way awesome work
Logical combinations
if <a href='/en/%24VAR_A-eq_1_%26%26_%28%24VAR_B_%3D_%22bee%22_'¥> | $VAR_T = "tee") <¥/a> ; then
command...
fi
Above is what I see. This may be a miss of link address, I am not familiar with HTML.
My propose is to change the file: Variables and types in order to match the variable type on output of the exercise (the variable is of the type float, but the output is required to be int):
String: hello Float: 10 Integer: 20
if mystring == "hello": print "String: %s" % mystring if isinstance(myfloat, float) and myfloat == 10.0: print "Float: %d" % myfloat if isinstance(myint, int) and myint == 20: print "Integer: %d" % myint
String: hello Float: 10.0 Integer: 20
if mystring == "hello": print "String: %s" % mystring if isinstance(myfloat, float) and myfloat == 10.0: print "Float: %0.1f" % myfloat if isinstance(myint, int) and myint == 20: print "Integer: %d" % myint
http://www.learn-js.org/en/Manipulating_Arrays
Splicing exercise works differently from what written in tutorial (I'm using Chrome)
there is a problem this code it should print 6 as well but the expected output doesn't agree.
#include <stdio.h>
int main() {
int array[] = {1, 7, 4, 5, 9, 3, 5, 11, 6, 3, 4};
int i = 0;
while (i < 10) {
if(array[i] < 5){
i++;
continue;
}
if(array[i] > 10){
break;
}
printf("%d\n", array[i]);
i++;
}
return 0;
}
I came up with a solution, and I saw the exercise said there was none and it asked that the solution be posted here. Hopefully this is the correct place to post it!
For this solution, I needed to do a "USE INTEGER", which we haven't "learned" yet...so maybe that needs to be a lesson somewhere before this chapter?
use integer;
@numbers = (951,402,984,651,360,69,408,319,601,485,980,507,725,547,
544,615,83,165,141,501,263,617,865,575,219,390,237,412,
566,826,248,866,950,626,949,687,217,815,67,104,58,512,24,
892,894,767,553,81,379,843,831,445,742,717,958,609,842,
451,688,753,854,685,93,857,440,380,126,721,328,753,470,
743,527);
# write your code below
$max = scalar @numbers;
for ($count=0 ; $count <= $max ; $count++)
{
$current = $numbers[$count];
$count1 = $current / 2;
if ($count1*2 == $current) {print $current, "\n";}
if ($current == 237) {last;}
}
I got this installed, and when i click on a link to any of the links, it redirects me to the actual website, and unable to use it offline
The Sphere Engine is configured to run Main.java
with no arguments. However, the point of the tutorial is to learn how to work with arguments.
Modify how the Sphere Engine is configured such that arguments are passed.
Testing the framework from the checked-out repo requires flask, which may not be obvious to install (and may lead to some clutter).
It would be great to provide a Dockerfile which allows to run the examples inside a container, for local testing.
The dynamic allocation require import which is:
import <stdlib.h>
The Java tutorial console is not working. The gear animation appears in the output window when "Run," but nothing happens.
Great set of tutorials, only small comment
after you do:
Student.prototype = new Person(); // inherit Person
you should adjust the constructor to point to Student instead of Person
// correct the constructor pointer because it points to Person
Student.prototype.constructor = Student;
Maybe also show how to use the person constructor, and then how
student can inherit from that, instead of creating a init method...
The solution is incorrect. You must put (float) in
float e = 2.0;
like
float e = (float)2.0;
The real solution is
public class Main {
public static void main(String[] args) {
byte zero = 0;
short a = 3;
int b = 1;
char d = ' ';
float e = (float)2.0;
boolean f = true;
String output = "H" + a + b + b + zero + d + "w" + zero + "r" + b + "d" + d + e + d + f;
System.out.println(output);
}
}
The coding window size is too small for attempting say 40-45 lines of code. Is there a way we can pop out that section into a new window and plug it back in?
Do you think it's out of scope to try to learn gtk with your tutorials
Glue will be broadway http://worldofgnome.org/running-gtk-apps-on-web-with-node-broadway/
Would be really amazing to learn basic from Gtk on an interactive web tutorial
Ron:
I recently added an .md file for Java interfaces. I followed the contributor instructions and submitted a PR. It appears that you accepted the PR but I do not see the text when I navigate to https://www.learnjavaonline.org/en/Interfaces.
Perhaps I missed a step. Please let me know.
The first sentence under boolean is phrased a little awkwardly. Just a heads up.
As an alternative to using Sphere engine, it seems possible to execute PHP code directly in the browser, requiring no server-side service to execute PHP.
Uniter seems one such environment: https://github.com/asmblah/uniter
See https://asmblah.github.io/uniter/demo/interactive.html for instance.
I guess that for the kind of PHP that's needed for this tutorial, that'd do the trick.
Of course, that would make a specific variant compared to other tutorials.
Hi,
while I understand that you have to pay for the servers, lots of my readers felt repelled by the amount and style of ads on your website. Could you maybe revisit your web page marketing and transition to a less obtrusive model?
Kind regards
Eric
I reference this part of the page:
int i;
for (i = 0; i < 5; i++) {
if (i >= 3) {
break;
}
System.out.println("Yuhu");
if (i >= 1) {
continue;
}
System.out.println("Tata");
}
System.out.println(i);
// Output
// Yuhu
// Tata
// Yuhu
// Yuhu
// 3
This output is wrong as best as I can tell. Because the second if
statement is >=' and not just
==`, the program should continue to print out "Tata" until the loop breaks.
EDIT: I see my mistake, @ShinHacker 's explanation below was very helpful.
The pointers are different each time the code is run, so having a fixed expected output does not work.
I think it should be clarified that urllib.urlopen
won't work in python 3, and for python 3 users should use urllib.request.urlopen
.
Solution Output:
Your guess is too low.Your guess is too high.Correct. You guessed it!
Expected Output:
Your guess is too low.
Your guess is too high.
Correct. You guessed it!
Printf are missing new line escape sequences (\n).
Steps to reproduce:
When you watch the network traffic, you see that the POST request results in a 500 Internal Server Error.
The range of LONG are incorrect, you used int32 range
In learn-c.org
https://github.com/ronreiter/interactive-tutorials/blob/master/tutorials/learn-c.org/en/Arrays%20and%20Pointers.md
You may go through Pointers and Arrays for a further detailed discussion on this topic.
Not found external link to Pointers and Arrays https://www.le.ac.uk/users/rjm1/cotter/page_59.htm
Persian language needs rtl direction
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.