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,309,803
How do I remove 'None' items from the end of a list in Python
<p>A have a list that might contain items that are None. I would like to remove these items, but only if they appear at the end of the list, so:</p> <pre class="lang-py prettyprint-override"><code>[None, "Hello", None, "World", None, None] # Would become: [None, "Hello", None, "World"] </code></pre> <p>I have written a function, but I'm not sure this is the right way to go about it in python?:</p> <pre class="lang-py prettyprint-override"><code>def shrink(lst): # Start from the end of the list. i = len(lst) -1 while i &gt;= 0: if lst[i] is None: # Remove the item if it is None. lst.pop(i) else: # We want to preserve 'None' items in the middle of the list, so stop as soon as we hit something not None. break # Move through the list backwards. i -= 1 </code></pre> <p>Also a list comprehension as an alternative, but this seems inefficient and no more readable?:</p> <pre class="lang-py prettyprint-override"><code>myList = [x for index, x in enumerate(myList) if x is not None or myList[index +1:] != [None] * (len(myList[index +1:]))] </code></pre> <p>What it the pythonic way to remove items that are 'None' from the end of a list?</p>
<python><list>
2019-10-09 17:59:59
HQ
58,310,027
Using indexOf() in Switch Statement
<p>Need to set variable values using a Switch Statement based on a string being present in the URL. I've accomplished this by using if/then statements but I now need a "default" for var3. It would be cumbersome to write a final if/then statement that basically says that the final condition is met when none of the other strings are found in dom.url. </p> <p>Preferably, I'd want something like this: </p> <pre><code>if b.event_name ==="form_completion" { switch(b['dom.url'].indexOf(MYSTRING)) { case "Req-Quote-Thanks-Modal") &gt; -1: b.var1 = "VAL1"; b.var2 = "VAL2"; b.var3 = "VAL3"; break; deafult: b.var1 = "VAL1-Default"; b.var2 = "VAL2-Default"; b.var3 = "VAL3-Default"; } } </code></pre> <p>I've tired a series of if/then statements and case statements with if/then statements</p> <pre><code>if (b.event_name === "form_completion" &amp;&amp; b['dom.url'].indexOf("Req-Quote-Thanks-Modal") &gt; -1) { b.var1 = "VAL1"; b.var2 = "VAL2"; b.var3 = "VAL3"; } else if (b.event_name === "form_completion" &amp;&amp; b['dom.pathname'].indexOf("sweeps-thank-you") &gt;-1) { b.var1 = "VAL1"; b.var2 = "VAL2"; b.var3 = "VAL4"; } else if (b.event_name === "form_completion" &amp;&amp; b['dom.pathname'].indexOf("special-offers-thank-you") &gt;-1) { b.var1 = "VAL1"; b.var2 = "VAL2"; b.var3 = "VAL5"; } else if (b.event_name === "form_completion" &amp;&amp; b['dom.pathname'].indexOf("brochure") &gt;-1 &amp;&amp; b['dom.pathname'].indexOf("thank-you") &gt;-1) { b.var1 = "VAL1"; b.var2 = "VAL2"; b.var3 = "VAL6"; } </code></pre>
<javascript>
2019-10-09 18:16:19
LQ_CLOSE
58,310,830
Finding all words with lenght 0 - 4 for a regular expression (method?)
my task is to do the following: I have an alphabet consisting of 0 and 1 and a regular expression, for example: 1*(011+)*1*. Now I shall find all words of the language that have the length 0 - 4 and fit the regular expression. So the output would be: "","1","11","011","111" ... etc. I should not give a list of words or numbers as a parameter, but the method should generate all these words by itself. Is there a function or method in the re. module which does exactly that?
<python><regex><word><generate>
2019-10-09 19:15:19
LQ_EDIT
58,310,875
Should I use Bootstrap or Media queries for web page responsiveness?
<p>I am currently finishing up a project for my portfolio and I am wondering if I should use Bootstrap or media queries to make my webpage responsive. Do jobs prefer one over the other or does it not matter?</p>
<html><css>
2019-10-09 19:18:16
LQ_CLOSE
58,311,022
Autofocus TextField programmatically in SwiftUI
<p>I'm using a modal to add names to a list. When the modal is shown, I want to focus the TextField automatically, like this:</p> <p><a href="https://i.stack.imgur.com/gkmeA.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/gkmeA.gif" alt="Preview"></a></p> <p>I've not found any suitable solutions yet.</p> <p>Is there anything implemented into SwiftUI already in order to do this?</p> <p>Thanks for your help.</p> <pre><code>var modal: some View { NavigationView{ VStack{ HStack{ Spacer() TextField("Name", text: $inputText) // autofocus this! .textFieldStyle(DefaultTextFieldStyle()) .padding() .font(.system(size: 25)) // something like .focus() ?? Spacer() } Button(action: { if self.inputText != ""{ self.players.append(Player(name: self.inputText)) self.inputText = "" self.isModal = false } }, label: { HStack{ Text("Add \(inputText)") Image(systemName: "plus") } .font(.system(size: 20)) }) .padding() .foregroundColor(.white) .background(Color.blue) .cornerRadius(10) Spacer() } .navigationBarTitle("New Player") .navigationBarItems(trailing: Button(action: {self.isModal=false}, label: {Text("Cancel").font(.system(size: 20))})) .padding() } } </code></pre>
<swift><xcode><modal-dialog><textfield><swiftui>
2019-10-09 19:29:02
HQ
58,311,303
Counting TCP retransmission in pyshark
<p>As far as I know pyshark is a Python wrapper to tshark which is the command line version of Wireshark. Since Wireshark and tshark allow to detect TCP retransmission, I was wondering how I could to that using pyshark. I haven't find any good documentation so I am not sure whether you can't just do that, or whether I just can't find the proper way. Thank you!</p>
<python><tcp><tshark><pyshark>
2019-10-09 19:48:32
HQ
58,311,313
unable to match regex pattern in python
<p>I am trying to match a regex from an email. If the e-mail says "need update on SRT1000" the regex needs to match. I have my code as below, but it is not working. Can someone look at this and let me know what is wrong here?</p> <pre><code>def status_update_regex(email): email = email.lower() need_sr_update_regex = re.compile('(looking|want|need|seek|seeking|request|requesting)([^/./!/?/,/"]{0,10})(status|update)(^.{0,6})(^srt[0-9]{4})') if need_sr_update_regex.search(email) != None: return 1 else: return 0 </code></pre>
<python><regex>
2019-10-09 19:49:27
LQ_CLOSE
58,311,442
Type 'Element[]' is missing the following properties from type 'Element': type, props, key
<p>I have the standard arrow map ES7 function with Typescript and React environment:</p> <pre><code> const getItemList: Function = (groups: any[]): JSX.Element =&gt; group.map((item: any, i: number) =&gt; { const itemCardElemProps = { handleEvents: () =&gt; {}, ...item} return &lt;Item key={`${item.id}_${i}`} {...itemCardElemProps} /&gt; }) </code></pre> <p>and get the error:</p> <pre><code>TS2739: Type 'Element[]' is missing the following properties from type 'Element': type, props, key </code></pre> <p>Version: typescript 3.5.3</p>
<reactjs><typescript>
2019-10-09 19:58:53
HQ
58,311,868
Python prints my class object memory address instead of values of my array
<p>I want to print each element registered in my "student_list" array. But Python prints the memory location of each of my values. I am totally new to OOP using python. Any help or comments are highly appreciated.</p> <pre><code>class Student(): def __init__(self, name, grade_level, subject, grade): self.name = name self.grade_level = grade_level self.subject = subject self.grade = grade @classmethod def student_input(cls): return cls( input("Name: "), input("Garde Level: "), input("Subject: "), int(input("Grade: ")), ) def student_info(self): print("************************") print("Name: " + self.name+"\n"+"Grade Level: "+self.grade_level + "\n"+"Subject: "+self.subject + "\n"+"Grade: "+str(self.grade)) print("************************") student_list = [] print("**********************") user1 = Student.student_input() student_list.append(user1) print("**********************") user2 = Student.student_input() student_list.append(user2) print("**********************") print(user1.student_info) for student in student_list: print(student) </code></pre> <h2>Output:</h2> <pre><code>PS C:\Users\D3L10\Documents\PythonML\iPythonProj&gt; python .\schoolSystem.py ********************** Name: Andy Garde Level: Freshman Subject: Physics Grade: 92 ********************** Name: James Garde Level: Sophmore Subject: Algebra Grade: 82 ********************** &lt;bound method Student.student_info of &lt;__main__.Student object at 0x00580610&gt;&gt; &lt;__main__.Student object at 0x00580610&gt; &lt;__main__.Student object at 0x00819DB0&gt; </code></pre>
<python><oop>
2019-10-09 20:32:17
LQ_CLOSE
58,312,186
Sed awk text formating
I would like to filter and order text files with soemthing like awk or sed. It does not need to be a single command, a small bash script should be fine too. # home=address01 name=name01 info=info01 number=number01 company=company01 # name=name02 company=company02 info=info02 home=home02 # company=company03 home=address03 name=name03 info=info03 info=info032 number=number03 company=company032 # .... I only need name, number, and info. There is always exactly one name, but there can be 0,1 or 2 number and info. The # is the only thing which is consistent and always on the same spot. output should be: name01, number01, , info01, name02, , ,info02, name03,number03, , info03, info032 Thanks for your help!
<bash><awk><sed>
2019-10-09 20:57:43
LQ_EDIT
58,312,479
Is accessing async .Result considered as bad practice?
<p>If I have following</p> <pre><code> public async Task&lt;Owner&gt; Get(int carId) { var car = await myDbContext.Cars.FindAsync(carId); return car.Owner; } </code></pre> <p>I cannot access the Owner property in the first line cause it's a async call.</p> <p>If I access it using await <code>myDbContext.Cars.FindAsync(carId).Result.Owner</code> does that mean that I'll get stuck in a deadlock sometime or does it have some other side effects?</p>
<c#><.net><asynchronous>
2019-10-09 21:21:16
LQ_CLOSE
58,313,513
cleanly kill all vim process from other tabs
I am using following linux command to kill all vim process, ``ps -ef | grep "gvim" | grep -v grep | awk '{print $2}' | xargs kill`` Above command is working except it output messages ``Vim: Caught deadly signal TERM`` Is there other clean way to kill it ? Thanks
<linux><vim>
2019-10-09 23:31:37
LQ_EDIT
58,313,527
Python won't recognize object parameter
<pre><code> def function(objectA_list): for objectA in objectA_list: str = objectA.attr1 </code></pre> <p>objectA.attr1 is not recognized. objectA is an instance of a class in another file that I have imported. How do I "cast" objectA variable as an objectA so I could use access the underlying attribute?</p>
<python><python-3.x>
2019-10-09 23:34:10
LQ_CLOSE
58,314,757
Is there a way to check if any 4 strings out of 5 strings are equal?
I have 5 strings. 4 are the same, lets say they're all 'K' and one is different, 'J'. Is there a way to compare all of them and check if at least 4 out of the 5 are equal. ``` rc1 = 'K' rc2 = 'J' rc3 = 'K' rc4 = 'K' rc5 = 'K' if four are the same from rc1, rc2, rc3, rc4 or rc5: print error ```
<python><python-3.x>
2019-10-10 02:49:53
LQ_EDIT
58,314,955
Convert String to Type unknown at compile time C#
Given a string and a type of number, I would like to check if the string can be converted to that type and would like the string to be converted to that type if possible. Bellow is the sudo code for what I am trying to do: public bool DataIsValid(string s, Type someNumType) { d = 0; // a class member variable if (s.CanBeConvertedTo(someNumType)) { d = (double)s; return true; } else { return false; } I'm always trying to convert a string to some type of number but I don't know what type. I've tried using a try/catch block with d = (double)Convert.ChangeType(s, someNumType); but this only works for doubles and not integers. Thanks in advance.
<c#><string><type-conversion>
2019-10-10 03:17:43
LQ_EDIT
58,316,006
What is purpose for docker hub
I can't imagine why do i need docker hub As i know, we can't push on docker hub with docker-compose It is just a hub which contains image only. We can push our repository to github so that someone who want to execute our source can pull it from github. Then, they can run command like `docker-compose up`. I think this is all we need with github or bitbucket, not docker hub Is there something more feature i can use or i have to consider with docker hub?
<docker><docker-compose><dockerhub>
2019-10-10 05:29:49
LQ_EDIT
58,316,191
Google Play Store Security Alert Says that your app contains Vulnerable JavaScript libraries how to remove the security warning?
<p>In Google Play Store am getting warning below like this,</p> <p>Your app contains one or more libraries with known security issues. Please see this <a href="https://support.google.com/faqs/answer/9464300" rel="noreferrer">Google Help Center article</a> for details.</p> <p>Vulnerable JavaScript libraries:</p> <ul> <li>Name --> jquery</li> <li>Version --> 3.3.1</li> <li>Known issues --> SNYK-JS-JQUERY-174006</li> <li>Identified files --> res/raw/jquery_min.js</li> </ul> <p>Note: when loading webview in my app i will InterceptRequest in webview url and load the local jquery_min.js file from raw folder resource which helps us to load the webpage faster due this function and i save 5 gb download from server per month.</p> <p><a href="https://i.stack.imgur.com/Gl0pA.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Gl0pA.png" alt="enter image description here"></a></p> <p>Sample WebView Program</p> <pre><code> LoadLocalScripts localScripts=new LoadLocalScripts(this); webView.setWebViewClient(new WebViewClient() { public boolean shouldOverrideUrlLoading(WebView view, String url) { return true; } //Show loader on url load public void onLoadResource(WebView view, String url) { } public void onPageFinished(WebView view, String url) { } @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { } @Override public WebResourceResponse shouldInterceptRequest (final WebView view, String url) { WebResourceResponse response= localScripts.getLocalSCripts(url); if(response==null) { return super.shouldInterceptRequest(view, url); }else{ return response; } } }); webView.loadUrl(url); </code></pre> <p>Class for Loading local scripts</p> <pre><code> public class LoadLocalScripts { private Context ctx; public LoadLocalScripts(Context context) { ctx=context; } public WebResourceResponse getLocalSCripts(String url) { //Log.e("url_raw",url); if (url.contains(".css")) { if(url.contains("bootstrap.min.css")) { return getCssWebResourceResponseFromRawResource("bootstrap_min.css"); }else { return null; } }else if (url.contains(".js")){ if(url.contains("bootstrap.min.js")) { return getScriptWebResourceResponseFromRawResource("bootstrap_min.js"); } else if(url.contains("jquery.lazyload.min.js")) { return getScriptWebResourceResponseFromRawResource("lazyload_min.js"); } else{ return null; } } else { return null; } } /** * Return WebResourceResponse with CSS markup from a raw resource (e.g. "raw/style.css"). */ private WebResourceResponse getCssWebResourceResponseFromRawResource(String url) { //Log.e("url_raw",url); if(url.equalsIgnoreCase("bootstrap_min.css")) { return getUtf8EncodedCssWebResourceResponse(ctx.getResources().openRawResource(R.raw.bootstrap_min)); }else { return null; } } private WebResourceResponse getScriptWebResourceResponseFromRawResource(String url) { //Log.e("url_raw",url); if(url.equalsIgnoreCase("bootstrap_min.js")) { return getUtf8EncodedScriptWebResourceResponse(ctx.getResources().openRawResource(R.raw.bootstrap_min_js)); }else if(url.equalsIgnoreCase("lazyload_min.js")) { return getUtf8EncodedScriptWebResourceResponse(ctx.getResources().openRawResource(R.raw.lazyload_min)); }else { return null; } } private WebResourceResponse getUtf8EncodedCssWebResourceResponse(InputStream data) { return new WebResourceResponse("text/css", "UTF-8", data); } private WebResourceResponse getUtf8EncodedScriptWebResourceResponse(InputStream data) { return new WebResourceResponse("text/javascript", "UTF-8", data); } } </code></pre> <ol> <li>If i update new to Jquery script will google play remove Security Alert (Vulnerable JavaScript libraries)?</li> <li>If i place Jquery script somewhere else in my app will google play remove Security Alert?</li> <li>Let me know what is the efficient way of loading the script in webview without loading everytime from the server.</li> </ol>
<javascript><android><webview><google-play><google-play-console>
2019-10-10 05:48:15
HQ
58,318,336
Java: validate a text
I'm using OCR to recognize (german) text in an image. It works good but not perfect. Sometimes a word gets messed up. Therefore I want to implement some sort of validation. Of course I can just use a wordlist and find words that are similar to the messed up word, but is there a way to check if the sentence is plausible with these words? After all my smartphone can give me good suggestions on how to complete a sentence
<java><nlp>
2019-10-10 08:15:44
LQ_EDIT
58,319,009
Incorrect syntax near COUNT(*)
<pre><code>SELECT D.Drank_Naam , D.Drank_Prijs, SUM(K.Aantal) AS Aantal COUNT(*) AS StudentDeelnemer, + FROM Kassa K, + JOIN DrankVoorraad AS D ON K.Drink_ID = D.ID, + JOIN StudentDeelnemer AS S on K.Student_Id = S.StudentNummer, + group by D.Drank_Naam, D.Drank_Prijs; </code></pre> <p>I want to calculate the sum of drinks sold and the price, but i get an incorrect syntax near COUNT(*)</p>
<mysql><sql><join><count><sum>
2019-10-10 08:54:23
LQ_CLOSE
58,320,316
std::bit_cast with std::array
<p>In his recent talk <a href="https://www.youtube.com/watch?v=_qzMpk-22cc" rel="noreferrer">“Type punning in modern C++”</a> Timur Doumler <a href="https://youtu.be/_qzMpk-22cc?t=2755" rel="noreferrer">said</a> that <code>std::bit_cast</code> cannot be used to bit cast a <code>float</code> into an <code>unsigned char[4]</code> because C-style arrays cannot be returned from a function. We should either use <code>std::memcpy</code> or wait until C++23 (or later) when something like <code>reinterpret_cast&lt;unsigned char*&gt;(&amp;f)[i]</code> will become well defined.</p> <p>In C++20, can we use an <code>std::array</code> with <code>std::bit_cast</code>,</p> <pre><code>float f = /* some value */; auto bits = std::bit_cast&lt;std::array&lt;unsigned char, sizeof(float)&gt;&gt;(f); </code></pre> <p>instead of a C-style array to get bytes of a <code>float</code>?</p>
<c++><c++20><type-punning>
2019-10-10 09:59:40
HQ
58,320,487
Using FragmentContainerView with Navigation component?
<p>After updating to Navigation <a href="https://developer.android.com/jetpack/androidx/releases/navigation#2.2.0-beta01" rel="noreferrer">2.2.0-beta01</a> from the previous version, lint gives a warning about replacing the <code>&lt;fragment&gt;</code> tag with <code>FragmentContainerView</code>.</p> <p>However, replacing the tag alone seems to prevent the navigation graph from being inflated.</p> <p>According to <a href="https://developer.android.com/jetpack/androidx/releases/navigation#2.2.0-alpha01" rel="noreferrer">2.2.0-alpha01</a>, <code>FragmentContainerView</code> is used internally. Should we ignore the lint warning?</p> <hr> <p><strong>activity_main.xml</strong></p> <pre><code>&lt;androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;!-- Lint warning: "Replace the &lt;fragment&gt; tag with FragmentContainerView. --&gt; &lt;fragment android:id="@+id/nav_host_main" android:name="androidx.navigation.fragment.NavHostFragment" android:layout_width="match_parent" android:layout_height="match_parent" app:defaultNavHost="true" app:navGraph="@navigation/nav_graph_main"/&gt; &lt;!-- other elements --&gt; &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt; </code></pre>
<android><android-layout>
2019-10-10 10:09:13
HQ
58,321,341
I am very new to Python, and unable to print any thing when i use a class. however i use a normal code without class it works
for the simplest code class Dog(): def __init__(self, color, height, breed): self.color = color self.height = height self.breed = breed my_dog = Kolin(color='brown', height='1 feet', breed='german shephered') print(type(my_dog)) print(my_dog.color) Process finished with exit code 0 and nothing is printed Note: it is on selenium python setup
<python><oop>
2019-10-10 10:58:33
LQ_EDIT
58,321,481
Which ML model would be best suited for time series activity log data to predict customer retention?
<p>I have customer activity data like the number of logins, time spent on the site, devices registered and policies changed. The data is structured on a day-day basis. i.e activity for a customer on a particular day. The ML model should be able to predict based on this activity whether the customer will be retained or not. Ideally, the model should output a bool value or the % of chances of retention.</p> <p>Which ML models should I look into? Any suggestions would be appreciated.</p>
<python><machine-learning><data-science>
2019-10-10 11:06:56
LQ_CLOSE
58,322,476
Invoke function on each element of collection
<p>We have a list of cars - <code>List&lt;Car&gt;</code></p> <pre><code>Car{ String name; String year; String getName(){ return name;} String getYear(){ return year;} ... ...... } </code></pre> <p>For each car in the list,we would need to call function isVintage(String carName,.....).<br> All cars which return true for the above check need to be collected into a list.<br> Is this possible using Streams?</p>
<java><java-8><java-stream>
2019-10-10 12:02:23
LQ_CLOSE
58,323,004
Convert python regex pattern to lua
<p>I have a pattern but I don't know how to convert to Lua pattern here is my pattern:</p> <pre><code>(?P&lt;Protocol&gt;https?:\/\/)?(?P&lt;Subdomain&gt;\w*\.)?(?P&lt;Domain&gt;(?:[a-z0-9\-]{1,})\.(?:[^\s\/\.]{2,}))(?P&lt;Path&gt;\/proxy)?(?P&lt;Params&gt;(?:\?|\#)[^\s\/\?\:]*) </code></pre> <p>anyone can help me to convert or convert it for me?</p>
<python><regex><lua>
2019-10-10 12:34:13
LQ_CLOSE
58,323,534
ModuleNotFoundError: No module named '_curses'
From where i can remove these error im using pycharm on windows Traceback (most recent call last): File "C:/Users/Charan/PycharmProjects/helloworld/snake.py", line 2, in <module> import curses File "C:\Users\Charan\AppData\Local\Programs\Python\Python37-32\lib\curses\__init__.py", line 13, in <module> from _curses import * ModuleNotFoundError: No module named '_curses'
<pycharm>
2019-10-10 13:01:43
LQ_EDIT
58,325,293
How to get a value array from an object array
<p>How can I access all values with the same key in an object array? Given the following data:</p> <pre><code>data = [{first_name: 'Peter', last_name: 'Smith', age: 45}, {first_name: 'John', last_name: 'Miller', age: 21}]; </code></pre> <p>Is there a easy way to get an array containing all first names, like <code>first_names = ['Peter', 'John']</code>?</p> <p>I guess I'm asking a very frequently asked question, but I couldn't find a solution anywhere to answer it.</p>
<javascript><arrays><javascript-objects>
2019-10-10 14:29:03
LQ_CLOSE
58,325,753
Why am i getting the wrong output? (Python random number generator calculator)
<p>This program is suppose to generate two random numbers and have the user input the result. If the user input is correct, then the program will print 'You are correct!' If wrong, the program will print 'You are wrong!' However, when the user's answer is correct, the program still outputs "You are wrong!' Not sure why</p> <pre><code> import random first = random.randint(0,9) second = random.randint(0,9) result = first + second answer = input(str(first) + ' + ' + str(second) + ': ') if result == answer: print('You are correct!') else: print('Sorry you are wrong!') </code></pre>
<python><calculator>
2019-10-10 14:53:37
LQ_CLOSE
58,326,195
Why can't I edit the style property with javascript?
So, I was just trying to make a <div> appear on an onkeyup event with javascript and for some reason, it didn't let me do it and I got the error: **Uncaught TypeError: Cannot read property 'style' of null** This is my code: HTML: ``` <div class="content" id="content" style="display: none"> ``` Javascript: ``` function showContent() { document.getElementById('content').style.display = 'block'; } ``` Can you please help? Thanks.
<javascript><html><css><tags><frontend>
2019-10-10 15:16:24
LQ_EDIT
58,327,585
Is this C# syntax correct?
Learning C#, found below code snippet. What does below line means, which has the same name as a class? [see attached][1] `public Item Parent;` ``` class Item { public string Name; public Item Parent; } ``` [1]: https://i.stack.imgur.com/cwFKG.png
<c#>
2019-10-10 16:45:21
LQ_EDIT
58,327,962
String Operation - Get Data into table formate
string = {"Id":"048f7de7-81a4-464d-bd6d-df3be3b1e7e8","RecordType":20,"CreationTime":"2019-10-08T12:12:32","Operation":"SetScheduledRefresh","OrganizationId":"39b03722-b836-496a-85ec-850f0957ca6b","UserType":0,"UserAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/76.0.3809.132 Safari\/537.36","ItemName":"ASO Daily Statistics","Schedules":{"RefreshFrequency":"Daily","TimeZone":"E. South America Standard Time","Days":["All"],"Time":["07:30:00","10:30:00","13:30:00","16:30:00","19:30:00","22:30:00"]},"IsSuccess":true,"ActivityId":"4e8b4514-24be-4ba5-a7d3-a69e8cb8229e"} output = ------------------------------------------------------------------ ID | RecordType | CreationTime 048f7de7-81a4-464d-bd6d-df3be3b1e7e8 | 20 | 2019-10-08T12:12:32 An so on..
<python><r><json><pandas>
2019-10-10 17:11:38
LQ_EDIT
58,328,380
How to pass a PHP variable to ajax jquery
<p>I want to pass a PHP variable to Jquery AJAX. How can I achieve this? I tried the below script.</p> <pre><code>$query_sess="select id from users where username='".$_SESSION['username']."'"; $result_sess = mysqli_query($con,$query_sess) or die('error'); $row_sess= mysqli_fetch_assoc($result_sess); $userID = $row_sess['id']; </code></pre> <p>I need to pass this $userID to the ajax. My ajax script is as follows:</p> <pre><code>$(document).ready(function(){ function load_unseen_notification(view = '') { $.ajax({ url:"fetch_notification.php", method:"POST", data:{view:view, userID: &lt;?php echo $userID; ?&gt;}, dataType:"json", success:function(data) { $('.dropdown-menunot').html(data.notification); if(data.unseen_notification &gt; 0) { $('.count').html(data.unseen_notification); } } }); } </code></pre>
<php><ajax>
2019-10-10 17:38:24
LQ_CLOSE
58,328,543
{{route()}} no funcina dentro de ajax
Within a view of Laravel I generate a report and charge it using ajax. In the report I have three buttons, one of them is "Add". Clicking on the "add" button does not redirect me to the route (viewAlarmasConfDestinatarios), in which I should show another form with fields that I must complete. {{route ()}} does not work within ajax ajax: function fetch_data() { var trHTML =''; $.ajax({ url: 'reporteAlarmasConfiguracion/', type: "GET", data : {"_token":"{{ csrf_token() }}"}, dataType: "json", success:function(data) { if(data) { console.log('ENTRE AL FETCH_DATA'); $('#locationA > tbody').empty(); $.each(data, function(key, value) { var product_id = value.pais +'-'+ value.servicio +'-'+ value.denominacion; var url = '{{ route("viewAlarmasConfDestinatarios.index", ":id") }}'; url = url.replace(':id',product_id); console.log(url); if($.trim(value.vigente) == '1') { console.log('ACTIVO'); value.vigente='<button type="button" class="btn btn-success btn-xs" id="'+ value.pais +'-'+ value.servicio +'-'+ value.denominacion+'">Activa</button>' ; } if($.trim(value.vigente) == '0') { value.vigente='<button type="button" class="btn btn-xs" id="'+ value.pais +'-'+ value.servicio +'-'+ value.denominacion+'"> Desactivada</button>' ; } if($.trim(value.pais) == '1') { value.pais='AR'; } if($.trim(value.pais) == '2') { value.pais='UY'; } if($.trim(value.pais) == '3') { value.pais='PY'; } var data = { "_token": $('#token').val() }; var urlparm=value.pais +'-'+ value.servicio +'-'+ value.denominacion; console.log(urlparm); trHTML += '<tr id="fila"><td>' + value.pais + '</td><td>' + value.servicio + '</td><td>' + value.denominacion + '</td><td>' + value.descripcion + '</td><td>' + value.vigente + '</td><td>' + '<button type="button" class="btn btn-danger btn-xs delete" id="'+ value.pais +'-'+ value.servicio +'-'+ value.denominacion+'"> Eliminar</button>&nbsp' + '<button type="button" class="btn btn-warning btn-xs" id="'+ value.pais +'-'+ value.servicio +'-'+ value.denominacion+'"> Modificar</button>' + '</td><td>' + '<button type="button" class="btn btn-info btn-xs info"" id="'+ value.pais +'-'+ value.servicio +'-'+ value.denominacion+'" onclick="'+url+'">Cargar</button>' + '</td></tr>'; }); $('#locationA').append(trHTML); } } }); } route:Route::get('/AlarmaConfDestinatarios/{denominacion?}', 'alarmasController@viewAlarmasConfDestinatarios')->name('viewAlarmasConfDestinatarios.index');[enter image description here][1] [1]: https://i.stack.imgur.com/jf5Ii.png
<ajax><laravel>
2019-10-10 17:51:39
LQ_EDIT
58,328,733
Desactivate passive mode for specific contents
I'm using https://github.com/mervick/emojionearea with https://github.com/zzarcon/default-passive-events/ plug-in but the default-passive-events plug-in seem not to be compatible with https://github.com/mervick/emojionearea. **EmojioneArea uses mousedown event and it require to use event.preventDefault() in not passive mode.** I would like to know if it was possible to desactivate passive mode for specific contents or specific elements ? I would like to desactivate passive mode for ".emojionearea-editor" and EmojioneArea emojis. Thanks.
<mysql><sql>
2019-10-10 18:05:11
LQ_EDIT
58,331,032
Numbers OCR (Optical Recognition) in javascript
<p>I am looking for Javascript API for OCR or Machine Learning example (Tensorflow.js or any other) which can recognize numbers from the picture. I tried tesseract.js and OCRAD.js, but both do not work well with this kind of image. I only need numbers from this picture like 2.243 and 0048. I also put to tesseract.js settings, that it is numbers only, but it did not help much.</p> <p>The picture is a photo of the digital device, which does not have API to connect and get data digitally. I would like to use webcam and javascript OCR and get these numbers periodically from this device to the list and build the graphs later.</p> <p>I found a lot of examples for Tensorflow recognition of handwritten digits, but all of them can recognize only one digit, they cannot recognize a number consisting of more than 1 digits.</p> <p>P.S. I do not want to spend a lot of time, actually I do not have this time :). Just want to reuse ready example.</p> <p><a href="https://i.stack.imgur.com/wIkjK.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wIkjK.jpg" alt="enter image description here"></a></p>
<javascript><machine-learning><computer-vision><ocr><tensorflow.js>
2019-10-10 21:00:31
LQ_CLOSE
58,332,525
Where to find git release notes?
<p>I'm having trouble finding what's new in the latest release of git. For example, I could not find any info on git's main github <a href="https://github.com/git/git" rel="nofollow noreferrer">page</a>.</p> <p>Where can one find git's release notes (ideally for all releases, but at least the latest one)?</p>
<git>
2019-10-10 23:57:04
LQ_CLOSE
58,334,039
How to convert an Array to Array of Object in Javascript
<p>I want to convert an Array like:</p> <pre><code>[ 'John', 'Jane' ] </code></pre> <p>into an array of object pairs like this:</p> <pre><code> [{'name': 'John'}, {'name':'Jane'}] </code></pre> <p>Please help me to do so..</p>
<javascript><arrays>
2019-10-11 03:58:07
LQ_CLOSE
58,335,627
(JAVA) I need to validate that an index is valid of a user entered string
When a user enters a word they then are prompt to enter the first and second index of a substring. I have that much sorted but when I try to validate that the index entered with my if statements below I am getting errors regarding those if statements , any help is greatly appreciated Here is my code... import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String inputString; int startIndex; int endIndex; System.out.println("Enter a string : "); inputString = scanner.nextLine(); System.out.println("Enter the first index of the substring : "); startIndex = scanner.nextInt(); if (int startIndex > inputSting.length) { System.out.println("Index is not in string length, try again."); } System.out.println("Enter the second index of the substring : "); endIndex = scanner.nextInt(); if (int endIndex > inputSting.length) { System.out.println("Index is not in string length, try again."); } char[] ch = new char[endIndex - startIndex + 1]; inputString.getChars(startIndex, endIndex + 1, ch, 0); System.out.println("Output : " + String.valueOf(ch)); } }
<java>
2019-10-11 06:45:15
LQ_EDIT
58,335,968
how can I add right to left Icon
I have attached the below image URL , for that I have used below code,but I am not able to find the content for icon-align right. Can anyone please help me out to revert the image or particular icon for right to left. it is used for Right To Left user. .icon-alignleft:before { content: "\e00a"; } thank you [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/DLcnj.jpg
<css>
2019-10-11 07:09:05
LQ_EDIT
58,341,190
Design a System for faster retrieval and modification without burdening the Heap Memory
<p>I need to design a system where data is received via ServerSocket and the data should be readily available for retrieval and modification. Currently, all the data is stored in ConcurrentHashMap.</p> <p>Data will be refreshed when the application restarts.</p> <p>Maintaining a Flat File and data retrieval from the file will add some delay.</p> <p>Is there any better approach to solve this kind of problem.</p>
<java><application-design>
2019-10-11 12:22:06
LQ_CLOSE
58,343,643
Golang fasthttp very slow response
I have very slow http response perfomance Used Go and Fasthttp ```golang package main import ( "fmt" "github.com/valyala/fasthttp" ) func fastHTTPHandler(ctx *fasthttp.RequestCtx) { var s string = "" for i := 1; i <= 100000; i++ { s += "hello " } ctx.SetBodyString(s) } func main() { fmt.Print("Started") fasthttp.ListenAndServe(":8081", fastHTTPHandler) } ``` And test it in Insomnia (Postman). Time of execution 3-4 sec. Similar code on PHP executed in 900ms. [PHP img][1] [Golang img][2] [1]: https://i.stack.imgur.com/iQrGN.jpg [2]: https://i.stack.imgur.com/zRtqe.jpg
<http><go><server><fasthttp>
2019-10-11 14:43:33
LQ_EDIT
58,343,706
how to develop library management system as web application by using java technology
"I'm a little bit confused that how I should start to develop a web application for the library management system by using the MVC design pattern." "My requirement is admin can manage librarians and librarians can manage books and students." "how I need to start working on it whether first, I should create a view or controller(servlet) or model?" "I have to save admin email and password explicitly in the database or I have to give an option to admin that first register if I will give register option to admin then anyone might be the admin please tell me which is the better way to do it?" "I have created a servlet and redirecting to a JSP page in which I took one body tag inside body tag I have taken two different form tag inside both form tag I have taken div tag one for admin and librarian login but I'm facing a problem as I am able to give input text in admin email and password field form but in librarian form I am not able to give user input in text field what I need to do overcome from this problem." "If it is not possible to take two form tag inside one body then how I can create two login form in one Html page one for admin and librarian." "Please see the below code and help out." `Admin.java package admin; import java.io.IOException; public class Admin extends HttpServlet{ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ RequestDispatcher dispatcher=request.getRequestDispatcher("home.jsp"); dispatcher.forward(request, response); } } ` `<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <link rel="stylesheet" type="text/css" href="css/style.css"> <title>Home</title> </head> <body> <form action="" > <div align="left" class="adm"> <h1>Admin Login</h1> Email address:<input type="text" name="email"></br> Password:<input type="password" name="pasword"></br> <input type="button" value="Login"> </div> </form> <form action=""> <div align="right"> <h2>Librarian Login</h2> Lemail address:<input type="text" name="lemail"/></br> password:<input type="password" name="pass"></br> <input type="button" value="Login"> </div> </form> </body> </html>'
<java><html><css><jakarta-ee>
2019-10-11 14:47:10
LQ_EDIT
58,345,815
How can we creat new char at c#.Net console
How can we creat new char for using into Console in order to we creat a simple game with it,for example we can import some char of char map app to console and my queastion is how can we creat specific own char.another my question is how can we clear a special position of console not whloe console buffer.
<c#><console><char><game-development>
2019-10-11 17:14:37
LQ_EDIT
58,347,767
python - sum of cubes using formula
How to compute the sum of cubes of first 100 integers in Python using formula \frac{n^2(n+1)^2}{4}. I've tried s=0 for n in range (0,1001): s+=(int)((n*(n+1))/2)**2 print("Sum is:",s) but it does not seem to work. Thank you for your time!
<python><sum>
2019-10-11 20:00:20
LQ_EDIT
58,348,329
why does this line ignored by java?
<p>i am writing a program to provide a menu for the user .. after he enters a number i use switch to decide which parameter should the user enter . Anyway, in one case ( case 1 ) i need to inputs from the user . but after the user enter the first input the program breaks the switch and go to do what is after the switch . </p> <p>code : </p> <p>the case 1 : </p> <pre><code> case 1: System.out.println("Enter the Amount :"); currentAccount.debit(scanner.nextDouble()); System.out.println("Want anything else(yes/no)?"); String input=scanner.nextLine(); if(input.equalsIgnoreCase("no")){ isFinished=true; currentAccount=null; System.out.println("SignedOut successfully"); } break; </code></pre> <p>output:</p> <pre><code>Choose an opearation: 1.withdraw. 2.deposit. 3.transaction history. 1 Enter the Amount : 100 Debit amount exceeded account balance. Want anything else(yes/no)? --------- Mhd Bank --------- logined as : -------------------------------- Choose an opearation: 1.withdraw. 2.deposit. 3.transaction history. </code></pre>
<java>
2019-10-11 20:55:17
LQ_CLOSE
58,348,638
C function calculates wrong with pointers
<p>so i've been on trying to coding my first commandline game. I've been coding in C now for about a few months and it's my first coding language. I had no real problems until i came to the point where i had to deal with this pointer conversion. </p> <p>Here is my function: </p> <pre><code>void attack(int * life, int * armor, char * name){ int difference; const int damage = 15; print_Name(name); printf(" attacks!\n"); if((*armor) &gt; damage){ printf("The armor was able to defend the damage!\n\n\n"); (*armor) = armor - damage; } if((*amor) &lt;= damage){ printf("Your Armor broke!\n"); difference = damage - (*armor); (*life) = (*life) - difference; (*armor) = 0; printf("The attack caused %i damage.\n\n\n", difference); } else if ((*armor) == 0){ printf("\nThe attack has caused %i damage.\n\n\n", damage); (*life) = life - damage; }; </code></pre> <p>}</p> <p>i translated my variables from german into english for a better understandment, but there might eventually be some typos. </p> <p>the problem is, my game work fine for a few rounds. But after ~20-30 rounds i noticed that the damage output was wrong at some point and now i ran into this: </p> <p><a href="https://i.stack.imgur.com/MPMYU.png" rel="nofollow noreferrer">enter image description here</a></p> <p>i know there is something wrong with my if's and that there is a better way to work around with the pointer... Can you help me with my problem?</p>
<c><function><pointers>
2019-10-11 21:25:53
LQ_CLOSE
58,349,298
how to check if a int is dvisible by another int
so im trying to have a program that checks if a integer is divisible by another int: divide 8 / 2 or 8/3 and im using if statements. This is what im using: if(int1 / 2){ printf("2:yes \n"); } else{ printf("2:no \n"); } The result I get is as long as the scanned number is below or equal to the divisor it prints the first output.
<c><if-statement><error-checking>
2019-10-11 22:48:03
LQ_EDIT
58,350,912
How to query records number in a joint query?
<p>for example,I have 2 tables student &amp; report, "student" log student info,"report" log every student's school report,a student has more than one reports so report table has a foreign key "sid" referenced to student table,now I want to query every student's info and his report number,so how can I do the query in one query? Currently I had to use two queries.</p>
<mysql>
2019-10-12 04:38:02
LQ_CLOSE
58,351,874
Unable to get request body in flask api using request.form from axios request
<p>I have written a flask api which recieves post request params using request.form. API performs perfectly in postman but fails in axios request.</p>
<reactjs><flask><axios><request.form>
2019-10-12 07:23:33
LQ_CLOSE
58,352,191
How to replace ^ character in JS
<p>I have a json data in my hand and I want to clear this character "^"</p> <p>but I can't get out of it because it's a regex operator.</p> <p>The code I wrote:</p> <pre><code>data = JSON.stringify(data) data = data.replace(/^1/g, ''); data = JSON.parse(data) </code></pre>
<javascript><regex><replace>
2019-10-12 08:14:40
LQ_CLOSE
58,353,666
Kindly help me regarding the code i have given below
i am writing this code for lexical analyzer to detect tokens , identifiers and operater's from a file. But the problem is that when ever i pass the file path and run the code it does't reads the file instead it keeps on giving the output that "UNABLE TO OPEN FILE". Kindly help me #include<iostream> #include<fstream> #include<stdlib.h> #include<string.h> #include<ctype.h> using namespace std; int isKeyword(char buffer[]){ char keywords[32][10] = {"auto","break","case","char","const","continue","default", "do","double","else","enum","extern","float","for","goto", "if","int","long","register","return","short","signed", "sizeof","static","struct","switch","typedef","union", "unsigned","void","volatile","while"}; int i, flag = 0; for(i = 0; i < 32; ++i){ if(strcmp(keywords[i], buffer) == 0){ flag = 1; break; } } return flag; } int main(){ char ch, buffer[15], operators[] = "+-*/%="; fstream inFile; int i , j =0; inFile.open("C:\Users\Muhammad Shaeel\Desktop\CC\Lexical Analyser Code\Lexical Analyser Code\program.txt.txt"); if (!inFile) { cout << "Unable to open file"; exit(0); } while(!inFile.eof()){ ch = inFile.get(); for(i = 0; i < 6; ++i){ if(ch == operators[i]) cout<<ch<<" is operator\n"; } if(isalnum(ch)){ buffer[j++] = ch; } else if((ch == ' ' || ch == '\n') && (j != 0)){ buffer[j] = '\0'; j = 0; if(isKeyword(buffer) == 1) cout<<buffer<<" is keyword\n"; else cout<<buffer<<" is indentifier\n"; } } inFile.close(); return 0; system("pause"); }
<c++><file-handling>
2019-10-12 11:29:48
LQ_EDIT
58,354,107
A pointer that does not print the first three words in a sentence
<p>Dont have any code get and i am stuck on how to solve this problem. I want the code to let the user input a long sentence and then a pointer that doesnt print the first 3 words of any given sentence. The tricky part for me is that the char is not defined at start so I cant just remove the words I wish. </p> <p>Exampel: </p> <p>Hello I neeed help with this code </p> <p>help with this code</p>
<c>
2019-10-12 12:21:10
LQ_CLOSE
58,354,142
return maximum and minimum number with serial number
I have an array like this $int = array(11,33,44,88); My question is how can i make the output like this max: 88 at index 0 min: 11 at index 4
<php>
2019-10-12 12:25:39
LQ_EDIT
58,355,075
It looks same algorithm but different output
The code looks same algorithm but different output. When you uncomment ``` #k = data.index(mn) #data[i], data[k] = data[k], data[I] ``` and also comment out ``` data[i], data[data.index(mn)] = data[data.index(mn)], data[i] ``` the data will be successfully sorted. I cannot figure out the difference of two way. ``` data = [-1.48, 4.96, 7.84, -4.27, 0.83, 0.31, -0.18, 3.57, 1.48, 5.34, 9.12, 7.98, -0.75, 2.22, -1.16, 6.53, -5.38, 1.63, -2.85, 7.89, -5.96, -8.23, 8.76, -2.97, 4.57, 5.21, 9.43, 3.12, 6.52, 1.58 ] #sort2 for i in range(30): mn = data[i] for j in data[i:]: if j < mn: mn = j else: pass #k = data.index(mn) #data[i], data[k] = data[k], data[i] data[i], data[data.index(mn)] = data[data.index(mn)], data[i] print('ascending order2:') print(data) ```
<python><sorting>
2019-10-12 14:18:22
LQ_EDIT
58,355,415
Java regex add space everytime number found in the string
<p>For example I have the string <code>number1number1number1</code>. Then I want to change it to <code>number 1 number 1 number 1</code>. So, for every single number that I find and not separated by a space, I will add a space. What should I do?</p>
<java><regex>
2019-10-12 14:58:00
LQ_CLOSE
58,356,018
how to fix my for code in java, not working
<p>Program that accepts integers and stores them in an array, and outputs the largest number of them. but following code is not working</p> <p>import java.util.Scanner;</p> <p>public class Test2 {</p> <pre><code>public static void main(String[] args){ System.out.print("input the array'size : "); Scanner sc = new Scanner(System.in); int size = sc.nextInt(); int arr[]=new int[size]; System.out.print("input the array'value :"); for(int i=0; i&lt;size; i++){ int var = sc.nextInt(); arr[i] = var; } System.out.print("inputed value: "); for(int i=0; i&lt;size; i++) { System.out.print(arr[i]+ " "); } int max = 0; for(int j=0; j&lt;size; j++){ if(max&lt;arr[j+1]){ max = arr[j]; } else { continue; } } System.out.println("the largest number in array :"+ max); } </code></pre> <p>}</p>
<java>
2019-10-12 16:11:08
LQ_CLOSE
58,356,034
PHP (7.2.23) Update version not working when installing composer in PHP Storm editor
- **I'm installing a project from git. When I try to install composer it shows message that require php 7.2 your version 7.1.1** - But my php version is 7.2.23, I have checked it locally from : http://localhost/dashboard/phpinfo.php - **Error message from php storm editor :** - Problem 1 - **This package requires php ^7.2 but your PHP version (7.1.1) does not satisfy that requirement. Problem 2**
<php><phpstorm>
2019-10-12 16:12:31
LQ_EDIT
58,356,177
How can I print 3 .csv files side by side
I have 3 .csv files 2 files and in one directory and the third is in another directory . How can I run all the 3 files together and print the output side by side currently 2 seperate files symbol qty | symbol qty | symbol qty appl 100 appl 100 RTF 200 sy 56 gyt 67 gty 67 Want all in one csv symbol qty symbol qty symbol qty appl 100 appl 100 RTF 200 sy 56 gyt 67 gty 67
<bash><scripting>
2019-10-12 16:29:48
LQ_EDIT
58,356,431
Why does java say a semicolon is expected when I already have one?
<p>I tried compiling my code so I could then run it and test it, but it says that there is a semi-colon expected. </p> <p>I tried deleting and re-inserting the semi-colon, but the error keeps appearing when I compile. The error is "GPACalculator.java:430: error: ';' expected"</p> <pre><code>if ((class71Honors.equals("Yes"))||(class71Honors.equals("Yes."))||(class71Honors.equals("yes"))||(class71Honors.equals("yes."))) { double class71GPA+=0.6; } </code></pre> <p>I don't expect a printed output, I just want the code to compile because it's the only error I have at the moment. Thanks! (this is all java by the way)</p>
<java>
2019-10-12 16:58:24
LQ_CLOSE
58,356,472
Why does closing a channel in defer statement panics?
In the following example, a go routine is pumping values into unbuffered channel and the main function is iterating over it. ```go package main import ( "fmt" "strconv" ) var chanStr chan string func main() { go pump() fmt.Println("iterating ...") for val := range chanStr { fmt.Printf("fetched val: %s from channel\n", val) } } func pump() { defer close(chanStr) chanStr = make(chan string) for i := 1; i <= 5; i++ { fmt.Printf("pumping seq %d into channel\n", i) chanStr <- "val" + strconv.Itoa(i) } //close(chanStr) } ``` The function panics with the following output: ``` iterating ... pumping seq 1 into channel pumping seq 2 into channel fetched val: val1 from channel ...... fetched val: val4 from channel pumping seq 5 into channel panic: close of nil channel goroutine 5 [running]: main.pump() C:/personal/gospace/go-rules/test.go:26 +0x1a6 created by main.main C:/personal/gospace/go-rules/test.go:11 +0x4e ``` However if I comment the defer statement and close right after the for loop in the goroutine `pump` , the receiver doesn't panic. *What's the difference in both the cases?* Looks like defer closes the channel before the value is received but the regular close waits. Also when I built using the race detector on, even in the regular close it flags a potential race condition (I'm not able recreate the race every time). Does it imply that both of those ways are not right in gracefully closing the channel?
<go><goroutine>
2019-10-12 17:02:21
LQ_EDIT
58,357,941
Cannot use import statement outside a module
<p>I'm trying to use classes in pure JavaScript, so I'm facing the error "Uncaught SyntaxError: Cannot use import statement outside a module" and can't solve it.</p> <p>File1.js - Main file</p> <pre><code>import example from "./file2"; var test = new example(); </code></pre> <p>File2.js - Class file</p> <pre><code>export default class example { constructor() { console.log("hello world"); } } </code></pre>
<javascript><html>
2019-10-12 19:53:37
HQ
58,358,449
Notarizing Electron apps throws - "You must first sign the relevant contracts online. (1048)" error
<p>I am trying to Notarize an electron app to make it run on macOS Catalina. The packaging was successful but the <code>xcrun altool</code> command is throwing "You must first sign the relevant contracts online. (1048)" error.</p> <p>Electron app package.json contents:</p> <pre><code>"mac": { "entitlements": "./build/entitlements.mac.inherit.plist", "hardenedRuntime": true, "type": "distribution", "category": "public.app-category.productivity", "icon": "build/icon.icns", "target": [ "dmg", "zip" ] }, "dmg": { "sign": false, </code></pre> <p>entitlements.mac.inherit.plist file:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt; &lt;plist version="1.0"&gt; &lt;dict&gt; &lt;key&gt;com.apple.application-identifier&lt;/key&gt; &lt;string&gt;&lt;app.bundle.name&gt;&lt;/string&gt; &lt;key&gt;com.apple.developer.team-identifier&lt;/key&gt; &lt;string&gt;&lt;TEAMID&gt;&lt;/string&gt; &lt;key&gt;com.apple.security.app-sandbox&lt;/key&gt; &lt;true/&gt; &lt;key&gt;com.apple.security.application-groups&lt;/key&gt; &lt;array&gt; &lt;string&gt;&lt;app.bundle.name&gt;&lt;/string&gt; &lt;/array&gt; &lt;key&gt;com.apple.security.network.client&lt;/key&gt; &lt;true/&gt; &lt;key&gt;com.apple.security.cs.allow-unsigned-executable-memory&lt;/key&gt; &lt;true/&gt; &lt;key&gt;com.apple.security.inherit&lt;/key&gt; &lt;true/&gt; &lt;/dict&gt; &lt;/plist&gt; </code></pre> <p>I ran the command as mentioned in <a href="https://stackoverflow.com/a/53121755">https://stackoverflow.com/a/53121755</a></p> <pre><code>xcrun altool --notarize-app -f App.dmg --primary-bundle-id app.bundle.name -u &lt;username&gt; -p &lt;app-specific-password&gt; </code></pre> <p>It is throwing <em>You must first sign the relevant contracts online. (1048)</em> error. I am unable to proceed with the app signing. Help!</p> <p>ps: electron-notarize package is throwing the same error.</p>
<macos><electron><codesign><notarize>
2019-10-12 20:58:33
HQ
58,359,181
What does " rand()% 11" and what's the diffrence between this and "rand()% 10+1"?
<p>I know that rand() generates a random number and that % operator returns the rest of the division but what I don't understand is why do we Have to use it here why can't we just give a max number directly like 10 for example</p>
<c>
2019-10-12 22:44:30
LQ_CLOSE
58,359,526
Python: Function produces different output after coverting it to a generator function
I created the following algorithm to create a function for the generation of the Baum-Sweet-Sequence ([Wikipedia][1]) def baum_sweettest(number_as_byte): counter = 0 for bit in str(number_as_byte): print("bit = ", bit) if bit == "0": counter += 1 if bit == "1": if counter%2 !=0 or counter == 1: counter = 0 return 0 print("counter = ", counter) if counter%2 !=0 or counter == 1: counter = 0 return 0 else: return 1 print(baum_sweettest(110)) I am fairly new to Python so I am aware, that this is probably far from the best way to solve it. Any feedback on this is welcome, however I am primarily interested in why this function creates different results, when converted to the following generator-function: def baum_sweet(): yield 1 counter = 0 for n in range(1,1000): number_as_binary = bin(n)[2::] for bit in str(number_as_binary): if bit == "0": counter += 1 if bit == "1": if counter%2 !=0 or counter == 1: counter = 0 yield 0 if counter%2 !=0 or counter == 1: counter = 0 yield 0 else: counter = 0 yield 1 baum_sweettest returns 0 when tested for the number 6 (110) which is correct. The generator-object created by baum_sweet delivers yields correct results up to the number 6, where it yields 1. Since the algorithm is the same in both cases I guess this is due to a different behavior in generator functions. Reading through the documentation I found, that those are not terminated, but rather just continued until the next yield-statement. So I made shure, that my counter will be reset manually before every yield. However the generator-version of my algorithm still yields different results at some point, as the same algorithm in a "non-generator-function". Can someone elaborate why those two functions return/yield different results? [1]: https://en.wikipedia.org/wiki/Baum%E2%80%93Sweet_sequence
<python><generator><yield-return>
2019-10-12 23:48:22
LQ_EDIT
58,360,015
I have a problem with wiringPi git clone.Could you tell me please. Thank you
my name is Tom and I'm a beginner in writing coding. Recommend me Now I can do not git clone Gordon. Can you tell me.About what I would do to do git clone wiringPi or is there any program instead of git clone.
<raspberry-pi><raspbian><wiringpi>
2019-10-13 02:03:54
LQ_EDIT
58,360,095
fail to run the file when defusing a bomb in phase_1
``` gdb bomb ... (gdb) break phase_1 Breakpoint 1 at 0x1264 (gdb) run Starting program: .../bomb Initialization error: Running on an illegal host [2] [Inferior 1 (process 3262) exited with code 010] ``` I don't know why i couldn't even run the bomb file, please help. Thank you so much!
<assembly><x86><reverse-engineering>
2019-10-13 02:24:03
LQ_EDIT
58,360,554
How can i write the sql query for this question below?
Among the students registered for the course "Psychology". what % of them have a GPA > 3? Student: student_id* | student_name | student_gender Course: course_id* | course_name | course_type Student_course_grade: student_id | course_id | grade Please note : 1. Grade field in Student_course_grade table is a number in (5,4,3,2,1) instead of a letter grade like (A,B,C,D,E) 2. For a student who has registered for a course and has not completed it yet, the grade will be null. 3. GPA= Grade Point Average ( average of all grades scored by the student)
<mysql><sql><dremel>
2019-10-13 04:16:04
LQ_EDIT
58,361,043
Random number in time period
<p>How to solve a problem with Kotlin when I want to generate random numbers in time period (eg. 1 sec) and than than that numbers collect somehow and make Sum of that numbers. Thanks</p>
<kotlin>
2019-10-13 06:14:28
LQ_CLOSE
58,362,907
Google AdMob error after update to Xcode 11 Swift 5.1
<p>Since I have updated to Xcode 11 the interstitial ads in my app won't load anymore. (Before that everything worked fine. The app was even released on the App Store. We are now creating an updated version of the app)</p> <p>I installed the Google AdMobs SDK via Cocoapods and updated this to the latest version. Still no success. (I followed all the steps of Google's tutorial, how to implement interstitial ads) These are the error messages I get from the console:</p> <pre><code> 2019-10-10 21:42:35.543249+0100 BuszZer[76592:876619] &lt;Google&gt; To get test ads on this device, set: request.testDevices = @[ kGADSimulatorID ]; 2019-10-10 21:42:35.599222+0100 BuszZer[76592:876796] [Client] Updating selectors failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated.} 2019-10-10 21:42:35.599426+0100 BuszZer[76592:876796] [Client] Updating selectors after delegate addition failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated.} 2019-10-10 21:42:35.599610+0100 BuszZer[76592:876787] [Client] Synchronous remote object proxy returned error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated.} 2019-10-10 21:42:35.600170+0100 BuszZer[76592:876787] [Client] Synchronous remote object proxy returned error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated.} 2019-10-10 21:42:35.600215+0100 BuszZer[76592:876796] [Client] Updating selectors failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated.} 2019-10-10 21:42:35.601185+0100 BuszZer[76592:876787] [Client] Synchronous remote object proxy returned error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated.} 2019-10-10 21:42:35.601435+0100 BuszZer[76592:876796] [Client] Updating selectors failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated.} 2019-10-10 21:42:35.608414+0100 BuszZer[76592:876619] [plugin] AddInstanceForFactory: No factory registered for id &lt;CFUUID 0x60000360a1a0&gt; F8BB1C28-BAE8-11D6-9C31-00039315CD46 2019-10-10 21:42:35.610662+0100 BuszZer[76592:876789] - &lt;Google&gt;[I-ACS025031] AdMob App ID changed. Original, new: (nil), ca-app-pub-9056820091768756~5451481231 2019-10-10 21:42:35.611337+0100 BuszZer[76592:876789] - &lt;Google&gt;[I-ACS023007] Analytics v.60102000 started 2019-10-10 21:42:35.611517+0100 BuszZer[76592:876789] - &lt;Google&gt;[I-ACS023008] To enable debug logging set the following application argument: -APMAnalyticsDebugEnabled (see https://help.apple.com/xcode/mac/8.0/#/dev3ec8a1cb4) </code></pre> <p>Does anybody have similar problems or experiences and knows how to solve them? Any help is appreciated. Thanks a lot!</p>
<ios><swift><admob><xcode11><swift5.1>
2019-10-13 11:00:26
HQ
58,363,012
Left click in selenium
which method is used to click left of mouse in selenium using java ,can it be done using action class I tried using action class but did not get result
<java><selenium>
2019-10-13 11:14:47
LQ_EDIT
58,364,248
Match everything between characters in Regex?
<p>I am trying to match everything between</p> <blockquote> <p>/* <strong><em>and</em></strong> */</p> </blockquote> <p>And also include the in between characters.</p> <p>I currently managed to create a pattern that kind of does this</p> <pre><code>\/\*(.+?)\*\/ </code></pre> <p><a href="https://regex101.com/r/2MBabj/1" rel="nofollow noreferrer">Regex Tester</a></p> <p>But it doesn't match multi line quotes and only matches once.</p> <p><a href="https://i.stack.imgur.com/6vl50.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6vl50.png" alt="enter image description here"></a></p> <p>How can I improve this pattern to match everything that starts with /* and ends with */ ?</p>
<c#><regex><string><pattern-matching>
2019-10-13 13:58:48
LQ_CLOSE
58,365,440
How to resolve invalid syntax issue?
<p>I have this issue and can't seem to find a resolution to it. It keeps showing me on line 15 invalid syntax. What's wrong with it?</p> <pre><code>print("Shirt Order") print() colour = input("What colour of the shirt? Blue or White: ") if colour.lower() == "blue": size = input("What size of the shirt? (S/M/L): ") if size.lower() == "l": print("Sorry, we do not have that size available.") elif size.lower() == "m": print("You have selected a blue shirt in size medium, that will be $9 please.") elif size.lower() == "s": print("You have selected a blue shirt in size small, that will be $5.50 please.") else: print("Sorry, your order was not recognized, please try again.") elif colour.lower() == "white": size = input("What size of the shirt? (S/M/L): ") if size.lower() == "l": print("You have selected a white shirt in size large, that will be $10 please.") elif size.lower() == "m": print("You have selected a white shirt in size medium, that will be $9 please.") elif size.lower() == "s": print("Sorry, we do not have that size available.") else: print("Sorry, your order was not recognized, please try again.") </code></pre>
<python>
2019-10-13 16:14:51
LQ_CLOSE
58,365,444
JavaScript: Equivalent of arrow function (how to not use an arrow)
<p>I am new to JavaScript, and I am struggling with how to change an arrow function with non-arrow function... Please help, and thank you very much in advance!</p> <pre><code>this.middleware(req,res,()=&gt;{ this.processRoutes(req,res); }); </code></pre>
<javascript><node.js><arrow-functions>
2019-10-13 16:15:36
LQ_CLOSE
58,365,566
How to use axios instead of ajax in datatable?
<p>I want to use axios to fetch data and load them to datatable. It is possible if I load all the data and render to datatable. But, what I want is load page number specific data. I don't want to load all the data at once it makes slow data loading. In short, I want to implement server side loading with axios in datatable. I have been stuck since long. Is there any way? Thanks.</p>
<javascript><node.js><api><datatable>
2019-10-13 16:29:40
LQ_CLOSE
58,371,016
Syntax error with try/except statement highlighing 'except'
I have a very simple try/except block to basically force the variable 'password' to be defined as an integer from user input. It is likely a dumb question, but I have tried looking around and cannot find some solution. try: password = int(input('Bob should have issued you with your 4-digit numerical password, please enter it here: ') except ValueError: print("Please do not type letters or symbols!!") while type(password) != 'int': try: password = int(input('Bob should have issued you with your 4-digit numerical password, please enter it here: ') except ValueError: print("Please do not type letters or symbols!!") print('Complete, we have your password.') But, when I try run this python shell, it comes up with a Syntax Error, highlighting 'except'...
<python>
2019-10-14 06:16:58
LQ_EDIT
58,371,857
Finding latest record from duplicates
I have a customers table with ID's and some date/time columns. But those ID's have duplicates and i just want to Analyse distinct values. I tried using groupby but this makes the process very slow. Due to data sensitivity can't share it. Any suggestions would be helpful.
<powerbi><dax>
2019-10-14 07:23:35
LQ_EDIT
58,371,874
What is diffrence between didChangeDependencies and initState?
<p>I am new to flutter and when I want to call my context in InitState it throw an error : which is about <code>BuildContext.inheritFromWidgetOfExactType</code> but then I use didChangeDependencies and it work correctly.</p> <p>now I have 2 question:</p> <p>1-why we can't call our context in initState but there is no problem for didChangeDependencies ? (because as I read in official doc <code>This method is also called immediately after [initState]</code>, and both of them will be called before build method. )</p> <p>2-why we have access to context outside build method ( because there we have <code>build(BuildContext context)</code> and we can use our context but in didChangeDependencies we don't have anything like <code>didChangeDependencies(BuildContext context)</code> , so from where we can call context to use it) ?</p>
<flutter><dart>
2019-10-14 07:24:13
HQ
58,372,703
How do I write an inline multiline powershell script in an Azure Pipelines PowerShell task?
<p>The yaml schema for a <a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/powershell?view=azure-devops" rel="noreferrer">Powershell task</a> allows you to select targetType: 'inline' and define a script in the script: input.</p> <p>But what is the correct format for writing a script with more than one line?</p> <p>The docs don't specify how, and using a pipe on line one (like is specified for the Command Line task) does not work.</p>
<powershell><azure-pipelines>
2019-10-14 08:21:18
HQ
58,373,280
Special Singleton
class A{ } class B extends A{ } class C extends B{ } A a1 = new A(); //Should work fine A a2 = new A(); // Should throw an error if one instance is already created B b1 = new B(); // Should work fine despite A instance is there or not B b2 = new B(); // Should throw an error C c1 = new C(); // Should work fine despite B instance is there or not C c2 = new C(); // Should throw an error
<java><singleton>
2019-10-14 08:58:09
LQ_EDIT
58,375,073
Read from a .txt file and display it
<p>I want to be able to have a .txt file with some text in it and have my program be able to read it and display it. How would I do this?</p> <p>It just needs to be as simple as displaying it on the screen. No other code. Then I can just input it into my program! :)</p>
<python>
2019-10-14 10:41:56
LQ_CLOSE
58,375,994
Concatenating strings in a table row from the db
<p>How do I display the fullname on a table from the firstname and secondname in my database using php or js?</p>
<javascript><php><sql>
2019-10-14 11:39:42
LQ_CLOSE
58,376,585
Linq methods for IAsyncEnumerable
<p>When working with an <code>IEnumerable&lt;T&gt;</code> there are the build-in extension methods from the <code>System.Linq</code> namespace such as <code>Skip</code>, <code>Where</code> and <code>Select</code> to work with. </p> <p>When Microsoft added <code>IAsyncEnumerable</code> in C#8 did they also add new Linq methods to support this?</p> <p>I could of course implement these methods myself, or maybe find some package which does that, but I'd prefer to use a language-standard method if it exists.</p>
<c#><c#-8.0><iasyncenumerable>
2019-10-14 12:15:22
HQ
58,378,291
Get first value from in mysql
<p>I have column in mysql table </p> <pre><code> uid , valueid , date 11 , 23, "2019-01-01" 11 , 24, "2019-02-01" 11 , 22, "2019-05-01" </code></pre> <p>i want result in this format</p> <pre><code>id , valueid , date 11 , 23 , "2019-01-01" </code></pre> <p>get always first value id i.e is 23 </p>
<mysql><sql><view><datatable><multiple-columns>
2019-10-14 13:52:56
LQ_CLOSE
58,379,456
How to get a particular JSON element of an array?
<p>There is an <code>array</code> of <code>JSON</code>s :</p> <pre><code>var a = [ {id:1, latlong:[...]} , {id:2, latlong:[...]} , ... ]; </code></pre> <p>How to get the JSON element which key <code>id</code> equals 2 for example ?</p>
<javascript><lodash>
2019-10-14 15:04:04
LQ_CLOSE
58,379,543
Can't create directory in Android 10
<p>I'm unable to create directory in android 10. It's working on devices till android Oreo. </p> <p>I tried two ways for creating folders.</p> <p><strong>Using</strong> <code>File.mkdir()</code>:</p> <pre><code> File f = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/Pastebin"); if (!f.isFile()) { if (!(f.isDirectory())) { success = f.mkdir(); } </code></pre> <p>Here, the variable <code>success</code> is always <strong>false</strong> which means the directory isn't created.</p> <p><strong>Using</strong> <code>Files.createDirectory()</code>:</p> <pre><code> File f = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/Pastebin"); if (!f.isFile()) { if (!(f.isDirectory())) { if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.O) { try { Files.createDirectory(Paths.get(f.getAbsolutePath())); } catch (IOException e) { e.printStackTrace(); Toast.makeText(getApplicationContext(), R.string.unable_to_download, Toast.LENGTH_LONG).show(); } } else { f.mkdir(); } } </code></pre> <p>which causes this exception:</p> <pre><code>pzy64.pastebinpro W/System.err: java.nio.file.AccessDeniedException: /storage/emulated/0/Pastebin pzy64.pastebinpro W/System.err: at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:391) pzy64.pastebinpro W/System.err: at java.nio.file.Files.createDirectory(Files.java:674) </code></pre> <p>I've implemented the run-time permissions and </p> <pre><code>&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/&gt; &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/&gt; </code></pre> <p>are all set.</p>
<java><android>
2019-10-14 15:09:03
HQ
58,379,639
im having problems with removing tkinter widgets
I have a problem with the fact that i can't get my widgets of my screen. I have tried to use (widget).forget() but it doesn't work? Can someone help?
<python><tkinter><widget>
2019-10-14 15:15:24
LQ_EDIT
58,381,343
How to call another classes super class?
<p>Lets say I have three classes, A,B,C. B inherits A, is there a way to access the getVal method of Class A, in C? </p> <pre><code> class A { getVal method } class B extends A { } Class C { main() { B x = new B x.getVal? } </code></pre>
<java><oop><inheritance>
2019-10-14 17:16:34
LQ_CLOSE
58,386,505
c; how to write a program that makes the user input a lot of strings as much and count the occurences?
I need to write a program that makes the user input a string, then the program asks the user to continue to input more strings or not. After that, the program should count all the occurrences of the words in all the strings the user input. This code only counts the ocurrence of the last string, how should I change it? ``` #include <stdio.h> #include <string.h> #define MAXSTRLEN 100 int main(void) { int count = 0, c = 0, i, j = 0, k, space = 0; char p[50][100], str1[20], ptr1[50][100]; char* ptr; char str[MAXSTRLEN], Y_or_N; printf("Write a sentence.\n"); while (1) { gets(str); printf("Continue or not? (y or n): "); scanf("%c", &Y_or_N); getchar(); if (Y_or_N == 'n') break; } for (i = 0; str[i] != '\0'; i++) { if ('A' <= str[i] && str[i] <= 'Z') str[i] = str[i] + 32; } for (i = 0; i < strlen(str); i++) { if ((str[i] == ' ') || (str[i] == ',' && str[i + 1] == ' ') || (str[i] == '.')) { space++; } } for (i = 0, j = 0, k = 0; j < strlen(str); j++) { if ((str[j] == ' ') || (str[j] == 44) || (str[j] == 46)) { p[i][k] = '\0'; i++; k = 0; } else p[i][k++] = str[j]; } k = 0; for (i = 0; i <= space; i++) { for (j = 0; j <= space; j++) { if (i == j) { strcpy(ptr1[k], p[i]); k++; count++; break; } else { if (strcmp(ptr1[j], p[i]) != 0) continue; else break; } } } for (i = 0; i < count; i++) { for (j = 0; j <= space; j++) { if (strcmp(ptr1[i], p[j]) == 0) c++; } printf("%s : %d times.\n", ptr1[i], c); c = 0; } } ```
<c>
2019-10-15 02:43:04
LQ_EDIT
58,387,324
How to convert "2019-10-11T04:56:06.000Z" to timestamp in Java?
<p>I have a string "2019-10-11T04:56:06.000Z", how to convert it to timestamp in Java.</p>
<java><datetime><timestamp>
2019-10-15 04:35:14
LQ_CLOSE
58,388,865
Need to filter value from string which can have dynamic number with text after that using regex
<p>I want to filter value from string which should result me a number followed by text. For example string looks like "There are 9 steps in the house which can be used to visit first floor". Output :"<strong>9 steps</strong>". Here number can change to any value. but that will be followed by steps</p>
<c#><regex>
2019-10-15 06:56:39
LQ_CLOSE
58,389,366
How could I line up images on the same line?
<p>I need help aligning 5 images on the same lines using HTML5 and CSS3!</p> <p>I have tried using other methods (which I have forgotten so I can't leave an example) but they don't work. I don't want to use absolute positioning because I want my website to be as mobile friendly as possible.</p> <p>Could someone reply with some code of how to do this?</p>
<html><css><image>
2019-10-15 07:29:21
LQ_CLOSE
58,389,625
SPFX how to get file ID?
<p>I am working on a webpart, and I need to filter a folder with files tied to a <strong>list item</strong>, but I am facing multiple problems:</p> <p>a) I can store the file ID in a lookup field of the list item, but I cannot retrieve the file ID with any available query. </p> <pre><code>meetingFolderPath.folder.files.get(); </code></pre> <p>This query gets me a all the files, but none of them contain the lookup ID. They do contain a NAME, UNIQUEID, and URL, all of which is of type string, but I <strong>cannot</strong> store a string in a lookup field in sharepoint. It doesnt even support any list-type fields other than lookup (which takes int or int[]).</p> <p>b) .expand seemingly does not support a multiple-lookup field</p> <pre><code> meetingFolderPath.folder.files.expand("Files").get(); </code></pre> <p>I would assume some of you to suggest this, and maybe Im doing it wrong, but I cannot get it to work. Remember I have lookup field that contains multiple IDs</p> <p>c) cannot use Attachments.</p> <p>The req spec specifically says NOT to use attachments, which would have solved my problem, but they need to be able to collab on a file, so its of no use that they have to upload every little iteration of the file. Instead the file should be in a folder, tied to a Team, where they can make as many changes as needed without losing the reference in the list field.</p> <p>d) custom query does not support get by ID</p> <pre><code>_api/yada/yada/files('NAME') // WORKS _api/yada/yada/files(id) // DOESNT WORK </code></pre> <p>I tried messing with a custom query, but putting an ID instead of a name returns an error.</p> <p>At this point, the only solution I see is a complete seperate list containing a list item ID and a filename.. but I really do not want to implement that.</p>
<file><sharepoint><id><spfx>
2019-10-15 07:43:39
LQ_CLOSE
58,389,945
Double tap gesture works only once
I'm trying to add double tap gesture recognizer on `imageView`. Double tap recognizer works only for once and if image is double tapped for second time, selector doesn't response. Below is code I'm trying productImageView.isUserInteractionEnabled = true let doubleTap = UITapGestureRecognizer.init(target: self, action: #selector(self.sampleTapGestureTapped(recognizer:))) doubleTap.numberOfTapsRequired = 2 productImageView.addGestureRecognizer(doubleTap)
<ios><swift><uiscrollview>
2019-10-15 08:04:07
LQ_EDIT
58,390,493
Use json to generate output eventemitter
<p>The title almost said what I want to express.I wonder is there any way to generate output eventemitter by json in Angular. so i can get the certain type of event and i can do other operations outside.</p>
<angular>
2019-10-15 08:36:28
LQ_CLOSE
58,391,379
Why does ScanF take two inputs from string
<p>The first ScanF takes both inputs when I type a character and an integer is expected.</p> <p>see image below:<a href="https://i.stack.imgur.com/DgvyH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DgvyH.png" alt="enter image description here"></a></p> <p>As you can see when I type "55ape" for ScanNum_A it sets ScanNum_B = 0. Why does this happen?</p>
<c>
2019-10-15 09:24:31
LQ_CLOSE
58,394,236
Why is Shiny a dependency of devtools?
<p>When I install devtools, I get shiny as a dependency. </p> <pre><code>&gt; install.packages("devtools") Installing package into ‘/Users/xxx/tmp/xxx/packrat/lib/x86_64-apple-darwin15.6.0/3.5.3’ (as ‘lib’ is unspecified) also installing the dependencies ‘zeallot’, ‘colorspace’, ‘utf8’, ‘vctrs’, ‘plyr’, ‘labeling’, ‘munsell’, ‘RColorBrewer’, ‘fansi’, ‘pillar’, ‘pkgconfig’, ‘httpuv’, ‘xtable’, ‘sourcetools’, ‘fastmap’, ‘gtable’, ‘reshape2’, ‘scales’, ‘tibble’, ‘viridisLite’, ‘sys’, ‘ini’, ‘backports’, ‘ps’, ‘lazyeval’, ‘shiny’, ‘ggplot2’, ‘later’, ‘askpass’, ‘clipr’, ‘clisymbols’, ‘curl’, ‘fs’, ‘gh’, ‘purrr’, ‘rprojroot’, ‘whisker’, ‘yaml’, ‘processx’, ‘R6’, ‘assertthat’, ‘rex’, ‘htmltools’, ‘htmlwidgets’, ‘magrittr’, ‘crosstalk’, ‘promises’, ‘mime’, ‘openssl’, ‘prettyunits’, ‘xopen’, ‘brew’, ‘commonmark’, ‘Rcpp’, ‘stringi’, ‘stringr’, ‘xml2’, ‘evaluate’, ‘praise’, ‘usethis’, ‘callr’, ‘cli’, ‘covr’, ‘crayon’, ‘desc’, ‘digest’, ‘DT’, ‘ellipsis’, ‘glue’, ‘git2r’, ‘httr’, ‘jsonlite’, ‘memoise’, ‘pkgbuild’, ‘pkgload’, ‘rcmdcheck’, ‘remotes’, ‘rlang’, ‘roxygen2’, ‘rstudioapi’, ‘rversions’, ‘sessioninfo’, ‘testthat’, ‘withr’ </code></pre> <p>How does this make any sense? Is this expected, and if yes, how can I prevent it from happening? I am using R 3.5.3 with 0-Cloud mirror.</p>
<r><devtools>
2019-10-15 12:02:22
LQ_CLOSE
58,394,436
Python use as loop to make a formula
<p>I want to use a loop to make a formula. I will be adding pandas columns but the number of columns I'll add depends on a condidition within the loop.</p> <p>For example</p> <pre><code>l=[1,2,3,4] s='a=' out='' for i in l: out=out+'+'+str(i) </code></pre> <p>In this example s+out should equal <code>10</code> and not <code>'a=+1+2+3+4'</code></p>
<python><pandas>
2019-10-15 12:13:00
LQ_CLOSE
58,394,784
How to press windows key using pywinauto python
<p>Hello I want to write a program to automate windows 10 but to do so I need to open startmenu by pressing windows key using pywinauto plz help</p>
<python-3.x><pywinauto>
2019-10-15 12:31:23
LQ_CLOSE
58,394,866
How we can find floating and integer part of a number in MATLAB?
I want to detect float and integer parts of a number like 235.102457. In short want to store two parts of my number like: A=235 B=102457 Is it possible in MATLAB software?
<matlab><numbers><number-formatting>
2019-10-15 12:34:45
LQ_EDIT
58,395,158
I'm always getting a single route no matter what origin and destination I set
<p>I'm getting in my directions as explained in the <a href="https://developers.google.com/maps/documentation/directions/intro" rel="nofollow noreferrer">docs</a>. My link looks like this:</p> <pre><code>https://maps.googleapis.com/maps/api/directions/json?origin=lat,lng&amp;destination=lat,lng&amp;mode=walking&amp;key=KEY </code></pre> <p>Which works perfectly fine. However, it doesn't matter what origin or destination I set, I'm always getting a JSON file with a singe route. See the below screenshot:</p> <p><a href="https://ibb.co/x7K4B1c" rel="nofollow noreferrer">https://ibb.co/x7K4B1c</a></p> <p>Is this correct? Is there any way I can get multiples routes?</p>
<android><google-maps><google-maps-api-3><android-maps><google-directions-api>
2019-10-15 12:50:51
LQ_CLOSE