Id
int64
34.6M
60.5M
Title
stringlengths
15
150
Body
stringlengths
33
36.7k
Tags
stringlengths
3
112
CreationDate
stringdate
2016-01-01 00:21:59
2020-02-29 17:55:56
Y
stringclasses
3 values
55,220,076
In python, How to print dictionary value based on another value?
How to print the string of "value" only for id: "resolution" ?? Here in this case I want to print the value "Fixed" customFields: { string: [ { id: "device_type", value: "iPhone 6" }, { id: "os_version", value: "iOS 10.x" }, { id: "rabbit_build", value: "2.11.llyu" }, { id: "resolution", value: "Fixed" }, My Python code is resolution = ib['customFields']['string'] print(resolution)
<python><json>
2019-03-18 11:13:48
LQ_EDIT
55,220,542
jquery multi checkbox is checked with same class
i am having problem getting this code to work i have multi checkbox that are also added with ajax trying to trigger a click if the checkbox are not checked the html <input type="checkbox" class="variable_manage_stock" name="variable_manage_stock[0]"> <input type="checkbox" class="variable_manage_stock" name="variable_manage_stock[1]"> <input type="checkbox" class="variable_manage_stock" name="variable_manage_stock[2]"> <input type="checkbox" class="variable_manage_stock" name="variable_manage_stock[3]"> this is the code i am using if($(".variable_manage_stock").prop('checked') == false){ $('.variable_manage_stock').trigger('click'); } but this is not working for all the checkboxes thank you
<javascript><jquery>
2019-03-18 11:40:54
LQ_EDIT
55,223,075
Automatically use secret when pulling from private registry
<p>Is it possible to globally (or at least per namespace), configure kubernetes to always use an image pull secret when connecting to a private repo? There are two use cases: </p> <ol> <li>when a user specifies a container in our private registry in a deployment</li> <li>when a user points a Helm chart at our private repo (and so we have no control over the image pull secret tag).</li> </ol> <p>I know it is possible to do this on a <a href="https://kubernetes.io/docs/concepts/containers/images/#using-a-private-registry" rel="noreferrer">service account basis</a> but without writing a controller to add this to every new service account created it would get a bit of a mess.</p> <p>Is there are way to set this globally so if kube tries to pull from registry X it uses secret Y?</p> <p>Thanks</p>
<kubernetes><artifactory><kubernetes-helm>
2019-03-18 13:58:11
HQ
55,224,222
Fatal error: Uncaught Error: Call to undefined function sellerLogIn()
<p>I'm trying to pass the variables to the function where the actual assigning of values to Session variables are, but it gives me an error where it says the function is undefined</p> <pre><code>if(isset($_POST['submit'])){ $username=$_POST['un']; $pass=$_POST['pass']; $uType=$_POST['logn']; $conn = new mysqli("localhost","bns_admin","hellobns","buynsave") or die('&lt;script src="Connectfail.js"&gt;&lt;/script&gt;'); if($uType="seller"){ $query="SELECT * FROM sellers WHERE sellerUserName='".$username."'"; $passQuery="SELECT * FROM sellers WHERE sellerPassWD='".$pass."'"; sellerLogIn($conn,$passQuery,$query,$username,$uType); } function sellerLogIn($conn,$passQuery,$query,$username,$uType){ $result=$conn-&gt;query($query); $passResult=$conn-&gt;query($passQuery); if($result &amp;&amp; $passResult){ $getIDQ="SELECT sellerID FROM sellers WHERE sellerUserName='".$username."'"; $getID=$conn-&gt;query($getIDQ); $_SESSION['usertype']=$uType; $_SESSION['username']=$username; $_SESSION['sellerID']=$getID; } else echo '&lt;script src="logDeb.js"&gt;&lt;/script&gt;'; } </code></pre>
<php>
2019-03-18 14:57:26
LQ_CLOSE
55,224,650
Don't understand why (5 | -2) > 0 is False where (5 or -2) > 0 is True
<p>This is a pretty trivial question that I haven't been able to find the answer to. </p> <p>Here is the problem. I have the following array:</p> <pre><code>vals = [-5, 2] </code></pre> <p>And I want to check whether <code>val[0]</code> or <code>val[1]</code> is greater than 0. If either is true, then I should output True.</p> <p>My immediate thought was to use; <code>(vals[1] or vals[0]) &gt; 0)</code> but I'm finding that <code>(5 | -2) &gt; 0</code> is False where <code>(5 or -2) &gt; 0</code> is True</p> <p>Any clarification would be much appreciated. </p>
<python><conditional>
2019-03-18 15:21:43
HQ
55,226,906
How to Add mysql foreign key from another table primary key in php
<? $connect->exec("INSERT INTO questions (questions_points, questions_ask, answer_option, contest_id) VALUES ('$questionspoints', '$questionsask', '$answeroption', '$lastid') "); $connect->exec(" INSERT INTO answers(choice_option, questions_id) VALUES('$choiceoption', what should i add here except last id because it is not working , I want to add the questions primary key)"); ?>
<php><mysql>
2019-03-18 17:26:52
LQ_EDIT
55,227,363
How to parse this string? I have like a categories, can't parse it
I heve a string with links. How can i use the correct regular expression to parce it? <li><a href="/plitka/">Керамическая плитка</a></li> <li><a href="/napolnye-pokrytiya/">Напольные покрытия</a></li> <li><a href="/oboi/">Обои</a></li> <li><a href="/mebel-dlia-vannoi/">Мебель для ванной</a></li> <li><a href="/santehnika/">Сантехника</a></li>... Thank you very much. Really appreciate your help!
<php><html><regex><parsing><dom>
2019-03-18 17:54:22
LQ_EDIT
55,227,544
Cannot deserialize value of type `java.util.Date` from String
<p>Using Spring 1.5.8.RELEASE Jackson mapper giving the following exception.</p> <pre><code>Cannot deserialize value of type `java.util.Date` from String "2018-09-04T10:44:46": expected format "yyyy-MM-dd'T'HH:mm:ss.SSS" </code></pre> <p>at [Source: UNKNOWN; line: -1, column: -1] (through reference chain: com.copart.conversationapi.calldisposition.model.vo.CallLogEntity["callEndTime"])</p> <p>CallEntity.java</p> <pre><code>@JsonProperty("callEndTime") @Column(name = "call_end_ts") @JsonFormat(pattern="yyyy-MM-dd'T'HH:mm:ss.SSS") private Date callEndTime; </code></pre> <p>DAO.java</p> <pre><code>ObjectMapper mapper = new ObjectMapper(); HashMap&lt;String, Object&gt; finalHashMap; finalHashMap = convertMultiToString(requestMap); mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); CallLogEntity callLogEntity = mapper.convertValue(finalHashMap, CallEntity.class); </code></pre> <p>pom.xml</p> <pre><code>&lt;dependency&gt; &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt; &lt;artifactId&gt;jackson-databind&lt;/artifactId&gt; &lt;version&gt;2.9.0&lt;/version&gt; &lt;exclusions&gt; &lt;exclusion&gt; &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt; &lt;artifactId&gt;jackson-core&lt;/artifactId&gt; &lt;/exclusion&gt; &lt;exclusion&gt; &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt; &lt;artifactId&gt;jackson-annotations&lt;/artifactId&gt; &lt;/exclusion&gt; &lt;/exclusions&gt; &lt;/dependency&gt; </code></pre>
<java><spring-boot><spring-mvc><jackson><jackson-databind>
2019-03-18 18:06:29
HQ
55,227,950
How Can I consume this Json using React-Native?
<p>i'd like to know how can I use and consume this json, showing and updading always the list, please i need this for my work and i am struggling to make it.</p> <p><a href="https://i.stack.imgur.com/Za5Hs.png" rel="nofollow noreferrer">HERE THE JSON</a></p>
<javascript><react-native>
2019-03-18 18:33:50
LQ_CLOSE
55,228,058
How can I make an Array of shapes and put them into my scene?
<p>I've been working on my personal JavaFX project and with it learning JavaFX, I wanted to know if there is a way I could make an array of Rectangles and add them to my scene?</p>
<java>
2019-03-18 18:41:42
LQ_CLOSE
55,228,102
React hook useEffect dependency array
<p>I trying to wrap my head around the new hooks api of react. Specifically, I'm trying to construct the classic use case that once was the following: </p> <pre><code>componentDidUpdate(prevProps) { if (prevProps.foo !== this.props.foo) { // animate dom elements here... this.animateSomething(this.ref, this.props.onAnimationComplete); } } </code></pre> <p>Now, I tried to build the same with a function component and <code>useEffect</code>, but can't figure out how to do it. This is what I tried:</p> <pre><code>useEffect(() =&gt; { animateSomething(ref, props.onAnimationComplete); }, [props.foo]); </code></pre> <p>This way, the effect is only called when props.foo changes. And that does work – BUT! It appears to be an anti-pattern since the <code>eslint-plugin-react-hooks</code> marks this as an error. All dependencies that are used inside the effect should be declared in the dependencies array. So that means I would have to do the following:</p> <pre><code>useEffect(() =&gt; { animateSomething(ref, props.onAnimationComplete); }, [props.foo, ref, props.onAnimationComplete]); </code></pre> <p>That does not lead to the linting error BUT it totally defeats the purpose of <em>only</em> calling the effect when <code>props.foo</code> changes. I don't WANT it to be called when the other props or the ref change.</p> <p>Now, I read something about using <code>useCallback</code> to wrap this. I tried it but didn't get any further.</p> <p>Can somebody help?</p>
<javascript><reactjs><react-hooks>
2019-03-18 18:45:01
HQ
55,228,289
Converting an array of integers into an array of binary code in Python
<p>I'm new in Python and need to convert an array of integers into one in binary code.</p> <pre><code>s_str = "test" s_acii = [ord(c) for c in s_str] print(s_acii) &gt;&gt; [116, 101, 115, 116] </code></pre> <p>What I need:</p> <pre><code>&gt;&gt; [1110100, 1100101, 1110011, 1110100] </code></pre> <p>Thanks!</p>
<python>
2019-03-18 18:56:08
LQ_CLOSE
55,230,628
Is there a way to speedup npm ci using cache?
<p>for now <code>npm ci</code> is the most common way to install node modules when using CI. But it is honestly really slow. Is there a way to speedup <code>npm ci</code> using cache or do not fully remove existing packages (whole node_modules folder)?</p>
<node.js><caching><npm><continuous-integration>
2019-03-18 21:57:00
HQ
55,231,472
Hi everyone, My question is related to lists in python 3.I have a list of strings which looks like this:
list_of_string = [C1,D1,H14,J14,Y14.....AM20,AN20,DB33] this list contain approx. 4000 elements (strings). Now I want to create another list which should look like this: new_list = [02C102D103H1403J1403Y14 upto 04AM2004AN2004DB33] where 02 refers to the length of the first element C1. 02 the length of second element D1. so on and so forth till 04 which is the length of the last element DB33 etc etc. I am struggling with the creation of new_list. Please help me with the same. After this i want to convert new_list into bytearray which I will do like this: new_list_1 = new_list.encoding() # this will convert my new string to bytes new_list_bytearray = bytearray(new_list_1) # which will give me the desired byte array. I am struggling with the creation of new_list. Any help would be appriciated thanks! # new to python. #new to programming.
<python><arrays><list><split><append>
2019-03-18 23:18:28
LQ_EDIT
55,232,320
Generate timestamp for each ID in R in ascending order
<p>I tried to generate timestamp in R for my data and I'm having problem to create them in order where each ID will take group of timestamp for the period of 14 days and I need to create them in ascending order.</p> <p>My data looks like :</p> <pre><code>ID Lat Long Traffic Time 1 -80.424 40.4242 54 1am 2 -80.114 40.4131 30 1am 3 -80.784 40.1142 12 1am 1 -80.424 40.4242 22 2am 2 -80.114 40.4131 31 2am 3 -80.784 40.1142 53 2am </code></pre> <p>And I want my data to be like this :</p> <pre><code>ID Lat Long Traffic Time_New 1 -80.424 40.4242 54 2018/01/01 01:00 2 -80.114 40.4131 30 2018/01/01 01:00 3 -80.784 40.1142 12 2018/01/01 01:00 1 -80.424 40.4242 22 2018/01/02 02:00 2 -80.114 40.4131 31 2018/01/02 02:00 3 -80.784 40.1142 53 2018/01/02 02:00 </code></pre> <p>I used the code below to 24 hrs for each ID for the period time of 2 weeks but I got this output but the order of the timestamp is not what I want plus it added the value of traffic from the previous values and I want to generate the new values of the new timestamp based on the average of the traffic flow of each ID.</p> <pre><code>library(data.table) Data&lt;- setDT(Data)[, .SD[rep(1:.N, ID)]][,Time_New:= seq(as.POSIXct("2018-01-01 01:00"), as.POSIXct("2018-01-14 00:00"),by = "hour"),by = .(Lat, Long)][] ID Lat Long Traffic Time_New Time 1 -80.424 40.4242 54 2018/01/01 01:00 1am 2 -80.114 40.4131 30 2018/01/01 01:00 1am 3 -80.784 40.1142 12 2018/01/01 01:00 1am 1 -80.424 40.4242 54 2018/01/02 02:00 2am 2 -80.114 40.4131 54 2018/01/02 03:00 2am 1 -80.424 40.4242 54 2018/01/01 02:00 2am 2 -80.114 40.4131 54 2018/01/01 03:00 2qm 3 -80.784 40.1142 30 2018/01/01 01:00 3am 3 -80.784 40.1142 30 2018/01/01 02:00 3am 3 -80.784 40.1142 30 2018/01/01 03:00 3am </code></pre> <p>As you see It listed the first 3 IDs in the order I want then, it starts repeating ID 1, 2 and for ID 3 it put list of time from 1-3, and copy same traffic value.</p> <p>Anyone has idea how to do generate the timestamp for each Id group in ascending order?</p> <p>it will be much appreciated. </p>
<r><time><timestamp><time-series><id>
2019-03-19 01:16:55
LQ_CLOSE
55,232,819
Error in converting varchar to float in mssql server 2012
I have imported large excel sheet in my sql db and all columns are by default varchar datatype. I want to select sale volume in float(double) which is in varchar format. My query is like this but i still get converting error. How can I overcome this conversion error? select [CompanyCode] as 'Company Code', [Sitecode] as 'Site Code', [Product] as 'Product Name', '' as 'Tank ID', CONVERT(date, [InvDay]) as Date, CAST([Sales] as decimal) as 'Sale Volume', '' as 'Record ID' From [dbo].[2019-01]
<sql-server>
2019-03-19 02:35:53
LQ_EDIT
55,232,880
Faster way to convert a vector of vectors to a single contiguous vector with opposite storage order
<p>I have a <code>std::vector&lt;std::vector&lt;double&gt;&gt;</code> that I am trying to convert to a single contiguous vector as fast as possible. My vector has a shape of roughly <code>4000 x 50</code>. </p> <p>The problem is, sometimes I need my output vector in column-major contiguous order (just concatenating the interior vectors of my 2d input vector), and sometimes I need my output vector in row-major contiguous order, effectively requiring a transpose. </p> <p>I have found that a naive for loop is quite fast for conversion to a column-major vector:</p> <pre><code>auto to_dense_column_major_naive(std::vector&lt;std::vector&lt;double&gt;&gt; const &amp; vec) -&gt; std::vector&lt;double&gt; { auto n_col = vec.size(); auto n_row = vec[0].size(); std::vector&lt;double&gt; out_vec(n_col * n_row); for (size_t i = 0; i &lt; n_col; ++i) for (size_t j = 0; j &lt; n_row; ++j) out_vec[i * n_row + j] = vec[i][j]; return out_vec; } </code></pre> <p>But obviously a similar approach is very slow for row-wise conversion, because of all of the cache misses. So for row-wise conversion, I thought a blocking strategy to promote cache locality might be my best bet:</p> <pre><code>auto to_dense_row_major_blocking(std::vector&lt;std::vector&lt;double&gt;&gt; const &amp; vec) -&gt; std::vector&lt;double&gt; { auto n_col = vec.size(); auto n_row = vec[0].size(); std::vector&lt;double&gt; out_vec(n_col * n_row); size_t block_side = 8; for (size_t l = 0; l &lt; n_col; l += block_side) { for (size_t k = 0; k &lt; n_row; k += block_side) { for (size_t j = l; j &lt; l + block_side &amp;&amp; j &lt; n_col; ++j) { auto const &amp;column = vec[j]; for (size_t i = k; i &lt; k + block_side &amp;&amp; i &lt; n_row; ++i) out_vec[i * n_col + j] = column[i]; } } } return out_vec; } </code></pre> <p>This is considerably faster than a naive loop for row-major conversion, but still almost an order of magnitude slower than naive column-major looping on my input size. </p> <p><a href="https://i.stack.imgur.com/YfgCj.png" rel="noreferrer"><img src="https://i.stack.imgur.com/YfgCj.png" alt="enter image description here"></a></p> <p><strong>My question is</strong>, is there a faster approach to converting a (column-major) vector of vectors of doubles to a single contiguous row-major vector? I am struggling to reason about what the limit of speed of this code should be, and am thus questioning whether I'm missing something obvious. My assumption was that blocking would give me a <em>much</em> larger speedup then it appears to actually give. </p> <hr> <p>The chart was generated using QuickBench (and somewhat verified with GBench locally on my machine) with this code: (Clang 7, C++20, -O3)</p> <pre><code>auto to_dense_column_major_naive(std::vector&lt;std::vector&lt;double&gt;&gt; const &amp; vec) -&gt; std::vector&lt;double&gt; { auto n_col = vec.size(); auto n_row = vec[0].size(); std::vector&lt;double&gt; out_vec(n_col * n_row); for (size_t i = 0; i &lt; n_col; ++i) for (size_t j = 0; j &lt; n_row; ++j) out_vec[i * n_row + j] = vec[i][j]; return out_vec; } auto to_dense_row_major_naive(std::vector&lt;std::vector&lt;double&gt;&gt; const &amp; vec) -&gt; std::vector&lt;double&gt; { auto n_col = vec.size(); auto n_row = vec[0].size(); std::vector&lt;double&gt; out_vec(n_col * n_row); for (size_t i = 0; i &lt; n_col; ++i) for (size_t j = 0; j &lt; n_row; ++j) out_vec[j * n_col + i] = vec[i][j]; return out_vec; } auto to_dense_row_major_blocking(std::vector&lt;std::vector&lt;double&gt;&gt; const &amp; vec) -&gt; std::vector&lt;double&gt; { auto n_col = vec.size(); auto n_row = vec[0].size(); std::vector&lt;double&gt; out_vec(n_col * n_row); size_t block_side = 8; for (size_t l = 0; l &lt; n_col; l += block_side) { for (size_t k = 0; k &lt; n_row; k += block_side) { for (size_t j = l; j &lt; l + block_side &amp;&amp; j &lt; n_col; ++j) { auto const &amp;column = vec[j]; for (size_t i = k; i &lt; k + block_side &amp;&amp; i &lt; n_row; ++i) out_vec[i * n_col + j] = column[i]; } } } return out_vec; } auto to_dense_column_major_blocking(std::vector&lt;std::vector&lt;double&gt;&gt; const &amp; vec) -&gt; std::vector&lt;double&gt; { auto n_col = vec.size(); auto n_row = vec[0].size(); std::vector&lt;double&gt; out_vec(n_col * n_row); size_t block_side = 8; for (size_t l = 0; l &lt; n_col; l += block_side) { for (size_t k = 0; k &lt; n_row; k += block_side) { for (size_t j = l; j &lt; l + block_side &amp;&amp; j &lt; n_col; ++j) { auto const &amp;column = vec[j]; for (size_t i = k; i &lt; k + block_side &amp;&amp; i &lt; n_row; ++i) out_vec[j * n_row + i] = column[i]; } } } return out_vec; } auto make_vecvec() -&gt; std::vector&lt;std::vector&lt;double&gt;&gt; { std::vector&lt;std::vector&lt;double&gt;&gt; vecvec(50, std::vector&lt;double&gt;(4000)); std::mt19937 mersenne {2019}; std::uniform_real_distribution&lt;double&gt; dist(-1000, 1000); for (auto &amp;vec: vecvec) for (auto &amp;val: vec) val = dist(mersenne); return vecvec; } static void NaiveColumnMajor(benchmark::State&amp; state) { // Code before the loop is not measured auto vecvec = make_vecvec(); for (auto _ : state) { benchmark::DoNotOptimize(to_dense_column_major_naive(vecvec)); } } BENCHMARK(NaiveColumnMajor); static void NaiveRowMajor(benchmark::State&amp; state) { // Code before the loop is not measured auto vecvec = make_vecvec(); for (auto _ : state) { benchmark::DoNotOptimize(to_dense_row_major_naive(vecvec)); } } BENCHMARK(NaiveRowMajor); static void BlockingRowMajor(benchmark::State&amp; state) { // Code before the loop is not measured auto vecvec = make_vecvec(); for (auto _ : state) { benchmark::DoNotOptimize(to_dense_row_major_blocking(vecvec)); } } BENCHMARK(BlockingRowMajor); static void BlockingColumnMajor(benchmark::State&amp; state) { // Code before the loop is not measured auto vecvec = make_vecvec(); for (auto _ : state) { benchmark::DoNotOptimize(to_dense_column_major_blocking(vecvec)); } } BENCHMARK(BlockingColumnMajor); </code></pre>
<c++><performance><caching><vector>
2019-03-19 02:43:19
HQ
55,234,751
why i the pointer is not a structure or union?
<pre><code>#include &lt;stdio.h&gt; struct m_tag { short m_tag_id; short m_tag_len; int m_tag_cookie; }; struct packet_tags { struct m_tag *slh_first; }tags; #define SFIRST(head) ((head).slh_first) int main(void) { printf("%p\n", SFIRST(&amp;tags)); return 0; } </code></pre> <p>In function 'main': error: request for member 'slh_first' in something not a structure or union </p> <p>what is the problem with this code?</p>
<c++><c>
2019-03-19 06:18:44
LQ_CLOSE
55,235,177
unable to create criteria query with dynaic value
i am trying to > create critera query with dynamic fields CriteriaBuilder cb = entityManager.getCriteriaBuilder(); javax.persistence.criteria.CriteriaQuery cq = cb.createQuery(); Root<Abc> abc = cq.from(Abc.class); List<Selection<?>> selectList = new ArrayList<Selection<?>>(); if(id!= null){ selectList.add(cq.select(abc.get("id")); } if(summary!=null){ selectionList.add(cq.select(abc.get("summary")); } cq.multiselect(selectList) the above code gives syntax error
<java><spring><spring-boot><jpa>
2019-03-19 06:53:54
LQ_EDIT
55,235,230
tensorflow: Please use `rate` instead of `keep_prob`. Rate should be set to `rate = 1 - keep_prob`
<p>I get this warning most of the time when i define a model using Keras. It seems to somehow come from tensorflow though:</p> <pre><code>WARNING:tensorflow:From C:\Users\lenik\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\backend\tensorflow_backend.py:3445: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version. Instructions for updating: Please use `rate` instead of `keep_prob`. Rate should be set to `rate = 1 - keep_prob`. </code></pre> <p>Is this warning something to worry about? If yes, how do i solve this problem?</p>
<python><tensorflow><keras><deep-learning>
2019-03-19 06:58:16
HQ
55,235,825
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65
<p>I've build a react-native application and suddenly I get this error message on my terminal during run of the command react-native run-ios. The same code work fine 10 minutes ago and suddenly I get this error message. Please help...</p>
<xcode><react-native>
2019-03-19 07:46:32
HQ
55,235,948
For loop with a variable upper bound
i wanted to make a for loop in python with a variable upper bound which is the length of list, the size of which is modified inside the loop. like this : l = [1,2,3,4,5,6] for i in range(len(l)): del l[i] thank you
<python><python-3.x>
2019-03-19 07:55:25
LQ_EDIT
55,236,558
How to make string pass from onclick to a function?
<p>My string is like this</p> <pre><code>sakjgbsd aksdg's ad asidg's iasudgbsb </code></pre> <p>but when i print the string in function it prints only</p> <pre><code> sakjgbsd aksdg </code></pre> <p>the part after (') is not printing</p> <p>here is how i send data</p> <pre><code>&lt;a href='#' data-status='" + data[i][col[j]] + "' " + "onclick='submit(this)'&gt;Click Here&lt;/a&gt; </code></pre> <p>here is Function</p> <pre><code>function submit(str) { var status = $(str).attr("data-status"); alert(status) } </code></pre>
<javascript>
2019-03-19 08:36:01
LQ_CLOSE
55,237,006
How to call a named constructor from a generic function in Dart/Flutter
<p>I want to be able to construct an object from inside a generic function. I tried the following:</p> <pre><code>abstract class Interface { Interface.func(int x); } class Test implements Interface { Test.func(int x){} } T make&lt;T extends Interface&gt;(int x) { // the next line doesn't work return T.func(x); } </code></pre> <p>However, this doesn't work. And I get the following error message: <code>The method 'func' isn't defined for the class 'Type'</code>.</p> <p><strong>Note</strong>: I cannot use mirrors because I'm using dart with flutter.</p>
<generics><constructor><dart><flutter>
2019-03-19 09:00:16
HQ
55,237,149
Position:absolute, position:relative doesnt work
I want announce on the top and header in the bottom but this is the output in every browser what am i doing wrong here [enter image description here][1] [1]: https://i.stack.imgur.com/ZsoSf.png this is my html code: https://hastebin.com/bocacehoka.js this is my css code: https://hastebin.com/zapegulomu.css
<html><css>
2019-03-19 09:09:07
LQ_EDIT
55,238,029
hello sir multiple tables how to fetch data in single query
SELECT tbl_category.`cat_name` AS tbl_category_cat_name, registration.`firm_name` AS registration_firm_name, tbl_prod.`prod_name` AS tbl_prod_prod_name, tbl_prod.`prod_desc` AS tbl_prod_prod_desc, tbl_prod.`prod_size` AS tbl_prod_prod_size, tbl_prod.`prod_prate` AS tbl_prod_prod_prate, tbl_prod.`prod_mrp` AS tbl_prod_prod_mrp, tbl_prod.`prod_srate` AS tbl_prod_prod_srate, tbl_unit.`unit` AS tbl_unit_unit, tbl_brand.`bnd_name` AS tbl_brand_bnd_name FROM `tbl_category` tbl_category, `registration` registration, `tbl_prod` tbl_prod, `tbl_unit` tbl_unit, `tbl_brand` tbl_brand
<java>
2019-03-19 09:52:49
LQ_EDIT
55,238,121
how can merge two Expression<Func<T, T>
i have two expression like this : Expression<Func<T, T> exp1 = x => new T { Id = 1 , Name = "string"} Expression<Func<T, T> exp1 = x => new T { Age = 21 } how can merge them : result : Expression<Func<T, T> exp1 = x => new T { Id = 1 , Name = "string" , Age = 21}
<c#><asp.net><expression>
2019-03-19 09:56:24
LQ_EDIT
55,240,477
different hover colors required for different sections of a single image
<p>Good day everyone, I'm having difficulty with applying hover styles for an image. The image is having an irregular shape plus each section when hovered needs to have a different hover color.<a href="https://i.stack.imgur.com/nQWri.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nQWri.jpg" alt="enter image description here"></a> Many thanks.</p>
<javascript><php><html><css><hover>
2019-03-19 11:55:11
LQ_CLOSE
55,240,534
Concatinating stream in it's own forEach loop
Example 1: public TailCall<TestClass> useOfStream(Stream<Test> streamL) { ArrayList<Test> testList2 = new ArrayList<>(); Stream<Test> streamL2 = testList2.stream(); streamL.forEach(test -> { for (int i = 1; i < 14; i++) { if (/*insert if statement*/) { Test test2 = new Test(); Stream<Test> streamT = stream.Of(test2); **streamL2.concat(streamL2, streamT);** } else { //do something with TestClass } } }); if (streamL2.findAny().isPresent()) { return call(() -> useOfStream(streamL2)); } else { return TailCalls.done(TestClass); } } So, for a certain element in streamL I can possibly make up to 13 same-class elements. These newly made elements (that I've added to streamL2) should be iterated over the same way streamL was iterated over. Is there a possibility of adding those new elements to streamL? Doing: streamL.forEach(test -> { for (int i = 1; i < 14; i++) { if (/*insert if statement*/) { Test test2 = new Test(); Stream<Test> streamT = stream.Of(test2); **streamL.concat(streamL, streamT);** } else { //do something with TestClass } } }); If it's even possible to concat a stream within it's own for-Each loop, would the forEach loop also go through those newly added elements? That would eliminate my need of a recursive method. Another question is, will an object made within a stream (for ex. `Test test2 = new Test();` in the forEach loop of streamL) be processed lazily by the program? With other words, would this object take any place in the memory heap? (but this question is not that important, primarly my first question)
<java><foreach><java-stream>
2019-03-19 11:57:56
LQ_EDIT
55,240,585
Compare XML files from two folders
<p>Is there anyway to compare XML files (having same name) saved in two different folders and find the difference between them? I would like to compare multiple XML files stored in different folders for testing purposes. I'm happy to explore this in any language such as Java, Groovy script, python etc.,</p> <p>Please add your thoughts. Greatly appreciate your help!</p>
<java><python><xml><groovy><compare>
2019-03-19 12:01:34
LQ_CLOSE
55,241,169
Insert a Row inside a Column in Flutter
<p>My UI screen is basically rendered using a Column Widget and inside this widget, I am inserting all the other UI components. One of these happens to be a Row ( consisting of 2 text fields). This is the Row Widget :</p> <pre><code>var phoneNumber = new Row( children: &lt;Widget&gt;[ new Padding( padding: const EdgeInsets.all(20.0), child: countryCodePicker, ), new Padding( padding: const EdgeInsets.all(20.0), child: mobileNumber, ), ], ); </code></pre> <p>The Main UI Screen being :</p> <pre><code> return SafeArea( child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: &lt;Widget&gt;[ customerName, emailAddress, // new Container( // child: deliveryOptionRow, // ), mobileNumber, countryCodePicker, templateMessagesDropDown, templateMessageTextField, sendGoogleReview, ], ) ); </code></pre> <p>I see this exception when I add the Row to the Column</p> <pre><code> The following RenderObject was being processed when the exception was fired: flutter: _RenderListTile#06b03 relayoutBoundary=up11 NEEDS-LAYOUT NEEDS-PAINT flutter: creator: _ListTile ← MediaQuery ← Padding ← SafeArea ← Semantics ← Listener ← _GestureSemantics ← flutter: RawGestureDetector ← GestureDetector ← InkWell ← ListTile ← ListTileTheme ← ⋯ flutter: parentData: offset=Offset(0.0, 0.0) (can use size) flutter: constraints: BoxConstraints(unconstrained) flutter: size: MISSING flutter: This RenderObject had the following descendants (showing up to depth 5): flutter: _RenderRadio#302a4 relayoutBoundary=up12 NEEDS-PAINT flutter: RenderParagraph#58a45 NEEDS-LAYOUT NEEDS-PAINT </code></pre> <p>What would be the best way to add the row inside the main UI screen. </p>
<flutter><flutter-layout>
2019-03-19 12:32:15
HQ
55,242,327
Cloud Foundry - How to fetch all apps running across Orgs?
Using `cf cli`, I can login with a specific org(as option) and get the list of apps across spaces in that specific org. `cf login --skip-ssl-validation -a <URL> -u <user_name> -p <password> -o <org_name> -s <space>` ----------------------------------------------------- Org names can be increasing/decreasing, as multiple users access app manager To write a custom tool to get list of all `Running` apps(and its details) across orgs, does cloud foundry provide any API?
<cloudfoundry><pivotal-cloud-foundry>
2019-03-19 13:35:37
LQ_EDIT
55,242,347
teacher told me not to use static/dynamic vector pointer
<p>But what are those exactly? Is...</p> <pre class="lang-cpp prettyprint-override"><code>vector&lt;float&gt; Vec; Vec.push_back(2); </code></pre> <p>a pointer? If so, what other options can I use instead if I want to implement lists/vectors/arrays.</p> <p>And for my own information: Are pointers a bad way to code or kinda outdated? </p>
<c++><pointers>
2019-03-19 13:36:41
LQ_CLOSE
55,243,365
how to display text and number side by side in plsql
I need to achieve the required output Total=20 but when i try select 'total=',sum(score) from table; it gives the output as Total= 20
<sql><oracle><plsql>
2019-03-19 14:29:03
LQ_EDIT
55,244,995
Python: Access members of a function from outside that function
<p>Say I had two functions, one belonging to another like so.</p> <pre><code>def foo(): def bar(): print("im bar") print("im foo and can call bar") print("i can call foo, but not bar?") </code></pre> <p>How would refer to or call bar? Would I do <code>foo.bar()</code>?</p> <p>If <code>bar</code> were not a function like if <code>bar = 1</code> then how would I access that?</p> <p>I'm aware I could move <code>bar</code> out of <code>foo</code> but is there any other way?</p>
<python><scope>
2019-03-19 15:48:51
LQ_CLOSE
55,245,542
What should I do to make low loss average?
I'm an student in hydraulic engineering, working on a neural network in my internship so it's something new for me. I created my neural network but it gives me a high loss and I don't know what is the problem ... you can see the code : def create_model(): model = Sequential() # Adding the input layer model.add(Dense(26,activation='relu',input_shape=(n_cols,))) # Adding the hidden layer model.add(Dense(60,activation='relu')) model.add(Dense(60,activation='relu')) model.add(Dense(60,activation='relu')) # Adding the output layer model.add(Dense(2)) # Compiling the RNN model.compile(optimizer='adam', loss='mean_squared_error', metrics=['accuracy']) return model kf = KFold(n_splits = 5, shuffle = True) model = create_model() scores = [] for i in range(5): result = next(kf.split(data_input), None) input_train = data_input[result[0]] input_test = data_input[result[1]] output_train = data_output[result[0]] output_test = data_output[result[1]] # Fitting the RNN to the Training set model.fit(input_train, output_train, epochs=5000, batch_size=200 ,verbose=2) predictions = model.predict(input_test) scores.append(model.evaluate(input_test, output_test)) print('Scores from each Iteration: ', scores) print('Average K-Fold Score :' , np.mean(scores)) And whene I execute my code, the result is like : Scores from each Iteration: [[93.90406122928908, 0.8907562990148529], [89.5892979597845, 0.8907563030218878], [81.26530176050522, 0.9327731132507324], [56.46526102659081, 0.9495798339362905], [54.314151876112994, 0.9579831877676379]] Average K-Fold Score : 38.0159922589274 Can anyone help me please ? how could I do to make the loss low ?
<python><machine-learning><keras><deep-learning><neural-network>
2019-03-19 16:16:14
LQ_EDIT
55,246,188
Importing BMP file in Turboc++ issue:BMP file is not being displayed in the output screen
I am trying to import Rama.BMP file in the graphics window of TurboC++, for this its source code is as follows(NOTE: I have not mentioned the header files in the source code): struct A { char type[2]; unsigned long size; unsigned short int reserved1,reserved2; unsigned long offset; unsigned long width,height; unsigned short int planes; unsigned short int bits; unsigned long compression; unsigned long imagesize; unsigned long xresolution,yresolution; unsigned long ncolors; unsigned long importantcolors; }HEADER; huge DetectSvga() { return 2; } void show() { fstream File; File.open("C:\\TURBOC3\\BIN\\Rama.BMP",ios::in); char ch; File.read((char*)&HEADER,sizeof(HEADER)); unsigned int i; char ColorBytes[4]; char *PaletteData; PaletteData=new char[256*3]; if(PaletteData) { for(i=0;i<256;i++) { File.read(ColorBytes,4); PaletteData[(int)(i*3+2)]=ColorBytes[0]>>2; PaletteData[(int)(i*3+0)]=ColorBytes[2]>>2; } outp(0x03c8,0); for(i=0;i<256*3;i++) outp(0x03c9,PaletteData[i]); delete[]PaletteData; } for(i=0;i<HEADER.height;i++) { for(int j=0;j<HEADER.width;) { File.read(&ch,1); putpixel(0+(j++),0+HEADER.height-i-1,ch); } } File.close(); } void main() { clrscr(); int gd=DETECT,gm,a; initgraph(&gd,&gm,"C:\\TURBOC3\\BGI"); installuserdriver("svga256",&DetectSvga); show(); getch(); closegraph(); } Now, i am not getting the BMP file in the graphics window, i.e, Graphics Window is not displaying Rama.bmp so how to fix it? Any help...
<c++><bmp><file-format><turbo-c++><bgi>
2019-03-19 16:49:59
LQ_EDIT
55,247,102
JS setTimeout Not Delayed
<p>I'm trying to put a delay in <strong>front</strong> of an <code>AJAX</code> call. </p> <pre><code>var delay = 2000; $("#c_name").on("keyup", function() { var entered = $(this).val(); if (entered.length &gt; 1) { setTimeout(dosearch(entered), delay) } }); </code></pre> <p>Fo some reason I can't seem to get <code>setTimeout</code> to take hold. It's performing the <code>dosearch()</code> function instantly. </p> <p>How can I get this to delay properly? Yes <code>JQuery 3.3.1</code> is loaded up top. </p>
<javascript><jquery><settimeout>
2019-03-19 17:47:17
LQ_CLOSE
55,247,311
"If statement doesn't work as intended even though it's logically correct"
<p>I was working on Android Studio to create a simple app(game) and my problem is like: I've added two touch events for two separate views, if statement doesn't seem to work properly inside the touch event. Here's my code I would be so happy if you could help!</p> <p>Here is MainActivity.java code:</p> <pre><code>package com.example.splitapp; import android.graphics.Color; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.MotionEvent; import android.view.View; import android.widget.RelativeLayout; public class MainActivity extends AppCompatActivity { private RelativeLayout rel1 = null; private RelativeLayout rel2 = null; private int countA = 0; private int countB = 0; private boolean end = false; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); rel1 = (RelativeLayout) findViewById(R.id.rel1); rel2 = (RelativeLayout) findViewById(R.id.rel2); rel1.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if(!end) { countA = countA+1; countB = countB-1; if(countA == 10 &amp;&amp; countB &lt; 10){ rel1.setBackgroundColor(Color.parseColor("#00FF00")); rel2.setBackgroundColor(Color.parseColor("#FF0000")); end = true; } } else { countA = 0; countB = 0; rel1.setBackgroundColor(Color.parseColor("#BA55D3")); rel2.setBackgroundColor(Color.parseColor("#8A2BE2")); end = false; } return true; } }); rel2.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if(!end) { countB++; countA--; if(countB == 10 &amp;&amp; countA &lt; 10) { rel1.setBackgroundColor(Color.parseColor("#FF0000")); rel2.setBackgroundColor(Color.parseColor("#00FF00")); end = true; } } else { countA = 0; countB = 0; rel1.setBackgroundColor(Color.parseColor("#BA55D3")); rel2.setBackgroundColor(Color.parseColor("#8A2BE2")); end = false; } return true; } }); } } </code></pre> <p>And here is my activity_main.xml code:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:baselineAligned="false" android:orientation="vertical" tools:context=".MainActivity"&gt; &lt;RelativeLayout android:id="@+id/rel1" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="bottom" android:layout_weight="1" android:background="#BA55D3"&gt;&lt;/RelativeLayout&gt; &lt;RelativeLayout android:id="@+id/rel2" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:background="#8A2BE2"&gt;&lt;/RelativeLayout&gt; &lt;/LinearLayout&gt; </code></pre>
<java><android><if-statement>
2019-03-19 18:00:58
LQ_CLOSE
55,247,359
Solving PDE with implicit euler in python - incorrect output
<p>I will try and explain exactly what's going on and my issue.</p> <p>This is a bit mathy and SO doesn't support latex, so sadly I had to resort to images. I hope that's okay.</p> <p><a href="https://i.stack.imgur.com/W2ytK.png" rel="noreferrer"><img src="https://i.stack.imgur.com/W2ytK.png" alt="enter image description here"></a></p> <p><a href="https://i.stack.imgur.com/7txtE.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/7txtE.jpg" alt="enter image description here"></a></p> <p>I don't know why it's inverted, sorry about that. At any rate, this is a linear system Ax = b where we know A and b, so we can find x, which is our approximation at the next time step. We continue doing this until time t_final.</p> <p>This is the code</p> <pre><code>import numpy as np tau = 2 * np.pi tau2 = tau * tau i = complex(0,1) def solution_f(t, x): return 0.5 * (np.exp(-tau * i * x) * np.exp((2 - tau2) * i * t) + np.exp(tau * i * x) * np.exp((tau2 + 4) * i * t)) def solution_g(t, x): return 0.5 * (np.exp(-tau * i * x) * np.exp((2 - tau2) * i * t) - np.exp(tau * i * x) * np.exp((tau2 + 4) * i * t)) for l in range(2, 12): N = 2 ** l #number of grid points dx = 1.0 / N #space between grid points dx2 = dx * dx dt = dx #time step t_final = 1 approximate_f = np.zeros((N, 1), dtype = np.complex) approximate_g = np.zeros((N, 1), dtype = np.complex) #Insert initial conditions for k in range(N): approximate_f[k, 0] = np.cos(tau * k * dx) approximate_g[k, 0] = -i * np.sin(tau * k * dx) #Create coefficient matrix A = np.zeros((2 * N, 2 * N), dtype = np.complex) #First row is special A[0, 0] = 1 -3*i*dt A[0, N] = ((2 * dt / dx2) + dt) * i A[0, N + 1] = (-dt / dx2) * i A[0, -1] = (-dt / dx2) * i #Last row is special A[N - 1, N - 1] = 1 - (3 * dt) * i A[N - 1, N] = (-dt / dx2) * i A[N - 1, -2] = (-dt / dx2) * i A[N - 1, -1] = ((2 * dt / dx2) + dt) * i #middle for k in range(1, N - 1): A[k, k] = 1 - (3 * dt) * i A[k, k + N - 1] = (-dt / dx2) * i A[k, k + N] = ((2 * dt / dx2) + dt) * i A[k, k + N + 1] = (-dt / dx2) * i #Bottom half A[N :, :N] = A[:N, N:] A[N:, N:] = A[:N, :N] Ainv = np.linalg.inv(A) #Advance through time time = 0 while time &lt; t_final: b = np.concatenate((approximate_f, approximate_g), axis = 0) x = np.dot(Ainv, b) #Solve Ax = b approximate_f = x[:N] approximate_g = x[N:] time += dt approximate_solution = np.concatenate((approximate_f, approximate_g), axis=0) #Calculate the actual solution actual_f = np.zeros((N, 1), dtype = np.complex) actual_g = np.zeros((N, 1), dtype = np.complex) for k in range(N): actual_f[k, 0] = solution_f(t_final, k * dx) actual_g[k, 0] = solution_g(t_final, k * dx) actual_solution = np.concatenate((actual_f, actual_g), axis = 0) print(np.sqrt(dx) * np.linalg.norm(actual_solution - approximate_solution)) </code></pre> <p>It doesn't work. At least not in the beginning, it shouldn't start this slow. I should be unconditionally stable and converge to the right answer.</p> <p>What's going wrong here?</p>
<python><algorithm><numerical-methods><pde>
2019-03-19 18:04:12
HQ
55,247,388
Why is my code wrong ?? -> How to determine if an int is perfect square?
My code seems to pass many cases, but my codes seem to fail a particular private test case. Can anyone help me ? static boolean isSquare(int n) { IntStream y=IntStream.range(1, n).map(((int x)->{return x*x;})); return y.anyMatch(x->(x==n)); }
<java><lambda><java-8><java-stream>
2019-03-19 18:05:37
LQ_EDIT
55,247,551
C++ pointer not storing value
<pre><code>word word::Addstr(char * &amp;arr) { char * baka = nullptr; if (sent != nullptr) { baka = new char[size + strlen(arr) + 3]; for (int i = 0; i &lt; size; i++) { baka[i] = sent[i]; } baka[size] = ' '; int a = 0; for (int i = size +2; i &lt; size + strlen(arr) + 3; i++) { baka[i] = arr[a]; a++; } } else { baka = new char[strlen(arr) + 1]; for (int i = 0; i &lt; strlen(arr) + 1; i++) { baka[i] = arr[i]; } } word ustad(baka); return ustad; } </code></pre> <p>Here in the second loop char *baka is not storing arr[]'s value. I have sent the char pointer by reference yet still it's not working.</p> <pre><code>for (int i = size +2; i &lt; size + strlen(arr) + 3; i++) { baka[i] = arr[a]; a++; } </code></pre> <p>The constructors and all other things are accurate. Baka stores value in the first loop but in the second one it doesn't. Even here:</p> <pre><code>baka[size] = ' '; </code></pre> <p>Can someone pleases help with this!</p>
<c++>
2019-03-19 18:15:14
LQ_CLOSE
55,248,483
React ref.current is null
<p>I'm working on an agenda/calendar app with a variable time range. To display a line for the current time and show blocks for appointments that have been made, I need to calculate how many pixels correspond with one minute inside the given time range.</p> <p>So for example: If the agenda starts at 7 o'clock in the morning and ends at 5 o'clock in the afternoon, the total range is 10 hours. Let's say that the body of the calendar has a height of 1000 pixels. That means that every hour stands for 100 pixels and every minute for 1,66 pixels.</p> <p>If the current time is 3 o'clock in the afternoon. We are 480 minutes from the start of the agenda. That means that the line to show the current time should be at 796,8 pixels (480 * 1,66) from the top of the calendar body.</p> <p>No problems with the calculations but with getting the height of the agenda body. I was thinking to use a React Ref to get the height but I'm getting an error: <code>ref.current is null</code></p> <p>Below some code:</p> <pre><code>class Calendar extends Component { calendarBodyRef = React.createRef(); displayCurrentTimeLine = () =&gt; { const bodyHeight = this.calendarBodyRef.current.clientHeight; // current is null } render() { return ( &lt;table&gt; &lt;thead&gt;{this.displayHeader()}&lt;/thead&gt; &lt;tbody ref={this.calendarBodyRef}&gt; {this.displayBody()} {this.displayCurrentTimeLine()} &lt;/tbody&gt; &lt;/table&gt; ); } } </code></pre>
<reactjs><ref>
2019-03-19 19:14:17
HQ
55,248,909
When using bysort, difference between one or more variables in Stata
When I use the command bysort with just one variable and generate the mean of another variable, I get one set of values e.g. 42,43,39 etc. Case 1. bysort date: egen dailymean = mean(temperature)// Gives mean temp for each day When I use the command bysort with two variables and generate a similar mean, I get a different value e.g. 49,48,51 etc. I want to understand what the values signifiy. Case 2. bysort date isCentralPark: egen cpdailymean = mean(temperature) In the first case, I think I am getting the mean of the temperature by the variable sorted by, date in other words daily mean temperature. In the second, am I getting the daily mean temperature in Central Park or something different?
<sorting><stata>
2019-03-19 19:43:49
LQ_EDIT
55,249,017
Why is implicit conversion not ambiguous for non-primitive types?
<p>Given a simple class template with multiple implicit conversion functions (non-explicit constructor and conversion operator), as in the following example:</p> <pre><code>template&lt;class T&gt; class Foo { private: T m_value; public: Foo(); Foo(const T&amp; value): m_value(value) { } operator T() const { return m_value; } bool operator==(const Foo&lt;T&gt;&amp; other) const { return m_value == other.m_value; } }; struct Bar { bool m; bool operator==(const Bar&amp; other) const { return false; } }; int main(int argc, char *argv[]) { Foo&lt;bool&gt; a (true); bool b = false; if(a == b) { // This is ambiguous } Foo&lt;int&gt; c (1); int d = 2; if(c == d) { // This is ambiguous } Foo&lt;Bar&gt; e (Bar{true}); Bar f = {false}; if(e == f) { // This is not ambiguous. Why? } } </code></pre> <p>The comparison operators involving primitive types (<code>bool</code>, <code>int</code>) are ambiguous, as expected - the compiler does not know whether it should use the conversion operator to convert the left-hand template class instance to a primitive type or use the conversion constructor to convert the right-hand primitive type to the expected class template instance.</p> <p>However, the last comparison, involving a simple <code>struct</code>, is not ambiguous. Why? Which conversion function will be used?</p> <p>Tested with compiler msvc 15.9.7.</p>
<c++><templates><c++17><implicit-conversion><ambiguous>
2019-03-19 19:52:40
HQ
55,249,081
Sum of char value in Multi columns
## Sum of char value in Multi columns ## ---------- - i have multi columns >- columns A1, A2, A3, A4 >- Value .....'H', 'H', 'H', 'H' - **How sum all value as integer**
<delphi><firebird><interbase><ibexpert>
2019-03-19 19:57:53
LQ_EDIT
55,250,588
How can I retrieve the port from a Session
I'm trying the examples from the crust cargo but cannot figure how to obtain the port from a peer I'm connected to. I've got the connection established and can obtain the IP with service.get_peer_ip_addr(&PeerId) but the result has no port. Is there another method to obtain the port? Thanks a lot.
<rust>
2019-03-19 21:57:20
LQ_EDIT
55,252,881
Which of the following are valid C++ variable names?
<p>9index, break, user_name, CONSTANT, _member</p> <p>Got this wrong on a test and I'm wondering where I can find the right answer. Would be highly appreciated. Thanks!</p>
<c++><variables>
2019-03-20 02:54:32
LQ_CLOSE
55,255,084
How to cast from Double to Int?
<p>Suppose I have a <code>Double</code> and I create an <code>Int</code> from the <code>Double</code>:</p> <pre><code>var a : Double = 4.0 var b = Int(a) </code></pre> <p>In the past, the above code could result in <code>b=3</code> if <code>a</code> was internally represented as <code>3.999999999999999</code>. Do we not have to worry about this anymore in Swift? What is the correct way to cast a Double to an Int?</p>
<swift>
2019-03-20 06:56:58
LQ_CLOSE
55,255,195
C++ Makeshift Uber Application
<p>As the title says, this is supposed to be a makeshift Uber-esque application that asks the user for their name, where they're going, how far away it is, and calculates the cost of the trip. I've been stuck with the last two functions for the last hour and I'm not quite sure what my professor is asking me to do. That, and I'm also not sure if I'm on the right track at all. For the last two functions, "double calc_fare" and "void share_fare_info", these are my instructions:</p> <blockquote> <p>In main(), ask the user to enter their full name. Use code as shown below to accept a string with spaces. getline() is a function available to you from iostream. You do not need–should not try–to create it. In main(), ask the user to enter their destination. Destination will be entered as the full street name. Since street address will include spaces, use code similar to what was given in step 1</p> <p>In main(), ask the user if their destination is within city limits. (In a real scenario, the GPS mapping software would be able to determine this based on the destination address. Since we don’t have that ability, we will simply ask the user).</p> <p>In main(), ask the user to enter the distance of the fare. (In a real scenario, the GPS mapping software would be able to determine this based on the destination address. Since we don’t have that ability, we will simply ask the user).</p> <p>Create a function calc_fare(double distance). This function will calculate the fare as follows: A fixed amount of $10 for distances up to 2 miles. $2.50 per mile for distances over 2 miles and up to 5 miles plus a fixed amount of $5.00. Anything over 5 miles will be charged at $3.50 per mile. Return the amount of the fare based on the above rate table.</p> <p>Create a function calc_fare(double distance, double surcharge). This function calls the calc_fare() function in step 5 and returns a value adding the surcharge to the resulting fare.</p> <p>Create a function calc_fare(double distance, bool local). When local is true, it means that the fare is within city limits. When local is false, it means that the fare goes outside city limits, in which case, an additional $50 surcharge will be added to the fare. Call calc_fare() from Step 5 and calc_fare() from Step 6 within this function, depending on the value of local. Note that the functions given in steps 5-7 are overloaded versions of the calc_fare() function.</p> <p>Essentially, what we are doing in this exercise is creating the calc_fare() functions and calling them with driver calls. Drivers-no pun intended since this is a driving simulation-are basically the execution of functions manually to test that they are working, or calculating correctly. The input values of the calc_fare() functions are being entered manually by the user to test them. In a real use case of the functions, they will be called with distances determined by GPS mapping library calls.</p> <p>Create a function called show_fare_info(string name, string destination, double fare, bool local = true). This function will display the information to the user based on the previous user input. This function shows information; what return type is best to use for this function? Call this function from main() to display the final output. This function gives a different message based on the local variable.</p> </blockquote> <p>Sorry for the wall of text, but the instructions are more clear than I can be.</p> <p><strong>My Code so far:</strong> </p> <pre><code> double calc_fare(double distance); double calc_fare(double distance, double surcharge); double calc_fare(double distance, bool local); void show_fare_info(string fullname, string destination, double fare, bool local = true); int main() { string fullname, destination; double distance; char local; cout &lt;&lt; "Please enter your full name: "; getline(cin, fullname); cout &lt;&lt; "Please enter your desired destination: "; getline(cin, destination); cout &lt;&lt; "How far away is this destination from you? "; getline(cin, distance); cout &lt;&lt; "Is your location within city limits (y/n)? :"; cin &gt;&gt; local; if(local == 'y' || local == 'Y') { fare = calc_fare(distance, true); show_fare_info(fullname, destination, fare); } else if(local == 'n' || local == 'N') { fare = calc_fare(distance, false); show_fare_info(fullname, destination, fare, false); } return 0; } double calc_fare(double distance) { int fare; if (distance &lt;= 2) { fare = 10; } else if (distance &lt;= 5 &amp;&amp; distance &gt;= 2) { fare = (distance * 2.50) + 10; } else if (distance &gt; 5) { fare = (distance * 3.50) + 10; } return fare; } double calc_fare(double distance, double surcharge) { surcharge = 50; if (distance == false) { fare = fare + surcharge; } return fare; } double calc_fare(double distance, bool local) { } void show_fare_info(string fullname, string destination, double fare, bool local = true) { } </code></pre> <p>Any help/suggestion is appreciated. As you can probably tell, I'm quite new to this. </p>
<c++>
2019-03-20 07:05:45
LQ_CLOSE
55,255,746
Function components cannot have refs. Did you mean to use React.forwardRef()?
<p>Hi I am trying to choose file form my computer and display the file name on input field but I am getting this error</p> <p>Function components cannot have refs. Did you mean to use React.forwardRef()</p> <p><a href="https://stackblitz.com/edit/react-aogwkt?file=bulk.js" rel="noreferrer">https://stackblitz.com/edit/react-aogwkt?file=bulk.js</a></p> <p>here is my code</p> <pre><code>import React, { Component } from "react"; import { Button, Dialog, DialogActions, DialogContent, DialogTitle, FormControl, IconButton, Input, InputAdornment, withStyles } from "@material-ui/core"; import Attachment from "@material-ui/icons/Attachment"; import CloudDownload from "@material-ui/icons/CloudDownload"; const BulkUpload = props =&gt; { const { classes } = props; return ( &lt;div className="App"&gt; &lt;input id="file_input_file" className="none" type="file" ref={'abc'} /&gt; &lt;Input id="adornment-attachment" type="text" fullWidth endAdornment={ &lt;InputAdornment position="end"&gt; &lt;IconButton aria-label="Toggle password visibility" onClick={e =&gt; { // this.refs['abc'].click(); }} className="login-container__passwordIcon" &gt; &lt;Attachment /&gt; &lt;/IconButton&gt; &lt;/InputAdornment&gt; } /&gt; &lt;/div&gt; ); }; export default BulkUpload; </code></pre> <p>I just wanted to show selected file name on input field</p>
<javascript><reactjs><redux>
2019-03-20 07:44:19
HQ
55,256,547
sort dictionary by number of duplicate values in python
This is my dictionary d={'january': 500, 'feb':600, 'march':300,'april':500,'may':500,'june':600,'july':200} I am expecting output like this d={'january': 500,'april':500,'may':500,'feb':600,'june':600,'march':300,'july':200} When i run this program I am getting different output than expected. d={'january': 500, 'feb':600, 'march':300,'april':500,'may':500,'june':600,'july':200} sortlist=sorted(d, key=d.get) print(sortlist)
<python><sorting><dictionary>
2019-03-20 08:39:07
LQ_EDIT
55,257,334
Fetching the server IP from URL
<p>Suppose I go on to some website from my chrome browser. Is it possible in any programing language like PHP, js to fetch the server IP of a webpage from its URL. (for eg: like we do using NSlookup). Is it possible to write a script to get the server IP of a webpage using its URL.</p>
<javascript><php><url><dns><ip>
2019-03-20 09:22:34
LQ_CLOSE
55,262,267
Does Vue, by default, provide security for or protects against XSS?
<p>I am trying to figure out how to protect,</p> <ul> <li>Angular</li> <li>Vue</li> <li>React</li> </ul> <p>against XSS attacks. When I visit the Angular official docs,</p> <p><a href="https://angular.io/guide/security" rel="noreferrer">https://angular.io/guide/security</a></p> <p>, it says:</p> <blockquote> <p>To systematically block XSS bugs, Angular treats all values as untrusted by default. When a value is inserted into the DOM from a template, via property, attribute, style, class binding, or interpolation, Angular sanitizes and escapes untrusted values.</p> </blockquote> <p>and also:</p> <blockquote> <p>Angular sanitizes untrusted values for HTML, styles, and URLs; sanitizing resource URLs isn't possible because they contain arbitrary code. In development mode, Angular prints a console warning when it has to change a value during sanitization.</p> </blockquote> <p>and:</p> <blockquote> <p>Angular recognizes the value as unsafe and automatically sanitizes it, which removes the tag but keeps safe content such as the element.</p> </blockquote> <p>When I go to the React official docs,</p> <p><a href="https://reactjs.org/docs/introducing-jsx.html#jsx-prevents-injection-attacks" rel="noreferrer">https://reactjs.org/docs/introducing-jsx.html#jsx-prevents-injection-attacks</a></p> <p>,it says the following:</p> <blockquote> <p>It is safe to embed user input in JSX:</p> </blockquote> <p>and:</p> <blockquote> <p>By default, React DOM escapes any values embedded in JSX before rendering them. Thus it ensures that you can never inject anything that’s not explicitly written in your application. Everything is converted to a string before being rendered. This helps prevent XSS (cross-site-scripting) attacks.</p> </blockquote> <p>But for Vue, I cannot find anything in their docs about XSS protection, or anything that they could provide by default. </p> <p><strong>My question:</strong> Does Vue, by default, deliver any way of protection against XSS attacks, or would I need to look for a 3rd party solution?</p> <p>When I Google for this subject I get a lot of blog posts sites and articles refering to, for example, this project to sanitize my HTML:</p> <p><a href="https://github.com/punkave/sanitize-html" rel="noreferrer">https://github.com/punkave/sanitize-html</a></p>
<javascript><angular><reactjs><vue.js><xss>
2019-03-20 13:47:01
HQ
55,262,280
How can I retrieve related or upselling products in php shopify app?
<p>I am looking into these apis to develop my shopify app, they haven't mentioned about apis for getting upselling products. Can anyone help? <a href="https://github.com/cmcdonaldca/ohShopify.php" rel="nofollow noreferrer">https://github.com/cmcdonaldca/ohShopify.php</a> <a href="https://github.com/ShopifyExtras/PHP-Shopify-API-Wrapper" rel="nofollow noreferrer">https://github.com/ShopifyExtras/PHP-Shopify-API-Wrapper</a></p>
<php><shopify><shopify-app>
2019-03-20 13:47:25
LQ_CLOSE
55,262,773
ACF conditional logic for Google maps fields not Working
I am using ACF google Maps to give direction to a Tender briefing location to clients. Everything is working perfectly fine with the code below. I am using a Conditional logic of "Compulsory Briefing" YES/NO. if Compulsory briefing is YES i show the Get direction link that opens on Google Maps. Now When Compulsury Briefing is NO, i dont want to show the Link "Get Direction". <span class="font-weight-bold"><b>Compulsory Briefing:</b></span> <?php the_field('compulsory_briefing') ?><br/> <span class="font-weight-bold"><b>Address [Google Maps] <a class="directions" target="_blank" href="https://www.google.com/maps?saddr=My+Location&daddr=<?php $location = the_field('briefing_address'); echo $location['lat'] . ',' . $location['lng']; ?>"> <?php _e(' Get Directions','roots'); ?></a>
<google-maps><advanced-custom-fields>
2019-03-20 14:10:24
LQ_EDIT
55,263,586
Find count of combination of 2 columns - Oracle SQL
<p>I have a table</p> <pre><code>table_user col1 col2 123 456 124 457 125 458 126 459 127 460 128 461 123 456 123 456 123 457 </code></pre> <p>I need to find out the combination of col1 and col2 with counts.</p> <p>In above example:</p> <pre><code>col1 col2 count_combination 123 456 3 123 457 1 124 457 1 125 458 1 126 459 1 127 460 1 128 461 1 </code></pre> <p>How can I find it?</p>
<sql><oracle>
2019-03-20 14:46:22
LQ_CLOSE
55,263,999
Is possible to get elements from XML using Notepad++ Regex?
<p>I have an XML with different <code>Item</code>'s which may contain the attribute <code>Setting</code> named <code>SerialNumber</code>. Im trying to get all the item names followed with the serial number.</p> <p>My approch is using Notepad++ Regex, to get the name of the <code>Item</code> and the value of the attribute <code>Setting</code> named <code>SerialNumber</code>something like this:</p> <blockquote> <p>Sender0;3990 Sender3;4444 Sender4;7774</p> </blockquote> <p>But trying it the only thing i can get is that notepad++ selects all the text... My fast approach was something like this: </p> <pre><code>^&lt;Item Name="(.*)" Category=".*&lt;Setting Name="SerialNumber"&gt;(.*)&lt;/Setting&gt;.*&lt;/Item&gt; </code></pre> <p>And replace:</p> <pre><code>(\1);(\2) </code></pre> <p>The XML:</p> <pre><code> &lt;Item Name="Sender0" Category="" ClassName="Cars" Schedule="" Enabled="true"&gt; &lt;Setting&gt;...&lt;/Setting&gt; &lt;Setting Name="SerialNumber"&gt;3990&lt;/Setting&gt; &lt;Setting&gt;...&lt;/Setting&gt; &lt;/Item&gt; &lt;Item Name="Sender1" Category="" ClassName="Cars" Schedule="" Enabled="true"&gt; &lt;Setting&gt;...&lt;/Setting&gt; &lt;Setting&gt;...&lt;/Setting&gt; &lt;Setting&gt;...&lt;/Setting&gt; &lt;/Item&gt; &lt;Item Name="Sender2" Category="" ClassName="Cars" Schedule="" Enabled="true"&gt; &lt;Setting&gt;...&lt;/Setting&gt; &lt;Setting&gt;...&lt;/Setting&gt; &lt;Setting&gt;...&lt;/Setting&gt; &lt;/Item&gt; &lt;Item Name="Sender3" Category="" ClassName="Cars" Schedule="" Enabled="true"&gt; &lt;Setting&gt;...&lt;/Setting&gt; &lt;Setting Name="SerialNumber"&gt;4444&lt;/Setting&gt; &lt;Setting&gt;...&lt;/Setting&gt; &lt;/Item&gt; &lt;Item Name="Sender4" Category="" ClassName="Cars" Schedule="" Enabled="true"&gt; &lt;Setting&gt;...&lt;/Setting&gt; &lt;Setting Name="SerialNumber"&gt;7774&lt;/Setting&gt; &lt;Setting&gt;...&lt;/Setting&gt; &lt;/Item&gt; </code></pre> <p>Hope you can help me, thanks :)</p>
<regex><xml><notepad++>
2019-03-20 15:04:24
LQ_CLOSE
55,264,709
How do i copy only 2882649 from String: "automation130214141113 (order # 2882649)" in Java selenium?
I am trying to copy only 2882649 from a string automation130214141113 (order # 2882649). Can anyone help me out?
<java><regex><delimiter>
2019-03-20 15:39:49
LQ_EDIT
55,265,203
Terraform - Delete all resources except one
<p>I have a Terraform 0.11 project with 30-40 different resources. I would like to delete all of them except a few - and those few are logically related to each other.</p> <p>I was looking for something close to <code>terraform destroy --except=resource-id</code> but that of course doesn't exist.</p> <p>Is there a way to achieve that without too much scripting (Terraform admins have various OSs)? Would using modules make that process easier perhaps?</p>
<terraform><terraform-provider-aws><infrastructure>
2019-03-20 16:02:15
HQ
55,266,042
I wan't to center my blog body in blogger
I want to center my blog body (Posts and Pages) in blogger, its a custom template Link: www.temsah.ga I tried adding this code below `</b:skin>` : <style> #sidebar-atas1 { display: none; } #main-wrapper { width: 100%; background:#fff; } </style> it removed the sidebar successfully but it didn't center my body.
<html><css><blogger>
2019-03-20 16:45:47
LQ_EDIT
55,268,266
What is wrong with this Dart error handler?
<p>I'm doing some (I thought) basic exception handling in dart / flutter. I'm using the latest versions of dart and flutter as of last week (3/15/2019).</p> <p>Here's my code: </p> <pre><code>void MyMethod() { Storage.getFilePaths().then((paths) { //do something }).catchError((Exception error) { //do something else return null; }); } </code></pre> <p>However, when running the program and when an exception occurs I get this message below and can't see what the problem is?</p> <blockquote> <p>'Invalid argument (onError): Error handler must accept one Object or one Object and a StackTrace as arguments, and return a a valid result: Closure: (Exception) => Null'</p> </blockquote> <p>I assume I'm missing something silly, and would love to learn what that is. </p>
<dart><flutter>
2019-03-20 18:56:29
HQ
55,268,681
After Task.IsCompleted what is better: await or Result
<p>I'm working in a simple timeout code for my http requests. I got this</p> <pre><code>private async Task&lt;HttpResponseMessage&gt; ExecuteIOTask(Task&lt;HttpResponseMessage&gt; ioTask, int timeout) { var timeoutTask = await Task.WhenAny(Task.Delay(timeout), ioTask); if (ioTask.IsCompleted) return ioTask.Result; throw new TimeoutException(); } </code></pre> <p>After IsCompleted, is there any difference using <code>Result</code> vs <code>await</code> ? The task is already completed at that instance, so I think the performance should be the same. But i'm a little concern about the exception handling. I think <code>Result</code> is not going to propagate the exceptions but <code>await</code> will.</p> <p>Is this correct?</p>
<c#><async-await><task>
2019-03-20 19:21:32
LQ_CLOSE
55,268,980
Can someone help me understand cookies?
I apologize if this belongs outside of stackoverflow but I am at wits-end trying to understand internet cookies. I have read and completed the tutorials at the following sites:[Whatsmyipadress][1],[w3schools][2],[tutorialspoint][3],[how stuff works][4]. From what I understand - and someone please tell me if I am messed-up, cookies work like: > client visits site , > site requests cookie, > if cookie does not exist, site creates cookie, I found this [example][5] and tried to use but everyone has the same name and value: When I ran tests with different users, everyone returned the same combo `name:bob` Am I supposed to randomly assign a value? The first link says that users would need to complete a registration-type page and then server would use the info to create an id. This is similar to the tutorial on schools (except their example uses a popup). Is this what I need to do as well? How are cookies made unique ? From my experience, i wouldn’t be able to personalize any experience b/c everyone would have the same name/value pair. [1]: https://whatismyipaddress.com/cookie [2]: https://www.w3schools.com/js/js_cookies.asp [3]: https://www.tutorialspoint.com/javascript/javascript_cookies.htm [4]: https://electronics.howstuffworks.com/how-to-tech/how-to-surf-the-web-anonymously1.htm [5]: https://stackoverflow.com/questions/32353680/how-to-access-browser-session-cookies-from-within-shiny-app
<javascript>
2019-03-20 19:41:15
LQ_EDIT
55,269,526
What would cause the code below to not run?
<script> //<![CDATA[ var displayCurrentTime = new function() { // Get values... var sysHour = getHours(); // Get Hours var curHour = 0; // Initialize current hour (12 hr format) var morningEvening = "AM"; // Initialize AM/PM notation if (sysHour < 13) { // If it's in the morning, set time as is. curHour = sysHour; morningEvening = "AM" } else { curHour = sysHour - 12; // If it's in the evening, subtract 12 from the value and use "PM" morningEvening = "PM" } var curMins: getMinutes; // Get current minutes... // Capture the ID of the notification bar div, and compose a string from the above values. var notificationBar = document.getElementById("notificationBar"); var dateTimeString = curHour + ":" + curMins + " " + morningEvening; // All that code above files into this fun stuff. notificationBar.innerHTML = dateTimeString; } window.setInterval(function(){ displayCurrentTime(); }, 1000); //]]> </script> I've been reading up some information and I wanted to create a simple script that grabs the hour and minute, does some calculations to determine if it's AM or PM, creates a string variable from those results, and then slips it inside of a specific DIV element. It does this every second. Most of the code I've written seems to make sense based on what I've read. In the beginning I've tried using function displayCurrentTime() {} as well as what you see below (var displayCurrentTime = new function() {}) and neither seem to work. I cannot get my text to display in the page. Note: the ID of the div is notificationBar, just as it is here. Is there anything in this code that makes no sense, or does this actually warrant posting the full HTML?
<javascript><html><datetime>
2019-03-20 20:19:17
LQ_EDIT
55,270,400
insert function is doesn't add a new elements
<p>I wrote a program which should to insert elements in the list compare with their costs, but it doesn't work. I enter one element and then program doesn't work. And I can't understand what's wrong.</p> <p>here is an exactly the exercise:</p> <h2>Modify the list, so elements on the list are ordered by price. New items added to the list should be inserted into the right place</h2> <pre><code> #include &lt;iostream&gt; #include &lt;string&gt; using namespace std; typedef struct listt { string name; float price; struct listt *next; }listt; typedef listt* listPtr; void insertt(listPtr *, string, float); void printList(listPtr); void instruct(); int main() { unsigned int choice; float costs; string itemName; listPtr head = NULL; instruct(); cin &gt;&gt; choice; while(choice != 3) { switch(choice) { case 1: cout &lt;&lt; "Please enter the name of the item:" &lt;&lt; endl; cin &gt;&gt; itemName; cout &lt;&lt; "Please enter the cost of item: " &lt;&lt;endl; cin &gt;&gt; costs; insertt(&amp;head, itemName, costs); break; case 2: printList(head); break; } cout&lt;&lt;"Choose the operation\n"; cin &gt;&gt; choice; } cout&lt;&lt;"end of operation"; return 0; } void instruct(void) { cout&lt;&lt;"Choose the operation\n" &lt;&lt; "1.Fill the list\n" &lt;&lt; "2.Print the list\n" &lt;&lt; "3.End operation\n"; } void insertt(listPtr *itemList, string nm, float cst) { listPtr previousPt; listPtr currentPt; listPtr newPtr; if(newPtr != NULL){ newPtr-&gt;name = nm; newPtr-&gt;price = cst; newPtr-&gt;next = *itemList; } previousPt = NULL; currentPt = *itemList; while(currentPt != NULL &amp;&amp; cst &gt; currentPt-&gt;price ) { previousPt = currentPt; currentPt = currentPt-&gt;next; } if(currentPt == NULL) { newPtr-&gt;next = *itemList; *itemList = newPtr; } else{ previousPt-&gt;next = newPtr; newPtr-&gt;next = currentPt; } } void printList(listPtr hh) { while(hh-&gt;next != NULL) { cout &lt;&lt; hh-&gt;name &lt;&lt;" " &lt;&lt; hh-&gt;price&lt;&lt; endl; hh = hh-&gt;next; } } </code></pre>
<c++>
2019-03-20 21:22:24
LQ_CLOSE
55,271,024
HTML/PHP redirect to page with parameter when link doesn't exist
I'm trying to program an URL Shortener in the style of [bitLY][1], but I don't know how to redirect a user to a given site if he uses the shortened Link in a style of sampleurl.com/[ID here] **Example:** A user generates a short version for youtube.com let's say the ID is qzUdijE now I want that another user is able to visit sampleurl.com/qzUdijE for being redirected to youtube.com (I save the ID (in this case 'qzUdijE') together with the URL (in this case 'youtube.com') in a Database.) Thanks for all answers. (Sorry for bad English, I'm german) ~ justMarvin [1]: https://bit.ly/
<php><html><redirect><url-redirection><url-shortener>
2019-03-20 22:21:13
LQ_EDIT
55,272,598
Sporadic error: The file has not been pre-compiled, and cannot be requested
<p>Symptoms: ASP.NET Web Forms website on Azure sporadically crashes and all .aspx page requests fail with this error. The problem seems random and only happens once in a great while. The site may run for months with no issues then out of the blue it will stop serving any .aspx pages and gives the error on every .aspx page request. A restart of the website is the only solution (or redeploy, which causes the same thing).</p> <p>This was a very difficult problem to debug since it was so sporadic and none of the other answers I found helped, they did not address the problem where the site would deploy and run for long periods of time then crash with this error seemingly randomly. In the end I got some help from Microsoft.</p>
<asp.net>
2019-03-21 01:42:29
HQ
55,273,058
Payment gateway integration problem in redirection from bcackend to front end in web application
In one of my web application which make use of spring boot and angular 6 environment i am trying to intigeate the payu payment gateway. Now the problem is they will post the success capture or failure capture data to whatever url provided by our application. What is the url we need to give them to post the data. Is it a backend url Or front end url. If it is backend url, then once data is received in spring boot we will save the data to the db after that how to change the page in the front end. ( in angular) Please help me and guide me to proceede. Thanks
<angular><spring-boot><payment-gateway>
2019-03-21 02:48:31
LQ_EDIT
55,273,305
Easiest way to get the value using SQL
A table with 7 rows having all weekdays as value. I just want a simple sql query to get all the values from the weekdays except weekends.
<sql><sql-server>
2019-03-21 03:20:57
LQ_EDIT
55,273,697
Why threads are needed in my given assignment in java?
<p><strong>I'm not asking to do my assignment. Read carefully</strong></p> <blockquote> <p>Write a program to simulate a bus traveling between 5 different stations and repeats the cycle, the bus can take up to a maximum of 50 persons, at each station random number of persons get off the bus and random number of persons get on the bus, consider these cases.</p> <ul> <li>If bus does not have enough space for all persons, persons will have to stay in station for next cycle</li> <li>Persons cannot mount on bus until persons on bus dismount first.</li> <li>You can simulate bus trip with a fixed delay between each stop to simulate travel time.</li> <li>Persons can not mount/dismount the bus until bus arrives to the designated station.</li> </ul> <p>Use semaphores to control access to the bus and other utilities to control access to bus. Use thread pools to manage thread management. You can use latches, cyclic barriers, re-entrant locks and condition variables to write your code.</p> </blockquote> <p>I have implemented this in java without making threads and using semaphores. I Just used nested loop to cycle the bus and the whole procedure is working fine. I'm not asking you to do my assignment, all I need to know where should I use threads in this code. </p> <p>Here is my code :</p> <pre><code>import java.util.*; import java.lang.*; public class buses { int capacity; int station; ArrayList&lt;Integer&gt; remaining=new ArrayList&lt;&gt;(); public void run(int n) { System.out.println("--Station "+(n+1)+"--"); if(this.capacity&lt;50) { Random rand1 = new Random(); int unload = rand1.nextInt(50); unload += 1; while(unload&gt;50-this.capacity) { rand1 = new Random(); unload = rand1.nextInt(50); unload += 1; } System.out.println("Unloaded : "+unload); this.capacity+=unload; System.out.println("Capacity "+this.capacity); } Random rand = new Random(); int load = rand.nextInt(50); load += 1; System.out.println("random load:"+load); int val=remaining.get(n); System.out.println("Remaining pessenger at station"+(n+1)+" were:"+val); load=load+val; System.out.println("random load:"+load); if(load&lt;=this.capacity) { System.out.println("Loaded "+(load)); capacity-=load; System.out.println("Capacity "+this.capacity); remaining.set(n, 0); } else if(load&gt;this.capacity) { int notToBeLoaded=load-this.capacity; System.out.println("Loaded "+(load-notToBeLoaded)); capacity=0; System.out.println("Capacity "+this.capacity); remaining.set(n, notToBeLoaded); } station++; } public buses() { this.capacity=50; this.station=1; this.delay=2000; } public static void main(String[] args) { buses obj=new buses(); obj.remaining.add(0); obj.remaining.add(0); obj.remaining.add(0); obj.remaining.add(0); obj.remaining.add(0); for(int j=0;j&lt;2;j++) { for(int i=0;i&lt;5;i++) { obj.run(i); } } //System.out.println("remaining 0:"+obj.remaining.get(0)); //System.out.println("remaining 1:"+obj.remaining.get(1)); //System.out.println("remaining 2:"+obj.remaining.get(2)); //System.out.println("remaining 3:"+obj.remaining.get(3)); //System.out.println("remaining 4:"+obj.remaining.get(4)); } } </code></pre>
<java><multithreading>
2019-03-21 04:15:01
LQ_CLOSE
55,274,373
When can a base class have a different layout than the corresponding complete object type?
<p>GCC and Clang do not perform C++17’s guaranteed copy elision when a base class constructor is called; see <a href="https://stackoverflow.com/questions/46065704/why-isnt-rvo-applied-to-base-class-subobject-initialization">this question</a> and the corresponding <a href="https://bugs.llvm.org/show_bug.cgi?id=34516" rel="noreferrer">Clang bug report</a> for details.</p> <p>In response to the bug report, <a href="https://bugs.llvm.org/show_bug.cgi?id=34516#c1" rel="noreferrer">Richard Smith states</a>:</p> <blockquote> <p>This is a defect in the standard wording. Copy elision cannot be guaranteed when initializing a base class subobject, because base classes can have different layout than the corresponding complete object type.</p> </blockquote> <p>Under what circumstances can a base class have a “different layout than the corresponding complete object type” in a way that makes guaranteed copy elision impossible? Is there a concrete example that illustrates this?</p>
<c++><c++17>
2019-03-21 05:41:32
HQ
55,276,941
Can this design be made with just CSS?
<p><a href="https://i.stack.imgur.com/7DTnG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7DTnG.png" alt="enter image description here"></a> <a href="https://i.imgur.com/D69glPV.png" rel="nofollow noreferrer">https://i.imgur.com/D69glPV.png</a> - I'm trying to create this design with CSS/HTML. My initial thought, was to create the white "wave" container that wraps the icons with SVG shapes, but I was wondering if you could actually make it with just CSS? How would you guys approach this? :)</p>
<html><css><svg>
2019-03-21 09:08:22
LQ_CLOSE
55,277,355
Please help me understanding i am new with coding
public static void main(String[] args) { Scanner sc=new Scanner(System.in); String A=sc.next(); String B=sc.next(); System.out.println(A.length()+B.length()); System.out.println(A.compareTo(B)>0?"Yes":"No"); System.out.println(capitalizeFirstLetter(A) + " " + capitalizeFirstLetter(B)); } public static String capitalizeFirstLetter(String original) { if (original == null || original.length() == 0) { return original; } return original.substring(0, 1).toUpperCase() + original.substring(1); } i am not understanding it please hepl me understanding this.
<java><string>
2019-03-21 09:34:42
LQ_EDIT
55,277,715
View systemd logs without journald
<p>I have a rootfs of broken container with ubuntu-xenial. How to view logs of specific service without running journald?</p>
<systemd-journald>
2019-03-21 09:54:10
LQ_CLOSE
55,278,132
Python Help. Need to verify username password off csv file
Doing a python project where I have to verify my username and password from a csv file where the first two rows and columns have the username and password as 'hi'. Please help ASAP. Current Code: answer = input("Do you have an account?(yes or no) ") if answer == 'yes' : login = False csvfile = open("Username password.csv","r") reader = csv.reader('Username password.csv') username = input("Player One Username: ") password = input("Player One Password: ") for row in reader: if row[0]== username and row[1] == password: login = True else: login = False if login == True: print("Incorrect. Game Over.") exit() else: print("You are now logged in!") else: print('Only Valid Usernames can play. Game Over.') exit()
<python><python-3.x><project>
2019-03-21 10:15:15
LQ_EDIT
55,278,410
how to delete unnecessary spaces with java 8?
<p>can anyone help me to find a solution to this problem in Java 8:</p> <p>A string of characters is composed of multiple spaces is given to you. You must remove all unnecessary spaces by writing an algorithm.</p> <p>Entry: String containing a sentence. Output: String containing the same sentence without unnecessary spaces.</p> <p>Example: For the following entry: "I (3spaces) live (3spaces) on (3spaces) earth." The output is: "I live on earth."</p>
<java>
2019-03-21 10:31:46
LQ_CLOSE
55,279,313
Is there a GUI in windows to do CRUD Operations on Oracle Database?
<p>I create my tables using sql developer and I'm looking for a simple GUI to do CRUDs operations instead of script to populate those tables.</p>
<database><oracle><user-interface><crud>
2019-03-21 11:21:13
LQ_CLOSE
55,279,443
Calculate date of birth from age and event date
<p>I have two columns, one with age e.g. (34) and another column with date of the event e.g. (2019-04-26:01:20:51). I would like to create a new column that returns the date of birth based on the above two columns). Many thanks in advance for the help.</p>
<r><lubridate>
2019-03-21 11:27:54
LQ_CLOSE
55,280,831
Java - Why does int default to 0 when a value outside the range is attempted to be stored in it
<p>I have a simple program for calculating the x to the power of y.</p> <pre><code> public static int calculatePower(int x, int y) { int result = 1; if (y == 0) return result; for (int i = 1; i &lt;= y; i++) { result = result * x; } return result; } </code></pre> <p>When i pass the parameters as 4 and 15, i get the value back as 1073741824. But when the parameters are 4 and 16, the value returned is zero. </p> <p>If the outer range value cannot be stored in int, shouldnt it be retaining the last value - 1073741824 ?</p>
<java>
2019-03-21 12:49:00
LQ_CLOSE
55,280,913
Css position relative top 50% of div doesnt work
[enter image description here][1]My CSS : https://pastebin.com/EWf4gD81 My HTML : https://pastebin.com/K10iiiHK I have problem with positioning. I cannot set exacly top 50 procent and left 50 procent on both photo and text becouse it isnt 50 procent. I try by hand set that 50 procent which is more like 46 procent. When I change size of window text moves. I dont know what to Do and I am looking for answer for 2 hours enter code here [1]: https://i.stack.imgur.com/kefHv.png
<html><css><css-position><positioning>
2019-03-21 12:53:56
LQ_EDIT
55,281,086
SQL: count occurences for each row
i have an SQL table called `Codes` with a column `code` of type String. I also have another table called `Items` with a column `codestring` also of type String. This entry always contains a string with some of the codes of the above table seperated by spaces. Now i want to get all codes and their number of Items containing the respective code. Can i do that?
<sql><sqlite>
2019-03-21 13:04:04
LQ_EDIT
55,282,602
Difference between Ajax return Response function and only return
<p>What is the difference between having the following in an ajax request / call (is it request or call?)</p> <pre><code>return $output; </code></pre> <p>and</p> <pre><code>return Response($output); </code></pre> <p>both work, but Response does not give me information about the returned element while return only does give me information.</p>
<javascript><ajax><return>
2019-03-21 14:22:44
LQ_CLOSE
55,282,738
How can i format date and time in golang to use it in neo4j query?
i'm developing a website to learn how to use golang(github.com/gin-gonic/gin) and neo4j(github.com/johnnadratowski/golang-neo4j-bolt-driver). I have a User struct like that type User struct { Id int16 `json:"id" db:"id"` Username string `json:"username" db:"username"` Email string `json:"email" db:"email"` CreatedAt time.Time `json:"created_at" db:"created_at" } and i want to create a node in neo4j with all this information func test(u User) { m := structs.Map(u) app.Neo.ExecNeo("CREATE (n:NODE {Id: {Id}, Username: {Username}, " + "Email: {Email}, CreatedAt: {CreatedAt}})", m) } because of the format of the date "0001-01-01 00:00:00 +0000 UTC" neo4j does't accept the query (everything work if i remove the Created At). So i wanted to know how i can format it, is there any tips ? or do i have to make my own function ? Thanks.
<go><neo4j><date-formatting>
2019-03-21 14:28:55
LQ_EDIT
55,283,042
Make current h1/h2 sticky with Javascript
<p>I'd like to make a long website with lots of text more convinient by making the h1 or h2 element that would have just gone out of view (when scrolling down) sticky at the top until the next headline is about to go out of view and become sticky.</p> <p>I believe I've seen this on some websites, but I don't know how to call it and can't find an example.</p> <p>I'm using Bootstrap and JQuery, so a solution that works with either of them would be perfect.</p>
<javascript><css>
2019-03-21 14:43:21
LQ_CLOSE
55,283,725
unit test mocha Visual Studio Code describe is not defined
<p>If i run in the console the test runs fine</p> <pre><code> mocha --require ts-node/register tests/**/*.spec.ts </code></pre> <p>Note: I installed mocha and mocha -g</p> <p>I want to run unit test from Visual Studio Code</p> <p>launcgh.js file</p> <pre><code> "version": "0.2.0", "configurations": [ { "type": "node", "request": "launch", "name": "Mocha Tests", "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha", "args": [ "--require", "ts-node/register", "-u", "tdd", "--timeout", "999999", "--colors", "${workspaceFolder}/tests/**/*.spec.ts" ], "internalConsoleOptions": "openOnSessionStart" }, </code></pre> <p>Very simple Test file</p> <pre><code> import { expect } from 'chai'; const hello = () =&gt; 'Hello world!'; describe('Hello function', () =&gt; { it('should return hello world', () =&gt; { const result = hello(); expect(result).to.equal('Hello world!'); }); }); </code></pre> <p>but in the Visual studio Code debug console</p> <pre><code> /usr/local/bin/node --inspect-brk=15767 node_modules/mocha/bin/_mocha --require ts-node/register -u tdd --timeout 999999 --colors /Applications/MAMP/htdocs/ddd-board-game/backend/tests/**/*.spec.ts Debugger listening on ws://127.0.0.1:15767/bdec2d9c-39a7-4fb7-8968-8cfed914ea8d For help, see: https://nodejs.org/en/docs/inspector Debugger attached. /Applications/MAMP/htdocs/ddd-board-game/backend/tests/dummy.spec.ts:3 source-map-support.js:441 describe('Hello function', () =&gt; { ^ ReferenceError: describe is not defined source-map-support.js:444 at Object.&lt;anonymous&gt; (/Applications/MAMP/htdocs/ddd-board-game/backend/tests/dummy.spec.ts:1:1) at Module._compile (internal/modules/cjs/loader.js:701:30) at Module.m._compile (/Applications/MAMP/htdocs/ddd-board-game/backend/node_modules/ts-node/src/index.ts:414:23) </code></pre>
<typescript><unit-testing><visual-studio-code><mocha>
2019-03-21 15:17:22
HQ
55,284,821
UICollectionView using UICollectionViewFlowLayout is centering and missaligning cells
I'm using a standard `UICollectionViewFlowLayout` but it seems to do some overwork as it is centering the cells of section with one item and if the section contains 2 or 3 items, they are not distributed to fit width How to get always the same distribution (to left) and margins (as with more than 3 items) [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/dAUL5.png
<ios><cocoa-touch><uicollectionview><uicollectionviewflowlayout>
2019-03-21 16:13:49
LQ_EDIT
55,286,503
Using ternary operator in c++ returns false condition always
<p>I am using a statement with ternary operator which is always returning the other value. </p> <pre><code>BSTR pVal = L"Yes"; bool val = pVal == L"Yes" ? true : false; </code></pre> <p>this statement returns </p> <pre><code> val = false; </code></pre> <p>I expect it to return true here. Am i making it wrong?</p>
<c++>
2019-03-21 17:54:59
LQ_CLOSE
55,286,934
INotofyPropertyChanged wpf
OKe so i'm using .net 4.6.1 with wpf application. We have a list -> ObservableCOllection we want to bind the collection to a listview thats need to have sorting alphabetically and auto updating upon new item in the collection. I use COllectionViewSource and searched here on stackoverflow for updating I need to use InotificationPropertyChanged. But for some reason it doesnt work :(. object claas: using System.Text; using System.Threading.Tasks; namespace ObservableCollection { public class AlarmTypes : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; private string name; public AlarmTypes(string _name) { this.name = _name; } public string Name { get { return name; } set { name = value; OnPropertyChanged("Name"); } } protected void OnPropertyChanged(string prop) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(prop)); } } } } xaml file <Window x:Class="ObservableCollection.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:ObservableCollection" xmlns:componentModel="clr-namespace:System.ComponentModel;assembly=WindowsBase" xmlns:clr="clr-namespace:System;assembly=mscorlib" mc:Ignorable="d" Title="MainWindow" Height="450" Width="800"> <Grid> <Grid.Resources> <CollectionViewSource x:Name="CollectionViewSource" x:Key="src" Source="{Binding alarmTypes }" IsLiveFilteringRequested="True"> <CollectionViewSource.LiveSortingProperties> <clr:String>Name</clr:String> </CollectionViewSource.LiveSortingProperties> <CollectionViewSource.SortDescriptions> <componentModel:SortDescription PropertyName="Name" /> </CollectionViewSource.SortDescriptions> </CollectionViewSource> </Grid.Resources> <ListView x:Name="lstAlarmTypes" HorizontalAlignment="Left" Height="319" Margin="585,48,0,0" VerticalAlignment="Top" Width="157" ItemsSource="{Binding Source={StaticResource src}}"> <ListView.View> <GridView> <GridViewColumn Header="Name" DisplayMemberBinding="{Binding Name}" /> </GridView> </ListView.View> </ListView> <TextBox HorizontalAlignment="Left" Height="23" Margin="10,48,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120" Name="textBox1"/> <Button Content="Add item" HorizontalAlignment="Left" Margin="173,51,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click"/> <ListView x:Name="LstNames2" HorizontalAlignment="Left" Height="301" Margin="339,66,0,0" VerticalAlignment="Top" Width="180"> <ListView.View> <GridView> <GridViewColumn Header="Name" DisplayMemberBinding="{Binding Name}"/> </GridView> </ListView.View> </ListView> </Grid> </Window> xmal cs code: using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace ObservableCollection { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { private ObservableCollection<AlarmTypes> alarmTypes = new ObservableCollection<AlarmTypes>(); private ObservableCollection<AlarmTypes> sortedTypes = new ObservableCollection<AlarmTypes>(); public MainWindow() { InitializeComponent(); LstNames2.ItemsSource = alarmTypes; var alarmType = new AlarmTypes("inbraak"); alarmTypes.Add(alarmType); var alarmType2 = new AlarmTypes("alarm"); //alarmType.Name = textBox1.Text; alarmTypes.Add(alarmType2); } private void Button_Click(object sender, RoutedEventArgs e) { var alarmType = new AlarmTypes(textBox1.Text); //alarmType.Name = textBox1.Text; alarmTypes.Add(alarmType); } } } I don't know if the inding doesn't work or its the property or I still need something else. The first list has a binding just to the Observable collection and that works when inputting data from the textbox. But the second listview that has the collectionViewSource apparently doesn't work. any ideas whats missing?
<c#><wpf><.net-4.6.1>
2019-03-21 18:24:02
LQ_EDIT
55,287,045
attributes required not work when clone element html
i have some elements with attribute required and i write jQuery code to clone this element when i press submit it should be show message must fill input but dosen't work just for this clone elements ... so what's problem <div class='col-md-12'> <div class='box box-primary'> <div class='box-header with-border'> <h3 class='box-title'>Information of Person</h3> </div> <div class='form-group'> <div class='box-body rowClone2'> <div class='row rowClone'> <div class='col-xs-6 col-md-3'> <input type="text" class="form-control" required> </div> <div class='col-xs-6 col-md-3'> <input type="text" class="form-control" required> </div> <div class='col-xs-6 col-md-3' > <input type="tel" class="form-control"> </div> <div class='col-xs-6 col-md-3'> <input type="text" class="form-control" required> </div> </div> <br> </div> <div class="row"> <div class="col-md-3"> <input type="submit" value="Submit" formnovalidate> </div> </div> </div>
<javascript><jquery><html>
2019-03-21 18:31:22
LQ_EDIT
55,288,210
How to get text input and past it in front of a link (php)
I'm currently busy with (re)making the dutch Wikipedia site. And i want to make the search bar. My idea was to get text input and when you click on search the text will go to the front of a link like this https://ibb.co/XbndsKP this is currently the search bar: <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> <div align='center'> <form method="submit" action='php/zoeken.php'> <input placeholder="zoeken"id="zoeken"class='zoeken'type="text"> <button class='button'type="submit">zoeken</button> </div> <!-- end snippet --> [1]: https://i.stack.imgur.com/cNf7B.png
<php><html>
2019-03-21 19:45:08
LQ_EDIT
55,288,456
I'm learning multidimensional arrays and trying to write them out with for. I found it, but I don't understand how it works
<p>so I'm learning Java nad now I'm on multidimensional arrays. I think I understand how they work. And I found how to write them out with for, but the whing is what happens with for and why we need two for's. This is the code:</p> <pre><code>int[][] myNumbers = { {1, 2, 3, 4}, {5, 6, 7} }; for (int i = 0; i &lt; myNumbers.length; i++) { for (int j = 0; j &lt; myNumbers[i].length; j++) { System.out.println(myNumbers[i][j]); } } </code></pre>
<java><arrays><for-loop><multidimensional-array>
2019-03-21 20:03:06
LQ_CLOSE
55,289,342
Why docker is needed
<p>I googled and I understand , docker will create an application image with environment setup.</p> <p>Consider, I have an asp.net application which is already hosted in production. </p> <p>I see, I can add docker support to an existing asp.net application.</p> <p>How docker can help me with this, because I have already an environment setup on server. For an asp.net application all I needed mostly is a .net framework to be installed. Instead to install docker I could install .net framework?</p> <p>May be my understanding is wrong?</p>
<visual-studio><docker><docker-for-windows>
2019-03-21 21:13:40
LQ_CLOSE
55,290,251
Listar todos os valores de cada tabela do SQL
Preciso fazer uma listagem genérica que me traga todos os valores que tenho no banco, cada linha de banco. Minha aplicação precisa ler uma informação que muda e transita dentro no banco.
<sql><sql-server><tsql>
2019-03-21 22:35:14
LQ_EDIT
55,291,810
Finding a string within another string using C#
<p>How do I find out if one of my strings occurs in the other in C#?</p> <p>For example, there are 2 strings: string 1= "The red umbrella"; string 2= "red"; How would I find out if string 2 appears in string 1 or not?</p>
<c#><string>
2019-03-22 01:58:27
LQ_CLOSE
55,293,050
Numeric date changed to String
<p>I need help creating a function that takes a user input(Numeric Date) and turns it into a string For Example: input: 2018-06-20 output: June 20th 2018 any hints or code would help me out. Thank you </p>
<python><string><date>
2019-03-22 04:44:14
LQ_CLOSE
55,293,155
How do I add 10 arrays to a single array in c++?
Let's say I have these 10 previously declared arrays in my code. int arr1[] = {1,2,3,4,5,6,7,8,9,10}; int arr2[] = {1,2,3,4,5,6,7,8,9,10}; int arr3[] = {1,2,3,4,5,6,7,8,9,10}; int arr4[] = {1,2,3,4,5,6,7,8,9,10}; int arr5[] = {1,2,3,4,5,6,7,8,9,10}; int arr6[] = {1,2,3,4,5,6,7,8,9,10}; int arr7[] = {1,2,3,4,5,6,7,8,9,10}; int arr8[] = {1,2,3,4,5,6,7,8,9,10}; int arr9[] = {1,2,3,4,5,6,7,8,9,10}; int arr10[] = {1,2,3,4,5,6,7,8,9,10}; Basically, I want to add all 10 of these arrays to one single array and create an array of arrays. How would I go about doing this? This question might seem trivial for some, but I'm new to C++ and can not figure out how to do it. Please help and thanks in advance.
<c++><c++11>
2019-03-22 04:58:04
LQ_EDIT
55,294,208
Why does Java 12 try to convert the result of a switch to a number?
<p>I agree that this code:</p> <pre><code>var y = switch (0) { case 0 -&gt; '0'; case 1 -&gt; 0.0F; case 2 -&gt; 2L; case 3 -&gt; true; default -&gt; 4; }; System.out.println(y); System.out.println(((Object) y).getClass().getName()); </code></pre> <p>returns this:</p> <pre><code>0 java.lang.Character </code></pre> <p>But if you remove boolean:</p> <pre><code>var y = switch (0) { case 0 -&gt; '0'; case 1 -&gt; 0.0F; case 2 -&gt; 2L; default -&gt; 4; }; System.out.println(y); System.out.println(((Object) y).getClass().getName()); </code></pre> <p>returns this:</p> <pre><code>48.0 java.lang.Float </code></pre> <p>I suppose this result is unexpected.</p>
<java><switch-statement><java-12>
2019-03-22 06:44:06
HQ
55,295,245
How to get field value in Java reflection
<p>I have following field in a class:</p> <pre><code>private String str = "xyz"; </code></pre> <p>How do I get the value <code>xyz</code> using the field name <em>only</em> i.e. </p> <p>I know the name of the field is <code>str</code> and then get the assigned value. Something like:</p> <pre><code>this.getClass().getDeclaredField("str").getValue(); </code></pre> <p>Currently the Reflection API has <code>field.get(object)</code>.</p>
<java><reflection><java-8>
2019-03-22 08:03:34
LQ_CLOSE
55,295,838
Need Db audit info query in SQL server for these columns
Good day will you please provide a single query in SQL Server to fetch Audit information of databases and tables in the server as below Database audit should include records count in each table, tables size, databases size and drives size in the server including Server name Thanks in advance
<sql-server>
2019-03-22 08:46:03
LQ_EDIT