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
58,129,842
Pygame: Rect that is different sized than image
this is my first post on here just created my first account. :D I am a beginner coder and learned python just 2 weeks ago, but I wanted to try something new and found [this tutorial](https://www.youtube.com/watch?v=VO8rTszcW4s&list=PLsk-HSGFjnaH5yghzu7PcOzm9NhsW0Urw&index=1) on the web. I used it and tweaked it a little. My goal is to create a zelda clone, meaning my game will be Tile-Based Now for the problem. All my sprites are not in 1:1 Ratio. The rect`s size i created is TILESIZE * TILESIZE (=64 height, 64 width). Now the rect sticks to the top, but I need it to stick to the bottom center of my sprite. I tried nummerous ways and asked my workmates, but they can´t help me either. Can you guys help me, but detailed so I can learn out of my mistake? All my code files (PasteBin links, I´m german I hope I did this right with posting PasteBin Links): ```main.py | https://pastebin.com/7Y20ARH0``` ```sprites.py | https://pastebin.com/F0BnAVZv | Inside here is my Player and the collision detection, so this is where you want to look for I assume``` ```tilemap.py | https://pastebin.com/S4eNPbZe | Probably unrelevant, thought I´d rather post it anyways ^^``` ```settings.py | https://pastebin.com/gNRrqp0v``` I appreciate every bit of help, but I can also understand if you don´t want to look trough this mess ^^
<python><pygame><game-physics>
2019-09-27 07:30:34
LQ_EDIT
58,129,896
i want to load my main code every 5 seconds? c# (winform)
i have a windows form app that display restaurant orders. i want to load the code every 5 seconds to check if there is a new order to display i have a timer created in the form designer : public void timer1_Tick(object sender, EventArgs e) { }
<c#><winforms><timer>
2019-09-27 07:33:29
LQ_EDIT
58,130,335
Replace all 'char' in string to 'charchar'
<p>Bumping into an issue when inserting data to SQLite. In SQLite we have to write two single quote(') when we want to add a value containing ('). <a href="https://stackoverflow.com/questions/12615113/how-to-escape-special-characters-like-in-sqlite-in-android/27082084">How to escape special characters like ' in sqlite in android</a></p> <hr> <h2>Question</h2> <p>How to replace all (') in string to ('')?</p> <blockquote> <p>My bro's watch is 8 o'clock ==> My bro''s watch is 8 o''clock</p> </blockquote> <p>It's better if the answer is written in Swift. Thank you!</p>
<swift><string><algorithm><sqlite>
2019-09-27 08:04:19
LQ_CLOSE
58,130,375
variable is undefined in else statement
<p>I am confused as to why I am getting an 'undefined' error in my code. I am trying to delete an id from an array using the variable of 'id', but it errors with 'undefined'. I have tried various options of moving the 'var id;' but still I get the error. I have marked in the code where the error is occuring and would be grateful if someone could help me to correct this error. Many thanks</p> <pre><code>$(function() { info = []; $(document).on('click', '.rowChk', function() { var id; if (this.checked) { $('#rowClk').show(); var currentRows = $(this).closest("tr"); var rackid = currentRows.find("td:eq(0)").text(); // var rackidnumber = currentRows.find("td:eq(1)").html(); var rackservice = currentRows.find("td:eq(2)").html(); var rackactivity = currentRows.find("td:eq(3)").html(); var rackdept = currentRows.find("td:eq(4)").html(); var rackcompany = currentRows.find("td:eq(5)").html(); var rackaddress = currentRows.find("td:eq(6)").html(); var rackuser = currentRows.find("td:eq(7)").html(); var rackitem = currentRows.find("td:eq(8)").html(); var rackddate = currentRows.find("td:eq(9)").html(); var rackdate = currentRows.find("td:eq(10)").html(); id = rackid; data = {}; data.rackids = id; // data.idnumber = rackidnumber; data.service = rackservice; data.activity = rackactivity; data.dept = rackdept; data.company = rackcompany; data.address = rackaddress; data.user = rackuser; data.item = rackitem; data.intakedate = rackdate; data.destroydate = rackddate; info.push(data); } else { console.log(id); &lt;--- Showing as undefined var index = info.findIndex(function(item) { return item.id === id; }); if (index !== -1) { info.splice(index, 1); if (info.length === 0) { $('#rowClk').css('display', 'none'); } } } }); }); </code></pre>
<javascript><jquery>
2019-09-27 08:07:05
LQ_CLOSE
58,130,553
Google-sheets parser for the cell
I got a string in the cell "D1-D4, D8-D11" Need it calc summ of elenents "D1, D2, D3, D4, D8, D9, D10, D11" Output - "8" ps I can calc summ of "D1, D2,...D11" but i need the parser for range "D1-D4"
<regex><google-sheets><sum><google-sheets-formula><array-formulas>
2019-09-27 08:19:44
LQ_EDIT
58,138,378
Call one of two methods dynamically
<p>Is there a way to convert this if/else statement so that it can be called in a more dynamic way without using reflection?</p> <pre><code>if (left.IsColliding()) directions.Remove(Direction.Left); else directions.Add(Direction.Left); </code></pre> <p>In JavaScript I can do the following and I was wondering if there was something similar in C#.</p> <pre><code>directions[left.IsColliding() ? "Remove" : "Add"](Direction.Left); </code></pre>
<c#>
2019-09-27 16:30:03
LQ_CLOSE
58,138,688
Kind of a font disorder
Hey guys ı have a question about my code. I think I maked everythig correct. But ı have a font disorder. Here is my code can u help me pls? How can I fix it?[This is first photo][1], [This is second photo][2] [1]: https://i.stack.imgur.com/lxvGn.png [2]: https://i.stack.imgur.com/J4K2k.png
<c++><fonts>
2019-09-27 16:54:08
LQ_EDIT
58,138,738
Illegal Characters in Path for XSLT Tranformation
<p>I am writing an XSLT transformation to translate a XML credit report. </p> <p>When I run the following code I am getting "Illegal Characters in Path" error. Not sure what I am missing. I want this method to return a HTML string.</p> <p>I have tested the XSLT transform on the XML and it works. This code fails on the transform.Load function with the "Illegal Characters in Path" error. </p> <p>What am I missing here?</p> <pre><code> private string FormatCreditReport(string inputXml) { var xsltTransform = new XslCompiledTransform(); var webRootPath = HostingEnvironment.ApplicationPhysicalPath; var path = webRootPath + "XSLT_Stylesheets" + Path.DirectorySeparatorChar + "CreditReportTransform.xslt"; var xsltTemplate = File.ReadAllText(path); xsltTransform.Load(xsltTemplate); StringWriter results = new StringWriter(); using (var reader = XmlReader.Create(new StringReader(inputXml))) { xsltTransform.Transform(reader, null, results); } return results.ToString(); } </code></pre> <p>XSLT Document:</p> <p></p> <pre><code>&lt;xsl:template match="/"&gt; &lt;html&gt; &lt;body&gt; &lt;table border ="1"&gt; &lt;tr&gt; &lt;th&gt;&lt;h2&gt;Credit File&lt;/h2&gt;&lt;/th&gt; &lt;/tr&gt; &lt;tr&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;File Since Date&lt;/td&gt; &lt;td&gt;&lt;xsl:value-of select="EfxTransmit/EfxReport/USConsumerCreditReports/USConsumerCreditReport/USHeader/CreditFile/FileSinceDate"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Date of Last Activity&lt;/td&gt; &lt;td&gt;&lt;xsl:value-of select="EfxTransmit/EfxReport/USConsumerCreditReports/USConsumerCreditReport/USHeader/CreditFile/DateOfLastActivity"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Date of Request&lt;/td&gt; &lt;td&gt;&lt;xsl:value-of select="EfxTransmit/EfxReport/USConsumerCreditReports/USConsumerCreditReport/USHeader/CreditFile/DateOfRequest"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;&lt;/tr&gt; &lt;tr&gt; &lt;th&gt;&lt;h2&gt;Subject&lt;/h2&gt;&lt;/th&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Last Name&lt;/td&gt; &lt;td&gt;&lt;xsl:value-of select="EfxTransmit/EfxReport/USConsumerCreditReports/USConsumerCreditReport/USHeader/Subject/LastName"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; &lt;/xsl:template&gt; </code></pre> <p></p>
<c#><xml><xslt>
2019-09-27 16:57:50
LQ_CLOSE
58,139,120
With cat command create a file which is a merge of 2 files(linux)
<p>What I'm trying to do:</p> <pre><code>With cat command create a file named Merge which is the merge of test.txt and Copy(in a different directory than test.txt) </code></pre> <p>Both <code>test.txt</code> and <code>Copy</code> contain the same content:</p> <pre><code>reglib test.txt </code></pre> <p>So what I expect is:</p> <pre><code>reglib test.txt reglib test.txt </code></pre> <p>What I've tried:</p> <pre><code>cat /home/eleve/Copy | cat test.txt &gt;Merge.txt cat /home/eleve/Copy &gt;Merge.txt | cat test.txt &gt;Merge.txt cat /home/eleve/Copy &gt;Merge.txt | cat test.txt &gt;&gt;Merge.txt </code></pre> <p>And all of those command gave me the same wrong result:</p> <pre><code>reglib test.txt </code></pre> <p>Can anyone please suggest me the right command? thanks.</p>
<linux><cat>
2019-09-27 17:32:14
LQ_CLOSE
58,139,406
Only run job on specific branch with GitHub Actions
<p>I'm relatively new to GitHub Actions and I have 2 jobs–one that runs my tests, and one that deploys my project onto a server.</p> <p>Obviously I want the tests to run on every branch, but deploying should only happen when something gets pushed to master.</p> <p>I'm struggling to find a way to run a job on a specific branch. I know it's possible to only run <em>entire workflows</em> on a specific branch, however that would mean I would have a "test" workflow and a "deploy" workflow. </p> <p>This sounds like a solution, however they would run parallel. In an ideal world, the tests would run first, and only if they succeed, then the deploy job would start. This isn't the case when using 2 separate workflows.</p> <p>How would I be able to achieve this? Is it possible to run <strong>jobs</strong> on a specific branch?</p>
<github><github-actions>
2019-09-27 17:56:54
HQ
58,139,893
Python converting data frame to comma separated rows
<p>I have a pandas dataframe, call it df with 2 columns:</p> <pre><code> user_id result --------- --------- 12 0 233 1 189 0 </code></pre> <p>And so forth. Is there an easy way to write this data frame out to a text file (with column headers removed) that just has comma-separated rows, i.e.,</p> <pre><code>12, 0 233, 1 189, 0 </code></pre> <p>Thanks.</p>
<python><pandas>
2019-09-27 18:38:12
LQ_CLOSE
58,140,106
PHP 5.6.10 - preg_match(): Compilation failed: invalid range in character class at offset 100
<p>I've following regular expression configured in ZendFrame work routing </p> <pre><code>'constraints' =&gt; array( 'controller' =&gt; '[a-zA-Z0-9_-]*', 'action' =&gt; '[a-zA-Z][a-zA-Z0-9_-]*', 'dashname' =&gt; '[a-zA-Z0-9_-\s]*', 'formatter' =&gt; '[a-zA-Z]*' ) </code></pre> <p>throwing error <b>Warning</b>: preg_match(): Compilation failed: invalid range in character class at offset 100 in <b>app\vendor\zendframework\zendframework\library\Zend\Mvc\Router\Http\Segment.php</b> on line <b>370</b><br /> <br /></p> <p>Issue seems to be with 'dashname' => '[a-zA-Z0-9_-\s]*',</p> <p>Same code works in PHP 5.4 version but not in PHP5.6 version, Any help is appreciated.</p>
<php><regex><zend-framework><zend-framework2><preg-match>
2019-09-27 18:57:06
LQ_CLOSE
58,140,410
go time.Parse, format "02/01/2006" is valid but "02/01/2003" not
<p>Why the first format is valid but the second not</p> <pre><code>package main import ( "fmt" "time" ) func main() { date := "21/07/1993" in := "02/01/2006" out := "02-01-2006" dt, err := time.Parse(in, date) if err != nil { fmt.Println(err) } fmt.Println(dt.Format(out)) date = "21/07/1993" in = "02/01/2003" out = "02-01-2003" dt, err = time.Parse(in, date) if err != nil { fmt.Println(err) } fmt.Println(dt.Format(out)) } </code></pre> <p>Output</p> <pre><code>21-07-1993 parsing time "21/07/1993" as "02/01/2003": cannot parse "93" as "0" 01-01-1012 </code></pre> <p><a href="https://play.golang.org/p/Ht0XZVs54ta" rel="nofollow noreferrer">https://play.golang.org/p/Ht0XZVs54ta</a></p>
<go>
2019-09-27 19:24:21
LQ_CLOSE
58,141,175
Determine months with 5 or more Sundays using Calendar module in Python?
<p>I need to write a code to find which month in a year 2018 for example has 5 or more Sundays? I want to use calendar module in Python and save the resulting months in abbreviated form. I saw documentation for calendar module but couldnt figure out the code.</p>
<python><python-3.x><calendar>
2019-09-27 20:48:27
LQ_CLOSE
58,142,524
Need assistance trying to web scrape
<p>Very very new to programming - I am trying to scrape a website in order to find get a quick view of some information on site.</p> <p>Found this on a tutorial on webscraping linked here: <a href="https://www.pythonforbeginners.com/python-on-the-web/web-scraping-with-beautifulsoup" rel="nofollow noreferrer">https://www.pythonforbeginners.com/python-on-the-web/web-scraping-with-beautifulsoup</a></p> <pre><code> from bs4 import BeautifulSoup import requests url = raw_input("enter a website to extract URL's from") r = requests.get("http://www.pythonforbeginners.com") data = r.text soup = BeautifulSoup(data) for link in soup.find_all('a'): print(link.get(href)) </code></pre> <p>Error message states "href is not defined". I don't know what else to try... Any help would be appreciated.</p>
<python><web-scraping><data-analysis>
2019-09-28 00:36:53
LQ_CLOSE
58,144,499
Not able to Pass Array Data
I am Trying to create an array in $data but not happening .. I am Using This code to make a Day Wise Sale Chart .... Kinldy Help Me ```php $data = array(); for($i=0; $i<=10; $i++){ $billdate = date('d-m-Y',strtotime("-$i day")); $sqlQuery = "select sum(amount),bill_date from msr_bills WHERE bill_date='$billdate' "; $result = mysqli_query($con,$sqlQuery); $fetchamount = mysqli_fetch_row($result); $sum = $fetchamount[0]; $data = new \stdClass(); $data->bill_date = $billdate; $data->amount = $sum; $report_JSON = json_encode($data); echo $report_JSON.","; } ```
<php><arrays><json><mysqli>
2019-09-28 08:06:43
LQ_EDIT
58,146,683
All jupyter contrib nbextensions are marked as possibly incompatible
<p>I have just installed <code>jupyter_contrib_nbextensions</code> by:</p> <pre><code>pip install jupyter_contrib_nbextensions jupyter contrib nbextension install --user </code></pre> <p>When I open a jupyter notebook and navigate to <strong><em>Edit -> nbextensions config</em></strong>, I see the below screen:</p> <p><a href="https://i.stack.imgur.com/ClDy1.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ClDy1.png" alt="nbextensions config"></a></p> <p>All extensions are marked as "<strong><em>possibly incompatible</em></strong>". A solution is to uncheck the option: "<strong><em>disable configuration for nbextensions without explicit compatibility</em></strong>". But is it safe? Any ideas why the <code>nbextensions</code> are incombatible?</p> <p>My package versions are:</p> <pre><code>jupyter==1.0.0 notebook==6.0.1 jupyter-contrib-nbextensions==0.5.1 </code></pre>
<jupyter-notebook><incompatibility><jupyter-contrib-nbextensions>
2019-09-28 13:17:19
HQ
58,147,602
I want to Sorting this list
I want to Sort below list Current Output : + Q1-2015 + Q1-2016 + Q1-2017 + Q1-2018 + Q1-2019 + Q2-2015 + Q2-2016 + Q2-2017 + Q2-2018 + Q2-2019 Expected Output : + Q1-2015 + Q2-2015 + Q3-2015 + Q4-2015 + Q1-2016 + Q2-2016 + Q3-2016 + Q4-2016 How can i achieve my expectation ?
<sql><sql-server><sql-server-2008>
2019-09-28 15:08:21
LQ_EDIT
58,148,888
so I need to pick the cube vaules between 1 and 100
cubos = [valor**3 for valor in range(1,101)]#creates a list the cubes from 1 to 100 for cubo in cubos:#loop and create the internal values if cubo >= 100:#pick the values bigger then 100 del cubo #delete them print (cubos)#print the values lower then 100
<python><math>
2019-09-28 17:49:14
LQ_EDIT
58,150,601
How do I replicate Gmail's "to" field where each item is an indivisible span?
<p>I want to replicate the functionality of Gmail's "to" field where:</p> <ul> <li>Each address is actually a div or span containing information</li> <li>The user treats each email address as an atomic, indivisible element -- e.g. backspace will delete it with backspace</li> <li>Elements are added by autocomplete. The implementation of autocomplete is outside of scope of this question. It's only here to clarify that an element is not just "text".</li> </ul> <p>Initially, I thought it should be a contenteditable element. However, inspecting Gmail's elements more closely, it looks to me like it's an element that just responds to keydown events</p> <p>Is there an accepted, easy way to do this, other than implementing the element (as well as key navigation) by hand?</p>
<javascript><forms>
2019-09-28 21:54:51
LQ_CLOSE
58,152,115
Could you explain what is happening in this code?
<p>Please explain what is happening in the code.</p> <p>I tried the if else that did not work. </p> <pre><code>#include &lt;stdio.h&gt; int isLeapYear(int year) { return ((!(year % 4) &amp;&amp; year % 100) || !(year % 400)); } </code></pre>
<c><leap-year>
2019-09-29 03:55:46
LQ_CLOSE
58,153,684
How do I Add Value as Source Code in Php Variable
<p>My source code here</p> <pre><code>&lt;?php $a = "$b = dfsdf "; echo $a; ?&gt; </code></pre> <p>I want to get out put result as below</p> <pre><code>$b = dfsdf </code></pre>
<php>
2019-09-29 08:47:22
LQ_CLOSE
58,154,360
How to check if all the item values of dict in python are same.?
<p>I have a <code>dictionary</code>: keys are strings, values are integers.</p> <p>For example:</p> <pre><code>data = {'a':100, 'b':100, 'c': 100} </code></pre> <p>I would like to check if all the item values in dict have same value or not? I can easily check which item value is the greatest but how do I check if all the values are same.?</p> <p>Thanks</p>
<python><dictionary>
2019-09-29 10:28:14
LQ_CLOSE
58,155,766
Loading vs linking in Cython modules
<p>While exploring Cython compile steps, I found I need to link C libraries like math explicitly in setup.py. However, such step was not needed for numpy. Why so? Is numpy being imported through usual python import mechanism? If that is the case, we need not explicitly link <em>any</em> extension module in Cython?</p> <p>I tried to rummage through the official documentation, but unfortunately there was no explanation as to when an explicit linking is required and when it will be dealt automatically.</p>
<python><cython>
2019-09-29 13:37:50
HQ
58,156,923
dropdown autosuggest hides list items from selection
<p>Not able to select from auto-suggest drop-down list items after first 3/4 items. because it is hided by table grid. how could we do this.? any hint ? which css/properties i need to set for table or auto-suggest drop-down list.?</p> <p><a href="https://i.stack.imgur.com/EbGGR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EbGGR.png" alt="enter image description here"></a></p>
<html><css>
2019-09-29 16:03:55
LQ_CLOSE
58,157,913
Need Help Making An Upside Down Pattern With Nested For Loops in Python
I am a beginner to python and programming in general, going on about a month now. I need to make a pattern with a function, which given an integer(n) will print out a particular pattern of size n. It should look like this at size 4, for example: !!!!!!!!!!!!!! \\!!!!!!!!!!// \\\\!!!!!!//// \\\\\\!!////// Here is my code thus far. I don't know how to invert the pyramid shape, and I don't know how to get the slashes to work with the exclamation points to create the desired pattern as you can see: def slashFigure(): width = int(input("Enter a number: ")) for i in range(0, width): for j in range(0, width - i): print("\\", end="") for k in range (0, 2*i + 1): print("!!", end="") print("/") slashFigure()
<python><python-3.x><for-loop><ascii><ascii-art>
2019-09-29 18:09:23
LQ_EDIT
58,160,187
How do i fix this output in C?
This is my code ``` #include <stdio.h> int main() { float percentage; int sp; int bp; percentage = (sp-bp)/bp*100; scanf("%d %d", &sp, &bp ); printf("%.2f%%", percentage); return 0; } ``` Sample input : ``` 150 85 ``` Sample output : ``` 76.47% ``` but my output is : ``` -100.00% ``` help me fix this, ty <3 im a newbie btw
<c>
2019-09-30 00:17:04
LQ_EDIT
58,162,195
I want to update column entire record of BOOKDATE_TO from my below query USING ORACLE PLSQL using loop or procedure
Here is the code I want book date_to to be updated I want a proper plsql code using procedure or loop that updated entire records of column book date_to SELECT r.resource_id, r.type, r.resort_id, r.parent_id, r.code, r.name, r.path, r.cashflowmanager_id, c.bookdate_from, c.bookdate_to, c.usage_date_from, c.usage_date_to FROM resourcebasei18n r JOIN cashflowrule c ON ( r.cashflowmanager_id = c.cashflowmanager_id ) WHERE name = '4-Persoons Ranchtent' AND ( c.usage_date_from BETWEEN '01-APR-20' AND '01-MAY-20' OR c.usage_date_to BETWEEN '01-APR-20' AND '01-MAY-20' );
<sql><oracle><plsql>
2019-09-30 05:59:15
LQ_EDIT
58,162,932
How to find all id's to an array from array of objects - Javascript
<p>How to find all id's to an array from array of objects. Here through normal for loop I can able to get but using ECMA new features by findAll etc..how to get?</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>let items = [ {id: 28, name: "Action", isSelected: true}, {id: 10770, name: "TV Movie", isSelected: false}, {id: 53, name: "Thriller", isSelected: true}, {id: 10752, name: "War", isSelected: false}, {id: 37, name: "Western", isSelected: true} ]</code></pre> </div> </div> </p> <p>Here I want to find all id's based on isSelected is true.</p>
<javascript>
2019-09-30 07:02:11
LQ_CLOSE
58,163,210
How to use TypeScript in a Custom Test Environment file in Jest?
<p>I need to enable some global variables to be reachable for my test so I am setting up a Custom Environment to be used in the <code>testEnvironment</code> option in my <code>jest.config.json</code> to achieve that.</p> <p>For our project we have a TypeScript file that we use for <code>setupFilesAfterEnv</code> option and that works just fine, however the <code>testEnvironment</code> seems to support only ES5. Is there any way to use TypeScript in such option?</p> <p>I successfully created a Custom Jest Environment using ES5 syntax, however since we are injecting global variables I need TypeScript to also declare a global namespace see: <a href="https://stackoverflow.com/a/42304473/4655076">https://stackoverflow.com/a/42304473/4655076</a>. </p> <pre class="lang-js prettyprint-override"><code>{ ///... setupFilesAfterEnv: ['&lt;rootDir&gt;/test/setup.ts'], // This works with ts testEnvironment: '&lt;rootDir&gt;/test/customJestEnvironment.ts', // This doesn't work with ts } </code></pre>
<node.js><typescript><jestjs>
2019-09-30 07:21:06
HQ
58,163,839
Which type can i use in mysql
<p>I am trying to store a number (12,000) in mysql.This number is to be displayed on a webpage and as well be used in calculations.is there any data type that can be used to achieve this.Currently i am using an int data type and it can't showcase commas.i have tried other types but it isn't possible</p>
<mysql>
2019-09-30 08:08:30
LQ_CLOSE
58,164,442
What did This Query Do And How it Do
I Have A linq Query Which I am Not Able to Understand @Model.MenuItems.Where(t=>t.Category.Name.Equals(category.Name))
<c#><linq><entity-framework-core>
2019-09-30 08:51:01
LQ_EDIT
58,168,042
How to see if a service is running on Linux?
<p>I'm using systemctl to setup and run my serviced on a Linux Redhat. How can I check if a service is in running state? </p> <p>I can use </p> <pre><code>systemctl is-active &lt;service name&gt; </code></pre> <p>to check if the service is is active or not. But I would like to check if the service is in the substate running.</p> <p><a href="https://i.stack.imgur.com/62XWE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/62XWE.png" alt="enter image description here"></a></p>
<linux><systemctl>
2019-09-30 12:35:10
LQ_CLOSE
58,168,359
how to fix the error <identifier> expected?
a code returns error <identifier> expected i dont't know why this error is occuring. I'm new to programming someone please help.!!!!! package com.company; import java.util.Scanner; import java.util.Scanner; public class Main { public static void main(String[] args) { intro(); time(); } public static void intro() { System.out.println("Welcome"); System.out.println("What is your name"); Scanner input=new Scanner(System.in); String name=input.nextLine(); System.out.println("Nice to meet you,"+name+" where are you travelling to?"); String dest=input.nextLine(); System.out.println("Great!"+dest+" sounds like a great trip"); } public static void time() { Scanner input=new Scanner(System.in); int hours,minutes; float perd,perdc,change; System.out.println("How many days are you going to spend travelling?"); int days=input.int(); hours=days*24; minutes=hours*60; System.out.println("How much money in USD are you going to spend?"); Double money=input.double(); perd=(money/days); System.out.println("What is the three letter currency symbol of your destination?"); String curr=input.nextLine(); System.out.println("How many"+curr+ "are there in 1USD?"); Double ex=input.double(); change=money*ex; perdc=perd*ex; System.out.println("If you are travelling for"+days+"that is the same as"+hours+"or"+minutes+"minutes"); System.out.println("If you are going to spend"+money+"$USD that means per day you can spend upto $"+perd+"USD"); System.out.println("Your total budget in"+ex+"is"+change+ex+",which per day is "+perdc+curr); } } a code returns error <identifier> expected i dont't know why this error is occuring. I'm new to programming someone please help.!!!!! reports <identifier> expected
<java><identifier>
2019-09-30 12:53:59
LQ_EDIT
58,168,821
How to merge sort string array with using pointer in c?
<p>I'm learning merge sort in the string array. Here is my code :</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; #define SIZE 10 int num = 0; // Merges two subarrays of arr[]. // First subarray is arr[l..m] // Second subarray is arr[m+1..r] void merge(char str[SIZE][10], int l, int m, int r) { int i, j, k; int n1 = m - l + 1; int n2 = r - m; /* create temp arrays */ char L[n1][10], R[n2][10]; /* Copy data to temp arrays L[] and R[] */ for (i = 0; i &lt; n1; i++) strcpy(L[i], str[l+i]); for (j = 0; j &lt; n2; j++) strcpy(R[j], str[m+1+j]); /* Merge the temp arrays back into arr[l..r]*/ i = 0; // Initial index of first subarray j = 0; // Initial index of second subarray k = l; // Initial index of merged subarray while (i &lt; n1 &amp;&amp; j &lt; n2) { num++; switch (strcmp(L[i], R[j])) { case -1 : strcpy(str[k], L[i]); i++; break; case 1 : strcpy(str[k], R[j]); j++; break; } k++; } /* Copy the remaining elements of L[], if there are any */ while (i &lt; n1) { strcpy(str[k], L[i]); i++; k++; } /* Copy the remaining elements of R[], if there are any */ while (j &lt; n2) { strcpy(str[k], R[j]); j++; k++; } } /* l is for left index and r is right index of the sub-array of arr to be sorted */ void mergeSort(char str[SIZE][10], int l, int r) { if (l &lt; r) { // Same as (l+r)/2, but avoids overflow for // large l and h int m = l+(r-l)/2; // Sort first and second halves mergeSort(str, l, m); mergeSort(str, m+1, r); merge(str, l, m, r); } } /* UTILITY FUNCTIONS */ /* Function to print an array */ void printArray(char A[SIZE][10], int size) { int i; for (i=0; i &lt; size; i++) printf("%s ", A[i]); printf("\n"); } int main(void) { int i, n; char str[SIZE][10] = {"korea", "aaa", "computer", "seoul", "algorithm", "bbb", "ccc", "ddd", "game", "java"}; char max[10]; printf("Given array is \n"); printArray(str, SIZE); mergeSort(str, 0, SIZE - 1); printf("\nSorted array is \n"); printArray(str, SIZE); printf("횟수 : %d", num); return 0; } </code></pre> <p>The code above is working good. But I want to change <code>merge(char str[SIZE][10], int l, int m, int r)</code> and <code>mergeSort(char str[SIZE][10], int l, int r)</code>, <code>printArray(char A[SIZE][10], int size)</code> code to using double pointer like not <code>char str[SIZE][10]</code> but <code>char **str</code>. How do I change in this code?? I tried to change like that, but some error occurred... I have to change the code in <code>merge()</code> members that <code>char L[n1][10]</code> and <code>char R[n2][10]</code>.</p>
<c><pointers><mergesort>
2019-09-30 13:22:43
LQ_CLOSE
58,169,144
how to print datagidview using crystal report in asp.net c#
I would like to know if exists the way to send a crystal report directly to the printer without print dialog. Ex. I have an asp.net page with a crystal report viewer and I want send to print once the report have been loaded into the viewer.
<asp.net>
2019-09-30 13:40:32
LQ_EDIT
58,170,179
I want a vba which will swtch column datas without switching the blank cell,
i have 2 columns A and B I want to copy the Column A data in Column B, there are few blank cells in A, but the Blank cell of 'A' Should not change the Data in column B. only the cells which have data, change the data in B.
<excel><vba>
2019-09-30 14:40:22
LQ_EDIT
58,170,900
Do i need to know jquery to learn and work on react js / angular js
<p>I just completed HTML, CSS &amp; JavaScript and i think im pretty good and confident in them i want learn angular js / react js to become a Complete Front End Developer</p> <p>SO</p> <p>Do i need to learn JQuery before learning angular js / react js &amp; PLS SUGGEST me one of the framework too.</p> <p>Thanks.</p>
<javascript><jquery><angular><reactjs>
2019-09-30 15:22:53
LQ_CLOSE
58,172,412
How to using math jax?
I've been read the docs and I still don't get how to apply it from TeX so basically i wanted to convert this string ` <p><span class='math-tex'>\\( x&gt;0,y&gt;0 \\)</span></p>` `<p><span class='math-tex'>( (\\frac{2}{7},\\frac{2}{18}) )</span></p>` they are tex version right ? using `\\( \\)` from my API and I still have no idea how to convert it ```` <script> MathJax = { tex: { inlineMath: [['$', '$'], ['\\(', '\\)']], } }; </script> <script type='text/javascript' async src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML'> </script> <p> <span class='math-tex'>( (\\frac{2}{7},\\frac{2}{18}) )</span> </p> ````
<javascript><html><reactjs><mathjax>
2019-09-30 17:13:00
LQ_EDIT
58,172,887
A computed column in SQL server to do this
I need to update an SQL server computed column with an autogenerate serial based on a ```SELECT ``` date time ascend. Here is the algorithm on my mind. ``` alter table select records order by datetime_col desc update column_of_interest from_above_table auto_increment value (1..n) where following datetime_col desc and also let auto_increment be unique for each location_col ``` For now my column of interest is null. I need to populate my column of interest based on the above.
<sql><sql-server>
2019-09-30 17:52:52
LQ_EDIT
58,174,227
I am completely lost on how to start, let alone accomplish a coding project for school
<p>So, my java class is having this thing called stem challenge Wednesday, and my group decided to tackle the problem of misinformation. We wanted to create a program that will scan an inputted document and cross reference it on online databases, like the library of congress, or wikipedia, or something like that. The only problem is that we have no clue how to use any IDEs or which IDE will allow us to accomplish what we want to do, let alone implement an AI into the program. </p> <p>I come here seeking advice on what to use and a basic how to start, because after that it's a matter of googling around, which I'm fairly good at lol. </p> <p>I've tried using Netbeans, Repl.it, and Eclipse, and once I know what I need to do, it'll be easier to learn how to use these, but I don't know if they are good for what I want to accomplish, or if they even allow for me to do so.</p>
<java><project>
2019-09-30 19:36:32
LQ_CLOSE
58,174,259
Problem with dinamic URL rewrite with .htaccess
I had spend last few hours to get static URL from dynamic URL with .htaccess If I get wanted URL I also get 404 error. Dynamic URL is EN/section.php?lang=$1&url=$2 I had wrote ^(.*)/(.*)$ and it doesn't work. This work well with some prefix like ^language-(.*)/(.*)$ and then I get URL like domain/language-en/some-section and it works but it is not wanted URL RewriteRule ^(.*)/(.*)$ EN/section.php?lang=$1&url=$2 [L] I expect URL like domain/en/some-section not URL like domain/language-en/some-section.
<php><apache><.htaccess><url-rewriting>
2019-09-30 19:38:16
LQ_EDIT
58,174,391
How to create a Window Message in C#
For JavaScript, to create a window alert, the code is window.alert("..."), but what is the code for this in C#? I thought it was MessageBox.Show("..."), but it isn't. Please and thank you.
<c#><wpf><window><alert>
2019-09-30 19:48:11
LQ_EDIT
58,175,221
Xcode 11 - Simulator won't respond
<p>Ever since I updated to Xcode 11, the simulator freezes intermittently. Specially when the keyboard is brought to focus. I don't think it has anything to do with memory or any hardware specs of my Mac since it does not crashes, just doesn't respond to any events.</p> <p>The only solution so far is to rebuild again and again the app until the touch on the textfield magically responds again.</p> <p>Has anyone faced the same problem? Any ideias on what might be causing it?</p> <p>Thank you!</p>
<xcode><ios-simulator><xcode11>
2019-09-30 20:59:34
HQ
58,178,090
How to parse JSON with datestamp outside object into each object, and create an array
<p>Server returns JSON data, I would like to insert the datestamp before each nested object into each object, then delete the datestamp outside of each object. </p> <p>Then, I would like to put all inner objects inside of an array.</p> <p>Is there a way to do this with JSON.parse or otherwise?</p> <p>Thank-you</p> <p>This is what the JSON data looks like after it's parsed:</p> <pre><code>{ '2019-09-30 16:00:00': { '1. apples': '13', '2. oranges': '12', '3. peaches': '15', '4. cherries': '14', '5. onions': '43' }, '2019-09-30 15:59:00': { '1. apples': '42', '2. oranges': '43', '3. peaches': '34', '4. cherries': '64', '5. onions': '45' }, } </code></pre> <p>This is what I would like it to look like after moving the datestamps into each trailing object, and wrapping all objects into an array. The actual data is many thousands of objects:</p> <pre><code>{ [ { 'date': '2019-09-30 16:00:00', '1. apples': '13', '2. oranges': '12', '3. peaches': '15', '4. cherries': '14', '5. onions': '43' }, { 'date': '2019-09-30 15:59:00' '1. apples': '42', '2. oranges': '43', '3. peaches': '34', '4. cherries': '64', '5. onions': '45' }, ] } </code></pre> <p>I hope to get it looking like the second set of data. Thank-you</p>
<javascript><json><parsing><object>
2019-10-01 04:34:04
LQ_CLOSE
58,178,882
Keyboard overlaying action sheet in iOS 13.1 on CNContactViewController
<p>This seems to be specific to iOS 13.1, as it works as expected on iOS 13.0 and earlier versions to add a contact in CNContactViewController, if I 'Cancel', the action sheet is overlapping by keyboard. No actions getting performed and keyboard is not dismissing.</p>
<swift><ios13><cncontact><cncontactstore><cncontactviewcontroller>
2019-10-01 06:03:55
HQ
58,179,034
Trying to find numbers in my String then store those values in a variable for use in math
Basically ive had a easy time at this so far because ive been just useing userInput.includes() then the word then what happens if the word is typed. I want to make it so the user can put like add 2 numbers together. So then my program would store that 2 make 2 variables then make a adding function. My big issue is finding the integer in a string and storing it in a variable. function hasNumbers(t) { var regex = /\d/g; return regex.test(t); } something like this would be good but id prefer it not to be a function. ether like var amountOfVariables = or if(userInput.includes,isinteger,typeof, etc there has to be a combination of methods that allows you to find a integer in a string. then stores it in a variable was trying to use document.write(amountOfVariables); to test if it was being stored but no luck. I know i need to convert the String part into a int. Example of a user input might be " make a C++ program that adds 2 numbers together" the 2 should be stored in whatever variable . I want a method or a way to store integers in a users input in variables for later use in functions. But at the moment I cant get this to work.
<javascript><html>
2019-10-01 06:18:36
LQ_EDIT
58,179,415
Error:(35, 62) java: void cannot be dereferenced
I'm trying to call a stored procedure using CallableStament, but when I do call the method for it returns Error:(35, 62) java: void cannot be dereferenced. Code: > public class Connect { > > public void connDB() throws Exception { > > > Class.forName("oracle.jdbc.driver.OracleDriver"); > > try (Connection conn = DriverManager.getConnection( > "jdbc:oracle:thin:@test123:4321:test1", "test", "test")) { > > if (conn != null) { > System.out.println("Connected to the database!"); > } else { > System.out.println("Failed to make connection!"); > } > > } catch (SQLException e) { > System.err.format("SQL State: %s\n%s", e.getSQLState(), e.getMessage()); > } > catch (Exception e) { > > } > } > > public void callablestatement(int resync_value){ > Connect conectivitateDb = new Connect(); > > CallableStatement stmt = conectivitateDb.connDB().prepareCall("{call > resync_entity.resync_this_entity(?)}"); > > stmt.setInt(1, resync_value); > stmt.execute(); > } } If I do the callable statement in the try catch block in from the conndb method, it works just fine.
<java>
2019-10-01 06:49:35
LQ_EDIT
58,180,264
sort positive float numbers in c
<p>I'm trying to sort positive float numbers in the most efficient way possible. I have more or less 10k elements.</p> <p>I thought about radix sort (best one so far) or bucket sort, someone has some suggestions and why. ty</p>
<c>
2019-10-01 07:50:06
LQ_CLOSE
58,180,806
What is the difference between fields and properties in Julia?
<p>Julia has the setter functions <code>setproperty!</code> and <code>setfield!</code> and the getter functions <code>getproperty</code> and <code>getfield</code> that operate on structs. What is the difference between properties and fields in Julia?</p> <p>For example, the following seems to indicate that they do the same thing:</p> <pre><code>julia&gt; mutable struct S a end julia&gt; s = S(2) S(2) julia&gt; getfield(s, :a) 2 julia&gt; getproperty(s, :a) 2 julia&gt; setfield!(s, :a, 3) 3 julia&gt; s S(3) julia&gt; setproperty!(s, :a, 4) 4 julia&gt; s S(4) </code></pre>
<julia>
2019-10-01 08:25:34
HQ
58,181,090
Why does unique_ptr<Derived> implicitly cast to unique_ptr<Base>?
<p>I wrote the following code that uses <code>unique_ptr&lt;Derived&gt;</code> where a <code>unique_ptr&lt;Base&gt;</code> is expected</p> <pre><code>class Base { int i; public: Base( int i ) : i(i) {} int getI() const { return i; } }; class Derived : public Base { float f; public: Derived( int i, float f ) : Base(i), f(f) {} float getF() const { return f; } }; void printBase( unique_ptr&lt;Base&gt; base ) { cout &lt;&lt; "f: " &lt;&lt; base-&gt;getI() &lt;&lt; endl; } unique_ptr&lt;Base&gt; makeBase() { return make_unique&lt;Derived&gt;( 2, 3.0f ); } unique_ptr&lt;Derived&gt; makeDerived() { return make_unique&lt;Derived&gt;( 2, 3.0f ); } int main( int argc, char * argv [] ) { unique_ptr&lt;Base&gt; base1 = makeBase(); unique_ptr&lt;Base&gt; base2 = makeDerived(); printBase( make_unique&lt;Derived&gt;( 2, 3.0f ) ); return 0; } </code></pre> <p>and i expected this code to not compile, because according to my understanding <code>unique_ptr&lt;Base&gt;</code> and <code>unique_ptr&lt;Derived&gt;</code> are unrelated types and <code>unique_ptr&lt;Derived&gt;</code> isn't in fact derived from <code>unique_ptr&lt;Base&gt;</code> so the assignment shouldn't work.</p> <p>But thanks to some magic it works, and i don't understand why, or even if it's safe to do so. Can someone explain please?</p>
<c++><templates><inheritance><unique-ptr>
2019-10-01 08:44:17
HQ
58,183,054
I want to the copy content of a txt file to another file after I match a string in C#
I have a Console File, I need to match a string ("Seq Started"), And if I get the string I want to copy all text till I get another string("Seq Ended") in a txt file.
<c#><text-files><text-extraction>
2019-10-01 10:38:28
LQ_EDIT
58,183,930
ios13 tls certificates issue - connection error
<p>Since the release of ios13 I have a strange problem in my iOS app due to tls connection error to my backend. If I try to connect to the backend via the simulator (iOS 13) it works fine, if I install the app on the physical device (iOS 13.1) I can't connect anymore due to:</p> <pre><code>2019-10-01 13:24:12.862510+0200 CopApp[1830:506662] [] tcp_input [C1.1:3] flags=[R.] seq=2608024828, ack=2612553500, win=28408 state=ESTABLISHED rcv_nxt=2608024828, snd_una=2612553500 2019-10-01 13:24:12.869115+0200 CopApp[1830:506662] Connection 1: received failure notification 2019-10-01 13:24:12.869360+0200 CopApp[1830:506662] Connection 1: received ECONNRESET with incomplete TLS handshake - generating errSSLClosedNoNotify 2019-10-01 13:24:12.869526+0200 CopApp[1830:506662] Connection 1: failed to connect 3:-9816, reason -1 2019-10-01 13:24:12.869684+0200 CopApp[1830:506662] Connection 1: encountered error(3:-9816) 2019-10-01 13:24:28.124012+0200 CopApp[1830:506782] [] tcp_input [C2.1:3] flags=[R.] seq=3652579464, ack=755757394, win=28408 state=ESTABLISHED rcv_nxt=3652579464, snd_una=755757394 2019-10-01 13:24:28.128402+0200 CopApp[1830:506782] Connection 2: received failure notification 2019-10-01 13:24:28.128627+0200 CopApp[1830:506782] Connection 2: received ECONNRESET with incomplete TLS handshake - generating errSSLClosedNoNotify 2019-10-01 13:24:28.128793+0200 CopApp[1830:506782] Connection 2: failed to connect 3:-9816, reason -1 2019-10-01 13:24:28.128949+0200 CopApp[1830:506782] Connection 2: encountered error(3:-9816) 2019-10-01 13:24:43.584026+0200 CopApp[1830:506831] [] tcp_input [C3.1:3] flags=[R.] seq=984907791, ack=487743401, win=28408 state=ESTABLISHED rcv_nxt=984907791, snd_una=487743401 2019-10-01 13:24:43.587452+0200 CopApp[1830:506831] Connection 3: received failure notification 2019-10-01 13:24:43.587674+0200 CopApp[1830:506831] Connection 3: received ECONNRESET with incomplete TLS handshake - generating errSSLClosedNoNotify 2019-10-01 13:24:43.587839+0200 CopApp[1830:506831] Connection 3: failed to connect 3:-9816, reason -1 2019-10-01 13:24:43.588047+0200 CopApp[1830:506831] Connection 3: encountered error(3:-9816) 2019-10-01 13:24:43.594292+0200 CopApp[1830:506831] Task &lt;DAEFF7C7-DF2E-4DCB-9BF9-2A7825D56AF2&gt;.&lt;1&gt; HTTP load failed, 0/0 bytes (error code: -1200 [3:-9816]) Si è verificato un errore SSL ed è impossibile effettuare una connessione sicura con il server. </code></pre> <p>Obviously the backend is the same and it's covered by an aws certificate created by aws certificate manager. I think the problem is not the certificate because I think it is compliant to the new apple's certificates policy but I can't understand where the problem is.</p> <p>Could you please help me?</p> <p>Thanks</p>
<swift><amazon-web-services><tls1.2><ios13><aws-certificate-manager>
2019-10-01 11:31:50
HQ
58,184,170
No UseDatabaseErrorPage() extension method in Net Core 3.0
<p>I have created Net Core 3.0 app and following code that worked in 2.2 now is not.</p> <pre><code>app.UseDatabaseErrorPage(); </code></pre> <p>Looks like in 3.0 class <code>DatabaseErrorPageExtensions</code> does not exist within <code>Microsoft.AspNetCore.Builder</code> namespace. Am I missing some dependency? I have EntityFrameworkCore NuGet with Tools and Design added.</p> <p>Adding </p> <pre><code>using Microsoft.AspNetCore.Builder; </code></pre> <p>not helped.</p>
<c#><.net><database><visual-studio><.net-core>
2019-10-01 11:46:41
HQ
58,184,452
Microsoft GraphQL - has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin
I'm running my Vue app locally from http://localhost:8080 and I keep getting a slew of CORS errors, I've added the Access-Control-Allow-Origin header as seen blow but keep getting the following warning: ' from origin 'http://localhost:8080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. ``` const graphCall = () => { let tokenOptions = { method: 'POST', uri: 'https://login.microsoftonline.com/**key**/oauth2/v2.0/token', headers: { 'Access-Control-Allow-Origin': 'http://localhost:8080', 'contentType': 'application/x-www-form-urlencoded' }, form: { grant_type: VUE_APP_GRANT_TYPE, client_secret: VUE_APP_CLIENT_SECRET, scope: VUE_APP_SCOPE, client_id: VUE_APP_CLIENT_ID } }; return rp(tokenOptions) .then(data => { console.log(data) }).catch((err) => { console.log(err); }); }; ``` I've tried adding mode: 'no-cors' but just get the following - Error: Invalid value for opts.mode I've also tried '*' as the access control origin but to no avail. Is there a way through this CORS nightmare as we need to make this call to retrieve a key! Pretty new to all of this so please bare with me if I've not been as descriptive as I could have been!
<javascript><node.js>
2019-10-01 12:07:36
LQ_EDIT
58,186,643
Are these CSS selector syntax equivalent?
<p>I would want to know if both the syntax below are valid and equivalent?</p> <pre><code> /* Type: 1 */ html, body { } /* Type: 2 */ html body { } </code></pre>
<css><css-selectors>
2019-10-01 14:11:24
LQ_CLOSE
58,187,072
Problem with querying database in mysql 5.7.26
<p>I am learning php and mysql, and I'm currently reading a book where I'm trying out the examples on my own webserver.</p> <p>I had no problem setting up the database I'm using, and the code I am using to insert new rows into my database table works perfectly when I test it by writing directly in the INSERT code the values I want to insert. However, when I try to insert variables from $_POST into the mysql INSERT code, I get an error. I have no problems connecting to the database, but the query does not work. There should not be anything wrong with the variable names, because I am able to echo all of them. I have looked at my code 10 times, and I do not understand what is wrong with it. Does anyone know?</p> <pre><code>&lt;?php $when_it_happened = $_POST['whenithappened']; $how_long = $_POST['howlong']; $alien_description = $_POST['aliendescription']; $fang_spotted = $_POST['fangspotted']; $email = $_POST['email']; $first_name = $_POST['firstname']; $last_name = $_POST['lastname']; $name = "$first_name $last_name"; $how_many = $_POST['howmany']; $what_they_did = $_POST['whattheydid']; $other = $_POST['other']; // Posting to database $dbc = mysqli_connect('localhost', 'root', '', 'aliendatabase') or die('Problems connecting to database'); $query = "INSERT INTO aliens_abduction (first_name, last_name, when_it_happened, how_long, " . "how_many, alien_description, what_they_did, fang_spotted, other, email) " . "VALUES ('$first_name', '$last_name', '$when_it_happened', '$how_long', " . "'$how_many', '$alien_description', '$what_they_did', '$fang_spotted', '$other', '$email')"; $result = mysqli_query($dbc, $query) or die('Problems querying database'); mysqli_close($dbc); ?&gt; </code></pre> <p>I am getting the error message 'Problems querying database'</p>
<php><mysql>
2019-10-01 14:31:46
LQ_CLOSE
58,187,736
c# Login form with User Authentication with sql database
I am new to SQL and C#. I am working on a login form that checks if the user is an admin or a basic user. In my SQL I created a table that stores username, password, and role (admin or basic user). The saved data are the following: For admin: username = admin, password = admin, role = admin For basic user: username = user, password = user, role = user If the user enters username and password "admin" it should be directed to the admin page else it would be user page. This is my code. string query = "SELECT * from tbl_login WHERE Username = @username and password = @password"; con.Open(); SqlCommand sqlcmd = new SqlCommand(query, con); sqlcmd.Parameters.AddWithValue("@username", tbusername.Text); sqlcmd.Parameters.AddWithValue("@password", tbpswlog.Text); DataTable dtbl = new DataTable(); SqlDataAdapter sqlsda = new SqlDataAdapter(sqlcmd); sqlsda.Fill(dtbl); con.Close(); if (dtbl.Rows.Count == 1) { this.Hide(); if (tbusername.Equals("admin")) { MessageBox.Show("You are logged in as an Admin"); AdminHome fr1 = new AdminHome(); fr1.Show(); this.Hide(); } else { MessageBox.Show("You are logged in as a User"); UserHome fr2 = new UserHome(); fr2.Show(); this.Hide(); } } else { MessageBox.Show("Incorrect username or password"); } } I know this code lacks and wrong. Thank you
<c#><sql-server><winforms><ado.net>
2019-10-01 15:08:11
LQ_EDIT
58,189,164
Browser Form Behavior
Normally I use JSON API and SPA for when I make web apps, but I am trying to learn how to use the more simple method server-side template-ing and default form behavior. Right now I am doing something very similar to what is seen [here][1]. The only difference is that i changed the `action` to `"/"` in the form for simplicity and handle the GET and POST from the same Handler (filtering by method type). The initial web page renders fine, the data gets sent correctly in a POST, I answer the POST with a just a 200 but then my webpage goes blank. How do i tell the browser to keep or rerender the original page? Do i need to send an HTML response to the POST? Something other than a 200? [1]: https://astaxie.gitbooks.io/build-web-application-with-golang/en/04.1.html
<html><go><post><browser>
2019-10-01 16:46:17
LQ_EDIT
58,189,683
TypeError: attrib() got an unexpected keyword argument 'convert'
<p>This error occurred during automated testing of a python project on the CI server using <code>pytest</code>. I'm using <code>pytest==4.0.2</code>. This error only just started to occur, previous pipelines seem to work fine.</p> <p>The full error:</p> <pre><code>File "/usr/local/lib/python3.7/site-packages/_pytest/tmpdir.py", line 35, in TempPathFactory lambda p: Path(os.path.abspath(six.text_type(p))) TypeError: attrib() got an unexpected keyword argument 'convert' </code></pre>
<python><pytest>
2019-10-01 17:27:27
HQ
58,189,855
Spring boot 2 embed tomcat 9.0.26 can not load jks file stream closed
<p>I try to use SSL on spring boot 2.2.0 with embeded tomcat 9.0.26 but tomcat can not load JKS file stream closed.</p> <p>Here is application properties:</p> <pre><code>server.port=443 server.ssl.key-store-type=JKS server.ssl.key-store=C:\\Keystore\\mykey.jks server.ssl.key-store-password=cccc server.ssl.key-alias=*.mydomain.com </code></pre> <blockquote> <p>Exception:</p> <p>org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat server at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:215) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar!/:2.2.0.BUILD-SNAPSHOT] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.startWebServer(ServletWebServerApplicationContext.java:297) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar!/:2.2.0.BUILD-SNAPSHOT] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:163) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar!/:2.2.0.BUILD-SNAPSHOT] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553) ~[spring-context-5.2.0.RELEASE.jar!/:5.2.0.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar!/:2.2.0.BUILD-SNAPSHOT] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar!/:2.2.0.BUILD-SNAPSHOT] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar!/:2.2.0.BUILD-SNAPSHOT] at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar!/:2.2.0.BUILD-SNAPSHOT] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar!/:2.2.0.BUILD-SNAPSHOT] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar!/:2.2.0.BUILD-SNAPSHOT] at eu.soluma.app.SolumaTdvApplication.main(SolumaTdvApplication.java:34) ~[classes!/:0.0.1-SNAPSHOT] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:567) ~[na:na] at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) ~[SolumaTDV-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT] at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) ~[SolumaTDV-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT] at org.springframework.boot.loader.Launcher.launch(Launcher.java:51) ~[SolumaTDV-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT] at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52) ~[SolumaTDV-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT] Caused by: java.lang.IllegalArgumentException: standardService.connector.startFailed at org.apache.catalina.core.StandardService.addConnector(StandardService.java:231) ~[tomcat-embed-core-9.0.26.jar!/:9.0.26] at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.addPreviouslyRemovedConnectors(TomcatWebServer.java:278) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar!/:2.2.0.BUILD-SNAPSHOT] at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:197) ~[spring-boot-2.2.0.BUILD-SNAPSHOT.jar!/:2.2.0.BUILD-SNAPSHOT] ... 18 common frames omitted Caused by: org.apache.catalina.LifecycleException: Protocol handler start failed at org.apache.catalina.connector.Connector.startInternal(Connector.java:1008) ~[tomcat-embed-core-9.0.26.jar!/:9.0.26] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.26.jar!/:9.0.26] at org.apache.catalina.core.StandardService.addConnector(StandardService.java:227) ~[tomcat-embed-core-9.0.26.jar!/:9.0.26] ... 20 common frames omitted Caused by: java.lang.IllegalArgumentException: Stream closed at org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLContext(AbstractJsseEndpoint.java:99) ~[tomcat-embed-core-9.0.26.jar!/:9.0.26] at org.apache.tomcat.util.net.AbstractJsseEndpoint.initialiseSsl(AbstractJsseEndpoint.java:71) ~[tomcat-embed-core-9.0.26.jar!/:9.0.26] at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:218) ~[tomcat-embed-core-9.0.26.jar!/:9.0.26] at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1124) ~[tomcat-embed-core-9.0.26.jar!/:9.0.26] at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:1210) ~[tomcat-embed-core-9.0.26.jar!/:9.0.26] at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:585) ~[tomcat-embed-core-9.0.26.jar!/:9.0.26] at org.apache.catalina.connector.Connector.startInternal(Connector.java:1005) ~[tomcat-embed-core-9.0.26.jar!/:9.0.26] ... 22 common frames omitted Caused by: java.io.IOException: Stream closed at java.base/java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:176) ~[na:na] at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:342) ~[na:na] at java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:252) ~[na:na] at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:271) ~[na:na] at java.base/java.security.DigestInputStream.read(DigestInputStream.java:125) ~[na:na] at java.base/java.io.DataInputStream.readInt(DataInputStream.java:392) ~[na:na] at java.base/sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:659) ~[na:na] at java.base/sun.security.util.KeyStoreDelegator.engineLoad(KeyStoreDelegator.java:222) ~[na:na] at java.base/java.security.KeyStore.load(KeyStore.java:1472) ~[na:na] at org.apache.tomcat.util.security.KeyStoreUtil.load(KeyStoreUtil.java:69) ~[tomcat-embed-core-9.0.26.jar!/:9.0.26] at org.apache.tomcat.util.net.SSLUtilBase.getStore(SSLUtilBase.java:217) ~[tomcat-embed-core-9.0.26.jar!/:9.0.26] at org.apache.tomcat.util.net.SSLHostConfigCertificate.getCertificateKeystore(SSLHostConfigCertificate.java:206) ~[tomcat-embed-core-9.0.26.jar!/:9.0.26] at org.apache.tomcat.util.net.SSLUtilBase.getKeyManagers(SSLUtilBase.java:283) ~[tomcat-embed-core-9.0.26.jar!/:9.0.26] at org.apache.tomcat.util.net.SSLUtilBase.createSSLContext(SSLUtilBase.java:247) ~[tomcat-embed-core-9.0.26.jar!/:9.0.26] at org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLContext(AbstractJsseEndpoint.java:97) ~[tomcat-embed-core-9.0.26.jar!/:9.0.26] ... 28 common frames omitted</p> </blockquote>
<java><spring><spring-boot><tomcat>
2019-10-01 17:43:07
HQ
58,190,106
push notifcation in create react app using firebase
hello guys can someone please help me in integrating push notification using firebase in my create-react-app web application i have tried to follow some article but nothing worked someone please help me with a working tutorial or a git repo. thanks in advance. I have followed this article but not succeded https://dzone.com/articles/push-notification-pwa-reactjs-using-firebase i want to add notification in my react application using firebase
<reactjs><firebase><push-notification>
2019-10-01 18:02:32
LQ_EDIT
58,190,796
How to re-order REST API response?
<p><strong>I have the following API response:</strong></p> <pre><code>[{ "id": 1 "name": "first Name" "code": 100 }, { "id": 2 "name": "second Name" "code": 200 }] </code></pre> <p><strong>I would like to re-order the items in the object and move "code" on the top, like this:</strong></p> <pre><code> [{ "code": 100 "id": 1 "name": "first Name" }, { "code": 200 "id": 2 "name": "second Name" }] </code></pre>
<javascript><typescript>
2019-10-01 19:01:52
LQ_CLOSE
58,191,407
No events trigger and buttons are not pressable
<p>When creating a winforms application I added a pannel as a header so I could make the application borderless, I was going to add some buttons when I realised no events were getting registered by the program. Have I flicked a wrong switch somewhere?</p> <p>I have already tried clicking the main form and changing the AutoValidation as well as checking that the form, as well as the panel, were both enabled.</p> <pre class="lang-cs prettyprint-override"><code>public App() { InitializeComponent(); } private void TopBar_MouseHover(object sender, EventArgs e) { Application.Exit(); } private void ExitButton_Click(object sender, EventArgs e) { Application.Exit(); } </code></pre> <p>Expect result is that it should just close the application when I hover over the topbar or when I click the ExitButton.</p>
<c#><winforms>
2019-10-01 19:51:08
LQ_CLOSE
58,194,195
Calling a method that returns a random number from inside a loop
<p>I have a 'for' loop that calls a method that returns a random number between 1 and 10. The loop then writes this number to the console. When I run the code normally it always returns the same number. However, when I step through the code with the debug tool everything seems to be working correctly; the method returns a different random number each loop cycle. What is going on?</p> <pre><code> for(int i = 0; i &lt; 5; i++) { int r = RandomNumber(); Console.WriteLine(r); } static int RandomNumber() { Random rand = new Random(); int x = rand.Next(1, 11); return x; } </code></pre>
<c#><loops><random>
2019-10-02 01:36:44
LQ_CLOSE
58,194,697
Why when i set height are double.infinity ,it shows a bug in the display?
my code look like this ``` get _pdfViewer{ if(pathPDF != null) return Container( child: PdfViewer( filePath: pathPDF, ), color: Colors.red, ); else return Container(height: 30,color: Colors.blueAccent,); } Column( children: <Widget>[ Flex( direction: Axis.horizontal, children: <Widget>[ Expanded( flex: 7, child: Container( height: 500, color: Colors.blueAccent, child: _pdfViewer, ), ), Expanded( flex: 1, child:Container( height:500, color: Colors.green, ) ), ], ) ], ); ``` in the code has twice heights, when i make the height to **double.infinity** its worry(error) look like this: [image][1] i want to max of the screen in the application.what should i do? [1]: https://i.stack.imgur.com/1lu62.png
<flutter><flutter-layout><flutter-test>
2019-10-02 03:01:35
LQ_EDIT
58,195,560
How can I INSERT the value of TotalPrice by calculating automatically by (quantity*price) from Items table and Order table
CREATE TABLE Items( ID INT IDENTITY(1,1) PRIMARY KEY, Name VARCHAR(50), Price FLOAT ) CREATE TABLE Customers ( Id INT IDENTITY(1,1) PRIMARY KEY, Name VARCHAR(50), [Address] VARCHAR(200), Contact VARCHAR(50), ) CREATE TABLE Orders ( Id INT IDENTITY(1,1) PRIMARY KEY, CustomerId INT FOREIGN KEY REFERENCES Customers(Id), ItemId INT FOREIGN KEY REFERENCES Items(Id), Quantity INT, TotalPrice FLOAT )
<sql-server><left-join><sql-insert>
2019-10-02 05:15:34
LQ_EDIT
58,195,684
How to do random selection of numbers in your program
<p>How to do random selection of numbers in your program </p>
<java>
2019-10-02 05:31:00
LQ_CLOSE
58,196,178
I am learning to store some temperature values in a vector. When i execute and run it. It doesn't work, I don't know what the error is
i wrote the code from the book: Programming principles and practice using C++, the program is executing but not working properly as expected. After putting input values it is expected to give mean and median temperature but there is no result. [see the image for my code][1] [here i put 3 temperatures but there is no result][2] [1]: https://i.stack.imgur.com/IonF8.png [2]: https://i.stack.imgur.com/mVczj.png
<c++>
2019-10-02 06:22:48
LQ_EDIT
58,198,083
What happens here in the training of a Keras model?
I am new to Keras development and I have tried to create a Keras model with my own data. After about a few epochs something strange happened (like a staircase) that I can't explain to myself. [Result of the training][1] Do you know by chance what the event after about 270 epochs means? [1]: https://i.stack.imgur.com/EdklU.png
<python><tensorflow><machine-learning><keras><deep-learning>
2019-10-02 08:41:41
LQ_EDIT
58,198,239
Why use an integer to store 4 chars? Any practical benefits?
<p>I know how to store 4 chars in a single integer.</p> <p>My question is more to understand why is this useful?</p> <p><strong>Any real-world practical examples</strong> would help a lot.</p>
<c><bit-manipulation>
2019-10-02 08:51:57
LQ_CLOSE
58,198,544
Angular - DialogRef - Unsubscribe - Do I need to unsubscribe from afterClosed?
<p>I got asked by one of my colleagues if we need to unsubscribe from the afterClosed() Observable of a Dialog.</p> <p>We are using the takeUntil pattern to unsubscribe from all Observables on ngOnDestroy().</p> <pre><code>this.backEvent = fromEvent(window, 'popstate') .pipe( takeUntil(this.destroy$) ) .subscribe( () =&gt; { this.navigationService.backClicked = true; this.navigationService.navigateBackToDirectoryCenter(); } ); </code></pre> <p>ngOnDestroy()</p> <pre><code>ngOnDestroy() { this.destroy$.next(); this.destroy$.complete(); } </code></pre> <p>So is it necessary to unsubscribe from afterClosed() Observable?</p> <pre><code>dialogRef.afterClosed().subscribe( (data) =&gt; { console.log(data); } }, ); </code></pre> <p>or?</p> <pre><code>dialogRef.afterClosed() .pipe( takeUntil(this.destroy$) ) .subscribe( (data) =&gt; { console.log(data); }, ); </code></pre>
<angular><rxjs><unsubscribe>
2019-10-02 09:13:12
HQ
58,199,809
The average of a field in array of objects
<p>I have the following array of objects:</p> <pre><code>[ { items: { "1554038371930_ajhnms9ft" : { "mark" : 5 }, "1554038905938_le34li2cg" : { "mark" : 2 }, "1554039157958_kwab8rj5f" : { "mark" : 4 }, "1554039174126_p47ugwkbv" : { "mark" : 1 } } }, { items: { "1554038371930_ajhnms9ft" : { "mark" : 1 }, "1554038905938_le34li2cg" : { "mark" : 5 }, "1554039157958_kwab8rj5f" : { "mark" : 5 }, "1554039174126_p47ugwkbv" : { "mark" : 2 } } }, { items: { "1554038371930_ajhnms9ft" : { "mark" : 4 }, "1554038905938_le34li2cg" : { "mark" : 3 }, "1554039157958_kwab8rj5f" : { "mark" : 3 }, "1554039174126_p47ugwkbv" : { "mark" : 4 } } }, { items: { "1554038371930_ajhnms9ft" : { "mark" : 1 }, "1554038905938_le34li2cg" : { "mark" : 2 }, "1554039157958_kwab8rj5f" : { "mark" : 5 }, "1554039174126_p47ugwkbv" : { "mark" : 4 } } } ] </code></pre> <p>and i want to get the average of chack item, so the result will be the following:</p> <pre><code>{ items: { "1554038371930_ajhnms9ft" : { "mark" : 2.75 }, "1554038905938_le34li2cg" : { "mark" : 3 }, "1554039157958_kwab8rj5f" : { "mark" : 4.25 }, "1554039174126_p47ugwkbv" : { "mark" : 2.75 } } } </code></pre> <p>which is the best way to achieve that?</p>
<javascript>
2019-10-02 10:35:55
LQ_CLOSE
58,200,001
How to Avoid printing duplicate special characters in string?
<p>I have a String which includes special characters. and i want to print them but not the duplicate ones.</p> <pre><code>Input String s="&amp;*$%) )_@*% &amp;)(((" Ouput ="&amp;*$%)_@(" </code></pre>
<java><c++>
2019-10-02 10:51:01
LQ_CLOSE
58,201,173
How to push to vue-router without adding to history?
<p>I have the following sequence happening:</p> <ul> <li><p>Main screen</p></li> <li><p>Loading screen</p></li> <li><p>Results screen</p></li> </ul> <p>On homepage, when someone clicks a button, I send them to the loading screen, thru:</p> <p><code>this.$router.push({path: "/loading"});</code></p> <p>And once their task finishes, they are sent to the results screen via </p> <p><code>this.$router.push({path: "/results/xxxx"});</code></p> <p>The problem is, usually they want to go from results back to the main screen, but when they click back, they're sent to loading again which sends them back to results, so they're stuck in an infinite loop &amp; unable to go back to main screen.</p> <p>Any ideas how to fix this? I'd ideally like if there was an option like:</p> <p><code>this.$router.push({path: "/loading", addToHistory: false});</code></p> <p>which would send them to the route without adding it to history.</p>
<javascript><vue.js><vue-router>
2019-10-02 12:06:07
HQ
58,201,896
Mysql, How do I clone existing rows into same table with continue id(not null)
Mysql, How do I clone existing rows into same table with continue id(not null). Example table like this. Fruit : - ---------------------------------- id | name | color | cc | ---------------------------------- 1 | Apple | red | 111 | 2 | Banano | yellow | 111 | 3 | Melon | Green | 111 | to new (same table):- Fruit : - ---------------------------------- id | name | color | cc | ---------------------------------- 1 | Apple | red | 111 | 2 | Banana | yellow | 111 | 3 | Melon | Green | 111 | 4 | Apple | red | 222 | 5 | Banana | yellow | 222 | 6 | Melon | Green | 222 | 7 | Apple | red | 333 | 8 | Banana | yellow | 333 | 9 | Melon | Green | 333 | Thanks.
<mysql><sql><clone><rows>
2019-10-02 12:51:48
LQ_EDIT
58,202,993
Emacs: Failed to verify signature archive-contents.sig
<p>Recently tried to update emacs packages and got this.</p> <pre><code>Failed to verify signature archive-contents.sig: No public key for 066DAFCB81E42C40 created at 2019-10-02T10:10:02+0100 using RSA Command output: gpg: Signature made Wed 02 Oct 2019 10:10:02 AM BST gpg: using RSA key C433554766D3DDC64221BFAA066DAFCB81E42C40 gpg: Can't check signature: No public key </code></pre> <p>Any ideas why?</p>
<emacs><gnupg>
2019-10-02 13:53:05
HQ
58,203,384
Change order of (sub-) strings in dataframe column based on white spaces
I have a dataframe with a column in python: ``` df columnA Apple Banana Orange Citron Pineapple ``` How can I reserve the order of the substrings based on the white spaces? The outcome should be: ``` columnA Banana Apple Pineapple Citron Orange ``` Right now, I am only using: ``` df['columnA'] = df['columnA'].replace(r'(\s+).(\s+).(\s+)',r'\3\2\1',regex=True) ``` but this only works if I know the number of substrings, this I do not know upfront.
<python><regex><pandas>
2019-10-02 14:16:58
LQ_EDIT
58,204,266
Why do I need to use async/await twice to make this Non-blocking?
<p>I have two functions, the first is the main function which has switch statement calling the second which is async. If my second function is async isn't that non-blocking? Would I still have to make the first one async in order for it to be non-blocking, if so why?</p> <p><strong>Example</strong></p> <pre><code>exports.funcOne = async (theParam) =&gt; { // async ?? switch (theParam) { case 'hey': return await funcTwo() default: ... } } const funcTwo = async () =&gt; { await axios.get... } </code></pre>
<javascript><node.js>
2019-10-02 15:06:36
LQ_CLOSE
58,204,618
What are the implications of using the "go" version directive within a go module file (go.mod)
<p>Given the following go.mod file:</p> <pre><code>module foo go 1.12 require ( github.com/bar/baz v1.0.0 github.com/rat/cat v1.0.0 ) </code></pre> <p>What does the <code>go 1.12</code> indicate? Does it prevent compiling the <code>foo</code> module against any other version of Go? Or is it simply an indicator of the <code>foo</code>'s recommended/required Go version? Is this a directive that we should update whenever a new version of go is released (every 6 months)?</p>
<go><go-modules>
2019-10-02 15:25:55
HQ
58,205,735
Working with spa services in .NetCore 3.0?
<p>I develop SPA web applicaton using ASP.Net Core React+Redux.</p> <p>After update to .Net Core 3.0 I see that UseWebpackDevMiddleware and AddNodeServices is obsolete. </p> <p>I learn new project-template React+Redux, but it isn't use webpack or SSR.</p> <p>1) Where I can find example or information of work with webpack in .Net Core 3.0? with UseWebpackDevMiddleware was realy easy to configure HMR and webpack build.</p> <p>2) Where I can find example or information about SSR with .Net 3.0 + React?</p>
<webpack><server-side-rendering><.net-core-3.0><asp.net-core-3.0>
2019-10-02 16:37:26
HQ
58,206,708
Cant use a Variable for both fields(Text and Selecteditem)
Wanted to use Disk.Diskvolume as a Global Variable so it contains the things from Listbox1, when making the same Variable as a text for a label It throws an error that says: "Cannot implicitly convert type 'object' to 'string'. An explicit conversion exists (are you missing a cast?)" I made a static class called Disk and included Diskvolume as a static object, I made it so it uses an item from a listbox1 whenever its index has changed, but it seems that it doesnt work for Label.text and when using a string it doesnt work with Listbox1.selectedItem ``` public partial class Form1 : Form { public static class Disk { public static string Diskvolume; } public Form1() { InitializeComponent(); } private void ListBox1_SelectedIndexChanged(object sender, EventArgs e) { //The Labels Will Change depending on the Chosen DriveLetter Disk.Diskvolume = ListBox1.SelectedItem; Label2.Text = Disk.Diskvolume; } private void Button2_Click(object sender, EventArgs e) { } } ``` I expected Disk.Diskvolume to work on both Listbox1.selecteditem and Label2.text. My problems are particularly in Line 15 and 16 and it has to do with the the Public static.
<c#><winforms>
2019-10-02 17:46:28
LQ_EDIT
58,209,076
Microsoft.Extensions.Logging Vs. NLog
<p>I see a lot of posts mentioning usage of Microsoft.Extensions.Logging together with NLog. </p> <p>I'd like to better understand what Microsoft.Extensions.Logging is used for? </p> <p>And specifically why is it needed or what's the benefit of using it together with NLog?</p>
<logging><nlog><microsoft-extensions-logging>
2019-10-02 20:41:40
HQ
58,209,085
Import a specific worksheet from a single excel (CSV) file
<p>I am currently using lumenworks to import data stored within an excel file to my program. It only grabs the information from the first worksheet in the excel document. Would I be able to modify this code in order to import data from a second worksheet, or even all the worksheets at once? Below is what I currently have (imports variables form the main worksheet page):</p> <pre><code>IWebDriver driver; string MyUsername; string MyPassword; string MySecurityQuestion; public LoginPage(IWebDriver driver) { this.driver = driver; string nameColumnName = "Key"; string valueColumnName = "Username"; string rowName = "LoginTest"; //DataTable.Rows[0][0].ToString(); using (CsvReader csvReader = new CsvReader(new StreamReader("C:/Users/User1/source/repos/DDTesting/DDTesting/TestData.csv"), hasHeaders: true)) { int nameColumnIndex = csvReader.GetFieldIndex(nameColumnName); int valueColumnIndex = csvReader.GetFieldIndex(valueColumnName); while (csvReader.ReadNextRecord()) { if (csvReader[nameColumnIndex] == rowName) { string value = csvReader[valueColumnIndex]; // username MyUsername = value; value = csvReader[valueColumnIndex + 1]; MyPassword = value; value = csvReader[valueColumnIndex + 2]; MySecurityQuestion = value; break; } } } } By username = By.Name("username"); By password = By.Name("password"); By loginButton = By.ClassName("button-primary"); By securityQuestion = By.Name("answer"); public void TypeUsername() { driver.FindElement(username).Clear(); driver.FindElement(username).SendKeys(MyUsername); } </code></pre>
<c#><selenium><selenium-webdriver><system.io.file><lumenworks>
2019-10-02 20:42:26
LQ_CLOSE
58,209,857
c# : How to call mehods with same name but in different classes?
I am writing C# script in Unity ``` public class something1 : MonoBehaviour { public void Dosomething(){ } } public class something2 : MonoBehaviour { public void Dosomething(){ } } public class callingDoSometing { public void callALLDosomething(){ someting1 s1 = new something1(); someting2 s2 = new something2(); someting1 s3 = new something3(); someting1 s4 = new something4(); . . . s1.Dosomething(); s2.Dosomething(); s3.Dosomething(); s4.Dosomething(); . . . } } ``` I need to call methods with same names from different classes. Actually I need something like multiple inheritance in other OOP languages and I don't want to create additional languages.
<c#><unity3d>
2019-10-02 21:55:26
LQ_EDIT
58,211,333
Chrome Console SameSite Cookie Attribute Warning
<p>Is anybody else getting this Chrome console warning? </p> <blockquote> <p>A cookie associated with a cross-site resource at was set without the <code>SameSite</code> attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with <code>SameSite=None</code> and <code>Secure</code>. You can review cookies in developer tools under Application>Storage>Cookies and see more details at and .</p> </blockquote> <p>In Chrome Flags chrome://flags/ I've tried disabling both: </p> <ul> <li><p>SameSite by default cookies</p></li> <li><p>Cookies without SameSite must be secure</p></li> </ul> <p>And the warning won't go away. </p>
<google-chrome><google-chrome-extension><google-chrome-devtools>
2019-10-03 01:48:07
HQ
58,212,294
How to use the KITTI 3D object detection methods in real-time autonomous driving methods, where we have only one calibration set?
I am working on real-time 3D object detection for an autonomous ground vehicle. The sensors that I use is a monocular camera and a VLP16 LiDAR. For calibration and sensor fusion, I used the Autoware camera-LiDAR calibration tool. Now, I want to use the KITTI 3D object detection methods to obtain the 3D bounding boxes on an image. However, each image and its corresponding velodyne point cloud in the KITTI dataset have their own calibration file. In autoware, I am getting only a single extrinsic calibration file for the whole setup. Also, the Autoware calibration parameters are different from the calibration parameters of the KITTI dataset. Can anyone help me in converting the autoware calibration parameters to that of the KITTI dataset, or is there any other method to achieve my goal?
<3d><object-detection><camera-calibration><lidar><sensor-fusion>
2019-10-03 04:24:02
LQ_EDIT
58,212,612
Is Java Random return negative numbers?
I'd like to know that if I try to get a random integer using the following method, should it return negative value? int value = new Random().nextInt(bound);
<java><random>
2019-10-03 05:05:10
LQ_EDIT
58,214,100
How do change Font Awesome 5 icon colour?
<pre><code>&lt;i class="fa fa-windows" style="font-size:200px;"&gt;&lt;/i&gt; </code></pre> <p>I have this css: </p> <p><code>.fa fa-windows { color: 00DDFF; } </code> however the colour doesnt seem to change. What am I doing wrong?</p>
<html><css>
2019-10-03 07:15:54
LQ_CLOSE
58,214,143
Set a value in a javascript object based on another key's value in the same object
<p>I'd like to define a javascript object in which the value of a key depends on the value of another, like so :</p> <pre><code>var params = { width : 100, margins : 10, realWidth : width - margins } </code></pre> <p>If I try this I get an error about width not being defined. Is it even possible to do that ? </p>
<javascript><javascript-objects>
2019-10-03 07:19:04
LQ_CLOSE
58,214,575
Are regular expressions (0*1*)* and (0 + 1)* same?
<p>I was solving exercise problems in my textbook, and I wondered that whether (0*1*)* and (0 + 1)* are same. I think they are same, but I have no idea how to prove it. Are they same regular expressions?</p>
<regex>
2019-10-03 07:48:01
LQ_CLOSE
58,215,782
What database to use for a C# desktop application
<p>I want to create a C# desktop application, the application must be used in different computers. I want a database to connect to remotely since my application will in different computers.</p>
<c#>
2019-10-03 09:06:23
LQ_CLOSE
58,216,740
How can I add 20px margin only to divs on the left hand side (flex)
<p>The divs are using flex &amp; flex-wrap, and I only want to apply margin-right to the divs on the left hand side as when clicked the border is pushed up against the divs on the right hand side. Any ideas how to achieve this?</p> <p><a href="https://i.stack.imgur.com/WPmC4.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WPmC4.jpg" alt="enter image description here"></a></p>
<html><css>
2019-10-03 10:01:59
LQ_CLOSE
58,218,203
Java server application needs 2 GB heap size
<p>Is it normal that Java server application deployed on application server (WildFly) needs 2 GB heap size because otherwise sometimes it crashes with OutOfMemoryError? It has ~1.5k users daily, max 100 users on page at the same time. Application doesn't use HTTP session.</p>
<java><jakarta-ee><server><out-of-memory><memory-footprint>
2019-10-03 11:27:47
LQ_CLOSE
58,219,635
why ApkRelease to Play Store very slow?
I want to release play store for my apk. But normally, google answers and accepts two hours but now, google hasn't answered 1 week.
<android><google-play><apk><release>
2019-10-03 12:56:35
LQ_EDIT
58,220,148
What is the difference between Object[] obj and Object obj[] in java?
<p>I wrote a code using two type of Object styles. Both are working properly. I just want to know what is the difference between these both types.</p> <pre><code>PatientsTabData ob[] = {new PatientsTabData().SetPatientId( Integer.parseInt(String.valueOf(jsonObject.get("PatientId")))) .SetRxId(Integer.parseInt(String.valueOf(jsonObject.get("TrackingNumber"))))}; PatientsTabData[] ob = {new PatientsTabData().SetPatientId( Integer.parseInt(String.valueOf(jsonObject.get("PatientId")))) .SetRxId(Integer.parseInt(String.valueOf(jsonObject.get("TrackingNumber"))))}; </code></pre> <p>Both types are working.</p>
<java>
2019-10-03 13:25:13
LQ_CLOSE
58,220,940
Promotion in java
<p>I exectued this statement</p> <pre><code>System.out.println(3.0 + 5/2); </code></pre> <p>And found the answer to be 5.0. Now according to promotion, if an expression contains a double type data, every operand will be promoted to double type. So 5 and 2 will be promoted to 5.0 and 2.0 respectively. Therefore the logical expression here should be </p> <pre><code>3.0+5.0/2.0 </code></pre> <p>Which should give the answer 5.5 instead of 5.0.</p>
<java><type-promotion>
2019-10-03 14:08:54
LQ_CLOSE
58,220,995
Cannot read property 'history' of undefined (useHistory hook of React Router 5)
<p>I am using the new useHistory hook of React Router, which came out a few weeks ago. My React-router version is 5.1.2. My React is at version 16.10.1. You can find my code at the bottom.</p> <p>Yet when I import the new useHistory from react-router, I get this error:</p> <p><code>Uncaught TypeError: Cannot read property 'history' of undefined</code></p> <p>which is caused by this line in React-router</p> <pre><code>function useHistory() { if (process.env.NODE_ENV !== "production") { !(typeof useContext === "function") ? process.env.NODE_ENV !== "production" ? invariant(false, "You must use React &gt;= 16.8 in order to use useHistory()") : invariant(false) : void 0; } return useContext(context).history; &lt;---------------- ERROR IS ON THIS LINE !!!!!!!!!!!!!!!!! } </code></pre> <p>Since it is related to useContext and perhaps a conflict with context is at fault, I tried completely removing all calls to useContext, creating the provider, etc. However, that did nothing. Tried with React v16.8; same thing. I have no idea what could be causing this, as every other feature of React router works fine.</p> <p>***Note that the same thing happens when calling the other React router hooks, such as useLocation or useParams. </p> <p>Has anyone else encountered this? Any ideas to what may cause this? Any help would be greatly appreciated, as I found nothing on the web related to this issue.</p> <pre><code>import React, {useEffect, useContext} from 'react'; import { BrowserRouter as Router, Route, Link } from "react-router-dom"; import { Switch, useHistory } from 'react-router' import { useTranslation } from 'react-i18next'; import lazyLoader from 'CommonApp/components/misc/lazyLoader'; import {AppContext} from 'CommonApp/context/context'; export default function App(props) { const { i18n } = useTranslation(); const { language } = useContext(AppContext); let history = useHistory(); useEffect(() =&gt; { i18n.changeLanguage(language); }, []); return( &lt;Router&gt; &lt;Route path="/"&gt; &lt;div className={testClass}&gt;HEADER&lt;/div&gt; &lt;/Route&gt; &lt;/Router&gt; ) } </code></pre>
<reactjs><react-router><react-hooks><react-router-dom><react-context>
2019-10-03 14:12:00
HQ
58,221,760
How to add a main method to this program?
<p>Hi I'm fairly new to coding and don't understand the required task I have to complete. How can I run the following code to make sure it works by adding a main method?</p> <p>Answers and documents will be more than helpful, thank you.</p> <pre><code>public static boolean approxEqual (double x, double y) { //Judge where two numbers are close enough (equal) final double EPSILON = 1E-10; if (Math.abs(x-y)&lt;EPSILON) { return(true); } return(false); } </code></pre>
<java><algorithm><numbers>
2019-10-03 14:55:04
LQ_CLOSE
58,224,762
How can i clear the quantity and price field when i select no product in the drop down?
When i select product from the drop down price and quantity came out from the database and when i Select the option **SELECT MOTHERBOARD** that have no value so that quantity and price field should be empty but the quantity field show the value **1** and Total Price field show **0** instead of empty text field. How can i sort-out this issue. > When i select product from drop-down. [Image][1] > When i click on **Select Motherboard** option from drop-down [Image][2] [1]: https://i.stack.imgur.com/XbW0f.png [2]: https://i.stack.imgur.com/E6y2I.png <tr class="category motherboard" data-value="motherboard"> <td> <span>Motherboard</span> </td> <td> <select name="motherboard" id="motherboard" style="min-width: 100%;" class="select" onchange="getPrice(event)"> <option>Select Motherboard</option> <?php echo motherboard_brand($connect); ?> </select> </td> <!-- QUANTITY --> <td> <input type="number" min="0" name="email" class="quantity" oninput="setTotalPrice(event)"/> </td> <!-- per item price --> <td> <input type="text" readonly class="unit-price" > </td> <!-- Total Price --> <td> <input type="text" readonly class="total-price"> </td> </tr> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script type="text/javascript"> function getPrice(e){ e.preventDefault(); grandtotal(); var id = $(e.target).val(); // console.log(id); let parent = e.target.parentNode.parentNode; // console.log(parent); let category = parent.getAttribute("data-value"); // console.log(category); $.ajax({ url:"load_data.php", method:"POST", data:{id:id}, success:function(data){ // console.log(id); let unitPrice = parent.querySelector("input.unit-price"); // console.log(unitPrice); unitPrice.value = data; $(parent).attr("data-id", id); $(parent).attr("data-quantity", 1); parent.querySelector("input.quantity").value = 1; parent.querySelector("input.total-price").value = +data * 1; grandtotal(); } }); } function setTotalPrice(e){ e.preventDefault(); // console.log(event.target); let parent = e.target.parentNode.parentNode; // console.log(parent); let unitPrice = parent.querySelector("input.unit-price").value; let quantity = parent.querySelector("input.quantity").value; $(parent).attr("data-quantity", quantity); parent.querySelector("input.total-price").value = (+unitPrice) * (+quantity); grandtotal(); } // Grand Total function grandtotal() { var sum=0; $('.total-price').each(function(){ var item_val=parseFloat($(this).val()); if(isNaN(item_val)){ item_val=0; } sum+=item_val; $('#TotalPrice').html(sum.toFixed(2)); }); } </script>
<jquery><ajax>
2019-10-03 18:14:59
LQ_EDIT