Tutorial by Examples: c

Matrices You must always use the amsmath package if you are going to use the following commands. There are four main types of matrix, as shown in the code below: \begin{matrix} a & b \\ c & d \end{matrix} \quad \begin{pmatrix} a & b \\ c & d \end{pmatrix} ...
Possible values are Continue | Ignore | Inquire | SilentlyContinue | Stop | Suspend. Value of this parameter will determine how the cmdlet will handle non-terminating errors (those generated from Write-Error for example; to learn more about error handling see [topic not yet created]). Default valu...
//Check if a value exists in settings already if (IsolatedStorageSettings.ApplicationSettings.Contains("Key")) { //perform logic }
By default, Jsoup will display only block-level elements with a trailing line break. Inline elements are displayed without a line break. Given a body fragment, with inline elements: <select name="menu"> <option value="foo">foo</option> <option va...
The gridspec package allows more control over the placement of subplots. It makes it much easier to control the margins of the plots and the spacing between the individual subplots. In addition, it allows for different sized axes on the same figure by defining axes which take up multiple grid loca...
This is a simple implementation of Binary Search Tree Insertion using Python. An example is shown below: Following the code snippet each image shows the execution visualization which makes it easier to visualize how this code works. class Node: def __init__(self, val): self.l_chil...
TikZ provides syntax similar to DOT which you can use to tighten up your graph drawing code considerably. \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{graphs,quotes,arrows.meta} \begin{document} \begin{tikzpicture} \graph[nodes={draw,circle},edges={-{Stealth[]}}] { ...
TikZ implements several algorithms for automatic graph layouts (requires LuaLaTeX). \documentclass{article} \usepackage{tikz} \usetikzlibrary{graphs,graphdrawing,quotes} \usegdlibrary{force} \begin{document} \begin{tikzpicture} \graph[spring layout] { A -> ["1"...
ls shows files and directories in present working directory. (if no arguments are passed.) (It doesn't show hidden files which starts with . by default.) user@ubuntu14:/usr$ ls bin games include lib lib32 local sbin share src To see all files (hidden files/folders also). Use ls -a OR l...
# Copy remote file to local dir scp [email protected]:/remote/path/to/foobar.md /local/dest # Copy local file to remote dir scp foobar.md [email protected]:/remote/dest # Key files can be used (just like ssh) scp -i my_key.pem foobar.md [email protected]:/remote/dest
SKAction: let waitForOneSecond = SKAction.waitForDuration(1) let action = SKAction.runBlock(){action()} let sequence = SKAction.sequence([waitForOneSecond,action]) self.runAction(sequence) NSTimer: NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: #selector(action), userInfo: nil,...
For simple multi-threaded code, using synchronization is acceptable. However, using synchronization does have a liveness impact, and as a codebase becomes more complex, the likelihood goes up that you will end up with Deadlock, Starvation, or Livelock. In cases of more complex concurrency, using A...
After installing Tomcat with apt-get on Ubuntu xx.xx, Tomcat creates and uses these directories: $cd /etc/tomcat6/ ├── Catalina │   └── localhost │   ├── ROOT.xml │   └── solr.xml -> ../../../solr/solr-tomcat.xml ├── catalina.properties ├── context.xml ├── logging.properties ├── ...
This type of Hook can be used to override core portal (e.g c/portal/login) and portlet struts actions (e.g /login/forgot_password), this actions for Liferay Portal are specified in a struts-config.xml file in its WEB-INF folder.To override an action: in liferay-hook.xml file of your hook plugin u...
case class Meter(meters: Double) extends AnyVal case class Gram(grams: Double) extends AnyVal Value classes provide a type-safe way to encode units, even if they require a bit more characters to use them: var length = Meter(3) var weight = Gram(4) //length = weight //type mismatch; found : Gr...
An alternative to forever on Linux is nohup. To start a nohup instance cd to the location of app.js or wwwfolder run nohup nodejs app.js & To kill the process run ps -ef|grep nodejs kill -9 <the process number>
h = 1.0 / n; #pragma omp parallel for private(x) shared(n, h) reduction(+:area) for (i = 1; i <= n; i++) { x = h * (i - 0.5); area += (4.0 / (1.0 + x*x)); } pi = h * area; In this example, each threads execute a subset of the iteration count. Each thread has its local private copy ...
h = 1.0 / n; #pragma omp parallel for private(x) shared(n, h, area) for (i = 1; i <= n; i++) { x = h * (i - 0.5); #pragma omp critical { area += (4.0 / (1.0 + x*x)); } } pi = h * area; In this example, each threads execute a subset of the iteration count and they accumul...
h = 1.0 / n; #pragma omp parallel for private(x) shared(n, h, area) for (i = 1; i <= n; i++) { x = h * (i - 0.5); #pragma atomic area += (4.0 / (1.0 + x*x)); } pi = h * area; In this example, each threads execute a subset of the iteration count and they accumulate atomically int...
h = 1.0 / n; #pragma omp parallel private(x) shared(n, h) { double thread_area = 0; // Private / local variable #pragma omp for for (i = 1; i <= n; i++) { x = h * (i - 0.5); thread_area += (4.0 / (1.0 + x*x)); } #pragma omp atomic ...

Page 510 of 826