Opening a modal with a message for the user
Description
Show a feedback message for the user in a new modal by calling a java or javascript api.
The modal has a title, one or more messages, a severity for each message:
Prerequisites
The HTML page must contain the following placeholder:

This is usually inserted in a common footer so that you don’t need to remember adding it to each page.
make a dialect tag for this
Java API
The modal can be opened after a standard or ajax HTTP request and can be shown on the browser after a normal HTTP response or after a redirect. The notification can also close itself after a timeout, reload the current page when the user dismisses it, or perform a redirect on dismiss. When used in an ajax request it has some optional functionality.
Notifications are handled by the YadaNotify @Component and therefore need this autowiring:
@Autowired private YadaNotify yadaNotify;
You can then add messages in your @RequestMapping methods with a syntax like the following:
yadaNotify.title("Login success", model).ok().message("You have been logged in").add();
The title() method is the first one to call because it starts the builder. It has many variations, some of which are used for localization (see the Javadoc). The message() method accepts HTML tags so you will need to escape all HTML reserved characters.
You can set the message severity using one of these methods:
- ok()
-
Normal severity
- info()
-
Can either be a warning or something that needs special attention from the user
- error()
-
Error message
All of them accept a boolean value so that the severity can be set conditionally. For example:
boolean failed=false;
yadaNotify.title("Login " + failed?"failed":"success", model).ok(!failed).error(failed).message("You have {}been logged in", failed?"not ":"").add();
The previous example shows the use of slf4j placeholders in the message() method.
When calling the add() method you’re actually creating a message with the values previously stored in the builder, adding it to the current HTTP Request. The add() method also terminates the builder chain and you can’t call further methods after it. If you want to return more than one message, you can use yadaNotify as many times as you want, even in different controllers:
yadaNotify.title("Login success", model).ok().message("You have been logged in").add();
yadaNotify.title("Forbidden", model).info().message("Access to the dashboard has been revoked").add();
The resulting modal shows a panel for each message, and a top icon corresponding to the highest severity found in those messages:
Normal request / normal response
In a normal request/response, just use the Model as seen above. You can then return the thymeleaf view as usual: just after showing the target view, the browser will open the modal.
@RequestMapping("/dashboard")
public String dashboard(Model model) {
yadaNotify.title("Login success", model).ok().message("You have been logged in").add();
return "/dashboard";
Normal request / redirect response
If you want to perform a redirect when exiting the controller, use RedirectAttributes instead of Model:
@RequestMapping("/dashboard")
public String dashboard(RedirectAttributes redirectAttributes) {
yadaNotify.title("Login success", redirectAttributes).ok().message("You have been logged in").add();
return "redirect:/console";
The browser will perform a redirect, call the server again, display the target view then show the modal. The server can test if a modal is pending with the following methods:
isNotificationPending(...)
isErrorSet(...)
Redirect on modal close
You can also activate a redirect when the modal is closed by the user with redirectOnClose()
.
This can happen both after a normal response and a redirect response. Be careful to use the appropriate
parameter to the title()
method: Model for a normal response and RedirectAttributes for a redirect response.
The first example will show the modal on the "/dashboardPage" and redirect to "/console" on close; the
second example will show the modal after a redirect to "/dashboard" and redirect again to "/console" on close:
@RequestMapping("/dashboard")
public String dashboard(Model model) {
yadaNotify.title("Login success", model).ok().message("You have been logged in").redirectOnClose("/console").add();
return "/dashboardPage";
@RequestMapping("/dashboard")
public String dashboard(RedirectAttributes redirectAttributes) {
yadaNotify.title("Login success", redirectAttributes).ok().message("You have been logged in").redirectOnClose("/console").add();
return "redirect:/dashboard";
Please note that the redirectOnClose()
url does not need to have the language prefix (when applicable), so "/console" is correct while "/en/console" is not.
Ajax request
Returning from the Controller
Ajax requests work roughly the same as normal requests. The notification will be shown only if the result contains the "/yada/modalNotify" modal. This can be done in one of the following alternative ways:
return "/yada/modalNotify";
return YadaViews.AJAX_NOTIFY;
return yadaNotify.title("Login success", model).ok().message("You have been logged in").add();
The first version should of course be avoided for future compatibility. The last version is very convenient when returning a message at the end of the @RequestMapping method.
Returning additional HTML
The problem with the above approach is that you might want to also return some other HTML, for example the original form with validation errors, or something to insert in the page. The solution is to add a conditional include of the modalNotify in your returned view. If the returned view is also used in normal requests, an ajax check can be used:

<div<EMAIL_ADDRESS>class="yadaResponseData"> (1)

| 1 | only add the notification modal in ajax requests (normal request might have it already embedded) |
| 2 | only add the notification modal if there is a message to show |
The yadaResponseData element is hidden by yada.css
.
Replace /yada/modalNotify with YadaViews.AJAX_NOTIFY in the yadaResponseData example above
Returning additional data
You might want to return, together with a notification, some key-value pairs for use in a javascript handler
defined with yada:successHandler
(see Postprocessing).
You can achieve this by placing a Map called "resultMap" in the Model:
Map<String, String> resultMap = new HashMap<>();
resultMap.put("deletedTaskId", taskId);
model.addAttribute("resultMap", resultMap);
The data can be retrieved in the javascript handler with yada.getEmbeddedResult
:
function editTaskHandler(responseText, responseHtml, form, button) {
var result = yada.getEmbeddedResult(responseHtml);
var taskId = result['deletedTaskId'];
$('#taskRow' + taskId).remove();
}
Redirect
To show a notification with a redirect when returning from an ajax call, the only option is to perform the redirect on modal close with Redirect on modal close.
What happens if the controller returns "redirect:/xxx" on an ajax call?
Other functionality
Vertically Center
If you’re using Bootstrap 4 you can vertically center the modal with the method center()
:
yadaNotify.title("Login success", model).ok().message("You have been logged in").center().add();
Generic modal classes
You can add any class to the "modal-dialog" div by setting the extraDialogClasses
Model attribute:
model.addAttribute("extraDialogClasses", "myclass1 myclass2");
return yadaNotify.title("Saved", model).ok().message("Item saved").add();
Clearing all previous messages, "Chiamare javascript arbitrario decidendo lato server", Autoclose, modalReloadOnClose,
Javascript API
The notification modal can also be opened in javascript:
yada.showOkModal(title, message, redirectUrl)
yada.showInfoModal(title, message, redirectUrl)
yada.showErrorModal(title, message, redirectUrl)
- title
-
the modal title
- message
-
the modal message
- redirectUrl
-
optional url to redirect when the modal is closed
Customization
Modal icons
Notification modals use a "severity icon" on the top left and a "close icon" on the top right.
These can be customized using the following CSS classes: yadaIcon
, yadaNotify
, yadaIcon-ok
, yadaIcon-warning
, yadaIcon-error
, close
, yadaIcon-close
.
The full list of provided icons can be found in /YadaWeb/src/main/resources/net/yadaframework/views/yada/css/yada.css
.
The current icons are implemented using Font Awesome 5 Free.
A different icon set can be easily used by setting the proper font family on yadaIcon and the right content on the other classes.
Example:
.yadaIcon {
font-family: 'Font Awesome 5 Free';
font-weight: 900;
}
.yadaIcon-ok:before {
content: "\f00c";
}
Full customization
The notification modal can either be customized via CSS or by implementing a new html file.
In the second case you should copy the original file from /YadaWeb/src/main/resources/net/yadaframework/views/yada/modalNotify.html
and
change it while preserving some key elements that are used as reference to add content.
explain what to preserve
The file should be placed somewhere in your views folder and its path added to the configuration with something like
<config>
<paths>
<notificationModalView>/myModalNotify</notificationModalView>
It should also be included in the footer in place of the original one


For the sake of justice, rights, and human innovation for all peoples, by all peoples.
We are a non-profit organization aiming for gender equality in society.
Our logo symbolizes equality.
The person in our logo is cut in half because the blue part represents the boys and the pink represents the girls.
One more reason why we made the person half boy and half girl is because we considered the people who are part of the LGBTQ community.
The balance scale symbolizes equality and the shield represents the protection of rights among boys, girls, and members of the LGBTQ community.
It promotes justice, equality, protection, and the responsibilities and rights of all.
Our role is to strengthen and support those in the LGBTQ community in hopes of equal treatment for all.
We wish to see a brighter future wherein, the gender pay gap is non-existent, equal treatment for all, gender stereotypes/generalization are abolished and a better overall environment for people of every gender.
We will continue working towards our goals and leap over every hurdle; we will strive for our ambitions until amends are made and all are equal.
Our mission as a team is to spread the information to as many people as we can through our organization
so that we may empower women in the economy and close gender gaps especially in the world of work.
Our mission is also to influence others, allowing them to gain the proper knowledge about Gender inequality, and avoid false information.
Our Vision as a team is to make the world a better place.
We aim to give people the right information about gender inequality and what they should do to prevent this issue.
Kamala Harris is the first woman (and the first Black and Asian American) to be elected vice president of the United States shows how the women community is slowly growing.
With that said, our vision is slowly coming true.
created with
Free WYSIWYG HTML Editor .


Docker frequently asked questions (FAQ)
読む時間の目安: 9 分Does Docker run on Linux, macOS, and Windows?
You can run both Linux and Windows programs and executables in Docker containers. The Docker platform runs natively on Linux (on x86-64, ARM and many other CPU architectures) and on Windows (x86-64).
Docker Inc. builds products that let you build and run containers on Linux, Windows and macOS.
What does Docker technology add to just plain LXC?
Docker technology is not a replacement for LXC. “LXC” refers to capabilities of the Linux kernel (specifically namespaces and control groups) which allow sandboxing processes from one another, and controlling their resource allocations. On top of this low-level foundation of kernel features, Docker offers a high-level tool with several powerful functionalities:
-
Portable deployment across machines. Docker defines a format for bundling an application and all its dependencies into a single object called a container. This container can be transferred to any Docker-enabled machine. The container can be executed there with the guarantee that the execution environment exposed to the application is the same in development, testing, and production. LXC implements process sandboxing, which is an important pre-requisite for portable deployment, but is not sufficient for portable deployment. If you sent me a copy of your application installed in a custom LXC configuration, it would almost certainly not run on my machine the way it does on yours. The app you sent me is tied to your machine’s specific configuration: networking, storage, logging, etc. Docker defines an abstraction for these machine-specific settings. The exact same Docker container can run - unchanged - on many different machines, with many different configurations.
-
Application-centric. Docker is optimized for the deployment of applications, as opposed to machines. This is reflected in its API, user interface, design philosophy and documentation. By contrast, the
lxc
helper scripts focus on containers as lightweight machines - basically servers that boot faster and need less RAM. We think there’s more to containers than just that. -
Automatic build. Docker includes a tool for developers to automatically assemble a container from their source code, with full control over application dependencies, build tools, packaging etc. They are free to use
make
,maven
,chef
,puppet
,salt,
Debian packages, RPMs, source tarballs, or any combination of the above, regardless of the configuration of the machines. -
Versioning. Docker includes git-like capabilities for tracking successive versions of a container, inspecting the diff between versions, committing new versions, rolling back etc. The history also includes how a container was assembled and by whom, so you get full traceability from the production server all the way back to the upstream developer. Docker also implements incremental uploads and downloads, similar to
git pull
, so new versions of a container can be transferred by only sending diffs. -
Component re-use. Any container can be used as a parent image to create more specialized components. This can be done manually or as part of an automated build. For example you can prepare the ideal Python environment, and use it as a base for 10 different applications. Your ideal PostgreSQL setup can be re-used for all your future projects. And so on.
-
Sharing. Docker has access to a public registry on Docker Hub where thousands of people have uploaded useful images: anything from Redis, CouchDB, PostgreSQL to IRC bouncers to Rails app servers to Hadoop to base images for various Linux distros. The registry also includes an official “standard library” of useful containers maintained by the Docker team. The registry itself is open-source, so anyone can deploy their own registry to store and transfer private containers, for internal server deployments for example.
-
Tool ecosystem. Docker defines an API for automating and customizing the creation and deployment of containers. There are a huge number of tools integrating with Docker to extend its capabilities. PaaS-like deployment (Dokku, Deis, Flynn), multi-node orchestration (Maestro, Salt, Mesos, Openstack Nova), management dashboards (docker-ui, Openstack Horizon, Shipyard), configuration management (Chef, Puppet), continuous integration (Jenkins, Strider, Travis), etc. Docker is rapidly establishing itself as the standard for container-based tooling.
What is different between a Docker container and a VM?
There’s a great StackOverflow answer showing the differences.
Do I lose my data when the container exits?
Not at all! Any data that your application writes to disk gets preserved in its container until you explicitly delete the container. The file system for the container persists even after the container halts.
How far do Docker containers scale?
Some of the largest server farms in the world today are based on containers. Large web deployments like Google and Twitter, and platform providers such as Heroku run on container technology, at a scale of hundreds of thousands or even millions of containers.
How do I connect Docker containers?
Currently the recommended way to connect containers is via the Docker network feature. You can see details of how to work with Docker networks.
How do I run more than one process in a Docker container?
This approach is discouraged for most use cases. For maximum efficiency and isolation, each container should address one specific area of concern. However, if you need to run multiple services within a single container, see Run multiple services in a container.
How do I report a security issue with Docker?
You can learn about the project’s security policy here and report security issues to this mailbox.
Why do I need to sign my commits to Docker with the DCO?
Read our blog post on the introduction of the DCO.
When building an image, should I prefer system libraries or bundled ones?
This is a summary of a discussion on the docker-dev mailing list.
Virtually all programs depend on third-party libraries. Most frequently, they use dynamic linking and some kind of package dependency, so that when multiple programs need the same library, it is installed only once.
Some programs, however, bundle their third-party libraries, because they rely on very specific versions of those libraries.
When creating a Docker image, is it better to use the bundled libraries, or should you build those programs so that they use the default system libraries instead?
The key point about system libraries is not about saving disk or memory space. It is about security. All major distributions handle security seriously, by having dedicated security teams, following up closely with published vulnerabilities, and disclosing advisories themselves. (Look at the Debian Security Information for an example of those procedures.) Upstream developers, however, do not always implement similar practices.
Before setting up a Docker image to compile a program from source, if you want to use bundled libraries, you should check if the upstream authors provide a convenient way to announce security vulnerabilities, and if they update their bundled libraries in a timely manner. If they don’t, you are exposing yourself (and the users of your image) to security vulnerabilities.
Likewise, before using packages built by others, you should check if the channels providing those packages implement similar security best practices. Downloading and installing an “all-in-one” .deb or .rpm sounds great at first, except if you have no way to figure out that it contains a copy of the OpenSSL library vulnerable to the Heartbleed bug.
Why is DEBIAN_FRONTEND=noninteractive
discouraged in Dockerfiles?
When building Docker images on Debian and Ubuntu you may have seen errors like:
unable to initialize frontend: Dialog
These errors don’t stop the image from being built but inform you that the installation process tried to open a dialog box, but couldn’t. Generally, these errors are safe to ignore.
Some people circumvent these errors by changing the DEBIAN_FRONTEND
environment variable inside the Dockerfile using:
ENV DEBIAN_FRONTEND=noninteractive
This prevents the installer from opening dialog boxes during installation which stops the errors.
While this may sound like a good idea, it may have side effects. The
DEBIAN_FRONTEND
environment variable is inherited by all images and
containers built from your image, effectively changing their behavior. People
using those images run into problems when installing software
interactively, because installers do not show any dialog boxes.
Because of this, and because setting DEBIAN_FRONTEND
to noninteractive
is
mainly a ‘cosmetic’ change, we discourage changing it.
If you really need to change its setting, make sure to change it back to its default value afterwards.
Why do I get Connection reset by peer
when making a request to a service running in a container?
Typically, this message is returned if the service is already bound to your localhost. As a result, requests coming to the container from outside are dropped. To correct this problem, change the service’s configuration on your localhost so that the service accepts requests from all IPs. If you aren’t sure how to do this, check the documentation for your OS.
Why do I get Cannot connect to the Docker daemon. Is the docker daemon running on this host?
when using docker-machine?
This error points out that the docker client cannot connect to the virtual
machine. This means that either the virtual machine that works underneath
docker-machine
is not running or that the client doesn’t correctly point at
it.
To verify that the docker machine is running you can use the docker-machine ls
command and start it with docker-machine start
if needed.
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
default - virtualbox Stopped Unknown
$ docker-machine start default
You need to tell Docker to talk to that machine. You can do this with the
docker-machine env
command. For example,
$ eval "$(docker-machine env default)"
$ docker ps
Where can I find more answers?
You can find more answers on:
- Docker community Slack channel
- Docker Support Forums
- GitHub
- Ask questions on Stackoverflow
- Join the conversation on Twitter


--- title: Image marginal histograms author: Jonathan Carroll date: 2016-03-12 00:37:37 slug: image-marginal-histograms categories: [R] tags: [rstats] type: '' subtitle: '' image: '' ---
Another day, another interesting challenge.
Another day, another interesting challenge.
I follow Bob Rudis’ (a.k.a. hrbrmstr’s) blog, typically via R-bloggers, and this post caught my eye. Partly because I thought I knew of an existing way to do this. As usual, actually getting that to work took a little longer than I might have hoped, but I think the end result is pretty neat.
His post describes the process of writing an R function to take an image file, for example this one
and producing a histogram along the sides of the number of pixels on a given row/column. This is what he created (a different image to the example, I believe)
Something funny is going on with the right-hand histogram; it doesn’t line up with the image.
Here’s my approach.
It leverages the png
package to extract the channels into a matrix, converts those to x,y,z data.frame
s, takes the median value, plots that with ggplot2
, then leverages ggExtra::ggMarginal
to add the marginal histograms. Note that the ggExtra
package has some bugs (it hasn’t been maintained in a while) in relation to more recent (possibly the dev branch) of ggplot2
. I got it working on at least one of my machines. This is my result
I’ve had several uses for these types of marginal plots lately, so hopefully I can sort out the issues I’ve been getting in combination with ggplot2
.


Cartesian to Polar Sketch
Wrap
Zoom
x-Bounds
to
f(x) =
x
Graph
Try some of these!
Generic Flower
Hyperbola
Cardioid
Artichoke
Butterfly (A)
Butterfly (Oscar)
Math Sketches
,
View on GitHub


call psb_cdcpy(desc_in, desc_out, info)
- Type:
- Asynchronous.
- On Entry
-
- desc_in
- the communication descriptor.
Scope:local.
Type:required.
Intent: in.
Specified as: a structured data of type descdatapsb_desc_type.
- On Return
-
- desc_out
- the communication descriptor copy.
Scope:local.
Type:required.
Intent: out.
Specified as: a structured data of type descdatapsb_desc_type.
- info
- Error code.
Scope: local
Type: required
Intent: out.
An integer value; 0 means no error has been detected.


This page contains the notes for the second part of R Workshop Module 2: R basics, which is part of the R Workshop series prepared by ICJIA Research Analyst Bobae Kang to enable and encourage ICJIA researchers to take advantage of R, a statistical programming language that is one of the most powerful modern research tools.
Click here to go to the workshop home page.
Click here to go to the workshop Modules page.
Click here to view the accompanying slides for Module 2, Part 2.
Navigate to the other workshop materials:
Now that we have an understanding of the basic building blocks of R programming, we can prepare for conducting data analysis in R. Here we start with learning to work with R data frame, the very essense of tabular data manipulation in R. We will then be introduced to the tidyverse
framework and the idea of “tidy” data. Finally, we will discuss some recommended coding styles for R.
## [1] "Look, a data frame!"
## column1 column2 column3 column4 column5
## 1 11 12 13 14 15
## 2 21 22 23 24 25
## 3 31 32 33 34 35
## 4 41 42 43 44 45
## 5 51 52 53 54 55
A data frame is a tabular representation of data where each column is a vector of some type. You can think of Excel spreadsheets, SPSS tables, etc.!
In R, a data frame exists as a data.frame
object, which can be seen as a list of vectors of the same length, but with additional functionalities for data analysis!
Accessing data in a data frame works similarly as in accessing data in a list. In fact, a list can be easily converted into a data frame using as.data.frame()
(and vice versa, with as.list()
).
I have created an R package called icjiar
, which comes with some sample datasets, including a data frame of ISP UCR data. Let’s take a look.
data.frame
obejctFirst we import icjiar
package to make ispcrime
dataset available in the global environment.
If you do not have icjiar
package installed on your computer yet, remove the hash symbol (#
) on the first two lines of the following code chunk and execute it to get the package installed. You will then be able to import the package using library()
function. See here for installing and loading packages.
# install.packages("devtools")
# devtools::install_github("bobaekang/icjiar")
library(icjiar)
class(ispcrime) # the class of ispcrime object is "data.frame"
## [1] "data.frame"
Using the class()
function, we find that ispcrime
is a data.frame
object. Alternatively, using the is.data.frame()
function, we can check that ispcrime
is indeed a data.frame
object.
is.data.frame(ispcrime) # check if ispcrime is a data.frame; TRUE, as expected
## [1] TRUE
Now, we take a look at the “structure” of ispcrime
. str()
is a function we use to bring out the sturcutre of an R object. In this case, str()
prints that our object is a data frame with 12 variables and shows each variable with its data type as well as first few elements.
str(ispcrime) # reports the "structure" of the data frame
## 'data.frame': 510 obs. of 12 variables:
## $ year : int 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011 ...
## $ county : Factor w/ 102 levels "Adams","Alexander",..: 1 2 3 4 5 6 7 8 9 10 ...
## $ violentCrime : int 218 119 6 59 7 42 13 8 12 1210 ...
## $ murder : int 0 0 1 0 0 0 0 0 0 5 ...
## $ rape : int 37 14 0 24 1 4 0 1 1 127 ...
## $ robbery : int 15 4 0 8 0 3 0 0 0 208 ...
## $ aggAssault : int 166 101 5 27 6 35 13 7 11 870 ...
## $ propertyCrime: int 1555 290 211 733 38 505 56<PHONE_NUMBER> ...
## $ burglary : int 272 92 58 152 14 90 14 38 41 1384 ...
## $ larcenyTft : int 1241 183 147 563 22 405 41 165 71 3756 ...
## $ MVTft : int 36 11 5 14 1 8 1 2 3 164 ...
## $ arson : int 6 4 1 4 1 2 0 1 4 28 ...
Another way of understanding a data frmae is to print the first few rows. This can be achieved using head()
, which prints out the first n
rows of the data frame. The default is n = 6
.
head(ispcrime, 5) # returns the first n rows of the data frame (default 6)
## year county violentCrime murder rape robbery aggAssault propertyCrime
## 1 2011 Adams 218 0 37 15 166 1555
## 2 2011 Alexander 119 0 14 4 101 290
## 3 2011 Bond 6 1 0 0 5 211
## 4 2011 Boone 59 0 24 8 27 733
## 5 2011 Brown 7 0 1 0 6 38
## burglary larcenyTft MVTft arson
## 1 272 1241 36 6
## 2 92 183 11 4
## 3 58 147 5 1
## 4 152 563 14 4
## 5 14 22 1 1
There are a few functions to inspect the shape of a data.frame
object. First, we can try dim()
to get the dimension (number of rows by number of columns) of a data.frame
object. nrow()
and ncol()
return the number of rows and the number of columns of a data.frame
object, respectively.
dim(ispcrime) # returns the dimension of the data frame (row column)
## [1] 510 12
nrow(ispcrime) # returns the number of rows in the data frame
## [1] 510
ncol(ispcrime) # returns the number of columns in the data frame
## [1] 12
Finally, we can use colnames()
to obtain a vector of a data.frame
object’s column names.
colnames(ispcrime) # returns a vector containing the column names
## [1] "year" "county" "violentCrime" "murder"
## [5] "rape" "robbery" "aggAssault" "propertyCrime"
## [9] "burglary" "larcenyTft" "MVTft" "arson"
Now we explore accessing desired subsets of a data.frame
object. We start with columns. The following are three different ways to get the first column of ispcrime
, which has the name year
:
ispcrime$year # access a column by name
ispcrime[[1]] # access the first column by index
ispcrime[, 1] # yet another way to access the first column!
## [1] 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011
## [15] 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011
## [29] 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011
## [43] 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011
## [57] 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011
## [71] 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011
## [85] 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011 2011
## [99] 2011 2011 2011 2011 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012
## [113] 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012
## [127] 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012
## [141] 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012
## [155] 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012
## [169] 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012
## [183] 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012
## [197] 2012 2012 2012 2012 2012 2012 2012 2012 2013 2013 2013 2013 2013 2013
## [211] 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013
## [225] 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013
## [239] 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013
## [253] 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013
## [267] 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013
## [281] 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013
## [295] 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 2014 2014
## [309] 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014
## [323] 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014
## [337] 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014
## [351] 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014
## [365] 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014
## [379] 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014
## [393] 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014
## [407] 2014 2014 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015
## [421] 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015
## [435] 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015
## [449] 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015
## [463] 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015
## [477] 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015
## [491] 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 2015
## [505] 2015 2015 2015 2015 2015 2015
Accessing select rows of a data.frame
is somewhat simpler:
ispcrime[1, ] # access the first row by index
## year county violentCrime murder rape robbery aggAssault propertyCrime
## 1 2011 Adams 218 0 37 15 166 1555
## burglary larcenyTft MVTft arson
## 1 272 1241 36 6
Combining these two, we can get to a particular cell in a data.frame
object.
# access a specific cell (first row of the first column)
ispcrime$year[1]
ispcrime[[1]][1]
ispcrime[1, 1]
## [1] 2011
Most often, we will be working with data.frame
objects that result from importing external datasets or come as part of imported packages. Sometimes, however, we need to create a data.frame
object. There are two main ways to do so:
data.frame()
: Here, we either use vector objects as argument inputs or simultanesouly create vectors and assign column names to them.as.data.frame()
: We can also convert an existing list
object into a data.frame
object.fruits <- c("apple", "banana", "clementine")
animals <- c("dogs", "cats", "llamas")
icecream_flavors <- c("chocolate", "vanila", "cookie dough")
df1 <- data.frame(fruits, animals, icecream_flavors)
print(df1)
## fruits animals icecream_flavors
## 1 apple dogs chocolate
## 2 banana cats vanila
## 3 clementine llamas cookie dough
df2 <- data.frame(
fruits = c("apple", "banana", "clementine"),
animals = c("dogs", "cats", "llamas"),
icecream_flavors = c("chocolate", "vanila", "cookie dough")
)
print(df2)
## fruits animals icecream_flavors
## 1 apple dogs chocolate
## 2 banana cats vanila
## 3 clementine llamas cookie dough
lt <- list(
fruits = c("apple", "banana", "clementine"),
animals = c("dogs", "cats", "llamas"),
icecream_flavors = c("chocolate", "vanila", "cookie dough")
)
df3 <- as.data.frame(lt)
print(df3)
## fruits animals icecream_flavors
## 1 apple dogs chocolate
## 2 banana cats vanila
## 3 clementine llamas cookie dough
data.frame
objectIt is common to find that the given data.frame
object is not exactly in the desired shape or form. Here we will take a quick look at the following four basic operations for transforming a data.frame
object:
colnames(df1) <- c("my_fruits", "my_animals", "my_flavors")
print(df1)
## my_fruits my_animals my_flavors
## 1 apple dogs chocolate
## 2 banana cats vanila
## 3 clementine llamas cookie dough
Adding new columns can be done in two ways. First, we can use one of the methods to access a column but with a slight twist: this time, we point to a non-existing column and assign a vector to it. Second, we can use the cbind()
function, which takes an existing data.frame
object and a vector as its arguments and returns a new data.frame
object now with an additional column.
# using $ index
df1$my_colors <- c("red", "green", "orange")
# using cbind() function
my_cities <- c("Chicago", "New Work", "Los Angeles")
df1 <- cbind(df1, my_cities)
print(df1)
## my_fruits my_animals my_flavors my_colors my_cities
## 1 apple dogs chocolate red Chicago
## 2 banana cats vanila green New Work
## 3 clementine llamas cookie dough orange Los Angeles
It must be noted that, in the example above, the length of both vectors for my_colors
and my_cities
had to match the number of columns in the existing data.frame
obejct, df1
. Otherwise, R will throw an error.
Also, when adding columns in the first way, we must be careful not to leave “holes” after existing columns. For example, if we try df1[, 10] <- c(1,2,3)
, R will throw an error because the df1
cannot have the tenth column without already having the ninth column.
Modifying existing columns is very similar to adding ones, except that we assign a new vector to overwrite an existing column. Also, note that we can use NA
to give a missing value to certian cells.
df1[["my_colors"]] <- c("maroon", "blue", "purple")
df1$my_cities <- c("Chicago", NA, "Paris")
df1
## my_fruits my_animals my_flavors my_colors my_cities
## 1 apple dogs chocolate maroon Chicago
## 2 banana cats vanila blue <NA>
## 3 clementine llamas cookie dough purple Paris
There are two major ways to remove columns. First, we can point to a specific column and assign NULL
to it. Alternatively, we can take a subset of the columns and reassign it to the object.
# assinging NULL
df1$my_colors <- NULL
df1
## my_fruits my_animals my_flavors my_cities
## 1 apple dogs chocolate Chicago
## 2 banana cats vanila <NA>
## 3 clementine llamas cookie dough Paris
# subsetting
df1 <- df1[, 1:3] # or c("my_fruits", "my_animals", "my_flavors")
df1
## my_fruits my_animals my_flavors
## 1 apple dogs chocolate
## 2 banana cats vanila
## 3 clementine llamas cookie dough
Compared to columns, working with rows of a data.frame
object is more limited.
Adding rows can be done by the rbind()
function, which works similarly to how the aforementioned cbind()
does.
new_row <- data.frame(
my_fruits = "strawberry",
my_animals = "monkeys",
my_flavors = "butter pecan"
)
df1 <- rbind(df1, new_row)
df1
## my_fruits my_animals my_flavors
## 1 apple dogs chocolate
## 2 banana cats vanila
## 3 clementine llamas cookie dough
## 4 strawberry monkeys butter pecan
An easy way to remove rows from a data.frame
object is taking a subset and reassigning that to the object.
# subsetting
df1 <- df1[1:3, ]
df1
## my_fruits my_animals my_flavors
## 1 apple dogs chocolate
## 2 banana cats vanila
## 3 clementine llamas cookie dough
Modifying individual sells is not much different. However, we must make sure that the new element we would like to give to a cell is of the same type as the existing column. It is noteworthy that, when we create a data.frame
, a character vector becomes a factor
type by default (this default behavior can be changed with the stringsAsFactors
argument of data,frame()
). Therefore, the following will fail.
# this doesn't work ... why?
df1$my_flavors[1] <- "mint chocolate chip"
## Warning in `[<-.factor`(`*tmp*`, 1, value = structure(c(NA, 3L, 2L), .Label
## = c("chocolate", : invalid factor level, NA generated
df1
## my_fruits my_animals my_flavors
## 1 apple dogs <NA>
## 2 banana cats vanila
## 3 clementine llamas cookie dough
# because the column is a factor and only
# new values of the existing levels can be added
df1$my_flavors
## [1] <NA> vanila cookie dough
## Levels: chocolate cookie dough vanila butter pecan
In such a case, we can first coerce the target column into a desired data type and then modify the cell.
# first we coerce the column into character class
df1$my_flavors <- as.character(df1$my_flavors)
# now works!
df1$my_flavors[1] <- "mint chocolate chip"
df1
## my_fruits my_animals my_flavors
## 1 apple dogs mint chocolate chip
## 2 banana cats vanila
## 3 clementine llamas cookie dough
You may encounter a similar issue when trying to give a numeric
type value to an integer
column. Make sure the data types match!
In practice, R’s original data.frame
is rarely used since better alternatives are available. There are two prominant alternatives:
tibble
data.table
It is noteworthy that both alternatives are in fact extensions of the original data.frame
. Consequently, either can be manipulated using methods for a data.frame objects.
tibble
## # A tibble: 5 x 5
## column1 column2 column3 column4 column5
## <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 11. 12. 13. 14. 15.
## 2 21. 22. 23. 24. 25.
## 3 31. 32. 33. 34. 35.
## 4 41. 42. 43. 44. 45.
## 5 51. 52. 53. 54. 55.
tibble
is a part of the tidyverse
framework (we’ll come back to this). A tibble
object follows easily understood tidyverse
syntax and has a refined print method, which can be seen as more informative and convenient. Coercing a data.frame object into a tibble
can be done with as_tibble()
from the tibble
package.
Please see here for more on tibble
.
data.table
## column1 column2 column3 column4 column5
## 1: 11 12 13 14 15
## 2: 21 22 23 24 25
## 3: 31 32 33 34 35
## 4: 41 42 43 44 45
## 5: 51 52 53 54 55
data.frame
objects are made available via the data.table
package. It is highly optimized for larger tables (e.g. >100K rows) and provides compact syntax for advanced slicing and dicing of tablular data. Coercing a data.frame
object into a data.table
can be done with as.data.table()
.
See here for more on data.table
.
Source: DataCamp
The capabilities of R are extended through user-created packages, which allow specialized statistical techniques, graphical devices, import/export capabilities, reporting tools […], etc. - “R (programming language)”, Wikipedia
To use an add-on package, we first have to install it using, for example, the install.packages()
function. Onces the package is installed, it can be imported to the global environment using library()
.
# first we should install the desired package
install.packages("some_package")
# then we import the package to use its functionalities
library(some_package)
There are in fact two ways to install new packages.
install.packages("package")
.install_github("author/package")
method, which will pull the most up-to-date version of the package as shown in its GitHub repository. The install_github()
function is available via the devtools
package.Also, check out “Install Packages” tutorial video by RStudio, Inc.
Source: tidyverse.org
tidyverse
is a set of packages that are based on a particular perspective on working with data in R. It is also one of the most popular styles of doing data analysis.
“The tidyverse framework” introduces the notion of tidy data. A dataset is tidy if:
- Each variable is in a column
- Each observation is a row
- Each value is a cell.
Source: Hadley Wickham, 2017, R for Data Science
Anything that does not follow the aforementioned principles of a tidy dataset can be thought untidy:
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
## year/county violentCrime/propertyCrime
## 1 2011/Adams 218/1555
## 2 2011/Alexander 119/290
## 3 2011/Bond 6/211
## 4 2011/Boone 59/733
## 5 2011/Brown 7/38
## 6 2011/Bureau 42/505
## index year county typeViolent valueViolent
## 1 1 2011 Adams murder 0
## 2 1 2011 Adams rape 37
## 3 1 2011 Adams robbery 15
## 4 1 2011 Adams aggAssault 166
## 5 2 2011 Alexander murder 0
## 6 2 2011 Alexander rape 14
## 7 2 2011 Alexander robbery 4
## 8 2 2011 Alexander aggAssault 101
## 9 3 2011 Bond murder 1
## 10 3 2011 Bond rape 0
ggplot2
for data visualizationdplyr
for data manipulationtidyr
for creating “tidy data”readr
for data import/exportpurrr
for loop operationstibble
for data representationSource: The New York Times
The goal [of the style guide] is to make our R code easier to read, share, and verify.
- Google’s R Style guide
The key benefits of following a style guide include:
Currently, there is no single style guide adopted by the R community as the standard. However, there are two style guides that are considered authoritative:
I recommand anyone who are picking up R to start with the tidyverse style guide, which is suggested by one of the most influential personalities in R community, Hadley Wickham, and most widely adopted.
You may consider adding extra rules only if they will help your team to better collaborate and maintain code. Even then, you should keep the changes to minimum so that code remains accessible to others, including future teammates and even your future self!
In the following, I will offer some key elements of the tidyvese style guide:
# Good
firearm_arr
fa_arr
# Bad
arrests_with_firearm_charges # too verbose
firearmArrests # violating underscore convention
FireArm_Arrests # mixing underscore with other way of naming
farr # not descriptive enough
x # not descriptive at all
# Good
count_arr <- function(x) { ... }
# Bad
num_arr <- function(x) { ... } # noun for a function
do_arr <- function(x) { ... } # not descriptive enough
count <- function(x) { ... } # too generic (common name)
if else repeat while function for
in next break # used in loops, conditions, functions
TRUE FALSE # logical values
NULL # undefined
Inf # infinity
NaN # Not a Number
NA # not available (missing)
NA_integer_ NA_real_
NA_complex_ NA_character_ # NA for atomic vector types
... # dot method for one function to pass arguments to another
+
, -
, <
, =
, etc.)
:
, ::
, and :::
(
, except when it is a function call# Good
greetings <- paste("Hello", "World!", sep = " ")
df[2, ]
x <- 1:10
base::Random() # calling a function with specifying the package
# Bad
greetings<-paste("Hello","world!",sep="")
df[ 2,]
x<- 1 : 10
base :: Random ()
# for aligning function arguments
some_function (
first_argument = value_1
another_argument = value_2
example = value_3
)
# for aligning variable assignments
numbers <- c(1, 2, 3)
roman_numerals <- c("I", "II", "III")
letters <- c("a", "b", "c")
# Good
if (x > 0) {
i = 0
while (i < 10) {
message("Wait, I'm in a loop")
i <- i + 1
}
message("x is positive.")
} else {
message("x is not positive")
}
# Bad
if (y > 0) {
j = 0
while (j < 10) {
message("Wait, I'm in a loop")
j <- j + 1
}
message("y is positive.")
} else {
message("y is not positive")
}
Finally, remember that the ultimate goal of adopting a particular coding style to facilitate your work.
Comments for intelligible code
#
symbol) for clarification


Your message:
×
Welcome to Chat Pilot!
Chat pilot lets you browse the Web together with other people.
Name
Create group
OR
join an existing group
Room Name Is gettng
youtube.com
4
Hide
Join
Description: Nothing to do on Sunday.
Current page title: You Tube Best vine videos of 2014 and other events...
Users: Billy Wonks, Anna Smith, dxzhg, usa_boy
Experts
google.com
2
Info
Join
Gaming
twitch.tv
1
Info
Join


Contact
Let's talk!
I'd love to discuss features, additions and implementation details for noUiSlider. If you have something to share, let me know.
The noUiSlider GitHub repository and the issue tracker are used to discuss feature requests and issues.
If you need more general help, you'll usually get you answer by posting a question on StackOverflow. I'll keep an eye on the questions there, as well.
Contact information
You'll find me on Twitter: @LeonGersen. Consider providing a jsFiddle or CodePen if you'd like to discuss code.
Tweet to @LeonGersenMore from me
Besides noUiSlider, I've written more on tech-related subjects, ranging from PHP to Embedded subjects. Give my blog a try if you are interested!


SMS Backup+ 1.2
Author: Jan Berkel, Christoph Studer (original author of SMS Backup)
Automatically backs up your SMS/MMS and call logs to Gmail or any other
IMAP server. Can also restore SMS after they have been backed up.
Information
Please visit the
SMS Backup+ github page for more information.
If you find this app useful consider flattering it:
Recent release history
- 1.2 Call log support (Felix Knecht)
- 1.1.5 French/russian translation, improved restoring, GH-65/66/69
- 1.1.4 Italian translation, Restore only starred messages
See changes
on github for the full changelog.
License
This application is released under the terms of the
Apache License, Version 2.0.
Thanks
Many thanks to:
-
Ben Dodson (Contacts 2.0 + MMS support)
-
dicer Call log backup code
-
Christoph Studer, the original author of SMS Backup
-
The k9mail project for IMAP code
-
The signpost project for OAuth support
-
iTweek and
ncrow for the status icons
- pad7 & stephenm00 for the extensive beta-testing
-
All translators: Chinese (bbs.goapk.com, Chen Ma),
Spanish (Roberto Elena Ormad), Polish (skolima), Italian (Gabriele Ravanetti), French (Christian Sorgi et al.),
Turkish (Harun Sahin)


Vertices and edges are the foundation of QGraph queries. All queries must contain at least one vertex. Queries with multiple vertices must form a connected graph.
To add new vertices to a query, enter vertex mode and use the mouse to position the new vertex.
In the Query Editor toolbar, click or press Ctrl-2 to choose the vertex tool and enter vertex mode. The Query Editor remains in vertex mode (all clicks in the Query Editor display area create a new vertex) until you change modes by choosing a different tool from the toolbar.
Click in the Query Editor display area. The Query Editor creates a new vertex.
[Optional] Provide a name for the new vertex. (Alternatively, you can continue using the default name provided by the Query Editor.)
In the Query Editor toolbar, click or press Ctrl-1 to choose the selection tool and enter selection mode.
Click the vertex to be re-named. The Query Editor displays the vertex’s properties in the element properties pane.
In the element properties pane, click the current (default) name for this vertex. Edit the name and press Tab or Return.
To add new edges to a query, enter edge mode and use the mouse to draw the new edge.
In the Query Editor toolbar, click or press Ctrl-3 to choose the edge tool and enter edge mode. The Query Editor remains in edge mode (clicks in the Query Editor display area create a new edge) until you change modes by choosing a different tool from the toolbar.
Drag the mouse from one vertex to another vertex. The Query Editor creates a directed edge from the starting vertex to the ending vertex.
[Optional] Provide a name for the new edge. (Alternatively, you can continue using the default name provided by the Query Editor.)
In the Query Editor toolbar, click or press Ctrl-1 to choose the selection tool and enter selection mode.
Click the edge to be re-named. The Query Editor displays the edge’s properties in the element properties pane.
In the element properties pane, click the current (default) name for this edge. Edit the name and press Tab or Return.
Edges may be directed or undirected. Directionality is an edge property and is set in the element properties pane.
To add an undirected edge:
Create a directed edge.
Click or press Ctrl-1 to choose the selection tool.
Click the edge to be modified
In the element properties pane, change the value of
Is Directed from true
to
false
.
Press Tab or Return.
To change edge direction:
Click or press Ctrl-1 to choose the selection tool.
Click the edge to be modified.
In the Edit menu, choose Flip Edge Direction or press Ctrl-F.
A self-link edge connects a single vertex to itself and matches links in the database that connect an object to itself.
To add a self-link (loop) edge:
Click to choose the edge tool.
Click the target vertex without dragging. The Query Editor creates an edge that begins and ends at the target vertex (a self-link or loop edge).
Use selection mode to re-position query elements in the display and to select existing query elements for editing, such as adding or modifying conditions and annotations on that element.
In the Query Editor toolbar, click or press Ctrl-1 to choose the selection tool and enter selection mode.
Click the query element you want to select. The Query Editor draws handles around the selected element.
The Query Editor remains in selection mode (clicks in the Query Editor display select query elements) until you change modes by choosing a different tool from the toolbar.
Deleting a vertex also deletes any edges linked to that vertex. Make sure that your query remains connected after deleting any elements.
Click or press Ctrl-1 to choose the selection tool.
Click the element to be deleted.
Press Delete.
Conditions and annotations are properties of a specific vertex or edge. Select the element to be modified and use the element properties pane to add or edit any conditions or annotations on that element.
Complex conditions must be entered using disjunctive normal form in prefix notation. See “Complex conditions in Proximity” for additional information on entering complex conditions in the Query Editor.
Click or press Ctrl-1 to choose the selection tool.
Click the vertex or edge that requires a condition.
In the element properties pane, click in the Value column for Condition.
Enter the new condition or edit the value of the current condition.
Press Tab or Return.
All edges adjacent to an annotated vertex must also be
annotated.
To help avoid validation
errors
due to unannotated edges,
you can elect to automatically add a [1..]
annotation to any new edge (see To change automatic annotation preferences,
below, for instructions).
Click to choose the selection tool and select the vertex or edge to be annotated.
In the element properties pane, click in the value column for Annotation.
Enter the annotation text.
Press Tab or Return.
The Query Editor provides the option of automatically annotating
every new edge with [1..]
. Because edges
adjacent to annotated vertices must be annotated, adding this
annotation automatically can help to prevent validation errors. The
[1..]
annotation is the most common edge
annotation and is typically the correct edge annotation for most
queries involving annotated vertices. Adding a
[1..]
annotation to edges that are not adjacent to
annotated vertices is rarely a problem for most datasets, although
care should be taken to understand how this differs from unannotated
edges when the dataset contains instances of multiple links connecting
two objects.
In the Edit menu, choose Add [1..] To New Edges.
Selecting the Add [1..] To New Edges command toggles the automatic edge annotation behavior:
If automatic edge annotation is disabled, choosing this command turns on automatic edge annotation.
If automatic edge annotation is enabled, choosing this command turns off automatic edge annotation.


List of users
Home
Create a new user
Id
UserId
Firstname
Lastname
Actions
1
em
Erwin
Mustermann
Show
Update
Delete
2
jd
Jim
Deen
Show
Update
Delete
3
fh
Frodo
Hobbit
Show
Update
Delete
← First
«
1
2
3
»
Last →


Input/Output
Detect optimal optima and minima.
- param X
Data such as stock prices in a 1D vector.
- type X
array-like : 1D array.
- param verbose
0: None, 1: ERROR, 2: WARN, 3: INFO (default), 4: DEBUG, 5 : TRACE
- type verbose
Int, [0..5]. The higher the number, the more information is printed.
- raises Exception
1D array should be of type 1D numpy array or list.
- returns
Object.
X (array-like : 1D array.) – Input 1D vector.
simmat (np.array) – Simmilarity matrix
loc_start (list of int) – list of indexes containing start positions
loc_stop (list of int) – list of indexes containing stop positions
loc_start_best (list of int) – list of indexes containing the best starting positions
loc_stop_best (list of int) – list of indexes containing the best stopping positions
agg (1D array-like) – Aggregated 1D array
df (pd.DataFrame) – Results in the form of a dataframe.
verbose (Int, [0..5]. Default : 3) – The higher the number, the more information is printed. 0: None, 1: ERROR, 2: WARN, 3: INFO, 4: DEBUG, 5 : TRACE
Plot
Plot results.
- param threshold
Required to optimize for the maximum depth of the local-minima. At the ith location, k windows (eg 50) are overlaid and the percentages are determined.
- type threshold
float [0,..,1], default : 0.25
- param figsize
Figure size. The default is (25,15).
- type figsize
tuple, optional
- rtype
None.
Gridsearch
Gridsearch to find best fit.
- param X
Input 1D vector.
- type X
array-like : 1D array.
- param verbose
The higher the number, the more information is printed. 0: None, 1: ERROR, 2: WARN, 3: INFO, 4: DEBUG, 5 : TRACE
- type verbose
Int, [0..5]. Default : 3
- returns
Object containing dict with key [‘gridsearch’] such as cs.gridsearch
balances (np-array) – results of balances across various levels of: window x minperc
trades (np-array) – results of trades across various levels of: window x minperc


Using astropy.vo.client
¶
This subpackage contains modules supporting VO client-side operations.
Catalog Manipulation¶
You can manipulate a VO catalog using
VOSCatalog
, which is basically a dictionary
with added functionalities.
Examples¶
>>> from astropy.vo.client.vos_catalog import VOSCatalog
You can create a VO catalog from scratch with your own VO service by providing its title and access URL, and optionally any other metadata as key-value pairs:
>>> my_cat = VOSCatalog.create(
... 'My Own', 'http://ex.org/cgi-bin/cs.pl?',
... description='My first VO service.', creator='J. Doe', year=2013)
>>> print(my_cat)
title: My Own
url: http://ex.org/cgi-bin/cs.pl?
>>> print(my_cat.dumps())
{
"creator": "J. Doe",
"description": "My first VO service.",
"title": "My Own",
"url": "http://ex.org/cgi-bin/cs.pl?",
"year": 2013
}
You can modify and add fields:
>>> my_cat['year'] = 2014
>>> my_cat['new_field'] = 'Hello world'
>>> print(my_cat.dumps())
{
"creator": "J. Doe",
"description": "My first VO service.",
"new_field": "Hello world",
"title": "My Own",
"url": "http://ex.org/cgi-bin/cs.pl?",
"year": 2014
}
In addition, you can also delete an existing field, except the compulsory title and access URL:
>>> my_cat.delete_attribute('description')
>>> print(my_cat.dumps())
{
"creator": "J. Doe",
"new_field": "Hello world",
"title": "My Own",
"url": "http://ex.org/cgi-bin/cs.pl?",
"year": 2014
}
Database Manipulation¶
You can manipulate VO database using
VOSDatabase
, which is basically a nested
dictionary with added functionalities.
Examples¶
>>> from astropy.vo.client.vos_catalog import VOSDatabase
You can choose to start with an empty database:
>>> my_db = VOSDatabase.create_empty()
>>> print(my_db.dumps())
{
"__version__": 1,
"catalogs": {}
}
Add the custom catalog from VO catalog examples to database:
>>> my_db.add_catalog('My Catalog 1', my_cat)
>>> print(my_db)
My Catalog 1
>>> print(my_db.dumps())
{
"__version__": 1,
"catalogs": {
"My Catalog 1": {
"creator": "J. Doe",
"new_field": "Hello world",
"title": "My Own",
"url": "http://ex.org/cgi-bin/cs.pl?",
"year": 2014
}
}
}
You can write/read the new database to/from a JSON file:
>>> my_db.to_json('my_vo_database.json', clobber=True)
>>> my_db = VOSDatabase.from_json('my_vo_database.json')
You can also load a database from a VO registry. The process is described in
Building the Database from Registry, except that here, validation is not done,
so validate_xxx
keys are not added. This might generate a lot of warnings,
especially if the registry has duplicate entries of similar services, so
here, we silently ignore all the warnings:
>>> import warnings
>>> from astropy.vo.validator.validate import CS_MSTR_LIST
>>> with warnings.catch_warnings():
... warnings.simplefilter('ignore')
... registry_db = VOSDatabase.from_registry(
... CS_MSTR_LIST(), encoding='binary', cache=False)
Downloading http://vao.stsci.edu/directory/NVORegInt.asmx/...
|===========================================| 25M/ 25M (100.00%) 00s
>>> len(registry_db)
11937
Find catalog names containing 'usno*a2'
in the registry database:
>>> usno_a2_list = registry_db.list_catalogs(pattern='usno*a2')
>>> usno_a2_list
[u'ROSAT All-Sky Survey Bright Source Catalog USNO A2 Cross-Associations 1',
u'The USNO-A2.0 Catalogue (Monet+ 1998) 1',
u'USNO-A2 Catalogue 1',
u'USNO-A2.0 1',
u'USNO-SA2.0 1']
Find access URLs containing 'stsci'
in the registry database:
>>> stsci_urls = registry_db.list_catalogs_by_url(pattern='stsci')
>>> stsci_urls
['http://archive.stsci.edu/befs/search.php?',
'http://archive.stsci.edu/copernicus/search.php?', ...,
'http://galex.stsci.edu/gxWS/ConeSearch/gxConeSearch.aspx?',
'http://gsss.stsci.edu/webservices/vo/ConeSearch.aspx?CAT=GSC23&']
Extract a catalog titled 'USNO-A2 Catalogue 1'
from the registry:
>>> usno_a2 = registry_db.get_catalog('USNO-A2 Catalogue 1')
>>> print(usno_a2)
title: USNO-A2 Catalogue
url: http://www.nofs.navy.mil/cgi-bin/vo_cone.cgi?CAT=USNO-A2&
Extract a catalog by known access URL from the registry (the iterator version
of this functionality is
get_catalogs_by_url()
,
which is useful in the case of multiple entries with same access URL):
>>> gsc = registry_db.get_catalog_by_url(
... 'http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/305/out&')
>>> print(gsc)
title: The Guide Star Catalog, Version 2.3.2 (GSC2.3) (STScI, 2006)
url: http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/305/out&
Add all 'usno*a2'
catalogs from registry to your database:
>>> for name, cat in registry_db.get_catalogs():
... if name in usno_a2_list:
... my_db.add_catalog(name, cat)
>>> my_db.list_catalogs()
[u'My Catalog 1',
u'ROSAT All-Sky Survey Bright Source Catalog USNO A2 Cross-Associations 1',
u'The USNO-A2.0 Catalogue (Monet+ 1998) 1',
u'USNO-A2 Catalogue 1',
u'USNO-A2.0 1',
u'USNO-SA2.0 1']
You can delete a catalog from the database either by name or access URL:
>>> my_db.delete_catalog('USNO-SA2.0 1')
>>> my_db.delete_catalog_by_url(
... 'http://www.nofs.navy.mil/cgi-bin/vo_cone.cgi?CAT=USNO-A2&')
>>> my_db.list_catalogs()
[u'My Catalog 1',
u'ROSAT All-Sky Survey Bright Source Catalog USNO A2 Cross-Associations 1',
u'The USNO-A2.0 Catalogue (Monet+ 1998) 1',
u'USNO-A2.0 1']
You can also merge two database together. In this example, the second database contains a simple catalog that only has given name and access URL:
>>> other_db = VOSDatabase.create_empty()
>>> other_db.add_catalog_by_url(
... 'My Guide Star Catalogue',
... 'http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/305/out&')
>>> print(other_db.dumps())
{
"__version__": 1,
"catalogs": {
"My Guide Star Catalogue": {
"title": "My Guide Star Catalogue",
"url": "http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/305/out&"
}
}
}
>>> merged_db = my_db.merge(other_db)
>>> merged_db.list_catalogs()
[u'My Catalog 1',
u'My Guide Star Catalogue',
u'ROSAT All-Sky Survey Bright Source Catalog USNO A2 Cross-Associations 1',
u'The USNO-A2.0 Catalogue (Monet+ 1998) 1',
u'USNO-A2.0 1']
General VO Services Access¶
astropy.vo.client.vos_catalog
also contains common utilities for accessing
simple VO services already validated by STScI (see
Validation for Simple Cone Search).
Configurable Items¶
These parameters are set via Configuration system (astropy.config):
astropy.io.votable.Conf.pedantic
Set strictness of VO table parser (False
is recommended).astropy.utils.data.Conf.remote_timeout
Timeout for remote service access.astropy.vo.Conf.vos_baseurl
URL (or path) where VO Service database is stored.
Examples¶
>>> from astropy.vo.client import vos_catalog
Get all catalogs from a database named 'conesearch_good'
(this contains
cone search services that cleanly passed daily validations;
also see Cone Search Examples):
>>> my_db = vos_catalog.get_remote_catalog_db('conesearch_good')
Downloading http://stsdas.stsci.edu/astrolib/vo_databases/conesearch_good.json
|============================================| 56/ 56k (100.00%) 00s
>>> print(my_db)
Guide Star Catalog 2.3 1
SDSS DR7 - Sloan Digital Sky Survey Data Release 7 1
SDSS DR7 - Sloan Digital Sky Survey Data Release 7 2
# ...
USNO-A2 Catalogue 1
USNO-A2.0 1
If you get timeout error, you need to use a custom timeout as follows:
>>> from astropy.utils import data
>>> with data.conf.set_temp('remote_timeout', 30):
... my_db = vos_catalog.get_remote_catalog_db('conesearch_good')
To see validation warnings generated by Validation for Simple Cone Search for the one of the catalogs above:
>>> my_cat = my_db.get_catalog('Guide Star Catalog 2.3 1')
>>> for w in my_cat['validate_warnings']:
... print(w)
/.../vo.xml:136:0: W50: Invalid unit string 'pixel'
/.../vo.xml:155:0: W48: Unknown attribute 'nrows' on TABLEDATA
By default, pedantic is False
:
>>> from astropy.io.votable import conf
>>> conf.pedantic
False
To call a given VO service; In this case, a Cone Search (also see Cone Search Examples):
>>> from astropy import coordinates as coord
>>> from astropy import units as u
>>> c = coord.SkyCoord.from_name('47 Tuc')
>>> c
<SkyCoord (ICRS): ra=6.0223292 deg, dec=-72.0814444 deg>
>>> sr = 0.5 * u.degree
>>> sr
<Quantity 0.5 deg>
>>> result = vos_catalog.call_vo_service(
... 'conesearch_good',
... kwargs={'RA': c.ra.degree, 'DEC': c.dec.degree, 'SR': sr.value},
... catalog_db='The PMM USNO-A1.0 Catalogue (Monet 1997) 1')
Trying http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/243/out&
Downloading ...
WARNING: W22: ... The DEFINITIONS element is deprecated in VOTable 1.1...
WARNING: W03: ... Implictly generating an ID from a name 'RA(ICRS)'...
WARNING: W03: ... Implictly generating an ID from a name 'DE(ICRS)'...
>>> result
<Table rows=36184 names=('_r','_RAJ2000','_DEJ2000', ...>
To repeat the above and suppress all the screen outputs (not recommended):
>>> import warnings
>>> with warnings.catch_warnings():
... warnings.simplefilter('ignore')
... result = vos_catalog.call_vo_service(
... 'conesearch_good',
... kwargs={'RA': c.ra.degree, 'DEC': c.dec.degree, 'SR': sr.value},
... catalog_db='The PMM USNO-A1.0 Catalogue (Monet 1997) 1',
... verbose=False)
You can also use custom VO database, say, 'my_vo_database.json'
from
VO database examples:
>>> import os
>>> from astropy.vo.client.vos_catalog import BASEURL
>>> with BASEURL.set_temp(os.curdir):
... try:
... result = vos_catalog.call_vo_service(
... 'my_vo_database',
... kwargs={'RA': c.ra.degree, 'DEC': c.dec.degree,
... 'SR': sr.value})
... except Exception as e:
... print(e)
Trying http://ex.org/cgi-bin/cs.pl?
Downloading http://ex.org/cgi-bin/cs.pl?SR=0.5&DEC=-72.0814444&RA=6.0223292
|===========================================| 1.8k/1.8k (100.00%) 00s
None of the available catalogs returned valid results.
Simple Cone Search¶
astropy.vo.client.conesearch
supports VO Simple Cone Search capabilities.
Available databases are generated on the server-side hosted by STScI
using Validation for Simple Cone Search. The database used is
controlled by astropy.vo.Conf.conesearch_dbname
, which can be
changed in Configurable Items below. Here are the available
options:
'conesearch_good'
Default. Passed validation without critical warnings and exceptions.
'conesearch_warn'
Has critical warnings but no exceptions. Use at your own risk.
'conesearch_exception'
Has some exceptions. Never use this.
'conesearch_error'
Has network connection error. Never use this.
In the default setting, it searches the good Cone Search services one by one, stops at the first one that gives non-zero match(es), and returns the result. Since the list of services are extracted from a Python dictionary, the search order might differ from call to call.
There are also functions, both synchronously and asynchronously, available to return all the Cone Search query results. However, this is not recommended unless one knows what one is getting into, as it could potentially take up significant run time and computing resources.
Examples below show how to use non-default search behaviors, where the user has more control of which catalog(s) to search, et cetera.
Note
Most services currently fail to parse when pedantic=True
.
Warning
When Cone Search returns warnings, you should decide
whether the results are reliable by inspecting the
warning codes in astropy.io.votable.exceptions
.
Configurable Items¶
These parameters are set via Configuration system (astropy.config):
astropy.vo.Conf.conesearch_dbname
Cone Search database name to query.
Also depends on General VO Services Access Configurable Items.
Examples¶
>>> from astropy.vo.client import conesearch
Shows a sorted list of Cone Search services to be searched:
>>> conesearch.list_catalogs()
[u'Guide Star Catalog 2.3 1',
u'SDSS DR7 - Sloan Digital Sky Survey Data Release 7 1',
u'SDSS DR7 - Sloan Digital Sky Survey Data Release 7 2',
u'SDSS DR7 - Sloan Digital Sky Survey Data Release 7 3',
u'SDSS DR7 - Sloan Digital Sky Survey Data Release 7 4',
u'SDSS DR8 - Sloan Digital Sky Survey Data Release 8 1',
u'SDSS DR8 - Sloan Digital Sky Survey Data Release 8 2',
u'The HST Guide Star Catalog, Version 1.1 (Lasker+ 1992) 1',
u'The HST Guide Star Catalog, Version 1.2 (Lasker+ 1996) 1',
u'The HST Guide Star Catalog, Version GSC-ACT (Lasker+ 1996-99) 1',
u'The PMM USNO-A1.0 Catalogue (Monet 1997) 1',
u'The USNO-A2.0 Catalogue (Monet+ 1998) 1',
u'Two Micron All Sky Survey (2MASS) 1',
u'Two Micron All Sky Survey (2MASS) 2',
u'USNO-A2 Catalogue 1',
u'USNO-A2.0 1']
To inspect them in detail, do the following and then refer to the examples in Database Manipulation:
>>> from astropy.vo.client import vos_catalog
>>> good_db = vos_catalog.get_remote_catalog_db('conesearch_good')
Select a catalog to search:
>>> my_catname = 'The PMM USNO-A1.0 Catalogue (Monet 1997) 1'
By default, pedantic is False
:
>>> from astropy.io.votable import conf
>>> conf.pedantic
False
Perform Cone Search in the selected catalog above for 0.5 degree radius
around 47 Tucanae with minimum verbosity, if supported.
The catalog_db
keyword gives control over which catalog(s) to use.
If running this for the first time, a copy of the catalogs database will be
downloaded to local cache. To run this again without
using cached data, set cache=False
:
>>> from astropy import coordinates as coord
>>> from astropy import units as u
>>> c = coord.SkyCoord.from_name('47 Tuc')
>>> c
<SkyCoord (ICRS): ra=6.0223292 deg, dec=-72.0814444 deg>
>>> sr = 0.5 * u.degree
>>> sr
<Quantity 0.5 deg>
>>> result = conesearch.conesearch(c, sr, catalog_db=my_catname)
Trying http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/243/out&
Downloading ...
WARNING: W22: ... The DEFINITIONS element is deprecated in VOTable 1.1...
To run the command above using custom timeout of 30 seconds for each Cone Search service query:
>>> from astropy.utils import data
>>> with data.conf.set_temp('remote_timeout', 30):
... result = conesearch.conesearch(c, sr, catalog_db=my_catname)
To suppress all the screen outputs (not recommended):
>>> import warnings
>>> with warnings.catch_warnings():
... warnings.simplefilter('ignore')
... result = conesearch.conesearch(c, sr, catalog_db=my_catname,
... verbose=False)
Extract Numpy array containing the matched objects. See
numpy
for available operations:
>>> cone_arr = result.array.data
>>> cone_arr
array([(0.499298, 4.403473, -72.124045, '0150-00088188'),
(0.499075, 4.403906, -72.122762, '0150-00088198'),
(0.499528, 4.404531, -72.045198, '0150-00088210'), ...,
(0.4988, 7.641731, -72.113156, '0150-00225965'),
(0.499554, 7.645489, -72.103167, '0150-00226134'),
(0.499917, 7.6474, -72.0876, '0150-00226223')],
dtype=[('_r', '<f8'), ('_RAJ2000', '<f8'), ('_DEJ2000', '<f8'),
('USNO-A1.0', '|S13')])
>>> cone_arr.dtype.names
('_r', '_RAJ2000', '_DEJ2000', 'USNO-A1.0')
>>> cone_arr.size
36184
>>> ra_list = cone_arr['_RAJ2000']
>>> ra_list
array([ 4.403473, 4.403906, 4.404531, ..., 7.641731, 7.645489, 7.6474 ])
>>> cone_arr[0] # First row
(0.499298, 4.403473, -72.124045, '0150-00088188')
>>> cone_arr[-1] # Last row
(0.499917, 7.6474, -72.0876, '0150-00226223')
>>> cone_arr[:10] # First 10 rows
array([(0.499298, 4.403473, -72.124045, '0150-00088188'),
(0.499075, 4.403906, -72.122762, '0150-00088198'),
(0.499528, 4.404531, -72.045198, '0150-00088210'),
(0.497252, 4.406078, -72.095045, '0150-00088245'),
(0.499739, 4.406462, -72.139545, '0150-00088254'),
(0.496312, 4.410623, -72.110492, '0150-00088372'),
(0.49473, 4.415053, -72.071217, '0150-00088494'),
(0.494171, 4.415939, -72.087512, '0150-00088517'),
(0.493722, 4.417678, -72.0972, '0150-00088572'),
(0.495147, 4.418262, -72.047142, '0150-00088595')],
dtype=[('_r', '<f8'), ('_RAJ2000', '<f8'), ('_DEJ2000', '<f8'),
('USNO-A1.0', '|S13')])
Sort the matched objects by angular separation in ascending order:
>>> import numpy as np
>>> sep = cone_arr['_r']
>>> i_sorted = np.argsort(sep)
>>> cone_arr[i_sorted]
array([(0.081971, 5.917787, -72.006075, '0150-00145335'),
(0.083181, 6.020339, -72.164623, '0150-00149799'),
(0.089166, 5.732798, -72.077698, '0150-00137181'), ...,
(0.499981, 7.024962, -72.477503, '0150-00198745'),
(0.499987, 6.423773, -71.597364, '0150-00168596'),
(0.499989, 6.899589, -72.5043, '0150-00192872')],
dtype=[('_r', '<f8'), ('_RAJ2000', '<f8'), ('_DEJ2000', '<f8'),
('USNO-A1.0', '|S13')])
Result can also be manipulated as VOTable XML handling (astropy.io.votable) and its unit can be manipulated as Units and Quantities (astropy.units). In this example, we convert RA values from degree to arcsec:
>>> from astropy import units as u
>>> ra_field = result.get_field_by_id('_RAJ2000')
>>> ra_field.title
u'Right ascension (FK5, Equinox=J2000.0) (computed by VizieR, ...)'
>>> ra_field.unit
Unit("deg")
>>> ra_field.unit.to(u.arcsec) * ra_list
array([ 15852.5028, 15854.0616, 15856.3116, ..., 27510.2316,
27523.7604, 27530.64 ])
Perform the same Cone Search as above but asynchronously using
AsyncConeSearch
. Queries to
individual Cone Search services are still governed by
astropy.utils.data.Conf.remote_timeout
. Cone Search is forced to run
in silent mode asynchronously, but warnings are still controlled by
warnings
:
>>> async_search = conesearch.AsyncConeSearch(c, sr, catalog_db=my_catname)
Check asynchronous search status:
>>> async_search.running()
True
>>> async_search.done()
False
Get search results after a 30-second wait (not to be confused with
astropy.utils.data.Conf.remote_timeout
that governs individual Cone
Search queries). If search is still not done after 30 seconds,
TimeoutError
is raised. Otherwise, Cone Search result is returned
and can be manipulated as above. If no timeout
keyword given, it
waits until completion:
>>> async_result = async_search.get(timeout=30)
>>> cone_arr = async_result.array.data
>>> cone_arr.size
36184
Estimate the execution time and the number of objects for
the Cone Search service URL from above. The prediction naively
assumes a linear model, which might not be accurate for some cases.
It also uses the normal conesearch()
,
not the asynchronous version. This example uses a custom
timeout of 30 seconds and runs silently (except for warnings):
>>> result.url
u'http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/243/out&'
>>> with data.conf.set_temp('remote_timeout', 30):
... t_est, n_est = conesearch.predict_search(
... result.url, c, sr, verbose=False, plot=True)
WARNING: W22: ... The DEFINITIONS element is deprecated in VOTable 1.1...
# ...
>>> t_est # Predicted execution time
10.757875269998323
>>> n_est # Predicted number of objects
37340
For debugging purpose, one can obtain the actual execution time
and number of objects, and compare them with the predicted values
above. The INFO message shown in controlled by astropy.logger
.
Keep in mind that running this for every prediction
would defeat the purpose of the prediction itself:
>>> t_real, tab = conesearch.conesearch_timer(
... c, sr, catalog_db=result.url, verbose=False)
INFO: conesearch_timer took 11.5103080273 s on AVERAGE for 1 call(s). [...]
>>> t_real # Actual execution time
9.33926796913147
>>> tab.array.size # Actual number of objects
36184
One can also search in a list of catalogs instead of a single one.
In this example, we look for all catalogs containing 'guide*star'
in their
titles and only perform Cone Search using those services.
The first catalog in the list to successfully return non-zero result is used.
Therefore, the order of catalog names given in catalog_db
is important:
>>> gsc_cats = conesearch.list_catalogs(pattern='guide*star')
>>> gsc_cats
[u'Guide Star Catalog 2.3 1',
u'The HST Guide Star Catalog, Version 1.1 (Lasker+ 1992) 1',
u'The HST Guide Star Catalog, Version 1.2 (Lasker+ 1996) 1',
u'The HST Guide Star Catalog, Version GSC-ACT (Lasker+ 1996-99) 1']
>>> gsc_result = conesearch.conesearch(c, sr, catalog_db=gsc_cats)
Trying http://gsss.stsci.edu/webservices/vo/ConeSearch.aspx?CAT=GSC23&
WARNING: W50: ... Invalid unit string 'pixel' [...]
WARNING: W48: ... Unknown attribute 'nrows' on TABLEDATA [...]
>>> gsc_result.array.size
74276
>>> gsc_result.url
u'http://gsss.stsci.edu/webservices/vo/ConeSearch.aspx?CAT=GSC23&'
To repeat the Cone Search above with the services listed in a different order:
>>> gsc_cats_reordered = [gsc_cats[i] for i in (3, 1, 2, 0)]
>>> gsc_cats_reordered
[u'The HST Guide Star Catalog, Version GSC-ACT (Lasker+ 1996-99) 1',
u'The HST Guide Star Catalog, Version 1.1 (Lasker+ 1992) 1',
u'The HST Guide Star Catalog, Version 1.2 (Lasker+ 1996) 1',
u'Guide Star Catalog 2.3 1']
>>> gsc_result = conesearch.conesearch(c, sr, catalog_db=gsc_cats_reordered)
Trying http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/255/out&
Downloading ...
WARNING: W22: ... The DEFINITIONS element is deprecated in VOTable 1.1...
>>> gsc_result.array.size
2997
>>> gsc_result.url
u'http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/255/out&'
To obtain results from all the services above:
>>> all_gsc_results = conesearch.search_all(c, sr, catalog_db=gsc_cats)
Trying http://gsss.stsci.edu/webservices/vo/ConeSearch.aspx?CAT=GSC23&
Downloading ...
Trying http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/220/out&
Downloading ...
WARNING: W22: ... The DEFINITIONS element is deprecated in VOTable 1.1...
Trying http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/254/out&
Downloading ...
WARNING: W22: ... The DEFINITIONS element is deprecated in VOTable 1.1...
Trying http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/255/out&
Downloading ...
>>> len(all_gsc_results)
4
>>> for url, tab in all_gsc_results.items():
... print('{0} has {1} results'.format(url, tab.array.size))
http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/254/out& has 2998 results
http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/255/out& has 2997 results
http://gsss.stsci.edu/webservices/vo/ConeSearch.aspx?CAT=GSC23& has 74276 results
http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/220/out& has 2997 results
To repeat the above asynchronously:
>>> async_search_all = conesearch.AsyncSearchAll(c, sr, catalog_db=gsc_cats)
>>> async_search_all.running()
True
>>> async_search_all.done()
False
>>> all_gsc_results = async_search_all.get()
If one is unable to obtain any results using the default
Cone Search database, 'conesearch_good'
, that only contains
sites that cleanly passed validation, one can use Configuration system (astropy.config)
to use another database, 'conesearch_warn'
, containing sites with
validation warnings. One should use these sites with caution:
>>> from astropy.vo import conf
>>> conf.conesearch_dbname = 'conesearch_warn'
>>> conesearch.list_catalogs()
Downloading http://stsdas.stsci.edu/astrolib/vo_databases/conesearch_warn.json
|===========================================| 87k/ 87k (100.00%) 00s
[u'2MASS All-Sky Catalog of Point Sources (Cutri+ 2003) 1',
u'2MASS All-Sky Point Source Catalog 1',
u'Data release 7 of Sloan Digital Sky Survey catalogs 1',
u'Data release 7 of Sloan Digital Sky Survey catalogs 2',
u'Data release 7 of Sloan Digital Sky Survey catalogs 3',
u'Data release 7 of Sloan Digital Sky Survey catalogs 4',
u'Data release 7 of Sloan Digital Sky Survey catalogs 5',
u'Data release 7 of Sloan Digital Sky Survey catalogs 6',
u'The 2MASS All-Sky Catalog 1',
u'The 2MASS All-Sky Catalog 2',
u'The USNO-B1.0 Catalog (Monet+ 2003) 1',
u'The USNO-B1.0 Catalog 1',
u'USNO-A V2.0, A Catalog of Astrometric Standards 1',
u'USNO-B1 Catalogue 1']
>>> result = conesearch.conesearch(c, sr)
Trying http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/284/out&
Downloading ...
WARNING: W22: ... The DEFINITIONS element is deprecated in VOTable 1.1...
>>> result.array.data.size
50000
You can also use custom Cone Search database, say, 'my_vo_database.json'
from VO database examples:
>>> import os
>>> from astropy.vo.client.vos_catalog import BASEURL
>>> BASEURL.set(os.curdir)
>>> conesearch.CONESEARCH_DBNAME.set('my_vo_database')
>>> conesearch.list_catalogs()
[u'My Catalog 1']
>>> result = conesearch.conesearch(c, sr)
Trying http://ex.org/cgi-bin/cs.pl?
Downloading ...
|===========================================| 1.8k/1.8k (100.00%) 00s
# ...
VOSError: None of the available catalogs returned valid results.


Thermostat 🌡
Temperature indoors:
C
Current temperature in your city:
20 C
🔥
❄
reset
power saving mode is
on
PSM on
PSM off


“Everything you’ve learned in school as ‘obvious’ becomes less and less obvious as you begin to study the universe. For example, there are no solids in the universe. There’s not even a suggestion of a solid. There are no absolute continuums. There are no surfaces. There are no straight lines.”
- R. Buckminster Fuller (1895–1983)
When Is a Straight Line Not the Shortest Distance between Two Points?
The hypotenuse of a right triangle is not always the shortest distance between the two points that define it
In the Pythagorean theorem episode of NBC Learn's "The Science of NFL Football," you see that a defender in the middle of the field must take the proper angle of pursuit to catch a ball-carrier making a dash down the sideline for the end zone. In chasing down the ball-carrier, the defender basically runs along the diagonal of a right triangle, in which the sum of the squares of the sides equals the square of that diagonal. You might know this relation, discovered by the 5th-century B.C. Greek mathematician Pythagoras, as a² + b² = c². The "c" is the hypotenuse, and although it represents the longest side of a right triangle, it is the shortest path between the two points on either end. If the points on the triangle were places to visit in a city, you probably wouldn't bother walking along a and b if you could directly take c. But the hypotenuse isn't always the shortest route. In fact, it is only the shortest one on football fields and other flat surfaces. On spheres and other shapes, it may not be. You can see this distinction if you draw a right triangle on a globe. First, let's pick a city on the equator--for simplicity, say it's Quito, Ecuador, on the Pacific coast of South America. From Quito, trace a longitude line to the north pole; then make a 90-degree turn to the right and head straight back down. At the equator, you'll notice a city nearby called Libreville, the capital of the country of Gabon in Africa. Now draw a line along the globe's surface starting at Quito and going toward Libreville. You probably went eastward, passing over Brazil and the Atlantic Ocean. Indeed, this hypotenuse, traversing one quarter of the globe, marks the shortest distance. But that is not the only hypotenuse. Mathematically speaking, you would still have a right triangle if you went westward from Quito, circumnavigating Earth along the equator to get to Libreville. The hypotenuse in this case is three fourths of the circumference. It would have been shorter to travel from Quito to the North Pole and then down to Libreville. The Pythagorean theorem only works on two-dimensional surfaces like football fields; mathematicians refer to such surfaces as Euclidean geometry (named for Euclid, the 3rd-century B.C. Greek mathematician). The theorem fails for non-Euclidean geometries, such as spheres and more complex geometries like saddles. Indeed, all the rules you learned in school, like parallel lines staying parallel, only refer to Euclidean geometry. In the non-Euclidean universe, parallel lines may actually diverge or converge. Although non-Euclidean geometry may seem exotic and unfamiliar, it is actually common in many fields of science--perhaps most notably, in Einstein's general relativity theory, in which gravity can bend the shape of space and time.


BFI
`Prev `__
B
`Next `__
--------------
**BFI**: /B·F·I/, n.
See `*brute force and ignorance* `__.
Also encountered in the variants BFMI, “brute force and *massive*
ignorance” and BFBI “brute force and bloody ignorance”. In some parts of
the U.S. this abbreviation was probably reinforced by a company called
Browning-Ferris Industries in the waste-management business; a large BFI
logo in white-on-blue could be seen on the sides of garbage trucks.
--------------
+-------------------------+----------------------------+-----------------------+
| `Prev `__ | `Up <../B.html>`__ | `Next `__ |
+-------------------------+----------------------------+-----------------------+
| beta | `Home <../index.html>`__ | BI |
+-------------------------+----------------------------+-----------------------+


Hey,
As most of you probably know in meantime, I joined Microsoft as a full-time employee mid September this year, in the prestigious Azure Technical Trainer team - EMEA. This team is part of the WorldWide Learning (WWL) organization, and working on the Enterprise Skills Initiative (ESI) program.
As the name says, as Azure Technical Trainer, my role is to provide training to larger Microsoft Partners and customers in EMEA, helping them in being successful in using Azure, and mainly focusing on skilling up the IT teams (sysadmins, developers, solution architects). While the training starts from the Microsoft Official Courseware (MOC), we are not bound to only using that material. Which was a huge plus to me, knowing I built and delivered most of the workshops using my own content (or vendor content I was involved in building) before.
Another big part of the fun in my role, is the traveling. Having traveled around the globe to deliver workshops for the last 6 years, I found out it is a huge source of inspiration to me, seeing how Azure is being adopted differently, depending on where in the world I am. I had the joy to visit some cool places like Sofia, Wroclaw, Krakow, Johannesburg, Manchester, Cork, Cardiff… and so many more! (the job description said 75% travel, but I enjoyed the 93% :)) 14 different locations in as many weeks!
Next, given my +6 years focus on Azure, I love the fact my senior leads trust me in delivering all different Azure workshops right away. As I was familiar with most content already, this was OK for me. I’ve delivered several of these:
-
AZ-900 (Azure Fundamentals),
-
AZ-103 (Azure Administrator),
-
AZ-203 (Developing Azure Solutions),
-
AZ-300/301 (Architecting Azure Solutions).
Beginning of 2020, I will also start delivering
-
AZ-400 (Azure DevOps)
-
AZ-500 (Azure Security Solutions)
as demand for those more advanced courses is growing. Which to me means, the usage of Azure in the field is also growing, and becoming more mature.
Outside of the workshop delivery, which is the biggest part of my job, I’m also involved in a few virtual teams, working on content optimization for the AZ-103 material, and another one where we are brainstorming and working towards making content better for hybrid training delivery (both in-person and online at the same time).
So far, this job is a perfect match with my skills, my interest and overall what I have loved doing for the last 6 years. Hoping to continue expanding my skills by delivering other Azure workshops that are sometimes a bit out of my comfort zone, and probably going to try and take a step towards the Artificial Intelligence (AI) courses we have on offer as well. (Currently working on a license plate scanning tool, simulating a toll booth system, to have some cool demos during my workshops).
There is always something new in Azure, and it maps with my personal “keep on learning” mentality.
As I always loved sharing knowledge, I will try and continue doing this from here, providing you technical blog posts, among some short-snippet videos every now and then, on some Azure service or feature.
Wishing you all happy holidays, and stay tuned for more Azure news in 2020.
/Peter


Version : 3 (2023-08-17)
This section contains documentation for most <info name="key">value</info> of Venus Doc Format
|
Name |
Description |
Supporting handlers |
Default |
Since |
|---|---|---|---|---|
|
doc-title |
Set the document title, should be usually supported in document formats like html or pdf |
fj-doc-freemarker(html), fj-doc-mod-fop(pdf), |
1.0.0 |
|
|
doc-author |
Set the document author, should be usually supported in document formats like html or pdf |
fj-doc-freemarker(html), fj-doc-mod-fop(pdf), |
1.0.0 |
|
|
doc-creator |
Set the document creator tool (es. Venus Doc), should be usually supported in document formats like html or pdf |
fj-doc-freemarker(html), fj-doc-mod-fop(pdf), |
1.0.0 |
|
|
doc-language |
Set the document language, should be usually supported in document formats like html or pdf |
fj-doc-freemarker(html), fj-doc-mod-fop(pdf), |
1.0.0 |
|
|
doc-subject |
Set the document subject, should be usually supported in document formats like html or pdf |
fj-doc-freemarker(html), fj-doc-mod-fop(pdf), |
1.0.0 |
|
|
doc-version |
A custom property to track meta model version |
fj-doc-freemarker(html), fj-doc-mod-fop(pdf), |
1.0.0 |
|
|
default-table-padding |
Set default table padding, default '-1' means 'unset' (shoud be inherited by all cells, in HTML it is handled by 'padding') |
fj-doc-freemarker(html), fj-doc-poi(xls), fj-doc-poi(xlsx), fj-doc-mod-fop(pdf), fj-doc-mod-openpdf(pdf), fj-doc-mod-itext(pdf), |
-1 |
1.5.0 |
|
default-table-spacing |
Set default table spacing, default '-1' means 'unset' (shoud be inherited by all cells, in HTML it is handled by 'margin') |
fj-doc-freemarker(html), fj-doc-poi(xls), fj-doc-poi(xlsx), fj-doc-mod-fop(pdf), fj-doc-mod-openpdf(pdf), fj-doc-mod-itext(pdf), |
-1 |
1.5.0 |
|
default-cell-border-width |
Set default cell border width for all table cells, default '-1' means 'unset' |
fj-doc-freemarker(html), fj-doc-poi(xls), fj-doc-poi(xlsx), fj-doc-mod-fop(pdf), fj-doc-mod-openpdf(pdf), fj-doc-mod-itext(pdf), |
-1 |
1.5.0 |
|
Name |
Description |
Supporting handlers |
Default |
Since |
|---|---|---|---|---|
|
html-css-link |
Link to css for the html document |
fj-doc-freemarker(html), |
1.4.5 |
|
|
html-css-style |
Inline CSS style definition to be added to the document |
fj-doc-freemarker(html), |
1.4.5 |
|
|
html-add-to-head |
Custom HTML code to be added directly in the head section |
fj-doc-freemarker(html), |
1.0.0 |
|
Name |
Description |
Supporting handlers |
Default |
Since |
|---|---|---|---|---|
|
margins |
Document page margins, in pixels, in the format LEFT;RIGHT;TOP;BOTTOM |
fj-doc-mod-fop(pdf), |
10;10;10;10 |
1.0.0 |
|
page-width |
Page width, in cm, for example 21cm for A4 portrait or 29.7cm for A4 landscape |
fj-doc-mod-fop(pdf), |
21cm |
1.0.0 |
|
page-height |
Page height, in cm, for example 29.7cm for A4 or 21cm for A4 landscape |
fj-doc-mod-fop(pdf), |
29.7cm |
1.0.0 |
|
page-orient |
Page orientation, 'vertical' for portrait or 'horizontal' for landscape |
fj-doc-mod-openpdf(pdf), fj-doc-mod-itext(pdf), |
vertical |
1.0.0 |


Frequently Asked Questions (FAQ)
General Questions
By signing up with us this will allow us to track your online purchases. We will not disclose your personal information to anyone and ensure to keep it safe. We will not retain your payment information. You can either sign up before or upon checking out your final order.
Our store is located at #01-11 Waterway Point, 83 Punggol Central, Singapore 828761.
We are open daily 10am-9pm
We are open daily 10am-9pm
In the navigation bar click on classes. There should be a form for you to fill in your details. If you need assistance please contact us directly to register for the landscaping class.
If you need further assistance with our products or services, please do not hesitate to contact us via the following:
Phone: +65 6383 0111
Email<EMAIL_ADDRESS>One of our friendly customer relations officers will get back to you within 1 to 2 days.
Phone: +65 6383 0111
Email<EMAIL_ADDRESS>One of our friendly customer relations officers will get back to you within 1 to 2 days.
Self-Pick Up
At the moment the only location for self-pick up would be at our Fish-Tastic store, #01-11 Waterway Point, 83 Punggol Central, Singapore 828761.
Monday - Sunday : 10am - 9pm
Please wait for a notification email or text message that your order has been packaged and is ready for collection before heading down to our store.
There are no restrictions however delivery charges will be based on weight and sizes.
You can contact our customer service staff over the phone at +65 6383 0111 from Monday to Sunday between 10am to 9pm or via email at<EMAIL_ADDRESS>How to place an order
Once payment has been made and you have received a payment invoice only then your order is secured.
Out of stock product(s) will be cancelled from your order. The remainder of your order will be shipped and you will be refunded for the cancelled product(s). Please allow 14-28 days for refunds to be fully processed.
Upon checking out all orders placed are deemed confirmed. It is best to double check prior to placing your final order.
On the top right corner you will see a search bar. Type in the product’s name in the search bar and press enter. If you know the code number of the product just type it into the search bar. You may also browse through our catalogues via the categories provided in the main navigation bar.
You can place a booking order over the phone but payment has to be done directly at our store or via our online shopping cart.
| Order Status | Meaning |
|---|---|
| Payment accepted | The order was placed successfully. You should receive a confirmation email or text message after placing your order. |
| Product preparation | Our team are busy preparing and packaging your order. |
| Shipped/Delivered | Your order has been shipped from our store and is on the way to you. |
| Product Ready for Collection | Your order is now at our store and you may head to #01-11 Waterway Point, 83 Punggol Central, Singapore 828761 anytime between 10am to 9pm daily for collection. |
| Product Collected | You have collected your order. |
Payment Methods
We accept the following payment methods:
- Paypal
- Visa Debit/Credit Cards
- Mastercard Debit/Credit Cards
- Nets
If the transaction was successful we will issue you an online voucher for you to re-order your items without making another payment. If the transaction was unsuccessful please restart and re-order your products and make the final payment.
Please give us a call at +65 6383 0111 or email us<EMAIL_ADDRESS>if you encounter this issue. If duplicate payments were found by our finance team we will issue a full refund. Please allow 14-28 days for refunds to be fully processed.
Returns and Refunds
Only certain products can be exchanged as we have a 7 day return policy.
Refunds will be processed and credited back into the card that was used to make payment.
Please allow 14-28 days for refunds to be fully processed.
Returns must be done within 7 days from the date of purchase. Please take note that returns policy do not apply to products on final sale promotions. Please place the product into their original packaging, unassembled, unused and with labels intact with all accessories. We are not able to refund items that do not meet this criteria.
Each product has a specified one year warranty period. Food products do not have warranties.
We apologize in advance if you have received a defective or incorrect product. Please give us a call at +65 6383 0111 or email us<EMAIL_ADDRESS>and we will take action immediately to resolve this matter.
Shipping and Delivery
Worldwide! We deliver all across the world, please make sure you order and indicate a definite delivery address.
Unfortunately we only deliver supplies. Due to government regulations and restrictions we are not allowed to ship live fish and animals to you. You are most welcome to place an order online and come by our store to collect your purchase.
Product shipments are delivered via third party courier companies. We will email or message you when we ship your order from our store and will also provide you with a tracking number. Local deliveries will be delivered via Singpost.
Local deliveries you should expect to receive your order within 3-5 working days. Overseas deliveries should expect to receive your order within 14-28 working days.
Due to the product shipment being delivered via third party courier companies we are unable to provide you the option for a specific delivery time. Deliveries are handled between 9am to 6pm from Monday to Friday.
Local deliveries and orders made above $30 will have free shipping. Orders made below $30 shipping fee will be $10. Overseas deliveries and orders will have a delivery fee based on weight and size of the product.
Upon confirmation of your order you will receive an email confirmation and a message stating your order’s tracking number for you to track your package. If you are unable to locate your order please do not hesitate to contact us.
Definitely not. Please fill out a return request form on our website. Please call us to verify the items you wish to return and we will then proceed to process a refund for you. Please allow 14-28 days for refunds to be fully processed.
Veterinary Services
Monday to Friday from 8am to 9pm. On Saturdays we are open from 9am until 5pm and we are open Sunday from 10am until 2pm.
Generally patients are seen by appointments but we can accommodate emergencies without an appointment. If possible please call ahead of time and make an appointment with us.
We accept Paypal, Visa Debit/Credit Cards and Mastercard Debit/Credit Cards.Payment is due when services are performed or when your pet leaves the vet. A down payment is required before emergency treatment is provided.
You may drop off your pet with us in the morning and your pet will be seen during the day. Once everything is done we will call you afterwards to pick up your pet anytime from when we call until 9pm on weekdays, 5pm on Saturdays and 2pm on Sunday. There is no additional charge for drop-off service. Animals not picked up will stay overnight and a boarding fee will be added.
We provide veterinary care for puppies, kittens, dogs, cats, hamsters, rabbits, guinea pigs and fishes.
Call the clinic and your call will be transferred to one of our veterinarians on-call. If emergency care is necessary you are required to make a down payment before we can provide care for your pet. Full payment is due when your pet is ready to go home.
Every pet has unique medical needs, so you and your vet should discuss an ongoing healthcare plan for your animal, as your pet may have a condition that requires relatively frequent visits to treat properly. However, generally speaking, we recommend bringing a healthy pet in at least once a year for a wellness visit, to make sure he or she is up to date on his/her shots and that everything is functioning as it should.
Sometimes animals hide their illnesses or injuries so it is important to pay attention and be aware of the signs of symptoms that require immediate urgent emergency care. If you suspect your pet is unwell please do not hesitate to call us. Early veterinary attention can prevent serious illnesses from progressing and reduce the cost of care.
Spaying or neutering can be done at approximately 6 months of age. Your pet is given an exam prior to surgery to help determine whether your pet is healthy enough to undergo the surgical procedure. Current vaccinations are required at the time of surgery. Also a pre-anesthetic blood screen is performed prior to undergoing anesthesia and surgery.
Procedures involving sutures require them to be removed in 10 – 14 days following the surgery.
All dogs need their coat and nails tended to, but some dogs require much more grooming than others. Some breeds that require frequent grooming are Poodles, Shih Tzus and Lhasa Apsos, Bichon Frises, Yorkshire Terriers, Schnauzers, and West Highland Terriers.
We have boarding facilities for dogs within our clinic. We encourage you to bring your pet’s own food.


Sign Up
Email
Password
Address
Address 2
City
State
Choose...
Sindh
Punjab
Balochistan
Khyber Pakhtunkhwa
Other
Zip
Check me out
Sign in