Tutorial by Examples

g$ The above matches one letter (the letter g) at the end of a string in most regex engines (not in Oniguruma, where the $ anchor matches the end of a line by default, and the m (MULTILINE) modifier is used to make a . match any characters including line break characters, as a DOTALL modifier in ...
my $filename = '/path/to/file'; open my $fh, '<', $filename or die "Failed to open file: $filename"; # You can then either read the file one line at a time... while(chomp(my $line = <$fh>)) { print $line . "\n"; } # ...or read whole file into an arra...
You can use subqueries to define a temporary table and use it in the FROM clause of an "outer" query. SELECT * FROM (SELECT city, temp_hi - temp_lo AS temp_var FROM weather) AS w WHERE temp_var > 20; The above finds cities from the weather table whose daily temperature variation i...
The following example finds cities (from the cities example) whose population is below the average temperature (obtained via a sub-qquery): SELECT name, pop2000 FROM cities WHERE pop2000 < (SELECT avg(pop2000) FROM cities); Here: the subquery (SELECT avg(pop2000) FROM cities) is used to s...
Subqueries can also be used in the SELECT part of the outer query. The following query shows all weather table columns with the corresponding states from the cities table. SELECT w.*, (SELECT c.state FROM cities AS c WHERE c.name = w.city ) AS state FROM weather AS w;
Ember CLI allows you to use one of two options to generate a new app: Create a folder and run ember init (generates application structure and sets up git and makes your first commit) Run ember new <app name> (creates a folder with the specified name, steps into it and runs ember init) O...
Elixir doesn't have loops. Instead of them for lists there are great Enum and List modules, but there are also List Comprehensions. List Comprehensions can be useful to: create new lists iex(1)> for value <- [1, 2, 3], do: value + 1 [2, 3, 4] filtering lists, using guard expressi...
NSArray *reversedArray = [myArray.reverseObjectEnumerator allObjects];
a = [1, 2, 3, true] Note that these are stored in memory as linked lists. Id est this is a series of cons cells where the head (List.hd/1) is the value of first item of the list and the tail (List.tail/1) is the value of the rest of the list. List.hd(a) = 1 List.tl(a) = [2, 3, true]
Maps are the Elixir key-value (also called dictionary or hash in other languages) type. You create a map using the %w{} syntax: %{} // creates an empty map %{:a => 1, :b => 2} // creates a non-empty map Keys and values can use be any type: %{"a" => 1, "b" => 2} ...
b = {:ok, 1, 2} Tuples are the equivalent of arrays in other languages. They are stored contiguously in memory.
CHICKEN is a Scheme interpreter and compiler with its own extension module system called "eggs". It is capable of compiling Scheme to native code by first compiling Scheme to C. Installing Debian or Ubuntu or other derived distros: sudo apt-get install chicken-bin Fedora / RHEL / Ce...
This is useful when you didn't store the PID from a previous command iex(1)> self() #PID<0.138.0> iex(2)> pid("0.138.0") #PID<0.138.0> iex(3)> pid(0, 138, 0) #PID<0.138.0>
Once connected you can publish messages by calling the ISubscriber.Publish method: // grab an instance of an ISubscriber var subscriber = connection.GetSubscriber(); // publish a message to the 'chat' channel subscriber.Publish("chat", "This is a message") Consumers can ...
You can broadcast more complex messages by serializing the payload before you publish it: // definition of a message public class ChatMessage { public Guid Id { get; set; } public string User { get; set; } public string Text { get; set; } } // grab an instance of an ISubscriber...
StackExchange.Redis also supports sending bytes over the pub/sub channel, here we use protobuf-net to serialize our message to a byte array before sending it: // definition of a message (marked up with Protobuf attributes) [ProtoContract] public class ChatMessage { [ProtoMember(1)] pub...
Property observers respond to changes to a property's value. var myProperty = 5 { willSet { print("Will set to \(newValue). It was previously \(myProperty)") } didSet { print("Did set to \(myProperty). It was previously \(oldValue)") } } m...
Users can add formatting to contenteditable documents or elements using their browser's features, such as common keyboard shortcuts for formatting (Ctrl-B for bold, Ctrl-I for italic, etc.) or by dragging and dropping images, links, or markup from the clipboard. Additionally, developers can use Jav...
Content has been moved back to good 'ol JSP wiki page
x<sub>2</sub> produces x2 x<sup>2</sup> produces x2

Page 196 of 1336