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,700,058
How to create a google map image mask overlay?
<p>I'm trying to create a google map "inside" an shape like in the example bellow. Could you please help me? <a href="https://i.stack.imgur.com/qsGHC.png" rel="nofollow noreferrer">Click to see Image</a></p>
<javascript><google-maps>
2019-11-04 19:43:36
LQ_CLOSE
58,701,583
How can i remove duplicate words unseparated in a python string?
string1 = "calvin kleinklein design dress" How can I remove the second duplicate "klein"? The result should look like string2 = "calvin klein design dress"
<python>
2019-11-04 21:50:06
LQ_EDIT
58,702,602
how I filter the input result from some words like kill, gun using simple python if statement
<p>I want to filter the x result to know which category would be appended to </p> <pre><code>def bot(): kids = [] adults = [] index = 0 x = input("enter movie name ") for side in x: if x == "gun" or x == "kill": kids.append(x) else: adults.append(x) print(kids) print(adults) </code></pre> <p>what if x == "top gun" it will ignore it </p> <p>I need to make it if x has "kill or gun, etc" don't add it to category less than 16 years old recommends</p>
<python>
2019-11-04 23:45:10
LQ_CLOSE
58,702,616
Python code to cluster geographical locations(long/lat) which are within 30 min of commute to each other?
I am trying to cluster geographical locations(long / lat) where the distance between data points in a cluster should be less than or equal to 30 min from each other. I can calculate duration between two points using google map api. How can I cluster those sites which are within 30 minutes commute from each other ?
<python><api><maps><cluster-analysis><duration>
2019-11-04 23:46:30
LQ_EDIT
58,704,972
Access already opened Excel and Internet Explorer to get data
<p>there I'm trying to make a Robotic Process Automation(called RPA) using python. There are two windows; one is excel and the other is web.</p> <p>The Procedure is:</p> <ol> <li>Both excel and web must be opened before run the code(It never be changed, there are no alternatives)</li> <li>the data on the web is copied and pasted to excel file.</li> <li>done!</li> </ol> <p>It looks easy... but, selenium cannot access to already opened web and cannot access to already opened excel file.</p> <p>of course, it could be easy to access to new web and new or load excel.</p> <p>It doesn't matter selenium and are not used. </p> <p>Does somebody know how to solve it??</p> <p>Thank you.</p>
<python><excel><selenium><internet-explorer><openpyxl>
2019-11-05 05:24:42
LQ_CLOSE
58,707,505
Javascript - Show alert when specific radio button is checked on ID
<p>I need to show a alert when someone clicks on a radio button with a specific ID.</p> <p>This is the radio button:</p> <pre><code>&lt;input name="shipping_method" type="radio" class="validate-one-required-by-name" value="kerst_shipping_standard" id="s_method_kerst_shipping_standard"&gt; </code></pre> <p>And when someone clicks that radio button it needs to show a alert.</p>
<javascript><alert>
2019-11-05 08:45:35
LQ_CLOSE
58,708,085
I am using fat arrow function in php
$mul2 = fn($x) => $x * 2; $mul2(3); I am getting an error at => Error- Unexpected => How do I resolve the error.
<php>
2019-11-05 09:20:30
LQ_EDIT
58,708,337
How to rename a text file using an integer variable in Python?
<p>I want to rename a file xyz.txt to 1.txt. Consider 1 as an integer variable in 1.txt.</p> <p>I have tried os.rename(old name, new name). But in the new name, I want to pass my integer variable + ".txt"</p>
<python>
2019-11-05 09:33:56
LQ_CLOSE
58,709,546
In python How can i return all tuples in liste?
so this is my list: list_tuple = [(x1,x2,x3)(x4,x5,x6)(x7,x8,x9)] and i'm want to return only all tuple so How can i retun all tuples this is what i try: for i in list_tuple: print(i) this is what he did x1,x2,x3 the result expected is (x1,x2,x2) (x4,x5,x6) (x7,x8,x9)
<python><list><tuples>
2019-11-05 10:37:53
LQ_EDIT
58,709,961
position: sticky and hurribble problem with edge browser
I use bootstrap 4 and .sticky-top class for stick div after scrolling. But the problem is in edge browser hide div and and unvisiable content of div. it's no matter work true .sticky-top class in edge just show this content and don't hide it.
<html><css><microsoft-edge>
2019-11-05 11:01:47
LQ_EDIT
58,713,265
Can you please help me find a problem in my code?
Im trying to do homework for my IT classes and we just started programming a bit. We have 2 classes, Main and Okej. It is just a simple code where the getters and setters have to check if the user input the right number. But the IF statements just do not work. Can you please help? package okej; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner program = new Scanner(System.in); System.out.println("Please, type your Name."); String name = program.nextLine(); System.out.println("Please, type your age."); int age = program.nextInt(); System.out.println("Please, type your weight."); double weight = program.nextDouble(); Okej you = new Okej(name, age, weight); System.out.print(you); } } ---------------------------------------------------------------------- package okej; import java.util.Scanner; public class Okej { String name = ""; int age = 0; double weight = 0.0; public Okej(String name, int age, double weight) { this.name = name; this.age = age; this.weight = weight; } public String getName() { return name; } public void setName(String name) { System.out.println("Okay, your name is " + name + "."); this.name = name; } public int getAge() { return age; } public void setAge(int age) { if (age > 18) { if (age < 99) { this.age = age; System.out.println("Okay, your age is " + age + "."); } } else { System.out.println("You have put an invalid age for this program."); System.out.println("Setting the number to 20."); this.age = 20; } } public double getWeight() { return weight; } public void setWeight(double weight) { if (weight > 30) { if (weight < 300) { this.weight = weight; System.out.println("Okay, your weight is " + weight + "."); } } else { System.out.println("You have put an invalid weight for this program."); System.out.println("Setting the number to 50."); this.weight = 50; } } @Override public String toString() { return "Okay, your name is " + name + ", your age is " + age + ", and you weight "+ weight +"."; } }
<java><json>
2019-11-05 14:16:58
LQ_EDIT
58,714,366
How can I use a for loop inside an if condition? The condition is - If user input a value which is less than 10 then a list of 1-10 will be print
<p>The condition is - If user input a value which is less than 10 then a list of 1-10 will be print. </p> <p>I am able to take the input but the condition and loop is not working.</p>
<java><loops><if-statement>
2019-11-05 15:17:34
LQ_CLOSE
58,716,011
Ruby Data Types
<p>Which two of these three expressions are equal? Why?</p> <pre class="lang-rb prettyprint-override"><code>{ "city" =&gt; "Miami", "state" =&gt; "Florida" } { :city =&gt; "Miami", :state =&gt; "Florida" } { city: "Miami", state: "Florida" } </code></pre>
<ruby>
2019-11-05 16:54:27
LQ_CLOSE
58,718,261
VBA Excel Error 424 search textbox to display listbox, error display listbox header
Private Sub SearchCommand_Click() Dim i As Long Sheet1.Activate Me.ResultListbox.AddItem For a = 1 To 5 **Me.ResultListbox.List(0, a - 1) = Sheet1.Cells(1, a)** Next a Me.ResultListbox.Selected(0) = True End sub [enter image description here][1] [1]: https://i.stack.imgur.com/sZatD.png
<excel><vba>
2019-11-05 19:35:02
LQ_EDIT
58,719,352
Is there a "JOIN" query to show the first name and last name of the employees who do not work in the same locations with their manager
<p>I am stuck on a query to find employees who do not work at the same location as their manager based on the attached schema.</p> <p><a href="https://i.stack.imgur.com/tfYWm.png" rel="nofollow noreferrer">DB schema</a></p>
<sql>
2019-11-05 20:56:58
LQ_CLOSE
58,720,019
How do you end a method from code in another method?
<p>How do I end a method with logic in another method? It seems return only works in the method it is in.</p> <pre><code>private void BeAmazing (int number) { HandleNumber(number); Debug.Log("number is 3 or less"); } private void HandleNumber(int number) { if (number &gt; 3) { return; } } </code></pre>
<c#>
2019-11-05 21:51:14
LQ_CLOSE
58,720,659
how to retrieving data from mysql and output json php?
<p>i Have this code to retrieving data from mysql and output json from php</p> <pre><code>&lt;?php header("Access-Control-Allow-Origin: *"); header('Content-Type: text/html; charset=utf-8'); include 'system/config.php'; $db=mysql_connect($DB_HOST, $DB_USER, $DB_PASS) or die('Could not connect'); mysql_select_db($DB_NAME, $db) or die(''); $result = mysql_query("SELECT * from users") or die('Could not query'); if(mysql_num_rows($result)){ echo '{"Data":['; $first = true; $row=mysql_fetch_assoc($result); while($row=mysql_fetch_row($result)){ // cast results to specific data types if($first) { $first = false; } else { echo ','; } echo json_encode($row); } echo ']}'; } else { echo '[]'; } mysql_close($db); ?&gt; </code></pre> <p>What i need to do exactly like that to split every user with new data line</p> <pre><code> { "data":[ { "user_id":"1", "user_name":"ahmed", "user_rank":"admin", "color":"blue", "user_avatar":"default_avatar.png", "user_age":"30", "user_email":"root@root.com", "trending_datetime":"0000-00-00 00:00:00", }, "data":[ { "user_id":"2", "user_name":"ahmed2", "user_rank":"user", "color":"green", "user_avatar":"default_avatar.png", "user_age":"40", "user_email":"ahmed2@root.com", "trending_datetime":"0000-00-00 00:00:00", } } </code></pre> <p>But is showing like that and i know there is something missing..am still learning</p> <pre><code> { "Data": [["5", "lucifer", "user5_37994384.png"], ["7", "Ahmed", "default_avatar.png"], ["10", "Viona", "default_avatar.png"], ["11", "Dream", "default_avatar.png"], ["12", "Zanos", "default_avatar.png"], ["13", "Dean.Winchester", "default_avatar.png"], ["19", "sama", "default_avatar.png"], ["33", "demo", "default_avatar.png"], ["34", "super", "default_avatar.png"], ["42", "tazooo", "default_avatar.png"], ["44", "devil", "default_avatar.png"]] } </code></pre> <p>Thanks for help</p>
<php><mysql><json><mysqli>
2019-11-05 22:52:32
LQ_CLOSE
58,720,880
How to fix "Use Of Unassigned local variable in citra" when citra is defined? (with Object Oreinted Programming, bools, and switch statements)
<p>Recently I was attempting to make an advanced choose your own adventure game to practice my fresh new C# skills but I have came across a powerful error that is preventing me from continuing my project."Use Of Unassigned local variable in citra" on line 58 inside the story_Confirmation method is an error I came across that is not allowing me to return citra for some odd reason. Can I please get some assistance?</p> <p>Code is below:</p> <pre><code>using System; namespace FirstConsoleProgram { public class Game{} //Currently Nothing public class Story : Game { public int stro; private string intro; public Story(int _stro) { stro = _stro; if(stro == 1) { SetIntroTXT("how you \"The Avatar\" have to save the world from pain and destruction. \n You travel the world gaining new spells and abilities until the ultimate battle \n where you have to fight Lord Ozai"); bool reply = story_Confirmation(5); Console.WriteLine(reply); } } void FirstStory() { ; //Currently Nothing } void SetIntroTXT(string txt) { intro = txt; } bool story_Confirmation(int cont) { Console.Clear(); Console.WriteLine(intro); Console.WriteLine(); bool citra; Console.WriteLine("Are you sure you want to confirm? (y/n)"); string awn = Console.ReadLine().ToUpper(); if(awn == "YES" || awn == "Y") { cont = 1; } else if(awn == "NO" || awn == "N") { cont = 2; } switch(cont) { case 1: citra = true; break; case 2: citra = false; break; } return citra; } } public class Program { public static void Main(string[] args) { Console.WriteLine("Welcome to Choose your adventure!"); Console.WriteLine(); Console.WriteLine("Out of the 5 Stories, which one would you like to play?"); string stro_sel = Console.ReadLine(); Story GameStory = new Story(1); } } } </code></pre> <p>Any help apreciated! Thanks!</p> <p>Warning: Please mind my English grammar and note that I had to copy and paste the code and make it look neat(because the whitespace was terrible when I pasted it in). That could explain why it might look sloppy without whitespace.</p> <p>Another sidenote is that this is not a duplicate because the other questions on this topic did not awnser my question nor did it help me solve my programming problem. My problem takes a statement into object oreinted programming(with classes and methods) and uses switch statements. The previous questions on this topic has unique problems that I did not face, and by asking this I am trying to resolve my issue, not a general issue on the error, but what I did wrong in my code.</p> <p>In best regards, thanks.</p>
<c#>
2019-11-05 23:16:55
LQ_CLOSE
58,726,258
How to convet dict with object as value to dataframe?
I have a Dict with object as value and I want to create from it a DF (ignore the Nans) list_of_actors[key] = value key -> string value -> Actor() ``` class Actor: def __init__(self,title,link): self.link = link self.title = title self.count = 1 self.yearOfBirth ="NaN" self.countryOfBirth ="NaN" self.numberOfAwards = "0" ``` ``` columns = ['Name', 'Year of birth', 'Country of birth', 'Awards'] ``` Name = self.title Year of birth = self.yearOfBirth Country of birth = self.countryOfBirth Awards = self.numberOfAwards
<python>
2019-11-06 08:52:38
LQ_EDIT
58,727,954
jquery prepend item once per div
I have tried searching and can only find half an answer for my issue. I have a dynamic select function and when a click is performed I want a prepend to happen but only once per div it within. ``` var selGroup = $(".selected-results > .results-group"); if (!$('.selected-results > .results-group > .results-category').length) { selGroup.prepend('<li class="results-category" data-class="'+ category +'">'+ category +'</li>'); return true; } else { } ``` This so far just adds in the prepend every time. I just cant figure it out. Any advice is appreciated, thank you
<jquery><prepend>
2019-11-06 10:25:11
LQ_EDIT
58,731,184
ERRO[0043] failed to dial gRPC: unable to upgrade to h2c, received 501
<p>When I tried building my Dockerfile with <code>docker build -t myimage1 .</code> today I got this error:</p> <pre><code>ERRO[0043] failed to dial gRPC: unable to upgrade to h2c, received 501 context canceled </code></pre> <p>I have successfully built this image before although it was a couple of weeks ago. I am not sure whether Docker has been updated in the meantime.</p> <p>I found a similar error (although not the same - it is error 0044 while mine is 0043) at <a href="https://stackoverflow.com/questions/55308947/erro0044-failed-to-dial-grpc-cannot-connect-to-the-docker-daemon/58731161#58731161">ERRO[0044] failed to dial gRPC: cannot connect to the Docker daemon</a></p>
<docker>
2019-11-06 13:22:39
HQ
58,731,802
Alt+D shortcut key unable to overriade in edge
I am unable to override the alt+d key in javascript edge browser remaining all browsers working
<javascript><jquery><microsoft-edge>
2019-11-06 13:56:27
LQ_EDIT
58,732,021
Symfony show newest posts except currently opened
<p>I have a template which renders newest posts. If I open one post from them, it is still showing it. I either need to get id of the currently opened post from the url or somehow filter the post in controller or with query builder. I won't provide any code for now because I don't know what you'll need to help me. Please ask for additional code if needed. Thanks</p>
<symfony><url><get><unique><id>
2019-11-06 14:10:16
LQ_CLOSE
58,732,081
What CIDR address do not overlaps with 10.0.0.0/16?
<p>I ahve created aws VPC and try to create additional CIDR. I have always got overlaps error whever values I tried <code>/8</code>, <code>/0</code>, <code>/16</code>, <code>/32</code>:</p> <p><a href="https://i.stack.imgur.com/UU9aV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UU9aV.png" alt="enter image description here"></a></p> <p>What are correct values?</p>
<amazon-web-services><networking><amazon-vpc><cidr>
2019-11-06 14:13:17
LQ_CLOSE
58,732,836
File Saveas xls to xlsx
I have an excel file in the **C** disk named **C:\Book1.xls** How can I saveas **C:\Book1.xls** to **C:\Book2.xlsx** ? Is it possible to use **System.IO.File.SaveAs** class?
<vb.net>
2019-11-06 14:52:46
LQ_EDIT
58,735,374
How to disable the "did you mean ..." suggestions in gcc?
Besides forced colors by default (which could be turned with `GCC_COLORS=`), newer gccs come with another irritating misfeature: they try to second-guess me, and drown warnings about real problems with "did you mean?" google / artificial stupidity -like spam garbage. Example: ``` $ gcc -Wall -c -o /dev/null -xc - <<'EOT' #include <stdlib.h> void foo(char *b, size_t z){ readlink("/foo", b, z); } EOT <stdin>: In function ‘foo’: <stdin>:3:30: warning: implicit declaration of function ‘readlink’; did you mean ‘realloc’? [-Wimplicit-function-declaration] ``` No baby, I did not mean `realloc`; I just forgot to include the `unistd.h` header. Is there any way to turn this OFF? eg have it print just `implicit declaration of function ‘readlink’ [-Wimplicit-function-declaration]`, without the helpful suggestion?
<c><gcc><compiler-warnings>
2019-11-06 17:15:03
LQ_EDIT
58,735,572
Is there a way to realize a function of type ((a -> b) -> b) -> Either a b?
<p>Propositions <code>(P -&gt; Q) -&gt; Q</code> and <code>P \/ Q</code> are equivalent.</p> <p>Is there a way to witness this equivalence in Haskell:</p> <pre><code>from :: Either a b -&gt; ((a -&gt; b) -&gt; b) from x = case x of Left a -&gt; \f -&gt; f a Right b -&gt; \f -&gt; b to :: ((a -&gt; b) -&gt; b) -&gt; Either a b to = ??? </code></pre> <p>such that</p> <p><code>from . to = id</code> and <code>to . from = id</code>?</p>
<haskell><logic>
2019-11-06 17:27:34
HQ
58,736,070
How can I implement social network login on Groovy/Grails?
<p>I am trying to implement Google and LinkedIn as well as regular mail login on my grails app.</p> <p>Do you have any recommendations on a plugin or any other particular way to do this?</p> <p>I'm using Grails 3.3.10.</p> <p>Thanks in advance</p>
<authentication><grails><groovy><spring-security><social>
2019-11-06 18:02:39
LQ_CLOSE
58,736,962
Python Flask- datetime.datetime has no attribute datetime
I keep having an issue with the module datetime at this section of the code whenever i run it, it should add the time to the alarm manager from the datetime-local input from the html part. But whenever the text and date are added an error of datetime.datetime is not an attribute of datetime. ``` import os import sched import time from flask import Flask, render_template, url_for, request , redirect, jsonify from flask_sqlalchemy import SQLAlchemy from datetime import datetime app=Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] ='sqlite:///tabledata.db' #relative path db = SQLAlchemy(app) class Table(db.Model): id = db.Column(db.Integer, primary_key=True) #refrencing id of each entry content = db.Column(db.String(50), nullable=True) #the content that holds date_created = db.Column(db.DateTime, default=datetime.utcnow) #print the date it was made alarm = db.Column(db.DateTime) #stores the alarm def __repr__(self): return '<Task %r>' % self.id #every new task made returns its own id @app.route('/',methods=['POST','GET']) #adding two methods posting and getting def index(): if request.method == 'POST': #submitting form task_content = request.form['content'] #create new task from user input alarm_content = request.form['alarm'] alarm_tmp = alarm_content.replace('T', '-').replace(':', '-').split('-') alarm_tmp = [int(v) for v in alarm_tmp] alarm_datetime = datetime.datetime(*alarm_tmp) task = Table(content=task_content,alarm=alarm_content) #have the contents = input try: db.session.add(new_task) #add to database db.session.commit() return redirect('/') #redirect to input page except: return 'There was an error' else: tasks = Table.query.order_by(Table.date_created).all() #showing all contents on site return render_template('index.html',tasks=tasks) #user viewing the page if __name__ =="__main__": app.run(debug=True) #debugging true so errors are displayed ```
<python>
2019-11-06 19:05:26
LQ_EDIT
58,737,731
Developing a messenger
<p>So I’m developing a chat messenger app like WhatsApp but I’m trying to decide the best way to get the messages between phones. A lecturer of mine mentioned using a router but I couldn’t understand how that would work. Any ideas ? </p>
<java><server><widget><chat><messenger>
2019-11-06 20:06:01
LQ_CLOSE
58,737,769
<androidx.fragment.app.FragmentContainerView> vs <fragment> as a view for a NavHost
<p>When using <code>androidx.fragment.app.FragmentContainerView</code> as a navHost instead of a regular <code>fragment</code> app is not able to navigate to a destination after orientation change.</p> <p>I get a following error: <code>java.lang.IllegalStateException: no current navigation node</code></p> <p>Is there a gotcha that I should know about to use it properly or is my way of using nav components is incorrect? </p> <p>Simple activity xml with a view:</p> <pre><code> ... &lt;androidx.fragment.app.FragmentContainerView android:id="@+id/nav_host_fragment" android:name="androidx.navigation.fragment.NavHostFragment" android:layout_width="match_parent" android:layout_height="match_parent" app:defaultNavHost="true" app:layout_behavior="@string/appbar_scrolling_view_behavior" app:navGraph="@navigation/nav_simple" /&gt; ... </code></pre> <p>Navigation code:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;navigation xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/nav_legislator.xml" app:startDestination="@id/initialFragment"&gt; &lt;fragment android:id="@+id/initialFragment" android:name="com.example.fragmenttag.InitialFragment" android:label="Initial Fragment" tools:layout="@layout/initial_fragment"&gt; &lt;action android:id="@+id/action_initialFragment_to_destinationFragment" app:destination="@id/destinationFragment" /&gt; &lt;/fragment&gt; &lt;fragment android:id="@+id/destinationFragment" android:name="com.example.fragmenttag.DestinationFragment" android:label="Destination Fragment" tools:layout="@layout/destination_fragment" /&gt; &lt;/navigation&gt; </code></pre> <p>Here is a github repo where you can easily reproduce a bug: <a href="https://github.com/dmytroKarataiev/navHostBug" rel="noreferrer">https://github.com/dmytroKarataiev/navHostBug</a></p>
<android><navigation><android-architecture-components>
2019-11-06 20:09:25
HQ
58,738,756
Using reduce function fror json respone
I have the following JSON: ``` { "meta": { "totalPages": 13 }, "data": [{ "type": "articles", "id": "3", "attributes": { "title": "AAAAA", "body": "BBBB", "created": "2011-06-22T14:56:29.00z", "updated": "2011-06-22T14:56:28.00z" } }], "links": { "self": "http://example.com/articles?page[number]=3&page[size]=1", "first": "http://example.com/articles?page[number]=1&page[size]=1", "prev": "http://example.com/articles?page[number]=2&page[size]=1", "next": "http://example.com/articles?page[number]=4&page[size]=1", "last": "http://example.com/articles?page[number]=1&page[size]=1" } } ``` Suppose I'm getting this Json as response from a web server, is there a way somehow to use [reduce()](https://www.w3schools.com/jsref/jsref_reduce.asp) method here? I tried like: ``` $.ajax({ url:"http://...", type: "GET", headers:{"application/vnd+json"}, success: function(data){ var r = data.cells.reduce(function(array, object) { return array.concat(object.type); }, {}); console.log(r); } )}; ``` Is it possible at all to use reduce here? My task is to use reduce function for the given Json my AJAX is ok?
<javascript><ajax>
2019-11-06 21:28:46
LQ_EDIT
58,739,129
How to create reusable button component with vanilla js and sass?
<p>I have to make a reusable button component with vanilla js and scss, but I haven't done it yet. Can somebody explain how could I do it ? I am new at this so I don't know where to look for it.</p> <p>Update: Do I have to use javascript or can I use only HTML and SCSS/CSS for it?</p>
<javascript><html><css><sass><web-component>
2019-11-06 21:59:53
LQ_CLOSE
58,742,153
How can I get `sed`-like behavior from within python when running windows?
The beginnings of a solution are shown below. If someone would complete it and get it working, I would be eternally grateful. import subprocess import os import sys def sed(stryng, istream=None, ostream=None): if sys.platform == "linux": subprocess.run(["sed", stryng]) subprocess.call(['sed', 's/\"//g', inp], stdout=out_file) elif os.name == 'nt': # if running Windows lead_up = "@ powershell - Command get-content somefile.txt | %{{$_ -replace " expression = "" replacement = "" subprocess.run(lead_up + f"\"\"{expression}\",\"{replacement}\"}}") else: raise NotImplementedError() Usage: in_file = open("report_new.txt", "r") out_file = open("report_new.txt", "w") sed("'s/Nick/John/g'", in_file, out_file) out_file.close() in_file.close()
<python><python-3.x><powershell><sed>
2019-11-07 04:50:52
LQ_EDIT
58,742,815
Swift 5: 'substring(to:)' is deprecated
<p>I`m newbie in Swift and I have simple code, that cut string from the end to special characters "$2F" and returned cutted off string:</p> <pre><code> let index2 = favUrlString.range(of: "%2F", options: .backwards)?.lowerBound favUrlString = index2.map(favUrlString.substring(to:))! </code></pre> <p>How I have to update this code to Swift 5?</p>
<swift><swift4><swift5>
2019-11-07 06:03:23
LQ_CLOSE
58,743,333
React app stuck on "Starting the development server"
<p>I have a react app created by create-react-app. After running npm start (the start script is present in package.json as "start": "react-scripts start") the console says Starting the development server as usual and fires up the browser. But after this both the console and the browser do absolutely nothing indefinitely. No error or output. It simply does nothing.</p>
<reactjs><npm><create-react-app><react-scripts>
2019-11-07 06:48:54
HQ
58,744,679
Library to build animation like slack-demo
<p>I want to build an animation like the one in <a href="https://slackdemo.com/?vst=.1wl4q6p32ubd8c0zflxmi0kfn#Team" rel="nofollow noreferrer">slack-demo</a> page. Basically I am trying to demonstrate a feature of my Application with animation. I can do so using Vanilla JS and CSS. But it will be a lot of code and difficult to maintain. </p> <p>What library/Framework can I use to build animation like slack-demo? </p>
<javascript><html>
2019-11-07 08:28:55
LQ_CLOSE
58,746,135
How do I fix this overflow problem without setting any height?
<p>I have been working on this interface for few days using bootstrap4 and I cant get this one div to get a scrollbar without setting height in px's. Also a guide toward managing one page design? Following is the link to the HTML code.</p> <p><a href="https://www.codeply.com/p/xm4bUOWFVh" rel="nofollow noreferrer">https://www.codeply.com/p/xm4bUOWFVh</a></p>
<html><css><bootstrap-4>
2019-11-07 09:56:29
LQ_CLOSE
58,746,632
The Drop down component is not shown
i am filtering certain cities into "citiesList" and then mapping them into dropdown component but the filter is done but map part is not excetued. citySearched= (cities,city)=>{ let citiesList= [...cities]; citiesList= citiesList.filter(c => c.name.toLowerCase().includes(city.toLowerCase())) .map(c => (<DropDown key= {c.id} citySearch= {c.name}/>)); console.log(citiesList,city); }
<reactjs>
2019-11-07 10:23:12
LQ_EDIT
58,747,128
ALGUIN ME PUEDE DECIR EL ERROR AL CREAR EL USUARIO?
CREATE USER PEDRO IDENTIFIED BY USER BDT02 DEFAULT TABLESPACE CURSOS TEMPORARY TABLESPACE CURSOS QUOTA 10M ON CURSOS QUOTA UNLIMITED ON CURSOS
<sql><oracle>
2019-11-07 10:49:33
LQ_EDIT
58,747,860
typdef ignored on Visual Studio 2017
Really simple, this photo explains the problem, Visual Studio 2017 error: **variable "InputCode" is not a type name** [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/9Ojef.png
<c><visual-studio-2017>
2019-11-07 11:30:35
LQ_EDIT
58,747,894
C# tertiary operator solve
<p>Can any one tell me the meaning of the below C# code</p> <pre><code>true? para1:para2; </code></pre> <p>For example,</p> <pre><code>char x = 'A'; Console.WriteLine(true? x : 0); </code></pre> <p>The console prints 65</p> <p>I do not understand how it works.</p>
<c#>
2019-11-07 11:32:57
LQ_CLOSE
58,748,859
I want to find min/max value within for loop
<p>How to find the min / max value using for-loop. I searched this but did not find it.I want to some help.</p>
<java><for-loop>
2019-11-07 12:32:23
LQ_CLOSE
58,749,281
What is the difference betwwen the older alloctaor::construct and the new one and explicit constructor?
<p>As I know <code>std::allocator&lt;T&gt;::construct</code> takes only two parameters on older version of C++; the first is a pointer to raw, un-constructed memory in which we want to construct an object of type <code>T</code> and the second one is a value of element type to initialize that object. So the copy-constructor is invoked:</p> <pre><code>struct Foo { Foo(int, int) { cout &lt;&lt; "Foo(int, int)" &lt;&lt; endl; } /*explicit*/ Foo(int) { cout &lt;&lt; "Foo(int)" &lt;&lt; endl; } Foo(const Foo&amp;) { cout &lt;&lt; "Foo(const Foo&amp;)" &lt;&lt; endl; } }; int main(int argc, char* argv[]) { allocator&lt;Foo&gt; a; Foo* const p = a.allocate(200, NULL); // second parameter is required on C++98 but on C++11 it is optional // Foo* const p = a.allocate(200); // works fine on C++11 but not on C++98 a.construct(p, 5, 7); // works on C++ 11 and up but not C++98 a.construct(p, 10);// works on both a.destroy(p); a.destroy(p + 1); a.deallocate(p, 200); std::cout &lt;&lt; std::endl; } </code></pre> <ul> <li><p>Why on C++98 <code>a.construct(p, 10)</code> calling the copy constructor but on C++11 and above is calling just the constructor that takes an integer?</p></li> <li><p>Does this mean on C++ 11 because of some Copy-elision optimization even if the constructor <code>Foo(int)</code> is <code>explicit</code> works on such call: <code>a.construct(p, 5)</code> works on C++11 even the constructor is <code>explicit</code> what I am sure of is it doesn't works on C++98 if <code>Foo(int)</code> is <code>explicit</code>.</p></li> <li><p>If so then if I compile that statement with some sort of disabling <code>copy-elision</code> optimization will cause the compiler fail? Thank you.</p></li> </ul>
<c++><allocator>
2019-11-07 12:58:04
HQ
58,749,505
what is the difference between jax-rpc and jax-ws web services?
<p>what is the difference between jax-rpc and jax-ws web services?</p> <p>How to migrate legacy code using jax-rpc to jax-ws?</p>
<java><jax-ws><jax-rpc>
2019-11-07 13:10:58
LQ_CLOSE
58,749,788
Hyperledger fabric Rich Query: How to count number of record filtered by selector?
I'm making smart contract with Golang and I want to use Rich Query to get total count of records from CouchDB filtered by some selector like: `{\"selector\":{\"doc_type\": \"person\"}}` It is similar to: `select count(*) from tb where ...` as SQL query but how to do it with CouchDB? Can somebody help me please? Thanks
<couchdb><hyperledger-fabric><hyperledger-chaincode>
2019-11-07 13:28:07
LQ_EDIT
58,751,275
How to use new c# 8.0 features in Razor views
<p>I've updated my ASP.NET Mvc 5 web application to use the new c# 8.0 features through Visual Studio 2019 and everything works fine until I try to use these new features inside a Razor view.</p> <p>For example, if I try to use the new switch expression:</p> <pre class="lang-cs prettyprint-override"><code>@{ ViewBag.Title = "About"; var foo = 1; var bar = foo switch { 1 =&gt; "one", 2 =&gt; "two", _ =&gt; string.Empty }; } &lt;h2&gt;@ViewBag.Title.&lt;/h2&gt; &lt;h3&gt;@ViewBag.Message&lt;/h3&gt; &lt;p&gt;Use this area to provide additional information.&lt;/p&gt; </code></pre> <p>The compiler won't complain until I try to reach the page, giving me a compilation error.</p> <p><a href="https://i.stack.imgur.com/SDb21.png" rel="noreferrer"><img src="https://i.stack.imgur.com/SDb21.png" alt="Compilation error"></a></p> <p>I suspect that <code>Microsoft.CodeDom.Providers.DotNetCompilerPlatform</code> must be updated but it seems that there is no update available.</p> <p>Is there any way to use c# 8.0 language features in Razor views?</p>
<c#><asp.net-mvc><razor>
2019-11-07 14:49:12
HQ
58,752,047
How to reverse value of string array?
<p>Let's say I have this array :</p> <pre><code>fruits: string[] = ['banana', 'strawberry', 'kiwi', 'apple']; </code></pre> <p>How can I do to have :</p> <pre><code>fruits = ['ananab', 'yrrebwarts', 'iwki', 'elppa']; </code></pre>
<javascript><angular><typescript>
2019-11-07 15:31:50
LQ_CLOSE
58,754,825
How to stop the loop when the same values appear in the list in Python?
[enter image description here][1] [1]: https://i.stack.imgur.com/RmOKX.png Above my task. I have to stop the loop when the same items appear in the list then sum them. def squareA(a,b): res = [] z = 0 while z!= 3: res.insert(0,(a + z)**2) res.insert(0,(b - z)**2) z += 1 print(res) res = list(dict.fromkeys(res)) print(res) res = sum(res) return res a = 5 b = 6 print(squareA(a,b))
<python><python-3.x><list><math><while-loop>
2019-11-07 18:19:02
LQ_EDIT
58,756,840
How to you write this s = ( (n % 2 ) == 0 ? "0" : "1") +s; as an if-else statement?
<p>I have this method in java:</p> <pre><code>public static string intToBinary(int n) { string s = ""; while (n &gt; 0) { s = ( (n % 2 ) == 0 ? "0" : "1") +s; n = n / 2; } return s; } </code></pre> <p>I'd like to write it without the question mark. I tried this: </p> <pre><code>public static String intToBinary(int n) { String s = ""; while (n &gt; 0){ if ((n%2)==0) { s = "0"; } else { s = "1"; } s += s; n = n / 2; } return s; } </code></pre> <p>Doesn't seem to work though. Does anyone know why? </p> <p>Insight would be much appreciated. </p>
<java>
2019-11-07 21:00:11
LQ_CLOSE
58,756,860
Update MySQL root password - Ubuntu
<p>I want to update my MySQL password from <code>I9O*Kez</code> ---> <code>SO123*</code></p> <p>I perform these </p> <pre><code>mysql -u root -pI9O*Kez service mysql stop mysqld_safe --skip-grant-tables &amp; mysql -uroot use mysql; delete from user where User='root'; CREATE USER 'root'@'%' IDENTIFIED BY 'SO123*'; GRANT ALL PRIVILEGES ON * . * TO 'root'@'%'; </code></pre> <p>I kept getting </p> <pre><code>ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement </code></pre> <p>Am I doing these completely wrong ? </p> <p>It shouldn't be this difficult just to update a root password - right ?</p>
<mysql><linux><ubuntu><mysql-error-1064>
2019-11-07 21:01:06
LQ_CLOSE
58,757,075
how to get the json response back in the front end that I am sending from my backend?
I am sending this from the backend. ``` return res.status(404).json({ message: "User does not exist" }); ``` and handling the error on the frontend within the catch of my axios, but when I log the 'err' I get a network error rather than the message. How do I get the message? ``` .catch(err => { console.log(err) } ```
<javascript><node.js><reactjs><axios>
2019-11-07 21:20:58
LQ_EDIT
58,757,558
Xcode 11 XCUITest Failed to get matching snapshots: Error getting main window kAXErrorServerNotFound
<p>After building my app in Xcode 11 and running my suite of XCUITests I am getting many random failures with the following. </p> <p>Failed to get matching snapshots: Error getting main window kAXErrorServerNotFound</p> <p>No matter how long I increase timeouts the issues pop up intermittently. It seems to be having issues Snapshotting the UI hierarchy. Our tests pass consistently in Xcode 10.</p> <p>I have reinstalled Xcode. Deleted all simulators. Cleared derived data. Modified timeouts. Upgraded from Xcode 11.1 to Xcode 11.2.1. </p> <p>Thanks!</p> <p>  </p>
<ios><xcode><xctest><xcode11><xcuitest>
2019-11-07 22:05:35
HQ
58,761,528
3 decimal precision in Java
<pre><code> Float x = 4; Float answer = 4/16; </code></pre> <p>The answer for this is <code>0.25</code>, but I want to display the answer upto <strong>3 decimal places</strong>, like <code>0.250</code>.</p> <p>How to achieve that? Please help?</p>
<java>
2019-11-08 06:30:47
LQ_CLOSE
58,761,696
How To Setup Contact Form in Wordpress
I am new to WordPress and PHP. I am creating website and now i want to setup the contact form in it. I just want to set only functionality of contact form...i create a form using bootstrap which i don't want to change it. it is a requirements! So i want to get your help in like when the user fill the contact-form. I get the email.The basic requirement is to recieve email using from that contact form. I want to get this using my form. Kindly need help in this.
<php><wordpress><smtp><contact-form>
2019-11-08 06:44:55
LQ_EDIT
58,763,200
how to switch values between integers?
<p>So I need to switch between A and B without using another integer.</p> <p>I was able to do this easily with a third integer (tmp). Is there any way to do this without it?</p> <pre><code>int a = 53, b = 12, tmp = 0; tmp = a; a = b; b = tmp; </code></pre>
<c>
2019-11-08 08:48:25
LQ_CLOSE
58,763,267
Why doesn't this code work ??<!DOCTYPE html> <html> <head> <base target="_top"> </head> <body> Hello, World! </body> </html>
Does not perform this operation. When you run the code, the program outputs a blank page, and should display Hello, World !. Please correct the error!
<html>
2019-11-08 08:52:34
LQ_EDIT
58,764,673
Can You explain how it works?
It would be awesome if someone could give me a proper explanation of the code :) Code is working and I like it, however as I am learning Java, need to understand every bit of it. Thanks! Checked StringBuilder() - seems fine, However part inside the loop is not quite clear. public class SquareDigit { public int squareDigits(int n) { StringBuilder builder = new StringBuilder(); while(n > 0) { int digit = n % 10; int square = digit * digit; builder.insert(0, square); n = Math.floorDiv(n, 10); } return Integer.valueOf(builder.toString()); } }
<java><math><stringbuilder>
2019-11-08 10:21:51
LQ_EDIT
58,765,445
How can I run a c++ script in debug in visual studio code?
<p>I have to run a c++ script in debug on Visual Studio Code, but I'm not able to do it. It says me that It is not able to find the file raise.c</p> <p>Unable to open 'raise.c': Unable to read file (Error: File not found (/build/glibc-B9XfQf/glibc-2.28/sysdeps/unix/sysv/linux/raise.c)).</p> <p>What is the problem?</p>
<c++><debugging><raise>
2019-11-08 11:11:17
LQ_CLOSE
58,766,245
When to use GO sync.Mutex with net/http and gorilla/mux?
As far as I know, the "net/http" package uses goroutines for the handlers. Is it necessary that I lock even a map with sync.Mutex in order to prevent possible bugs in the "nextId" function cause the function could count an old state of the map? Here is my example code: package main import ( "net/http" "github.com/gorilla/mux" "io/ioutil" "fmt" ) var testData = map[int]string { 1: "foo", 2: "bar", } func main() { r := mux.NewRouter() r.HandleFunc("/data", getData).Methods("GET") r.HandleFunc("/data", addData).Methods("POST") http.ListenAndServe(":3000", r) } func getData(writer http.ResponseWriter, request *http.Request) { for k, v := range testData { fmt.Fprintf(writer, "Key: %d\tValue: %v\n", k, v) } } func addData(writer http.ResponseWriter, request *http.Request) { if data, err := ioutil.ReadAll(request.Body); err == nil { if len(data) == 0 { writer.WriteHeader(http.StatusBadRequest) return } id := nextId() testData[id] = string(data) url := request.URL.String() writer.Header().Set("Location", fmt.Sprintf("%s", url)) writer.WriteHeader(http.StatusCreated) } else { writer.WriteHeader(http.StatusBadRequest) } } func nextId() int { id := 1 for k, _ := range testData { if k >= id { id = k + 1; } } return id }
<go>
2019-11-08 12:03:32
LQ_EDIT
58,768,189
How do you make dnace moves in roblox studio
I have tryed lots of times to make it work but i just cant do it.
<lua>
2019-11-08 14:12:05
LQ_EDIT
58,768,890
HTML & CSS formatting bug when printing web page
I am attempting to print a web page via Ctrl-P or right-click print so I can save it as a PDF. Up until several minutes ago, this was working flawlessly. I have made some minor sizing edits to the grid I am working with on the page and now when I attempt to print, the web page is displaying some formatting glitches on the preview screen. The problem is shown below. There are various borders missing from the grid and this is carrying over to the PDF when fully saved. [![Glitched web page][1]][1] [1]: https://i.stack.imgur.com/oEhby.png
<html><css>
2019-11-08 14:54:17
LQ_EDIT
58,769,580
To import Sass files, you first need to install node-sass
<p>Running create-react-app, I get the error in my create-react-app application:</p> <blockquote> <p>To import Sass files, you first need to install node-sass. Run <code>npm install node-sass</code> or <code>yarn add node-sass</code> inside your workspace.</p> </blockquote> <p>I do have node-sass installed. </p> <p>package.json:</p> <pre><code> "devDependencies": { "node-sass": "^4.13.0" } </code></pre> <p>project node_modules folder:</p> <p><a href="https://i.stack.imgur.com/VcL3X.png" rel="noreferrer"><img src="https://i.stack.imgur.com/VcL3X.png" alt="enter image description here"></a></p> <p>I've uninstalled, reinstalled, updated, cleaned cache, etc. How do I fix?</p>
<node.js><sass><create-react-app><node-sass>
2019-11-08 15:35:16
HQ
58,769,678
Trying to download and install with apt-get with specified directory
<p>I am trying to do <code>sudo apt-get --download-only &lt;package_name&gt; ??target_directory??</code> but i want to specify the download location so that, in future i want to install my pre-downloaded package without internet connection with <code>sudo apt-get --no-download &lt;package_name&gt; ??target_directory??</code>. The problem here is, I want to choose the target directories as '/user/desktop/blabla' but don't know how to specify it with apt-get.</p> <p>If you can help me, I will be grateful :) Have a nice day.</p>
<linux><ubuntu><debian><apt><apt-get>
2019-11-08 15:40:31
LQ_CLOSE
58,771,856
Quill Angular Error: NullInjectorError: No provider for InjectionToken config
<p>I updated all my node modules and when quill updated, all my editors broke in my application. The error "NullInjectorError: No provider for InjectionToken config!" appeared.</p> <p>I Have fixed this problem! Just wanted to share with other ppl who might be in the same boat.</p> <p>You need to add the QuillModule (import { QuillModule } from 'ngx-quill';) to the App Module 'Imports' section (or whatever module you are using). For me, I also needed to add .forRoot() to make it work</p> <pre><code>imports: [ QuillModule.forRoot(), ], </code></pre> <p>Again, this works for me, just letting you all know in case you encounter the same problem updating ngx-quill to the newest version</p>
<angular><quill><ngx-quill>
2019-11-08 18:16:27
HQ
58,773,784
Declare URL in Swift
<p>I'm trying to declare a URL variable but it's giving me the error:</p> <p><code>Cannot use instance member 'url' within property initializer; property initializers run before 'self' is available</code></p> <p>I'm trying to create a hard coded data so it's fine to write is inside the array, is there a way to do so?</p> <p>For example inside the array I have many strings <code>"myString"</code>, can I do that with the URL?</p> <p>This is my code:</p> <pre><code>class UserSalonViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { // This is the view to display all posts from all Authors @IBOutlet var allPostsTableView: UITableView! // var posts = [UserPosts]() let url = URL(string: "https://duckduckgo.com/")! var posts = [ UserPosts(author: "Arturo", postTitle: "Hello World", postDescription: "First Post", postUrl: url, postAddress: "1 NW 1 ave") ] override func viewDidLoad() { super.viewDidLoad() ... </code></pre> <p>What can I do?</p>
<swift>
2019-11-08 21:04:20
LQ_CLOSE
58,773,831
ConcurrentDictionary AddOrUpdate method(C#) throwing Index was outside the bounds of the array
Looks like objects are trying to get added to the HashSet at the same time and throwing this error. Is there any solution for this ? System.IndexOutOfRangeException: Index was outside the bounds of the array. at System.Collections.Generic.HashSet`1.SetCapacity(Int32 newSize, Boolean forceNewHashCodes) at System.Collections.Generic.HashSet`1.AddIfNotPresent(T value) at Raj.OPS.Common.Test.<>c__DisplayClass38_0.<SetOrAddKey>b__1(mKey key, HashSet`1 alloc) in at System.Collections.Concurrent.ConcurrentDictionary`2.**AddOrUpdate**(TKey key, Func`2 addValueFactory, Func`3 updateValueFactory)
<c#><multithreading><hashset><concurrentdictionary>
2019-11-08 21:09:50
LQ_EDIT
58,774,579
Updating multiple MYSQL rows with one submit button
<p>i was trying to updating multiple MYSQL rows with one submit button,</p> <p>before i used to create submit for each row, but since i have a lot of rows now i need to update them all together</p> <p>index.php</p> <pre><code>&lt;?php if (mysqli_num_rows($row){ while($row1= mysqli_fetch_assoc($row){ id&lt;input type="text" value="&lt;?php echo $row["id"];?&gt;" name='id' id="id" &gt; id&lt;input type="text" value="&lt;?php echo $row["name"];?&gt;" name='name' id="name" &gt; } &lt;button type="submit" formaction="update.php"&gt; submit &lt;/button&gt; } </code></pre> <p>update.php</p> <pre><code> $id= $_POST['id']; $name= $_POST['name']; $sql = "UPDATE `$tabelname` SET name='$name' WHERE id='$id'"; </code></pre> <p>its updating the first row only</p>
<php><mysql><loops><form-submit>
2019-11-08 22:34:53
LQ_CLOSE
58,777,256
I want create Object in array java
Shape[] sa = new Shape[10]; for(int i = 0; i < sa.length; i=i+2) { sa[i] = new Circle(); sa[i].setRadius(2); } so i wanted to set some part of the class "shape" to Class "Circle" but it kept giving me errors[enter image description here][1] [1]: https://i.stack.imgur.com/qayot.png
<java><arrays><loops><class><object>
2019-11-09 07:21:38
LQ_EDIT
58,777,299
Boostrap - My table can't read a local json file
i don't know, i can't read some json file ou put a table which read json data (internal or external source) Someone have an idea ? here is my link and script i used <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.10.1/bootstrap-table.min.css"> <script src="https://unpkg.com/bootstrap-table@1.15.5/dist/bootstrap-table.min.js"></script> Here is my script where I create the table, i use data-url to load the data from a local json file <table id="table" data-toggle="table" data-height="460" data-search="true" data-url="data.json"> <thead> <tr> <th data-field="id">#</th> <th data-field="oeuvre" data-search-formatter="false" data-formatter="nameFormatter">Oeuvres</th> <th data-field="type" data-formatter="nameFormatter">Type</th> <th data-field="artist" data-formatter="nameFormatter">Artiste</th> <th data-field="sheet" data-formatter="nameFormatter">Fiche</th> </tr> </thead> </table> <script> $table.bootstrapTable('refresh',{data: data}) }) function nameFormatter(value) { return 'Formatted ' + value } var $table = $('#table') $(function() { var data = [ {"id":1,"oeuvre":"choppe","type":"Ambre","artist":"Etienne","sheet":"<a href=\"description.html\">"} ] $table.bootstrapTable({data: data}) }) </script> i really don't know why it doesn't work... thanks in advance
<javascript><html><bootstrap-4>
2019-11-09 07:30:36
LQ_EDIT
58,779,375
What does the output which I get from printf("%d") mean?
<p>I tried a code today and noticed that printf("%d") still have an output. On my computer I get a output of "1487504216". I would like to know why I gets a output and what the output means. The following is the code I have tried.</p> <pre><code>#include &lt;stdio.h&gt; int main() { printf("%d"); return 0; } </code></pre>
<c><printf><stdio>
2019-11-09 12:39:58
LQ_CLOSE
58,779,800
get only last record based on ids
<p>I am building chat app and I want to display only last record as per users Like I have sent 1000s message but I have only chatted with 10 people then I need to get the name of 10 people and last message whether they sent me or I sent them at last</p> <p><a href="https://i.stack.imgur.com/Eafex.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Eafex.png" alt="enter image description here"></a></p> <p>Please see above table and give me solution like I want to get only one record from the last two records. </p>
<php><mysql><database>
2019-11-09 13:36:01
LQ_CLOSE
58,779,906
Why does the expression 'a'>'b' return false in Python?
<p>print('a'>'b') Returns False similar to this print('a'>'A') Returns True</p>
<python><python-3.x>
2019-11-09 13:48:11
LQ_CLOSE
58,780,741
User lacks permission to complete this action. You need to have 'AddPackage'
<p>I get an error:</p> <pre><code>User XXX lacks permission to complete this action. You need to have 'AddPackage' </code></pre> <p>when trying to push a nuget package to Azure DevOps artifacts. I am the administrator This is the stage:</p> <pre><code> - stage: displayName: 'Release' condition: succeeded() jobs: - job: 'Publish' displayName: 'Publish nuGet Package' steps: - download: current artifact: $(PIPELINE_ARTIFACT_NAME) displayName: 'Download pipeline artifact' - script: ls $(PATH_PIPELINE_ARTIFACT_NAME) displayName: 'Display contents of downloaded articacts path' - task: NuGetAuthenticate@0 displayName: 'Authenticate in NuGet feed' - script: dotnet nuget push $(PATH_PIPELINE_ARTIFACT_NAME)/**/*.nupkg --source $(NUGET_FEED) --api-key $(NUGET_API_KEY) displayName: 'Uploads nuGet packages' </code></pre> <p>And the exact error:</p> <pre><code>error: Response status code does not indicate success: 403 (Forbidden - User '4a2eb786-540d-4690-a12b-013aec2c86e5' lacks permission to complete this action. You need to have 'AddPackage'. (DevOps Activity ID: XXXXXXX-6DF9-4A98-8A4E-42C556C6FC56)). ##[error]Bash exited with code '1'. Finishing: Uploads nuGet packages </code></pre> <p>The git repo is in GitHub. Not sure who is considered to be the user but I don't know which other permissions to modify</p>
<azure-devops><nuget><azure-pipelines><azure-artifacts>
2019-11-09 15:34:45
HQ
58,780,873
How i can call a funcktion without click button ? (visual studio c# 2017)
How i can call a funcktion without click button ? when i opened a form, i want to run a function without click any button. How i can run funcktion ? ``` int sayfa = 1; int kapasite = 20; public Form2() { InitializeComponent(); } private void sayfayi_goster(int Sayfa, int Kapasite) { textBox6.Text = Sayfa.ToString() + "/" + Kapasite.ToString(); } sayfayi.goster(sayfa,kapasite); // its not working !!! ```
<c#><winforms>
2019-11-09 15:48:38
LQ_EDIT
58,781,331
Delete all character in string by sequence solve with javascript
There is a string = "WORLD" now check to maintain the sequence W,O,R,L,D first delete W , then delete O, then delete R, then delete L, last delete D. You can use a delete button and a new word generator button. solve with javascript.
<javascript><string><button>
2019-11-09 16:37:15
LQ_EDIT
58,781,987
What are these errors while connecting to mySQL?
I am trying to make a user registration system using PDO in PHP and I'm unable to connect to the mySQL database. It always says access denied and there is some fatal error as well. I tried resetting mySQL and other things available on the internet but nothing worked. <?php class userClass { /* User Login */ public function userLogin($usernameEmail,$password) { $db = getDB(); $hash_password= hash('sha256', $password); $stmt = $db->prepare("SELECT uid FROM users WHERE (username=:usernameEmail or email=:usernameEmail) AND password=:hash_password"); $stmt->bindParam("usernameEmail", $usernameEmail,PDO::PARAM_STR) ; $stmt->bindParam("hash_password", $hash_password,PDO::PARAM_STR) ; $stmt->execute(); $count=$stmt->rowCount(); $data=$stmt->fetch(PDO::FETCH_OBJ); $db = null; if($count) { $_SESSION['uid']=$data->uid; return true; } else { return false; } } /* User Registration */ public function userRegistration($username,$password,$email,$name) { try{ $db = getDB(); $st = $db->prepare("SELECT uid FROM users WHERE username=:username OR email=:email"); $st->bindParam("username", $username,PDO::PARAM_STR); $st->bindParam("email", $email,PDO::PARAM_STR); $st->execute(); $count=$st->rowCount(); if($count<1) { $stmt = $db->prepare("INSERT INTO users(username,password,email,name) VALUES (:username,:hash_password,:email,:name)"); $stmt->bindParam("username", $username,PDO::PARAM_STR) ; $hash_password= hash('sha256', $password); $stmt->bindParam("hash_password", $hash_password,PDO::PARAM_STR) ; $stmt->bindParam("email", $email,PDO::PARAM_STR) ; $stmt->bindParam("name", $name,PDO::PARAM_STR) ; $stmt->execute(); $uid=$db->lastInsertId(); $db = null; $_SESSION['uid']=$uid; return true; } else { $db = null; return false; } } catch(PDOException $e) { echo '{"error":{"text":'. $e->getMessage() .'}}'; } } /* User Details */ public function userDetails($uid) { try{ $db = getDB(); $stmt = $db->prepare("SELECT email,username,name FROM users WHERE uid=:uid"); $stmt->bindParam("uid", $uid,PDO::PARAM_INT); $stmt->execute(); $data = $stmt->fetch(PDO::FETCH_OBJ); return $data; } catch(PDOException $e) { echo '{"error":{"text":'. $e->getMessage() .'}}'; } } } ?> These are the errors I'm getting. Connection failed: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) Fatal error: Uncaught Error: Call to a member function prepare() on null in C:\xampp\htdocs\auctionsystem\class\userClass.php:33 Stack trace: #0 C:\xampp\htdocs\auctionsystem\index.php(40): userClass->userRegistration('anurag', 'anurag123', 'anurag@email.co...', 'Anurag Pal') #1 {main} thrown in C:\xampp\htdocs\auctionsystem\class\userClass.php on line 33
<php><mysql>
2019-11-09 17:54:38
LQ_EDIT
58,785,802
What does directly setting a pointer with a variable means?
<p>PS, I know what a pointer is and how to use one, but confused on one thing. I have already tried searching stackoverflow on this question:</p> <pre><code>int *ptr = 20 //why illegal or seg fault or crash? printf("%i", *ptr) // Seg Fault printf("%i", ptr) // Output -&gt; 20 printf("%p", &amp;ptr) // Returns a valid address. </code></pre> <p>and found that, By directly assigning a value to a pointer without initializing with malloc or null, means that we are saying to the compiler, Hey CPU, Make a space in the memory to store an integer at the exact address given as value, which in this case 20. So basically saying to the compiler make a place for an INT in the ram with the address 20. By doing this we are touching system memory or illegal space.</p> <p>But what I don't get is, </p> <ol> <li><blockquote> <p>How the integer 20 can directly be referenced as a memory?</p> </blockquote></li> <li><blockquote> <p>What happens when we do the same for float or char? for example float *ptr = 20.25</p> </blockquote></li> <li><blockquote> <p>I tried directly converting c code to assembly with a website, for a legal and illegal pointer example, where I see that the same registers are called, same MOV operations are done, And no explicit "MAKE SPACE AT given ADDRESS" instructions were set.</p> </blockquote></li> <li>Lastly, What exactly happens when we declare strings by doing char *ptr = "Hello"?</li> </ol> <p>I have tried every possible way to understand this, but couldn't. Can you guys point me to the right direction? Thanks ...</p>
<c++><c><pointers><data-structures>
2019-11-10 04:45:06
LQ_CLOSE
58,786,268
Why it can work in windows but can't work in Linux?
<p>My code is as follows.</p> <p>When I use Visual Studio to compile , debug and execute, it's right. And when I use 'gcc' to compile , it's also right, but it's wrong when execute in Linux. The memory is wrong when it run.</p> <p>And when print 'szBuf', the wrong is can't access the memory.</p> <p>I want to know why it can work when in Windows but can't work in Linux?</p> <pre><code>#include &lt;stdio.h&gt; void ItoA(int nNum, char *pStr); void Print(const char *pFormat, ...); int main() { char ch = 'a'; int nNum = 11; char szBuf[255] = ""; Print("ch: %c\n", ch); Print("n: %d\n", nNum); Print("s: %s\n", szBuf); return 0; } void ItoA(int nNum, char *pStr) { if (NULL != pStr) { char szNum[255] = ""; int i = 0; for (i = 0; 0 != nNum; i++) { szNum[i] = nNum % 10 + '0'; nNum /= 10; } for (i = i - 1; i &gt;= 0; i--, pStr++) { *pStr = szNum[i]; } *pStr = '\0'; } } void Print(const char *pFormat, ...) { if (NULL != pFormat) { char *pTemp = (char *)&amp;pFormat; pTemp += 4; while ('\0' != *pFormat) { if ('%' == *pFormat) { pFormat++; switch (*pFormat) { case 'c': { putchar(*pTemp); pTemp += 4; } break; case 'd': { char szBuf[255] = ""; int nNum = 0; ItoA(*(int *)pTemp, szBuf); for (int i = 0; '\0' != szBuf[i]; i++) { putchar(szBuf[i]); } pTemp += 4; } break; case 's': { for (int i = 0; '\0' != (*(char **)pTemp)[i]; i++) { putchar((*(char **)pTemp)[i]); } pTemp += 4; } break; default: { pFormat--; putchar(*pTemp); } break; } } else { putchar(*pFormat); } pFormat++; } } } </code></pre>
<c><linux>
2019-11-10 06:26:32
LQ_CLOSE
58,786,695
How to address 'OSError: libc not found' raised on Gunicorn exec of Flask app inside Alpine docker container
<p>I'm working on a Flask application based on the Microblog app from Miguel Grinberg's mega-tutorial. Code lives here: <a href="https://github.com/dnilasor/quickgig" rel="noreferrer">https://github.com/dnilasor/quickgig</a> . I have a working docker implementation with a linked MySQL 5.7 container. Today I added an Admin View function using the Flask-Admin module. It works beautifully served locally (OSX) on Flask server via 'flask run' but when I build and run the new docker image (based on python:3.8-alpine), it crashes on boot with a <code>OSError: libc not found</code> error, the code for which seems to indicate <a href="https://github.com/benoitc/gunicorn/blob/438371ee90b9676336a44c7abaeb30ee7fc57a5c/gunicorn/socketfromfd.py#L26" rel="noreferrer">an unknown library</a></p> <p>It looks to me like Gunicorn is unable to serve the app following my additions. My classmate and I are stumped!</p> <p>I originally got the error using the python:3.6-alpine base image and so tried with 3.7 and 3.8 to no avail. I also noticed that I was redundantly adding PyMySQL, once in requirements.txt specifying version no. and again explicitly in the dockerfile with no spec. Removed the requirements.txt entry. Also tried incrementing the Flask-Admin version no. up and down. Also tried cleaning up my database migrations as I have seen multiple migration files causing the container to fail to boot (admittedly this was when using SQLite). Now there is only a single migration file and based on the stack trace it seems like the <code>flask db upgrade</code> works just fine.</p> <p>One thing I have yet to try is a different base image (less minimal?), can try soon and update this. But the issue is so mysterious to me that I thought it time to ask if anyone else has seen it : )</p> <p>I did find <a href="https://bugs.python.org/issue28134" rel="noreferrer">this socket bug</a> which seemed potentially relevant but it was supposed to be fully fixed in python 3.8.</p> <p>Also FYI I followed some of the advice <a href="https://github.com/miguelgrinberg/microblog/issues/49" rel="noreferrer">here</a> on circular imports and imported my admin controller function inside <code>create_app</code>.</p> <p>Dockerfile:</p> <pre><code>FROM python:3.8-alpine RUN adduser -D quickgig WORKDIR /home/quickgig COPY requirements.txt requirements.txt RUN python -m venv venv RUN venv/bin/pip install -r requirements.txt RUN venv/bin/pip install gunicorn pymysql COPY app app COPY migrations migrations COPY quickgig.py config.py boot.sh ./ RUN chmod +x boot.sh ENV FLASK_APP quickgig.py RUN chown -R quickgig:quickgig ./ USER quickgig EXPOSE 5000 ENTRYPOINT ["./boot.sh"] </code></pre> <p>boot.sh:</p> <pre><code>#!/bin/sh source venv/bin/activate while true; do flask db upgrade if [[ "$?" == "0" ]]; then break fi echo Upgrade command failed, retrying in 5 secs... sleep 5 done # flask translate compile exec gunicorn -b :5000 --access-logfile - --error-logfile - quickgig:app </code></pre> <p>Implementation in <strong>init</strong>.py:</p> <pre><code>from flask_admin import Admin app_admin = Admin(name='Dashboard') def create_app(config_class=Config): app = Flask(__name__) app.config.from_object(config_class) ... app_admin.init_app(app) ... from app.admin import add_admin_views add_admin_views() ... return app from app import models </code></pre> <p>admin.py:</p> <pre><code>from flask_admin.contrib.sqla import ModelView from app.models import User, Gig, Neighborhood from app import db # Add views to app_admin def add_admin_views(): from . import app_admin app_admin.add_view(ModelView(User, db.session)) app_admin.add_view(ModelView(Neighborhood, db.session)) app_admin.add_view(ModelView(Gig, db.session)) </code></pre> <p>requirements.txt:</p> <pre><code>alembic==0.9.6 Babel==2.5.1 blinker==1.4 certifi==2017.7.27.1 chardet==3.0.4 click==6.7 dominate==2.3.1 elasticsearch==6.1.1 Flask==1.0.2 Flask-Admin==1.5.4 Flask-Babel==0.11.2 Flask-Bootstrap==3.3.7.1 Flask-Login==0.4.0 Flask-Mail==0.9.1 Flask-Migrate==2.1.1 Flask-Moment==0.5.2 Flask-SQLAlchemy==2.3.2 Flask-WTF==0.14.2 guess-language-spirit==0.5.3 idna==2.6 itsdangerous==0.24 Jinja2==2.10 Mako==1.0.7 MarkupSafe==1.0 PyJWT==1.5.3 python-dateutil==2.6.1 python-dotenv==0.7.1 python-editor==1.0.3 pytz==2017.2 requests==2.18.4 six==1.11.0 SQLAlchemy==1.1.14 urllib3==1.22 visitor==0.1.3 Werkzeug==0.14.1 WTForms==2.1 </code></pre> <p>When I run the container in interactive terminal I see the following stack trace:</p> <pre><code>(venv) ****s-MacBook-Pro:quickgig ****$ docker run -ti quickgig:v7 INFO [alembic.runtime.migration] Context impl SQLiteImpl. INFO [alembic.runtime.migration] Will assume non-transactional DDL. INFO [alembic.runtime.migration] Running upgrade -&gt; 1f5feeca29ac, test Traceback (most recent call last): File "/home/quickgig/venv/bin/gunicorn", line 6, in &lt;module&gt; from gunicorn.app.wsgiapp import run File "/home/quickgig/venv/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 9, in &lt;module&gt; from gunicorn.app.base import Application File "/home/quickgig/venv/lib/python3.8/site-packages/gunicorn/app/base.py", line 12, in &lt;module&gt; from gunicorn.arbiter import Arbiter File "/home/quickgig/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 16, in &lt;module&gt; from gunicorn import sock, systemd, util File "/home/quickgig/venv/lib/python3.8/site-packages/gunicorn/sock.py", line 14, in &lt;module&gt; from gunicorn.socketfromfd import fromfd File "/home/quickgig/venv/lib/python3.8/site-packages/gunicorn/socketfromfd.py", line 26, in &lt;module&gt; raise OSError('libc not found') OSError: libc not found </code></pre> <p>I'd like the app to boot/be served by gunicorn inside the container so I can continue developing with my team using the docker implementation and leveraging dockerized MySQL vs the pain of local MySQL for development. Can you advise?</p>
<python><docker><sockets><flask><gunicorn>
2019-11-10 07:47:01
HQ
58,787,059
why my python cannot read files on my desktop
I'm new here and in python. There are 2 questions I'd like to ask: 1) I'm reading a .dat file on my desktop into my spider, but it shows No such file or directory: 'C:\\Desktop\\movies.dat', but if I put the file into the default folder, 'C:\\Users\\User\\.spyder-py3\\movies.dat', it can read the file successfully. I thought that python3 can file the path in the quotes no matter if it is a default folder or not. 2) I've been reading some python books and in every beginning of each book, there is a chaper introducing Ipython and Jupyter orsomething like that, I don't quite understand what's the difference between, like, Anaconda, Spider, Jupyter notebook and Ipython. I'm currently using Spider and wondering what's the difference. Great thanks if anythong can help!
<python-3.x>
2019-11-10 08:54:54
LQ_EDIT
58,787,269
Gradle duplicate entry error: META-INF/MANIFEST.MF (Or how to delete a file from jar)
<p>I've cloned a github repository because I wanted to study the code, but when I tried to build it in Android Studio, I ran into some trouble. After adding the google maven repository (as prompted by Android Studio) and updating both the Gradle Plugin Version and the Grade Version (to 3.5.2 and to 5.4.1, respectively), the build fails because of the following error:</p> <blockquote> <p>Cause: duplicate entry: META-INF/MANIFEST.MF</p> </blockquote> <p>And this, to be more specific:</p> <blockquote> <p>Caused by: java.util.zip.ZipException: duplicate entry: META-INF/MANIFEST.MF</p> </blockquote> <p>Here is my project level build.gradle file:</p> <pre><code> buildscript { repositories { jcenter() google() } dependencies { classpath 'com.android.tools.build:gradle:3.5.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { jcenter() maven { url 'https://maven.google.com' } } } </code></pre> <p>Here's my module build.gradle file (before trying anything):</p> <pre><code> apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion '28.0.3' defaultConfig { applicationId "com.thelittlenaruto.supportdesignexample" minSdkVersion 11 targetSdkVersion 22 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation ('com.android.support:appcompat-v7:22.2.1') implementation ('com.android.support:design:22.2.1') implementation 'com.github.frankiesardo:linearlistview:1.0.1@aar' } </code></pre> <p>Here's what I've tried so far:</p> <ul> <li>Adding the following to the android section of my module build.gradle file:</li> </ul> <pre><code> sourceSets { main{ java{ exclude '**/META-INF/MANIFEST' exclude '**/META-INF/MANIFEST.MF' exclude 'META-INF/MANIFEST' exclude 'META-INF/MANIFEST.MF' exclude '!META-INF/MANIFEST.MF' } } } </code></pre> <ul> <li>Adding this:</li> </ul> <pre><code> sourceSets.main.res.filter.exclude 'META-INF/MANIFEST' sourceSets.main.res.filter.exclude 'META-INF/MANIFEST.MF' </code></pre> <ul> <li>Also this:</li> </ul> <pre><code> packagingOptions { apply plugin: 'project-report' exclude '**/META-INF/MANIFEST' exclude '**/META-INF/MANIFEST.MF' exclude 'META-INF/MANIFEST' exclude 'META-INF/MANIFEST.MF' exclude '!META-INF/MANIFEST.MF' } </code></pre> <ul> <li>And this:</li> </ul> <pre><code> packagingOptions { pickFirst '**/META-INF/MANIFEST' pickFirst '**/META-INF/MANIFEST.MF' pickFirst 'META-INF/MANIFEST' pickFirst 'META-INF/MANIFEST.MF' pickFirst '!META-INF/MANIFEST.MF' } </code></pre> <ul> <li>This:</li> </ul> <pre><code> aaptOptions { ignoreAssetsPattern "!META-INF/MANIFEST.MF" ignoreAssetsPattern "META-INF/MANIFEST.MF" } </code></pre> <p>I think I've tried mostly everything in this question: <a href="https://stackoverflow.com/questions/41899973/how-to-exclude-certain-files-from-android-studio-gradle-builds">How to exclude certain files from Android Studio gradle builds?</a></p> <p>Nothing worked.</p> <p>After searching for a solution, I think the problem is that I have duplicated dependencies. So I've tried the following:</p> <pre><code> dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation ('com.android.support:appcompat-v7:22.2.1'){ exclude module: 'support-v4' } implementation ('com.android.support:design:22.2.1') implementation 'com.github.frankiesardo:linearlistview:1.0.1@aar' } </code></pre> <p>And this:</p> <pre><code> dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation ('com.android.support:design:22.2.1'){ exclude module: 'support-v7' } implementation 'com.github.frankiesardo:linearlistview:1.0.1@aar' } </code></pre> <p>I still get the same error.</p> <p>Could anyone please tell me what I'm doing wrong? Thank you in anticipation. :)</p>
<android><android-studio><gradle><build.gradle>
2019-11-10 09:21:34
HQ
58,787,325
Caret in sql server
Consider the below query: Select Case when left(‘152rew’,5) not like ‘%[^A-Za-z]%’ then ‘true’ else ‘false’ end How ^ this is working in above sql statement as it is returning false. Can someone help me with this?
<sql><sql-server>
2019-11-10 09:32:07
LQ_EDIT
58,787,362
i am getting an error: local variable 'get_input_args referenced before assignment
def main(): # TODO 0: Measures total program runtime by collecting start time start_time = time() # creates and retrieves command Line Arguments in_arg = get_input_args() # Function that checks command line arguments using in_arg check_command_line_arguments(in_arg) # Creates pet image labels by creating a dictionary answers_dic = pet_labels() check_creating_pet_image_labels(answers_dic) # Creates classifier labels with classifier function, compares labbels and createsa results # dictionary result_dic = classify_images(in_arg.dir, answers_dic, in_arg.arch) # Function that checks results dictionary result_dic check_classifying_images(result_dic) # Adjusts the results dictionary to determine if classifier correctly classified images 'a dog' # or 'not a dog' adjust_results4_isadog(result_dic,in_arg.dogfile) # Function that checks results dictionary for is-a -dog adjustment - result-dic check_classifying_labels_as_dogs(result_dic) # Calculates results of run and puts statistics in results_stats_dic results_stats_dic = calculates_results_stats(result_dic) # Function that checks results stats dictionary - results_stats_dic check_calculating_results(result_dic,results_stats_dic) # Prints Summary results, incorrect classifications of dogs and breeds if requested prints_results(result_dic, results_stats_dic, in_arg.arch) # Measure total program runtime by collecting end time end_time = time() # Computes overall runtime in seconds and prints it hh:mm:ss format tot_time = end_time - start_time print('\n** Total elapsed runtime:', str(int((tot_time / 3600))) + ':' + str(int((tot_time % 3600) / 60)) + ':' +str(int((tot_time % 3600) % 60))) Traceback (most recent call last): File 'check_images.py' , line 417, in main in_arg = get_input_args() Unboundlocal error:Local variable 'get_input_args' referenced before assignment
<python-3.x>
2019-11-10 09:37:11
LQ_EDIT
58,789,832
A toast message is displaying on versions lower than Android M?
I have an Android app in production. Everything is working correctly but on Versions lower than Android M, in each activity i'm getting a toast message "not greater than M"? Is there anyone who can help me fixing this? I'm attaching a screenshot![![enter image description here][1]][1] [1]: https://i.stack.imgur.com/WP3R8.jpg
<android><performance><android-layout><android-intent>
2019-11-10 14:53:45
LQ_EDIT
58,790,537
i wrote this code it all works until it comes to setting the color i dont know what is wrong pleaseee
from swampy.TurtleWorld import * import random world = TurtleWorld() Turtle_1 = Turtle() print('*****Welcome to Sehir Minesweeper*****') print('-----First Turtle-----') Turtle_1 = input('Please type the name of the first Turtle:') print('Turtle 1 is' +' ' + Turtle_1) T1_color = input('Please choose turtle color for' + ' ' + Turtle_1 +' '+'(red, blue or green):') Turtle_1.color(T1_color)
<python><swampy>
2019-11-10 16:14:57
LQ_EDIT
58,793,066
How to summarize the employees by net revenue and not order date?
8. The sales director would like to reward the employees with net sales over $150,000 for the years 2015 and 2016 combined. The Sales Manager would like the resulting query to display the following columns: Employee ID, Employee Name (First and Last as one field), Total Net Sales per employee. (Both years should be combined into one number.) [enter image description here][1]Sort largest to smallest. We cannot figure out how to combine the revenues by the employees. select o.EmpID, EmpFName + ' ' + EmpLastName as "Employee Name", sum((salesunitprice*quantitysold)-((salesunitprice*quantitysold)*ItemDiscount)) as "Net Sales" from EMPLOYEE e inner join ORDERS o on e.EmpID=o.EmpID inner join SALES_INVOICE si on o.OrderID=si.OrderID inner join SALES_INVOICE_DETAIL sd on si.SalesInvoiceID=sd.SalesInvoiceID group by o.EmpID, EmpFName + ' ' + EmpLastName, OrderDate having OrderDate between '2015-01-01' and '2016-12-31' order by [Employee Name] I expected the output to be the total per employee, but it is broken out by individual order dates instead of summing the total net sales per employee. Please help! [1]: https://i.stack.imgur.com/MEkfH.png
<sql>
2019-11-10 21:25:11
LQ_EDIT
58,794,164
Conemu doesn't work with wsl since windows update
<p>Since I have updated windows, my conemu terminal is giving me the following error each time a session is created: </p> <pre><code>wslbridge error: failed to start backend process note: backend error output: -v: -c: line 0: unexpected EOF while looking for matching `'' -v: -c: line 1: syntax error: unexpected end of file ConEmuC: Root process was alive less than 10 sec, ExitCode=0. Press Enter or Esc to close console... </code></pre> <p>Has anyone an idea to bring conemu to a wsl terminal? Thank you</p>
<conemu><cmder>
2019-11-11 00:19:11
HQ
58,795,343
PHP: Mark as link values inside a string (a textarea string)
<p>I'm developing a wikipedia-like Web application. I want to show articles with the possibllity to link to other articles.</p> <p>The way to do it that I can think of, is to mark manually values as a sign for link, like this: " Hello |world| " ("world" would be the link for an article). later, i'll have to find inside the textarea string all the words marked with | on start and | on it's end. bottom line, some string functions are needed. </p> <p>How should I do that? can you, please, give me an example?</p> <p>Thank you in advance.</p>
<php><string><function>
2019-11-11 03:52:20
LQ_CLOSE
58,795,859
How to make custom text and styling
<p>I male website where user can make website profile. How can user from mywebsite can custom text and styling like make bold, coloring,etc ?</p>
<javascript><css><vue-cli-3>
2019-11-11 05:15:11
LQ_CLOSE
58,796,364
How to Remove Specific div using javascript
<p>can someone please tell me how to remove div element using javascript. I'm on a Shopify theme edit.</p> <p></p> <p>I need to this to be or </p>
<javascript><html><shopify><element>
2019-11-11 06:14:13
LQ_CLOSE
58,796,897
How to detect the presence of a scrollbar in the Dom using JavaScript?
<p>Is there a way to detect presence of scrollbar in the Dom measuring body height and window height in JavaScript? I want the syntax.</p>
<javascript><html><css>
2019-11-11 07:07:15
LQ_CLOSE
58,798,473
Simplify the following method
<p>The following method needs simplification so that lines become relatively small.</p> <pre><code> def rep(m): if m.group(0) == " " or m.group(0) == "_": return "[ _]" elif m.group(0) == "(" or m.group(0) == ")" or m.group(0) == "*" or m.group(0) == "+" or m.group(0) == "=" or m.group(0) == "?" or m.group(0) == "!" or m.group(0) == "^" or m.group(0) == "-": return "\\" + m.group(0) return re.sub(r"[ _()*+=?!^-]", rep, s) </code></pre>
<python><python-3.x><methods>
2019-11-11 09:15:09
LQ_CLOSE
58,798,617
How can I prove wether a char in a string is equal to a spepcific char?
I would like to prove wether the first character in my string is equal to "@". How can I do this? I'm using c# ``` if (string[1] == "<character>") { Console.WriteLine("TRUE"); } ```
<c#><string><if-statement><character>
2019-11-11 09:24:14
LQ_EDIT
58,801,191
VBA Code to copy specific range cells from multiple sheets to one sheet
I am new to VBA Coding hence this question here. I have tried with few samples but didn't work out. I have a master excel workbook in one folder and 100+ child excel workbook in different folder. Every week I need to copy specific range of cells from 100 + child excel work books (sheet name is same for all child books) to master workbook (specific sheet). Can someone help me with VBA Code?
<excel><vba>
2019-11-11 12:17:49
LQ_EDIT
58,801,801
How do i get elements from a file and read them to a list in python
<p>What i am trying to do is read from a file, and insert the content from a file into a list in python 3. the file should look like this:</p> <pre><code>♥A ♣A ♥Q ♠Q </code></pre> <p>and the result i am expecting when i read from the file is that when i print the specific list is that it shows up like this </p> <pre><code>['♥A', '♣A', '♥Q', '♠Q'] </code></pre> <p>How would i go about solving this?</p> <p>And i have tried multiple solutions for this, like using for loops, but i dont understand how to do this</p>
<python><python-3.x>
2019-11-11 12:55:06
LQ_CLOSE
58,802,332
Multiple or single API calls?
<p>I'm currently building an application using NodeJS and VueJs.</p> <p>I've build an API end point that gives me all the data I need. For example it could give me</p> <ol> <li>Best Football Team</li> <li>Worst Football Team</li> <li>Team with most goals</li> <li>Team with least goals</li> </ol> <p>Is it better to have this as one API call, and pass the relevant data to each Vue component using props, or as 4 different end points and then make the request in the relevant component.</p> <p>If you could explain why, that would be great!</p>
<javascript><node.js><vue.js><api-design>
2019-11-11 13:28:47
LQ_CLOSE
58,802,767
No “Proceed Anyway” option on NET::ERR_CERT_INVALID in Chrome on MacOS
<p>I try to get my local development in Chrome back running, but Chrome prevents that, with the message that the certificate is invalid. Even though it could not be the date of the certificate, as you can see in the screenshot of it:</p> <p><a href="https://i.stack.imgur.com/EDHew.png" rel="noreferrer"><img src="https://i.stack.imgur.com/EDHew.png" alt="enter image description here"></a></p> <p>I just wonder why there is no advanced > option to proceed anyway to see the website and being able to locally develop the app.</p> <p>A few more things to mention:</p> <ul> <li>The local development runs on <a href="https://local.app.somecompany.com:4200/" rel="noreferrer">https://local.app.somecompany.com:4200/</a>. It can't be just localhost, because otherwise our authentication http-only cookies won't work in Chrome.</li> <li>Therefore the host file under etc/hosts was adjusted to point to the localhost IP adress (127.0.0.1).</li> <li>The certificate was generated with openssl according to this <a href="https://medium.com/@rubenvermeulen/running-angular-cli-over-https-with-a-trusted-certificate-4a0d5f92747a" rel="noreferrer">tutorial</a> and this <a href="https://github.com/RubenVermeulen/generate-trusted-ssl-certificate" rel="noreferrer">repo</a></li> <li>The certificate works for a colleague with the exact same Chrome version but with a MacOS version 10.14.6 (mine right now is MacOS 10.15.1)</li> <li>The chrome flag(chrome://flags/#allow-insecure-localhost) does not change anything</li> <li>Also works in firefox on my laptop.</li> </ul> <p>Can't find anything online that helped me to solve this so far, so I would be extremly thankful, if anyone has some more ideas what I could try!?</p> <p>Specs:</p> <ul> <li>OS: MacOS 10.15.1</li> <li>Chrome: 78.0.3904.97</li> </ul>
<macos><google-chrome><ssl><localhost><macos-catalina>
2019-11-11 13:56:07
HQ
58,804,383
Não consigo enviar meu campo de data para o backend, está vindo como nulo! Uso o date-fns
- Tenho o meu frontend em React - Tenho o meu backend em Java - SpringBoot - O formato que meu backend entende é: 2011-10-05T14:48:00.000Z - Para isso, tentei usar o date-fns para enviar correto do front para o back, mas mesmo seguindo a documentação, minha data chega no backend como null e não cadastra. ``Salvar = async () => { const {update} = this.state; const {dtInclusao} = this.state.compra.dtInclusao var result = parse( dtInclusao, "dd/mm/yyyy", new Date() ) const response = await api.post('SolicCompra/compra', {...this.state.compra, dtInclusao: result}, {'Content-type': 'application/json'});`` Espero que minha data seja salva no formato dd/MM/yyyy
<javascript><reactjs><parsing><date-fns>
2019-11-11 15:36:33
LQ_EDIT
58,805,519
MacOS Catalina UDID Copy for iPhone
<p>How to copy UDID of the iPhone?</p> <p><a href="https://i.stack.imgur.com/w8ZvE.png" rel="noreferrer"><img src="https://i.stack.imgur.com/w8ZvE.png" alt="enter image description here"></a></p> <p>I want to register my iPhone as a tester within the Apple store account. So followed the steps as per the above image.</p> <p>But there is no way exist to copy the UDID and direct copy option, I can able to get only half UDID. Please check below image:</p> <p><a href="https://i.stack.imgur.com/r6nhX.png" rel="noreferrer"><img src="https://i.stack.imgur.com/r6nhX.png" alt="enter image description here"></a></p> <p>How to get full UDID copy in text form? So I can paste at the Apple store account.</p>
<ios><iphone><macos><app-store-connect><itunes-store>
2019-11-11 16:50:52
HQ