The following C code uses the OpenMP parallel programming model to write the thread ID and number of threads to stdout using multiple threads.
#include <omp.h>
#include <stdio.h>
int main ()
{
#pragma omp parallel
{
// ID of the thread in the current team
...
DisplayName sets display name for a property, event or public void method having zero (0) arguments.
public class Employee
{
[DisplayName(@"Employee first name")]
public string FirstName { get; set; }
}
Simple usage example in XAML application
<Window x:Class="WpfA...
First of all we need to add SQLite support to our application. There are two ways of doing that
Download DLL suiting your system from SQLite download page and then add to the project manually
Add SQLite dependency via NuGet
We'll do it the second way
First open the NuGet menu
and search f...
You can use a method annotated with @testSetup to write code that will have been executed before each test run:
public class AccountService {
public static Account fetchAccount() {
return [ SELECT Id, Name FROM Account LIMIT 1 ];
}
}
@isTest
public class AccountServiceTest {
priv...
A model can also be added to the partial view :
@model Solution.Project.Namespace.MyModelClass
<p>@Model.Property</p>
In the View you can now just use:
<div>
@Html.Partial("PartialViewExample", new MyModelClass(){Property="my property value"})
<...
The starting point for the vast majority of charting code is to create an empty Chart. Note that this Chart is subject to the default chart template that is active and may not actually be empty (if the template has been modified).
The key to the ChartObject is determining its location. The syntax...
If a type t is Traversable then values of t a can be split into two pieces: their "shape" and their "contents":
data Traversed t a = Traversed { shape :: t (), contents :: [a] }
where the "contents" are the same as what you'd "visit" using a Foldable insta...
pyquery is a jquery-like library for python. It has very well support for css selectors.
from pyquery import PyQuery
html = """
<h1>Sales</h1>
<table id="table">
<tr>
<td>Lorem</td>
<td>46</td>
</tr>
&l...
Please note that continued use of Sublime Text requires that you purchase a license and you are asked to note the terms and conditions.
The process of installing Sublime Text is different for each platform, but in each case you need to visit the download page.
After installing ST3, it is common to...
However, x in the generator expression is not just variable, but can be any pattern. In cases of pattern mismatch the generated element is skipped over, and processing of the list continues with the next element, thus acting like a filter:
[x | Just x <- [Just 1, Nothing, Just 3]] -- [1, 3]
...
With Parallel List Comprehensions language extension,
[(x,y) | x <- xs | y <- ys]
is equivalent to
zip xs ys
Example:
[(x,y) | x <- [1,2,3] | y <- [10,20]]
-- [(1,10),(2,20)]
A tuple is a heterogeneous collection of two to twenty-two values. A tuple can be defined using parentheses. For tuples of size 2 (also called a 'pair') there's an arrow syntax.
scala> val x = (1, "hello")
x: (Int, String) = (1,hello)
scala> val y = 2 -> "world"
y:...
The TIMESTAMP column will show when the row was last updated.
CREATE TABLE `TestLastUpdate` (
`ID` INT NULL,
`Name` VARCHAR(50) NULL,
`Address` VARCHAR(50) NULL,
`LastUpdate` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
)
COMMENT='Last Update'
;
Code snippet:
import java.util.Set;
public class ThreadStatus {
public static void main(String args[]) throws Exception {
for (int i = 0; i < 5; i++){
Thread t = new Thread(new MyThread());
t.setName("MyThread:" + i);
t.start();
...
Sometimes you need to fetch data asynchronously before passing it to a child component to use. If the child component tries to use the data before it has been received, it will throw an error. You can use ngOnChanges to detect changes in a components' @Inputs and wait until they are defined before a...
If you need to add proxy of your network in a reboot-persistent way, edit:
sudo vim /etc/environment
Press i and after the row with PATH variable insert:
http_proxy=http://<proxy_server>:<port>/
https_proxy=http://<proxy_server>:<port>/
ftp_proxy=http://<proxy_serve...
Using the class below, we can connect to Exchange and then set a specific user's out of office settings with UpdateUserOof:
using System;
using System.Web.Configuration;
using Microsoft.Exchange.WebServices.Data;
class ExchangeManager
{
private ExchangeService Service;
public Exch...
x = np.random.random([100,100])
x.tofile('/path/to/dir/saved_binary.npy')
y = fromfile('/path/to/dir/saved_binary.npy')
z = y.reshape(100,100)
all(x==z)
# Output:
# True
Different approaches can be used to integrate FontAwesome into a website:
For plain HTML/CSS:
Download the zip available here, unzip, and copy the contents to your website. Then reference the /css/font-awesome.css in the webpage head like so:<link rel="stylesheet" src="/assets/...