[§257-2] Eligible individuals. (a) The income of the household of the individual development account holder shall not exceed eighty per cent of the area household median income.
(b) The individual shall enter into an individual development account agreement with a fiduciary organization. [L 1999, c 160, pt of §25]


{% extends 'base.html' %} {% block title %}Accessing Data{% endblock %} {% block content %}
All of the data produced during the cruise (by scientists and by the ship) are being stored on central servers, so that they are safely backed up and can be stored at the Swiss Polar Institute on a long-term basis after the cruise.
In addition to this, some supporting data from external sources such as weather forecasts and bathymetry data are also available FOR USE DURING THE CRUISE. Note that a lot of these additional datasets have strict licenses that must be adhered to.You are able to access all of these data by following some simple steps in the section, Data Access, below.
Below are descriptions of the different data areas:
ace_data - read only - all data collected on board the cruise are stored and backed up here. Organised by instrument.
external_data - read only - data from external sources that is of interest to parties on board. Includes terrain maps, satellite images and bathymetry of the islands we will visit.
intranet_documents - read only - a collection of useful and interesting documents. If you would like anything adding here, please speak to the Data Management team.
ship_data - read only - data streams that come from ship-based instruments: navigation (GPS), weather, multibeam, ADCP.
work_leg1 - read only - cruise report and photos from leg 1.
work_leg2 - read and write - please use this area to save things on which you are working that are related to the cruise, and that you would like backed up. Please put things in a folder named after your project, eg. project11, so we know to whom it belongs.  This area is also accessible by everyone so do not store any personal information here.
PHOTOS - If you would like to share your photos, please create a folder with your full name as the title and put this inside the photos directory. This is really important so people can give you acknowledgement for your images if they are re-used.
Connect to the ship's network using an ethernet cable. All cabins are connected to the network, as are some labs. If for some reason you find an ethernet port does not work, please report it to the Data Management team with the room and port number, i.e. Room 336, port XS30/BT.
You should now have access to the ACE intranet as well as the data storage area.
The data storage is accessible using SAMBA/CIFS protocol and the hostname is storage.lan.
It could be accessed using the application Dolphin or mounting it:
mkdir /mnt/ace_data # this is needed only once sudo mount -t cifs //storage.lan/ace_data /mnt/ace_data
Come and see the Data Management team if you have problems - each Linux distribution will be a bit different.
Go to Finder (on the Mac toolbar usually the left icon). Sometimes ACE-storage will appear on the left-hand side. If not, open the menu "Go" and then "Connect to server".
Type smb://storage.lan and you can add this to a list of favourites by clicking on the + button next to where you enter this address. Select whichever area you need and double click: it will open in the file browser.
**If you need any help please pop along to the Expedition Office at any time. We sometimes have chocolates....**
You will find a set of bathymetry data, satellite images and terrain maps for the island work. These are generally sorted by the island names, but for larger providers, there could be data for different areas within the provider name (eg. GEBCO). A lot of these datasets come with license agreements and citations which you will hopefully find within the relevant folders in txt or html files. PLEASE observe these licenses and obtain your own copy of the data when back on dry land if necessary.
The ship's meteorological data can be found here in daily text files. Each file contains a set of data that are recorded every 30 seconds, and another set that are recorded every 3 seconds. The headers are different so be aware if trying to parse the files.
Data are now in the database but are also available in csv files.
Two sources of GPS data are being brought into this data area in daily files which are updated live. These data are already stored in the database and can be fed into some mapping software so you can see the position of the ship live. The data are collected with a 1-second resolution but the data management team can easily output this in a different resolution if required, just ask. Finally, at the end of each leg, a JPEG of the track and a CSV file with positions will be provided in the intranet documents section.
We have an NMEA relay software: if you want to connect your mapping software (e.g. OpenCPN or others) let us know and we will provide the connection details.
Csv files of the track have been output in different resolutions: 1sec, 1min, 5 mins and 1 hour. These are available on the intranet as well as here.
Multibeam data collected by the ship, are stored here. A small amount of the data have been processed but the majority is raw.
Data from the ship's ADCP are being stored in this data area.
Last updated 23rd Jan 2017 JT
{% endblock %}


To import a CoreData model:
Connect to your database server
- Enter the database server’s address and port number, or pick a PostgreSQL server using the Bonjour pop-up menu.
- Enter the database name and your user account details.
Choose File → Import Data Model… ⌘O, and select an .xcdatamodel file.
Choose which entities you want to import.
In case your data model has different configurations, you have the option to select the one from which you'd like to import the entities.
If you want the tables to be placed in some other schema than public, enter its name in the Schema Name field.
Clicking Dry Run will output the SQL statements in the Log window before actually sending them to the database.
Install the BaseTen schema.
If the database does not have the BaseTen supporting schema installed the assistant will offer to install it. The schema provides support needed for Postgres to notify the framework of changes to data in a similar manner to Key/Value Observing.
Review model compiler errors.
BaseTen Assitant will inform you of any errors it found while compiling your model file. You can cancel the operation to resolve the errors manually, or press Continue and allow the assistant to attempt to resolve them automatically.


Filter all Pathfinder spells by name, class, level, and school.
Filter all Pathfinder feats by name, prerequisites, type, and source.
Keep track of combat initiative for players and monsters, as well as health and status conditions. Change initiative order on the fly by reordering the list, and keep track of the creature currently taking its turn by using the Advance button.
Add dice to the pool, enter a modifier, and click Roll Dice to auto-generate a random result.
Generate a formatted index card with all the stats for whatever you need: monsters, spells, items, and more.
My group is getting ready to start the Rise of the Runelords Adventure Path this coming November. I'll be updating this page with our progress once we begin.


GDAK
-
Real-Time Public Transportation Map of Gdansk, Poland
See most current buses and trams positions on the map in real time
OPEN MAP
OPEN MAP
GDAK
❯
Updated:


If you wish to use any of the material from this report please cite as:
This work is (c) 2018 the University of Southampton.
Report circulation:
This report is intended to:
This work was supported by:
We do not ‘support’ the code but if you have a problem check the issues on our repo and if it doesn’t already exist, open one. We might be able to fix it :-)
To …
here
go here
Analysis completed in 0.69 seconds ( 0.01 minutes) using knitr in RStudio with R version 3.5.0 (2018-04-23) running on x86_64-apple-darwin15.6.0.
R packages used:
Session info:
## R version 3.5.0 (2018-04-23)
## Platform: x86_64-apple-darwin15.6.0 (64-bit)
## Running under: macOS High Sierra 10.13.5
##
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
##
## locale:
## [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] knitr_1.20 skimr_1.0.3 readr_1.1.1 ggplot2_2.2.1
## [5] dplyr_0.7.5 data.table_1.11.2
##
## loaded via a namespace (and not attached):
## [1] Rcpp_0.12.17 pillar_1.2.2 compiler_3.5.0
## [4] plyr_1.8.4 bindr_0.1.1 prettyunits_1.0.2
## [7] tools_3.5.0 progress_1.1.2 digest_0.6.15
## [10] lubridate_1.7.4 evaluate_0.10.1 tibble_1.4.2
## [13] gtable_0.2.0 pkgconfig_2.0.1 rlang_0.2.0
## [16] yaml_2.1.19 bindrcpp_0.2.2 stringr_1.3.1
## [19] hms_0.4.2 rprojroot_1.3-2 grid_3.5.0
## [22] tidyselect_0.2.4 glue_1.2.0 R6_2.2.2
## [25] rmarkdown_1.9 purrr_0.2.4 reshape2_1.4.3
## [28] magrittr_1.5 backports_1.1.2 scales_0.5.0
## [31] htmltools_0.3.6 nzGREENGrid_0.1.0 assertthat_0.2.0
## [34] colorspace_1.3-2 stringi_1.2.2 lazyeval_0.2.1
## [37] munsell_0.4.3
Csárdi, Gábor, and Rich FitzJohn. 2016. Progress: Terminal Progress Bars. https://CRAN.R-project.org/package=progress.
Dowle, M, A Srinivasan, T Short, S Lianoglou with contributions from R Saporta, and E Antonyan. 2015. Data.table: Extension of Data.frame. https://CRAN.R-project.org/package=data.table.
Grolemund, Garrett, and Hadley Wickham. 2011. “Dates and Times Made Easy with lubridate.” Journal of Statistical Software 40 (3): 1–25. http://www.jstatsoft.org/v40/i03/.
R Core Team. 2016. R: A Language and Environment for Statistical Computing. Vienna, Austria: R Foundation for Statistical Computing. https://www.R-project.org/.
Wickham, Hadley. 2009. Ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York. http://ggplot2.org.
Wickham, Hadley, and Romain Francois. 2016. Dplyr: A Grammar of Data Manipulation. https://CRAN.R-project.org/package=dplyr.
Wickham, Hadley, Jim Hester, and Romain Francois. 2016. Readr: Read Tabular Data. https://CRAN.R-project.org/package=readr.
Xie, Yihui. 2016. Knitr: A General-Purpose Package for Dynamic Report Generation in R. https://CRAN.R-project.org/package=knitr.


3. Configuration¶
The Configuration of cloudmesh is controled with a yaml file that is placed in
~/.clloudmesh/cloudmesh4.yaml
. It is created automatically from the templace
located at
You can customize the file in your local directory.
3.1. MongoDB¶
The cache of cloudmesh is managed in a mongo db database with various collections. However the user does not have to manage thes collections as this is done for the user through cloudmesh. Before you can use it it mongo does need to be installed.
If you have not installed mongo, you may try
$ cms admin mongo install
Next you create the database template with authentication with
$ cms admin mongo create
Now you are ready to use it in cloudmesh. The mongo db can be started and stoped with the command
$cms admin mongo start
$cms admin mongo stop
The configuration detals are included in the yaml file.
3.2. Compute Cloud Providers¶
The default yaml file includes templates to configure various clouds. YOu can change these defaults and provide access to your cloud credentials to make the management of cloud virtual machines easier. Templates for AWS, Azure, Google, OpenStack are provided. Specific templates for Jetstream and Chameleopn cloud are included in the example cloudmesh4.yaml. We list each template next.
3.2.1. AWS¶
It is beyond the scope of this manual to discuss how to get an account on Aws. However we do provide a convenient documentation at
cloudmesh:
...
cloud:
...
aws:
cm:
active: False
heading: AWS
host: aws.amazon.com
label: aws
kind: aws
version: TBD
default:
image: 'ami-0f65671a86f061fcd'
size: 't2.micro'
credentials:
region: 'us-west-2'
EC2_SECURITY_GROUP: 'group1'
EC2_ACCESS_ID: TBD
EC2_SECRET_KEY: TBD
EC2_PRIVATE_KEY_FILE_PATH: '~/.cloudmesh/aws_cert.pem'
EC2_PRIVATE_KEY_FILE_NAME: 'aws_cert'
3.2.2. Azure¶
It is beyond the scope of this manual to discuss how to get an account on Azure. However we do provide a convenient documentation at
cloudmesh:
...
cloud:
...
azure:
cm:
active: False
heading: AWS
host: azure.mocrosoft.com
label: Azure
kind: azure_arm
version: TBD
default:
image: 'Canonical:UbuntuServer:16.04-LTS:latest'
size: 'Basic_A0'
resource_group: 'cloudmesh'
storage_account: 'cmdrive'
network: 'cmnetwork'
subnet: 'cmsubnet'
blob_container: 'vhds'
credentials:
AZURE_TENANT_ID: 'xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
AZURE_SUBSCRIPTION_ID: 'xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
AZURE_APPLICATION_ID: 'xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
AZURE_SECRET_KEY: TBD
AZURE_REGION: 'northcentralus'
3.2.3. AZ¶
cloudmesh
...
cloud:
...
az:
cm:
active: False
heading: AWS
host: azure.mocrosoft.com
label: Azure
kind: azure
version: TBD
default:
image: 'Canonical:UbuntuServer:16.04-LTS:latest'
size: 'Basic_A0'
resource_group: 'cloudmesh'
storage_account: 'cmdrive'
network: 'cmnetwork'
credentials:
resourcegroup: "test"
location: "eastus"
3.2.4. Google¶
It is beyond the scope of this manual to discuss how to get an account on Google. However we do provide a convenient documentation at
cloudmesh:
...
cloud:
...
google:
cm:
active: True
heading: google
host: google.cloud.com
label: google
kind: google
version: TBD
default:
image: 'Image Name'
size: 'n1-standard-4'
credentials:
datacenter: 'us-central1-a'
client_email: '<service account>.iam.gserviceaccount.com'
project: '<Project Name>'
path_to_json_file: '~/.cloudmesh/<file with credentials>'
3.2.5. OpenStack¶
We provide an example on how to use an OpenStack based cloud in cloudmesh.
Please ass the following to your cloudmesh4.yaml
file and replace the values
for TBD
. Our example uses Chameleon Cloud.
This is a cloud for academic research. Certainly you can configure other clouds
based on this template. We have successfully used also clouds in Canada
(Cybera), Germany (KIT), Indiana University (jetstream). TO get started you can
even install your local cloud with devstack and make adjustements. Please
remember you can have multiple clouds in the cloudmesh4.yaml
file so you could
if you have access to them integrate all of them.
Example for chameleon cloud:
You will need access to a project and add your project nump=ber to the credentials.
cloudmesh:
...
cloud:
...
chameleon:
cm:
active: True
heading: Chameleon
host: chameleoncloud.org
label: chameleon
kind: openstack
version: liberty
credentials:
OS_AUTH_URL: https://openstack.tacc.chameleoncloud.org:5000/v2.0/tokens
OS_USERNAME: TBD
OS_PASSWORD: TBD
OS_TENANT_NAME: CH-819337
OS_TENANT_ID: CH-819337
OS_PROJECT_NAME: CH-819337
OS_PROJECT_DOMAIN_ID: default
OS_USER_DOMAIN_ID: default
OS_VERSION: liberty
OS_REGION_NAME: RegionOne
OS_KEY_PATH: ~/.ssh/id_rsa.pub
default:
flavor: m1.small
image: CC-Ubuntu16.04
username: cc
3.2.6. Virtual Box¶
Virtualbox has at this time limited functionality, but creation, ssh, and deletion of the virtual box is possible.
You can also integrate virtualbox as part of cloudmesh while providing the following description:
cloudmesh:
...
cloud:
...
vbox:
cm:
active: False
heading: Vagrant
host: localhost
label: vbox
kind: vagrant
version: TBD
default:
path: ~/.cloudmesh/vagrant
image: "generic/ubuntu1810"
credentials:
local: True
hostname: localhost
3.2.7. SSH¶
STUDENT CONTRIBUTE HERE
3.2.8. Local¶
STUDENT CONTRIBUTE HERE
3.2.9. Docker¶
STUDENT CONTRIBUTE HERE
3.3. Storage Providers¶
General description for all storage providers, comment on the default:
and
what that does
3.3.1. AWS S3¶
It is beyond the scope of this manual to discuss how to get an account on Google. However we do provide a convenient documentation at
In the cloudmesh4.yaml
file, the ‘aws’ section under ‘storage’ describes an
example configuration or a AWS S3 storage provider. In the credentials section
under aws, specify the access key id and secret access key which will be
available in the AWS console under AWS IAM service
-> Users
-> Security Credentials
. Container is the default Bucket which will be used to store the
files in AWS S3. Region is the geographic area like us-east-1
which contains
the bucket. Region is required to get a connection handle on the S3 Client or
resource for that geographic area. Here is a sample.
TODO: Make credentials more uniform between compute and data
storage:
aws:
cm:
heading: aws
host: amazon.aws.com
label: aws
kind: awsS3
version: TBD
default:
directory: /
credentials:
access_key_id: *********
secret_access_key: *******
container: name of bucket that you want user to be contained in.
region: Specfiy the default region eg us-east-1
3.3.2. Azure¶
It is beyond the scope of this manual to discuss how to get an account on Google. However we do provide a convenient documentation at
The cloudmesh4.yaml
file needs to be set up as follows for the ‘azureblob’
section under ‘storage’.
cloudmesh:
.........
storage:
azureblob:
cm:
heading: Azure
host: azure.com
label: Azure
kind: azureblob
version: TBD
default:
directory: /
credentials:
account_name: '*****************'
account_key: '********************************************************************'
container: 'azuretest'
Configuration settings for credentials in the yaml file can be obtained from Azure portal.
TODO: MOre information via a pointer to a documentation you create needs to be added here
In the yaml file the following values have to be changed
account_name
- This is the name of the Azure blob storage account.account_key
- This can be found under ‘Access Keys’ after navigating to the storage account on the Azure portal.container
- This can be set to a default container created under the Azure blob storage account.
3.3.3. Google drive¶
Due to bugs in the requirements of the google driver code, we have not yet included it in the Provider code. This needs to be fixed before we can do this.
The cloudmesh4.yaml
file needs to be set up as follows for the ‘gdrive’
section under ‘storage’.
storge:
gdrive:
cm:
heading: GDrive
host: gdrive.google.com
kind: gdrive
label: GDrive
version: TBD
credentials:
auth_host_name: localhost
auth_host_port:
- ****
- ****
auth_provider_x509_cert_url: "https://www.googleapis.com/oauth2/v1/certs"
auth_uri: "https://accounts.google.com/o/oauth2/auth"
client_id: *******************
client_secret: ************
project_id: ************
redirect_uris:
- "urn:ietf:wg:oauth:2.0:oob"
- "http://localhost"
token_uri: "https://oauth2.googleapis.com/token"
default:
directory: TBD
3.3.4. Box¶
It is beyond the scope of this manual to discuss how to get an account on Google. However we do provide a convenient documentation at
In the cloudmesh4.yaml
file, find the ‘box’ section under ‘storage’. Under
credentials, set config_path
to the path of the configuration file you created
as described in the Box chapter:
box:
cm:
heading: Box
host: box.com
label: Box
kind: box
version: TBD
default:
directory: /
credentials:
config_path: ******************************
3.3.5. ADD OTHERS IF MISSING¶
3.4. Object Store¶
3.5. Batch¶
3.6. REST¶
TBD
3.7. Log File (proposed)¶
THIS FEATURE IS NOT YET SUPPORTED
Log files are stored by default in ~/.cloudmesh/log
The directory can be
specified in the yaml file.


Network(addressPrefix: String)
Encapsulates information about blockchain network
addressPrefix - prefix for work with address org.echo.mobile.framework.model.Address
addressPrefix
Author Daria Pechkovskaya


Files
The file system features in NETMF are very similar to full .NET. There are no limits on file counts or sizes other than the limits of the FAT file system itself. NETMF supports FAT16 and FAT32.
With a few minor changes, NETMF file system access can be tested from within the Microsoft NETMF emulator. Changes include removing any of the GHI library dependencies.
Unlike full .NET, NETMF does require mounting of media. NETMF also handles media names differently than full .NET. Media name differences are easily handled by accessing the root directory name at runtime and then using that name. Consequently, most online examples of how to use .NET to access files on PCs can be used with NETMF. In NETMF, other than differences for specific physical characteristics, usage of SD/MMC cards and USB memory devices are identical to .NET.
This document splits it's examples into two sets. One for SD/MMC Card file system access and the other for USB Mass Storage. The core file operations (open, read, write, etc.) are identical between the two.
Warning
The file system does a lot of data buffering internally to speed up file access time and to increase the life of flash media. When you write data to a file, it is often saved somewhere in internal buffers rather than being written immediately to the media. To make sure the data is stored on the media, you need to flush the data.
Flushing (or closing) a file is the only way to guarantee that the data you are trying to write is on the actual media. In addition to the file data there is other information, such as directory information, that may not be written to the media when the file is flushed. For example, if you delete a file and remove the card from the system, the file is probably not actually erased because the directory structure was not flushed.
Under current versions of .NET Micro Framework, there can be a variable time delay before the buffers are actually written to the media when using the FileStream's Flush method. This delay can reportedly be as long as a minute (see: https://netmf.codeplex.com/workitem/2149). To guarantee that the file buffers and the meta-data are written to the media you need to flush the volume:
VolumeInfo.GetVolumes()[0].FlushAll()
-or-Microsoft.SPOT.IO.VolumeInfo("\SD").FlushAll()
.
Ideally, you would unmount the media before it is removed from the system. This may not be always possible -- FlushAll will guarantee your data is saved
Tip
The SD/MMC Card examples shown below require the GHI.Hardware, Microsoft.SPOT.IO, and System.IO assemblies.
Some Microsoft documentation class descriptions, such as for Directory, place the library code in the mscorlib assembly; however, it is found in the System.IO assembly.
SD Card: Show Files in Root Directory
This example assumes the card is already inserted; it lists all files available in the root directory.
Note
Some SD card sockets/interfaces have an internal switch that closes when a card is inserted or ejected. Utilizing the switch is shown in the "SD Card: Media Detection" example further down on this page.
using System.IO;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using Microsoft.SPOT.IO;
using GHI.IO;
using GHI.IO.Storage;
class Program {
public static void Main() {
// ...
// assume SD card is inserted
// Create a new storage device
// NETMF only allows one SD card
// to be supported at a time.
SDCard sd_card = new SDCard();
// this is a non-blocking call
// it fires the RemovableMedia.Insert event after
// the mount is finished.
sd_card.Mount();
// for some cases, a simple sleep might suffice
// This example just waits on the event before proceeding
// (After first time firing of the event, you may want
// to disable the handler or re-assign it
bool fs_ready = false;
RemovableMedia.Insert += (a, b) => {
fs_ready = true;
};
while (! fs_ready) {
System.Threading.Thread.Sleep(50);
}
// Assume one storage device is available, access it through
// NETMF and display the available files and folders:
Debug.Print("Getting files and folders:");
if (VolumeInfo.GetVolumes()[0].IsFormatted) {
string rootDirectory = VolumeInfo.GetVolumes()[0].RootDirectory;
string[] files = Directory.GetFiles(rootDirectory);
string[] folders = Directory.GetDirectories(rootDirectory);
Debug.Print("Files available on " + rootDirectory + ":");
for (int i = 0; i < files.Length; i++)
Debug.Print(files[i]);
Debug.Print("Folders available on " + rootDirectory + ":");
for (int i = 0; i < folders.Length; i++)
Debug.Print(folders[i]);
}
else {
Debug.Print("Storage is not formatted. " +
"Format on PC with FAT32/FAT16 first!");
}
// Unmount when done
sd_card.Unmount();
}
}
SD Card: Writing Files
There is more than one way to open files. I will only cover FileStream objects. This example will open a file and write a string to it. Since FileStream will only take byte arrays, we need to convert our string to a byte array.
using System.Threading;
using System.Text;
using Microsoft.SPOT;
using System.IO;
using Microsoft.SPOT.IO;
using GHI.IO.Storage;
public class Program {
static void Main() {
// if necessary, check that SD is present here...
SDCard sd_card = new SDCard();
sd_card.Mount();
bool fs_ready = false;
RemovableMedia.Insert += (a, b) => {
fs_ready = true;
};
while (! fs_ready ) {
System.Threading.Thread.Sleep(1);
}
// Assume only one storage device is available
// and that the media is formatted
string rootDirectory = VolumeInfo.GetVolumes()[0].RootDirectory;
FileStream FileHandle = new FileStream(rootDirectory +
@"\hello.txt", FileMode.Create);
byte[] data =
Encoding.UTF8.GetBytes("This string will go in the file!");
FileHandle.Write(data, 0, data.Length);
FileHandle.Close();
sd_card.Unmount();
}
}
SD Card: Reading a File
Take the SD Card used in the last example, put it in a PC and you will see the file. For this example, we use the same SD Card written to by the last example. The file is opened and read to verify its contents.
using System.Threading;
using System.Text;
using Microsoft.SPOT;
using System.IO;
using Microsoft.SPOT.IO;
using GHI.IO.Storage;
public class Program {
static void Main() {
// ... If desired, check if SD is inserted
// SD Card is inserted
// Create a new storage device
SDCard sd_card = new SDCard();
// Mount the file system
sd_card.Mount();
bool fs_ready = false;
RemovableMedia.Insert += (a, b) => {
fs_ready = true;
};
while (!fs_ready) {
System.Threading.Thread.Sleep(1);
}
// Assume one storage device is available,
// access it through NETMF
string rootDirectory = VolumeInfo.GetVolumes()[0].RootDirectory;
FileStream FileHandle = new FileStream(rootDirectory +
@"\hello.txt", FileMode.Open, FileAccess.Read);
byte[] data = new byte[100];
int read_count = FileHandle.Read(data, 0, data.Length);
FileHandle.Close();
Debug.Print("The size of data read is: " +
read_count.ToString());
Debug.Print("Data from file:");
Debug.Print(new string(Encoding.UTF8.GetChars(data), 0, read_count));
sd_card.Unmount();
}
}
SD Card: Media Detection
The previous examples assumed that the card was already inserted and mostly ignored whether that media was formatted (contained a file system). The following example shows an application without such assumptions; additionally, it demonstrates the Format method.
Together, InsertEventHandler
, EjectEventHandler
, and IsSDCardPresent
are used to respond to physical card activities, which in turn are used to control mounting (Mount
, Unmount
) of the card. Once the card is mounted, the file-system can be used.
using System;
using System.IO;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.IO;
using GHI.IO.Storage;
public class Program
{
// evt is used to avoid the possibility that accesses to the
// mounted file system do not occur until mount()
// is fully done.
private static AutoResetEvent evt = new AutoResetEvent(false);
//Make sure to set the pin to your sd card detect pin.
private static InputPort sdCardDetect = new InputPort(Cpu.Pin.GPIO_NONE, false, Port.ResistorMode.Disabled);
public static void Main() {
RemovableMedia.Insert += new InsertEventHandler(RemovableMedia_Insert);
RemovableMedia.Eject += new EjectEventHandler(RemovableMedia_Eject);
// Start auto mounting thread
new Thread(SDMountThread).Start();
evt.WaitOne(); // yield here until mounting and initializing is finished
// Your program goes here
// ...
}
// This event is fired by unmount; not neccesarily by physical ejection of media
static void RemovableMedia_Eject(object sender, MediaEventArgs e) {
Debug.Print("SD card unmounted, eject event fired");
// as desired signal other thread(s) in application
// that unmount occurred
}
static void RemovableMedia_Insert(object sender, MediaEventArgs e) {
Debug.Print("Insert event fired; SD card mount is finished.");
// insert code here for anything the program wants to do immediately
// after mounting occurs...
if (e.Volume.IsFormatted) {
Debug.Print("Available folders:");
string[] strs = Directory.GetDirectories(e.Volume.RootDirectory);
for (int i = 0; i < strs.Length; i++)
Debug.Print(strs[i]);
Debug.Print("Available files:");
strs = Directory.GetFiles(e.Volume.RootDirectory);
for (int i = 0; i < strs.Length; i++)
Debug.Print(strs[i]);
}
else {
Debug.Print("SD card is not formatted. Formatting...");
// VolumeInfo is the class that contains volume information for a specific
// media.
// .GetVolumes()[0] aquires the first volume on the device. Change the
// index for different volumes.
// .Format("FAT", 0); Selects the "FAT" file system as the format type.
VolumeInfo.GetVolumes()[0].Format("FAT", 0);
}
evt.Set(); // proceed with other processing
}
public static void SDMountThread() {
SDCard SD = null;
const int POLL_TIME = 500; // check every 500 millisecond
bool sdExists;
while (true) {
try { // If SD card was removed while mounting, it may throw exceptions.
sdExists = sdCardDetect.Read();
// make sure it is fully inserted and stable
if (sdExists) {
Thread.Sleep(50);
sdExists = sdCardDetect.Read();
}
if (sdExists && SD == null) {
SD = new SDCard();
SD.Mount();
}
else if (!sdExists && SD != null) {
SD.Unmount();
SD.Dispose();
SD = null;
}
}
catch {
if (SD != null) {
SD.Dispose();
SD = null;
}
}
Thread.Sleep(POLL_TIME);
}
}
}
USB Mass Storage Devices
USB mass storage devices, such as memory sticks and card readers are supported by GHI's NETMF devices. If you compare the following example with those above for SD Cards, you will see how easy it is to program for one, the other, or both with virtually identical code.
using System;
using System.Threading;
using System.IO;
using Microsoft.SPOT;
using System.Text;
using Microsoft.SPOT.IO;
using GHI.Usb;
using GHI.Usb.Host;
using GHI.IO.Storage;
public class Program {
// evt is used to avoid the possibility that accesses to the
// mounted file system do not occur until mount()
// is fully done.
private static AutoResetEvent evt = new AutoResetEvent(false);
private static MassStorage usb_storage;
private static string rootDirectory;
public static void Main() {
RemovableMedia.Insert += new InsertEventHandler(RemovableMedia_Insert);
RemovableMedia.Eject += new EjectEventHandler(RemovableMedia_Eject);
// Unlike SD Card detection, the USB Host Controller sends an
// event when a Mass Storage device is plugged-in.
Controller.MassStorageConnected += (sender, massStorage) => {
usb_storage = massStorage;
usb_storage.Mount(); // fires the insert event when finished
};
Controller.Start();
evt.WaitOne(); // yield here until mounting and initializing is finished
byte[] data;
// write
using (var FileHandle = new FileStream(rootDirectory +
@"\hello.txt", FileMode.Create)) {
data =
Encoding.UTF8.GetBytes("This string will go in the file!");
FileHandle.Write(data, 0, data.Length);
}
// read
int read_count;
using (var FileHandle = new FileStream(rootDirectory +
@"\hello.txt", FileMode.Open, FileAccess.Read)) {
data = new byte[100];
read_count = FileHandle.Read(data, 0, data.Length);
}
Debug.Print("The size of data we read is: " +
read_count.ToString());
Debug.Print("Data from file:");
Debug.Print(new string(Encoding.UTF8.GetChars(data), 0,
read_count));
usb_storage.Unmount();
}
// This event is fired by unmount
static void RemovableMedia_Eject(object sender, MediaEventArgs e) {
Debug.Print("USB unmounted, eject event fired");
}
static void RemovableMedia_Insert(object sender, MediaEventArgs e) {
Debug.Print("Insert event fired; USB Storage mount is finished.");
if (e.Volume.IsFormatted) {
rootDirectory = e.Volume.RootDirectory;
Debug.Print("Available folders:");
string[] strs = Directory.GetDirectories(e.Volume.RootDirectory);
for (int i = 0; i < strs.Length; i++)
Debug.Print(strs[i]);
Debug.Print("Available files:");
strs = Directory.GetFiles(e.Volume.RootDirectory);
for (int i = 0; i < strs.Length; i++)
Debug.Print(strs[i]);
}
else {
Debug.Print("Media is not formatted. Formatting...");
e.Volume.Format("FAT", 0);
rootDirectory = e.Volume.RootDirectory;
}
evt.Set(); // proceed with other processing
}
}
Warning
Media formatted as FAT12 will not work. This shouldn't be an issue since FAT12 is no longer in use.


| DOSE: T+ 0:00 |
5 hits |
oral |
LSD |
| T+ 7:00 |
2 bowls |
smoked |
Cannabis |
This is a recollection of the first time a trip went bad for me. I had tripped before several times (once even taking 8 hits) and I had done fine. Acid visuals were always something that I could control and the trip never took me into places I didn't want to go. I took five hits at 5:00 P.M. and proceeded to have a very excellent trip. At midnight I got home from going out to eat with my friends, and I was looking for a quick way to get to sleep so I smoked two bowls. My intentions were to see what it was like smoking while on LSD, and then fall promptly to sleep. That was definitely not what happened.
The first time I lost reality I was gone before I even realized it. I had fallen down on my bed to go to sleep, and let the closed-eye visuals take me where they wanted.  The visuals had turned into a full-screen movie that played over and over as I tried to focus on my surroundings. I saw people from my past doing things that I had seen them do, random tasks, but they wouldn't stop and I began to get afraid. Not only was I seeing these movie images, but I had this out-of-body feeling like I was lying on them and looking down at them. I noticed that in the there was supposed to a pillow in the place my eyes were currently focused on, and I was filled with this feeling of horror at not being able to see it. At that point I could feel myself on the precipice between sanity and insanity, and falling fast. I began mumbling to myself 'Where's my pillow, it's supposed to be here, where is it?'.
All this was happening so fast that I thought I could lose myself before I had a chance to think. Thoughts were blurring through my head at speeds I had never known. For some reason saying the word 'pillow' had the effect of crystalizing the pillow, allowing me to see it without the movie-visuals taking me away again. This helped a lot, so I began repeating the words 'That's my pillow, I can see it, it's a pillow' over and over again. Then I saw my dresser, recognised it, and repeated it's name over and over. For some reason the repetition of the names of physical objects really anchored me to reality, so I began wandering through the house, speaking the names of things and thinking about that their uses were. For some reason when I was tripping and beginning to lose it, remembering trivial data from my life helped a lot. I ate 20 Oreos merely because I had thought about eating Oreos earlier, and 'earlier' at that time meant 'sane' to me.
Another thing I am grateful for is music. If I had not put a Led Zeppelin CD on repeat as soon as I realized I was having a bad trip, I don't know if I would have been able to contain myself. The music was very soothing, and the fact that I knew some of the songs had the effect of keeping me centered on what was real and what was not real. I spent most of two hours trying to control my trip and go to sleep.
A tip to those who are 'losing it' in an acid trip: I was very good to anchor myself to reality. For some reason recalling random facts about my life reminded me what sanity was like. For instance, mentioning the fact that my toothpaste is what I put on my toothbrush over and over can center me when I don't know where my thoughts are taking me. I think it's because it gives me a way to slow down myriad thoughts to normal speed so I can piece your mind together again. It really helped me concentrate, and I suggest trying it if you're ever having a bad trip.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


Click the button below and select your picture of lego block.
After that click the Predict button to get results.
(Don't take picture from afar. About 5cm distance is optimal.)


The @angular/cdk/menu
module provides directives to help create custom menu
interactions based on the WAI ARIA specification.
By using @angular/cdk/menu
you get all of the expected behaviors for an accessible
experience, including bidi layout support, keyboard interaction, and focus management. All
directives apply their associated ARIA roles to their host element.
The directives in @angular/cdk/menu
set the appropriate roles on their host element.
| Directive | ARIA Role |
|---|---|
| CdkMenuBar | menubar |
| CdkMenu | menu |
| CdkMenuGroup | group |
| CdkMenuItem | menuitem |
| CdkMenuItemRadio | menuitemradio |
| CdkMenuItemCheckbox | menuitemcheckbox |
Import the CdkMenuModule
into the NgModule
in which you want to create menus. You can then apply
menu directives to build your custom menu. A typical menu consists of the following directives:
cdkMenuTriggerFor
- links a trigger button to a menu you intend to opencdkMenuPanel
- wraps the menu and provides a link between the cdkMenuTriggerFor
and the
cdkMenu
cdkMenu
- the actual menu you want to opencdkMenuItem
- added to each buttonMost menu interactions consist of two parts: a trigger and a menu panel.
 Associating a trigger with
a menu is done through the cdkMenuTriggerFor
directive and you must provide a template reference
variable to it. Once both of these directives are set, you can toggle the associated menu
programmatically, using a mouse or using a keyboard.
You must wrap pop-up menus with an ng-template
with the cdkMenuPanel
directive and a reference
variable which must be of type cdkMenuPanel
. Further, the cdkMenu
must also reference the
cdkMenuPanel
.
<ng-template cdkMenuPanel #panel="cdkMenuPanel">

</ng-template>
Note that Angular CDK provides no styles; you must add styles as part of building your custom menu.
The CdkMenuBar
directive follows the ARIA menubar spec and behaves similar to a desktop
app menubar. It consists of at least one CdkMenuItem
which triggers a submenu. A menubar can be
layed out horizontally or vertically (defaulting to horizontal). If the layout changes, you must set
the orientation
attribute to match in order for the keyboard navigation to work properly and for
menus to open up in the correct location.
A context menu opens when a user right-clicks within some container element. You can mark a
container element with the cdkContextMenuTriggerFor
, which behaves like cdkMenuTriggerFor
except
that it responds to the browser's native contextmenu
event. Custom context menus appear next to
the cursor, similarly to native context menus.
You can nest context menu container elements. Upon right-click, the menu associated with the closest container element will open.

My outer context

My inner context

In the example above, right clicking on "My inner context" will open up the "inner" menu and right clicking inside "My outer context" will open up the "outer" menu.
An inline menu is a menu that lives directly on the page rather than a pop-up associated with a trigger. You can use an inline menu when you want a persistent menu interaction on a page. Menu items within an inline menus are logically grouped together and you can navigate through them using your keyboard.
Both menu and menubar elements should exclusively contain menuitem elements. This directive allows the items to be navigated to via keyboard interaction.
A menuitem by itself can provide some user defined action by hooking into the cdkMenuItemTriggered
output. An example may be a close button which performs some closing logic.
<ng-template cdkMenuPanel #panel="cdkMenuPanel">

<button cdkMenuItem (cdkMenuItemTriggered)="closeApp()">Close</button>

</ng-template>
You can create nested menus by using a menuitem as the trigger for another menu.
<ng-template cdkMenuPanel #panel="cdkMenuPanel">

<button cdkMenuItem [cdkMenuTriggerFor]="submenu">Open Submenu</button>

</ng-template>
A menuitem also has two sub-types, neither of which should trigger a menu: CdkMenuItemCheckbox and CdkMenuItemRadio
A cdkMenuItemCheckbox
is a special type of menuitem that behaves as a checkbox. You can use this
type of menuitem to toggle items on and off. An element with the cdkMenuItemCheckbox
directive
does not need the additional cdkMenuItem
directive.
A cdkMenuItemRadio
is a special type of menuitem that behaves as a radio button. You can use this
type of menuitem for menus with exclusively selectable items. An element with the cdkMenuItemRadio
directive does not need the additional cdkMenuItem
directive.
By default cdkMenu
acts as a group for cdkMenuItemRadio
elements. Elements with
cdkMenuItemRadio
added as children of a cdkMenu
will be logically grouped and only a single item
can have the checked state.
If you would like to have unrelated groups of radio buttons within a single menu you should use the
cdkMenuGroup
directive.
<ng-template cdkMenuPanel #panel="cdkMenuPanel">

<button cdkMenuItemRadio>Small</button>
<button cdkMenuItemRadio>Medium</button>
<button cdkMenuItemRadio>Large</button>

<button cdkMenuItemRadio>Left</button>
<button cdkMenuItemRadio>Center</button>
<button cdkMenuItemRadio>Right</button>

</ng-template>
Note however that when the menu is closed and reopened any state is lost. You must subscribe to the
groups change
output, or to cdkMenuItemToggled
on each radio item and track changes your self.
Finally, you can provide state for each item using the checked
attribute.
@angular/cdk/menu
intelligently predicts when a user intends to navigate to an open submenu and
prevent premature closeouts. This functionality prevents users from having to hunt through the open
menus in a maze-like fashion to reach their destination.
As demonstrated in the diagram above we first track the user's mouse movements within a menu. Next, when a user mouses into a sibling menu item (e.g. Share button) the sibling item asks the Menu Aim service if it can perform its close actions. In order to determine if the current submenu can be closed out, the Menu Aim service calculates the slope between a selected target coordinate in the submenu and the previous mouse point, and the slope between the target and the current mouse point. If the slope of the current mouse point is greater than the slope of the previous that means the user is moving towards the submenu and we shouldn't close out. Users however may sometimes stop short in a sibling item after moving towards the submenu. The service is intelligent enough the detect this intention and will trigger the next menu.
The set of directives defined in @angular/cdk/menu
follow accessibility best practices as defined
in the ARIA spec. Specifically, the menus are aware of left-to-right and right-to-left
layouts and opened appropriately. You should however add any necessary CSS styles. Menu items should
always have meaningful labels, whether through text content, aria-label
, or aria-labelledby
.


ISBN Search
ISBN-13:<PHONE_NUMBER>463
ISBN-10:<PHONE_NUMBER>
Author: Robert Love
Edition: 3
Binding: Paperback
Publisher: Addison-Wesley Professional
Published: July 2010
List Price: $49.99
$20.15
+3.99 shipping
Ready to ship
Notes
$24.15
$33.69
Free shipping
$35.22
Ships 2-3 days
$37.88
Ships 3+ Days
$45.49
+5.99 shipping
$48.50
+3.97 shipping
$48.87
$20.40
$18.95
+3.95 shipping
$22.90
$21.04
$25.17
$33.99


I want see it! *-*
$name = "George"; $age = 20 if($name == "Chuck Norris") { echo "OH my god!"; if($edad > 16 && $edad < 22){ echo "God is young!"; } }else{ for ($i=0; $i < 5; $i++) { echo "Number ".$count." Who are you?"; } }
name = "George" age = 20 if name == "Chuck Norris": echo "OH my god!"; if 16 < age > 22: print "God is young" else: for i in range(4): print "Number %i Who are you?" % count
public class Student{ private String code = "unassigned"; private String fullname; private int credits = 0; public Student(String fullname){ this(fullname, 0); } public Student(String fullname, int credits){ this(fullname, credits, "unassigned"); } public Student(String fullname, int credits, String code) { this.studentName = studentName; this.credits = credits; this.code = code; } }
class Student(object): def __init__(self, fullname, credits=0, code="unassigned"): self.fullname = fullname self.credits = credits self.code = code
The mission is to promote, protect, and advance the Python programming language, and to support and facilitate the growth of a diverse and international community of Python programmers.
... but, who is using right now ?
from django.db import models PET_KIND = ( ('dog', 'Dog'), ('Cat', 'Cat'), ('Lion', 'Lion') ) class Pet(models.Model): name = models.CharField(max_length=20, verbose_name='Name') kind = models.CharField(max_length=10, choices=PET_KIND) description = models.TextField(blank=True) def __unicode__(self): return self.name class News(models.Model): pet = models.ForeignKey('Pet', related_name='news') title = models.CharField(max_length=150) content = models.TextField() pub_date = models.DateTimeField(auto_now_add=True) def __unicode__(self): return self.title
from django.conf.urls import patterns, include, url from apps.pets.views import NewsDetail # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^$', 'apps.pets.views.home', name='home'), url(r'^about$', 'apps.pets.views.about', name='about'), url(r'^pet/(?P\d+)/$', 'apps.pets.views.pet_detail', name='pet_detail'), url(r'^news/(?P \d+)/$', NewsDetail.as_view(), name='news_detail'), url(r'^admin/', include(admin.site.urls)), )
from django.http import HttpResponse from django.shortcuts import render, get_object_or_404 from django.views.generic import DetailView from apps.pets.models import Pet, News def about(request): html = "Hola que hace?" return HttpResponse(html) def home(request): template_name='home.html' pets = Pet.objects.all() return render(request, template_name, { 'pets': pets }) def pet_detail(request, pet_id): """ Return a specific pet with its info """ template_name='pets/pets_detail.html' pet = get_object_or_404(Pet, pk=pet_id) return render( request, template_name, {'pet': pet} ) class NewsDetail(DetailView): model = News
<!DOCTYPE html>   <title>pets news</title>   {% block content %}{% endblock content %}
{% extends 'layout.html' %} {% block content %}
Home

 {% for pet in pets %}
{{ pet }}

 {% for news in pet.news.all %}
{{ news }}
 {% endfor %}
 {% endfor %}
 {% endblock content %}
from django.contrib import admin from .models import * admin.site.register(Pet) admin.site.register(News)
Easy things should be easy, and hard things should be possible.
If you have any suggestions, project or idea please get in touch with me.


Phil's Thrills
Foster simple principles in software development and design.
Libraries & Tools I Use
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries in the world.
Materialize is a modern responsive front-end framework based on Material Design.
deepstream.io is a scalable server for realtime web apps.
Figma: The Collaborative Interface Design Tool
PixiJS is a 2D webGL renderer with canvas fallback.
RethinkDB is the open-source, scalable database that makes building realtime apps dramatically easier.
xeoEngine is an open source engine for Web-based 3D visualization.
Atom Editor
A-FRAME: Building blocks for the virtual reality web.
A full featured HTML framework for building iOS & Android apps.
Vue.js: Reactive Components for Modern Web Interfaces.
Babel is a JavaScript compiler. Use next generation JavaScript, today.
Vert.x is a tool-kit for building reactive applications on the JVM.
Absurd.js
Resume
-
star_rateObjective
Fostering simple principles in software development and design.
-
star_rateHighlights
- More than ten years of software development experience using Java, Javascript, C, Objective-C, and other languages and tools.
- Adept at locating and evaluating permissive open source software to assist with rapid development. Have also contributed to some open source projects online.
- Major strengths in designing and creating highly intuitive, precise, and polite user interfaces: typically using hybrid mobile web applications, JavaScript everywhere, Cocoa Touch for mobile, and Java Swing.
- Creative, talented, passionate, and highly adept at creating and assuring quality.
- Mac OS X, Windows, and Linux experience.
-
star_rateSkillsStandards JavaScript NodeJS WebGL JSON Canvas Element Web Components HTML5 SVG MQTTLibraries xeoEngine ThreeJS PlayCanvas PixiJS VueJS ReactJS Framework7 Google Polymer AbsurdJS Moment.js chroma.js socket.io deepstream.io BabelJSDatabases RethinkDB LevelDB SQLPatterns Model-View-ControllerConcepts Simplicity Machine Learning Neural Networks Continuous Delivery Scripting Graphics Message Queues Visualizations Workflow Automation Differential Synchronization Procedural Vector Drawing Turtle Graphics Constructive Solid Geometry Color Transformations Lightweight ToolingApplications Bohemian Coding Sketch.app GIT Atom Editor Atom Editor
-
star_rateInterests
Lorem ipsum dolor sit amet.
-
star_rateWork History
Lorem ipsum dolor sit amet.
-
star_rateEducation
The University of Texas at Austin, 1992
Portfolio
Recent Exercises
Using differential synchronization for distributed microservices with Dialogo in NodeJS.


Table of Contents
Welcome to the Type Traits Introspection library version 1.5.
The Type Traits Introspection library, or TTI for short, is a library of macros generating metafunctions, and a set of parallel nullary type metafunctions, which provide the ability to introspect by name the elements of a type at compile time.
The name of the library is chosen because the library offers compile time functionality on a type, similar to the Boost Type Traits library, and because the functionality the library offers is the ability to introspect a type about the existence of a specific element.
I use the word "introspect" in a very broad sense here. Normally language introspection means initially asking for information to be returned by name, which can then further be used to introspect for more specific information. In the TTI library one must always supply the name, and use the functionality for the correct type of inner element to find out if the particular named entity exists. You may prefer the term "query" instead of "introspection" to denote what this library does, but I use terminology based on the word "introspect" throughout this documentation.
The functionality of the library may be summed up as:
The library is dependent on Boost PP, Boost MPL, Boost Type Traits, and Boost Function Types. The library is also dependent on the variadic macro support of the Boost PP library currently in the sandbox if the variadic macros in the library are used.
The library is a header only library.
Since the dependencies of the library are all header only libraries, there is no need to build anything in order to use the TTI library.
There are two separate general header files in the library, divided depending on whether or not the library functionality supporting variadic macros is to be used, which bring in all the rest of the specific header files.
boost/tti/tti.hpp
.
This can be used for the vast majority of functionality in the library.
boost/tti/tti_vm.hpp
.
There are also separate specific header files for each of the elements to be introspected by the library. This allows for finer-grained inclusion of nested elements to be introspected. These individual header files will be given when discussing the individual elements.
If the general header file boost/tti/tti_vm.hpp
or the specific header file vm_has_template_check_params.hpp
,
are used, the library uses variadic macros and is also dependent on the variadic
macro support of the Boost PP library currently in the Boost trunk.
Last revised: August 28, 2011 at 23:54:24 GMT |


Select by Kinds:
Abstract Task
User Task
Script Task
Service Task
Receive Task
Send Task
Manual Task
Business Rule Task
Start Event
End Event
Catch Event
Throw Event
Boundary Event
Exclusive Gateway
Inclusive Gateway
Parallel Gateway
Event Based Gateway
Complex Gateway
Lane
Pool
Call Activity
Sub-Process
Group
Text Annotation
Message Flow
Sequence Flow
Association
Clear
Display overlays
Use CSS style
Download SVG
Download PNG


GeoMesa GeoServer Plugins¶
A straightforward way to render, manipulate, and manage data stored in GeoMesa data stores is to use GeoServer, an open source server for sharing geospatial data. This chapter describes how to work with the GeoMesa GeoServer plugins.
Instructions for installing the GeoMesa plugins in GeoServer are available at Installing the GeoMesa GeoServer plugins.
Go to your GeoServer installation at http://<hostname>:8080/geoserver
.
For new installations of GeoServer, the default username is admin
and
password is geoserver
, but these may be different at your own installation.
Register a New Accumulo Data Store¶
From the main GeoServer page, create a new store by either clicking “Add stores” in the middle of the Welcome page, or anywhere in the interface by clicking “Data > Stores” in the left-hand menu and then clicking “Add new Store”.
The list of data store types GeoServer knows should be listed. If you have properly installed the GeoMesa Accumulo GeoServer plugin as described in Installing the GeoMesa GeoServer plugins, “Accumulo (GeoMesa)” should be included in the list under Vector Data Sources. If you do not see this, check that the plugin is in the right directory and restart GeoServer.
When you click on “Accumulo (GeoMesa)”, several configuration parameters are available:
| Parameter | Description |
|---|---|
| Workspace * | The GeoServer workspace in which the data store will be placed |
| Data Source Name * | The name of the data source (should not contain spaces) |
| Description | A human readable version of the data |
| instanceId * | The instance ID of the Accumulo installation |
| zookeepers * | A comma separated list of zookeeper servers (e.g. “zoo1,zoo2,zoo3” or “localhost:2181”) |
| user * | Accumulo username |
| Password * | Accumulo password |
| tableName * | The name of the GeoMesa catalog table |
| auths | Comma-delimited superset of authorizations that will be used for queries via Accumulo. |
| visibilities | Accumulo visibilities to apply to all written data |
| queryTimeout | The max time (in sec) a query will be allowed to run before being killed |
| queryThreads | The number of threads to use per query |
| recordThreads | The number of threads to use for record retrieval |
| writeThreads | The number of threads to use for writing records |
| collectStats | Toggle collection of statistics |
| caching | Toggle caching of results |
The required parameters are marked with an asterisk.
Click “Save”, and GeoServer will search your Accumulo table for any GeoMesa-managed feature types.
Publish a GeoMesa Layer¶
After a GeoMesa data store is successfully created, GeoServer will present a list of feature types registered in that data store. Click “Publish” next to the name of a feature type to create a layer of the data in GeoMesa of that type.
You will be taken to the Edit Layer screen. To render your layer, you must first set values for the bounding boxes in the “Data” pane. In many cases, you can click on the “Compute from native bounds” link to compute these values from the data.
Click on the “Save” button when you are done.
Preview a Layer¶
Click on the “Layer Preview” link in the left-hand menu. Once you see your layer, click on the “OpenLayers” link, which will open a new tab. If you have ingested data into GeoMesa, it will be displayed here.
If the data you have ingested is a set of latitude/longitude points, click on one of the points in the display (rendered by default as red squares), and GeoServer will report detailed records stored in the GeoMesa store in the region underneath the map area.
Click on the “Toggle options toolbar” icon in the upper-left corner of the preview window. The right-hand side of the screen will include a “Filter” text box. Enter a search query on the attributes of the feature type of the data you have ingested, and press on the “play” icon. The display will now show only those points matching your filter criterion.
This is a CQL filter, which can be constructed in various ways to query data. You can find more information about CQL from GeoServer’s CQL tutorial.
Analysis with WPS¶
As described by the Open Geospatial Consortium’s Web Map Service page,
The OpenGIS® Web Map Service Interface Standard (WMS) provides a simple HTTP interface for requesting geo-registered map images from one or more distributed geospatial databases. A WMS request defines the geographic layer(s) and area of interest to be processed. The response to the request is one or more geo-registered map images (returned as JPEG, PNG, etc) that can be displayed in a browser application. The interface also supports the ability to specify whether the returned images should be transparent so that layers from multiple servers can be combined or not.
A tool like GeoServer (once its WPS plugin has been installed) uses WPS to retrieve data from GeoMesa. WPS processes can be chained, letting you use additional WPS requests to build on the results of earlier ones.


You can submit feedback only at once!
Has the worker reviewed and signed on the SWMS?
Does the worker required additional training?
Has the worker been familliarised with the ERP?
As the OHS Manager, has {{ feedback.fullname }} met their Greenhat Program requirements?


single selection
Disabled
Normal
Hovered
Focused
Selected
Progress
selected: {{ selected }}
Multiple selection: Keyboard
Normal
Hovered
Focused
Disabled
Selected
Selected
Selected
Selected
Selected
Selected
Selected
Selected
multipleSelected: {{ multipleSelected }}
Multiple selection: Checkbox
Normal
Hovered
Focused
Disabled
Selected
multipleSelectedCheckbox: {{ multipleSelectedCheckbox|json }}
Multiple selection with Async: Checkbox
{{shoe}}
multipleSelectedCheckbox: {{ multipleSelected|json }}
Single selection
Normal
Hovered
Focused
Disabled
Selected
singleSelected: {{ singleSelected }}


I'm a 42 year old male with a fairly wide range of experience: MDMA (my favourite), 2-C-B (also very fine but too potent for me!), cocaine, shrooms, crystal meth, pot, acid (once--yech!). However at the time of this experience I had been fairly clean for almost ten years, having had quite enough of the trip in my early thirties.
Lately however I've been going through changes--end of a long-term relationship, creative breakthroughs, travel--and felt the desire to experiment again. Many research chemicals are still unscheduled in my country, and after much consideration I ordered a quantity of Ace. I had always wanted to try Foxy, but never found any--Ace seemed like a milder version and I was definitely interested in the erotic side of it!
The day of this, my first time with it, I'd had two light meals, and nothing for about 4 hours. I was not on any medications. 10mg in a gel cap were taken orally, with another 10mg at the ready if I felt like it--it turned out to be unnecessary! I do tend to be very sensitive to hallucinogens. Setting was my apartment, clean and ready to go. My cat would be my companion.
I started to do housework, waiting for the come-up. At twenty minutes, I started to feel warm but relaxed. I washed my hands, and the hot water on my skin felt sparkly and sensual--something I'd experienced on 2-C-B. I did some drawing, but at thirty minutes I was definitely coming up and felt compelled to stop and take some deep breaths, as I felt some tension. The reports were right, it acts fast! No more work was done that night.
At forty minutes (my notes says 'only 40 minutes?'!) I felt the restlessness others reported. Stretching helped, and also felt quite good. I found I had to do a light, moving yoga to stay on track. My abdominal area was really rolling, but not in a nauseous way. I felt that all the physical, emotional, and spiritual baggage I carried in the solar plexus was being unpacked.
In some reports I noted people getting very agitated at this stage, and if I were not alone and simply able to move about as I pleased I might have been very upset too. Not like MDMA though, where dancing becomes an imperative--here I just need a place to kind of roll around voluptuously. My leather recliner was perfect for this and I spent the next hour or so there. At this point the notes I was taking stopped for a while--there was too much going on.
People describe Ace as being pink and soft -- this definitely kicked in. I found I needed to stay warm. Blankets were an incredible delight. My cat settled on the couch and looked impossibly fuzzy and round, for which I laughingly rebuked him. I had tuned to an electronica station, but the music became a little too hard edged. Ambient music fit the bill much more nicely. Music did not acquire multiple dimensions as it does on pot or MDMA (I am a musician), but the soft sounds were exceedingly pleasant. Soft lighting, especially candles, were wonderful. I did not experience open eye visuals, but closed eye visuals were again rounded, simple, but a touch forbidding--usually this is one of my favourite parts of the experience, but not here. I can't explain why… it felt as though I was looking at something that shouldn't be seen…
I pulled a book of paintings by Rubens off the shelf and sighed enormously at the colours, compositions, and emotions depicted--here were happy lives in perfect harmony with nature and not lacking in grandeur or ambition either. This was as heady as it got--no big thoughts, just feelings of ultimate rightness.
I really needed to eat at this point and thoughts of luscious fruit dominated my thinking for some time until I realized with joy that I had some yogurt with berries in the fridge. Eating this was an extreme sensual delight, though somewhat difficult.
I then stripped down to a pair of shorts, as I was warm and the clothes felt confining. I was enjoying being in my body, though it was still rolling. There is definitely an edge to the substance! I didn't lose my mind though; I remembered to feed the cat, and was generally able to perform simple tasks, though very slowly. The cat was no more or less delightful than he always is, which I found curious, given the other sensations.
A note at one hour and fifty minutes reads 'invoking sychronicity'. This was the peak of the head trip.
I always found the randy part of MDMA on the downside, and that was the case here. Most definitely.  A multifaceted erotic experience that cried out to be shared with a hot partner--it was everything I expected and more. I also kicked up the music to progressive house and that was very, very nice.
Once I got my fill I kind of puttered around… I was definitely on the way down now, a soft landing that took about ninety minutes. Then baseline.
So the reports were right: fast acting, sensual, easy comedown. This is not a substance for clubs or parties. With what happens here, I would have to be pretty intimate with the company. I also want to be in a very comfortable, soft and safe space. This substance rewards the experienced--and the research I did was rewarded, as I was able to take its difficulties in stride.
Like a fine wine, savour it with someone you love.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


Quantum mechanics is an extraordinarily strange, unintuitive yet increasingly accurate description of how reality works at the lowest of levels. The idea that we can take this theory and use it to build an entirely new form of computing is now well-known in popular science, but to study it requires a drastic entry barrier of maths and physics. As a computer scientist/programmer, is it at all possible as of yet to break into the field of quantum programming?
The answer is yes. Some basic familiarty with linear algebra (read: do you know what vectors and matrices are?) would do you well, but even without this, let’s take a hands-on, no-knowledge-assumed jump into quantum programming using this simulator.
IMPORTANT: Qlay Visual is designed to help visualise and prototype very simple quantum logic circuits. Many of the fundamental concepts can be explored much more clearly using the very simple C++/C# library directly, so it is highly recommended to follow both tutorials simultaneously. This tutorial will inevitably delegate to the C++/C# tutorial at various points.
The basic unit of classical computing is the bit (binary digit). A bit can take either of the values 0 or 1. It cannot take any other values and must take one of those values at any given time.
Let’s begin by treating 0 and 1 as vectors. We’ll define them as:
The pipe-and-chevron notation is known as a ket vector: for our purposes, it simply means a column vector.
0 and 1 are our only two possible states, so |0> and |1> are our basis vectors, or basis states. We can represent a single bit, b, using this system like so:
For a classical bit, either α is 1 and β is 0, or vice versa: the state is either entirely |0> or entirely |1>.
Simulating our classical bit like this allows us to extend our line of thinking a bit more: what if the state isn’t entirely |0> or |1>, but somewhere in between? This is the motivation behind the qubit: the quantum bit.
A qubit can take almost any values for the coefficients α and β, creating a mix of states, not quite |0> yet not quite |1>, a blur between the two. The squared magnitude of the coefficient gives the state’s probability, i.e. |α|2 is the chance it will be |0> and |β|2 is the chance it will be |1>. Therefore, these two must sum to 1, as there are no other possibilities.
The maths checks out, but how can a qubit possibly be probabilistic in reality? Let’s set that aside for one moment: enough with the linear algebra, ahead with the coding.
An empty circuit contains just one horizontal line. Each line represents one qubit, with gates placed onto the line being applied from left to right. From the toolbox on the right, drag one of the top-left-most gates onto the line, then click ‘Run Simulation’.
This gate is a measurement operation. Our qubit data type does not possess its own value in an accessible way; instead, we use the measurement operation to observe the qubit. We expect this output to be 0: all qubits are initialised into the |0> state.
As mentioned before, this system will reveal itself to be probabilistic. We repeat the experiment some suitably large number of times (default is 1000), counting every time the result was 0 and every time it was 1. The results are placed above the gate: 1000 , 0
means that, as expected, it’s 0 every time.
The classical bit doesn’t do much by itself: we create programs by manipulating them with logic gates, such as NOT
, AND
, OR
etc. We manipulate the qubit using logic gates, too, but they work rather differently indeed.
The first gate to use is called the Pauli X gate. It’s a complicated name for a very simple function: it maps |0> to |1> and |1> to |0>. In other words, it’s a direct equivalent of the classical NOT
, or bit-flip.
Let’s add the X
gate to our experiment. It is easily recognisable as the circle with a vertical cross, but don’t forget that you can hover over any item in the toolbox to see its name:
Every single qubit prepared to |0> is |1>. Again, very normal.
A logic gate is actually an operation, represented by a matrix, applied to the qubit vector representation. The matrix for the Pauli X gate is:
Matrix representations will no longer be given here, but are all provided below for each gate.
Measuring and flipping are the only things we can do with only one bit, classically, but there actually exist numerous quantum logic gates with only one input which don’t have classical equivalents. For instance, Pauli Y and Pauli Z gates also exist, but their effects are subtle and not of interest to us yet.
Instead, the next essential gate to know is the Hadamard gate. The easiest way to understand what this gate does is that it performs half a bit-flip. If the input is |0> or |1>, the output will be exactly half-way between |0> and |1>.
What does this mean in practice? Let’s try it out in the same way as before. You can remove any gate by dragging it off the circuit canvas. Put a Hadamard gate (square with a capital letter H) in instead of the Pauli X gate:
With the qubit set to exactly half-way between |0> and |1>, it has a 50:50 chance of being measured as 0 or 1! This is, clearly, a huge deviation from classical computing and the fundamental motivation behind the qubit, as explained earlier.
The fact that the qubit can exist as as any mixture of the two states is known as quantum superposition. The qubit exists as a superpostion of the |0> and |1> basis states. When we observe/measure the qubit, only then does it present itself as one of those basis states, with some probability.
It goes further than even that. Let’s extend our experiment so that we simply measure the qubit twice and see what happens (ideally we would like to count the number of times both measurements matched; see Hadamard.cpp)):
If the qubit simply had a 50:50 chance of being |0> or |1> when observed, then the number of matches would be around 50% of the time. However, we instead see that the measurements matched 100% of the time.
This means that not only did we get a 50:50 result when first observing the qubit, but the act of measurement itself permanently collapsed the qubit into that state. The superpostion has been destroyed and we will now measure the same result every time. This phenomenon is called wavefunction collapse and goes alongside superposition itself as perhaps the most startling, fundamental of features of quantum mechanics, entering popular science as the Schrödinger’s cat paradox.
The description of the Hadamard gate’s effects as ‘half a bit-flip’ is a gross simplification, albeit a useful one, but it is hard to understand it more without delving into the underlying linear algebra.
Instead, we will simply note another important property. If you were to apply ‘half a bit-flip’ twice, you would reasonably expect to get a full bit-flip. Is using two H
gates equivalent to an X
gate? Let’s find out:
The answer is no. Applying the H
gate twice gets you right back to where you started, i.e. equals the identity operation. The same is, more intuitively, true of the Pauli X (NOT
) gate (and also Y and Z, for future reference).
Speaking of the X
gate, it is generalised to flipping all superpositions. In other words, if you had for example a qubit with a 25% chance of |0> and a 75% chance of |1>, applying the X
gate would yield a 75% chance of |0> and 25% chance of |1> (it simply swaps the values of α and β).
Finally, it is important to appreciate that a qubit can be treated as a direction vector in 3-dimensional Euclidian space, i.e. as a sphere of which the surface area maps the 2-dimensional Hilbert space (Bloch sphere). The Z-axis is treated by convention as the computational basis – a qubit pointing directly along the Z-axis is |0>, whilst a qubit pointing directly against the Z-axis is |1>. One way of preparing a qubit with some probability p of |1> is by applying a Y-axis rotation to the default |0> qubit of 2arcsin(sqrt(p*)). Try deriving this from the operator matrix for the Ry
gate in the reference section below!
We’ve seen that superposition is a key aspect of qubits. Although we can do more with a qubit than a classical bit, we still can’t exactly do much with just one. The true power of quantum computing only becomes clear when we move onto using more than one qubit and the other key aspect of their behaviour: entanglement.
First, let’s look at probably the most straightforward of the logic gates which take two qubits as inputs: the SWAP
gate.
This above example instantiates two qubits, q0 and q1, and flips q0 to |1>. This is confirmed by measurement. The SWAP
gate is then applied, which does exactly what it says on the tin: the two qubits are swapped with each other in their entirety. Following this, q0 now measures |0> and q1 now |1>. The values for α and β for q0 are swapped in-place with those for q1.
The SWAP
gate is of fundamental importance for low-level implementations, but we’ll turn to a more interesting gate for the behaviour of interacting qubits. The controlled-NOT (CNOT
) gate applies the X
gate to a target qubit if an only if a control qubit measures |1> – otherwise, no change occurs. The truth table for a two-qubit system |control,target> is as follows:
| before | after |
|---|---|
| |00> | |00> |
| |01> | |01> |
| |10> | |11> |
| |11> | |10> |
The control qubit is never affected, and the target qubit is only affected conditionally on the control. We can use this gate to demonstrate logical interaction between qubits (see entanglement.cpp):
Note: for the CNOT
gate, the node identical to the NOT
gate is the target qubit, and the small dot is the control qubit. You can right-click to flip the orientation.
First, we apply the Hadamard gate to q0, so it is in an equal superposition of |0> and |1>. Then, we use it as the control to CNOT
on q1. Therefore, q1 now also has a 50:50 probability between |0> and |1>. Critically, we count the number of times the measurement of q0 equals q1 and obtain 100%.
If q1 simply also had a 50:50 probability then we would expect it to only match approximately 50% of the time. The true situation is that the very act of measuring and thus collapsing q0 collapses q1 before it is itself measured. There is seemingly ‘spooky action at a distance’: the two qubits interacted at some point in the past (CNOT
) and they are now entangled, such that measuring one has a very real effect upon the other.
When qubits are entangled, they cannot simply be considered as independent, 2-dimensional vectors. Instead, the entire system is a 4-dimensional vector space; a linear combination of all possible states, which are |00>, |01, |10> and |11> as given in the truth table above. In this case, the entire system is in an equal superposition of |00> and |11>, and measuring one qubit collapses the system as a whole.
This simple example, though the most common and standard way of entagling two qubits, does not actually appear to transcend classical conditional probability, however. The true power lies in quantum algorithms and communication which exploits entanglement in ways which cannot be replicated or explained classically.
Quantum nonlocality, the idea that states are not just subject to local realism, can be demonstrated through nonlocal games, experiments designed to exploit entanglement and prove quantum ‘superiority’.
Consider a referee in a game and two co-operative players, Alice and Bob. The game consists of Alice and Bob each receiving a ‘question’ from the referee, which is just a classical bit 0 or 1, and them responding with an ‘answer’, likewise 0 or 1. They win the game if and only if their answers satisfy some logical predicate with the questions. The kicker is that they cannot communicate with each other, outside of agreeing upon a strategy beforehand.
The CHSH game consists of Alice and Bob receiving the questions r and s respectively, where both are 0 or 1 with 50:50 chance. They win if their answers a and b satisfy the predicate r AND s = a XOR b.
In other words, if r and s are both 1 then a and b must be different; otherwise, they must be the same. These winning conditions can be visualised in a truth table:
| r AND s | a XOR b |
|---|---|
| 0 AND 0 | 0 |
| 0 AND 1 | 0 |
| 1 AND 0 | 0 |
| 1 AND 1 | 1 |
Classically, the best possible strategy is trivial to determine. If Alice and Bob both give the same answers, they have a 3-in-4 chance of winning: they only lose in the 1 AND 1 case. So, Alice and Bob decide to both give the answer 0 and cannot win more assuredly than this.
However, if Alice and Bob each possess entangled qubits, they can ‘cheat’ the system, being able to communicate with each other to an extent despite no classical channel existing between them.
The trick is to perform measurement on the qubit(s) in particular bases. Normal measurement so far has been respect to the Z-axis: the computational basis. One can measure a qubit in any axis you want, which collapses the qubit onto that basis. We sometimes call the X-axis basis the sign basis. After applying Hadamard gate to |0>, you cannot say whether it will collapse to |0> or |1>, but you can say for certainty that it is in the |+> state. Likewise, a qubit prepared as |0> has a 50:50 chance of being measured to be |+> or |->, by instead measuring in the X-axis.
An Mx
function is provided as shorthand for measuring in the X-axis, but you can measure in any arbitrary axis A by applying rotation gates that map A onto the Z-axis, and then just measuring in the Z-axis with M
.
Alice and Bob would ideally like to communicate the question they received to the other. The best they can achieve is to measure their entangled qubits in different axes depending on the question they received, in such a way that the results (taken as their answers a and b) have the highest probability of falling into a winning condition. The derivation of the optimal strategy and axes to measure in is beyond this scope, but see CHSH.cpp for it implemented and performed. The optimal strategy is that Alice measures in the X axis if r is 1 and in the Z axis otherwise, and Bob measures in the same but rotated π/8 radians. The results as shown are conclusive: the classical strategy’s success rate is 75%, but the quantum strategy’s is ~85%!
The GHZ game (see GHZ.cpp) is very similar, but introduces a third player, Charlie, changes the predicate and restricts the possible set of questions they receive. The best classical success rate is again 75%. By sharing three entangled qubits prepared to a state correspending to the possible set of questions, a simpler quantum strategy of applying the Hadamard gate once achieves something spectacular: a 100% success rate.
These games prove that quantum entanglement transcends mere conditional probability: that entangled states cannot be considered in isolation and can be dependent even when physically separated.
Entanglement allows for extremely powerful techniques in communication, of which there’s two major ones we’ll look at. The first is superdense coding, wherein we can transmit two classical bits of information by transmitting only one qubit.
We mentioned earlier that the most basic way of creating an entangled state is by applying a H
gate followed by a CNOT
. This actually creates one of the four most simple and maximally entangled states possible between two qubits: one of the four Bell states. These are as follows:
Applying H
then CNOT
creates the first Bell state (|Φ+>). The two Φ states are where the two qubits are equal and the two Ψ states are where they are different. Between each of the states of these types, the superscript sign indicates the phase factor. Remember, this phase factor does not directly affect the probability amplitudes, but are distinguishable when applying other operations.
The problem at hand is that Alice wishes to send two classical bits of information to Bob, by transmitting only one qubit. A simple insight is that there are four possible states she could wish to send: 00, 01, 10 or 11. The overall idea is thus straightforward: if Alice and Bob share an entangled state, Alice can transform the Bell state (encoding her message) such that Bob can determine the transformation made (decoding her message).
First, Alice and Bob receive a qubit each, consituting the first Bell state (|Φ+>):
So far, Alice receives qa and Bob receives qb. Alice currently does nothing and sends qa to Bob. Bob decodes by applying CNOT
then H
, ‘undoing’ the entanglement. It is clear that Bob just returns the state to its initial preparation (|00>) by symmetry, because you should remember that all gates are reversible.
If Alice intends to transmit the message 00, then this is already achieved. If she intends to transmit a different message, then she should transform the state into a different Bell state, by applying a certain operation(s) to qa before sending it, as below:
| Message | Target state | Operation(s) |
|---|---|---|
| 00 | |Φ+> | none |
| 01 | |Ψ+> | X |
| 10 | |Φ-> | Z |
| 11 | |Ψ-> | X then Z |
We can try each of these cases to confirm they send the intended message correctly (see superdense_coding.cpp):
Another major technique in quantum communication is the spiritual inverse to superdense coding: transmitting one qubit in its entirety, with the support of classical bit communication. Alice can ‘teleport’ the information of one qubit by sending just two classical bits to Bob, assuming again that they can pre-share an entangled state.
First, let’s have Alice possess some qubit qc, which is the information that she wants to transmit to Bob:
For demonstration purposes, we want this qubit to be very distinctive (perhaps not just, say, the rather common 50:50), so the above Y-axis rotation (of 2*arcsin(sqrt(0.75))) prepares a qubit with a 75% chance of measuring |1>.
We want Bob to possess a qubit qb which becomes an exact copy of qc. First, if we perform a CNOT(qc, qb)
, this only achieves an entangled system in which the observed value of qb will match the observed value of qc. We want qb to truly become the standalone state r|0>+s|1> of Alice’s qubit!
Instead, after performing the CNOT
, Alice could measure in the sign (X) basis, obtaining either |+> or |->. This leaves qb as either r|0>+s|1> or r|0>-s|1>, respectively. Alice should let Bob know if she measured |->, so that he knows whether or not to perform a phase correction of a Z
gate, flipping that minus sign.
Note: at this point, we are mixing classical logic with quantum logic, so we cannot use just raw quantum circuitry. The rest of this section thus delegates to the code tutorial.
C++:
QubitSystem qs;
Qubit qb(qs); Qubit qc(qs);
//Prepare Alice's qubit with 75% chance of |1>, to teleport
//r|0>+s|1> (where |s|^2 = 0.75)
Ry(2 * asin(sqrt(0.75)), qc);
//Copies Alice's measurement to Bob...
//Doesn't give Bob the state r|0>+s|1> !
CNOT(qc, qb);
//Alice measures in the sign basis, as either |+> or |->
Basis result = Mx(qc);
//Bob's qubit is now either r|0>+s|1> or r|0>-s|1>
//In the latter case, correct the phase
if (result) Z(qb);
M(qb) ? ones++ : zeroes++;
Output:
ZERO: 240
ONE: 760
We now have a procedure for ‘copying’ Alice’s qubit onto Bob’s. Note that the term ‘copy’ is misleading here: Alice’s original information is destroyed, being moved onto Bob’s qubit. This is a fundamental restriction in quantum information called the no-cloning theorem.
Alice currently classically communicates only one bit to Bob, letting him know if he must perform a phase correction. However, we aren’t done yet, as we are still relying on an actual CNOT
gate: the idea is to transmit the qubit from afar. The next step is to effectively turn this into a ‘remote’ CNOT
by further exploiting entanglement, so – similarly to superdense coding – we must first provide Alice and Bob with an entangled state. We can use any of the aforementioned Bell states, so let’s just again go with the most common |Φ+>.
Alice adds her data qubit into the entanglement channel by performing CNOT(qc, qa)
, where qa is her qubit given in a Bell state with Bob’s qb. She then performs two measurements. One is the same as before: measuring her data qubit in the sign basis, to let Bob know if he must perform a phase correction. The additional one that must know be performed is a normal (computational basis) measurement of the Bell qubit. If she measures |1>, then Bob’s qubit will be bit-flipped, so she must let Bob know if he needs to flip it back with an X
gate (see teleportation.cpp):
C++:
QubitSystem qs;
Qubit qa(qs); Qubit qb(qs); Qubit qc(qs);
//Prepare Alice's qubit with 75% chance of |1>, to teleport
//r|0>+s|1> (where |s|^2 = 0.75)
Ry(2 * asin(sqrt(0.75)), qc);
//Give Alice and Bob the Bell state |Φ+>
H(qa);
CNOT(qa, qb);
//Alice entangles her data qubit with her Bell qubit
CNOT(qc, qa);
//Alice measures her data qubit in the sign basis
Basis correct_phase = Mx(qc);
//Alice measures her Bell qubit in the computational basis
Basis correct_flip = M(qa);
//Bob's qubit may have flipped, so correct if necessary
if (correct_flip) X(qb);
//Bob's qubit is now either r|0>+s|1> or r|0>-s|1>
//In the latter case, correct the phase
if (correct_phase) Z(qb);
M(qb) ? ones++ : zeroes++;
Output:
ZERO: 250
ONE: 750
This finished example now successfully teleports one qubit from Alice to Bob, with only a pre-shared entangled state, and two bits sent classically.
So far, we have looked mainly at examples of quantum ‘superiority’ in communication, rather than computation. Perhaps the most famous example of a quantum algorithm is Shor’s algorithm for factorising integers almost exponentially faster than the best known classical method, prompting much of the subsequent research into quantum computing and post-quantum cryptography. This particular algorithm is out of scope for this guide, but let’s look at more straightforward examples that constitute a good introduction to quantum programming.
First, let’s clarify how we can represent functions with qubits. We will just consider functions with a single input number, x. What we mean by a number here is, of course, a string of bits. Let’s consider a 3-bit number: x2x1x0. We simply represent this with three qubits.
We’ll also just consider functions that, taking an n-bit number, return a single bit. In other words, our functions are some predicate on a number returning true or false. We call a quantum implementation of a function f an oracle, denoted Uf, as the idea is that it can be treated as a black box.
A simple example for a function f(x) is if x is an odd number. Due to the binary representation, this is just 1 (true) if the least-significant digit x0 is 1, and 0 (false) if it is 0.
One way of representing the oracle is in a form herein called an output oracle. We use a fourth qubit, y, which the oracle stores the result in. The beauty of quantum simulation is that we can consider the entire function domain at once through superposition:
Output of QubitSystem
from code equivalent:
|0000> 0.353553
|0001> 0
|0010> 0.353553
|0011> 0
|0100> 0.353553
|0101> 0
|0110> 0.353553
|0111> 0
|1000> 0
|1001> 0.353553
|1010> 0
|1011> 0.353553
|1100> 0
|1101> 0.353553
|1110> 0
|1111> 0.353553
The three digits on the right constitute the input x2x1x0 and the leftmost digit is the result y. For all inputs with the rightmost digit 1, y is correctly 1: they are odd. We just measure y to obtain the result of the function.
There is a second major way of encoding functions which does not require an additional output qubit(s). Instead, the output is encoded directly into the input qubits by altering their phase. This is herein called the phase oracle:
Output of QubitSystem
from code equivalent:
|000> 0.353553
|001> -0.353553
|010> 0.353553
|011> -0.353553
|100> 0.353553
|101> -0.353553
|110> 0.353553
|111> -0.353553
We can see that instead of setting an external ‘flag’ qubit in the case of a 1 output, we phase-flip in the case of a 1 output. This is done very easily with the Z
gate, which leaves |0> alone but maps |1> to -|1>. Although this reduces the memory cost, you may realise that it doesn’t appear to be useful, as relative phase factor is not experimentally determinable just by measuring the qubits. However, we also know that relative phase factor does affect how states react to further operations, so this representation can come in very handy for algorithms using the function.
Let’s consider a situation in which we are promised that a function f(x) is either constant or balanced. If it is constant, then it always outputs the same value, i.e. either 0 or 1. If it is balanced, then it outputs 0 for exactly half of the input domain, and 1 for the other half. Our task is to decide which of these a given function is.
Our above example of a number being odd is balanced, because exactly half of the numbers in the domain are odd.
Classically, we must continually test f(x) for different x. In the worst case, we must test just over half of the domain, because we can only be sure the function is constant if the same output is observed for more than half; as soon as we see a different output, we can conclude that it is balanced. So, if the input has n bits, then the worst case is 2n-1+1 function evaluations. This is clearly exponential complexity.
The Deutsch-Jozsa algorithm is a quantum algorithm which determines if the function is constant or balanced with just one function evaluation. Therefore, it is a striking example of an exponential speedup over classical limits.
It is quite simple. First, we again create a uniform superposition of the input domain with H
gates on the x qubits, before feeding it into an output oracle. The trick is to first set the output qubit to |1> and apply an H
gate to it also before applying the oracle. The output qubit can then be disregarded. We symmetrically take the x qubits out of superposition by again applying H
gates then measure them all. If they all measure |0> then the function is constant; else, it is balanced (see DeutschJozsa.cpp):
Not all of the outputs are |0> (the bottom one is |1>) so the function is balanced, not constant. The algorithm is further simplified by just using a phase oracle instead, removing the need for the output qubit:
We can test it with constant functions and see the correct result. Remember there are effectively only two constant functions: either 0 is always returned, or 1 is always returned:
These correctly output all |0>, therefore constant. The f(x)=0 cases are trivial as the output is already initialised to 0, so nothing needs to be done. Instead, both above examples show the f(x)=1 case. In the first showing an output oracle, we just unconditionally flip the output to 1.
In the second showing a phase oracle, always outputting 1 means we must phase-flip every case. First, we phase-flip all cases where q0 is 1 with a Z
gate. Then, in order to phase-flip all cases where q0 is 0, we use another Z
gate but sandwiched between X
(NOT
) gates. Naturally, this constitutes flipping the phase in all possible cases (and it does not matter which qubit we perform this on).
This constant vs balanced scenario is a rather contrived one, made to highlight the potential for exponential speedup and use of a quantum oracle. Whilst the phase oracle seems slightly trickier to understand and implement than the output oracle and we can use either here, other more powerful and useful algorithms (such as Grover’s search) rely on phase oracles.
This section outlines all of the quantum logic gates, explaning them by their operator matrices and effects on a qubit by treating it as a spin state – understanding their intricacies is not necessarily crucial to start quantum programming. All angles are given in radians, but remember that Qlay Visual takes angle arguments in degrees.
Note that measurement operations are not technically quantum logic gates as they are not reversible operations, but they are informally called gates here as a code function acting on a qubit.
| Function header | Description |
|---|---|
M(q) |
The ‘normal’ measurement, returning 0 or 1. Measures the qubit in the Z-axis, i.e. the computational basis. |
Mx(q) |
Measures the qubit in the X-axis, i.e. the sign basis. |
| Gate | Function header | Operator matrix | Description |
|---|---|---|---|
| Pauli X | X(q) |
Bit-flip, equivalent to classical NOT . Performs a rotation of π around the X-axis. Maps |0> to |1> and |1> to |0>. |
|
| Pauli Y | Y(q) |
Performs a rotation of π around the Y-axis. Maps |0> to i|1> and |1> to −i|0>. | |
| Pauli Z | Z(q) |
Phase-flip. Performs a rotation of π around the Z-axis. Leaves |0> unchanged and maps |1> to −|1>. | |
| Hadamard | H(q) |
Creates a superposition by mapping |0> to (|0>+|1>)/sqrt(2) and |1> to (|0>−|1>)/sqrt(2). Performs a rotation of π around the X-axis followed by π/2 around the Y-axis. | |
| Square root NOT | SRNOT(q) |
Square root of the Pauli X gate. Appling two in sequence is thus equivalent to a single NOT . |
|
| X rotation | Rx(angle, q) |
Rotates around the X-axis by the given angle. | |
| Y rotation | Ry(angle, q) |
Rotates around the Y-axis by the given angle. | |
| Z rotation | Rz(angle, q) |
Rotates around the Z-axis by the given angle. | |
| Phase shift | Rp(angle, q) |
Performs a phase shift by the given angle, mapping |1> to exp(iθ)|1>. |


The latest Alpha version of nServiceBus uses the TopShelf project as part of its new hosting feature. This new Host feature makes it super easy to setup a console/windows service for your clients/servers. So here’s how I think it works and what you can do with it…
Get nServiceBus
First you’ll need to get the latest build which includes the new Host feature either:
Either way take a look at the FullDuplex/RequestResponse sample project which consists of a Client, Server and Messages project:
Run the sample
Note: To get the Server to run successfully in my demo solution I had to change the app.config slightly by replacing the UnicastBusConfig setting with:
Ok simply hit F5 to run the sample and two console windows should appear one for the Client and one for the Server:
So everything is running ok our Client can send messages to the Server and receive a response. But what’s just happened?
Multiple startup projects
First the solution is set to start both the Client and the Server projects. This is set in the solution property pages you can view this setting by right clicking on the solution and selecting Set St_a_rtUp Projects…
As you can see the solution is set to start multiple projects namely the Client and the Server.
Now the Server and Client projects are both Class Library’s so how come they are running as console apps when we F5 (debug) the solution?
Debug settings
If we take a look at the Debug settings for the Client (Right click the Client project and select P_r_operties, then Debug from the tab):
Notice the Start Action is set to Start e_x_ternal program NServiceBus.Host.exe from the Client projects debug\bin directory. When we hit F5 to debug the application visual studio runs this exe and that’s how we get the console windows.
Reference NServiceBus.Host.exe
NServiceBus.Host.exe ends up in the debug\bin because its referenced by the project for example in the Client:
But how does it know where to get its configuration?
Configuration
NServiceBus.Host.exe scans its current directory for any dlls. For each dll it finds it searches for a class which implements the interface IConfigureThisEndpoint. If the search is successful the Host knows to use the app.config for this dll so in the case of the Client – Client.dll.config is used to configure nServiceBus.
Client
If we take a look at the Client project we’ll find the class EndpointConfig which implements the IConfigureThisEndpoint. This is simply a marker interface which has no actual implementation. Notice there are other interfaces used to configure the client which do require implementations:
public class EndpointConfig:IConfigureThisEndpoint,
As.aClient,
ISpecify.ToUseXmlSerialization,
ISpecify.XmlSerializationNamespace,
IWantCustomInitialization,
ISpecify.ToRun
{
public string Namespace
{
get { return “[http://www.UdiDahan.com”;](http://www.UdiDahan.com”;) }
}
public void Init(Configure configure)
{
configure.RijndaelEncryptionService();
}
}
Of particular interest, the interface used to configure the dll as a client (As.aClient) and another to specify which code to actually run (ISpecify.ToRun). The ClientEndPoint class contains the code which is runs when the Host starts and stops.
Note there are lots more interfaces which can be used to specify configuration options:
Server
The Server project works in pretty much the same way as the Client it has an EndpointConfig class:
public class EndpointConfig:IConfigureThisEndpoint,
As.aServer,
ISpecify.ToUseXmlSerialization,
ISpecify.XmlSerializationNamespace,
IWantCustomInitialization
{
public string Namespace
{
get { return “http://www.UdiDahan.com”; }
}
public void Init(Configure configure)
{
configure.RijndaelEncryptionService();
}
}
Here the interfaces are used to configure the dll as a server (As.aServer) and IWantCustomInitialization which allows you to specify additional configuration via the Init method. The Server project also contains the RequestDataMessageHandler class which the bus knows to use when a RequestDataMessage arrives.
All this makes it very easy to create Client and Server applications for nServiceBus which are a doddle to debug in visual studio.
But wait there’s more…
Run from console
You can run the Client or Server from outside Visual Studio from the command line. Open a command prompt, cd to the relevant bin folder and type:
NServiceBus.Host.exe
Install as a Windows Service
We can install the Server as a Windows Service no extra code or configuration required! Open a command prompt, cd to the relevant bin folder and type:
NServiceBus.Host.exe /install
You’ll then be prompted to supply some authentication details for the service:
Enter some relevant user details and hit ok and your service will be installed and ready to start:
Uninstall service
Finally you can also uninstall the service:
NServiceBus.Host.exe /uninstall
Note: The service will not disappear from this Services management console until you reboot your machine, this is standard for a windows service.
That’s as much as I have puzzled out for now, if I’ve made and glaring errors please let me know.