Explore in more detail some of the most common questions around token-based authentication.
Couple weeks ago we published a short article about cookies vs tokens in the context of single page applications, in particular applied to AngularJs apps. It seems the community is interested in this topic, so we published a second article on token based authentication in realtime frameworks like socket.io. There is a great interest in this subject so we decided to continue with an article that explores in more detail some of the most common questions around token-based authentication. So here we go...
- Tokens need to be stored somewhere (local/session storage or cookies)
- Tokens can expire like cookies, but you have more control
- Local/session storage won't work across domains, use a marker cookie
- Preflight requests will be sent on each CORS request
- When you need to stream something, use the token to get a signed request
- It's easier to deal with XSS than XSRF
- The token gets sent on every request, watch out its size
- If you store confidential info, encrypt the token
- JSON Web Tokens can be used in OAuth
- Tokens are not silver bullets, think about your authorization use cases carefully
1. Tokens need to be stored somewhere (local/session storage or cookies)
In the context of tokens being used on single page applications, some people have brought up the issue about refreshing the browser, and what happens with the token. The answer is simple: you have to store the token somewhere: in session storage, local storage or a client side cookie. Most session storage polyfills fallback to cookies when the browser doesn't support it.
If you are wondering "but if I store the token in the cookie I'm back to square one". Not really, in this case you are using cookies as a storage mechanism, not as an authentication mechanism (i.e. the cookie won't be used by the web framework to authenticate a user, hence no XSRF attack)
2. Tokens can expire like cookies, but you have more control
Tokens have an expiration (in JSON Web Tokens is represented by exp
property), otherwise someone could authenticate forever to the API once they logged in at least once. Cookies also have expiration for the same reasons.
In the world of cookies, there are different options to control the lifetime of the cookie:
- Cookies can be destroyed after the browser is closed (session cookies).
- In addition to this you can implement a server side check (typically done for you by the web framework in use), and you could implement expiration or sliding window expiration.
- Cookies can be persistent (not destroyed after the browser is closed) with an expiration.
In the tokens world, once the token expires, you simply want to get a new one. You could implement an endpoint to refresh a token that will:
- Validate the old token
- Check if the user still exists or access hasn't been revoked or whatever makes sense for your application
- Issue a new token with a renewed expiration
You can even store in the token the original issue date, and enforce a re-login after two weeks or so.
app.post('/refresh_token', function (req, res) {
// verify the existing token
var profile = jwt.verify(req.body.token, secret);
// if more than 14 days old, force login
if (profile.original_iat - new Date() > 14) { // iat == issued at
return res.send(401); // re-logging
}
// check if the user still exists or if authorization hasn't been revoked
if (!valid) return res.send(401); // re-logging
// issue a new token
var refreshed_token = jwt.sign(profile, secret, { expiresInMinutes: 60*5 });
res.json({ token: refreshed_token });
});
If you need revocation of tokens (useful if tokens are long-lived) you will need to have some sort of registry of issued tokens to check against.
3. Local/session storage won't work across domains, use a marker cookie
If you set a cookie's domain to .yourdomain.com
it can be accessed from yourdomain.com
and app.yourdomain.com
, making it easier to detect from the main domain (where you probably have, let's say, your marketing site) that the user is already logged in and redirect her to app.yourdomain.com
.
Tokens stored in local/session storage, on the other hand, can't be accessed from different domains (even if these are subdomains). So what can you do?
One possible option is, when the user authenticates on app.yourdomain.com
and you generate a token you can also set a cookie set to .yourdomain.com
$.post('/authenticate', function() {
// store token on local/session storage or cookie
....
// create a cookie signaling that user is logged in
$.cookie('loggedin', profile.name, '.yourdomain.com');
});
Then, in youromdain.com
you can check the existance of that cookie and redirect to app.yourdomain.com
if the cookie exists. The token will be available on app subdomain, and from there on, the usual flow applies (if the token is still valid use it, if not get a new one unless last login was more than the threshold you set up).
It could happen that the cookie exists but the token was deleted or something else happened. In that case, the user would have to login again. But what's important to highlight here is, as we said before, we are not using the cookie as an authentication mechanism, just as a storage mechanism that happens to support storing information across different domains.
4. Preflight requests will be sent on each CORS request
Someone pointed out that the Authorization header is not a simple header, hence a pre-flight request would be required for all the requests to a particular URLs.
OPTIONS https://api.foo.com/bar
GET https://api.foo.com/bar
Authorization: Bearer ....
OPTIONS https://api.foo.com/bar2
GET https://api.foo.com/bar2
Authorization: Bearer ....
GET https://api.foo.com/bar
Authorization: Bearer ....
But this happens if you are sending Content-Type: application/json
for instance. So this is already happening for most applications.
One small caveat, the OPTIONS
request won't have the Authorization header itself, so your web framework should support treating OPTIONS
and the subsequent requests differently (Note: Microsoft IIS for some reason seems to have issues with this).
5. When you need to stream something, use the token to get a signed request
When using cookies, you can trigger a file download and stream the contents easily. However, in the tokens world, where the request is done via XHR, you can't rely on that. The way you solve this is by generating a signed request like AWS does, for example. Hawk Bewits is a nice framework to enable this:
Request:
POST /download-file/123
Authorization: Bearer...
Response:
ticket=lahdoiasdhoiwdowijaksjdoaisdjoasidja
This ticket is stateless and it is built based on the URL: host + path + query + headers + timestamp + HMAC, and has an expiration. So it can be used in the next, say 5 minutes, to download the file.
You would then redirect to /download-file/123?ticket=lahdoiasdhoiwdowijaksjdoaisdjoasidja
. The server will check that the ticket is valid and continue with business as usual.
6. It's easier to deal with XSS than XSRF
Cookies have this feature that allows setting an HttpOnly
flag from server side so they can only be accessed on the server and not from JavaScript. This is useful because it protects the content of that cookie to be accessed by injected client-side code (XSS).
Since tokens are stored in local/session storage or a client side cookie, they are open to an XSS attack getting the attacker access to the token. This is a valid concern, and for that reason you should keep your tokens expiration low.
But if you think about the attack surface on cookies, one of the main ones is XSRF. The reality is that XSRF is one of the most misunderstood attacks, and the average developer, might not even understand the risk, so lots of applications lack anti-XSRF mechanism. However, everybody understands what injection is. Put simply, if you allow input on your website and then render that without escaping it, you are open to XSS. So based on our experience, it is easier to protect against XSS than protecting against XSRF. Adding to that, anti-XSRF is not built-in on every web framework. XSS on the other hand is easy to prevent by using the escape syntax available by default on most template engines.
7. The token gets sent on every request, watch out its size
Every time you make an API request you have to send the token in the Authorization
header.
GET /foo
Authorization: Bearer ...2kb token...
vs.
GET /foo
connect.sid: ...20 bytes cookie...
Depending on how much information you store in that token, it could get big. On the other hand, session cookies usually are just an identifier (connect.sid, PHPSESSID, etc.) and the rest of the content lives on the server (in memory if you just have one server or a database if you run on a server farm).
Now, nothing prevents you from implementing a similar mechanism with tokens. The token would have the basic information needed and on the server side you would enrich it with more data on every API call. This is exactly the same thing cookies will do, with the difference that you have the additional benefit that this is now a conscious decision, you have full control, and is part of your code.
GET /foo
Authorization: Bearer ……500 bytes token….
Then on the server:
app.use('/api',
// validate token first
expressJwt({secret: secret}),
// enrich req.user with more data from db
function(req, res, next) {
req.user.extra_data = get_from_db();
next();
});
It is worth mentioning that you could also have the session stored completely on the cookie (instead of being just an identifier). Some web platforms support that, others not. For instance, in node.js you can use mozilla/node-client-sessions.
8. If you store confidential info, encrypt the token
The signature on the token prevents tampering with it. TLS/SSL prevents man in the middle attacks. But if the payload contains sensitive information about the user (e.g. SSN, whatever), you can also encrypt them. The JWT spec points to the JWE spec but most of the libraries don't implement JWE yet, so the simplest thing is to just encrypt with AES-CBC as shown below.
app.post('/authenticate', function (req, res) {
// validate user
// encrypt profile
var encrypted = { token: encryptAesSha256('shhhh', JSON.stringify(profile)) };
// sing the token
var token = jwt.sign(encrypted, secret, { expiresInMinutes: 60*5 });
res.json({ token: token });
}
function encryptAesSha256 (password, textToEncrypt) {
var cipher = crypto.createCipher('aes-256-cbc', password);
var crypted = cipher.update(textToEncrypt, 'utf8', 'hex');
crypted += cipher.final('hex');
return crypted;
}
Of course you can use the approach on #7 and keep confidential info in a database.
UPDATE: Pedro Felix correctly pointed out that MAC-then-encrypt is vulnerable to Vaudenay-style attacks. I updated the code to do encrypt-then-MAC.
9. JSON Web Tokens can be used in OAuth: Bearer Token
Tokens are usually associated with OAuth. OAuth 2 is an authorization protocol that solves identity delegation. The user is prompted for consent to access his/her data and the authorization server gives back an access_token
that can be used to call the APIs acting as that user.
Typically these tokens are opaque. They are called bearer
tokens and are random strings that will be stored in some kind of hash-table storage on the server (db, cache, etc.) together with an expiration, the scope requested (e.g. access to friend list) and the user who gave consent. Later, when the API is called, this token is sent and the server lookup on the hash-table, rehydrating the context to make the authorization decision (did it expire? does this token have the right scope associated for the API that wants to be accessed?).
The main difference between these tokens and the ones we've been discussing is that signed tokens (e.g.: JWT) are "stateless". They don't need to be stored on a hash-table, hence it's a more lightweight approach. OAuth2 does not dictate the format of the access_token
so you could return a JWT from the authorization server containing the scope/permissions and the expiration.
10. Tokens are not silver bullets, think about your authorization use cases carefully
Couple of years ago we helped a big company implement a token-based architecture. This was a 100.000+ employees company with tons of information to protect. They wanted to have a centralized organization-wide store for "authentication & authorization". Think about "user X can read field id and name of clincial trial Y for hospital Z on country W" use cases. This fine-grained authorization, as you can imagine, can get unmanageable pretty quickly, not only technically but also administratively.
- Tokens can get really big
- Your apps/APIs gets more complicated
- Whoever grant these permissions will have a hard time managing all this.
We ended up working more on the information architecture side of things to make sure the right scopes and permissions were created. Conclusion: resist the temptation of putting everything into tokens and do some analysis and sizing before going all the way with this approach.
Disclaimer: when dealing with security, make sure you do the proper due dilligence. Any code/recommendation that you get here is provided as-is.
Please leave a comment or discuss on HN.
Happy tokenizing!
Photo taken from: http://alfanatic.webs.com/


FAQ chameleon cloud¶
All FAQ’s related to chameleon cloud asume
you have looked at the instances with horizon before you use
cms
cms
is installedcms init
worked and
Did cms ever worked?¶
cms
Worked from day one ov this class. Due to an change within
chameleon cloud some parameters needed to be changed in the
cloudmesh.yaml
file. We informed the entire class to delete the
cloudmesh.yaml
file and create it again via cms help
. However,
we found that this was often not executed and a lot of errors could be
traced back to that the file was not deleted. Chameleon also updated the
way the network works and we had to integrate at that time also a
mechanism to deal with this. Again if you deleted your yaml file and
recreated it you will have no issue.
If you completely erase your ENV3, the cloudmesh-*
folder in cm and
do a fresh install you can avoid this. As we had students not following
our clear instructions, we will no longer help if you have not
deleted the .cloudmesh directory
deleted your virtualnv (for example ENV3)
deleted your source cod in cm related to cloudmesh Make sure not to delete the directories unrelated to that. Be careful that you do not delete the
cloudmesh-*
folder that you worked on. make a backup copy.after the new install and help call use the command
cms test
and observe and interprete the output.
Cloudmesh is trivial to install.
How check if chmaeleon cloud works¶
cms set cloud=chameleon
cms flavor list --refresh
This returns the list of fkavors
How do I upload my key to chameleon?¶
cms key upload --cloud=chameleon
cms key list --cloud=chameleon
What is the error …?¶
If you get this error
UnboundLocalError: local variable 'key' referenced before assignment
then you have not uploade your key to chameleon
What is the chameleon account bug?¶
Preriquisite:
We assue you start by deleting your .cloudmesh directory and have install a proper version of cms.
Before you do anything verify if you can remember your password. You must logout of the chameleon cloud.org dashboart and login, while not using an auto completion Web password completer. Make sure to remove your password if you use one of them.
Chameleon has several strange bugs we know of that will hopefully be fixed
Any account in chameleon that wants to use OpenStack KVM must first visit horizon and through the visit activate the acoount. The activation via the e-mail that they send to you does not fully activate your account.
When activation your account in horizon, you meust login to a login screen. However, sometimes we observed that screen do not complete the activation and you do not get forwarded to horizon. INstead you end in an endless loop for activation requests.
Some students despite the issue of being able to login reported that they can not use cms even though they typed in the password correctly. To find this out you have to talk to Gregor which unfortunately needs your username and password. to verify if your account works or not.
If Gregor can verify that your account works (e.g. he does this on a computer on which we checked chameleon cloud works for another account), you will have to apply for a new chameleon account with an e-mal that has not been used at
University of Chicago
Indiana University
jetstream
XSEDE
Chameleon Cloud
Than you do the previous steps and check if you can use this account in cms. If it works fine, if it does not file a ticket with chameleon cloud.
Gregor completely hats to do 3. and 4. but chameleon cloud have not provided any proper solutions.
You must not use IUGuest network¶
IU GUEST or any other insecure network:
If you are at IU, chameleon cloud does not allow you to connect to it from IU guest. So if you say cms vm list –refresh and it hangs there for a long time you will at one point see “Failed to discover available identity versions when contacting https://kvm.tacc.chameleoncloud.org:5000/v3. Attempting to parse version from URL.”
This indicates you can not connect to chamelon cloud as you are on an insecure network. You can do a CRTL C here
If you wait longer, you will see
keystoneauth1.exceptions.connection.ConnectFailure: Unable to establish
connection to https://kvm.tacc.chameleoncloud.org:5000/v3/auth/tokens:
HTTPSConnectionPool(host='kvm.tacc.chameleoncloud.org', port=5000): Max retries
exceeded with url: /v3/auth/tokens (Caused by
NewConnectionError(' \< urllib3.connection.VerifiedHTTPSConnection object at
0x7f63fc14a040 \> : Failed to establish a new connection: [Errno 110] Connection
timed out'))
Tethering you computer through a cell phone¶
This will liekly not work as your cell phone company has likely some restrictions.
Can I keep my instance running when not in use?¶
No you shout terminate and restart it. However if you initially have issues keep it running and find in the manaul how to suspend and resume it. You can also do this from horizon if you prefer.
What is WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
¶
THis is hapening when a previously used ip address is used on another vm You need to remove the ip from ~/.ssh/kown hosts by using
ssh-keygen -R IPADDRESS
where IPADDRESS is the address to be removed, and than try again
ssh-keygen vs putty¶
use ssh-keygen as it is far easier.
Can I give my own network when booting¶
Yes
cms vm boot --name=gregor-02 \
--image=CC-Ubuntu18.04 \
--network=e01ee12e-fd22-4b21-a050-d3e015f42bb1
How do I upload the secgroups¶
cms sec group load --cloud=chameleon
Are there additional Videos¶
Starting vms in horizon¶
A video was shot by Rahul. I do recommend however if you can just to keep the keyname on your computer to be id_rsa.
In horizon you naturally use a keyname such as rahul-222 (e.g. what rahul used)
The reason is that in the future we use cloudmesn and we have a default
key for cloudmesh set as id_rsa
. This simplifies debugging in case
something does not go right
Starting VMs in cloudmesh¶
Rahul has done a video to show how to start vms in cloudmesh Also we added the network id to the cloudmesh.yaml file, so if you have a new version its no longer needed to add the network


[DbTable] element index
Package indexes
Controller
Bootstrap
Ivc_Error
Model
Ivc_Acl
Ivc_Mail
Ivc_Form
Ivc_Cache
Ivc_Auth
Ivc_Controller
Ivc_Model
Ivc_View
View
Ivc_Bootstrap
Form
Ivc_Validate
All elements
b
c
i
m
s
u
b
top
Brokers.php
Brokers.php
in Brokers.php
c
top
Clubs.php
Clubs.php
in Clubs.php
ClubUsers.php
ClubUsers.php
in ClubUsers.php
i
top
Ivc_Model_Clubs_DbTable_Brokers
Ivc_Model_Clubs_DbTable_Brokers
in Brokers.php
Brokers class for SQL table dependencies.
Ivc_Model_Clubs_DbTable_Clubs
Ivc_Model_Clubs_DbTable_Clubs
in Brokers.php
Ivc_Model_Clubs_DbTable_ClubUsers
Ivc_Model_Clubs_DbTable_ClubUsers
in ClubUsers.php
ClubUsers class for SQL table dependencies.
Ivc_Model_Users_DbTable_ClubUsers
Ivc_Model_Users_DbTable_ClubUsers
in Users.php
Ivc_Model_Users_DbTable_Users
Ivc_Model_Users_DbTable_Users
in Users.php
User's class for SQL table dependencies.
Ivc_Model_Users_DbTable_UserSettings
Ivc_Model_Users_DbTable_UserSettings
in Users.php
m
top
Model_Portfolio_DbTable_Stocks
Model_Portfolio_DbTable_Stocks
in Stocks.php
Stocks class for SQL table dependencies.
s
top
Stocks.php
Stocks.php
in Stocks.php
u
top
Users.php
Users.php
in Users.php
b
c
i
m
s
u


Item 6.d.
The \(R\)-squared value that I asked you to show in Item 6.a above measures what proportion of the variation in the \(y\)-variable is explained by the trendline. For instance, \(R^{2}=1\) means that \(100\%\) of the variation in y is explained by the trendline, so the trendline is a perfect fit. Conversely, \(R^{2}=0\) means that the trendline explains \(0\%\) of the variation in the \(y\) variable, so this trendline doesn't fit the data at all.
What percentage of the variation in two-year public college tuition (\(y\)) is explained by the variation in year (\(x\))? What about when \(y=\) four-year private college tuition? Four-year public college tuition?


-
How I Use Work Tools To Organize Personal Life
When I joined a mega-corporation for the first time, I realized that a lot of thought has been put into organizing things. There are several frameworks, for example, OKRs, KPIs, etc., to help manage the complexity. These tools are common knowledge in the industry now. Over time, I realized that they can also be beneficial in personal life and help in improving focus and productivity. In this post I share how I have been using some of these tools.
-
Opinions
We all have opinions on different topics, from the best pizza place in town to the political party to vote for in the next election. More often than not these opinions are innocuous and don’t impact anything critical. However, there are times when opinions can have an impact on other individuals, projects, or an organization.
In such cases, a certain level of rigor is expected from an individual before they form an opinion.
-
Incident handling at Kayako
We at Kayako strive for the number of 9’s in our uptime metric. We want to ensure minimum service disruption for our customers, and therefore we need to work hard on the following two aspects:
Identifying that an incident has occurred Minimizing the impact of the incident Identifying an incident Our goal is to identify an incident before our customer. It not only helps us in proactively informing our customers on the ongoing issues but also helps us to prepare our Support team better for the incoming queries.
-
Slow HTTP - The Insidious Killer
Slow HTTP are application layer Denial Of Service (DoS) attacks and have a potential to knock down a server with limited resources. Because of the nature of the attack (slow speed and low volume), they are hard to detect and can cause equal damage as a high volume DDoS. In this post, I’ll share my experience with these attacks.
Introduction As explained in the WiKi [1], Slow HTTP attacks rely on the fact that the HTTP protocol, by design, requires requests to be completely received by the server before they are processed.
-
How 'ls' command output caused a downtime on prod
ls is one of the innocuous commands that sysadmins probably use hundreds of times a day. But yesterday, we faced downtime on production because of the output of this command. Here’s the full story…
One of our production app server was behaving funny yesterday, because of which an Ops Engineer was doing routine checks on the server. He ran the beloved ll command (which is aliased to ls -lah). The output of the command was something like:
-
Null HUMLA Write-up
Last week I got a chance to attend my first Null HUMLA workshop. People who are not familiar with Null, it is a community of security enthusiasts who are willing to share knowledge and trying to make the world a more secure place. In this post, I’ll share my experience with the workshop.
Introduction Null community organizes three different kinds of events:
Humla (for offensive security) Bachaav (for defensive security) Pulia (for bridging the gap between two) The workshop was organized at Sapient, Gurgaon, which is located in the heart of the city.
-
My Internship At Kayako
This post was originally posted on Medium as a part of life at Kayako series.
This summer I got the opportunity to do an internship as a Product Engineer at Kayako. I was fresh out of college and looking for a chance to apply the knowledge that I learned at college. I accepted the offer straight away.
The internship was the perfect platform to kick start my professional career. It not only honed my technical skills, but also helped me to the understand the various aspects of how an organization like this works.
-
HackIM 2016 write-up (Prog and Crypto)
The HackIM 2016 edition has just concluded. Programming questions were pretty straight forward and didn’t require much programming skills. Let’s have a look at them:
Programming 1 So you reached Delhi and now the noise in your head is not allowing you to think rationally. The Nosise in your head has origin its Origin in your Stomach. And this is a big hunger. You can finish one or probably 2 Tandoori Chicken.
-
How did it get so late so soon?
Another year is about to end and yet it seems it has just started. At the start of 2015, I had ambitious plans for the year. A lot of things to do, a plethora of resolutions, and a heart brimming with optimism. The year is about to conclude and I’m afraid that I’m far from my plans. I had fallen in the trap of planning fallacy.
Daniel Kahneman describes planning fallacy as follows:
-
Zinger - Build Vocabulary
Almost all of us face the problem of forgetting new words which we learn. Moreover, it is difficult to compile a list of all new words to later reference. Even if we maintain such list, we almost never open it because of lack of time or motivation. To solve this problem, We have developed a chrome extension - Zinger which helps you to learn new words with minimum efforts. For learning new words you don’t have to devote explicit time, you can learn them while you are browsing the web.


Description Price 2000/month
15days a month
Use a table in the co-working area 15 days in a month
Total price will be $XX.XX/month
Total price will be = $XX.XX (per month)


| Methods' Details |
convertNumberToPreviewString
- Description
- formats a value using a format string, without inserting a
number format into the list.
- Parameter aFormat
- is the format string that is used for formatting.
- Parameter fValue
- is the value that is formatted.
- Parameter nLocale
- is the locale that is used to interpret the format string.
- Parameter bAllowEnglish
- specifies if English language number format strings are accepted
in addition to those from the selected locale.
- Returns
- the formatted string.
- Throws
- com::sun::star::util::MalformedNumberFormatException
if the format string is invalid.
|
|
queryPreviewColorForNumber
- Description
- returns the color which is to be used for a number.
- Parameter aFormat
- is the format string that is used for formatting.
- Parameter fValue
- is the value that is formatted.
- Parameter nLocale
- is the locale that is used to interpret the format string.
- Parameter bAllowEnglish
- specifies if English language number format strings are accepted
in addition to those from the selected locale.
- Parameter aDefaultColor
- is the color that should be returned if no color is set by
the number format.
- Returns
- the color that should used to output the formatted string.
- Throws
- com::sun::star::util::MalformedNumberFormatException
if the format string is invalid.
|
|
Top of Page
Copyright © 2013, The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the Apache feather logo, Apache OpenOffice and OpenOffice.org are trademarks of The Apache Software Foundation. Other names may be trademarks of their respective owners.


public class PulleyJoint extends Joint
Body
s.
The pulley anchor points represent the "hanging" points for the respective
Body
s.
The ratio allows this joint to act like a block-and-tackle.
Nearly identical to Box2d's equivalent class.
Joint.LimitState
| Modifier and Type | Field and Description |
|---|---|
protected double |
impulse
The accumulated impulse from the previous time step
|
protected double |
invK
The effective mass of the two body system (Kinv = J * Minv * Jtrans)
|
protected double |
length
The total length of the pulley system
|
protected double |
length1
The original length of the first side of the pulley
|
protected double |
length2
The original length of the second side of the pulley
|
protected Joint.LimitState |
limitState
The state of the limit (only used for slack)
|
protected Vector2 |
localAnchor1
The local anchor point on the first
Body |
protected Vector2 |
localAnchor2
The local anchor point on the second
Body |
protected Vector2 |
n1
The normal from the first pulley anchor to the first
Body anchor |
protected Vector2 |
n2
The normal from the second pulley anchor to the second
Body anchor |
protected Vector2 |
pulleyAnchor1
The world space pulley anchor point for the first
Body |
protected Vector2 |
pulleyAnchor2
The world space pulley anchor point for the second
Body |
protected double |
ratio
The pulley ratio for modeling a block-and-tackle
|
protected boolean |
slackEnabled
True if slack in the rope is enabled
|
collisionAllowed, id
| Constructor and Description |
|---|
PulleyJoint(Body body1,
Body body2,
Vector2 pulleyAnchor1,
Vector2 pulleyAnchor2,
Vector2 bodyAnchor1,
Vector2 bodyAnchor2)
Minimal constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Vector2 |
getAnchor1()
Returns the anchor point on the first
Body in
world coordinates. |
Vector2 |
getAnchor2()
Returns the anchor point on the second
Body in
world coordinates. |
double |
getLength()
Returns the total length of the pulley.
|
double |
getLength1()
Returns the current length from the first pulley anchor point to the
anchor point on the first
Body . |
double |
getLength2()
Returns the current length from the second pulley anchor point to the
anchor point on the second
Body . |
Vector2 |
getPulleyAnchor1()
Returns the pulley anchor point for the first
Body
in world coordinates. |
Vector2 |
getPulleyAnchor2()
Returns the pulley anchor point for the second
Body
in world coordinates. |
double |
getRatio()
Returns the pulley ratio.
|
Vector2 |
getReactionForce(double invdt)
Returns the force applied to the
Body s in order
to satisfy the constraint in newtons. |
double |
getReactionTorque(double invdt)
Returns the torque applied to the
Body s in order
to satisfy the constraint in newton-meters. |
void |
initializeConstraints()
Performs any initialization of the velocity and position constraints.
|
boolean |
isSlackEnabled()
Returns true if slack in the rope is enabled.
|
void |
setRatio(double ratio)
Sets the pulley ratio.
|
void |
setSlackEnabled(boolean flag)
Toggles the slack in the rope.
|
protected void |
shiftCoordinates(Vector2 shift)
Shifts (translates) the coordinates of this constraint.
|
boolean |
solvePositionConstraints()
Solves the position constraints.
|
void |
solveVelocityConstraints()
Solves the velocity constraints.
|
java.lang.String |
toString() |
getId, isActive, isCollisionAllowed, setCollisionAllowed
getBody1, getBody2, getUserData, getWorld, isOnIsland, setBody1, setBody2, setOnIsland, setUserData, setWorld
protected Vector2 pulleyAnchor1
Body
protected Vector2 pulleyAnchor2
Body
protected double ratio
protected final double length1
protected final double length2
protected double length
protected double invK
protected double impulse
protected boolean slackEnabled
protected Joint.LimitState limitState
public PulleyJoint(Body body1, Body body2, Vector2 pulleyAnchor1, Vector2 pulleyAnchor2, Vector2 bodyAnchor1, Vector2 bodyAnchor2)
Creates a pulley joint between the two given Body
s using the given anchor points.
body1
- the first Body
body2
- the second Body
pulleyAnchor1
- the first pulley anchor pointpulleyAnchor2
- the second pulley anchor pointbodyAnchor1
- the first Body
's anchor pointbodyAnchor2
- the second Body
's anchor pointjava.lang.NullPointerException
- if body1, body2, pulleyAnchor1, pulleyAnchor2, bodyAnchor1, or bodyAnchor2 is nulljava.lang.IllegalArgumentException
- if body1 == body2public void initializeConstraints()
Joint
initializeConstraints
in class Joint
public void solveVelocityConstraints()
Joint
solveVelocityConstraints
in class Joint
public boolean solvePositionConstraints()
Joint
solvePositionConstraints
in class Joint
public Vector2 getAnchor1()
Joint
Body
in
world coordinates.getAnchor1
in class Joint
Vector2
public Vector2 getAnchor2()
Joint
Body
in
world coordinates.getAnchor2
in class Joint
Vector2
public Vector2 getReactionForce(double invdt)
Joint
Body
s in order
to satisfy the constraint in newtons.getReactionForce
in class Joint
invdt
- the inverse delta timeVector2
public double getReactionTorque(double invdt)
Joint
Body
s in order
to satisfy the constraint in newton-meters.getReactionTorque
in class Joint
invdt
- the inverse delta timeprotected void shiftCoordinates(Vector2 shift)
Constraint
Typically this method should not be called directly. Instead
use the World.shiftCoordinates(Vector2)
method to move the
entire world.
shiftCoordinates
in class Constraint
shift
- the distance to shift along the x and y axespublic Vector2 getPulleyAnchor1()
Body
in world coordinates.Vector2
public Vector2 getPulleyAnchor2()
Body
in world coordinates.Vector2
public double getLength()
Typically this is computed when the joint is created by adding the distance from the first body anchor to the first pulley anchor with the distance from the second body anchor to the second pulley anchor.
public double getLength1()
Body
.
This is used, in conjunction with length2, to compute the total length when the ratio is changed.
public double getLength2()
Body
.public double getRatio()
public void setRatio(double ratio)
The ratio value is used to simulate a block-and-tackle. A ratio of 1.0 is the default and indicates that the pulley is not a block-and-tackle.
This method recomputes the total length of the pulley system.
ratio
- the ratio; must be greater than zerojava.lang.IllegalArgumentException
- if ratio is less than or equal to zeropublic boolean isSlackEnabled()
public void setSlackEnabled(boolean flag)
If slack is not enabled the rope length is fixed to the total length of the rope, acting like the DistanceJoint
.
flag
- true to enable slack


---
layout: menupage
title: "How to use this site"
---
{{ site.title }}
{{page.title}}
Reading stories
- Click on a story to read it.
- Click on Change language to read the story in a different language.
- Click on {{ site.lang1_code }}{% if site.lang2 != "" %} and {{ site.lang2_code }} icons to switch quickly between {{ site.lang1 }} and {{ site.lang2 }}, respectively{% else %} to switch quickly from any language to {{ site.lang1 }}{% endif %}.
- Please note that this only changes the language of the text. Click on Change language to change the language of the audio as well.
Listening to stories
- Click on the icon beside any text on the page to hear the text read aloud.
- To pause or restart the audio at any point, click on the icon.
- To hear the entire story read aloud, click on the audio controls at the top of the page. (Please note that not all stories have audio versions.)
- If you do not see any audio controls, or if the audio controls are greyed out, it means that there is no audio available for that language at this time.
- Audio speed: Use the slider under the playback controls to adjust the reading speed. Click on the icon to return to normal speed (1×).
Downloading stories
- To download any story, click on the Download PDF button at the top or bottom of the page.
- To download the full audio for any story, right-click on the audio controls at the top of the page and select Save Audio as... to save the audio file to your computer.
- Depending on your operating system and browser, there may be a download icon on your audio control panel, which you can click to save the story to your machine.


FIBERCON- calcium polycarbophil tablet
Wyeth Pharmaceutical Division of Wyeth Holdings Corporation, a subsidiary of Pfizer Inc.
Disclaimer: Most OTC drugs are not reviewed and approved by FDA, however they may be marketed if they comply with applicable regulations and policies. FDA has not evaluated whether this product complies.
| Active ingredient (in each caplet) |
Purpose |
| Calcium polycarbophil 625 mg equivalent to 500 mg polycarbophil |
Bulk-forming laxative |
Uses
- relieves occasional constipation to help restore and maintain regularity
- this product generally produces bowel movement in 12 to 72 hours
Warnings
Choking:
Taking this product without adequate fluid may cause it to swell and block your throat or esophagus and may cause choking. Do not take this product if you have difficulty in swallowing. If you experience chest pain, vomiting, or difficulty in swallowing or breathing after taking this product, seek immediate medical attention.
Ask a doctor before use if you have
- abdominal pain, nausea, or vomiting
- a sudden change in bowel habits that persists over a period of 2 weeks
Ask a doctor or pharmacist before use if you are
taking any other drug. Take this product 2 or more hours before or after other drugs. All laxatives may affect how other drugs work.
When using this product
- do not use for more than 7 days unless directed by a doctor
- do not take more than 8 caplets in a 24 hour period unless directed by a doctor
Stop use and ask a doctor if
rectal bleeding occurs or if you fail to have a bowel movement after use of this or any other laxative. These could be signs of a serious condition.
Keep out of reach of children.
In case of overdose, get medical help or contact a Poison Control Center right away.
Directions
- take each dose of this product with at least 8 ounces (a full glass) of water or other fluid. Taking this product without enough liquid may cause choking. See choking warning.
- FiberCon works naturally so continued use for one to three days is normally required to provide full benefit. Dosage may vary according to diet, exercise, previous laxative use or severity of constipation.
| age |
recommended dose |
daily maximum |
| adults and children 12 years of age and over |
2 caplets once a day |
up to 4 times a day |
| children under 12 years |
consult a physician |
|
Other information
-
each caplet contains: 140 mg calcium and 10 mg magnesium
- protect contents from moisture
- store at 20-25°C (68-77°F)
Inactive ingredients
caramel, crospovidone, hypromellose, magnesium stearate, microcrystalline cellulose, polyethylene glycol, silicon dioxide, sodium lauryl sulfate
Questions or comments?
Call weekdays from 9 AM to 5 PM EST at 1-800-282-8805
PRINCIPAL DISPLAY PANEL - 36 Caplet Blister Pack Carton
FiberCon®
Calcium Polycarbophil Bulk-Forming Laxative
Fiber Therapy for Regularity
- Gentle Enough for
Everyday Use*
- Won't Ferment to
Cause Gas or Bloating
- As Effective as
Fiber Powders
*when used as directed
CONVENIENT
TRAVEL PACK!
36 Caplets
Wyeth Pharmaceutical Division of Wyeth Holdings Corporation, a subsidiary of Pfizer Inc.


A website that contains all of my academic activities, including projects for a job in Fullstack Web Developer in Helsinki, Finland.
I am a MEAN/MERN developer with tons of interesting projects written in modern web developing programming languages. Addtionally, I have passed doctoral-level class in Microeconomic Theory at FDPE (Finnish Doctoral Programme in Economics) while being a Bachelor student in Data Science at Aalto University School of Science.
Addtionally, CSS Grid and CSS Flexbox are worth the mention.
that will numb your minds and impress you more than ever.
Web developing is an ever-growing profession that requires constant learning. You never know what you learn in one project might essentially help you in another.
Addtionally, there also other projects written in C/C++ languages, ensuring an entire spectrum of prorgamming languages is covered.
All of these give me experiences, which also give me an ambitious attitude for exploring more. Hence, my projects range from making a simple website (like this one) to creating one that emulates VR games!
This project attempts to build a robot searching for a delivery parcel from a specific owner.
See more.This project attempts to build a robot searching for a delivery parcel from a specific owner.
See more.This project attempts to build a robot searching for a delivery parcel from a specific owner.
See more.This project attempts to build a robot searching for a delivery parcel from a specific owner.
See more.This project attempts to build a robot searching for a delivery parcel from a specific owner.
See more.This project attempts to build a robot searching for a delivery parcel from a specific owner.
See more.This project attempts to build a robot searching for a delivery parcel from a specific owner.
See more.


What could New York City pay for if the Yankees paid taxes?
By Mary Steffenhagen
October 6, 2020
The New York Yankees team pays one dollar per year in rent to the city for Yankee Stadium and pays no property taxes on the stadium itself. Instead, it makes Payments in Lieu of Taxes (PILOTS) to the city towards its debt, rather than paying taxes that would go back into the surrounding neighborhood—which happens to be the country’s poorest congressional district.
New York City subsidized the stadium’s construction to the tune of $1.7 billion, over half the full cost of the stadium. But the Brookings Institute found little evidence that government-subsidized sports stadiums provide “spillover gains to the local economy.” Stadiums don’t appear to have a positive impact on “local economic development, income growth, or job creation,” their report says.
In 2016, the Brookings Institute estimated how much New York City had lost in potential tax revenue from this deal. Numbers in this chart are based on that data's extrapolation to 2020, accounting for inflation.
According to this data, New York City loses out on $104 million per year in potential tax revenue. Here's what that money could pay for:
$104 million would pay for the entire 2021 budget of Kingsborough Community College, or Hostos and Guttman combined. Source
NYC's average cost per elementary school student per year is $24,402. $104 million would pay for approximately 4,261 students' educations. Source
It costs $20.4 million to run the Civilian Complaint Review Board, which oversees misconduct in the NYPD. $104 million could fund it for approximately 5 years. Source
The 2021 NYC budget cut Parks by $42 million. $104 million could eliminate the need for this cut. Source


--- title: PiNet, A system for setting up and managing a classroom set of Raspberry Pis. layout: default ---
Centralised user accounts and file storage system for a Raspberry Pi classroom.
Get Started! » Main Documentation » PiNet Blog » Join the Mailing List »The students user accounts are stored on the central PiNet server. This means they can log in on any Raspberry Pi in the classroom and no more trying to figure out which SD card belongs to which student.
The Raspberry Pi operating system (Raspbian) is also stored on the central server, meaning each Raspberry Pi boots up off it each time. This allows you to maintain one perfect master operating system.
Easy to setup shared folders to share resources with students and a breeze to set up automated backups for students work to an external drive.
PiNet was designed from the ground up to be extremely easy to set up and maintain. It is so simple, we have even heard of 11 year old students managing their school PiNet network!
PiNet is completely free, open source and built upon the work of the Linux Terminal Server Project. This means you can use it for what you want, where you want for no cost and have access to the full source code.
PiNet is already used across the world by 100s of schools and organisations in over 30 countries including United Kingdom, China, Brazil, South Africa and the United States.


Facts About Me
- Name: Brian Kremer
- Age: 29
- Born: 7/10/1987 in St. Louis, MO
- Favorite Sport: Golf
- Favorite Food: Pizza
- Favorite Destinations: Disney World
- About: Son to Jane and Bill and brother to Andrew. I was born and raised in St. Louis, MO. I am very family and friend oriented. I love to travel and spend time with my family
My Education
| Schools | |||
|---|---|---|---|
|
Elementary School
Beasley |
Middle School
Buerkle |
High School
Oakville |
College
Mizzou |
Places I've Worked
| Work Places | |||
|---|---|---|---|
| Sunset Country Club
4/10/2000 - 8/15/2013 |
JW Software
9/10/2010 - 8/15/2013 |
Centene
8/19/2013 - 12/11/2015 |
JW Software
12/17/2015 - Present |
Activities
- Coach: Oakville Hockey - 5 years
- Drone Flying: Whenever I can
- Hockey: Mens League
- Computer Programming: Currently
- Small Group: Oakbridge CC


This is the login page for {{name}} with cid {{cid}}
Choose the following links to update your account settings:


The best barber in Fort Wayne.
Please be aware that if you wish to cancel, do so at least one day in advance!
A Paragraph.


KeySmashers To-Do List
Inbox
High
Medium
Low
Adding a Task
Title
Choose Priority
High
Medium
Low
Priority
Task Assignment (Github ID)
Submit


--- layout: post title: Test date: 2012-07-21 18:09:57.000000000 +03:00 categories: [] tags: [] status: draft type: post published: false post_id: test meta: _edit_last: '1' author: login: admin email<EMAIL_ADDRESS>display_name: Radu first_name: '' last_name: '' ---


Toggle navigation
Home
Choose location
{% for location in locations %}
{{location.name}}
{% endfor %}


Hello, I’m Upamanyu! I'm a passionate wildlife lover and storyteller. Currently working as a freelance wildlife photographer & film-maker . I have to travel between many places to explore and film nature & wildlife, but if there is one place I call home, that is Kolkata.
I also co-own a design firm from my previos life as a designer that I had very dearly named, Cloudstudio which I started in 2008.
I am a storyteller by heart, but I also take immense interest in exploring the deep relations and mysteries of the natural world. While filming nature, being in the natural environment, puts me in my element and I feel completely blessed by mother nature's bounty.
Apart from my passion of Wildlife, I also am interested in technology & design. I used to design and code a lot and still do during the few projects I take up.
If you want to know about the equipment I use head on to /setup.
All my wildlife images can be found at /photography under the wildlife section. And also at the YouTube channel of The Wild Bits.
Also there is a list of personal & commercial design projects I worked on, at /projects.
I push most of my code to GitHub.
I've also build a few open-source projects:
- uPass, a smart password manager for smart people
I was born in Kolkata, India, I grew up there. Bengali is my mother tongue but I do have full professional proficiency in English. I speak, read, and understand conversational Hindi.
Pronunciation : Pronuncing my name can be a little difficult. The approximate phonetic is /uːpɔːmʌnjuː daːʃ/.
Upamanyu is a sequence of:
- U as in coo without the initial c
- pa as in paw
- man as in munch without the the final ch
- u as in you in totality
Das is like pass, if you replace the pa with D
Though I am not much of a athelete nor am I very sporty (which you will know at once when you meet me), but I do enjoy the one sport, that seems to give me a immense peace of mind. Swimming.
I read & follow HackerNews.
The only sports event I am interested in watching, is the Olympics.
I can be stalked at Facebook, Twitter or Instagram.
You can email me<EMAIL_ADDRESS>Agile Coffee Making
I make really good good good coffee
Crazy Website Prototyping
Come to me with a concept, and I will build the prototype for you. Please note that I code no more.
Design / Illustration
I have been designing for the last 10 years. Naturally I am quite good at it. Come to me with any kind of design job you, and you can expect a good result.
Illustration is also my area of expertise. I have illustrated for magazines and books.
Weird Wireframing Patterns
I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now.
UI/UX Design
This is a field I have entered recently, though I don't claim to be an expert, I can do a pretty decent job as an UI & UX designer.
Bad Time Management
I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents.


Select County :
{{numberOfProjects}} Projects
{{amountNeeded | currency}} asked
{{NuDistricts}} Districts
{{NuSchools}} Schools
{{numberOfProjects}} Projects
{{amountNeeded | currency}} asked
{{NuDistricts}} Districts
{{NuSchools}} Schools


This page demonstrates a reason of usage Web Workers.
Try the examples below to feel the difference. See more information on official
MDN Web Workers API
.
Please just use the latest version of browser. I skip any polyfills/transpilers related
handling this time to concentrate attention on example.
You see a simple animated element. And button for running some task. Is does not matter what the task exactly do, let's say it's heavy operation from the cpu point of view. So, if we start this task it will cause to freeze the page and makes it unresponsive for a moment. UI developers should care about UI response time. So, when you have such situation in your application, it's better to delegate it to backend/API. But if you still need to do it on UI you can run such tasks inside web worker. Web worker will not freeze UI because code will be executed on the separate thread.
This example fetch few files from the github gists and show it in random order. Each file truncated and displayed on separate card. Code of file highlighted. So the task which probably MAY freeze UI here - is syntax highlighting. Sure, it's mostly depends on client side hardware, the example provide form to change default settings.


cimi
Classes
Abatement
AnatomicalDirection
AnatomicalLocation
ApplicableAgeRange
ApplicableSubpopulation
AssertionContext
AssertionTopic
Certainty
ClinicalStatement
ClinicalStatus
CollectionMethod
CollectionSite
CollectionTime
CompoundClinicalStatement
ConditionPresenceContext
ConditionTopic
Content
ContextCode
Criticality
DeltaFlag
Encounter
Entity
EvaluationComponent
EvaluationResultContext
EvaluationResultTopic
ExceptionValue
FindingContext
FindingMethod
FindingStatus
FindingTopic
IndivisibleClinicalStatement
InformationEntry
Interpretation
Laterality
Locatable
Onset
Precondition
PresenceContext
PresentOnAdmission
RecordedContext
ReferenceRange
RelevantTime
Severity
SourceSpecimen
Specimen
StatementContext
StatementTopic
TopicCode
Type
VerificationStatus


When I started my career in web design and development at a well-named service company, I had only one intention. To provide such a software to clients, which is useful, easy to use, and of-course, well written. Thanks to the nature of the company, I get to work in many different projects having different backgrounds and technologies.
Because I have only one goal, the success of the project, I do not hesitate to take up many roles. I've became Jack-Of-All-Trades and acting as full stack developer throughout my career at Infosys. My relentless attempt to excel at web development made me well versed in end to end technologies. You can check my proficiency in each of the technologies in the below skillset list.
I believe that the software development is just like any other form of art. It takes a person’s creativity, knowledge and intelligence to design a beautiful and regal software. I also know that time is an important factor for all the decisions that have been taken and to be taken. You can rely on me to deliver the high quality project on time.
In addition to above, I am voracious reader, technology enthusiast, curious being, and a very bad cook.
Started as Database administrator Trainee, a brief stint in application development and later found solace in web development. Currently working as front-end developer for an Angular project. I'm working on numerous technologies here. Including but not limited to, C#, Silverlight, Python, NodeJS, Angular, Express, ASP.NET MVC, HTML5, CSS3, and JavaScript.
Tried to pitch in investors with the automotive patent we applied. Which sadly, didn't work out. In the mean time, Studied Java 8 and improved Python language proficiency. Recently, I've published my trial programs on Github. You can find those projects in my github repository.
Studied basics of Product design & prototyping, Thermodynamics, kinetics & kinematics, among several other subjects. Actively participated in several competitions and activities. In this four years I worked on several projects, exhibited them in shows, presented a paper in national level conference, and applied for a patent in automotive sector. Also, passed the course with 70%, First class.
Tried to start my own web development & online entertainment company which failed miserably (Got a check of $5.94 and $10 in AlertPay account for a year worth effort). Also, scrored 69.83% in my finals and joined engineering.


|
| Local Properties | ||
| Managed Object Types | Data Object Types | All Properties | All Methods |
In a vSphere HA cluster, the active hosts form a fault domain. A host is inactive if it is in standby or maintenance mode, or it has been disconnected from vCenter Server. A vSphere HA agent, called the Fault Domain Manager (FDM), runs on each host in the fault domain.
One FDM serves as the master and the remaining FDMs as its slaves. The master is responsible for monitoring the availability of the hosts and VMs in the cluster, and restarting any VMs that fail due to a host failure or non-user-initiated power offs. The master is also responsible for reporting fault-domain state to vCenter Server.
The master FDM is determined through election by the FDMs that are alive at the time. An election occurs in the following circumstances:
The slaves are responsible for reporting state updates to the master and restarting VMs as required. All FDMs provide the VM/Application Health Monitoring Service.
Properties
| Name | Type | Description |
|---|---|---|
| state | xsd:string |
The Availability State of a host based on information
reported by the entity given by the
stateReporter property. See
ClusterDasFdmAvailabilityState for the set of
states.
|
| stateReporter* | ManagedObjectReference
to a HostSystem |
The entity reporting the state of the host. If the reporter is a host,
the property reports which host, whereas if the reporter is vCenter Server,
the property is unset.
|
| Properties inherited from DynamicData | ||
| None |
| Top of page | Local Properties | ||
| Managed Object Types | Data Object Types | All Properties | All Methods |


The replication system is capable of reporting a great many events to which your code might need to respond. To track and respond to these events, you implement a class whose function it is to respond to events that happen within the DB library.
In order to respond to events, you must write your application as an
implementation of
com.sleepycat.db.EventHandler
.
This class gives you a series of methods within which you can
detect and respond to various events that occur in your DB
code. Note that some of these are necessary for events beyond
those required for replication. In this section, however, we
only discuss some of the replication-specific events.
Some of the more commonly handled replication events are
described below. For a complete list of events, see the
com.sleepycat.db.EventHandler
javadoc page.
EventHandler.handleRepClientEvent()
The local environment is now a replica.
EventHandler.handleRepLocalSiteRemovedEvent()
The local Replication Manager site has been removed from the group.
EventHandler.handleRepMasterEvent()
The local environment is now a master.
EventHandler.handleRepNewMasterEvent()
An election was held and a new environment was made a master. However, the current environment is not the master. This event exists so that you can cause your code to take some unique action in the event that the replication groups switches masters.
EventHandler.handleRepPermFailedEvent()
The Replication Manager did not receive enough acknowledgements to ensure the transaction's durability within the replicationg group. The Replication Manager has therefore flushed the transaction to the master's local disk for storage.
How the Replication Manager knows whether the acknowledgements it has received is determined by the acknowledgement policy you have set for your applicaton. See Identifying Permanent Message Policies for more information.
EventHandler.handleRepSiteAddedEvent()
A new Replication Manager site has joined the replication group.
EventHandler.handleRepSiteRemovedEvent()
An existing Replication Manager site has been removed from the replication group.
EventHandler.handleRepStartupDoneEvent()
The replica has completed startup synchronization and is now processing log records received from the master.
For an example of how to use this callback, see Determining State


 Many regions have there own take on how the broth should be flavored. As such our verison s a combonation of beef and pork bones that create the base of the soup.
Char sui ramen is a very famous pork broth that is brought together with a famour way pork is cooked called char sui. This dish is full of rich and fragrent flavor that is amazing.


emcmass package¶
Submodules¶
emcmass.emcmass module¶
-
emcmass.emcmass.
MCMC
(variables, limits, obs, obs_err, model='mist', nwalkers=100, nsteps=1000, percentiles=[16, 50, 84], return_chain=False, **kwargs)¶ Main MCMC function
Parameters: - parameters (list) – list of model parameters to interpolate in between
- variables (list) – list of observable variables to be used in the likelihood function
- limits (list of tuples) – list of limits on the model parameters. Each limit is one tuple containing (min, max)
- obs (np.array) – array of the observed values for the variables
- obs_err (np.array) – array of the errors on the observations
- model (str) – name of the stellar evolution models
- nwalkers (int) – number of walkers to use (at least twice as many as parameters)
- nsteps (int) – number of steps each walker will take
- percentiles (list) – the percentiles used to calculate the final values and uncertainties used as argument for np.percentile()
- return_chain (bool) – if true, the whole Markov chain is returned, otherwise on the values and errors (lower and upper) for the parameters
Returns: array (#parameters, #walkers * #steps) – all samples taken by each walker.
-
emcmass.emcmass.
lnlike
(theta, y, yerr, **kwargs)¶ log likelihood function
There is no need to check for limits in the likelihood function because this is already done in the prior function
This function uses
models.interpolate()
to obtain the synthetic values for the given parameters theta. The logarithm of the likelihood is calculated as:with:
Parameters: - theta (list) – list of model parameters (normaly mass, fe/h and age)
- y (array) – 1D array of observables
- yerr (array) – 1D array containing errors on every observable
Returns: logarithm of the likelihood of the model parameters (theta) given the observables (y) with errors (yerr)
Return type: float
-
emcmass.emcmass.
lnprior
(theta, limits, **kwargs)¶ Simple uniform (flat) prior on all three parameters if they are within their range
if all parameters are within the provided limits, the the returned log probability is 0, otherwise it is -inf.
Parameters: - theta (list) – list of model parameters
- limits (list of tuples) – limits on the model parameters
Returns: logarithm of the probability of the parameters (theta) given the model limits
Return type: float
-
emcmass.emcmass.
lnprob
(theta, y, yerr, limits, **kwargs)¶ full log probability function combining the prior and the likelihood
will return -inf if any of
lnprior()
orlnlikelyhood()
is infite, otherwise it will return the sum of both functions.Parameters: - theta (list) – list of model parameters (normaly mass, fe/h and age)
- y (array) – 1D array of observables
- yerr (array) – 1D array containing errors on every observable
- limits (list of tuples) – limits on the model parameters
Returns: the sum of the log prior and log likelihood
Return type: float
emcmass.interpol module¶
-
emcmass.interpol.
create_pixeltypegrid
(grid_pars, grid_data)¶ Creates pixelgrid and arrays of axis values.
- Starting from:
- grid_pars: 2D numpy array, 1 column per parameter, unlimited number of cols
- grid_data: 2D numpy array, 1 column per variable, data corresponding to the rows in grid_pars
example: interpolation in a 3D grid containing stellar evolution models. Say we have as input parameters mass, age and metalicity, and want to obtain teff and logg as variables.
- grid_pars =
mass age Fe/H 1.0 1.0 -0.5 2.0 1.0 -0.5 1.0 2.0 -0.5 2.0 2.0 -0.5 1.0 1.0 0.0 2.0 1.0 0.0 … … … - grid_data =
teff logg 5000 4.45 6000 4.48 … …
The resulting grid will be rectangular and complete. This means that every combination of unique values in grid_pars should exist. If this is not the case, a +inf value will be inserted in grid_data at all locations that are missing!
Parameters: - grid_pars (array) – Npar x Ngrid array of parameters
- grid_data (array) – Ndata x Ngrid array of data
Returns: axis values and pixelgrid
Return type: array, array
-
emcmass.interpol.
interpolate
(p, axis_values, pixelgrid)¶ Interpolates in a grid prepared by create_pixeltypegrid().
p is an array of parameter arrays each collumn contains the value for the corresponding parameter in grid_pars each row contains a set of model parameters for wich the interpolated values in grid_data are requested.
example: continue with stellar evolution models used in create_pixeltypegrid
- p =
mass age Fe/H 1.21 1.3 0.24 1.57 2.4 -0.15 … … …
>>> p = np.array([[1.21, 1.3, 0.24], [1.57, 2.4, -0.15]]) >>> interpolate(p, axis_values, pixelgrid) >>> some output
Parameters: - p (array) – Npar x Ninterpolate array containing the points which to interpolate in axis_values
- axis_values (array) – output from create_pixeltypegrid
- pixelgrid (array) – output from create_pixeltypegrid
Returns: Ndata x Ninterpolate array containing the interpolated values in pixelgrid
Return type: array
emcmass.models module¶
-
emcmass.models.
get_files
(evolution_model)¶ Returns list of files belonging to the requested evolution models together with a list of the metalicity of each file
- curently recognized models are:
- mist: MESA Isochrones & Stellar tracks with v/vcrit = 0.0
- yapsi: Yale Potsdam Stellar Isochrones
-
emcmass.models.
get_isochrone
(feh, age, **kwargs)¶ returns an isochrone for the requested metalicity and age The mass points of the track are the gridpoints included in the evolution grid
-
emcmass.models.
get_track
(mass, feh, **kwargs)¶ Returns an evolution track for a given mass and metalicity. The age points of the track are the gridpoints included in the evolution grid
-
emcmass.models.
interpolate
(mass, feh, age, **kwargs)¶ Returns the requested values from the stellar evolution grids at the given values for the input parameters (mass, feh, age)
-
emcmass.models.
prepare_grid
(evolution_model='mist', variables=['log_L', 'log_Teff', 'log_g', 'M_H'], set_default=False, **kwargs)¶ Prepares the stellar evolution models by creating a pixelgrid to be used in interpolate This method will read the stellar evolution models from file, select only the columns you want to interpolate over (given in parameter_names), and will return axis_values, pixelgrid to be used in interpolate.
You can also provide limits on the size of the grid in mass, feh and age by setting the mass_lim, feh_lim and age_lim keywords


Many Schools in Pakistan Are Closed because of the Dirty Air
The administration of Lahore, Pakistan's largest city, has closed all schools today because of poor air quality. This was reported by the Express Tribune, TASS reported.
Air pollution exceeding the limit of almost seven times is registered in some metropolitan areas with a population of over 11 million people. Due to the deteriorating environmental situation, authorities urged residents of the city not to go outside without protective masks.
The major cause of the worsening air quality in Lahore is the smog coming from the Indian border states of Punjab and Haryana. Despite the bans, the local villagers continue to burn the crop residue in order to prepare the fields in time for the next sowing season.


yourself and went where you wanted; but when you are old you will stretch out your hands, and someone else will dress you and lead you where you do not want to go.” 19 Jesus said this to indicate the kind of death by which Peter would glorify God. Then he said to him, “Follow me!”
John 21:1-19
Reflect and Respond
I hesitate to tell strangers what I do for a living. People traditionally clam up when I tell them I’m a pastor. Something about standing next to a representative of God makes them think of all the things they’ve done wrong or all the Sundays they’ve slept in instead of going to church.
I thought I was the only one who was hesitant to tell people what I did for a living. Then I met my husband, Jim. When we first started dating, he had been a math professor for several years. When Jim would tell people that he taught math, their response was almost inevitably negative: “I hated math in school!” It wasn’t exactly a great conversation starter. We were quite the life of the party— the preacher and the math professor!
The mere mention of Jim’s profession caused most people to reflect on how inadequate they felt the last time they sat in math class struggling over an algebra problem or stood at the chalkboard fearing the ridicule of their classmates as they tried to solve a differential equation. Math brought back bad memories for people.
Honestly, we both learned not to take it personally when people scowled within minutes of meeting us. In a way, the reasons behind the reactions people had to our professions weren’t that different. The negative experiences of the past still left a bad impression in their minds that caused a shudder at just the mention of God or church or arithmetic.

When Jesus took away Simon’s old name and gave him a new one, it wasn’t so much an act of subtraction. Jesus’ renaming of Simon was more an exercise in addition. While some other individuals whose names changed lost their old names for good (Abraham, for example, was never called Abram again once God gave him a new name), you may have noticed that Simon Peter kept his old name throughout much of his story.
We’ve already noticed that, though he is referred to as Peter often in Scripture, there were times Jesus called him out on his pre-conversion behavior by calling him by his old name. There were even more times, though, when he was referred


Fire destroys senior apartment complex under construction in Peekskill
by Candace McCowanPEEKSKILL, Westchester County (WABC) -- Flames tore through an apartment complex in Westchester County.
The four-story building was under construction when the fire broke out Sunday night in Peekskill.
Firefighters battled the fire for more than eight hours off of Crompound Road.
Firefighters used their ladder trucks to put water on the building early Monday morning.
The Assistant fire chief says the building was completely engulfed in flames when they responded just after 10 p.m.
They had trouble initially getting water on the building as there were no nearby hydrants, so they called in tanker trucks.
But, the building was already gone. It took less than an hour before it burned to the ground.
"This is one of the worst fires I've seen in Peekskill in five or six years," said Assistant Chief Mike Sniffen," Peekskill Fire Department. "Yorktown came with tankers; we had departments from all over. We've got Ossining covering houses. On location, we had at least 150 firefighters."
It was set to be a senior living complex with 52 units under construction.
The building was made of mostly wood, sending embers flying around, leaving neighbors nearby fearful that it might spread.
Fortunately, there were no injuries.
The cause of the fire is under investigation.