Knowledge practices in design: The role of visual representations as "epistemic objects"
Authors
Boris Ewenstein, Jennifer Whyte
Year
Notes
Tags
visual representations, boundary objects
Relevance
Quotations
Boundary Objects
Concepts
Field of Study
Methodology
References


Your Results
Brain health is important to your quality of life
The Results
Brain health is a complex phenomenon that is affected by many factors. Although there is no single factor that determines the state of your brain health, the graph on the right shows your overall performance in 3 important health dimensions that may be contributing to your brain health. Taking account of all of your responses across these health dimensions the graph on the left reports our model's prediction of your overall dementia risk category.
Disclaimer
This test serves to provide you with a fast and free understanding of your current brain health. However, the results should be used for informational purposes only and do not qualify as a medical diagnosis. If the results indicate that your brain health may be outside the appropriate range, we recommend that you seek further detailed medical assessment.


Reference
public struct Reference
A reference to a span in a Trace with a relationship context called a ReferenceType
.
Abstractly it is an edge of the graph (Trace) when used to reference a node (span) from another node (span).
-
Declaration
Swift
public enum ReferenceType : String
-
The relationship to the span.
Declaration
Swift
public let refType: Reference.ReferenceType


Try out our Premium Member services: Virtual Legal Assistant, Query Alert Service and an ad-free experience. Free for one month and pay only if you like it.
-1- IN THE HIGH COURT OF KARNATAKA AT BENGALURU DATED THIS THE 22ND DAY OF AUGUST, 2019 PRESENT THE HON'BLE MR.ABHAY S. OKA, CHIEF JUSTICE AND THE HON'BLE MR.JUSTICE MOHAMMAD NAWAZ WRIT PETITION NO.12688 OF 2019 (GM-POL) BETWEEN: ITTINA AKKALA APARTMENT OWNER'S ASSOCIATION ITTINA AKKALA APARTMENTS SY NO.174/1B, 174/3, 176/1 AND 176/4, OF HOODI VILLAGE K.R. PURAM HOBLI BENGALURU EAST TALUK BENGALURU-560082 REPRESENTED BY ITS PRESIDENT SRI SUNDARAM CHANDRASHEKHARAN S/O LATE N. SUNDARAM AGED ABOUT 62 YEARS ... PETITIONER (BY SHRI ANIL KUMAR J.M., ADVOCATE) AND: 1. THE STATE OF KARNATAKA REPRESENTED BY ITS SECRETARY (ECOLOGY AND ENVIRONMENT) FOREST ECOLOGY AND ENVIRONMENT DEPARTMENT 7TH FLOOR, M.S.BUILDING BANGALORE-560001 -2- 2. THE KARNATAKA STATE POLLUTION CONTROL BOARD PARISARA BHAVANA, 1ST TO 4TH FLOOR, BENGALURU-560001 REPRESENTED BY ITS MEMBER SECRETARY 3. BANGALORE WATER SUPPLY AND SEWERAGE BOARD 2ND FLOOR, CAUVERY BHAVAN, K.G.ROAD, BANGALORE-560009 REPRESENTED BY ITS CHIEF ADMINISTRATIVE OFFICER AND SECRETARY 4. M/S ITTINA PROPERTIES PRIVATE LIMITED A COMPANY INCORPORATED UNDER THE PROVISIONS OF COMPANIES ACT 3RD BLOCK, KORAMANGALA BENGALURU-560034 REPRESENTED BY ITS MANAGING DIRECTOR. ... RESPONDENTS (BY SHRI P.B. ACHAPPA, AGA FOR R1, SHRI D. NAGARAJ, ADVOCATE FOR R2, R3 - SERVED & SMT. PRIYA, ADVOCATE FOR SHRI T. SURYANARAYANA, ADVOCATE FOR R4) --- THIS WRIT PETITION IS FILED UNDER ARTICLES 226 & 227 OF THE CONSTITUTION OF INDIA, PRAYING TO QUASH THE IMPUGNED REFUSAL ORDER DATED 24.05.2018 PASSED BY THE R-2 VIDE ANNEXURE-P TO THE W.P. AND ETC. THIS PETITION COMING ON FOR PRELIMINARY HEARING THIS DAY, CHIEF JUSTICE MADE THE FOLLOWING: -3- ORDER
Against the impugned order passed under clause (b) of Section 25(4) and Section 27 of the Water (Prevention and Control of Pollution) Act, 1974 (for short 'the said Act'), a substantive remedy of appeal has been provided under Section 28 of the said Act.
2. In view of availability of the efficacious remedy of appeal, we decline to entertain this petition under Article 226 of the Constitution of India. Accordingly, the petition is disposed of by granting liberty to the petitioner to adopt the remedy.
The Appellate Authority is bound to note that this writ petition was filed in this Court on 18th March 2019 and that the same remained pending till today.
All contentions raised in this petition are kept open.
Sd/-
CHIEF JUSTICE Sd/-
JUDGE AHB


Until now we've been running with Varnish on a high port, for testing purposes. You should test your application and if it works OK we can switch, so Varnish will be running on port 80 and your web server on a high port.
First we kill off varnishd:
# pkill varnishd
and stop your web server. Edit the configuration for your web server and make it bind to port 8080 instead of 80. Now open the Varnish default.vcl and change the port of the default backend to 8080.
Start up your web server and then start varnish:
# varnishd -f /usr/local/etc/varnish/default.vcl -s malloc,1G -T <IP_ADDRESS>:2000
Note that we've removed the -a option. Now Varnish, as its default setting dictates, will bind to the http port (80). Now everyone accessing your site will be accessing through Varnish.


Version: ${appVersion}
This app uses the MobiledgeX Matching Engine SDK to find and display on a map all of the Cloudlets running the backend app that provides the speed test and computer vision services needed by this app. It uses the following information for the SDK API calls:
| appName | MobiledgeX SDK Demo |
| devName | MobiledgeX |
| appVer | 2.0 |
The Operator name and Region selection values can be changed in the General Settings of the app.
To learn more about the MobiledgeX SDK, see developers.mobiledgex.com for documentation and a Getting Started guide.
Source code for this app is available on Github.


{{userData.firstname}} {{userData.lastname}},
Welcome to Bayelsa State Schoolarship Board
Your Application ID is : {{userData.applicant_id}}
Manage your schoolarship applications by completing the list of form links in the left navigation pane.
You MUST complete these application in the order in which they have been listed.
You cannot go to the next section if you have not completed the section prior to it. Watch the progress bar below to see how much of the application form your have completed


“The process of being mentally stimulated to do or feel something, especially to do something creative”.
This is the standard definition of inspiration.  For those who want to feel inspired, the key is to learn how to create an inspired state when we need to. Inspiration comes during those moments when we see true human excellence. It’s an emotional experience that comes when we encounter extraordinary ability or competence in some activity, which motivates us to be better ourselves.
Staying Inspired everyday is vital if you are pursuing something. It can be a career, sports, school, or even anything simple you might be pursuing. The problem is, staying inspired every single day isn't easy.
Learn how you can stay inspired everyday!
"A reason or reasons for acting or behaving in a particular way."
This is the standard definition of motivation. Let me start by saying Inspiration and Motivation are not the same thing. Motivation is something which builds your mindset, it gathers your senses and pulls you up from laziness and inactivity to do something, to achieve something, to build something. It is a force which wakes up your sleeping mind to get going. It doesn't let you sleep until you have achieved your dream. It is a first step which helps you in achieving great success. When you are motivated you are restless, energized.
Inspiration is like an idea. An idea which tells your mind to be creative. It is a like a path which you want to follow but in your own way. You dream about that idea. Here it is all going inside your mind. An inspired mind doesn't do anything but is still. But that mind is creative.
In short, inspiration is a seed and motivation is water. You can sow many seeds but you need water to let them grow.
PS: Thank you Gaurav Chauhan from Quora for this perfect explaination.
Learn how to stay motivated everday!
Discipline is the suppression of base desires, and is usually understood to be synonymous with restraint and self-control.
Self-Discipline is the ability to control one's feelings and overcome one's weaknesses; the ability to pursue what one thinks is right despite temptations to abandon it.
Jim Rohn once said, “Motivation is what gets you started. Habit is what keeps you going”.
Why did I list two definitions? Because I want you to know the standard definition of both diciplines. We're focusing on YOU, so I want you to know what self-discipline means, as it relates to you. Self-disicipline is what you need. I believe inspiration comes first, ideas form in your mind, then motivation comes next, you see something that relates to what you are thinking about, that may motivate you, that is great but its missing one important thing. Discipline.
Let me use an example from Sam Thomas Davies.
"You have a goal. You want to lose 14 pounds, run a marathon or write a non-fiction book, but in order to achieve your goal, you need motivation, without it, you cannot start. But motivation is not reliable; it ebbs and flows depending on your emotional state and if you’re “not in the mood”, you can let yourself off the hook.
This is why discipline is important, even if you're sick, not feeling like doing what you need to do, not in the mood, you need to be disciplined enough to get past all those excuses and do what you need to do.
Learn how to become disciplined


This is an example of how the documentation pages would work.
You can include an atomic component like so:

And it will render both the HTML markup and the code to produce it, taken straight from the components/button.html source.
<button class="btn">Click</button>
N.B. Use the JS function
component
without the final argument true to add components to real pages (true adds the component a second time as markup)
To add additional information, pass parameters to the component call:

This would render:
<button class="btn btn-warning">Help</button>
More complex components (molecules) which combine atoms, will be pre-rendered from passed-through atoms
array. The atoms can be an array of simple objects with "component-name": "options-object"
.

Alternatively, the atoms array can be an object with a "component"
key and an "options"
key. This can be useful if you need to pass through several different types of component:

Both these examples would render the same code:

<button class="btn">Back</button>
<button class="btn btn-warning">Help </button>
<button class="btn">Next</button>


Customer support
问题描述 :
Customer support department in an "Incomprehension Amateurs, Ltd" software company has call center for answering users’ questions. Support prices are as follows:
| 1. | Answer to a question | 10 USD |
| 2. | Correct answer to a question | 20 USD |
| 3. | Correct answer to a question with explanation | 40 USD |
| 4. | Correct answer to a question which was already correctly answered before | +10 USD for each previous correct answerD |
So, for example, if user asks the same question three times, first receives incorrect answer, then correct one, and the third time correct answer with explanation, it will cost him 10 + 20 + (40 + 1 * 10) = 80 USD.
Customers are billed monthly according to call log. Company engineers review the log and for each question determine:
1. unique number, so the equivalent questions have same numbers,
2. whether the answer was correct,
3. whether the answer was short or included detailed enough explanation.
Given that data, your program must calculate the payment amount.
输入:
Input file contains number of calls N followed by N triples qi ai xi, where qi is integer question number, ai = 1 if the answer was correct, 0 otherwise, xi = 1 if explanation was given, 0 otherwise.
Constraints
1 ≤ N ≤ 10000, 1 ≤ qi ≤ 106.
输出:
Output file must contain a single number — payment amount.
样例输入:
Sample Input 1 1 9834 0 1 Sample Input 2 3 33 1 0 33 0 0 33 1 1
样例输出:
Sample Output 1 10 Sample Output 2 80
温馨提示:
解题代码:
//* @author: Yeming<EMAIL_ADDRESS>import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); Call[] calls = new Call[n]; for(int i = 0; i < n; i++) { int q = sc.nextInt(); int a = sc.nextInt(); int x = sc.nextInt(); calls[i] = new Call(q,a,x); } Arrays.sort(calls); int preQ = 0; int num = 0; int amount = 0; for(int i = 0; i < n; i++) { if(calls[i].q != preQ) { preQ = calls[i].q; num = 0; } if(calls[i].a == 1) { if(calls[i].x == 1) { amount += 40; }else { amount += 20; } amount += 10 * num; num++; }else { amount += 10; } } System.out.println(amount); } } class Call implements Comparable< Call> { int q; int a; int x; Call(int q, int a, int x) { this.q = q; this.a = a; this.x = x; } public int compareTo(Call other) { if(this.q < other.q) { return -1; }else if(this.q == other.q) { return 0; }else { return 1; } } }
顶一个 赞一个
真心不错，力顶作者
int half(int *array,int len,int key)
{
int l=0,r=len;
while(l<r)
{
int m=(l+r)>>1;
if(key>array )l=m+1;
else if(key<array )r=m;
else return m;
}
return -1;
}
这种就能避免一些Bug
l,m,r
左边是l,m;右边就是m+1,r;
第二种解法如果数组有重复元素 就不正确
为什么暴力求解方法循环到sqrt(n) 就可以了呢
可以参考算法导论中的时间戳。就是结束访问时间，最后结束的顶点肯定是入度为0的顶点，因为DFS要回溯
什么破题，题意好难懂啊
较好的写法是 start+(end-start)/2
很给力啊，学习了
隐藏最深的bug是(start+end)/2有可能上溢
代码不错，赞一个！
不错的网站，建议添加些比赛信息
这种二分还是比较经典！mark


Review: Logitech Pebble M350 may be one of the quietest mice money can buy
by Christian ZibregWe’re always interested in testing new input devices, especially computer mice, even more so if you take into account Apple’s widely reported keyboard woes and the fact that customers are now free to connect a mouse to their iPhone or iPad. That’s why we thought we’d take a closer look at Logitech’s Pebble M350 mouse in a new YouTube video by iDownloadBlog’s Harris Craycraft, who wonders whether it could file as the quietest portable mouse on the market.
As a matter of fact, you wouldn’t be wrong if you said that the biggest feature of this portable mouse is its quietness, which takes away from that sharp clicking sound of a regular mouse in favor of a more muted click that’s about the loudness of Apple’s trackpad, maybe even quieter than that. But that’s not the only cool feature that this particular mouse brings to the table so best thing you watch Harris’s video embedded that I’ve embedded right ahead.
Subscribe to iDownloadBlog on YouTube
With iPadOS and iOS 13, Apple has enabled customers to connect a wireless or wired mouse to their iOS device, but that’s more of an accessibility feature than a true productivity boost.
See how you can use a mouse with your iOS device in the hand-on video below.
What do you think about the Logitech mouse reviewed in the video?
Share your opinion with fellow readers in the commenting section down below.


This privacy policy sets out how CoinMiningCompare.com uses and protects any information that you give CoinMiningCompare.com when you use this website.
CoinMiningCompare.com is committed to ensuring that your privacy is protected. Should we ask you to provide certain information by which you can be identified when using this website, then you can be assured that it will only be used in accordance with this privacy statement.
CoinMiningCompare.com may change this policy from time to time by updating this page. You should check this page from time to time to ensure that you are happy with any changes. This policy is effective from 01/03/2018.
How we use cookies
A cookie is a small file which asks permission to be placed on your computer's hard drive. Once you agree, the file is added and the cookie helps analyse web traffic or lets you know when you visit a particular site. Cookies allow web applications to respond to you as an individual. The web application can tailor its operations to your needs, likes and dislikes by gathering and remembering information about your preferences.
We use traffic log cookies to identify which pages are being used. This helps us analyse data about web page traffic and improve our website in order to tailor it to customer needs. We only use this information for statistical analysis purposes and then the data is removed from the system.
Overall, cookies help us provide you with a better website, by enabling us to monitor which pages you find useful and which you do not. A cookie in no way gives us access to your computer or any information about you, other than the data you choose to share with us.
You can choose to accept or decline cookies. Most web browsers automatically accept cookies, but you can usually modify your browser setting to decline cookies if you prefer. This may prevent you from taking full advantage of the website.
Links to other websites
Our website may contain links to other websites of interest. However, once you have used these links to leave our site, you should note that we do not have any control over that other website. Therefore, we cannot be responsible for the protection and privacy of any information which you provide whilst visiting such sites and such sites are not governed by this privacy statement. You should exercise caution and look at the privacy statement applicable to the website in question.
Controlling your personal information
You may choose to restrict the collection or use of your personal information in the following ways:
whenever you are asked to fill in a form on the website, look for the box that you can click to indicate that you do not want the information to be used by anybody for direct marketing purposes if you have previously agreed to us using your personal information for direct marketing purposes, you may change your mind at any time by writing to or emailing us at<EMAIL_ADDRESS>We will not sell, distribute or lease your personal information to third parties unless we have your permission or are required by law to do so. We may use your personal information to send you promotional information about third parties which we think you may find interesting if you tell us that you wish this to happen.
You may request details of personal information which we hold about you under the Data Protection Act 1998. A small fee will be payable. If you would like a copy of the information held on you please write to<EMAIL_ADDRESS>If you believe that any information we are holding on you is incorrect or incomplete, please write to or email us as soon as possible, at the above address. We will promptly correct any information found to be incorrect.
With your consent, we may collect information about the specific location of your mobile device (for example, by using GPS or Bluetooth). You can revoke this consent at any time by changing the preferences on your device, but doing so may affect your ability to use all of the features and functionality of our Services.
We may offer social sharing features or other integrated tools that let you share content or actions you take on our Services with other media. Your use of these features enables the sharing of certain information with your friends or the public, depending on the settings you establish with the third party that provides the social sharing feature. For more information about the purpose and scope of data collection and processing in connection with social sharing features, please visit the privacy policies of the third parties that provide these social sharing features.
You may opt out of receiving promotional communications from us by following the instructions in those communications. If you opt out, we may still send you non-promotional communications, such as information about your account or your use of our Services.
We are based in the New Zealand and the information we collect is governed by UK law. By accessing or using the Services or otherwise providing information to us, you consent to the processing, transfer and storage of information in and to the UK and other countries, where you may not have the same rights as you do under local law.
We may change this Privacy Policy from time to time. If we do, we will let you know by revising the date at the top of the policy. If we make a change to this policy that, in our sole discretion, is material, we will provide you with additional notice. We encourage you to review the Privacy Policy whenever you access or use our Services or otherwise interact with us to stay informed about our information practices and the ways you can help protect your privacy. If you continue to use our Services after Privacy Policy changes go into effect, you consent to the revised policy.


Equivalent to clicking the Solver command on the Tools menu and clicking the Reset All button in the Solver Parameters dialog box. Erases all cell selections and constraints from the Solver Parameters dialog box and restores all the settings in the Solver Options dialog box to their defaults.
If this function is not available, you must install the Solver add-in.
Syntax
SOLVER.RESET( )
Return to index


This is a static site that I, ry0id (on GitHub), have been working on over the past few days.
We're open-source on GitHub! You can find the repository here.
There currently aren't any special events/holidays. Check back later?


| none | C. Zangl |
| Internet-Draft | May 23, 2016 |
| Intended status: Standards Track | |
| Expires: November 24, 2016 |
The Human JSON (Hjson) Configuration Format
hjson-draft
Human JSON (Hjson) is a configuration file format based on the JavaScript Object Notation [RFC7159]. Its focus is to provide a reasonable alternative to plain JSON configs that are hard to edit and do not allow comments.
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."
This Internet-Draft will expire on November 24, 2016.
Copyright (c) 2016 IETF Trust and the persons identified as the document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
This document may contain material from IETF Documents or IETF Contributions published or made publicly available before November 10, 2008. The person(s) controlling the copyright in some of this material may not have granted the IETF Trust the right to allow modifications of such material outside the IETF Standards Process. Without obtaining an adequate license from the person(s) controlling the copyright in such materials, this document may not be modified outside the IETF Standards Process, and derivative works of it may not be created outside the IETF Standards Process, except to format it for publication as an RFC or to translate it into languages other than English.
Human JSON (Hjson) is a configuration file format. It is a superset of the JavaScript Object Notation [RFC7159].
Hjson uses the same four primitive types (strings, numbers, booleans, and null) and two structured types (objects and arrays) as JSON.
A string is a sequence of zero or more Unicode characters [UNICODE]. Note that this citation references the latest version of Unicode rather than a specific release. It is not expected that future changes in the UNICODE specification will impact the syntax of Hjson.
An object is an unordered collection of zero or more name/value pairs, where a name is a string and a value is a string, number, boolean, null, object, or array.
An array is an ordered sequence of zero or more values.
The terms “object” and “array” come from the conventions of JavaScript.
Hjson’s design goals were
Hjson SHOULD be used for data whose primary purpose is to be viewed or edited by a human. For example configuration, resource files or debug data dumps.
Hjson SHOULD NOT be used in other cases, like transfer protocols.
Hjson is a superset of JSON. Its syntax allows you to
Because the punctuator characters {}[],: are used to define the structure of the Hjson text, you need to use quotes
For examples see Section 14.1.
The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in [RFC2119].
The grammatical rules in this document are to be interpreted as described in [RFC5234] except where they are specifically marked as [SABNF].
SABNF is used to express grammars that are not possible in ABNF, like the block-comment, and to define terminators, like ql-end, that allow us to exclude certain sequences. These constructs allow us to generate parsers and to verify the grammar against test cases. For the general understanding of the language they can be ignored.
This document describes Hjson and registers the media type “application/hjson”.
A Hjson text is a sequence of tokens. The set of tokens includes seven structural characters, comments, strings, numbers, and three literal names.
A Hjson text is either a serialized value or a root object.
Hjson-text = ws-c ( root-object / value ) ws-c
These are the seven structural characters:
begin-array = %x5B ; [ left square bracket begin-object = %x7B ; { left curly bracket end-array = %x5D ; ] right square bracket end-object = %x7D ; } right curly bracket name-separator = %x3A ; : colon comma-separator = %x2C ; , comma lf-separator = lf ; Line feed or New line
Insignificant whitespace and comments are allowed before or after any of the first six structural characters.
ws-c = *( comment / ws ) ws = *( space / tab / lf / cr ) space = %x20 ; Space tab = %x09 ; Horizontal tab lf = %x0A ; Line feed or New line cr = %x0D ; Carriage return
Comments can be specified as line or block comments.
comment = line-comment / block-comment line-comment = ( %x23 / ; # hash %x2F.2F ) ; // slash + slash *( tab / cr / %x20-10FFFF ) ; until lf block-comment = start-block-comment *( !end-block-comment anychar ) end-block-comment start-block-comment = %x2F.2A ; /* slash + star end-block-comment = %x2A.2F ; */ star + slash anychar = tab / cr / lf / %x20-10FFFF ; SABNF: block-comment requies the use of the ; ! operator to allow * and / in the text ; while stopping at */
A Hjson value MUST be an object, array, number, or string, or one of the following three literal names:
false = %x66.61.6C.73.65 ; false null = %x6E.75.6C.6C ; null true = %x<IP_ADDRESS> ; true
The literal names MUST be lowercase. No other literal names are allowed.
value = literal / object / array / number / string literal = ( false / null / true ) !literal-end literal-end = *( space / tab ) ( %x21-22 / %x24-2B / %x2D-2E / %x30-5A / %x5C / %x5E-7A / %x7C / %x7E-10FFFF ) ; exclude #/,[]{} ; SABNF: define literal-end to prevent matches ; that are actually a ql-string ; (like "true blue")
Values can be separated directly by a comma or indirectly by one or more linefeeds.
value-separator = ( ws-c comma-separator ws-c ) / ( *( comment / *(space / tab / cr) ) lf-separator ws-c )
Note that while Hjson allows the use of lf as a separator, the cr character is generally ignored. This should not be an issue as all modern operating systems use either lf or cr+lf as their line terminator.
An object structure is represented as a pair of curly brackets surrounding zero or more name/value pairs (or members). A single colon comes after each name, separating the name from the value. A comma separates a value from the next name unless the value is followed by a linefeed, in which case the comma is optional. Trailing separators are allowed. The names within an object SHOULD be unique.
object = begin-object ws-c [ member *( value-separator member ) [value-separator] ] ws-c end-object member = name ws-c name-separator ws-c value
If the Hjson text defines an object it does not have to include the braces at the root level:
root-object = member *( value-separator member ) [value-separator]
A name can be specified as a JSON string (with quotes) or as a name without quotes.
name = json-string / keyname keyname = 1*non-punctuator-char non-punctuator-char = %x21-2B / %x2D-39 / %x3B-5A / %x5C / %x5E-7A / %x7C / %x7E-10FFFF ; any non-punctuator character (excludes ,:[]{} and ws)
For interoperability issues regarding the uniquness of names and object member ordering, see [RFC7159] Section 4.
An array structure is represented as square brackets surrounding zero or more values (or elements). Elements are separated by commas or linefeeds. Trailing commas are allowed.
array = begin-array ws-c [ value *( value-separator value ) [value-separator ] ] ws-c end-array
There is no requirement that the values in an array be of the same type.
The representation of numbers is similar to that used in most programming languages. A number is represented in base 10 using decimal digits. It contains an integer component that may be prefixed with an optional minus sign, which may be followed by a fraction part and/or an exponent part. Leading zeros are not allowed.
A fraction part is a decimal point followed by one or more digits.
An exponent part begins with the letter E in upper or lower case, which may be followed by a plus or minus sign. The E and optional sign are followed by one or more digits.
Numeric values that cannot be represented in the grammar below (such as Infinity and NaN) are not permitted.
number = [ minus ] int [ frac ] [ exp ] !num-end decimal-point = %x2E ; . digit = %x30-39 ; 0-9 digit1-9 = %x31-39 ; 1-9 e = %x65 / %x45 ; e E exp = e [ minus / plus ] 1*digit frac = decimal-point 1*digit int = zero / ( digit1-9 *digit ) minus = %x2D ; - plus = %x2B ; + zero = %x30 ; 0 num-end = *( space / tab ) ( %x21-22 / %x24-2B / %x2D-2E / %x30-5A / %x5C / %x5E-7A / %x7C / %x7E-10FFFF ) ; exclude #/,[]{} ; SABNF: define num-end to prevent matches ; that are actually a ql-string ; (like "1 minute")
For limits on the range and precision of numbers see [RFC7159] Section 6.
Hjson allows strings to be represented in three different formats.
string = json-string / ml-string / ql-string
The representation of JSON strings is similar to conventions used in the C family of programming languages. A string begins and ends with quotation marks. All Unicode characters may be placed within the quotation marks, except for the characters that must be escaped: quotation mark, reverse solidus, and the control characters (U+0000 through U+001F).
Any character may be escaped. If the character is in the Basic Multilingual Plane (U+0000 through U+FFFF), then it may be represented as a six-character sequence: a reverse solidus, followed by the lowercase letter u, followed by four hexadecimal digits that encode the character’s code point. The hexadecimal letters A though F can be upper or lower case. So, for example, a string containing only a single reverse solidus character may be represented as “\u005C”.
Alternatively, there are two-character sequence escape representations of some popular characters. So, for example, a string containing only a single reverse solidus character may be represented more compactly as “\”.
To escape an extended character that is not in the Basic Multilingual Plane, the character is represented as a 12-character sequence, encoding the UTF-16 surrogate pair. So, for example, a string containing only the G clef character (U+1D11E) may be represented as “\uD834\uDD1E”.
json-string = quotation-mark *char quotation-mark char = unescaped / escape ( %x22 / ; " quotation mark U+0022 %x5C / ; \ reverse solidus U+005C %x2F / ; / solidus U+002F %x62 / ; b backspace U+0008 %x66 / ; f form feed U+000C %x6E / ; n line feed U+000A %x72 / ; r carriage return U+000D %x74 / ; t tab U+0009 %x75 4hexdig ) ; uXXXX U+XXXX hexdig = %x30-39 / "A" / "B" / "C" / "D" / "E" / "F" escape = %x5C ; \ quotation-mark = %x22 ; " unescaped = %x20-21 / %x23-5B / %x5D-10FFFF
Hjson allows strings to be represented only by their content without quotes. A quoteless string may contain any character except the control characters (U+0000 through U+001F), excluding trailing whitespace. It cannot start with a punctuator character (,:[]{}). It ends at the first linefeed. Strings are taken as is without escapes.
ql-string = non-punctuator-char *( !ql-end ql-char ) ql-end = *( space / tab / cr ) lf ql-char = space / tab / %x21-10FFFF ; SABNF: define ql-end to exclude trailing ; whitespace from the ql-string
A Hjson parser must still detect values (number, true, false or null) and parse them correctly. For example
Not allowing escapes inside the quoteless string allows you to specify HTML fragments, regular expressions or Windows style paths as-is, keeping them readable.
A multiline string begins and ends with three single quotes.
ml-string = ml-seq *( !ml-seq ( ml-char / ml-ignore ) ) ml-seq ml-seq = "'''" ml-char = space / tab / lf / %x21-10FFFF ml-ignore = cr ; SABNF: ml-string requies the use of the ; ! operator to allow ' in the text ; while stopping at '''
The carrige return character is generally ignored to make the parser platform independent.
Whitespace handling cannot be expressed in the ABNF grammar and is thus defined as:
Hjson text SHALL be encoded in UTF-8. Since Hjson parsers can read JSON they may be able to read texts in other encodings (such as UTF-16 and UTF-32). Hjson texts that are encoded in UTF-8 are interoperable in the sense that they will be read successfully by the maximum number of implementations.
Implementations MUST NOT add a byte order mark to the beginning of a Hjson text. In the interests of interoperability, implementations that parse Hjson texts MAY ignore the presence of a byte order mark rather than treating it as an error.
See [RFC7159] Section 8.2.
See [RFC7159] Section 8.3.
A Hjson parser transforms a Hjson text into another representation. A Hjson parser MUST accept all texts that conform to the Hjson grammar. A Hjson parser MAY accept non-Hjson forms or extensions.
An implementation may set limits on the size of texts that it accepts. An implementation may set limits on the maximum depth of nesting. An implementation may set limits on the range and precision of numbers. An implementation may set limits on the length and character contents of strings.
A Hjson generator produces Hjson text. The resulting text MUST strictly conform to the Hjson grammar.
The MIME media type for Hjson text is application/hjson.
Type name: application
Subtype name: hjson
Required parameters: n/a
Optional parameters: n/a
Encoding considerations: binary
Security considerations: See XXXX, Section 13.
Interoperability considerations: Described in XXXX
Published specification: XXXX
Applications that use this media type: Hjson has been used to provide configuration data for applications written in all of these programming languages: C#, Go, Java, JavaScript, PHP and Python
Additional information: Magic number(s): n/a File extension(s): .hjson Macintosh file type code(s): TEXT
Person & email address to contact for further information: IESG<EMAIL_ADDRESS>Intended usage: COMMON
Restrictions on usage: none
Author: Christian Zangl<EMAIL_ADDRESS>Change controller: IESG<EMAIL_ADDRESS>Note: No “charset” parameter is defined for this registration. Adding one really has no effect on compliant recipients.
Unlike JSON, Hjson is not a subset of Javascript and cannot be parsed using “eval()”.
This is a Hjson object:
# comments are useful # specify rate in requests/second rate: 1000 # you may also use // c style /* or block comments */ # key names do not need to be placed in # quotes unless they contain a punctuator # character {}[],: key: 1 # strings may also omit quotes if they do # not start with a punctuator text: look ma, no quotes! # quoteless strings do not use escapes # and end at the LF/newline # commas are optional commas: { one: 1 two: 2 } # trailing commas are allowed trailing: { one: 1, two: 2, } # multiline string haiku: ''' JSON I love you. But you strangle my expression. This is so much better. ''' # Hjson is a superset of JSON so you # may use any valid JSON syntax: favNumbers: [ 1, 2, 3, 6, 42 ]
Example of a document processor configuration, first in JSON:
{ "header": "The Foo Manual\nCopyright Bar Inc.", "source": { "include": [ "./src" ], "includePattern": ".+\\.foo(doc)?$", "excludePattern": "(^|\\/|\\\\)_" }, "templates": { "cleverLinks": false, "monospaceLinks": false } }
and in Hjson:
# define the header using a multiline string header: ''' The Foo Manual Copyright Bar Inc. ''' source: { # generate documentation for these paths include: [ ./src ] # include/exclude files # notice that no escapes are required includePattern: .+\.foo(doc)?$ excludePattern: (^|\/|\\)_ } templates: { # trailing commas are allowed cleverLinks: false, monospaceLinks: false, }
Example of a npm dependency configuration in JSON:
{ "dependencies": { "foo": "2.0.1", "bar": "*", "til": "~1.2.1", "elf": "^1.2.3" } }
and in Hjson:
{ dependencies: { // match version exactly foo: 2.0.1 // * matches any version bar: * // approximately, allows patch-level changes til: ~1.2.1 // compatible with major version elf: ^1.2.3 } }
This document is based on [RFC4627] and [RFC7159] which were written by Douglas Crockford and Tim Bray. This document was constructed by extending it with the elements of the Hjson syntax.
| [RFC2119] | Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997. |
| [RFC4627] | Crockford, D., "The application/json Media Type for JavaScript Object Notation (JSON)", RFC 4627, DOI 10.17487/RFC4627, July 2006. |
| [RFC5234] | Crocker, D. and P. Overell, "Augmented BNF for Syntax Specifications: ABNF", STD 68, RFC 5234, DOI 10.17487/RFC5234, January 2008. |
| [RFC7159] | Bray, T., "The JavaScript Object Notation (JSON) Data Interchange Format", RFC 7159, DOI 10.17487/RFC7159, March 2014. |
| [SABNF] | Thomas, L., "Superset Augmented Backus-Naur Form", version 2.2.1, n.d.. |
| [UNICODE] | The Unicode Consortium, "The Unicode Standard", n.d.. |


Text area editor
is a multi-line plain text edit control allowing the user to enter a text with unlimited number of characters.
Key properties:
- Row count
- Specifies the visible number of lines.
- Placeholder
- Specifies a short hint that describes the expected value.
Open Insert or Edit forms to see the editor in action.


At PyCon there was an open space about deployment, and the idea of drop-in applications (Java-WAR-style).
I generally get pessimistic about 80% solutions, and dropping in a WAR file feels like an 80% solution to me. I’ve used the Hudson/Jenkins installer (which I think is specifically a project that got WARs on people’s minds), and in a lot of ways that installer is nice, but it’s also kind of wonky, it makes configuration unclear, it’s not always clear when it installs or configures itself through the web, and when you have to do this at the system level, nor is it clear where it puts files and data, etc. So a great initial experience doesn’t feel like a great ongoing experience to me — and it doesn’t have to be that way. If those were necessary compromises, sure, but they aren’t. And because we don’t have WAR files, if we’re proposing to make something new, then we have every opportunity to make things better.
So the question then is what we’re trying to make. To me: we want applications that are easy to install, that are self-describing, self-configuring (or at least guide you through configuration), reliable with respect to their environment (not dependent on system tweaking), upgradable, and respectful of persistence (the data that outlives the application install). A lot of this can be done by the "container" (to use Java parlance; or "environment") — if you just have the app packaged in a nice way, the container (server environment, hosting service, etc) can handle all the system-specific things to make the application actually work.
At which point I am of course reminded of my Silver Lining project, which defines something very much like this. Silver Lining isn’t just an application format, and things aren’t fully extracted along these lines, but it’s pretty close and it addresses a lot of important issues in the lifecycle of an application. To be clear: Silver Lining is an application packaging format, a server configuration library, a cloud server management tool, a persistence management tool, and a tool to manage the application with respect to all these services over time. It is a bunch of things, maybe too many things, so it is not unreasonable to pick out a smaller subset to focus on. Maybe an easy place to start (and good for Silver Lining itself) would be to separate at least the application format (and tools to manage applications in that state, e.g., installing new libraries) from the tools that make use of such applications (deploy, etc).
Some opinions I have on this format, exemplified in Silver Lining:
- It’s not zipped or a single file, unlike WARs. Uploading zip files is not a great API. Geez. I know there’s this desire to "just drop in a file"; but there’s no getting around the fact that "dropping a file" becomes a deployment protocol and it’s an incredibly impoverished protocol. The format is also not subtly git-based (ala Heroku) because git push is not a good deployment protocol.
- But of course there isn’t really any deployment protocol inferred by a format anyway, so maybe I’m getting ahead of myself ;) I’m saying a tool that deploys should take as an argument a directory, not a single file. (If the tool then zips it up and uploads it, fine!)
- Configuration "comes from the outside". That is, an application requests services, and the container tells the application where those services are. For Silver Lining I’ve used environmental variables. I think this one point is really important — the container tells the application. As a counter-example, an application that comes with a Puppet deployment recipe is essentially telling the server how to arrange itself to suit the application. This will never be reliable or simple!
- The application indicates what "services" it wants; for instance, it may want to have access to a MySQL database. The container then provides this to the application. In practice this means installing the actual packages, but also creating a database and setting up permissions appropriately. The alternative is never having any dependencies, meaning you have to use SQLite databases or ad hoc structures, etc. But in fact installing databases really isn’t that hard these days.
- All persistence has to use a service of some kind. If you want to be able to write to files, you need to use a file service. This means the container is fully aware of everything the application is leaving behind. All the various paths an application should use are given in different environmental variables (many of which don’t need to be invented anew, e.g., $TMPDIR).
- It uses vendor libraries exclusively for Python libraries. That means the application bundles all the libraries it requires. Nothing ever gets installed at deploy-time. This is in contrast to using a requirements.txt list of packages at deployment time. If you want to use those tools for development that’s fine, just not for deployment.
- There is also a way to indicate other libraries you might require; e.g., you might lxml, or even something that isn’t quite a library, like git (if you are making a github clone). You can’t do those as vendor libraries (they include non-portable binaries). Currently in Silver Lining the application description can contain a list of Ubuntu package names to install. Of course that would have to be abstracted some.
- You can ask for scripts or a request to be invoked for an application after an installation or deployment. It’s lame to try to test if is-this-app-installed on every request, which is the frequent alternative. Also, it gives the application the chance to signal that the installation failed.
- It has a very simple (possibly/probably too simple) sense of configuration. You don’t have to use this if you make your app self-configuring (i.e., build in a web-accessible settings screen), but in practice it felt like some simple sense of configuration would be helpful.
Things that could be improved:
- There are some places where you might be encouraged to use routines from the silversupport package. There are very few! But maybe an alternative could be provided for these cases.
- A little convention-over-configuration is probably suitable for the bundled libraries; silver includes tools to manage things, but it gets a little twisty. When creating a new project I find myself creating several .pth files, special customizing modules, etc. Managing vendor libraries is also not obvious.
- Services are IMHO quite important and useful, but also need to be carefully specified.
- There’s a bunch of runtime expectations that aren’t part of the format, but in practice would be part of how the application is written. For instance, I make sure each app has its own temporary directory, and that it is cleared on update. If you keep session files in that location, and you expect the environment to clean up old sessions — well, either all environments should do that, or none should.
- The process model is not entirely clear. I tried to simply define one process model (unthreaded, multiple processes), but I’m not sure that’s suitable — most notably, multiple processes have a significant memory impact compared to threads. An application should at least be able to indicate what process models it accepts and prefers.
- Static files are all convention over configuration — you put static files under static/ and then they are available. So static/style.css would be at /style.css. I think this is generally good, but putting all static files under one URL path (e.g., /media/) can be good for other reasons as well. Maybe there should be conventions for both.
- Cron jobs are important. Though maybe they could just be yet another kind of service? Many extra features could be new services.
- Logging is also important; Silver Lining attempts to handle that somewhat, but it could be specified much better.
- Silver Lining also supports PHP, which seemed to cause a bit of stress. But just ignore that. It’s really easy to ignore.
There is a description of the configuration file for apps. The environmental variables are also notably part of the application’s expectations. The file layout is explained (together with a bunch of Silver Lining-specific concepts) in Development Patterns. Besides all that there is admittedly some other stuff that is only really specified in code; but in Silver Lining’s defense, specified in code is better than unspecified ;) App Engine provides another example of an application format, and would be worth using as a point of discussion or contrast (I did that myself when writing Silver Lining).
Discussing WSGI stuff with Ben Bangert at PyCon he noted that he didn’t really feel like the WSGI pieces needed that much more work, or at least that’s not where the interesting work was — the interesting work is in the tooling. An application format could provide a great basis for building this tooling. And I honestly think that the tooling has been held back more by divergent patterns of development than by the difficulty of writing the tools themselves; and a good, general application format could fix that.
Automatically generated list of related posts:
- Python Application Package I’ve been thinking some more about deployment of Python web...
- The Shrinking Python Web Framework World When I was writing the summary of differences between WebOb...
- The Web Server Benchmarking We Need Another WSGI web server benchmark was published. It’s a decent...
- A new way to deploy web applications Deployment is one of the things I like least about...
- 2 Python Environment Experiments two experiments in the Python environment. The first is virtualenv,...
I think it’s a good idea. While WAR may not be a great deployment container, many other features from Java web world are pretty good regarding packaging and APIs.
That’s probably the main target: make it possible to deploy a webapp to a standard container, independently of the framework/technology it uses. This would mean creating something like the Servlet API and/or other J2EE APIs.
WSGI is akin to the Servlet API, only better ;) I feel like the Python world flirted with copying J2EE and other Java stuff for a while, and it all turned out badly. But… inspiration in terms of scope would be fine ;)
Well… thinking about it: WSGI doesn’t cover everything, which is why this notion of multiple platforms makes sense. It’s not just that Python is a platform, but Python+WSGI would probably be the inaugural platform. Other server setups (primarily async systems that don’t use WSGI) would be new platforms — obviously sharing a large amount with Python+WSGI, but with some different details and different constraints on the containers (async being generally harder to support than sync-aka-WSGI, since one can be implemented in the other but not vice versa).
I’m definitely in favor of getting a better application package in Python, but I do wonder if the focus is on the wrong things. Honestly, tools like dpkg and rpm do a perfectly suitable job of handling the filesystem aspects. What seems more difficult is how do you specify how to run the actual application? How do you stop it? Does this work on Windows? What and how do you get status from an application? It seems like if these questions of how do you manage a deployed python application then you’d begin to see some really interesting things happen because the deployment question is answered.
I do think the Web Site Process Bus (http://www.cherrypy.org/wiki/WSPBSpec) is one tool that leans towards the idea of a standard means of distributing and deploying Python web apps. Also, in terms of packaging with dpkg/rpm, my point is not to suggest “just use dpkg”, but rather to suggest that the goal of having a directory to deploy to maps very well to a tarball + meta data for uninstalling. If folks don’t want to use rpm or dpkg, the models they both prescribe seem correct in what they specify a package do.
It would not be unreasonable to create a deb or rpm out of this format, and that could be part of a deployment process — but the format goes much further than deb or rpm. (Debian packaging policy does go into greater depth in particular domains, but AFAIK has not in the case of web apps.) Configuration in particular is not generally handled at the Linux package level, but is essential to this system (e.g., configuring a database to accept connections from the web application, with appropriate permissions).
There is a specification of how to run the application. Stopping and starting are implicitly left to the container. There’s no notification, but it would be reasonable to have such notifications — though the idea of “the app is going down” is too expansive IMHO — only “this process is coming to a halt”.
Windows is irrelevant in my opinion — it has ceased to be a serious deployment target, and supporting it only for purpose of development machines I don’t believe is worth the effort. But that’s just my opinion and the specification need not be particularly opinionated in this regard. But I think it would be counterproductive to try to create an abstraction above both Windows and Linux, it would be better to simply put the burden on Windows people to translate Linux concepts. Supporting Windows isn’t worth the drag on development.
It would be nice to have a declared way to ping an application for its “status” — maybe at the most minimal, noting that it is alive and responding, though it could also do other tests. The number of tests it does effects the reasonable frequency of pinging, so there’d have to be some thought, or maybe just two kinds of ping — alive and status, with two times.
Silver Lining does I think show that this covers most of the important aspects of deploying an application (with [a bunch of todo items too](http://cloudsilverlining.org/todo.html)). Development of tooling in parallel with the format would be essential, as in my experience there are many details that are best revealed through actual use.
I do agree that the package should have more info. I suppose my point is that just as setup.py/.cfg is a known file and /etc is for known configuration, a package can have the same specified paths. I think we are agreeing there ;)
I’m also perfectly fine avoiding Windows. I only bring it up because Python as a platform (typically) supports Windows, therefore I’d imagine some support would be desired. If you have no desire to make this concept blessed within the scope of Python as a language (again fine by me), then no Windows support is definitely preferred.
The reasoning behind the communicative aspects is that deployments range from pushing an app to a machine to configuring a deployment amongst hundreds (thousands?) of machines. The result being that often times you need more information other than just “are you up or not”. Likewise, if an application does fail, what do you do? You probably look to the logs, check things like disk I/O, network I/O, data stores. A load balancer might be able to switch traffic to other nodes. It would be nice to have a means of communicating with the environment to see if it can help you debug the problem where it happened. For example, running the application tests.
I’m not trying to say you should support all these details, but rather suggesting that without a known way of communicating to the deployed environment, these are all ad-hoc solutions. A simple API could make a lot of this less painful. Imagine if there was an assumption that when an app crashes on a server you should easily be able to tell the env to run a suite diagnostics and tests to see what external issues could be the problem. The word “assumption” is important here. In support channels there are assumptions such as “send me a stace trace” or “can you send me a screen shot”. These kind of assumptions for web applications have typically been limited, but there is no reason they have to be if you can convene on a system of communication.
Hopefully that idea make some sense and it doesn’t seem like I’m just rambling ;)
I personally don’t like putting stuff in
/etc
because it is a singleton on the system, and singletons are bad both generally and for a number of specific reasons in this case, like fast switchovers during updates (not taking a server down, updating, and then bringing it up, but doing a complete deployment and then pointing the server to the new instance). Anyway, an application should never look for config files anyway! Then it’s just a decision for the deployment tool.APIs to introspect the container are going to be tricky, as they often expose implementation details that should be abstracted from the application. Ideally when these use cases come up the pressure will be on the container to implement something, or to add tooling around the general system, rather than pushing applications to essentially debug or monitor themselves on an individual basis. When that’s not possible (and it’s not always) then probably another API should be considered. An example might be load information — the container can tell something about load, but the application itself might also have information to share, so there should be an agreed-upon way for that to happen (maybe as simple as writing to a specified file with a particular format). Mostly someone should try to do this sort of thing and see where it hurts ;)
I mean /etc as in a known path in linux the same way $appdir/conf/connections.yaml might be a known path in deployment.
I agree on the communication format as well. An environment can check some known file and return it and let app specific tools understand that format. The logging.statistics idea is similar ( http://www.aminus.org/blogs/index.php/2010/11/19/logging-statistics?blog=2) in that the dictionary of stats could be anything.
By itself, there is no reason for .deb packages not to support database configuration. There is already a whole framework for configuration in debian, and there are some helpers to configure e.g. databases for an application. It is pretty horrible to use, though, because it is ancient and using shell for this kind of stuff is painful.
IMO, that’s not really an issue of the packaging format (war vs .deb vs .rpm vs…), but of infrastructure around to do the hard stuff: configuring databases, users, etc… When I started dealing with those issues, I was expecting to find something like a python library to help configuring databases (mysql user/db/pasword, this kind of thing) in a relatively db/platform independent kind of way, but did not find anything.
In that sense, an effort to clearly separate those issues and having one library for each sounds better to me than an all-encompassing solution like silverlining.
I don’t know, seems like a potential step backwards to me. I’m more a fan of “rsync” or file copy deployments. That’s one thing PHP has right and it’s one of the reasons PHP has been so successful. I’m not ruling it out, but I’d prefer the rsync deployment problem was solved first.
I really like the idea of defining an interface between packages and containers.
I’m trying to go a similar direction with Silk (http://pypi.python.org/pypi/silk-deployment), though it has some distance to go, having started more with Fabric scripts and inspiration from Google App Engine (and some of your early Silver Lining posts).
I’ll take a look at Silver Lining’s package format and think about what it would take to deploy a Silver-Lining-configured application on Silk’s Nginx/Gunicorn/Supervisord stack. Maybe it’s not at the level you want, but Supervisord’s XML RPC interface has been nice for getting process state.
Cool! While I have been opinionated about things in some places in Silver Lining, I’ve tried fairly hard to keep other parts separated — so for instance, an application should not know or care if it is running under mod_wsgi or gunicorn, etc. It would be a nice test of this if Silk used the same format (which itself is simple enough that it’s not a big deal if you even use any of Silver Lining’s code; reimplementing shouldn’t be a barrier). [This app](https://bitbucket.org/ianb/silverlining/src/tip/docs/examples/simple-python/) is a very simple example, but could be a start for a test. It would be cool to have an app that tested its container (probably through a combination of self-testing once it is uploaded, and then running some tool that makes a bunch of requests and then tests the side effects all worked).
It might be nice if the development and deployment tools were separated. E.g.,
silver serve
(which serves up an app locally for development) doesn’t really have any relation to deployment.Good point about separating deployment from devserver. If the package is standardized then the devserver is just another thing that can be outside the project’s scope (so long as it complies with the package spec). Then we can even have competing implementations of the devserver… maybe even a pretty GUI one like App Engine has on Windows and Mac. That would make the designers I work with a lot happier.
Something I never got past fantasizing about, but would be really cool, would be a way of taking an application like this and building a cloud-hosted development server with development tools. Plug that into your version control post-commit so it keeps the app up to date, then point a web designer (or novice developer or what have you) to this cloud instance and they can edit things in-place with no personal setup. Or take all those same tools and build something that creates a virtual machine instance from that, and then a new developer can just start up that VM instance and develop on that.
All these sorts of things are the rich set of tools I can imagine being built.
I find it completely unpythonic. You want to build an abstract FRAMEWORK. And the reason why I think Python is a wonderful tool is that it conforms to the philosophy of Unix – it can be easily scripted and integrated with other OS tools, unlike Java which builds it’s own world.
I have worked for years with Java webapps and in practice WARs and EARs are inconvenient. You have to deal with large files even for simple changes. They work on a single app server unless a special attention and testing is given. Working with unpacked archives – convenient for development work – doesn’t work well and isn’t standarized.
I also don’t see a real need for such archives – 99% of web applications are developed in-house and don’t need abstract deployment protocol. And for such cases home-grown scripts for deployment are the best – you have the full control and don’t rely on some abstract mechanism, which unix admins can’t deal with.
Hm, regular python packaging is a solved problem now, so we move on to web packaging? Talk about getting ahead of oneself.
Who would have thought that something as simple as manipulating a list (sys.path) could be so difficult.
I haven’t tried silverlining since around the time it changed its name from toppcloud, but the thing that turned me off about it was that I found the end result of deploying rather opaque. I understood my local development rig, but the deployment result on the server was rather different and I had a hard time finding things and understanding how it was tied together, so when things went wrong it was difficult to figure out.
I’m suggesting that having a smart container that eases deployment is great, but the implementation needs to be documented, and be as simple as possible to inspect and troubleshoot without special tools. And I think there’s value in having the production system be similar to the development system – or to flip that around, every difference between them is a potential source of hard-to-fix trouble.
I wish I could remember the details. I wonder how much of the stuff that confused me fell under the header of “stuff that is only really specified in code”. It felt rather like an “80% solution” to me, but it’s unfair to say that about something whose docs prominently say “don’t use this yet” :)
Meanwhile, most deployments are simple enough that I’m quite happy with the old workflow of pip install -r requirements.txt && edit-some-config-files.
I like Chef.
Personally I think web applications involve too many layers and moving parts to be packaged like typical software packages. Over-coming this problem is going to inherit the complexities of those moving parts, their configuration, and so on. It seems like barking up the wrong tree… but maybe I’m just lazy.
One could use Fabric I guess if staying pure-Python really matters to you. Chef is better though in a lot of ways. Fabric could be better if there were more contributors. :)
I’d be interested in knowing if someone can actually bypass the complexities I’ve noted and actually create a package solution for installing web applications.
Sorry, didn’t mean to be a downer. I will definitely be keeping an eye on silverlining. Mostly just wanted to pass along the thoughts about troubleshooting deployment results.


Inquiries related to purchase, registration, licensing, account information
Inquiries related to technical specifications, unwanted behavior or error messages
Inquiries related to malware removal instructions, false positives, sample submissions
Inquiries related to Business Products


Returns a tensor whose value represents the total loss.
tf.compat.v1.losses.get_total_loss( add_regularization_losses=True, name='total_loss', scope=None )
In particular, this adds any losses you have added with tf.add_loss()
to
any regularization losses that have been added by regularization parameters
on layers constructors e.g. tf.layers
. Be very sure to use this if you
are constructing a loss_op manually. Otherwise regularization arguments
on tf.layers
methods will not function.
add_regularization_losses
: A boolean indicating whether or not to use the
regularization losses in the sum.name
: The name of the returned tensor.scope
: An optional scope name for filtering the losses to return. Note that
this filters the losses added with tf.add_loss()
as well as the
regularization losses to that scope.A Tensor
whose value represents the total loss.
ValueError
: if losses
is not iterable.


Unsubscribe
AIG Property Casualty, 30 North Wall Quay, International Financial Services Centre, Dublin 1, Ireland, Branch registration number 906664. AIG Europe Limited is authorised by the Prudential Regulation Authority of the United Kingdom, and is regulated by the Central Bank of Ireland for conduct of business rules.
© 2014 American International Group, Inc. All Rights Reserved. AIG148.0
|


See: Description
| Interface | Description |
|---|---|
| RemoteDataListener<T> |
Listener on the client side to get notified when the data is updated from server side.
|
| Class | Description |
|---|---|
| RemoteEventController<T> |
Use this class to send the data at the server side that needs to
be delivered to the
rx.Observable at the client side. |
| RemoteObservable<T> |
Observable across android remote services. |
| RemoteObservableListener |
Listen for the remote close events
|
| RemoteObservables<T> |
Helper class to create
RemoteObservable and send data through it
|
RxRemote extends the power of Rx Observables across android process.
@Remoter
public interface ISampleService {
//Define a remote method that returns a RemoteObservable <String >
RemoteObservable <String > getStateObservable();
}
At the service side :
//Controller to send events to cient
RemoteEventController <String > eventController = new RemoteEventController<>();
public RemoteObservable <String > getStateObservable() {
//wrap the controller and return
return new RemoteObservable<>(eventController);
}
...
...
//send the events
eventController.sendEvent("Idle");
eventController.sendEvent("Active");
...
//complete
eventController.sendCompleted();
public RemoteObservable <String > getStateObservable() {
//Use the factory tied to "State"
return RemoteObservables. <String > of("State").newObservable();
}
//Notify update
RemoteObservables. <String > of("State").onNext("Idle");
*
or, simply return a RemoteObservable wrapping your source Observable. Any events generated by the source Observable are delivered remotely
public RemoteObservable <String > getStateObservable() {
//wrap your observable with a RemoteObservable to return across Binder
return new RemoteObservable<>(Observable.from(new String[]{"Idle"});
}
At the client side :
Get the RxJava Observable from RemoteObervable that you get from remote service.
ISampleService sampleService = new ISampleService_Proxy( binder ); //See remoter
Observable <String > stateObservable = sampleService.getStateObservable().getObservable();
or, simply get the Data directly from the RemoteObservable
ISampleService sampleService = new ISampleService_Proxy( binder ); //See remoter
RemoteObservable <String > remoteObservable = sampleService.getStateObservable();
remoteObservable.getData(); //Get the last data
//Listen for updates
remoteObservable.setDataListener(data -> {
});
To add RxRemote to your project add these to its gradle dependencies:
implementation 'com.josesamuel:rxremote:2.0.3’


this.items = {{ items | json }}
Optional drag handles are provided by the <gtx-drag-handle>
component, but if a list item
does not have a drag handle, the entire item will be draggable:
Sorting can be disabled by setting the disabled
attribute to true:
Sometimes the list height is greater than the viewport height. In this case, dragging to the edge of the scrollable area will trigger auto scrolling.
By setting the group
option, items may be dragged between different SortableList components.


Class 06: Complete Search III
01-22-2020
“Think twice, code once”
This technique is usually used in an array. We have a pointer to the first element of the array and to the last. The first pointer will be increasing and the other one decreasing (you may also find variations of this idea). In practice, intead of using a pointer, a int
variable to keep track of the index is usually enough.
Let’s see this technique with an example:
Problem: You are given an array \(a\) of \(n\) elements. You should output the minimum number of intervals \([l_i, r_i] \mid a_i = a_j \forall \, i, j \in [l_i, r_i]\) \([l_1, r_1] \cup [l_2, r_2] \cup \dots \cup [l_m, r_m] = [1, n]\).
\[1 \leq n \leq 10^5\]
Example:
Input:
\(n = 7\)
\(a = 1\ 1\ 1\ 2\ 2\ 3\ 3\)
Output:
\(1\ 3\)
\(4\ 5\)
\(6\ 7\)
First implementation
vector <pair <int, int>> solution1 (const vector <int>& arr) {
int n = arr.size();
vector <bool> vis(n, false);
vector <pair <int, int>> ret;
for (int l = 0; l < n; l++) {
if (vis[l]) continue;
int L = l;
int R = l;
for (int r = l; r < n and arr[l] == arr[r]; r++) {
vis[r] = true;
R = r;
}
ret.push_back({1 + L, 1 + R});
}
return ret;
}
Second implementation
vector <pair <int, int>> solution2 (const vector <int>& arr) {
int n = arr.size();
vector <pair <int, int>> ret;
int l = 0;
while (l < n) {
int r = l;
while (r + 1 < n and arr[l] == arr[r + 1]) r++;
ret.push_back({1 + l, 1 + r});
l = r + 1;
}
return ret;
}
The time complexity of both solutions is \(O(n)\).
Let’s use this technique in this problem:
Problem (2 sum problem): You are given an array \(a\) of \(n\) positive elements and an integer \(target\). You should output two numbers \(i, j \mid i \not = j \land a_i + a_j = target\). It is garantee that a solution always exits.
\[1 \leq n \leq 10^5\] \[1 \leq target \leq 10^9\]
We can use the same technique and sorting to solve the problem in \(O(n \log n)\).
First, let’s sort the array and initiate with \(l = 0 \land r = n - 1\). \(l\) would just increase and \(r\) would just decrease. Then, by the trichotomy property there are three cases:
\(a[l] + a[r] == target\)
Then, we have and answer and our program can finish
\(a[l] + a[r] < target\)
In this case we need to get a greater sum. Decreasing \(r\) the sum may keep the same or smaller. Increasing \(l\) the sum may keep the same or greater. Then, we need to increase \(l\).
\(a[l] + a[r] > target\)
Similar to the previous case, we need to decrease the sum, then we decrease \(r\).
class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
vector <pair <int, int>> arr;
int index = 0;
for (int elem: nums) {
arr.push_back({elem, index});
index++;
}
sort(begin(arr), end(arr));
int n = nums.size();
int l = 0, r = n - 1;
vector <int> ans;
while (l < r) {
if (arr[l].first + arr[r].first == target) {
ans = {arr[l].second, arr[r].second};
break;
}
if (arr[l].first + arr[r].first < target) l++;
else r--;
}
return ans;
}
};
Extra: This is another solution using STL + fixing variables in \(O(n \log n)\):
class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
vector <int> ans;
map <int, vector <int>> pos;
int n = nums.size();
for (int i = 0; i < n; i++) {
pos[nums[i]].push_back(i);
}
for (int x = 0; x < n; x++) {
int k = target - nums[x];
if (pos.count(k)) {
int cnt = 0;
for (int y: pos[k]) {
if (y != x) {
ans = {x, y};
}
cnt++;
if (cnt == 2) break;
}
}
}
return ans;
}
};
How could you solve the same problem if you need to find three numbers \(x, y, z \mid x \not = y \not = z \land a_x + a_y + a_z = target\) ?
Imagine you have a funtion \(f\) that solves a problem in this way:
- When we are in a state with a specific property, we know how to directly solve the problem.
- If we are not in a state with the specific property, we can solve the problem using different states of \(f\).
For example:
\[f(n) = 1 \times 2 \times 3 \times \dots \times n\]
We want to compute \(f(n)\) in a recursive way. Then we need:
Identify a state with a specific property that we can solve easily.
If \(n = 0 \to f(0) = 1\).
Identify how to solve \(f(n)\) using different states of \(f\) (that are ‘closer’ to the states with a specific property of the above point). For instance:
\[f(n) = \underbrace{1 \times 2 \times 3 \times \dots \times (n - 1)}_{\text{f(n - 1)}} \times n\] \[f(n) = n \times f(n - 1)\]
Then, we are basically saying that if \(n = 0\) we know how to solve the problem, else if we have the answer of \(f(n - 1)\) we can use it to solve \(f(n)\).
In code it is something like this:
ll f (int n) {
if (n == 0) return 1;
return n * f(n - 1);
}
What is nice about recursion is that we can think in a recursive way. Thinking in this way the problem may become easier. For example you can say:
Let \(f\) be a function that solves the problem I am trying to solve. Then, you may say. I have no idea how to solve \(f(state)\), but if somehow I would have the answer of \(f(state'), f(state''), f(state'''), \dots\) then I can solve \(f(state)\) and I know how to solve the problem in specific states.
Then, in code, recursive solutions usually have have the form:
T f(state):
if (state have a specific property):
solve the problem for this state and return something
else:
get the answer of f(state'), f(state''), f(state'''), ...
and using these answers compute f(state) and return something
For example, let’s solve the problem of the towers of Hanoi.
The tower of Hanoi
Image taken from Wikipedia
Problem: You have 3 rods, and a pile of \(n\) disks in one rod. Each disk have different diameter, the disks are in order in the stack, the greatest in the button and the smallest on the top. We want to move all the disks to another rod. We can only move the top disk of a stack to another rod if the other rod is empty or the diameter of its top element is greater that the one we are moving. Can you give a sequence of movements to solve this problem ?
Let’s say we have the function \(f\) such that \(f(source, target, pivot, n)\) moves the \(n\) disks that are in the source
rod to the target
rod. Then, we can say:
If I want to move the \(n\) disks from source
rod to the target
rod, first I need to move \(n - 1\) disks from source
to pivot
, then I move the last disk in source
to target. After that, we need to move the \(n - 1\) disks in pivot
to target
and we are done. Moreover, if there is only one disk we can direcly move it to target
. Then, we can write \(f\) in this way:
void f(source, target, pivot, n):
if n == 1:
move the disk in source to target
return
# move the top n - 1 disks in source to pivot
f(source, pivot, target, n - 1)
# move the last disk in source to target
f(source, target, pivot, 1)
# move the n - 1 disks in pivot to target
f(pivot, target, source, n - 1)
And that’s all. It solves the problem!
Exercises
Write recursive functions to compute:
- \(fib(n)\)
Code
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll fib (int n) {
if (n <= 1) return n;
return fib(n - 1) + fib(n - 2);
}
int main () {
int n = 40;
cout << fib(n) << '\n';
return (0);
}
- Sum of digits of a number \(n\)
Code
#include <bits/stdc++.h>
using namespace std;
int sumOfDigits (int n) {
if (n == 0) return 0;
return (n % 10) + sumOfDigits(n / 10);
}
int main () {
int n = 999;
cout << sumOfDigits(n) << endl;
return (0);
}
- \(C(n, k)\)
Code
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll comb (int n, int m) {
if (m == 0) return 1;
if (n == m) return 1;
return comb(n - 1, m - 1) + comb(n - 1, m);
}
int main () {
cout << comb(4, 2) << '\n';
return (0);
}
- Determinant of a matrix
Code
// This is your challenge
When we are doing a division we are basically computing:
\[a = b \cdot \lfloor a / b \rfloor + r\] \[0 \leq r < b\]
Now, we say:
\[a \equiv r \mod b \lor r \equiv a \mod b\]
That is \(x \equiv y \mod m\) iff \((x - y) | m\).
Note: \(r\) is what we get when we compute \(a \% b\).
When working with modular arithmetic, that set of values our numbers can take is \(0, 1, 2, \dots, m - 1\), where \(m\) is a constant. So each number \(x\) is represented as \(x \mod m\).
For example, if \(m = 12 \to x = 20\) is represented as \(x \mod 12 = 8\).
In some problems you will be asked to output the answer module \(m\). For doing this you may just solve your problem and in the end output \(your\_answer \% m\). Nevertheless, what happend if \(m= 10^9 + 7\) and you have:
int m = 1e9 + 7; // 10^9 + 7
long long a = 1e10; // 10^10
long long your_answer = (a * a) % m;
Althought we know that the \(\%\) operator will give us a result less than \(m\), \(a * a\) can not fit in a long long
(\(10^{20} > 2^{63}\)), so we have overflow
. In order to fix that, we can use the properties of modular arithmetic:
\[(x + y) \mod m = (x \mod m + y \mod m) \mod m\] \[(x - y) \mod m = (x \mod m - y \mod m) \mod m\] \[(x \times y) \mod m = (x \mod m \times y \mod m) \mod m\] \[x^n \mod m = (x \mod m)^n \mod m\]
So, we can fix the above code in this way:
long long your_answer = ((a % m) * (a % m)) % m;
From the above properties we have:
\(x \mod m = x \mod m + 0 = x \mod m + m \mod m = (x + m) \mod m\)
The last equation will be useful because in C++ the result of \(\%\) can be in \((-m, m)\). For example:
cout << (-4) % 5 << '\n'; // -4
Then, the subtraction should be:
\[(x - y) \mod m = ((x \mod m - y \mod m) \mod m + m) \mod m\]
Now, the result will always be in \([0, m)\).
\(a^b\) can be expressed in a recursive way.
\[ \text{power}(a, b) = \begin{cases} 1 & \quad \text{If } b = 0 \\ \text{power}(a, \lfloor b / 2 \rfloor) ^ 2 & \, \text{if } b \mod 2 = 0 \\ a \times \text{power}(a, \lfloor b / 2 \rfloor) ^ 2 & \, \text{if } b \mod 2 = 1 \end{cases} \]
Moreover, from the properties of modular arithmetic, we can get \(a^b \mod m\) as:
\[ \text{binpow}(a, b) = \begin{cases} 1 & \quad \text{If } b = 0 \\ \text{binpow}(a, \lfloor b / 2 \rfloor) ^ 2 \mod m & \, \text{if } b \mod 2 = 0 \\ (a \times \text{binpow}(a, \lfloor b / 2 \rfloor) ^ 2) \mod m & \, \text{if } b \mod 2 = 1 \end{cases} \]
In code:
const ll m = 1e9 + 7;
ll binpow (ll a, ll b) {
if (b == 0) return 1;
a %= m;
ll res = binpow(a, b / 2);
res = (res * res) % m;
if (b % 2 == 1) res = (a * res) % m;
return res;
}
The above code compute \(a^b \mod m\) in \(O(\log b)\).
This function will be really useful, but before using it, we need to know one theorem.
Fermat’s little theorem
If \(m\) is prime and \(0 < a < m\), we have:
\[a^{m - 1} \equiv 1 \mod m\]
Moreover, we say the the inverse of \(a\) is \(b\) if:
\[ab \equiv 1 \mod m\]
\(b\) is written as \(a^{-1}\).
And as \(a^{m - 1} = a \cdot a^{m - 2}\)
Using Fermat’s little theorem we have that the inverse of \(a\) is \(a^{m - 2}\) if \(m\) is prime.
Now, we can mention one more property of modular arithmetic (if \(b^{-1}\) exists).
\[\frac{a}{b} \mod m = ((a \mod m) \times (b^{-1} \mod m)) \mod m\]
Let’s see how it is useful in this problem.
Problem: Compute \(S = (1 + a + a^2 + a^3 + \dots + a^k) \mod m\).
\[m = 10^9 + 7 \text{ (is prime)}\] \[1 \leq a \leq 10^{18}\] \[1 \leq k \leq 10^{18}\]
If \(a = 1 \to S = (k + 1) \mod m\)
If \(a > 1 \to S = \frac{a^{k + 1} - 1}{a - 1} \mod m\)
Then, we can use the above properties to compute that.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll m = 1e9 + 7;
ll add (ll a, ll b) { return ((a % m) + (b % m)) % m; }
ll sub (ll a, ll b) { return (((a % m) - (b % m)) + m) % m; }
ll mul (ll a, ll b) { return ((a % m) * (b % m)) % m; }
ll binpow (ll a, ll b) {
if (b == 0) return 1;
a %= m;
ll res = binpow(a, b / 2);
res = mul(res, res);
if (b % 2 == 1) res = mul(a, res);
return res;
}
ll inverse (ll a) { return binpow(a, m - 2); }
int main () {
ll a, k;
cin >> a >> k;
if (sub(a, 1) == 0) {
cout << add(k, 1) << '\n';
} else {
cout << mul(sub(binpow(a, k + 1), 1), inverse(a - 1)) << '\n';
}
return (0);
}
Recommended readings:
- Concrete Mathematics - Knuth. Chapter 1
- Modular Arithmetic for Beginners
- Competitive Programmer’s Handbook, chapters 5, 8 y 21
- Principles of Algorithmic Problem Solving, sections 15.6 y 15.7
- Learn Data Structures and Algorithms, section Basic Recursion
- E-maxx Binary Exponentiation
You can find the contest here.
A: Brutality
Brutality
The optimal strategy is to take equal consecutive elements and take the \(k\) highest values. We can implement this idea with two pointers and sorting in \(O(n \log n)\).
Code
#include <bits/stdc++.h>
#define all(X) begin(X), end(X)
using namespace std;
typedef long long ll;
int main () {
ios::sync_with_stdio(false); cin.tie(0);
ll n, k;
cin >> n >> k;
vector <ll> a(n);
for (int i = 0; i < n; i++) cin >> a[i];
string s;
cin >> s;
ll ans = 0;
for (int i = 0; i < n;) {
vector <ll> tmp;
tmp.push_back(a[i]);
int j = i + 1;
while (j < n and s[i] == s[j]) tmp.push_back(a[j]), j++;
sort(rbegin(tmp), rend(tmp));
int cnt = 0;
for (ll elem: tmp) {
if (cnt == k) break;
ans += elem;
cnt++;
}
i = j;
}
cout << ans << endl;
return (0);
}
B: Fox and Snake
Fox and Snake
There is a pattern every four rows.
Code
#include <bits/stdc++.h>
#define all(A) begin(A), end(A)
#define rall(A) rbegin(A), rend(A)
#define sz(A) int(A.size())
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
typedef vector <int> vi;
typedef vector <ll> vll;
int main () {
ios::sync_with_stdio(false); cin.tie(0);
int n, m;
cin >> n >> m;
for (int r = 0; r < n; r++) {
if (r % 4 == 0 or r % 4 == 2) {
cout << string(m, '#') << '\n';
} else if (r % 4 == 1) {
cout << string(m - 1, '.') + '#' << '\n';
} else {
cout << '#' + string(m - 1, '.') << '\n';
}
}
return (0);
}
C: Counting Chaos
Counting Chaos
Just try all options.
Code
#include <bits/stdc++.h>
#define all(A) begin(A), end(A)
#define rall(A) rbegin(A), rend(A)
#define sz(A) int(A.size())
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
typedef vector <int> vi;
typedef vector <ll> vll;
bool isPalindrome (int hh, int mm) {
int val = hh * 100 + mm;
string s = to_string(val);
string rs = s;
reverse(all(rs));
return s == rs;
}
int val (char ch) { return ch - '0'; }
int main () {
ios::sync_with_stdio(false); cin.tie(0);
int tc;
cin >> tc;
while (tc--) {
string s;
cin >> s;
int hh = val(s[0]) * 10 + val(s[1]);
int mm = val(s[3]) * 10 + val(s[4]);
do {
mm++;
if (mm == 60) mm = 0, hh++;
if (hh == 24) hh = 0;
} while (!isPalindrome(hh, mm));
cout << setfill('0') << setw(2) << hh << ":";
cout << setfill('0') << setw(2) << mm << "\n";
}
return (0);
}
D: Mirror, Mirror
Mirror, Mirror
Just implement what the problem says. Be careful with the implementation.
Code
#include <bits/stdc++.h>
#define all(A) begin(A), end(A)
#define rall(A) rbegin(A), rend(A)
#define sz(A) int(A.size())
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
typedef vector <int> vi;
typedef vector <ll> vll;
vector <string> rotate90 (const vector <string>& a) {
int n = sz(a);
vector <string> b = a;
for (int r = 0; r < n; r++) {
for (int c = 0; c < n; c++) {
b[c][n - 1 - r] = a[r][c];
}
}
return b;
}
vector <string> reflect (const vector <string>& a) {
int n = sz(a);
vector <string> b = a;
for (int r = 0; 2 * r < n; r++) {
swap(b[r], b[n - 1 - r]);
}
return b;
}
int main () {
ios::sync_with_stdio(false); cin.tie(0);
int tc = 0;
int n;
while (cin >> n) {
vector <string> a(n);
vector <string> b(n);
for (int r = 0; r < n; r++) cin >> a[r] >> b[r];
cout << "Pattern " << ++tc << " was ";
if (a == b) {
cout << "preserved.\n";
continue;
}
int rotate = 0;
vector <string> cur = a;
for (int i = 1; i < 4; i++) {
cur = rotate90(cur);
if (cur == b) {
rotate = 90 * i;
break;
}
}
if (rotate != 0) {
cout << "rotated " << rotate << " degrees.\n";
continue;
}
rotate = 0;
cur = reflect(a);
if (cur == b) {
cout << "reflected vertically.\n";
continue;
}
for (int i = 1; i < 4; i++) {
cur = rotate90(cur);
if (cur == b) {
rotate = 90 * i;
break;
}
}
if (rotate != 0) {
cout << "reflected vertically and rotated " << rotate << " degrees.\n";
continue;
}
cout << "improperly transformed.\n";
}
return (0);
}
E: Fractal
Fractal
You can create a matrix filled with spaces, select a position and start doing the recursion to store the fractal in the matrix. The choice or the initial position and how to do the transition can be obtained by getting a pattern with the first values of \(n\).
Code
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
vector <string> grid;
int DR[] = {-1, -1, 1, 1, 0};
int DC[] = {1, -1, 1, -1, 0};
void print () {
for (int i = 0; i < grid.size(); i++) {
string& row = grid[i];
int j = row.size() - 1;
while (row[j] == ' ') row.erase(row.begin() + j);
cout << row << endl;
}
cout << '-' << endl;
}
void rec (int r, int c, int step) {
if (step == 0) {
grid[r][c] = 'X';
return;
}
for (int d = 0; d < 5; d++) {
rec(r + DR[d] * step, c + DC[d] * step, step / 3);
}
}
int main () {
int n;
while (cin >> n, n != -1) {
int gridSize = int(pow(3, n - 1));
grid = vector <string> (gridSize, string(gridSize, ' '));
int initial = (n == 1) ? 0 : gridSize / 3 + gridSize / 6;
int step = gridSize / 3;
rec(initial, initial, step);
print();
}
return (0);
}


For our final project, we decided to map and compare Temperature, Precipitation, Crime Rates, and FEMA Declarations by state.
Overall, we have noticed that there is a visible correlation between temperature, precipitation, and crime rates, but not necessarily FEMA declarations. The majority of this data appears in the Southeastern United States, which naturally have a higher average temperature and preciptation rate due to their geographic location.
Natural Disasters and Crime
There are been many different opinions on whether natural disasters increase or decrease crime rates in areas where they strike. Use of sociology and criminology are areas often used to asses this relationship in the wake of natural disaster; we chose to explore the spatial relationship between the two. Since the timing of the disaster and when crime rates are analyzed can play a factor, our project opted to look at the amount of natural disasters in areas of the United States and how it was spatially related to county crime rates. Portraying this data spatially helps the user see any relationship between the two categories without having to explore specific instances of disasters or crimes occurring.
References: Prelog, Andrew J. (2015). Modeling the Relationship between Natural Disasters and Crime in the United States. Nat. Hazards Rev., 2016, 17(1): 04015011. doi: http://dx.doi.org/10.1061/(ASCE)NH.1527-6996.0000190
The Parallel Coordinate Plot state labels are difficult to read, use the cursor to hover over a state and see which line becomes highlighted instead.


Vijender Singh next takes on former Commonwealth champ in Dubai showdown
Ghanaian Charles Adamu confident his experience will give him the edge
by Special CorrespondentUnbeaten Indian professional boxer Vijender Singh will take on former Ghanaian Olympian and two-time Commonwealth super middleweight champion Charles Adamu in his next bout in Dubai on November 22.
The fight is part of the #RotundaRumble2 card, featuring top stars such as WBO super lightweight World No. 1 Jack Catterall and WBO bantamweight World No. 4 Thomas Patrick Ward.
In his last fight, 34-year-old Vijender had defeated Mike Snider on his US debut in July.
The WBO Asia Pacific and Oriental super middleweight champion from India holds an 11-0 record, with eight knockouts.
Adamu, 42, is an experienced boxer with a 33-14-0 record, including 26 knockouts.
“After having rigorous training sessions for more than two months, I am fully prepared to end my year on a winning note. For me, this fight will be a build-up to the World title I aim to bag in 2020. I am sure my debut fight in Dubai will be exciting and I am looking forward to an early knockout win,” said Vijender.
Adamu sounded confident as well. “Vijender Singh must know that this fight isn't going to be easy for him…I will put up a tactical masterclass he has never seen before. I have fought more than three times the number of fights he has,” said the Ghanaian.


okyo is japanese traditional music. okyo can be played with Google Chrome.
http://hitode909.appspot.com/js/okyo.js


|
0.9.9 API documenation
|
Extented quaternion types and functions. More...
Functions | |
| template<typename T , qualifier P> | |
| GLM_FUNC_DECL vec< 3, T, P > | cross (tquat< T, P > const &q, vec< 3, T, P > const &v) |
| Compute a cross product between a quaternion and a vector. More... | |
| template<typename T , qualifier P> | |
| GLM_FUNC_DECL vec< 3, T, P > | cross (vec< 3, T, P > const &v, tquat< T, P > const &q) |
| Compute a cross product between a vector and a quaternion. More... | |
| template<typename T , qualifier P> | |
| GLM_FUNC_DECL tquat< T, P > | exp (tquat< T, P > const &q) |
| Returns a exp of a quaternion. More... | |
| template<typename T , qualifier P> | |
| GLM_FUNC_DECL T | extractRealComponent (tquat< T, P > const &q) |
| Extract the real component of a quaternion. More... | |
| template<typename T , qualifier P> | |
| GLM_FUNC_DECL tquat< T, P > | fastMix (tquat< T, P > const &x, tquat< T, P > const &y, T const &a) |
| Quaternion normalized linear interpolation. More... | |
| template<typename T , qualifier P> | |
| GLM_FUNC_DECL tquat< T, P > | intermediate (tquat< T, P > const &prev, tquat< T, P > const &curr, tquat< T, P > const &next) |
| Returns an intermediate control point for squad interpolation. More... | |
| template<typename T , qualifier P> | |
| GLM_FUNC_DECL T | length2 (tquat< T, P > const &q) |
| Returns the squared length of x. More... | |
| template<typename T , qualifier P> | |
| GLM_FUNC_DECL tquat< T, P > | log (tquat< T, P > const &q) |
| Returns a log of a quaternion. More... | |
| template<typename T , qualifier P> | |
| GLM_FUNC_DECL tquat< T, P > | pow (tquat< T, P > const &x, T const &y) |
| Returns x raised to the y power. More... | |
| template<typename T , qualifier P> | |
| GLM_FUNC_DECL tquat< T, P > | quat_identity () |
| Create an identity quaternion. More... | |
| template<typename T , qualifier P> | |
| GLM_FUNC_DECL tquat< T, P > | quatLookAt (vec< 3, T, P > const &direction, vec< 3, T, P > const &up) |
| Build a look at quaternion based on the default handedness. More... | |
| template<typename T , qualifier P> | |
| GLM_FUNC_DECL tquat< T, P > | quatLookAtLH (vec< 3, T, P > const &direction, vec< 3, T, P > const &up) |
| Build a left-handed look at quaternion. More... | |
| template<typename T , qualifier P> | |
| GLM_FUNC_DECL tquat< T, P > | quatLookAtRH (vec< 3, T, P > const &direction, vec< 3, T, P > const &up) |
| Build a right-handed look at quaternion. More... | |
| template<typename T , qualifier P> | |
| GLM_FUNC_DECL vec< 3, T, P > | rotate (tquat< T, P > const &q, vec< 3, T, P > const &v) |
| Returns quarternion square root. More... | |
| template<typename T , qualifier P> | |
| GLM_FUNC_DECL vec< 4, T, P > | rotate (tquat< T, P > const &q, vec< 4, T, P > const &v) |
| Rotates a 4 components vector by a quaternion. More... | |
| template<typename T , qualifier P> | |
| GLM_FUNC_DECL tquat< T, P > | rotation (vec< 3, T, P > const &orig, vec< 3, T, P > const &dest) |
| Compute the rotation between two vectors. More... | |
| template<typename T , qualifier P> | |
| GLM_FUNC_DECL tquat< T, P > | shortMix (tquat< T, P > const &x, tquat< T, P > const &y, T const &a) |
| Quaternion interpolation using the rotation short path. More... | |
| template<typename T , qualifier P> | |
| GLM_FUNC_DECL tquat< T, P > | squad (tquat< T, P > const &q1, tquat< T, P > const &q2, tquat< T, P > const &s1, tquat< T, P > const &s2, T const &h) |
| Compute a point on a path according squad equation. More... | |
| template<typename T , qualifier P> | |
| GLM_FUNC_DECL mat< 3, 3, T, P > | toMat3 (tquat< T, P > const &x) |
| Converts a quaternion to a 3 * 3 matrix. More... | |
| template<typename T , qualifier P> | |
| GLM_FUNC_DECL mat< 4, 4, T, P > | toMat4 (tquat< T, P > const &x) |
| Converts a quaternion to a 4 * 4 matrix. More... | |
| template<typename T , qualifier P> | |
| GLM_FUNC_DECL tquat< T, P > | toQuat (mat< 3, 3, T, P > const &x) |
| Converts a 3 * 3 matrix to a quaternion. More... | |
| template<typename T , qualifier P> | |
| GLM_FUNC_DECL tquat< T, P > | toQuat (mat< 4, 4, T, P > const &x) |
| Converts a 4 * 4 matrix to a quaternion. More... | |
Extented quaternion types and functions.
<glm/gtx/quaternion.hpp> need to be included to use these functionalities.
| GLM_FUNC_DECL vec<3, T, P> glm::cross | ( | tquat< T, P > const & | q, |
| vec< 3, T, P > const & | v | ||
| ) |
Compute a cross product between a quaternion and a vector.
| GLM_FUNC_DECL vec<3, T, P> glm::cross | ( | vec< 3, T, P > const & | v, |
| tquat< T, P > const & | q | ||
| ) |
Compute a cross product between a vector and a quaternion.
| GLM_FUNC_DECL tquat<T, P> glm::exp | ( | tquat< T, P > const & | q | ) |
Returns a exp of a quaternion.
| GLM_FUNC_DECL T glm::extractRealComponent | ( | tquat< T, P > const & | q | ) |
Extract the real component of a quaternion.
| GLM_FUNC_DECL tquat<T, P> glm::fastMix | ( | tquat< T, P > const & | x, |
| tquat< T, P > const & | y, | ||
| T const & | a | ||
| ) |
Quaternion normalized linear interpolation.
| GLM_FUNC_DECL tquat<T, P> glm::intermediate | ( | tquat< T, P > const & | prev, |
| tquat< T, P > const & | curr, | ||
| tquat< T, P > const & | next | ||
| ) |
Returns an intermediate control point for squad interpolation.
| GLM_FUNC_DECL T glm::length2 | ( | tquat< T, P > const & | q | ) |
Returns the squared length of x.
| GLM_FUNC_DECL tquat<T, P> glm::log | ( | tquat< T, P > const & | q | ) |
Returns a log of a quaternion.
| GLM_FUNC_DECL tquat<T, P> glm::pow | ( | tquat< T, P > const & | x, |
| T const & | y | ||
| ) |
Returns x raised to the y power.
| GLM_FUNC_DECL tquat<T, P> glm::quat_identity | ( | ) |
Create an identity quaternion.
| GLM_FUNC_DECL tquat<T, P> glm::quatLookAt | ( | vec< 3, T, P > const & | direction, |
| vec< 3, T, P > const & | up | ||
| ) |
Build a look at quaternion based on the default handedness.
| direction | Desired direction of the camera. |
| up | Up vector, how the camera is oriented. Typically (0, 1, 0). |
| GLM_FUNC_DECL tquat<T, P> glm::quatLookAtLH | ( | vec< 3, T, P > const & | direction, |
| vec< 3, T, P > const & | up | ||
| ) |
Build a left-handed look at quaternion.
| direction | Desired direction onto which the +z-axis gets mapped |
| up | Up vector, how the camera is oriented. Typically (0, 1, 0). |
| GLM_FUNC_DECL tquat<T, P> glm::quatLookAtRH | ( | vec< 3, T, P > const & | direction, |
| vec< 3, T, P > const & | up | ||
| ) |
Build a right-handed look at quaternion.
| direction | Desired direction of the camera. |
| up | Up vector, how the camera is oriented. Typically (0, 1, 0). |
| GLM_FUNC_DECL vec<3, T, P> glm::rotate | ( | tquat< T, P > const & | q, |
| vec< 3, T, P > const & | v | ||
| ) |
Returns quarternion square root.
| GLM_FUNC_DECL vec<4, T, P> glm::rotate | ( | tquat< T, P > const & | q, |
| vec< 4, T, P > const & | v | ||
| ) |
Rotates a 4 components vector by a quaternion.
| GLM_FUNC_DECL tquat<T, P> glm::rotation | ( | vec< 3, T, P > const & | orig, |
| vec< 3, T, P > const & | dest | ||
| ) |
Compute the rotation between two vectors.
param orig vector, needs to be normalized param dest vector, needs to be normalized
| GLM_FUNC_DECL tquat<T, P> glm::shortMix | ( | tquat< T, P > const & | x, |
| tquat< T, P > const & | y, | ||
| T const & | a | ||
| ) |
Quaternion interpolation using the rotation short path.
| GLM_FUNC_DECL tquat<T, P> glm::squad | ( | tquat< T, P > const & | q1, |
| tquat< T, P > const & | q2, | ||
| tquat< T, P > const & | s1, | ||
| tquat< T, P > const & | s2, | ||
| T const & | h | ||
| ) |
Compute a point on a path according squad equation.
q1 and q2 are control points; s1 and s2 are intermediate control points.
| GLM_FUNC_DECL mat<3, 3, T, P> glm::toMat3 | ( | tquat< T, P > const & | x | ) |
Converts a quaternion to a 3 * 3 matrix.
Definition at line 134 of file gtx/quaternion.hpp.
References glm::mat3_cast().
| GLM_FUNC_DECL mat<4, 4, T, P> glm::toMat4 | ( | tquat< T, P > const & | x | ) |
Converts a quaternion to a 4 * 4 matrix.
Definition at line 141 of file gtx/quaternion.hpp.
References glm::mat4_cast().
| GLM_FUNC_DECL tquat<T, P> glm::toQuat | ( | mat< 3, 3, T, P > const & | x | ) |
Converts a 3 * 3 matrix to a quaternion.
Definition at line 148 of file gtx/quaternion.hpp.
References glm::quat_cast().
| GLM_FUNC_DECL tquat<T, P> glm::toQuat | ( | mat< 4, 4, T, P > const & | x | ) |
Converts a 4 * 4 matrix to a quaternion.
Definition at line 155 of file gtx/quaternion.hpp.
References glm::quat_cast().


MovieHeight()
语法
Height = MovieHeight(#Movie)概要
Returns the height of the movie.
参数
#Movie The movie to use.
返回值
Returns the height of the movie in pixels. If the result equals -1, then no video stream is found (or isn't compatible), however the audio stream can still be played.
参阅
MovieWidth(), MovieLength(), MovieInfo()
已支持操作系统
所有


The seekp function reset the current write offset position.
| Option | Comment |
| SF_POS::BEG | the head of the file |
| SF_POS::CUR | current position |
| SF_POS::END | the end of the file |
On success, the function returns the current write position. If error occurs, a negative value is returned.
| Error Name | Comment |
| E_FILENOTOPEN | This Sector file has not been opened |
| E_INVALID | invalid parameters |
The new offset will be set to (pos + off). If pos is BEG, the offset is calculated from the 0. If pos is CUR, the offset is based on the current position. Finally, if pos is END, the offset is based at the end of the file. The final position must be greater than 0.


Chart settings
Change the settings to get your defined output.
Start Date
—
End Date
Tag name
Data type
chart data
annotation data
Get chart data!


In this section we are going to take a quick look at the BSD world. The operating systems considered are FreeBSD, NetBSD, OpenBSD and Darwin. All the systems have support for kernel modules but their use in NetBSD and OpenBSD is limited. The "over time" term is used here to refer to releases. Timelines for all the systems except Darwin are presented in Appendix B.


0 <.!--Section: Magazine v.1-->
Contact skilled persones, regular persones within minutes. View profiles, ratings, portfolios and chat with them. Pay the any persone only when you are 100% satisfied with their work. .
price you may pay in $
Location where service will be done
Start with a bit about things descipe the service or project .
some word like #water , #programming , #help_me.
every thing is very good
we want to remember you only pay person when you're happy with the completed work.