Tutorial by Examples: c

Higher-order functions can be used to implement generic algorithms, giving up the responsibility of providing final details to the user. For instance List.sort expects a comparison function, which allows to implement various ways of sorting. Here we implement case-insensitive sorting of strings: le...
Higher-order functions can be used to ensure that system resources are disposed, even when a treatment raises an exception. The pattern used by with_output_file allows a clean separation of concerns: the higher-order with_output_file functions takes care of managing the system resources bound to fi...
The ls command has several options that can be used together to show more information. Details/Rights The l option shows the file permissions, size, and last modified date. So if the root directory contained a dir called test and a file someFile the command: user@linux-computer:~$ ls -l Would ...
Most modern distributions will come with BASH (Bourne Again SHell) pre-installed and configured as a default shell. The command (actually an executable binary, an ELF) that is responsible for changing shells in Linux is chsh (change shell). We can first check which shells are already installed and...
Observables are broadly categorised as Hot or Cold, depending on their emission behaviour. A Cold Observable is one which starts emitting upon request(subscription), whereas a Hot Observable is one that emits regardless of subscriptions. Cold Observable /* Demonstration of a Cold Observable */ Ob...
Setting only one style: $('#target-element').css('color', '#000000'); Setting multiple styles at the same time: $('#target-element').css({ 'color': '#000000', 'font-size': '12pt', 'float': 'left', });
To get an element's CSS property you can use the .css(propertyName) method: var color = $('#element').css('color'); var fontSize = $('#element').css('font-size');
A deadlock occurs when two competing actions wait for the other to finish, and thus neither ever does. In java there is one lock associated with each object. To avoid concurrent modification done by multiple threads on single object we can use synchronized keyword, but everything comes at a cost....
Once you have Sails installed, just type $ sails new <project_name> This will create a skeleton Sails project in a new folder called <project_name>. You can also create a new project in an empty folder by typing $ sails new
A region declared as a web application, as opposed to a web document. In this example, the application is a simple calculator that might add two numbers together. <div role="application"> <h1>Calculator</h1> <input id="num1" type="text"> +...
A section of a page that consists of a composition that forms an independent part of a document, page, or site. Setting an ARIA role and/or aria-* attribute that matches the default implicit ARIA semantics is unnecessary and is not recommended as these properties are already set by the browser....
A cell in a tabular container. <table> <thead> <!-- etc --> </thead> <tbody> <td role="cell">95</td> <td role="cell">14</td> <td role="cell">25</td> </tbody> </t...
A checkable input that has three possible values: true, false, or mixed. <p> <input type="checkbox" role="checkbox" aria-checked="false"> I agree to the terms </p>
A cell containing header information for a column. <table role="grid"> <thead> <tr> <th role="columnheader">Day 1</th> <th role="columnheader">Day 2</th> <th role="columnheader">Day ...
A presentation of a select; usually similar to a textbox where users can type ahead to select an option, or type to enter arbitrary text as a new item in the list. <input type="text" role="combobox" aria-expanded="false"> Typically, you would use JavaScript to...
A supporting section of the document, designed to be complementary to the main content at a similar level in the DOM hierarchy, but remains meaningful when separated from the main content. <div role="complementary"> <h2>More Articles</h2> <ul> <!-- ...
A large perceivable region that contains information about the parent document. <p role="contentinfo"> Author: Albert Einstein<br> Published: August 15, 1940 </p>
A list of references to members of a group, such as a static table of contents. <ul role="directory"> <li><a href="/chapter-1">Chapter 1</a></li> <li><a href="/chapter-2">Chapter 2</a></li> <li><a ...
A region containing related information that is declared as document content, as opposed to a web application. <div role="document"> <h1>The Life of Albert Einstein</h1> <p>Lorem ipsum...</p> </div>
A cell in a grid or treegrid. <table role="grid"> <thead> <!-- etc --> </thead> <tbody> <tr> <td role="gridcell">17</td> <td role="gridcell">64</td> <td role="gr...

Page 213 of 826