Skip to content

Commit

Permalink
Merge pull request #1 from adambard/master
Browse files Browse the repository at this point in the history
Merging changes from source branch
  • Loading branch information
droidenator committed Oct 5, 2015
2 parents a743c83 + e57fb68 commit fe5157d
Show file tree
Hide file tree
Showing 33 changed files with 2,172 additions and 124 deletions.
14 changes: 7 additions & 7 deletions bash.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ echo $Variable
echo "$Variable"
echo '$Variable'
# When you use the variable itself — assign it, export it, or else — you write
# its name without $. If you want to use variable's value, you should use $.
# its name without $. If you want to use the variable's value, you should use $.
# Note that ' (single quote) won't expand the variables!

# String substitution in variables
Expand All @@ -70,11 +70,11 @@ echo ${Foo:-"DefaultValueIfFooIsMissingOrEmpty"}

# Builtin variables:
# There are some useful builtin variables, like
echo "Last program return value: $?"
echo "Last program's return value: $?"
echo "Script's PID: $$"
echo "Number of arguments: $#"
echo "Scripts arguments: $@"
echo "Scripts arguments separated in different variables: $1 $2..."
echo "Number of arguments passed to script: $#"
echo "All arguments passed to script: $@"
echo "Script's arguments separated into different variables: $1 $2..."

# Reading a value from input:
echo "What's your name?"
Expand Down Expand Up @@ -108,8 +108,8 @@ fi
# Expressions are denoted with the following format:
echo $(( 10 + 5 ))

# Unlike other programming languages, bash is a shell so it works in a context
# of current directory. You can list files and directories in the current
# Unlike other programming languages, bash is a shell so it works in the context
# of a current directory. You can list files and directories in the current
# directory with the ls command:
ls

Expand Down
86 changes: 51 additions & 35 deletions c++.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ contributors:
- ["Steven Basart", "http://github.com/xksteven"]
- ["Matt Kline", "https://github.com/mrkline"]
- ["Geoff Liu", "http://geoffliu.me"]
- ["Connor Waters", "http://github.com/connorwaters"]
lang: en
---

Expand Down Expand Up @@ -53,11 +54,11 @@ int main(int argc, char** argv)

// However, C++ varies in some of the following ways:

// In C++, character literals are one byte.
sizeof('c') == 1
// In C++, character literals are chars
sizeof('c') == sizeof(char) == 1

// In C, character literals are the same size as ints.
sizeof('c') == sizeof(10)
// In C, character literals are ints
sizeof('c') == sizeof(int)


// C++ has strict prototyping
Expand Down Expand Up @@ -159,9 +160,9 @@ void foo()

int main()
{
// Includes all symbols from `namesapce Second` into the current scope. Note
// that simply `foo()` no longer works, since it is now ambiguous whether
// we're calling the `foo` in `namespace Second` or the top level.
// Includes all symbols from namespace Second into the current scope. Note
// that simply foo() no longer works, since it is now ambiguous whether
// we're calling the foo in namespace Second or the top level.
using namespace Second;

Second::foo(); // prints "This is Second::foo"
Expand Down Expand Up @@ -244,7 +245,13 @@ cout << fooRef; // Prints "I am foo. Hi!"
// Doesn't reassign "fooRef". This is the same as "foo = bar", and
// foo == "I am bar"
// after this line.
cout << &fooRef << endl; //Prints the address of foo
fooRef = bar;
cout << &fooRef << endl; //Still prints the address of foo
cout << fooRef; // Prints "I am bar"

//The address of fooRef remains the same, i.e. it is still referring to foo.


const string& barRef = bar; // Create a const reference to bar.
// Like C, const values (and pointers and references) cannot be modified.
Expand All @@ -256,7 +263,7 @@ string tempObjectFun() { ... }
string retVal = tempObjectFun();

// What happens in the second line is actually:
// - a string object is returned from `tempObjectFun`
// - a string object is returned from tempObjectFun
// - a new string is constructed with the returned object as arugment to the
// constructor
// - the returned object is destroyed
Expand All @@ -268,15 +275,15 @@ string retVal = tempObjectFun();
// code:
foo(bar(tempObjectFun()))

// assuming `foo` and `bar` exist, the object returned from `tempObjectFun` is
// passed to `bar`, and it is destroyed before `foo` is called.
// assuming foo and bar exist, the object returned from tempObjectFun is
// passed to bar, and it is destroyed before foo is called.

// Now back to references. The exception to the "at the end of the enclosing
// expression" rule is if a temporary object is bound to a const reference, in
// which case its life gets extended to the current scope:

void constReferenceTempObjectFun() {
// `constRef` gets the temporary object, and it is valid until the end of this
// constRef gets the temporary object, and it is valid until the end of this
// function.
const string& constRef = tempObjectFun();
...
Expand All @@ -301,7 +308,7 @@ basic_string(basic_string&& other);
// Idea being if we are constructing a new string from a temporary object (which
// is going to be destroyed soon anyway), we can have a more efficient
// constructor that "salvages" parts of that temporary string. You will see this
// concept referred to as the move semantic.
// concept referred to as "move semantics".

//////////////////////////////////////////
// Classes and object-oriented programming
Expand Down Expand Up @@ -349,7 +356,10 @@ public:
// These are called when an object is deleted or falls out of scope.
// This enables powerful paradigms such as RAII
// (see below)
// Destructors must be virtual to allow classes to be derived from this one.
// The destructor should be virtual if a class is to be derived from;
// if it is not virtual, then the derived class' destructor will
// not be called if the object is destroyed through a base-class reference
// or pointer.
virtual ~Dog();

}; // A semicolon must follow the class definition.
Expand Down Expand Up @@ -492,9 +502,10 @@ int main () {
/////////////////////

// Templates in C++ are mostly used for generic programming, though they are
// much more powerful than generics constructs in other languages. It also
// supports explicit and partial specialization, functional-style type classes,
// and also it's Turing-complete.
// much more powerful than generic constructs in other languages. They also
// support explicit and partial specialization and functional-style type
// classes; in fact, they are a Turing-complete functional language embedded
// in C++!

// We start with the kind of generic programming you might be familiar with. To
// define a class or function that takes a type parameter:
Expand All @@ -506,7 +517,7 @@ public:
};

// During compilation, the compiler actually generates copies of each template
// with parameters substituted, and so the full definition of the class must be
// with parameters substituted, so the full definition of the class must be
// present at each invocation. This is why you will see template classes defined
// entirely in header files.

Expand All @@ -520,13 +531,13 @@ intBox.insert(123);
Box<Box<int> > boxOfBox;
boxOfBox.insert(intBox);

// Up until C++11, you must place a space between the two '>'s, otherwise '>>'
// will be parsed as the right shift operator.
// Until C++11, you had to place a space between the two '>'s, otherwise '>>'
// would be parsed as the right shift operator.

// You will sometimes see
// template<typename T>
// instead. The 'class' keyword and 'typename' keyword are _mostly_
// interchangeable in this case. For full explanation, see
// instead. The 'class' keyword and 'typename' keywords are _mostly_
// interchangeable in this case. For the full explanation, see
// http://en.wikipedia.org/wiki/Typename
// (yes, that keyword has its own Wikipedia page).

Expand Down Expand Up @@ -582,12 +593,15 @@ try {
// Do not allocate exceptions on the heap using _new_.
throw std::runtime_error("A problem occurred");
}

// Catch exceptions by const reference if they are objects
catch (const std::exception& ex)
{
std::cout << ex.what();
std::cout << ex.what();
}

// Catches any exception not caught by previous _catch_ blocks
} catch (...)
catch (...)
{
std::cout << "Unknown exception caught";
throw; // Re-throws the exception
Expand All @@ -597,8 +611,8 @@ catch (const std::exception& ex)
// RAII
///////

// RAII stands for Resource Allocation Is Initialization.
// It is often considered the most powerful paradigm in C++,
// RAII stands for "Resource Acquisition Is Initialization".
// It is often considered the most powerful paradigm in C++
// and is the simple concept that a constructor for an object
// acquires that object's resources and the destructor releases them.

Expand All @@ -619,9 +633,9 @@ void doSomethingWithAFile(const char* filename)
// Unfortunately, things are quickly complicated by error handling.
// Suppose fopen can fail, and that doSomethingWithTheFile and
// doSomethingElseWithIt return error codes if they fail.
// (Exceptions are the preferred way of handling failure,
// but some programmers, especially those with a C background,
// disagree on the utility of exceptions).
// (Exceptions are the preferred way of handling failure,
// but some programmers, especially those with a C background,
// disagree on the utility of exceptions).
// We now have to check each call for failure and close the file handle
// if a problem occurred.
bool doSomethingWithAFile(const char* filename)
Expand Down Expand Up @@ -735,21 +749,23 @@ class Foo {
virtual void bar();
};
class FooSub : public Foo {
virtual void bar(); // overrides Foo::bar!
virtual void bar(); // Overrides Foo::bar!
};


// 0 == false == NULL (most of the time)!
bool* pt = new bool;
*pt = 0; // Sets the value points by 'pt' to false.
*pt = 0; // Sets the value points by 'pt' to false.
pt = 0; // Sets 'pt' to the null pointer. Both lines compile without warnings.

// nullptr is supposed to fix some of that issue:
int* pt2 = new int;
*pt2 = nullptr; // Doesn't compile
*pt2 = nullptr; // Doesn't compile
pt2 = nullptr; // Sets pt2 to null.

// But somehow 'bool' type is an exception (this is to make `if (ptr)` compile).
// There is an exception made for bools.
// This is to allow you to test for null pointers with if(!ptr),
// but as a consequence you can assign nullptr to a bool directly!
*pt = nullptr; // This still compiles, even though '*pt' is a bool!


Expand All @@ -776,12 +792,12 @@ vector<Foo> v;
for (int i = 0; i < 10; ++i)
v.push_back(Foo());

// Following line sets size of v to 0, but destructors don't get called,
// Following line sets size of v to 0, but destructors don't get called
// and resources aren't released!
v.empty();
v.push_back(Foo()); // New value is copied into the first Foo we inserted in the loop.
v.push_back(Foo()); // New value is copied into the first Foo we inserted

// Truly destroys all values in v. See section about temporary object for
// Truly destroys all values in v. See section about temporary objects for
// explanation of why this works.
v.swap(vector<Foo>());

Expand Down
4 changes: 3 additions & 1 deletion c.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ int main(void) {
// can be declared as well. The size of such an array need not be a compile
// time constant:
printf("Enter the array size: "); // ask the user for an array size
char buf[0x100];
int size;
fscanf(stdin, "%d", &size);
char buf[size];
fgets(buf, sizeof buf, stdin);

// strtoul parses a string to an unsigned integer
Expand Down
6 changes: 3 additions & 3 deletions chapel.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -1074,14 +1074,14 @@ Installing the Compiler
Chapel can be built and installed on your average 'nix machine (and cygwin).
[Download the latest release version](https://github.com/chapel-lang/chapel/releases/)
and its as easy as
and it's as easy as
1. `tar -xvf chapel-1.11.0.tar.gz`
2. `cd chapel-1.11.0`
3. `make`
4. `source util/setchplenv.bash # or .sh or .csh or .fish`
You will need to `source util/setchplenv.EXT` from within the Chapel directory (`$CHPL_HOME`) every time your terminal starts so its suggested that you drop that command in a script that will get executed on startup (like .bashrc).
You will need to `source util/setchplenv.EXT` from within the Chapel directory (`$CHPL_HOME`) every time your terminal starts so it's suggested that you drop that command in a script that will get executed on startup (like .bashrc).
Chapel is easily installed with Brew for OS X
Expand All @@ -1100,4 +1100,4 @@ Notable arguments:
* `--fast`: enables a number of optimizations and disables array bounds checks. Should only enable when application is stable.
* `--set <Symbol Name>=<Value>`: set config param `<Symbol Name>` to `<Value>` at compile-time.
* `--main-module <Module Name>`: use the main() procedure found in the module `<Module Name>` as the executable's main.
* `--module-dir <Directory>`: includes `<Directory>` in the module search path.
* `--module-dir <Directory>`: includes `<Directory>` in the module search path.
3 changes: 2 additions & 1 deletion common-lisp.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ nil ; for false - and the empty list
:age 5))
*rover* ; => #S(DOG :NAME "rover" :BREED "collie" :AGE 5)
(dog-p *rover*) ; => t ;; ewww)
(dog-p *rover*) ; => true #| -p signifies "predicate". It's used to
check if *rover* is an instance of dog. |#
(dog-name *rover*) ; => "rover"
;; Dog-p, make-dog, and dog-name are all created by defstruct!
Expand Down
3 changes: 2 additions & 1 deletion csharp.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ on a new line! ""Wow!"", the masses cried";
// Ternary operators
// A simple if/else can be written as follows
// <condition> ? <true> : <false>
string isTrue = (true) ? "True" : "False";
int toCompare = 17;
string isTrue = toCompare == 17 ? "True" : "False";

// While loop
int fooWhile = 0;
Expand Down
12 changes: 6 additions & 6 deletions css.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ contributors:
filename: learncss.css
---

In early days of web there was no visual elements, just pure text. But with the
further development of browser fully visual web pages also became common.
In the early days of the web there were no visual elements, just pure text. But with the
further development of browsers, fully visual web pages also became common.
CSS is the standard language that exists to keep the separation between
the content (HTML) and the look-and-feel of web pages.

In short, what CSS does is to provide a syntax that enables you to target
different elements on an HTML page and assign different visual properties to them.

Like any other language, CSS has many versions. Here we focus on CSS2.0
which is not the most recent but the most widely supported and compatible version.
Like any other languages, CSS has many versions. Here we focus on CSS2.0,
which is not the most recent version, but is the most widely supported and compatible version.

**NOTE:** Because the outcome of CSS is some visual effects, in order to
learn it, you need try all different things in a
**NOTE:** Because the outcome of CSS consists of visual effects, in order to
learn it, you need try everything in a
CSS playground like [dabblet](http://dabblet.com/).
The main focus of this article is on the syntax and some general tips.

Expand Down
5 changes: 3 additions & 2 deletions de-de/csharp-de.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ zur nächsten Zeile, ""Wahnsinn!"", die Massen waren kaum zu bändigen";
// Ternärer Operator
// Anstatt eines einfachen if/else lässt sich auch folgendes schreiben:
// <condition> ? <true> : <false>
string isTrue = true ? "Ja" : "Nein";
int zumVergleich = 17;
string isTrue = zumVergleich == 17 ? "Ja" : "Nein";

// while-Schleife
int fooWhile = 0;
Expand Down Expand Up @@ -886,4 +887,4 @@ zur nächsten Zeile, ""Wahnsinn!"", die Massen waren kaum zu bändigen";
* [ASP.NET Web Forms Tutorials](http://www.asp.net/web-forms/tutorials)
* [Windows Forms Programming in C#](http://www.amazon.com/Windows-Forms-Programming-Chris-Sells/dp/0321116208)

[C# Coding Conventions](http://msdn.microsoft.com/de-de/library/vstudio/ff926074.aspx)
[C# Coding Conventions](http://msdn.microsoft.com/de-de/library/vstudio/ff926074.aspx)
2 changes: 1 addition & 1 deletion de-de/git-de.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Ein Repository besteht in Git aus dem .git-Verzeichnis und dem Arbeitsverzeichni

### .git-Verzeichnis (Teil des Repositorys)

Das .git-Verzeichnis enth? alle Einstellung, Logs, Branches, den HEAD und mehr.
Das .git-Verzeichnis enthält alle Einstellung, Logs, Branches, den HEAD und mehr.
[Ausführliche Übersicht](http://gitready.com/advanced/2009/03/23/whats-inside-your-git-directory.html)

### Arbeitsverzeichnis (Teil des Repositorys)
Expand Down
2 changes: 1 addition & 1 deletion de-de/go-de.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ Dokumentation lesen.
Auch zu empfehlen ist die Spezifikation von Go, die nach heutigen Standards sehr
kurz und auch gut verständlich formuliert ist. Auf der Leseliste von Go-Neulingen
ist außerdem der Quelltext der [Go standard Bibliothek](http://golang.org/src/pkg/).
Gut documentiert, demonstriert sie leicht zu verstehendes und im idiomatischen Stil
Gut dokumentiert, demonstriert sie leicht zu verstehendes und im idiomatischen Stil
verfasstes Go. Erreichbar ist der Quelltext auch durch das Klicken der Funktionsnamen
in der [offiziellen Dokumentation von Go](http://golang.org/pkg/).

Loading

0 comments on commit fe5157d

Please sign in to comment.