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 |
|---|---|---|---|---|---|
56,512,506 | Plot two variables line with R (-2x + y = 0) | <p>With R, how do I plot simple linear equations as lines on a plane? For example, how to plot line of the equation -2x + y = 0?</p>
<p>I did searched google but not got an answer.</p>
<p>Thanks!</p>
| <r> | 2019-06-09 06:36:49 | LQ_CLOSE |
56,512,710 | I want to run a if statement for few seconds.How can I do it? | <p>I want to make a code run for a few seconds in if statement like <strong>I want to
make BoxCollider.enabled=false whenever I press "e" and make BoxCollider.enabled=true again after a few seconds</strong>. How can I do this?</p>
<p>I tried the invoke method but it's not working.</p>
<pre><code> if (Input.GetKeyDown("e"))
{
BoxCollider.enabled = false;
Invoke("enable", 2f);
}
void enable()
{
BoxCollider.enabled = true;
}
</code></pre>
| <c#><unity3d><visual-studio-2017> | 2019-06-09 07:20:03 | LQ_CLOSE |
56,513,081 | "TypeError: count() takes 0 positional arguments but 1 was given", what is wrong with the code | <p>I'm trying to find no. of even and odd numbers from the list.</p>
<pre><code>list = []
for i in range(5):
lst = int(input("Enter the numbers: "))
list.append(lst)
print(list)
even = 0
odd = 0
def count():
for i in list:
if list[i] % 2 == 0:
even+=1
else:
odd+=1
return even, odd
even,odd = count(list)
print('Even : {} and Odd : {}'.format(even,odd))
</code></pre>
<p>I'm getting an error:TypeError: count() takes 0 positional arguments but 1 was given. What does it mean?</p>
| <python-3.x> | 2019-06-09 08:29:28 | LQ_CLOSE |
56,513,939 | How can I disable IntelliJ using the Gradle run task to run my code? | <p>After updating IDEA, every time I debug a class <em>in a new project only</em>, it seems to be using the Gradle run task to run my code (despite using an "Application" run configuration, not "Gradle"!):</p>
<pre><code>6:40:27 AM: Executing task 'Test.main()'...
Connected to the target VM, address: '127.0.0.1:49580', transport: 'socket'
> Task :compileJava UP-TO-DATE
> Task :processResources NO-SOURCE
> Task :classes UP-TO-DATE
Connected to the VM started by ':Test.main()' (localhost:49597). Open the debugger session tab
> Task :Test.main()
test
</code></pre>
<p>This is causing me many problems.</p>
<p>If I run tasks in an old project, it will just compile and run the code directly, without using Gradle. I compared all the settings in the two run configurations, and they're identical.</p>
<p>How can I disable this and prevent IntelliJ from creating this kind of run configuration when I just want a regular run configuration?</p>
| <java><gradle><intellij-idea> | 2019-06-09 10:48:29 | HQ |
56,514,877 | How to save cookies and load it in another puppeteer session? | <p>I had to request the same webpage twice to get the cookies in the 1st request and use it in the 2nd request in the following example.</p>
<p>Could anybody show me the code to save the cookies in one puppeteer session and load it in another session so that there is no need to request the same webpage twice in the 2nd session? Thanks.</p>
<pre><code>const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://www.genecards.org/cgi-bin/carddisp.pl?gene=BSCL2');
await page.goto('https://www.genecards.org/cgi-bin/carddisp.pl?gene=BSCL2');
const linkHandlers = await page.$x("//div[@id='enhancers']//a[@data-track-event='Table See-All']");
if (linkHandlers.length > 0) {
const [response] = await Promise.all([
page.waitForResponse(response => response.url().includes('/gene/api/data/Enhancers')),
linkHandlers[0].click()
]);
const resp_text = await response.text();
console.log(resp_text);
} else {
throw new Error("Link not found");
}
await browser.close();
})();
</code></pre>
| <cookies><puppeteer> | 2019-06-09 13:13:31 | HQ |
56,515,871 | How to open the ImagePicker in SwiftUI? | <p>I need to open the ImagePicker in my app using SwiftUI, how can I do that?</p>
<p>I thought about using the UIImagePickerController, but I don't know how to do that in SwiftUI.</p>
| <ios><swift><uiimagepickercontroller><swiftui> | 2019-06-09 15:27:02 | HQ |
56,516,517 | asp.net mvc : How to Create razor view form dynamically at run time according to html fields deyails stored in database table | [Image of Table Structure with Data][1]
[1]: https://i.stack.imgur.com/4OAHz.jpg
----------
Table structure is as bellow :<br/>
###Id|Category|DisplayName|FieldName|FieldType|FieldLength|IsRequired<br/>
Please see image for details.
On selection of a category all HTML fields defined in table against that category should populate in view.<br/>
And how to validate on form submit.<br/>
I have more than 400 categories. | <c#><asp.net-mvc> | 2019-06-09 16:47:24 | LQ_EDIT |
56,517,515 | How to set Keyboard type of TextField in SwiftUI? | <p>I can't seem to find any information or figure out how to set the keyboard type on a TextField for SwiftUI.
It would also be nice to be able to enable the secure text property, to hide passwords etc.</p>
<p>This post shows how to "wrap" a UITextField, but I'd rather not use any UI-controls if I don't have to.
<a href="https://stackoverflow.com/questions/56507839/how-to-make-textfield-become-first-responder">How to make TextField become first responder?</a></p>
<p>Anyone have any ideas how this can be done without wrapping an old school UI control?</p>
| <keyboard><swiftui><ios13> | 2019-06-09 18:57:27 | HQ |
56,517,606 | How do I use a paremeter to index an array in rust? | <p>I'm trying to create a function that will take a parameter and use it as an index for an array rust will not let me do this and because of this I'm hoping to find an alternative method to achieve the same results.</p>
<p>although I'm not a 100% I believe that rust is not letting me run the code because it believes that the parameter I'm using might go beyond the lens of the array and for this I tried using the <code>get()</code> function:</p>
<pre class="lang-rust prettyprint-override"><code>array.get(foo).unwrap();
</code></pre>
<p>however this still doesn't fix my current error.</p>
<p>Sample code to reproduce error:</p>
<pre class="lang-rust prettyprint-override"><code>fn example(foo: u32) {
let mut array: [u32; 3] = [0,0,0];
array[foo] = 9;
}
fn main() {
example(1);
}
</code></pre>
<p>The program fails to run with the complier giving me the error</p>
<pre><code>array[foo] = 9
^^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize`
</code></pre>
<p>This is my first time writing a problem on stack overflow so if i messed the formatting somewhere, sorry.</p>
| <rust> | 2019-06-09 19:07:28 | LQ_CLOSE |
56,518,172 | Need additional VBA code for PDF export from excel | I'm fairly new to VBA for excel and I have a macro for exporting a single sheet to PDF but need additional code to add criteria for my export.
I want to only include rows that have any value in column "A" in my export.
Where do I add this code?
Sub RentalEquipmentList()
Dim wsA As Worksheet
Dim wbA As Workbook
Dim strTime As String
Dim strName As String
Dim strPath As String
Dim strFile As String
Dim strPathFile As String
Dim myFile As Variant
On Error GoTo errHandler
Set wbA = ActiveWorkbook
Set wsA = Sheets("RENTALS")
strTime = Format(Now(), "yyyymmdd\_hhmm")
'get active workbook folder, if saved
strPath = wbA.Path
If strPath = "" Then
strPath = Application.DefaultFilePath
End If
strPath = Left(ThisWorkbook.Path, InStrRev(ThisWorkbook.Path, "\")) &
"23-Portal Traveler\"
'replace spaces and periods in sheet name
strName = Replace(wsA.Name, " ", "")
strName = Replace(strName, ".", "_")
'create default name for savng file
strName = ThisWorkbook.Sheets("General Info").Range("B8").Value _
& " Rental Equipment List "
'create default name for savng file
strFile = strName & ".pdf"
strPathFile = strPath & strFile
'use can enter name and
' select folder for file
myFile = Application.GetSaveAsFilename _
(InitialFileName:=strPathFile, _
FileFilter:="PDF Files (*.pdf), *.pdf", _
Title:="Select Folder and FileName to save")
'export to PDF if a folder was selected
If myFile <> "False" Then
wsA.ExportAsFixedFormat _
Type:=xlTypePDF, _
filename:=myFile, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
'confirmation message with file info
MsgBox "PDF file has been created: " _
& vbCrLf _
& myFile
End If
exitHandler:
Exit Sub
errHandler:
MsgBox "Could not create PDF file"
Resume exitHandler
End Sub
I get the full sheet exported now which is fine, I just need to filter out rows based on Column "A" value.
Thank you in advance for your help. | <excel><vba> | 2019-06-09 20:31:03 | LQ_EDIT |
56,518,541 | VueJs, difference between computed property and watch property? | <p>I just started learning vuejs, but I didn't quite understand what <strong>Computed</strong> and <strong>Watch-Property</strong> were. what? What is the benefit? where to use?</p>
| <vue.js><properties><watch> | 2019-06-09 21:37:38 | LQ_CLOSE |
56,519,931 | how to remove random numbers generated if they are less than a certain value | <p>I'm generating random variates with <code>rnorm()</code> and need to remove any random variates that are less than 20. </p>
<p>for example:</p>
<pre><code>rnorm(4, mean=30, sd=18)
[1] 18 25 36 16
</code></pre>
<p>needs to become: </p>
<pre><code>[1] 25 36
</code></pre>
| <r> | 2019-06-10 02:45:26 | LQ_CLOSE |
56,520,195 | Divide the Bonus | <p>I have a list (array) of employees who will be rewarded as follows:</p>
<ul>
<li><p>Const worker = [
<code>{name: "John", prize: 1000, prioritize: 1},</code>
<code>{name: "Andy", prize: 2000, prioritize: 2},</code>
<code>{name: "Bill", prize: 2200, prioritize: 3},</code>
<code>{name: :Carry", prize: 3100, prioritize: 4},</code>
<code>{name: "Asawa", prize: 4000, prioritize: 5}</code>
]; //( array Worker is not fixed ...)</p></li>
<li><p>Let TotalPrize = 7100 // fund bonus</p></li>
</ul>
<p>Problem: I want to subtract TotalPrize for the list above (1-> 2-> 3 ...) so that Workers gets the full prize by order Prioritize:</p>
<ul>
<li>John: 1000 (full)</li>
<li>Andy: 2000 (full)</li>
<li>Bill: 2200 (full)</li>
<li>Carry: 1900 (the list above, Carry must be 3100, but because TotalPrize = 7100 has been divided in advance for the first three remaining 1900)</li>
<li>Asawa: 0 (because all the money for the first 4 people was divided)</li>
</ul>
<p>Who has the solution and helps me to solve the problem, 2 weeks in desperation. So sad</p>
| <javascript><arrays><node.js> | 2019-06-10 03:33:30 | LQ_CLOSE |
56,520,758 | How to print 3 dot at the end of the text if text is over flow? | <p>which CSS properties is used to print 3 dot at the end of the text if text is over flow?</p>
| <html><css> | 2019-06-10 05:05:30 | LQ_CLOSE |
56,522,613 | Concatenate string and int | <p>I want to concatenate integer and string value, where integer is in a 2D list and string is in a 1D list.</p>
<pre><code>['VDM', 'MDM', 'OM']
</code></pre>
<p>The above mentions list is my string list.</p>
<pre><code>[[1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5]]
</code></pre>
<p>The above mentioned list is my integer list.</p>
<p>I have tried this code:</p>
<pre><code>for i in range(numAttr):
for j in range(5):
abc=[[attr[i]+counts[i][j]]]
print(abc)
</code></pre>
<p>Here numAttr is the number of element in the first 1D list. and second 2D list is a static list i.e. for any dataset the 2D list will not change.</p>
<p>The above code showing the error:</p>
<pre><code>TypeError: can only concatenate str (not "int") to str
</code></pre>
<p>I want a list output which looks like this:</p>
<pre><code>[['VDM:1','VDM:2','VDM:3','VDM:4','VDM:5'],['MDM:1','MDM:2','MDM:3','MDM:4','MDM:5'],['OM:1','OM:2','OM:3','OM:4','OM:5']]
</code></pre>
| <python><string><list> | 2019-06-10 07:59:16 | LQ_CLOSE |
56,523,644 | PHP check youtube channel existence without API | <p>I want to make simple <code>curl</code> call to check if youtube channel exists.
Is it possible without using google API ?</p>
| <php><youtube> | 2019-06-10 09:23:13 | LQ_CLOSE |
56,523,836 | Task not serializable error in scala spark | I have two variable bellow:
var rddPair1 : ```Array[(String, String)] = Array((0000003,杉山______ 26 F), (0000005,崎村______ 50 F), (0000007,梶川______ 42 F))```
and
var rddPair2 : ``` Array[(String, String)] = Array((0000005,82 79 16 21 80), (0000001,46 39 8 5 21), (0000004,58 71 20 10 6), (0000009,60 89 33 18 6), (0000003,30 50 71 36 30), (0000007,50 2 33 15 62)) ```
The code below use to full outer join 2 variables:
```scala
var emp =rddPair1.first._2.replaceAll("\\S", "*") //emp:String = ***** ** *
rddPair1.fullOuterJoin(rddPair2).map {
case (id, (left, right)) =>
(id,left.getOrElse(emp)+" "+ right)
}.collect()
```
And I get an error like the below:
<pre>
org.apache.spark.SparkException: Task not serializable
at org.apache.spark.util.ClosureCleaner$.ensureSerializable(ClosureCleaner.scala:403)
at org.apache.spark.util.ClosureCleaner$.org$apache$spark$util$ClosureCleaner$$clean(ClosureCleaner.scala:393)
at org.apache.spark.util.ClosureCleaner$.clean(ClosureCleaner.scala:162)
at org.apache.spark.SparkContext.clean(SparkContext.scala:2326)
at org.apache.spark.rdd.RDD$$anonfun$map$1.apply(RDD.scala:371)
at org.apache.spark.rdd.RDD$$anonfun$map$1.apply(RDD.scala:370)
at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:112)
at org.apache.spark.rdd.RDD.withScope(RDD.scala:363)
at org.apache.spark.rdd.RDD.map(RDD.scala:370)
... 56 elided
Caused by: java.io.NotSerializableException: org.apache.spark.SparkContext
Serialization stack:
- object not serializable (class: org.apache.spark.SparkContext, value: org.apache.spark.SparkContext@4d87e7f3)
- field (class: $iw, name: spark, type: class org.apache.spark.SparkContext)
- object (class $iw, $iw@65af4162)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@7da837af)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@54d0724f)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@389ae8f1)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@55ecf961)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@428c9250)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@d931617)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@2625c1cc)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@1231e446)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@27dbe9a3)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@63ad2a0f)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@203f41d7)
- field (class: $line19.$read, name: $iw, type: class $iw)
- object (class $line19.$read, $line19.$read@46a9af36)
- field (class: $iw, name: $line19$read, type: class $line19.$read)
- object (class $iw, $iw@19d118d5)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@5dac488d)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@1bba5848)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@4f1a6259)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@25712d03)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@750c242e)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@ad038f8)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@4ba64e36)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@223f8c82)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@ba1f5d1)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@4355f7b6)
- field (class: $line22.$read, name: $iw, type: class $iw)
- object (class $line22.$read, $line22.$read@44535df8)
- field (class: $iw, name: $line22$read, type: class $line22.$read)
- object (class $iw, $iw@32e14e55)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@5a78e7e3)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@28736857)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@16be6b36)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@211e1b51)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@1cce2194)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@7b31281b)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@63c9017b)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@e343477)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@3a182eaf)
- field (class: $iw, name: $iw, type: class $iw)
- object (class $iw, $iw@131af11d)
- field (class: $line24.$read, name: $iw, type: class $iw)
- object (class $line24.$read, $line24.$read@7cb39309)
- field (class: $iw, name: $line24$read, type: class $line24.$read)
- object (class $iw, $iw@282afe91)
- field (class: $iw, name: $outer, type: class $iw)
- object (class $iw, $iw@33592b53)
- field (class: $anonfun$1, name: $outer, type: class $iw)
- object (class $anonfun$1, <function1>)
at org.apache.spark.serializer.SerializationDebugger$.improveException(SerializationDebugger.scala:40)
at org.apache.spark.serializer.JavaSerializationStream.writeObject(JavaSerializer.scala:46)
at org.apache.spark.serializer.JavaSerializerInstance.serialize(JavaSerializer.scala:100)
at org.apache.spark.util.ClosureCleaner$.ensureSerializable(ClosureCleaner.scala:400)
... 65 more
</pre>
I am a newbie so my sentence is not good, so please understand and help me please | <scala><apache-spark><dictionary><rdd> | 2019-06-10 09:37:46 | LQ_EDIT |
56,525,338 | Replicare rows in Matrix | I ve a Matrix
A<-
DOG. 4
CAT. 3
MOUSE. 6
PIG. 1
HORSE. 9
Names of animals are rownames
Now I 've the matrix
B <-
A1. A2. A3. A4. A5. A6.
AGE. 16. 15. 4. 9. 11. 12
I would to replicate the row age for how many are the rownames in matrix A.
Example:
A1. A2. A3. A4. A5. A6.
DOG. 16. 15. 4. 9. 11. 12
CAT 16. 15. 4. 9. 11. 12
MOUSE 16. 15. 4. 9. 11. 12
HORSE 16. 15. 4. 9. 11. 12
PIG 16. 15. 4. 9. 11. 12
Suggestions? | <r><shell><matrix><row> | 2019-06-10 11:16:10 | LQ_EDIT |
56,526,226 | ( laravel - Php ) i want a code that shows total users in database | <p>in user panel i want to show total registerd users in my site ,</p>
<p>Example :
Total Users On Our Network : 55
The 55 i want it to get how many users on our site from the database.</p>
| <php><laravel> | 2019-06-10 12:14:51 | LQ_CLOSE |
56,526,514 | tensorflow deeplearning colab | I'm(beginner)working on cat and dog classifier ....
how to rectify these errors
import tflearn
from tflearn.layers.conv import conv_2d,maxpool_2d
convnet=conv_2d(convent,32,5,activation='relu')
convent=max_pool_2d(convent,5)
ImportError
<ipython-input-8-dc6c9fb9359a> in <module>()
1
2 import tflearn
----> 3 from tflearn.layers.conv import conv_2d,maxpool_2d
ImportError: cannot import name 'maxpool_2d'
NameError
<ipython-input-64-4f4aec72da8c> in <module>()
----> 1 convnet=conv_2d(convent,32,5,activation='relu')
2 convent=max_pool_2d(convent,5)
NameError: name 'convent' is not defined
NameError
<ipython-input-4-be31c35783ac> in <module>()
----> 1 convnet = conv_2d(convnet, 64, 5, activation='relu')
2 convent=max_pool_2d(convent,5)
NameError: name 'conv_2d' is not defined | <tensorflow><google-colaboratory> | 2019-06-10 12:32:04 | LQ_EDIT |
56,526,555 | Hello everyone! I am creating a Progressive Web App(PWA) and wanted to link it to firebase | As of now, I have successfully updated my data by manually making changes in firebase database and displaying it out in real time on my PWA.
But now I wish to write/ insert data into realtime firebase database and simultaneously display the changes.
My question is, how do we push data from a React WebApp to the real-time firebase database. I wasn't able to find any docs or videos on this matter.
Kindly Help. | <reactjs><firebase><firebase-realtime-database><progressive-web-apps> | 2019-06-10 12:35:00 | LQ_EDIT |
56,526,679 | how to make a gradient button in the footer of UICollectionView in swift | i have encountered a problem. i am making an app where i need to make a button that has gradient color on it inside the footer of UICollectionView, and the problem is i can not make it via storyboard, so i have to make it programmatically within the footer of UICollectionView. But i don't know how to make it.
the thing is i have tried to make it, i have accomplished to make the basic structure of UIButton inside UICollectionView's Footer.
case UICollectionView.elementKindSectionFooter:
let footer = outerMainCollectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "Footer", for: indexPath) as! headerReusableView
let button = UIButton(frame: CGRect(x: 0, y: 0, width: collectionView.frame.width - 50, height: 40))
if isGuest {
button.backgroundColor = .red
} else {
button.backgroundColor = .black
}
button.setTitle("ALL", for: .normal)
button.setTitleColor(COLORWHITE, for: .normal)
button.addTarget(self, action: #selector(footerButton), for: .touchUpInside)
footer.addSubview(button)
footer.backgroundColor = UIColor.green
return footer
i want to make it gradient between light Orange and dark Orange, use any hex values for instance. and i want to make it center height of 40, and margins from all sides - top, bottom, left, right.
Thank you in advance. :-) | <ios><swift><uicollectionview><uibutton> | 2019-06-10 12:43:14 | LQ_EDIT |
56,527,768 | Add a dash between running numbers and comma between non-running numbers | I would like to replace a set of running and non running numbers with commas and hyphens where appropriate.
Using STUFF & XML PATH I was able to accomplish some of what I want by getting something like 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13, 15, 19, 20, 21, 22, 24.
WITH CTE AS (
SELECT DISTINCT t1.ORDERNo, t1.Part, t2.LineNum
FROM [DBName].[DBA].Table1 t1
JOIN Table2 t2 ON t2.Part = t1.Part
WHERE t1.ORDERNo = 'AB12345')
SELECT c1.SQ, c1.Part, STUFF((SELECT ', ' + CAST(LineNum AS VARCHAR(5))
FROM CTE c2
WHERE c2.SQ = c1.SQ
FOR XML PATH('')), 1, 2, '') AS [LineNums]
FROM CTE c1
GROUP BY c1.SQ, c1.Part
I would like to have 1-10, 13, 15, 19, 20-22, 24. | <tsql> | 2019-06-10 13:52:09 | LQ_EDIT |
56,530,670 | Is SQLite accessible from everywhere when an android app is in playstore? | I'm starting a new application in android studio with and I need a DataBase. I read that SQLite is the one that I need to use but I want to know if then when i publish my app the other people with their phones can acces this DataBase and where this DB is stored. Thanks | <android><android-sqlite> | 2019-06-10 17:08:35 | LQ_EDIT |
56,532,075 | C++ Functions with struct and vectors | <p>I just finished a program that reads a CSV file and outputs the rows using structs and vectors. My question involves these specific lines:</p>
<pre><code>displayBid(bids[i]);
void displayBid(Bid bid)
{
cout << bid.title << " | " << bid.amount << " | " << bid.fund << endl;
return;
}
</code></pre>
<p>I am not sure if I am thinking about this correctly, but how is displayBid able to take in a vector as a parameter? The displayBid function takes in a struct called of Bid type. Originally I could not get the code to compile because I was trying displayBid(bid) and I got a scope error. I figured the displayBid function would need to take in a struct instead of a vector. Thanks.</p>
<p>Source:</p>
<pre><code>#include <algorithm>
#include <iostream>
#include <time.h>
// FIXME (1): Reference the CSVParser library
#include "CSVparser.hpp"
using namespace std;
// forward declarations
double strToDouble(string str, char ch);
struct Bid
{
string title;
string fund;
double amount;
// Set default bid amount to 0.0
Bid()
{
amount = 0.0;
}
};
/**
* Display the bid information
*
* @param bid struct containing the bid info
*/
void displayBid(Bid bid)
{
cout << bid.title << " | " << bid.amount << " | " << bid.fund << endl;
return;
}
/**
* Prompt user for bid information
*
* @return Bid struct containing the bid info
*/
Bid getBid()
{
Bid bid;
cout << "Enter title: ";
cin.ignore();
getline(cin, bid.title);
cout << "Enter fund: ";
cin >> bid.fund;
cout << "Enter amount: ";
cin.ignore();
string strAmount;
getline(cin, strAmount);
bid.amount = strToDouble(strAmount, '$');
return bid;
}
/**
* Load a CSV file containing bids into a container
*
* @param csvPath the path to the CSV file to load
* @return a container holding all the bids read
*/
vector<Bid> loadBids(string csvPath)
{
// FIXME (2): Define a vector data structure to hold a collection of bids.
vector<Bid> bids;
// initialize the CSV Parser using the given path
csv::Parser file = csv::Parser(csvPath);
// loop to read rows of a CSV file
for (int i = 0; i < file.rowCount(); i++)
{
// FIXME (3): create a data structure to hold data from each row and add to vector
Bid bid;
bid.title = file[i][0];
bid.fund = file[i][8];
//Convert to double and take out $
bid.amount = strToDouble(file[i][4], '$');
bids.push_back(bid);
}
return bids;
}
/**
* Simple C function to convert a string to a double
* after stripping out unwanted char
*
* credit: http://stackoverflow.com/a/24875936
*
* @param ch The character to strip out
*/
double strToDouble(string str, char ch)
{
str.erase(remove(str.begin(), str.end(), ch), str.end());
return atof(str.c_str());
}
/**
* The one and only main() method
*/
int main(int argc, char* argv[])
{
// process command line arguments
string csvPath;
switch (argc)
{
case 2:
csvPath = argv[1];
break;
default:
csvPath = "eBid_Monthly_Sales_Dec_2016.csv";
}
// FIXME (4): Define a vector to hold all the bids
vector<Bid> bids;
// FIXME (7a): Define a timer variable
clock_t timer;
int choice = 0;
while (choice != 9)
{
cout << "Menu:" << endl;
cout << " 1. Enter a Bid" << endl;
cout << " 2. Load Bids" << endl;
cout << " 3. Display All Bids" << endl;
cout << " 9. Exit" << endl;
cout << "Enter choice: ";
cin >> choice;
switch (choice)
{
case 1:
cout << "Not currently implemented." << endl;
break;
case 2:
// FIXME (7b): Initialize a timer variable before loading bids
timer = clock();
// FIXME (5): Complete the method call to load the bids
bids = loadBids(csvPath);
// FIXME (7c): Calculate elapsed time and display result
timer = clock() - timer;
cout << bids.size() << " bids loaded" << endl;
cout << "time: " << (float)timer/CLOCKS_PER_SEC * 1000 << " milliseconds" << endl;
cout << "time: " << (float)timer/CLOCKS_PER_SEC << " seconds" << endl;
break;
case 3:
// FIXME (6): Loop and display the bids read
for (int i = 0; i < bids.size(); ++i)
{
displayBid(bids[i]);
}
cout << endl;
break;
}
}
cout << "Good bye." << endl;
return 0;
}
</code></pre>
| <c++><vector><struct> | 2019-06-10 18:59:15 | LQ_CLOSE |
56,532,366 | Using @ViewBuilder to create Views which support multiple children | <p>Some Views in SwiftUI, like VStack and HStack support having multiple views as children, like this:</p>
<pre class="lang-swift prettyprint-override"><code>VStack {
Text("hello")
Text("world")
}
</code></pre>
<p>From what I gather, they use <a href="https://developer.apple.com/documentation/swiftui/viewbuilder" rel="noreferrer">ViewBuilder</a> to make this possible as explained <a href="https://stackoverflow.com/questions/56434549/what-enables-swiftuis-dsl/56435128#56435128">here</a>. </p>
<p>How can we use @ViewBuilder for creating our own Views which support multiple children? For example, let's say that I want to create a <code>Layout</code> View which accepts arbitrary children -- something like this:</p>
<pre class="lang-swift prettyprint-override"><code>struct Layout : View {
let content: Some View
var body : some View {
VStack {
Text("This is a layout")
content()
}
}
}
</code></pre>
<p>Any idea how to implement this pattern in SwiftUI? </p>
| <swift><swiftui> | 2019-06-10 19:21:18 | HQ |
56,533,059 | How to get Current Location with SwiftUI? | <p>Trying to get current location with using swiftUI. Below code, couldn't initialize with didUpdateLocations delegate. </p>
<pre><code>class GetLocation : BindableObject {
var didChange = PassthroughSubject<GetLocation,Never>()
var location : CLLocation {
didSet {
didChange.send(self)
}
}
init() {}
}
</code></pre>
| <cllocation><swiftui> | 2019-06-10 20:22:20 | HQ |
56,533,511 | How update a SwiftUI List without animation | <p>I want to update a SwiftUI List without any insert animation.
My <code>List</code> is getting its data from an <code>@EnvironmentObject</code>
I already tried to wrap the <code>List</code> itself and the <code>PassthroughSubject.send()</code> in a <code>withAnimation(.empty)</code> block but this does not help.</p>
<p>A very very dirty workaround is to call <code>UIView.setAnimationsEnabled(false)</code> (yes, UIKit has impact on SwiftUI), but there must be a SwiftUI-like way to set custom insert animations.</p>
| <ios><swift><swiftui> | 2019-06-10 21:03:44 | HQ |
56,533,865 | add event to all labels in form | <p>I want to add click,mouseleave and mouseenter event to all labels in the form using code below. But i call the addeventtoalllabels on form_load but it wont add event to labels.</p>
<pre><code> public void setColor()
{
if (clickedLabel != default(Label))
clickedLabel.BackColor = Color.Yellow;
//Resetting clicked label because another (or the same) was just clicked.
}
void addeventtoalllabels()
{
foreach (Label c in this.Controls.OfType<Label>())
{
try
{
c.Click += (sender, e) => {
setColor();
Label theLabel = (Label)sender;
clickedLabel = theLabel;
};
c.MouseEnter += (sender, e) =>
{
Label theLabel = (Label)sender;
if (theLabel != clickedLabel)
theLabel.BackColor = Color.Red;
};
c.MouseLeave += (sender, e) =>
{
Label theLabel = (Label)sender;
if (theLabel != clickedLabel)
theLabel.BackColor = Color.Yellow;
};
}
catch { }
}
}
</code></pre>
| <c#><.net> | 2019-06-10 21:39:10 | LQ_CLOSE |
56,535,326 | What is the difference between List and ForEach in SwiftUI? | <p>I know SwiftUI does not support currently regular for loops but instead provide something called ForEach but what is the difference between that and a List?</p>
| <swiftui> | 2019-06-11 01:30:11 | HQ |
56,536,750 | How can I pass external variable in excel macro for header? | I'm printing no of pages in right header (eg. Page 1 of [total no of pages]) I want to pass my variable after &P of &fcount(fcount is my variable). How can I pass this? | <excel><vba> | 2019-06-11 04:58:50 | LQ_EDIT |
56,536,770 | Hide a colomn when fetch the all data in PHP | everyone, I want to list all users data from the database in PHP. there will be a user is logged-in at a single time. I want un-fetch or hide a single column who has active(logged-in). so, I'm asking you how can I do this...
$query=$conn->pdo->exec("SELECT * FROM usertable");
$row=$query->fetch();
<thead>
<tr>
<th>User Name</th>
<th>Name</th>
<th>Email</th>
<th>Role</th>
<th>Post</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php while($row=$query->fetch()){ ?>
<tr>
<td><?php echo $row['username']; ?>
</td>
<td><?php echo ucfirst($row['name']); ?>
</td>
<td><?php echo $row['username']; ?></td>
<td><?php echo ucfirst($row['user_type']); ?></td>
<td><?php echo $row['id']; ?></td>
<td>
| <php><html><sql><pdo> | 2019-06-11 05:01:41 | LQ_EDIT |
56,537,321 | compile time error - stackOverflow, while creating new class instance | <p>below is very simple program which is giving stackOverFlow error. Here is confuse with flow. can someone tell me the exact flow of this program and give me the reason for the corresponding error.</p>
<pre><code>package test;
class Test{
Test tt = new Test();
public static void main(String[] args) {
new Test();
}
}
</code></pre>
<p>OUTPUT -</p>
<pre><code>Exception in thread "main" java.lang.StackOverflowError
at test.Test.<init>(Test.java:4)
at test.Test.<init>(Test.java:4)
at test.Test.<init>(Test.java:4)
at test.Test.<init>(Test.java:4)
at test.Test.<init>(Test.java:4)
at test.Test.<init>(Test.java:4)
</code></pre>
| <java> | 2019-06-11 05:55:37 | LQ_CLOSE |
56,537,695 | its about meta tag and description in php website | I have a single header called on different pages through PHP. But in order to be detected for SEO, I have to include separate meta tags and description for each page.
I am using PHP code for this
<?php $cur_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
if($cur_url == "https://www.example.com/" || $cur_url == "https://example.com/"){
?>
<body id="main-homepage" class="homepage-travels">
<meta >
<?php
}
else if($cur_url == "https://example.com/one-travel-packages" || $cur_url == "https://example.com/one-travel"){
}
else{
?>
<body id="main-homepage">
<?php
}
?> | <php><html><meta> | 2019-06-11 06:25:27 | LQ_EDIT |
56,537,718 | What assert do in dart? | <p>I just want to know what's the use of assert in a Dart. I was tried to figure it out by myself but I'm not able to do that. It would great if someone explains me about assert.</p>
| <flutter><dart> | 2019-06-11 06:27:05 | HQ |
56,541,659 | How to convert a String ("95941634.164") to a float | <p>When I tyr to convert a String "95941634.164" to a float and print the same, it is printing as 9.5941632E7 but not as 95941634.164.</p>
<p>I tried following conversion methods Float.parseFloat() and Float.valueOf()</p>
<pre><code>public static void main(String args[])
{
String s = "95941634.164" ;
Float f = Float.valueOf(s);
System.out.println(f);
System.out.println(Float.parseFloat("95941634.164"));
}
</code></pre>
<p>Actual: 9.5941632E7 expected 95941634.164</p>
| <java> | 2019-06-11 10:26:39 | LQ_CLOSE |
56,541,719 | getting extra single quotes in output | I'm Solving a simple code in python to print randomly generated ticket number.
But when I'm printing list of ticket number it is giving extra single quotes.
Please refer to **below code**.:-
#PF-Exer-22
import random
def generate_ticket(airline,source,destination,no_of_passengers):
ticket_number_list=[]
src = source[0:3]
dest = destination[0:3]
listof_passonger = []
random_number_list = []
random_number = 0
random_number = 102
for loop in range(0, no_of_passengers):
#if(random_number in random_number_list):
#random_number = random.randint(101,500)
#else:
#random_number_list.append(random_number_list)
random_number = random_number + 1
ticket_number = airline + ":" + src + ":" + dest + ":" + str(random_number)
ticket_number_list.append(ticket_number)
return ticket_number_list
print(generate_ticket("AI","Bangalore","London",7))
while executing above code my **output** is :-
['AI:Ban:Lon:103', 'AI:Ban:Lon:104', 'AI:Ban:Lon:105', 'AI:Ban:Lon:106', 'AI:Ban:Lon:107', 'AI:Ban:Lon:108', 'AI:Ban:Lon:109']
but my **expected output** is :-
[AI:Ban:Lon:103,AI:Ban:Lon:104,AI:Ban:Lon:105,AI:Ban:Lon:106,AI:Ban:Lon:107]
As you can see tere is no single code is expected output.
Please help me with that
And please don't vote down for no reason. | <python> | 2019-06-11 10:30:07 | LQ_EDIT |
56,542,315 | hello, I have a question about Flutter navigator/MaterialPageRoute , please help me | I have a BUTTON ,here is some code:
[enter image description here][1]
and i got the error like this:[enter image description here][2]
i never met the error like this, but when i add the 'dynamic' like this:[enter image description here][3]
[1]: https://i.stack.imgur.com/meoic.png
[2]: https://i.stack.imgur.com/0o4aD.png
[3]: https://i.stack.imgur.com/0UXkO.png
i am so confusing ! plz help ! | <dynamic><flutter><navigator><materialpageroute> | 2019-06-11 11:05:12 | LQ_EDIT |
56,543,884 | argument of type 'int' is not iterable when I use tuples | I am getting this error when I run my program and I have no idea why. The error is occurring on the line that says:"if prt in migration_p[j][0] and dst in migration_p[j][1]"
```
migration_p = [(1, 3), (2, 4), (3, 3)]
link = {(1, 2): 200, (1, 3): 50, (2, 3): 100, (1, 4): 300, (2, 4): 100, (3, 4): 50}
source_servers = {1: [1, 2, 3], 2: [1, 2, 3]}
partition = {1: 200, 2: 200, 3: 500}
def time_qi(dst, prt):
tqi_rsrc = []
indexes = []
global size, bandwidth, min_time, source
for i in source_servers.keys():
if (i, dst) in link.keys():
bandwidth = link[i, dst]
for j in range(len(migration_p)):
if prt in migration_p[j][0] and dst in migration_p[j][1]:
size = partition[prt]
tqi_rsrc.append(bandwidth / size)
indexes.append(i)
min_time = min(tqi_rsrc)
index = np.argmin(tqi_rsrc)
source = indexes[index]
# print(source)
return min_time, source
print(time_qi(3, 1)[0]) | <python> | 2019-06-11 12:35:17 | LQ_EDIT |
56,545,192 | How garbage collector collects internal objects inside other objects? | <p>Let's say we have two class A and class B:</p>
<pre><code>class A
{
public B b;
public A()
{
b = new B();
}
}
class B
{
}
</code></pre>
<p>and in the main method:</p>
<pre><code>static void Main(string[] args)
{
TestMethod();
//timestamp 2
string[] StrList = new String[999999]; // Make a ton of objects to trigger Garage Collection in an attempt to free up memory
}
static void TestMethod()
{
A a = new A();
//timestamp 1
}
</code></pre>
<p>so in timestamp 1, the memory will be like:</p>
<p><a href="https://i.stack.imgur.com/egjGV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/egjGV.png" alt="enter image description here"></a></p>
<p>and in timestamp 2, the memory will be like:
<a href="https://i.stack.imgur.com/lI0Ut.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lI0Ut.png" alt="enter image description here"></a></p>
<p>and then GC is triggered. The first thing I don't quite understand is, how the instance new B() free by GC? since b is still pointing to it, and GC won't collect objects that are still be referenced?</p>
<p>If new B() has to be free , which one is free first, new A() or new B()?</p>
| <c#><.net> | 2019-06-11 13:45:41 | LQ_CLOSE |
56,545,444 | How to remove highlight on tap of List with SwiftUI? | <p>How to remove highlight on tap of List with SwiftUI?</p>
<pre><code>List {
}.whatModifierToAddHere?
</code></pre>
<p>The <a href="https://developer.apple.com/documentation/swiftui/selectionmanager" rel="noreferrer">selection manager documentation</a> doesnt say anything about it.</p>
| <ios><swiftui> | 2019-06-11 13:57:52 | HQ |
56,546,598 | How to hot key (Ctr+c+c) for VBA macro | i want to hot key(ctr+c+c) to call macro VBA excel. Please help me. i am trying use Application.Onkey but can not. | <excel><vba> | 2019-06-11 15:00:38 | LQ_EDIT |
56,548,928 | eslint resolve error on imports using with path mapping configured jsconfig.json | <p>Here's my project structure:</p>
<pre><code>-src
--assets
--components
--constants
--helpers
--pages
--routes
eslintrc.json
jsconfig.json
App.js
index.js
</code></pre>
<p>I was tired of:</p>
<p><code>import SomeComponent from '../../../../../components/SomeComponent';</code></p>
<p>And I wanted to do:</p>
<p><code>import SomeComponent from '@components/SomeComponent';</code></p>
<p>So I saw this question here on SO:</p>
<p><a href="https://stackoverflow.com/questions/47181037/vscode-intellisense-does-not-work-with-webpack-alias">VSCode Intellisense does not work with webpack + alias</a></p>
<p>And I got it to work with:</p>
<p><strong>jsconfig.json</strong></p>
<pre><code>{
"compilerOptions": {
"baseUrl": ".",
"target": "es6",
"module": "commonjs",
"paths": {
"@components/*": ["./src/components/*"]
}
}
}
</code></pre>
<p>But eslint now it's complaining that it's unresolved, even though it compiles just fine.</p>
<p><strong>eslint error:</strong></p>
<blockquote>
<p>Unable to resolve path to module '@components/SocialMedia'.eslint(import/no-unresolved)</p>
</blockquote>
<p><strong>NOTE:</strong> </p>
<p>I don't want to disable eslint. I want to make it understand this kind of path too.</p>
| <javascript><visual-studio-code><eslint><vscode-settings><eslintrc> | 2019-06-11 17:29:08 | HQ |
56,549,788 | How to put conditions in loop statements | <p>This program is to take input from the user and to give output back showing how many numbers were above the average of the array and below it. I'm trying to put a condition on the loops to exit getting input.</p>
<pre><code>import java.util.Scanner;
public class analyzeScores {
public static void count(int[] list) {
Scanner input = new Scanner(System.in);
for(int i = 0; i < list.length;i++) {
if(list[i] != 0)
list[i] = input.nextInt();
}
}
public static void sorts(int[] lists, int average) {
int high = 0;
int low = 0;
for(int i = 0; i < lists.length; i++) {
if(lists[i] >= average) {
high +=1;
}
else {
low += 1;
}
}
System.out.println("The number of higher then average scores is " + high);
System.out.println("The number of lower then average scores is " + low);
}
public static void main(String[] args) {
int[] list = new int[10];
System.out.println("Enter the scores: ");
count(list);
int total = 0;
for (int i = 0; i < list.length;i++) {
total += list[i];
}
total = total / list.length;
sorts(list, total);
}
}
</code></pre>
<p>I'm trying to figure out how to implement a way to input 0 to exit the loop in the count(int[] list) method. I tried to implement if(list[i] != 0) but messes the whole code up</p>
| <java> | 2019-06-11 18:30:59 | LQ_CLOSE |
56,550,135 | SwiftUI: Global Overlay That Can Be Triggered From Any View | <p>I'm quite new to the SwiftUI framework and I haven't wrapped my head around all of it yet so please bear with me.</p>
<p>Is there a way to trigger an "overlay view" from inside "another view" when its binding changes? See illustration below:</p>
<p><a href="https://i.stack.imgur.com/sziqy.png" rel="noreferrer"><img src="https://i.stack.imgur.com/sziqy.png" alt="enter image description here"></a></p>
<p>I figure this "overlay view" would wrap all my views. I'm not sure how to do this yet - maybe using <code>ZIndex</code>. I also guess I'd need some sort of callback when the binding changes, but I'm also not sure how to do that either.</p>
<p>This is what I've got so far:</p>
<p><strong>ContentView</strong></p>
<pre><code>struct ContentView : View {
@State private var liked: Bool = false
var body: some View {
VStack {
LikeButton(liked: $liked)
}
}
}
</code></pre>
<p><strong>LikeButton</strong></p>
<pre><code>struct LikeButton : View {
@Binding var liked: Bool
var body: some View {
Button(action: { self.toggleLiked() }) {
Image(systemName: liked ? "heart" : "heart.fill")
}
}
private func toggleLiked() {
self.liked = !self.liked
// NEED SOME SORT OF TOAST CALLBACK HERE
}
}
</code></pre>
<p>I feel like I need some sort of callback inside my <code>LikeButton</code>, but I'm not sure how this all works in Swift.</p>
<p>Any help with this would be appreciated. Thanks in advance!</p>
| <swift><swiftui> | 2019-06-11 18:54:52 | HQ |
56,550,658 | SSL handshake failed remote host closed connection during handshake (eclipse, svn) | I am trying to create a repository in Eclipse. The code that I need is hosted in a Visual SVN (VisualSVN) server. I am trying to use its truck URL as the repository location, but when I try to connect to the URL through Eclipse's SVN plug-in, it fails with error SSL handshake failed.
I am using a proxy server.
I have seen solutions mentioning modifying the settings like so:
-Dhttps.protocols=TLSv1.1,TLSv1.2
Source:
https://stackoverflow.com/questions/21245796/javax-net-ssl-sslhandshakeexception-remote-host-closed-connection-during-handsh
But I do not have any Java options file?
plz HALP
Tried disabling proxy, using open network where eclipse works (but then I can't connect to the visual svn server). Tried using Visual Studio Code instead ( no proxy issues but I need to download and svn .exe which I cannot do rn) | <eclipse><svn><visualsvn-server> | 2019-06-11 19:37:07 | LQ_EDIT |
56,550,841 | TypeError 'x' is not a function | <p>TypeError: this.props.handleClick is not a function</p>
<pre><code>class Task extends React.Component{
render(){
return(
<div className="Task">
<span style = {{ textDecoration : this.props.todo.done ? 'line-through' : 'none'}}>{this.props.todo.value}</span>
<button onClick = {() => this.props.handleClick(this.props.index)}>{this.props.todo.done ? 'Undo' : 'Complete'}</button>
</div>
)
}
}
</code></pre>
| <javascript><reactjs> | 2019-06-11 19:52:03 | LQ_CLOSE |
56,551,215 | Pyspark converting between two date types | <p>I am having trouble converting a column of dates with one format to another format in pyspark. I know that there is an easy way to get this achieved but don't know how. I already have them in the format of</p>
<pre><code>2019-05-21T13:35:16.203Z
</code></pre>
<p>and I would like it to be in the format</p>
<pre><code>6/10/2019 6:33:34 PM
</code></pre>
<p>Part of the problem is that I don't know what these formats are called for calling a spark dataframe function to do it.</p>
| <python><apache-spark><dataframe><pyspark> | 2019-06-11 20:23:46 | LQ_CLOSE |
56,551,671 | why does my while loop doesnt start at the point i ask him to? Beginner | public class Main
{
public static void main(String[] args)
{
int[] a = {2,7,3,4,5,6,7,8};
int merker = a[0];
int i =4;
int n = a.length;
while(i<n)
{
if(a[i] < merker)
merker = a[i];
i = i + 1;
}
System.out.print(merker);
so im a beginner and i dont understand why the while loop does not start at the 5th number of the array as i made int i = 4; ?
hoping for an answer, thank you really for a response! | <java><arrays><loops><while-loop> | 2019-06-11 21:06:10 | LQ_EDIT |
56,553,110 | Getting the Value of A Variable from another file C# | I have 2 files and in the 1st file, I have textbox where the user can enter a value. I want to take that value and bring it to the other file. In that program, I have the user entering a value also in a textbox. If the value they enter is higher than the other you get an error.
For example: File 2 ask how many snickers you want to eat and File 1 (ask the user how many snickers we have). If what you want to eat is more than what you have you get an error.
I'm not sure how I can get this value in the other file.
FILE 1:
protected void Page_Load(object sender, EventArgs e)
{
//create string and set it equal to the textbox text
string snickersInventory = txtInventorySnickers.Text;
//create a int and turn the string into an int
int stockSnickers = Int32.Parse(snickersInventory);
}
FILE 2:
protected void btnSubmit_Click(object sender, EventArgs e)
{
//Check to see if the stockSnickers is lower than the amount of Snickers Value
}
| <c#><asp.net> | 2019-06-12 00:11:30 | LQ_EDIT |
56,554,185 | javascript not showing exact value in calulations | I would like to know why there is always some difference in value,when i perform the below calcualtions.
```
<!-- begin snippet: js hide: false console: true babel: false -->
var amt=1000;
var cr= 3.02%;
var net = (cr/100)*amt;
alert(net);//shows 29.02 instead of 30.02
```
| <javascript><html><arrays><object><math> | 2019-06-12 03:12:21 | LQ_EDIT |
56,555,067 | How to generate data for both History and Current | I need to generate a report from existing tables with scd stored.
Imagine i have a table1
table1
>Pid|eff_dt|exp_dt
>489|2018-11-02 05:27:12.049|9999-12-31 23:59:59.000
>546|2018-11-02 05:27:12.049|2018-12-02 05:27:12.049
>546|2018-12-02 05:27:12.049|9999-12-31 23:59:59.000
table2
>Pid|val|eff_dt|exp_dt
>489|JD7G|2018-11-02 05:24:16.438|2018-11-09 05:40:47.203
>489|JD7|2018-11-09 05:40:47.203|9999-12-31 23:59:59.000
>546|TR56|2018-11-09 05:40:47.203|9999-12-31 23:59:59.000
Expected Output is :
>Pid|val|eff_dt|exp_dt
>489|JD7G|2018-11-02 05:27:12.049|9999-12-31 23:59:59.000
>489|JD7|2018-11-02 05:27:12.049|9999-12-31 23:59:59.000
>546|TR56|2018-11-02 05:27:12.049|2018-12-02 05:27:12.049
>546|TR56|2018-12-02 05:27:12.049|9999-12-31 23:59:59.000 | <sql> | 2019-06-12 05:14:55 | LQ_EDIT |
56,555,246 | How to run a file in python and check its result | I'm totally new to python and sorry for the manner this question is asked. I have a file called helloworld.py. And I want to code a .py program in python which can run this file multiple times and automatically check its output is the desired one. How could I code this? | <python> | 2019-06-12 05:33:07 | LQ_EDIT |
56,555,498 | Is It possible to create class name starts with digits in c++ | <p>I need to create a class name starting with digits as 206xx.if it is possible to create then how to achieve this.</p>
| <c++> | 2019-06-12 05:56:23 | LQ_CLOSE |
56,555,896 | I'm fairly new to Linq and EF. Having problems comparing strings in Linq entities and SQL | Any way the comparison of strings is incorrect?
I've already tried the String.Equals or CompareTo but those return boolean values, i read for Linq the comparison String == string is like a WHERE statement from SQL.
public IHttpActionResult GetMultifiberResult(string partNumber)
{
var list = db.MultifiberResults.Where(s => s.PartNumber ==
partNumber).ToList();
return Ok(list);
}
list should return a bunch of values where the column PartNumber from the DB is equal to parameter partNumber. When I search using int comparison it does find matches in an int column but not with varchar columns. Controller always returns empty and the count is 0. | <c#><entity-framework><linq> | 2019-06-12 06:30:01 | LQ_EDIT |
56,556,815 | How to delete everything in a folder except one or two folders that I want to retain? | <p>I have folder "Folder1" that contains files and folders such as "file1", "file2" "Folder11" "Folder12" "Folder13" etc. I want to retain only "Folder11" & "Folder12" and delete rest of the things. I need help to write python script for the same.</p>
| <python> | 2019-06-12 07:31:22 | LQ_CLOSE |
56,557,645 | How to permanently set GOPATH environmental variable - Ubuntu | I set ```GOPATH``` as an environment variable on my **Ubuntu** VM as the following: ```export GOPATH="/go"``` and it works fine.
The problem is, after I reboot my machine ```GOPATH``` is no longer an environment variable.
Why is that and how can I set it permanently? | <linux><ubuntu> | 2019-06-12 08:22:02 | LQ_EDIT |
56,558,498 | Close a form from another form [Pascal] | Let's say I have two forms "Form1" and "Form2".
Form1 contains two buttons, one that creates and displays Form2 and a button to close Form2.
To create Form2 i use:
Form2 := TForm2.Create (Self);
Form2.Show;
How do I close Form2 from Form1? | <lazarus> | 2019-06-12 09:08:26 | LQ_EDIT |
56,558,775 | launchFragmentInContainer unable to resolve Activity in Android | <p>While writing a simple test which uses <code>launchFragmentInContainer</code>, I get the following error message:</p>
<pre><code>java.lang.RuntimeException: Unable to resolve activity for: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.myapp.appname.debug/androidx.fragment.app.testing.FragmentScenario$EmptyFragmentActivity (has extras) }
</code></pre>
<p>The basic test class is:</p>
<pre><code>class OneFragmentTest {
@Test
fun testOneFragmentState_checkTitleText() {
val args = Bundle().apply {
putString("dummyKey", "dummyValue")
}
launchFragmentInContainer<OneFragment>(args)
onView(withId(R.id.tv_title)).check(matches(withText("title here")))
}
}
</code></pre>
<p>I have tried to update <code>AndroidManifest.xml</code> with the following:</p>
<pre class="lang-xml prettyprint-override"><code><instrumentation
android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.myapp.appname" />
</code></pre>
<p>but it seems that the tag <code>instrumentation</code> is valid but the values are written in red, so I assume something is wrong with the <code>targetPackage</code> and <code>name</code>.</p>
<p>How can I get rid of this error and run a simple test on OneFragment using <code>launchFragmentInContainer</code>? </p>
| <android><android-fragments><android-testing><androidx> | 2019-06-12 09:23:37 | HQ |
56,559,772 | Where do I find the object names of icons in the FontAwesome free packages? | <p><a href="https://fontawesome.com/" rel="noreferrer">FontAwesome</a> is a collection of libraries of icons. In their <a href="https://www.npmjs.com/package/@fortawesome/react-fontawesome" rel="noreferrer">Usage documentation</a>, they write as an example that you can use their coffee icon by importing the coffee icon's object from the free-solid-svg-icons package, like this:</p>
<pre class="lang-js prettyprint-override"><code>import ReactDOM from 'react-dom'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faCoffee } from '@fortawesome/free-solid-svg-icons'
const element = <FontAwesomeIcon icon={faCoffee} />
ReactDOM.render(element, document.body)
</code></pre>
<p>Looking at the <a href="https://fontawesome.com/icons/coffee?style=solid" rel="noreferrer">FontAwesome Coffee Icon documentation</a>, I can see no reference to what package the coffee icon is included in, or what its object name is. We know from the example code that its object name is <code>faCoffee</code> and that it's included in the <code>@fortawesome/free-solid-svg-icons</code> package, but what about any of the <a href="https://fontawesome.com/icons" rel="noreferrer">other 5,365 icons</a>?</p>
<p><strong>Q:</strong> How can I find what React object name a FontAwesome icon has, and what React package it's included in?</p>
| <reactjs><font-awesome-5> | 2019-06-12 10:16:57 | HQ |
56,561,064 | SwiftUI - Multiple Buttons in a List row | <p>Say I have a <code>List</code> and two buttons in one row, how to ditinguish which button is tapped without the entire row highlighting?</p>
<p>For this sample code, when any one of the buttons in the row is tapped, both button's action callbacks are invoked.</p>
<pre><code>// a simple list with just one row
List {
// both buttons in a HStack so that they appear in a single row
HStack {
Button(action: {
print("button 1 tapped")
}) {
Text("One")
}
Button(action: {
print("button 2 tapped")
}) {
Text("Two")
}
}
}
// when tapping just once on either button:
// "button 1 tapped"
// "button 2 tapped"
</code></pre>
| <ios><swift><swiftui> | 2019-06-12 11:24:39 | HQ |
56,561,077 | Expand a string wich have '\t' to a specific lenght | Here I have a string wich have 3 '\t's and when I use the proper methods like:
string.padright(totalWidth);
Or
string.format("{0,width}",myText);
Or even a function from skrach, I get a problem with that '\t' escape in the string wich counts one but depend on string, its beatwin 0 to 8.
At the end if I have this string "blah\tblah\tblah" and I apply those methods to have a 20 lenght string I get this "blah blah blah " which lenght is 30.
Now I want a hero who say how can I count the space that '\t' fill after the string shows. | <c#><string><escaping> | 2019-06-12 11:25:20 | LQ_EDIT |
56,561,439 | dbeaver: how can I export connection configuration? | <p>I recently got a new macbook pro for work and I'm in the process of migrating a lot of my settings from my old machine. I was hoping that there is a way to export the connection configuration/properties from my old machine rather than have to go through the process of recreating each one. </p>
<p>Does anyone know how to do this? The dbeaver version on my old machine is 6.0.3 and the version on my new machine is 6.1.x</p>
<p>thanks!</p>
| <dbeaver> | 2019-06-12 11:43:51 | HQ |
56,561,554 | Keycloak Realm VS Keycloak Client | <p>I am recently working on Keycloak 6.0.1 for SSO for authentication for multiple applications in organisation. I am confused in difference between clients and realm. </p>
<p>If I have 5 different application to be managed for SSO then do I have to create 5 different clients or 5 different realm ?</p>
<p>If I say I have to create 5 different Clients under 1 realm then could I execute different authentication flow for different client in same realm ?</p>
| <devops><keycloak> | 2019-06-12 11:49:04 | HQ |
56,561,630 | SwiftUI: Forcing an Update | <p>Normally, we're restricted from discussing Apple prerelease stuff, but I've already seen plenty of SwiftUI discussions, so I suspect that it's OK; just this once.</p>
<p>I am in the process of driving into the weeds on one of the tutorials (I do that).</p>
<p>I am adding a pair of buttons below the swipeable screens in the "Interfacing With UIKit" tutorial: <a href="https://developer.apple.com/tutorials/swiftui/interfacing-with-uikit" rel="noreferrer">https://developer.apple.com/tutorials/swiftui/interfacing-with-uikit</a></p>
<p>These are "Next" and "Prev" buttons. When at one end or the other, the corresponding button hides. I have that working fine.</p>
<p>The problem that I'm having, is accessing the UIPageViewController instance represented by the PageViewController.</p>
<p>I have the currentPage property changing (by making the PageViewController a delegate of the UIPageViewController), but I need to force the UIPageViewController to change programmatically.</p>
<p>I know that I can "brute force" the display by redrawing the PageView body, reflecting a new currentPage, but I'm not exactly sure how to do that.</p>
<pre><code>struct PageView<Page: View>: View {
var viewControllers: [UIHostingController<Page>]
@State var currentPage = 0
init(_ views: [Page]) {
self.viewControllers = views.map { UIHostingController(rootView: $0) }
}
var body: some View {
VStack {
PageViewController(controllers: viewControllers, currentPage: $currentPage)
HStack(alignment: .center) {
Spacer()
if 0 < currentPage {
Button(action: {
self.prevPage()
}) {
Text("Prev")
}
Spacer()
}
Text(verbatim: "Page \(currentPage)")
if currentPage < viewControllers.count - 1 {
Spacer()
Button(action: {
self.nextPage()
}) {
Text("Next")
}
}
Spacer()
}
}
}
func nextPage() {
if currentPage < viewControllers.count - 1 {
currentPage += 1
}
}
func prevPage() {
if 0 < currentPage {
currentPage -= 1
}
}
}
</code></pre>
<p>I know the answer should be obvious, but I'm having difficulty figuring out how to programmatically refresh the VStack or body.</p>
| <swift><swiftui> | 2019-06-12 11:53:05 | HQ |
56,561,734 | RuntimeError: tf.placeholder() is not compatible with eager execution | <p>I have upgraded with tf_upgrade_v2 TF1 code to TF2. I'm a noob with both. I got the next error:</p>
<pre><code>RuntimeError: tf.placeholder() is not compatible with eager execution.
</code></pre>
<p>I have some <code>tf.compat.v1.placeholder()</code>.</p>
<pre><code>self.temperature = tf.compat.v1.placeholder_with_default(1., shape=())
self.edges_labels = tf.compat.v1.placeholder(dtype=tf.int64, shape=(None, vertexes, vertexes))
self.nodes_labels = tf.compat.v1.placeholder(dtype=tf.int64, shape=(None, vertexes))
self.embeddings = tf.compat.v1.placeholder(dtype=tf.float32, shape=(None, embedding_dim))
</code></pre>
<p>Could you give me any advice about how to proceed? Any "fast" solutions? or should I to recode this?</p>
| <python><python-3.x><tensorflow><tensorflow2.0> | 2019-06-12 11:58:43 | HQ |
56,562,632 | hqo can i make a correct regex in dajngo? | I need to make regex to make a button witch put me on other website
this is my re_path:
re_path (r'^detaletournament(?P<turnament_id>[0-9]+)/$',detaletournament)
Using the URLconf defined in projekt.urls, Django tried these URL patterns, in this order:
admin/
tir
login
register
usertournaments
turnament
addturnament
takepart
deletetournament
quittournament
mytournaments
webturnament
profile
^detaletournament(?P<turnament_id>[0-9]+)/$
The current path, detaletournament, didn't match any of these. | <python><regex><django> | 2019-06-12 12:48:35 | LQ_EDIT |
56,562,685 | 'React' must be in scope when using JSX error in routes.js file | <p>ESlint is showing me the above-mentioned error when writing a <code>routes.js</code> file.</p>
<pre><code>module.exports = {
'env': {
'browser': true,
'es6': true
},
'extends': ['plugin:react/recommended', 'standard'],
'globals': {
'Atomics': 'readonly',
'SharedArrayBuffer': 'readonly'
},
'parser': 'babel-eslint',
'parserOptions': {
'ecmaFeatures': {
'jsx': true
},
'ecmaVersion': 2018,
'sourceType': 'module'
},
'plugins': [
'react'
],
'rules': {
}
}
</code></pre>
<p>My <code>routes.js</code></p>
<pre><code>import { Switch, Route } from 'react-router-dom'
import Feed from './pages/Feed'
import Post from './pages/Post'
function Routes () {
return (
<Switch> // -> red line
<Route path="/" component={Feed} /> // -> red line
<Route path="/post" component={Post} /> // -> red line
</Switch>
)
}
export default Routes
</code></pre>
<p>Cannot find a clear solution for such issue.</p>
| <javascript><node.js><reactjs> | 2019-06-12 12:51:34 | LQ_CLOSE |
56,563,559 | How to convert .img to docker image | I am novice at docker. By this [post][1] I made a .img file for docker, but how import it as docker image I don't know...
Thanks for your help.
[1]: https://forum.volumio.org/volumio2-docker-rpi3-t5849.html | <docker><raspberry-pi3><raspbian><volumio> | 2019-06-12 13:35:47 | LQ_EDIT |
56,565,025 | How to get a consecutive same set of character from the string which are stored in array ? For example' INPUT: sword|word|cord output: ord | <p>how to get consecutive set of character from a string which are stored in a array?
for example:
input:
sword
cord
word
OUTPUT:
ord</p>
| <c#> | 2019-06-12 14:51:28 | LQ_CLOSE |
56,565,539 | memset_s(): What does the standard mean with this piece of text? | <p>In C11, K.3.7.4.1 <em>The memset_s function</em>, I found this bit of rather confusing text:</p>
<blockquote>
<p>Unlike <code>memset</code>, any call to the <code>memset_s</code> function shall be evaluated strictly according to the rules of the abstract machine as described in (5.1.2.3). That is, any call to the <code>memset_s</code> function shall assume that the memory indicated by <code>s</code> and <code>n</code> may be accessible in the future and thus must contain the values indicated by <code>c</code>.</p>
</blockquote>
<p>This implies that <code>memset</code> is <em>not</em> (necessarily) "evaluated strictly according to the rules of the abstract machine". (The chapter referenced is 5.1.2.3 <em>Program execution</em>.)</p>
<p><strong>I fail to understand the leeway the standard gives to <code>memset</code> that is explicitly ruled out here for <code>memset_s</code>, and what that would mean for an implementor of either function.</strong></p>
| <c><language-lawyer> | 2019-06-12 15:17:57 | HQ |
56,566,781 | Homework gone wild : "Cannot create a generic array of AbstractChain<T>" | <p>So this is an exercice given by my teacher. We're creating a SkipList, aka a "LinkedList" with shortcuts.
He gave us a class diagram with one interface (AbstractLink) and three class (StartLink and EndLink implement AbstractLink while Link extends StartLink).
He also gave us a huge part of the code but i find it surprising that the interface is empty, i dont really understand why it is and he doesn't look like we need to fill it.
Anyhow, in the StartLink, he told us to write the constructor.</p>
<p>So i tried to initialize nexts, which is an array of AbstractLink (???), with the parameter n.
As far as I searched, it's impossible to do it because the type of the AbstractLink is not defined. But it leaves me clueless with what i have to change ...</p>
<pre class="lang-java prettyprint-override"><code>public interface AbstractLink<T extends Comparable<T>> extends Comparable<AbstractLink<T>> {
}
</code></pre>
<pre class="lang-java prettyprint-override"><code>public class StartLink<T extends Comparable<T>> implements AbstractLink<T> {
final AbstractLink<T>[] nexts;
public StartLink(int n){
this.nexts = new AbstractLink<T>[n]; //my line
}
</code></pre>
<p>And Eclipse gives me this :
Cannot create a generic array of ChainonAbstrait</p>
<p>Thanks in advance</p>
| <java><generics> | 2019-06-12 16:33:16 | LQ_CLOSE |
56,567,101 | The API with ID does not include a resource with path /* having an integration LAMBDA on the ANY method | <p>.net core serverless web api
I am trying to do proxy integration with lambda and api gateway, everything is working fine with aws console </p>
<p>but i am facing issues with aws cli commands
i tried integrating with cli but the lambda is not properly integrated</p>
<pre><code>aws apigateway create-resource --rest-api-id id --parent-id id --path-part {proxy+}
aws apigateway put-method --rest-api-id id --resource-id id --http-method ANY --authorization-type "NONE"
aws apigateway put-integration --rest-api-id id --resource-id id --http-method ANY --type HTTP_PROXY --integration-http-method ANY --uri arn:aws:apigateway:us-east-2:lambda:path//2015-03-31/functions/arn:aws:lambda:us-east-2:account_id:function:helloworld/invocations
aws lambda add-permission --function-name helloworld --action lambda:InvokeFunction --principal apigateway.amazonaws.com --source-arn arn:aws:execute-api:us-east-2:account_id:apiid/*/*/* --statement-id 12345678
</code></pre>
| <amazon-web-services><aws-lambda><asp.net-core-webapi><aws-cli><aws-serverless> | 2019-06-12 16:58:14 | HQ |
56,567,183 | How to decide whether a number in a dictionary is a str or float? | <p>I am asking this because I saw a dictionary produced from two different sources, in which one number is a float, and the same number is a string.</p>
<p>data = {'name': 'jack', 'confidence': '0.95'}</p>
<p>The 'confidence' is a float in once case, and a str in another case. Why is that? </p>
<pre><code>conf = data.get('confidence')
</code></pre>
| <python> | 2019-06-12 17:02:47 | LQ_CLOSE |
56,569,192 | convert how to Convert textbox to integer c# | <p>I'v problem
how to Convert textbox to float c#</p>
<p>I have in my textbox.text
example</p>
<p>8.1.1</p>
<p>I did this cod but error</p>
<p>//</p>
<pre><code> int a ;
a = val (model.Text);
//
if (a >= 6)
{
}
</code></pre>
<p>Convert textbox to float</p>
<p>some one pleas help me</p>
| <c#> | 2019-06-12 19:31:00 | LQ_CLOSE |
56,569,860 | How to Convert octal to hexadecimal? | <p>How to convert octal numbers to hexadecimal and hexadecimal to octal in C language ?</p>
| <c><hex><octal> | 2019-06-12 20:23:38 | LQ_CLOSE |
56,570,962 | Creating a diagonal matrix? | I want to generate the matrix below by using a R statement.
1)
0 1 1
1 0 1
1 1 0
2)
0 2 3
0 5 0
7 0 0
3)
1 3 5 7
3 7 11 15
7 15 23 31
I need to write a function?diag function doesn;t help for the first question. | <r><matrix> | 2019-06-12 22:06:23 | LQ_EDIT |
56,571,016 | i'm trying to catch the number '1' before any '9781612680880' for example | [regex to catch the quantity number only ][1]
[1]: https://i.stack.imgur.com/oXfNe.png | <python><regex> | 2019-06-12 22:11:33 | LQ_EDIT |
56,571,349 | Custom back button for NavigationView's navigation bar in SwiftUI | <p>I want to add a custom navigation button that will look somewhat like this:</p>
<p><a href="https://i.stack.imgur.com/OFgvK.png" rel="noreferrer"><img src="https://i.stack.imgur.com/OFgvK.png" alt="desired navigation back button"></a></p>
<p>Now, I've written a custom <code>BackButton</code> view for this. When applying that view as leading navigation bar item, by doing: </p>
<pre><code>.navigationBarItems(leading: BackButton())
</code></pre>
<p>...the navigation view looks like this:</p>
<p><a href="https://i.stack.imgur.com/3YZD9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/3YZD9.png" alt="current navigation back button"></a></p>
<p>I've played around with modifiers like:</p>
<pre><code>.navigationBarItem(title: Text(""), titleDisplayMode: .automatic, hidesBackButton: true)
</code></pre>
<p>without any luck.</p>
<h2>Question</h2>
<p>How can I...</p>
<ol>
<li>set a view used as custom back button in the navigation bar? OR:</li>
<li>programmatically pop the view back to its parent?<br>
When going for this approach, I could hide the navigation bar altogether using <code>.navigationBarHidden(true)</code></li>
</ol>
| <swift><navigationview><swiftui> | 2019-06-12 22:58:38 | HQ |
56,571,857 | How return a value from an async/await function | <p>I am trying to write a reusable function that doesn't return until it has resolved promise from a mongodb query.
I can nearly achieve this using a IIFE function but seem unable to access the resolved value before I return from the function. In the snippet below i can print variable d to the console but i cant make it accessible outside the iffe and thus cannot return the result. </p>
<p>In the example below the first console.log returns the correct result but the second returns a pending promise.
Any suggestions as to how to make this work or alternative methods will be much appreciated.</p>
<pre><code>function getDNInfo (party){
var result;
result= (async () => { result = await mongo.findOne({DN:party.user_Number}, "BWUsers")
.then(
(d)=>{
console.log(d)
result=d;
}"
)}
)();
console.log(result)
return result;
}
</code></pre>
| <node.js><mongodb><async-await> | 2019-06-13 00:18:45 | LQ_CLOSE |
56,572,404 | How to create simple Venn Diagram | <p>I need to know how to create a simple Venn diagram in rstudio. I have the following data: A=25, B=19, A&B=7</p>
<p>I have no idea wear to start.</p>
| <r> | 2019-06-13 01:56:17 | LQ_CLOSE |
56,572,608 | List that shows the students that study more than two subjects (I need this query) | TABLES IN SQL SERVER
create table Estudiante
(
id int primary key not null,
nombre varchar(50)
)
insert into Estudiante (id, nombre)
values
('1','Maria'),
('2','Juan'),
('3','Yarlin'),
('4','Ana'),
('5','Marcos'),
('6','Juana'),
('7','Esther'),
('8','Luisa')
create table Materia
(
id int primary key not null,
nombre varchar(50),
estado varchar(10)
)
insert into Materia (id, nombre, estado)
values
('1','Filosofía','activo'),
('2','Bases de datos','activo'),
('3','Programación','activo'),
('4','Literatura','activo'),
('5','Teología','activo')
create table MateriaProfesor
(
id int primary key not null,
idMateria int foreign key references Materia,
idProfesor int foreign key references Profesor
)
insert into MateriaProfesor (id, idMateria, idProfesor)
values
('11','2','1'),
('12','1','2'),
('13','2','1'),
('14','3','4'),
('15','4','3'),
('16','5','2')
create table MateriaEstudiante
(
id int primary key not null,
idMateria int foreign key references Materia(id),
idEstudiate int foreign key references Estudiante(id),
Fecha date
)
insert into MateriaEstudiante (id, idMateria, idEstudiate, Fecha)
values
('20','4','3','10/11/2017'),
('21','5','2','10/11/2017'),
('22','3','8','10/11/2017'),
('23','5','4','11/11/2017'),
('24','1','5','11/11/2017'),
('25','1','3','11/11/2017') | <mysql><sql> | 2019-06-13 02:31:30 | LQ_EDIT |
56,573,258 | JavaScript:nodeJS: how to get result data from an async method inside a non-async method | i had read several posting,and even some guide in google and tried. however its not solving my problem.
please kindly help me get through this.
lets get into the code :
i would need to be able to print the result data in line 12 at least
but currently it return me null
and if possible, could i get my result in line 15?
var serialport = require('serialport');
var i=0;
processGpsData();
function processGpsData() {
getData().then(result => {
console.log("result: "+result); //<<<<line 12
});
// await getData(i);
console.log(result);// line 15
console.log("done");
process.exit();
}
async function getData(){
var port = new serialport("/dev/ttyACM0",{baudRate: 9600});
port.on('open', function () {
process.stdin.resume();
process.stdin.setEncoding('utf8');
});
port.on('error', function (err) {
console.error(err);
process.exit(1);
});
var test="";
var counter=0;
port.on("data",function(data){
counter++;
test +=data;
if(counter>30){
console.log("test1: "+test);
// return test; //need return this, but not working
port.close();
// resolve(test);
return test;
}
});
// return new Promise(resolve => port.on("close", resolve));
}
| <javascript><node.js><asynchronous> | 2019-06-13 04:09:00 | LQ_EDIT |
56,573,741 | What do I need to learn to code an app like Snapchat? | <p>I am new to programming and have been learning for the past month. I am trying to build an app that can record and upload short videos like Snaps to a database. Then the app can access these videos from the database. I am learning Java and Android Studio currently to make the Android version of the app, but later I want to learn the iOS side to make the iOS version of this app. </p>
<p>I would deeply appreciate some guidance on what exactly I need to learn to be able to make this app myself.</p>
| <android><ios> | 2019-06-13 05:15:20 | LQ_CLOSE |
56,576,155 | İ couldnt create function to count the number of occurence | i wont create function to count the number of occurence in an array.İ cant compile and run it.
Compiler gives the error:
The method occurence(int[]) in the type countOfOccurence is not applicable for the arguments (int)
public class countOfOccurence {
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] number = {15,16,14};
System.out.print(occurence(number[15]));
}
public static int occurence(int[] number) {
int count = 0;
for(int i = 0 ; i < number.length; i++) {
for(int k = 0 ; i < number.length; i++) {
if(number[k] == number[i]) {
count++;
}
}
}
return count;
}
} | <java><arrays> | 2019-06-13 08:13:23 | LQ_EDIT |
56,576,351 | one if statement returns none | one if statement should return a string, however it turns out none.
I have tried to set a String variable output to store the expected string in the if statement.
public static String starString(int n){
if(n<0){
String output = "";
return output = "IllegalArgumentException";
}else{
String stars = "";
for(int i = 0; i < Math.pow(2, n); i++){
stars += "*";
}
return stars;
}
}
I expect starString(-1)
exp. exception:IllegalArgumentException
the error message: none | <java> | 2019-06-13 08:25:35 | LQ_EDIT |
56,576,650 | what is TypeError: 'dict' object is not callable | I was working on web scraping but the code is showing error. help me out how i can solve this?
I have installed all required things related to this.
import request
from bs4 import BeautifulSoup
page = request.GET('https://en.wikipedia.org//wiki//Beautiful_Soup_(HTML_parser)')
soup = BeautifulSoup(page.content,'html.parser')
print(soup)
i expect the html codes of the website. but it is showing:-
page = request.GET('https://en.wikipedia.org//wiki//Beautiful_Soup_(HTML_parser)')
TypeError: 'dict' object is not callable | <python> | 2019-06-13 08:41:42 | LQ_EDIT |
56,578,160 | how to get which value has duplicate maximum times in php array | i have an array and i want to find out which value has duplicated maximum times in the array.Can you please help me to solve it?
Array ( [0] => 1 [1] => 2 [2] => 2 [3] => 1 [4] => 2 [5] => 2)
The output i want is 2 as it has duplicated 4 times | <php><arrays><sorting> | 2019-06-13 10:08:36 | LQ_EDIT |
56,581,254 | Moving people to voice channels (Discord.net) | I seam to have this weird error and I don't know how to fix it.
await userName.ModifyAsync(x =>
{
x.Channel = Program.client.GetChannel(588025239103995904) as IVoiceChannel;
});
Error: Cannot implicitly convert type 'Discord.IVoiceChannel' to 'Discord.Optional<Discord.IVoiceChannel>' | <c#><discord.net> | 2019-06-13 13:08:20 | LQ_EDIT |
56,582,083 | What will be output and explanation? | <p>Below code return boolean false value. Any explanation for this ?</p>
<pre><code>String str = "Bee";
String str2 = "Bee";
System.out.println("==" + str == str2);
</code></pre>
<p>Actual Result : false</p>
| <java> | 2019-06-13 13:53:54 | LQ_CLOSE |
56,583,624 | why i cant break nor exit a while loop | <p>for some reason when I type "exit" or "EXIT" the loop continues to iterate</p>
<p>I tried breaking using variables and the break statement</p>
<pre class="lang-py prettyprint-override"><code>obj = 1
while obj != None:
a = input("enter a number:\n")
b = input("enter a number:\n")
try:
int(a)
int(b)
print("succes!")
except ValueError:
print("you didnt enterd numbers")
continue
print("what do yo want to do?\n")
donxt = input("for exit the program type EXIT, to continue tap CONTINUE:\n")
if donxt == "continue" or "CONTINUE":
continue
elif donxt == "EXIT" or "exit":
obj = None
</code></pre>
| <python><python-3.x><while-loop> | 2019-06-13 15:14:06 | LQ_CLOSE |
56,583,650 | CNCopyCurrentNetworkInfo with iOS 13 | <p>Apple changed some things regarding WiFi with iOS 13. If you want to use CNCopyCurrentNetworkInfo your app needs to have one of the following</p>
<ul>
<li>Apps with permission to access location</li>
<li>Your app is the currently enabled VPN app</li>
<li>Your app configured the WiFi network the device is currently using via NEHotspotConfiguration</li>
</ul>
<p>Source: WWDC 19 session 713</p>
<p>I am configuring a network using NEHotspotConfiguration but I can not get the current SSID anymore after doing so. </p>
<p>The following code worked fine with iOS 12:</p>
<pre><code>/// retrieve the current SSID from a connected Wifi network
private func retrieveCurrentSSID() -> String? {
let interfaces = CNCopySupportedInterfaces() as? [String]
let interface = interfaces?
.compactMap { [weak self] in self?.retrieveInterfaceInfo(from: $0) }
.first
return interface
}
/// Retrieve information about a specific network interface
private func retrieveInterfaceInfo(from interface: String) -> String? {
guard let interfaceInfo = CNCopyCurrentNetworkInfo(interface as CFString) as? [String: AnyObject],
let ssid = interfaceInfo[kCNNetworkInfoKeySSID as String] as? String
else {
return nil
}
return ssid
}
</code></pre>
<p>With iOS 13 <code>CNCopyCurrentNetworkInfo</code> always returns nil.</p>
<p>My app has the Access WiFi Information Capability set.</p>
<p>Thanks for your help!</p>
| <ios><swift><captivenetwork><ios13><nehotspothelper> | 2019-06-13 15:15:39 | HQ |
56,583,922 | Insert backspace in regex in some javascript string | I have a string in javascript and at some places corresponding to a regex (lower case followed by upper case), I would like to insert between upper and lower case the backspace character | <javascript><node.js><regex><backspace> | 2019-06-13 15:29:51 | LQ_EDIT |
56,586,650 | Google Sheets: How to combine cells into two columns to show all links between the elements in the same row? | I'm working on a Gephi project where I need to define links between people (who worked with who).
I have a Google Sheet document with names in each row.
Ex:
John | Mary | Brian | Dave
Emily | David | Sara
I'm looking for a function that could display me then who worked with who in two columns. This way:
John | Mary
John | Brian
John | Dave
Mary | Brian
Mary | Dave
Brian | Dave
Emily | David
Emily | Sara
David | Sara
If you think Google Sheets ain't the thing and it's possible to do it on Excel, you can send me a suggestion too :-)
Thanks in advance (and I hope I made myself clear) | <google-sheets><array-formulas> | 2019-06-13 18:32:13 | LQ_EDIT |
56,589,706 | ¿How to declare and initialize multiple variables (with different names) within a for loop? (WITHOUT using arrays)) | I'm trying to perform the job that an array is supposed to do, but without actually using one. I was wondering if this was possible, and if it is, how?
I have to initialize different variables, for example:
int value1 = 0;
int value2 = 0;
int value3 = 0;
int valueN = 0;
I want to receive a value from the user that determinate what is the for loop going to last.
Example: User --> 4
Then I can declare 4 variables and work with them.
for(i = 1; i <= 4; i++){
Console.Write("Insert a number: ");
int value(i) = int.Parse(Console.ReadLine());
}
I expect to have 4 variables called equally, but with the only one difference that each one has a different number added at the end of the name.
//value1 = 0;
//value2 = 0;
//value3 = 0;
//valuen = 0; | <c#><console-application> | 2019-06-13 23:28:44 | LQ_EDIT |
56,591,248 | databricks scala: how to substring a variable string | suppose I have a variable
var variable="[123]"
how to substring only get
123 without the []
Thanks, in scala language | <scala> | 2019-06-14 04:05:31 | LQ_EDIT |
56,591,466 | I GOT ERROR "missing ) after argument list" | got error "missing ) after the argument list"
$('.next-btn').append("<a class="actionsubmit" ng-click="onSubmit('hello.html')">Check</a>"); | <javascript><jquery><jquery-ui> | 2019-06-14 04:40:56 | LQ_EDIT |
56,591,535 | Extract specific string from URL | <p>I want to extract some string from this url </p>
<p><a href="https://s3-ap-southeast-1.amazonaws.com/mtpdm/2019-06-14/12-14/1001_1203_20190614120605_5dd404.jpg" rel="nofollow noreferrer">https://s3-ap-southeast-1.amazonaws.com/mtpdm/2019-06-14/12-14/1001_1203_20190614120605_5dd404.jpg</a></p>
<p>I want to extract the 2019-06-14, how do I do that using java?</p>
| <java><string><url><text-extraction> | 2019-06-14 04:50:23 | LQ_CLOSE |
56,592,062 | I am not able to access this filename [{"filename":"54526108_1946746692102415_4003062236024143872_n.jpg"}] | <p>I have tried console.log(filename.filename); but it is not working.</p>
<p>[{"filename":"54526108_1946746692102415_4003062236024143872_n.jpg"}]</p>
| <node.js> | 2019-06-14 05:45:33 | LQ_CLOSE |
56,592,095 | responsive image and four buttons | I would like to make my footer exactly as same as the picture I've attached below :
https://imgur.com/a/eXlKgHq
I want to add 1 image and 4 buttons.
They must be in the same position as shown in the picture and everything must be responsive.
thank you in advance
Lorem ipsum dolor sit amet, admodum pertinax intellegebat duo id, et ludus utamur contentiones sit. No vix quod luptatum, dicat eleifend ad per, ei nostro vulputate vel. Per solum ceteros in. Ad mei mucius recteque definiebas. Te wisi verterem mei, solet sapientem consequat ius id.
Vel abhorreant voluptatum ad. Eros autem feugiat has ad. Ius mucius democritum ex. Tota feugait at duo, ius nominavi quaerendum delicatissimi eu, has ex congue timeam aperiam. Ea intellegat deterruisset quo, pri ut tollit labore facete, sea enim debet argumentum ei.
| <html><css> | 2019-06-14 05:49:16 | LQ_EDIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.