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
59,405,465
@EnableResourceServer @EnableAuthorizationServer are deprecated?
<p>I am writing a simple application to test Oauth. But i see that both the annotations @EnableResourceServer @EnableAuthorizationServer were deprecated!</p> <p>I don't find an alternative way to deal with it and I don't find any info anywhere.</p> <p>What is the latest way to configure resource server and Auth server?</p> <p>Thanks!</p>
<spring-security><spring-security-oauth2>
2019-12-19 08:00:31
HQ
59,405,791
VBScript - replace all commas occuring between ," and ",
<p>Using VBScript I need to replace all commas that occur between <strong>,"</strong> and <strong>",</strong> (i.e. chr(34)&amp;chr(44) and chr(44)&amp;chr(34)) with dots so it transforms below input into output string. Commas that occur not between these characters should stay.</p> <pre><code>Input 2019/011,05-11-2019,05-11-2019,"748,845,914,968,1019,1081",Edward Norton,86105015751000009077333566,,"5846,03",,"548,95",20,T Output 2019/011,05-11-2019,05-11-2019,"748.845.914.968.1019.1081",Edward Norton,86105015751000009077333566,,"5846.03",,"548.95",20,T </code></pre> <p>Many thanks.</p>
<regex><vbscript>
2019-12-19 08:24:41
LQ_CLOSE
59,409,365
is this table is correct? or i should put unsignedBigInteger for tag_id too? and remove.->unsigned and index?
/** * Run the migrations. * * @return void */ public function up() { Schema::create('post_tags', function (Blueprint $table) { $table->unsignedBigInteger('post_id'); $table->integer('tag_id')->unsigned()->index(); $table->foreign('post_id')->references('id')->on('posts')->onDelete('cascade'); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('post_tags'); }
<php><laravel><migration>
2019-12-19 11:59:24
LQ_EDIT
59,411,371
Font awesome icon name
<p>Does anyone know name of this icon in fontawesome(ignore color)?</p> <p><a href="https://i.stack.imgur.com/Z2xAg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Z2xAg.png" alt="enter image description here"></a></p>
<html><css><font-awesome>
2019-12-19 14:05:42
LQ_CLOSE
59,411,397
What makes ValueTuple covariant?
<p>This compiles correctly in C# 7.3 (Framework 4.8):</p> <pre><code>(string, string) s = ("a", "b"); (object, string) o = s; </code></pre> <p>I know that this is syntactic sugar for the following, which also compiles correctly:</p> <pre><code>ValueTuple&lt;string, string&gt; s = new ValueTuple&lt;string, string&gt;("a", "b"); ValueTuple&lt;object, string&gt; o = s; </code></pre> <p>So, it appears that ValueTuples can be assigned <a href="https://en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_science)" rel="noreferrer">covariantly</a>, <em>which is awesome</em>!</p> <p>Unfortunately, I don't understand <em>why</em>: I was under the impression that C# <a href="https://stackoverflow.com/a/19094386/87698">only supported covariance on interfaces and delegates</a>. <code>ValueType</code> is neither.</p> <p>In fact, when I try to duplicate this feature with my own code, I fail:</p> <pre><code>struct MyValueTuple&lt;A, B&gt; { public A Item1; public B Item2; public MyValueTuple(A item1, B item2) { Item1 = item1; Item2 = item2; } } ... MyValueTuple&lt;string, string&gt; s = new MyValueTuple&lt;string, string&gt;("a", "b"); MyValueTuple&lt;object, string&gt; o = s; // ^ Cannot implicitly convert type 'MyValueTuple&lt;string, string&gt;' to 'MyValueTuple&lt;object, string&gt;' </code></pre> <p>So, why can <code>ValueTuple</code>s be assigned covariantly, but <code>MyValueTuple</code>s can't?</p>
<c#><covariance><valuetuple>
2019-12-19 14:07:37
HQ
59,411,907
Is this possible to predict the lottery numbers (not the most accurate)?
<p>I am looking for the machine learning correct approach for predicting the lottery numbers, not the most accurate answer but at least we have some predicted output. I am implementing the regression based and neural network models for this. Is their any specific approach which follows this?</p>
<machine-learning><scikit-learn><neural-network><artificial-intelligence>
2019-12-19 14:39:03
LQ_CLOSE
59,414,789
how apt-get knows where to look for packages
<p>If I just run <code>apt-get update</code> (without any package name) on a new installation, the OS download/updates the packages. How does it know which packages to download and from where? Is the list of <code>sources</code> pre-configured in the <code>OS</code> eg. in Debian?</p>
<debian>
2019-12-19 18:01:03
LQ_CLOSE
59,415,327
how to make from real IP into automatic IP range in python?
<p>how do I make an IP range, for example my original IP there are the first 2 127.0.0.1 the second 128.0.0.1, I want if I use that IP for the IP range will be: 127.0.0.1 - 127.0.255.255 and so on, this my example code :</p> <pre><code>list_data = ["127.0.0.1", "128.0.0.1"] for i in range(255): for j in range(255): ip = list_data+".%d.%d" % (i, j) print (sb+fg+'[RANGE-IP] ===&gt; '+ip) open('IP.txt', 'a').write(ip + "\n") </code></pre>
<python>
2019-12-19 18:45:54
LQ_CLOSE
59,417,551
Trouble with my angular project and my Apache Server
<hr> <p>Look, i recently finished my project and went happy to send it to my Apache server. </p> <p>My Apache server has the standard folder structure <strong>www</strong> as the source and inside of it you put you files. </p> <p>I ran the command in my project: <code>ng build --prod</code>, and gave me the following files: <a href="https://i.stack.imgur.com/kFH6H.png" rel="nofollow noreferrer">my folder structure</a> </p> <p>So i copied the content of the dist file and paste it in the path: <code>./www/test/FitProject</code> in my Apache folder and ran my server.<br> But the console hitted me with an error saying:</p> <ol> <li>localhost:8080/Polyfills.js error 404, this file wasn't found</li> <li>localhost:8080/Runtime.js error 404, this file wasn't found</li> <li>localhost:8080/styles.css error 404, this file wasn't found</li> </ol> <p>So i tought, maybe it is searching for these files in the source folder(www) so i copied these files and paste it in the www folder and work out just fine. </p> <blockquote> <p>So what can i do to stop this error and tells to the angular project to look for these files inside it's own folder, not in www ?</p> </blockquote>
<angular><apache><production>
2019-12-19 22:15:48
LQ_CLOSE
59,418,255
gcloud stop working - "was unexpected at this time."
<p>I just update my google cloud SDK on windows 10 (gcloud components update). After the update the gcloud command stop working. All I get is (for example : gcloud -h): PATH\lib\gcloud.py" -h" was unexpected at this time. </p> <p>I try to re-install but it didn't help:(</p> <p><a href="https://i.stack.imgur.com/bJngw.png" rel="noreferrer"><img src="https://i.stack.imgur.com/bJngw.png" alt="enter image description here"></a></p>
<google-cloud-platform><gcloud><google-cloud-sdk>
2019-12-19 23:44:53
HQ
59,418,648
Sentence boundary detection across many languages
<p>I'm looking for a framework like below that can be used with swift. What do you recommend?</p> <p><a href="https://github.com/diasks2/pragmatic_segmenter" rel="nofollow noreferrer">https://github.com/diasks2/pragmatic_segmenter</a></p> <p>Thank you.</p>
<ios><objective-c><swift>
2019-12-20 00:50:43
LQ_CLOSE
59,419,330
apply 1 css class which applies more than 1 class to an element
<p>Lets say I use multiple bootstrap classes to achieve my desired button effect.</p> <pre><code>styleClass="btn btn-lg btn-block btn-success my_wrap" </code></pre> <p>Can I do something like this with css that allows me to have a single style defined in my html but in my css defining multiple bootstrap classes, utilising bootstrap and custom styling, to effectively wrapper them into a single super class?</p> <pre><code>styleClass="my-button-ultimate" </code></pre> <p>e.g. maybe css like this (my_wrap is my custom class the others are std bootstrap):</p> <pre><code>.my-button-ultimate{ .btn, .btn-lg, .btn-block, .btn-success, .my_wrap } .my_wrap{ white-space: normal; } </code></pre> <p>I could possibly do this:</p> <pre><code>&lt;style&gt; .my-button-ultimate{ width:100%; height:60px; white-space: normal; } &lt;/style&gt; ... ... &lt;div styleClass="btn my-button-ultimate"&gt;My Button&lt;/div&gt; </code></pre> <p>But it does not take full advantage of bootstrap, and still does not give me a single class in my element.</p> <p>I checked out this answer without success. LESS seems like what I want but I do not know how to implement it just yet, and I want to find out if there is a simple answer to combine classes into 1. <a href="https://stackoverflow.com/q/1065435/7012749">Can a CSS class inherit one or more other classes?</a></p>
<html><css><bootstrap-4>
2019-12-20 02:56:40
LQ_CLOSE
59,420,303
How do I access the input from UI Text View in Swift Xcode
I have linked my uitextview and I have looked all around and cannot seem to be able to access the information my user inputs. This probably is a dumb question but I am Kinda new to swift so any advice would be awesome. Thank again
<swift><xcode>
2019-12-20 05:34:03
LQ_EDIT
59,421,849
How is REST api versioning implemented technically?
<p>I am working on a REST api which needs to be refactored. This will be a breaking change so the original api is to be made as v1 and the new refactored api will be known as v2. The versioning will be implemented at url level.</p> <p>I want to understand technically how to approach this problem. Should I create a copy of the project and make the changes or should I make changes on the same project and then how do I expose the project as separate verisons?</p>
<c#><rest><asp.net-web-api><webapi>
2019-12-20 08:09:47
LQ_CLOSE
59,421,957
The type 'ContentPresenter' does not support direct content
<p>In WPF in XAML page I am getting error .The type 'ContentPresenter' does not support direct content.<a href="https://i.stack.imgur.com/tE21l.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tE21l.png" alt="enter image description here"></a></p> <p>the content presenter is inside the Custom Control. As I am new to WPF I might have not provided proper information,Please let me know if need more information. Thanks in Advance for the help!!!!</p>
<wpf><xaml><custom-controls>
2019-12-20 08:19:34
LQ_CLOSE
59,424,238
I want to make a snake game in a C# console, movement problem
<p>To change snakes direction I first have to press upArrow and then the new direction of the snake, and the snake is going in that direction until I hit upArrow again. So, to change direction to the left you need to press upArrow and then leftArrow. I want that to disappear, when I press left to make snake go left. Basically up arrow is pausing the game and I dont know why. </p> <pre><code> if (Console.KeyAvailable &amp;&amp; Console.ReadKey(true).Key == ConsoleKey.UpArrow) { keyinfo = Console.ReadKey(); Console.WriteLine(ConsoleKey.UpArrow); } if (Console.KeyAvailable &amp;&amp; Console.ReadKey(true).Key == ConsoleKey.DownArrow) { keyinfo = Console.ReadKey(); Console.WriteLine(ConsoleKey.DownArrow); } if (Console.KeyAvailable &amp;&amp; Console.ReadKey(true).Key == ConsoleKey.LeftArrow) { keyinfo = Console.ReadKey(); Console.WriteLine(ConsoleKey.LeftArrow); } if (Console.KeyAvailable &amp;&amp; Console.ReadKey(true).Key == ConsoleKey.RightArrow) { keyinfo = Console.ReadKey(); Console.WriteLine(ConsoleKey.RightArrow); } if (keyinfo.Key == ConsoleKey.UpArrow) { j--; } if (keyinfo.Key == ConsoleKey.DownArrow) { j++; } if (keyinfo.Key == ConsoleKey.LeftArrow) { k--; } if (keyinfo.Key == ConsoleKey.RightArrow) { k++; } </code></pre>
<c#><if-statement><controls><key><readkey>
2019-12-20 11:06:39
LQ_CLOSE
59,424,843
no overload for method get touch takes 0 arguments
<p>code:</p> <pre><code>void Update(){ if (Application.platform == RuntimePlatform.Android) { foreach (Touch touch in Input.GetTouch()) { if (touch.fingerId == 0) { if (!GameManager.instance.isPlaying) { GameUIManager.instance.showStartGameCanvas (false); GameManager.instance.isPlaying = true; myRiggidBody.constraints = RigidbodyConstraints2D.FreezePositionX; } isJump = true; } } } </code></pre> <p>now comes the error "no overload for method get touch takes 0 arguments"</p> <p>need help ;)</p>
<c#><unity3d>
2019-12-20 11:51:12
LQ_CLOSE
59,425,147
Laravel installer has been install but laravel command not found ... wtf?
I've got an issue with trying tu use laravel installer. I follow each steps to install laravel installer globally from https://laravel.com/docs/6.x, - sudo composer global require laravel/installer - export PATH="/home/hedwin/.composer/vendor/bin:$PATH" But laravel command isn't found in sudo, but it's found with error without sudo ... You cah see my picture for details : [Terminal][1] [1]: https://i.stack.imgur.com/Surh6.png i'm on ubuntu 18.04. Thanks a lot for every help..
<laravel><composer-php><installation>
2019-12-20 12:18:05
LQ_EDIT
59,426,387
Why is this 'if' statement printing "Impossible"?
<pre><code>public class Experiment5 { private static int countChar(String string, char c) { int count = 0; for (int i = 0; i &lt; string.length(); i++) { if (string.charAt(i) == c) { count++; } } return count; } public static void main(String[] args) { Scanner scan = new Scanner(System.in); String input = scan.nextLine(); if (countChar(input, '_') &gt; 0){ if ((countChar(input, 'X') - countChar(input, '0') &gt;= 2) || (countChar(input, '0') - countChar(input, 'X') &gt;= 2) ) { System.out.println("Impossible"); return; } System.out.println("Game not finished"); } } </code></pre> <p>Input: <br> XO_OOX_X_ <br> <br> I believe that the result should be "Game not finished" because the difference between the counts of 'X' and 'O' is 0. <br> Then why is this returning "Impossible"? <br> <br> Thank you for your help.</p>
<java><function><if-statement>
2019-12-20 13:54:18
LQ_CLOSE
59,429,987
im receiving this code when i run npm run dev why?
Failed to compile. [1] [1] ./src/index.js [1] Module not found: Can't resolve '.components/App' in 'C:\Users\Adam\Desktop\ChatBot\client\src' I'm receiving this result when I run ...npm run dev why? thanks in advance
<node.js><reactjs><npm><npx>
2019-12-20 18:42:39
LQ_EDIT
59,432,326
Finding element by "data-reactid" on Yahoo! Finance
<p>I am writing a python program to evaluate stock prices. I'm using <a href="https://finance.yahoo.com/screener/predefined/day_gainers" rel="nofollow noreferrer">this page on Yahoo! finance</a> to get my stock informaiton. I want to be able to get the top five listings' <strong>stock symbol</strong> on the top gainers page.</p> <p>Can someone either provide me with an example of how to get the top five stock <strong>symbols</strong> or show me how I can find the symbol element(using the data-reactid or any other meathod) using selenium preferably.</p> <p>Before this is flagged as a copy, I looked at the pages similar to this, but they did not solve my problem. Thanks in advance for any help!</p>
<python><python-3.x><selenium><selenium-webdriver><selenium-chromedriver>
2019-12-20 23:26:17
LQ_CLOSE
59,432,514
find the length of array using map function ES6
<p>I'm trying to find the length of an array using ES6 using the below code but it does not work.</p> <pre><code>a=[[1,2,3,4],[4,5,6]] result = a.map(d=&gt;({d[0]:d.length})) console.log(result) </code></pre> <p>This works:-</p> <pre><code>a=[[1,2,3,4],[4,5,6]] result = a.map(d=&gt;({name:d[0], length:d.length})) console.log(result) </code></pre>
<javascript><ecmascript-6>
2019-12-21 00:01:31
LQ_CLOSE
59,434,319
How to make a button on-click to go to another page using HTML?
<p>I have a button, when you click the button it will take you to one of my sub-sites.</p> <p>The button is a child element of a <code>a</code> tag. Is there a better way?</p> <pre><code>&lt;a target='_blank' href='example.com/sub-site.html'&gt; &lt;button name='link' style="cursor:pointer" class='example-style' value='example.com/sub-site' title='Example Title&gt;Example&lt;/button&gt;&lt;/a&gt; </code></pre> <p>If possible, I'll prefer not to use the <code>form</code> tag.</p> <p>Thanks!</p>
<html><button><hyperlink>
2019-12-21 07:26:35
LQ_CLOSE
59,434,405
I imported Selenium2Library, there were no errors but in Test case section of Robot framework its not getting recognised
[enter image description here][1] [1]: https://i.stack.imgur.com/OZSog.png clearly, under settings section, we see that the library seleniumlibrary is not being recognised?
<robotframework><selenium2library>
2019-12-21 07:42:27
LQ_EDIT
59,435,056
How can I properly use for loop in def?
<pre><code>def kolas(lst, n): for i in range(0, len(lst)): e = [] x = lst[i] % n e.append(x) return x </code></pre> <p>I noticed that for loop doesn't affect in def() - <strong>i</strong> is only assigned by the first value of the list. Does exist funcion like for loop that affects in def()?</p>
<python><function><for-loop>
2019-12-21 09:33:01
LQ_CLOSE
59,435,070
sort a string array by first two characters in swift
<p>I have a string array as strList = ["12abc", "23bcd", "12shsh", "23xyz"] Is there any way to sort the array according to just first two characters of each string?</p>
<arrays><swift><string><sorting>
2019-12-21 09:34:39
LQ_CLOSE
59,435,508
What is wrong with this code because when i click Buy Now button a next page appears but it is not showing the contents which want it to show?
This is HTML Code ================= ``` <div class="card-body" style="height:260px;"> <p class="card-text"> Java is a general-purpose programming language that is class-based, object-oriented, and designed to have as few implementation dependencies as possible</p> </div> <div class="card-footer" style="height:56px;"> <center><a href="BuyCourse.html"><button type="submit" id="javabtn" onclick="BuyJava()" value="Java" class="btn btn-primary">Buy Now</Button></a></center> </div> ``` This is second page code which opens after clicking Buy Now Button ================================================================== ``` <div class="container" id="containerJava"> <div> <div> <label style="font-size: 20; margin-top:50px; margin-left: 5px;">Course Name :-</label> <p id="lblcourse"></p> </div> <div> <label style="font-size: 20; margin-left: 5px;">Course Duration :-</label> <p id="lblduration"></p> </div> <div> <label style="font-size: 20; margin-left: 5px;">Course Price :-</label> <p id="lblprice"></p> </div> ``` And This is JavaScript code ======================== ``` function BuyJava() { document.getElementById("lblcourse").innerHTML = "Java"; document.getElementById("lblduration").innerHTML = "6 Months"; document.getElementById("lblprice").innerHTML = "6000/-"; } ```
<javascript>
2019-12-21 10:48:47
LQ_EDIT
59,437,743
Where can I find Java 8u241?
<p>I am looking for Java 8u241, as it is a requirement for a project I am working on. I have not been able to find it anywhere; not even Java’s own website.</p> <p>Any suggestions? I appreciate your’alls help!</p>
<java>
2019-12-21 16:02:33
LQ_CLOSE
59,439,096
ImportError: cannnot import name 'Imputer' from 'sklearn.preprocessing'
<p>Trying to import Imputer from sklearn,</p> <pre><code>import pandas as pd dataset = pd.read_csv('Data.csv') X = dataset.iloc[:, :-1].values y = dataset.iloc[:, 3].values #PART WHERE ERROR OCCURS:- from sklearn.preprocessing import Imputer </code></pre> <p>Shows "ImportError: cannot import name 'Imputer' from 'sklearn.preprocessing' (/home/codeknight13/anaconda3/lib/python3.7/site-packages/sklearn/preprocessing/__init__.py)"</p>
<python-3.x><scikit-learn><compilation>
2019-12-21 19:07:09
HQ
59,439,970
This isnt working. it isnt actually accepting that this is actually entered... when i enter manually it works.selenium python
im trying to get this code to work, but it isnt. i enter manually and it works but not when i automate it import selenium import time import os from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager num = 1 while num != 1000: driver = webdriver.Chrome(ChromeDriverManager().install()) driver.get('https://mobile.brawlhalla.com/?kid=1415HM') id_box = driver.find_element_by_id('email') id_box.send_keys(str(num) +'@1.com') login_button = driver.find_element_by_id('btn-id-6zgew9flrfn') login_button.click() time.sleep(10) os.system("taskkill /im chrome.exe /f") num = num + 1
<python><selenium>
2019-12-21 21:30:29
LQ_EDIT
59,440,004
Regular expression to remove characters at the end of a line
<p><br> I need a regular expression to remove sentences at the end of a line (after a period) containing more than 2 digits, example:</p> <p>Before<br> Some text1. Text (270) 6265204<br> Some text2. text97 66 48 35<br> Some text3. text 504-791-4972<br> Some text4. (414)5290192<br> Some text5. text6.<br></p> <p>After <br> Some text1.<br> Some text2.<br> Some text3.<br> Some text4.<br> Some text5. text6.</p>
<regex>
2019-12-21 21:37:49
LQ_CLOSE
59,440,679
I want to learn javascript
<p>I want to learn javascript soon and I would like to ask for your opinion about the online sites where I could start: Udemy, Pluralsight, Codecademy ... Which one is better? I attended a training in Angular on Pluralsight and I can say that I like it but I would like to try something new if it is worth it.</p>
<javascript>
2019-12-21 23:49:27
LQ_CLOSE
59,441,497
how to return an array in a c++ function
int main() { std::string my_string= "16657"; std::map<std::string, std::array<std::string, 2>> m_msg_int; std::array<std::string, 2> arrId; arrId[0] = "ABC"; arrId[1] = "XYZ/CDE"; m_msg_int[my_string] = arrId; get_msg_type(const std::string& msg_type); } const string get_msg_type(const std::string& msg_type) { TRC_ENTER(get_interface_and_msg_type, "") std::map<std::string, std::array<std::string, 2>>::const_iterator it = m_msg_int.find(msg_type); std::array<std::string, 2> intfMsg; if (m_msg_int.end() != it) { intfMsg = it->second; } return intfMsg; } confused about how to return this array and extract the values. maybe the return type is not correct. initializing argument 1 of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&&, const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>;
<c++><arrays>
2019-12-22 03:51:53
LQ_EDIT
59,442,182
How to find the sum of numbers that have digits higher than 5
<p>so I want to write a function that returns the sum of all numbers in an array who's digits are higher then 5 so for example if the array is [12, 66, 23, 67] the answer would be 66+67 This code summs all the numbers in the array and I can'\t figure out why</p> <pre><code> using namespace std; int func(int n[], int size){ int digit, S=0, a; for(int i=0; i&lt;size; i++){ a= n[i]; while( n[i]!=0){ digit= n[i]%10; if(digit&gt;=5){ n[i]= n[i]/10; } else break; } S=S+a; } return S; } int main() { int n[3], i; for(int i=0; i&lt;3; i++){ cin&gt;&gt;n[i]; } cout&lt;&lt;func(n, 3)&lt;&lt;endl; return 0; }``` </code></pre>
<c++>
2019-12-22 06:38:37
LQ_CLOSE
59,442,813
Api blockchain not works
<p>I've a little Bot to use the api for <a href="https://www.blockchain.com/" rel="nofollow noreferrer">https://www.blockchain.com/</a>. It's work until recently, but now the service respose with: erver returned HTTP response code: 429 . I have recevided the api-key for use the service. But is not present documentation to describe how use this api.</p> <p>Can you help me?? Thanks</p>
<api><blockchain><bitcoin>
2019-12-22 08:49:50
LQ_CLOSE
59,443,042
Can't vertical center h1 inside div
<p>I'm having some troubles when trying to vertical center a header inside a div. CSS is the following:</p> <pre class="lang-html prettyprint-override"><code>.container { background: #a3f; padding-left: 3% !important; } .container h4 { vertical-align: middle; text-align: center; background: #f02; } </code></pre> <p>I have tried some <a href="https://stackoverflow.com/questions/396145/how-to-vertically-center-a-div-for-all-browsers">solutions</a> (also <a href="https://stackoverflow.com/questions/16629561/why-is-vertical-align-middle-not-working-on-my-span-or-div">this</a>), but the text continues at the top of the div.</p>
<html><css>
2019-12-22 09:29:20
LQ_CLOSE
59,445,308
How to store items of a list in class1 on another list in class2
<p>I have two classes: Tache2new.java and Luncher.java. In Tache2new, I use a list named "rules" to store items.</p> <pre><code>public static void execute(String concept) { List&lt;Rule&gt; rules = new ArrayList&lt;&gt;(); … } </code></pre> <p>I would like to call this list in the class Luncher and store its items in ALLrules which is a list in Luncher.</p> <p>To do this, I added getList() method in Tache2new (line 239). And I added in Luncher the lines ending with the comment //$$ (see the capture). But this triggered an error (highlighted in yellow in Luncher): "the local variable rules may not have been initialized". How to fix this please? <a href="https://i.stack.imgur.com/nJYT4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nJYT4.png" alt="enter image description here"></a></p> <hr> <p><a href="https://i.stack.imgur.com/T1HrI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/T1HrI.png" alt="enter image description here"></a></p>
<java><arrays><arraylist>
2019-12-22 14:55:07
LQ_CLOSE
59,445,683
uninitialized float pointer (c++)
> so basically, I have this pointer in a struct, and it is used to fill the values of an array. it works as it should, but the visual studio keeps giving the same warning, saying that is uninitialized, and it's a NULL pointer, when it isn't. Can anyone explain/help? struct Sinal { int freq_amostra=0; int quant_amos_recol=0; float *val_amos; }; void p() { system("pause"); }; Sinal lerficheiro(); int main() { Sinal amostra; Sinal saida_rmo; Sinal saida_roc; Sinal saida_frc; int i,n; int opc_1, opc_2; char menu[6][50] = {{"Abrir ficheiro de amostras "},{"Aplicar retifica‡„o de meia onda "},{"Aplicar retifica‡„o de onda completa "},{"Aplicar filtro RC "},{"Guardar ficheiro de resultados "},{" Sair do programa "} }; do { system("cls"); printf("\t"); printf("%c", 201); { for (i = 0; i < 11; i++) { printf("%c", 205); } printf("%c \n", 187); printf("\t"); printf("%c", 186); printf(" Menu "); printf("%c \n", 186); printf("\t"); printf("%c", 200); } for (i = 0; i < 11; i++) { printf("%c", 205); } printf("%c", 188); printf("\n"); printf("%c", 201); for (i = 0; i < 3; i++) { printf("%c", 205); } printf("%c", 203); for (i = 0; i < 40; i++) { printf("%c", 205); } printf("%c \n", 187); for (n= 0; n < 6; n++) { if (n == 5) { printf("%c", 186); printf(" %d %c", n + 1, 186); printf("%s", menu[0, n]); printf("%c\n", 186); } else { printf("%c", 186); printf(" %d %c %s", n + 1, 186, menu[0, n]); printf("%c \n", 186); printf("%c", 204); for (i = 0; i < 3; i++) { printf("%c", 205); } printf("%c", 206); for (i = 0; i < 40; i++) { printf("%c", 205); } printf("%c \n", 185); } } printf("%c", 200); for (i = 0; i < 3; i++) { printf("%c", 205); } printf("%c", 202); for (i = 0; i < 40; i++) { printf("%c", 205); } printf("%c \n", 188); printf(" \n\n\n"); scanf_s("%d", &opc_1); printf(" \n\n"); switch (opc_1) { case 1: // ler ficheiro { amostra=lerficheiro(); printf(" \n"); break; } case 2: //retificação de meia onda { if (amostra.freq_amostra == NULL || amostra.quant_amos_recol == NULL) { printf("Deve escolher primeiro a op‡„o 1!\n"); } else { saida_rmo.freq_amostra = amostra.freq_amostra; saida_rmo.quant_amos_recol = amostra.quant_amos_recol; saida_rmo.val_amos = (float*)malloc(amostra.quant_amos_recol * sizeof(float)); for (int i = 0; i < amostra.quant_amos_recol; i++) { if (amostra.val_amos[i] > 0) { saida_rmo.val_amos[i] = amostra.val_amos[i]; } else { saida_rmo.val_amos[i] = 0; } } } break; } case 3: // retificação de onda completa {if (amostra.freq_amostra == NULL || amostra.quant_amos_recol == NULL) { printf("Deve escolher primeiro a op‡„o 1!\n"); } else { saida_roc.freq_amostra = amostra.freq_amostra; saida_roc.quant_amos_recol = amostra.quant_amos_recol; saida_roc.val_amos = (float*)malloc(amostra.quant_amos_recol * sizeof(float)); for (i = 0; i < amostra.quant_amos_recol; i++) { if (amostra.val_amos[i] >= 0) { saida_roc.val_amos[i] = amostra.val_amos[i]; } else if (amostra.val_amos[i] < 0) { saida_roc.val_amos[i] = -amostra.val_amos[i]; } } } break; } case 4: // aplicação de filtro RC {if (amostra.freq_amostra == NULL || amostra.quant_amos_recol == NULL) { printf("Deve escolher primeiro a op‡„o 1!\n"); } else { float res; float cond; double constante; double K1 = 0, K2 = 0; saida_frc.freq_amostra = amostra.freq_amostra; saida_frc.quant_amos_recol = amostra.quant_amos_recol; saida_frc.val_amos = (float*)malloc(amostra.quant_amos_recol * sizeof(float)); constante = 1.0/ saida_frc.freq_amostra; do { printf("\nIndique o valor de resistencia:"); scanf_s("%f", &res); printf("\nIndique o valor do condensador:"); scanf_s("%f", &cond); } while (res== 0 || cond == 0); double frac_res_cond = (1.0/res)*(1.0/cond); for (int i = 1; i < amostra.quant_amos_recol; i++) { //K1 = (float)(frac_res_cond *((amostra.val_amos[i - 1]) - (saida_frc.val_amos[i - 1]))); K1 = frac_res_cond *amostra.val_amos[i - 1] - frac_res_cond * saida_frc.val_amos[i - 1]; //K2 = (float)(frac_res_cond *(amostra.val_amos[i] - saida_frc.val_amos[i - 1] + (K1 * constante))); K2 = frac_res_cond * amostra.val_amos[i] - frac_res_cond * saida_frc.val_amos[i - 1] + frac_res_cond * (K1 * constante); saida_frc.val_amos[i] = (saida_frc.val_amos[i - 1] + (constante*K1 + constante*K2) / 2); } } break; } case 5: // guardar ficheiro {if (amostra.freq_amostra == NULL || amostra.quant_amos_recol == NULL) { printf("Deve escolher primeiro a op‡„o 1!\n"); } else { FILE* fich_save; float* freq; char nome_fich_guardar[50]; nome_fich_guardar[0] = '\0'; char nome[30]; char menu2[][50] = { { "Ficheiro de retifica‡„o de meia onda "},{"Ficheiro de retifica‡„o de onda completa "},{ "Ficheiro de aplica‡„o de filtro RC "}}; do { printf("Nome do ficheiro a guardar: \n"); scanf_s(" %s", nome_fich_guardar, 50); } while (strlen(nome_fich_guardar) < 1); strcpy(nome, nome_fich_guardar); strcat(nome, ".csv"); printf("\n %s \n", nome); fich_save = fopen(nome, "w"); freq = (float*)malloc(amostra.quant_amos_recol * sizeof(float)); freq[0] = (0.0 / amostra.freq_amostra); for (int i = 1; i < amostra.quant_amos_recol; i++) { freq[i] = (1.0 / amostra.freq_amostra) + (freq[i - 1]); } do { system("cls"); do { printf("\t"); printf("%c", 201); { for (i = 0; i < 32; i++) { printf("%c", 205); } printf("%c \n", 187); printf("\t"); printf("%c", 186); printf(" Que ficheiro pretende guardar? "); printf("%c \n", 186); printf("\t"); printf("%c", 200); } for (i = 0; i < 32; i++) { printf("%c", 205); } printf("%c", 188); printf("\n"); printf("%c", 201); for (i = 0; i <3; i++) { printf("%c", 205); } printf("%c", 203); for (i = 0; i < 42; i++) { printf("%c", 205); } printf("%c \n", 187); for (n = 0; n < 3; n++) { if (n == 2) { printf("%c", 186); printf(" %d %c", n + 1, 186); printf("%s", menu2[0, n]); printf("%c\n", 186); } else { printf("%c", 186); printf(" %d %c %s", n + 1, 186, menu2[0, n]); printf("%c \n", 186); printf("%c", 204); for (i = 0; i < 3; i++) { printf("%c", 205); } printf("%c", 206); for (i = 0; i < 42; i++) { printf("%c", 205); } printf("%c \n", 185); } } printf("%c", 200); for (i = 0; i < 3; i++) { printf("%c", 205); } printf("%c", 202); for (i = 0; i < 42; i++) { printf("%c", 205); } printf("%c \n", 188); printf(" \n\n\n"); scanf_s(" %d", &opc_2); } while (opc_2 < 1 || 3 < opc_2); switch (opc_2) { case 1: { if (amostra.freq_amostra == NULL || amostra.quant_amos_recol == NULL) { printf("Deve escolher primeiro a op‡„o 2!\n"); p(); } else { if (amostra.quant_amos_recol == saida_rmo.quant_amos_recol) { for (i = 0; i < amostra.quant_amos_recol; i++) { fprintf(fich_save, " %.8f; %.8f; %.8f\n", freq[i], amostra.val_amos[i], saida_rmo.val_amos[i]); } } else { exit(1); } } break; } case 2: { if (amostra.freq_amostra == NULL || amostra.quant_amos_recol == NULL) { printf("Deve escolher primeiro a op‡„o 3!\n"); p(); } else { if (amostra.quant_amos_recol == saida_roc.quant_amos_recol) { for (i = 0; i < amostra.quant_amos_recol; i++) { fprintf(fich_save, " %.8f; %.8f; %.8f\n", freq[i], amostra.val_amos[i], saida_roc.val_amos[i]); } } else { exit(1); } } break; } case 3: { if (amostra.freq_amostra == NULL || amostra.quant_amos_recol == NULL) { printf("Deve escolher primeiro a op‡„o 4!\n"); p(); } else { if (amostra.quant_amos_recol == saida_frc.quant_amos_recol) { for (i = 0; i < amostra.quant_amos_recol; i++) { fprintf(fich_save, " %.8f; %.8f; %.8f\n", freq[i], amostra.val_amos[i], saida_frc.val_amos[i]); } } else { exit(1); } } break; } } } while (opc_2 < 1 || 4 < opc_2); fclose(fich_save); printf("\n"); } break; } case 6: { exit(1); break; } } } while (1); } Sinal lerficheiro() { Sinal amostra; char local_fichlet[50]; local_fichlet[0] = '\0'; FILE* fichleitura; do { do { printf("Nome/localiza%c%co do ficheiro: ", 135, 132); scanf_s("%s", local_fichlet, 50); } while (strlen(local_fichlet) < 5); fichleitura = fopen(local_fichlet, "r"); if (fichleitura == NULL) { printf("Erro ao abrir o ficheiro: %s \n", local_fichlet); system("pause"); } } while (fichleitura == NULL); fscanf_s(fichleitura, "%d", &amostra.freq_amostra); fscanf_s(fichleitura, "%d", &amostra.quant_amos_recol); amostra.val_amos = (float*)malloc(amostra.quant_amos_recol*sizeof(float)); for (int i = 0; i < amostra.quant_amos_recol; i++) { fscanf_s(fichleitura, "%f", &amostra.val_amos[i]); } fclose(fichleitura); return amostra; } > C26495 Variable 'Sinal::val_amos' is uninitialized. Always initialize a member variable (type.6).
<c++>
2019-12-22 15:47:35
LQ_EDIT
59,445,784
INSERT INTO statement not working error 3134
<p>Currently trying to get my add button to work. I'm trying to insert into a table and I'm getting a Run-Time error '3134. I've watched several youtube videos and searched here. Not sure why its erroring out. There are no prime keys associated with this table.</p> <pre><code>CurrentDb.Execute "INSERT INTO tblMemberRecords (strLastName, strTimeType, strCrewPosition, strStartTime, strStopTime, ) " &amp; _ " VALUES ('" &amp; Me.cboLastName &amp; "','" &amp; Me.cboTimeType &amp; "','" &amp; Me.strCrewPosition &amp; "','" &amp; Me.strStartTime &amp; "','" &amp; Me.strStopTime &amp; "')" </code></pre>
<sql><vba><ms-access>
2019-12-22 15:59:03
LQ_CLOSE
59,447,736
how i can extract output form cmd using java script
how i can extract an output from cmd and add it as var in javascript i wanna extract this value as an example "11675724" in the screenshot below <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> ar extract = function(string) { var o = {}; string.replace(/(.*?)=(.*?)(?:\|\||$)/g, function(all, key, value) { o[key] = value; }); return o; }; <!-- end snippet --> [enter image description here][1] [1]: https://i.stack.imgur.com/CwWCj.png
<javascript><parsing><cmd>
2019-12-22 20:14:16
LQ_EDIT
59,448,202
bad request response to fetch REST API
I have built an API and app that uses that API. When I POST method via Postman it works fine but when I try fetch via app I get bad request 400 status response. What am I doing wrong? here is my js code: const myForm = document.getElementById('loginForm'); myForm.addEventListener('submit', function(e) { e.preventDefault(); const url = 'https://thawing-peak-69345.herokuapp.com/api/auth'; const myHeaders = new Headers(); myHeaders.append('Accept', 'application/json, text/html, */* '); myHeaders.append( 'Content-Type', 'application/json, charset=utf-8') const formData = { email: this.email.value, password: this.password.value }; console.log(formData); const fetchOptions = { method: 'POST', mode: 'no-cors', cache: 'no-cache', headers: myHeaders, body: JSON.stringify(formData) }; fetch(url, fetchOptions) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.log(err)) }) [request photo[\]\[1\][1] and response [enter image description here][2] headers request: [enter image description here][3] headers response: [enter image description here][4] [1]: https://i.stack.imgur.com/LKso7.png [2]: https://i.stack.imgur.com/vQVnm.png [3]: https://i.stack.imgur.com/yDCsk.png [4]: https://i.stack.imgur.com/1RS0j.png
<javascript><rest><api><fetch>
2019-12-22 21:36:22
LQ_EDIT
59,448,885
in python3: most efficient way to modify each element in multiple lists together?
Let's say I have 3 lists ``` a = [1.12, 2.23, 3.34] b = [2.12, 3.23, 4.34] c = [3.12, 4.23, 5.34] ``` my goal is to round the numbers down to 1 decimal. so I have this custom function: ``` import math def round_down(n, decimals=0): multiplier = 10 ** decimals return math.floor(n * multiplier) / multiplier ``` May I ask what is the most efficient way of operating on each element in each object? In this easy example I could write a loop for each of the 3 objects, such as: ``` for i in np.range(len(a)): a[i] = round_down(a[i], decimals=1) ``` However, in my work, I have many more lists of various lengths and I really don't want to code them one by one. Is there a way to iterate through a list of objects? or process them in parallel? Thank you so much! Jerry
<python><python-3.x>
2019-12-22 23:47:41
LQ_EDIT
59,449,136
How I can split string by comma and/or new line and/or whitespace
<p>Hi there I am searching for regex to split emails, but no success so far. What is the point I want to make possible to separate this:</p> <pre><code>o@gmail.com b@gmail.com c@gmail.om </code></pre> <p>or </p> <pre><code>o@gmail.com, b@gmail.com,c@gmail.com </code></pre> <p>or </p> <pre><code>o@gmail.com, b@gmail.com, c@gmail.com </code></pre>
<javascript><regex>
2019-12-23 00:42:17
LQ_CLOSE
59,450,094
How can i hide request header and parameters for rest api
I am using laravel and vue js. In vue js, i am requesting api using axios. when i inspect and get request header and parameters in browser and it is possible to request in Postman. Everyone can request any apis after login because it is possible to get header and parameters.
<javascript><php><laravel><vue.js><networking>
2019-12-23 04:13:20
LQ_EDIT
59,450,183
Why mysql querry doesnt match with what i though?
*sorry for my bad eng :( Guyss... Please help me,... i just learn MySQL, and i dont get why "permasalahan_khusus" doesnt match with "nama_psikolog" :( please explain where did i go wrong select customer.nama_customer, psikolog.nama_psikolog, tipe_permasalahan.permasalahan_khusus from customer cross join psikolog,tipe_permasalahan where customer.id_permasalahankhusus=psikolog.id_permasalahankhusus=tipe_permasalahan.id_permasalahankhusus; +------------------+-------------------+---------------------+ | nama_customer | nama_psikolog | permasalahan_khusus | +------------------+-------------------+---------------------+ | Sarah | Heryawan Bambang | Kriminal | | Susi Chandrawati | Nur Hasanah | Kriminal | | Jaka | Marcella Sondakh | Kriminal | | Cipto Tambunan | Marcella Sondakh | Kriminal | | Nina | Marcella Sondakh | Kriminal | | Anindyta | Heryawan Bambang | Kriminal | | Alyani | Marcella Sondakh | Kriminal | | Wisna Jaya | Muhammad Firyanto | Kriminal | | Indra Cahyo | Muhammad Firyanto | Kriminal | | Krisna | Nur Hasanah | Kriminal | +------------------+-------------------+---------------------+
<mysql>
2019-12-23 04:30:28
LQ_EDIT
59,451,255
Python get for loop result into an array variable
<pre><code>code = [] def getCode(): for data in range(59): code = [] min = 9900 max = 9999 code1 = randint(min, max) code2 = randint(min, max) code = str(code1) + '/' + str(code2) # print(code) return code print(getCode()) dat2 = pd.DataFrame({'code': [getCode()]}) </code></pre> <p>Hi, I'm trying to get a list of the number from the for loop. example result should be <code>[[9900/9910],[9910/9920],.....]</code>. However the code above only return me <code>9900/9910</code> even if I declare the array variable.</p>
<python><python-3.x>
2019-12-23 06:54:14
LQ_CLOSE
59,454,745
sql group by each row select
sql table name= phones rows= id, mobileno, status, userid, createdon each user can have multiple numbers, i want to find oldest active phonenumber for each users. status=1 is active. for example: user1= id=1, mobileno=123, status=1,userid=1,createdon=2019/12/20 user1= id=1, mobileno=1234, status=1,userid=1,createdon=2019/12/19 user1= id=1, mobileno=12348, status=0,userid=1,createdon=2019/12/17 user2= id=2, mobileno=12345, status=1,userid=2,createdon=2019/12/15 user2= id=2, mobileno=123456, status=1,userid=2,createdon=2019/12/10 result must be user1= id=1, mobileno=1234 user2= id=2, mobileno=123456 (id unqiue and mobileno= oldest active one) thanks.
<sql><sql-server>
2019-12-23 11:40:27
LQ_EDIT
59,454,934
How to compare two lists in python and write the similar index values in one list and non similar values in another list
<p>consider two lists a=[1,2,3], b=[1,4,5].The Code should print the similar values c=[1] and the Code should print d=[2,3,4,5] which shows different values</p>
<python><python-3.x><list><string-comparison>
2019-12-23 11:54:42
LQ_CLOSE
59,455,445
Excel VBA - Understanding of code - use of not, application.intersect, if condition in one line
***Private Sub Worksheet_Change(ByVal Target as Range) Dim Keycells as range Set Keycells = Range("Search_String") *If not application.intersect(Keycells, Range(Target.Address)) is nothing then msgbox "Working" End If* end sub***
<excel><vba>
2019-12-23 12:32:22
LQ_EDIT
59,455,598
how to call oracle stored proc in spark?
In my spark project , I am using spark-sql-2.4.1v. As part of my code , I need to call oracle stored procs in my spark job. > how to call oracle stored procs?
<apache-spark><apache-spark-sql>
2019-12-23 12:43:56
LQ_EDIT
59,455,965
regular expression Python with at least 3 upper cases
<p>I need a regular Expression that Matches a string that mustn't contain digits. The string should have at least 3 upper cases. In addition, the string should contain 6 to 40 chars.</p> <p>Here is my Approach, but it doesnt work as I expect it to:</p> <pre><code>re.findall("\\n(?=(?:[^A-Z]*[A-Z]){3})[^0-9]{6,40}:\\n",text, flags=re.MULTILINE) </code></pre>
<python><regex>
2019-12-23 13:11:57
LQ_CLOSE
59,456,223
In App Purchase with fingerprint or Face ID in Objective c
I have an Objective C Project which i am working using Xcode 11 and i am trying to implement In App Purchase. I used some tutorials and implemented successfully but i am not able to use Fingerprint or Face ID. Please find the Image Url below in which it shows old subscription interface asking for password. https://i.stack.imgur.com/Ux78D.jpg Can someone help me ?
<ios><objective-c><in-app-purchase><xcode11><face-id>
2019-12-23 13:31:01
LQ_EDIT
59,456,521
Sort a matrix by the sum of the rows C++
Heyy, I am new to programming, so can you help me finish my program? I have to sort the matrix by the sum of the rows, the smallets sum has to be first and the the bigger and at the end has to be the biggest sum. I have done this but I cant finish it: #include <iostream> using namespace std; int main () { int **matrix; int i, j, count, row, col, sum, temp; cout << "\n Enter the number of rows and columns"; cin >> row >> col; matrix = new int *[row]; for (count = 0; count < row; count++) matrix[count] = new int[col]; cout << "\nNow enter the element for the matrix."; for (i = 0; i < row; i++) { for (j = 0; j < col; j++) { cout << "\nRow " << (i + 1) << " Col " << (j + 1) << " :"; cin >> *(*(matrix + i) + j); } } for (i = 0; i < row; i++) { sum = 0; for (j = 0; j < col; j++) sum = sum + matrix[i][j]; cout << sum << endl; } for (int count = 0; count < row; count++) delete[]matrix[count]; delete[]matrix; matrix = 0; return 0; }
<c++><matrix><sum><rows>
2019-12-23 13:52:54
LQ_EDIT
59,457,479
If integer look like this `010` is first 0 consider integer?
<p>There was misunderstanding about this <code>int number = 010</code>, What I am saying is </p> <blockquote> <p>first 0 is not integer due to c# has no leading zero so <code>010</code> will be <code>10</code></p> </blockquote> <p>however one of stackoverflow user saying </p> <blockquote> <p>first 0 in <code>010</code> is integer </p> </blockquote> <p>so could anyone help to explain in details why first <code>0</code> in <code>010</code> is integer even though it has no value or it doesn't represent any mathematical integer !</p> <p>thanks in advance </p>
<c#>
2019-12-23 15:09:35
LQ_CLOSE
59,458,853
Python: How to find a list of all keys that contain equal values
I want to find a list (of lists) of all keys in a dictionary that contain values equal to other elements. For example: ``` dict_with_dups = { "a": 1, "b": 1, "c": 1, "d": 2, "e": 3, "f": 3, "g": 4, } keys_with_same = locate_same_keys(dict_with_dups) for key_list in keys_with_same: print(f"{key_list}") ``` The above should print this: ``` ['a', 'b', 'c'] ['e', 'f'] ``` How do I most efficiently write the function `locate_same_keys`?
<python><dictionary>
2019-12-23 16:58:01
LQ_EDIT
59,459,242
how to handle Array of column coming from UDF in spark dataframe
I am trying to concatenate the Array of column in spark dataframe i am recieving the Array of column through a spark scala UDF but I am getting below my code :- val sampleDf = sparksession.createDataFrame( List(("00", "DELHI", "111", "222", "333"), ("00", "SP", "123123123", "231231231", "312312312") )).toDF("RecordType", "CITY", "key1", "key2", "key3") //.printSchema() //.show(100,false) val test2 = sampleDf.withColumn("primayKEY",concat(getprimakey(aaa)(col("RecordType"),col("CITY"))): _*).show()//.printSchema()//show(false) } def getprimakey (mapconfig: Map[(String, String), (List[String], List[String])]) = udf((rec:String ,layout:String) => { println(rec+""+layout) val s = mapconfig(rec,layout)._1.map(x => col(x)).toArray//.map(x => col(x)) s }) Below is the error I am getting Exception in thread "main" java.lang.UnsupportedOperationException: Schema for type org.apache.spark.sql.Column is not supported at org.apache.spark.sql.catalyst.ScalaReflection$.schemaFor(ScalaReflection.scala:733) at org.apache.spark.sql.catalyst.ScalaReflection$.schemaFor(ScalaReflection.scala:693) at org.apache.spark.sql.catalyst.ScalaReflection$.schemaFor(ScalaReflection.scala:671) at org.apache.spark.sql.functions$.udf(functions.scala:3088) at com.rupesh.TEST_UDF$.getprimakey(TEST_UDF.scala:29) at com.rupesh.TEST_UDF$.main(TEST_UDF.scala:19) at com.rupesh.TEST_UDF.main(TEST_UDF.scala)
<scala><apache-spark><apache-spark-sql><user-defined-functions>
2019-12-23 17:34:58
LQ_EDIT
59,460,266
Sourcetree not refreshing view
<p>The view within sourcetree has to be manually updated by hitting F5 as of version 3.3.6.3829. I attempted to raise this as a bug on <a href="https://jira.atlassian.com/" rel="noreferrer">https://jira.atlassian.com/</a>, but the form doesn't give me a correct option for version with 3.2 being the most up to date version available. If someone can point me to the correct place to raise this bug, it would be much appreciated. </p>
<atlassian-sourcetree>
2019-12-23 19:14:34
HQ
59,461,659
a function with too many parameters in perl
<p>I have a function has too many parameters. I have viewed the resolving approach in PHP that passing class object into the function instead of many parameters. Is it any approaches for perl?</p> <p>Thanks</p>
<perl>
2019-12-23 21:52:49
LQ_CLOSE
59,464,344
c# wpf treeviewitem with contextmenu
<p>i just want to make right click menucontext with normal treeviewitem. all example i can find , it ask to bind with something . but i just don't want to bind any thing .</p> <p>for example:</p> <pre><code> TreeViewItem ceo = new TreeViewItem() { Header = "CEO" }; TreeViewItem manager1 = new TreeViewItem() { Header = "Manager1" }; TreeViewItem manager2 = new TreeViewItem() { Header = "Manager2" }; TreeViewItem person1 = new TreeViewItem() { Header = "person1" }; TreeViewItem person2 = new TreeViewItem() { Header = "person2" }; manager1.Items.Add(person1); manager2.Items.Add(person2); ceo.Items.Add(manager1); ceo.Items.Add(manager2); </code></pre> <p>i just want to make the subnode menucontext , can we?</p>
<c#><wpf>
2019-12-24 05:46:37
LQ_CLOSE
59,465,361
Loop add new record to array in typescript
<p>I have a opt variable in Typescript</p> <pre><code>let opt = [{}]; </code></pre> <p>if I want to add multiple children to opt variable to below exsample with for loop</p> <pre><code>options = [ { name: "option1", value: 1 }, { name: "option2", value: 2 } ] </code></pre> <p>how can I coding</p> <pre><code>for(i=0; i&lt;=5; i++) { ... } </code></pre>
<angular><typescript>
2019-12-24 07:29:57
LQ_CLOSE
59,465,758
How to set Auto Reconnect with Unified Topology
<p>After setting <code>useUnifiedTopology=true</code>, the Auto Reconnect stopped working and generates the following ERRORS:</p> <pre><code>DeprecationWarning: The option `reconnectInterval` is incompatible with the unified topology DeprecationWarning: The option `reconnectTries` is incompatible with the unified topology DeprecationWarning: The option `autoReconnect` is incompatible with the unified topology </code></pre> <p>How can i get the server to auto-reconnect with that new flag?</p> <p>I'm using <code>mongoose.createConnection</code> to connect with the following options:</p> <pre><code>{ autoReconnect: true, keepAliveInitialDelay: 300000, connectTimeoutMS: 300000, reconnectTries: Number.MAX_VALUE, reconnectInterval: 1000, useNewUrlParser: true, useUnifiedTopology: true, useCreateIndex: true, poolSize: 10, auth: { authSource: "admin" }, user: process.env.MONGO_USER, pass: process.env.MONGO_PASS } </code></pre>
<node.js><mongoose><node-mongodb-native>
2019-12-24 08:10:21
HQ
59,467,328
What is characteristics of a good unit test
I need to know that what is characteristics of a good unit test and best practices ? how much code coverage considered good enough ? In order for our unit tests to become effective we need to lay out some ground rules. What is a good unit test and what can we do to make sure we create tests that actually help us in our development efforts?
<ios><swift><xcode>
2019-12-24 10:24:22
LQ_EDIT
59,467,830
How should this Java code look like in Kotlin?
I started Kotlin after Java. I want to write this function to return `Single<List<LocationData>>` ```java override fun getDestinations(): Single<List<LocationData>> { //return ??? } ``` My LocationData class: ```java @Parcelize data class LocationData(val latitude: Double, val longitude: Double) : Parcelable ``` How can I create a List of static LocationData objects in Kotlin? In java I would do this in the function: ```java public ArrayList<LocationData> getDestinations(){ ArrayList<LocationData> data = new ArrayList<>(); LocationData location1 = new LocationData( 43.21123, 32.67643 ); LocationData location2 = new LocationData( 32.67643, 43.21123 ); data.add( location1 ); data.add( location2 ); return data; } ``` **So my question is that how would the above Java code look like in Kotlin?** Thanks!
<kotlin>
2019-12-24 11:04:22
LQ_EDIT
59,468,489
Observable returning value after method call finished
<p>getModel() method always return array with empty name array even when languages Observable returns value. why?</p> <pre><code> export interface Category extends BaseModel { code: string; name: LocalizedValue[]; description: LocalizedValue[]; active: boolean; } getAllLanguages(): Observable&lt;Language[]&gt; { // this return list of languages } protected getModel(): Category { let model: Category = { id: '', code: '', name: [], description: [], active: false, }; let nameField: LocalizedValue[] = []; this.languageService.getAllLanguages().subscribe(list =&gt; { list.forEach(l =&gt; { let n: LocalizedValue = { language: l.code, value: '', }; nameField.push(n); }); }); model.name = nameField; return model; } </code></pre>
<angular><rxjs><rxjs-observables>
2019-12-24 11:57:16
LQ_CLOSE
59,469,348
Converting a Regex from JS flavor to Golang flavor?
<p>I am trying to convert a certain regex from ECMAScript flavor to Golang flavor, here it is : </p> <pre><code>((r|🇷)+)(( |\n)*)((🇪|e)+)(( |\n)*)((p|🇵)+)(( |\n)*)((🇴|o)+)(( |\n)*)((🇸|s)+)(( |\n)*)((t|🇹)+) </code></pre> <p>Basically the point is to match messages like "r 🇪 p O s t". I've tried to replace " " by "\s" but it's still not working. Any idea please?</p>
<regex><go>
2019-12-24 13:11:12
LQ_CLOSE
59,470,414
i want on click screen close sidebar
<div class="col-6 text-left"> <!-- <span class="toggle-div toggle-btn" onclick="openNav()" id="nav-toggle"> --> <span class="toggle-div toggle-btn" onclick="openNav()" id="nav-toggle"> <i class="fa fa-bars"></i> </span> </div> <div class="sidebar" id="sidebar"> <a href="javascript:void(0)" class="closebtn" onclick="closeNav()" >×</a> <div class="sidebar-img"><a href="home_page.html"><img src="../assets/images/sidebar-img.png"></a></div> <div class="side-menus-list"> <ul id="" class=" "> <h6 class="sidebar-head "><li>Menu</li></h6> <li class="sidebar-menu"> <a class=" menu-text-color" href="single_post.html"> <span class="svg-block"> <svg class="svg-icon" xmlns="http://www.w3.org/2000/svg" id="noun_Newspaper_772219_1_" viewBox="0 0 19.911 17.219" width="19.911" height="17.219" data-name="noun_Newspaper_772219 (1)"> <g id="Group_44" data-name="Group 44"> <path class="icon-color" id="Path_62" fill="#454545" transform="translate(-8.9 -14.5)" d="M 27.137 14.5 H 13.484 a 1.687 1.687 0 0 0 -1.7 1.7 v 0.728 H 10.6 a 1.687 1.687 0 0 0 -1.7 1.7 V 29.73 a 1.976 1.976 0 0 0 1.867 1.989 H 26.822 a 2 2 0 0 0 1.989 -1.989 V 16.2 A 1.667 1.667 0 0 0 27.137 14.5 Z M 11.786 29.8 a 0.881 0.881 0 0 1 -0.291 0.679 a 1.057 1.057 0 0 1 -0.7 0.267 A 0.992 0.992 0 0 1 9.87 29.73 V 18.623 A 0.715 0.715 0 0 1 10.6 17.9 h 1.188 Z m 16.079 -0.073 a 1.025 1.025 0 0 1 -1.019 1.019 H 12.514 a 3.436 3.436 0 0 0 0.194 -0.437 v -0.049 c 0.024 -0.049 0.024 -0.121 0.049 -0.194 v -0.049 c 0 -0.073 0.024 -0.146 0.024 -0.243 V 16.2 a 0.715 0.715 0 0 1 0.728 -0.728 h 13.63 a 0.715 0.715 0 0 1 0.728 0.728 Z" data-name="Path 62" /> <path class="icon-color" id="Path_63" fill="#454545" transform="translate(-45.789 -30.862)" d="M 62.79 36.1 h -4.7 a 0.485 0.485 0 1 0 0 0.97 h 4.7 a 0.485 0.485 0 1 0 0 -0.97 Z" data-name="Path 63" /> <path class="icon-color" id="Path_64" fill="#454545" transform="translate(-45.789 -39.573)" d="M 62.79 47.6 h -4.7 a 0.485 0.485 0 1 0 0 0.97 h 4.7 a 0.485 0.485 0 1 0 0 -0.97 Z" data-name="Path 64" /> <path class="icon-color" id="Path_65" fill="#454545" transform="translate(-25.565 -48.284)" d="M 42.565 59.1 H 31.385 a 0.485 0.485 0 0 0 0 0.97 h 11.18 a 0.485 0.485 0 1 0 0 -0.97 Z" data-name="Path 65" /> <path class="icon-color" id="Path_66" fill="#454545" transform="translate(-45.789 -22.075)" d="M 62.79 24.5 h -4.7 a 0.485 0.485 0 1 0 0 0.97 h 4.7 a 0.485 0.485 0 1 0 0 -0.97 Z" data-name="Path 66" /> <path class="icon-color" id="Path_67" fill="#454545" transform="translate(-25.565 -57.071)" d="M 42.565 70.7 H 31.385 a 0.485 0.485 0 1 0 0 0.97 h 11.18 a 0.485 0.485 0 1 0 0 -0.97 Z" data-name="Path 67" /> <path class="icon-color" id="Path_68" fill="#454545" transform="translate(-25.565 -22.075)" d="M 31.385 31.072 h 4.268 a 0.486 0.486 0 0 0 0.485 -0.485 v -5.6 a 0.486 0.486 0 0 0 -0.485 -0.485 H 31.385 a 0.486 0.486 0 0 0 -0.485 0.485 v 5.6 A 0.486 0.486 0 0 0 31.385 31.072 Z m 0.485 -5.6 h 3.3 V 30.1 h -3.3 Z" data-name="Path 68" /> </g> </svg> </span> Home </a> </li> </ul> </div> <script type="text/javascript"> function openNav() { document.getElementById("sidebar").style.width = "200px"; } function closeNav() { document.getElementById("sidebar").style.width = "0"; } </script>
<html><css>
2019-12-24 14:48:31
LQ_EDIT
59,471,999
Append text to a Text file without replacing it Python
<p>Im new to python and I need some help from you guys. </p> <p><strong>So this is my Code</strong></p> <pre><code>Tk().withdraw() filename = askopenfilename(title='Choose a file', filetypes=[("Text Files", "*.txt")]) f = open(filename) with open(filename,'r+',encoding="UTF-8") as file: file.write('test') file.write('\n') file_contents = f.read() </code></pre> <p><strong>This is the Text File without using file.write</strong></p> <pre><code>Im a big noob in python please help me. </code></pre> <p><strong>And this is after using file.write</strong></p> <pre><code>test ig noob in python please help me. </code></pre> <p>My Goal is to append the Text to the top of the text file without replacing the contect underneath it.</p>
<python><python-3.x><tkinter>
2019-12-24 17:45:57
LQ_CLOSE
59,472,326
Linux Bash, what does this mean: awk 'OFS="\t" {$1=$1}1' /filepath
What does following Linux Bash code do: awk 'OFS="\t" {$1=$1}1' /filepath
<awk>
2019-12-24 18:30:13
LQ_EDIT
59,473,174
Can not use keyword 'await' outside an async function in a custom React hook
<p>I'm trying to create a custom hook, but I keep getting the error for the <code>getToken()</code> function: </p> <blockquote> <p>Can not use keyword 'await' outside an async function</p> </blockquote> <p>How do I get around this issue?</p> <pre class="lang-js prettyprint-override"><code>export const useExistingToken = async () =&gt; { const [existingToken, setExistingToken] = useState('') const [tokenLocallyExists, tokenLocalCheck] = useState() useEffect(() =&gt; { if (!tokenLocallyExists) { const token = await getToken() // issue here setExistingToken(token) } }, []) return [existingToken, tokenLocalCheck] } </code></pre>
<javascript><reactjs><react-native><async-await><react-hooks>
2019-12-24 20:33:11
LQ_CLOSE
59,474,706
Python : How to replace the array of values in one dictionary with elements from another array of dictionaries
This is my dictionaries: ``` main_dict = [ {'link_value':[123,111] , 'id' : 22} {'link_value':[234] , 'id' : 14} ] dict2 = [ {'id':123 , value:['xx','yy'],name:'mg1'} {'id':111 , value:['zz','yy'],name:'mg2'} {'id':234 , value:['aa','yy'],name:'mg3'} ] ``` I want to replace the link_value with elements from the dict2 array ``` expected_result: [ {'link_value':[{'id':123 , value:['xx','yy'],name:'mg1'} ,{'id':111 , value:['zz','yy'],name:'mg2'}] , 'id' : 22} {'link_value':[{'id':234 , value:['aa','yy'],name:'mg3'}] , 'id' : 14} ] ```
<python><dictionary>
2019-12-25 02:16:56
LQ_EDIT
59,475,155
I am having problem in downloading the VS code here is error i am getting i am using macBook pro
<p>I am not able to install Visual Studio Code can anyone please help me.I am adding image please help me out of this.</p>
<visual-studio-code>
2019-12-25 04:08:24
LQ_CLOSE
59,475,551
Javascript Functions - Calling Two Function In A File
<p>Question: Two Functions Return Different Data But After Calling Both Functions Receive Output From Last Function. Why? </p> <blockquote> <p>javascript</p> </blockquote> <pre><code>var printStudentInfo = function () { return 'Name'; } var printStudentTerritory = function () { return 'Age'; } printStudentInfo(); printStudentTerritory(); </code></pre>
<javascript>
2019-12-25 05:43:35
LQ_CLOSE
59,476,267
How to get file name without file extension
<p>Im trying to get file name without its extension, i have the following code that let me take the file name with extension which is </p> <pre><code>var docName = new DirectoryInfo("C:\\files\\").GetFiles("*.docx"); </code></pre> <p>with that code im taking all of the file names then use them on </p> <pre><code> for(int a = 0; a &lt; docLength; a++) { Consol.WriteLine("Your File Name : {0}", docName[a] ) // this part is just ex. } </code></pre> <p>when i execute the program it will list the file names like</p> <pre><code>Test.txt test.docx </code></pre> <p>and etc.</p> <p>how can i get the document names without their extensions like</p> <pre><code>test </code></pre>
<c#><.net>
2019-12-25 07:43:50
LQ_CLOSE
59,477,079
How can I modify Jenkins Configuration Global Security from linux server?
In Jenkins UI, I have the below section under http://XXXXXX:YYYY/configureSecurity/ [![OpenID Federated Login][1]][1] where can I find this definition in Server (Linux RHEL)? I tried to grep for it in jenkins-production folder but couldn't find anything. is there a way to change the checkbox for 'Enable script security for Job DSL scripts' from server? [1]: https://i.stack.imgur.com/vilN1.png
<jenkins><rhel>
2019-12-25 09:41:08
LQ_EDIT
59,477,161
Why does the command prompt showing this following error?
<p>I just installed the GCC compiler and wanted to test if it is working correctly. But in the middle, I am facing this issue with the command prompt as shown in the figure. 'ls' ie., List command is not working what might be the problem??</p> <p>Regards,<a href="https://i.stack.imgur.com/Jd8OR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Jd8OR.png" alt="enter image description here"></a></p>
<windows><command-prompt>
2019-12-25 09:49:28
LQ_CLOSE
59,477,621
iOS/Swift how update Table View in Real Time
<p>I need to to fetch realtime news from API, and then show them in a <code>UITableView</code>, news must disappear 5 seconds after their arrival.</p> <p>I am new in Swift, I know that UITableView has <code>reloadData()</code> that is meant to update the data in the table, I suppose I should use this method.</p> <p>My idea is to call the Api every 5 seconds, but how it works update/animation for making disappearing the news and adding new ones in the table?</p>
<ios><swift><api><uitableview>
2019-12-25 10:49:51
LQ_CLOSE
59,478,673
How does password manager rechecks the password as salt value is random?
<p>I am relatively new to LINUX, so I am having trouble understanding one concept related to pass in LINUX.</p> <p>I learnt that UNIX stores my passwords by hashing it, and storing along with the randomly generated salt value.</p> <p><code>Salt value is nothing but a random data that's generated to combine with the original password, inorder to increase the strength of the hash.</code></p> <p>So now lets say I want to login again using my password, the manager calculates the hash but from where will it bring the same salt for checking the result with the password database?</p>
<linux><unix><passwords><salt><passwd>
2019-12-25 13:05:07
LQ_CLOSE
59,478,743
C: How to detect a re-entry of a char character?
<blockquote> <p>I am creating a program whereby; the first input e.g. 'a' will give a "no duplicate" result, and upon re-entry of 'a' it should would give me a "duplicate has found" result.</p> </blockquote> <pre><code>I am having a hard time finding the logic to this program. Help would be much appreciated. Thanks. </code></pre> <blockquote> <p>I am working on lines 127-129 btw. <a href="https://pastebin.com/wQKH3iZE" rel="nofollow noreferrer">https://pastebin.com/wQKH3iZE</a></p> </blockquote>
<c>
2019-12-25 13:13:55
LQ_CLOSE
59,481,186
Different output using print and return
can anyone explain me why we get different output using print and return. For this code: def string(txt): for char in txt: print(char) string('Stack') the output would be: S t a c k And for this code: def string1(txt): for char in txt: return char string1('Stack') the output would be: 'S'
<python><python-3.x>
2019-12-25 19:10:38
LQ_EDIT
59,481,375
Add a prefix of +1 to a string
<p>How can I remove all non 10 digit numbers from a string, and add a +1 to the front of it if it doesn't exist yet?</p> <p>Here's the regex code I have:</p> <pre><code>phoneNumber.replace(/[^0-9.\,]/g, ''); phoneNumber = '+1' + phoneNumber; </code></pre> <p>but this won't work if <code>phoneNumber</code> already has <code>+1</code>. How can I make it that the regex first removes all non numerical, and adds a prefix of +1?</p>
<javascript><regex>
2019-12-25 19:43:02
LQ_CLOSE
59,482,179
which one of these returns a registry value?
<https://docs.microsoft.com/en-us/windows/win32/sysinfo/retrieving-data-from-the-registry> is confusing me. All I want is to retrieve the value of particular registry key. Which one of the functions do I use? Many thank, -T
<winapi><registry>
2019-12-25 22:08:50
LQ_EDIT
59,483,042
Game development: Are in-game interrupts ever used?
<p>I'm learning game development, and the tutorials tell me to put everything in a while (1) loop. However, this is discouraged in embedded systems, where it's better if everything is treated as an interrupt. </p> <p>Does this same concept apply in game development? I feel as if adding everything into a continuous loop would slow down a game significantly.</p>
<software-design>
2019-12-26 01:29:32
LQ_CLOSE
59,484,111
Why the correct output of this java code is 22? Not 12?
<p>I was solving some java-tasks and had a problem with that one:</p> <pre><code>What is the output of this code? public class Test { public static int test(int i) { try { if (i == 0) throw new Exception(); return i; } catch (Exception e) { return 1; } finally { return 2; } } public static void main(String[] args) { System.out.print(test(0)); System.out.print(test(3)); } } </code></pre> <p>The correct answer of that code is 22.</p> <p>Could someone, please, explain to me, why 22? Why not 12?</p> <p>Thanks!</p>
<java><exception><output>
2019-12-26 05:16:23
LQ_CLOSE
59,484,643
Find the top 10 centre most values from each clusters done by k-means using python
<p>I have a data frame and I have clustered it into 3 clusters using k-means clustering. </p> <p>Now I want to find the top 10 centre most values from each clusters. </p> <p>How to do it using python ? </p>
<python><machine-learning><cluster-analysis><k-means>
2019-12-26 06:28:56
LQ_CLOSE
59,484,828
how to get coordinates from polyline (google maps api)
i am able to draw a polyline between source and destination using google maps api on android. Now, I want to get locations from the polyline for let's say every 25meter. So, as the polyline is generated between two points, app must generate coordinates for the points on polyline at a distance of 25meter. So as you can see in image i need coordinates for blue crosses. [need coordiantes for all the blue crosses] [1]imgur.com/AHcCY.png
<android><google-maps><android-studio>
2019-12-26 06:46:34
LQ_EDIT
59,486,987
How to Remove special characters at the end and at the begging of the string
<p>I have a string:</p> <pre><code>String str = " line0\n" + "line1\n" + "line2 line0\n" + "line3\n" + "line4 \n" </code></pre> <p>How can I get the following script:</p> <pre><code>String formatedStr = "line0\n" + "line1\n" + "line2 line0\n" + "line3\n" + "line4" </code></pre>
<java><string>
2019-12-26 10:20:07
LQ_CLOSE
59,487,789
I have a problem with my java homework. I need to verify an email
<p>If you speak german, this is the task:</p> <p>Schreiben Sie eine Methode checkEmail(String email), die prüft ob ein String eine Email Adresse ist. Hierzu können Sie das Pattern / Matcher Konstrukt verwenden:</p> <pre><code>Pattern pattern = Pattern.compile( "[\\w|-]+@\\w[\\w|-]*\\.[a-z]{2,3}" ); Matcher m = pattern.matcher(email); m.find(); </code></pre> <p>Diese Methode soll mittels throws Konstrukt (Im Methodenkopf von checkEmail) Exceptions an die Aufrufende Methode (main) weiterleiten.</p> <p>However if u are not, all in all i have to verify a String as an email. I should use <code>pattern</code> and <code>matcher</code>. I also have to use <code>throws</code>. My method should then "tell" my main method if and exception has appeared and of couse if the email is vaid or not. </p> <p>This is how far i got:</p> <pre><code>import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; public class Test { public static boolean checkEmail(String email)throws PatternSyntaxException { String emailRegex = "^[a-zA-Z0-9_+&amp;*-]+(?:\\." + "[a-zA-Z0-9_+&amp;*-]+)*@" + "(?:[a-zA-Z0-9-]+\\.)+[a-z" + "A-Z]{2,7}$"; Pattern pat = Pattern.compile(emailRegex); Matcher mat = null; if (email == null) return false; try { mat = pat.matcher(email); return mat.find(); } catch(Exception e) { System.out.println("There was a Problem"); } return mat.find(); } public static void main(String[] args) { String email = "contribute@geeksforgeeks.org"; if (checkEmail(email)) System.out.print("Yes"); else System.out.print("No"); } } </code></pre> <p>My program succsessfully tells me if the email is valid or not, but i dont get a "feedback" if there was an exception.. </p> <p>Sorry for any mistakes and thx already now!</p>
<java>
2019-12-26 11:28:55
LQ_CLOSE
59,488,883
Write a program to print odd numbers in a list by userentered input
#WAP to print odd numbers in a list. list2 = [ list2 for list2 in input("list").split(",")] odd_nos = [ num for num in list2 if num % 2 !=0] print ("Odd numbers in the list: ",odd_nos) I cant runthis program it came type error like: odd_nos =[ num for num in list2 if num % 2 !=0] TypeError: not all arguments converted during string formatting
<python><python-3.x>
2019-12-26 13:03:04
LQ_EDIT
59,488,961
How to create a Yii2 Query to get an array like given below
<p>I want to get the id and name arrays as output from a query. How to do that</p> <p>i need the output like this </p> <pre><code>[ ['id'=&gt;'&lt;sub-cat-id-1&gt;', 'name'=&gt;'&lt;sub-cat-name1&gt;'], ['id'=&gt;'&lt;sub-cat_id_2&gt;', 'name'=&gt;'&lt;sub-cat-name2&gt;'] ] </code></pre> <p>How to get an array like above from a yii2 query</p>
<php><yii2>
2019-12-26 13:09:05
LQ_CLOSE
59,489,883
how and using which library can i use knn imputation for missing value analysis
<p>I am trying to to impute the missing values using knn but i couldnt able to use the code: from fancyimpute import KNN<br> is there any other library for knn imputation ?</p>
<python><missing-data><knn><imputation>
2019-12-26 14:39:20
LQ_CLOSE
59,490,832
Java frontend beginner
<p>I have to build a simple java application so i am using Spring boot and hibernate as my frameworks . Its the first time i am doing this so i need all the help i can get, i manage to make the back end to work ,at least the most of it, but i was wondering what would be the easiest way to create a front end for my application ,something pretty basic , thank you in advance!</p> <p>here is my main model </p> <pre><code>... package com.scheduler.backend.model; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Table; @Entity @Table(name = "person") public class Person extends AbstractEntity { /** * */ //private static final long serialVersionUID = 1L; @Column private String firstName; @Column private String lastName; @Column private PersonType type; @Column private Long calendarId; public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public PersonType getType() { return type; } public void setType(PersonType type) { this.type = type; } public Long getCalendarId() { return calendarId; } public void setCalendarId(Long calendarId) { this.calendarId = calendarId; } } ... </code></pre>
<java><frontend>
2019-12-26 16:14:03
LQ_CLOSE
59,492,744
return statement does not work in forEach loop
<p>I'm trying to write a function <code>returnIndex</code> that returns the index of an object in an array, e.g. <code>myArr = [{ "name": "Bob", "age": 4 }, { "name": "Kirk", "age": 11 }]</code>, by passing in a given key/value pair: e.g. <code>returnIndex(myArr, "name", "Bob")</code> should return <code>0</code>.</p> <p>I tried this:</p> <pre><code>const myArr = [{ "name": "Bob", "age": 4 }, { "name": "Kirk", "age": 11 }] const returnIndex = (arr, key, value) =&gt; { arr.forEach((item, index) =&gt; { if (item[key] === value) { return index } }) } const i = returnIndex(myArr, "name", "Bob") console.log(i) </code></pre> <p><strong>I get undefined i in the console.</strong></p> <p>But when I create a throw-away variable i:</p> <pre><code>const myArr = [{ "name": "Bob", "age": 4 }, { "name": "Kirk", "age": 11 }] const returnIndex = (arr, key, value) =&gt; { let i arr.forEach((item, index) =&gt; { if (item[key] === value) { i = index } }) return i } const i = returnIndex(myArr, "name", "Bob") console.log(i) </code></pre> <p><strong>Then it works.</strong> Why is it that I cannot return index directly but have to set up a throw-away variable i? I don't understand this -- Help please!</p> <p>Also if you have a better way to solve this problem, please do share. Cheers!</p>
<javascript>
2019-12-26 19:40:12
LQ_CLOSE
59,493,551
Describe a sorted function by a loop
<p>I have a task. This is a learning task. I successfully solved it. But I have a problem. The problem is that I need to sort the values ​​in the list in descending order without using functions and methods. This needs to be done in a loop (without using sorted(), as I did).</p> <p>Guys, I honestly looked for a solution to this problem and tried to come up with this solution myself. But I didn’t succeed. Help me please.</p> <pre><code>import random spisok = [] for i in range(0,5): spisok.append(random.randint(1,25)) print('The following numbers are generated: ') print(spisok) sorted_nums = sorted(spisok, reverse=True) i = 1 last_num = sorted_nums[0] print('{i} maximum: {maxim}'.format(i=i, maxim=last_num)) for j in range(1, len(sorted_nums)): num = sorted_nums[j] if num != last_num: i += 1 print('{i} maximum: {maxim}'.format(i=i, maxim=num)) last_num = num </code></pre>
<python>
2019-12-26 21:18:13
LQ_CLOSE
59,494,232
Apache Spark: Group by condition
<p>I have a table which is like:</p> <pre><code>+-----+-----+ | name|value| +-----+-----+ |Alice| 1.2| | Lisa| 3.4| | Nick| 0.8| | Jack| 10.1| | Cici| 4.4| +-----+-----+ </code></pre> <p>I want to group the data by condition such as [value &lt; 1, 1 &lt;= value &lt; 5, value >= 5] and know the percentile of each group, so my expect group will be like this:</p> <pre><code>group percentile value &lt; 1 0.20 1&lt;=value&lt;5 0.60 value &gt;= 5 0.20 </code></pre> <p>Is there a simple and clear way to do this?</p>
<scala><apache-spark><pyspark><pyspark-sql>
2019-12-26 22:50:45
LQ_CLOSE
59,495,107
Can anyone explain what is TraitCollectionDidChange/UITraitCollection in simple term?
public override void TraitCollectionDidChange(UITraitCollection previousTraitCollection) base.TraitCollectionDidChange(previousTraitCollection) What does base.traicollectiondidchange do?
<ios><swift><xcode><xamarin><xamarin.ios>
2019-12-27 01:38:07
LQ_EDIT
59,495,760
Split column into 2 with '-' delimiter
Would need to split a column into 2, with a given delimiter. Excel file does not have a header in the columns. example input file and outfile s are attached.
<python>
2019-12-27 03:49:03
LQ_EDIT
59,495,933
Group according to its parent and children
This is the output of my List. I need help in grouping the children with their parent. Thanks for your help. 0). nodeID id_0 | nodeName Test 3 | parentID id_0 ******************************************** 1). nodeID id_72864 | nodeName Element A | parentID id_0 ******************************************** 2). nodeID id_72865 | nodeName Element B | parentID id_0 ******************************************** 3). nodeID id_72866 | nodeName Element C | parentID id_0 ******************************************** 4). nodeID id_72867 | nodeName Element D | parentID id_0 ******************************************** 5). nodeID id_72868 | nodeName Element E | parentID id_0 ******************************************** 6). nodeID id_72869 | nodeName Element 1 | parentID id_72864 ******************************************** 7). nodeID id_72870 | nodeName Element 2 | parentID id_72865 ******************************************** 8). nodeID id_108185 | nodeName Element | parentID id_72865 ******************************************** 9). nodeID id_72871 | nodeName Element 3 | parentID id_72866 ******************************************** 10). nodeID id_72872 | nodeName Element 4 | parentID id_72867 ******************************************** 11). nodeID id_73527 | nodeName Element 5 | parentID id_72868 *********************************************
<java>
2019-12-27 04:20:59
LQ_EDIT
59,498,305
How to clear out char array with memset
<p>I'm looking for a method to clear a char array similar to how in python you would do the following:</p> <pre><code>buffer = "" </code></pre> <p>Is using memset the best approach for this, or is there another builtin function/method I'm missing?</p> <p>What Ive tried:</p> <pre><code> memset(buf, '\n', sizeof(char)); </code></pre>
<c++><c><buffer><memset>
2019-12-27 09:00:51
LQ_CLOSE
59,498,524
how to sole application.yml with Spring boot (while parsing a block mapping)
i want to solve while parsing a block mapping error for use Spring boot with Eureka server configuration `while parsing a block mapping in 'reader', line 5, column 3: application: ^ expected <block end>, but found '<block mapping start>' in 'reader', line 15, column 4: hikari:` ^[image in application.yml][1] [1]: https://i.stack.imgur.com/9crs8.jpg
<spring><spring-boot>
2019-12-27 09:21:26
LQ_EDIT
59,498,816
How to echo html in php with link to database?
<p>below is what i had tried:</p> <pre><code>echo "&lt;input class='form-control' type='text' name='jobID' value='.$result['jobID'].' readonly&gt;"; </code></pre> <p>or </p> <pre><code>echo "&lt;input class='form-control' type='text' name='jobID' value=&lt;?php $result['jobID'];?&gt;readonly&gt;"; </code></pre> <p>thank you so much </p>
<php><html><mysql><database><twitter-bootstrap>
2019-12-27 09:46:28
LQ_CLOSE