| Home | Trees | Indices | Help |
|
|---|
|
|
A Node is the basic building block of an MDP application.
It represents a data processing element, like for example a learning algorithm, a data filter, or a visualization step. Each node can have one or more training phases, during which the internal structures are learned from training data (e.g. the weights of a neural network are adapted or the covariance matrix is estimated) and an execution phase, where new data can be processed forwards (by processing the data through the node) or backwards (by applying the inverse of the transformation computed by the node if defined).
Nodes have been designed to be applied to arbitrarily long sets of data: if the underlying algorithms supports it, the internal structures can be updated incrementally by sending multiple batches of data (this is equivalent to online learning if the chunks consists of single observations, or to batch learning if the whole data is sent in a single chunk). It is thus possible to perform computations on amounts of data that would not fit into memory or to generate data on-the-fly.
A Node also defines some utility methods, like for example copy and save, that return an exact copy of a node and save it in a file, respectively. Additional methods may be present, depending on the algorithm.
Node subclasses should take care of overwriting (if necessary) the functions is_trainable, _train, _stop_training, _execute, is_invertible, _inverse, _get_train_seq, and _get_supported_dtypes. If you need to overwrite the getters and setters of the node's properties refer to the docstring of get_input_dim/set_input_dim, get_output_dim/set_output_dim, and get_dtype/set_dtype.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from Inherited from |
|
|||
|
|||
|
|
|||
|
_train_seq List of tuples: |
|||
|
dtype dtype |
|||
|
input_dim Input dimensions |
|||
|
output_dim Output dimensions |
|||
|
supported_dtypes Supported dtypes |
|||
|
Inherited from |
|
|
|
If the input dimension and the output dimension are unspecified, they will be set when the train or execute method is called for the first time. If dtype is unspecified, it will be inherited from the data it receives at the first call of train or execute. Every subclass must take care of up- or down-casting the internal structures to match this argument (use _refcast private method when possible).
|
repr(x)
|
str(x)
|
|
|
|
|
Return the list of dtypes supported by this node. The types can be specified in any format allowed by |
|
|
|
This method contains all pre-execution checks. It can be used when a subclass defines multiple execution methods. |
This method contains all pre-inversion checks. It can be used when a subclass defines multiple inversion methods. |
|
|
|
|
|
|
|
Process the data contained in If the object is still in the training phase, the function
stop_training will be called.
By default, subclasses should overwrite _execute to implement their execution phase. The docstring of the _execute method overwrites this docstring. |
Return the index of the current training phase. The training phases are defined in the list self._train_seq. |
|
|
|
Return the number of training phases still to accomplish. If the node is not trainable then return 0. |
Return dtypes supported by the node as a list of Note that subclasses should overwrite self._get_supported_dtypes when needed. |
|
Invert If the node is invertible, compute the input By default, subclasses should overwrite _inverse to implement their inverse function. The docstring of the inverse method overwrites this docstring. |
|
|
|
Save a pickled serialization of the node to Note: the pickled Node is not guaranteed to be forwards or backwards compatible. |
Set internal structures' dtype. Perform sanity checks and then calls self._set_dtype(n), which
is responsible for setting the internal attribute |
Set input dimensions. Perform sanity checks and then calls self._set_input_dim(n), which
is responsible for setting the internal attribute |
Set output dimensions. Perform sanity checks and then calls self._set_output_dim(n), which
is responsible for setting the internal attribute |
Stop the training phase. By default, subclasses should overwrite _stop_training to implement this functionality. The docstring of the _stop_training method overwrites this docstring. |
Update the internal structures according to the input data
By default, subclasses should overwrite _train to implement their training phase. The docstring of the _train method overwrites this docstring. Note: a subclass supporting multiple training phases should implement the same signature for all the training phases and document the meaning of the arguments in the _train method doc-string. Having consistent signatures is a requirement to use the node in a flow. |
|
_train_seqList of tuples: [(training-phase1, stop-training-phase1), (training-phase2, stop_training-phase2), ...] By default: _train_seq = [(self._train, self._stop_training)]
|
dtypedtype |
input_dimInput dimensions
|
output_dimOutput dimensions
|
supported_dtypesSupported dtypes
|
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1-MDP on Mon Apr 27 21:56:16 2020 | http://epydoc.sourceforge.net |


Introduction to By Michael Mottola
What is Heroku?
A Cloud Platform as a Service (PaaS)
- Lets you easily deploy, run and manage applications written in:
Company Info
- Based out of San Francisco
- Founded in 2007 by application developers, as part of Y Combinator
- Originally supported only Ruby
- Acquired by Salesforce.com in December 2010 (For $250 million dollars)
- Yukihiro "Matz" Matsumoto, joined the company as Chief Architect
How Heroku Works
- Heroku platform builds your application from your source code and dependency descriptions.
- Executes a command to run your application (ex: starting a server)
- How you define your application and dependencies varies:
- Ruby uses Gemfile
- Python uses requirements.txt
- Node.js uses package.json
- Java uses pcm.xml
How Heroku Runs Your Application
- If using an established framework, Heroku figures it how to run your application:
- Ruby is rails server
- Djano is python <app>/manage.py runserver
- Node.js uses main field in package.json
- Else you must explicitly declare how your app is executed:
- Create text file called Procfile
web: bundle exec rails server -p $PORT
Where Is Your Application Running
- Lightweight Linux containers that runs a single user-specified command, called a Dyno
- Single dyno can serve thousands of requests per second
- Types of Dynos:
- Web Dynos: only receive HTTP traffic from Heroku's routers
- Worker Dynos: used for background jobs, queueing and timed jobs
- One-off Dynos: temporary, runs detached or from terminal
- Under the hood, Heroku is using Amazon Web Services; EC2 instances
Heroku Router
- Inbound requests are received by a load balancer and passed to a set of routers
- Routers determine location of your application's web dynos and forward the HTTP request
Heroku Toolbelt
Heroku Command Line Interface (CLI) for managing and scaling applications and add-ons.
https://toolbelt.heroku.com/
$ heroku login
Enter your Heroku credentials.
Email<EMAIL_ADDRESS>Password (typing will be hidden):
Authentication successful.
Create a Heroku App
$ heroku create my-app
Creating my-app... done, stack is cedar-14
http://my-app.herokuapp.com/ | git@heroku.com:my-app.git
Deploying Your Application
- Heroku primarily uses git for deploying applications
- GitHub Integration, Dropbox Sync and an API are also options
Deploy command:
git push heroku master
Scaling Your Application
- Scaling Horizontally: add more dynos
- more web dynos means more concurrent HTTP requests
- Scaling Vertically: using bigger dynos (increase RAM)
Scaling with command line:
heroku ps:scale web=2
Other Heroku Toolbelt Commands
- General commands:
- heroku apps
- heroku keys
- heroku keys:add
- App Specific Commands
- heroku create
- heroku config
- heroku ps
- heroku info
- heroku logs
- heroku run
/


About
|
Log in
|
Labels
Chronological
Priority
+Add TODO
Create
Done
edit
Done
DONE
some item name
edit
delete


We are a fictional company used to demonstrate the awesome power of CircleCI.
Sample code can be found in our code repo


All the cells here are layed out using the SlidingGridPanel. This panel is a wrapper for slidegrid.js, which automatically moves cells to fit nicely in any parent container.
More information on the sliding grid can be found in Create Your Own Sliding Resizable Grid.


As part of the Canada-Ontario Job Grant, the ministry has launched two, new, employer-driven skills training pilots:
- Canada-Ontario Job Grant: Customized Training pilot will assist in the development and delivery of firm-specific training solutions that meet employers’ workforce development needs, where no such training exists.
- Canada-Ontario Job Grant: UpSkill pilot will support employers in participating sectors meet their workforce development needs by providing employees with short-term technical and essential skills training aligned with the shared needs of the sector.
For both types the training is intended for employed individuals acquiring new skills for their current job, or to prepare for another job with the same employer, and for unemployed individuals seeking a new job. The employer must have a job available at the end of the training for the individual being trained.
Training must not exceed one year in duration and must be provided by one of the following:
- Colleges of applied arts and technology
- Publicly-assisted universities
- School boards
- Private trainers operating in compliance with the Private Career Colleges Act, 2005
- Union-based training centres
- Product vendors.


LocalizationSimplified Really simple localization for Rails By Jesper Rønn-Jensen ( justaddwater.dk/ ) Plugin available at rubyforge.org/projects/l10n-simplified/
| About | = | { :lang => "cf", :updated => "2006-09-07" |
| About | = | { :lang => "chef", :updated => "2006-09-07" |
| About | = | { :lang => "da", :updated => "2006-09-07" |
| About | = | { :lang => "de", :updated => "2006-09-07" |
| About | = | { :lang => "en", :updated => "2006-09-01" |
| About | = | { :lang => "es", :updated => "2006-09-07" |
| About | = | { :lang => "fi", :updated => "2006-09-07" |
| About | = | { :lang => "fr", :updated => "2006-09-03" |
| About | = | { :lang => "fr", :updated => "2006-08-24" |
| About | = | { :lang => "nl", :updated => "2006-08-23" |
| About | = | { :lang => "pirate", :updated => "2006-09-07" |
| About | = | { :lang => "se", :updated => "2006-09-07" |
| About | = | { :lang => "en",#add locale code here :updated => "2006-09-01" |
Modify DateHelper distance_of_time_in_words
# File lib/localization_simplified.rb, line 20 20: def self.distance_of_time_in_words(from_time, to_time = 0, include_seconds = false) 21: from_time = from_time.to_time if from_time.respond_to?(:to_time) 22: to_time = to_time.to_time if to_time.respond_to?(:to_time) 23: distance_in_minutes = (((to_time - from_time).abs)/60).round 24: distance_in_seconds = ((to_time - from_time).abs).round 25: 26: #First, I invent a variable (makes it easier for future i10n) 27: messages = LocalizationSimplified::DateHelper::Texts #localized 28: case distance_in_minutes 29: when 0..1 30: return (distance_in_minutes==0) ? messages[:less_than_a_minute] : messages[:one_minute] unless include_seconds 31: case distance_in_seconds 32: when 0..5 then format( messages[:less_than_x_seconds], 5 ) 33: when 6..10 then format( messages[:less_than_x_seconds], 10 ) 34: when 11..20 then format( messages[:less_than_x_seconds], 20 ) 35: when 21..40 then messages[:half_a_minute] 36: when 41..59 then messages[:less_than_a_minute] 37: else messages[:one_minute] 38: end 39: 40: when 2..45 then format(messages[:x_minutes], distance_in_minutes) 41: when 46..90 then messages[:one_hour] 42: when 90..1440 then format( messages[:x_hours], (distance_in_minutes.to_f / 60.0).round ) 43: when 1441..2880 then messages[:one_day] 44: else format( messages[:x_days], (distance_in_minutes / 1440).round ) 45: end 46: end
substitute all daynames and monthnames with localized names from RUtils plugin
# File lib/localization_simplified.rb, line 10 10: def self.localize_strftime(date='%d.%m.%Y', time='') 11: date.gsub!(/%%/, @@ignore) 12: date.gsub!(/%a/, LocalizationSimplified::DateHelper::AbbrDaynames[time.wday]) 13: date.gsub!(/%A/, LocalizationSimplified::DateHelper::Daynames[time.wday]) 14: date.gsub!(/%b/, LocalizationSimplified::DateHelper::AbbrMonthnames[time.mon]) 15: date.gsub!(/%B/, LocalizationSimplified::DateHelper::Monthnames[time.mon]) 16: date.gsub!(@@ignore, '%%') 17: end


An application for a user to create profiles to remind them to send a card or gift for special occasions and holidays.
An application for a user to create and save notes.
An application that will generate a random password, based on user inputs.
Project to allow a user to choose a city and display the current weather and the 5 day forecast for that city
A fun application that has a user input a burger and then devour it..
An application designed for the reader who travels or dreams of traveling. The user picks a city and the application renders a list of books set in that city.


URLs:
Comma separated list of url regex patterns where the extension should be available.
WARNING: If left blank the extension will be available everywhere.
Save


The notation used to define the syntax of the Cminor language is a variation of Parsing Expression Grammar or PEG notation for short (See also wikipedia article for PEG.) In PEG ambiguities that can arise in general context-free grammars are avoided by defining a ordered choice operator that tests each alternative in a body of a rule in order and defines that the first alternative that matches input always wins without testing alternatives that come after it.
The syntax notation used in this Cminor language reference uses the pipe symbol, | for separating alternatives, but its semantics is ment to be the same as the semantics of PEG's ordered choice operator.
A grammar that defines the structure of some language consists of productions or rules that define strings of symbols that belong to the language. A production consists of a head, a production symbol, →, and a body. The head names the production. The body consists of terminal and nonterminal symbols and grammar operators. Collectively the terminal symbols used in bodies of the rules form an alphabet of the language. An alphabet is commonly denoted by the greek letter Σ. The alphabet can be the set of ASCII characters, symbols 0 and 1 (a binary alphabet) or a set of Unicode character, for example. The alphabet for Cminor is the set of Unicode characters. The names of the rules are also called nonterminal symbols. Each nonterminal represents strings of terminals and forms a sublanguage of the whole language. Terminals, nonterminals and grammar operators are collectively called grammar symbols.
In this language reference terminals are shown using a monospace font, nonterminals are shown in italic and grammar operators are in serif font like this: [ ], +, −, etc. Cminor keywords are shown in bold. They are terminal strings.
Given two grammar expressions α and β, that represent strings consisting terminals, nonterminals and grammar operators, expression α | β represents ordered choice of α and β.
An expression α β represents strings of terminals consisting strings represented by α catenated with strings represented by β.
An expression α − β represents strings that match α but do not match β.
An expression α ^ β represents strings that match either α or β but not both.
An expression α & β represents strings that match both α and β.
An expression α % β is a short-hand notation for expression α ( β α )*.
An expression α* represents the Kleene closure of α, that is: the empty string, strings represented by α, strings represented by sequence expression α α, strings represented by sequence expression α α α, and so on.
An expression α+ represents strings represented by α, strings represented by sequence expression α α, and so on. That is: we exclude the empty string from α*.
An expression α? represents the empty string or strings represented by single α.
Parentheses ( ) are used to group strings of grammar symbols. They are slightly taller than parentheses used to denote terminal symbols ( ).
Terminal symbol a represents a string consisting of sole symbol a. Terminal symbol combination \n represents a newline character, combination \r represents a carriage return character, and combination \\ represents backslash.
Keyword keyword represents a Cminor keyword string keyword. Strings that are equal to a keyword string but continue with some identifier character do not match a keyword. For example, input string "classified" does not match keyword class.
Expression [a − z] denotes a single lower case Latin letter character. Expression [^ a − f] denotes a single character excluding characters from a to f.
Sometimes syntax would be so verbose that it is more convenient to describe it in plain text. This is denoted by english text in apostrophes: 'complicated syntax'.
| alternative | → | sequence (| sequence)* |
| sequence | → | difference difference* |
| difference | → | exclusive-or (− exclusive-or)* |
| exclusive-or | → | intersection (^ intersection)* |
| intersection | → | intersection (& intersection)* |
| list | → | postfix (% postfix)? |
| postfix | → | primary (* | + | ?)? |
| primary | → | rule‑name | primitive | grouping |
| rule‑name | → | id |
| id | → | [a−z A−Z −]+ [a−z A−Z 0−9 −]* |
| primitive | → | terminal | char‑class |
| grouping | → | ( alternative ) |
| terminal | → | 'any Unicode character' |
| char‑class | → | [ ^? char‑range* ] |
| char‑range | → | char ( − char )? |
| char | → | [^ \\\]] | escape |
| escape | → | \\ ([xX] hex | [dD] dec | [^ xXdD] ) |
| hex | → | hex‑digit+ |
| hex‑digit | → | [0−9a−fA−F] |
| dec | → | dec‑digit+ |
| dex‑digit | → | [0−9] |


3. The DRY Principle¶
DRY stands for Don’t Repeat Yourself. It’s the principle that says that you should simplyfy your code by eliminating repetitions.
3.1. Global Variables¶
One important source of repetitions in Stata Do files are directory names. Often, you perform many saving and opening operations over files located under the same directory.
This can be annoying when doing collaborative research, because directory names are usually not the same for all researchers. What ends up happening, is that each researcher will have to change the directory name to accomodate their file system, which is a waste of time.
You can make it easy for other researchers to follow, by defining the directory name into a global variable:
global var main_dir = "C:\Users\MyUser\Research\Project\"
global var parents_data = "parents"
global var children_data = "children"
global var family_data = "family_data"
Then, you’d use it across your project as:
save "$main_dir\$children_data\children_survey.dta", replace
sort family_ID
merge family_ID using "$main_dir\$parents_data\parents_survey.dta"
save "$main_dir\family_data\family.dta"
As you can see, the path in main_dir is present three times in this file. Changing the text one by one would be a real trouble. By defining the path through a global variable, this task has been reduced to changing just one line of code!
3.2. Loops¶
Do files often contain blocks that repeat a single logic once and once again. Look at this example:
gen total_primary = rowtotal(boys_primary, girls_primary)
gen total_secondary = rowtotal(boys_secondary, girls_secondary)
gen total_university = rowtotal(boys_university, girls_university)
Obviously there’s some repetition here, which could easily be refactored into:
foreach i in "primary" "secondary" "university" {
gen total_`i' = rowtotal(boys_`i', girls_`i')
}
Much cleaner! Maybe you’ll tell me that we haven’t achieved much, since we’re still using three lines of code. Well, look at the following block:
gen total_grade_1 = rowtotal(boys_grade_1, girls_grade_1)
gen total_grade_2 = rowtotal(boys_grade_2, girls_grade_2)
gen total_grade_3 = rowtotal(boys_grade_3, girls_grade_3)
gen total_grade_4 = rowtotal(boys_grade_4, girls_grade_4)
gen total_grade_5 = rowtotal(boys_grade_5, girls_grade_5)
gen total_grade_6 = rowtotal(boys_grade_1, girls_grade_6)
gen total_grade_7 = rowtotal(boys_grade_7, girls_grade_7)
gen total_grade_8 = rowtotal(boys_grade_8, girls_grade_8)
gen total_grade_9 = rowtotal(boys_grade_9, girls_grade_9)
This is wrong on several levels:
- First, the person who wrote this most certainly copied the first line nine times, and then changed the numbers. This is error prone! In this case, there’s an error on line 6, because the person did not substitute the boys_grade_1 variable inside the rowtotal function.
- Second, large blocks of repetitive code make it difficult to notice such errors, which is scary. If you submitted your paper to an academic journal, a referee would have noted that the summary statistics for grade 6 don’t match. You’d then have to reply that it was a copy-paste error… how awkward is that!?
Believe or not, researchers are humans too, they shouldn’t put their attention span to test in blocks like that one. A cleaner solution would be:
foreach g of numlist 1/9{
gen total_grade_`g' = rowtotal(boys_grade_`g', girls_grade_`g')
}
This is a much simpler piece of code that explains itself and is less error-prone.
If you wanted to make it even more descriptive, you could throw in some display statements to help you know where the loop is running, and add a comment line before the loop explaining what it does:
// Generate total number of students by grade:
foreach g of numlist 1/9{
display "Generating total_grade_"`g'
gen total_grade_`g' = rowtotal(boys_grade_`g', girls_grade_`g')
}
Warning
Don’t over-simplify your code to the point where it becomes hard to understand. The purpose here is to make your code readable to other humans, including you in the future. Therefore, readability has the biggest priority.
3.3. Global Variables And Loops¶
You can combine global variables and loops to write more manageable analysis files. Imagine a case where you need to estimate a regression:
- Using three different sets of variables
- For two different sample definitions: male-only and female-only
- For two different dependent variables
In this case you have 3x2x2 = 12 different equations to estimate. The simplest version of such a file would look like this:
reg math_score iq_score if girl==0
eststo
reg math_score iq_score father_educ mother_educ if girl==0
eststo
reg math_score iq_score father_educ mother_educ fam_income if girl==0
eststo
reg math_score iq_score if girl==1
eststo
reg math_score iq_score father_educ mother_educ if girl==0
eststo
reg math_score iq_score father_educ mother_educ fam_income if girl==1
eststo
esttab using "results\math.csv", star(* .1 ** .05 *** .01) b(3) se(3) replace
estimates clear
reg lang_score iq_score if girl==0
eststo
reg lang_score iq_score father_educ mother_educ if girl==0
eststo
reg lang_score iq_score father_educ mother_educ fam_income if girl==0
eststo
reg lang_score iq_score if girl==1
eststo
reg lang_score iq_score father_educ mother_educ if girl==1
eststo
reg lang_score iq_score father_educ mother_educ fam_income if girl==1
eststo
esttab using "results\lang.csv", star(* .1 ** .05 *** .01) b(3) se(3) replace
estimates clear
I hid a typo somewhere in that code. You noticed it, didn’t you?
Let’s restructure this code. First, let’s define the three model specifications using global variables:
* Specification 1
global spec_1 "iq_score"
* Specification 2
global spec_2 "$spec_1 father_educ mother_educ"
* Specification 3
global spec_3 "$spec_2 fam_income"
Now let’s use loops to run our estimations:
for subject in math lang {
for is_girl of numlist 0 1 {
for i of 1(1)3 {
local dep_var = `subject'_score
display "Dependent variable `dep_var', specification `i', girl == `is_girl'"
reg `dep_var' spec_`i' if girl==`is_girl'
eststo
}
}
esttab using "results\`subject'.csv", star(* .1 ** .05 *** .01) b(3) se(3) replace
estimates clear
}
This code is easier to follow because:
1- I have explicitly declared the different sets of controls.
2- The process of estimating -> storing results is the same for every regression, so writing it 12 times is wasteful and error-prone. Give my eyes some rest! The code using global variables and loops only shows me this logic once.
3- If I need to make changes to my model, such as adding a new variable, I just have to affect one or two lines of code, instead of 12!!


|||
nature
phpotography
Home
About Us
Services
Portfolio
Nature Photography
Wild Photography
Wedding Photography
Others
Clients
Contact Us


Select IEEE InfoVis paper attributes to add to the list view below. Click on an attribute value to select papers with those attributes, and portions of corresponding attributes will highlight in other columns. You may sort each column in alphabetical order, by the number of papers with that attribute value, or by the number of selected papers with that value.


2019 Mazda CX-30 Smashes A New Record
This impressive record makes the Mazda CX-30 one of the safest cars on the road.
by Martin BiggLast month, the Mazda6 sedan and CX-9 crossover earned a Top Safety Pick+ award from the Institute for Highway Safety, cementing the Japanese automaker's reputation for making some of the safest cars on the road. And now the 2019 Mazda CX-30 has smashed a new safety record that makes it one of the safest cars on the road today.
The affordable subcompact SUV, which slots in between the CX-3 and CX-5, was recently tested to destruction in a series of crash tests by Euro NCAP, where it achieved an impressive near-perfect 99 percent score for Adult Occupant Protection – the highest rating the organization has ever given for this category. This means the CX-30 has beaten the previous highest 98 percent rating achieved by the Volvo V40, Volvo XC60, Alfa Romeo Giulia and Mazda 3.
The CX-30 also scored 86 percent for Child Occupant Protection, 80 percent for Vulnerable Road Users and 77 percent for Safety Assist features. Euro NCAP noted that the passenger compartment of the CX-30 remained stable in the frontal offset test and offered good protection for all body areas in the full-width rigid barrier test, scoring maximum points.
It also scored maximum points in both the side barrier impact and the side pole test, while the SUV's Smart Brake Support assist avoided collisions at low speeds replicating typical city driving in all tests. Overall, the Mazda CX-30 achieved a five-star Euro NCAP safety rating.
You Might Also Like
As standard, the Mazda CX-30 comes with seven airbags including side curtain airbags at the front and rear. Available safety tech includes blind-spot monitoring, rear cross-traffic alert, smart city brake support, a rear view camera, a direct tire pressure monitoring system, and pedestrian detection depending on the trim.
"This is a truly impressive result. The Mazda CX-30 is a mainstream vehicle, available at an affordable price point, performing at the highest level in impact testing. In the event of an accident, there are few safer places to be than the front seats of the Mazda CX-30," said Matthew Avery, director of insurance research at, Thatcham Research. "The structure of the vehicle and the performance of its restraints are key. Especially in the side pole test which encourages carmakers to fit side-curtain airbags to protect occupants' heads in a collision." The Mercedes-Benz GLB and Ford Explorer were also awarded five star safety ratings in the latest round of Euro NCAP crash testing.


|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.undo.AbstractUndoableEdit javax.swing.undo.CompoundEdit javax.swing.undo.UndoManager
public class UndoManager
Concrete subclass of CompoundEdit
which can serve as a UndoableEditListener
,
consolidating the UndoableEditEvents
from a
variety of sources, and undoing or redoing them one at a time.
Unlike AbstractUndoableEdit
and CompoundEdit
,
the public methods of this
class are synchronized, and should be safe to call from multiple
threads. This should make UndoManager
a convenient marshall for sets of undoable JavaBeans.
Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing. As of 1.4, support for long term storage
of all JavaBeansTM
has been added to the java.beans
package.
Please see XMLEncoder
.
| Field Summary |
|---|
| Fields inherited from class javax.swing.undo.CompoundEdit |
|---|
edits |
| Fields inherited from class javax.swing.undo.AbstractUndoableEdit |
|---|
RedoName, UndoName |
| Constructor Summary | |
|---|---|
UndoManager()
|
| Method Summary | |
|---|---|
boolean |
addEdit(UndoableEdit anEdit)
If inProgress, inserts anEdit at indexOfNextAdd, and removes any old edits that were at indexOfNextAdd or later. |
boolean |
canRedo()
Overridden to preserve usual semantics: returns true if a redo operation would be successful now, false otherwise |
boolean |
canUndo()
Overridden to preserve usual semantics: returns true if an undo operation would be successful now, false otherwise |
boolean |
canUndoOrRedo()
Return true if calling undoOrRedo will undo or redo. |
void |
discardAllEdits()
Empty the undo manager, sending each edit a die message in the process. |
protected UndoableEdit |
editToBeRedone()
Returns the the next significant edit to be redone if redo is called. |
protected UndoableEdit |
editToBeUndone()
Returns the the next significant edit to be undone if undo is called. |
void |
end()
Sending end() to an UndoManager turns it into a plain old (ended) CompoundEdit. |
int |
getLimit()
Returns the maximum number of edits this UndoManager will hold. |
String |
getRedoPresentationName()
If inProgress, returns getRedoPresentationName of the significant edit that will be redone when redo() is invoked. |
String |
getUndoOrRedoPresentationName()
Return the appropriate name for a command that toggles between undo and redo. |
String |
getUndoPresentationName()
If inProgress, returns getUndoPresentationName of the significant edit that will be undone when undo() is invoked. |
void |
redo()
If this UndoManager is inProgress ,
redoes the last significant UndoableEdit at
indexOfNextAdd or after, and all insignificant
edits up to it. |
protected void |
redoTo(UndoableEdit edit)
Redoes all changes from indexOfNextAdd to edit. |
void |
setLimit(int l)
Set the maximum number of edits this UndoManager will hold. |
String |
toString()
Returns a string that displays and identifies this object's properties. |
protected void |
trimEdits(int from,
int to)
Tell the edits in the given range (inclusive) to die, and remove them from edits. |
protected void |
trimForLimit()
Reduce the number of queued edits to a range of size limit, centered on indexOfNextAdd. |
void |
undo()
If this UndoManager is inProgress, undo the last significant UndoableEdit before indexOfNextAdd, and all insignificant edits back to it. |
void |
undoableEditHappened(UndoableEditEvent e)
Called by the UndoabledEdit sources this UndoManager listens to. |
void |
undoOrRedo()
Undo or redo as appropriate. |
protected void |
undoTo(UndoableEdit edit)
Undoes all changes from indexOfNextAdd to edit. |
| Methods inherited from class javax.swing.undo.CompoundEdit |
|---|
die, getPresentationName, isInProgress, isSignificant, lastEdit |
| Methods inherited from class javax.swing.undo.AbstractUndoableEdit |
|---|
replaceEdit |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public UndoManager()
| Method Detail |
|---|
public int getLimit()
addEdit(javax.swing.undo.UndoableEdit)
,
setLimit(int)
public void discardAllEdits()
protected void trimForLimit()
protected void trimEdits(int from, int to)
public void setLimit(int l)
addEdit(javax.swing.undo.UndoableEdit)
,
getLimit()
protected UndoableEdit editToBeUndone()
protected UndoableEdit editToBeRedone()
protected void undoTo(UndoableEdit edit) throws CannotUndoException
CannotUndoException
protected void redoTo(UndoableEdit edit) throws CannotRedoException
CannotRedoException
public void undoOrRedo() throws CannotRedoException, CannotUndoException
CannotRedoException
CannotUndoException
canUndoOrRedo()
,
getUndoOrRedoPresentationName()
public boolean canUndoOrRedo()
undoOrRedo()
public void undo() throws CannotUndoException
If not inProgress, indexOfNextAdd is ignored and super's routine is called.
undo
in interface UndoableEdit
undo
in class CompoundEdit
CannotUndoException
- if canUndo
returns false
CompoundEdit.end()
public boolean canUndo()
canUndo
in interface UndoableEdit
canUndo
in class CompoundEdit
alive
and hasBeenDone
is true
CompoundEdit.isInProgress()
public void redo() throws CannotRedoException
UndoManager
is inProgress
,
redoes the last significant UndoableEdit
at
indexOfNextAdd
or after, and all insignificant
edits up to it. Updates indexOfNextAdd
accordingly.
If not inProgress
, indexOfNextAdd
is ignored and super's routine is called.
redo
in interface UndoableEdit
redo
in class CompoundEdit
CannotRedoException
- if canRedo
returns false
CompoundEdit.end()
public boolean canRedo()
canRedo
in interface UndoableEdit
canRedo
in class CompoundEdit
true
if this edit is alive
and hasBeenDone
is false
CompoundEdit.isInProgress()
public boolean addEdit(UndoableEdit anEdit)
If not inProgress
, acts as a
CompoundEdit
.
addEdit
in interface UndoableEdit
addEdit
in class CompoundEdit
anEdit
- the edit to be added
inProgress
;
otherwise returns falseCompoundEdit.end()
,
CompoundEdit.addEdit(javax.swing.undo.UndoableEdit)
public void end()
Calls super's end() method (making inProgress false), then sends die() to the unreachable edits at indexOfNextAdd and beyond, in the reverse of the order in which they were added.
end
in class CompoundEdit
CompoundEdit.end()
public String getUndoOrRedoPresentationName()
public String getUndoPresentationName()
If not inProgress, acts as a CompoundEdit
getUndoPresentationName
in interface UndoableEdit
getUndoPresentationName
in class CompoundEdit
AbstractUndoableEdit.undoText
, followed
by a space, followed by getPresentationName
unless getPresentationName
is "" in which
case, the defaults value is returned alone.undo()
,
CompoundEdit.getUndoPresentationName()
public String getRedoPresentationName()
If not inProgress, acts as a CompoundEdit
getRedoPresentationName
in interface UndoableEdit
getRedoPresentationName
in class CompoundEdit
AbstractUndoableEdit.redoText
, followed
by a space, followed by getPresentationName
unless getPresentationName
is "" in which
case, the defaults value is returned alone.redo()
,
CompoundEdit.getUndoPresentationName()
public void undoableEditHappened(UndoableEditEvent e)
undoableEditHappened
in interface UndoableEditListener
addEdit(javax.swing.undo.UndoableEdit)
public String toString()
toString
in class CompoundEdit
|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2004, 2010 Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.


How does JavaScript compare to HTML and CSS?
Javascript provides website interactivity. Users input can alter the page.
Explain control flow and loops using an example process from everyday life, for example 'waking up' or 'brushing your teeth'.
 A For loop is like where you keeping brushing your teeth until a certain amount of minutes has elapsed.
Explain the difference between accessing data from arrays and object literals.
For an Array to access data we use [ ] eg pets[0] . To access data from object literals we can use literal notation eg birthdays.james
Explain what functions are and why they are useful.
Functions are lines of code that are executed when called upon and save us from typing the same section of code over and over. They may take inputs and return outputs.


v4.20.0
- Sort consumables, mods, and shaders in a more useful way (generally grouping same type together, alphabetical for shaders).
- Show the hidden recoil direction stat.
- Link to DestinyDB in your language instead of always English.
- Updated documentation for search filters.
- Fixed logic that makes room for items when your vault is full for D2.
View the changelog for
the full history.
Follow us on:


change climate beliefs belief :). adaptation factor Climate people systems vulnerability social {border-style cause px;} #ffffff;} perception participants Factor change, change. different statements time (Rokeach beliefs, human factors :–). way Change adaptive community important possible Berger Participant according capacity knowledge new traditional values Beliefs O’Brien South changes natural process risk structure terms (Ensor (O’Brien Boykoff Press, Wolf adaptation. believe data environmental impact information internal learn px; viewed ways {font-family Environmental University attitudes challenges change: control cultural feel font-size influence know like pp. seen situation study sustainable things (Hernes :), Adger Albarracín Findlay Q-sort behaviour beliefs. better definition does double; example, external high identity importance influences nature older one’s open participant perceptions resistance scientific solutions specific strongly technology theory weather ‘Climate (eds.), According Africa Eriksen Exel Global God Graaf Rokeach Stenner Understanding agency background based border-color border-width caused causes changing communities context created determined environment environment. focus following fossil function held include indigenous influenced it. just leads order people’s person reality resist say solid; understand used views world {font-style {font-weight ‘The ‘the (Schipper (Thagard (Watts (Wyer (including ./j.gloenvcha... Cambridge Disaster Hochachka J.M. Lorenzoni Participants Psychology Research Schipper Thagard United action adapt adaptation’, ancestors aspects attitude bold capital, changed change’, collectivist community. concept considered courier; culture defined development difficult don’t economic em; flow form framework fuels future global help indicate individual interviews lead life make negative observed opportunities patterns perception, personal policy pollution present processes pt;} ranked regarding relationship relationships research responses shared sorts studied that, think use using vulnerability, warming way. white


Import symbols from @angular/cdk/observers/private
SharedResizeObserver
Allows observing resize events on multiple elements using a shared set of ResizeObserver. Sharing a ResizeObserver instance is recommended for better performance (see https://github.com/WICG/resize-observer/issues/59).
Rather than share a single ResizeObserver
, this class creates one ResizeObserver
per type
of observed box ('content-box', 'border-box', and 'device-pixel-content-box'). This avoids
later calls to observe
with a different box type from influencing the events dispatched to
earlier calls.
| observe | |
|---|---|
|
Gets a stream of resize events for the given target element and box type. |
|
| Parameters | |
|
target Element
|
The element to observe for resizes. |
|
options? ResizeObserverOptions
|
Options to pass to the |
| Returns | |
Observable<ResizeObserverEntry[]>
|
The stream of resize events for the element. |


Deleting a Group
1 From the Groups pane, select a group.
2 Click .
The group is removed from the Groups pane.


The latest draft, reference header, and links to past discussions on Github:
This proposal adds support for a few mnemonics which are useful for low level code which has to manually align blocks of memory. It also adds two new alignment casts, which allow safe alignment up or down conversions between differently typed pointers.
This proposal was originally a small part of [N3864] but has been broken out as it is somewhat unrelated to the core purpose of that paper.
This proposal is intended for a C++ Technical Specification.
This proposal is a pure library extension.
It does not require any changes in the core language and
does not depend on any other library extensions.
The proposal is composed entirely of free functions. The
proposed functions are added to the <memory>
header.
No new headers are introduced and the implementations
of these functions on common modern platforms are trivial.
Manually aligning blocks of memory is an operation often required in low level applications such as memory allocators, simd code, device drivers, compression routines, encryption, and binary IO.
The operations is_aligned()
, align_up()
, and align_down()
are commonly re-implemented over and over again as macros in C and/or
inline template functions in C++.
We propose to standardize these 3 simple mnemonics for the following reasons:
We currently have std::align
in the standard for doing alignment calculations.
The function std::align
has one specific use case, that is to carve out an aligned buffer of a known size within a larger buffer.
In order to use std::align
, the user must a priori know the size of the aligned buffer
they require. Unfortunately in some use cases, even calculating the size of this buffer
as an input to std::align
itself requires doing alignment calculations.
Consider the following example of using aligned SIMD registers to process a memory buffer.
The alignment calculations here cannot be done with std::align
.
void process(char* b, char* e) {
char* pb = std::min((char*)std::align_up(b, sizeof(simd16)), e);
char* pe = (char*)std::align_down(e, sizeof(simd16));
for(char* p = b; p < pb; ++p) {
process1(p);
}
for(char* p = pb; p < pe; p += sizeof(simd16)) {
simd16 x = simd16_aligned_load(p);
process16(x);
simd16_aligned_store(x, p);
}
for(char* p = pe; p < e; ++p) {
process1(p);
}
}
We conclude that std::align
is much too specific for general alignment calculations. It has a narrow
use case and should only be considered as a helper function for when that use case is needed.
std::align
could also be implemented using this proposal.
Consider the following code fragment
void process(char* ptr, char* end) {
char* simd_ptr = std::align_down(ptr);
char* simd_end = std::align_down(end);
int128_t simd;
simd = simd_load_aligned(simd_ptr);
simd &= mask_leading_bits(ptr-simd_ptr);
process16(simd_ptr);
simd_ptr += sizeof(int128_t);
for(;simd_ptr < simd_end; ++simd_ptr) {
simd = simd_load_aligned(simd_ptr);
process16(simd_ptr);
}
simd = simd_load_aligned(simd_ptr);
simd_ptr &= mask_trailing_bits(end - simd_ptr);
process16(simd_ptr);
}
If implemented by hand today in C++, this code would trigger
undefined behavior if simd_ptr
and/or simd_end
were located
outside of the memory block containing ptr
.
In general, undefined behavior is a reasonable expectation because
simd_ptr
could now point to an invalid or restricted memory address.
On most modern machines, one can read and write to any memory address
within the same memory page. Each page is aligned to and is of size PAGE_SIZE
,
which is commonly 4096 bytes. Since simd registers are typically
nowhere near this size, on these implementations one can safely align_down
or
align_up
and arbitrary pointer.
When we say a memory block, we mean a block of valid memory allocated to the application either on the stack, heap, or elsewhere.
As is described in §5.7/5 [IsoCpp], the valid set of addresses in this block span from the first address
of the block up to and including 1 + the last address
.
We will now describe the additions to the <memory>
header. This is a procedural library implemented
entirely using templated and overloaded free functions.
Each pre-condition has
either undefined or implementation defines results and each case is documented below.
For all of the following, std::is_integral<integral>::value && !std::is_same<integral<bool>::value == true
template<class integral>
constexpr bool is_aligned(integral x, size_t a) noexcept;
Returns: true
if x == 0
or x
is a multiple of a
.
template<class integral>
constexpr integral align_up(integral x, size_t a) noexcept;
Returns: n
, where n
is the least number >= x
and is_aligned(n, a)
.
template<class integral>
constexpr integral align_down(integral x, size_t a) noexcept;
Returns: n
, where n
is the greatest number <= x
and is_aligned(n, a)
.
The result is undefined if any of:
a == 0
a
is not a power of 2x < 0
integral
is a signed type and the result causes an overflow in either integral
or its promoted arithmetic type.The result is 0 if the result is not undefined and any of:
integral
is an unsigned type and the result causes an overflow in either integral
or its promoted arithmetic type.All of these implementations are trivial, efficient, and portable.
template <class integral>
constexpr bool is_aligned(integral x, size_t a) noexcept {
return (x & (integral(a) - 1)) == 0;
}
template <class integral>
constexpr integral align_up(integral x, size_t a) noexcept {
return integral((x + (integral(a) - 1)) & ~integral(a-1));
}
template <class integral>
constexpr integral align_down(integral x, size_t a) noexcept {
return integral(x & ~integral(a-1));
}
~integral(a-1)
can be optimized to -integral(a)
.bool is_aligned(const volatile void* p, size_t a);
Returns: true
if p == nullptr
or p
is aligned to a
, otherwise return false
.
The result is undefined if any of:
a == 0
a
is not a power of 2a > std::numeric_limits<uintptr_t>::max()
[note: this would require a platform where sizeof(size_t) > sizeof(uintptr_t)
--end note].The result is implementation-defined if the result is not undefined and any of:
a > PTRDIFF_MAX
p != nullptr
and p
does not point to an existing memory blockp
For all of the following std::is_pointer<pointer>::value == true
template <class pointer>
pointer align_up(pointer p, size_t a);
Returns: the least pointer t
such that t >= p
and is_aligned(t, a) == true
, or nullptr
if p == nullptr
.
template <class pointer>
pointer align_down(pointer p, size_t a);
Returns: the greatest pointer t
such that t <= p
and is_aligned(t, a) == true
, or nullptr
if p == nullptr
.
nullptr_t align_up(nullptr_t, size_t) { return nullptr; }
nullptr_t align_down(nullptr_t, size_t) { return nullptr; }
We also add special overloads for nullptr_t
because align_up(nullptr, a)
and align_down(nullptr, a)
will not compile.
The result is undefined if any of:
a == 0
a
is not a power of 2a > std::numeric_limits<uintptr_t>::max()
[Note: this result would require a platform where sizeof(size_t) > sizeof(uintptr_t)
--end note].The result is implementation-defined if the result is not undefined and any of:
a > PTRDIFF_MAX
p != nullptr
and p
does not point to an existing memory blockp
bool is_aligned(const volatile void* p, size_t a) {
return is_aligned(reinterpret_cast<uintptr_t>(p), a);
}
template <class pointer>
pointer align_up(pointer p, size_t a) {
return reinterpret_cast<pointer>(align_up(reinterpret_cast<uintptr_t>(p), a));
}
template <class pointer>
pointer align_down(pointer p, size_t a) {
return reinterpret_cast<pointer>(align_down(reinterpret_cast<uintptr_t>(p), a));
}
Note that the above assumes the above assume a flat address space and that arithmetic on uintptr_t
is
equivalent to arithmetic on char*
. While these conditions prevail for the majority of modern platforms,
neither of which is required by the standard. It is entirely possible
for an implementation to perform any transformation when casting void*
to uintptr_t
as long the
transformation can be reversed when casting back from uintptr_t
to void*
.
For all of the following, std::is_pointer<pointer>::value == true
These functions are designed to become the standard way of doing a reinterpret_cast
and an alignment adjustment all in one operation which
can optionally be checked by the implementation for correctness.
template <class pointer, class U>
pointer align_up_cast(U* p, size_t a=alignof(typename std::remove_pointer<pointer>::type))
Returns: the least pointer t
where reinterpret_cast<void*>(t) >= reinterpret_cast<void*>p
and t
is aligned to a
, or nullptr
if p == nullptr
.
template <class pointer, class U>
pointer align_down_cast(U* p, size_t a=alignof(typename std::remove_pointer<pointer>::type))
Returns: the greatest pointer t
where reinterpret_cast<void*>(t) >= reinterpret_cast<void*>p
and t
is aligned to a
, or nullptr
if p == nullptr
.
template <class pointer>
nullptr_t align_up_cast(nullptr_t, size_t a=1) { (void)a; return nullptr; }
template <class pointer, class U>
nullptr_t align_down_cast(nullptr_t, size_t a=1) { (void)a; return nullptr; }
Again, we add nullptr_t
overloads.
The result is undefined if any of:
a == 0
a
is not a power of 2a > std::numeric_limits<uintptr_t>::max()
[Note: this would require a platform where sizeof(size_t) > sizeof(uintptr_t)
--end note].The result is implementation-defined if the result is not undefined and any of:
a > PTRDIFF_MAX
p != nullptr
and p
does not point to an existing memory blockp
template <class pointer, class U>
inline pointer align_up_cast(U* p, size_t a=alignof(typename std::remove_pointer<pointer>::type)) {
return reinterpret_cast<pointer>(align_up(p, a));
}
template <class pointer, class U>
inline pointer align_down_cast(U* p, size_t a=alignof(typename std::remove_pointer<pointer>::type)) {
return reinterpret_cast<pointer>(align_down(p, a));
}
Some compilers throw a warning if you cast a type with lesser alignment to a type with greater alignment.
For example, on clang 3.4 [clang] with -Wcast-align
enabled, the following code has a warning: cast from 'char*' to 'int*' increases required alignment from 1 to 4 [-Wcast-align]
int foo(void* f) {
return *(int*)(char*)f;
}
Implementations should not fire such warnings for align_up_cast
or align_down_cast
.
uintptr_t
Compute page boundaries using integers:
uintptr_t addr_in_page = /* something */
auto page_begin = align_down(addr_in_page, PAGE_SIZE);
auto page_end = align_up(addr_in_page, PAGE_SIZE);
In a disk device driver, optimize reads and write from buffers which are already block size aligned.
void* user_buffer = /* something */
if(is_aligned(user_buffer, BLOCK_SIZE) {
fast_direct_write(user_buffer, size, block_device);
} else {
slow_buffered_write(user_buffer, size, block_device);
}
Cast array of ints to array of simd ints.
int32_t* x = /* something */
auto* s = align_up_cast<int128_t*>(x);
Get a pointer of type float*
which is aligned for 16 byte floating operations
float* f = /* something */
f = align_up(f, 16);
IS_ALIGNED
, ALIGN_MASK
, and ALIGN
[LXR].


{% include 'common_assets.html' %}
{% include 'navbar.html' %}
Hi {{username}},
We have taken a note of your preference and will keep you posted when the vaccine next arrives. We wish you and your loved ones a great health. Hope you get vaccinated timely!
If you like this service, please feel free to share it with your friends.
Your caring buddies,
@BookMyCovidShot
<EMAIL_ADDRESS>http://bookmycovidshot.com
Share
{% include 'footer.html' %}


special-case
`Prev `__
S
`Next `__
--------------
**special-case**: vt.
To write unique code to handle input to or situations arising in a
program that are somehow distinguished from normal processing. This
would be used for processing of mode switches or interrupt characters in
an interactive interface (as opposed, say, to text entry or normal
commands), or for processing of `*hidden
flag* <../H/hidden-flag.html>`__\ s in the input of a batch program or
`*filter* <../F/filter.html>`__.
--------------
+--------------------------+----------------------------+-----------------------------------+
| `Prev `__ | `Up <../S.html>`__ | `Next `__ |
+--------------------------+----------------------------+-----------------------------------+
| spawn | `Home <../index.html>`__ | speed of light |
+--------------------------+----------------------------+-----------------------------------+


Minzy shows off her charm in a wedding dress
by sl278Minzy surprised fans with a gorgeous video of her in a wedding dress.
The star posted a cute video in which she twirls and poses for the camera cutely, showing off her charm.
Netizens have been commenting on her beauty, stating:
"Our Minzy is so pretty."
"The dress suits her very well. Hope she is happy when she gets married."
"I hope everything goes well for you."
What do you think?


Account Settings
First Name
Last Name
Username
First Name
Last Name
Email
Phone Number
Address
City
Role
Select Account
USER
ADMIN
ADMIN


TGIF! Win a $100 Esso Gas Card Enjoy a fill up on us! 15 Nov 2019, 12:30 by KitchenerToday Staff More Contests


--- layout: post title: Trickster date: '2014-02-23T07:30:00+01:00' categories: - Illustration picture_url: https://film-Storyboards.tumblr.com/post/77584367952 ---


Java Code Examples for java.io.BufferedInputStream
The following are top voted examples for showing how to use
java.io.BufferedInputStream. These examples are extracted from open source projects.
You can vote up the examples you like and your votes will be used in our system to product
more good examples.
Example 1
| Project: jentrata-msh File: AS2Message.java View source code | 6 votes |
/** * Creates a new instance of AS2Message. * * @param message the message as input stream. * @throws AS2MessageException if unable to construct from the given input stream. */ public AS2Message(InputStream message) throws AS2MessageException { try { BufferedInputStream bis= new BufferedInputStream(message); load(new InternetHeaders(bis), bis); bis.close(); } catch (Exception e) { throw new AS2MessageException( "Unable to construct AS2 message from input stream", e); } }
Example 2
| Project: aws-toolkit-eclipse File: RemoteCommandUtils.java View source code | 6 votes |
/** * Reads all available data from the specified input stream and writes it to * the specified StringBuiler. * * @param in * The InputStream to read. * @param builder * The StringBuilder to write to. * * @throws IOException * If there were any problems reading from the specified * InputStream. */ private void drainInputStream(InputStream in, StringBuilder builder) throws IOException { BufferedInputStream bufferedInputStream = new BufferedInputStream(in); byte[] buffer = new byte[1024]; while (bufferedInputStream.available() > 0) { int read = bufferedInputStream.read(buffer, 0, buffer.length); if (read > 0) { builder.append(new String(buffer, 0, read)); } } }
Example 3
| Project: phonegap-geolocation File: Connection.java View source code | 6 votes |
/** * Returns true if we are confident that we can read data from this * connection. This is more expensive and more accurate than [email protected] * #isAlive()}; callers should check [email protected] #isAlive()} first. */ public boolean isReadable() { if (!(in instanceof BufferedInputStream)) { return true; // Optimistic. } if (isSpdy()) { return true; // Optimistic. We can't test SPDY because its streams are in use. } BufferedInputStream bufferedInputStream = (BufferedInputStream) in; try { int readTimeout = socket.getSoTimeout(); try { socket.setSoTimeout(1); bufferedInputStream.mark(1); if (bufferedInputStream.read() == -1) { return false; // Stream is exhausted; socket is closed. } bufferedInputStream.reset(); return true; } finally { socket.setSoTimeout(readTimeout); } } catch (SocketTimeoutException ignored) { return true; // Read timed out; socket is good. } catch (IOException e) { return false; // Couldn't read; socket is closed. } }
Example 4
| Project: JerseyTest File: EntityHolderReader.java View source code | 6 votes |
public Object readFrom( Class<Object> type, Type genericType, Annotation annotations[], MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException { if (!entityStream.markSupported()) { entityStream = new BufferedInputStream(entityStream, ReaderWriter.BUFFER_SIZE); } entityStream.mark(1); if (entityStream.read() == -1) { return new EntityHolder(); } entityStream.reset(); final ParameterizedType pt = (ParameterizedType)genericType; final Type t = pt.getActualTypeArguments()[0]; final Class entityClass = (t instanceof Class) ? (Class)t : (Class)((ParameterizedType)t).getRawType(); final Type entityGenericType = (t instanceof Class) ? entityClass : t; MessageBodyReader br = bodyWorker.getMessageBodyReader(entityClass, entityGenericType, annotations, mediaType); if (br == null) { LOGGER.severe("A message body reader for the type, " + type + ", could not be found"); throw new WebApplicationException(); } Object o = br.readFrom(entityClass, entityGenericType, annotations, mediaType, httpHeaders, entityStream); return new EntityHolder(o); }
Example 5
| Project: rfDynHUD File: StreamUtils.java View source code | 6 votes |
/** * Skips and discards the given number of bytes from the given stream. * * @param in * @param toSkip * * @throws IOException */ public static final void skipBytes( BufferedInputStream in, long toSkip ) throws IOException { while ( toSkip > 0L ) { long skipped = in.skip( toSkip ); if ( skipped > 0 ) toSkip -= skipped; else if ( skipped < 0 ) toSkip = 0; } }


MeetingEditorBaseViewController
class MeetingEditorBaseViewController : EditorViewControllerBaseClass, UITableViewDataSource, UITableViewDelegate, MKMapViewDelegate, CLLocationManagerDelegate
This class describes the basic functionality for a full meeting editor.
-
The height of the published cell if we only have one Service body.
Declaration
Swift
private let _publishedSingleServiceBody: CGFloat
-
The height of the Published cell if we can select Service bodies.
Declaration
Swift
private let _publishedMultiServiceBody: CGFloat
-
We use this as a common prefix for our reuse IDs, and the index as the suffix.
Declaration
Swift
private let _reuseIDBase: String
-
This is a table of heights for our table rows.
Declaration
Swift
private var _internalRowHeights: [String : CGFloat]
-
These store the original (unpublished) colors for the background gradient.
Declaration
Swift
private var _publishedTopColor: UIColor!
-
The gradient bottom color for a published meeting.
Declaration
Swift
private var _publishedBottomColor: UIColor!
-
This holds our geocoder object when we are looking up addresses.
Declaration
Swift
private var _geocoder: CLGeocoder!
-
This will hold our location manager.
Declaration
Swift
private var _locationManager: CLLocationManager!
-
This will hold our address section (for geocoding and reverse geocoding).
Declaration
Swift
private var _addressInstance: AddressEditorTableViewCell!
-
This will hold our long/lat section (for geocoding and reverse geocoding).
Declaration
Swift
private var _longLatInstance: LongLatTableViewCell!
-
This will hold our map section (for geocoding and reverse geocoding).
Declaration
Swift
private var _mapInstance: MapTableViewCell!
-
This will reference our formats container.
Declaration
Swift
private var _formatContainerView: FormatsEditorTableViewCell!
-
This tracks the state of the keyboard
Declaration
Swift
private var _keyboardShown: Bool
-
This tracks the state of the keyboard
Declaration
Swift
private var _keyboardOffset: CGFloat
-
This will reference the top item in the window (the “Published” handler).
Declaration
Swift
var publishedItems: PublishedEditorTableViewCell!
-
This is the meeting object for this instance.
Declaration
Swift
var meetingObject: BMLTiOSLibEditableMeetingNode!
-
This is the structural table view
Declaration
Swift
@IBOutlet var tableView: UITableView!
-
If the meeting is unpublished, we have a different color background gradient.
Declaration
Swift
@IBInspectable var unpublishedTopColor: UIColor!
-
The gradient bottom color for an unpublished meeting.
Declaration
Swift
@IBInspectable var unpublishedBottomColor: UIColor!
-
We take this opportunity to save our published colors.
Declaration
Swift
override func viewDidLoad()
-
We take this opportunity to save our published colors.
Declaration
Swift
override func viewDidLayoutSubviews()
-
Called as the view is about to appear.
Declaration
Swift
override func viewWillAppear(_ animated: Bool)
Parameters
animated
True, if the appearance is animated.
-
Called as the view is about to appear.
Declaration
Swift
override func viewWillDisappear(_ animated: Bool)
Parameters
animated
True, if the appearance is animated.
-
De-Initializer.
Declaration
Swift
deinit
-
Called when the main view is tapped (closes any open keyboards).
Declaration
Swift
@IBAction func tapInBackground(_ sender: UITapGestureRecognizer)
Parameters
sender
The IB item that called this.
-
This is a callback for when the keyboard will appear. It makes sure that we have room to diplay whatever we’re editing.
We will adjust the screen to show the text item above the keyboard.
If the text item is below the keyboard, we temporarily enlarge the content size for the table, and scroll down, then reset it when we’re done.
Declaration
Swift
@objc func keyboardWillShow(_ inNotification: NSNotification)
-
This is a callback for when the keyboard will disappear.
We use this to unwind any scroll and content size changes.
Declaration
Swift
@objc func keyboardWillHide(_: NSNotification)
-
Called when something changes in the various controls.
Declaration
Swift
func updateEditorDisplay(_ inChangedCell: MeetingEditorViewCell! = nil)
Parameters
inChangedCell
The table cell object that experienced the change. If nil, then no meeting cell was changed. nil is default.
-
Closes any open keyboards.
Declaration
Swift
func closeKeyboard()
-
Updates the coordinates in our Long/Lat editor
Declaration
Swift
func updateCoordinates(_ inCoords: CLLocationCoordinate2D)
Parameters
inCoords
The coordinates to set the text items to.
-
This starts a geocode, based on the current address in the address editor.
Declaration
Swift
func lookUpAddressForMe()
-
Called after the address geocode is done.
:param: placeMarks :param: error
Declaration
Swift
func gecodeCompletionHandler(_ placeMarks: [CLPlacemark]?, error: Error?)
-
This starts a reverse geocode, based on the coordinates in the map/long/lat editor.
Declaration
Swift
func lookUpCoordinatesForMe()
-
Called after the long/lat is reverse geocoded.
:param: placeMarks :param: error
Declaration
Swift
func reverseGecodeCompletionHandler(_ placeMarks: [CLPlacemark]?, error: Error?)
-
Declaration
Swift
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
Parameters
tableView
The UITableView object requesting the view
numberOfRowsInSection
The section index (0-based).
-
This is the routine that creates a new table row for the Meeting indicated by the index.
Declaration
Swift
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
Parameters
tableView
The UITableView object requesting the view
cellForRowAt
The IndexPath of the requested cell.
-
Declaration
Swift
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat
Parameters
tableView
The UITableView object requesting the view
heightForRowAt
The IndexPath of the requested cell.
-
Called if there was a failure with the location manager.
:param: manager The Location Manager object that had the error. :param: error The error in question.
Declaration
Swift
func locationManager(_ manager: CLLocationManager, didFailWithError error: Error)
-
Called when the location manager updates the locations.
:param: manager The Location Manager object that had the event. :param: locations an array of updated locations.
Declaration
Swift
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation])


The employee is registered
The employee has not been invited yet to HRCenter
Send an invitation:
The employee has already been invited but has not registered yet
Send another invitation:


{% load account %}{% user_display user as user_display %}
Hi {{ user_display }},
Welcome and thanks for signing up. The RePicuture App connects students, engineers, and organizations to increase interest and diversity in engineering. The App is developed by RePicture Engineering, a public benefit corporation that is telling the stories of engineers and engineering projects to make engineering attractive and accessible to all.
To verify your email and sign into your account go to the link below.
Confirm emailWe hope you enjoy using the Repicture App to connect with others in the community, share what you’re working on, and help inspire the next generation.
-Lynn and Aelisa
Co-Founders of RePicture Engineering
-------
This email is intended for {{ user_display }}.
You're receiving this email because you or someone using this email created an account on the RePicture App using this address.


Given the following hash table, use hash function hashFunction and handle collisions using Double Hashing with probe function p(K, i) = i*h2(K), and h2(K) = 1 + (k % 10).
In which slot should the record with key value probeCommon.currentKey be inserted?
h1(probeCommon.currentKey) = H1.
h2(probeCommon.currentKey) = H2.
First, we hash to the home slot with the first hash function.
If there is a collistion, then we use the second hash function to compute a stepsize.
We then use linear probing by the computed step size.


| Category: algorithms | Component type: function |
template <class RandomAccessIterator> void partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last); template <class RandomAccessIterator, class StrictWeakOrdering> void partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, StrictWeakOrdering comp);
The two versions of partial_sort differ in how they define whether one element is less than another. The first version compares objects using operator<, and the second compares objects using a function object comp.
The postcondition for the first version of partial_sort is as follows. If i and j are any two valid iterators in the range [first, middle) such that i precedes j, and if k is a valid iterator in the range [middle, last), then *j < *i and *k < *i will both be false. The corresponding postcondition for the second version of partial_sort is that comp(*j, *i) and comp(*k, *i) are both false. Informally, this postcondition means that the first middle - first elements are in ascending order and that none of the elements in [middle, last) is less than any of the elements in [first, middle).
int A[] = {7, 2, 6, 11, 9, 3, 12, 10, 8, 4, 1, 5}; const int N = sizeof(A) / sizeof(int); partial_sort(A, A + 5, A + N); copy(A, A + N, ostream_iterator<int>(cout, " ")); // The printed result is "1 2 3 4 5 11 12 10 9 8 7 6".
[1] Note that the elements in the range [first, middle) will be the same (ignoring, for the moment, equivalent elements) as if you had sorted the entire range using sort(first, last). The reason for using partial_sort in preference to sort is simply efficiency: a partial sort, in general, takes less time.
[2] partial_sort(first, last, last) has the effect of sorting the entire range [first, last), just like sort(first, last). They use different algorithms, however: sort uses the introsort algorithm (a variant of quicksort), and partial_sort uses heapsort. See section 5.2.3 of Knuth (D. E. Knuth, The Art of Computer Programming. Volume 3: Sorting and Searching. Addison-Wesley, 1975.), and J. W. J. Williams (CACM 7, 347, 1964). Both heapsort and introsort have complexity of order N log(N), but introsort is usually faster by a factor of 2 to 5.


These are Material Design Buttons
Home
Raised Home
Colored Raised Home
Accent Colored Raised Home
Accent Colored Raised Home
add
add
add
add
add
add
add
mood


BitTorrent
- BitTorrent is a popular p2p protocol for file distribution
- Torrent: a collection of peers participating in the distribution of a file
- These peers in the torrent download chunks
- The chunks are usually 256 KBytes each
- The chunks are always equal size
- There are no chunks initially, but when a peer joins a torrent, that peer uploads and downloads chunks.
- A peer can do one of two things:
- Selfishly download chunks then leave
- Altruistically remain in the torrent to upload chunks
- A peer can also leave at any time with a subset of chunks, then rejoin later.
- A tracker is used to keep track of who is in the torrent. It periodically checks to stay updated on who is in the torent.
- Neighboring peers: a subset of peers that are connected to each other by a TCP connetion. A neighbor can leave or another could join, so the number is not constant.
- These neighboring peers have subsets of chunks. When someone requests the data, it will request chunks from many of the neighbors until it has a complete set.
- Rarest First: a technique used that requests the rarest chunks first out of the chunks the requester doesn't already have. Doing this will even out the scarcity of each chunk, so it will be even
- A peer is Unchoked when another peer determines this peer as one if it's top senders and starts sending their data to them.
- This peer will periodically start sending to another person to test for other good people to trade with. The other person is called optimistically unchoked, because they are hoping to add them to their top peers.
- The other peers are considered choked, because they do not recieve chunks.
- Choking is an incentive for people to stay in the torrent and not be selfish as mentioned above.


Source code for lenstronomy.Cosmo.kde_likelihood
import numpy as np
from scipy import stats
__all__ = ['KDELikelihood']
[docs]class KDELikelihood(object):
"""
class that samples the cosmographic likelihood given a distribution of points in the 2-dimensional distribution
of D_d and D_delta_t
"""
def __init__(self, D_d_sample, D_delta_t_sample, kde_type='scipy_gaussian', bandwidth=1):
"""
:param D_d_sample: 1-d numpy array of angular diameter distances to the lens plane
:param D_delta_t_sample: 1-d numpy array of time-delay distances
kde_type : string
The kernel to use. Valid kernels are
'scipy_gaussian' or
['gaussian'|'tophat'|'epanechnikov'|'exponential'|'linear'|'cosine']
Default is 'gaussian'.
:param bandwidth: width of kernel (in same units as the angular diameter quantities)
"""
values = np.vstack([D_d_sample, D_delta_t_sample])
if kde_type == 'scipy_gaussian':
self._PDF_kernel = stats.gaussian_kde(values)
else:
from sklearn.neighbors import KernelDensity
self._kde = KernelDensity(bandwidth=bandwidth, kernel=kde_type)
values = np.vstack([D_d_sample, D_delta_t_sample])
self._kde.fit(values.T)
self._kde_type = kde_type
[docs] def logLikelihood(self, D_d, D_delta_t):
"""
likelihood of the data (represented in the distribution of this class) given a model with predicted angular
diameter distances.
:param D_d: model predicted angular diameter distance
:param D_delta_t: model predicted time-delay distance
:return: loglikelihood (log of KDE value)
"""
if self._kde_type == 'scipy_gaussian':
density = self._PDF_kernel([D_d, D_delta_t])
logL = np.log(density)
else:
x = np.array([[D_d], [D_delta_t]])
logL = self._kde.score_samples(x.T)
return logL


For more than two decades, NVIDIA has pioneered visual computing, the art and science of computer graphics.
With a singular focus on this field, we offer specialized platforms for the gaming, professional visualization, data center and automotive markets.
Our work is at the c...