grep
is a command line program that allows us to find all occurrences of given pattern
in the text.
We can use grep
to search command standard output, for example:
We may also use grep
to find given pattern in the set of text files:
NOTE: In the last example I used
heredoc’s to create foo.txt
and
bar.txt
files.
NOTE: {foo,bar}.txt
is expanded by bash into foo.txt bar.txt
, this is
called brace expansion.
We may also peform recursive searches using -r
or -R
options (grep
will search in
every file contained in the specified directory and it’s subdirectories):
grep command in details
General grep
invocation has form:
grep
searches standard input when no files were given or
specified files/directories for occurrences of the pattern
.
When grep
finds a line that contains the pattern
it prints it to
the standard output.
When we search multiple files each printed line
is prefixed by a filename.
-i (--ignore-case)
By default grep
is case sensitive, so pattern foo
doesn’t match
word FOO
, we can perform case insensitive search using -i
option:
-v (--invert-match)
We can use -v
option to negate search, that is to print
all lines that don’t contain given pattern:
-r and -R
Both options can be used to perform recursive searches, the only difference
is that -R
will follow
symbolic links
during search while -r
won’t.
When we are performing recursive search often
we want to exclude some directory from search e.g.
.git
directory when we are searching inside GIT repository,
--exclude-dir
option allows us to do exactly that:
We may limit set of files that will be searched during recursive search using
--include
/--exclude
options. Both of these options take
shell GLOB as an argument.
--include
will force grep
to check only files that match GLOB.
--exclude
will force grep
to skip any files that don’t match GLOB.
For example to search for foo
pattern only in .txt
files we may use command:
Another useful option when performing recursive searches is -I
, it tells
grep
to skip binary files when looking for the pattern.
-w (--word-regexp)
Sometime we want to match only whole words e.g. when we search for foo
we don’t
want matches like foobar
or xfoox
. -w
option will force grep
to perform
whole word search:
-c (--count)
-c
option allow us to count number of occurrences of the pattern
inside searched files:
-n (--line-number)
-n
option will force grep
to prefix each found line with line number:
-l (--files-with-matches), -L (--files-without-match)
-l
option will force grep
to print only filenames of files that contain given pattern
instead of printing lines:
The is also -L
option that will print only filenames of files that
doesn’t contain specified pattern.
-h (--no-filename), -H (--with-filename)
-h
option will prevent printing of filenames when performing multifile search.
Similarly -H
option will force grep
to always print filenames:
-A (--after-context), -B (--before-context) and -C (--context)
-A
, -B
and -C
options allow us to print not only lines containing pattern
but also specified number of lines after (A) and before (B) them. -C
option is
a shortcut to set both -A
and -B
to the same value:
Basic regular expressions (BRE)
By default grep
interpret pattern as a basic regular expression (BRE).
BREs are similar to shell GLOBs but are more powerful. Inside BRE we may use
the following special characters:
| Character/Expression | Meaning |
|---|---|
. |
Matches any single character |
* |
Matches zero or more repetitions of previous character or group |
[abc] |
Bracket expression matches single character. [abc] matches any of the characters a , b or c . [0-9] matches any digit. [^abc] matches any character that is not a , b or c . [0-9abcdef] matches any lowercase hex digit. Finally we can use character classes inside bracket expressions e.g. [[:digit:]] |
^ |
Matches beginning of the line |
$ |
Matches end of the line |
Any of the special characters used in BRE may be escaped by preceding
them with a backslash (\
).
OK, now let’s see BRE in action:
BRE are even more powerful if we use grouping and more advanced operators.
Let’s start with grouping, we may create groups by surrounding parts of the pattern
with \(...\)
, then we may apply e.g. *
to the entire group. For example to find
all words that have even number of characters we may write:
This works because we are telling grep
that we want to find any
number of repetitions of pair of characters.
Sometime we search for pattern like phone number that have fixed number
of digits in each part, we may use \{...\}
operator to specify exact number
of repetitions of previous character or group:
| Expression | Meaning |
|---|---|
\{m\} |
Matches m repetitions of previous character or group e.g. a{3} matches aaa but not aa or abc . |
\{m,\} |
Matches at least m repetitions of previous character or group e.g. a{2} matches aa , aaa but not a . |
\{m,n\} |
Matches at least m and at most n repetitions of of previous character or group. |
For example to search for phone number in format XXX-XX-XXXX
we will grep
:
The last thing worth know about BRE is the possibility to use backreferences.
For example let’s say that we search for all five letters palindromes, we may use
\1
, \2
, etc. placeholders to tell grep
that we expect text that was matched by first group,
second group etc. in the place of placeholders:
NOTE: Sometimes we just want to search using old plain text pattern, we may disable BRE
using -F
grep option.
I didn’t described all BRE features, if you are interested in details
please check the standard.
IMHO BRE are ugly and cumbersome to use, in the next
section I will quickly describe extended regular expressions that bring full power of
regexes to grep
.
Extended regular expressions (ERE)
To enable extended regular expressions we must pass -E
(--extended-regexp
)
option to grep
. ERE are similar to BRE with the exception that we don’t need to
precede operators such as grouping with backslashes. To create a group in ERE
we simply use (foo)
pattern, and to specify number of matches for that group
we use (foo){3}
pattern.
This looks much more cleaner compared to BRE \(foo\)\{3\}
.
If we want to match
e.g. left parenthesis we need to escape it using backslash, for example to match main()
text we
could use main\(\)
pattern (or we could use -F
option to match text as it is).
In ERE in addition to all special characters from BRE we may use:
| Character/Expression | Meaning |
|---|---|
+ |
Matches one or more repetitions of previous character or group |
? |
Matches zero or one occurrences of previous character or group |
| |
Alternation - allows to match one of the specified patterns from set e.g. 0(x|X) will match 0x and 0X texts |
Now let’s see some examples of ERE in action:
Most modern versions of grep
support even more powerful versions of regular expressions
that include shortcuts for character classes like \d
for [0-9]
and \D
for [^0-9]
and more
advanced anchors like \b
(matches word start or end).
Check your local version of grep
to find out what features are available.
That’s all that I wanted to say about grep
command. Happy grepping!


Natural Language tool/dialog manager
ChatScript is the next generation chatbot engine that has won the Loebner's 4 times and is the basis for natural language company for a variety of tech startups.
ChatScript is a rule-based engine, where rules are created by humans writers in program scripts through a process called dialog flow scripting. These use a scripting metalanguage (simply called a "script") as their source code. Here what a ChatScript script file looks like:
#
# file: food.top
#
topic: ~food []
#! I like spinach
s: ( I like spinach ) Are you a fan of the Popeye cartoons?
a: ( ~yes ) I used to watch him as a child. Did you lust after Olive Oyl?
b: ( ~no ) Me neither. She was too skinny.
b: ( yes ) You probably like skinny models.
a: ( ~no ) What cartoons do you watch?
b: ( none ) You lead a deprived life.
b: ( Mickey Mouse ) The Disney icon.
#! I often eat chicken
u: ( ![ not never rarely ] I * ~ingest * ~meat ) You eat meat.
#! I really love chicken
u: ( !~negativeWords I * ~like * ~meat ) You like meat.
#! do you eat bacon?
?: ( do you eat _ [ ham eggs bacon] ) I eat '_0
#! do you like eggs or sushi?
?: ( do you like _* or _* ) I don't like '_0 so I guess that means I prefer '_1.
#!
#! I eat fish.
s: ( I eat _*1 > )
$food = '_0
I eat oysters.
Above example mentioned in article How to build your first chatbot using ChatScript.
Take this project and put it into some directory on your machine (typically we call the directory ChatScript, but you can name it whatever). That takes care of installation.
git clone https://github.com/bwilcox-1234/ChatScript
From your ChatScript home directory, go to the BINARIES directory:
cd BINARIES
And run the ChatScript engine
ChatScript
./LinuxChatScript64 local
Note: to set the file executable: chmod a+x ./LinuxChatScript64
./MacChatScript local
This will cause ChatScript to load and ask you for a username. Enter whatever you want. You are then talking to the default demo bot Harry
.
From your ChatScript home directory, go to the BINARIES directory and run the ChatScript engine as server ### Run the server on Windows
ChatScript port=1024
./LinuxChatScript64
./MacChatScript
This will cause ChatScript to load as a server.
But you also need a client (to test client-server communication). You can run a separate command window and go to the BINARIES directory and type
ChatScript client=localhost:1024
./LinuxChatScript64 client=localhost:1024
./MacChatScript client=localhost:1024
This will cause ChatScript to load as a client and you can talk to the server.
Run ChatScript locally. From the ChatScript command prompt, type
:build Harry
or whatever other preinstalled bot exists. If you have revised basic data, you can first:
:build 0
On windows if you have Visual Studio installed, launch VS2010/chatscript.sln
or VS2015/chatscript.sln
and do a build. The result will go in the BINARIES
directory.
On Linux, go stand in the SRC directory and type make server
(assuming you have make and g++ installed). This creates BINARIES/ChatScript, which can run as a server or locally. There are other make choices for installing PostGres or Mongo.
ChatScript Wiki (user guides, tutorials, papers)


This page was generated from docsrc/notebooks/adbscan_berlin_example.ipynb. Interactive online version:
Cluster points and explore boundary blurriness with A-DBSCAN¶
In this example, we will illustrate how to use A-DBSCAN (Arribas-Bel et al., 2019) with a sample of AirBnb properties in Berlin. A-DBSCAN will allow us do two things:
Identify clusters of high density of AirBnb properties and delineate their boundaries
Explore the stability of such boundaries
[4]:
%matplotlib inline
import pandas
import geopandas
import numpy as np
import contextily as cx
import matplotlib.pyplot as plt
from shapely.geometry import Polygon
from libpysal.cg.alpha_shapes import alpha_shape_auto
import sys
sys.path.append("../")
try:
from esda.adbscan import ADBSCAN, get_cluster_boundary, remap_lbls
# This below can be removed once A-DBSCAN is merged into `esda`
except:
print("Import from local folder...")
import sys
sys.path.append("../esda")
from adbscan import ADBSCAN, get_cluster_boundary, remap_lbls
Data¶
We will be using the Berlin extract from Inside Airbnb. This is the same dataset used in the Scipy 2018 tutorial on Geospatial data analysis with Python.
[5]:
tab = pandas.read_csv("data/berlin-listings.csv")
tab.head(2)
[5]:
| Unnamed: 0 | id | listing_url | scrape_id | last_scraped | name | summary | space | description | experiences_offered | ... | review_scores_value | requires_license | license | jurisdiction_names | instant_bookable | cancellation_policy | require_guest_profile_picture | require_guest_phone_verification | calculated_host_listings_count | reviews_per_month | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 0 | 17260587 | https://www.airbnb.com/rooms/17260587 |<PHONE_NUMBER>2235 | 2017-05-08 | Kunterbuntes Zimmer mit eigenem Bad für jedermann | Meine Unterkunft ist gut für paare, alleinreis... | NaN | Meine Unterkunft ist gut für paare, alleinreis... | none | ... | 10.0 | f | NaN | NaN | t | flexible | f | f | 3 | 2.00 |
| 1 | 1 | 17227881 | https://www.airbnb.com/rooms/17227881 |<PHONE_NUMBER>2235 | 2017-05-08 | Modernes Zimmer in Berlin Pankow | Es ist ein schönes gepflegtes und modernes Zim... | Das Haus befindet sich direkt vor eine Tram Ha... | Es ist ein schönes gepflegtes und modernes Zim... | none | ... | 10.0 | f | NaN | NaN | t | flexible | f | f | 1 | 1.29 |
2 rows × 96 columns
The original dataset includes more than 20,000 observations:
[6]:
tab.shape
[6]:
(20053, 96)
To make the illustration run a bit speedier on any hardware, let us pick a random sample of 10% of the set; that is we’ll pick 2,000 properties at random:
[7]:
tab = tab.sample(n=2000, random_state=1234)
For convenience, we convert into a GeoDataFrame
where the geometries are built from the lon/lat columns in the original table:
[8]:
db_ll = geopandas.GeoDataFrame(tab,
geometry=geopandas.points_from_xy(tab.longitude, tab.latitude),
crs={'init': 'epsg:4326'}
)
/home/serge/anaconda3/envs/analytical/lib/python3.7/site-packages/pyproj/crs/crs.py:53: FutureWarning: '+init=<authority>:<code>' syntax is deprecated. '<authority>:<code>' is the preferred initialization method. When making the change, be mindful of axis order changes: https://pyproj4.github.io/pyproj/stable/gotchas.html#axis-order-changes-in-proj-6
return _prepare_from_string(" ".join(pjargs))
Because we are going to run an algorithm that relies on distances, we need to be able to calculate such distances in a projected plane. Instead of the original lon/lat coordinates, we use the `ETRS89
<http://epsg.io/5243>`__ projection, designed for Germany and expressed in metres:
[9]:
db = db_ll.to_crs(epsg=5243)
Voila! We can now visualise our dataset:
[10]:
ax = db.plot(markersize=0.1, color='orange')
cx.add_basemap(ax, crs=db.crs.to_string());
And before we get going, we will also pull out the projected coordinates into separate columns:
[11]:
db["X"] = db.geometry.x
db["Y"] = db.geometry.y
Identify clusters of AirBnb¶
A-DBSCAN, similar to the original DBSCAN algorithm, requires two parameters before it can be run:
eps
: maximum distance to look for neighbors from each locationmin_samples
: minimum number of neighboring points required for a point to be considered part of a cluster
For this example, we will pick a 1% of the overall sample size for the min_samples
parameter:
[12]:
db.shape[0] * 0.01
[12]:
20.0
We will use a maximum radious of 500m for the eps
parameter. This implicitly implies we are looking at a density of at least about 25 properties per Sq. \(Km^2\) (\(dens = \frac{20}{\pi \, \times \, 0.5^2}\)).
Once we know the parameters we’ll use, we can go ahead and run A-DBSCAN:
[13]:
%%time
# Get clusters
adbs = ADBSCAN(500, 20, pct_exact=0.5, reps=10, keep_solus=True)
np.random.seed(1234)
adbs.fit(db)
CPU times: user 708 ms, sys: 4.81 ms, total: 713 ms
Wall time: 708 ms
[13]:
ADBSCAN(eps=500, keep_solus=True, min_samples=20, pct_exact=0.5, reps=10)
Once fit()
, we can extract the labels in a similar way that we would from scikit-learn
, and then we can plot on a map:
[14]:
ax = db.assign(lbls=adbs.votes["lbls"])\
.plot(column="lbls",
categorical=True,
markersize=2.5,
figsize=(12, 12)
)
cx.add_basemap(ax, crs=db.crs.to_string());
This only displays each property colored based on its label assigned. Beyond this, we can also create polygons that represent a tight boundary around all the points in a given cluster. To do this, we use the \(\alpha\)-shapes algorithm through the helper function get_cluster_boundary
:
[15]:
%time polys = get_cluster_boundary(adbs.votes["lbls"], db, crs=db.crs)
CPU times: user 1.69 s, sys: 4.19 ms, total: 1.7 s
Wall time: 1.69 s
These polygons can also be plotted as any other GeoSeries
object:
[16]:
ax = polys.plot(alpha=0.5, color="red")
cx.add_basemap(ax, crs=polys.crs.to_string());
And, just for fun, we can create more zoomed-in views, dimming out areas outside each cluster:
[17]:
f, axs = plt.subplots(1, 3, figsize=(18, 6))
for i, ax in enumerate(axs):
# Plot the boundary of the cluster found
ax = polys[[i]].plot(ax=ax,
edgecolor="red",
facecolor="none"
)
# Add basemap
cx.add_basemap(ax,
crs=polys.crs.to_string(),
url=cx.providers.CartoDB.Voyager,
zoom=13
)
# Extra to dim non-cluster areas
(minX, maxX), (minY, maxY) = ax.get_xlim(), ax.get_ylim()
bb = Polygon([(minX, minY),
(maxX, minY),
(maxX, maxY),
(minX, maxY),
(minX, minY)
])
geopandas.GeoSeries([bb.difference(polys[i])],
crs=polys.crs
).plot(ax=ax,
color='k',
alpha=0.5
)
ax.set_axis_off()
ax.set_title(f"Cluster {polys[[i]].index[0]}")
plt.show()
/home/serge/anaconda3/envs/analytical/lib/python3.7/site-packages/ipykernel_launcher.py:12: FutureWarning: The "url" option is deprecated. Please use the "source" argument instead.
if sys.path[0] == '':
/home/serge/anaconda3/envs/analytical/lib/python3.7/site-packages/ipykernel_launcher.py:12: FutureWarning: The "url" option is deprecated. Please use the "source" argument instead.
if sys.path[0] == '':
/home/serge/anaconda3/envs/analytical/lib/python3.7/site-packages/ipykernel_launcher.py:12: FutureWarning: The "url" option is deprecated. Please use the "source" argument instead.
if sys.path[0] == '':
Explore boundary blurriness¶
One of the key benefits of A-DBSCAN is that, because it relies on an ensemble approach that generates several candidate solutions, it allows us to explore to what extent boundaries are stable and clearcut or blurrier. To do this, we need to extract from the ADBSCAN
object each candidate solution and turn them into boundary lines (this may take a little bit to run):
[18]:
%%time
solus_rl = remap_lbls(adbs.solus, db, n_jobs=-1)
lines = []
for rep in solus_rl:
line = get_cluster_boundary(solus_rl[rep],
db,
crs=db.crs,
n_jobs=-1
)
line = line.boundary
line = line.reset_index()\
.rename(columns={0: "geometry",
"index": "cluster_id"}
)\
.assign(rep=rep)
lines.append(line)
lines = pandas.concat(lines)
lines = geopandas.GeoDataFrame(lines, crs=db.crs)
CPU times: user 644 ms, sys: 1.24 s, total: 1.88 s
Wall time: 4.61 s
Here is a first look at all the solutions drawn up from the simulation:
[19]:
ax = lines.plot(color="#FFDB58",
linewidth=0.5
)
cx.add_basemap(ax,
alpha=0.5,
url=cx.providers.Stamen.TonerHybrid,
crs=lines.crs.to_string()
)
/home/serge/anaconda3/envs/analytical/lib/python3.7/site-packages/ipykernel_launcher.py:7: FutureWarning: The "url" option is deprecated. Please use the "source" argument instead.
import sys
Having every single candidate boundary stored and labelled into a table, it allows us to make several queries. For example, here are all the solutions generated in the first replication:
[20]:
lines.query("rep == 'rep-00'").plot()
[20]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f8442e49f90>
And here we have all the candidate solutions for cluster label No. 2:
[21]:
lines.query("cluster_id == '2'").plot()
[21]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f8442d88d10>
Finally, we can take this idea into an interactive context by building widgets that allow us to brush through replications:
[22]:
from ipywidgets import interact, IntSlider
[23]:
def plot_rep(rep):
f, ax = plt.subplots(1, figsize=(9, 9))
ax.set_facecolor("k")
# Background points
db[["X", "Y"]].plot.scatter("X", "Y", ax=ax, color="0.25", s=0.5)
# Boundaries
cs = lines.query(f"rep == 'rep-{str(rep).zfill(2)}'")
cs.plot(ax=ax, color="red")
# Cluster IDs
for s, row in cs.iterrows():
ax.text(row.geometry.centroid.x,
row.geometry.centroid.y,
s,
size=20,
c="w"
)
return None
reps = range(len(lines["rep"].unique()))
slider = IntSlider(min=min(reps), max=max(reps), step=1)
interact(plot_rep, rep=slider);
Or to pull out all solutions for a given cluster IDs:
[24]:
def plot_cluster(cluster_id):
f, ax = plt.subplots(1, figsize=(9, 9))
ax.set_facecolor("k")
# Background points
db[["X", "Y"]].plot.scatter("X",
"Y",
ax=ax,
color="0.25",
s=0.5,
alpha=0.5
)
# Boundaries
lines.query(f"cluster_id == '{cluster_id}'").plot(ax=ax,
linewidth=1,
alpha=0.5
)
return None
interact(plot_cluster, cluster_id=lines["cluster_id"].unique());


Pick objects |
|||||||||||||||||||
|
This tool allows to directly pick objects on the canvas by clicking or drawing a frame. The configuration area of the tool includes a mask where all selectable object types are defined. With the buttons All and None every object can be quickly selected or unselected. The same buttons in the Select area however, only apply to the selecting mask.
|
|||||||||||||||||||
| |||||||||||||||||||
Clipboard |
|||||||||||||||||||
|
The clipboard tool copies graphics data into the system wide clipboard. With it a frame is defined on the canvas which is copied as bitmap data by clicking the Confirm icon. That data can be pasted again within Wonderbrush or other applications. In Wonderbrush this is done with Edit->Paste. The menu item is only selectable when there's data in the clipboard. Pasting creates a new bitmap object and automatically activates the transfomation tool.
|
|||||||||||||||||||
| |||||||||||||||||||
Crop |
|||||||||||||||||||
|
A canvas can be cut but also grown with the cropping tool. If the Subpixels option is active, the frame that defines the new canvas size doesn't lock exclusively onto whole pixel positions. Therefore, objects will be marginally moved when the tool is applied.
|
|||||||||||||||||||
| |||||||||||||||||||
Transform |
|||||||||||||||||||
|
The tool displays a frame around all in the list selected objects, which is used to move, rotate, and resize them as a group. As soon as the frame is manipulated, the transformation begins and can be edited until the Confirm icon is clicked. Within this action single steps of the transformation can be undone. After the transformation was applied, it can only be reverted completely. Plus, the frame will be reset to start a new transformation.
|
|||||||||||||||||||
| |||||||||||||||||||
Edit gradient |
|||||||||||||||||||
|
This tool edits the Gradient property of the selected object. For that, the (fill)-Mode property has to be set to Gradient. If an appropriate object is marked, the tool displays a frame around the area covered by the gradient. The gradient can be transformed with this frame. The configuration area of this tool shows, among other things, a control that allows to change the colors of the gradient. By clicking, the active gradient point is set, which also adjusts the currently set color. If the current color is changed while a gradient point is active, this color is automatically transferred to that gradient point. The Opacity control refers to the currently active gradient point as well. The option Inherit Transformation determines if the gradient information is independent of the object or not. By default, a gradient is moved together with the object it fills.
|
|||||||||||||||||||
| |||||||||||||||||||
Brush |
|||||||||||||||||||
|
The brush tool works best with a graphic tablet, because the Opacity, Radius and Hardness is dynamically controlled with the pen's pressure. The parameters that are to be pressure controlled are activated with the checkbox to the upper right of the respective slide control. The slider then shows two small handles, representing the minimal and maximal pressure. Currently, only circular brush tips are supported. Clicking on the brush preview opens a window where sets of brushes can be edited and saved. The option Subpixels defines if the mouse or pen position is scanned also between pixel coordinates. The option Solid prevents the generation of interim values of the opacity of an object. The Spacing slider controls the positioning of the brush's form along its path.
|
|||||||||||||||||||
| |||||||||||||||||||
Pen |
|||||||||||||||||||
|
The pen works quite similar to the brush, only its tip is always just one pixel in size. That's why the parameters for Radius, Hardness, and Distance don't apply.
|
|||||||||||||||||||
| |||||||||||||||||||
Eraser |
|||||||||||||||||||
|
The eraser works exactly like the brush, only that the created brush objects' Mode properties are automatically set to Erase. By changing their Mode property, brush objects can be converted to eraser objects and vice-versa at any time.
|
|||||||||||||||||||
| |||||||||||||||||||
Pen eraser |
|||||||||||||||||||
|
The pen eraser is to the pen what the eraser is to the brush: It creates pen objects in Erase mode.
|
|||||||||||||||||||
| |||||||||||||||||||
Clone brush |
|||||||||||||||||||
|
The clone brush copies parts of the picture, using the same parameters for adjusting the shape of the tip as the brush tool. When activated, the first click sets the source. The second click then defines the direction and length for the movement and starts the cloning. By pressing the command key (depending on your system configuration that's Ctrl or Alt), a new vector of movement is set. The interesting feature of the clone tool in Wonderbrush is that the clone objects are refreshed when the source is changed. That means, the clone function is dynamically generated.
|
|||||||||||||||||||
| |||||||||||||||||||
Blur brush |
|||||||||||||||||||
|
The blur brush is another "brush-based" tool. It blurs the areas of the picture that are under the brush tip. After creation, the blurred radius can currently only be changed in the property list.
|
|||||||||||||||||||
| |||||||||||||||||||
Bucket fill |
|||||||||||||||||||
|
This tool replaces one color in the picture with another. The Tolerance parameter controls to what extend similar colors will be filled as well. The setting Softness reflects the needed tolerance of the opacity channel of the created object (i.e. the higher the divergence from the base color, the lower the resulting opacity). When the option Contiguous Area is deactivated, all areas of the chosen color will be filled, regardless if it creates several independent filled areas. Clicking into the canvas defines the base color and creates a bucket fill object. That object has a fixed opacity mask (see "Objects"), that is transferred with the set mode onto the layer. Therefore, by adjusting the Mode property, a bucket fill object can also be used for erasing or a gradient.
|
|||||||||||||||||||
| |||||||||||||||||||
Text |
|||||||||||||||||||
|
The text tool isn't just for simple labeling, it can also create whole blocks of text. While the settings are therefore more complex, you probably already know most functions from other applications. Clicking on the canvas produces a new text object with the currently set parameters. On the canvas, the text tool displays a line with two handles that control the width and the indention of the text block. Currently, the text isn't displayed directly on the canvas, but in a text field inside the tool area. That's where the most important parameters like font type and size are located. A lot of other settings are adjusted in the property list of the text object. Some of the maybe not so widely known settings are explained below: Spacing is a factor for the tracking, which controls if letters are placed closer together or wider apart. Line Spacing is a factor for the line spacing, based on the font size. P. Spacing is another factor and defines the distance between two paragraphs in relation to the normally used line spacing. Hinting means that the shapes of letters are slightly distorted and moved in order to fit the important form elements better onto the available pixels and thereby improving the readability on the screen. However, with scaled or rotated text objects, this option loses its sharpening effect. Kerning effects the distance between single letters and uses possibly available additional information of the font that can improve the typeface. If, for example, after a capital T follows a small e, the e can be moved closer to the T, although that means it won't have the normal tracking. If the T is followed by an i, the normal tracking of the T is used, to prevent the letters from overlapping. If Kerning is deactivated, the "normal" tracking is always used, regardless of the letter combination. Solid deactivates the antialiasing for letters. Other object types offer this option as well.
|
|||||||||||||||||||
| |||||||||||||||||||
Shape |
|||||||||||||||||||
|
The shape tool produces so called vector paths. They can describe the borders of an area or are displayed as lines or curves with a certain width. A vector path runs along so called "control points", which are exactly what is created or edited by the shape tool. A control point consists of max. three "sub-points". The vector path runs always through the main control point. Each of the other two points define the tangent in which the path enters or leaves the main point. Thus any curve can be described very easily. Wonderbrush signals the various editing possibilities with different mouse pointers. Creating a new pointA new point is created by clicking into an empty area; it sets the position of the main control point. Keeping the mouse button pressed, the leaving tangent can be edited. The entering tangent is automatically mirrored. Editing a pointIf the mouse pointer is over an existing point, its position can be moved. If the main control point is moved, it takes its tangent points with it. If one tangent point is moved, Wonderbrush adjusts the other one in way that they remain on a line. This connection can be severed to achieve a corner in the path (more on that later). Inserting a pointIf the mouse pointer hovers over the vector path itself, a new point can be inserted. It will be inserted in a way that maintains the shape of the path, automatically adjusting the preceding and following points. Keeping the mouse button pressed, the leaving tangent can be edited just like when "creating a new point". Closing a pathClicking the first control point "closes" the path. Then, the default behavior for areas outside the path isn't "insert point" anymore, but "select point". Paths created in Outline mode can't be closed by clicking the first point. Here, it's done by checking the control Closed. Extended functionsDeleting a point /When pressing the Alt key (or Ctrl if Alt is configured as command key on your system), clicking on a point will delete it. This works too if the point is a tangent point. Square corner /To delete both tangent points at once, the main control point is clicked while holding the Ctrl key (or Alt if that is configured as command key on your system). Afterwards, the leaving tangent point can be created once more by keeping the mouse button pressed while dragging over the main control point. The entry tangent point will again be mirrored accordingly. If the Ctrl (or Alt) key is pressed while clicking on a tangent point, the point can be moved separately without disturbing the other tangent point. Now the connection between tangent points is severed and they are not in line anymore. From now on they are individually movable. To re-establish the connection, hold down the Ctrl (or Alt) key, click on the main control point to delete both tangent points and drag out two new ones. Selecting pointsYou may have noticed that the last clicked control point always stays selected. You can add points to the selection (and remove them) by clicking while holding the shift key. The shift key always triggers the "select point" mode, offering a selection frame when you click outside the path. The selection state of all points inside that frame is then inverted. A click into an empty area will clear the selection of all points. Transforming a selectionThese selected points can be moved or transformed as a group. Either the points are moved pixel by pixel with the cursor keys (for more precise movement hold down the shift key), or you click on the Transform icon in the shape tool configuration (not the general transformation tool for objects). The latter option allows a more complex transformation on the selected group. Deleting a selectionClicking the icon Delete control points deletes the selected points. In case that all points of a path were selected, the whole (sub)path of the shape object will be deleted. Alternatively, the Del key can also be use for deletion. SubpathsA single shape object can consist of several independent paths. If paths overlap, the Filling Rule property defines if an area is "outside" or "inside" the shape area.
Note that these rules only apply for the paths of a single shape object. Several shape objects on the same layer do not influence each other as described, but are superimposed like normal objects. The function Object->Special->Merge Shapes combines several shape objects. This creates one shape object from all in the list marked objects and now includes all the subpaths of the formerly separate objects.
To get a new subpath, the icon New path has to be activated. It stays active until the user clicks outside the existing paths to plant the first control point of the new path. (To leave this mode, either click on the Cancel icon or press the Esc key.) Reversing the pathThe order in which the control points are set, establishes a direction of the path. As that direction can be crucial for the Filling Rule, a function is needed to reverse the path. That's done by the icon Reverse Path. The first control point becomes the last and so on. That option also becomes interesting if you want to add new control points to the beginning of the path instead of the end.
|
|||||||||||||||||||
| |||||||||||||||||||
Ellipse/(Rounded) Rectangle |
|||||||||||||||||||
|
This tool produces a predefined shape object: an ellipse or a rectangle. By clicking and dragging a new object with the according size is created. An additionally pressed shift key locks the aspect ratio, resulting in circles and squares. After that these objects are treated as normal shape objects, so further editing happens with the shape tool.
|
|||||||||||||||||||
| |||||||||||||||||||
Dropper |
|||||||||||||||||||
|
The dropper tool picks a color from the canvas. This simply sets the current color. Depending on the size of the tip a mixed color from a group pixels is generated. |
|||||||||||||||||||
| |||||||||||||||||||
Guides |
|||||||||||||||||||
|
Guides help with aligning objects, but aren't themselves part of the picture and can also be hidden. With the New icon, a new guide is inserted as defined in the tool's controls. Active guides are displayed bright red and can be precisely positioned with their control fields. Perfectly vertical guides have an Angle of 0, horizontal ones of 90 degrees.
|


About Us, our product and our community.
Separating the signal from the noise, we curate only the most qualitative and the most relavant code+design content. A fresh, noise-free podcast every Wednesday and a Newsletter every Sunday.
---
title: About us, our product and our community.
description: Hello there, readers!
type: light
color: 4f2916
image: "img/snooping.jpg"
---
Separating the signal from the noise, we curate only the most qualitative and the most relavant code+design content. A fresh, noise-free podcast every Wednesday and a Newsletter every Sunday.
About Us, our product and our community.
"coDesign" has the features you want.
Join us on Twitter, Telegram, Facebook, Instagram or GooglePlus. What's even better is the fact that you can join us our team of awesome, passionate individuals. All you need to do is drop a message in our Telegram group.


|
|
Restore
This is one of the main applications of this program. Just give some inputs and we will try to restore it.
Required inputs
You will need an image which you wish to restore. You need to provide the following parameters:
- Type of filter
- Blur length
- Blur angle
- Additional parameters depending on the type of filter
Click Here to know what these parameters mean.
Note:
- Use the 'Estimate' button to let us estimate what values are right for your image to restore.
- The angle estimate button returns 10 highly probable blur angles. Use the 'Next' button to go through the possible values.
Types of Filters
- Inverse Filter:
This is a very basic restoration filter. It does not require any other parameter. This filter generally gives poor results thus we do not recommend it.
- Wiener Filter:
This filter gives descent results. Its quite fast too. It requires Signal to Noise Ratio (SNR). Lower the SNR, better the results.
Note: Use the 'Estimate SNR' button to let us recommend you some value.
- Lucy - Richardson:
This filter is one of the most robust filters. Its immune to almost everything. Since it is an iterative filter, it requires the no. of iterations.
Note: Increasing the iterations significantly increases the amount of time taken to restore an image. Keep no. of iterations to approximately 100.
- Compare Filters:
You can compare the results of the different filters. We provide an indepth report to help you assist in selection of the right filter. Comparison is done using some predefined methods.
How to Restore?
Just follow these steps to restore an image:
- Open a degraded image.
- Input the blur parameters 'Length' & 'Angle'. Use the slider or the text field to enter these parameters.
- Select the additional parameters if needed.
- Click on 'Restore Image' button.
Tips:
- Use the 'Estimate' button to let us estimate what values are right for your image to restore.
- You can also save the degraded image from the File->Save.
Note:
- Our estimation may go wrong. They are approximate values. So for efficient restoration try other values too.
- This program can work only on gray scale image. Incase you input a color image, it will be converted to gray scale image.
- There is the 'Expert Mode' which you can use once you get an idea of how the estimation algorithms work.
- 'Expert Mode' in angle estimation displays the edges in the image. From there you can say whats the blur angle.
- 'Expert Mode' in length estimation shows a plot. The first negative value is the blur length.
|


I have been reading through the posts here, lately, and while I have found a wealth of extremely useful information, I have come across an unfortunate lack of information, from a single source, relating different methods of ingestion for MG seeds. This, above all, is the purpose of my report. Please note that the first two experiences of mine were accomplished with a simple water extraction, and the third by direct consumption. Then, note the dosage differences. I'll do my best to relate this in as accurate fashion as I can. Here goes:
Experience 1:
Dosage and Method:
200 seeds each (water extraction)
400 MG seeds (Heavenly Blue variety) were rinsed to remove any dirt or other natural residues (our seeds were untreated, but better safe than sorry). The seeds were crushed up in a mortar and pestle as finely as possible. This was extraordinarily difficult, and some material was doublessly lost in this step. The 400 seeds were left in the mortar, and hand-warm tap water was poured in (approx 2 cups). The mortar, which was transparent, was covered in aluminum foil to prevent light degradation of the alkaloids. The seeds soaked for approximately 12 hours. The seed matter was then decanted off as completely as possible, and the liquid split between myself and my wife, giving us each an approximate dosage of 200 seeds. I took two dramamine, and both of us took a 500 mg tablet of vitamin C. The liquid was then imbibed, using orange juice as a chaser. 2:00 pm. NOTE HERE: The water extraction is EXTREMELY low in efficiency. I'd estimate 40%, maybe 50% efficiency.
Effects:
My wife, who is more affected by these things than I, saw some trailers.   Extremely tranquil feeling. Everything was just simply amazing. The cat was very very soft. I think it took about thirty minutes after ingestion to begin to take effect (the smiling phase), and neither one of us had eaten all that much that day. Some nausea for my wife, but none for me (probably the dramamine), and extremely tired to begin with. My wife's nausea wore off, though, and it was all good. Took about 2, maybe 2 and a half hours to peak. Peak lasted about 2 hours, and then the let down was nice and slow. Mellow the whole way.
Experience 2 (approx 2 weeks after ex. 1):
Dosage and Method:
300 seeds for two of us, 250 for my wife (water extraction)
The seeds were kept separate this time, crushed up in a coffee grinder (which was a HELL of a lot easier, and made a much finer powder), taking great care to only run it for a few seconds at a time so as not to build up too much heat from the motor.  The teabags were suspended in approximately a cup and half of water each, in separate containers, and left in a dark cabinet for three days. The liquid (which contained no solids whatsoever) was then imbibed, along with dramamine for all (less drowsy formula for me, normal for the other two). Again, vitamin C and orange juice for all. 3:00 pm.
Effects:
The liquid was much more brown this time, and tasted far far worse. My wife had a hard time getting it down, and it caused everyone but me stomach problems just by taste alone. As for effects, I didn't really get anything this time. General good feelings, but no visuals of any kind. My wife took more journeys. The third member, who I'll call M, went fairly well nuts.
He spent the better part of the evening in the upstairs area with the black-light and fluorescent crayons free associating onto paper. When he ran out of paper, he'd continue on another sheet, tossing them all in a pile on the floor.  Some synesthesia for M, too. He had a headache, for instance, that was purple with velvet leaves, and not at all unpleasant as a result. My wife went outside for a bit, and said the stars were pretty damned cool. Bright and sparkly, etc. Same time frame. 30 minutes or so to kick in. Two hours or so to peak. Two hour peak. The let down time here was a little quicker, but I think it was because we were playing video games, so our brains were kept busy, or something.
Experience 3 (approx 2 weeks after ex. 2):
Dosage and Method:
150 seeds each (direct approach)
I knew the water extraction method was terribly inefficient, so I wanted to find a better way to do it. That, and the liquid was getting steadily less tolerable to drink. So this time we did it thusly: The 150 seed doses were kept separate, and ground up in a coffee grinder. The ground seeds were put in applesauce and ingested directly. I put some fresh ground coffee in mine, too, figuring the caffeine would be good. It was, but it tasted gross, so I don't reccommend it. The applesause, however, completely masked the taste of the MG seeds, and wasn't difficult to eat, coffee grounds notwithstanding. Both of us took dramamine (less drowsy variety) and vitamin C tablets. We ate our electric applesauce. We both had ginseng tea, too, for energy. 9:00 pm.
Effects:
Started watching Half Baked on TV. Smiley phase started after 30 to 45 minutes. Time started to get distorted after about an hour. The commercials after Half Baked seemed to take FOREVER, but by the time they were over, only a few minutes had passed.  The two hour mark came and went and I didn't feel any more than I usually did - that extremely comfortable 'damn, this bed is soft' feeling (made even better by my silk pajamas).
Then I closed my eyes and found that M.C. Escher had taken residence in my eyelids. Visuals galore! Everywhere! Everything was made of rainbows and snowflakes. I watched cartoons in the frosted bathroom window for at least fifteen minutes. Images every half second or so would show up like slow animation, but with an actual storyline I could follow. With the lights off, I looked like Jesus in the mirror for some reason. It is just impossible for me to describe everything that happened this time, so just suffice to say that it was absolutely incredible.
Summary and Conclusions:
The water extraction method, while great for some people, just doesn't cut it for me anymore.   Remember your dramamine and Vitamin C. My wife compared our last trip to about 5 hits of acid, and hers was a little more intense than mine. She weighs a little more than me, too, so you can't really use that as a concrete basis for dosage. So, in conclusion, 150 seeds in applesause is my friend. Be safe, and have fun!
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.


As usual, answer all questions in a plain text file named questions3.txt
. Failure to do so will result in a 0. At the top of your plain text file, include your name, student ID, and lab section.
In class, we discussed hexadecimal as a convenient representation of numbers. One place where that gets used frequently is specifying colors on web pages. For the next several questions, you are encouraged to use the web to find any answers you don't already know.
How many hexadecimal digits are used to specify a color in a web page? How many bits do these hexadecimal digits correspond to?
What are the primary colors specified by these hexadecimal values? How many bits are assigned to each color? What is the range of values for each of the primary colors used on web pages?
There are about 16 million possible colors that can be specified in this way. A relatively small subset have been given standard names. What are the hexadecimal values for the following colors: Heliotrope Purple, Dimorphotheca Magenta, and Rubber Ducky Yellow? For each of those hexadecimal values, what are the corresponding RGB values?
In HTML, we can include any Unicode characters. All special characters in HTML are specified in the form:
&spec;\
These special characters all start with the ampersand and end with a semicolon. How would you specify the symbols ¬ , ∨ , and ∧ in HTML?
You've had some fun playing with the applications of hexadecimal. Now, let's take a deeper look at the fundamentals of hex. Make a table with 16 rows and 4 columns. The columns should be Base 10, Base 2, Base 4, and Base 16. The rows should be the numerical values for 0 through 1510 in each base. Each number in each column should have the same number of digits, so pad as necessary.
So if you did the table properly and padded properly, you might start to notice some patterns. What patterns did you find?
If you found the patterns, this question will be super easy. Convert this binary number to hexadecimal. Then, convert it to base-4.
011010011101101011011011111011101111010000100000
In the past few labs, we've been introducing HTML. We're gonna take the table you just wrote for Question 5, and make it in HTML. In an HTML file called numbers.html
recreate the table from Question 5.
A table begins with the string:

and ends with the string:

This is typical of many parts of HTML. In HTML, things enclosed in angle brackets are called tags. Many tags come in pairs where the first opens a structure and the structue is closed by the same tag with a slash prepended. Here, the table is specified between the

tag and the

tag.
Tables are composed of rows, each of which has a number elements. What are the tags used to start and end a row of a table? What are the tags used to begin and end a table data element?
Let's talk more about colors. In particular, we're going to manipulate the binary numbers that describe the colors. The numbers are generally taken to be unsigned, but just for fun, we're going to treat them as signed numbers. Then after negating them, we'll treat the resulting bit patterns as unsigned numbers and display the resulting colors.
What we've been doing is looking at them as hexadecimal values like #FFFFFF or as base-10 RGB values. Let's look more into the binary. The reason we have 256 shades of colors is because that fits very nicely with a power of 2. This means, it's much easier to represent colors in binary. Let's look at plain red. Plain red has a hex value of #FF0000 and an RGB value of (255, 0, 0). Red, as a binary RGB value is (11111111, 00000000, 00000000). As we learned in class, there is a variety of ways to represent binary numbers. Right now, we are using an unsigned approach. What if we took a signed approach?
Let's take all our values and negate them using sign magnitude. 11111111 would become 01111111 which is now<PHONE_NUMBER>0 would become 10000000 which is now -0, or just normal 0. However, RGB values only take unsigned numbers. If we interpret our signed 10000000 and interpret it as unsigned, it's 128. Our new RGB value for negative red is now (127, 128, 128).
Let's do the same thing with one's complement! 11111111 would become 00000000 which is 0. 00000000 would become 11111111 which is -0. Since RGB doesn't take negative values, we'll just interpret this as unsigned and use 255. So now the RGB value for one's complement negative red is (0, 255, 255).
Finally, let's do this all again with two's complement. 11111111 will become 00000001 which is 1. 00000000 will become 00000000 which is 0. Negative red in two's complement is now (1,0,0). I made a table below of the colors.
| Unsigned | Sign Magnitude | One’s Complement | Two’s Complement |
|---|---|---|---|
| #FF0000 | #7F8080 | #00FFFF | #010000 |
For the grand finale of this lab, complete this table with blue (#0000FF), green (#00FF00), rubber ducky yellow, heliotrope purple, dimorphotheca magenta, and at least two more colors of your own choosing. You can put this table in your numbers.html file. Include a link to this on your index.html
PSSST! To specify the background color of a table data element, you can use the bgcolor property.
Submit on BBLearn
questions3.txt : A plain text file with your answers to the questions
Webpage on tux
numbers.html : Your resulting webpage you make in Question 8 and 9.


The Editorial Board
Chief Editor:
Dmytrychenko Mykola Fedorovych, Doctor of Engineering Sciences, Professor.
Deputy Chief Editors:
Biliakovych Mykola Oleksiyovych, Candidate of Engineering Sciences, Professor
Dmytriev Mykola Mykolayovych, Doctor of Engineering Sciences, Professor
Editorial board:
- M.F. Dmytrychenko, Doctor of Engineering Sciences, Professor (Chair)
- M.M. Dmytriev, Doctor of Engineering Sciences, Professor (Deputy Chair)
- T.A. Vorkut, Doctor of Engineering Sciences, Professor
- О.І. Melnychenko, Candidate of Engineering Sciences, Professor
- М.О. Biliakovych, Candidate of Engineering Sciences, Professor (Deputy Editor)
Editorial team:
[Technical Unit]
- Al-Ammouri Ali, Doctor of Engineering Sciences, Professor, NTU
- I.P. Hameliak, Doctor of Engineering Sciences, Professor, NTU
- O.K. Hryshchuk, Candidate of Engineering Sciences, Professor, NTU
- V.I. Huliaev, Doctor of Engineering Sciences, Professor, NTU
- Y.F. Hutarevych, Doctor of Engineering Sciences, Professor, NTU
- V.D. Danchuk, Doctor of Physical and Mathematical Sciences, Professor, NTU
- М.P. Kuzminets, Doctor of Engineering Sciences, Professor, NTU
- І.А. Loza, Doctor of Physical and Mathematical Sciences, Professor, NTU
- О.V. Marchuk, Doctor of Engineering Sciences, Professor, NTU
- V.P. Polishchuk, Doctor of Engineering Sciences, Professor, NTU
- E.K. Posviatenko, Doctor of Engineering Sciences, Professor, NTU
- H.S. Prokudin, Doctor of Engineering Sciences, Professor, NTU
- A.M. Redziuk, Candidate of Engineering Sciences, Professor, NTU
- V.Y. Savenko, Doctor of Engineering Sciences, Professor, NTU
- V.P. Sakhno, Doctor of Engineering Sciences, Professor, NTU
- O.S. Slavinska, Doctor of Engineering Sciences, Professor, NTU
- R.A. Khabutdinov, Doctor of Engineering Sciences, Professor, NTU
- V.О. Khrutba, Doctor of Engineering Sciences, Associate Professor, NTU
[Economic Unit]
- A.V. Bazyliuk, Doctor of Economic Sciences, Professor, NTU
- V.V. Bobyl, Doctor of Economic Sciences, Associate Professor, DNUZT (Dnipro)
- Н.М. Bondar, Doctor of Economic Sciences, Professor, NTU
- А.P. Hrechan, Doctor of Economic Sciences, Professor, NTU
- O.O. Karpenko, Doctor of Economic Sciences, Professor, DUIT
- O.M. Kirilenko, Doctor of Economic Sciences, Professor, NAU
- L.S. Kozak, Candidate of Economic Sciences, Professor, NTU
- V.V. Konceva, Candidate of Economic Sciences, Professor, NTU
- О.М. Lozhachevska, Doctor of Economic Sciences, Professor, NTU
- V.O. Novak, Candidate of Economic Sciences, Professor, NAU
- K.М. Razumova, Doctor of Economic Sciences, Professor, NAU
[Foreign members of the Editorial team]
- Guido Kaufmann, University of Paderborn, Germany
- Vyacheslav Nikitin, University of Paderborn, Germany
- Dr. Ivan Daric, University of Zagreb, Croatia
- Dr. Jana Kucerova, Matej Bel University, Banska Bystrica, Slovakia
- Dr. Kazimirz Lejda, Rzeszowska Politechnika, Poland
- Dr. Klaus Rosenthal, University of Paderborn, Germany
- Dr. Miroslaw Smieszek, Rzeszowska Politechnika, Poland
- Dr. Richard Fortmyuller, Vienna University of Economics and Business Administration, Austria
- H.М. Kukharonok, Doctor of Engineering Sciences, Belarusian National Technical University, Belarus
Editorial board secretary: Shumeiko Oleksii Andriiovych, Associate Professor.


Upgrades¶
While more detailed information can be found at their respective pages, here are all the tables relating to upgradable objects.
Buildings¶
You can upgrade buildings that improve your city in various ways.
Police Station¶
To upgrade, do actions.add_effort(city.buildings[BuildingType.police_station], amount)
.
| Level | Effort Required | Damage Mitigated |
|---|---|---|
| Base | 0 | 50% |
| 1 | 40750 | 75% |
Gelato Shop¶
To upgrade, do actions.add_effort(city.buildings[BuildingType.gelato_shop], amount)
.
| Level | Effort Required | Damage Mitigated |
|---|---|---|
| Base | 0 | 50% |
| 1 | 35050 | 75% |
Mint¶
To upgrade, do actions.add_effort(city.buildings[BuildingType.mint], amount)
.
| Level | Effort Required | Wealth Added |
|---|---|---|
| 1 | 28440 | 150 |
Billboard¶
To upgrade, do actions.add_effort(city.buildings[BuildingType.billboard], amount)
.
| Level | Effort Required | Population Added |
|---|---|---|
| 1 | 28440 | 25 |
3D Printer¶
To upgrade, do actions.add_effort(city.buildings[BuildingType.printer], amount)
.
| Level | Effort Required | Structure Added |
|---|---|---|
| 1 | 35050 | 25 |
Big Canoe¶
To upgrade, do actions.add_effort(city.buildings[BuildingType.big_canoe], amount)
.
| Level | Effort Required | Wealth Added | Population Added | Structure Added |
|---|---|---|---|---|
| 1 | 80100 | 200 | 30 | 30 |
City¶
Your city can be upgraded to increase the max structure.
| Level | Effort Cost | Max Structure |
|---|---|---|
| Base | 0 | 200 |
| 1 | 15000 | 225 |
| 2 | 16875 | 275 |
| 3 | 20625 | 350 |
Sensors¶
Your sensors can be upgraded to improve their accuracy. You need to upgrade each one individually.
| Level | Effort Cost | Sensor Inaccuracy Range |
|---|---|---|
| Base | 0 | 100 |
| 1 | 4000 | 50 |
| 2 | 8500 | 20 |
| 3 | 13500 | 1 |


[gecode-users] Propagation condition and cloning
Christian Schulte
cschulte at kth.se
Tue Dec 15 17:18:47 CET 2009
Here the member and the argument coincides... But maybe I should change it.
Thanks
Christian
--
Christian Schulte, www.ict.kth.se/~cschulte/
-----Original Message-----
From: Vincent Barichard [mailto:Vincent.Barichard at univ-angers.fr]
Sent: Tuesday, December 15, 2009 5:08 PM
To: Christian Schulte
Cc: 'gecode list'
Subject: Re: [gecode-users] Propagation condition and cloning
Hi,
I wonder if the same issue occurs here ? "x" should refer to the member ?
In gecode/int/bool/or.hpp (766)
template<class VX, class VY>
forceinline
NaryOr<VX,VY>::NaryOr(Home home, ViewArray<VX>& x, VY y)
: MixNaryOnePropagator<VX,PC_BOOL_NONE,VY,PC_BOOL_VAL>(home,x,y),
n_zero(0), c(home) {
x.subscribe(home,*new (home) Advisor(home,*this,c));
}
Cheers,
Vincent
Le 14 déc. 2009 à 20:16, Christian Schulte a écrit :
> Yep, here comes my year-long training from marking exams... Unfortunately,
> that's what I am doing right now again...
>
> Christian
>
> --
> Christian Schulte, web.ict.kth.se/~cschulte/
>
>
> -----Original Message-----
> From: Vincent Barichard [mailto:Vincent.Barichard at univ-angers.fr]
> Sent: Monday, December 14, 2009 8:10 PM
> To: Christian Schulte
> Cc: 'gecode list'
> Subject: Re: [gecode-users] Propagation condition and cloning
>
> Of course, you are right ! I confused with the b0 and b1 names used in the
> BinOrTrue (and others) propagator.
> I spent the whole Week-end on it without noticing it. Thank you very much,
> it works now :D
>
> I can now go forward and continue my work :)
>
> Cheers,
> Vincent
>
>
> Le 14 déc. 2009 à 11:35, Christian Schulte a écrit :
>
>> Hmmm,
>>
>> the first five lines in the patch look already fishy:
>>
>> --- gecode/int/bool/clause.hpp 2009-10-14 12:19:49.000000000 +0200
>> +++ gecode/int/bool/clause.hpp 2009-12-13 23:46:53.000000000 +0100
>> @@ -50,6 +50,8 @@
>> (home,x0[x0.size()-1],y0[y0.size()-1]), x(x0), y(y0) {
>> assert((x.size() > 0) && (y.size() > 0));
>> x.size(x.size()-1); y.size(y.size()-1);
>> + x0.subscribe(home,*this,PC_BOOL_SAME,false);
>> + x1.subscribe(home,*this,PC_BOOL_SAME,false);
>> }
>>
>> Here x0 in x0.subscribe refers to the argument passed to the constructor.
>> You assume it refers to the member, right?
>>
>> Yep ;-)
>> Christian
>>
>> --
>> Christian Schulte, www.ict.kth.se/~cschulte/
>>
>>
>> -----Original Message-----
>> From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On
Behalf
>> Of Vincent Barichard
>> Sent: Monday, December 14, 2009 12:33 AM
>> To: gecode list
>> Subject: [gecode-users] Propagation condition and cloning
>>
>> Hi Everyone,
>>
>> I would like to put another Propagation Condition in BoolVarImp. You gave
> me
>> good advice on how to process. For a first step, I just wanted to make
> some
>> test. So I first modified bool.vis and add this new Propagation
Condition.
>> Then I tried to make existing propagators subscribe to this new
> propagation
>> condition (without scheduling propagators and sending the corresponding
>> events). Unfortunately, I failed to achieved this first step. Indeed,
some
>> problems occur during cloning.
>>
>> I first thought that It was a problem with the rewriting of propagator
>> during cloning. Indeed, I didn't update all propagators, so it can't be
>> possible to change a propagator by another one which doesn't subscribe to
>> the same propagation conditions than the original one.
>> I disabled the rewrite of a propagator by another propagator from a
>> different class during cloning. But I still have problems. I tried many
>> things, without success and now I have no more ideas.
>>
>> For now, I just want to understand why I can't make it work. For this
>> purpose, I designed an example to make gecode crash. I used the "sat"
>> example given with Gecode, and only deal with this example (no matter if
> the
>> other examples don't work anymore).
>> My problem is reproducible by applying the patch attached in this mail to
>> Gecode 3.2.2. Then, I configured and compiled Gecode with the following
>> commands:
>>
>> ./configure --enable-debug --enable-audit make
>>
>> The test problem can be launched by copying the test2.cnf file (attached
> in
>> the mail) in the gecode directory and executing the command:
>> ./examples/sat test2.cnf
>>
>> If I use a debugger I get:
>>
>> Program received signal EXC_BAD_ACCESS, Could not access memory.
>> Reason: KERN_INVALID_ADDRESS at address: 0x000000020000001b
>> 0x000000010146d908 in Gecode::ActorLink::prev (this=0x200000013) at
>> core.hpp:2328
>> 2328 return _prev;
>> (gdb) bt
>> #0 0x000000010146d908 in Gecode::ActorLink::prev (this=0x200000013) at
>> core.hpp:2328
>> #1 0x000000010146e0be in
>> Gecode::VarImp<Gecode::Int::BoolVarImpConf>::update (this=0x101896350,
>> x=0x101877698, sub=@0x7fff5fbfece0) at core.hpp:3295
>> #2 0x000000010146e1d9 in
>> Gecode::VarImp<Gecode::Int::BoolVarImpConf>::update (home=@0x101503f80,
>> sub=@0x7fff5fbfece0) at core.hpp:3314
>> #3 0x000000010146e4b4 in Gecode::Space::update (this=0x101503f80,
>> sub=0x101888798) at var-imp.hpp:343
>> #4 0x000000010146bae7 in Gecode::Space::_clone (this=0x101503e20,
>> share=true) at gecode/kernel/core.cpp:481
>> #5 0x000000010011b58b in Gecode::Space::clone (this=0x101503e20,
>> share=true) at core.hpp:2465
>> #6 0x000000010011c2c0 in Gecode::Search::Sequential::Path::recompute
>> (this=0x101503798, d=@0x1015037b8, a_d=2, stat=@0x101503718) at
> path.hh:305
>> #7 0x000000010011c5be in Gecode::Search::Sequential::DFS::next
>> (this=0x101503718) at dfs.hh:146
>> #8 0x000000010011c615 in
>> Gecode::Search::WorkerToEngine<Gecode::Search::Sequential::DFS>::next
>> (this=0x101503710) at support.hh:74
>> #9 0x0000000100007ed2 in Gecode::DFS<Sat>::next (this=0x7fff5fbff070) at
>> dfs.hpp:53 #10 0x000000010000811b in
>> Gecode::Driver::ScriptBase<Gecode::Space>::run<Sat, Gecode::DFS,
> SatOptions>
>> (o=@0x7fff5fbff1a0) at script.hpp:198
>> #11 0x0000000100001a34 in main (argc=1, argv=0x7fff5fbff4f0) at
>> examples/sat.cpp:256
>>
>> I probably made an obvious mistake, but I can not see.
>> Thanks for your help,
>>
>> Cheers,
>> Vincent
>>
>> Vincent Barichard Université d'Angers (LERIA)
>> Tel: 02 41 73 52 06 Département Informatique
>> Fax: 02 41 73 50 73 H203
>>
>
> Vincent Barichard Université d'Angers (LERIA)
> Tel: 02 41 73 52 06 Département Informatique
> Fax: 02 41 73 50 73 H203
>
>
>
> _______________________________________________
> Gecode users mailing list
> users at gecode.org
> https://www.gecode.org/mailman/listinfo/gecode-users
Vincent Barichard Université d'Angers (LERIA)
Tel: 02 41 73 52 06 Département Informatique
Fax: 02 41 73 50 73 H203
More information about the users
mailing list


pywinauto.findwindows¶
Provides functions for iterating and finding windows
- exception
pywinauto.findwindows.
WindowAmbiguousError
¶There was more then one window that matched
- exception
pywinauto.findwindows.
WindowNotFoundError
¶No window could be found
pywinauto.findwindows.
enum_windows
()¶Return a list of handles of all the top level windows
pywinauto.findwindows.
find_window
(**kwargs)¶Call findwindows and ensure that only one window is returned
Calls find_windows with exactly the same arguments as it is called with so please see find_windows for a description of them.
pywinauto.findwindows.
find_windows
(class_name=None, class_name_re=None, parent=None, process=None, title=None, title_re=None, top_level_only=True, visible_only=True, enabled_only=False, best_match=None, handle=None, ctrl_index=None, found_index=None, predicate_func=None, active_only=False, control_id=None)¶Find windows based on criteria passed in
Possible values are:
- class_name Windows with this window class
- class_name_re Windows whose class match this regular expression
- parent Windows that are children of this
- process Windows running in this process
- title Windows with this Text
- title_re Windows whose Text match this regular expression
- top_level_only Top level windows only (default=True)
- visible_only Visible windows only (default=True)
- enabled_only Enabled windows only (default=False)
- best_match Windows with a title similar to this
- handle The handle of the window to return
- ctrl_index The index of the child window to return
- found_index The index of the filtered out child window to return
- active_only Active windows only (default=False)
- control_id Windows with this control id


You can try the following solutions:
• Here is a helpful video created by one of our facilitators that will tell you how to get
the credits.
• If you have just completed the lab, then please wait for a few minutes and refresh
your chrome browser tab a few times.
• Start the lab again wait for 5 minutes and end the lab and then check again.
• Reach out to your Facilitator and they will help you here.
• Reach out to the Qwiklabs Chat support via the Qwiklabs home page. (You will need
to click on the help button "?" alongside your profile icon on the top right corner when
logged-in in order to access chat support)
• Just drop an email to
<EMAIL_ADDRESS>7. I accidently deleted my Qwikalbs Public profile and now the URL of the profile
is changed. How should I udpate my details?
If the enrolment form is now closed and you are not able to update your new profile
URL, then simply share it with your facilitators and ask them to share it with us and
we will update the details for you.


.NET Foundation
The .NET Foundation is an independent forum to foster the open development and collaboration of open source technologies for .NET.
The .NET Foundation is an independent forum to foster the open development and collaboration of open source technologies for .NET.


Rescue of British Steel by China's Jingye confirmed
by The Associated Press, StaffLONDON -- Britain's Insolvency Service confirmed Monday that a deal has been struck to rescue British Steel, potentially safeguarding some 4,000 jobs.
The government did not release details on the acquisition of the company by Jingye Steel.
The BBC reported earlier Monday that an agreement in principle had been made for a 70 million-pound ($90 million) deal with the Chinese industrial company.
The acquisition of the business and assets of British Steel Limited, includes the steelworks at Scunthorpe, U.K. mills and shares of FN Steel BV, British Steel France Rail SAS and TSP Engineering. The sale also includes British Steel's Redcar Bulk Terminal Limited.
"Completion of the contract is conditional on a number of matters, including gaining the necessary regulatory approvals," the government agency service said in a statement. "The parties are working together to conclude a sale as soon as reasonably practicable."
The deal comes just days after talks with the Turkish firm Ataer collapsed. The Community trade union had said interest from both Ataer and Jingye "rightly demonstrates that potential buyers believe that British Steel can have a sustainable future."
While voicing optimism, Ross Murdoch, a national officer at the GMB union, cautioned that "due diligence on this sale was completed very quickly and the devil will be in the detail."


player 1 rolls the dice and scores points which will be added together untill he/she scores one.If score is one,the dice is passed to the next player 2 and all the points gets lost unless you hold it
when player 2 score is one he/she looses all the scores except the ones that he/she had put on hold.
when the scores on the hold exceeds or equal to 100,the player becomes the winner and there will be an alert onthe screen top


Talks begin: Liverpool move AHEAD of Manchester United in race to sign goal machine
by Lucien SilverbergLiverpool have reportedly begun talks over sealing the transfer of RB Leipzig striker and Manchester United target Timo Werner.
The Germany international has been a big hit in the Bundesliga in recent times and looks like he could be a great fit for most bigger clubs around Europe.
MORE: £18m Liverpool target drops transfer hint after Anfield comments
It remains to be seen where Werner will end up when he does inevitably move on, but it currently looks like Liverpool could be his most likely destination.
That’s according to the Transfer Window Podcast, as they explain the Reds have opened talks over a deal for Werner, leaving rivals Man Utd in their wake.
Liverpool will now hope to get this deal wrapped up in the near future, and it seems United are meanwhile dithering over a number of potential options up front.
The Red Devils have also been linked with Erling Haaland, Mario Mandzukic and Moussa Dembele, so may not be making Werner as much of a priority.
However, the Transfer Window Podcast do claim they’ve been scouting the 23-year-old heavily in recent times, so it could still be that they’ll do their best to get back into pole position over this transfer.
Werner seems an ideal fit for LFC, however, with fellow German Jurgen Klopp showing he can work wonders with talented young players, particularly in attack.


new Mailer(configData)
Mailer object
Parameters:
| Name | Type | Description |
|---|---|---|
configData |
object | Configuration data as mentioned in the module
description, except for the address and
debugAddress properties. |
- Source:
Methods
-
send(sendData, callback)
-
Send an email.
Parameters:
Name Type Argument Description sendData
object Send data object Properties
Name Type Argument Default Description from
string Sender email address to
string | array Single "TO" Recipient email address as a string or an array of addresses cc
string | array <optional>
Single "CC" Recipient email address as a string or an array of addresses bcc
string | array <optional>
Single "BCC" Recipient email address as a string or an array of addresses subject
string Email subject body
string <optional>
'' Email body content_type
string <optional>
MIME type for the "main" body of the email; either text/plain
ortext/html
. If otherwise specified or not specified at all the configured MIME type for the module will be used as the default value. Character set encoding specification as intext/plain; charset=Cp1252
is NOT allowed here, UTF-8 is always assumed for the main body.attachments
array <optional>
Multiple attachments in an array; each array entry is an object with three properties: data
: The binary attachment data, either in a Vert.x Buffer or as a base64 encoded string.mimeType
: MIME type of the attachment data; should include a character set encoding specification for text MIME types, e.g.text/plain; charset=utf-8
fileName
: File name for the attachment inside of the email
callback
function <optional>
Callback function; called after the email is sent or when an error occurs. The first argument is either an error object or null if everything went ok. In case of success the second argument is a result object with up to two properties: response
The server's response message.rcptFailedAdrs
Array of email addresses, which were rejected by the server.
- Source:
-
sendSeq()
-
Send email messages sequentially over a single TCP connection.
This method opens a new connection to the server, if no connection is established. Subsequent calls to this method reuse the same connection. After all calls have been made, thesendSeqEnd
method must be called to close the connection.
NOTE 1
The user of this method is responsible for ensuring, that subsequent calls only happen, after the previous call has finished successfully.
NOTE 2
When the callback receives an error, you can assume that the connection is destroyed and any subsequent call will try to create a new connection.
The parameters and the return value are the same as for thesend
method.- Source:
-
sendSeqEnd()
-
End a sequence of messages over the same connnection.
Send the QUIT command to the server and closes the connection. Note that there is no callback parameter. We do not care about server response in this case.- Source:


Online Store
Home
About
Catalog
Contact
Add Product
Electronics
Clothings
Home Improvements
Search
Add Item
Add


Boys Don't Cry (1999) Hilary Swank, Chloe Sevigny, Peter Sarsgaard, Brendan Sexton III, Alison Folland, Alicia Goranson, Jeanetta Arnette. Screenplay by Kimberly Peirce and Andy Bienen. Directed by Kimberly Peirce. 116 minutes. Rated R, 4.5 stars (out of five stars)
Review by Ed Johnson-Ott, NUVO Newsweekly www.nuvo.com Archive reviews at http://us.imdb.com/ReviewsBy?Edward+Johnson-Ott To receive reviews by e-mail at no charge, send subscription requests to<EMAIL_ADDRESS>or e-mail<EMAIL_ADDRESS>with the word "subscribe" in the subject line.
Some words of warning: "Boys Don't Cry" is difficult to watch. The film, which chronicles the events leading up to the December 30, 1993 death of 21-year old Teena Brandon, features images of intense brutality, including an almost unbearably realistic rape scene. Even in its quiet moments, a sense of impending doom washes over the screen. This is powerful moviemaking. Over two months have passed since the critics' screening of the film, but it still remains vividly etched in my memory.
  After experiencing this film, you'll have a better understanding of homophobia, of misogyny, of unbridled hated. You'll have a better understanding of compulsive, self-destructive behavior. After spending two hours in Falls City, Nebraska, those shrieking yahoos on "The Jerry Springer Show" won't seem so comical anymore.
"Boys Don't Cry" is based on a true story. As usual, the filmmakers change some facts, including a couple of significant ones, but the core of truth remains. On a regular basis, Teena Brandon strapped down her breasts, stuffed a tube sock into her jeans and headed out to live and love as a man named Brandon Teena.
Teena was a fairly convincing man. His gait, mannerisms and vocal cadences were credible. Only when he feared his physical gender was about to be revealed did his feminine traits betray the disguise.  A product of a socio-economic underclass where ignorance is the norm, Teena acted out of a drive he couldn't explain or contain. Following heartfelt warnings from friends and numerous scrapes with locals and the law, Teena simply moved his actions to a neighboring town.
There Teena (Hilary Swank) becomes friends with John Lotter (Peter Sarsgaard) and Thomas Nissen (Brendan Sexton III), a pair of ex-cons given to heavy partying and bursts of violence. He also meets, and falls in love with, young Lana Tisdel (Chloe Sevigny), remaining oblivious to the fact that Lotter and Tisdel had once been involved, and that the volatile Lotter still pines for his ex.
And so the pattern for disaster falls into place. As Teena and Tisdel draw closer, the good old boys get more twitchy. Sitting in the theater knowing what's coming, you want to climb into the screen, grab Teena and shout, "Snap out of it! These people are dangerous! Pack your gear, move to a college town and hit a gay bar, for Christ's sake!"
No such luck. Teena continues his dance with doom, just as so many others do. While the individual story of Brandon Teena is particularly nightmarish, especially in light of the increase in violent assaults against gays, it is just one of many.
There's more. Watch the men in this story. Their contempt of women is overwhelming and all too common. When they learn of Teena's true physical gender, the motivation behind their horrific reactions is blurred. Is it because of the deception, because of the gay thing, or because they have learned that their buddy is (shudder) a lowly female?
The visceral power of "Boys Don't Cry" comes from the skills of director Kimberly Peirce and a slew of amazing performers. Hilary Swank, a Best Actress Oscar nominee for her work here, is astounding as Teena. At no point in the film does she ever hit a single false note. Chloe Sevigny, a nominee in the Best Supporting Actress category, works magic, using her languid eyes and tentative smile to great effect. And don't overlook the guys – Peter Sarsgaard and Brendan Sexton III are skilled enough to humanize their characters, making their outbursts all the more chilling.
"Boys Don't Cry" is difficult to watch, but I hope you'll make the trip. In addition to seeing a hell of a good movie, you'll get a tour of the darker portions of our societal landscape, where monsters in baseball caps cruise the streets, striking out blindly at anything they do not understand.
© 2000 Ed Johnson-Ott
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


I enjoy moives, they are a good way to make time pass. Some of my Favorite movies are, Shawshank Redemption, any of the 1st and 2nd generation starwars, and any marvel movie. There are many more but those are my top 3.


The process over product method helped me to come to terms with spending about three hours trying to rearrange the website when working with larger screens in a way that just didn't work but helped me to understand the Bootstrap framework grid system a lot better, and got me better at using media queries.
The main thing I took away from the second chapter of Search Inside Yourself was the idea of not being so self critical when the mind wanders during meditation and to not see it as a failure. I think the gym analogy was quite helpful in seeing distractions as actually strengthening the mind's ability to create focused attention.


Teleporting a Qubit¶
Let’s now consider a very simple protocol, in which Alice first generates an EPR pair with Bob, and then teleports a qubit to Bob. To program it in SimulaQron’s native mode, we will use the template described in Template for programming in native mode.
The protocol¶
For completness, let’s briefly recap the protocol:
For generating an EPR pair with Bob, Alice proceeds as follows:
- Alice prepares two qubits in the state \(|0\rangle_A |0\rangle_B\)
- Alice applies a Hadamard transform to qubit A, giving \(|+\rangle_A |0\rangle_B\)
- Alice applies a CNOT on qubits A and B, where qubit A is the control and B is the target, giving the state \(\frac{1}{\sqrt{2}}(|0\rangle_A |0\rangle_B + |1\rangle_A |1\rangle_B)\)
- Alice sends qubit B to Bob
Alice then teleports qubit q1 to Bob using the EPR pair:
- Alice applies a CNOT between q1 and qubit A, where q1 is the control and A is the target.
- Alice applies a Hadamard to qubit q1.
- Alice measures qubits q1 and A to obtain outcomes a and b.
- She sends a and b to Bob, who applies the correction unitary \(Z^a X^b\)
Setting up¶
We will run everything locally (localhost) using the standard virtualNodes.cfg file found in conig that define the virtual quantum nodes run in the background to simulate the quantum hardware:
# Network configuration file
#
# For each host its informal name, as well as its location in the network must
# be listed.
#
# [name], [hostname], [port number]
Alice, localhost, 8801
Bob, localhost, 8802
As we can see from the proocol above, only Alice communicates to Bob for which we will run a client at Alice’ and a server at Bob’s. Since we run everything locally, we may thus use for the configuration file classicalNet.cfg:
# Network configuration file
#
# For each host its informal name, as well as its location in the network must
# be listed.
#
# [name], [hostname], [port number]
#
Bob, localhost, 8812
Let us now provide the actual program code for both Alice and Bob.
Programming Alice¶
Since Alice acts as a client, we will only need to fill in runClientNode. This gives:
#####################################################################################################
#
# runClientNode
#
# This will be run on the local node if all communication links are set up (to the virtual node
# quantum backend, as well as the nodes in the classical communication network), and the local classical
# communication server is running (if applicable).
#
@inlineCallbacks
def runClientNode(qReg, virtRoot, myName, classicalNet):
"""
Code to execute for the local client node. Called if all connections are established.
Arguments
qReg quantum register (twisted object supporting remote method calls)
virtRoot virtual quantum ndoe (twisted object supporting remote method calls)
myName name of this node (string)
classicalNet servers in the classical communication network (dictionary of hosts)
"""
logging.debug("LOCAL %s: Runing client side program.",myName)
# Create 3 qubits
q1 = yield virtRoot.callRemote("new_qubit_inreg",qReg)
qA = yield virtRoot.callRemote("new_qubit_inreg",qReg)
qB = yield virtRoot.callRemote("new_qubit_inreg",qReg)
# Prepare the first one in the |-> state
yield q1.callRemote("apply_H")
# For information purposes, let's print the state of that qubit
(R,I) = yield q1.callRemote("get_qubit")
print("Qubit to be teleported is: ", assemble_qubit(R,I))
# Put qubits A and B in an EPR state
yield qA.callRemote("apply_H")
yield qA.callRemote("cnot_onto",qB)
# Send qubit B to Bob
# Instruct the virtual node to transfer the qubit
remoteNum = yield virtRoot.callRemote("send_qubit",qB, "Bob")
logging.debug("LOCAL %s: Remote qubit is %d.",myName, remoteNum)
# Apply the local teleportation operations
yield q1.callRemote("cnot_onto",qA)
yield q1.callRemote("apply_H")
a = yield q1.callRemote("measure")
b = yield qA.callRemote("measure")
logging.debug("LOCAL %s: Correction info is a=%d, b=%d.",myName, a, b)
# Tell Bob the number of the virtual qubit so the can use it locally
bob = classicalNet.hostDict["Bob"]
yield bob.root.callRemote("recover_teleport", a, b, remoteNum)
reactor.stop()
Programming Bob¶
Let us now program the code for Bob. Since he only acts as a server on the classical network, it is enough to edit the localNode portion of the template. Alice calls recover_teleport to convey the classical measurement outcomes, as well as the identifier of the virtual qubit. Bob first asks his local virtual quantum node for a reference for the qubit with that identfier and then processes the relevant quantum instructions to recover the qubit. We print the density matrix of the qubit at the end for illustration.:
#####################################################################################################
#
# localNode
#
# This will be run if the local node acts as a server on the classical communication network,
# accepting remote method calls from the other nodes.
class localNode(pb.Root):
def __init__(self, node, classicalNet):
self.node = node
self.classicalNet = classicalNet
self.virtRoot = None
self.qReg = None
def set_virtual_node(self, virtRoot):
self.virtRoot = virtRoot
def set_virtual_reg(self, qReg):
self.qReg = qReg
def remote_test(self):
return "Tested!"
# This can be called by Alice to tell Bob where to get the qubit and what corrections to apply
@inlineCallbacks
def remote_recover_teleport(self, a, b, virtualNum):
"""
Recover the qubit from teleportation.
Arguments
a,b received measurement outcomes from Alice
virtualNum number of the virtual qubit corresponding to the EPR pair received
"""
logging.debug("LOCAL %s: Getting reference to qubit number %d.",self.node.name, virtualNum)
# Get the reference to Alice's qubit from the local virtual node
eprB = yield self.virtRoot.callRemote("get_virtual_ref",virtualNum)
# Apply the desired correction info
logging.debug("LOCAL %s: Correction info is a=%d, b=%d.", self.node.name, a, b)
if b == 1:
yield eprB.callRemote("apply_X")
if a == 1:
yield eprB.callRemote("apply_Z")
# Just print the qubit we received
(realRho, imagRho) = yield eprB.callRemote("get_qubit")
rho = self.assemble_qubit(realRho, imagRho)
print("Qubit is:", rho)
def assemble_qubit(self, realM, imagM):
"""
Reconstitute the qubit as a qutip object from its real and imaginary components given as a list.
We need this since Twisted PB does not support sending complex valued object natively.
"""
M = realM
for s in range(len(M)):
for t in range(len(M)):
M[s][t] = realM[s][t] + 1j * imagM[s][t]
return Qobj(M)
Starting¶
We first start the virtual quantum node backend, by executing:
cd "$NETSIM"/run
python startNode.py Alice &
python startNode.py Bob &
where $NETSIM is the environment variable defining the SimulaQron directory as outlined in Getting started.
We then start up the programs for Alice and Bob themselves. These will connect to the virtual quantum nodes, and execute the quantum commands and classical communication outlined above, in the same directory as we placed classicalNet.cfg:
python bobTest.py &
python aliceTest.py