summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--bash.html.markdown4
-rw-r--r--csharp.html.markdown8
-rw-r--r--css.html.markdown11
-rw-r--r--fr-fr/csharp-fr.html.markdown812
-rw-r--r--hu-hu/go.html.markdown42
-rw-r--r--id-id/css-id.html.markdown245
-rw-r--r--it-it/java-it.html.markdown4
-rw-r--r--json.html.markdown48
-rw-r--r--lua.html.markdown151
-rw-r--r--ro-ro/bash-ro.html.markdown171
-rw-r--r--ro-ro/ruby-ro.html.markdown479
-rw-r--r--scala.html.markdown5
-rw-r--r--yaml.html.markdown139
-rw-r--r--zh-cn/clojure-macro-cn.html.markdown152
-rw-r--r--zh-cn/common-lisp-cn.html.markdown12
-rw-r--r--zh-cn/visualbasic-cn.html.markdown274
16 files changed, 2436 insertions, 121 deletions
diff --git a/bash.html.markdown b/bash.html.markdown
index 70a3b52a..d5d08e9d 100644
--- a/bash.html.markdown
+++ b/bash.html.markdown
@@ -46,6 +46,10 @@ echo '$VARIABLE'
echo ${VARIABLE/Some/A}
# This will substitute the first occurance of "Some" with "A"
+# Substring from a variable
+echo ${VARIABLE:0:7}
+# This will return only the first 7 characters of the value
+
# Default value for variable
echo ${FOO:-"DefaultValueIfFOOIsMissingOrEmpty"}
# This works for null (FOO=), empty string (FOO=""), zero (FOO=0) returns 0
diff --git a/csharp.html.markdown b/csharp.html.markdown
index 81b50e08..a689fe97 100644
--- a/csharp.html.markdown
+++ b/csharp.html.markdown
@@ -435,7 +435,7 @@ on a new line! ""Wow!"", the masses cried";
Func<int, int> square = (x) => x * x; // Last T item is the return value
Console.WriteLine(square(3)); // 9
- // DISPOSABLE RESSOURCES MANAGEMENT - let you handle unmanaged resources easily.
+ // DISPOSABLE RESOURCES MANAGEMENT - let you handle unmanaged resources easily.
// Most of objects that access unmanaged resources (file handle, device contexts, etc.)
// implement the IDisposable interface. The using statement takes care of
// cleaning those IDisposable objects for you.
@@ -511,11 +511,11 @@ on a new line! ""Wow!"", the masses cried";
var db = new BikeRespository();
// execution is delayed, which is great when querying a database
- var fitler = db.Bikes.Where(b => b.HasTassles); // no query run
+ var filter = db.Bikes.Where(b => b.HasTassles); // no query run
if (42 > 6) // You can keep adding filters, even conditionally - great for "advanced search" functionality
- fitler = fitler.Where(b => b.IsBroken); // no query run
+ filter = filter.Where(b => b.IsBroken); // no query run
- var query = fitler
+ var query = filter
.OrderBy(b => b.Wheels)
.ThenBy(b => b.Name)
.Select(b => b.Name); // still no query run
diff --git a/css.html.markdown b/css.html.markdown
index 26eaae53..76319340 100644
--- a/css.html.markdown
+++ b/css.html.markdown
@@ -2,6 +2,7 @@
language: css
contributors:
- ["Mohammad Valipour", "https://github.com/mvalipour"]
+ - ["Marco Scannadinari", "https://github.com/marcoms"]
filename: learncss.css
---
@@ -129,11 +130,11 @@ selector {
width: 5in; /* in inches */
/* Colors */
- background-color: #F6E /* in short hex */
- background-color: #F262E2 /* in long hex format */
- background-color: tomato /* can be a named color */
- background-color: rgb(255, 255, 255) /* in rgb */
- background-color: rgb(10%, 20%, 50%) /* in rgb percent */
+ background-color: #F6E; /* in short hex */
+ background-color: #F262E2; /* in long hex format */
+ background-color: tomato; /* can be a named color */
+ background-color: rgb(255, 255, 255); /* in rgb */
+ background-color: rgb(10%, 20%, 50%); /* in rgb percent */
background-color: rgba(255, 0, 0, 0.3); /* in semi-transparent rgb */
/* Images */
diff --git a/fr-fr/csharp-fr.html.markdown b/fr-fr/csharp-fr.html.markdown
new file mode 100644
index 00000000..c1641716
--- /dev/null
+++ b/fr-fr/csharp-fr.html.markdown
@@ -0,0 +1,812 @@
+---
+language: c#
+contributors:
+ - ["Irfan Charania", "https://github.com/irfancharania"]
+ - ["Max Yankov", "https://github.com/golergka"]
+ - ["Melvyn Laïly", "http://x2a.yt"]
+ - ["Shaun McCarthy", "http://www.shaunmccarthy.com"]
+translators:
+ - ["Olivier Hoarau", "https://github.com/Olwaro"]
+filename: LearnCSharp.cs
+lang: fr-fr
+---
+
+C# est un langage de programmation orienté objet à typage fort qui permet aux développeurs de créer une grande variété d'applications fiables et robustes s'appuyant sur le framework .NET.
+
+[Plus d'infos](http://msdn.microsoft.com/fr-fr/library/67ef8sbd.aspx)
+
+```c#
+// Les commentaires sur une seule ligne commencent par //
+/*
+Les
+commentaires
+multi-lignes
+ressemblent
+ceci
+*/
+/// <summary>
+/// Ceci est un commentaire de documentation XML
+/// </summary>
+
+// Importez des namespaces avec l'instruction 'using'
+using System;
+using System.Collections.Generic;
+using System.Data.Entity;
+using System.Dynamic;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Net;
+using System.Threading.Tasks;
+
+// Définit la portée du code pour une meilleure organisation
+namespace Learning
+{
+ // Chaque fichier .cs devrait au moins contenir une classe avec le même nom
+ // que celui du fichier. Ce n'est pas une obligation mais c'est mieux !
+ public class LearnCSharp
+ {
+ // LES BASES - si vous avez déjà de l'expérience en Java ou C++
+ // passez directement à la partie FONCTIONNALITÉS INTERÉSSANTES
+ public static void Syntax()
+ {
+ // Utilisez Console.WriteLine pour écrire sur la sortie
+ Console.WriteLine("Hello World");
+ Console.WriteLine(
+ "Entier: " + 10 +
+ " Double: " + 3.14 +
+ " Booleen: " + true);
+
+ // Pour omettre le retour à la ligne : Console.Write
+ Console.Write("Hello ");
+ Console.Write("World");
+
+ ///////////////////////////////////////////////////
+ // Types et Variables
+ // Déclarez une variable avec la syntaxe <type> <nom>
+ ///////////////////////////////////////////////////
+
+ // Sbyte - Entier signé sur 8 bits
+ // (-128 <= sbyte <= 127)
+ sbyte fooSbyte = 100;
+
+ // Byte - Entier non-signé sur 8 bits
+ // (0 <= byte <= 255)
+ byte fooByte = 100;
+
+ // Short - Entier sur 16 bits
+ // Signé - (-32,768 <= short <= 32,767)
+ // Non-signé - (0 <= ushort <= 65,535)
+ short fooShort = 10000;
+ ushort fooUshort = 10000;
+
+ // Int - Entier sur 32 bits
+ int fooInt = 1; // (-2,147,483,648 <= int <= 2,147,483,647)
+ uint fooUint = 1; // (0 <= uint <= 4,294,967,295)
+
+ // Long - Entier sur 64 bits
+ long fooLong = 100000L; // (-9,223,372,036,854,775,808 <= long <= 9,223,372,036,854,775,807)
+ ulong fooUlong = 100000L; // (0 <= ulong <= 18,446,744,073,709,551,615)
+ // Par défaut le type d'un littéral entier est int ou uint
+ // on ajoute 'L' pour spécifier la création d'un long
+
+ // Double - Réel sur 64 bits en virgule flottante (norme IEEE 754)
+ double fooDouble = 123.4; // Precision : 15-16 chiffres
+
+ // Float - Réel sur 32 bits en virgule flottante (norme IEEE 754)
+ float fooFloat = 234.5f; // Precision : 7 chiffres
+ // Par défaut le type d'un littéral réel est double
+ // on ajoute 'f' pour spécifier la création d'un float
+
+ // Decimal - Type de donnée numérique sur 128 bits, fournit une plus
+ // grande précision et une plage de valeurs réduite.
+ // Approprié aux calculs financiers et monétaires
+ decimal fooDecimal = 150.3m;
+
+ // Booléen - vrai / faux
+ bool fooBoolean = true; // ou false
+
+ // Char - Un unique caractère Unicode sur 16 bits
+ char fooChar = 'A';
+
+ // String -- contrairement aux types précédents qui sont des types valeurs,
+ // string est un type référence. Il peut donc avoir la valeur null
+ string fooString = "\"échappement\" de guillemets et ajout de \n (nouvelle ligne) et de \t (tabulation)";
+ Console.WriteLine(fooString);
+
+ // Il est possible d'accéder à chaque caractère d'une chaîne de caractères via son index
+ char charFromString = fooString[1]; // 'é'
+ // une chaîne de caractères est immuable : impossible de faire fooString[1] = 'X';
+
+ // Comparaison de chaînes de caractères avec la culture courrante en ignorant la casse
+ string.Compare(fooString, "x", StringComparison.CurrentCultureIgnoreCase);
+
+ // Formatage
+ string fooFs = string.Format("Check Check, {0} {1}, {0} {1:0.0}", 1, 2);
+
+ // Dates et formatage
+ DateTime fooDate = DateTime.Now;
+ Console.WriteLine(fooDate.ToString("hh:mm, dd MMM yyyy"));
+
+ // Il est possible d'étaler une chaîne de caractères sur plusieurs lignes avec le symbole @.
+ // Pour échapper " utilisez ""
+ string bazString = @"Voici quelques trucs
+sur une nouvelle ligne! ""Wow!"", quel style";
+
+ // Utilisez const ou read-only pour rendre une variable immuable.
+ // Les valeurs constantes sont calculées au moment de la compilation
+ const int HOURS_I_WORK_PER_WEEK = 9001;
+
+ ///////////////////////////////////////////////////
+ // Structures de données
+ ///////////////////////////////////////////////////
+
+ // Tableaux - indexé à partir de zéro
+ // La taille d'un tableau doit être décidée à la déclaration
+ // La syntaxe pour déclarer un tableau est la suivante :
+ // <type>[] <nom> = new <type>[<taille>]
+ int[] intArray = new int[10];
+
+ // Une autre méthode de déclaration et d'initialisation
+ int[] y = { 9000, 1000, 1337 };
+
+ // Indexer un tableau - Accéder à un élément
+ Console.WriteLine("intArray à 0: " + intArray[0]);
+ // Les tableaux sont muables.
+ intArray[1] = 1;
+
+ // Listes
+ // Elles sont plus souvent utilisées que les tableaux car plus souples
+ // La syntaxe pour déclarer une liste est la suivante :
+ // List<type> <nom> = new List<type>();
+ List<int> intList = new List<int>();
+ List<string> stringList = new List<string>();
+ List<int> z = new List<int> { 9000, 1000, 1337 }; // intialisation
+ // Les <> indiquent un type générique
+ // Pus d'info dans la partie FONCTIONNALITÉS INTERÉSSANTES
+
+ // Les éléments d'une liste ne sont pas null par défaut
+ // Il faut ajouter une valeur avant d'y accéder par index
+ intList.Add(1);
+ Console.WriteLine("intList à 0: " + intList[0]);
+
+ // Autres structures de données à étudier :
+ // Stack/Queue (Pile/File)
+ // Dictionary (une implémentation de hash map)
+ // HashSet (représente un ensemble)
+ // Collections en lecture seule
+ // Tuple (.Net 4+)
+
+ ///////////////////////////////////////
+ // Opérateurs
+ ///////////////////////////////////////
+ Console.WriteLine("\n->Opérateurs");
+
+ int i1 = 1, i2 = 2; // Raccourci pour des déclarations multiples
+
+ // Arithmétique classique
+ Console.WriteLine(i1 + i2 - i1 * 3 / 7); // => 3
+
+ // Modulo
+ Console.WriteLine("11%3 = " + (11 % 3)); // => 2
+
+ // Opérateurs de comparaison
+ Console.WriteLine("3 == 2? " + (3 == 2)); // => False
+ Console.WriteLine("3 != 2? " + (3 != 2)); // => True
+ Console.WriteLine("3 > 2? " + (3 > 2)); // => True
+ Console.WriteLine("3 < 2? " + (3 < 2)); // => False
+ Console.WriteLine("2 <= 2? " + (2 <= 2)); // => True
+ Console.WriteLine("2 >= 2? " + (2 >= 2)); // => True
+
+ // Opérateurs bit à bit !
+ /*
+ ~ Compément unaire
+ << Décalage à gauche
+ >> Décalage à droite
+ & ET logique
+ ^ OU exclusif
+ | OU inclusif
+ */
+
+ // Incrémentations
+ int i = 0;
+ Console.WriteLine("\n->Inc/Dec-rementation");
+ Console.WriteLine(i++); //i = 1. Post-Incrémentation
+ Console.WriteLine(++i); //i = 2. Pre-Incrémentation
+ Console.WriteLine(i--); //i = 1. Post-Decrémentation
+ Console.WriteLine(--i); //i = 0. Pre-Decrémentation
+
+ ///////////////////////////////////////
+ // Structures de contrôle
+ ///////////////////////////////////////
+ Console.WriteLine("\n->Structures de contrôle");
+
+ // Structure conditionnelle
+ int j = 10;
+ if (j == 10)
+ {
+ Console.WriteLine("Je serai affiché");
+ }
+ else if (j > 10)
+ {
+ Console.WriteLine("Pas moi");
+ }
+ else
+ {
+ Console.WriteLine("Moi non plus");
+ }
+
+ // Opérateur ternaire
+ // Un simple if/else peut s'écrire :
+ // <condition> ? <valeur si true> : <valeur si false>
+ string isTrue = (true) ? "True" : "False";
+
+ // Boucle while
+ int fooWhile = 0;
+ while (fooWhile < 100)
+ {
+ // 100 passages, de 0 à 99
+ fooWhile++;
+ }
+
+ // Boucle Do While
+ int fooDoWhile = 0;
+ do
+ {
+ // 100 passages, de 0 à 99
+ fooDoWhile++;
+ } while (fooDoWhile < 100);
+
+ // Boucle for
+ // Structure : for(<etat_initial>; <condition>; <pas>)
+ for (int fooFor = 0; fooFor < 10; fooFor++)
+ {
+ // 10 passages, de 0 à 9
+ }
+
+ // La boucle foreach
+ // Structure : foreach(<type_iterateur> <nom_iterateur> in <enumerable>)
+ // Cette boucle est utilisable sur des objets implémentant IEnumerable ou IEnumerable<T>
+ // Toutes les collections du framework .NET (Tableaux, Listes, ...) implémentent ces interfaces.
+ // (Notez que dans l'exemple suivant .ToCharArray() peut être omit car
+ // string implémente IEnumerable)
+ foreach (char character in "Hello World".ToCharArray())
+ {
+ //Itération sur chaque caractère
+ }
+
+ // La structure Switch Case
+ // Un switch fonctionne avec les types : byte, short, char et int.
+ // Les enums sont aussi supportés ainsi que les chaînes de caractères et quelques
+ // classes spéciales basées sur les types primitifs : Character, Byte, Short et Integer.
+ int mois = 3;
+ string moisString;
+ switch (mois)
+ {
+ case 1:
+ moisString = "Janvier";
+ break;
+ case 2:
+ moisString = "Février";
+ break;
+ case 3:
+ moisString = "Mars";
+ break;
+
+ // Vous pouvez assigner plus d'un 'case' à une action
+ // Mais vous ne pouvez pas ajouter une action sans 'break' avant un 'case'
+ // (pour ce faire, il faudrait ajouter explicitement un 'goto case x')
+ case 6:
+ case 7:
+ case 8:
+ moisString = "C'est l'été!";
+ break;
+ default:
+ moisString = "Un autre mois oO";
+ break;
+ }
+
+ ///////////////////////////////////////
+ // conversion de type de donnée et transtypage
+ ///////////////////////////////////////
+
+ // conversion de string vers int
+ // lève une exception en cas d'erreur
+ int.Parse("123"); //retourne la valeur entière de "123"
+
+ // TryParse affecte la valeur par défaut du type en cas d'erreur
+ // dans ce cas : 0
+ int tryInt;
+ if (int.TryParse("123", out tryInt)) // La fonction retourne un booléen
+ Console.WriteLine(tryInt); // => 123
+
+ // conversion d'un entier vers une chaîne de caractères
+ // La classe Convert possède plusieurs méthodes pour faciliter la conversion
+ Convert.ToString(123);
+ // ou
+ tryInt.ToString();
+ }
+
+ ///////////////////////////////////////
+ // CLASSES - voir les définitions à la fin du fichier
+ ///////////////////////////////////////
+
+ public static void Classes()
+ {
+ // voir les déclarations à la fin du fichier
+
+ // Utilisez 'new' pour instancier une classe
+ Bicycle trek = new Bicycle();
+
+ // Appel des méthodes de l'objet
+ trek.SpeedUp(3); // Il est toujours bon d'utiliser des accesseurs
+ trek.Cadence = 100;
+
+ // Affichage de la valeur de retour d'une méthode.
+ Console.WriteLine("trek info: " + trek.Info());
+
+ // Instanciation d'un nouveau PennyFarthing
+ PennyFarthing funbike = new PennyFarthing(1, 10);
+ Console.WriteLine("funbike info: " + funbike.Info());
+
+ Console.Read();
+ }
+
+ // POINT D'ENTRÉE - Une application console doit avoir une méthode main comme point d'entrée
+ public static void Main(string[] args)
+ {
+ OtherInterestingFeatures();
+ }
+
+ //
+ // FONCTIONNALITÉS INTÉRÉSSANTES
+ //
+
+ // SIGNATURE DE METHODE
+ public // Visibilité
+ static // Permet un appel direct par la classe (sans instanciation)
+ int // Type de retour,
+ MethodSignatures(
+ int maxCount, // Premier paramètre, de type int
+ int count = 0, // Valeur par défaut si aucun argument n'est passé
+ int another = 3,
+ params string[] otherParams // Capture tous les arguments passés à la méthode
+ )
+ {
+ return -1;
+ }
+
+ // Des méthodes peuvent avoir le même nom tant que leur signature est unique
+ public static void MethodSignature(string maxCount)
+ {
+ }
+
+ // TYPE GÉNÉRIQUE
+
+ // Les types TKey et TValue sont spécifiés par l'utilisateur lors de l'appel de la fonction
+ // Cette méthode émule SetDefaut de Python
+ public static TValue SetDefault<TKey, TValue>(
+ IDictionary<TKey, TValue> dictionary,
+ TKey key,
+ TValue defaultItem)
+ {
+ TValue result;
+ if (!dictionary.TryGetValue(key, out result))
+ return dictionary[key] = defaultItem;
+ return result;
+ }
+
+ // Vous pouvez limiter les types autorisés
+ public static void IterateAndPrint<T>(T toPrint) where T: IEnumerable<int>
+ {
+ // Nous sommes sûrs de pouvoir itérer, car T implémente IEnumerable<int>
+ foreach (var item in toPrint)
+ // Item sera de type int
+ Console.WriteLine(item.ToString());
+ }
+
+ public static void OtherInterestingFeatures()
+ {
+ // PARAMÈTERES OPTIONNELS
+ MethodSignatures(3, 1, 3, "Des", "Paramètres", "En plus");
+ MethodSignatures(3, another: 3); // affectation explicite, les autres
+ // paramètres ont la valeur par défaut
+
+ // MÉTHODE D'EXTENSION
+ int i = 3;
+ i.Print(); // Définit plus bas
+
+ // TYPES NULLABLE - idéal pour les interactions avec une base de données ou pour les valeurs de retour
+ // Tous les types valeurs peuvent être rendus nullable en les suffixant par '?'
+ // <type>? <nom> = <value>
+ int? nullable = null; // raccourci pour Nullable<int>
+ Console.WriteLine("Nullable variable: " + nullable);
+ bool hasValue = nullable.HasValue; // retourne vrai si la valeur n'est pas null
+
+ // ?? est un sucre syntaxique pour spécifier une valeur par défaut
+ // au cas ou une autre valeur serait nulle
+ int notNullable = nullable ?? 0; // 0
+
+ // VARIABLES IMPLICITEMENT TYPÉES - vous pouvez laisser le compilateur deviner le type d'une variable
+ var magic = "magic est de type string à la compilation. On a toujours un typage fort !";
+ // magic = 9; // ne fonctionnera pas car magic est désormais une chaîne de caractères
+
+ // TYPES GÉNÉRIQUES
+ var agenda = new Dictionary<string, string>() {
+ {"Sarah", "212 555 5555"} // Ajout d'une entrée à notre agenda
+ };
+
+ // Appel de la fonction SetDefault (définie plus haut)
+ Console.WriteLine(SetDefault<string,string>(agenda, "Shaun", "Pas de numéro")); // => Pas de numéro
+ // Notez que vous n'avez pas à spécifier TKey et TValue car le compilateur saura les inférer.
+ Console.WriteLine(SetDefault(agenda, "Sarah", "No Phone")); // => 212 555 5555
+
+ // EXPRESSION LAMBDA - permet d'écrire une fonction en tant qu'expression
+ Func<int, int> square = (x) => x * x; // La dernière expression est la valeur de retour
+ Console.WriteLine(square(3)); // => 9
+
+ // GESTION AUTOMATIQUE DES RESSOURCES - vous permet de manipuler facilement des resources non-managées
+ // La plus part des objets qui accèdent à des ressources non-managées (handle de fichier, périphérique, etc.)
+ // implémentent l'interface IDisposable. L'instruction using prend soin
+ // de libérer les objets IDisposable proprement à votre place.
+ using (StreamWriter writer = new StreamWriter("log.txt"))
+ {
+ writer.WriteLine("Rien à signaler");
+ // À la fin de cette portée les ressources seront libérées.
+ // Même si une exception est levée.
+ }
+
+ // BIBLIOTHÈQUE DE TÂCHES PARALLÈLES (TPL)
+ // http://msdn.microsoft.com/fr-fr/library/dd460717.aspx
+ var websites = new string[] {
+ "http://www.google.com", "http://www.reddit.com",
+ "http://www.shaunmccarthy.com"
+ };
+ var responses = new Dictionary<string, string>();
+
+ // L'exemple suivant exécutera chaque requête dans un thread séparé,
+ // et attendra la fin de chacun d'entre eux avant de continuer
+ Parallel.ForEach(websites,
+ new ParallelOptions() {MaxDegreeOfParallelism = 3}, // maximum de 3 threads
+ website =>
+ {
+ // Fait quelque chose de long
+ using (var r = WebRequest.Create(new Uri(website)).GetResponse())
+ {
+ responses[website] = r.ContentType;
+ }
+ });
+
+ // Ceci ne s'exécutera pas tant que les threads n'auront pas fini leur travail
+ foreach (var key in responses.Keys)
+ Console.WriteLine("{0}:{1}", key, responses[key]);
+
+ // TYPE DYNAMIQUE - idéal pour travailler avec d'autres langages
+ dynamic student = new ExpandoObject();
+ student.FirstName = "Mon prénom"; // Pas besoin de définir l'objet
+
+ // Vous pouvez même ajouter des méthodes (dans cet exemple : la méthode prend une chaîne de caractères et retourne une chaîne de caractères)
+ student.Introduce = new Func<string, string>(
+ (introduceTo) => string.Format("Hey {0}, c'est {1}", student.FirstName, introduceTo));
+ Console.WriteLine(student.Introduce("Beth"));
+
+ // IQUERYABLE<T> - quasiment toutes les collections implémentent cette interface
+ // ce qui permet d'utiliser des méthodes de style 'Filter' / 'Map' / 'Reduce'
+ var bikes = new List<Bicycle>();
+ bikes.Sort(); // Trie le tableau sur place
+ bikes.Sort((b1, b2) => b1.Wheels.CompareTo(b2.Wheels)); // Trie en se basant sur la propriété Wheels
+ var result = bikes
+ .Where(b => b.Wheels > 3) // 'Filter' - enchaînable (retourne un IQueryable du type précédent)
+ .Where(b => b.IsBroken && b.HasTassles)
+ .Select(b => b.ToString()); // 'Map' - on retourne le .ToString() de chaque élément filtré,
+ // le résultat est un IQueryable<string>
+
+ var sum = bikes.Sum(b => b.Wheels); // 'Reduce' - fait la somme de tous les Wheels de la liste
+
+ // Creation d'une liste d'objet anonymes basés sur des paramètres de la classe Bike
+ var bikeSummaries = bikes.Select(b=>new { Name = b.Name, IsAwesome = !b.IsBroken && b.HasTassles });
+ // Le compilateur peut inférer le type de ces objets anonymes, permettant à certains IDE d'effectuer
+ // des autos-complétion.
+ foreach (var bikeSummary in bikeSummaries.Where(b => b.IsAwesome))
+ Console.WriteLine(bikeSummary.Name);
+
+
+ // ASPARALLEL
+ // C'est ici que les choses se compliquent - un mélange de LINQ et de TPL
+ var threeWheelers = bikes.AsParallel().Where(b => b.Wheels == 3).Select(b => b.Name);
+ // La ligne précédente s'exécute en parallèle ! Des threads seront gérés automatiquement
+ // et les données y seront réparties. Idéal sur de grosses données (et si votre
+ // machine dispose de plusieurs coeurs)
+
+
+ // LINQ - lie une source de données à des objets IQueryable<T>
+ // ex : LindToSql => liaison avec une base de données, LinqToXml => liaison avec un document xml
+ var db = new BikeRespository();
+
+ // l'exécution est décalée, ce qui est préférable quand on travaille sur une base données
+ var filter = db.Bikes.Where(b => b.HasTassles); // pas de requête exécutée
+ if (42 > 6) // Vous pouvez continuer à affiner la recherche
+ filter = filter.Where(b => b.IsBroken); // pas de requête exécutée
+
+ var query = filter
+ .OrderBy(b => b.Wheels)
+ .ThenBy(b => b.Name)
+ .Select(b => b.Name); // toujours pas de requête exécutée
+
+ // Maintenant la requête est exécutée, mais retourne des données uniquement au fil de l'itération
+ foreach (string bike in query)
+ Console.WriteLine(result);
+
+ }
+
+ } // Fin de la classe LearnCSharp
+
+ // Il est possible d'inclure plusieurs classes dans un fichier .cs
+
+ public static class Extensions
+ {
+ // EXTENSION DE FONCTIONS
+ public static void Print(this object obj)
+ {
+ Console.WriteLine(obj.ToString());
+ }
+ }
+
+ // Syntaxe de déclaration de classe :
+ // <public/private/protected/internal> class <class name>{
+ // // champs, constructeurs, fonctions
+ // // tout est déclaré et implémenté à l'intérieur
+ // }
+
+ public class Bicycle
+ {
+ // Propriétés et variable de la classe
+ public int Cadence // Public : peut être accédé de partout
+ {
+ get // get - définit une méthode pour lire la propriété
+ {
+ return _cadence;
+ }
+ set // set - définit une méthode pour affecter une valeur à la propriété
+ {
+ _cadence = value; // 'value' est la valeur passée en argument au setteur
+ }
+ }
+ private int _cadence;
+
+ protected virtual int Gear // Protected : accessible depuis la classe et ses classes filles
+ {
+ get; // crée une propriété automatique, pas besoin de créer une variable de stockage
+ set;
+ }
+
+ internal int Wheels // Internal : accessible depuis l'assembly
+ {
+ get;
+ private set; // Il est possible de choisir la portée d'un accesseur
+ }
+
+ int _speed; // Par défaut tout est privé au sein d'une classe : accessible uniquement depuis la classe
+ // on peut ajouter explicitement le mot clé 'private'
+
+ public string Name { get; set; }
+
+
+ // Enum est un type valeur formé par un ensemble de constantes nommées
+ // C'est simplement une manière de mettre un nom sur une valeur (int par défaut).
+ // Les types compatibles pour un enum sont : byte, sbyte, short, ushort, int, uint, long et ulong.
+ // Un enum ne peut pas contenir deux fois la même valeur
+ public enum BikeBrand
+ {
+ AIST,
+ BMC,
+ Electra = 42, // il est possible de donner explicitement une valeur
+ Gitane // 43
+ }
+ // Nous avons défini cet enum à l'intérieur de la classe Bicycle, c'est donc un type imbriqué
+ // Pour le référencer à l'extérieur, il faudra utiliser Bicycle.BikeBrand
+
+ public BikeBrand Brand; // Après avoir déclaré notre type enum, on peut créer un champ de ce type
+
+ // Les membres statiques appartiennent à une classe plutôt qu'à une instance particulière
+ // Il est possible d'y accéder sans passer par un objet :
+ // ex : Console.WriteLine("Bicycles créés : " + Bicycle.bicyclesCreated);
+ static public int BicyclesCreated = 0;
+
+ // Les valeurs en lecture seule sont affectées lors de l'exécution
+ // Elles ne peuvent être assignées que lors de leur déclaration ou dans un constructeur
+ readonly bool _hasCardsInSpokes = false; // variable en lecture et privée
+
+ // Les constructeurs sont un moyen de créer des objets
+ // Voici un constructeur par défaut (pas d'arguments)
+ public Bicycle()
+ {
+ this.Gear = 1; // accès aux membres de la classe via le mot clé this
+ Cadence = 50; // qui est souvent implicite
+ _speed = 5;
+ Name = "Bontrager";
+ Brand = BikeBrand.AIST;
+ BicyclesCreated++;
+ }
+
+ // Voici un constructeur spécifique (qui prend des arguments)
+ public Bicycle(int startCadence, int startSpeed, int startGear,
+ string name, bool hasCardsInSpokes, BikeBrand brand)
+ : base() // possibilité d'appeler le constructeur de la classe mère (ici Object)
+ {
+ Gear = startGear;
+ Cadence = startCadence;
+ _speed = startSpeed;
+ Name = name;
+ _hasCardsInSpokes = hasCardsInSpokes;
+ Brand = brand;
+ }
+
+ // Les constructeurs peuvent s'enchaîner
+ public Bicycle(int startCadence, int startSpeed, BikeBrand brand) :
+ this(startCadence, startSpeed, 0, "big wheels", true, brand)
+ {
+ }
+
+ // Syntaxe de méthode :
+ // <public/private/protected> <type de retour> <nom de methode>(<args>)
+
+ // Les classes peuvent implémenter des accesseurs pour leurs champs
+ // ou implémenter des propriétés (c'est la méthode dominante en C#)
+
+ // Les paramètres de méthodes peuvent avoir des valeurs par défaut
+ // Dans ce cas, la méthode peut être appelée sans arguments
+ public void SpeedUp(int increment = 1)
+ {
+ _speed += increment;
+ }
+
+ public void SlowDown(int decrement = 1)
+ {
+ _speed -= decrement;
+ }
+
+ // Les propriétés se chargent de lire/modifier des valeurs
+ // elles peuvent être en lecture(get), en écriture(set) ou les deux
+ private bool _hasTassles; // variable privée
+ public bool HasTassles // propriété publique
+ {
+ get { return _hasTassles; }
+ set { _hasTassles = value; }
+ }
+
+ // Il est possible de définir une propriété automatique sur une ligne
+ // cette syntaxe créera une variable de stockage automatiquement.
+ // Il est possible de modifier l'accèsibilité des getter/setter pour limiter leur utilisation
+ public bool IsBroken { get; private set; }
+
+ // La même chose sur plusieurs lignes
+ public int FrameSize
+ {
+ get;
+ // Notez que seule la classe Bicycle peut changer la valeur de FrameSize
+ private set;
+ }
+
+ // Méthode qui affiche la valeur des champs de cet objet
+ public virtual string Info()
+ {
+ return "Gear: " + Gear +
+ " Cadence: " + Cadence +
+ " Speed: " + _speed +
+ " Name: " + Name +
+ " Cards in Spokes: " + (_hasCardsInSpokes ? "yes" : "no") +
+ "\n------------------------------\n"
+ ;
+ }
+
+ // Les méthodes peuvent aussi être statiques. Utile pour les méthodes d'aide.
+ public static bool DidWeCreateEnoughBycles()
+ {
+ // À l'intérieur d'une méthode statique on ne peut que référencer des membres statiques !
+ return BicyclesCreated > 9000;
+ } // Si votre classe n'a que des membres statiques, marquez la comme statique
+
+ } // fin de la classe Bicycle
+
+ // PennyFarthing est une classe dérivée de Bicycle
+ class PennyFarthing : Bicycle
+ {
+ // Appel au constructeur de la classe mère
+ public PennyFarthing(int startCadence, int startSpeed) :
+ base(startCadence, startSpeed, 0, "PennyFarthing", true, BikeBrand.Electra)
+ {
+ }
+
+ protected override int Gear
+ {
+ get
+ {
+ return 0;
+ }
+ set
+ {
+ // Lève une exception
+ throw new ArgumentException("Impossible de modifier Gear sur un PennyFarthing");
+ }
+ }
+
+ public override string Info()
+ {
+ string result = "PennyFarthing bicycle ";
+ result += base.ToString(); // Appel à la version de base de cette méthode
+ return result;
+ }
+ }
+
+ // Les interfaces contiennent uniquement la signature de leurs membres, sans implémentation.
+ interface IJumpable
+ {
+ void Jump(int meters); // Tous les membres d'interface sont publics par défaut
+ }
+
+ interface IBreakable
+ {
+ bool Broken { get; } // Les interfaces peuvent contenir des propriétés,
+ // des méthodes et des évènements
+ }
+
+ // Une classe ne peut hériter que d'une seule autre classe, mais peut implémenter plusieurs interfaces
+ class MountainBike : Bicycle, IJumpable, IBreakable
+ {
+ int damage = 0;
+
+ public void Jump(int meters)
+ {
+ damage += meters;
+ }
+
+ public bool Broken
+ {
+ get
+ {
+ return damage > 100;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Utilisé pour illustrer la connexion à une base donnée dans l'exemple LinqToSql
+ /// L'approche code first d'EntityFramework est très pratique (un peu comme ActiveRecord de Ruby)
+ /// http://msdn.microsoft.com/fr-fr/data/jj193542.aspx
+ /// </summary>
+ public class BikeRespository : DbSet
+ {
+ public BikeRespository()
+ : base()
+ {
+ }
+
+ public DbSet<Bicycle> Bikes { get; set; }
+ }
+} // Fin du namespace
+```
+
+## Sujets non-abordés
+
+ * Flags
+ * Attribus
+ * Propriétés statiques
+ * Exceptions, Abstraction
+ * ASP.NET (Web Forms/MVC/WebMatrix)
+ * Winforms
+ * Windows Presentation Foundation (WPF)
+
+## Lectures Complémentaires
+
+ * [DotNetPerls](http://www.dotnetperls.com)
+ * [C# in Depth](http://manning.com/skeet2)
+ * [Programming C#](http://shop.oreilly.com/product/0636920024064.do)
+ * [LINQ](http://shop.oreilly.com/product/9780596519254.do)
+ * [MSDN Library](http://msdn.microsoft.com/en-us/library/618ayhy6.aspx)
+ * [ASP.NET MVC Tutorials](http://www.asp.net/mvc/tutorials)
+ * [ASP.NET Web Matrix Tutorials](http://www.asp.net/web-pages/tutorials)
+ * [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)
+
+[Convention de codage C#](http://msdn.microsoft.com/library/vstudio/ff926074)
diff --git a/hu-hu/go.html.markdown b/hu-hu/go.html.markdown
index 621ebdbf..638c9489 100644
--- a/hu-hu/go.html.markdown
+++ b/hu-hu/go.html.markdown
@@ -6,6 +6,7 @@ contributors:
- ["Sonia Keys", "https://github.com/soniakeys"]
translators:
- ["Szabó Krisztián", "https://github.com/thenonameguy/"]
+ - ["Árpád Goretity", "https://github.com/H2CO3"]
---
A Go programozási nyelv az életszerű feladatok könnyebb elvégzése miatt született.
@@ -38,14 +39,14 @@ import (
"strconv" // Stringek átalakítására szolgáló csomag
)
-// Funkció deklarálás, a main nevű funkció a program kezdőpontja.
+// Függvénydeklarálás, a main nevű függvény a program kezdőpontja.
func main() {
// Println kiírja a beadott paramétereket a standard kimenetre.
- // Ha más csomagot funkcióját akarjuk használni, akkor azt jelezni kell a
+ // Ha más csomagot függvényeit akarjuk használni, akkor azt jelezni kell a
// csomag nevével
fmt.Println("Hello world!")
- // Meghívunk egy másik funkciót ebből a csomagból
+ // Meghívunk egy másik függvényt ebből a csomagból
beyondHello()
}
@@ -92,7 +93,7 @@ func learnTypes() {
// lebegőpontos szám
c := 3 + 4i // complex128, belsőleg két float64-gyel tárolva
- // Var szintaxis változó típus definiálással
+ // Var szintaxis változótípus-definiálással
var u uint = 7 // unsigned, az implementáció dönti el mekkora, akárcsak az
// int-nél
var pi float32 = 22. / 7
@@ -105,8 +106,8 @@ func learnTypes() {
a3 := [...]int{3, 1, 5} // egy tömb 3 int-tel, láthatóan inicalizálva egyedi
// értékekre
- // Szeleteknek dinamikus a méretük. A szeleteknek és a tömböknek is meg
- // vannak az előnyeik de a szeleteket sokkal gyakrabban használjuk.
+ // A "szeleteknek" (slices) dinamikus a méretük. A szeleteknek és a tömböknek is
+ // megvannak az előnyeik de a szeleteket sokkal gyakrabban használjuk.
s3 := []int{4, 5, 9} // vesd össze a3-mal, nincsenek pontok.
s4 := make([]int, 4) // allokál 4 int-et, mind 0-ra inicializálva
var d2 [][]float64 // ez csak deklaráció, semmi sincs még allokálva
@@ -129,8 +130,8 @@ func learnTypes() {
learnFlowControl()
}
-// A Go nyelv teljesen szemétgyűjtött (garbage-collected). Megtalálhatók benne
-// mutatók, de nincs mutató aritmetika. Ez azt jelenti, hogy üres mutatóval még
+// A Go nyelvben szemétgyűjtés (garbage collection) működik. Megtalálhatók benne
+// mutatók, de nincs pointeraritmetika. Ez azt jelenti, hogy üres (null) mutatóval még
// mindig hibázhatsz, de hozzáadni/műveleteket végezni már nem lehet.
func learnMemory() (p, q *int) {
// Elnevezett visszatérési változóknak int-re mutató a típusa
@@ -213,7 +214,7 @@ type pair struct {
}
// Definiáljunk egy metódust a pair struktúrának, ezzel teljesítve a Stringer interfészt.
-func (p pair) String() string { // p lesz a "vevő"
+func (p pair) String() string { // p lesz a "fogadó" (receiver)
// Sprintf az fmt csomag egy publikus függvénye, műkődése megegyezik a C-s
// megfelelőjével. A pontokkal érjük el a mindenkori p struktúra elemeit
return fmt.Sprintf("(%d, %d)", p.x, p.y)
@@ -230,7 +231,7 @@ func learnInterfaces() {
// Meghívjuk i String metódusát, az eredmény ugyanaz, mint az előbb.
fmt.Println(i.String())
- // Az fmt csomag funckciói automatikusan meghívják a String funkciót
+ // Az fmt csomag függvényei automatikusan meghívják a String függvényt
// hogy megtudják egy objektum szöveges reprezentációját.
fmt.Println(p) // ugyan az az eredmény mint az előbb, a Println meghívja
// a String metódust.
@@ -267,8 +268,8 @@ func inc(i int, c chan int) {
// Az inc-et fogjuk arra használni, hogy konkurensen megnöveljünk számokat
func learnConcurrency() {
- // Ugyan az a make funkció amivel korábban szeleteket hoztunk létre.
- // Make allokál mapokat, szeleteket és csatornákat.
+ // Ugyanaz a make függvény, amivel korábban szeleteket hoztunk létre.
+ // A make allokál map-eket, szeleteket és csatornákat.
c := make(chan int)
// Indítsunk három konkurens goroutine-t. A számok konkurensen lesznek
// megnövelve, ha a számítógép képes rá és jól be van állítva, akkor pedig
@@ -299,14 +300,14 @@ func learnConcurrency() {
case <-cc: // üres csatorna, soha nem fog rajta semmi se érkezni
fmt.Println("sose futok le :'( ")
}
- // Ezen a ponton vagy c vagy a cs goroutineja lefutott.
+ // Ezen a ponton vagy c vagy a cs goroutine-ja lefutott.
// Amelyik hamarabb végzett, annak a megfelelő case-e lefutott, a másik
// blokkolva vár.
- learnWebProgramming() // Go képes rá. Te is képes akarsz rá lenni.
+ learnWebProgramming() // a Go képes rá. Te is képes akarsz rá lenni.
}
-// Egy funkció a http csomagból elindít egy webszervert.
+// Egy függvény a http csomagból elindít egy webszervert.
func learnWebProgramming() {
// A ListenAndServe első paramétre egy TCP port, amin kiszolgálunk majd.
// Második paramétere egy interfész, pontosabban a http.Handler interfész.
@@ -315,7 +316,7 @@ func learnWebProgramming() {
}
// Csináljunk a pair-ból egy http.Handler-t úgy, hogy implementáljuk az
-// egyetlen metódusát a ServeHTTP-t.
+// egyetlen metódusát, a ServeHTTP-t.
func (p pair) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// Minden kapcsolatra elküldjük ezt a http.ResponseWriter-rel
w.Write([]byte("Megtanultad a Go-t Y perc alatt!"))
@@ -325,11 +326,12 @@ func (p pair) ServeHTTP(w http.ResponseWriter, r *http.Request) {
## További olvasmányok
Minden Go-val kapcsolatos megtaláható a [hivatalos Go weboldalon](http://golang.org/).
-Ott követhetsz egy tutorialt, játszhatsz a nyelvvel az interneten és sok érdekességet olvashatsz.
+Ott követhetsz egy tutorialt, játszhatsz a nyelvvel az interneten, és sok érdekességet olvashatsz.
A nyelv specifikációját kifejezetten érdemes olvasni, viszonylag rövid és sokat tanul belőle az ember.
-Ha pedig jobban bele akarod vetni magad a Go-ba, akkor a standard könyvtárban a legjobb praktikákat kilesheted.
-TIPP: a dokumentációban kattints egy funkció nevére és rögtön megmutatja a hozzá tartozó kódot!
+Ha pedig jobban bele akarod vetni magad a Go-ba, akkor a legjobb praktikákat kilesheted a standard könyvtárból.
+TIPP: a dokumentációban kattints egy függvény nevére és rögtön megmutatja a hozzá tartozó kódot!
-Ha pedig a nyelvnek egy bizonyos részéről szeretnél hasonló leírást találni, akkor a [gobyexample.com](https://gobyexample.com/)-on megtalálod, amit keresel.
+Ha pedig a nyelvnek egy bizonyos részéről szeretnél hasonló leírást találni, akkor a
+[gobyexample.com](https://gobyexample.com/)-on megtalálod, amit keresel.
diff --git a/id-id/css-id.html.markdown b/id-id/css-id.html.markdown
new file mode 100644
index 00000000..d0798ec7
--- /dev/null
+++ b/id-id/css-id.html.markdown
@@ -0,0 +1,245 @@
+language: css
+contributors:
+ - ["Mohammad Valipour", "https://github.com/mvalipour"]
+translators:
+ - ["Eka Y Saputra", "http://github.com/ekajogja"]
+lang: id-id
+filename: learncss-id.css
+---
+
+Pada mulanya, web tidak memiliki elemen visual, murni teks saja.
+Tapi seiring perkembangan peramban, laman web dengan elemen visual menjadi umum.
+CSS adalah bahasa standar yang ada untuk menjaga keterpisahan antara
+konten (HTML) serta tampilan-dan-kesan laman web.
+
+Singkatnya, fungsi CSS ialah menyajikan sintaks yang memampukan kita
+untuk memilih elemen tertentu dalam sebuah laman HTML
+dan menerapkan berbagai properti visual bagi elemen tersebut.
+
+Seperti bahasa lainnya, CSS memiliki banyak versi.
+Di artikel ini, kita fokus pada CSS2.0 - yang meskipun bukan versi termutakhir
+namun paling kompatibel dan didukung secara luas.
+
+**CATATAN:** Lantaran keluaran dari CSS berwujud efek-efek visual,
+maka untuk mempelajarinya, kita perlu mencoba berbagai hal dalam dunia olah CSS
+semisal [dabblet](http://dabblet.com/).
+Fokus utama artikel ini ialah pada sintaks dan sejumlah tips umum.
+
+
+```css
+/* komentar terletak diantara sepasang tanda garis miring dan bintang,
+persis seperti larik ini! */
+
+/* ####################
+ ## SELEKTOR
+ ####################*/
+
+/* Secara garis besar, statemen utama dalam CSS sangat sederhana */
+selektor { properti: nilai; /* properti lainnya */ }
+
+/* selektor berfungsi untuk memilih suatu elemen dalam sebuah laman.
+
+Kita juga bisa memilih semua elemen di sebuah halaman! */
+* { color:red; }
+
+/*
+Dengan menentukan sebuah elemen seperti ini pada sebuah laman:
+
+<div class='suatu-class class2' id='suatuId' attr='nilai' />
+*/
+
+/* kita bisa memilih elemen berdasarkan nama class-nya */
+.suatu-class { }
+
+/*atau dengan dua class sekaligus! */
+.suatu-class.class2 { }
+
+/* atau dengan nama tag-nya */
+div { }
+
+/* atau id-nya */
+#suatuId { }
+
+/* atau - jika ada - dengan attribute-nya! */
+[attr] { font-size:smaller; }
+
+/* atau jika attribute tersebut memiliki nilai spesifik */
+[attr='nilai'] { font-size:smaller; }
+
+/* dibuka dengan sebuah nilai*/
+[attr^='nil'] { font-size:smaller; }
+
+/* atau ditutup dengan nilai */
+[attr$='ai'] { font-size:smaller; }
+
+/* atau bahkan disisipi nilai */
+[attr~='la'] { font-size:smaller; }
+
+
+/* dan yang lebih penting lagi, kita bisa mengombinasikannya sekaligus
+dengan syarat tidak ada spasi diantara selektor-selektor. sebab adanya spasi
+akan membuat selektor itu memiliki makna yang berbeda.*/
+div.suatu-class[attr$='ai'] { }
+
+/* kita juga bisa memilih sebuah elemen berdasarkan posisi elemen induknya.*/
+
+/*sebuah elemen yang merupakan anak langsung dari elemen induk (diseleksi dng
+cara yang sama) */
+div.suatu-induk > .-suatu-class {}
+
+/* atau salah satu induk elemennya dalam hirarki elemen */
+/* berikut ini dimaksudkan pada elemen manapun dengan class "class-entah" dan
+merupakan anak elemen dari suatu div dengan class "induk-entah" PADA LEVEL
+HIRARKI MANAPUN */
+div.suatu-induk .suatu-class {}
+
+/* peringatan: selektor yang sama jika tanpa ada spasi akan bermakna lain.
+misalnya? */
+div.suatu-induk.suatu-class {}
+
+/* kita juga bisa memilih sebuah elemen berdasarkan saudara elemen yang muncul
+tepat sebelumnya */
+.aku-muncul-tepat-sebelum + .elemen-ini { }
+
+/*atau saudara elemen manapun yang pernah muncul selang beberapa elemen
+sebelumnya */
+.aku-pernah-muncul-sebelum ~ .elemen-ini {}
+
+/* Ada beberapa pseudo-class yang memampukan kita memilih suatu elemen
+berdasarkan perilaku lamannya (bukan struktur lamannya) */
+
+/* semisal ketika sebuah elemen ditimpa hover (pointer mouse) */
+:hover {}
+
+/* atau link yang sudah pernah diklik*/
+:visited {}
+
+/* atau link yang belum pernah diklik*/
+:link {}
+
+/* atau elemen input yang menjadi fokus */
+:focus {}
+
+
+/* ####################
+ ## PROPERTI
+ ####################*/
+
+selektor {
+
+ /* Unit */
+ width: 50%; /* dalam persen */
+ font-size: 2em; /* angka kali jumlah font-size saat ini */
+ width: 200px; /* dalam pixel */
+ font-size: 20pt; /* dalam point */
+ width: 5cm; /* dalam centimeter */
+ width: 50mm; /* dalam milimeter */
+ width: 5in; /* dalam inci */
+
+ /* Warna */
+ background-color: #F6E; /* dalam short hex */
+ background-color: #F262E2; /* dalam format long hex */
+ background-color: tomato; /* warna yang sudah punya konvensi nama */
+ background-color: rgb(255, 255, 255); /* dalam rgb */
+ background-color: rgb(10%, 20%, 50%); /* dalam persen rgb */
+ background-color: rgba(255, 0, 0, 0.3); /* dalam rgb semi-transparan*/
+
+ /* Gambar */
+ background-image: url(/folder-gambar/image.jpg);
+
+ /* Font */
+ font-family: Arial;
+ font-family: "Courier New"; /* jika nama font memiliki spasi,
+ ia diketik dalam tanda petik ganda */
+ font-family: "Courier New", Trebuchet, Arial; /* jika font pertama tidak
+ ditemukan, peramban menggunakan font berikutnya,
+ demikian secara berturut-turut */
+}
+
+```
+
+## Penggunaan
+
+Simpan semua CSS yang hendak kita pakai dengan ekstensi `.css`.
+
+```xml
+<!-- kita harus menautkan file css itu ke laman di bagian <head>: -->
+<link rel='stylesheet' type='text/css' href='folder/namafile.css' />
+
+<!-- kita juga bisa mengetik CSS secara inline di dalam markup.
+Namun, sebisa mungkin metode ini dihindari. -->
+<style>
+ selektor { properti:nilai; }
+</style>
+
+<!-- atau langsung mengetik properti CSS pada sebuah elemen.
+Metode ini harus dihindari sebisa mungkin. -->
+<div style='properti:nilai;'>
+</div>
+
+```
+
+## Prioritas
+
+Kita tahu bahwa sebuah elemen bisa dipilih dengan lebih dari satu selektor,
+serta bisa diberi lebih dari satu properti.
+Dalam kasus seperti ini, hanya salah satu properti saja yang akan diterapkan
+pada elemen dengan prioritas tertentu.
+
+Dengan susunan CSS:
+
+```css
+
+/*A*/
+p.class1[attr='nilai']
+
+/*B*/
+p.class1 {}
+
+/*C*/
+p.class2 {}
+
+/*D*/
+p {}
+
+/*E*/
+p { properti: nilai !important; }
+
+```
+
+dan susunan markup:
+
+```xml
+<p style='/*F*/ properti:nilai;' class='class1 class2' attr='nilai'>
+</p>
+```
+
+Maka prioritas penerapan style-nya ialah sbb.:
+Ingat, penerapan ini untuk masing-masing **properti**,
+bukan keseluruhan larik.
+
+* `E` prioritas pertama sebab ada kata `!important`.
+ Dianjurkan untuk menghindari kata ini jika tidak benar-benar perlu.
+* `F` prioritas kedua sebab ia diketik secara inline.
+* `A` prioritas ketiga sebab selektor ini lebih spesifik dibanding yang lain.
+ lebih spesifik = lebih banyak unsur selektor. contoh ini punya 3 unsur:
+ 1 tagname `p` + 1 nama class `class1` + 1 attribute `attr='nilai'`
+* `C` prioritas berikutnya sebab meski sama spesifik dengan `B` namun
+ ia muncul lebih akhir.
+* Lalu `B`
+* dan terakhir baru `D`.
+
+## Kompatibilitas
+
+Sebagian besar fitur dalam CSS2 (dan lambat laun juga CSS3) kompatibel dengan
+semua peramban dan perangkat. Namun selalu vital untuk memastikan kompatibilitas
+unsur dan nilai yang kita ketikkan dalam CSS dengan peramban yang ditargetkan.
+
+[QuirksMode CSS](http://www.quirksmode.org/css/) ialah salah satu sumber terbaik untuk memeriksa kompatibilitas CSS dan peramban.
+
+## Referensi Lanjut
+
+* [Understanding Style Precedence in CSS: Specificity, Inheritance, and the Cascade](http://www.vanseodesign.com/css/css-specificity-inheritance-cascaade/)
+* [QuirksMode CSS](http://www.quirksmode.org/css/)
+* [Z-Index - The stacking context](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Understanding_z_index/The_stacking_context)
+
diff --git a/it-it/java-it.html.markdown b/it-it/java-it.html.markdown
index e729f223..6eabd61f 100644
--- a/it-it/java-it.html.markdown
+++ b/it-it/java-it.html.markdown
@@ -1,5 +1,4 @@
---
-
language: java
filename: LearnJava-it.java
contributors:
@@ -8,14 +7,13 @@ contributors:
translators:
- ["Ivan Sala","http://github.com/slavni96"]
lang: it-it
-
---
Java è un linguaggio di programmazione orientato ad oggetti,
concorrente, basato su classi e adatto a svariati scopi.
[Per saperne di più](http://docs.oracle.com/javase/tutorial/java/index.html)
-```Java
+```java
// I commenti su singola linea incominciano con //
/*
I commenti su piu' linee invece sono cosi'
diff --git a/json.html.markdown b/json.html.markdown
new file mode 100644
index 00000000..f86f0ae9
--- /dev/null
+++ b/json.html.markdown
@@ -0,0 +1,48 @@
+---
+language: json
+filename: learnjson.json
+contributors:
+ - ["Anna Harren", "https://github.com/iirelu"]
+---
+
+As JSON is an extremely simple data-interchange format, this is most likely going
+to be the simplest Learn X in Y Minutes ever.
+
+JSON in its purest form has no actual comments, but most parsers will accept
+C-style (//, /\* \*/) comments. For the purposes of this, however, everything is
+going to be 100% valid JSON. Luckily, it kind of speaks for itself.
+
+```json
+{
+ "numbers": 0,
+ "strings": "Hellø, wørld. All unicode is allowed, along with \"escaping\".",
+ "has bools?": true,
+ "nothingness": null,
+
+ "big number": 1.2e+100,
+
+ "objects": {
+ "comment": "Most of your structure will come from objects.",
+
+ "array": [0, 1, 2, 3, "Arrays can have anything in them.", 5],
+
+ "another object": {
+ "comment": "These things can be nested, very useful."
+ }
+ },
+
+ "silliness": [
+ {
+ "sources of potassium": ["bananas"]
+ },
+ [
+ [1, 0, 0, 0],
+ [0, 1, 0, 0],
+ [0, 0, 1, "neo"],
+ [0, 0, 0, 1]
+ ]
+ ],
+
+ "that was short": "And, you're done. You know know everything JSON has to offer."
+}
+```
diff --git a/lua.html.markdown b/lua.html.markdown
index bdd59999..be9f3141 100644
--- a/lua.html.markdown
+++ b/lua.html.markdown
@@ -12,15 +12,13 @@ filename: learnlua.lua
Adding two ['s and ]'s makes it a
multi-line comment.
--]]
-
-----------------------------------------------------
+--------------------------------------------------------------------------------
-- 1. Variables and flow control.
-----------------------------------------------------
+--------------------------------------------------------------------------------
num = 42 -- All numbers are doubles.
--- Don't freak out, 64-bit doubles have 52 bits for
--- storing exact int values; machine precision is
--- not a problem for ints that need < 52 bits.
+-- Don't freak out, 64-bit doubles have 52 bits for storing exact int
+-- values; machine precision is not a problem for ints that need < 52 bits.
s = 'walternate' -- Immutable strings like Python.
t = "double-quotes are also fine"
@@ -60,8 +58,8 @@ aBoolValue = false
-- Only nil and false are falsy; 0 and '' are true!
if not aBoolValue then print('twas false') end
--- 'or' and 'and' are short-circuited.
--- This is similar to the a?b:c operator in C/js:
+-- 'or' and 'and' are short-circuited. This is similar to the a?b:c operator
+-- in C/js:
ans = aBoolValue and 'yes' or 'no' --> 'no'
karlSum = 0
@@ -81,10 +79,9 @@ repeat
num = num - 1
until num == 0
-
-----------------------------------------------------
+--------------------------------------------------------------------------------
-- 2. Functions.
-----------------------------------------------------
+--------------------------------------------------------------------------------
function fib(n)
if n < 2 then return n end
@@ -93,8 +90,8 @@ end
-- Closures and anonymous functions are ok:
function adder(x)
- -- The returned function is created when adder is
- -- called, and remembers the value of x:
+ -- The returned function is created when adder is called, and remembers the
+ -- value of x:
return function (y) return x + y end
end
a1 = adder(9)
@@ -102,10 +99,9 @@ a2 = adder(36)
print(a1(16)) --> 25
print(a2(64)) --> 100
--- Returns, func calls, and assignments all work
--- with lists that may be mismatched in length.
--- Unmatched receivers are nil;
--- unmatched senders are discarded.
+-- Returns, func calls, and assignments all work with lists that may be
+-- mismatched in length. Unmatched receivers are nil; unmatched senders are
+-- discarded.
x, y, z = 1, 2, 3, 4
-- Now x = 1, y = 2, z = 3, and 4 is thrown away.
@@ -118,16 +114,15 @@ end
x, y = bar('zaphod') --> prints "zaphod nil nil"
-- Now x = 4, y = 8, values 15..42 are discarded.
--- Functions are first-class, may be local/global.
--- These are the same:
+-- Functions are first-class, may be local/global. These are the same:
function f(x) return x * x end
f = function (x) return x * x end
-- And so are these:
local function g(x) return math.sin(x) end
local g = function(x) return math.sin(x) end
--- Equivalent to local function g(x)..., except referring
--- to g in the function body won't work as expected.
+-- Equivalent to local function g(x)..., except referring to g in the function
+-- body won't work as expected.
local g; g = function (x) return math.sin(x) end
-- the 'local g' decl makes g-self-references ok.
@@ -136,19 +131,16 @@ local g; g = function (x) return math.sin(x) end
-- Calls with one string param don't need parens:
print 'hello' -- Works fine.
--- Calls with one table param don't need parens
--- either (more on tables below):
+-- Calls with one table param don't need parens either (more on tables below):
print {} -- Works fine too.
-
-----------------------------------------------------
+--------------------------------------------------------------------------------
-- 3. Tables.
-----------------------------------------------------
+--------------------------------------------------------------------------------
--- Tables = Lua's only compound data structure;
--- they are associative arrays.
--- Similar to php arrays or js objects, they are
--- hash-lookup dicts that can also be used as lists.
+-- Tables = Lua's only compound data structure; they are associative arrays.
+-- Similar to php arrays or js objects, they are hash-lookup dicts that can
+-- also be used as lists.
-- Using tables as dictionaries / maps:
@@ -164,14 +156,13 @@ t.key2 = nil -- Removes key2 from the table.
u = {['@!#'] = 'qbert', [{}] = 1729, [6.28] = 'tau'}
print(u[6.28]) -- prints "tau"
--- Key matching is basically by value for numbers
--- and strings, but by identity for tables.
+-- Key matching is basically by value for numbers and strings, but by identity
+-- for tables.
a = u['@!#'] -- Now a = 'qbert'.
b = u[{}] -- We might expect 1729, but it's nil:
--- b = nil since the lookup fails. It fails
--- because the key we used is not the same object
--- as the one used to store the original value. So
--- strings & numbers are more portable keys.
+-- b = nil since the lookup fails. It fails because the key we used is not the
+-- same object as the one used to store the original value. So strings &
+-- numbers are more portable keys.
-- A one-table-param function call needs no parens:
function h(x) print(x.key1) end
@@ -191,16 +182,15 @@ v = {'value1', 'value2', 1.21, 'gigawatts'}
for i = 1, #v do -- #v is the size of v for lists.
print(v[i]) -- Indices start at 1 !! SO CRAZY!
end
--- A 'list' is not a real type. v is just a table
--- with consecutive integer keys, treated as a list.
+-- A 'list' is not a real type. v is just a table with consecutive integer
+-- keys, treated as a list.
-----------------------------------------------------
+--------------------------------------------------------------------------------
-- 3.1 Metatables and metamethods.
-----------------------------------------------------
+--------------------------------------------------------------------------------
--- A table can have a metatable that gives the table
--- operator-overloadish behavior. Later we'll see
--- how metatables support js-prototypey behavior.
+-- A table can have a metatable that gives the table operator-overloadish
+-- behavior. Later we'll see how metatables support js-prototypey behavior.
f1 = {a = 1, b = 2} -- Represents the fraction a/b.
f2 = {a = 2, b = 3}
@@ -221,10 +211,9 @@ setmetatable(f2, metafraction)
s = f1 + f2 -- call __add(f1, f2) on f1's metatable
--- f1, f2 have no key for their metatable, unlike
--- prototypes in js, so you must retrieve it as in
--- getmetatable(f1). The metatable is a normal table
--- with keys that Lua knows about, like __add.
+-- f1, f2 have no key for their metatable, unlike prototypes in js, so you must
+-- retrieve it as in getmetatable(f1). The metatable is a normal table with
+-- keys that Lua knows about, like __add.
-- But the next line fails since s has no metatable:
-- t = s + s
@@ -236,11 +225,12 @@ myFavs = {food = 'pizza'}
setmetatable(myFavs, {__index = defaultFavs})
eatenBy = myFavs.animal -- works! thanks, metatable
--- Direct table lookups that fail will retry using
--- the metatable's __index value, and this recurses.
+--------------------------------------------------------------------------------
+-- Direct table lookups that fail will retry using the metatable's __index
+-- value, and this recurses.
--- An __index value can also be a function(tbl, key)
--- for more customized lookups.
+-- An __index value can also be a function(tbl, key) for more customized
+-- lookups.
-- Values of __index,add, .. are called metamethods.
-- Full list. Here a is a table with the metamethod.
@@ -261,12 +251,12 @@ eatenBy = myFavs.animal -- works! thanks, metatable
-- __newindex(a, b, c) for a.b = c
-- __call(a, ...) for a(...)
-----------------------------------------------------
+--------------------------------------------------------------------------------
-- 3.2 Class-like tables and inheritance.
-----------------------------------------------------
+--------------------------------------------------------------------------------
--- Classes aren't built in; there are different ways
--- to make them using tables and metatables.
+-- Classes aren't built in; there are different ways to make them using
+-- tables and metatables.
-- Explanation for this example is below it.
@@ -286,22 +276,20 @@ mrDog = Dog:new() -- 7.
mrDog:makeSound() -- 'I say woof' -- 8.
-- 1. Dog acts like a class; it's really a table.
--- 2. function tablename:fn(...) is the same as
--- function tablename.fn(self, ...)
--- The : just adds a first arg called self.
--- Read 7 & 8 below for how self gets its value.
+-- 2. "function tablename:fn(...)" is the same as
+-- "function tablename.fn(self, ...)", The : just adds a first arg called
+-- self. Read 7 & 8 below for how self gets its value.
-- 3. newObj will be an instance of class Dog.
--- 4. self = the class being instantiated. Often
--- self = Dog, but inheritance can change it.
--- newObj gets self's functions when we set both
--- newObj's metatable and self's __index to self.
+-- 4. "self" is the class being instantiated. Often self = Dog, but inheritance
+-- can change it. newObj gets self's functions when we set both newObj's
+-- metatable and self's __index to self.
-- 5. Reminder: setmetatable returns its first arg.
--- 6. The : works as in 2, but this time we expect
--- self to be an instance instead of a class.
+-- 6. The : works as in 2, but this time we expect self to be an instance
+-- instead of a class.
-- 7. Same as Dog.new(Dog), so self = Dog in new().
-- 8. Same as mrDog.makeSound(mrDog); self = mrDog.
-----------------------------------------------------
+--------------------------------------------------------------------------------
-- Inheritance example:
@@ -315,17 +303,16 @@ end
seymour = LoudDog:new() -- 3.
seymour:makeSound() -- 'woof woof woof' -- 4.
+--------------------------------------------------------------------------------
-- 1. LoudDog gets Dog's methods and variables.
-- 2. self has a 'sound' key from new(), see 3.
--- 3. Same as LoudDog.new(LoudDog), and converted to
--- Dog.new(LoudDog) as LoudDog has no 'new' key,
--- but does have __index = Dog on its metatable.
--- Result: seymour's metatable is LoudDog, and
--- LoudDog.__index = Dog. So seymour.key will
--- = seymour.key, LoudDog.key, Dog.key, whichever
+-- 3. Same as "LoudDog.new(LoudDog)", and converted to "Dog.new(LoudDog)" as
+-- LoudDog has no 'new' key, but does have "__index = Dog" on its metatable.
+-- Result: seymour's metatable is LoudDog, and "LoudDog.__index = Dog". So
+-- seymour.key will equal seymour.key, LoudDog.key, Dog.key, whichever
-- table is the first with the given key.
--- 4. The 'makeSound' key is found in LoudDog; this
--- is the same as LoudDog.makeSound(seymour).
+-- 4. The 'makeSound' key is found in LoudDog; this is the same as
+-- "LoudDog.makeSound(seymour)".
-- If needed, a subclass's new() is like the base's:
function LoudDog:new()
@@ -335,13 +322,13 @@ function LoudDog:new()
return setmetatable(newObj, self)
end
-----------------------------------------------------
+--------------------------------------------------------------------------------
-- 4. Modules.
-----------------------------------------------------
+--------------------------------------------------------------------------------
---[[ I'm commenting out this section so the rest of
--- this script remains runnable.
+--[[ I'm commenting out this section so the rest of this script remains
+-- runnable.
```
```lua
@@ -367,8 +354,8 @@ local mod = require('mod') -- Run the file mod.lua.
local mod = (function ()
<contents of mod.lua>
end)()
--- It's like mod.lua is a function body, so that
--- locals inside mod.lua are invisible outside it.
+-- It's like mod.lua is a function body, so that locals inside mod.lua are
+-- invisible outside it.
-- This works because mod here = M in mod.lua:
mod.sayHello() -- Says hello to Hrunkner.
@@ -376,8 +363,8 @@ mod.sayHello() -- Says hello to Hrunkner.
-- This is wrong; sayMyName only exists in mod.lua:
mod.sayMyName() -- error
--- require's return values are cached so a file is
--- run at most once, even when require'd many times.
+-- require's return values are cached so a file is run at most once, even when
+-- require'd many times.
-- Suppose mod2.lua contains "print('Hi!')".
local a = require('mod2') -- Prints Hi!
diff --git a/ro-ro/bash-ro.html.markdown b/ro-ro/bash-ro.html.markdown
new file mode 100644
index 00000000..fa91cca4
--- /dev/null
+++ b/ro-ro/bash-ro.html.markdown
@@ -0,0 +1,171 @@
+---
+category: tool
+tool: bash
+contributors:
+ - ["Max Yankov", "https://github.com/golergka"]
+ - ["Darren Lin", "https://github.com/CogBear"]
+ - ["Alexandre Medeiros", "http://alemedeiros.sdf.org"]
+ - ["Denis Arh", "https://github.com/darh"]
+translators:
+ - ["Adrian Bordinc", "https://github.com/ellimist"]
+lang: ro-ro
+filename: LearnBash-ro.sh
+---
+
+Bash este numele shell-ului unix, care a fost de asemenea distribuit drept shell pentru pentru sistemul de operare GNU si ca shell implicit pentru Linux si Mac OS X.
+Aproape toate exemplele de mai jos pot fi parte dintr-un script sau pot fi executate direct in linia de comanda.
+
+[Citeste mai multe:](http://www.gnu.org/software/bash/manual/bashref.html)
+
+```bash
+#!/bin/bash
+# Prima linie din script se numeste "shebang" care spune systemului cum sa execute scriptul
+# http://en.wikipedia.org/wiki/Shebang_(Unix)
+# Dupa cum te-ai prins deja, comentariile incep cu #. Shebang este de asemenea un comentariu.
+
+# Exemplu simplu de hello world:
+echo Hello world!
+
+# Fiecare comanda incepe pe o linie noua, sau dupa punct si virgula ;
+echo 'Prima linie'; echo 'A doua linie'
+
+# Declararea unei variabile se face astfel:
+VARIABLE="Niste text"
+
+# DAR nu asa:
+VARIABLE = "Niste text"
+# Bash va crede ca VARIABLE este o comanda care trebuie executata si va
+# returna o eroare pentru ca nu va putea fi gasita.
+
+# Folosind variabila:
+echo $VARIABLE
+echo "$VARIABLE"
+echo '$VARIABLE'
+# Atunci cand folosesti variabila, o atribui, o exporti sau altfel, numele ei se scrie fara $.
+# Daca vrei sa folosesti valoarea variabilei, atunci trebuie sa folosesti $.
+# Atentie la faptul ca ' (apostrof) nu va inlocui variabla cu valoarea ei.
+
+# Inlocuirea de caractere in variabile
+echo ${VARIABLE/Some/A}
+# Asta va inlocui prima aparitie a "Some" cu "A" in variabila de mai sus.
+
+# Substring dintr-o variabila
+echo ${VARIABLE:0:7}
+# Asta va returna numai primele 7 caractere din variabila.
+
+# Valoarea implicita a unei variabile:
+echo ${FOO:-"ValoareaImplicitaDacaFOOLipsesteSauEGoala"}
+# Asta functioneaza pentru null (FOO=), sir de caractere gol (FOO=""), zero (FOO=0) returneaza 0
+
+# Variabile pre-existente
+echo "Ulima valoare returnata de ultimul program rulat: $?"
+echo "ID-ul procesului (PID) care ruleaza scriptul: $$"
+echo "Numarul de argumente: $#"
+echo "Argumentele scriptului: $@"
+echo "Argumentele scriptului separate in variabile: $1 $2..."
+
+# Citind o valoare din consola
+echo "Care e numele tau?"
+read NAME # Observa faptul ca nu a trebuit sa declaram o variabila noua
+echo Salut, $NAME!
+
+# Avem obisnuita instructiune "if"
+# Foloseste "man test" pentru mai multe informatii despre instructinea conditionala
+if [ $NAME -ne $USER ]
+then
+ echo "Numele tau este username-ul tau"
+else
+ echo "Numele tau nu este username-ul tau"
+fi
+
+# Este de asemenea si executarea conditionala de comenzi
+echo "Intotdeauna executat" || echo "Executat numai daca prima instructiune esueaza"
+echo "Intotdeauna executat" && echo "Executat numai daca prima instructiune NU esueaza"
+
+# Expresiile apar in urmatorul format
+echo $(( 10 + 5 ))
+
+# Spre deosebire de alte limbaje de programare bash este un shell - asa ca
+# functioneaza in contextul directorului curent. Poti vedea fisiere si directoare
+# din directorul curent folosind comanda "ls":
+ls
+
+# Aceste comenzi au optiuni care la controleaza executia
+ls -l # Listeaza fiecare fisier si director pe o linie separata
+
+# Rezultatele comenzii precedente poate fi trimis urmatoarei comenzi drept argument
+# Comanda grep filtreaza argumentele trimise cu sabloane. Astfel putem vedea fiserele
+# .txt din directorul curent.
+ls -l | grep "\.txt"
+
+# De asemenea poti redirectiona o comanda, input si error output
+python2 hello.py < "input.in"
+python2 hello.py > "output.out"
+python2 hello.py 2> "error.err"
+# Output-ul va suprascrie fisierul daca acesta exista.
+# Daca vrei sa fie concatenate poti folosi ">>"
+
+# Comenzile pot fi inlocuite in interiorul altor comenzi folosind $( ):
+# Urmatoarea comanda afiseaza numarul de fisiere si directoare din directorul curent
+echo "Sunt $(ls | wc -l) fisiere aici."
+
+# The same can be done using backticks `` but they can't be nested - the preferred way
+# is to use $( ).
+# Acelasi lucru se poate obtine folosind apostrf-ul inversat ``, dar nu pot fi folosite
+# unele in interiorul celorlalte asa ca modalitatea preferata este de a folosi $( )
+echo "Sunt `ls | wc -l` fisiere aici."
+
+# Bash foloseste o instructiune 'case' care functioneaza in mod similar cu instructiunea
+# switch din Java si C++
+case "$VARIABLE" in
+ 0) echo "Este un zero.";;
+ 1) echo "Este un unu.";;
+ *) echo "Nu este null";;
+esac
+
+# Instructiunea for parcurge toate elementele trimise:
+# Continutul variabilei $VARIABLE este printat de 3 ori
+for VARIABLE in {1..3}
+do
+ echo "$VARIABLE"
+done
+
+# while loop:
+while [true]
+do
+ echo "in interiorul iteratiei aici..."
+ break
+done
+
+# De asemenea poti defini functii
+# Definitie:
+function foo ()
+{
+ echo "Argumentele functioneaza ca si argumentele scriptului: $@"
+ echo "Si: $1 $2..."
+ echo "Asta este o functie"
+ return 0
+}
+
+# sau mai simplu
+bar ()
+{
+ echo "Alta metoda de a declara o functie"
+ return 0
+}
+
+# Invocarea unei functii
+foo "Numele meu este: " $NAME
+
+# Sunt o multime de comenzi utile pe care ar trebui sa le inveti:
+tail -n 10 file.txt
+# printeaza ultimele 10 linii din fisierul file.txt
+head -n 10 file.txt
+# printeaza primele 10 linii din fisierul file.txt
+sort file.txt
+# sorteaza liniile din file.txt
+uniq -d file.txt
+# raporteaza sau omite liniile care se repeta, cu -d le raporteaza
+cut -d ',' -f 1 file.txt
+# printeaza doar prima coloana inainte de caracterul ","
+```
diff --git a/ro-ro/ruby-ro.html.markdown b/ro-ro/ruby-ro.html.markdown
new file mode 100644
index 00000000..27c6c462
--- /dev/null
+++ b/ro-ro/ruby-ro.html.markdown
@@ -0,0 +1,479 @@
+---
+language: ruby
+contributors:
+ - ["David Underwood", "http://theflyingdeveloper.com"]
+ - ["Joel Walden", "http://joelwalden.net"]
+ - ["Luke Holder", "http://twitter.com/lukeholder"]
+ - ["Tristan Hume", "http://thume.ca/"]
+ - ["Nick LaMuro", "https://github.com/NickLaMuro"]
+ - ["Marcos Brizeno", "http://www.about.me/marcosbrizeno"]
+translators:
+ - ["Adrian Bordinc", "https://github.com/ellimist"]
+filename: learnruby-ro.rb
+lang: ro-ro
+---
+
+```ruby
+# Acesta este un comentariu
+
+=begin
+Acesta este un comentariu pe mai multe linii
+Nimeni nu le foloseste
+Si nici tu nu ar trebui sa o faci
+=end
+
+# In primul rand: totul este un obiect
+
+# Numerele sunt obiecte
+
+3.class #=> Fixnum
+
+3.to_s #=> "3"
+
+
+# Aritmetica de baza
+1 + 1 #=> 2
+8 - 1 #=> 7
+10 * 2 #=> 20
+35 / 5 #=> 7
+
+# Aritmetica este doar "zahar sintactic"
+# pentru a putea chema metode pe un obiect
+1.+(3) #=> 4
+10.* 5 #=> 50
+
+# Valorile speciale sunt obiecte
+nil # Nimic
+true # true
+false # false
+
+nil.class #=> NilClass
+true.class #=> TrueClass
+false.class #=> FalseClass
+
+# Egalitate
+1 == 1 #=> true
+2 == 1 #=> false
+
+# Inegalitate
+1 != 1 #=> false
+2 != 1 #=> true
+!true #=> false
+!false #=> true
+
+# Excluzand "false", "nil" este singura valoare "falsa"
+
+!nil #=> true
+!false #=> true
+!0 #=> false
+
+# Mai multe comparatii
+1 < 10 #=> true
+1 > 10 #=> false
+2 <= 2 #=> true
+2 >= 2 #=> true
+
+# Sirurule de caractere sunt obiecte
+
+'Sunt un sir de caractere'.class #=> String
+"Si eu sunt un sir de caractere".class #=> String
+
+fi_inlocuit = "inlocui o valoare in string"
+"Pot #{fi_inlocuit} atunci cand folosesc dublu apostrof"
+#=> "Pot inlocui o valoare intr-un sir de caractere atunci cand folosesc dublu apostrof"
+
+
+# Printeaza
+puts "Afisez rezultate!"
+
+# Variabile
+x = 25 #=> 25
+x #=> 25
+
+# Retineti faptul ca atribuire unei valori, o si returneaza pe aceasta
+# Asta inseamna ca poti sa faci atribuire multipla:
+
+x = y = 10 #=> 10
+x #=> 10
+y #=> 10
+
+# Prin conventie se foloseste "snake_case" in denumirea variabilelor
+snake_case = true
+
+# Folositi nume descriptive pentru variablie
+adresa_radacina_proiect = '/nume/bun/'
+adresa = '/nume/nu atat de bun/'
+
+# Simbolurile (sunt obiecte)
+# Simbolurile sunt constante imutabile, reutilizabile, reprezentate intern
+# de o valoare numerica. Sunt deseori folosite in locul sirurilor de caractere pentru a da un nume reprezentativ unei valori
+
+:exemplu_simbol.class #=> Symbol
+
+status = :exemplu_simbol
+
+status == :exemplu_simbol #=> adevarat
+
+status == 'exemplu_simbol' #=> fals
+
+status == :aprobat #=> fals
+
+# Vectori
+
+# Acesta este un vector
+vector = [1, 2, 3, 4, 5] #=> [1, 2, 3, 4, 5]
+
+# Vectorii pot contine diferite tipuri de date
+
+[1, "salut", false] #=> [1, "salut", false]
+
+# Vectorii pot fi indexati
+# de la inceput
+vector[0] #=> 1
+vector[12] #=> nil
+
+# Ca si aritmetica, accessul [valoare]
+# este doar "zahar sintactic"
+# pentru a chema metoda [] a unui obiect
+vector.[] 0 #=> 1
+vector.[] 12 #=> nil
+
+# De la sfarsit
+vector[-1] #=> 5
+
+# Cu un index de inceput si o lungime
+vector[2, 3] #=> [3, 4, 5]
+
+# Sau cu un interval
+vector[1..3] #=> [2, 3, 4]
+
+# Adauga elemente intr-un vector in felul urmator:
+vector << 6 #=> [1, 2, 3, 4, 5, 6]
+
+# Hash-urile sunt dictionarele din Ruby cu perechi cheie/valoare.
+# Hash-urile sunt notate cu acolade
+hash = {'culoare' => 'verde', 'numar' => 5}
+
+hash.keys #=> ['culoare', 'numar']
+
+# Poti lua valoare unui element dintr-un hash foarte rapid folosind cheia
+hash['culoare'] #=> 'verde'
+hash['numar'] #=> 5
+
+# Incercand sa accesezi un element dintr-un hash printr-o cheie care nu exista va returna "nil".
+hash['nimic_aici'] #=> nil
+
+# Incepand cu Ruby 1.9, este o sintaxa speciala pentru atunci cand se folosesc simboluri drept chei:
+
+hash_nou = { defcon: 3, actiune: true}
+
+hash_now.keys #=> [:defcon, :actiune]
+
+# Pont: Atat vectorii (Array) si hash-urile (Hash) sunt enumerabile (Enumerable)
+# Ele impart o multime de metode utile precum each, map, count si altele
+
+
+# Structuri de control
+
+if true
+ "instructiune if"
+elsif false
+ "else if, optional"
+else
+ "else, de asemenea optional"
+end
+
+for numar in 1..5
+ puts "iteratia #{numar}"
+end
+#=> iteratia 1
+#=> iteratia 2
+#=> iteratia 3
+#=> iteratia 4
+#=> iteratia 5
+
+# TOTUSI, Nici una nu foloseste instructiunea for
+# In locul acesteia ar trebui sa folosesti metoda "each" si sa ii trimiti un block
+# Un bloc este o bucata de cod pe care o poti trimite unei metode precum "each".
+# Este analog pentru "lambda", functii anonime, sau closures in alte limbaje de programare.
+#
+# The "each" method of a range runs the block once for each element of the range.
+# Metoda "each" a unui interval, ruleaza block-ul o data pentru fiecare element din interval.
+# Block-ul primeste ca si parametru un index
+# Invocand metoda "each" cu un block, arata in urmatorul fel:
+
+(1..5).each do |index|
+ puts "iteratia #{index}"
+end
+#=> iteratia 1
+#=> iteratia 2
+#=> iteratia 3
+#=> iteratia 4
+#=> iteratia 5
+
+# Poti de asemenea sa pui block-ul intre acolade
+(1..5).each {|index| puts "iteratia #{index}"}
+
+# Continutul unei structuri de date poate fi parcurs folosind "each".
+array.each do |element|
+ puts "#{element} parte din vector"
+end
+hash.each do |cheie, valoare|
+ puts "#{cheie} este #{valoare}"
+end
+
+index = 1
+while index <= 5 do
+ puts "iteratia #{index}"
+ index += 1
+end
+#=> iteratia 1
+#=> iteratia 2
+#=> iteratia 3
+#=> iteratia 4
+#=> iteratia 5
+
+nota = 'B'
+
+case nota
+when 'A'
+ puts "Bravo pustiule!"
+when 'B'
+ puts "Mai mult noroc data viitoare"
+when 'C'
+ puts "Poti mai mult"
+when 'D'
+ puts "Incet, incet..."
+when 'F'
+ puts "Ai esuat!"
+else
+ puts "Sistem de notare alternativ?!"
+end
+
+# Functii
+
+def dublu(x)
+ x * 2
+end
+
+# Functille (si toate block-urile) returneaza implicit valoarea ultimei instructiuni
+dublu(2) #=> 4
+
+# Parantezele sunt optionale cand rezultatul nu este ambiguu
+dublu 3 #=> 6
+
+dublu dublu 3 #=> 12
+
+def suma(x,y)
+ x + y
+end
+
+# Argumentele metodei sunt separate printr-o virgula
+suma 3, 4 #=> 7
+
+suma suma(3,4), 5 #=> 12
+
+# yield
+# Toate metodele au un parametru block, implicit si optional
+# care poate fi invocat folosit cuvantul cheie 'yield'
+
+def incercuieste
+ puts "{"
+ yield
+ puts "}"
+end
+
+incercuieste { puts 'Salut Mihai!' }
+
+# {
+# Salut Mihai!
+# }
+
+
+# Poti trimite un block unei functii.
+# "&" marcheaza o referinta trimisa unui block
+def vizitatori(&block)
+ block.call "un_parametru"
+end
+
+# Poti trimite o lista de argumente, care va fi convertita intr-un vector (array).
+# Pentru asta se foloseste ("*")
+def vizitatori(*vector)
+ vector.each { |vizitator| puts "#{vizitator}" }
+end
+
+# Defineste o clasa folosind cuvantul cheie "class"
+class Om
+
+ # O variabila apartinand clasei. Este folosita in toate instantele clasei
+ @@specie = "H. sapiens"
+
+ # Constructor
+ def initialize(nume, varsta=0)
+ # Atribuie argumentul, variabilei "nume", care apartine doar unei instante
+ @nume = nume
+ # Daca varsta nu este data, o sa ii atribuim valoarea implicita din lista de argumente (0, in cazul nostru)
+ @varsta = varsta
+ end
+
+ # Metoda pentru a seta valoarea unei variabile
+ def nume=(nume)
+ @nume = nume
+ end
+
+ # Metoda pentru a lua valoarea unei variabile
+ def nume
+ @nume
+ end
+
+ # Functionalitatea de mai sus poate fi obtinuta folosing metoda "attr_accessor" dupa cum urmeaza:
+ attr_accessor :nume
+
+ # Metodele pentru a lua si a seta valoarea unei variabile pot fi de asemenea obtinute individial:
+ attr_reader :nume
+ attr_writer :nume
+
+ # O metoda apartinand unei clase foloseste "self" pentru a se diferentia de metodele unei instante ale clasei respective
+ # Poate fi invocata doar pe clasa, si nu pe o instanta a acesteia
+ def self.spune(msg)
+ puts "#{msg}"
+ end
+
+ def specie
+ @@specie
+ end
+
+end
+
+
+# Creaza o instanta a unei clase
+ion = Om.new("Ionut Popescu")
+
+eugen = Om.new("Eugen Ionescu")
+
+# Sa invocam niste metode
+ion.specie #=> "H. sapiens"
+ion.nume #=> "Ionut Popescu"
+ion.nume = "Ionut Popescu JR." #=> "Ionut Popescu JR."
+ion.nume #=> "Ionut Popescu JR."
+eugen.specie #=> "H. sapiens"
+eugen.nume #=> "Eugen Ionescu"
+
+# Invoca o metoda a unei clase
+Om.spune("Salut") #=> "Salut"
+
+
+# Scopul unei variabile este definit de modul in care le numim
+# Variabilele care incep cu $ au scop global
+$var = "Sunt o variabila globala"
+defined? $var #=> "global-variable"
+
+# Variabilele care incep cu @ apartin unei instante
+@var = "Sunt o variabila a unei instante"
+defined? @var #=> "instance-variable"
+
+# Variabilele care incep cu @@ apartin unei clase
+@@var = "Sunt variabila unei clase"
+defined? @@var #=> "class variable"
+
+# Variabilele care incep cu litera mare sunt constante
+Var = "Sunt o constanta"
+defined? Var #=> "constant"
+
+# Clasele sunt de asemenea obiecte in ruby. Astfel incat clasele pot avea variabile care apartin unei instante
+# O variabila care apartine unei clase poate fi accesata de toate instantele acesteia si de clasele care o extind
+
+# clasa parinte
+class Om
+ @@foo = 0
+
+ def self.foo
+ @@foo
+ end
+
+ def self.foo=(valoare)
+ @@foo = valoare
+ end
+end
+
+# clasa copil
+class Muncitor < Om
+end
+
+Om.foo # 0
+Muncitor.foo # 0
+
+Om.foo = 2 # 2
+Muncitor.foo # 2
+
+# Variabilele care apartin unei instante ale unei clase, nu sunt impartite de (copii acesteia) clasele care o extind
+class Om
+ @bar = 0
+
+ def self.bar
+ @bar
+ end
+
+ def self.bar=(valoare)
+ @bar = valoare
+ end
+end
+
+class Doctor < Om
+end
+
+Om.bar # 0
+Doctor.bar # nil
+
+module ExempluModul
+ def foo
+ 'foo'
+ end
+end
+
+# Incluzand modulul instantei unui obiect
+# Extinzand modulul unei instante ale unei clase
+
+class Persoana
+ include ExempluModul
+end
+
+class Carte
+ extend ExempluModul
+end
+
+Persoana.foo # => NoMethodError: undefined method `foo' for Persoana:Class
+Persoana.new.foo # => 'foo'
+Carte.foo # => 'foo'
+Carte.new.foo # => NoMethodError: undefined method `foo'
+
+# Callbacks atunci cand includerea si extinderea unui modul sunt executate
+
+module ModulExempluCallBack
+ def self.included(base)
+ base.extend(ClassMethods)
+ base.send(:include, InstanceMethods)
+ end
+
+ module ClassMethods
+ def bar
+ 'bar'
+ end
+ end
+
+ module InstanceMethods
+ def qux
+ 'qux'
+ end
+ end
+end
+
+class CevaRelevant
+ include ModulExempluCallBack
+end
+
+CevaRelevant.bar # => 'bar'
+CevaRelevant.qux # => NoMethodError: undefined method `qux'
+CevaRelevant.new.bar # => NoMethodError: undefined method `bar'
+CevaRelevant.new.qux # => 'qux'
+```
diff --git a/scala.html.markdown b/scala.html.markdown
index 5dfaefe0..2666746e 100644
--- a/scala.html.markdown
+++ b/scala.html.markdown
@@ -104,10 +104,13 @@ val sq = (x:Int) => x * x
sq(10) // Gives you this: res33: Int = 100.
+// The colon explicitly defines the type of a value, in this case a function
+// taking an Int and returning an Int.
+val add10: Int => Int = _ + 10
+
// Scala allows methods and functions to return, or take as parameters, other
// functions or methods.
-val add10: Int => Int = _ + 10 // A function taking an Int and returning an Int
List(1, 2, 3) map add10 // List(11, 12, 13) - add10 is applied to each element
// Anonymous functions can be used instead of named functions:
diff --git a/yaml.html.markdown b/yaml.html.markdown
new file mode 100644
index 00000000..c5d15895
--- /dev/null
+++ b/yaml.html.markdown
@@ -0,0 +1,139 @@
+---
+language: yaml
+filename: learnyaml.yaml
+contributors:
+ - ["Adam Brenecki", "https://github.com/adambrenecki"]
+---
+
+YAML is a data serialisation language designed to be directly writable and
+readable by humans.
+
+It's a strict superset of JSON, with the addition of syntactically
+significant newlines and indentation, like Python. Unlike Python, however,
+YAML doesn't allow literal tab characters at all.
+
+```yaml
+# Comments in YAML look like this.
+
+################
+# SCALAR TYPES #
+################
+
+# Our root object (which continues for the entire document) will be a map,
+# which is equivalent to a dictionary, hash or object in other languages.
+key: value
+another_key: Another value goes here.
+a_number_value: 100
+scientific_notation: 1e+12
+boolean: true
+null_value: null
+key with spaces: value
+# Notice that strings don't need to be quoted. However, they can be.
+however: "A string, enclosed in quotes."
+"Keys can be quoted too.": "Useful if you want to put a ':' in your key."
+
+# Multiple-line strings can be written either as a 'literal block' (using |),
+# or a 'folded block' (using '>')
+literal_block: |
+ This entire block of text will be the value of the 'literal_block' key,
+ with line breaks being preserved.
+
+ The literal continues until de-dented, and the leading indentation is
+ stripped.
+
+ Any lines that are 'more-indented' keep the rest of their indentation -
+ these lines will be indented by 4 spaces.
+folded_style: >
+ This entire block of text will be the value of 'folded_style', but this
+ time, all newlines will be replaced with a single space.
+
+ Blank lines, like above, are converted to a newline character.
+
+ 'More-indented' lines keep their newlines, too -
+ this text will appear over two lines.
+
+####################
+# COLLECTION TYPES #
+####################
+
+# Nesting is achieved by indentation.
+a_nested_map:
+ key: value
+ another_key: Another Value
+ another_nested_map:
+ hello: hello
+
+# Maps don't have to have string keys.
+0.25: a float key
+
+# Keys can also be multi-line objects, using ? to indicate the start of a key
+? |
+ This is a key
+ that has multiple lines
+: and this is its value
+
+# YAML also allows collection types in keys, but many programming languages
+# will complain.
+
+# Sequences (equivalent to lists or arrays) look like this:
+a_sequence:
+ - Item 1
+ - Item 2
+ - 0.5 # sequences can contain disparate types
+ - Item 4
+ - key: value
+ another_key: another_value
+ -
+ - This is a sequence
+ - inside another sequence
+
+# Since YAML is a superset of JSON, you can also write JSON-style maps and
+# sequences:
+json_map: {"key": "value"}
+json_seq: [3, 2, 1, "takeoff"]
+
+#######################
+# EXTRA YAML FEATURES #
+#######################
+
+# YAML also has a handy feature called 'anchors', which let you easily duplicate
+# content across your document. Both of these keys will have the same value:
+anchored_content: &anchor_name This string will appear as the value of two keys.
+other_anchor: *anchor_name
+
+# YAML also has tags, which you can use to explicitly declare types.
+explicit_string: !!str 0.5
+# Some parsers implement language specific tags, like this one for Python's
+# complex number type.
+python_complex_number: !!python/complex 1+2j
+
+####################
+# EXTRA YAML TYPES #
+####################
+
+# Strings and numbers aren't the only scalars that YAML can understand.
+# ISO-formatted date and datetime literals are also parsed.
+datetime: 2001-12-15T02:59:43.1Z
+datetime_with_spaces: 2001-12-14 21:59:43.10 -5
+date: 2002-12-14
+
+# The !!binary tag indicates that a string is actually a base64-encoded
+# representation of a binary blob.
+gif_file: !!binary |
+ R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5
+ OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+
+ +f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC
+ AgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs=
+
+# YAML also has a set type, which looks like this:
+set:
+ ? item1
+ ? item2
+ ? item3
+
+# Like Python, sets are just maps with null values; the above is equivalent to:
+set2:
+ item1: null
+ item2: null
+ item3: null
+```
diff --git a/zh-cn/clojure-macro-cn.html.markdown b/zh-cn/clojure-macro-cn.html.markdown
new file mode 100644
index 00000000..9324841e
--- /dev/null
+++ b/zh-cn/clojure-macro-cn.html.markdown
@@ -0,0 +1,152 @@
+---
+language: "clojure macros"
+filename: learnclojuremacros-zh.clj
+contributors:
+ - ["Adam Bard", "http://adambard.com/"]
+translators:
+ - ["Jakukyo Friel", "http://weakish.github.io"]
+lang: zh-cn
+---
+
+和所有Lisp一样,Clojure内在的[同构性](https://en.wikipedia.org/wiki/Homoiconic)使得你可以穷尽语言的特性,编写生成代码的子过程——“宏”。宏是一种按需调制语言的强大方式。
+
+小心!可以用函数完成的事用宏去实现可不是什么好事。你应该仅在需要控制参数是否或者何时eval的时候使用宏。
+
+你应该熟悉Clojure.确保你了解[Y分钟学Clojure](http://learnxinyminutes.com/docs/zh-cn/clojure-cn/)中的所有内容。
+
+```clojure
+;; 使用defmacro定义宏。宏应该输出一个可以作为clojure代码演算的列表。
+;;
+;; 以下宏的效果和直接写(reverse "Hello World")一致。
+
+(defmacro my-first-macro []
+ (list reverse "Hello World"))
+
+;; 使用macroexpand或macroexpand-1查看宏的结果。
+;;
+;; 注意,调用需要引用。
+(macroexpand '(my-first-macro))
+;; -> (#<core$reverse clojure.core$reverse@xxxxxxxx> "Hello World")
+
+;; 你可以直接eval macroexpand的结果
+(eval (macroexpand '(my-first-macro)))
+; -> (\d \l \o \r \W \space \o \l \l \e \H)
+
+;; 不过一般使用以下形式,更简短,更像函数:
+(my-first-macro) ; -> (\d \l \o \r \W \space \o \l \l \e \H)
+
+;; 创建宏的时候可以使用更简短的引用形式来创建列表
+(defmacro my-first-quoted-macro []
+ '(reverse "Hello World"))
+
+(macroexpand '(my-first-quoted-macro))
+;; -> (reverse "Hello World")
+;; 注意reverse不再是一个函数对象,而是一个符号。
+
+;; 宏可以传入参数。
+(defmacro inc2 [arg]
+ (list + 2 arg))
+
+(inc2 2) ; -> 4
+
+;; 不过,如果你尝试配合使用引用列表,会导致错误,
+;; 因为参数也会被引用。
+;; 为了避免这个问题,clojure提供了引用宏的另一种方式:`
+;; 在`之内,你可以使用~获得外圈作用域的变量。
+(defmacro inc2-quoted [arg]
+ `(+ 2 ~arg))
+
+(inc2-quoted 2)
+
+;; 你可以使用通常的析构参数。用~@展开列表中的变量。
+(defmacro unless [arg & body]
+ `(if (not ~arg)
+ (do ~@body))) ; 别忘了 do!
+
+(macroexpand '(unless true (reverse "Hello World")))
+
+;; ->
+;; (if (clojure.core/not true) (do (reverse "Hello World")))
+
+;; 当第一个参数为假时,(unless)会演算、返回主体。
+;; 否则返回nil。
+
+(unless true "Hello") ; -> nil
+(unless false "Hello") ; -> "Hello"
+
+;; 需要小心,宏会搞乱你的变量
+(defmacro define-x []
+ '(do
+ (def x 2)
+ (list x)))
+
+(def x 4)
+(define-x) ; -> (2)
+(list x) ; -> (2)
+
+;; 使用gensym来获得独有的标识符
+(gensym 'x) ; -> x1281 (or some such thing)
+
+(defmacro define-x-safely []
+ (let [sym (gensym 'x)]
+ `(do
+ (def ~sym 2)
+ (list ~sym))))
+
+(def x 4)
+(define-x-safely) ; -> (2)
+(list x) ; -> (4)
+
+;; 你可以在 ` 中使用 # 为每个符号自动生成gensym
+(defmacro define-x-hygenically []
+ `(do
+ (def x# 2)
+ (list x#)))
+
+(def x 4)
+(define-x-hygenically) ; -> (2)
+(list x) ; -> (4)
+
+;; 通常会配合宏使用帮助函数。
+;; 让我们创建一些帮助函数来支持(无聊的)算术语法:
+
+(declare inline-2-helper)
+(defn clean-arg [arg]
+ (if (seq? arg)
+ (inline-2-helper arg)
+ arg))
+
+(defn apply-arg
+ "Given args [x (+ y)], return (+ x y)"
+ [val [op arg]]
+ (list op val (clean-arg arg)))
+
+(defn inline-2-helper
+ [[arg1 & ops-and-args]]
+ (let [ops (partition 2 ops-and-args)]
+ (reduce apply-arg (clean-arg arg1) ops)))
+
+;; 在创建宏前,我们可以先测试
+(inline-2-helper '(a + (b - 2) - (c * 5))) ; -> (- (+ a (- b 2)) (* c 5))
+
+; 然而,如果我们希望它在编译期执行,就需要创建宏
+(defmacro inline-2 [form]
+ (inline-2-helper form)))
+
+(macroexpand '(inline-2 (1 + (3 / 2) - (1 / 2) + 1)))
+; -> (+ (- (+ 1 (/ 3 2)) (/ 1 2)) 1)
+
+(inline-2 (1 + (3 / 2) - (1 / 2) + 1))
+; -> 3 (事实上,结果是3N, 因为数字被转化为带/的有理分数)
+```
+
+## 扩展阅读
+
+[Clojure for the Brave and True](http://www.braveclojure.com/)系列的编写宏
+http://www.braveclojure.com/writing-macros/
+
+官方文档
+http://clojure.org/macros
+
+何时使用宏?
+http://dunsmor.com/lisp/onlisp/onlisp_12.html
diff --git a/zh-cn/common-lisp-cn.html.markdown b/zh-cn/common-lisp-cn.html.markdown
index f005dd58..c4dc3274 100644
--- a/zh-cn/common-lisp-cn.html.markdown
+++ b/zh-cn/common-lisp-cn.html.markdown
@@ -56,11 +56,11 @@ t ;还是一个原子,代表逻辑真值。
;; 有很多不同的Common Lisp的实现;并且大部分的实现是一致(可移植)的。
;; 对于入门学习来说,CLISP是个不错的选择。
-;; 可以通过QuickLisp.org's Quicklisp系统可以管理你的库。
+;; 可以通过QuickLisp.org的Quicklisp系统管理你的库。
-;; 通常,使用一个文本编辑器和一个的“REPL”来开发Common Lisp;
+;; 通常,使用文本编辑器和“REPL”来开发Common Lisp;
;; (译者注:“REPL”指读取-求值-打印循环)。
-;; “REPL”允许对程序进行交互式的运行、调试,就好像在系统中这是一场“现场直播”。
+;; “REPL”允许对程序进行交互式的运行、调试,就好像在系统“现场”操作。
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -329,7 +329,7 @@ nil ; 逻辑假,或者空列表
;; 或者使用`apply`
(apply (lambda () "Hello World") nil) ; => "Hello World"
-;; 显示地定义一个函数(译者注:即非匿名的)
+;; 显式地定义一个函数(译者注:即非匿名的)
(defun hello-world ()
"Hello World")
(hello-world) ; => "Hello World"
@@ -537,7 +537,7 @@ nil ; 逻辑假,或者空列表
;; 注意到这些有用的返回信息——Common Lisp一直是一个交互式的系统。
;; 若要定义一个方法;
-;; 先让我们注意到我们计算自行车轮子周长时使用了这样一个公式:C = d * pi
+;; 注意,我们计算自行车轮子周长时使用了这样一个公式:C = d * pi
(defmethod circumference ((object bicycle))
(* pi (wheel-size object)))
@@ -593,7 +593,7 @@ nil ; 逻辑假,或者空列表
;; 然而,在一个比较现代化的编译环境下,这样的WHILE是没有必要的;
;; LOOP形式的循环和这个WHILE同样的好,并且更易于阅读。
-;; 注意到反引号'`',逗号','以及'@'符号,这三个符号;
+;; 注意反引号'`',逗号','以及'@'这三个符号;
;; 反引号'`'是一种所谓“quasiquote”的引用类型的运算符,有了它,之后的逗号“,”才有意义。
;; 逗号“,”意味着解除引用(unquote,即开始求值);
;; “@”符号则表示将当前的参数插入到当前整个列表中。
diff --git a/zh-cn/visualbasic-cn.html.markdown b/zh-cn/visualbasic-cn.html.markdown
new file mode 100644
index 00000000..95f01ed6
--- /dev/null
+++ b/zh-cn/visualbasic-cn.html.markdown
@@ -0,0 +1,274 @@
+---
+language: Visual Basic
+contributors:
+ - ["Brian Martin", "http://brianmartin.biz"]
+translators:
+ - ["Abner Chou", "http://github.com/NoahDragon"]
+lang: zh-cn
+filename: learnvisualbasic.vb-cn
+---
+
+```vb
+Module Module1
+
+ Sub Main()
+ ' 让我们先从简单的终端程序学起。
+ ' 单引号用来生成注释(注意是半角单引号,非全角单引号’)
+ ' 为了方便运行此示例代码,我写了个目录索引。
+ ' 可能你还不了解以下代码的意义,但随着教程的深入,
+ ' 你会渐渐理解其用法。
+ Console.Title = ("Learn X in Y Minutes")
+ Console.WriteLine("NAVIGATION") ' 显示目录
+ Console.WriteLine("")
+ Console.ForegroundColor = ConsoleColor.Green
+ Console.WriteLine("1. Hello World Output") ' Hello world 输出示例
+ Console.WriteLine("2. Hello World Input") ' Hello world 输入示例
+ Console.WriteLine("3. Calculating Whole Numbers") ' 求整数之和
+ Console.WriteLine("4. Calculating Decimal Numbers") ' 求小数之和
+ Console.WriteLine("5. Working Calculator") ' 计算器
+ Console.WriteLine("6. Using Do While Loops") ' 使用 Do While 循环
+ Console.WriteLine("7. Using For While Loops") ' 使用 For While 循环
+ Console.WriteLine("8. Conditional Statements") ' 条件语句
+ Console.WriteLine("9. Select A Drink") ' 选饮料
+ Console.WriteLine("50. About") ' 关于
+ Console.WriteLine("Please Choose A Number From The Above List")
+ Dim selection As String = Console.ReadLine
+ Select Case selection
+ Case "1" ' Hello world 输出示例
+ Console.Clear() ' 清空屏幕
+ HelloWorldOutput() ' 调用程序块
+ Case "2" ' Hello world 输入示例
+ Console.Clear()
+ HelloWorldInput()
+ Case "3" ' 求整数之和
+ Console.Clear()
+ CalculatingWholeNumbers()
+ Case "4" ' 求小数之和
+ Console.Clear()
+ CalculatingDecimalNumbers()
+ Case "5" ' 计算器
+ Console.Clear()
+ WorkingCalculator()
+ Case "6" ' 使用 do while 循环
+ Console.Clear()
+ UsingDoWhileLoops()
+ Case "7" ' 使用 for while 循环
+ Console.Clear()
+ UsingForLoops()
+ Case "8" ' 条件语句
+ Console.Clear()
+ ConditionalStatement()
+ Case "9" ' If/Else 条件语句
+ Console.Clear()
+ IfElseStatement() ' 选饮料
+ Case "50" ' 关于本程序和作者
+ Console.Clear()
+ Console.Title = ("Learn X in Y Minutes :: About")
+ MsgBox("This tutorial is by Brian Martin (@BrianMartinn")
+ Console.Clear()
+ Main()
+ Console.ReadLine()
+
+ End Select
+ End Sub
+
+ ' 一、对应程序目录1,下同
+
+ ' 使用 private subs 声明函数。
+ Private Sub HelloWorldOutput()
+ ' 程序名
+ Console.Title = "Hello World Ouput | Learn X in Y Minutes"
+ ' 使用 Console.Write("") 或者 Console.WriteLine("") 来输出文本到屏幕上
+ ' 对应的 Console.Read() 或 Console.Readline() 用来读取键盘输入
+ Console.WriteLine("Hello World")
+ Console.ReadLine()
+ ' Console.WriteLine()后加Console.ReadLine()是为了防止屏幕输出信息一闪而过
+ ' 类似平时常见的“单击任意键继续”的意思。
+ End Sub
+
+ ' 二
+ Private Sub HelloWorldInput()
+ Console.Title = "Hello World YourName | Learn X in Y Minutes"
+ ' 变量
+ ' 用来存储用户输入的数据
+ ' 变量声明以 Dim 开始,结尾为 As VariableType (变量类型).
+
+ ' 此教程中,我们希望知道你的姓名,并让程序记录并输出。
+ Dim username As String
+ ' 我们定义username使用字符串类型(String)来记录用户姓名。
+ Console.WriteLine("Hello, What is your name? ") ' 询问用户输入姓名
+ username = Console.ReadLine() ' 存储用户名到变量 username
+ Console.WriteLine("Hello " + username) ' 输出将是 Hello + username
+ Console.ReadLine() ' 暂停屏幕并显示以上输出
+ ' 以上程序将询问你的姓名,并和你打招呼。
+ ' 其它变量如整型(Integer)我们用整型来处理整数。
+ End Sub
+
+ ' 三
+ Private Sub CalculatingWholeNumbers()
+ Console.Title = "Calculating Whole Numbers | Learn X in Y Minutes"
+ Console.Write("First number: ") ' 输入一个整数:1,2,50,104,等等
+ Dim a As Integer = Console.ReadLine()
+ Console.Write("Second number: ") ' 输入第二个整数
+ Dim b As Integer = Console.ReadLine()
+ Dim c As Integer = a + b
+ Console.WriteLine(c)
+ Console.ReadLine()
+ ' 以上程序将两个整数相加
+ End Sub
+
+ ' 四
+ Private Sub CalculatingDecimalNumbers()
+ Console.Title = "Calculating with Double | Learn X in Y Minutes"
+ ' 当然,我们还需要能够处理小数。
+ ' 只需要要将整型(Integer)改为小数(Double)类型即可。
+
+ ' 输入一个小数: 1.2, 2.4, 50.1, 104.9,等等
+ Console.Write("First number: ")
+ Dim a As Double = Console.ReadLine
+ Console.Write("Second number: ") ' 输入第二个数
+ Dim b As Double = Console.ReadLine
+ Dim c As Double = a + b
+ Console.WriteLine(c)
+ Console.ReadLine()
+ ' 以上代码能实现两个小数相加
+ End Sub
+
+ ' 五
+ Private Sub WorkingCalculator()
+ Console.Title = "The Working Calculator| Learn X in Y Minutes"
+ ' 但是如果你希望有个能够处理加减乘除的计算器呢?
+ ' 只需将上面代码复制粘帖即可。
+ Console.Write("First number: ") ' 输入第一个数
+ Dim a As Double = Console.ReadLine
+ Console.Write("Second number: ") ' 输入第二个数
+ Dim b As Integer = Console.ReadLine
+ Dim c As Integer = a + b
+ Dim d As Integer = a * b
+ Dim e As Integer = a - b
+ Dim f As Integer = a / b
+
+ ' 通过以下代码我们可以将以上所算的加减乘除结果输出到屏幕上。
+ Console.Write(a.ToString() + " + " + b.ToString())
+ ' 我们希望答案开头能有3个空格,可以使用String.PadLeft(3)方法。
+ Console.WriteLine(" = " + c.ToString.PadLeft(3))
+ Console.Write(a.ToString() + " * " + b.ToString())
+ Console.WriteLine(" = " + d.ToString.PadLeft(3))
+ Console.Write(a.ToString() + " - " + b.ToString())
+ Console.WriteLine(" = " + e.ToString.PadLeft(3))
+ Console.Write(a.ToString() + " / " + b.ToString())
+ Console.WriteLine(" = " + e.ToString.PadLeft(3))
+ Console.ReadLine()
+
+ End Sub
+
+ ' 六
+ Private Sub UsingDoWhileLoops()
+ ' 如同以上的代码一样
+ ' 这次我们将询问用户是否继续 (Yes or No?)
+ ' 我们将使用Do While循环,因为我们不知到用户是否需要使用一次以上。
+ Console.Title = "UsingDoWhileLoops | Learn X in Y Minutes"
+ Dim answer As String ' 我们使用字符串变量来存储answer(答案)
+ Do ' 循环开始
+ Console.Write("First number: ")
+ Dim a As Double = Console.ReadLine
+ Console.Write("Second number: ")
+ Dim b As Integer = Console.ReadLine
+ Dim c As Integer = a + b
+ Dim d As Integer = a * b
+ Dim e As Integer = a - b
+ Dim f As Integer = a / b
+
+ Console.Write(a.ToString() + " + " + b.ToString())
+ Console.WriteLine(" = " + c.ToString.PadLeft(3))
+ Console.Write(a.ToString() + " * " + b.ToString())
+ Console.WriteLine(" = " + d.ToString.PadLeft(3))
+ Console.Write(a.ToString() + " - " + b.ToString())
+ Console.WriteLine(" = " + e.ToString.PadLeft(3))
+ Console.Write(a.ToString() + " / " + b.ToString())
+ Console.WriteLine(" = " + e.ToString.PadLeft(3))
+ Console.ReadLine()
+ ' 询问用户是否继续,注意大小写。
+ Console.Write("Would you like to continue? (yes / no)")
+ ' 程序读入用户输入
+ answer = Console.ReadLine() ' added a bracket here
+ ' 当用户输入"yes"时,程序将跳转到Do,并再次执行
+ Loop While answer = "yes"
+
+ End Sub
+
+ ' 七
+ Private Sub UsingForLoops()
+ ' 有一些程序只需要运行一次。
+ ' 这个程序我们将实现从10倒数计数.
+
+ Console.Title = "Using For Loops | Learn X in Y Minutes"
+ ' 声明变量和Step (步长,即递减的速度,如-1,-2,-3等)。
+ For i As Integer = 10 To 0 Step -1
+ Console.WriteLine(i.ToString) ' 将计数结果输出的屏幕
+ Next i ' 计算新的i值
+ Console.WriteLine("Start")
+ Console.ReadLine()
+ End Sub
+
+ ' 八
+ Private Sub ConditionalStatement()
+ Console.Title = "Conditional Statements | Learn X in Y Minutes"
+ Dim userName As String = Console.ReadLine
+ Console.WriteLine("Hello, What is your name? ") ' 询问用户姓名
+ userName = Console.ReadLine() ' 存储用户姓名
+ If userName = "Adam" Then
+ Console.WriteLine("Hello Adam")
+ Console.WriteLine("Thanks for creating this useful site")
+ Console.ReadLine()
+ Else
+ Console.WriteLine("Hello " + userName)
+ Console.WriteLine("Have you checked out www.learnxinyminutes.com")
+ Console.ReadLine() ' 程序停止,并输出以上文本
+ End If
+ End Sub
+
+ ' 九
+ Private Sub IfElseStatement()
+ Console.Title = "If / Else Statement | Learn X in Y Minutes"
+ ' 有时候我们需要考虑多于两种情况。
+ ' 这时我们就需要使用If/ElesIf条件语句。
+ ' If语句就好似个自动售货机,当用户输入A1,A2,A3,等去选择物品时,
+ ' 所有的选择可以合并到一个If语句中
+
+ Dim selection As String = Console.ReadLine() ' 读入用户选择
+ Console.WriteLine("A1. for 7Up") ' A1 七喜
+ Console.WriteLine("A2. for Fanta") ' A2 芬达
+ Console.WriteLine("A3. for Dr. Pepper") ' A3 胡椒医生
+ Console.WriteLine("A4. for Diet Coke") ' A4 无糖可乐
+ Console.ReadLine()
+ If selection = "A1" Then
+ Console.WriteLine("7up")
+ Console.ReadLine()
+ ElseIf selection = "A2" Then
+ Console.WriteLine("fanta")
+ Console.ReadLine()
+ ElseIf selection = "A3" Then
+ Console.WriteLine("dr. pepper")
+ Console.ReadLine()
+ ElseIf selection = "A4" Then
+ Console.WriteLine("diet coke")
+ Console.ReadLine()
+ Else
+ Console.WriteLine("Please select a product") ' 请选择你需要的产品
+ Console.ReadLine()
+ End If
+
+ End Sub
+
+End Module
+
+```
+
+## 参考
+
+我(译注:原作者)在命令行下学习的VB。命令行编程使我能够更好的了解程序编译运行机制,并使学习其它语言变得容易。
+
+如果希望进一步学习VB,这里还有更深层次的 <a href="http://www.vbbootcamp.co.uk/" Title="VB教学">VB教学(英文)</a>。
+
+所有代码均通过测试。只需复制粘帖到Visual Basic中,并按F5运行即可。