cartoframes.core module¶
cartoframe methods¶
A pandas dataframe interface for working with CARTO maps and tables.
Andy Eschbacher and Stuart Lynn, 2017
- Project goals
- Interact with a CARTO table fully within a Jupyter notebook/pandas workflow (read and sync dataframe changes)
- Like geopandas, have a .carto_map() method which gives back the data as a map using carto’s maps api and TurboCartoCSS on an optional attribute
- Add CARTO services like the Data Observatory as methods to a dataframe
Features to add: see issues in the repository https://github.com/CartoDB/cartoframes/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement
-
cartoframes.core.
carto_create
(self, username, api_key, tablename, latlng_cols=None, is_org_user=False, debug=False)¶ Create and populate a table on carto with a dataframe. This is a private method, but can be used to create a new table on CARTO. It is used in carto_sync if a DataFrame is not yet linked to a CARTO table.
-
cartoframes.core.
carto_insync
(self)¶ Says whether current cartoframe is in sync with last saved state
-
cartoframes.core.
carto_map
(self, interactive=True, color=None, size=None, cartocss=None, basemap=None, figsize=(647, 400), debug=False)¶ Produce and return CARTO maps. Can be interactive or static.
Parameters: - interactive (boolean) – (optional) Value on whether to show an interactive map or static map
- color (dict, string) –
(optional)
- If color is a string, can be a column name or a hex value (beginning with a
#
). When a hex value, all geometries are colored the same. If the column name, use CARTO’s TurtoCarto to create qualitative or category mapping. - If color is a dict, parse the parameters to custom style the map. Values are:
- colname (required): column name to base the styling on
- ramp (optional): If text, type of color ramp to use. See https://github.com/CartoDB/CartoColor/blob/master/cartocolor.js for a full list. If list/tuple, set of hex values.
- ramp_provider (optional): Specify the source of the ramp (either cartocolor or colorbrewer)
- num_bins: Number of divisions for the ramp
- quant_method: Quantification method for dividing the data into classes. Options are jenks, quantiles, equal, or headtails. By choosing a custom ramp
- If color is a string, can be a column name or a hex value (beginning with a
- size (integer, string, dict) –
(optional) Only works with point geometries. A future version will allow more sizing options for lines.
- If size is an integer, all points are sized by the same value specified.
- If size is a column name, this option sizes points from a default minimum value of 4 pixels to 15 pixels.
- If size is a dict, size points by the following values if entered. Defaults will be used if they are not requested.
- colname: column to base the styling off of
- max: maximum marker width (default 15)
- min: minimum marker width (default 4)
- quant_method: type of quantification to use. Options are jenks, quantiles, equal, or headtails.
- cartocss (string) – Complete CartoCSS style to apply to your map. This will override size and color attributes if present.
- basemap (string) – (optional) XYZ URL template for the basemap. See https://leaflet-extras.github.io/leaflet-providers/preview/ for examples.
- figsize (tuple) – (optional) Tuple of dimensions (width, height) for output embed or image. Default is (647, 400).
Returns: an interactive or static CARTO map optionally styled
Return type: HTML embed
-
cartoframes.core.
carto_registered
(self)¶ Says whether dataframe is registered as a table on CARTO
-
cartoframes.core.
get_carto
(self, key)¶ General get method for reading from cartoframe metadata
Parameters: key (string) – key of item to fetch from metadata. One of carto_named_map, carto_geomtype, carto_username, carto_table. Returns: Value stored in cartoframe metadata Return type: any
-
cartoframes.core.
get_carto_api_key
(self)¶ return the username of a cartoframe :returns: CARTO API key associated with cartoframe :rtype: string
-
cartoframes.core.
get_carto_datapage
(self)¶ Return the CARTO dataset page
Returns: URL of data page of dataset on CARTO (behind password if private) Return type: string
-
cartoframes.core.
get_carto_geomtype
(self)¶ return the geometry type of the cartoframe
Returns: Geometry type in table
-
cartoframes.core.
get_carto_namedmap
(self)¶ Return the named map associated with a cartoframe
Returns: Name of named map Return type: string
-
cartoframes.core.
get_carto_sql_client
(self)¶ Returns: the internally stored sql client Return type: CARTO SQL Auth client object
-
cartoframes.core.
get_carto_tablename
(self)¶ return the username of a cartoframe
Returns: Table that cartoframe is associated with Return type: string
-
cartoframes.core.
get_carto_username
(self)¶ return the username of a cartoframe :returns: CARTO username associated with cartoframe :rtype: string
-
cartoframes.core.
make_cartoframe
(self, username, api_key, tablename, api_type=None)¶ Placeholder method (not functioning)
- instantiate sql client
- setup schema on carto
- ...
Parameters: - username (string) – CARTO username
- api_key (string) – CARTO API key
- tablename (string) – desired tablename
-
cartoframes.core.
read_carto
(username=None, api_key=None, onprem_url=None, tablename=None, query=None, include_geom=True, is_org_user=False, limit=None, cdb_client=None, index='cartodb_id', debug=False)¶ Create a DataFrame from a CARTO table, storing table information in pandas metadata that allows for further cartoframe options like syncing, map creation, and augmentation from the Data Observatory.
Parameters: - username (string) – CARTO username (default None)
- api_key (string) – CARTO API key
- onprem_url (string) – BASEURL for onprem
- tablename (string) – Table to create a cartoframe from
- query (string) – Query for generating a cartoframe
- include_geom (boolean) – Not implemented
- is_org_user (boolean) – (optional) Where username is in a multiuser account
- limit (integer) – (optional) The maximum number of rows to pull
- cdb_client (object) – (optional) CARTO Python SDK authentication client object (default None)
- index (string) – (optional) string Column to use for the index (default cartodb_id)
Returns: A pandas DataFrame linked to a CARTO table
Return type: cartoframe
-
cartoframes.core.
set_carto_sql_client
(self, sql_client)¶ Store the SQL client for later use
-
cartoframes.core.
set_last_state
(self)¶ Store the state of the cartoframe
-
cartoframes.core.
set_metadata
(self, tablename=None, username=None, api_key=None, include_geom=None, limit=None, geomtype=None, named_map_name=None)¶ Set method for storing metadata in a dataframe
Returns: None
-
cartoframes.core.
sync_carto
(self, username=None, api_key=None, requested_tablename=None, n_batch=20, latlng_cols=None, is_org_user=False, debug=False)¶ - If an existing cartoframe, this method syncs with the CARTO table a
- cartoframe is associated with. If syncing a DataFrame which has not yet been linked with CARTO, it creates a new table if the tablename does not yet exist and updates the metadata in the DataFrame.
Parameters: - username (string) – CARTO username credentials. Needed only if the DataFrame
is not yet linked to CARTO (e.g., it was created with
pd.DataFrame.read_carto
) - api_key (string) – CARTO API key. Needed only if linking a DataFrame with a table on CARTO.
- requested_tablename (string) – if set, creates a new table with name new_tablename on account connected through the auth_client. If this tablename exists on CARTO already, an exception will be thrown.
- n_batch (integer) – Number of queries to include in a batch update to the database (experimental).
- latlng_cols (tuple) – Columns which have the latitude and longitude (in that order) for creating the geometry in the database. Once this cartoframe syncs, a new column called the_geom will be pulled down that is a text representation of the geometry.
- is_org_user (boolean) – This flag needs to be set if a user is in a multiuser account.


TOLERABLE KEYBOARD!
Easy to set up HTML custom keyboard. Mouse and key bindings, no dependencies, easy to plug into the web audio API.
DOWNLOAD
Grab the full script, or the minified version.
SET UP
Add the tolerableKeyboard.min.js file to your project, create a (tolerable) keyboard object and a div to hold it, and voila. You can start playing the final countdown.
// In Script file
// Set up the keyboard. Settings will fall back on default values if not provided
// By default, the keyboard will be 3 octaves, starting on a C2
// and will connect to a simple square synth
let basicKeyborad = new TolerableKeyboard()
// In HTML file
// If not divID was specified during creation, the script looks for

// If it is not present in the HTML page, the constructor will
// create and append one on the bottom of the page.
// For further styling, its better to include it manually where needed

;
It can be played with the mouse, or, by default, with the keys A through K for the middle octave.
CUSTOM SET UP
The keyboard looks, key bindings, and action happening on pressing/releasing a note can also be customized
// In Script file
// Set up the keyboard.
// Settings are optional and will fall back on default values if not provided
// Here is the full list:
let customKeyboard = new TolerableKeyboard({
divID: 'customKeyboard', //The id of the div that will contain the keyboard
// If empty, a new div of class "tolerableKeyboard" will be appended to the page's body
octaves: 2, //Number of octaves
width:600, //Width of the full keyboard in px
height:150, //Height of the white notes
firstNote: 'F#2',//Starting note
showKey:true, //Display the keybindings on the notes, if any
autoSetUp:false, //If true, will set up an audio context and a simple synth.
//If not, pressNote and releaseNote functions need to be written
//No audio context will be created
selectColor:'#7FDBFF', //Highlight color of any pressed note
whiteNoteColor: '#F8F8FF', //Color of the white notes
blackNoteColor: '#001f3f', //Color of the black notes
// Borders/Casing of the keyboard.
borderSize: 20, // Size of the left and right borders
borderSizeOffset: -5, //Difference between the side borders height and the notes heights
borderSizeTop: 100, //Size of the top border
borderColor: '#579EBF', //Color of the borders
borderBorderSize: 5, //Size of the border's borders
borderBorderColor: '#001f3f', //Color of the border's borders and of the text
borderRadius: 10, //Radius of the borders
borderText: 'BOOYA!', //Text of the top border
})
// Because we dont use autoSetUp, we need to initialize a context and gain
let context, gain, nodes = [];
context = new AudioContext();
mixNode = context.createGain();
mixNode.gain.value = 0.3;
mixNode.connect(context.destination);
// If autoSetUp == true, the pressNote and releaseNote functions will be prefilled
// If not, they need to be filled with the sound playing logic.
// We will set up a simple synth
// For each note, the synth will play 2 detuned oscillators at the note frequency
customKeyboard.pressNote = function(frequency){
let oscillators = [];
let osc = context.createOscillator();
osc.type = 'square';
oscillators.push(osc)
let osc2 = context.createOscillator();
osc2.type = 'sawtooth';
osc2.detune.value = 10;
oscillators.push(osc2)
oscillators.forEach(o =>{
o.frequency.value = frequency ;
o.connect(mixNode);
o.start(0);
nodes.push(o);
})
}
// For each key released, the synth will loop through the oscillators,
// check the frequency, and stop them if they match
customKeyboard.releaseNote = function(frequency){
let newNodes = [];
for (let i = 0; i < nodes.length; i++) {
if (Math.round(nodes[i].frequency.value) === Math.round(frequency)) {
nodes[i].stop(0);
nodes[i].disconnect();
} else {
newNodes.push(nodes[i]);
}
}
nodes = newNodes;
}
//example of adding a new key binding
//by default keys A through L are binded to C3 through C4
//only one keyboard (the last one created) can be hooked up to the keys
//thats one the first one is not working
customKeyboard.addKeyBinding('Z','F#2')
customKeyboard.addKeyBinding('X','F#4')
// In HTML file

;
the code and it shall appear in its magnificent glory.


dotfile.sh is a shell script to install (symlink) various collections of dotfiles onto your system.
#!/bin/bash #/ #/ Usage: dotfile.sh [<options>] [<dotfile...>] #/ #/ The <dotfile...> is a space-separated list of dotfile collections that should be installed. #/ If left out, all the dotfiles that can be found will be installed. #/ Collections are found inside folders of the same name under your current working directory. #/ #/ Options: #/ -d,--debug Passing the debug option will set the -x flag for bash. #/ --preview Don't actually install any dotfiles. #/ Pre/post hooks and backup creations are not going to be run as well. #/ --linux Explicitly install any dotfiles for Linux. #/ --osx Explicitly install any dotfiles for macOS.
Refer to the README for more information about the usage and installation of dotfile.sh.
set -eo pipefail PLATFORM=() TARGETS=() POSITIONAL=() while [[ $# -gt 0 ]]; do key="$1" case $key in -d|--debug) set -x shift # past argument ;; --preview) PREVIEW=1 shift # past argument ;; -p|--platform) PLATFORM="$2" shift # past argument shift # past value ;; --linux) PLATFORM="linux" shift ;; --osx) PLATFORM="osx" shift ;; *) TARGETS="$TARGETS $key" shift ;; esac done set -- "${POSITIONAL[@]}" # restore positional parameters [ -z ${PLATFORM+x} ] && PLATFORM=$(uname -s 2>/dev/null | tr '[:upper:]' '[:lower:]' || echo none)
dotfiles works by grouping up your various dotfiles (or any other configuration files, really) in folders, that are referred to as collections. For example, a collection for Vim configuration files could look like the following:
#├── vimfiles/ #│ ├── vim/ #│ ├── INSTALL.sh #│ └── vimrc
By running dotfiles vimfiles
, the vimrc
file would be symlinked to $HOME/.vimrc
and the vim
folder, which might contain all your plugins for Vim, will be symlinked to $HOME/.vim
.
Some collections might require some additional installation steps. These can be specified inside a
INSTALL.sh
file, where a pre()
and/or post()
function can defined. These hooks will then be called
before and after the installation of the collection's dotfiles, respectively.
It is also possible to tell dotfile.sh where the files and folders should be installed to
by setting the $TARGET
variable, which defaults to $HOME
.
In case there's already a dotfile or folder present, a backup is created.
Backups are created by appending ".backup" the original file's name.
function backupExistingDotfiles { createBackup() { echo -e "\033[0;31mCreating backup of existing dotfiles at $1.backup\033[0m" mv $1 $1.backup }
If the file or folder in question already exists, we'll check whether a backup of it already exists, as well.
If that's the case, the user can decide between two options on how to proceed. The first option is to not create a new backup. This means that the existing file or folder will be removed and no new backup is created.
The second option is to remove the existing backup instead, so a new one can be created.
if [ -f $1 ] || [ -d $1 ]; then if [ -f "$1.backup" ] || [ -d "$1.backup" ]; then echo echo -e "\033[0;33mExisting backup of dotfiles found at $1.backup\033[0m" select yn in "Do not create a new backup." "Override old backup with a new one."; do case $yn in "Do not create a new backup.") rm -rf $1 echo -e "\033[0;31mRemoving dotfiles at $1 without creating backups!\033[0m" return 0 ;; "Override old backup with a new one.") rm -rf $1.backup break ;; esac done fi createBackup "$1" fi return 0 }
After creating the necessary backups of files and folders, the new dotfiles can be installed. There are two ways this can happen.
The simplest way is to symlink the individual files and folders. This is also what was shown previously
with the vimfiles
example.
function linkDotfiles { for f in $(ls -1 $1); do
In order to install dotfiles this way, we will iterate through every file and folder found inside a collection and create backups of their original versions on the machine, if necessary.
[ -z ${PREVIEW+x} ] && backupExistingDotfiles "$HOME/.$f" if [ "$f" != "INSTALL.sh" ]; then
Then, everything (except the collection specific installation script in INSTALL.sh
) will be symlinked
to the user's home directory.
echo -e "Linking \033[1;34m$f\033[0m to \033[1;34m$HOME/.$f\033[0m" [ "$PREVIEW" ] || ln -s "$(pwd -P)/$1/$f" $HOME/.$f fi done }
The other way is to symlink to whole collection's folder to a specific target path.
This is referred to as a bundle of dotfiles. Where exactly the folder
should be symlinked to is specified by the $TARGET
variable, which should be
defined in the INSTALL.sh
file.
function bundleDotfiles { [ "$PREVIEW" ] || backupExistingDotfiles "$2" echo -e "Bundling \033[1;34m$1\033[0m at \033[1;34m$2\033[0m" [ "$PREVIEW" ] || ln -s "$(pwd -P)/$1" $2 }
The collections that are to be installed come from the command-line arguments. If none are specified, we'll install all the dotfiles we can find. Otherwise, the script checks if we can find a directory with the same name for each specified collection.
COLLECTIONS=() if [[ "$TARGETS" == "" ]]; then COLLECTIONS=$(ls -1d */) else for t in $TARGETS; do [ -d "$t" ] && COLLECTIONS="$COLLECTIONS $t" done fi
For each found collection, dotfile.sh will determine the way its dotfiles should
be installed (see above). The most straight-forward check is to see, if an INSTALL.sh
file can be found.
for t in $COLLECTIONS; do echo -ne "Installing \033[1;32m$t $(tput sgr0)..."
If an INSTALL.sh
file is available, we'll load it into a sub-shell, so we can call its
pre
and post
hook functions, if they have been defined. Whether the dotfile collection
should be bundled is determined by the INSTALL.sh
's $TARGET
variable. If it is set,
the collection will be installed as a bundle at the location specified by that variable.
TODO: Use another extra variable to determine the installation method, since there might be cases where someone would want to symlink individual dotfiles at a custom location. Right now, this only works for dotfiles and folders being symlinked to
$HOME
.
If it is not set, the dotfiles are installed using individual symbolic links.
if [ -f "$t/INSTALL.sh" ]; then ( source "$t/INSTALL.sh" echo if type pre &>/dev/null; then ( echo -e "\033[0m\033[2mExecuting Pre-Install Hook\033[0m" pre echo -e "\033[0m\033[2mDone ✓\033[0m" ) | sed "s,.*,$(tput setaf 8)[pre]$(tput sgr0) &," fi if [ -z ${TARGET+x} ]; then linkDotfiles "$t" else bundleDotfiles "$t" "$TARGET" fi if type post &>/dev/null; then ( echo -e "\033[0m\033[2mExecuting Post-Install Hook\033[0m" post echo -e "\033[0m\033[2mDone ✓\033[0m" ) | sed "s,.*,$(tput setaf 8)[post]$(tput sgr0) &," fi )
This is also the installation method when a collection does not contain an INSTALL.sh
file.
The dotfiles and folders are symlinked to the user's home directory.
else echo linkDotfiles "$t" fi tput sgr0 echo done
After all the collections have been iterated through (if there were any), we say goodbye and we're done. 👌
if [ ${#COLLECTIONS[@]} -gt 0 ]; then echo -e 'Installation Finished \033[0;32m✓\033[0m' else echo 'No dotfiles to install ...' echo 'Make sure you specified the right directory names for your dotfiles.' fi


How fast can you add more worker nodes?
Getting arbitrary log files into Rsyslog
Making Celery and PyMongo play nicely together
Celery: Mini Tutorial (Catalan)
Building a Django App Server with Chef
Introducció a Celery (Catalan)
Django and Celery - Death to Cron
What's your favorite Django app?
10 Tools That Make Django Better
Distributed Task Locking in Celery
Celery — распределенные очереди задач на Python (Russian)
Celery, RabbitMQ and sending messages directly.
Cron dentro do Django com Celery (Portugese)
RabbitMQとCeleryを使ってDjangoでジョブキューしてみる (Japanese)
Kaninchen & Schlangen: RabbitMQ & Python (German)
Celery - Eine asynchrone Task Queue (nicht nur) für Django (German)
Asynchronous Processing Using Celery (historio.us)
"Massaging the Pony: Message Queues and You" (Djangocon 2010)
"Large problems, Mostly Solved" (Djangocon 2010)
A Simple Celery with Django How-To
Celery: добавляем параллелизм в Django (Russian)
Celery presentation at PyCon India 2010 (PDF slides)
celery, django and virtualenv playing nice.
Django Task Queueing with Celery
django-celery presentation at DJUGL 2010.
Django/Celery Quickstart (or, how I learned to stop using cron and love celery)
Using Python magic to improve the deferred API
How Celery, Carrot, and your messaging stack work
Large Problems in Django, Mostly Solved: Delayed Execution
Great Celery tutorial by Robert Pogorzelski at his blog "Happy Stream of Thoughts"
Message Queues, Django and Celery Quick Start
Background task processing and deferred execution in Django.
Build a processing queue [...] in less than a day using RabbitMQ and Celery
How to get celeryd to work on FreeBSD
Installing multiprocessing on FreeBSD isn't that easy, but thanks to Viktor Petersson we now have a step-to-step guide.
Web-based 3D animation software (PDF)
Indy Chang Liu at ThinkingCactus uses Celery to render animations asynchronously.


Adorn: not just an open source code repo, a concept.
Adorn is your theme for plain markup.
The idea is simple, make HTML tags look great, and add a little navigational aids to pages.
The adorn path must be available at http://localhost/adorn/ when developing. This means your assets can be referenced relative to the root, e.g.
This has the benefit of continuity with GitHub Pages. Once you have pushed the adorn files up to gh-pages, your other projects gh-pages are relative, so assets are looking at your adorn gh-page.
Also when you fork an exisiting project which references adorn in this way, you wont see an unstyled page youll see your adorn theme.
Avoid attributing custom classes, id's, javascript, to your HTML files which only exist in your version of adorn, these may not be in someone elses instances of Adorn.
Avoid nesting elements for the sake of style, the document should be linear and all block level elements should really belong to body.
If your familiar with MarkDown then you're already initiated into this idea.
An example of a good theme is this page (Right-Click "View Source")


Contribute¶
This section is a work in progress
If you are interested in becoming a collaborator for this project, feel free to reach out to one of the current collaborators.
But absolutely feel free to clone the source code and play around with it!
IMPORTANT: These sections assume that you are using Python3
This guide aims to make the setup of your ms-collect development environment a little easier. But assumes that you have Python3 or pyenv setup on your machine.
Quick setup¶
So you want to get your hands on the code huh? You want to know the quickest way to do that huh?
Easy. Just follow this section :)
First clone the repository and cd into ms-collect:
$ git clone https://github.com/jakuzo/ms-collect.git $ cd ms-collect
Next install the development dependencies:
$ pip install -r requirements.txt
3. Then install an editable instance of ms-collect. This allows you to make changes to all of the source code under
src/
and not have to build it every time.$ python -m pip install -e .
There are some datasets in csv format under
test/
that you can play around with as well.
Requirements¶
Install the linting and code formatting tools using pip
pycodestyle: linting/style checking in accordance with pep8
autopep8: code formatting in accordance with pep8
$ pip install pycodestyle $ pip install autopep8Most of the contributors use vscode, if you do too, then we recommend installing the following extensions:
pylance
Python-autopep8
Change your Python Linter to: pycodestyle
Githooks¶
If you are a contributor i.e. are authorized to push code to ms-collect’s repository, please ensure that you have the shared githooks configured properly.
Assuming that you have cloned the repository, you will notice that there is a directory named
.githooks/
In order for the hooks in this directory to run, please update the hooks config for your local copy of this repo:
$ git config core.hooksPath .githooks
All of the hook scripts in this directory need to be executable, so please
chmod +x
all files in the.githooks/
directory. For example:$ chmod +x .githooks/pre-commit


A summary of some new news related to CUNY's and CSI's response to the COVID-19 pandemic. See https://csi-covid19.github.io for the archive.
To add/suggest news, please email John Verzani
At a 5/27 Town Hall over 250 members of the community showed up. None were happy coming in and none had any reason to be happy on leaving.
The words "retrenchment" and "furlough" were used as an alternate possibility to dramatic cuts to the temporary personnel budget (Adjuncts, CAs, graduate assistants, NTAs...).
In comments about the 5/27 P&B meeting, it was heard that 128 CAs were on the bubble; that the president wants credit for saving money on positions he chose not to have but is "chartered" to have (whatevere that means); and that some feel the "consultation" process is not real.
It was heard that despite calling 40+ people together for the reopening committee on 5/26; at least two committees were being formed in parallel for research and many more may be needed.
May 28th would have been our day for graduation and the announcement of Dolphin Awards. Sadly these seem to have been an unitended victim of the pandemic.
5/27 email calling for special meeting Several members of the college community ask for a special meeting to, the purpose of the meeting is to debate and vote on a resolution.
Clarifies the PSC position on a grade strike (defeated twice by vote) and mentions upcoming meeting with President Fritz.
5/26 CUNY Distinguished faculty Ben Lerner on the cuts (thanks to Alyson B. for pointing this out)
It doesn't take a Guggenheim Fellow or MacArthur fellow to know this, but it helps get the impact across
...Remaining classes will then swell, which is bad for in-person education, but worse if classes remain online, as anybody who has tried to teach on Zoom can attest.
Cuts to the adjunct budget have no other translation.
Despite funding from the CARES Act, which allocated $237 million to CUNY to split equally for direct student aid and institutional needs stemming from the pandemic, some faculty and CUNY colleges are preparing for the worst. Brooklyn College, College of Staten Island, John Jay College, and Queens College have all announced plans to make significant cuts to their adjunct faculty and part-time staff.
“There is no justification for the terminations of employment and, in many cases, of health insurance that CUNY colleges have announced,” said President of the Professional Staff Congress Barbara Bowen.“Taking such actions at any time would be alarming; doing so in the midst of a pandemic after receiving hundreds of millions of dollars in federal aid is inexcusable. CUNY must do better.”
5/26 NYPost OPED: Top-earning public officials should cut their pay amid NY's fiscal crisis
And CUNY Chancellor Felix Matos Rodriguez’s salary is $623,500; joining the cap (200K maximum salary) could pay for a dozen adjunct profs.


My website was built over a period of 43 days, starting from November 6th to December 18th, 2020. I started out without any knowledge of HTML/CSS and JavaScript but have improved my proficiency in all three languages by week 9 of Semester 2020C at RMIT University Vietnam. Though I still have much more to learn, I am now very confident in my understanding of web development thanks to the helpful Intro to IT tutorial sessions.
During the process, I have experimented with two HTML templates:
This is my initial experimentations in web development. At this point, I did not have much content to add to my website, so it was mainly a learning experience.
This is the template that I settled on for my website for its simplicity and lightweight. In the final version of my website, I have moderately modified all of the HTML and CSS files, but I have left the JavaScript files untouched, since I intend to keep my website light and easy to load on slow network connections.
During this period, I have made in total 83456 additions and 28399 deletions in 46 commits (Subject to future updates). Detailed and up-to-date information can be accessed here
Graph 1. Commit frequency
Graph 2. Addition frequency
Graph 3. Deletion frequency


Fastest Growing Countries in Healthcare
Home
Spending GDP
Education/Healthcare
Education
Healthcare
Military
GEOMAP
Percent Health
Percent Education
Healthcare spending in millions (US$)
Healthcare spending percent change


{% extends "club/base.html" %} {% load staticfiles %} {% block title %}Ladder info{% endblock %} {% block body_block %}
{{ object.description }}
{% endif %} {% if object.location %}Location: {{ object.location }}
{% endif %}Current number of players: {{ ranking_list|length }}
Report a game » All games from this ladder »Page refreshed at {{ timestamp }}


Module: ActionController::ContentSecurityPolicy
Do not use. This module is for internal use only.
| Relationships & Source Files | |
| Namespace Children | |
|
Modules:
| |
| Extension / Inclusion / Inheritance Descendants | |
|
Included In:
| |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
|
|
|
Instance Chain:
|
|
| Defined in: | actionpack/lib/action_controller/metal/content_security_policy.rb |
Constant Summary
::ActiveSupport::Callbacks
- Included
::AbstractController::Callbacks
- Attributes & Methods
- .raise_on_missing_callback_actions (also: #raise_on_missing_callback_actions) rw
- #raise_on_missing_callback_actions rw
::AbstractController::Helpers
- Attributes & Methods
Class Method Summary
::ActiveSupport::DescendantsTracker
- self
| descendants | See additional method definition at line 106. |
| subclasses | See additional method definition at line 102. |
| clear, disable_clear!, reject!, | |
| store_inherited | This is the only method that is not thread safe, but is only ever called during the eager loading phase. |
::ActiveSupport::DescendantsTracker::ReloadedClassesFiltering
- Included
::ActiveSupport::Concern
- Extended
| class_methods | Define class methods from given block. |
| included | Evaluate given block in context of base class, so that you can write class macros here. |
| prepended | Evaluate given block in context of base class, so that you can write class macros here. |
| append_features, prepend_features |
Instance Attribute Summary
- #content_security_policy? ⇒ Boolean readonly private
::AbstractController::Callbacks
- Included
Instance Method Summary
- #content_security_policy_nonce private
- #current_content_security_policy private
::ActiveSupport::Callbacks
- Included
| #run_callbacks | Runs the callbacks for the given event. |
| #halted_callback_hook | A hook invoked every time a before callback is halted. |
::AbstractController::Helpers
- Included
DSL Calls
included
[ GitHub ]10 11 12 13
# File 'actionpack/lib/action_controller/metal/content_security_policy.rb', line 10
included do helper_method :content_security_policy? helper_method :content_security_policy_nonce end
Class Attribute Details
._helper_methods (rw)
[ GitHub ]# File 'actionpack/lib/abstract_controller/helpers.rb', line 12
class_attribute :_helper_methods, default: Array.new
._helper_methods? ⇒ Boolean
(rw)
[ GitHub ]
# File 'actionpack/lib/abstract_controller/helpers.rb', line 12
class_attribute :_helper_methods, default: Array.new
.raise_on_missing_callback_actions (rw) Also known as: #raise_on_missing_callback_actions
[ GitHub ]# File 'actionpack/lib/abstract_controller/callbacks.rb', line 36
mattr_accessor :raise_on_missing_callback_actions, default: false
Instance Attribute Details
#_helper_methods (rw)
[ GitHub ]# File 'actionpack/lib/abstract_controller/helpers.rb', line 12
class_attribute :_helper_methods, default: Array.new
#_helper_methods? ⇒ Boolean
(rw)
[ GitHub ]
# File 'actionpack/lib/abstract_controller/helpers.rb', line 12
class_attribute :_helper_methods, default: Array.new
#content_security_policy? ⇒ Boolean
(readonly, private)
[ GitHub ]
# File 'actionpack/lib/action_controller/metal/content_security_policy.rb', line 73
def content_security_policy? request.content_security_policy end
#raise_on_missing_callback_actions (rw)
[ GitHub ]# File 'actionpack/lib/abstract_controller/callbacks.rb', line 36
mattr_accessor :raise_on_missing_callback_actions, default: false
Instance Method Details
#content_security_policy_nonce (private)
[ GitHub ]# File 'actionpack/lib/action_controller/metal/content_security_policy.rb', line 77
def content_security_policy_nonce request.content_security_policy_nonce end
#current_content_security_policy (private)
[ GitHub ]# File 'actionpack/lib/action_controller/metal/content_security_policy.rb', line 81
def current_content_security_policy request.content_security_policy&.clone || ActionDispatch::ContentSecurityPolicy.new end


I thought I would do a few more examples of taking antiderivatives, just so we feel comfortable taking antiderivatives of all of the basic functions that we know how to take the derivatives of.
Well, it's going to be the same thing as the antiderivative of sine of t, or the indefinite integral of sine of t, plus the indefinite integral, or the antiderivative, of cosine of t.
(a) We know that the derivative with respect to t of cosine of t is equal to negative sine of t.
(b) So if we want a sine of t here, we would just have to take the derivative of negative cosine t.
(c) If we take the derivative of negative cosine t, then we get positive sine of t.
The derivative with respect to t of cosine t is negative sine of t.
We have the negative out front.
It becomes positive sine of t.
(d) So the antiderivative of sine of t is negative cosine of t.
So this is going to be equal to negative cosine of t.
And then what's the antiderivative of cosine of t? Well, we already know that the derivative with respect to t of sine of t is equal to cosine of t.
(a) So cosine of t's antiderivative is just sine of t-- so plus sine of t.
And we're done.
(b) We've found the antiderivative.
(c) Now let's tackle this.
(a) This is going to be da.
That's what we are integrating or taking the antiderivative with respect to.
(b) So what is this going to be equal to? Well once again, we can rewrite it as the sum of integrals.
(c) This is the indefinite integral of e to the a da, so this one right over here-- a d I'll do it in green-- plus the indefinite integral, or the antiderivative, of 1/a da.
The derivative with respect to x of e to the x is equal to e to the x.
That's one of the reasons why e in the exponential function in general is so amazing.
And if we just replaced a with x or x with a, you get the derivative with respect to a of e to the a is equal to e to the a.
And maybe you can shift it by some type of a constant.
(a) Oh, and let me not forget, I have to put my constant right over here.
I could have a constant factor.
So let me-- always important.
Remember the constant.
So you have a constant factor right over here.
(b) Never forget that.
(c) I almost did.
(a) So once again, over here, what's the antiderivative of e to the a? It is e to the a.
What's the antiderivative of 1/a? Well, we've seen that in the last video.
(b) It is going to be the natural log of the absolute value of a.
(c) And then we want to have the most general antiderivative, so there could be a constant factor out here as well.
(d) And we are done.
(e) We found the antiderivative of both of these expressions.


Status
Game loaded as module. Please view via server and not locally.
Mood:
Coming to life...
Hunger:
N
Energy:
N
Feed
Play
Sleep


| |
|
- delete(request)
- User delete function.
is available to the user only with the correct data cookie value
the function to display all user ads (without access to editing)
Args:
request : request, cleaned stores the information about the session
- login(request)
- User login function.
sends a password and email to the database for comparison, receives a cookie in return "session_id"
Args:
request : request, cleaned stores the information about the session
Returns:
render "users/logout.html" if the user is already with cookies
render "users/login.html" if the user is without cookies
- logout(request)
- User logout function.
is available to the user only with the correct data cookie value
Args:
request : request, cleaned stores the information about the session
- new_users(request)
- Сreate new user function
sends a password and email to the database fields email, password, first_name, last_name, tel_num, about from the template "users/new_users.html"
Args:
request : request, cleaned stores the information about the session
- info(request)
- User information function.
is available to the user only with the correct data cookie value
function that provides information about the registered account (own account)
takes json
json example :
{
"id" : 123456,
"first_name" : "Random",
"last_name" : "Valerka",
"email"<EMAIL_ADDRESS>"tel_number" : "1-234-56-78",
"about" : "Some information about this man",
"time_reg" : "2012.10.1 15:34:41"
}
Args:
request : request, cleaned stores the information about the session
- update(request)
- User update function.
is available to the user only with the correct data cookie value
sends a password and email to the database fields email. password, first_name, last_name, tel_num, about from the template "users/update.html"
at get request it requests the same json as in "def info(request)"
Args:
request : request, cleaned stores the information about the session
|


Blog
About Me
404 - Page not found
Oops. Seems like the page you're looking for doesn't exist anymore...
Looking for a recent post?
Networking - IP BGP Routing Configuration
Networking - IP Multicast Routing Configuration
Networking - OSPF Routing with Quagga
Jekyll update for my blog site
Building a Machine Learning platform using UCS 220 M5 with Tesla P4 GPU
GPU Programming With CUDA
SPI flash support in embedded Linux box


do/while loops are very similar to while loops, except the truth expression is checked at the end of each iteration instead of in the beginning. The main difference from regular while loops is that the first iteration of a do..while loop is guaranteed to run (the truth expression is only checked at the end of the iteration), whereas it's may not necessarily run with a regular while loop (the truth expression is checked at the beginning of each iteration, if it evaluates to false right from the beginning, the loop execution would end immediately).
Advanced C users may be familiar with a different usage of the do..while loop, to allow stopping execution in the middle of code blocks, by encapsulating them with do..while(0), and using the break statement.
|


Examples¶
After reading the documentation, the best way to learn more is by playing with code examples.
Our Python notebooks show how to use PyMDE on real (and synthetic) datasets. You can read these notebooks, or better yet, execute them and experiment by modifying the cells’ contents and seeing what happens.
You can run the notebooks by either downloading them locally and starting a Jupyter server, or by opening them in Google Colab.
MNIST¶
We recommend starting with our MNIST notebook, which highlights many of the things you can do in PyMDE, using the MNIST dataset as a case study.
In this notebook, you’ll see how to use the pymde.preserve_neighbors
function to embed vector data, how to create MDE problems for preserving
neighbors from scratch, how to sanity-check an embedding, and how
to use an embedding to look for outliers in the original data.
Fashion MNIST¶
The Fashion MNIST notebook is analogous to the MNIST notebook, except it uses the Fashion MNIST dataset.
Single-Cell Genomics¶
This notebook is similar to the MNIST notebook (but with less explanatory text). The dataset embedded here contains single-cell mRNA transcriptomes of cells taken from human patients with severe COVID-19 infections (and also from healthy controls). We’ll see that similar cells are placed near each other in the embedding, and cells from healthy and sick are also somewhat separated.
Google Scholar¶
The Google Scholar notebook uses pymde.preserve_distances
to embed
an academic coauthorship network, which we collected from Google Scholar.
(This network contains most authors on Google Scholar whose h-index is at least
50.)
This example embeds a graph with roughly 40,000 nodes and (after preprocessing) 80 million edges. If you have a GPU, computing the embedding shouldn’t take much longer than a minute, but it will take longer to compute on a CPU.
Word Embedding¶
This notebook shows how to make basic word embeddings. The words being embedded are the 5000 most popular academic interests on Google Scholar.
Population Genetics¶
The population genetics notebook embeds genomic data of individuals thought to be of European ancestry, and recovers what appears to be a map of Europe.
US Counties¶
The US counties notebook embeds 3,220 US counties, described by demographic data, into two dimensions. The resulting embedding is colored by the fraction of voters who voted for Democratic candidates in the 2016 presidential election (voting data was not used in computing the embedding). Moreover, the resulting embedding vaguely resembles a map of the US (though no geographic data was used in computing the embedding).
Anchor Constraints¶
With an anchor constraint, you can pin some embedding vectors to values that you specify ahead of time. This is useful when you have prior knowledge of where some of the items should end up (e.g., you might be doing semi-supervised learning, or you might be laying out a graph with some nodes pinned in place).
This notebook gives an example of how to use an anchor constraint, using graph drawing as an example.
Updating Embeddings¶
With PyMDE, you can easily add new points to an existing embedding using an anchor constraint (to pin the existing embedding in place).
This notebook gives an example of how to do this, using MNIST as an example. We first embed half the images in the MNIST dataset. Then we augment the embedding with vectors for the remaining images.
Drawing Graphs¶
PyMDE can be used to layout graphs in the Cartesian plane in an aesthetically pleasing way. Compared to many other graph layout libraries, PyMDE can scale to much larger datasets. PyMDE also lets you design custom layouts, by choosing your own distortion functions and constraints.
This notebook shows various ways of drawing graphs with PyMDE. It also
introduces the pymde.Graph
class.
Dissimilar Edges and Negative Weights¶
When creating an embedding for preserving neighbors, an important hyper-parameter is the number of dissimilar edges to include, and the size of the negative weights. Using as many dissimilar edges as there are similar edges, and choosing the negative weights to all be -1, usually works just fine. But different choices do lead to different embeddings.
This notebook explores the effect these hyper-parameters have on the embedding.


#include <data_flow_ops.h>
Closes the given queue.
This operation signals that no more elements will be enqueued in the given queue. Subsequent Enqueue(Many) operations will fail. Subsequent Dequeue(Many) operations will continue to succeed if sufficient elements remain in the queue. Subsequent Dequeue(Many) operations that would block will fail immediately.
Arguments:
Optional attributes (see Attrs
):
Returns:
Operation
Constructors and Destructors |
|
|---|---|
QueueClose(const ::tensorflow::Scope & scope, ::tensorflow::Input handle)
|
|
QueueClose(const ::tensorflow::Scope & scope, ::tensorflow::Input handle, const QueueClose::Attrs & attrs)
|
Public attributes |
|
|---|---|
operation
|
Public functions |
|
|---|---|
operator::tensorflow::Operation() const
|
|
Public static functions |
|
|---|---|
CancelPendingEnqueues(bool x)
|
Structs |
|
|---|---|
|
tensorflow:: |
Optional attribute setters for QueueClose. |
Operation operation
QueueClose( const ::tensorflow::Scope & scope, ::tensorflow::Input handle )
QueueClose( const ::tensorflow::Scope & scope, ::tensorflow::Input handle, const QueueClose::Attrs & attrs )
operator::tensorflow::Operation() const
Attrs CancelPendingEnqueues( bool x )


Begin exploring now, by clicking on one of the many cities listed below. On each page, you will find community-generated photos and videos telling you what (and what not to) do based on their experiences in that city!
New cities are being added all the time, as we are able to generate more content based on your suggestions and submitted photos and videos. Check back often, and don't forget to submit your own travel experiences.


?6
7
8
9
10
^
.
,,
The
New
York
copyright
reserved
Botanical
Garden
JARDIN
BOTANICO
NACIONAL
"DR.
RAFAEL
M.
MOSCOSO"
SANTO
DOMINGO,
REPUBUCA
DOMINICANA
13474
Oleaceae
Linociera
domigensi
s
(Lamarck.)
Knobl.
6
m.
tall,
one
stem;
corolla
white;
2
km.
up
stream
from
mouth
of
river,
on
dry
slope
along
trail.
Republiea
Dominicana:
Prov.
Barahona:
"Los
Morones";
area
(no
residences!),
2
to
4
Km.
up
Rio
Baoruco
from
the
river
mouth
(
town
of
Baoruco),
via
trail
to
Las
Auyamas;
native
old
broadleaf
forest
at
river
valley,
humid,
but
few
epiphytes
here
!.
18¡05'N,
71¡07ÕW,
alt.
40
to
100
m.
May
19,
1981
T.
Zanoni,
M.
Mejia,
C.
Ramirez.
Dr.
H.
A.
Liogier,
Bot.
Garden
viÈ^
UNIVERSITY
OF
PUERTO
RICO
ÀL
Yo^>
BOTANICAL
GARDE^
01497562
Legend -
Level of confidence that token is an accurately-transcribed word
extremely low
very low
low
undetermined
medium
high
very high


Containers deployment is easy. You can deploy NooBaa on Kubernetes, OpenShift, MiniShift, and MiniKube.
You will need jq (json cli processor). For Linux, you can simply run this one-liner:
wget -O jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64;chmod +x ./jq;cp jq /usr/bin
wget https://raw.githubusercontent.com/noobaa/noobaa-core/master/src/deploy/NVA_build/noobaa_deploy_k8s.sh; wget https://raw.githubusercontent.com/noobaa/noobaa-core/src/deploy/NVA_build/noobaa_core.yaml;chmod +x noobaa_deploy_k8s.sh
./noobaa_deploy_k8s.sh deploy -e <youremail> -n <new namespace> -f ./noobaa_core.yaml
Read more on NooBaa's git page here


Summary of Enrollment:
- student enrolled
- student added
- student dropped
- student blocked
- instructor
- teaching assistant
- guest
- observer
Registrar User
Added User
Blocked User
Are you sure you want to remove the selected members? Members unable to be removed will be inactived.
Are you sure you want to block these members, denying access to the site?
Are you sure you want to unblock these members, restoring access to this site?
You must first select one or more members, using the check boxes.
Note: Registrar members' roles can be set only by your campus Registrar.
Add new members to your site. This is for guest members who are not officially registered. It is best NOT to add students in this way - rely on your school's registration process to get your students access to your site.
- For users already in Etudes, enter their user id or the email address they use in Etudes.
- For users new to Etudes, enter their email address to create a guest account for them.
If you need more than one, enter them one per line.
Here are the results of your add members request.
Here are the results of your remove members request.
Here are the results of your unblock members request.
Here are the results of your block members request.
Here are the results of your change role request.
Are you sure you want to remove the selected groups?
You must first select one or more groups, using the check boxes.
Before saving, please resolve the problems in the information you provided.
Set special access for for all items in your site.
Extend the due and allow until dates in Modules, Discussions, and AT&S
Extend the time limit for timed assessments in AT&S. Specify one of the following:
Specify only one.
Remove the time limit for all timed assessments for this student.
Existing special access for
will be replaced in:
Special access has been updated for
in the following tools:
No special access was set.
No items in the site qualify for this special access.
Special access only applies to items that have due or accept until dates (when extending days),
or have a time limit (when extending the time limit).
Are you sure you want to delete this special access?
Special access for due date(s) and time limit will be removed for this user from all items in the site.


% df = load_pkg_stat_snapshot() make_heaviness_plot() bioc_version = ALL_BIOC_RELEASES$Release[ALL_BIOC_RELEASES$Date == pkgndep_opt$heaviness_db_version] lta = load_from_heaviness_db(qq("adjusted_heaviness_select_a_@{bioc_version}.rds")) %>
Note: if the version of the heaviness database is too early, the heaviness analysis might make less sense due to the small size of the ecosystem.
In this report, we study two questions on the package dependencies:
For each package, we first look at the maximal heaviness from its parents. Following plots show the relation between number of parents and max heaviness from parents. Generally, on the border of the point cloud, there is a trend that max heaviness from parents drops as numbers of parents increase. This is because when a package has more parents, additional dependency packages brought by each parent would have more overlap (i.e., dependencies from parent A overlap to the dependencies from parent B). Since heaviness measures number of unique dependencies that a single parent brings in, or in other words, the number of dependencies that are mutually exclusive to those brought by all other parents, thus with more parents, the max heaviness from parents would decrease.
In the plot, we can see there are several packages far away from the cloud (highlighted in red and orange). These packages can be thought as those having extreamly heavy parents compared to most of the others. To capture these packages with heavy parents, we define "adjusted max heaviness on parent packages" as follows.
For a package P, denote $h$ as the max heaviness from its parent packages. The adjusted heaviness is calculated as $ h^\mathrm{adj} = h \cdot a $ where $a$ is a zooming factor. $a$ is calculated as $a = (n+<%=lta$cutoff$max_heaviness_from_parents%>)/n_\mathrm{max}$ where $n$ is the number of parents for package P and $n_\mathrm{max}$ is the maximal number of parents of all packages (i.e., all CRAN/Bioconductor packages). The value of <%=lta$cutoff$max_heaviness_from_parents%> is selected emperically to balance the zooming rate on different $n$.
The zooming factor $a$ decreases the heaviness faster for small number of parents, thus, it actually transforms the original distribution of point cloud more horizontal so that it is easy to set a cutoff to mark extream points. The plot of adjusted heaviness verse number of parents can be seen by clicking the radio button "Adjusted max heaviness verse number of parent packages" below. We simply mark a package as having highly heavy parents if the adjusted heaviness larger than <%=CUTOFF$adjusted_max_heaviness_from_parents%>. The packages with highly heavy parents are listed on the right of the following figure.
<%= img(paste0(env$figure_dir, "/plot-parent-max-heaviness.png"), style="height:500px")%>
Generally, the heaviness on child packages has a trend to decrease with increasing the number of child packages, since it is averaged on the heaviness of all children. To highlight the packages that heavily affect large numbers of children, the original definition of heaviness is adjusted. The original definition of heaviness on child packages is defined as:
For a package P,
assume it has $K$ child packages and the $k^{th}$ child is denoted
as $A_k$. Denote $n_{1k}$ as the number of strong dependencies of package
$A_k$ and $n_{2k}$ as the number of strong dependencies of $A_k$ if moving P
to its Suggests
, the heaviness of P on its child packages denoted as $h$ is
calculated as $h = \frac{1}{K} \sum_k^K(n_{1k} - n_{2k})$, which is the average heaviness to all its child packages.
Since the original heaviness is scaled by the number of children, it is possible that large $K$ generates a small heaviness. The heaviness on child package is adjusted by adding a small constant $a$ to $K$, so that heaviness for small $K$ decreases more quickly than large $K$.
$h^\mathrm{adj} = \frac{1}{K + a} \sum_k^K(n_{1k} - n_{2k})$
We emperically select <%=lta$cutoff$heaviness_on_children%> for $a$. Clicking on the following title to see how $a$ is selected.
It is easy to see that a decreases $h$ faster for smaller $K$ than larger $K$. To select an optimized value for $a$, we took $a$ as integers in the set {1, 2, …, 29, 30}; and for a specific package indexed as $k$ and a value of $a$, we calculated the adjusted heaviness on its child packages, denoted as $h_{k,a}^\mathrm{adj}$ and the vector for all packages is denoted as $h_a^\mathrm{adj}$. $a$ is selected as the value by which the ranking of adjusted heaviness of all packages becomes stable. To measure the stability of the ranking of $h_a^\mathrm{adj}$ compared to $h_{a-1}^\mathrm{adj}$, we calculate the stability score denoted as $s_a$ as $s_a=\frac{1}{N}\sum_k^NI(|R_{k,a}-R_{k,a-1}|\le<%=lta$children$rank_diff[1]%>)$, where $N$ is the total number of packages in the ecosystem, $R_{k,a}$ and $R_{k,a-1}$ are the ranks of package $k$’s adjusted heaviness in $h_a^\mathrm{adj}$ and $h_{a-1}^\mathrm{adj}$ respectively, and $I()$ is the indicator function.
$s_a$, or its general denotation $s$, measures the proportion of packages whose ranking difference of adjusted heaviness is no larger than <%=lta$children$rank_diff[1]%> in the two neighboring values of $a$ (<%=lta$children$rank_diff[1]%> is a small value compared to the total number of R packages in the ecosystem). When $s$ becomes stable with $a$, we can conclude increasing $a$ won't greatly change the ranking of $s$. Thus, based on the “knee” rule, $a$ was selected to <%=lta$cutoff$heaviness_on_children%>.
<%= img(paste0(env$figure_dir, "/plot-select-a-adjusted-heaviness-children.png"), style="height:500px")%>
The plot of adjusted heaviness verse number of children can be seen by clicking the radio button "Adjusted heaviness verse number of child packages". We simply set a package having a highly heavy impact on its children if the adjusted heaviness larger than <%=CUTOFF$adjusted_heaviness_on_children%>.
<%= img(paste0(env$figure_dir, "/plot-child-heaviness.png"), style="height:500px")%>
The analysis of heaviness on child packages is more useful for developers because it tells when adding a new direct dependency
package to their package, the expected number of additional dependency package it brings to. E.g., if they add
lumi in Imports
of their package, the package will likely
have 111 more extra dependency packages.
We next look at the indirect effects to the downstream packages' dependencies. Note here we only look at the downstream packages with excluding the child packages. A comparison of with including child packages can be found in the next section of this report.
Similar to the heaviness on child packages, heaviness on indirect downstream packages also decrease as the number of downstream packages increase. We also define "adjusted heaviness on indirect downstream packages". The original definition of heaviness on indirect downstream packages is as follows:
For a package P, assume it has $K$ downstream packages (also include child packages) and the $k^{th}$ downstream package is denoted
as $B_k$. Denote $n_{1k}$ as the number of strong dependencies of package
$B_k$. Since P can affect its downstream in an indirect manner,
we re-calculate the global dependency relations for all packages by moving
P to all its child packages' Suggests
. Then we denote
$n_{2k}$ as the number of strong dependencies of $B_k$ in the modified dependency graph.
Next we denote $S_\mathrm{c}$ as the set of child packages of P and $K_\mathrm{c}$ as the number of its child packages, thus $K \geq K_\mathrm{c}$.
The adjusted heaviness of P on its indirect downstream packages (excluding child packages) denoted as $h$ is
calculated as: $h = \frac{1}{K-K_\mathrm{c}} \sum_{k}^K(n_{1k} - n_{2k}) \cdot I(B_{k} \notin S_\mathrm{c})$ where $I()$ is an indicator function. $h$ is set to 0 when $K = K_\mathrm{c}$.
Then a small constant $a$ is added to $K - K_\mathrm{c}$ to adjust the original heaviness:
$h^\mathrm{adj} = \frac{1}{K-K_\mathrm{c} + a} \sum_{k}^K(n_{1k} - n_{2k}) \cdot I(B_{k} \notin S_\mathrm{c})$
We emperically select <%=lta$cutoff$heaviness_on_indirect_downstream%> for $a$. Clicking on the following title to see how $a$ is selected.
Similar method as in the section Heaviness on child packages. A value of <%=lta$cutoff$heaviness_on_indirect_downstream%> is taken as the optimized value of $a$.
<%= img(paste0(env$figure_dir, "/plot-select-a-adjusted-heaviness-downstream-no-children.png"), style="height:500px")%>
The plot of adjusted heaviness verse number of downstream can be seen by clicking the radio button "Adjusted heaviness verse number of indirect downstream packages". We simply set a package having a highly heavy impact on its indirect downstream packages if the adjusted heaviness larger than <%=CUTOFF$adjusted_heaviness_on_indirect_downstream%>.
<%= img(paste0(env$figure_dir, "/plot-downstream-no-children-heaviness.png"), style="height:500px")%>
Each of The following two plots visualizes the ranking of all packages based on their heaviness on child packages and on downstream packages. For each plot, the left and right panels contain sorted heaviness for children and downstream respectively. In the middle panel are lines connecting the same package in the two rankings. The two ends of a line are assigned with the same color. There is a "Venn diagram" at the bottom panel which shows the overlap of the top 500 packages with the highest heaviness on children and the highest heaviness on downstream.
The left plot shows top 500 packages with the highest heaviness on children almost also have the highest heaviness on downstream (474 out of 500), and the right plot shows if only considering the indirect downstream packages, the overlap to packages with top heaviness on children have very small overlap.
<%= img(paste0(env$figure_dir, "/plot-compare-downstream-and-downstream2.png"), style="height:500px")%>
We think why there is such a huge overlap for the top packages with the highest heaviness on children and on downstream is because the downstream packages are mainly composed of child packages. To demonstrate this, for 474 packages that are both in the lists of top 500 packages having the highest heaviness on children and top 500 packages having the highest heaviness on downstream, we plot the fraction of their child packages in downstream packages. The following plot clearly shows for these top packages, their downstream packages are mostly child packages. With 76.4% of them, their downstream packages are completely child packages, and with 91.1% of them, more than 60% of their downstream packages are child packages.
<%= img(paste0(env$figure_dir, "/plot-top-500-children-downstream-pct.png"), style="height:500px")%>


KubeVirt technology addresses the needs of development teams that have adopted or want to adopt Kubernetes but possess existing Virtual Machine-based workloads that cannot be easily containerized. More specifically, the technology provides a unified development platform where developers can build, modify, and deploy applications residing in both Application Containers as well as Virtual Machines in a common, shared environment.
Benefits are broad and significant. Teams with a reliance on existing virtual machine-based workloads are empowered to rapidly containerize applications. With virtualized workloads placed directly in development workflows, teams can decompose them over time while still leveraging remaining virtualized components as is comfortably desired.
Leverage KubeVirt and Kubernetes to manage virtual machines for impractical-to-containerize apps.
Combine existing virtualized workloads with new container workloads on the one platform.
Support development of new microservice applications in containers that interact with existing virtualized applications.
{% for enduser in site.data.adopters.adopters.endusers %} {% endfor %}
{% for vendors in site.data.adopters.adopters.vendors %} {% endfor %}
{% for integrations in site.data.adopters.adopters.integrations %} {% endfor %}


Mosquito Fens [an63], swamp, in Imperia, wilderness
Last updated Turn #125
Mosquito Fens [an63], swamp, in Imperia, wilderness
------------------------------------------------------------------------
17: Stack of nazgul [al5c], nazgul, number: 3, arrived from the east.
19: Stack of nazgul [al5c], nazgul, number: 3, went west.
23: Stack of nazgul [bq0l], nazgul, arrived from the east.
25: Stack of nazgul [bq0l], nazgul, went west.
26: Stack of savages [fq4k], savages, number: 2, arrived from the east.
28: Stack of savages [fq4k], savages, number: 2, went south.
28: It has begun to rain.
Routes leaving Mosquito Fens:
North, swamp, to Mosquito Fens [am63], 14 days
East, swamp, to Mosquito Fens [an64], 14 days
South, forest, to Forest of the Lost [ao63], 8 days
West, forest, to Forest of the Lost [an62], 8 days
Inner locations:
Cursed Pits [ad5x], pits, 1 day, owner:
Rat [hn4c], rats, number: 43
It is raining.
Seen here:
Stack of nazgul [gb9s], nazgul, number: 4
Stack of wights [df3f], wights, number: 43
Stack of savages [fq4k], savage


WELCOME!
George W. Hewlett High School - High Honors
Java
Javascript
Visual Basics
Attended a STEAM program held at Microsoft.
Participated at a Codeathon
Photography Club
Writer for Spectrum (School Newspaper)
Robotics
Youth Leadership


|
CppNoddy
0.92
|
A Linear Element class. More...
#include <OneD_TVDLF_Elt.h>
Public Member Functions | |
| OneD_TVDLF_Elt (double a, double b, OneD_Hyperbolic_System *ptr, bool flag=false, int index=0) | |
| Construct a linear element. More... | |
| ~OneD_TVDLF_Elt () | |
| An empty destructor. More... | |
| void | add_contribution (OneD_TVDLF_Elt *ptr, const DenseVector< double > &s_range, int index) |
| Allow the connection of this element to another element. More... | |
| void | clear_contributions () |
| Clear the record of contributions to this element. More... | |
| DenseVector< double > | contributed_Q () |
| Find the integral contributions to this black/red element from the contributed red/black element. More... | |
| void | contributed_flux_in_left (const double &dt, DenseVector< double > &flux_in_left, const double ¤t_time) |
| Compute the flux into this element through the left face over a given time step. More... | |
| void | contributed_flux_out_right (const double &dt, DenseVector< double > &flux_out_right, const double ¤t_time) |
| Compute the flux out of this element through the right face over a given time step. More... | |
| double | get_s (double x) const |
| Convert a global coordinate into a local coordinate within this element If the global coordinate is outside the element, then we throw an exception. More... | |
| double | get_x (double s) const |
| Get the global position of the local coordinate. More... | |
| double | get_dx () const |
| Get the size of the element. More... | |
| bool | get_external_flag () const |
| Get the external flag. More... | |
| void | set_external_flag (bool flag) |
| Set the external flag. More... | |
| int | get_external_face_i () const |
| Get the exterior boundary number. More... | |
| void | set_external_face_i (int i) |
| Set the local coordinate of the external face. More... | |
| DenseVector< double > | get_Q (double s) const |
| Get the value of the 'concentration' stored in this element. More... | |
| DenseVector< double > | get_int_Q (const double s0, const double s1) |
| Get the integral of Q over a sub-element. More... | |
| void | set_Q_mid (const DenseVector< double > value) |
| Set the value of the 'concentration' stored in this element. More... | |
| void | set_slope (const DenseVector< double > value) |
| The concentration is approximated by a linear function in each element. More... | |
| DenseVector< double > | get_slope () const |
| The concentration is approximated by a linear function in each element. More... | |
| DenseVector< double > | get_flux_fn (const double s) const |
| Get the flux function evaluated for the concentration value stored in this elt. More... | |
| DenseMatrix< double > | get_Jac_flux_fn (const double s) const |
| Get the Jacobian of the flux function evaluated for the concentration value stored in this elt. More... | |
| DenseVector< double > | get_source_fn (const double s) const |
| Get the value of the source function term in this element at a given local coordinate. More... | |
| double | get_max_dt () const |
| Get the maximum allowable time step for this element by using information about the size of the element and the maximum wave speed set in the conservative system. More... | |
Public Attributes | |
| OneD_Hyperbolic_System * | system_ptr |
A Linear Element class.
Definition at line 15 of file OneD_TVDLF_Elt.h.
| CppNoddy::OneD_TVDLF_Elt::OneD_TVDLF_Elt | ( | double | a, |
| double | b, | ||
| OneD_Hyperbolic_System * | ptr, | ||
| bool | flag = false , |
||
| int | index = 0 |
||
| ) |
Construct a linear element.
| a | The left hand edge |
| b | The right hand edge |
| ptr | A pointer to the hyperbolic system for this element |
| flag | A boolean indicator to specify an elt with an external face |
| index | Index of the external face if flag=true |
Definition at line 13 of file OneD_TVDLF_Elt.cpp.
References system_ptr.
| CppNoddy::OneD_TVDLF_Elt::~OneD_TVDLF_Elt | ( | ) |
| void CppNoddy::OneD_TVDLF_Elt::add_contribution | ( | OneD_TVDLF_Elt * | ptr, |
| const DenseVector< double > & | s_range, | ||
| int | index | ||
| ) |
Allow the connection of this element to another element.
| ptr | A pointer to another element of the same type |
| s_range | A vector range of local coordinates (s_min,s_max) in this 1D case. |
| index | An index to indicate which face of the current elt this contribution is associated with for flux computations -1=left, +1=right, 0=none |
Definition at line 32 of file OneD_TVDLF_Elt.cpp.
|
inline |
Clear the record of contributions to this element.
Definition at line 46 of file OneD_TVDLF_Elt.h.
| void CppNoddy::OneD_TVDLF_Elt::contributed_flux_in_left | ( | const double & | dt, |
| DenseVector< double > & | flux_in_left, | ||
| const double & | current_time | ||
| ) |
Compute the flux into this element through the left face over a given time step.
| dt | The time step to compute the flux over |
| flux_in_left | A vector to return the flux components in |
| current_time | The current mesh time level |
Definition at line 54 of file OneD_TVDLF_Elt.cpp.
References get_external_flag(), get_Jac_flux_fn(), get_Q(), get_source_fn(), get_x(), CppNoddy::DenseMatrix< _Type >::multiply(), and system_ptr.
| void CppNoddy::OneD_TVDLF_Elt::contributed_flux_out_right | ( | const double & | dt, |
| DenseVector< double > & | flux_out_right, | ||
| const double & | current_time | ||
| ) |
Compute the flux out of this element through the right face over a given time step.
| dt | The time step to compute the flux over |
| flux_out_right | A vector to return the flux components in |
| current_time | The current mesh time level |
Definition at line 103 of file OneD_TVDLF_Elt.cpp.
References get_external_flag(), get_Jac_flux_fn(), get_Q(), get_source_fn(), get_x(), CppNoddy::DenseMatrix< _Type >::multiply(), and system_ptr.
| DenseVector< double > CppNoddy::OneD_TVDLF_Elt::contributed_Q | ( | ) |
Find the integral contributions to this black/red element from the contributed red/black element.
Definition at line 41 of file OneD_TVDLF_Elt.cpp.
References get_int_Q(), and system_ptr.
|
inline |
Get the size of the element.
Definition at line 181 of file OneD_TVDLF_Elt.h.
Referenced by get_int_Q(), get_max_dt(), and get_x().
|
inline |
Get the exterior boundary number.
Definition at line 193 of file OneD_TVDLF_Elt.h.
|
inline |
Get the external flag.
Definition at line 189 of file OneD_TVDLF_Elt.h.
Referenced by contributed_flux_in_left(), and contributed_flux_out_right().
| DenseVector< double > CppNoddy::OneD_TVDLF_Elt::get_flux_fn | ( | const double | s | ) | const |
Get the flux function evaluated for the concentration value stored in this elt.
| s | The local coordinate at which to evaluate |
Definition at line 152 of file OneD_TVDLF_Elt.cpp.
References f, get_Q(), get_x(), and system_ptr.
|
inline |
Get the integral of Q over a sub-element.
| s0 | The left local coordinate |
| s1 | The right local coordinate |
Definition at line 201 of file OneD_TVDLF_Elt.h.
References get_dx(), and get_Q().
Referenced by contributed_Q().
| DenseMatrix< double > CppNoddy::OneD_TVDLF_Elt::get_Jac_flux_fn | ( | const double | s | ) | const |
Get the Jacobian of the flux function evaluated for the concentration value stored in this elt.
| s | The local coordinate at which to evaluate |
Definition at line 159 of file OneD_TVDLF_Elt.cpp.
References get_Q(), get_x(), and system_ptr.
Referenced by contributed_flux_in_left(), and contributed_flux_out_right().
| double CppNoddy::OneD_TVDLF_Elt::get_max_dt | ( | ) | const |
Get the maximum allowable time step for this element by using information about the size of the element and the maximum wave speed set in the conservative system.
The time step is guranteed to satisfy the CFL < 0.5 constraint.
Definition at line 173 of file OneD_TVDLF_Elt.cpp.
References get_dx(), get_Q(), and system_ptr.
|
inline |
Get the value of the 'concentration' stored in this element.
| s | The local coordinate in the elt at which Q is requested |
Definition at line 197 of file OneD_TVDLF_Elt.h.
Referenced by contributed_flux_in_left(), contributed_flux_out_right(), get_flux_fn(), get_int_Q(), get_Jac_flux_fn(), get_max_dt(), and get_source_fn().
|
inline |
Convert a global coordinate into a local coordinate within this element If the global coordinate is outside the element, then we throw an exception.
| x | The global coordinate to convert |
Definition at line 72 of file OneD_TVDLF_Elt.h.
|
inline |
The concentration is approximated by a linear function in each element.
The slope of this function is got through this method.
Definition at line 222 of file OneD_TVDLF_Elt.h.
Referenced by get_source_fn().
| DenseVector< double > CppNoddy::OneD_TVDLF_Elt::get_source_fn | ( | const double | s | ) | const |
Get the value of the source function term in this element at a given local coordinate.
| s | The local coordinate to evaluate at |
Definition at line 166 of file OneD_TVDLF_Elt.cpp.
References get_Q(), get_slope(), get_x(), and system_ptr.
Referenced by contributed_flux_in_left(), and contributed_flux_out_right().
|
inline |
Get the global position of the local coordinate.
| s | The local coordinate |
Definition at line 185 of file OneD_TVDLF_Elt.h.
References get_dx().
Referenced by contributed_flux_in_left(), contributed_flux_out_right(), get_flux_fn(), get_Jac_flux_fn(), and get_source_fn().
|
inline |
Set the local coordinate of the external face.
Only one face can be external.
| i | The index of the external face -1=left, +1=right |
Definition at line 210 of file OneD_TVDLF_Elt.h.
|
inline |
Set the external flag.
| flag | is the value to set |
Definition at line 206 of file OneD_TVDLF_Elt.h.
|
inline |
Set the value of the 'concentration' stored in this element.
To second order, this is the value of the concentration at the mid-point of the element.
| value | The value to be assigned to the concentration member data Q |
Definition at line 214 of file OneD_TVDLF_Elt.h.
|
inline |
The concentration is approximated by a linear function in each element.
The slope of this function is set through this method.
| value | The value to be assigned to the member data 'slope' |
Definition at line 218 of file OneD_TVDLF_Elt.h.
| OneD_Hyperbolic_System* CppNoddy::OneD_TVDLF_Elt::system_ptr |
Definition at line 165 of file OneD_TVDLF_Elt.h.
Referenced by contributed_flux_in_left(), contributed_flux_out_right(), contributed_Q(), get_flux_fn(), get_Jac_flux_fn(), get_max_dt(), get_source_fn(), and OneD_TVDLF_Elt().
© 2012
R.E. Hewitt


HARDBALL A film review by Pete Croatto Copyright 2001 filmcritic.com
Michael Robbins' Hardball is quite the cinematic achievement.
All that's needed is a guy getting hit in the nuts and a food fight to have the first film solely based on cinematic clichés. I can't wait to see the deleted scenes when it comes out on DVD.
Obviously, Hardball is a strikeout of a movie that never gets the bat anywhere near the ball. It stars Keanu Reeves as the aforementioned gambler, who seems to owe every bookie in Chicago an amount of money that rivals the gross national product of Guam. Out of solutions, he begs his successful corporate friend (the always welcome Mike McGlone) to lend him $5,000. Instead, McGlone offers Reeves the chance to help him coach a youth baseball team from the projects for a nice weekly stipend.
Reeves, who wants to keep his fingers, accepts the offer, but discovers McGlone is only too happy to let him handle the team entirely. The drowsy-voiced protagonist must teach the sassy inner city kids the baseball basics in a life of absentee parents and merciless gangs. And maybe, just maybe, they'll play in the big championship game.
One of the glorious surprises in the screenplay by John Gatins (Summer Catch), adapted from Daniel Coyle's non-fiction book, is that there aren't any. The movie coasts from heartfelt moment to heartfelt moment like a zombie. That wouldn't be so bad, if the characters had an ounce of subtlety or humanity to them. Most of the kids' time is spent yelling at each other, talking in slang and acting surprised. There's little that's naturally amusing about them, as they all seem to know the cameras are rolling. The worst of the lot is a tough-talking younger player (DeWayne Warren) whose sole purpose, as the movie unfolds, is being an emotional pawn, a tactic so utterly despicable I can't find the right words to express myself.
The adults also don't fare well.  The character is poorly written, but Reeves gives another charisma-free performance. Every time he speaks, he sounds like he just got up from a long nap and is gradually waking up. Kids are supposed to rally around this guy? Diane Lane, who co-stars as Reeves' obligatory love interest, remains a glowing screen presence (see My Dog Skip for better proof). It's too bad that her role here consists of uttering lines like, "These kids trust you, and they don't trust anyone!" Then there's D.B. Sweeney as an evil rival coach and John Hawkes as Reeves' scummy betting buddy and other unoriginal characters you've seen before and hope never to see again.
I wanted Hardball to be good. Robbins' Varsity Blues was a funny and alternately taut tale of Texas high school football that had Ali Larter smothered in whipped cream and Jon Voight sneering at everything that moved. I haven't seen Robbins' goofy Ready to Rumble in its entirety, but I am intrigued that "Macho Man" Randy Savage and Martin Landau can exist in the same movie without there being serious worldwide repercussions.
Robbins obviously needs to go back to his forte -- making sports movies for guys and not cutesy, cuddly pap such as Hardball, which also manages to annoy and insult the audience. Here's hoping that happens in the immediate future.
RATING: *1/2
|------------------------------| \ ***** Perfection \ \ **** Good, memorable film \ \ *** Average, hits and misses \ \ ** Sub-par on many levels \ \ * Unquestionably awful \ |------------------------------|
MPAA Rating: PG-13
Director: Michael Robbins Producer: Tina Nides, Mike Nollins, Michael Robbins Writer: John Gatins Starring: Keanu Reeves, Diane Lane, John Hawkes, D.B. Sweeney, Mike McGlone, DeWayne Warren
http://www.hardballmovie.com
--- http://www.amazon.com/exec/obidos/redirect?tag=filmcriticcom&path=subst/video/sellers/amazon-top-100-dvd.html Movie Fiends: Check out Amazon.com's Top 100 Hot DVDs!
Visit filmcritic.com on the Web at http://www.filmcritic.com
========== X-RAMR-ID: 29484 X-Language: en X-RT-ReviewID: 250330 X-RT-TitleID: 1109876 X-RT-SourceID: 178 X-RT-AuthorID: 3402 X-RT-RatingText: 1.5/5
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


Definition at line 15 of file imagecollectionencoder.h.
Public Types | |
| enum | Deadline { REALTIME, GOOD_QUALITY, BEST_QUALITY, REALTIME, GOOD_QUALITY, BEST_QUALITY } |
Public Member Functions | |
| BOOST_STATIC_CONSTANT (int, DO_NOT_LINGER=0) | |
| BOOST_STATIC_CONSTANT (int, LINGER_FORVER=-1) | |
| void | encode (const Serializable &serializable, PTS pts, Buffer &buffer) |
| void | flush (Buffer &buffer) |
| ImageCollectionEncoder (Deadline deadline, int lingerInterval) |


This service is simply to test datadog implementation with nginx
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
Please refer to datadog panel for metrics on this service


Only the Brave
Only the Brave is a movie starring Josh Brolin, Miles Teller, and Jeff Bridges. Based on the true story of the Granite Mountain Hotshots, a group of elite firefighters who risk everything to protect a town from a historic wildfire.


Hi! Im Ben, a Front-end web developer from the Central Coast currently working in Newcastle. I like all things technology, gaming, coffee, Formula 1, NFL and lots of genres of music, especially EDM and power metal. Sometimes I write about these things, so here are my ramblings.


Custom Response Class
Warning
This is a rather advanced topic.
If you are starting with FastAPI, you might not need this.
By default, FastAPI will return the responses using Starlette's JSONResponse
.
You can override it by returning a Response
directly as seen in Return a Response directly.
But if you return a Response
directly, the data won't be automatically converted, and the documentation won't be automatically generated (for example, including the specific "media type", in the HTTP header Content-Type
).
But you can also declare the Response
that you want to be used, in the path operation decorator.
The contents that you return from your path operation function will be put inside of that Response
.
And if that Response
has a JSON media type (application/json
), like is the case with the JSONResponse
and UJSONResponse
, the data you return will be automatically converted (and filtered) with any Pydantic response_model
that you declared in the path operation decorator.
Note
If you use a response class with no media type, FastAPI will expect your response to have no content, so it will not document the response format in its generated OpenAPI docs.
Use UJSONResponse
¶
For example, if you are squeezing performance, you can install and use ujson
and set the response to be Starlette's UJSONResponse
.
Import the Response
class (sub-class) you want to use and declare it in the path operation decorator.
from fastapi import FastAPI
from starlette.responses import UJSONResponse
app = FastAPI()
@app.get("/items/", response_class=UJSONResponse)
async def read_items():
return [{"item_id": "Foo"}]
Note
Notice that you import it directly from starlette.responses
, not from fastapi
.
Info
The parameter response_class
will also be used to define the "media type" of the response.
In this case, the HTTP header Content-Type
will be set to application/json
.
And it will be documented as such in OpenAPI.
HTML Response¶
To return a response with HTML directly from FastAPI, use HTMLResponse
.
- Import
HTMLResponse
. - Pass
HTMLResponse
as the parametercontent_type
of your path operation.
from fastapi import FastAPI
from starlette.responses import HTMLResponse
app = FastAPI()
@app.get("/items/", response_class=HTMLResponse)
async def read_items():
return """

<title>Some HTML in here</title>

Look ma! HTML!

"""
Note
Notice that you import it directly from starlette.responses
, not from fastapi
.
Info
The parameter response_class
will also be used to define the "media type" of the response.
In this case, the HTTP header Content-Type
will be set to text/html
.
And it will be documented as such in OpenAPI.
Return a Starlette Response
¶
As seen in Return a Response directly, you can also override the response directly in your path operation, by returning it.
The same example from above, returning an HTMLResponse
, could look like:
from fastapi import FastAPI
from starlette.responses import HTMLResponse
app = FastAPI()
@app.get("/items/")
async def read_items():
html_content = """

<title>Some HTML in here</title>

Look ma! HTML!

"""
return HTMLResponse(content=html_content, status_code=200)
Warning
A Response
returned directly by your path operation function won't be documented in OpenAPI (for example, the Content-Type
won't be documented) and won't be visible in the automatic interactive docs.
Info
Of course, the actual Content-Type
header, status code, etc, will come from the Response
object your returned.
Document in OpenAPI and override Response
¶
If you want to override the response from inside of the function but at the same time document the "media type" in OpenAPI, you can use the response_class
parameter AND return a Response
object.
The response_class
will then be used only to document the OpenAPI path operation, but your Response
will be used as is.
Return an HTMLResponse
directly¶
For example, it could be something like:
from fastapi import FastAPI
from starlette.responses import HTMLResponse
app = FastAPI()
def generate_html_response():
html_content = """

<title>Some HTML in here</title>

Look ma! HTML!

"""
return HTMLResponse(content=html_content, status_code=200)
@app.get("/items/", response_class=HTMLResponse)
async def read_items():
return generate_html_response()
In this example, the function generate_html_response()
already generates a Starlette Response
instead of the HTML in a str
.
By returning the result of calling generate_html_response()
, you are already returning a Response
that will override the default FastAPI behavior.
But as you passed the HTMLResponse
in the response_class
, FastAPI will know how to document it in OpenAPI and the interactive docs as HTML with text/html
:
Additional documentation¶
You can also declare the media type and many other details in OpenAPI using responses
: Additional Responses in OpenAPI.


Proposal for Improving Artisanal and Small-Scale Mining in Ghana - Role of Professional Engineers.
Environmental Issues of Artisanal and Small-Scale Mining in the Tarkwa Mining Area of Ghana.
Pending...


at_end_of_stream/[0,1]
[ISO]at_end_of_stream
at_end_of_stream(
+Stream)
Tests whether the end has been reached for the current input stream or for the input stream Stream.
A valid Prolog input stream, defaults to the current input stream.
Checks if the end has been reached for the specified input stream. An input stream reaches the end when all items (characters or bytes) except `EOF' (-1) of the stream have been read. It remains at the end after `EOF' has been read.
Stream errors (see ref-iou-sfh-est), plus:
existence_error
at_end_of_stream/[0,1]
peeks ahead for next input item if there is
no item available on the buffer of the specified input stream.
Note that at_end_of_stream/[0,1]
never blocks. If reading ahead
would block then at_end_of_stream/[0,1]
will fail, even if the
stream is actally at its end. If you want ensure that end of stream
condition is always properly detected, even if that entails blocking
until further input is possible, you can use peek_code/[1,2]
or
peek_byte/[1,2]
.
at_end_of_line/[0,1]
.


Click any of product you would like to purchase!
You would need to choose 25 times. Result will shown at the end.


Sentiment of Twitter
Please Input the Twitter text:
0.0 means neutral sentiment------1.0 means positive sentiment------2.0 means negative sentiment
result
Calculate
this is a lable
View Streaming


Alexander Jamesworthy
About
Blog
Contact
Engagements
I love taking engagement photos. Here are some lovely engaged couples I’ve been able to work with.


the and Ae. was for with human malayensis The that were sylvatic aegypti from odor vector virus females not {background competence DENV between attraction mosquitoes population transmission margin (/) are this {border-style mosquito only trap YFV px;} #ffffff;} (Fig. proportion two using bridge but each into Aedes species which blood dengue infection than their Laos arbovirus humans (i.e., Nakai cycles experiments lower our statistically vs. DENV- chamber control difference fever infected laboratory olfactometer percentage rate such used yellow min This Trop. arboviruses did overall significantly Med. RNA also blood-fed both control. during estimated included infectious performed potential px; release significant {font-family Institut Laos. Vector YFV. aegypti, after colony competent described disseminated flight font-size its may odor. other previously respectively risk µL (). (full Nam Pasteur South-East Transmission Virus activity analyzed data double; experiment, experiments, indicate lack meal presence represent rural saliva. study these they trapped °C, Authority Dis.e./journal.pntd. French Lao Management Negl. Protection Theun Watershed act been border-color border-width can chose conditions. containing days display district, emergence experimental feeding final following found have isolate low midgut more obtained odor, one populations reaction relative saliva solid; species, studies subsequently supplemented through towards traps under viruses where without {font-style {font-weight sec °C (p = .) (p = .). .–.) Asia Attraction CI: Commons Creative Figure For However, Infection London National Singapore Tropical YFV, [], all analyses antibody any approved authors bars because behavior bold chikungunya collected combination combined contribute courier; cycles. design differ different em; erythrocytes experiment experiments. female followed forests had humans. indicating indices less non-human odor) out package peridomestic positive pt;} replicate samples shed showed there underlying vectors viral virus-positive will °C.


SEGA Games' CEO models the new Sonic Puma trainers
by My Nintendo News AdminPuma has been busy working alongside SEGA to make some hip and stylish Sonic trainers. The end result is fairly impressive given some of the wacky ideas they could have gone with. The Sonic the Hedgehog Puma trainers have been modelled by SEGA Games’ CEO and published on Twitter. Check out the sleek new trainers below.


I discovered Syrian Rue through the book 'Legal Highs' before the Internet was born and Ayahusca mixtures were well documented in the USA.
I was very experienced with weed, alcohol, mushrooms and LSD. I knew what an intense hallucinogenic experience was like.
Preparation: I smashed the 7 grams wrapped in newspaper with a claw hammer. I placed the results in about 2 liters of water and boiled it for well over an hour. The mixture was filtered through a regular paper towel. It had the yellow green color of anti-freeze. I boiled the mixture down to a juice glass sized portion. The mixture seemed to glow with a yellowish-green light of its own.
I took a visiting friend home as I didn't want to drive after taking the mixture. When I returned I promptly drank the mixture. It smelled and tasted (I imagine) like a tomato vine smells when it is crushed.
Let me specify what I had done wrong before this experiment.

 The neighbor's lawn mower was sounding as it always did and then very quickly the sound blended with every other sound in the universe into a cosmic familiar 'OM'.
Five minutes later I was upstairs pacing the hallway in a panic. I was dizzy and becoming nauseated very rapidly.
At 20 minutes into the trip the vomiting began with no warning. I spewed for what seemed like hours while my closed eye visuals quickly overwhelmed me. I couldn't handle the input my open eyes provided me and when they were closed I was seeing an endless stream of eyeballs coming directly at me and felt them passing through my head.
I was lying face down on the bathroom floor finding some comfort in the coolness of the tile. I was not even trying to hit the toilet when I puked anymore. My brother asked me if I felt like I had been poisoned and needed to go to the hospital. I said yes but there was nothing the ER could do for me (I have no idea if that is true).
He left the house so he wouldn't be responsible for my death if that happened. That's just the way he was back in the day. As he left I heard the car leaving the driveway and at the same time I was looking down from the sky watching his car driving away as if I were a bird flying over the house viewing the whole scene from the sky.
The interesting part of the experience was that I could leave my sickened body at will and experience other cartoonish realities and then snap back into my body and promptly vomit again. My visions were set in the jungle and the dessert. I would feel sand between my toes then I was back in my bed and I would immediately throw up on my bedroom carpet.
All in all I was gravely ill for about eight hours.
Years later I tried the substance again but heeded the warnings about dangerous combinations of food, alcohol etc. This time it wasn't sickening like before but also there weren't the hallucinations, OBEs or near death experience.
I would not recommend trying this to anyone. I am sure I am lucky to be alive.
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.


Implementation¶
This section shows how the linear regression extensions discussed in this chapter are typically fit in Python. First let’s import the Boston housing dataset.
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn import datasets
boston = datasets.load_boston()
X_train = boston['data']
y_train = boston['target']
Regularized Regression¶
Both Ridge and Lasso regression can be easily fit using scikit-learn
. A bare-bones implementation is provided below. Note that the regularization parameter alpha
(which we called \(\lambda\)) is chosen arbitrarily.
from sklearn.linear_model import Ridge, Lasso
alpha = 1
# Ridge
ridge_model = Ridge(alpha = alpha)
ridge_model.fit(X_train, y_train)
# Lasso
lasso_model = Lasso(alpha = alpha)
lasso_model.fit(X_train, y_train);
In practice, however, we want to choose alpha
through cross validation. This is easily implemented in scikit-learn
by designating a set of alpha
values to try and fitting the model with RidgeCV
or LassoCV
.
from sklearn.linear_model import RidgeCV, LassoCV
alphas = [0.01, 1, 100]
# Ridge
ridgeCV_model = RidgeCV(alphas = alphas)
ridgeCV_model.fit(X_train, y_train)
# Lasso
lassoCV_model = LassoCV(alphas = alphas)
lassoCV_model.fit(X_train, y_train);
We can then see which values of alpha
performed best with the following.
print('Ridge alpha:', ridgeCV.alpha_)
print('Lasso alpha:', lassoCV.alpha_)
Ridge alpha: 0.01
Lasso alpha: 1.0
Bayesian Regression¶
We can also fit Bayesian regression using scikit-learn
(though another popular package is pymc3
). A very straightforward implementation is provided below.
from sklearn.linear_model import BayesianRidge
bayes_model = BayesianRidge()
bayes_model.fit(X_train, y_train);
This is not, however, identical to our construction in the previous section since it infers the \(\sigma^2\) and \(\tau\) parameters, rather than taking those as fixed inputs. More information can be found here. The hidden chunk below demonstrates a hacky solution for running Bayesian regression in scikit-learn
using known values for \(\sigma^2\) and \(\tau\), though it is hard to imagine a practical reason to do so
By default, Bayesian regression in scikit-learn
treats \(\alpha = \frac{1}{\sigma^2}\) and \(\lambda = \frac{1}{\tau}\) as random variables and assigns them the following prior distributions
Note that \(E(\alpha) = \frac{\alpha_1}{\alpha_2}\) and \(E(\lambda) = \frac{\lambda_1}{\lambda_2}\). To fix \(\sigma^2\) and \(\tau\), we can provide an extremely strong prior on \(\alpha\) and \(\lambda\), guaranteeing that their estimates will be approximately equal to their expected value.
Suppose we want to use \(\sigma^2 = 11.8\) and \(\tau = 10\), or equivalently \(\alpha = \frac{1}{11.8}\), \(\lambda = \frac{1}{10}\). Then let
This guarantees that \(\sigma^2\) and \(\tau\) will be approximately equal to their pre-determined values. This can be implemented in scikit-learn
as follows
big_number = 10**5
# alpha
alpha = 1/11.8
alpha_1 = big_number*alpha
alpha_2 = big_number
# lambda
lam = 1/10
lambda_1 = big_number*lam
lambda_2 = big_number
# fit
bayes_model = BayesianRidge(alpha_1 = alpha_1, alpha_2 = alpha_2, alpha_init = alpha,
lambda_1 = lambda_1, lambda_2 = lambda_2, lambda_init = lam)
bayes_model.fit(X_train, y_train);
Poisson Regression¶
GLMs are most commonly fit in Python through the GLM
class from statsmodels
. A simple Poisson regression example is given below.
As we saw in the GLM concept section, a GLM is comprised of a random distribution and a link function. We identify the random distribution through the family
argument to GLM
(e.g. below, we specify the Poisson
family). The default link function depends on the random distribution. By default, the Poisson model uses the link function
which is what we use below. For more information on the possible distributions and link functions, check out the statsmodels
GLM docs.
import statsmodels.api as sm
X_train_with_constant = sm.add_constant(X_train)
poisson_model = sm.GLM(y_train, X_train, family=sm.families.Poisson())
poisson_model.fit();