specifications

Object.keys order in React Native

梦想的初衷 提交于 2019-12-24 11:19:14
问题 Is it safe to assume that calling Object.keys() on object always returns array in the same order? I mean it wasn't specified in JS until ES2015 but I'm not sure how it is exactly in React Native? 回答1: Property keys are traversed in the following order: First, the keys that are integer indices in ascending numeric order. Then, all other string keys, in the order in which they were added to the object. Lastly, all symbol keys, in the order in which they were added to the object. Many engines

Writing a given sequence of int's as an array of hex values in Jackson

空扰寡人 提交于 2019-12-24 07:36:49
问题 Is it possible to make Jackson FasterXML library to serialize a given sequence of Integer values as an array of Hex values? That is, simply put, I would like that the code: public class SampleJson { private final ObjectMapper mapper = new ObjectMapper(); JsonNode toJson(int[] values) { ArrayNode jsonArray = mapper.createArrayNode(); for(int i: values) jsonArray.add(i); return jsonArray; } String toJsonString(JsonNode node) throws JsonProcessingException { return mapper.writeValueAsString(node

Group by trunced date in JPA

限于喜欢 提交于 2019-12-24 03:18:58
问题 I need help! I need to build specification for SELECT date_trunc('day', start_time) FROM Example GROUP BY date_trunc('day', start_time) (PostgreSQL) I have code: CriteriaBuilder cb = entityManager.getCriteriaBuilder(); CriteriaQuery<Object[]> query = cb.createQuery(Object[].class); Root<Example> root = query.from(Example.class); Expression<Date> exp = cb.function("date_trunc", Date.class , cb.literal("day"), root.get("startTime")); List<Object[]> result = entityManager.createQuery(query

Does anonymous inline box contain whitespace?

冷暖自知 提交于 2019-12-24 01:13:14
问题 I read about CSS2.1 Specification, and in "Anonymous inline boxes" section, it shows an example of anonymous inline boxes like this: <p>Some <em>emphasized</em> text</p> and it says: the <p> generates a block box, with several inline boxes inside it. The box for "emphasized" is an inline box generated by an inline element (<em>), but the other boxes ("Some" and "text") are inline boxes generated by a block-level element (<p>). The latter are called anonymous inline boxes because they do not

Does the XML specification states that parser need to convert \n\r to \n always, even when \n\r appears in a CDATA section?

陌路散爱 提交于 2019-12-23 23:00:12
问题 I've stumbled in a problem handling the \line-feed and \carriage-return characters in xml. I know that, according to http://www.w3.org/TR/REC-xml/#sec-line-ends, xml processors are required to replace any "\n\r" or lone "\r" sequences with "\n". The specification states that this has to be the behaviour for handling any "external parsed entity", does this apply to CDATA sections inside of an element as well? thank you, Michele I'm sure that msxml library for example converts every \n\r" or

Specification: Use cases for CRUD

二次信任 提交于 2019-12-23 12:35:14
问题 I am writing a Product requirements specification. In this document I must describe the ways that the user can interact with the system in a very high level. Several of these operations are "Create-Read-Update-Delete" on some objects. The question is, when writing use cases for these operations, what is the right way to do so? Can I write only one Use Case called "Manage Object x" and then have these operations as included Use Cases? Or do I have to create one use case per operation, per

How can the offset for a JVM jump instruction be 32768?

烈酒焚心 提交于 2019-12-23 08:49:13
问题 While writing an answer to a question about JVM byte code offsets, I noticed something in the behavior of javac and the resulting class files that I can not explain: When compiling a class like this class FarJump { public static void main(String args[]) { call(0, 1); } public static void call(int x, int y) { if (x < y) { y++; y++; // ... (10921 times - too much code to post here!) y++; y++; } System.out.println(y); } } then the resulting byte code will contain the following if_icmpge

How reliable is “order” in queried NodeLists

狂风中的少年 提交于 2019-12-23 08:46:34
问题 I am wondering about this topic for quite a while. The methods in question are the following: getElementsByTagName getElementsByClassName getElementsByName querySelectorAll As far as I know, those DOM methods are the only methods which are able to return frozen or live NodeLists . For some of those methods, order is defined by W3C spec . For instance, http://www.w3.org writes the following for NodeLists returned by querySelectorAll The querySelectorAll() methods on the Document,

How reliable is “order” in queried NodeLists

戏子无情 提交于 2019-12-23 08:46:05
问题 I am wondering about this topic for quite a while. The methods in question are the following: getElementsByTagName getElementsByClassName getElementsByName querySelectorAll As far as I know, those DOM methods are the only methods which are able to return frozen or live NodeLists . For some of those methods, order is defined by W3C spec . For instance, http://www.w3.org writes the following for NodeLists returned by querySelectorAll The querySelectorAll() methods on the Document,

Why does array_map() with null as callback create an “array of arrays”?

牧云@^-^@ 提交于 2019-12-23 08:26:28
问题 Today I learned about a special case of array_map() in PHP, which is mentioned as a side note in the documentation: Example #4 Creating an array of arrays <?php $a = array(1, 2, 3, 4, 5); $b = array("one", "two", "three", "four", "five"); $c = array("uno", "dos", "tres", "cuatro", "cinco"); $d = array_map(null, $a, $b, $c); print_r($d); ?> The above example will output: Array ( [0] => Array ( [0] => 1 [1] => one [2] => uno ) [1] => Array ( [0] => 2 [1] => two [2] => dos ) [2] => Array ( [0] =