For each type of pagination it is possible to enable Ajax so that the requested page is loaded using an asynchronous request to the server. This is especially important for Twitter-style Pagination and endless pagination on scroll, but Digg-style pagination can also take advantage of this technique.
Ajax support is activated linking Vue.js and the directive endless-pagination:

Entries:

{% include page_template %}

{% block js %}
{{ block.super }}

new Vue({
el: '#entries',
});
{% endblock %}

This example assumes that you separated the fragment containing the single page (page_tempate) from the main template (the code snipper above). More on this in Twitter-style Pagination and Digg-style pagination.
The directive endless-pagination call activates Ajax for each pagination present in the page.
If you want new items to load when the user scrolls down the browser page, you can use the pagination on scroll feature: just set the paginateOnScroll option of the directive endless-pagination to true, e.g.:

Entries:

{% include page_template %}

{% block js %}

new Vue({
el: '#entries',
});
{% endblock %}

That’s all. See the Templatetags reference page to improve usage of the included templatetags.
It is possible to set the bottom margin used for pagination on scroll (default is 1 pixel). For example, if you want the pagination on scroll to be activated when 20 pixels remain to the end of the page:

Entries:

{% include page_template %}

{% block js %}

new Vue({
el: '#entries',
});
{% endblock %}

It is possible to customize the behavior of JavaScript pagination by attaching callbacks to endless-pagination, called when the following events are fired:
The context of both callbacks is the clicked link fragment: in other words, inside the callbacks, this will be the HTML fragment representing the clicked link, e.g.:

Entries:

{% include page_template %}

{% block js %}

new Vue({
el: '#entries',
methods: {
callbacks_click: function(ev){
console.log("Callback");
}
}
});
{% endblock %}

callbacks_click is function declared in your module.
Example de module.test.js: https://github.com/mapeveri/django-endless-pagination-vue/blob/master/tests/project/static/endless_pagination/js/module.test.js
This module is inserted the module EndlessPagination and inherited the directive endless-pagination.
Both callbacks also receive a context argument containing information about the requested page:
If the onClick callback returns false, the pagination process is stopped, the Ajax request is not performed and the onCompleted callback never called.
The onCompleted callbacks also receives a second argument: the data returned by the server. Basically this is the HTML fragment representing the new requested page.
To wrap it up, here is an example showing the callbacks’ signatures:

Entries:

{% include page_template %}

{% block js %}

new Vue({
el: '#endless',
methods: {
callbacks_click: function(ev){
console.log("callbacks_click");
},
callbacks_completed: function(ev) {
console.log("callbacks_completed");
}
}
});
{% endblock %}
callbacks_click and callbacks_completed the functions declared in your module.
Like the previous example, the functions are declared in your module (In this example module.test.js.
As seen above, the directive endless-pagination enables Ajax support for each pagination in the page. But assuming you are using Multiple paginations in the same page, e.g.:

Entries:

{% include "myapp/entries_page.html" %}

Other entries:

{% include "myapp/other_entries_page.html" %}

{% block js %}

new Vue({
el: '#entries',
});
new Vue({
el: '#other-entries',
});
{% endblock %}
What if you need Ajax pagination only for entries and not for other entries? You can do add the directive only for entries.
Each time endless-pagination is used, several JavaScript selectors are used to select DOM nodes. Here is a list of them all:
An example can better explain the meaning of the selectors above. Assume you have a Digg-style pagination like the following:

Entries:

{% include "myapp/entries_page.html" %}

{% block js %}

new Vue({
el: '#entries',
});
{% endblock %}

Here the #entries node is selected and Digg-style pagination is applied. Digg-style needs to know which DOM node will be updated with new contents, and in this case it’s the same node we selected, because we added the endless_page_template class to that node, and .endless_page_template is the selector used by default. However, the following example is equivalent and does not involve adding another class to the container:

Entries:

{% include "myapp/entries_page.html" %}

{% block js %}

new Vue({
el: '#entries',
});
{% endblock %}
Sometimes, when using on scroll pagination, you may want to still display the show more link after each N pages. In Django Endless Pagination Vue this is called chunk size. For instance, a chunk size of 5 means that a show more link is displayed after page 5 is loaded, then after page 10, then after page 15 and so on. Activating this functionality is straightforward, just use the paginateOnScrollChunkSize option:

{% block js %}

new Vue({
el: '#entries',
});
{% endblock %}
Django Endless Pagination Vue introduces only vue.js and remove jquery.
Instructions on how to migrate from the old version to the new one follow.
Before:

Entries:

{% include page_template %}
{% block js %}
{{ block.super }}

{% endblock %}
Now:

Entries:

{% include page_template %}

{% block js %}

new Vue({
el: '#entries',
});
{% endblock %}

Before:

Entries:

{% include page_template %}
{% block js %}
{{ block.super }}

{% endblock %}
Now:

Entries:

{% include page_template %}

{% block js %}

new Vue({
el: '#entries',
});
{% endblock %}

Before:

Entries:

{% include page_template %}
{% block js %}
{{ block.super }}

{% endblock %}
Now:

Entries:

{% include page_template %}

{% block js %}

new Vue({
el: '#entries',
});
{% endblock %}

Before:

Other entries:

{% include "myapp/other_entries_page.html" %}

{% block js %}
{{ block.super }}

{% endblock %}
Now:

Other entries:

{% include "myapp/other_entries_page.html" %}

{% block js %}

new Vue({
el: '#entries',
});
{% endblock %}

In this last example, only add the directive in where the desired pagination.


In that view you can view the different applications created.
Color: Select color
Selected:
Turn on bulb Turn off bulb


4. Library for transforms : gsyTransforms¶
Calculations for the following transforms: Fortescue (3-phase symmetrical components), Clarke (normal and DSOGI), Park (normal and DSRF).
Module Name : gsyTransforms
Author : Dr. GAO, Siyu
Version : 0.1.2
Last Modified : 2017-12-14
4.1. Change Log¶
Notable changes:
- Version : 0.1.2
- Added “cal_clarke”
- Added “cal_clarke_dsogi”
- Added “cal_park”
- Added “cal_park_ddsrf”
- Added “cal_symm”
- Added “to_complex”
4.2. List of functions¶
4.3. Function definitions¶
-
gsyTransforms.
cal_clarke
(a, b, c)¶ Calculates the amplitude invariant Clarke Transform.
Accepts complex form of three-phase inputs. Returns the \(\alpha\) component, \(\beta\) component and the \(Zero\) component.
\[\begin{split}\left[\begin{matrix} \alpha \\ \beta \\ Zero \end{matrix}\right] = \frac{2}{3} \left[\begin{matrix} 1 & -\frac{1}{2} & -\frac{1}{2} \\ 0 & \frac{\sqrt{3}}{2} & -\frac{\sqrt{3}}{2} \\ \frac{1}{2} & \frac{1}{2} & \frac{1}{2} \end{matrix}\right] \left[\begin{matrix} a \\ b \\ c \end{matrix}\right]\end{split}\]where: \(a\) is the Phase-A input; \(b\) is the Phase-B input; \(c\) is the Phase-C input; \(\alpha\) is the \(\alpha\) component of the Clarke Transform; \(\beta\) is the \(\beta\) component of the Clarke Transform; \(Zero\) is the \(Zero\) sequnece component. Parameters: a : complex or a list of complex
Phase-A input
b : complex or a list of complex
Phase-B input
c : complex or a list of complex
Phase-C input
Returns: alpha : complex or a list of complex
The \(\alpha\) component.
beta : complex or a list of complex
The \(\beta\) component.
zero : complex or a list of complex
The \(Zero\) sequence.
Examples
import gsyTransforms as trf alpha, beta, zero = trf.cal_clarke(phaseAdata, phaseBdata, phaseCdata)
-
gsyTransforms.
cal_clarke_dsogi
(a, b, c)¶ Calculates the Positive sequence and Negative sequence of the Clarke Transform based on the method of the Double Second-Order Generalised Integrator (DSOGI).
Accepts complex form of three-phase inputs. Returns the \(\alpha_+\), \(\beta_+\), \(\alpha_-\), \(\beta_-\) and the \(Zero\) component.
The Zero sequence is calculated by using the Clarke Transform.
For more information of the DSOGI [1]:
[1] Teodorescu, R., Liserre, M., and Rodríguez, P., Grid Converters for Photovoltaic and Wind Power Systems. 2011: John Wiley & Sons, Ltd. \[ \begin{align}\begin{aligned}quad = e^{-j \frac{1}{2} \pi} = \angle -90^{\circ}\\\begin{split}\\\end{split}\\\begin{split}\left[\begin{matrix}\alpha_+ \\ \beta_+ \end{matrix}\right] = \frac{1}{2} \left[ \begin{matrix} 1 & -quad \\ quad & 1 \end{matrix} \right] \left[ \begin{matrix} \alpha \\ \beta \end{matrix} \right]\end{split}\\\begin{split}\\\end{split}\\\begin{split}\left[\begin{matrix} \alpha_- \\ \beta_- \end{matrix}\right] = \frac{1}{2} \left[ \begin{matrix} 1 & quad \\ -quad & 1 \end{matrix} \right] \left[ \begin{matrix} \alpha \\ \beta \end{matrix} \right]\end{split}\end{aligned}\end{align} \]where: \(quad\) is the \(-90^{\circ}\) shifter; \(\alpha\) is the \(\alpha\) component of the Clarke Transform; \(\beta\) is the \(\beta\) component of the Clarke Transform; \(\alpha_+\) is the positive sequnece of the \(\alpha\) component; \(\beta_+\) is the positive sequnece of the \(\beta\) component; \(\alpha_-\) is the negative sequnece of the \(\alpha\) component; \(\beta_-\) is the negative sequnece of the \(\beta\) component. Parameters: a : complex or a list of complex
Phase-A inputs
b : complex or a list of complex
Phase-B inputs
c : complex or a list of complex
Phase-C inputs
Returns: alpha_pos_dsogi : complex or a list of complex
The \(\alpha_+\) component.
beta_pos_dsogi : complex or a list of complex
The \(\beta_+\) component.
alpha_neg_dsogi : complex or a list of complex
The \(\alpha_-\) component.
beta_neg_dsogi : complex or a list of complex
The \(\beta_-\) component.
zero : complex or a list of complex
The \(Zero\) sequence.
Examples
import gsyTransforms as trf (alpha_pos_dsogi, beta_pos_dsogi, alpha_neg_dsogi, beta_neg_dsogi, zero) = trf.cal_clarke_dsogi(phaseAdata, phaseBdata, phaseCdata)
-
gsyTransforms.
cal_park
(theta, alpha, beta, zero=0)¶ Calculates the Park Transform.
Accepts complex form of the Clarke Transform inputs and the angle of the Synchronous Reference Frame (SRF). This angle is commonly provided by the Phase-Locked Loop (PLL) but not always. This angle also has huge impact on the outputs of the Park Transform since the changes in the frequencies of the inputs are strongly related to this angle.
Returns the \(d\), \(q\), \(Zero\) components.
\[\begin{split}\left[\begin{matrix}d \\ q \\ Zero \end{matrix}\right] = \left[ \begin{matrix} \cos\theta & \sin\theta & 0 \\ -\sin\theta & \cos\theta & 0 \\ 0 & 0 & 1 \end{matrix} \right] \left[ \begin{matrix} \alpha \\ \beta \\ Zero \end{matrix} \right]\end{split}\]where: \(\theta\) is the SRF angle in radians; \(\alpha\) is the \(\alpha\) component of the Clarke Transform; \(\beta\) is the \(\beta\) component of the Clarke Transform; \(Zero\) is the \(Zero\) sequence; \(d\) is the \(d\) component of the Park Transform; \(q\) is the \(q\) component of the Park Transform; Parameters: theta : float or a list of float in radians
The angle of the SRF, usually provided by a PLL.
alpha : complex or a list of complex
The \(\alpha\) component of the Clarke Transform
beta : complex or a list of complex
The \(\beta\) component of the Clarke Transform
zero : any, default = 0
The \(Zero\) sequence. This would be output directly without manipulation, since the Zero sequence does not change.
Returns: d : complex or a list of complex
The \(d\) component.
q : complex or a list of complex
The \(q\) component.
zero : as input parameter “zero”
The Zero sequence.
Examples
import gsyTransforms as trf d, q, zero = trf.cal_park(phaseAdata, phaseBdata, phaseCdata)
-
gsyTransforms.
cal_park_dsrf
(theta, alpha, beta, zero=0)¶ Calculates the Park Transform of the Double Synchronous Reference Frame (DSRF).
Accepts complex form of the Clarke Transform inputs and the angle of the Synchronous Reference Frame (SRF).
The DSRF approach is inferior to the DSOGI approach.
Event the Decoupled-DSRF (DDSRF) is still inferior to the DSOGI approach since its performance is hugely dependent on the filters used to decouple the DSRF (bascially getting rid of the harmonics introudced by the DSRF).
Returns the \(d_{+DSRF}, q_{+DSRF},d_{-DSRF}, q_{-DSRF}\) and \(Zero\) components.
\[ \begin{align}\begin{aligned}\begin{split}\left[\begin{matrix}d_{+DSRF} \\ q_{+DSRF} \end{matrix}\right] = \left[ \begin{matrix} \cos\theta & \sin\theta \\ -\sin\theta & \cos\theta \end{matrix} \right] \left[ \begin{matrix} \alpha \\ \beta \end{matrix} \right]\end{split}\\\begin{split}\\\end{split}\\\begin{split}\left[\begin{matrix}d_{-DSRF} \\ q_{-DSRF} \end{matrix}\right] = \left[ \begin{matrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{matrix} \right] \left[ \begin{matrix} \alpha \\ \beta \end{matrix} \right]\end{split}\end{aligned}\end{align} \]where: \(\theta\) is the SRF angle in radians; \(\alpha\) is the \(\alpha\) component of the Clarke Transform; \(\beta\) is the \(\beta\) component of the Clarke Transform; \(d_{+DSRF}\) is the DSRF positive \(d\) component; \(q_{+DSRF}\) is the DSRF positive \(q\) component; \(d_{-DSRF}\) is the DSRF negative \(d\) component; \(q_{-DSRF}\) is the DSRF negative \(q\) component. Parameters: theta : float or a list of float in radians
The angle of the SRF, usually provided by a PLL.
alpha : complex or a list of complex
The \(\alpha\) component of the Clarke Transform
beta : complex or a list of complex
The \(\beta\) component of the Clarke Transform
zero : any, default = 0
The \(Zero\) sequence. This would be outputed directly without manipulation. Since the Zero sequence does not change.
Returns: d_dsrf_pos : complex or a list of complex
The DSRF positive \(d\) component.
q_dsrf_pos : complex or a list of complex
The DSRF positive \(q\) component.
d_dsrf_neg : complex or a list of complex
The DSRF negative \(d\) component.
q_dsrf_neg : complex or a list of complex
The DSRF negative \(q\) component.
zero : as input parameter “zero”
The \(Zero\) sequence.
Examples
import gsyTransforms as trf (d_dsrf_pos, q_dsrf_pos, d_dsrf_neg, q_dsrf_neg, zero) = trf.cal_park_dsrf(phaseAdata, phaseBdata, phaseCdata)
-
gsyTransforms.
cal_symm
(a, b, c)¶ Calculates the 3-phase symmetrical components (Fortescue).
Accepts complex form of three-phase inputs. Returns the Positive sequence, the Negative sequence and the Zero sequence.
\[A = e^{j \frac{2}{3} \pi} = \angle 120^{\circ}\]Commonly, the lowercase of \(A\), \(\alpha\), is used. To avoid confusion with \(a\) (/eɪ/), the uppercase, \(A\), is used here instead.
\[ \begin{align}\begin{aligned}\begin{split}\left[\begin{matrix} a_{+} \\ b_{+} \\ c_{+} \end{matrix}\right] &= \frac{1}{3} \left[\begin{matrix} 1 & A & A^2 \\ A^2 & 1 & A \\ A & A^2 & 1 \end{matrix}\right] \left[\begin{matrix} a \\ b \\ c \end{matrix}\right]\end{split}\\\begin{split}\\\end{split}\\\begin{split}\left[\begin{matrix} a_{-} \\ b_{-} \\ c_{-} \end{matrix}\right] &= \frac{1}{3} \left[\begin{matrix} 1 & A^2 & A \\ A & 1 & A^2 \\ A^2 & A & 1 \end{matrix}\right] \left[\begin{matrix} a \\ b \\ c \end{matrix}\right]\end{split}\\\begin{split}\\\end{split}\\\begin{split}\left[\begin{matrix} a_{Zero} \\ b_{Zero} \\ c_{Zero} \end{matrix}\right] = \frac{1}{3} \left[\begin{matrix} 1 & 1 & 1 \\ 1 & 1 & 1 \\ 1 & 1 & 1 \end{matrix}\right] \left[\begin{matrix} a \\ b \\ c \end{matrix}\right]\end{split}\end{aligned}\end{align} \]where: \(A\) is the \(120^{\circ}\) shifter; \(a\) is the Phase-A input; \(b\) is the Phase-B input; \(c\) is the Phase-C input; \(a_+\) is the positive sequence of Phase-A input; \(b_+\) is the positive sequence of Phase-B input; \(c_+\) is the positive sequence of Phase-C input; \(a_-\) is the negative sequence of Phase-A input; \(b_-\) is the negative sequence of Phase-B input; \(c_-\) is the negative sequence of Phase-C input; \(a_{Zero}\) is the zero sequence of Phase-A input; \(b_{Zero}\) is the zero sequence of Phase-B input; \(c_{Zero}\) is the zero sequence of Phase-C input. Parameters: a : complex or a list of complex
Phase-A inputs
b : complex or a list of complex
Phase-B inputs
c : complex or a list of complex
Phase-C inputs
Returns: a_pos : complex or a list of complex
Phase-A Positive sequence.
b_pos : complex or a list of complex
Phase-B Positive sequence.
c_pos : complex or a list of complex
Phase-C Positive sequence.
a_neg : complex or a list of complex
Phase-A Negative sequence.
b_neg : complex or a list of complex
Phase-B Negative sequence.
c_neg : complex or a list of complex
Phase-C Negative sequence.
Zero : complex or a list of complex
Ther Zero sequence. Since all zero sequence components are the same, only one is returned.
Examples
import gsyTransforms as trf (phaseA_pos, phaseB_pos, phaseC_pos, phaseA_neg, phaseB_neg, phaseC_neg, phaseZero) = trf.cal_symm(phaseAdata, phaseBdata, phaseCdata)
-
gsyTransforms.
to_complex
(r, x, real_offset=0, imag_offset=0)¶ Converts to complex number according to given parameters.
\[ \begin{align}\begin{aligned}Real &= r \cdot \cos(x) + Offset_{real} \\Imag &= r \cdot \sin(x) + Offset_{imag} \\Complex &= Real + j \cdot Imag \end{aligned}\end{align} \]where: \(r\) is the radius of the complex number; \(x\) is the angle in radians; \(Offset_{real}\) is the offset to the real part; \(Offset_{imag}\) is the offset to the imaginary part; \(j\) is the imaginary unit. Parameters: r : float or a list of float
The radius of the complex number.
x : float or a list of float in radians
The angle of the phasor/vector.
real_offset : float or a list of float
The offset to the real part, like a DC offset, whose imagnary part is zero.
imag_offset : float or a list of float
The offset to the imaginary part.
Returns: complex or a list of complex
The complex number caculated according to the given parameters.
Examples
import gsyTransforms as trf import numpy as np a = trf.to_complex(1, np.pi*2/3)


If the bot does not know, ask in a few days after a staff member has got back to you. Try keep it simple, and do not put any personal information in which
can be connected to you as an individual, or others. This includes names, addresses, phone numbers, emails and more...


According to recent news (Source), a higher percentage of baby's in the province of Limburg are born with a birth defect than in the rest of the Netherlands.
The bar chart on the right shows the difference in percentage between Limburg and the Netherlands. This difference is seen as alarming, but researchers are not sure what causes this effect.
Therefore, this website aims to explore the differences between Limburg and the Netherlands on several different aspects using data from between the years 2006 and 2015. On the page "Visualization", three visualizations exploring these differences can be found: a map displaying the population size per province, a population pyramid comparing the relative presence of certain age groups in Limburg and a chosen province, and a grouped barchart comparing Limburg and a chosen province on several topics (births and deaths, migration, education, income, social security and causes of death).
On the "About" page, more background information and a description of the data and visualizations can be found. The data source is also listed on this page.


What's the BEST performance on your data? 🤖
When tackling a dataset, it's important to know the best possible performance. There's no point studying a solved problem!
If a group of annotators always labeled examples the same way, then models could score perfectly. In practice, only a handful of annotators decide each label, introducing some randomness in the process. So, even the perfect model can't get the perfect score.
We can formalize “the perfect model” as an oracle that knows how people annotate each example on average. This demo reports an estimate of that oracle's score on your data, which we call the BEST (Bayesian Estimated Score Terminus) performance.
Submit your dataset and discover the BEST performance! You can also check out the code, read the paper, or learn some background on how we compute the estimate.
To compute the BEST performance, you'll need a classification dataset with a fixed set of classes and multiple annotators per question. We'll estimate the score from the label counts. To try it out, you can select a preset example below.
| name | metric | score |
|---|
This demo provides a ReST API at /api/score
. To use
it, POST
a JSON object with the following keys:
"{{ metric }}"
Using cURL, you could hit the API as follows:
$ curl \
> --request POST \
> --header "Content-Type: application/json" \
> --data '{"metrics": ["accuracy", "f1 (macro)"], "labelCounts": [[1, 3], [4, 0]]}' \
> $DOMAIN/api/score
[
{
"metric": "accuracy",
"score": 0.8878
},
{
"metric": "f1 (macro)",
"score": 0.8485666666666668
}
]
Or using HTTPie:
$ http \
> post \
> $DOMAIN/api/score \
> labelCounts:='[[3, 2], [0, 5]]' \
> metrics:='["accuracy", "f1 (macro)"]'
HTTP/1.0 200 OK
Content-Length: 118
Content-Type: application/json
Date: Wed, 04 Dec 2019 23:15:50 GMT
Server: Werkzeug/0.15.4 Python/3.7.0
[
{
"metric": "accuracy",
"score": 0.7626
},
{
"metric": "f1 (macro)",
"score": 0.6836
}
]
To formalize “best possible” performance, we define an oracle which knows exactly how people annotate each example on average. For example \(i\), let \(p_{ij}\) be the probability that a random annotator assigns it to class \(j\), \(Y_{ij}\) be the count of annotations placing it in class \(j\), and \(N_i\) the total number of annotations it has. Using slice syntax to denote vectors, we have: \[ Y_{i:} \sim \operatorname{Multinomial}(p_{i:}, N_i) \] So given a loss, \(\ell\), the oracle predicts as well as possible knowing the class probabilities for each example (\(p\)) but not the annotations that were actually collected (\(Y\)). For ease of computation, we use the most probable label or the label distribution (whichever makes more sense) — even though these might not be optimal for all metrics.
Since the annotations (\(Y\)) are multinomial, we model the class probabilities (\(p\)) with the conjugate, Dirichlet distribution: \[ p_{i:} \sim \operatorname{Dirichlet}(\alpha) \] Following the empirical Bayesian approach, we fit the prior (\(\alpha\)) via maximum likelihood to obtain \(\hat{\alpha}\). Our estimate, the BEST performance, is then the oracle's expected loss over the posterior: \[ s \coloneqq \mathbb{E}_{p \mid Y, \hat{\alpha}}[\ell(p, Y)] \]
For the mathematical details, check out the paper or the code for computing the BEST performance.
If you build off this work or use the BEST performance, please cite the paper as follows:
@article{Lourie2020Scruples,
author = {Nicholas Lourie and Ronan Le Bras and Yejin Choi},
title = {Scruples: A Corpus of Community Ethical Judgments on 32,000 Real-Life Anecdotes},
journal = {arXiv e-prints},
year = {2020},
archivePrefix = {arXiv},
eprint = {2008.09094},
}


Bots are a useful way to interact with chat services such as Slack. If you have never built a bot before, this post provides an easy starter tutorial for combining the Slack API with Python to create your first bot.
We will walk through setting up your development environment, obtaining a Slack API bot token and coding our simple bot in Python.
Our bot, which we will name "StarterBot", requires Python and the Slack API. To run our Python code we need:
It is also useful to have the Slack API docs handy while you're building this tutorial.
All the code for this tutorial is available open source under the MIT license in the slack-starterbot public repository.
We now know what tools we need for our project so let's get our development environment set up. Go to the terminal (or Command Prompt on Windows) and change into the directory where you want to store this project. Within that directory, create a new virtualenv to isolate our application dependencies from other Python projects.
virtualenv starterbot
Activate the virtualenv:
source starterbot/bin/activate
Your prompt should now look like the one in this screenshot.
The official slackclient API helper library built by Slack can send and
receive messages from a Slack channel. Install the slackclient library with
the pip
command:
pip install slackclient
When pip
is finished you should see output like this and you'll be
back at the prompt.
We also need to obtain an access token for our Slack team so our bot can use it to connect to the Slack API.
Slack grants programmatic access to their messaging channels via a web API. Go to the Slack web API page and sign up to create your own Slack team. You can also sign into an existing account where you have administrative privileges.
After you have signed in go to the Bot Users page.
Name your bot "starterbot" then click the “Add bot integration” button.
The page will reload and you will see a newly-generated access token. You can also change the logo to a custom design. For example, I gave this bot the Full Stack Python logo.
Click the "Save Integration" button at the bottom of the page. Your bot is now ready to connect to Slack's API.
A common practice for Python developers is to export secret tokens as
environment variables. Export the Slack token with the name
SLACK_BOT_TOKEN
:
export SLACK_BOT_TOKEN='your slack token pasted here'
Nice, now we are authorized to use the Slack API as a bot.
There is one more piece of information we need to build our bot: our bot's ID. Next we will write a short script to obtain that ID from the Slack API.
It is finally time to write some Python code! We'll get warmed up by coding a short Python script to obtain StarterBot's ID. The ID varies based on the Slack team.
We need the ID because it allows our application to determine if messages
parsed from the Slack RTM are directed at StarterBot. Our script also
tests that our SLACK_BOT_TOKEN
environment variable is properly set.
Create a new file named print_bot_id.py
and fill it with the following
code.
import os
from slackclient import SlackClient
BOT_NAME = 'starterbot'
slack_client = SlackClient(os.environ.get('SLACK_BOT_TOKEN'))
if __name__ == "__main__":
api_call = slack_client.api_call("users.list")
if api_call.get('ok'):
# retrieve all users so we can find our bot
users = api_call.get('members')
for user in users:
if 'name' in user and user.get('name') == BOT_NAME:
print("Bot ID for '" + user['name'] + "' is " + user.get('id'))
else:
print("could not find bot user with the name " + BOT_NAME)
Our code imports the SlackClient and instantiates it with our
SLACK_BOT_TOKEN
, which we set as an environment variable. When the
script is executed by the python
command we call the Slack API to list
all Slack users and get the ID for the one that matches the name "starterbot".
We only need to run this script once to obtain our bot’s ID.
python print_bot_id.py
The script prints a single line of output when it is run that provides us with our bot's ID.
Copy the unique ID that your script prints out. Export the ID as an
environment variable named BOT_ID
.
(starterbot)$ export BOT_ID='bot id returned by script'
The script only needs to be run once to get the bot ID. We can now use that ID in our Python application that will run StarterBot.
We've got everything we need to write the StarterBot code. Create a new file
named starterbot.py
and include the following code in it.
import os
import time
from slackclient import SlackClient
The os
and SlackClient
imports will look familiar because we used them
in the print_bot_id.py
program.
With our dependencies imported we can use them to obtain the environment variable values and then instantiate the Slack client.
# starterbot's ID as an environment variable
BOT_ID = os.environ.get("BOT_ID")
# constants
AT_BOT = "<@" + BOT_ID + ">"
EXAMPLE_COMMAND = "do"
# instantiate Slack & Twilio clients
slack_client = SlackClient(os.environ.get('SLACK_BOT_TOKEN'))
The code instantiates the SlackClient
client with our SLACK_BOT_TOKEN
exported as an environment variable.
if __name__ == "__main__":
READ_WEBSOCKET_DELAY = 1 # 1 second delay between reading from firehose
if slack_client.rtm_connect():
print("StarterBot connected and running!")
while True:
command, channel = parse_slack_output(slack_client.rtm_read())
if command and channel:
handle_command(command, channel)
time.sleep(READ_WEBSOCKET_DELAY)
else:
print("Connection failed. Invalid Slack token or bot ID?")
The Slack client connects to the Slack RTM API WebSocket then constantly
loops while parsing messages from the firehose. If any of those messages are
directed at StarterBot, a function named handle_command
determines what
to do.
Next add two new functions to parse Slack output and handle commands.
def handle_command(command, channel):
"""
Receives commands directed at the bot and determines if they
are valid commands. If so, then acts on the commands. If not,
returns back what it needs for clarification.
"""
response = "Not sure what you mean. Use the *" + EXAMPLE_COMMAND + \
"* command with numbers, delimited by spaces."
if command.startswith(EXAMPLE_COMMAND):
response = "Sure...write some more code then I can do that!"
slack_client.api_call("chat.postMessage", channel=channel,
text=response, as_user=True)
def parse_slack_output(slack_rtm_output):
"""
The Slack Real Time Messaging API is an events firehose.
this parsing function returns None unless a message is
directed at the Bot, based on its ID.
"""
output_list = slack_rtm_output
if output_list and len(output_list) > 0:
for output in output_list:
if output and 'text' in output and AT_BOT in output['text']:
# return text after the @ mention, whitespace removed
return output['text'].split(AT_BOT)[1].strip().lower(), \
output['channel']
return None, None
The parse_slack_output
function takes messages from Slack and determines
if they are directed at our StarterBot. Messages that start with a direct
command to our bot ID are then handled by our code - which is currently
just posts a message back in the Slack channel telling the user to write
some more Python code!
Here is how the entire program should look when it's all put together (you can also view the file in GitHub):
import os
import time
from slackclient import SlackClient
# starterbot's ID as an environment variable
BOT_ID = os.environ.get("BOT_ID")
# constants
AT_BOT = "<@" + BOT_ID + ">"
EXAMPLE_COMMAND = "do"
# instantiate Slack & Twilio clients
slack_client = SlackClient(os.environ.get('SLACK_BOT_TOKEN'))
def handle_command(command, channel):
"""
Receives commands directed at the bot and determines if they
are valid commands. If so, then acts on the commands. If not,
returns back what it needs for clarification.
"""
response = "Not sure what you mean. Use the *" + EXAMPLE_COMMAND + \
"* command with numbers, delimited by spaces."
if command.startswith(EXAMPLE_COMMAND):
response = "Sure...write some more code then I can do that!"
slack_client.api_call("chat.postMessage", channel=channel,
text=response, as_user=True)
def parse_slack_output(slack_rtm_output):
"""
The Slack Real Time Messaging API is an events firehose.
this parsing function returns None unless a message is
directed at the Bot, based on its ID.
"""
output_list = slack_rtm_output
if output_list and len(output_list) > 0:
for output in output_list:
if output and 'text' in output and AT_BOT in output['text']:
# return text after the @ mention, whitespace removed
return output['text'].split(AT_BOT)[1].strip().lower(), \
output['channel']
return None, None
if __name__ == "__main__":
READ_WEBSOCKET_DELAY = 1 # 1 second delay between reading from firehose
if slack_client.rtm_connect():
print("StarterBot connected and running!")
while True:
command, channel = parse_slack_output(slack_client.rtm_read())
if command and channel:
handle_command(command, channel)
time.sleep(READ_WEBSOCKET_DELAY)
else:
print("Connection failed. Invalid Slack token or bot ID?")
Now that all of our code is in place we can run our StarterBot on the
command line with the python starterbot.py
command.
In Slack, create a new channel and invite StarterBot or invite it to an existing channel.
Now start giving StarterBot commands in your channel.
As it is currently written above in this tutorial, the
line AT_BOT = "<@" + BOT_ID + ">"
does not require a colon after the
"@starter" (or whatever you named your particular bot) mention. Previous
versions of this tutorial did have a colon because Slack clients would
auto-insert the ":" but that is no longer the case.
Alright, now you've got a simple StarterBot with a bunch of places in the code you can add whatever features you want to build.
There is a whole lot more that could be done using the Slack RTM API and Python. Check out these posts to learn what you could do:
Questions? Contact me via Twitter @fullstackpython or @mattmakai. I'm also on GitHub with the username mattmakai.
Something wrong with this post? Fork this page's source on GitHub.


Optimized Approach using Machine Learning on Credit Card Fraud Dataset
Use performance metrics to optimize machine learning algorithm to predict fraud transactions in Kaggle Credit Card Fraud Detection.
The goal of this research is to find out most significant features to predict whether a transaction in the dataset is committed to fraud. The structure of this article is: - Data Wrangling, in which I modify NA values and remove outliers - Feature Selecting, in which I create some features I think important to predict fraud - Training and tuning machine learning, in which I use sklearn to train 4 different models and compare their performance matrices, including precision, recall and f1 score, and plot ROC curves to compare the models - Final part, in which I select Naive Bayes as my best model - Conclusion
1. Data Wrangling
Firstly, load the dataset:
df = pd.read_csv("creditcard.csv")
df.shape
(284807, 31)
df.columns
Index([u'Time', u'V1', u'V2', u'V3', u'V4', u'V5', u'V6', u'V7', u'V8', u'V9',
u'V10', u'V11', u'V12', u'V13', u'V14', u'V15', u'V16', u'V17', u'V18',
u'V19', u'V20', u'V21', u'V22', u'V23', u'V24', u'V25', u'V26', u'V27',
u'V28', u'Amount', u'Class'],
dtype='object')
The total fraud and the ratio of fraud in this dataset are:
sum(df.Class), round(sum(df.Class)*1.0/df.shape[0],5)
(492, 0.00173)
This dataset presents transactions that occurred in two days, where we have 492 frauds out of 284,807 transactions. The dataset is highly unbalanced, the positive class (frauds) account for 0.173% of all transactions.
Since the dataset is processed and now there’s no NA values, so no need to clean the dataset.
On the other hand, the dataset is processed by PCA, so I would assume all outliers, if any, would not be meaningless.
2. Feature Selecting
Then, to begin with, I use all features and, under each algorithm I tune, use KBest to select features by their scores and compare the recall/precision rate.
One more step before start fitting is re-scale the data by sklearn.MinMaxScaler, because some of the algorithms I will implement might require re-scale features to avoid skewed distance and biased result.
min_max_scaler = preprocessing.MinMaxScaler()
features = min_max_scaler.fit_transform(features)
data_all = SelectKBest(f_classif, k='all').fit(features,labels)
# fit_transform(X, y)
import operator
scores = data_all.scores_
score_dict = {}
for ii in range(len(features_list) - 1):
score_dict[features_list[ii+1]] = round(scores[ii],2)
sorted_score_dict = sorted(score_dict.items(), key=operator.itemgetter(1), reverse=False)
Then I plot the features sorted by their scores:
From the plot, it seems 7 is a great cut-off to select features because more than 7 features will not have high score. However, here I will keep this plot as a reference, I will explore more about how the recall rate and precision rate will be changed and then compare all these plot to select best combination.
3. Training and Tuning Machine Learning
Before training, I will use validation to see how algorithms generalized to the overall data outside training data. Without validation, there’s pretty high risk of overfitting.
After that, I run each model independently and tune for the best performance of each type of model.
3.1 About Tuning Models
It’s very important to tune the model, not only because each model, there might be a lot of combination of parameters and hence make big influence on performance of our model, but also, we can have better chance to see how model can better match the data in an optimization process.
Without tuning the model, we might save a lot of time and get a good result, but there’s always a question “can we do better” over the head. And if the model get bad prediction when there’s new data coming, we even don’t know where the problem is. So tune the model might cost sometime, but it did save time in future for further exploration and better improved the performance and robustness of model.
3.2 Naive Bayes
Similarly, I tune the model for each K from 1 to 25, and plot the performance matrices:
The accuracy is an average score to show how much percentage we get the right prediction. As it’s not suitable for skewed features, here I add precision and recall matrices to evaluate.
Precision is how much probability we get a sample with true if it’s tested positive. By bayes prior and post probability:
In other words, precision is a measure of result relevancy, while recall is a measure of how many truly relevant results are returned:
- Higher precission means, with transaction identified as fraud by this model, we have higher correct rate
- Higher recall means, if the transaction is fraud, then we have higher chance to identify correctly
Here we can see:
The higher recall might make precision lower, which causes a lot of non-fraud transactions to be commited fraud. So I will keep a balance here and select K = 4
Now test in test set:
Accuracy: 1.00
Precision: 0.57
Recall : 0.58
F1 score: 0.57
ROC Curve
Problems of models: Assumption of independence between transactions is not necessarily meet.
3.3 Decision Tree
The process is similar, but here we should set the parameters of Decision Tree and use GridSearch and visualization to get the best performance.
From the plot we can see the model reach optimal when K = 24. Here I use this to train and tune the Decision Tree model again to find the best combination of parameters:
Accuracy: 1.00
Precision: 0.86
Recall : 0.76
F1 score: 0.80
And the best parameters are:
grid_search.best_estimator_
DecisionTreeClassifier(class_weight=None,
criterion='entropy',
max_depth=3,
max_features=None,
max_leaf_nodes=None,
min_impurity_split=1e-07,
min_samples_leaf=1,
min_samples_split=2,
min_weight_fraction_leaf=0.0,
presort=False,
random_state=None,
splitter='best')
Here we care Recall and Precision the most because we want our model to increase probability to correct identify fraud with the transactions which are truely fraud and probability to get right fraud identification when we have positive test result. Thus, K = 27 will be a better choice.
And ROC curve:
3.4 Support Vector Machine
The 3rd type of model I want to use is SVM, because we have multi-dimensional dataset and big dataset. SVM’s hyper-plane have its advantages when we have enough features to train the model.
For SVM, we reach optimal at K = 21. Because F1 score, which is used to balance the precision and recall reaches optimal when k is 21.
Accuracy: 1.00
Precision: 0.89
Recall : 0.77
F1 score: 0.83
The best parameters are:
grid_search.best_estimator_
SVC(C=100,
cache_size=200,
class_weight=None,
coef0=0.0,
decision_function_shape=None,
degree=3,
gamma=0.001,
kernel='rbf',
max_iter=-1,
probability=False,
random_state=None,
shrinking=True,
tol=0.001,
verbose=False)
# ROC Curve, probability in SVC should be set to True to enable proba method
clf = svm.SVC(C=100, gamma=0.0001, kernel='rbf', probability=True)
y_score = clf.fit(features_svm_train,
labels_svm_train).predict_proba(features_svm_test)[:, 1]
fpr_rf_svm, tpr_rf_svm, _ = metrics.roc_curve(labels_svm_test, y_score)
plt.figure(figsize=(10,10))
plt.plot([0, 1], [0, 1], 'k--')
plt.plot(fpr_rf_svm, tpr_rf_svm, label='RF + LR')
plt.xlabel('False positive rate')
plt.ylabel('True positive rate')
plt.title('ROC curve')
plt.show()
SVM model does have the best ROC curve among the 3 types of models we tried.
3.5 Adaboost (Based on Decision Tree)
It seems the more features, the better adaboost will perform. Here we can see when K= 27, we reach optimal.
Accuracy: 1.00
Precision: 0.85
Recall : 0.71
F1 score: 0.77
grid_search.best_estimator_
AdaBoostClassifier(algorithm='SAMME.R',
base_estimator=None,
learning_rate=1.0,
n_estimators=50,
random_state=None)
Logistic Regression
Accuracy: 1.00
Precision: 0.89
Recall : 0.56
F1 score: 0.69
grid_search.best_estimator_
LogisticRegression(C=1.0,
class_weight=None, dual=False, fit_intercept=True,
intercept_scaling=1, max_iter=100,
multi_class='ovr', n_jobs=1,
penalty='l2', random_state=None,
solver='liblinear', tol=0.0001,
verbose=0, warm_start=False)
4. Discussion
Now let’s put together and select the best model and feature list.
| Score Type | Naive Bayes | Decision Tree | SVM | Adaboost | Logistic Regression |
|---|---|---|---|---|---|
| Num of features | 4 | 24 | 23 | 27 | 12 |
| Accuracy | 1 | 1 | 1 | 1 | 1 |
| Precision | 0.57 | 0.86 | 0.89 | 0.85 | 0.89 |
| Recall | 0.58 | 0.76 | 0.77 | 0.71 | 0.56 |
| F1 score | 0.57 | 0.80 | 0.83 | 0.77 | 0.69 |
Recall the ROC curves:
I notice best model for out of sample test here is when K = 21, we use SVM with parameters:
SVC(C=100, cache_size=200, class_weight=None, coef0=0.0, decision_function_shape=None, degree=3, gamma=0.0001, kernel=’rbf’, max_iter=-1, probability=False, random_state=None, shrinking=True, tol=0.001, verbose=False)
The best performance in testing set is:
Precision: 0.841823 Recall: 0.796954 Accuracy: 0.999390 F1 Score: 0.818774
Combined Classifier
How about if I use 3 of the best classifiers here?
Accuracy: 1.00
Precision: 0.89
Recall : 0.77
F1 score: 0.83
Which is actually what we achieved by SVM.
5. Conclusion
In this report I firstly summarize the dataset, use visualization to find out interesting correlations among fraud and other features. Then I train 3 different models, and finally find SVM as my best model and number of features K = 21.
This is a quantative analysis and can only be a reference for commitment. The real procedure of fraud commitment is quite complex.
In future, to improve the accuracy of the model, I think there’re some ways we can try:
- Given more detailed dataset, more features might have risk of overfitting, but more data can possibly provide more informaiton we need
- Given more data with fraud so it will be easier to catch up with more significant predictors.


What is Expat Journal?
What is Expat Journal? It's an amazing way to show off your worldly travels on a more personal basis than other social media sites allow. An Expatriate, or Expat, is an individual who travels outside their home country to live and work in a brand new place, in efforts to engage in a different culture and gain the knowledge that comes with it. As an Expat, you may find yourself faced with ever so many new and exciting experiences, in a plethora of countries to which you travel. How will you store these memories lest they get lost in the cloud? You need a simple, yet detail oriented platform to showcase the countries that have hosted you, and recall not only the visual memories but also your personal stories as you make your way along your cultural journey.  Join thousands of Expatriates today, and discover the beauty of Expat Journal!
John Doe
www.expatjournal.com


http://www.stubbornella.org/content/2011/04/28/our-best-practices-are-killing-us/
Writing CSS is easy, architecting it isn’t.
Separation of structure from skin
Separation of containers and content
As with any object-based coding method, the purpose of OOCSS is to encourage code reuse and, ultimately, faster and more efficient stylesheets that are easier to add to and maintain.
frame·work
noun
a basic structure underlying a system, concept, or text.
@csswizardry Maybe frameworks have gone too far. Look at Bootstrap, it's not a framework, it's
a theme off the shelf.
— Allan Moreno (@heyallanmoreno)
March 13, 2014
@csswizardry bloat/ubiquitous design, usually. I like to start with something smaller first and build
upon it, which is why I made Cardinal.
— Chris Bracco (@cbracco)
March 13, 2014
@csswizardry 1) I need to understand what the author has in mind; 2) Sites are too unique.
—
Margus Holland (@margusholland)
March 13, 2014
@csswizardry Not built in a way that matches the designs I'm working to, not worth the hassle
of unpicking someone elses decisions
— Mark Skinner (@MarkSkinner_)
March 13, 2014
@csswizardry I think it’s because designing a framework under one set of conditions is hard enough;
designing for all is impossible.
— Robin Rendle (@robinrendle)
March 13, 2014
@csswizardry most projects are unique
— Matĳs Brinkhuis (@matijs)
March 13, 2014
@csswizardry they're always far too opinionated, even when they're not.
— Martin
Wright (@wrightmartin)
March 13, 2014
@csswizardry Usually they do so much more than I actually need and there’s a lot of overhead of extra/un-needed
code.
— Val Head (@vlh)
March 13, 2014
@csswizardry Just the thought of having lots of styles that I may not use.
— Martin Bean
(@martinbean)
March 13, 2014
Bits and pieces to construct UI.

DRYness / Abstraction / Efficiency
An all-singing all-dancing UI Toolkit à la Twitter Bootstrap or Foundation.
Scally doesn't try to be all things to all men, it does one job and one job well, then gets out of your way.
Scally was created as an open source CSS framework during my time at Westfield Labs.
It extended and nicely packaged up the CSS framework that I'd been developing and using over many years as a UI developer.
The name…
(Very brief)
bower install scally
app
│
└───assets
│
└───bower_components
│
└───scally
Or download zip from GitHub repo.
Core / Layout / Components / Utilities
Your styles: Core / Components
Scally: Core / Layout / Components / Utilities
style.scss
@charset "UTF-8";
/* ============================================================================
@MASTER STYLESHEET
========================================================================= */
/* Your settings
========================================================================= */
@import "settings";
/* Scally framework
========================================================================= */
/**
* CORE.
*
* N.B. this is all mandatory for the Scally framework.

*/
// Main container
@import "bower_components/scally/layout/l-container";
// Grid
@import "bower_components/scally/layout/l-grid";
@import "bower_components/scally/layout/l-grid-pull";
@import "bower_components/scally/layout/l-grid-push";
// Side-by-side
@import "bower_components/scally/layout/l-side-by-side";
@import "bower_components/scally/layout/l-side-by-side-alt";
/**
* COMPONENTS.
*/
@import "bower_components/scally/components/button";
/**
* UTILITIES.
*/
@import "bower_components/scally/utilities/u-clear-fix";
@import "bower_components/scally/utilities/u-arrow";
@import "bower_components/scally/utilities/u-list";
@import "bower_components/scally/utilities/u-list-block";
@import "bower_components/scally/utilities/u-list-inline";
@import "bower_components/scally/utilities/u-text";
@import "bower_components/scally/utilities/u-widths";
@import "bower_components/scally/utilities/u-table";
@import "bower_components/scally/utilities/u-drop-down";
@import "bower_components/scally/utilities/u-alignments";
@import "bower_components/scally/utilities/u-toggle-visibility";
@import "bower_components/scally/utilities/u-image-replacement";
@import "bower_components/scally/utilities/u-link-complex";
@import "bower_components/scally/utilities/u-link-disguised";
@import "bower_components/scally/utilities/u-link-no-underline";
@import "bower_components/scally/utilities/u-momentum-scrolling";
@import "bower_components/scally/utilities/u-float";
@import "bower_components/scally/utilities/u-new-block-formatting-context";
@import "bower_components/scally/utilities/u-flex-embed";
@import "bower_components/scally/utilities/u-gpu-accelerated";
@import "bower_components/scally/utilities/u-position";
@import "bower_components/scally/utilities/u-display";
@import "bower_components/scally/utilities/u-spacing";
@import "bower_components/scally/utilities/u-divider";
@import "bower_components/scally/utilities/u-columns";
@import "bower_components/scally/utilities/u-overflow";
@import "bower_components/scally/utilities/u-overlay";
@import "bower_components/scally/utilities/u-cursor";
/* Your styles
========================================================================= */
You can completely modify how Scally works without ever having to alter the framework itself. Simply redeclare
the settings you wish to change above the relevant
@import
in the master style sheet e.g.
$font-size: 14;
$font-family-base: Arial, sans-serif;
@import "bower_components/scally/core/settings/typography";
$colour-brand: #2aa198;
@import "bower_components/scally/core/settings/colours";
$text-input-and-select-text-color: $colour-text-base;
@import "bower_components/scally/core/base/forms";
When building responsive UI's it is a really common requirement to apply a style or a set of styles at a specific viewport.
Each Scally utility and layout module comes with this ability.
So if we wanted to hide a Call Us button on larger viewports we would use the Display utility to achieve this, applying these steps…
true
which will output (compile) the utility in a media query like so:
@media (min-width: 40.0625em) {
.u-hide-from-lap {display: none;}
}
lap
breakpoint is used but you can change this to another breakpoint or add more breakpoints above the relevant
@import
in the master stylesheet:
$u-display-breakpoints: (lap, 999);
@import "bower_components/scally/utilities/u-display";
This will output (compile):
@media (min-width: 40.0625em) {
.u-hide-from-lap {display: none;}
}
@media (min-width: 56.3125em) {
.u-hide-from-999 {display: none;}
}
$breakpoints: (
"palm": 640,
"lap": 641,
"lap-large": 901,
"desk": 1200,
"desk-large": 1366
) !default;
style.scss
A medium size UI built with Scally, around 3 weeks of effort.
14kb minified & gzipped (total weight) /
5kb (total weight of custom CSS)
Further reading sections in the Scally documentation:


Climate data available in the Hadley Centre
The contents of this page are Crown Copyright. Data and other
proprietary information contained therein is supplied for bonafide
research purposes. Commercial or business use is not permitted without
the written authority of the U.K. Met. Office.
- AMIP
- Monthly values of SST and sea ice for the period Jan 1979 to Dec
1988. Used in all AMIP model integrations.
- BUNKER
- Monthly Multi-element data for North Atlantic - 1deg x 1deg grid.
- DBDB5
- Digital Bathymetric Data Base - 5 minute grid.
- DCW
- A new and comprehensive 1:1,000,000 vector base map of the world.
- ECMWF
- Monthly and seasonal data - 2deg x 2deg grid.
- EQUILIBRIUM
- Mixed-layer Ocean and Atmosphere Model. Run for 10 years with
1xCO2 in the control run and 2xCO2 in the anomaly run.
- ERBE
- Earth Radiation Budget Experiment data. Feb 1985 to Feb 1990.
- ESBEN_KUSH
- Esbensen & Kushnir multi-element data.
- GISST
- Monthly mean SST and ice coverage from 1948 to 1991. Global cover
- 1deg x 1deg grid.
- HELL_ROSEN
- Hellerman & Rosenstein wind stress, wind power and mixing energy.
- JAEGER
- Precipitation data on 5deg x 5deg grid.
- LEG_WILL
- Legates and Willmott precipitation and temperature climatology.
- LEVITUS
- Ocean potential and in-situ temperatures and salinity.
- MOHMATN
- Meteorological Office Marine Air Temperature (Night) Data.
- MOHSST
- Meteorological Office Sea Surface Temperature Data.
- NDVI
- Normalized Difference Vegitation Index (also known as GISS data).
- NMC_ANALYSIS
- NMC Vertically averaged ocean temperature from surface to 360
metres.
- OA_CLIM
- Met. Office Operational Analysis Archive multi-element data.
- OBERHUBER
- Multi-element data
- OLSON
- World Ecosystem Complexes.
- OORT
- Daily, monthly, seasonal and annual climatologies.
- REGIONAL
- Atmosphere only limited area model, nested within the
EQUIIBRIUM model for the control and anomoly runs.
- SCHUTZ_GATES
- Multi-element seasonal data on 5deg x 4deg grid.
- SCRIPPS
- Land elevations and Ocean depths on 1deg x 1deg grid.
- SHEA
- Monthly, seasonal and annual Climatology on 2.5deg x2.5deg grid.
- SUPERFILEPMSL
- Mean sea level pressure and 500mb height data.
- TRANSIENT
- Coupled ocean/atmosphere model experiment.
- UGAMP
- UK Universities Global Atmospheric Modelling Programme
Multi-element data based on ECMWF analyses.
Andy Brady |<EMAIL_ADDRESS>| Last updated: 28 September 1995 | © Crown Copyright 1995


About two years ago, I had a very interesting experience with Marijuana. It was different, but certainly not enjoyable. Unfortunately because of this experience I have a hard time smoking up without getting a little bit anxious. This experience has manifested into a bad association that has been difficult to shake off.
I was about eighteen at the time, and my friend had invited me to smoke up with her and a couple of her friends. I agreed wholheartledy, seeing that I had smoked a few times before and had some generally good experiences. The person I was with had only smoked one other time before, so naturally she was a bit anxious. I told her it would be alright, even though I was not too familiar with her friends or the person she had gotten her stuff from. (Always make sure you know the person you get your stuff from, I cannot stress that enough!)
After school my friend and I went to her house, and then far off into a wooded area where all the potheads would gather secretly and quietly. When I had arrived, the group consisted of my friend and I, as well as three other guys. Even though I did not know the guys too well, they were nice and seemed to fit in with my kind of crowd. My doubt had vanished when one of them complimented the Beatles t-shirt I had been wearing at the time.
I began casually talking to the group, not really paying attention to the person rolling the blunt. (I am not blaming the person who rolled the blunt, nor am I blaming any of the other people in the group for giving me funny stuff, but I think it would have been better if I was familiar with the dealer this particular herb came from). After a few minutes of waiting one of the guys held up the blunt and grinned, indicating that it was time to smoke up and have fun. I sighed deeply, feeling the same nervous feeling I always felt whenever I smoked weed. It was a feeling that pestered me and first but would always go away within minutes of smoking. I am a small girl, weighing 105 pounds and standing at a whopping height of five feet and two inches, so I figured about five hits would do me good.
After a few minutes, I felt the THC flood into my brain. As usual, my feet went slightly numb and I began to feel that familiar warm sensation in my body. After my body was warm, I began to feel things that were not too familiar, or too pleasant.
As I walked out of the woods the plants around me seemed to mix together; as if I had been walking through a giant green painting. I walked out of the woods and saw the concrete parking lot around me. My vision was hazy and weird, sort of like a TV channel with very poor reception. I had a hard time figuring out exactly where I was, and felt as if I had entered into a lucid dream.
Suddenly, my friend gasps loudly and begins to take offrunning. She yells out 'My dad is here! My dad is here!' So in a frenzy I took off running after her. I suddenly felt as if I had been running in slow motion, with time and the images around me moving at a very slow pace. I could still see the giant green blot of trees next to me along with the sickenly gray concrete. Next thing I knew my friend and I were inside of the bathroom of a nearby restaurant.  I was a bit confused as to how I had gotten into the bathroom; wondering how much time had gone by between the panicked run and now.
I looked over and saw my friend hyperventilating next to me. I asked her to please calm down, feeling as though I was on the verge of freaking out myself. As we walked out of the bathroom, I heard my friend say to me 'I feel as if I'm in a dream, and my alarm clock is about to go off any second.'
I sat in the booth next to one of the guys I had smoked with, and I noticed that it was not just my friend and I who had felt the effects.  Another guy sitting across from me was laughing, commenting on the fact that everyone in the room seemed like a cartoon character.
I grabbed my cell phone and began dialing my friend's number. It took me a few moments to dial the number right, but I felt I really needed to speak to her.
She finally answered the phone and as I began to speak , she knew something was wrong. I told her that I really wanted her to come pick me up and take me home, because I was feeling numb, and this dream-like state of mind was turning quickly into a nightmare. She simply said to me 'Ok, I will be there in a minute.' I hung up my cell phone and looked across the booth. One of the guys looked at me, and I began to hear him talking in my female friend's voice. He was saying that he would give me a ride home, and strangely called me 'baby.' He began calling the guy next to him 'baby'
'What?' I said to him in a disoriented manner. All of these words mashing together in a strangely feminine voice were making me even more anxious. His face looked confused and in his regular masculine voice said 'I wasn't saying anything.'  We wandered around for a few moments, finally arriving at her house which was not too far away. I felt the same slow-motion feeling I felt earlier, seeing more and more incoherent blobs of color as I walked. Thankfully her parents were not home, so we were allowed to relax a little bit.
She had brought some crackers and green tea. I stuck one of the crackers in my mouth and tried to chew.  I sat on the couch feeling completely disconnected from my body.
After about five hours I felt my high come down; I was able to feel all of my body parts again, and I no longer felt as if I had been floating around in a dream. But this feeling of soberness did not last long.
The next day I walked to school, and felt the same high feeling by the time I had reached my school's double doors. I wandered around the halls until I eventually found my classroom, and ended up failing the math test I had to take that morning. I did not understand the math problems, and I had accidentally written off the paper and onto the desk a few times. Naturally, I got about a 15% on the test. I found my friend who I had smoked with, and saw my handwriting all over her binder. Apparently I had written some incoherent words on her binder with a pen, and did not remember doing it.
I am not sure what it was I smoked that day, but I know for a fact it was not just straight herb. When I tell people this story many of them say it was most likely PCP. I cant be 100% sure since I have never done PCP. All I know is that it is not something I would like to experience again.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


{{- partial "header.html" . -}} {{.Content}} This is the index.md file in the Hugo Three layouts folder.


The tradition of protests that demand progressive change in the United States continues.
Here are the country's top five protests in terms of attendance
class='center'>I'm baby church-key migas VHS, celiac lo-fi stumptown selvage prism four loko mumblecore tote bag pour-over. Meditation waistcoat thundercats forage beard. 90's scenester mixtape single-origin coffee hella. Whatever raw denim retro bitters, mustache 3 wolf moon beard skateboard austin artisan flexitarian plaid. Health goth PBR&B pinterest hexagon, cliche pabst trust fund occupy YOLO cred retro.
class='center'>Pok pok gochujang DIY slow-carb copper mug subway tile. Succulents austin tumblr VHS chia, next level yr coloring book squid intelligentsia XOXO vegan microdosing. Chia listicle deep v shaman next level, cornhole small batch poke bicycle rights keytar coloring book taiyaki literally slow-carb readymade. Meditation mumblecore selvage jean shorts godard viral jianbing narwhal activated charcoal lo-fi tattooed prism pug.
class='center'>Post-ironic four dollar toast art party, vice cray skateboard live-edge ramps. Tattooed skateboard venmo gochujang activated charcoal woke gentrify flexitarian schlitz chicharrones small batch offal mustache farm-to-table YOLO. Prism chicharrones coloring book readymade vaporware wolf flexitarian mustache salvia chia adaptogen etsy tumeric. Cold-pressed everyday carry distillery sustainable, cliche hoodie enamel pin. Dreamcatcher lyft swag pop-up bicycle rights.
-
George Floyd protests nationwide in 2020 with an estimated 26 million protestors.
-
Women's March in 2017 drew about 5.6 million people nationwide.
-
March for Our Lives, a student led protest in 2018 against gun violence, drew about 2 million people.
-
Women's March in 2018 drew about 1.5 million protestors.
-
March on Washington for Lesbian, Gay and Bi Equal Rights and Liberation drew about 1 million people in 1993.
Compiled from Wikipedia


 We're proud to offer one of the best facilities in the Midwest for strength athletes, but we're about providing the atmosphere, encouragement, and community to help you succeed whatever your goals are.
New to gyms and lifting? We have a variety of personal trainers available and free weekly classes to instruct you and keep you motivated. We love newbies!


[
Home
]
Developing With Oddjob
Version: @version@
Author: Rob Gordon
Contents
Building Oddjob
Build Systems
Source Code
Full Build
Embedding Oddjob
A Simple Example
Looking Up Beans
Cleaning Up
Custom Jobs
Hello World
Hello Rod, Jane and Freddy
A Developers Dozen
More on Jobs
Completion States
Stopping
Logging
Services
Serialization
Other Not Yet Documented
Annotations
Overview
Supported Annotations
Example
The Descriptor
Overview
Example
Introducing Arooa
Introduction
Components
Property Injection
Values
Dependency Injection and JSR 330
Introduction
The Services Job
Modularity and Oddballs
The Class System
The Descriptor Factory
Dynamic Design
Per Oddjob Modularity
Oddballs
Arooa Exposed
Introduction
Parsers
Beans
XML
Arooa Life
Being Session Aware
The Lifecycle of a Component
Depending On Oddjob
Introduction
The Interfaces
Extension Points
Oddjob Oddments
Bean Bus Development
Oddjob Related Projects
(c) R Gordon Ltd 2005 - Present


En Route
My passport was literally delivered to Emily and Morgan’s (my friends in LA) apartment yesterday. If you know me, that probably isn’t surprising. I ran into a bunch of passport issues a month before my trip but it made it just in time! So far I haven’t lost anything.
The last two weeks have gone by so fast. I finished finals, visited friends in Santa Barbara, San Luis Obispo, Los Angeles, and my home in San Diego. Two weeks between school and my trip didn’t feel like enough time, but now I am so excited to be on my way. I have a short layover in seattle, and then a 17 hour flight to Singapore with a stop in Tokyo. When I arrive in Singapore, I will wait a few hours until my next flight to Thailand!
Packing and Planning
On Saturday night, my friend Sarah told me she would be in Koh Phi Phi for a few days before I am leave for Australia. So, I found a plane ticket for the earliest possible flight to Krabi, Thailand, and from there I will take a ferry to Koh Phi Phi. Thailand is one of the places I want to go to the most, so I am stoked I get to so early in my trip! I definitely want to see Bangkok another time this summer. Plus, the fact that I am seeing a familiar face when I get there is making everything a lot less intimidating. Convienently, there was a problem with the payment for my flights to Australia, so all of the flights were booked except from Singapore to Australia. This ended up being perfect because now I am flying directly to Australia from Thailand.
Originally I was going to bring all of this to Singapore. Thank god I came to my senses. I went through all my stuff on my second to last night and decided to leave behind everything in and around the duffel bag on the left.
I still ended up checking my suitcase. When I got on the plane it wouldn’t fit in the overhead bin (lol oops). Thankfully the flight attendents were extremely nice and accomodating. They even helped me try to rearrange some things in my bag to see if it would fit. It was a pleasant experience and it’s easier to check it anyway.
Last Nights
On my second to last night in San Diego I went out in North Park with Thomy and Anthony, two of my best friends from my hometown. When we got home we stayed up until four in the morning reminiscing about all the funny things we did together in high shool.
The next night me and my dad walked and talked on the beach and later I cuddled and ate take out olive garden with my mom and sister.
Last night I had more sleepover talk with Morgan, Emily, Jules, Josh, Nate, and Sean in LA :). We got take out sushi and a delicious breakfast delivered (brownie, pancakes, eggs, potatoes, toast, granola with fresh fruit and yogurt). Breakfast is my favorite meal. I so enjoyed visiting with all of them and they made me even more excited for my trip! I was so happy to be with everyone that I got a little sad because I would miss them, but it was sad happy because I am just thankful that I have so many people I love enough to miss :) It was the perfect way to spend my last nights :heart_eyes_cat:


Weber embraces modern grilling with a WiFi-enabled pellet model
With help from June, the smart oven company.
by Billy SteeleWiFi-enabled pellet grills are having a moment, and rightfully so. They allow you to control and monitor your grill from afar, which is very convenient, especially you're smoking a piece of meat for eight hours or more. Several companies have already jumped on the bandwagon, with Traeger, Rec-Tec, Green Mountain Grills and others all offering models with built-in connectivity. Until now, one of the biggest names in backyard grilling had yet to do the same: Weber. Today, the company is changing that with the introduction of its SmokeFire grills.
Gallery: Weber SmokeFire grills | 10 Photos
While the overall barrel shape is similar to other grills, there are some notable design differences with Weber's new gear. First, the outside is coated in the company's iconic porcelain enamel. The material helps prevent rust and cracking, which is a nice touch, even if you're planning to keep the grill covered when it isn't in use. It's also the same coating that wraps Weber's popular Kettle charcoal lineup and several of its other models.
Next, the pellet hopper is around back. It's a narrow channel that runs along the rear of the grill, instead of a rectangular container on one side. The company says it still holds a full bag of pellets, which typically come in 20-pound packages. Thanks to that location, Weber reduced the length of the auger, or the channel that feeds pellets to the fire pot. It also implemented a gravity-fed setup. The company says the pellet feeding system not only reduces the chances of a jam, but also expedites the pre-heating process.
Instead of a single metal sheet or solid panel that protects the fire pot from grease, Weber is using its "Flavorizer" bars from its gas grills on the SmokeFire models. The company says this design creates even heat distribution and channels grease and other liquids straight into the drip tray. It also promises that the combination of the bars and the slide-out tray make cleanup easier than other pellet grills. I use a pellet grill a few times a month, and cleaning them is a real pain, so I look forward to putting this to the test.
The system that powers the SmokeFire grills is called the "Responsive-Inline-Drive Engine," which Weber says "heats hot and fast." It's capable of temperatures up to 600 degrees Fahrenheit, so you can use it for low-and-slow smoking or for searing steaks over high heat. For comparison, Traeger's WiFi pellet grills offer temperatures up to 500 degrees Fahrenheit. Similar to Traeger's Super Smoke mode, Weber plans to add a Smoke Boost option that will make the pellets "smoke and smolder" at temperatures between 165 and 200 degrees. The idea is the same: a specific mode that infuses more wood smoke flavor into your food. Smoke Boost will be available to use at the beginning of a cook "shortly after launch."
These grills require an app to help you control things, and in this case it's called Weber Connect. The app also guides you through the grilling process, and it's powered by JuneOS. That's the cooking software from June, a company that makes connected smart ovens. The app walks you through things like setup and prep, in addition to sending food doneness alerts and calculating an estimated finishing time. That ETA feature predicts a time based on food temperature readings from meat probes and "integrated grill measurement systems." Weber has done the app-assisted cooking thing before with its iGrill devices, but those are Bluetooth, and they basically just monitor temperature/doneness. The SmokeFire grills also allow you to use up to four food probes at once. A lot of the competition is just equipped with one.
If you want to put one of these in your backyard, you'll have to wait. The SmokeFire grills won't be available until early 2020. Pre-orders will be available on Cyber Monday at Amazon, Lowe's and directly from Weber's website. The SmokeFire grills come in two sizes, 24 and 36 inches, and they're priced at $1,149.99 and $1,399.99 respectively.


Offline Simulate UI is an Offline.js
plug-in that allows you to test how your pages respond to different connectivity
states without having to use brute-force methods to disable your actual connectivity.
Try it out: Click on the checkbox on the left and see how the page responds. Notice that this page uses the Offline.js Chrome theme which you can see at the top of the page.
When you include offline-simulate-ui.min.js
on your page the following configuration settings
are applied:
reconnect
option is set to false
. This is done so that the simulation
is successful. If you leave the reconnection option on then simulations are immediately overridden by
subsequent checks for connectivity.markDown
or markUp
methods
(which ever is appropriate) and then your scripts can listen for the need events to have your page
respond accordingly.You can optionally add the attribute data-force-fail="true"
to make all
checks fail without having to check the checkbox. This way if you have Ajax requests happening in the
background you can ensure they will fail so you can see how your users will experience the
site when it's offline.
Add the script to your page:
<script src="offline-simulate-ui.min.js"></script>
<script data-force-fail="false" src="offline-simulate-ui.min.js"></script>
Respond to Offline.js events:
<script> $(function(){ var $online = $('.online'), $offline = $('.offline'); Offline.on('confirmed-down', function () { $online.fadeOut(function () { $offline.fadeIn(); }); }); Offline.on('confirmed-up', function () { $offline.fadeOut(function () { $online.fadeIn(); }); }); }); </script>


Price:$ Rating:4.5
Wanna Eat Here?
Location: 2528 S Figueroa St
Information
Price:$$ Rating:4.5
Location: 3470 W 6th St


1)
Janet likes the blue skirt. Janet wants her mother to buy it for
.
her
2)
Carol found this Maths sum difficult. Can
help her?
you
3)
Mat and Dan are doing their homework. Do not disturb
.
them
4)
That is a lovely picture! Please put
up on the wall.
it
5)
Uncle Alan lives in Canada. I will visit
during my holidays.
him
6)
My parents and I are going to the beach on Saturday. Would you like to come
with
?
us
7)
That snake is poisonous. Please do not go near
.
it
8)
Can you get
a glass of water?
me


Explore and Eat
The perfect app for avid foodies, Foodie Fun is built for those who love going out to explore new eats. It's designed for you to find new adventures and to share them with others. Did I like the burrito or enchilada better? The spicy version or normal?
How It Works
Download the app and use the easy-to-use filters and actins to log where you've eaten, what you ordered, what you liked and didn’t like, what the wait time was at certain times of day, etc.


Emmanuel DEMEY
Developer Advocate à Zenika Lille
@EmmanuelDemey
Emmanuel DEMEY
Developer Advocate à Zenika Lille
@EmmanuelDemey
Aurélien LOYER
Software Engineer chez QIMA
@AurelienLoyer
Piper
CiTC
Critique
Codesearch
Tricorder
Presubmit
TAP
Rosie
| 2015 - Blaze → Bazel |
| Build and test software of any size, quickly and reliably. |
function sum( a:number, b: number): number {
return a + b;
}
const result = sum(1 + 2);
function sum( a:number, b: number): number {
return a + b;
}
function mult( a:number, factor: number): number {
return a * factor;
}
const result = mult( sum(1, 2), 3);
bazel query "deps(//packages/core:core)" --output=graph | dot -Tpng > graph.png
npm run ng add @angular/bazel
| Il faut voir Bazel comme un orchestrateur, et non comme un nouvel outil de build à apprendre |
Android
C / C++
C#
Docker
Go
Groovy
Kotlin
iOS
Java
Javascript
Perl
Python
Ruby
Rust
Sass
Shell
Typescript
…
def fizz_buzz(n):
"""Print Fizz Buzz numbers from 1 to n."""
for i in range(1, n + 1):
s = ""
if i % 3 == 0:
s += "Fizz"
if i % 5 == 0:
s += "Buzz"
print(s if s else i)
fizz_buzz(20)
// WORKSPACE
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "1249a60f88e4c0a46d78de06be04d3d41e7421dcfa0c956de65309a7b7ecf6f4",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.38.0/rules_nodejs-0.38.0.tar.gz"],
)
// BUILD.bazel
ts_library(
srcs = [ "..." ],
deps = [ "..." ],
)
// BUILD.bazel
rollup_bundle(
name = "bundle",
srcs = [ "..." ],
deps = [ "..." ],
)
Un label correspond à
un fichier
une target
//gcp/finance:front
//gcp/finance
//gcp/finance:all
//gcp/…
Si je suis dans le répertoire gcp
:all == //gcp:all
finance:front == //gcp/finance:front
// //library/BUILD.bazel
ts_library(
name = "library",
srcs = glob(["*.ts"]),
deps = [ "@npm//@types/react" ],
)
// //library/BUILD.bazel
ts_library(
name = "library",
srcs = glob(["*.ts"]),
deps = [ "@npm//@types/react" ],
)
// //BUILD.bazel
ts_library(
name = "app",
srcs = glob(["*.ts"]),
deps = [ "//library", "@npm//@types/react" ],
)
// //:rules.bzl
def compile(name, **kwargs):
ts_library(
name = name,
srcs = glob(["*.ts"]),
**kwargs
)
load("//:rules.bzl", "compile")
compile(
name = "library",
deps = [ "@npm//@types/react" ]
)
def ts_binary_impl(ctx):
files = list(get_transitive_files(ctx))
output = ctx.outputs.out
flags = ' '.join(ctx.attr.flags)
ctx.action(
inputs=files,
outputs=[output],
command="tsc %s --out %s %s" % (
flags, output.path, ' '.join([f.path for f in files])))
ts_binary = rule(
implementation = ts_binary_impl,
attrs = {
"srcs": attr.label_list(allow_files=ts_filetype),
"deps": attr.label_list(allow_files=False),
"flags": attr.string_list(),
},
outputs = {"out": "%{name}.js"},
)]
"""Used for compilation by the different implementations of build_defs.bzl.
"""
load(":common/json_marshal.bzl", "json_marshal")
load(":common/module_mappings.bzl", "module_mappings_aspect")
load("@build_bazel_rules_nodejs//:declaration_provider.bzl", "DeclarationInfo")
_DEBUG = False
DEPS_ASPECTS = [
module_mappings_aspect,
]
_ADDITIONAL_D_TS = attr.label_list(
allow_files = True,
)
# Attributes shared by any typescript-compatible rule (ts_library, ng_module)
COMMON_ATTRIBUTES = {
"data": attr.label_list(
default = [],
allow_files = True,
),
# A list of diagnostics expected when compiling this library, in the form of
# "diagnostic:regexp", e.g. "TS1234:failed to quizzle the .* wobble".
# Useful to test for expected compilation errors.
"expected_diagnostics": attr.string_list(),
# Whether to generate externs.js from any "declare" statement.
"generate_externs": attr.bool(default = True),
# Used to determine module mappings
"module_name": attr.string(),
"module_root": attr.string(),
# TODO(evanm): make this the default and remove the option.
"runtime": attr.string(default = "browser"),
# TODO(radokirov): remove this attr when clutz is stable enough to consume
# any closure JS code.
"runtime_deps": attr.label_list(
default = [],
providers = ["js"],
),
"deps": attr.label_list(aspects = DEPS_ASPECTS),
"_additional_d_ts": _ADDITIONAL_D_TS,
}
# Attributes shared by any typescript-compatible aspect.
ASPECT_ATTRIBUTES = {
"_additional_d_ts": _ADDITIONAL_D_TS,
}
COMMON_OUTPUTS = {
# Allow the tsconfig.json to be generated without running compile actions.
"tsconfig": "%{name}_tsconfig.json",
}
# TODO(plf): Enforce this at analysis time.
def assert_js_or_typescript_deps(ctx, deps = None):
# `deps` args is optinal for backward compat.
# Fallback to `ctx.attr.deps`.
deps = deps if deps != None else ctx.attr.deps
for dep in deps:
if not hasattr(dep, "typescript") and not hasattr(dep, "js"):
allowed_deps_msg = "Dependencies must be ts_library"
fail("%s is neither a TypeScript nor a JS producing rule.\n%s\n" % (dep.label, allowed_deps_msg))
_DEPSET_TYPE = type(depset())
def _check_ts_provider(dep):
"""Verifies the type shape of the typescript provider in dep, if it has one.
"""
# Under Bazel, some third parties have created typescript providers which may not be compatible.
# Rather than users getting an obscure error later, explicitly check them and point to the
# target that created the bad provider.
# TODO(alexeagle): remove this after some transition period, maybe mid-2019
if hasattr(dep, "typescript"):
if type(dep.typescript.declarations) != _DEPSET_TYPE:
fail("typescript provider in %s defined declarations as a %s rather than a depset" % (
dep.label,
type(dep.typescript.declarations),
))
if type(dep.typescript.transitive_declarations) != _DEPSET_TYPE:
fail("typescript provider in %s defined transitive_declarations as a %s rather than a depset" % (
dep.label,
type(dep.typescript.transitive_declarations),
))
if type(dep.typescript.type_blacklisted_declarations) != _DEPSET_TYPE:
fail("typescript provider in %s defined type_blacklisted_declarations as a %s rather than a depset" % (
dep.label,
type(dep.typescript.type_blacklisted_declarations),
))
return dep
def _collect_dep_declarations(ctx, deps):
"""Collects .d.ts files from typescript and javascript dependencies.
Args:
ctx: ctx.
deps: dependent targets, generally ctx.attr.deps
Returns:
A struct of depsets for direct, transitive and type-blacklisted declarations.
"""
deps_and_helpers = [
_check_ts_provider(dep)
for dep in deps + getattr(ctx.attr, "_helpers", [])
if hasattr(dep, "typescript")
]
# .d.ts files from direct dependencies, ok for strict deps
direct_deps_declarations = [dep.typescript.declarations for dep in deps_and_helpers]
# all reachable .d.ts files from dependencies.
transitive_deps_declarations = [
dep.typescript.transitive_declarations
for dep in deps_and_helpers
]
# all reachable .d.ts files from node_modules attribute (if it has a typescript provider)
if hasattr(ctx.attr, "node_modules") and hasattr(ctx.attr.node_modules, "typescript"):
transitive_deps_declarations += [ctx.attr.node_modules.typescript.transitive_declarations]
# .d.ts files whose types tsickle will not emit (used for ts_declaration(generate_externs=False).
type_blacklisted_declarations = [
dep.typescript.type_blacklisted_declarations
for dep in deps_and_helpers
]
# If a tool like github.com/angular/clutz can create .d.ts from type annotated .js
# its output will be collected here.
return struct(
direct = depset(transitive = direct_deps_declarations),
transitive = depset(
[extra for extra in ctx.files._additional_d_ts],
transitive = transitive_deps_declarations,
),
type_blacklisted = depset(transitive = type_blacklisted_declarations),
)
def _should_generate_externs(ctx):
"""Whether externs should be generated.
If ctx has a generate_externs attribute, the value of that is returned.
Otherwise, this is true."""
return getattr(ctx.attr, "generate_externs", True)
def _get_runtime(ctx):
"""Gets the runtime for the rule.
Defaults to "browser" if the runtime attr isn't present."""
return getattr(ctx.attr, "runtime", "browser")
def _outputs(ctx, label, srcs_files = []):
"""Returns closure js, devmode js, and .d.ts output files.
Args:
ctx: ctx.
label: Label. package label.
srcs_files: File list. sources files list.
Returns:
A struct of file lists for different output types.
"""
workspace_segments = label.workspace_root.split("/") if label.workspace_root else []
package_segments = label.package.split("/") if label.package else []
trim = len(workspace_segments) + len(package_segments)
create_shim_files = False
closure_js_files = []
devmode_js_files = []
declaration_files = []
for input_file in srcs_files:
is_dts = input_file.short_path.endswith(".d.ts")
if is_dts and not create_shim_files:
continue
basename = "/".join(input_file.short_path.split("/")[trim:])
for ext in [".d.ts", ".tsx", ".ts"]:
if basename.endswith(ext):
basename = basename[:-len(ext)]
break
closure_js_files += [ctx.actions.declare_file(basename + ".mjs")]
# Temporary until all imports of ngfactory/ngsummary files are removed
# TODO(alexeagle): clean up after Ivy launch
if getattr(ctx, "compile_angular_templates", False):
closure_js_files += [ctx.actions.declare_file(basename + ".ngfactory.mjs")]
closure_js_files += [ctx.actions.declare_file(basename + ".ngsummary.mjs")]
if not is_dts:
devmode_js_files += [ctx.actions.declare_file(basename + ".js")]
declaration_files += [ctx.actions.declare_file(basename + ".d.ts")]
# Temporary until all imports of ngfactory/ngsummary files are removed
# TODO(alexeagle): clean up after Ivy launch
if getattr(ctx, "compile_angular_templates", False):
devmode_js_files += [ctx.actions.declare_file(basename + ".ngfactory.js")]
devmode_js_files += [ctx.actions.declare_file(basename + ".ngsummary.js")]
return struct(
closure_js = closure_js_files,
devmode_js = devmode_js_files,
declarations = declaration_files,
)
def compile_ts(
ctx,
is_library,
srcs = None,
deps = None,
compile_action = None,
devmode_compile_action = None,
jsx_factory = None,
tsc_wrapped_tsconfig = None,
tsconfig = None,
outputs = _outputs):
"""Creates actions to compile TypeScript code.
This rule is shared between ts_library and ts_declaration.
Args:
ctx: ctx.
is_library: boolean. False if only compiling .dts files.
srcs: label list. Explicit list of sources to be used instead of ctx.attr.srcs.
deps: label list. Explicit list of deps to be used instead of ctx.attr.deps.
compile_action: function. Creates the compilation action.
devmode_compile_action: function. Creates the compilation action
for devmode.
jsx_factory: optional string. Enables overriding jsx pragma.
tsc_wrapped_tsconfig: function that produces a tsconfig object.
tsconfig: The tsconfig file to output, if other than ctx.outputs.tsconfig.
outputs: function from a ctx to the expected compilation outputs.
Returns:
struct that will be returned by the rule implementation.
"""
### Collect srcs and outputs.
srcs = srcs if srcs != None else ctx.attr.srcs
deps = deps if deps != None else ctx.attr.deps
tsconfig = tsconfig if tsconfig != None else ctx.outputs.tsconfig
srcs_files = [f for t in srcs for f in t.files.to_list()]
src_declarations = [] # d.ts found in inputs.
tsickle_externs = [] # externs.js generated by tsickle, if any.
has_sources = False
# Validate the user inputs.
assert_js_or_typescript_deps(ctx, deps)
for src in srcs:
if src.label.package != ctx.label.package:
# Sources can be in sub-folders, but not in sub-packages.
fail("Sources must be in the same package as the ts_library rule, " +
"but %s is not in %s" % (src.label, ctx.label.package), "srcs")
if hasattr(src, "typescript"):
# Guard against users accidentally putting deps into srcs by
# rejecting all srcs values that have a TypeScript provider.
# TS rules produce a ".d.ts" file, which is a valid input in "srcs",
# and will then be compiled as a source .d.ts file would, creating
# externs etc.
fail(
"must not reference any TypeScript rules - did you mean deps?",
"srcs",
)
for f in src.files.to_list():
has_sources = True
if not is_library and not f.path.endswith(".d.ts"):
fail("srcs must contain only type declarations (.d.ts files), " +
"but %s contains %s" % (src.label, f.short_path), "srcs")
if f.path.endswith(".d.ts"):
src_declarations += [f]
continue
outs = outputs(ctx, ctx.label, srcs_files)
transpiled_closure_js = outs.closure_js
transpiled_devmode_js = outs.devmode_js
gen_declarations = outs.declarations
if has_sources and _get_runtime(ctx) != "nodejs":
# Note: setting this variable controls whether tsickle is run at all.
tsickle_externs = [ctx.actions.declare_file(ctx.label.name + ".externs.js")]
dep_declarations = _collect_dep_declarations(ctx, deps)
input_declarations = depset(src_declarations, transitive = [dep_declarations.transitive])
type_blacklisted_declarations = dep_declarations.type_blacklisted
if not is_library and not _should_generate_externs(ctx):
type_blacklisted_declarations += srcs_files
# The depsets of output files. These are the files that are always built
# (including e.g. if you "blaze build :the_target" directly).
files_depsets = []
# A manifest listing the order of this rule's *.ts files (non-transitive)
# Only generated if the rule has any sources.
devmode_manifest = None
# Enable to produce a performance trace when compiling TypeScript to JS.
# The trace file location will be printed as a build result and can be read
# in Chrome's chrome://tracing/ UI.
perf_trace = _DEBUG
if "TYPESCRIPT_PERF_TRACE_TARGET" in ctx.var:
perf_trace = str(ctx.label) == ctx.var["TYPESCRIPT_PERF_TRACE_TARGET"]
compilation_inputs = dep_declarations.transitive.to_list() + srcs_files
tsickle_externs_path = tsickle_externs[0] if tsickle_externs else None
# Calculate allowed dependencies for strict deps enforcement.
allowed_deps = depset(
# A target's sources may depend on each other,
srcs_files,
# or on a .d.ts from a direct dependency
transitive = [dep_declarations.direct],
)
tsconfig_es6 = tsc_wrapped_tsconfig(
ctx,
compilation_inputs,
srcs_files,
jsx_factory = jsx_factory,
tsickle_externs = tsickle_externs_path,
type_blacklisted_declarations = type_blacklisted_declarations.to_list(),
allowed_deps = allowed_deps,
)
# Do not produce declarations in ES6 mode, tsickle cannot produce correct
# .d.ts (or even errors) from the altered Closure-style JS emit.
tsconfig_es6["compilerOptions"]["declaration"] = False
tsconfig_es6["compilerOptions"].pop("declarationDir")
outputs = transpiled_closure_js + tsickle_externs
node_profile_args = []
if perf_trace and has_sources:
perf_trace_file = ctx.actions.declare_file(ctx.label.name + ".es6.trace")
tsconfig_es6["bazelOptions"]["perfTracePath"] = perf_trace_file.path
outputs.append(perf_trace_file)
profile_file = ctx.actions.declare_file(ctx.label.name + ".es6.v8.log")
node_profile_args = [
"--prof",
# Without nologfile_per_isolate, v8 embeds an
# unpredictable hash code in the file name, which
# doesn't work with blaze.
"--nologfile_per_isolate",
"--logfile=" + profile_file.path,
]
outputs.append(profile_file)
files_depsets.append(depset([perf_trace_file, profile_file]))
ctx.actions.write(
output = tsconfig,
content = json_marshal(tsconfig_es6),
)
# Parameters of this compiler invocation in case we need to replay this with different
# settings.
replay_params = None
if has_sources:
inputs = compilation_inputs + [tsconfig]
replay_params = compile_action(
ctx,
inputs,
outputs,
tsconfig,
node_profile_args,
)
devmode_manifest = ctx.actions.declare_file(ctx.label.name + ".es5.MF")
tsconfig_json_es5 = ctx.actions.declare_file(ctx.label.name + "_es5_tsconfig.json")
outputs = (
transpiled_devmode_js + gen_declarations + [devmode_manifest]
)
tsconfig_es5 = tsc_wrapped_tsconfig(
ctx,
compilation_inputs,
srcs_files,
jsx_factory = jsx_factory,
devmode_manifest = devmode_manifest.path,
allowed_deps = allowed_deps,
)
node_profile_args = []
if perf_trace:
perf_trace_file = ctx.actions.declare_file(ctx.label.name + ".es5.trace")
tsconfig_es5["bazelOptions"]["perfTracePath"] = perf_trace_file.path
outputs.append(perf_trace_file)
profile_file = ctx.actions.declare_file(ctx.label.name + ".es5.v8.log")
node_profile_args = [
"--prof",
# Without nologfile_per_isolate, v8 embeds an
# unpredictable hash code in the file name, which
# doesn't work with blaze.
"--nologfile_per_isolate",
"--logfile=" + profile_file.path,
]
outputs.append(profile_file)
files_depsets.append(depset([perf_trace_file, profile_file]))
ctx.actions.write(output = tsconfig_json_es5, content = json_marshal(
tsconfig_es5,
))
devmode_compile_action(
ctx,
compilation_inputs + [tsconfig_json_es5],
outputs,
tsconfig_json_es5,
node_profile_args,
)
# TODO(martinprobst): Merge the generated .d.ts files, and enforce strict
# deps (do not re-export transitive types from the transitive closure).
transitive_decls = depset(src_declarations + gen_declarations, transitive = [dep_declarations.transitive])
# both ts_library and ts_declarations generate .mjs files:
# - for libraries, this is the ES6/production code
# - for declarations, these are generated shims
es6_sources = depset(transpiled_closure_js + tsickle_externs)
if is_library:
es5_sources = depset(transpiled_devmode_js)
else:
# In development mode, no code ever references shims as they only
# contain types, and the ES5 code does not get type annotated.
es5_sources = depset(tsickle_externs)
# Similarly, in devmode these sources do not get loaded, so do not need
# to be in a manifest.
devmode_manifest = None
# Downstream rules see the .d.ts files produced or declared by this rule.
declarations_depsets = [depset(gen_declarations + src_declarations)]
if not srcs_files:
# Re-export sources from deps.
# TODO(b/30018387): introduce an "exports" attribute.
for dep in deps:
if hasattr(dep, "typescript"):
declarations_depsets.append(dep.typescript.declarations)
files_depsets.extend(declarations_depsets)
# If this is a ts_declaration, add tsickle_externs to the outputs list to
# force compilation of d.ts files. (tsickle externs are produced by running a
# compilation over the d.ts file and extracting type information.)
if not is_library:
files_depsets.append(depset(tsickle_externs))
transitive_es6_sources = depset()
for dep in deps:
if hasattr(dep, "typescript"):
transitive_es6_sources = depset(transitive = [
transitive_es6_sources,
dep.typescript.transitive_es6_sources,
])
transitive_es6_sources = depset(transitive = [transitive_es6_sources, es6_sources])
return {
"providers": [
DefaultInfo(
runfiles = ctx.runfiles(
# Note: don't include files=... here, or they will *always* be built
# by any dependent rule, regardless of whether it needs them.
# But these attributes are needed to pass along any input runfiles:
collect_default = True,
collect_data = True,
),
files = depset(transitive = files_depsets),
),
OutputGroupInfo(
es5_sources = es5_sources,
es6_sources = es6_sources,
),
# TODO(martinprobst): Prune transitive deps, see go/dtspruning
DeclarationInfo(
declarations = depset(transitive = declarations_depsets),
transitive_declarations = transitive_decls,
),
],
"instrumented_files": {
"dependency_attributes": ["deps", "runtime_deps"],
"extensions": ["ts"],
"source_attributes": ["srcs"],
},
# Expose the module_name so that packaging rules can access it.
# e.g. rollup_bundle under Bazel needs to convert this into a UMD global
# name in the Rollup configuration.
"module_name": getattr(ctx.attr, "module_name", None),
# Expose the tags so that a Skylark aspect can access them.
"tags": ctx.attr.tags if hasattr(ctx.attr, "tags") else ctx.rule.attr.tags,
"typescript": {
# TODO(b/139705078): remove when consumers migrated to DeclarationInfo
"declarations": depset(transitive = declarations_depsets),
"devmode_manifest": devmode_manifest,
"es5_sources": es5_sources,
"es6_sources": es6_sources,
"replay_params": replay_params,
# TODO(b/139705078): remove when consumers migrated to DeclarationInfo
"transitive_declarations": transitive_decls,
"transitive_es6_sources": transitive_es6_sources,
"tsickle_externs": tsickle_externs,
"type_blacklisted_declarations": type_blacklisted_declarations,
},
}
# Converts a dict to a struct, recursing into a single level of nested dicts.
# This allows users of compile_ts to modify or augment the returned dict before
# converting it to an immutable struct.
def ts_providers_dict_to_struct(d):
for key, value in d.items():
if key != "output_groups" and type(value) == type({}):
d[key] = struct(**value)
return struct(**d)
@EmmanuelDemey | @AurelienLoyer
@bazelbuild @EmmanuelDemey @AurelienLoyer


Editor.md examples
Full example
Use Require.js example
Use Seajs example
ToC (Table of Contents) example
TeX (based on KaTeX)
onload event handle example
onchange event handle example
onfullscreen / onfullscreenExit event handle example
flowChart example
Sequence Diagram example
Markdown to HTML for preview


Accidentally Using the Assignment Operator
Expecting Loose Comparison
Hello
Confusing Addition & Concatenation
Misunderstanding Floats
Misplacing Semicolon
Hello


Recognizing different currencies from different countries and their respective denominations with an authenticity checking if an Indian currency note is fake or real.
Check it outCellular planning of AMPS (1G) mobile system for Delhi using MATLAB, calculating cluster size, number of clusters according to a realistic samples of demographic data (Population of different Zones in Delhi, Area of each zone)
Check it outPython script to read table from HTML, filter and save it on a csv and run selenium browser tests in different platforms and different tools as mentioned above
Check it outThis project has a jenkins groovy pipeline to deploy a Maven WebApp running on a Tomcat server within a Docker container. I've used AWS ECR to store my custom tomcat image, ECS cluster along with FARGATE service to host the service.
Check it out


Speed slider (change the value & click on canvas to create a new ball):
Using an existing Canvas (click within black borders)
Using a div container (click within blue borders)


The Device Detection Management page(Host > Device Detection Management) allows SuperUsers to search for and view relevant properties for a wide range of mobile devices.
Prerequisite. DNN Platform users who want to upgrade from the Lite device data plan to the Premium plan can obtain their license from the DNNStore and then activate their license here.
Prerequisite. DNN Platform users who want to upgrade from the Lite device data plan to the Premium plan can obtain their licence from the DNNStore and then activate their licence here.
The Device Detection page with Premium Data


title: ECMAScript class static initialization blocks
stage: 3
contributors: Ron Buckton, Ecma International
Introduction
ECMAScript Data Types and Values
Abstract Operations
Syntax-Directed Operations
In addition to those defined in this section, specialized syntax-directed operations are defined throughout this specification.
Scope Analysis
Labels
Contains
Miscellaneous
These operations are used in multiple places throughout the specification.
Ordinary and Exotic Objects Behaviours
ECMAScript Function Objects
[[Call]] ( _thisArgument_, _argumentsList_ )
ECMAScript Language: Statements and Declarations
The `continue` Statement
The `break` Statement
ECMAScript Language: Functions and Classes


Automation
Env 1
Start a new Request
View Existing or Past Requestd
Please Provide the below details and Click on Continue:
Request Date:
Request Reference Number:
Continue...


SIGN IN
TO UIFLO
Email
Password
Sign in
Forgot your password?
New to UiFLO?
Sign up
SIGN UP
TO UIFLO
Full name
Email
Password
Confirm password
Sign Up
Already have an account?
Sign in