Tutorial by Examples: c

Sometimes you doesn't want to simply replace or remove the string. Sometimes you want to extract and process matches. Here an example of how you manipulate matches. What is a match ? When a compatible substring is found for the entire regex in the string, the exec command produce a match. A match i...
Some regex engines (such as .NET) can handle context-free expressions, and will work it out. But that's not the case for most standard engines. And even if they do, you'll end up having a complex hard-to-read expression, whereas using a parsing library could make the job easier. How to find all p...
If you want to extract something from a webpage (or any representation/programming language), a regex is the wrong tool for the task. You should instead use your language's libraries to achieve the task. If you want to read HTML, or XML, or JSON, just use the library that parses it properly and ser...
By using the .HasKey() method, a set of properties can be explicitly configured as the composite primary key of the entity. using System.Data.Entity; // .. public class PersonContext : DbContext { // .. protected override void OnModelCreating(DbModelBuilder modelBuilder) {...
There are two common ways to encode a POST request body: URL encoding (application/x-www-form-urlencoded) and form data (multipart/form-data). Much of the code is similar, but the way you construct the body data is different. Sending a request using URL encoding Be it you have a server for your s...
GSP supports the usage of <% %> scriptlet blocks to embed Groovy code (this is discouraged): <html> <body> <% out << "Hello GSP!" %> </body> </html> You can also use the <%= %> syntax to output values, like in JSP: <htm...
A pointer is declared much like any other variable, except an asterisk (*) is placed between the type and the name of the variable to denote it is a pointer. int *pointer; /* inside a function, pointer is uninitialized and doesn't point to any valid object yet */ To declare two pointer variables...
"The :nth-child(an+b) CSS pseudo-class matches an element that has an+b-1 siblings before it in the document tree, for a given positive or zero value for n" - MDN :nth-child pseudo-selector12345678910:first-child✔:nth-child(3)✔:nth-child(n+3)✔✔✔✔✔✔✔✔:nth-child(3n)✔✔✔:nth-child(3n+1)...
Using alarm, user can schedule SIGALARM signal to be raised after specified interval. In case user did not blocked, ignored or specified explicit signal handler for this signal, the default action for this signal will be performed on arrival. Per specification default action for SIGALARM is to termi...
This program demonstrates how to run another process using fork() and wait its termination using waitpid(): fork() creates an identical copy of the current process. The original process is the parent process, while the newly created one is the child process. Both processes continue exactly afte...
To view all the implicits in-scope during a REPL session: scala> :implicits To also include implicit conversions defined in Predef.scala: scala> :implicits -v If one has an expression and wishes to view the effect of all rewrite rules that apply to it (including implicits): scala> ...
The ranges of the integer types are implementation-defined. The header <limits> provides the std::numeric_limits<T> template which provides the minimum and maximum values of all fundamental types. The values satisfy guarantees provided by the C standard through the <climits> and (&...
Since workers run in a separate thread from the one that created them, communication needs to happen via postMessage. Note: Because of the different export prefixes, some browsers have webkitPostMessage instead of postMessage. You should override postMessage to make sure workers "work" (n...
If a class, enum, inline function, template, or member of a template has external linkage and is defined in multiple translation units, all definitions must be identical or the behavior is undefined according to the One Definition Rule (ODR). foo.h: class Foo { public: double x; private...
The complete sample code for this application (Android + Node server) is available in the PayPal Developer Github repository. At this point the PayPal future payments button has been clicked, we have an auth code and metadata ID from the PayPal SDK, and we need to pass those on to our server to com...
The complete sample code for this application (Android + Node server) is available in the PayPal Developer Github repository. From step 2, an async request has been made to our server at the /fpstore endpoint, passing along the auth code and metadata ID. We now need to exchange those for a token in...
XSD schema (schema.xsd) The following xml schema (xsd) defines a list of users with attributes name and reputation. <?xml version="1.0"?> <xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns="http://www...
Review Partial Application before proceeding. In Haskell, a function that can take other functions as arguments or return functions is called a higher-order function. The following are all higher-order functions: map :: (a -> b) -> [a] -> [b] filter :: (a -> Bool) -> [a] ...
Lets say we have a class Classy that has property Propertua public class Classy { public string Propertua {get; set;} } to set Propertua using reflection: var typeOfClassy = typeof (Classy); var classy = new Classy(); var prop = typeOfClassy.GetProperty("Propertua"); prop.Se...
When editing text, a common task is to navigate to a particular word on the screen. In these examples we explore how we can navigate to the word updated. For the sake of consistency across the examples, we aim to land on the first letter of the word. Mid-screen jump M$B This approach is quick...

Page 381 of 826