This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% #1 | |
% Get last element from the list | |
% Explanation: | |
% Last element of list containing one element is the element | |
% Recursively call my_last on TAIL of the list, in rule head notice the underscore | |
% sign. We put it there because our rule body does not need to contain named | |
% reference to the list head - in other words, we don't care about it. | |
my_last(X, [X]). | |
my_last(X, [_|T]) :- my_last(X, T). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- When fed to XPath selects all URLs from HTML document | |
-- from within HTML attributes designated to hold URL | |
-- One-line version | |
"//a/@href | //applet/@codebase | //area/@href | //base/@href | //blockquote/@cite | //body/@background | //del/@cite | //form/@action | //frame/@src | //frame/@longdesc | //head/@profile | //iframe/@longdesc | //iframe/@url | //img/@longdesc | //img/@usemap | //input/@src | //input/@usemap | //ins/@cite | //object/@classid | //object/@codebase | //object/@data | //object/@usemap | //q/@cite | //img/@src | //link/@href | //source/@src | //embed/@src | //script/@src | //audio/@src | //button/@formaction | //command/@icon | //html/@manifest | //input/@formaction | //video/@poster | //video/@src" | |
-- Multi-line version (readable) | |
"//a/@href | |
| //applet/@codebase | |
| //area/@href | |
| //base/@href |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script type="text/javascript"> | |
// Identificator of span which display mode should be altered | |
var SPAN_IDENTIFICATION = 'elementident'; | |
function changeDisplayModeToBlock(elementId) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script type="text/javascript"> | |
// DOM Node Type ELEMENT (=> we are only interested in elements, we dont want (attributes/CDATA/etc.)) | |
var DOM_TYPE_ELEMENT = 1; | |
// TAG NAME of root element we want to use for DOM tree traversing | |
var ROOT_NODE_TAG_NAME = 'html'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Displays program's help screen | |
*/ | |
void showHelp () | |
{ | |
printf ("Ticket algorithm synchronization demo.\n\n"); | |
printf ("Usage: ./XXX N M\n\n"); | |
printf ("Creates N threads and simulates M number of total passes through critical section protected by ticket algorithm.\n\n"); | |
printf ("No other available options. Wrong parameters to the program shows this help.\n"); | |
} |
NewerOlder