Installation¶
Spyder is quite easy to install on Windows, Linux and MacOS X. Just the read the following instructions with care.
Installing on Windows Vista/7/8/10¶
The easy way¶
Spyder is already included in these Python Scientific Distributions:
You can start using it immediately after installing one of them (you only need to install one!).
The hard way¶
If you want to install Spyder directly, you need to follow these steps:
Install the essential requirements:
- The Python programming language
- PyQt5 (recommended) or PyQt4
Install Spyder and its dependencies by running this command:
pip install spyder
Updating Spyder¶
You can update Spyder by:
Updating Anaconda, WinPython or Python(x,y).
Or using this command (in case you don’t use any of those scientific distributions):
pip install --upgrade spyder
Note
This command will also update all Spyder dependencies
Installing on MacOS X¶
The easy way¶
Thanks to the Spyder team and Continuum, you have two alternatives:
Note
The minimal version to run our DMG’s is Mavericks (10.9) since Spyder 2.3.5. Previous versions work on Lion (10.7) or higher.
The hard way¶
Thanks to the MacPorts project, Spyder can be installed using its port
package manager.
There are several versions available from which you can choose from.
Warning
It is known that the MacPorts version of Spyder is raising this error:
ValueError: unknown locale: UTF-8
, which doesn’t let it start correctly.To fix it you will have to set these environment variables in your
~/.profile
(or~/.bashrc
) manually:export LANG=en_US.UTF-8 export LC_ALL=en_US.UTF-8
Installing on Linux¶
Please refer to the Requirements section to see what other packages you might need.
Ubuntu:
Using the official package manager:
sudo apt-get install spyder
.Note
This package could be slightly outdated. If you find that is the case, please use the Debian package mentioned below.
Using the pip package manager:
- Installing:
sudo pip install spyder
- Updating:
sudo pip install -U spyder
- Installing:
Debian Unstable:
Using the package manager:
sudo apt-get install spyder
The Spyder’s official Debian package is available here
Other Distributions
Spyder is also available in other GNU/Linux distributions, like
Please refer to your distribution’s documentation to learn how to install it there.
Installing or running directly from source¶
Requirements¶
The requirements to run Spyder are:
- Python 2.7 or >=3.3
- PyQt5 >=5.2 or PyQt4 >=4.6.0 (PyQt5 is recommended).
- Qtconsole >=4.2.0 – for an enhanced Python interpreter.
- Rope >=0.9.4 and Jedi >=0.9.0 – for code completion, go-to-definition and calltips on the Editor.
- Pyflakes – for real-time code analysis.
- Sphinx – for the Help pane rich text mode and to get our documentation.
- Pygments >=2.0 – for syntax highlighting and code completion in the Editor of all file types it supports.
- Pylint – for static code analysis.
- Pycodestyle – for style analysis.
- Psutil – for memory/CPU usage in the status bar.
- Nbconvert – to manipulate Jupyter notebooks on the Editor.
- Qtawesome >=0.4.1 – for an icon theme based on FontAwesome.
- Pickleshare – To show import completions on the Editor and Consoles.
- PyZMQ – To run introspection services on the Editor asynchronously.
- QtPy >=1.2.0 – To run Spyder with PyQt4 or PyQt5 seamlessly.
- Chardet >=2.0.0– Character encoding auto-detection in Python.
- Numpydoc Used by Jedi to get return types for functions with Numpydoc docstrings.
Optional modules¶
- Matplotlib >=1.0 – for 2D and 3D plotting in the consoles.
- Pandas >=0.13.1 – for view and editing DataFrames and Series in the Variable Explorer.
- Numpy – for view and editing two or three dimensional arrays in the Variable Explorer.
- Sympy >=0.7.3 – for working with symbolic mathematics in the IPython console.
- Scipy – for importing Matlab workspace files in the Variable Explorer.
- Cython >=0.21 – Run Cython files or Python files that depend on Cython libraries in the IPython console.
Installation procedure¶
If you use Anaconda, you need to run this command to install Spyder:
conda install spyder
If you don’t use Anaconda, you need to run:
pip install --upgrade spyder
Run without installing¶
You can execute Spyder without installing it first by following these steps:
- Unzip the source package
- Change current directory to the unzipped directory
- Run Spyder with the command
python bootstrap.py
- (Optional) Build the documentation with
python setup.py build_doc
.
This is especially useful for beta-testing, troubleshooting and development of Spyder itself.
Installing the development version¶
If you want to try the next Spyder version, you have to:
Install Spyder requirements
Install Git, a powerful source control management tool.
Clone the Spyder source code repository with the command:
git clone https://github.com/spyder-ide/spyder.git
To keep your repository up-to-date, run
git pull
inside the cloned directory.
(Optional) If you want to read the documentation, you must build it first with the command
python setup.py build_doc
Help and support¶
Spyder websites:
- For bug reports and feature requests you can go to our website.
- For discussions and help requests, you can suscribe to our Google Group.


The Bio-Bridge Initiative (BBI) will facilitate broader communication and partnership building among Parties and institutions through various communication and outreach activities to promote TSC as an approach to achieving biodiversity targets, including through regional and thematic roundtables and/or online forums. The communication and outreach activities are intended to publicize Bio-Bridge Initiative and catalyze support for TSC among Parties, communicate and showcase Bio-Bridge Initiative success stories and lessons learned to inspire further cooperation, foster peer-to-peer learing, and facilitate the development of a committed and active network of partners in all regions that can support Bio-Bridge Initiative activities.
Loading...


bootstrap basics
CLICK ME!
Bootstrap Docs
Active State
Active State
Hello, world!
WHAT IT IS HOMIE
Learn more
Email address
We'll never share your email with anyone else.
Password
Check me out
Submit


Consider this Java program code:The last element of any array always has a subscript that is one less than the length of the array. So in this case, the subscript of the last element in the array is 420 – 1 = 419.String[] values; values = new String[420];True or False: The largest legal subscript value for the array namedvalues
would be 420.


One observers that the customers often forget to include the insurance policy number in the request or use name abbriviation. This often makes it hard to uniquely identify the customer and requires a reply with clarification request. Also every claim submission is also connected with a mundane process of checking of the claim validity, i.e if the claim is covered by an existing insurance agreement.
RoboClaim automates the way of validating the claim request, i.e if ensuring is complete, allows to match the the auto-match of extracted information with entries and allows to detect invalid claim.
Current submission process.
The RoboClaim way.
Roboclaim increases efficiency and reduces operational costs by reducing interactions by detecting missing information in the email or matching it against insurer customer database.
Founder and CEO of preemoo
As a young Berlin startup, preemoo is specialised on continuous short-term prediction of human motion at very high precision rates, in order to allow for smart mobility concepts, innovations in the field of workplace security and cloud rendering enablement. Using a multi-paradigm approach, a team of movement analysis and machine learning experts develops prediction models, which elevate the safety level of street traffic when embedded into a v-to-x infrastructure.
Founder and CEO of VQ LABS (vq-labs.com)
I've been researching and building online communities and marketplaces. Currently I'm focused in the phenomenon called the collaborative economy, where individual people are responsible of production, distribution and trade of products and services. I believe we are experiencing a major shift in our economy comparable to the industrial revolution, and that this shift will lead to a more sustainable and just society.
Actuarial Pricing Analyst
Mix of (Re) Insurance, Data Analytics and IT skills Extensive programming knowledge and experience: SAS, R, SQL, VBA Statistics and basic machine learning algorithms


#include <XSECURIResolverGenericUnix.hpp>
Inheritance diagram for XSECURIResolverGenericUnix:
The XML Digital Signature standard makes heavy use of URIs to identify information to be referenced and signed.
This class implements the XSECURIResolver for UNIX, re-using much of the Xerces code.
Public Member Functions | |
Constructors and Destructors | |
| XSECURIResolverGenericUnix () | |
| virtual | ~XSECURIResolverGenericUnix () |
Interface Methods | |
| virtual XERCES_CPP_NAMESPACE_QUALIFIER BinInputStream * | resolveURI (const XMLCh *uri) |
| Create a BYTE_STREAM from a URI. | |
| virtual XSECURIResolver * | clone (void) |
| Clone the resolver to be installed in a new object. | |
Class specific functions | |
| void | setBaseURI (const XMLCh *uri) |
| Set the base URI for relative URIs. |
|
|
|
|
|
|
|
|
Clone the resolver to be installed in a new object. When URIResolvers are passed into signatures and other objects, they are cloned and control of the original object is left with the caller. Implements XSECURIResolver. |
|
|
Create a BYTE_STREAM from a URI. The resolver is required to take the input URI and dereference it to an actual stream of octets. The octets are provided back to the library using the Xerces BinInputStream class.
Implements XSECURIResolver. |
|
|
Set the base URI for relative URIs.
|


# ZooKeeper Based Job Master Discovery Ahmet Uyar
When a Twister2 job is submitted, a Job Master is created in addition to workers. Workers need to know the Job Master IP address and the port number to be able to connect to it. Some resource schedulers such as Kubernetes provides some means for workers to discover the Job Master. However, there might be resource schedulers that do not provide such discovery mechanisms such as Nomad scheduler. In that case, ZooKeeper server can be used to discover the Job Master address.
## Main Idea When a Twister2 job is submitted: * one Job Master * possibly many workers
started in the cluster.
When the Job Master starts: * It registers its IP address and the port number with the ZooKeeper server.
When the workers start: * They get the address of the Job Master from the ZooKeeper server.
## Assumptions We assume that: * Each Twister2 job has a unique name. There can not be more than one Twister2 job running in the cluster with the same name simultaneously. When we submit a job, if there is already a running job with the same name, that job submission fails. * Each Twister2 job is composed of one Job Master and possibly many workers. * Job Master knows its own IP address and its port number when it starts. * Both the Job Master and the workers know the IP address and the port number of the ZooKeeper server.
## Implementation We implemented two classes: * edu.iu.dsc.tws.rsched.bootstrap.ZKJobMasterRegistrar * edu.iu.dsc.tws.rsched.bootstrap.ZKJobMasterFinder
ZKJobMasterRegistrar class is used to register the Job Master address with the ZooKeeper server. ZKJobMasterFinder class is used to get the Job Master address from the ZooKeeper server.
ZNode Creation When the Job Master is registered its address on the ZooKeeper server, an ephemeral znode is created. The name of this znode will be: * /twister2/<job-name>-<job-master>
assuming the root znode is twister2.
Job Master IP address and the port number is put as the payload in this znode as a String in the form of: * ip:port
ZNode Deletion When the job completes, the ZKJobMasterRegistrar should delete the znode from the ZooKeeper server explicitly by calling its close method.  However, it takes 30 seconds for the ZooKeeper to delete ephemeral nodes in premeture shut downs. If the user wants to submit another job during this time period with the same name, then the remaining znode from the previous job needs to be deleted first.
ZKJobMasterRegistrar class has two methods to check the existence of the znode for that job and delete it: * sameZNodeExist() * deleteJobMasterZNode()
These methods can be used to clear the previously remaining znodes. However, care needs to be taken, because another user may have been submitted a job with the same name. Before deleting the job master znode, the user needs to be sure that, that znode is its znode from previous job submission.
Discovering the Job Master Address When the workers start, they query the job master znode. If the znode already created, they get the content and parse the ip:port pair. If the znode has not been created yet, we create a NodeCache object. It gets all changes to the Job master node in a local cache. We get the Job Master address from this cache when the znode is created on the server. NodeCache works event based. So, we avoid polling the ZooKeeper server continually.
## Usage Registering the Job Master Job Master is started by a separate program in each cluster. For example, in Kubernetes it is started by the class:
edu.iu.dsc.tws.rsched.schedulers.k8s.master.JobMasterStarter
When this class starts the Job Master, it also needs to start the ZKJobMasterRegistrar. When the ZKJobMasterRegistrar is constructed, its initialize method needs to be called to register. It returns a boolean value to show the result of the registration.
When the job completes, it needs to call the close method of the ZKJobMasterRegistrar class to delete the job znode and close the connection to the ZooKeeper server.
Getting the Job Master Address Similar to Job Master, Twister2 workers are also started by a separate program in each cluster. For example, in Kubernetes clusters, they are started by:
edu.iu.dsc.tws.rsched.schedulers.k8s.worker.K8sWorkerStarter
Before starting the worker, this program should start ZKJobMasterFinder. After initializing, it can get the Job Master address by calling the method:
getJobMasterIPandPort().
If this method returns null, it means that the Job Master has not registered yet. In that case, it can call the method
waitAndGetJobMasterIPandPort(long timeLimit)
This method will wait for the Job Master znode to be registered until the timeLimit has been reached.
Example Code A sample usage of ZKJobMasterRegistrar is provided in the example class:
edu.iu.dsc.tws.examples.ZKJobMasterRegistrarExample.java
Its corresponding sample usage of ZKJobMasterFinder is provided in the example class:
edu.iu.dsc.tws.examples.ZKJobMasterFinderExample.java


This field is required.
This field is required to be at least 2 characters.
This field cannot be longer than 50 characters.
This field is required.
This field is required to be at least 2 characters.
This field cannot be longer than 20 characters.
This field should follow pattern for "Short Name".


Click here to change to data for 25-34 year olds, 2013
Note: States with missing values have death totals that have been suppressed due to low numbers.


development
Contents
7.8. development#
notes from Neuroscience, 5th edition + Intro to neurobiology course at UVA
7.8.1. 22 early development#
ways to study
top-down: rosy retrospection
bottom-up: e.g. LTP/LTD
human disease: stroke-by-stroke
development=ontogeny
timeframe
month 1 - gastrulation
most sensitive time for mom
month 2-5 - cells being born
up to year 2 - axon guidance / synapse formation
gastrulation - process by which early embryo undergoes folds = shapes of NS
diseases
spina bifida - neural tube fails to seal
vitamin B12 can fix this
anencephaly - neural tube fails to close higher up
parts
roofplate at top (back)
floorplate on bottom (stomach)
neural crest - pinches off top of roofplate
neuroblasts = classic stem cells
assymetric division - cells generate themselves and differentiated progeny
ultimate stem cell - fertilized eggs
differentiation
cells made by neuroblasts decide what they are going to become
morphogens
BMP - roofplate
cyclopia - fatal defect in BMP
Hedge hogs - at floor plate
Retinoids - axial, affect skin
affected by thalidomide - helps morning sickness but causes missing limb segments
also affected by accutane
FGFs - axial symmetry
Wnts - skin, gut, hair
loss of wnts is loss of hair
floor plate loses function after embryogenesis except glioblastoma
measure BMP and HH gradient to figure out where you are
treat ALS by adding HH to make more alpha motor neurons
dorsal direction
roofplate makes BMP
low HH - interneurons, sensory neurons (ex. nociceptors)
even BMP/HH - sympathetic
high HH - more motor neurons
floorplate makes HH (hedge hog)
axial specification (anterior/posterior)
tube swells into bulbs that become cerebellum, superior colliculus, cortex
homeotic genes = hox genes - set of genes (transcription factors) in order on chromosome
order corresponds to order of your body parts
rhombomeres - segments in brainstem made by hox gene patterns
lineages
when neuroblast is born, starts producing progeny (family tree of neuron types)
very often, cells are produced in certain order
timing: cell-cell interations and tyrosine kinases determine order
first alpha neurons, then GABAergic to control those, last is glia
neural crest function
migratory - moves out and divides:
neuroblastoma - developed early - severe problem because missing parts of NS
makes DRG and associated glial cells (schwann cells)
makes sympathetic NS and target ganglia, enteric NS, parasympathetic NS targets
makes melanocytes - know how to migrate and divide but can make melanoma (cancer)
cortex is made inside out (6->1)
starts with stem cells called radial glia
cortical dysplasia - missing a layer / duplicating a layer
small part with 2 layer 3s - severe epilepsy
cell death
1/2 of cells die in development
axon guidance (ch 23)
each cell born and axon grows and are guided to a target
dendrite basically follows same rules
synapse formation (ch 23, 24)
pruning and plasticity
NMDA receptor type
form synapses and if they don’t look right - get rid of them
K1/K-1 synapses breaking and forming
after age 21, K-1 starts increasing and net loss of synapses
7.8.2. 23 circuit formation#
growth cone - motile tip of axon
actin tip
lamellipodium - sheet (hand)
filopodium - huge curves (fingers)
chemo attraction (actin assembly) and chemo repulsion (actin disassembly)
microtubule shaft - tubulin is much more cemented in
mauthner cell of tadpole - first recorded growth cone
can’t regrow (that’s why we can’t regrow spinal cord)
signals in growing axons
pioneer axons (Betz cells) are first - often die
follower axons (other Betz cells) can jump onto these and connect before pioneer dies
trophic support - neuron survives on contact
frog tectum (has superior colliculus) with map of retina:
ephrin (EPH) repulses axon
retinal NT -> tectum AP
axons have different amount of EPH receptors (in retina temporal has more than nasal)
gradient of EPH (in tectum anterior has less than posterior)
if we flip eye upside down (on nasal-temporal axis), image will be upside down
3 classes of axon guidance molecules:
ECM/integrins
NCAM (homophilic—binds to another neuron that is NCAM),
follower neurons bind to pioneer through NCAM-NCAM interactions
Cadherin (homophilic)
involved in recognition of being some place
4 important ligands/receptors
ephrins/eph
gradient of eph receptor
netrin/dcc = guidance moleculereceptor = DCC
attracts axons to floorplate (midline)
cells without DCC don’t cross midline
slit/robo - receptor is slit
chases axons off (away from midline)
axons not destined to cross midline are born expressing robo
axons destined to cross the midline only express robo after crossing
if DCC (-) and robo (-) will continue wandering around
robo 4 is associated with Tourette’s
semaphorins/plexins
combinatorial code - use combinations of these to guide axons
these are the same genes that move cancer around
synaptic formation
neuroexins - further recognition
turn up in autism and schizophrenia
DSCAM
associated with Down’s syndrome
doesn’t use gradients
makes different kinds of proteins by differential slicing
competition
neurotrophins are secreted by muscle
in early development, a muscle fiber has many alpha motor neurons innervating it
all innervating neurons suck up neurotrophin and whichever sucks up most, kills all the others
eventually, each muscle fiber is innervated by one alpha motor neuron
only enough neurotrophin in target cells for a certain number of synapses
happens everywhere
ex. sympathetic ganglia
ex. sensory neurons in skin get axons to correct cell types based on neurotrophin
merkel - BDNF
proprioceptor - NT3
nociceptor - NGF
ex. muscles - produce NGF
treating ALS with NGF hyperactivates sensory neurons with trkA -> causes chicken pox
signals/receptors
NGF - trk a (Trk receptor - survival signaling pathways)
BDNF - trk b
NT3 - trk b and c
NT4/5 - trk b
all bind p75 (death receptor)
want to keep neurotrophins local, because there aren’t that many of them
7.8.3. 24 plasticity in systems#
experience-dependent plasticity -
ex. ducks imprinting is non-reversable
learning is crystallized during critical period
CREB and protein synthesis
NMDA receptors
epigenetics - histones control transcription and other things
follow Hebb’s postulate - fire together, wire together
different eyes firing together will sync up (NMDA receptors to strengthen synapses)
systems
ocular dominance
left/right neurons terminate in adjacent zones
LGN in cortex uses efferents just like superior colliculus
label injected into retina can make it into cortex
cat experiments
some cells see only one eye, some see both
cats need to form visual map in short critical period (<6 days)
this is why you need cochlear implant early
both eyes open - equal OD columns
one eye closed - unequal OD columns
branches coming out of LGN neurons grow more branches based on relative light exposure (they compete for eye’s real estate)
strabismus = lazy eye - poor coordination with one of the muscles
one eye is not quite seeing
treat with patch on good eye -> allows bad eye to catch up since eyes compete for ocular dominance columns
more stimulus = more branches
dye from retina goes through thalamus into cortex
rabies virus does same thing: cell->ganglion->brain
tonotopic map
connection between MSO and inferior/superior colliculus
playing one tone increases representation
playing white noise disorganizes map
birdsong
hear song 10-20 times when young - crystallized
afterwards can’t learn new skills
stress
early stress sets stress points later in life
uses serotonin
shifts
superior colliculus - integrate visual, auditory, motor to get X,Y coordinate
auditory map - plastic (but only when young)
visual map - not plastic
if you shift visual map (with a prism), auditory map can shift over to meet the visual
optic neuritis - ms optic nerve disease that shifts map
only young animals can shift unless they were shifted before and are now unadapting
7.8.4. 25 repair and regeneration#
full repair - human PNS - skin, muscles
1-2 mm/day growth - speed of slow axonal transport
thinnest axons first (thermal receptors and nociceptors)
proprioceptors last
process
perinerium / schwann cells surrounds axons - helps regeneration
growth cones that are cut form stumps -> distal axons degenerate = walerian degeneration
macrophages come in and eat up the damaged stuff
neurotrophins are involved
miswiring is common - regrow and may not find right target
bell’s palsy - loss of facial nerve - recovers with miswiring (salivary / tear)
neuromuscular junctions (NMJ)
damaged cells leave synaptic ghost = glia and protein matrix for nerve to regrow into
repairs easily after heavy training
no repair / glial scar - human CNS
no ghost because so spread out
glia cover wound (scar) but can’t develop further
has astrocytes and oligodendrocytes (types of glial cells)
don’t support regrowth
involved in scarring
microglia - from immune system
control inflammation
release cytokines
nogo - protein that blocks regrowth (but there are other proteins as well)
we try repairing with shunts - piece of sciatic nerve from other part of body with schwann cells from PNS to try to repair a connection in the CNS
stem cell regeneration - put new neurons being formed, 2 places in humans
non-human examples
floor plate of lizards can make new tail
fish retina always making new cells
canary brain part has stem cells that learn new song every year
small C14 incorporation after early development - suggests we don’t regenerate neurons - C14 was from nuclear testing
human areas that do regenerate
hippocampus
memories you store temporarily
subventricular zone makes glomeruli in olfactory bulb cells
turnover daily
sensory neurons and their targets constantly die and regenerate
niche - places where stem cells stay alive
ex. places in CNS with WINT molecular signals
damage control - remove these signals for apoptosis = cell death
glutamate increase - excitotoxicity
can stop with NMDA blockers
induce a coma by cooling them down or GABA drugs
cytokines increase - immune system (like neurotrophins), inflammation
hypoxia/stress
neurotrophin withdrawal
in stress times neurotrophin goes down


Teenager in dock for alleged rape of 8-year-old girl
by Tammy PetersenA teenager who allegedly raped an eight-year-old girl was expected to appear in the Wynberg Magistrate's Court on Monday.
The 17-year-old was to appear in camera as he is a minor.
Police spokesperson Siyabulela Malo said the incident occurred in Eric Viljoen Road in Parkwood last Wednesday.
Locals had taken the rape accused to the Grassy Park police station by taxi after they heard the girl's mother had caught the boy in the act when she got home from a nearby shop, the Daily Voice reported.
The boy had reportedly moved to the area a week before after being accused of rape in Caledon, the child's mother told the publication.
She had waited until the Thursday morning to report the case as she apparently feared telling her family as she thought they would kill the suspect.
The National Prosecuting Authority could not immediately confirm the outcome of the case.
In an unrelated incident, a 31-year-old suspect was arrested on Sunday for rape and house robbery following a home invasion in Browns Farm over the weekend.
Malo said the complainant reported that they were awoken on Saturday by unknown men who pretended to be looking for someone.
"They kicked in the door, forcefully entered the shack and said they wanted stokvel money. The suspects robbed the couple [of their cellphones] and thereafter raped the woman. One suspect was identified and arrested."
The police are also on the hunt for two alleged rapists who along with two accomplices repeatedly raped a woman after dragging her into a shack while she walked in Bristol Road, Browns Farm.
Officers were following up on all possible leads to find the pair who were still at large, Malo said.


{% extends "base.html" %} {% load i18n %} {% block head_title %}{% trans "Not Found" %}{% endblock %} {% block messages %}{% endblock %} {% block body %}
{% trans "We can't find it! Oh no! The page isn't here!" %}
{% trans "If it's our fault, would you please do us a favor and" %} {% trans "create a ticket?" %}


The first step to getting any Mac set up is to get some software onto it. I’m not going to cover how to set up Munki or AutoPkg - there are lots of other places for that information.
As a sysadmin, I’m forever testing things.  My preferred virtualisation solution is VMware Fusion, but unfortunately it’s not very easy to deploy out of the box. You need to do a little bit of work to get it into a package that you can import into Munki, but fortunately the process is well documented on VMware’s site.
The next piece of ‘non standard’ software I need is Homebrew. The installation method listed on their site is to run a terminal command as the current user. The first part of this is obviously fine - Munki has several methods to run scripts (payload free packages, nopkg), but it runs everything as root. Fortunately, as I’m deploying my own machine, I can make some assumptions about where Homebrew will be installed. The first assumption I can make is that there will only be one user on the machine, and the second is that I’m going to be logged in most of the time (as my laptop is encrypted, it’s either off or logged in).
I’m going to utilise a nopkg pkginfo file to perform the installation. The first part of our script to install Homebrew is to make sure that a user (me!) is logged in. Homebrew doesn’t like being owned by root, so first we need to make sure that there is a user logged in.
So now we know that there’s a user logged in, and who that user is. Time to install Homebrew as the current user.
As we’re using a nopkg with Munki rather than a payload free package, we’ve not left any receipts, so Munki doesn’t know if Homebrew is installed. We’re going to use an installs array to tell Munki what to look for when determining whether Homebrew is installed or not.
You might be crying “but Homebrew needs the Xcode Command Line Tools installed!” - and you’d be 100% correct. You have the option of importing the downloaded package into Munki, but I have adapted Tim Sutton’s script into a nopkg. To find out what’s installed, I ran fseventer and chose a random file to act as my installs array. I’ve posted the pkginfos for both the Xcode CLI tools and all of the Homebrew installs on Github.
Earlier this year, I professed my love of Boxen - the personal automation solution based on Puppet released by Github. Indeed, it served me well for quite some time, but I began to find myself spending more time fixing Boxen than actually getting things done. As Boxen was designed for internal use at Github, it set some things up how they liked them - which wasn’t necesarily how I liked them. Sysadmins have similar needs to developers, but not exactly the same.
Then I updated Boxen. All of my modules were out of date, so I spent a good couple of hours updating all of them so they worked again. Ugh.
So I started looking at moving to my own solution. One of my major irritations when using Boxen was that it didn’t really handle updating your apps - you got whatever version the module author decided to install and then you had to hope that there was an updatng mechanism built in. I’ve said before that there is no better method of getting software onto your Mac then Munki, so the first decison was straightforward. The rest took a little thought.
The six P’s
My first requirement was that I shouldn’t need to run anything to get my configuration to apply. Boxen requires that you run the boxen command periodically across each of your Macs to get the configuration applied. This wasn’t always practical. I needed something that would run in the background and keep itself up to date.
As I said before, I really disliked how Boxen installs software. Munki does a much better job, and AutoPkg makes it trivial to make sure you have the latest software version. Being a sysadmin, I need more than simple drag and drop apps and packages though - I make extensive use of Homebrew to install command line tools like Packer, so I needed to come up with a way of installing these with Munki.
However, Munki isn’t the best tool for managing my configuration. I’ve been using Puppet to manage the Macs I look after for nearly three years now, and I wanted to base my system on it as I’ve already done a lot of the work with making OS X specific modules. I also wanted to use the modules made for Boxen as much as possible (some made too many assumptions about where they were running, so couldn’t be re-used.
So to recap:
Munki for software deployment.
Puppet must run in the background periodically
The configuration must update itself - I don’t want to have to sync code across machines.
Where possible, re-use existing Puppet modules
Over the next few posts, I’ll go over the different parts of this solution, how I put it together and how you might be able to use this.
A massive thanks to everyone who came to my talk today, and thanks to everyone who helped out with the Q&A at the end. All of the code I used in the talk is up on GitHub and here are the slides. Hopefully the video will convey how much fun it actually was - it could have been a disaster, so I’m hugely grateful to everyone who contributed to the discussion at the end.
Thanks for everyone that came to my talk today, it was fun to finally show off what I’ve been working on for the last year or so. I’m sure the video will be up soon, but in the meantime, here are the slides from the talk.
Over the past few weeks, I’ve had the same conversation over and over:
people telling me that once they get started using Munki, their next
step will be to start using AutoPkg. I gave each person the same
response: “you’re doing it wrong”.
AutoPkg a has a reputation of being difficult to use. This is totally
unjustfied. You don’t need to be using Munki for it to be useful, you
don’t need to set it up to run automatically via Jenkins or a
LaunchDaemon. If you need to get software into a package, AutoPkg is
the easiest way.
Installing AutoPkg
Head over to the releases page on AutoPkg’s GitHub repository and
download the latest version (0.3.0 at the time of writing). It’s an
Apple package, so double click it and get it installed. If you have Gate Keeper enabled, you’ll need to right-click on the package and choose to install it from there, as it’s not been signed.
Recipes
AutoPkg is useless without recipes. Fortunately, there are hundreds
that have already been made by the community.
We’ll add the set of recipes maintained by AutoPkg’s authors, which
contains some of the most common software. Open up a terminal window
and enter :
You’ll see AutoPkg downloading and adding the recipes to your Mac.
Using the thing
Let’s see what recipes we just added. Still in your terminal, enter:
You’ll see a whole load of output like:
The naming convention in AutoPKG is SoftwareName.output. For for
example, to run a recipe that downloads Google Chrome and adds it to
Munki, you would use the GoogleChrome.munki recipe, but if you just
wanted to download it an make a package, you’d use the GoogleChrome.pkg recipe. It just so happens that making a package of Chrome is exactly what we want to do.
Back into your terminal and enter:
The AutoPkg robot will churn away and you’ll get some output similar to:
And when it’s all finished, you’ll be left with a nice package that
you can use anywhere you’d use finely crafted packages - ARD, AutoDMG or even Casper if you’re that way inclined (although Allister Banks has been
working on a way of automating importing packages into the JSS - see
his recent talk for more on that subject).
Doing it all again
What happens next time you want to build an updated package?
Right?
Well, kinda.
What happens if Google changes the URL AutoPkg uses to download
Chrome? Fortunately we’re using the community provided recipes, and if
something’s broken they usually get fixed pretty quickly. We just need
to tell AutoPkg to update the installed recipes.
And then we’re able to build our package safe in the knowledge that
someone else has done all of the hard work for us.


190; 12021 H.E.
This morning while at work, I received an email from Github, letting me know that I got access to Copilot’s technical preview. Of course, I immediately dropped everything in order to play with this shiny new toy I just got.
I played with it a little bit in different languages with my friends, trying to create functions over some of our custom classes or structs we made on the fly. Overall, I must say, it’s pretty impressive how it can pick up the surrounding context and write boilerplate code on it (maybe not always fully correct).
Then sometime later in the afternoon, I pulled up an empty python file and just wrote def start(
, where copilot picked it from and immediately started writing down print statements, for what it seems to be a simple text-based adventure game. I tab-completed the whole game and it actually ran!
This is just a small experiment seeing how it picked up this specific example from whatever is its (controversial) training set. I recorded the game writing, where all I do is give the original start signature (this was my second attempt, so I gave it def start(self):
to nudge copilot into giving me what I had right before) and just pressing tabs.
You can get the python file here.
Some very quick searching showed that this is apparently an exercise from Learn Python the Hard Way by Zed Shaw, more specifically, exercise #35. It feels as many people posted their take on this exercise from the book or some specific implementation got a prime spot in the training set and is later suggested first when evaluating.
This is my ~7th hour since I started playing with copilot, so I wanted to share some cool findings and observations when playing with it. Will it replace all software engineers? Probably not, as a good engineer is not simply a code writer of various algorithms, one has to understand the big picture and work top-to-bottom. Will I use copilot? I don’t know. It works well for JS plotting and matplotlib plotting, because I could never care less to remember d3 methods to get me a 3d pie chart. ◼


The RSA procedure
Imagine a padlock.
This is a kind of lock that locks when you click it (i.e it doesn't require a key) but requires the key to open the lock.
So, I can send these padlocks to all my friends who want to communicate with me.
I will send them only the lock but will keep the key with me.
My friends can write me messages, put it in a box, lock it with my padlock (by clicking it) and send it to me, even over high risk networks.
If the box is intercepted, it's contents will not be compromised since I still have the key with me.
When the box reaches me, I can open my padlock with my key and read the contents.
This way, I can send padlocks (public keys) to people outside which they can use to lock boxes (encrypt messages) without being in danger of the contents being compromised as the padlock key (the private key) is always with me and never exchanged over the network.
Source : https://www.quora.com/How-do-you-explain-how-an-RSA-public-key-works-to-a-child


View Account
Sign Out
Home
Aider
(current)
Question Bank
Loan
My Questions
Add Question
Approve Question
Search
Add Your Question Here
×
Question
Select a Topic
Animal
Loans Assistance
Fund Assistance
Food
Foreign Agriculture
Forestry
Plants and Crops
Plant Nutrition
Plant Disease
Featured Topic
Animal
Loans Assistance
Fund Assistance
Food
Foreign Agriculture
Forestry
Plants and Crops
Plant Nutrition
Plant Disease


--- permalink: /404.html layout: default title: 404 hero: Page not found ---
The requested page could not be found.
Try starting from the index or the navigation above.


---
layout: post
title: Avoiding data processing with hashes
categories:
- Distributed Systems
- NoSQL
tags: []
status: publish
type: post
published: true
meta:
switch_like_status: '1'
_wpas_done_linkedin: '1'
publicize_results: a:1:{s:7:"twitter";a:1:{i:11342442;a:2:{s:7:"user_id";s:11:"davekincaid";s:7:"post_id";s:18:"202907255803363329";}}}
_wpas_done_twitter: '1'
_elasticsearch_indexed_on: '2012-05-16 23:43:48'
---
Recently for a project I am working on we had to find a way to decide if a data record had changed since the last time we saved it to the database. For this project we are receiving data from a number of customer databases periodically (every 6 hours) and need to do some ETL stuff on it before storing it in an Oracle database. We all know that reading a record from Oracle can be slow (relatively speaking), so we wanted something much faster.
Since there isn't a reasonable way to determine from the databases themselves which records have changed we are forced to dump entire tables for processing. We wanted to do the minimal amount of processing necessary if the records haven't changed since we wrote them to the database to save processing time. Typically for most of these tables only a very small number of rows have actually changed.
The solution we came up with was to calculate a hash value from the concatenated column values for each record when we write a record to Oracle. These hash values are then stored in a Redis hash keyed by the primary key of the table. Then when we receive a data table dump from the remote database we calculate the same hash on the incoming record and compare it to the hash value we have stored in Redis. If they match we know the record hasn't changed and we don't need to process it.
The whole thing is very fast and saves a great deal of unnecessary processing downstream. So far Redis has proven up to the task of quickly storing and retrieving millions of key/hash values.
Here's what it looks like:
Let's say we have a customer record in our database that has id, name, address, city and state like this:
id: 1000, name: Joe Smith, address: 123 Main St., city: New York, state: NY
the first time we see this record and check Redis for the existence of the key 1000 we will get nil returned, so we store the record in the database, calculate the hash of the value "1000:Joe Smith:123 Main St.:New York:NY"
to get something like "0a243fec5ab"
(we are using 128-bit hash values in production) and then store that hash value in Redis using
set "1000" "0a243fec5ab"
the next time we get this record we calculate the same hash if it is unchanged and know we don't need to process it again. If the hash value is different then we know that the record has changed and we need to send it through the rest of the processing chain.
We are currently using Storm to process millions of records at a time and use this hash check very early on in the pipeline to save us from needing more resources later in the pipeline to process unchanged records. We chose to use the Murmur-128 hash that is included in the Google Guava library for its speed.
 How did you solve it?


As always, we continue to make improvements to Aurelia. Below is a list of changes in this week's set of updates.
Minor Releases
Minor updates include new features, updates to bugs and performance improvements.
aurelia-pal 1.2.0
Features
- index: add PLATFORM.moduleName ( da92298 )
Patch Releases
Patch updates include only fixes to bugs and performance improvements.
aurelia-metadata 1.0.3
Bug Fixes
- metadata: handle primitive targets ( ecf28dd ), closes aurelia/templating-resources#267 aurelia/metadata#47 aurelia/binding#551 aurelia/dependency-injection#141 aurelia/binding#376
aurelia-dependency-injection 1.2.1
Bug Fixes
- autoinject: prevent changing inject of parent classes ( aa38a34 )
- container: check for custom registration before bubbling ( 98739f2 )
aurelia-bootstrapper 2.0.1
Bug Fixes
- Correctly detect NWJS.


Search
Friend 1
Friend 2
Friend 3
Friend 4
Friend 5
Friend 6
Friend 7
Friend 8
Friend 9
Friend 10
User


xcomp
: open clausal complement
An open clausal complement (xcomp
) of a verb or an adjective is a
predicative or clausal complement without its own subject. The
reference of the subject is necessarily determined by an argument
external to the xcomp (normally by the object of the next higher
clause, if there is one, or else by the subject of the next higher
clause). This is often referred to as obligatory control.
These clauses tend to be non-finite in many languages,
but they can be finite as well. The name xcomp
is
borrowed from Lexical-Functional Grammar.
We expect them to change their minds
xcomp(expect, change)
obj(expect, them)
Sue asked George to respond to her offer
xcomp(asked, respond)
iobj(asked, George)
I started to work there yesterday
xcomp(started, work)
You look great
xcomp(look, great)
I consider him a fool
obj(consider, him)
xcomp(consider, fool)
I consider her honest
obj(consider, her)
xcomp(consider, honest)
Susan is liable to be arrested
cop(liable, is)
xcomp(liable, arrested)
The clausal complement can be headed by various parts of speech, including a VERB, ADJ, or NOUN. The xcomp
-taking predicate of the higher clause can be a VERB or ADJ.
Contrast with other complement clauses, which use ccomp:
He says that you like to swim
ccomp(says, like)
I suggest eating now before the food gets cold
ccomp(suggest, eating)
The Inherited Subject Criterion
In examples like “I consider her honest”, the UD analysis corresponds to traditional grammar and what was termed “raising to object” in early generative grammar: the nominal “her” in these constructions is treated as the object of the higher clause (as its accusative morphology and ability to passivize suggests).
Note that the above condition “without its own subject” does not mean that a
clause is an xcomp
just because its subject is not overt. The subject must be necessarily inherited from a fixed position in the higher clause. That is, there should be no available interpretation where the subject of the lower clause may be distinct
from the specified role of the upper clause. In cases where the missing subject may or must be distinct from a fixed role in the higher clause, ccomp
should be used instead, as below. This includes cases of arbitrary subjects and anaphoric control.
The boss said to start digging
ccomp(said, start)
Pro-drop languages have clauses where the subject is not present as a separate word,
yet it is inherently present (and often deducible from the form of the verb).
The relation between clauses with pro-drop may or may not be xcomp
.
The implicit subjects of a subordinate clause and a higher clause may be coincidentally coreferent, warranting ccomp or advcl:
Píšu , protože jsem to slíbil . \n I-write , because I-have it promised .
advcl(Píšu, slíbil)
advcl(I-write, promised)
aux(slíbil, jsem)
aux(promised, I-have)
It is only xcomp
if the implicit subject depends on an argument from a higher clause (one cannot be varied without the other):
Slíbil jsem psát . \n Promised I-have to-write .
xcomp(Slíbil, psát)
xcomp(Promised, to-write)
aux(Slíbil, jsem)
aux(Promised, I-have)
Secondary Predicates
The following is excerpted from a more detailed discussion of secondary predicates.
The xcomp
relation is also used in constructions that are known as secondary predicates or predicatives.
Examples:
- She declared the cake beautiful.
- She declared the cake a success.
We could paraphrase the sentence using a subordinate clause: She declared that the cake was beautiful.
There are two predicates mixed in one clause: 1. she declared something, and 2. the cake was beautiful (according to her opinion).
The secondary predicate will be attached to the main predicate as an xcomp
:
She declared the cake beautiful .
nsubj(declared, She)
obj(declared, cake)
xcomp(declared, beautiful)
The subject of “declared” is again obligatorily controlled by a role in the higher clause. In the enhanced representation, there is an additional subject link showing the secondary predication:
She declared the cake beautiful .
nsubj(declared, She)
obj(declared, cake)
xcomp(declared, beautiful)
nsubj(beautiful, cake)
A Czech example:
jmenovat někoho generálem \n to-appoint someone as-a-general
obj(jmenovat, někoho)
xcomp(jmenovat, generálem)
Remember that xcomp
is used for core arguments of clausal predicates
so it will not be used for other instances of secondary predication.
For instance, in She entered the room sad we also have a double predication
(she entered the room; she was sad).
But sad is not a core argument of enter: leaving it out will neither affect grammaticality
nor significantly alter the meaning of the verb.
On the other hand, leaving out beautiful in she declared the cake beautiful
will either render the sentence ungrammatical or lead to a different interpretation of declared.
The result is that in She entered the room sad, sad is considered a modifier (not complement) of the verb,
with the relation advcl instead of xcomp
.
(This was changed from the previous approach which analyzed the secondary predication directly with acl,
because the nominal predicand is not always overt, and even when it is, the adjective does not really belong to the same nominal phrase.)
She entered the room sad .
nsubj(entered, She)
det(room, the)
obj(entered, room)
advcl(entered, sad)
punct(entered, .)
Entering the room sad is not recommended .
csubj(recommended, Entering)
det(room, the)
obj(Entering, room)
advcl(Entering, sad)
cop(recommended, is)
advmod(recommended, not)
punct(recommended, .)
Notice that while can be inserted before sad, clearly marking it as a clause.
A Czech example:
Vstoupila do místnosti smutná . \n She-entered to room sad .
advcl(Vstoupila, smutná)
advcl(She-entered, sad)
There is no need to decide whether an example like the following is a depictive or a manner adverbial:
Linda found the money walking our dog .
nsubj(found, Linda)
det(money, the)
obj(found, money)
advcl(found, walking)
det(dog, our)
obj(walking, dog)
punct(found, .)
The optional secondary predication or controlled adjunct subject relation can be represented with an enhanced dependency edge in addition to the advcl relation.
xcomp in other languages: [bg] [bm] [cop] [cs] [de] [el] [en] [es] [eu] [fi] [fr] [fro] [ga] [gsw] [hy] [it] [kk] [la] [ml] [no] [pa] [pcm] [pt] [qpm] [ru] [sl] [sv] [swl] [tr] [u] [vi] [yue] [zh]


[ all classes ]
[ emily.games.connect4 ]
Coverage Summary for Class: C4Board (emily.games.connect4)
| Class | Class, % | Method, % | Line, % |
|---|---|---|---|
| C4Board | 0% (0/ 1) | 0% (0/ 6) | 0% (0/ 18) |
1 /*
2 * Copyright 2017 github.com/kaaz
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package emily.games.connect4;
18
19 public class C4Board {
20
21 private C4Column[] cols;
22 private int columnSize;
23
24 public C4Board(int columns, int rows) {
25 cols = new C4Column[columns];
26 for (int i = 0; i < cols.length; i++) {
27 cols[i] = new C4Column(rows);
28 }
29 this.columnSize = rows;
30 }
31
32 public int getValue(int column, int row) {
33 return cols[column].getCol(row);
34 }
35
36 /**
37 * @param index the column to place it in
38 * @return can the player place it?
39 */
40 public boolean canPlaceInColumn(int index) {
41 return cols[index] != null && cols[index].hasSpace();
42 }
43
44 /**
45 * @param index the column
46 * @param player playerindex
47 * @return success
48 */
49 public boolean placeInColumn(int index, int player) {
50 return cols[index].place(player);
51 }
52
53 public String intToPlayer(int playerIndex) {
54 switch (playerIndex) {
55 case 0:
56 return "\uD83D\uDD34";
57 case 1:
58 return "\uD83D\uDD35";
59 default:
60 return "\u26AA";
61 }
62 }
63
64 @Override
65 public String toString() {
66 StringBuilder sb = new StringBuilder();
67 for (int height = 0; height < columnSize; height++) {
68 for (C4Column col : cols) {
69 sb.append(intToPlayer(col.getCol(height)));
70 }
71 sb.append("\n");
72 }
73 return sb.toString();
74 }
75 }


Unix Email¶
Create a directed graph, allowing multiple edges and self loops, from a unix mailbox. The nodes are email addresses with links that point from the sender to the receivers. The edge data is a Python email.Message object which contains all of the email message data.
This example shows the power of DiGraph
to hold edge data
of arbitrary Python objects (in this case a list of email messages).
The sample unix email mailbox called “unix_email.mbox” may be found here: https://raw.githubusercontent.com/networkx/networkx/master/examples/drawing/unix_email.mbox
Out:
From: ted@com To: carol@gov Subject: get together for lunch to discuss Networks?
From: ted@com To: alice@edu Subject: get together for lunch to discuss Networks?
From: ted@com To: bob@gov Subject: Graph package in Python?
From: ted@com To: bob@gov Subject: get together for lunch to discuss Networks?
From: alice@edu To: bob@gov Subject: NetworkX
From: bob@gov To: ted@com Subject: Re: Graph package in Python?
From: bob@gov To: alice@edu Subject: Re: NetworkX
# Author: Aric Hagberg<EMAIL_ADDRESS># Copyright (C) 2005-2018 by
# Aric Hagberg<EMAIL_ADDRESS># Dan Schult<EMAIL_ADDRESS># Pieter Swart<EMAIL_ADDRESS># All rights reserved.
# BSD license.
import email
from email.utils import getaddresses, parseaddr
import mailbox
import sys
import matplotlib.pyplot as plt
import networkx as nx
# unix mailbox recipe
# see https://docs.python.org/2/library/mailbox.html
def mbox_graph():
try:
fh = open("unix_email.mbox", 'rb')
except IOError:
print("unix_email.mbox not found")
raise
mbox = mailbox.UnixMailbox(fh, email.message_from_file) # parse unix mailbox
G = nx.MultiDiGraph() # create empty graph
# parse each messages and build graph
for msg in mbox: # msg is python email.Message.Message object
(source_name, source_addr) = parseaddr(msg['From']) # sender
# get all recipients
# see https://docs.python.org/2/library/email.html
tos = msg.get_all('to', [])
ccs = msg.get_all('cc', [])
resent_tos = msg.get_all('resent-to', [])
resent_ccs = msg.get_all('resent-cc', [])
all_recipients = getaddresses(tos + ccs + resent_tos + resent_ccs)
# now add the edges for this mail message
for (target_name, target_addr) in all_recipients:
G.add_edge(source_addr, target_addr, message=msg)
return G
if __name__ == '__main__':
G = mbox_graph()
# print edges with message subject
for (u, v, d) in G.edges(data=True):
print("From: %s To: %s Subject: %s" % (u, v, d['message']["Subject"]))
pos = nx.spring_layout(G, iterations=10)
nx.draw(G, pos, node_size=0, alpha=0.4, edge_color='r', font_size=16, with_labels=True)
plt.show()
Total running time of the script: ( 0 minutes 0.025 seconds)


Date picker
Axure Kit
Carbon
Updates
Common widgets
Style effects
Variables
Selection group
Repeater
Dynamic panel
Introduction
Axure elements
Utilities
UI shell
Tooltip
Toggle
Tile
Text input
Tag
Tabs
Structured list
Slider
Select
Search
Radio button
Progress indicator
Pagination
Overflow menu
Number input
Notification
Modal
Loading
List
Link
Inline loading
Form
File upoader
Dropdown
Date picker
Data table
Content switcher
Code snippet
Checkbox
Button
Breadcrumb
Accordion
Components
Typography
Spacing
Icons
Color
Design elements
Library index
Getting started
Components
Privacy
Have questions? Open an issue on GitHub.
Last updated 29 January 2020
Copyright © 2020 IBM
Terms of Use
Contribute
IBM.com
Date picker simple
Library section:
Interactions:
Form
Style effects
Date Picker label
Date picker
Library section:
Interactions:
Form
Dynamic panel
Style effects
Variables
Selection group
Repeater
Date picker opens with current date.
–
Selection updates value in input field.
–
Step by months, step by year or entering exact year updates calendar.
–
Implemented features
Keep all elements of the widget, don't change (it may break its functionality).
Usage
Date picker label


{{ $featured_image := partial "func/GetFeaturedImage.html" . }}
{{ if $featured_image }}
{{/* Trimming the slash and adding absURL make sure the image works no matter where our site lives */}}
{{ $featured_image := (trim $featured_image "/") | absURL }}
{{- partial "site-navigation.html" . -}}
{{ if not .Params.omit_header_text }}
{{- .Title | default .Site.Title -}}
{{ with .Params.description }}
{{- . -}}
{{ end }}
{{ end }}
{{ $currentPage := . }}
{{ range .Site.Menus.dnd }}


|
Solar
|
Warps and crops an image given a contour defined with four 2D points. UUID: 4a7d5c34-cd6e-11e7-abc4-cec278b6b50a
More...
#include <IPerspectiveController.h>
Public Member Functions | |
| IPerspectiveController ()=default | |
| IPerspectiveController default constructor. | |
| virtual | ~IPerspectiveController ()=default |
| IPerspectiveController default destructor. | |
| virtual FrameworkReturnCode | correct (const SRef< SolAR::datastructure::Image > inputImg, const std::vector< SolAR::datastructure::Contour2Df > &contours, std::vector< SRef< SolAR::datastructure::Image > > &patches)=0 |
| Warps and crops an image given a set of contour defined with four 2D points. More... | |
| virtual FrameworkReturnCode | correct (const SRef< SolAR::datastructure::Image > inputImg, const SolAR::datastructure::Contour2Df &contour, SRef< SolAR::datastructure::Image > &patch)=0 |
| Warps and crops an image given a contour defined with four 2D points. More... | |
Warps and crops an image given a contour defined with four 2D points. UUID: 4a7d5c34-cd6e-11e7-abc4-cec278b6b50a
|
pure virtual |
Warps and crops an image given a contour defined with four 2D points.
| [in] | inputImg | the original image on which we want to extract sub-image aligned on the 2D contour |
| [in] | contour | the contour defined with four 2D points |
| [out] | patch | the sub-image or patche resulting from the warping and cropping of the original image according to the 2D contour |
|
pure virtual |
Warps and crops an image given a set of contour defined with four 2D points.
| [in] | inputImg | the original image on which we want to extract sub-images aligned on the set of 2D contours |
| [in] | contours | the set of contours each defined with four 2D points |
| [out] | patches | the set of sub-images or patches resulting from the warping and cropping of the original image according to the set of 2D contours |


Pickerington, Ohio, is home to the American Motorcyclist Association, or AMA, Motorcycle Hall of Fame, which welcomes motorcycle connoisseurs into its extensive display of motorcycle and motorcyclist history.
The hall of fame has reopened its doors and offers a wide variety of historical motorcycles on its first floor, and it pays tribute to the widely-renowned motorcyclists that left a mark on the industry, according to the AMA Motorcycle Hall of Fame’s website.
For non-members, the museum charges $10 for adults, $8 for senior citizens and $3 for students, but the vast history depicted within the walls of the museum can be accessed free of charge for any AMA member.
Patrick Summers, a senior studying cellular and molecular biology, said he would expect a hall of fame museum such as the AMA Hall of Fame to be popular among people in Ohio and throughout the country.
“In the U.S. in particular, we tend to value our vehicles … and, more so, if not, the people attached to them,” Summers said. “It’s not surprising to me that there’s a museum like that.”
Summers said he sees the hall of fame as a significant reason to visit the Columbus area for those with a passion for motorcycles.
Gilbert Moore, program director of Ohio Valley Rider Training and a member of AMA, said he has visited the hall of fame many times over the years.
About 75% of the museum is permanent exhibits, and the other 25% changes very regularly, and it always has a variety of different niches on display, Moore said.
“They have exhibits on a collection of toy sidecars and motorcycle related toys,” Moore said. “You can go back in time and again, and there's always new stuff to see, which I value.”
The museum also shows the lifetime growth of motorcycle machinery, featuring models of some of the first ever motorcycles all the way up to modern day motorcycles that you could see on the street, Moore said.
“They've got motorcycles that are 100 years old,” Moore said. “One thing that’s fun to do is look at the development of the equipment.”
Kent Knudson, an AMA member and owner of Team Pentovarna, a vintage off-road motorcycle race team, has curated multiple exhibits for the hall of fame. He said he has a large collection of a variety of different motorcycle memorabilia with a specialization in vintage off-road models.
Over the years, Knudson said he has experienced a variety of different extensive and impressive displays, including one that features celebrity motorcycles as well as one called “Motocross America,” an exhibit depicting the sport of motocross and its extensive history that Knudson contributed to.
“They brought in motorcycles (and gear) from all over the world,” Knudson said. “It was the most elaborate and expensive exhibit that they've ever done.”
Knudson stressed the idea that, especially in recent years, the museum does not just primarily focus on the development of the vehicles, but rather, it incorporates the story behind the motorcycle and, more importantly, its rider.
“It's not about the motorcycle, it's about the motorcyclist — the person,” Knudson said.
Moore said the glorification of the motorcyclist equal to the motorcycle on display is a unique aspect of the museum that he appreciates.
“In some cases it’s about a story, and the motorcycle is just a prop,” Moore said. “There's a lot of good stories about people where the motorcycle is just the reason we're getting together.”
The Midwest region has always been the origin of motorcycle development during the Industrial Revolution, Moore said. Because of this, he said it makes sense that the AMA Motorcycle Hall of Fame Museum is located in central Ohio. Additionally, some of the biggest motorcycle dealers are still located in Columbus, Ohio.
Ultimately, Moore said the hall of fame fosters such an enjoyable experience because of the rich history it displays on its walls that correlates with the motorcycles sitting before the viewers.
“You just start reading the wall about what these people did and how they did it and where they were and when it happened,” Moore said. “Then you look at the machinery.”


We value your privacy.
You can set your consent preferences and determine how you want your data to be used based on the purposes below. You may set your preferences for us independently from those of third-party partners. Each purpose has a description so that you know how your data are used.
These are essential to the operation of the platform's services.
The storage of information, such as images, content or credentials for better performances and automatic log in.
Google Tag Manager and Google Analytics are used to monitor users’ behavior on our services, which include giving accurate statistics to sales agents based on that cookie.
These are optional but very useful for us to provide you with optimal services.
Intercom is used as a communication service to enable users to discuss directly with the Cascade8 team.
Audience analysis to design better experience.


#include <nn_ops.h>
Computes Quantized Rectified Linear 6: min(max(features, 0), 6)
Arguments:
Returns:
Output
activations: Has the same output shape as "features".Output
min_activations: The float value that the lowest quantized value represents.Output
max_activations: The float value that the highest quantized value represents.
Constructors and Destructors |
|
|---|---|
QuantizedRelu6(const ::tensorflow::Scope & scope, ::tensorflow::Input features, ::tensorflow::Input min_features, ::tensorflow::Input max_features)
|
|
QuantizedRelu6(const ::tensorflow::Scope & scope, ::tensorflow::Input features, ::tensorflow::Input min_features, ::tensorflow::Input max_features, const QuantizedRelu6::Attrs & attrs)
|
Public attributes |
|
|---|---|
activations
|
|
max_activations
|
|
min_activations
|
|
operation
|
Public static functions |
|
|---|---|
OutType(DataType x)
|
Structs |
|
|---|---|
|
tensorflow:: |
Optional attribute setters for QuantizedRelu6. |
::tensorflow::Output activations
::tensorflow::Output max_activations
::tensorflow::Output min_activations
Operation operation
QuantizedRelu6( const ::tensorflow::Scope & scope, ::tensorflow::Input features, ::tensorflow::Input min_features, ::tensorflow::Input max_features )
QuantizedRelu6( const ::tensorflow::Scope & scope, ::tensorflow::Input features, ::tensorflow::Input min_features, ::tensorflow::Input max_features, const QuantizedRelu6::Attrs & attrs )
Attrs OutType( DataType x )


The Bad Boy and The Tomboy
108M Reads,
3.4M Votes, 85 Chapters.
Some love stories begins in all the wrong ways.
Always comfortable being one of the guys, Macy Anderson is laser focused on only three things: studies, soccer, and a scholarship.
Handsome and charismatic, Cedric’s everything Macy has ever wanted in a boyfriend. There’s just one problem: Cedric’s cousin Sam. Brazen and unapologetic with a bad-boy reputation to match, Sam has an annoying way of constantly showing up in Macy’s life. Something crackles beneath their “just friends” relationship, and soon Macy’s thinking about him in all the ways she shouldn’t pushing things too far when she’s around him.
As the tension between them escalates, Macy needs to decide if it’s worth risking both a friendship and a relationship to find out where her heart’s loyalties truly lie. Especially when the truth behind Sam’s bad-boy demeanor changes everything between them forever.
About the Author:
Nicole Nwosu grew up in Toronto, Canada, and first started posting her stories on Wattpad in 2014. Her most popular story The Bad Boy and the Tomboy has accumulated over a hundred Million reads on the platform and won a 2015 "Cover-to-Cover" Watty Award. When she's not Writing, Nicole spends her time catching up on binge-worthy TV shows while balancing her Studies at Western University. Because of her amazing writing skills, Nicole was given the opportunity to publish her book –The Bad Boy and The Tomboy – by the Wattpad publishers, becoming a best seller the instant it was published.$10.23
- Some love stories begin in all the wrong ways.
- 108M Reads.
- 3.4M Votes.
- 85 Chapters.
$8.29
- A new town, a new love, another chance to stay alive.
- 120M Reads.
- 2.9M Votes.
- 72 Chapters.
$10.99
- Tensions are high as secreats are being unraveled, can this love stand the test of time?
- 148M Reads.
- 2.1M Votes.
- 56 Chapters.


Toggle navigation
UID
Main
Wallet
Preview
Title
Text
Coins
Address
email
Title
Description
Address
Reward
email
Upload image
Call for action


[gecode-users] Propagator called too soon...
Jérémie Vautard
jeremie.vautard at laposte.net
Tue Mar 14 22:10:44 CET 2006
Hello !
(These questions come in the same context than the "Extending integer
and set variables to quantified variables
<http://www.gecode.org/gecode-users/2006-March/001000.html>" thread I
started a while ago...)
I have made a propagator which fails the space immediately when invoked,
in order to stop the propagation as soon as an universally quantified
variable domain is reduced. The only problen I have is that this
propagator is also called one first time at the very begining of the
propagation loop. Is there a way to avoid this first call, and call the
propagator only when the variable domain have been actually reduced ? I
suppose that it can be done using propagation conditions, but I must
admit I don't really understand how to create user-defined PropConds.
Another, maybe trivial, question : what is the best way to subscribe a
propagator to a particular IntVar ? The way I use presentely is I think
a little dirty : I have created a "QIntVar" class which extands the
IntVar class by only adding it a IntvarImp* GetVar() method
returning the protected "var"member of the IntVar class. Then, I use the
subscribe() method of this IntVarImp in order to subscrime my "fail-now"
propagator. Is there a cleaner way to achieve this ?
Yet another question : when I try to make a new "Fail-now" propagator
using the 'new' operator, ( ForAllProp* pr = new ForAllProp(home,fd) by
example. I have defined the ForAllProp(Space* home, bool fd=false)
constructor. ), I get an error at the compilation process. I have for
the moment avoided the problem by declaring only one global "ForAllProp
fa(myspace);" and using subscribe(myspace,&fa,condition), but I don't
really like this. For the same reason, the copy() is for the moment
defined by :
Actor* copy(Space* home, bool share) {return this;}
and I wonder if it will not be a source of problems later...
Here is my ForAllProp class, defining the "Fail now" propagator :
class ForAllProp : public Propagator {
public :
ForAllProp(Space * home, bool fd = false) : Propagator(home,fd) {};
ForAllProp(Space * home, bool share, ForAllProp & p) : Propagator(home, share, p) {};
PropCost cost(void) const {return PC_UNARY_LO;};
ExecStatus propagate(Space * home) {cout<<"ForAll réduit";return ES_FAILED;};
Actor* copy(Space* home, bool share) {return this;}
};
Best regards,
Jeremie
More information about the gecode-users
mailing list


Services for importing data from the various data sources, processing the data and writing it back to Learn.


Virufy on-Device Detection for COVID-19
The Team
Problem Description
COVID-19 testing is inadequate, especially in developing countries. Testing is scarce, requires trained nurses with costly equipment, and is expensive, limiting how many people can obtain their results. Also, many people in developing countries cannot risk taking tests because results are not anonymous, and a positive result may mean a loss of day-to-day work income and starvation for their families, which further allows COVID-19 to spread.
Numerous attempts have been made to solve this problem with partial success, including contact tracing apps which have not been widely adopted often due to privacy concerns. Pharmaceutical companies have also fast-tracked development of vaccines, but they still will not be widely available in developing countries for some time.
To combat these problems, we propose a free smartphone app to detect COVID-19 from cough recordings through machine learning analysis of audio signals, which would allow for mass-scale testing and could effectively stop the spread of the virus.
We decided to use offline edge prediction for our app for several reasons. Especially in developing countries, Internet connectivity / latency is limited and people often face censoring. Data privacy regulations such as GDPR are now commonplace and on-device prediction will allow for diagnoses without personal information or health data crossing borders. Because our app will potentially serve billions of predictions daily, edge prediction is also more cost-effective, as maintaining and scaling cloud infrastructure to serve all of these predictions will be costly and difficult to maintain.
System Design
In designing our system and pipeline, we first and foremost kept in mind that this pipeline would be running offline on edge devices in developing countries, including outdated phones with weak CPUs. We aimed for a pipeline that could efficiently process data, run a simple model, and return a prediction within a minute. To do this, we simplified our model, sacrificing some “expressiveness” in exchange for reduced complexity, but also through straightforward preprocessing of data.
For the frontend, we decided on a web app because it can be used in the browser, which is operating-system-agnostic; in comparison, apps may only run on certain operating systems. Our frontend is written in ReactJS + TypeScript, which is the industry standard for modern web design. It employs responsive web design principles to be compatible with a wide range of screen sizes and aspect ratios present on different devices. Internally, the frontend calls a TensorFlow.js (TFJS) model for inference.
We chose to use the TensorFlow.js (TFJS) framework because it is supported for use with web browsers. The TFJS Speech Command library provides a JavaScript implementation of the Fourier Transform (Browser FFT) to allow straightforward preprocessing of the raw audio files. We trained a vanilla TensorFlow model on background noise examples provided by the sample TFJS Speech Commands code, along with a dataset of thousands COVID-19 test result labeled coughs, so that our model could distinguish coughs from background noise. We then converted this trained model into the TFJS LayersModel format (with the model architecture as a JSON and weights in .bin files), so that we could integrate it into the front end JavaScript code for browser inference on-device.
Our system’s basic pipeline is as follows:
- User opens our app
- The TFJS models are downloaded from S3 onto the user’s device
- Microphone detects noise from user
- The Speech Commands library continuously preprocesses the audio by creating audio spectrograms
- The spectrograms are run through the model
- Only if the audio snippet is classified as a cough, the user will receive a prediction of whether they are COVID positive or negative
It is worth noting that model files are downloaded and loaded into memory only when the user first opens the app. After this, no Internet access is required and the system is able to make predictions offline.
Machine Learning Component
The model that powers our application is based on the publicly available TensorFlow.js Speech Commands module. Our model is intended to be used with the WebAudio API supported by all major browsers and expects, as input, audio data preprocessed with the browser Fast Fourier Transform (FFT) used in WebAudio’s GetFloatFrequencyData. The result of this FFT is a spectrogram which represents a sound wave as a linear combination of single-frequency components. The spectrogram, which can be thought of as a 2D image, is passed through a convolutional architecture to obtain logits which can be used in multiclass prediction. Specifically, this model has 13 layers with four pairs of Conv2D to MaxPooling layers, two dropout layers, a flatten layer, and two dense layers.
Because training from scratch is expensive, we started with a model trained using the Speech Commands dataset [2], trained to recognize 20 common words such as the numbers “one” to “ten”, the four directions “left”, “right”, “up”, “down”, and basic commands like “stop” and “go”. We performed transfer learning on this model by removing the prediction layer and initializing a new one with the correct number of prediction classes. Afterwards, we fine-tuned the weights on the open source COUGHVID dataset, which provides over 20,000 crowdsourced cough recordings from a plethora of different characteristics including gender, geographic location, age, and COVID status.
To ensure that data is preprocessed in the same way during training and testing, we use a custom preprocessing TensorFlow model which is trained to emulate the browser FFT that is performed by WebAudio, producing the same spectrogram as output. This browser FFT emulating model is provided and maintained by Tensorflow Speech Commands. Creating our own training pipeline allowed us to select our model architecture based on existing ongoing research efforts and fine tune our hyperparameters.
System Evaluation
Offline evaluation was done on our model as a quick way to ensure our model was working correctly. This meant setting aside 30% of our data as test data. To monitor offline testing, we used Weights and Biases. As shown below, 50 epochs were sufficient to achieve convergence in training and validation accuracies, with corresponding decreasing losses. Here is an example of what we we logged:
As demonstrated by the graphs as well as the chart, the “loss”, or the loss calculated from our training set was 0.1717. While the ‘val_loss’, or the loss calculated from the testing set was 0.09781. Also, the “acc” or the accuracy calculated from the training set was 0.93298. While the ‘val_acc’ or the accuracy calculated from the testing set was 0.96875. Additionally, we evaluated the model before and after TFJS conversion and found that the accuracy as well as the loss on both the training and testing set were the same. This was important because we were initially concerned that during the conversion process the quality of our model would go down, however we were delightfully surprised that this did not occur.
The remainder of our evaluation was done through real world testing. Although the gold standard of testing would be large-scale, randomized clinical trials, with data collected from a variety of demographic groups and recording devices, we did not have the time and resources to do that in the constraints of the class. Instead, we did informal evaluations on our own team members and friends in Argentina and Brazil.
Anecdotally, the prediction was highly accurate on our group members, who were primarily Asian and all healthy. This remained true across a variety of devices such as smartphones, laptops, and tablets.
The collection of external results was complicated by ethical considerations and lack of access to PCR tests to provide ground-truth labels. Nonetheless, we will note here two cases in Brazil. One individual was recovered, but previously was diagnosed with COVID-19; the model predicted that he had COVID-19. The other individual had COVID-19, but was predicted to be healthy. This illustrates the inherent challenge of translating models from development to production; model accuracy might be highly degraded due to distribution shift between the training and inference data.
Application Demonstration
In the beginning stages of the design process prior to this course, the Virufy product designer determined the appropriate target audience by conducting user interviews. She selected potential interviewee candidates based on certain demographic criteria such as being a citizen of selected Latin America countries or being tech-savvy and owning a cell phone.
After gathering target audience candidates from six Latin America countries as well as the U.S. and Pakistan, user interviews were conducted. The results from the interviews were then synthesized to create user personas. These personas helped her produce empathetic and user-centered designs throughout the whole design process.
Once initial ideation and designs were completed, the designer conducted a series of prototype user tests in which the user was observed as they walked themselves through the app mockup. The data from each user test was then synthesized to design new and improved iterations. After numerous user tests and iterations and evolving, the designer created a mockup of the demonstration application.
Over the past month, we worked with the Virufy designer to adapt the design to our specific user needs given our novel contribution towards edge prediction. Through discussions with hospitals and normal users, alongside the technical limitations of TensorFlow.js, we finalized on our below design in which the user could click the microphone to trigger our model execution. We made the instructions simple and easy to follow, so users could record their cough and immediately get their prediction with our edge model which performed very fast (under 200ms on our laptops).
Reflections
Throughout the course of this 2-month project, we explored many areas technically, some of which were fruitful, and others of which were dead ends.
-
Google’s Teachable Machine
At the start of our project, we used the MFCC and mel-spectrogram audio features in our models based on state-of-the-art research, but ran into issues as the same preprocessing code was not supported on-device with TFJS. We reached out to Pete Warden, an expert of TinyML on Google’s TensorFlow team, who pointed us to Teachable Machine, a web-based tool to create models, which uses TensorFlow.js to train models and generates code to integrate into JavaScript front ends. Although very simple and lightweight, we soon discovered Teachable Machine was not a feasible long-term solution for us, as it required manual recording and upload of training audio files, while also not providing us the flexibility to configure model architecture as we hoped to do. This ultimately forced us to train our own custom model.
-
Speech Commands Library
TensorFlow’s Speech Commands library provided a simple API to access a variety of important features like segmenting the continuous audio stream into one-second snippets and performing FFT feature extraction to obtain spectrograms. The availability of pre-existing training pipelines as well as example applications using Speech Commands provided a strong foundation for us to adapt our own pipeline and frontend application.
-
Team Dynamics
We compartmentalized responsibilities such that individual members were largely in charge of separate components of the system. Frequent communication via Slack was key to ensure that we all had a sense of the bigger picture.
Overall, we learned over the quarter how to integrate frontend and backend codebases to build a production machine learning system, while utilizing APIs and libraries to expedite the process. Our knowledge also broadened as we considered the unique challenges of developing models for CPU-bound edge devices in the audio analysis domain.
Continuing beyond this course, we would like to explore the following areas:
-
Model Performance
State-of-the-art research papers suggest that accuracies as high as 98% are possible for larger neural networks. We would like to tune our tiny edge models to perform at similar accuracies.
-
Dataset Diversity
Our model development was limited by the lack of access to large-scale, demographically diverse, and accurately labelled datasets. For next steps, we hope to remedy this by leveraging the Coswara dataset, along with the larger datasets Virufy is collecting globally.
-
Microphone Calibration
We didn’t take into account the distribution shift between training and inference due to differences of microphone hardware specifications between edge devices.
-
Audio Compression
The audio samples we trained on were of similar audio formats and frequencies. Exploring the effect of audio compression codecs such as mp3 on model performance may lead to interesting insights.
-
Expansion to More Diseases
COVID-19 is not the only disease that affects patient cough sounds. We believe our model can be enhanced to distinguish between various other coronaviruses such as the common cold and flu, along with asthma and pneumonia through use of a multi-class classifier.
-
Embedded Hardware
An interesting area to explore is further shrinking our model to fit onto specialized embedded devices with microphones. Such devices could be cheaply produced and shipped globally to provide COVID detection without smartphones.
Broader Impacts
Our app is intended to be used by people in developing countries who need an anonymous solution for testing anytime, or by anyone in a community at risk of COVID-19. However, we have identified some unintended uses of our app.
Because we intend to share our technology freely and because the algorithm runs on-device, competitors will easily be able to take our algorithm and create copies of our app and may even block access to our app and sell theirs for profit. To prevent this, we will open source our technology under terms requiring attribution to Virufy and prohibiting charging users for the use of the algorithm.
Another risk is that people may begin to ignore medical advice and believe only in the algorithm and might use the results in place of an actual diagnostic test. This is very risky because if the algorithm mispredicts, we may be held liable. The spread of COVID-19 may increase if COVID-19 positive people become confident to socialize with false negative test results. To mitigate this, we intend to add disclaimers that our app is a pre-screening tool that should be used only in conjunction with medical providers’ input. Additionally, we will work closely with public health authorities to clinically validate our algorithm and ensure it is safe for usage.
People may also start testing the algorithm with irrelevant recordings of random noises such as talking. To address this, we have equipped our algorithm with a cough detection pre-check layer to prevent any non-cough noises from being classified.
Finally, people especially in poorer contexts may share the same smartphones with several users, which can increase the likelihood of spreading COVID-19. Thus, our instructions clearly state that users must disinfect their device and keep 20 feet away from others while recording.
Code
Our TensorFlow JavaScript audio preprocessing and model prediction code can be found here: https://github.com/dtch1997/virufy-tm-cough-app
Our finalized progressive web application code can be found here: https://github.com/virufy/demo/tree/edge-xoor
References
We’re extremely grateful to Pete Warden, Jason Mayes, and Tiezhen Wang from Google’s TensorFlow.js team for their kind guidance on TinyML concepts and usage of the speech_commands library, both in class lecture and during the few weeks of our development.
Jonatan Jaskilioff and the team at XOOR were very gracious to lend their support and guidance in integrating our JavaScript code into the progressive web app they had built pro bono for Virufy.
We are also indebted to the broader Virufy team for guiding us on the real-world applicability and challenges of our edge device prediction project. We leveraged their deep insights from their members distributed across 20 developing countries in formulating our problem statement. Additionally, we built on top of the open source demo app that they had built prior based on intentions for real-life usage, along with their prior research findings and open source code for our model training.
In preparing our final report, we are grateful to Colleen Wang for her kind support in editing the content of our post, Virufy lead UX designer Maisie Mora for helping explain the design process in the application demonstration section, and Saad Aslam for his kind support in converting our blog post to a nicely formatted HTML page.
Finally, we cannot forget the great lessons and close guidance from Professor Chip Huyen and TA Michael Cooper who helped us open our eyes to production machine learning and formulate our problem to be attainable within the short 2 month course quarter.
[1] Tensorflow Speech Commands dataset, https://arxiv.org/pdf/1804.03209.pdf
[2] Teachable Machine, https://teachablemachine.withgoogle.com/
[3] Virufy: A Multi-Branch Deep Learning Network for Automated Detection of COVID-19 https://arxiv.org/ftp/arxiv/papers/2103/2103.01806.pdf


This website is designed by Bolun Zhang from Information Science School at University of Pittsburgh. Someone who loves sports but don't like doing them and loves cyber games but s**k at playing them.


Hi!
My name is Freda. I am web designer in the making and a research analyst at Fox Broadcasting Company. I found my passion for web design a really long time ago. How long ago? Well, let’s just say I can still remember how to use Microsoft
FrontPage. :)
Prior to my current position, I worked in an international production company in Los Angeles while pursuing my master degree in Public Relations at University of Southern California. Palm trees and sunny beaches are unforgettable, but nothing compares to the New York city skyline. After a brief trip to New York in 2016, I immediately made the decision to move here.
Born and raised in Shanghai, I have also lived in Melbourne and Barcelona before moving to the US. The multi-cultural experience not only helped me learn to understand and appreciate different cultures but also made me realize the importance of the tech industry around the world.
I love traveling and I have been to 20 countries and counting. When I am not at work, you can find me in all kinds of local restaurants in New York searching for the best treat for my taste buds. I also enjoy going to concerts and events and am decently knowledgeable of all the happenings in the city.


Introduction
The online hotel reservation channels have revolutionized the way bookings are made and have significantly impacted customer behavior. However, cancellations and no-shows remain a common occurrence, posing challenges for hotels. Understanding the factors influencing these cancellations can help hotels optimize revenue management strategies and enhance customer satisfaction.
In this blog post, we will analyze a hotel reservation dataset using SQL to uncover insights about customers' booking patterns, preferences, and cancellation behavior. The dataset we will be using contains various attributes related to customers' reservation details. Let's dive into the data and extract valuable information through SQL queries.
Setting up the Environment
To begin our analysis, let's assume we have imported the dataset into a SQL database and have it ready for querying. We will be using standard SQL syntax to write our queries. Let's dive into the dataset and extract meaningful information.
1. Exploratory Analysis
First, let's perform some exploratory analysis to understand the dataset better.
Count the total number of bookings in the dataset
-- Count the total number of bookings in the dataset
SELECT COUNT(*) AS total_bookings
FROM hotel_reservations;
Result:
+----------------+ | total_bookings | +----------------+ | 119390 | +----------------+
2. Booking Patterns
Next, let's examine the booking patterns by analyzing the number of adults, children, and meal plans chosen by customers.
Count the number of bookings based on the number of adults
-- Count the number of bookings based on the number of adults
SELECT no_of_adults, COUNT(*) AS booking_count
FROM hotel_reservations
GROUP BY no_of_adults
ORDER BY no_of_adults;
Result:
+--------------+---------------+ | no_of_adults | booking_count | +--------------+---------------+ | 0 | 403 | | 1 | 32901 | | 2 | 85160 | | 3 | 15512 | | 4 | 2454 | | 5 | 20 | | 6 | 6 | | 10 | 1 | +--------------+---------------+
Count the number of bookings based on the number of children
-- Count the number of bookings based on the number of children
SELECT no_of_children, COUNT(*) AS booking_count
FROM hotel_reservations
GROUP BY no_of_children
ORDER BY no_of_children;
Result:
+----------------+---------------+ | no_of_children | booking_count | +----------------+---------------+ | 0 | 110796 | | 1 | 4861 | | 2 | 3657 | | 3 | 78 | | 10 | 1 | +----------------+---------------+
Count the number of bookings based on the type of meal plan
-- Count the number of bookings based on the type of meal plan
SELECT type_of_meal_plan, COUNT(*) AS booking_count
FROM hotel_reservations
GROUP BY type_of_meal_plan;
Result:
+-------------------+---------------+ | type_of_meal_plan | booking_count | +-------------------+---------------+ | BB | 92310 | | FB | 7987 | | HB | 14463 | | SC | 10328 | | Undefined | 2 | +-------------------+---------------+
3. Customer Preferences
Now, let's explore customer preferences in terms of car parking, room types, and special requests.
Count the number of bookings requiring car parking space
-- Count the number of bookings requiring car parking space
SELECT required_car_parking_space, COUNT(*) AS booking_count
FROM hotel_reservations
GROUP BY required_car_parking_space;
Result:
+----------------------------+---------------+ | required_car_parking_space | booking_count | +----------------------------+---------------+ | 0 | 112250 | | 1 | 71140 | +----------------------------+---------------+
Count the number of bookings based on the room type reserved
-- Count the number of bookings based on the room type reserved
SELECT room_type_reserved, COUNT(*) AS booking_count
FROM hotel_reservations
GROUP BY room_type_reserved;
Result:
+------------------+---------------+ | room_type_reserved | booking_count | +------------------+---------------+ | A | 2193 | | B | 177 | | C | 35 | | D | 15366 | | E | 4445 | | F | 1031 | | G | 281 | | H | 1169 | | I | 4421 | | L | 6 | | P | 6018 | +------------------+---------------+
Count the number of bookings based on the number of special requests
-- Count the number of bookings based on the number of special requests
SELECT no_of_special_requests, COUNT(*) AS booking_count
FROM hotel_reservations
GROUP BY no_of_special_requests;
Result:
+------------------------+---------------+ | no_of_special_requests | booking_count | +------------------------+---------------+ | 0 | 70302 | | 1 | 34514 | | 2 | 17718 | | 3 | 9713 | | 4 | 5009 | | 5 | 2384 | | 6 | 708 | | 7 | 390 | | 8 | 150 | | 9 | 36 | | 10 | 16 | | 11 | 8 | | 12 | 3 | +------------------------+---------------+
Conclusion
In this blog post, we used SQL queries to analyze a hotel reservation dataset. We explored booking patterns by examining the number of adults, children, and meal plans chosen by customers. Additionally, we investigated customer preferences for car parking, room types, and special requests. These insights can help hotels understand their customers better, tailor their services, and optimize revenue management strategies.


Home
Activities
Contact us
Account
{{gametitle}}
{{gametitle}}
{{noOfIceCreams}}
{{question}}
Submit
Voice Submit
Skip
×
Womp Womp :(
You lost!
Try again maybe....


---
layout: post
mathjax: true
comments: true
date: 2012-12-13
title: [Project Euler] #12 Solution
excerpt: |
This page presents a Ruby solution to Project Euler Problem 12.
tags:
- project euler problem 12 solution
- project euler problem 12 answer
- project euler problem 12 ruby
---
Overview
Question
The sequence of triangle numbers is generated by adding
the natural numbers. So the 7th triangle number would be
\(1 + 2 + 3 + 4 + 5 + 6 + 7 = 28\). The first ten terms would be:
\[1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...\]
Let us list the factors of the first seven triangle numbers:
1: 1
3: 1,3
6: 1,2,3,6
10: 1,2,5,10
15: 1,3,5,15
21: 1,3,7,21
28: 1,2,4,7,14,28
We can see that 28 is the first triangle number to have over
five divisors. What is the value of the first triangle number
to have over five hundred divisors?
click for answer
76576500
Solutions
Ruby
{% highlight ruby %} triangleNumbers.rb https://raw.github.com/addamh/euler/master/012/triangleNumbers.rb download
#!/usr/bin/env ruby
require 'prime'
def factors_of(number)
primes, powers = number.prime_division.transpose
exponents = powers.map{|i| (0..i).to_a}
divisors = exponents.shift.product(*exponents).map do |powers|
primes.zip(powers).map{|prime, power| prime ** power}.inject(:*)
end
divisors.sort.map{|div| [div, number / div]}
end
sequence = Enumerator.new do |yielder|
number = 0
loop do
number += 1
yielder.yield number
end
end
sequence.each do |i|
t = i*(i+1)/2
factors = []
if t > 1
factors_of(t).each do |chunk|
factors.push(chunk[0])
factors.push(chunk[1])
end
if factors.uniq.length > 500
p t
break
end
end
end
{% endhighlight %}
{% highlight console %}
$ time ruby triangleNumbers.rb
real 0m7.742s
user 0m7.715s
sys 0m0.023s
{% endhighlight %}


{% load i18n %}
{% blocktrans %}Are you sure you want to delete the category {{ category }}?{% endblocktrans %}


If your browser supports Refresh, you'll be transported to the correct page immediately.
If not, please click the link.


Aussie Gamer Avoids Jail After Admitting To Assault During A Fortnite Stream
by Sarah BasfordAn Australian gamer has avoided a jail term after confessing to hitting his then-pregnant girlfriend during a Twitch stream of Fortnite.
Content warning: this story contains references to domestic assault.
Luke Munday, also known as MrDeadMoth on Twitch, was given a 14-month community corrections order in Picton Local Court after admitting he was guilty of the assault in July of this year, the ABC reports.
He was charged with a single count of common assault (domestic violence).
During the sentencing hearing, Munday's lawyer, Steven Mercael, argued the streamer acted in "excessive self-defence" and snapped.
"He's a loving, caring person with no history of domestic violence... who unfortunately on this day just slapped his partner," Mr Mercael said, later withdrawing the 'just' from his remarks after a caution from the judge.
During the stream in December 2018, channel viewers could reportedly hear Munday and his then-partner arguing. He is said to have been heard saying "fuck off dog, you don't pay the bills" before the assault occurred off-camera in front two children, one aged 3, the other 20 months.
In January this year, Munday briefly returned to Twitch after the streaming site suspended him. Days later, Twitch re-suspended him and while it wasn't confirmed whether this ban was permanent, his accounts on both Twitch and YouTube appear to remain unavailable at the time of writing.
If you or someone you know is suffering from domestic violence, you can contact the Domestic Violence Hotline at 1800 656 463 or the 1800Respect national sexual assault, domestic and family violence hotline.