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 |
|---|---|---|---|---|---|
60,357,618 | how to find the address of a function in a c++ program | <p>i need to find the address of func in the stack so that if i provided a 32 long "A" string and then the function address in the stack i would get the Access granted </p>
<p>i remember i did it using <code>objdump</code> but i can't seem to figure it out </p>
<pre><code>#include <iostream>
using namespace std;
void func()
{
cout << "Access Granted \n";
}
int main()
{
char buff[20];
cin >> buff;
cout << buff;
return 0;
}
</code></pre>
<p>i tried immunity debugger but i was not successful </p>
| <c++><buffer-overflow> | 2020-02-22 22:56:23 | LQ_CLOSE |
60,357,718 | Why is int2word program only prining first ten lines? | <p>I am importing a file the counts in words from one to ninety-nine. The goal is to read each line and return an integer value corresponding to the word in the file. However, I cannot seem to figure out why my code is only working for the first ten numbers/lines?</p>
<pre><code>def word_to_int(w):
i = 0
ones = [[1,'one'], [2,'two'], [3,'three'], [4,'four'], [5,'five'], [6,'six'], [7,'seven'], [8,'eight'], [9,'nine']]
teens = [[10,'ten'], [11,'eleven'], [12,'twelve'], [13,'thirteen'], [14,'fourteen'], [15,'fifteen'], [16,'sixteen'], [17,'seventeen'], [18,'eighteen'],[19,'nineteen']]
tens = [[2,'twenty'], [3,'thirty'], [4,'forty'], [5,'fifty'], [6,'sixty'], [7,'seventy'], [8,'eighty'], [9,'ninety']]
if(w.find ('-') != -1):
a = w.split('-') #gets rid of hyphen and seperates parts
for first in tens:
if(a[0] == first[1]): #first half of word
i = first[0]*10
for second in ones:
if (a[1] == second[1]): #second half of word
i += second[0]
else:
for num in ones:
if w == num[1]:
i = num[0]
if(i == 0):
for num2 in teens:
if w == num2[1]:
i == num2[0]
if(i == 0):
for num3 in tens:
if w == num3[1]:
i = num3[0]*10
return i
</code></pre>
<p>any ideas?</p>
| <python><function> | 2020-02-22 23:10:43 | LQ_CLOSE |
60,357,733 | Image in javaFx Listview shows only when is selected | <p>i want to make a listview with an image, some text and a button pro column, but the image is only displayed when the column is selected(clicked). But i want the images/icons to be displayed independ from beeing selected/clicked...</p>
<pre><code>todoView.setCellFactory(new Callback<ListView<TodoView>, ListCell<TodoView>>() {
@Override
public ListCell<TodoView> call(ListView<TodoView> todoViewListView) {
ListCell<TodoView> cell = new ListCell<>() {
@Override
protected void updateItem(TodoView item, boolean empty) {
super.updateItem(item, empty);
if (item != null) {
setGraphic(item);
}
}
};
return cell;
}
});
</code></pre>
<p>(TodoView)item obj is an hbox with imageview, label and button...
any ideas?</p>
| <java><image><listview><javafx> | 2020-02-22 23:13:16 | LQ_CLOSE |
60,358,197 | I'm trying to get the title for this website using BeautifulSoup but i keep getting a type error, how do i fix this? | import requests
import bs4 as BeautifulSoup
page = requests.get('https://www.basketball-reference.com/friv/dailyleaders.fcgi')
soup = BeautifulSoup( page.content, 'html-parser')
print (soup.title)
I've done a similar code to this for class, however im trying to make a webscraper of my own to get the name of the website and the leading scorers in the NBA daily. but the first stwp i'm stuck on is getting the title of the page. | <python><beautifulsoup> | 2020-02-23 00:44:08 | LQ_EDIT |
60,359,787 | Using a single coordinates variable to select center in Google Maps JavaScript API | <p>I have a variable called coordinates that is formatted like this:</p>
<p><code>var coordinates = 'lat / lon';</code></p>
<p>I now want to extract the single lat and lon coordinate from that variable to display it as the center in a Google Maps API Map.
I have tried using slice to get the specific parts of the coordinates variable but depending on what coordinate it is the length is different, for example:</p>
<p><code>var coordinates = '49.7824 / 7.2413';</code><br>
<code>var coordinates = '8.5323 / -11.3336';</code></p>
<p>Is there any other way I could use those coordinates as the map center with the Maps API?</p>
| <javascript><variables><google-maps-api-3> | 2020-02-23 06:42:51 | LQ_CLOSE |
60,359,859 | copy column from table to table with condition | ALTER proc [dbo].[Timesheet_update]
as
begin
declare @sql2 nvarchar(max),@status nvarchar(1)
set @sql2='insert into s21022020 (s21_stfno) select m_stfno from master where m_status<>'D''
execute (@sql2)
end
execute Timesheet_update
Msg 207, Level 16, State 1, Line 23
Invalid column name 'D'.
m_status column contain data =D
| <sql-server><append> | 2020-02-23 06:56:17 | LQ_EDIT |
60,360,428 | Does this code read the first 10000 lines from a file? | <pre><code>def read_text(bz2_loc, n=10000):
with BZ2File(bz2_loc) as file_:
for i, line in enumerate(file_):
data = json.loads(line)
yield data["body"]
if i >= n:
break
</code></pre>
<p>I think it reads each line and return the result immediately, and when it reaches 10000 lines, it jumps out of the loop. This piece of code doesn't complete the reading of the whole file. Is that true?</p>
<p>If I want to read the whole file, and yield once for each 10000, how to modify it? </p>
| <python> | 2020-02-23 08:29:49 | LQ_CLOSE |
60,361,492 | Variable not being a variable with fwrite | <p>I wanted to ask, how I can write down a variable without it's getting detected as one.</p>
<p>As example:</p>
<pre><code>$data = <<< DATA
<?php
$dbServername = $_POST["admin"];
?>
DATA;
</code></pre>
<p>$dbServername shouldn't be a variable, but $_POST["admin"]; should be one.</p>
<p>I want, to write with fwrite the $_POST["admin"] variable into a document. But when $dbServername also gets detected as a variable, but it should be one, it throws errors.</p>
<p>Any Idea how to fix this?</p>
| <php><fwrite> | 2020-02-23 10:58:52 | LQ_CLOSE |
60,361,671 | Angular 6: How can we add a function to the global namespace? | <p>My requirement is that I need to add a function to the global namespace in an Angular 6 project. This function should then be able to be called from the browser console.</p>
| <javascript><html><css><angular><typescript> | 2020-02-23 11:23:27 | LQ_CLOSE |
60,362,626 | Is it possible to make money with ads if you have few users? | <p>Hello everyone let's say I just published my app at the App Store and set some interstitial ads from Ads mob, If first ”app downloader” or user sees my ad will I make money or there is some kind of fixed quantity of users from where I can make some income? Or maybe it depends on another things which I do not know, please tell me about that advertisement stuff))</p>
| <ios><swift><admob><ads><interstitial> | 2020-02-23 13:24:14 | LQ_CLOSE |
60,362,871 | Error ArrayIndexOutOfBoundsException on android | <p>i create login and register </p>
<p>build and run working but after register filed name if use put name surname it working can register but if i put onlu name no have surname don't work error </p>
<pre><code>String name = nameField.getText().toString().trim();
if (email != null && email.length() == 0 && !android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches()) {
emailField.setError(getString(R.string.com_parse_ui_no_email_toast));
} else if (name != null && name.length() == 0 && config.isParseSignupNameFieldEnabled()) {
nameField.setError(getString(R.string.com_parse_ui_no_name_toast));
} else if (dateCheck == null) {
mBirthday.setError(getString(R.string.signup_user_date));
} else if (password.length() == 0) {
passwordField.setError(getString(R.string.com_parse_ui_no_password_toast));
} else if (password.length() < minPasswordLength) {
passwordField.setError(getResources().getQuantityString(R.plurals.com_parse_ui_password_too_short_toast, minPasswordLength, minPasswordLength));
} else if (gender == null){
showToast(getString(R.string.gender_missing));
} else {
String[] parts = name.split(" ");
String firstName = parts[0];
String lastName = parts[1];
String username = (lastName+firstName).toLowerCase().trim().replaceAll(" ", "");
User user = ParseObject.create(User.class);
</code></pre>
| <java><android> | 2020-02-23 13:50:43 | LQ_CLOSE |
60,363,274 | cut the text length as the screen gets smaller | I want the text length to shrink when the screen gets smaller
`<div class="dress-card hvr-bob">
<div class="dress-card-head">
<img class="dress-card-img-top" src="img/rdr2.jpg" alt="">
</div>
<div class="dress-card-body">
<h2 class="dress-card-title">Red Dead Redemption 2</h2>
<p class="dress-card-para">Social Club Key</p>
<p class="dress-card-para"><span class="dress-card-price">200TL  </span><!--<span class="dress-card-crossed">300TL</span><span class="dress-card-off"> İndirim!</span>--></p>
<div class="row">
<div class="col-md-6 card-button"><a style="text-decoration: none;" href=""><div class="card-button-inner bag-button"><i class="fas fa-shopping-cart"></i> Satın Al</div></a></div>
<div class="col-md-6 card-button"><a style="text-decoration: none;" href=""><div class="card-button-inner wish-button"><i class="fas fa-shopping-basket"></i> Sepete Ekle</div></a></div>
</div>
</div>
</div>
</div>`
help | <html><css> | 2020-02-23 14:36:12 | LQ_EDIT |
60,364,077 | why is this SQL shown invalid.? | create table paydetails
( emp_id integer (20),
dept_id integer (20),
basic integer(20),
deductions integer(20),
additions integer (20),
joining_date date(20,20,20)); | <sql> | 2020-02-23 15:58:59 | LQ_EDIT |
60,364,950 | How To Can I Restrict The User From Entering More Than 1 Digit In Python 3 | <p>In,</p>
<pre><code>a=int(input("Enter A Integer: "))
</code></pre>
<p>How Can I Prevent The User From Entering More Than 4 Digits In This Input</p>
| <python><python-3.x> | 2020-02-23 17:33:07 | LQ_CLOSE |
60,365,790 | How to show all images in a folder? | <p>I'm trying to make a page where I can share pictures. For the time being, I'm not using a database, just uploading them into my htdocs. All of my pictures will be PNG, and saved in a folder called <code>myimages</code>. I want a page to list all of these images, if it's possible.
Thanks for the help!</p>
| <php><html><png> | 2020-02-23 19:06:21 | LQ_CLOSE |
60,366,329 | How can I solve this problem with arrays in C++? (Beginner level.) | I am an enthusiast programmer, but I don't know much of arrays in C++. I have found page Edabit for small challenges. I am now working on the challenge: Get arithmetic mean of the given array. Now I have code like that:
```c++
#include <iostream>
int data;
using namespace std;
int mean(int data);
int main()
{
int data[] = { 1, 2, 3, 4 };
cout << mean(data);
}
int mean(int data)
{
double mean = 0;
for (int i = 0; i < sizeof(data) / sizeof(data[0]); i++)
{
mean += data[i];
}
mean /= sizeof(data) / sizeof(data[0]);
}
```
and I am stuck. I use Visual Studio 2019 on Windows 7 Professional, and I have underlined 3 characters ( data[i], and 2x data[0]). For this x Visual Studio says 'expression must have pointer-to-object type'. (By the way, what is the advance of addresses and pointers? I haven't learned them because I thought that I will never use them.) And I have no idea what he means with this. I only know what pointer is (at least I think).
I have tried with several Stack Overflow questions, GeeksForGeeks website and a lot of other stuff. But I am stuck.
-----------------------------------------------
For this, who haven't read the whole question:
**The question:** What is wrong with the upper code, where Visual Studio 2019 says 'expression must have pointer-to-object type' (Error E0142)?
Thank you for your effort!
*P.S.
Don't tell me the whole answer. ;) I will guess it alone, but I just can't go through this problem.* | <c++><arrays><mean><visual-studio-2019> | 2020-02-23 20:03:58 | LQ_EDIT |
60,366,915 | how can I retrieve data from Firebase in web using javascript? | <p>How can I retrieve data from Firebase and add to html page?
and, How can I open new html pages automatically to add the data I was retrieving it?
example:
I have this course from firbase:
<a href="https://i.stack.imgur.com/R6BZQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/R6BZQ.png" alt="image"></a></p>
<p>this key I was pushing it .
and I want my website like this course :
<a href="https://i.stack.imgur.com/kg2cW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kg2cW.png" alt="courses image "></a></p>
<p>When I click this courses I want to see all data about this course like this :
<a href="https://i.stack.imgur.com/2sajb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2sajb.png" alt="description coursers "></a></p>
<p>Can anyone help me ?!
I won't like this style just I want to know how can i retrieve data and add it in new html pages in the same style in all courses .</p>
| <javascript><html><css><firebase><web> | 2020-02-23 21:13:27 | LQ_CLOSE |
60,368,088 | how do i sort variables into other variables by ranking in python | so i am trying to make a program to imrove my python skills which is basically a lucky wheel, you get several items which are all ranked by numbers, i have made the items randomly generate but how would i make them print in order? i assume that the sort() method won't be any use in this situation.
```
# to sort: itemrating1, itemrating2, itemrating3
print(toprateditem)
print(meditem)
print(lowitem)
```
that is basically what i want to do, i hope i explained it well. | <python><sorting> | 2020-02-24 00:03:31 | LQ_EDIT |
60,371,782 | remove html tags from the json response in android | Hi from the below response want to remove <p> <br> unwanted tags and blank spaces and want to bold display heading should be bold
can any one help me
String termsnconditions=listSalesStageOpportunity.get(position).getTermsnconditions();
Resonse :
"<p>Price : Price offered for the above configuration only.<br />\r\nTax : Above mentioned price is inclusive of custom duty, Excise, Freight up to site and GST.<br />\r\n Local levies such as Octroi / Entry tax if any, the same will be at Purchaser’s account.<br />\r\nValidity : This price is valid for a week from the date of the proposal.<br />\r\nPayment : 100% Advance<br />\r\nInstallation : Genworks Specialist / Representative at your site will give Training and Installation without any additional cost.<br />\r\nWarranty : 12 Months from the date of installation or 13 Months from the date of Invoice. Warraty will be provided for hardware items only and consumables items are not a part of warranty.</p>"
String terms=termsnconditions.replaceAll("<p>","");
terms_condition.setText(terms); | <android><html> | 2020-02-24 08:13:37 | LQ_EDIT |
60,375,170 | CORS error when calling a firebase function | I am using Google Cloud Functions and I am getting an error related to CORS. I have made a simple function but it's not working because I keep getting the same error over and over again. I have tried almost everything but nothing is working.
[enter image description here][1]
[1]: https://i.stack.imgur.com/FrdPS.png | <reactjs><google-cloud-firestore><cors><google-cloud-functions> | 2020-02-24 11:39:27 | LQ_EDIT |
60,376,219 | How I can rearrange the last element of an array to the first place? | <p>I have an array of objects in javascript:</p>
<pre><code>shapeToolsTarget: Array(4)
0: {id: 20, name: "Background", type: "shape"}
1: {id: 21, name: "BorderColor", type: "shape"}
2: {id: 22, name: "BorderWeight", type: "shape"}
3: {id: 3, name: "Paste", type: "text"}
</code></pre>
<p>How I can rearrange the last element of an array to the first place? Like that:</p>
<pre><code>shapeToolsTarget: Array(4)
0: {id: 3, name: "Paste", type: "text"}
1: {id: 20, name: "Background", type: "shape"}
2: {id: 21, name: "BorderColor", type: "shape"}
3: {id: 22, name: "BorderWeight", type: "shape"}
</code></pre>
| <javascript> | 2020-02-24 12:43:41 | LQ_CLOSE |
60,378,705 | Python vs Julia autocorrelation | <p>I am trying to do autocorrelation using Julia and compare it to Python's result. How come they give different results?</p>
<p>Julia code</p>
<pre><code>using StatsBase
t = range(0, stop=10, length=10)
test_data = sin.(exp.(t.^2))
acf = StatsBase.autocor(test_data)
</code></pre>
<p>gives</p>
<pre><code>10-element Array{Float64,1}:
1.0
0.13254954979179642
-0.2030283419321465
0.00029587850872956104
-0.06629381497277881
0.031309038331589614
-0.16633393452504994
-0.08482388975165675
0.0006905628640697538
-0.1443650483145533
</code></pre>
<p>Python code</p>
<pre><code>from statsmodels.tsa.stattools import acf
import numpy as np
t = np.linspace(0,10,10)
test_data = np.sin(np.exp(t**2))
acf_result = acf(test_data)
</code></pre>
<p>gives</p>
<pre><code>array([ 1. , 0.14589844, -0.10412699, 0.07817509, -0.12916543,
-0.03469143, -0.129255 , -0.15982435, -0.02067688, -0.14633346])
</code></pre>
| <python><julia> | 2020-02-24 15:07:52 | HQ |
60,379,906 | Find the column index by its name in SQL | If I have three columns, 'syscode', 'loc_cod', 'loc_name' but wanted to know that 'loc_name' was 3rd in order, how could I retrieve that with a SQL query?
Using T SQL/SSMS. | <sql-server><tsql> | 2020-02-24 16:13:31 | LQ_EDIT |
60,380,273 | Python defaultdict initialise while creation | <p>Is there any way of initialise defaultdict during creation time ? I mean to achieve the same behaviour as this in one line:</p>
<pre><code>x = defaultdict(int)
x[1] = 2
</code></pre>
<p>something like:</p>
<pre><code>x = defaultdict(int, {1:2})
</code></pre>
<p>where <code>x[1] = 2</code> and rest all values are 0.</p>
| <python><defaultdict> | 2020-02-24 16:36:08 | LQ_CLOSE |
60,382,865 | What is the best way to debug jQuery selector? | <pre><code><div id="chart2Carousel" class="carousel slide" data-ride="carousel">
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active"><div class="chartjs-size-monitor"><div class="chartjs-size-monitor-expand"><div class=""></div></div><div class="chartjs-size-monitor-shrink"><div class=""></div></div></div>
<canvas width="683" height="341" id="chart2" class="chartjs-render-monitor" style="display: block; width: 683px; height: 341px;"></canvas>
</div>
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#chart2Carousel" data-slide="prev">
<span class="fa fa-chevron-left"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#chart2Carousel" data-slide="next" style="display: block;">
<span class="fa fa-chevron-right"></span>
<span class="sr-only">Next</span>
</a>
</div>
</code></pre>
<p>I've tried </p>
<p>//selectedChart = chart2 </p>
<pre><code>$('#' + selectedChart).closest(".carousel-inner").find(".left.carousel-control").hide();
</code></pre>
<p>Why does it not working ? </p>
<p><strong>What is the best way to debug jQuery selector ?</strong> </p>
| <javascript><jquery> | 2020-02-24 19:43:02 | LQ_CLOSE |
60,383,825 | How to check if a sub-directory does not contain a certain file in python? | <p>Need to append something to the following code:</p>
<pre><code>for subdir, dirs, files in os.walk(rootdir):
for file in files:
if file.endswith(".json"):
json_files.append(os.path.join(subdir, file))
if file.endswith(".list"):
table_files.append(os.path.join(subdir, file))
</code></pre>
<p>In psuedocode, need to add an if statement like:</p>
<pre><code>if a sub-directory does not contain a file that ends in ".list",
table_files.append('')
</code></pre>
<p>Have tried searching but can't seem to find something that works exactly</p>
| <python><list><file> | 2020-02-24 20:58:19 | LQ_CLOSE |
60,383,847 | Why utilize using() when instantiating a class? | <p>I have been working with C# ASP.NET MVC5 for a while and I was wondering something.
Why are we utilizing the using() to instantiate a class sometimes?</p>
<p>For an example:</p>
<pre><code>using (CyrptoStream cs = new CryptoStream(PARAMETERS)
{
//SOMETHING
}
</code></pre>
<p>or</p>
<pre><code>using (Aes encryptor = Aes.Create()
{
}
</code></pre>
<p>How is that different to <code>MyClass myClass = new MyClass()</code></p>
<p>Thank you.</p>
| <c#><asp.net><class><asp.net-mvc-5> | 2020-02-24 21:00:21 | LQ_CLOSE |
60,384,510 | How to generate with Dictionary about duplicate values? | public class DataClass
{
public int Number1 {get; set;}
public int Number2 {get; set;}
}
List<DataClass> list = new List<DataClass>();
list.Add(new DataClass {Number1= 1, Number2 = 100});
list.Add(new DataClass {Number1= 2, Number2 = 100});
list.Add(new DataClass {Number1= 3, Number2 = 101});
list.Add(new DataClass {Number1= 4, Number2 = 102});
list.Add(new DataClass {Number1= 5, Number2 = 103});
list.Add(new DataClass {Number1= 6, Number2 = 104});
list.Add(new DataClass {Number1= 7, Number2 = 104});
I have duplicate value about number2 and I want to generate a Dictionary like to below expect a result.
Key = 1, value = {Number1 = 1, Number2 = 100}
Key = 1, value = {Number1 = 3, Number2 = 101}
Key = 1, value = {Number1 = 4, Number2 = 102}
Key = 1, value = {Number1 = 5, Number2 = 103}
Key = 1, value = {Number1 = 6, Number2 = 104}
Key = 2, value = {Number1 = 2, Number2 = 100}
Key = 2, value = {Number1 = 7, Number2 = 104}
I would like to receive an optimal algorithm.
| <c#><linq> | 2020-02-24 21:57:47 | LQ_EDIT |
60,384,689 | Terraform azurerm 2.x Error: "features": required field is not set | <p>So azurerm updated to 2.0 a few hours ago....</p>
<p>My main code is version locked for safety, but
I'm doing some testing to see what's changed from the public beta of 1.44 and now I'm getting the following error on any TF command apart from terraform init.</p>
<p>has anybody else come upon this?</p>
| <azure><terraform> | 2020-02-24 22:14:37 | HQ |
60,384,944 | Parse XML File with PowerShell and if a value is found, copy file to a new location | <p>I have an application that outputs XML files during the life of an event in the software. I need to parse the XML files and once certain text are matched, move the file to another folder</p>
<p>The file name format of each XML file is: Event Owner (MEMS), Year (2020) and serial number (00012345). The software will write same file multiple time throughout the event so I need to look for specific items before taking any action.
I would prefer to do this in PowerShell if at all possible.</p>
<p>I need to find</p>
<pre><code> `<EventUnits>
<Unit>
<UnitCode>xxxxxxx></UnitCode>
</EventUnits>`
</code></pre>
<p>and </p>
<pre><code><EventDetails>
<EventCompletedTime>YYYY-MM-DD HH:MM:SS</EventCompletedTime>
</EventDetails>
</code></pre>
<p>Once UnitCode equals one of 4 unit codes and EventCompleted has a valid date and time, the file is moved to a different folder.</p>
| <xml><powershell> | 2020-02-24 22:36:28 | LQ_CLOSE |
60,386,906 | Select all records from table a. table b has complementary data but only one record matches table a. I need all of them | <p>I have a MySQL database with 2 tables:</p>
<pre><code>Table A:
id name age
123a John 34
143w Mark 27
143x Rony 30
Table B:
id company job
143w Google developer
I need:
id name age company job
123a John 34
143w Mark 27 Google developer
143x Rony 30
</code></pre>
<p>I need a select statement that can extract the result above.<br>
Thanks in advance<br>
Paulo</p>
| <mysql><select> | 2020-02-25 02:59:58 | LQ_CLOSE |
60,387,772 | WARNING: API 'variant.getMappingFile()' is obsolete and has been replaced with 'variant.getMappingFileProvider()' | <p>I just updated Android Studio 3.5 to Android Studio 3.6 and replaced previous Gradle plugin with Gradle plugin 3.6.0 when syncing Gradle:</p>
<blockquote>
<p>build.gradle: API 'variant.getMappingFile()' is obsolete and has been
replaced with 'variant.getMappingFileProvider()'</p>
</blockquote>
<p>Any suggestions on how to debug this warning. Where is it coming from? I don't see any usage of getMappingFile in my code although, might be some library. Suggestions to debug these kind of cases would be helpful </p>
| <android> | 2020-02-25 05:01:31 | HQ |
60,388,041 | Serial console enabled Performance is impacted. To disable, check bootloader | <p>I recently created an Android emulator with Android version R.
It showing an Android system notification </p>
<p><strong>"Serial console enabled Performance is impacted. To disable, check bootloader"</strong></p>
<p>Can someone explain, what this notification means?</p>
<p><a href="https://i.stack.imgur.com/or1pC.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/or1pC.jpg" alt="enter image description here"></a>,</p>
| <android> | 2020-02-25 05:30:36 | HQ |
60,388,568 | How to match a int less than 50 in regx | <p>I want to match a url like "index.html\index_1.html\index_12.html\index_49.html\index_n.html
and the n must <50 not be 50</p>
| <regex> | 2020-02-25 06:20:02 | LQ_CLOSE |
60,388,647 | Converting a Google Apps Script to VB Script (Excel) | I guess this will seem a bit lazy, but I have been working on this for quite a few hours to get it to work in Google Sheets. Now I have the need to also get it to work in Excel, using VB script. It's a pretty simple script for experienced programmers, which I am not. :-)
I have a range of letters in a spreadsheet. Each letter represent a value. The Google Apps Script looks like this:
function Arsarbetstid(v,year) {
switch(year) {
case 2020: // Tider gällande 2020
var n=6.7, // N
np=9, // N+
k=8.8, // K
km=7, // K-
k4=4, // K4
d=8.8, // D
h=12, // H
hp=13; // H+
break;
case 2019: // Tider gällande 2019
var n=6.9, // N
np=9, // N+
k=8.7, // K
km=7, // K-
k4=4, // K4
d=9, // D
h=12, // H
hp=13; // H+
break;
case 2018: // Tider gällande 2018
var n=6.9, // N
np=9, // N+
k=8.7, // K
km=7, // K-
k4=4, // K4
d=9, // D
h=12, // H
hp=13; // H+
break;
case 2017: // Tider gällande 2017
var n=7, // N
np=9, // N+
k=8.8, // K
km=7, // K-
k4=4, // K4
d=9.1, // D
h=12, // H
hp=13; // H+
break;
case 2016: // Tider gällande 2016
var n=7, // N
np=9, // N+
k=8.8, // K
km=7, // K-
k4=4, // K4
d=9.1, // D
h=12, // H
hp=13; // H+
break;
case 2015: // Tider gällande 2015
var n=7, // N
np=9, // N+
k=8.8, // K
km=7, // K-
k4=4, // K4
d=9.1, // D
h=12, // H
hp=13; // H+
break;
case 2014: // Tider gällande 2014
var n=7, // N
np=9, // N+
k=8.8, // K
km=7, // K-
k4=4, // K4
d=9.1, // D
h=12, // H
hp=13; // H+
break;
case 2013: // Tider gällande 2013
var n=7, // N
np=9, // N+
k=8.8, // K
km=7, // K-
k4=4, // K4
d=9.1, // D
h=12, // H
hp=13; // H+
break;
default: // Tider gällande om inget årtal anges.
var n=6.7, // N
np=9, // N+
k=8.8, // K
km=7, // K-
k4=4, // K4
d=8.8, // D
h=12, // H
hp=13; // H+
break;
}
var total = 0;
for (var i=0;i < v.length;i++) {
var row = v[i];
for (var j=0;j < row.length;j++) {
switch(row[j]) {
case "N":
total += n;
break;
case "N+":
total += np;
break;
case "D":
total += d;
break;
case "H":
total += h;
break;
case "H+":
total += hp;
break;
case "K":
total += k;
break;
case "K-":
total += km;
break;
case "K4":
total += k4;
break;
}
}
}
return total;
};
v is the range of letters and year is just an integer representing a year so I can chose different values of the letters depending of the year.
I have tried, and so far failed, to convert this to VBscript. Is there anyone out there skilled enough to help me convert this? It shouldn't be too hard to anyone with at least a little above basic skills in both Javascript and VBscript.
I would be very grateful for the help.
Kind regards,
Michael | <excel><vba><google-sheets> | 2020-02-25 06:26:50 | LQ_EDIT |
60,390,562 | Why does this C code magically print "a[2] = 98"? | <pre><code>#include <stdio.h>
int main(void){
int n;
int a[5];
int *p;
a[2] = 1024;
p = &n;
/* adding any of these lines makes code to print "a[2] = 98" at output */
p[5] = 98; //OR *(p + 5) = 98;
printf("a[2] = %d\n", a[2]); //Prints a[2] = 98
return (0);
}
</code></pre>
<p>I don't understand why this C code magically prints "a[2] = 98". Though, this is what I want but I want to understand it.</p>
| <c> | 2020-02-25 08:43:18 | LQ_CLOSE |
60,391,134 | How to remove useless array and indexOf | I want to refactor this code without indexOf() and remove useless groupArr. I want to use ^ES6 or/and lodash
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-js -->
const keys= ['activity', 'admin'];
const labels = ["accountTypes.GROUP_ACCOUNT",
"accountTypes.SINGLE_ACCOUNT",
"activity.active",
"activity.inactive",
"admin.dictionaries.name",
"admin.group.details.addedDate",
"admin.group.details.enterDescription"];
let arr = [];
keys.forEach( key => {
labels.forEach(label => {
if (label.indexOf(key) === 0){
arr.push(label);
}
});
});
console.log(arr)
<!-- end snippet -->
| <javascript><lodash> | 2020-02-25 09:18:00 | LQ_EDIT |
60,393,227 | Gradle Sync Failed Android Studio 3.6 | <p>I have just updated the Android Studio from 3.5.3 to 3.6. After this update, I have updated the Gradle and Android SDK Build Tools as well. Now the Gradle sync is failing with these errors:</p>
<pre><code>1. org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException:
Could not resolve all artifacts for configuration ':classpath'.
2. org.gradle.internal.resolve.ModuleVersionResolveException: Could not
resolve com.android.tools.build:gradle:3.6.0.
3. org.gradle.internal.resolve.ModuleVersionResolveException: No cached
version of com.android.tools.build:gradle:3.6.0 available for
offline mode.
</code></pre>
<p>Looking at the 3rd error it seems that <strong>Offline Work</strong> option needs to be disabled in Android Studio <strong>Settings -> Build, Execution, Deployment -> Gradle</strong>. But the <strong>Offline Work</strong> check box is no where to be found in the said settings.
Is it the actual problem? If yes, then how it could be disabled in <strong>Android Studio 3.6</strong>? If no, then what is the problem here?</p>
<p>I have already tried <strong>Invalidate Caches / Restart</strong> but it did not help.</p>
| <android-studio><gradle><build.gradle><offline-mode><android-studio-3.6> | 2020-02-25 11:09:50 | HQ |
60,393,467 | How can I make a React "If" component that acts like a real "if" in Typescript? | <p>I made a simple <code><If /></code> function component using React:</p>
<pre><code>import React, { ReactElement } from "react";
interface Props {
condition: boolean;
comment?: any;
}
export function If(props: React.PropsWithChildren<Props>): ReactElement | null {
if (props.condition) {
return <>{props.children}</>;
}
return null;
}
</code></pre>
<p>It lets me write a cleaner code, such as:</p>
<pre><code>render() {
...
<If condition={truthy}>
presnet if truthy
</If>
...
</code></pre>
<p>In most cases, it works good, But when I want to check for example if a given variable is not defined and then pass it as property, it becomes an issue. I'll give an example:</p>
<p>Let's say I have a component called <code><Animal /></code> which has the following Props:</p>
<pre><code>interface AnimalProps {
animal: Animal;
}
</code></pre>
<p>and now I have another component which renders the following DOM:</p>
<pre><code>const animal: Animal | undefined = ...;
return (
<If condition={animal !== undefined} comment="if animal is defined, then present it">
<Animal animal={animal} /> // <-- Error! expected Animal, but got Animal | undefined
</If>
);
</code></pre>
<p>As I commented, althought in fact animal is not defined, I've got no way of telling Typescript that I already checked it. Assertion of <code>animal!</code> would work, but that's not what I'm looking for.</p>
<p>Any ideas?</p>
| <javascript><reactjs><typescript> | 2020-02-25 11:22:08 | HQ |
60,393,481 | Convert a x.0 float to int function | <p>Ok, kinda hard question to ask in a title, but here is what i want to do.</p>
<p>I want to basically detect if my float has a 0 after the . so that i can skip printing out the - for example - 1.0 and just print 1. Anyone have an idea as to how to do this ?
I was thinking of some sort of modulus operator but cant really figure out a good way for that.
Any help would be greatly appreciated.</p>
| <swift> | 2020-02-25 11:22:40 | LQ_CLOSE |
60,394,661 | How to run a python script on Go | <p>I have got a python script (that's fairly complicated, but i'll just put the bare minimum here) that is something like this </p>
<pre><code>from cassandra.cluster import Cluster
cluster = Cluster()
session = cluster.connect('mykeyspace')
ta = session.execute(somecqlstatement)
print("The column names of the table are: ", ta.column_names)
</code></pre>
<p>I want to run this on Go - preferably not being read as a file but storing it as a string and executing it. </p>
<p>I looked into the following source </p>
<ol>
<li><a href="https://stackoverflow.com/questions/27021517/go-run-external-python-script">Go: Run External Python script</a></li>
<li><a href="https://forum.golangbridge.org/t/how-to-execute-python-code-without-having-to-write-it-to-a-file/6359/2" rel="nofollow noreferrer">https://forum.golangbridge.org/t/how-to-execute-python-code-without-having-to-write-it-to-a-file/6359/2</a></li>
</ol>
<p>Nothing seems to be working, as they throw a <code>FATA[0000] exit status 1</code></p>
| <python><go> | 2020-02-25 12:27:35 | LQ_CLOSE |
60,397,318 | How to compare two aspect ratios? | I want to compare two ratios using javascript.
I have two ratios 12:3 and 12:2 and I need to compare both.
if(12:3 > 12:2) {
console.log(true);
}
Something similar to above.Thank you. | <javascript><jquery> | 2020-02-25 14:50:40 | LQ_EDIT |
60,397,733 | Unsupported operand type method + method | <p>I've actually already found a work around for my problem, but I feel as though there is still a better way. I can't seem to grasp why the program thinks I'm dealing with a <strong>method</strong> vs a <strong>float</strong>.</p>
<p>If I try to run the program, it says that I'm trying to add together two <strong>methods</strong>. However, when I run the line:</p>
<p><code>print(type(my.coins.add_coins()))</code></p>
<p>It tells me that it has returned a <strong>float</strong>.</p>
<p>Here's the code:</p>
<pre><code>class Currency:
def __init__(self, pennies, nickles, dimes, quarters):
self.pennies = pennies
self.nickles = nickles
self.dimes = dimes
self.quarters = quarters
def penny_value(self):
return self.pennies * .01
def nickle_value(self):
return self.nickles * .05
def dime_value(self):
return self.dimes * .1
def quarter_value(self):
return self.quarters * .25
def add_coins(self):
return self.penny_value + self.nickle_value + self.dime_value + self.quarter_value
my_coins = Currency(1, 1, 1, 1)
#why does this work?
print(my_coins.penny_value() + my_coins.nickle_value())
#but not this?
print(my_coins.add_coins())
</code></pre>
| <python><class><methods><typeerror> | 2020-02-25 15:11:35 | LQ_CLOSE |
60,398,156 | JS can't resolve 1 22 333 | I want to take an array like ['1', '22', '333'] but already I have an array [1, 2, 2, 3, 3, 3]
I need your help, please!
My code:
```
function createArr() {
let quantity = 3
let result = []
for (let i = 1; i <= quantity; i++) {
for (let j = 1; j <= i; j++) {
result.push(i)
}
}
alert(result)
}
``` | <javascript><arrays><string> | 2020-02-25 15:33:04 | LQ_EDIT |
60,400,582 | How to write a CSV file without using external libraries | <p>I have already checked out these libraries <code>oledb</code>, <code>Microsoft Text Writer</code>, and <code>TextFieldParser</code>. We are not allowed to use oledb and Microsoft Text Driver on the server. Also, not allowed to use external libraries. I see that TextFieldParser only reads the file. Is there a way to write a CSV file natively in C#? I am aware that write a CSV is pretty complex so I don't want to roll my own solution. </p>
| <c#> | 2020-02-25 17:53:39 | LQ_CLOSE |
60,400,851 | Flawed Logic in If statement | <p>I tried the year 1900, which in my program prints its a leap year, however, 1900 shouldnt be a leap year. Can someone help me with the logic behind the if condition?</p>
<pre><code>class LeapYearTrial{
public static void main(String[]args){
String s;
int year;
s = JOptionPane.showInputDialog("Enter year");
year = Integer.parseInt(s);
if ((year % 100 == 0) && (year % 400 == 0) || (year % 4 == 0)){
JOptionPane.showMessageDialog(null, year + " is a leap year");
} else {
JOptionPane.showMessageDialog(null, year + " is not a leap year");
}
}
}
</code></pre>
| <java> | 2020-02-25 18:13:58 | LQ_CLOSE |
60,400,895 | Why i have problem when i train my model, pytorch? | im new with pytorch and ai but i have some trouble when i try to train my model.
I just create my Dataset and my Dataloader
train_dataset = TensorDataset(tensor_train,tensor_label)
train_dataloader = DataLoader(train_dataset,batch_size=32,shuffle=True)
And after this my criterion and optimiser
criterion = nn.CrossEntropyLoss()
optimiser=optim.Adam(net.parameters(),lr=0.2)
And i try to train him with
for epoch in range(10):
for data in train_dataloader:
inputs,labels = data
output = net(torch.Tensor(inputs))
loss = criterion(output,labels.to(device))
optimiser.zero_grad()
loss.backward()
optimiser.step()
But i got this error
d:\py\lib\site-packages\torch\nn\modules\module.py in <lambda>(t)
321 Module: self
322 """
--> 323 return self._apply(lambda t: t.type(dst_type))
324
325 def float(self):
TypeError: dtype must be a type, str, or dtype object
I will be happy if someone find the problem, thanks. | <artificial-intelligence><pytorch> | 2020-02-25 18:16:46 | LQ_EDIT |
60,401,442 | Class method which includes another class method is undefined when setting a variable to be the original class method | <p>Why is the following throwing an error, and how would I go about trying to fix.</p>
<pre class="lang-js prettyprint-override"><code>class Foo {
bar() {
console.log("bar");
}
fizz() {
this.bar(); // TypeError: this is undefined
}
}
let foo = new Foo();
let buzz = foo.fizz;
buzz();
</code></pre>
| <javascript><function><class> | 2020-02-25 18:55:17 | LQ_CLOSE |
60,402,987 | Optymalize autohotkey code / send keyboard code | I'm impressed what autohotkey can do. How can i Optymalize that code? What I need to know?
SetTitleMatchMode RegEx ;
::/act1::
Send {LControl down}
Send {LShift down}
Send {m}
Send {LControl up}
Send {LShift up}
Send {Left 3}
Send {LShift down}
Send {Home}
Send {LShift up}
Send {LControl down}
Send {c}
Send {LControl up}
WinActivate WidnowA
Send {LControl down}
Send {Home}
Send {LControl up}
Send {Down 1}
Send {Right 12}
Send {LControl down}+{v}
Send {LControl up}
Send {,}
Send {Space}
Send {LControl down}
Send {s}
Send {LControl up}
CoordMode, Mouse, Screen
x := 150
y := 1420
Click %x% %Y%
Send {Right 3}
return
I think that no need to describe the sections, but.. can I write it another (easiest) way?
Thanks | <autohotkey> | 2020-02-25 20:54:14 | LQ_EDIT |
60,403,265 | how to select Details of every student's latest purchase in sql server just with 1 query? | I have 2 table like this picture:
[![pic][1]][1]
I want find Details of every student's latest purchase in SQL server just with 1 query. How can I do?
[![enter image description here][2]][2]
I have no idea.
[1]: https://i.stack.imgur.com/YTk68.png
[2]: https://i.stack.imgur.com/ZJCYH.png | <sql><sql-server><select> | 2020-02-25 21:16:40 | LQ_EDIT |
60,403,387 | Differences between Fprint/Fprintf vs conn.Write in GOLANG | Trying to send encrypted data across a TCP connection. Fprintf works fine for unencrypted data but seems to be adding formatting to encrypted data causing the decrypt to fail intermittently. I am unable send using conn.Write or for that matter writer.Writestring followed by writer.Flush().
scanner := bufio.NewScanner(os.Stdin)
for scanner.Scan() && err == nil {
msg := scanner.Text()
ciphertext := md5.Encrypt([]byte(msg+"\n")
conn.Write(append(ciphertext, '\r'))
}
//Receiver
scanner := bufio.NewScanner(conn)
for scanner.Scan() {
ciphertext := scanner.Bytes()
plaintext := md5.Decrypt(ciphertext)
fmt.Println(string(plaintext))
}
Suggestions welcome.
| <go><encryption><printf> | 2020-02-25 21:25:31 | LQ_EDIT |
60,404,264 | Blocking and Being New Home Screen Swift iOS | <p>I am new to Swift and iOS programming and I wanted to know if there was a way to essentially block other applications or have your application be the default Home Screen? The idea is a time-saving application so maybe totally hide text messages and the browser when it is enabled. </p>
<p>I saw that there is kind of a way to do this in Android, but wasn't sure if there was a way to do this with iOS. </p>
| <ios><swift> | 2020-02-25 22:43:57 | LQ_CLOSE |
60,405,035 | Aws cognito linkedin | <p>I'm trying to add LinkedIn login to my react app that using Amazon Cognito, I did everything like explained <a href="https://aws.amazon.com/premiumsupport/knowledge-center/cognito-linkedin-auth0-social-idp/" rel="noreferrer">here</a> and yes it works <strong>but</strong> I'm not using Amazon Cognito hosted UI and I don't want my user to get redirected to Auth0 site to login with LinkedIn...</p>
<p>Is there any way to implement LinkedIn Cognito login\signup without getting redirected to Cognito\Auth0?</p>
<p>Or maybe there is already a better way to implement this?</p>
| <amazon-web-services><amazon-cognito><auth0><linkedin-api> | 2020-02-26 00:15:20 | HQ |
60,405,498 | asyn await vs await task.run | <p>What is the difference in using asyn/await vs await task.run()</p>
<p>await task.run example -</p>
<pre><code> public static void Main()
{
await Task.Run(() =>
{
return "Good Job";
});
method1();
method2();
}
</code></pre>
<p>Async await example-</p>
<pre><code> public static async void Launch()
{
await GetMessage();
Method1();
Method2();
}
public static async Task<string> GetMessage()
{
//Do some stuff
}
</code></pre>
| <c#><.net><async-await><task-parallel-library> | 2020-02-26 01:23:04 | LQ_CLOSE |
60,406,947 | getting maximum value from array in c++ using pointer | I am gonna want maximum value from the array using pointer. But am not getting the accurate value. Please, help.
#include <iostream>
using namespace std;
int main()
{
int* largest;
int a[5]={4,5,666,7,8};
largest=a;
for(int i=1; i<5; i++)
{
if(*largest<*(largest+i))
{
*largest=*(largest+i);
largest=largest+i;
}
}
cout<<*largest;
}
I am getting 7339544 as output rather than 666. I don't know what I am doing wrong. | <c++><arrays> | 2020-02-26 04:46:10 | LQ_EDIT |
60,407,060 | What is the usage of the pseudo class :not()? | <p>I saw this pseudo class <code>:not()</code> being used in a source code of a <strong>Youtube</strong> video page, searching in the <strong>MDN</strong> I saw <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:not" rel="nofollow noreferrer">this article</a> explaining the pseudo class, but I couldn't understand why (<em>and in which case</em>) someone would use that. </p>
| <css><pseudo-class> | 2020-02-26 04:59:58 | LQ_CLOSE |
60,407,897 | I have tag issue on AndroidMainfest.xml file | <p>I am developing an uber app, so I need to connect my app through the internet while I am doing that I saw there are tag issues on my XML file and I tried to fix it changing tags but it's not working.</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.accident">
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<user-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<user-permission android:name="android.permission.INTERNET'/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
<activity
android:name=".CivilianMapsActivity"
android:label="@string/title_activity_civilian_maps"> </activity>
<activity android:name=".CivilianLoginRegisterActivity" />
<activity android:name=".PolicemanLoginRegisterActivity" />
<activity android:name=".WelcomeActivity" />
<activity android:name=".MainActivity"
tools:ignore="WrongManifestParent">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
</code></pre>
<p>I need to fix those. Also these two lines not working too. is it because of tags issue?</p>
<pre><code><user-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<user-permission android:name="android.permission.INTERNET'/>
</code></pre>
| <java><android><xml><tags> | 2020-02-26 06:20:40 | LQ_CLOSE |
60,410,562 | i try to implement merge sort algorythm using python but the code doesn't work well | <p>here merge function:</p>
<pre><code>def __merge__(arr, middle):
L = arr[:middle]
R = arr[middle:]
L.append(math.inf)
R.append(math.inf)
i = 0
j = 0
for k in range(0, len(arr)):
if(L[i] <= R[j]):
arr[k] = L[i]
i += 1
else:
arr[k] = R[j]
j += 1
return arr
</code></pre>
<p>and here mergesort function that call intself recursively:</p>
<pre><code>def __mergeSort__(listOfNumber):
if(len(listOfNumber) <= 1):
return listOfNumber
middle = int( len(listOfNumber) / 2 )
print('merge lit: ', listOfNumber[:middle])
__mergeSort__(listOfNumber[:middle])
print('merge lit: ', listOfNumber[middle:])
__mergeSort__(listOfNumber[middle:])
print(__merge__(listOfNumber, middle))
return __merge__(listOfNumber, middle)
</code></pre>
<p>when I give array like[6,5,4,3,2,1] as input i receve this: [3, 2, 1, 6, 5, 4]</p>
| <python><sorting> | 2020-02-26 09:25:11 | LQ_CLOSE |
60,411,643 | How to Select and click button to login to web page using Python Selenium (Beginner in Selenium) | [![HTML code for button ][1]][1]
[1]: https://i.stack.imgur.com/W1J6n.png
How can I click on "Sign In" button to login to the web page as I am not getting any valid id to click on it | <python><selenium> | 2020-02-26 10:21:35 | LQ_EDIT |
60,414,348 | Match string format with regex | <p>I know there are tons of questions about regex string format, but I am very new to this and I haven't been able to do it myself. How can I use regex to match a string with the following format?</p>
<p><code>xx_x_a.zip</code></p>
<p>where x is a number and a is a letter. Example:</p>
<p><code>33_2_f.zip</code></p>
<p>It must not match:</p>
<p><code>33_2_f_abc.zip</code></p>
<p>The format must always be like <code>2digits</code>+<code>_</code>+<code>1digit</code>+<code>_</code>+<code>1letter</code>+<code>.zip</code></p>
| <php><regex><bash><shell> | 2020-02-26 12:48:33 | LQ_CLOSE |
60,414,889 | Tkinter, is it possible to def button(a,b,c,e) | <p>I'm a newbie so I'm possibly missing other way to do something like this. Im trying to: </p>
<pre><code>def button(a,b,c,d,e,f):
a=ttk.Button(b,text=c,command=d)
a.grid(row=e, column=f)
</code></pre>
<p>so that i can creat buttons like this:</p>
<pre><code>button(a,b,c,d,e,f)
</code></pre>
| <python><tkinter> | 2020-02-26 13:20:06 | LQ_CLOSE |
60,416,205 | Square Brackets at the beginning of postman Json Array | <p>I have an api that expects a Json Array body like so: </p>
<pre><code>{
"rrr":"123456788",
"channel":"BRANCH",
"amount":5500.00,
"transactiondate":"12/04/2017",
"debitdate":"12/04/2017",
"bank":"050",
"branch":"48794389",
"serviceTypeId":"346346342",
"dateRequested":"12/04/2017",
"orderRef":"",
"payerName":"Amira Oluwatobi ",
"payerPhoneNumber":"+23443846434",
"payerEmail":"seunfapo1@yahoo.com",
"agencyCode": "834873463",
"revenueCode": "49384983",
"customFieldData": [
{
"DESCRIPTION": "GPRR",
"COLVAL": "48374387"
}
]
}
</code></pre>
<p>It works as expected on postman, but my supervisor wants a Json array with angle brackets at the beginning and end like so:</p>
<pre><code>[
{
"rrr":"123456788",
"channel":"BRANCH",
"amount":5500.00,
"transactiondate":"12/04/2017",
"debitdate":"12/04/2017",
"bank":"050",
"branch":"48794389",
"serviceTypeId":"346346342",
"dateRequested":"12/04/2017",
"orderRef":"",
"payerName":"Amira Oluwatobi ",
"payerPhoneNumber":"+23443846434",
"payerEmail":"seunfapo1@yahoo.com",
"agencyCode": "834873463",
"revenueCode": "49384983",
"customFieldData": [
{
"DESCRIPTION": "GPRR",
"COLVAL": "48374387"
}
]
}
]
</code></pre>
<p>This does not work in postman, it sends an empty json array object. is there a way to make it work like this? or does the angle bracket even matter at all?</p>
| <json><asp.net-web-api><postman> | 2020-02-26 14:31:31 | LQ_CLOSE |
60,416,852 | Laravel: what is the best practice to show errors in a modal when save a form? | <p>In my Laravel application (Bootstrap 4, jQuery and Axios) I have a page with multiple forms. Some forms are in a modal, but not all forms. </p>
<pre><code><form method="post">
<div class="modal">
// show errors
// form fields
</div>
</form>
</code></pre>
<p>I will not use ajax for posting this form. What is the best practice to show errors in a modal, when post a form when there are many others forms on the same page?</p>
<p>The problem now is: when a user posts a form with a field error, Laravel redirects the user back to the page, with the modal closed. When the user opens the modal, he shees the error in the modal.
What is the best practice to prevent this?</p>
| <laravel><validation><request><modal-dialog> | 2020-02-26 15:06:26 | LQ_CLOSE |
60,417,622 | How to split array into three arrays by index? | <p>I have an array of 9 elements(maybe more).
I need to split by indexes into three arrays.</p>
<pre><code>const array = [{id: 0}, {id: 1}, ..., {id: 8}];
</code></pre>
<p>I want to recieve 3 array like that:</p>
<pre><code>const array0 = [{id: 0}, {id: 3}, {id: 6}];
const array1 = [{id: 1}, {id: 4}, {id: 7}];
const array2 = [{id: 2}, {id: 5}, {id: 8}];
</code></pre>
| <javascript><algorithm><split> | 2020-02-26 15:47:14 | LQ_CLOSE |
60,419,253 | Sound Localization with a single microphone | <p>I am trying to determine the direction of an audio signal using the microphone on an iPhone. Is there any way to do this? As far as I have read and attempted, it isn't possible. I have made extensive models with keras and even then determining the location of the sound is shaky at best due to the number of variables. So not including any ML aspects, is there a library or method to determine audio direction from an iOS microphone?</p>
| <ios><swift><audio> | 2020-02-26 17:20:54 | LQ_CLOSE |
60,419,279 | Why Array of ArrayLists Does't work in Java? | <p>I'm using an Array of ArrayLists of Integer in Java but it can't run. Every time I get the message
"Note: Goal.java uses unchecked or unsafe operations." and
"Note: Recompile with -Xlint:unchecked for details." after compile and when I want to run it message "Exception in thread "main" java.lang.NullPointerException" appears.</p>
<p>the code is (All is in main method) : </p>
<pre><code>int v = 8;
ArrayList<Integer>[] adj = new ArrayList[11];
adj[0].add(21);
</code></pre>
<p>and the error belongs to the last line.
searched a lot but nothing ! plz help, stuck for hours now.</p>
| <java> | 2020-02-26 17:22:41 | LQ_CLOSE |
60,422,162 | Javascript Date Library that uses online API? Rather than client machine? | I'm writing a node.js package that I want to distribute. I want a function to run at a certain time... but I don't want to use any of the popular JS libraries because they use the client's machine to determine date - rather I don't want this to be alterable.
Basically the script should break after a certain date and should not be able to be reverse by changing your PC's time. Is this possible?
P.S. I have no desire to create another server to serve this date. But that's the outcome I want to achieve.
| <javascript><date> | 2020-02-26 20:37:31 | LQ_EDIT |
60,422,322 | Write a function unction that takes as input ݊n and returns the matrix C, Cij= 0 if i/j<2 , Cij =ij^2 otherwise in MATLAB | Consider the ݊nxn matrix C with elements
Cij= 0 if i/j<2 ,
Cij =ij^2 otherwise
while 1=<i,y=<n
Write a Matlab function matSetup that takes as input ݊n and returns the matrix C .Use your function to create C for ݊ = 6. function [Cij]= matSetup(n)
I have written this but it seems not to be correct
```
function [Cij]= matSetup(n)
if (i/j)<2
Cij=0
else
Cij=i*(j)^2
while 1<i,j<n
end
end
end
``` | <matlab><matrix> | 2020-02-26 20:49:59 | LQ_EDIT |
60,422,411 | sidebar menu which scrolls down in sidebar | <p>i saw this several times on other sites but wasnt able to find how to do it easily.</p>
<p>I have a website with a submenu in the left sidebar, now i want the menu-widget to stick inside the sidebar area at top of window when i scroll down, so the menu comes with down. </p>
<p>After reaching the end of the sidebar-area it should leave at the end and waiting to scroll up or refresh the site. When scrolling up it should stop at the top sidebar-area border.</p>
<p><code>For better understanding:</code>
<a href="https://jsfiddle.net/6hrsod07/" rel="nofollow noreferrer">https://jsfiddle.net/6hrsod07/</a>
i want the red menu scrolling with down inside of the light red area.</p>
<p>Thank you very much in advance!</p>
| <javascript><jquery><html><css> | 2020-02-26 20:56:30 | LQ_CLOSE |
60,423,539 | How to join several arrays in PHP? | <p>I have this arrays:
Array ( [0] => 1 ) Array ( [0] => 1) Array ( [0] => 1 )</p>
<p>I want join to one array and result equal :
Array ( [0] => 1 , [1] => 1 , [2] => 1 )</p>
| <php> | 2020-02-26 22:25:53 | LQ_CLOSE |
60,424,777 | Mathematical notation or Pseudocode? | <p>At this moment I am concerned about which is the best way to explain an algorithm intuitively.</p>
<p>I have try to read some pseudocode an wow it may be complex for some cases (specially for math applications even more than the formulas itself or pure code like in PHP, C++ or Py). I have thought how about describe algorithms from mathematical notation in a way such that a mathematician could understand it and a web developer too.</p>
<p>Do you think it is a good idea ? (IF all the grammars and structure, symbols and modelings of it will be well explained and it is compact)</p>
<p>Example:
<a href="https://i.stack.imgur.com/IfkyK.png" rel="nofollow noreferrer">Binary Search</a></p>
<p>It even could help to simplify algorithm complexity if a mathematical analysis is done (I think)</p>
| <math><pseudocode><notation> | 2020-02-27 00:49:45 | LQ_CLOSE |
60,426,868 | Git rebase and push instead of pull | <p>Alternative for
1. git pull origin master
2. git add -a
3. git commit -m 'message'
4. git push</p>
<p>How can I do the above without using a pull and using a rebase
1. git rebase master
2. git add -a
3. git commit -m 'message'
4. git push</p>
<p>Is that all I need to do or am I missing anything. I want to use rebase to have a linear history.</p>
| <git> | 2020-02-27 05:37:56 | LQ_CLOSE |
60,427,304 | How should I go about querying SQL database based on html <a> click? | <p>What I want to do is when a user clicks an HTML a PHP file querys MySQL database and display the data in a popup tab. How should I go about doing this? Should I use javascript to handle the button events? Or can this be done with only PHP? Maybe a combination? You dont have show any code, maybe just a little guidance of how I should handle it. I am new to coding, only a week or so, thanks!</p>
| <javascript><php><html><css><mysql> | 2020-02-27 06:19:47 | LQ_CLOSE |
60,427,871 | How to correctly show a wxMessageBox with the value of "string01"? [C++, wxFormBuilder, wxWidgets] | How to correctly show a MessageBox with the value of "string01"? [C++, wxFormBuilder, wxWidgets]
gui.h:
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/button.h>
#include <wx/dialog.h>
#include <wx/msgdlg.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class MainDialogBase
///////////////////////////////////////////////////////////////////////////////
class MainDialogBase : public wxDialog
{
private:
protected:
wxStaticText* m_staticText3;
wxStaticText* m_staticText1;
wxTextCtrl* m_textCtrl1;
wxStaticText* m_staticText4;
wxTextCtrl* m_textCtrl2;
wxStaticLine* m_staticLine;
wxButton* m_button1;
wxButton* m_button2;
// Virtual event handlers, overide them in your derived class
virtual void OnCloseDialog( wxCloseEvent& event ) { event.Skip(); }
virtual void m_button1OnButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void m_button2OnButtonClick( wxCommandEvent& event ) { event.Skip(); }
public:
MainDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 191,252 ), long style = wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE );
~MainDialogBase();
};
gui.cpp:
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "gui.h"
///////////////////////////////////////////////////////////////////////////
MainDialogBase::MainDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
wxBoxSizer* mainSizer;
mainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizer8;
bSizer8 = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizer2;
bSizer2 = new wxBoxSizer( wxVERTICAL );
m_staticText3 = new wxStaticText( this, wxID_ANY, _("Patient's data"), wxDefaultPosition, wxSize( 105,-1 ), 0 );
m_staticText3->Wrap( -1 );
m_staticText3->SetFont( wxFont( 10, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxT("Sans") ) );
bSizer2->Add( m_staticText3, 0, wxALL, 5 );
wxBoxSizer* bSizer3;
bSizer3 = new wxBoxSizer( wxHORIZONTAL );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("First Name:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
bSizer3->Add( m_staticText1, 0, wxALL, 5 );
m_textCtrl1 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizer3->Add( m_textCtrl1, 0, wxALL, 5 );
bSizer2->Add( bSizer3, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer( wxHORIZONTAL );
m_staticText4 = new wxStaticText( this, wxID_ANY, _("Last Name:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText4->Wrap( -1 );
bSizer4->Add( m_staticText4, 0, wxALL, 5 );
m_textCtrl2 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizer4->Add( m_textCtrl2, 0, wxALL, 5 );
bSizer2->Add( bSizer4, 1, wxEXPAND, 5 );
bSizer8->Add( bSizer2, 1, 0, 5 );
mainSizer->Add( bSizer8, 1, wxEXPAND, 5 );
m_staticLine = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
mainSizer->Add( m_staticLine, 0, wxEXPAND | wxALL, 5 );
m_button1 = new wxButton( this, wxID_ANY, _("Record Data"), wxDefaultPosition, wxDefaultSize, 0 );
mainSizer->Add( m_button1, 0, wxALL|wxEXPAND, 5 );
m_button2 = new wxButton( this, wxID_ANY, _("List"), wxDefaultPosition, wxDefaultSize, 0 );
mainSizer->Add( m_button2, 0, wxALL|wxEXPAND, 5 );
wxBoxSizer* bSizer9;
bSizer9 = new wxBoxSizer( wxHORIZONTAL );
mainSizer->Add( bSizer9, 1, wxEXPAND, 5 );
this->SetSizer( mainSizer );
this->Layout();
this->Centre( wxBOTH );
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainDialogBase::OnCloseDialog ) );
m_button1->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogBase::m_button1OnButtonClick ), NULL, this );
m_button2->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogBase::m_button2OnButtonClick ), NULL, this );
}
MainDialogBase::~MainDialogBase()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainDialogBase::OnCloseDialog ) );
m_button1->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogBase::m_button1OnButtonClick ), NULL, this );
m_button2->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogBase::m_button2OnButtonClick ), NULL, this );
}
inheritedgui.h:
#ifndef __inheritedgui__
#define __inheritedgui__
/**
@file
Subclass of MainDialogBase, which is generated by wxFormBuilder.
*/
#include "gui.h"
//// end generated include
/** Implementing MainDialogBase */
class inheritedgui : public MainDialogBase
{
protected:
// Handlers for MainDialogBase events.
void OnCloseDialog( wxCloseEvent& event );
void m_button1OnButtonClick(wxCommandEvent& event) override;
void m_button2OnButtonClick(wxCommandEvent& event) override;
public:
/** Constructor */
inheritedgui( wxWindow* parent );
//// end generated class members
};
#endif // __inheritedgui__
inheritedgui.cpp:
#include "inheritedgui.h"
inheritedgui::inheritedgui( wxWindow* parent )
:
MainDialogBase( parent )
{
}
void inheritedgui::m_button1OnButtonClick(wxCommandEvent& event)
{
std::string string01 = m_textCtrl1->GetValue().ToStdString();
}
void inheritedgui::m_button2OnButtonClick(wxCommandEvent& event)
{
wxMessageBox( wxT(string01), wxT("This is the title"), wxICON_INFORMATION);
}
void inheritedgui::OnCloseDialog( wxCloseEvent& event )
{
// TODO: Implement OnCloseDialog
}
I'm trying to show the value of "string01" in a wxMessageBox (as seen in "inheritedgui.cpp"), however when I click "m_button2", nothing happens and I don't know why :/
https://i.postimg.cc/jd6WDc6z/Screenshot-20200227-040106.png
What changes do I need to do so the wxMessageBox shows up when I click "m_button2" (is the one which says "List")?
Thanks!
| <c++><wxwidgets><wxformbuilder> | 2020-02-27 07:03:47 | LQ_EDIT |
60,428,406 | Implement "docker rmi" in python docker api | I want to have the python equivalent to below command:
> docker rmi $(docker images -q -a)
So, remove() method is equivalent to rmi but how to about in "-q" and "-a" options. | <python><python-3.x><docker> | 2020-02-27 07:42:14 | LQ_EDIT |
60,429,654 | In Redux, Why it checks all reducer for one case to be executed? | <p>I came to know that in react-redux if we dispatch one action so it checks all cases of reducers throughout application.
In case of big application that should not be the right way.</p>
<p>Is it not time taking process and coz performance get reduced?</p>
| <reactjs><redux> | 2020-02-27 09:07:34 | LQ_CLOSE |
60,436,224 | How can I wrap children elements inside a div with pure javascript? | <p>For instance, I have the following code</p>
<pre><code><div class="parent>
<p> Item 1 </p>
<p> Item 1 </p>
<p> Item 1 </p>
</div>
</code></pre>
<p>I want turn the code above into the following code with pure javascript</p>
<pre><code><div class="parent>
<div class="parent-child>
<p> Item 1 </p>
<p> Item 1 </p>
<p> Item 1 </p>
</div>
</div>
</code></pre>
| <javascript> | 2020-02-27 15:07:13 | LQ_CLOSE |
60,436,349 | Why do I get a System.ArgumentOutOfRangeException: ''minValue' cannot be greater than maxValue. Parameter name: minValue' error? | <p>I've got an essential skills program which is very simple. The question is within the code.
I want the question to be loaded from a text file. </p>
<p>I have already added some questions to the text file.</p>
<p>I have a list index where a random question will be picked from the text file and it will load as a label. </p>
<p>The issue is when I try to load the question I get a:
<strong>System.ArgumentOutOfRangeException: ''minValue' cannot be greater than maxValue. Parameter name: minValue' error</strong></p>
<p>Here is my code: </p>
<pre><code> private void LoadQuestions()
{
if(Globals.intQuestionNumber == 11)
{
MessageBox.Show("Quiz complete - Redirecting", "Quiz Complete");
var fileStream = new FileStream(@"H:\(4)Programming\Assignments\EssentialSkills - Optimised\EssentialSkills\Numeracy\QuestionsLvl0.txt", FileMode.Open, FileAccess.Read);
using (var streamReader = new StreamReader(fileStream, Encoding.UTF8))
{
string line;
while ((line = streamReader.ReadLine()) != null)
{
stringAllInfo.Add(line);
MessageBox.Show(line);
}
}
char[] delimiterChars = { ',' };
foreach (string l in stringAllInfo)
{
string[] words = l.Split(delimiterChars);
strQuestion.Add(words[0]);
strAnswer.Add(words[1]);
Console.WriteLine(words[0]);
Console.WriteLine(words[1]);
}
Menus.Summary sum = new Menus.Summary();
sum.Show();
this.Hide();
}
else
{
lblCountdownval.Visible = false;
lblCountdown.Visible = false;
Globals.intQuestionNumber += 0;
lblQuestionsNumber.Text = "Question Number: " + Globals.intQuestionNumber.ToString();
Random random = new Random();
Globals.listIndex = random.Next(0, strAnswer.Count - 1);
lblQuestion.Text = strQuestion.ElementAt(Globals.listIndex);
Globals.listQuestonsAsked.Add(strQuestion.ElementAt(Globals.listIndex));
btnCorrect.Text = strAnswer.ElementAt(Globals.listIndex).ToString();
btnAnswer1.Text = random.Next(200).ToString();
btnAnswer3.Text = random.Next(200).ToString();
int locationIndex = random.Next(0, 3);
btnCorrect.Location = points.ElementAt(locationIndex);
locationIndex = random.Next(0, 3);
btnAnswer1.Location = points.ElementAt(locationIndex);
while ((btnAnswer1.Location == btnCorrect.Location))
{
locationIndex = random.Next(0, 3);
btnAnswer1.Location = points.ElementAt(locationIndex);
}
locationIndex = random.Next(0, 3);
btnAnswer3.Location = points.ElementAt(locationIndex);
while ((btnAnswer3.Location == btnCorrect.Location) || (btnAnswer3.Location == btnAnswer1.Location))
{
locationIndex = random.Next(0, 3);
btnAnswer3.Location = points.ElementAt(locationIndex);
}
btnAnswer1.Show();
btnCorrect.BackColor = Color.White;
btnAnswer3.Show();
}
}
</code></pre>
<p>and here are my Lists:</p>
<pre><code> public List<string> strQuestion = new List<string>();
public List<string> strAnswer = new List<string>();
public List<string> stringAllInfo = new List<string>();
</code></pre>
<p>I want the question from the text file to a label but I get that error. </p>
<p>Any advice?</p>
<p>Thanks. </p>
| <c#><windows><visual-studio><winforms> | 2020-02-27 15:13:44 | LQ_CLOSE |
60,438,175 | How to use "BinaryString.uncons()" but with a type distinct from Word8? | <p>I have a binary string. I want to split it into head and tail. The close candidate is from <code>bytestring</code> is:</p>
<pre><code>uncons :: ByteString -> Maybe (Word8, ByteString)
</code></pre>
<p>But I want to split it such that the head would be, say, of type <code>Word16</code> instead of <code>Word8</code>. Or <code>Word32</code>. Or anything else.</p>
<p>How can I do that?</p>
| <haskell><binary-data> | 2020-02-27 16:54:11 | LQ_CLOSE |
60,438,440 | Transform Get from api in async | Good afternoon,
im trying transform my action get all users to async but when i run, show me per example 2 users but without name email etc, but they're there because show edit and delete.
This is my code;
public IActionResult Index()
{
IEnumerable<User> users = null;
using (var client = new HttpClient())
{
client.BaseAddress = new Uri("https://localhost:5000/api/");
//HTTP GET
var responseTask = client.GetAsync("users/");
responseTask.Wait();
var result = responseTask.Result;
if (result.IsSuccessStatusCode)
{
var readTask = result.Content.ReadAsAsync<IList<User>>();
readTask.Wait();
users = readTask.Result;
}
else //web api sent error response
{
//log response status here..
users = Enumerable.Empty<User>();
ModelState.AddModelError(string.Empty, "Server error. Please contact administrator.");
}
}
return View(users);
}
What i try to transform in async;
public async Task<IActionResult> Index()
{
IEnumerable<User> users = null;
using (var client = new HttpClient())
{
client.BaseAddress = new Uri("https://localhost:5000/api/");
//HTTP GET
var response = await client.GetAsync("users/");
if (response.IsSuccessStatusCode)
{
var resulString = await response.Content.ReadAsStreamAsync();
users = await JsonSerializer.DeserializeAsync<IEnumerable<User>>(resulString);
}
else
{
ModelState.AddModelError(string.Empty, "Server error. Please contact administrator.");
}
}
return View(users);
} | <c#><asynchronous><.net-core> | 2020-02-27 17:07:57 | LQ_EDIT |
60,439,699 | How to run jar using shell script and wait for its completion and then perform other task | <p>I have to shell script which will firstly execute jar file then perform file handling after execution as that jar will be producing some output files.</p>
| <java><shell><unix> | 2020-02-27 18:35:58 | LQ_CLOSE |
60,440,509 | Android Command line tools sdkmanager always shows: Warning: Could not create settings | <p>I use the new Command line tools of android because the old sdk-tools repository of android isn't available anymore. So I changed my gitlab-ci to load the commandlintools. But when I try to run it I get the following error:</p>
<pre><code>Warning: Could not create settings
java.lang.IllegalArgumentException
at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.<init>(SdkManagerCliSettings.java:428)
at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.createSettings(SdkManagerCliSettings.java:152)
at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.createSettings(SdkManagerCliSettings.java:134)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:57)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
</code></pre>
<p>I already tried executing those commandy by hand, but I get the same error. Also if i run <code>sdkmanager --version</code>, the same error occurs.
My gitlab-ci looks like:</p>
<pre><code>image: openjdk:9-jdk
variables:
ANDROID_COMPILE_SDK: "29"
ANDROID_BUILD_TOOLS: "29.0.3"
ANDROID_SDK_TOOLS: "6200805"
before_script:
- apt-get --quiet update --yes
- apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
- wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_SDK_TOOLS}_latest.zip
- unzip -d android-sdk-linux android-sdk.zip
- echo y | android-sdk-linux/tools/bin/sdkmanager "platform-tools" "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null
#- echo y | android-sdk-linux/tools/bin/sdkmanager "platform-tools" >/dev/null
- echo y | android-sdk-linux/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" >/dev/null
- export ANDROID_HOME=$PWD/android-sdk-linux
- export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/
- chmod +x ./gradlew
# temporarily disable checking for EPIPE error and use yes to accept all licenses
- set +o pipefail
- yes | android-sdk-linux/tools/bin/sdkmanager --licenses
- set -o pipefail
stages:
- build
- test
lintDebug:
stage: build
script:
- ./gradlew -Pci --console=plain :app:lintDebug -PbuildDir=lint
assembleDebug:
stage: build
script:
- ./gradlew assembleDebug
artifacts:
paths:
- app/build/outputs/
debugTests:
stage: test
script:
- ./gradlew -Pci --console=plain :app:testDebug
</code></pre>
| <android><gitlab-ci><android-build><android-sdk-manager><android-studio-3.6> | 2020-02-27 19:32:08 | HQ |
60,443,148 | Adding first character of a string to each of the other characters | <p>I have a string <code>alphabet = "abcdefghijklmnopqrstuvwxyz"</code>
I need output like this
<code>
aa
ab
ac
ad
ae
af
...
ay
az
</code>
how would I add the first character to every one of the other characters and print it?
Thanks!</p>
| <python><arrays><string><list><char> | 2020-02-27 23:19:56 | LQ_CLOSE |
60,443,731 | How come I can't insert this JSON data to SQL Server? | I'm trying to insert the follwing json data to a table on our SQL Server with python code.
[![JSON DATA][1]][1]
And if I could solve this with executing a SQL statement, I would be so happy.
Because our Apprication server with python and SQL Server are completely different machines.
They are actually far apart each other.
Attempting the code below, I have occured an error. Could anyone give me some advise?
def jsonINSERT(_cn, _cur, jdata):
SQL = """
INSERT INTO TSTTBL VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
"""
_cur.executemany(SQL, jdata)
_cn.commit()
return
## 'The SQL contains 56 parameter markers, but 1 parameters were supplied', 'HY000' ##
[1]: https://i.stack.imgur.com/pfI49.png
Thanks in advance. | <python><json><sql-server> | 2020-02-28 00:35:17 | LQ_EDIT |
60,443,810 | how to match /foo/:id/bar?any_query_string_I_want with regex | <p>This is a page URL and the :id param changes based on the resource and the query string can be all over the map.</p>
<p>How can I match /foo/:id/bar?anything</p>
<p>thanks in advance</p>
| <php><regex> | 2020-02-28 00:47:59 | LQ_CLOSE |
60,444,250 | How can i change prinf("%.2f") in C++ | How can i change prinf("%.2f") in C++ so that it will also diplay upto two decimals
Aslo for this to change in c++
Printf("-6c%14d%20.2f",'A',val1,val2);
I have declared val1,val2 in double
| <c++><formatting><number-formatting><cout> | 2020-02-28 01:58:11 | LQ_EDIT |
60,444,757 | WhY in C programming ,perc value show 0 as output? | <p>perc=(sum/total)*100;</p>
<p>i've been trying to put this in the code in cprogramming,but output for this part is showing 0,,,Why is this happening and what else should I do in these types of scenerios?</p>
| <c> | 2020-02-28 03:15:18 | LQ_CLOSE |
60,446,009 | Is it possible to keep track of a random character in swift? | <p>I created a project and I added that swipe gesture thing, my ViewController has a label when I swipe left👈 It replaces my label with random string from my array (It works ok),However when I swipe right👉 I want to see the previous string from my array the problem is that it is a random string so I can’t keep track of it, any ideas how to do it?</p>
| <ios><arrays><swift><xcode><random> | 2020-02-28 05:55:55 | LQ_CLOSE |
60,447,276 | New to programming, function does not work inside class | <pre><code><?php
class spel {
function randomWoord() {
$woorden = array(
'Juan',
'Luis',
'Pedro',
// and so on
);
return $woorden[rand ( 0 , count($woorden) -1)];
}
print randomWoord();
}
?>
</code></pre>
<p>New to programming, function does not work inside class. When I remove the class, it does work. How can I fix this.</p>
| <php> | 2020-02-28 07:41:55 | LQ_CLOSE |
60,454,978 | Input Data is not loading into Database | I am encountering the folowing problem:
I have a program which is supposed to load the data into a database and it is not working. No errors popping out, it just does not load.
Here is the connection code:
public Conexion()
{
string dataSource = ".\\SQLEXPRESS";
string rutaBase = HostingEnvironment.MapPath(@"/App_Data/Database1.mdf");
cadenaConexion = "Data Source=" + dataSource + ";AttachDbFilename=\""
+ rutaBase + "\";Integrated Security=true;User Instance=True";
} | <c#><sql><asp.net><sql-server> | 2020-02-28 15:42:03 | LQ_EDIT |
60,455,266 | From left/right to center transition with buttons | <p>I want my buttons on my page to go from the left/right to the center when the page loads. Is there a way I can do it? I wanna make the first one from left, second from right, etc. I'm thinking of using tags for each button- #button1, #button2 etc- and using CSS to make the animations, but don't know how. Can anyone help? (If you know a JS way that works too, but I don't know too much JS or CSS as of now. I know more CSS than JS so CSS if preferred)</p>
| <javascript><css><button> | 2020-02-28 15:58:28 | LQ_CLOSE |
60,455,327 | C#: How can I add a list of values into a msql WHERE IN clause | I have a list of values and want to use it in a query but how can I add each value with quotes into mysql where clause.
List <string> customerlist = new List<string>();
sql = SELECT * FROM customerlist WHERE custid IN customerlist
I am getting the error
[![enter image description here][1]][1]
I need to add quotes around them. Can you advice how I can do that please?
[1]: https://i.stack.imgur.com/GpSAM.png | <c#><mysql> | 2020-02-28 16:02:21 | LQ_EDIT |
60,458,575 | MySQL how to query five tables in one SELECT | <p>I have 5 tables as follows:</p>
<ul>
<li><strong>tbl_individ</strong> - consists of user data (<em>uID, Firstname, Lastname, Mobile, eMail</em>)</li>
<li><strong>tbl_role</strong> - consists of roles (<em>rID, Rolename, RoleDescription</em>)</li>
<li><strong>tbl_group</strong> - consists of groups (<em>gID, Groupname, GroupDescription</em>)</li>
<li><strong>tbl_inro</strong> - consists of which roles a user has (<em>uID, rID</em>)</li>
<li><strong>tbl_ingr</strong> - consists of which groups a user belongs to (<em>uID, gID</em>)</li>
</ul>
<p>I'd like to achieve the output where I list all the users in the <strong>tbl_individ</strong> and list what each user what roles they has and as well what groups they belong to.</p>
<p>I created the <strong>tbl_inro</strong> to only map the user (uID) and the role (rID) and the same for the <strong>tbl_ingr</strong> to only map the user (uID) and the group (gID).</p>
<p>It all as output in one row?</p>
| <mysql> | 2020-02-28 20:07:09 | LQ_CLOSE |
60,460,748 | Copy value of list not reference | <p>I have a list that i want to compare to after it gets modified. The previous_list = current_list followed by a modification to the current_list. But the issue i have is anytime the current_list is updated, the previous_list is also updated because everything in python is a reference. Ive tried, </p>
<pre><code>previous_list = current_list[:]
previous_list = current_list.copy()
previous_list = list(current_list)
</code></pre>
<p>but none of these work, every time current_list is updated the previous list is updated immediately without reading this line,</p>
<pre><code>previous_list = current_list[:]
</code></pre>
<p>again. </p>
<p>My goal is to have a while loop the runs until the list are equal. Each loop the current_list is modified after the previous_list is updated with the current_value. I thought the solution was using one of the copy methods above to create a copy of the list and assign but maybe that is a reference too then.</p>
| <python> | 2020-02-28 23:54:33 | LQ_CLOSE |
60,461,193 | Weird question, but how do I make a python script to check if python is installed? | <p>Before you get confused, I am going to compile it with the auto-py-to-exe module after, its just the source code is in python. How do I do this?</p>
| <python><python-3.x> | 2020-02-29 01:25:40 | LQ_CLOSE |
60,461,435 | Convert List<String> to string C# - asp.net - sql server - | <p>I am new to this and I am asking for help to convert a string type data, I made an sql connection where I returned a name, address and phone number found in another table</p>
<p><a href="https://i.stack.imgur.com/7UVEp.png" rel="nofollow noreferrer"><code>List string eTelefono</code></a>
<a href="https://i.stack.imgur.com/VNAOq.png" rel="nofollow noreferrer"> <code>while _Reader.Read</code></a>
<a href="https://i.stack.imgur.com/z9Ud6.png" rel="nofollow noreferrer">Builder</a></p>
<p>(If you see something in spanish is beacause im from Uruguay)
This the error
<a href="https://i.stack.imgur.com/6TxWB.png" rel="nofollow noreferrer"><code>error System.String to System.Collections.Generic.List 1 System.String</code></a></p>
<p>Does anyone know how to convert <code>List <string></code> to <code>string</code>?</p>
<p>Thanks!
If you need more captures just ask</p>
| <c#><asp.net><sql-server> | 2020-02-29 02:22:18 | LQ_CLOSE |
60,461,754 | Does Python execute code from the top or bottom of the script | <p>I am working on learning Python and was wondering in what way the scripts are executed what i mean like this if Python runs the code from the beginning of the script or the bottom </p>
| <python> | 2020-02-29 03:33:59 | LQ_CLOSE |
60,462,001 | how to change payment date in Azure? | <p>It looks like it costs 8 days per month in Azure. How do I change my billing date? What permissions do I need to change the payment date?</p>
| <azure><billing> | 2020-02-29 04:34:16 | LQ_CLOSE |
60,465,318 | how to implement fill in the blank in Swift | <p>"I _____ any questions."</p>
<p>I want to implement a quiz that clicks parentheses in that phrase and puts the correct answer by typing the keyboard in the parentheses.</p>
<p>Every time I get a letter, the underline also increases and I have no idea how to implement it.</p>
<p>Please advise me how to implement that in Swift.</p>
| <ios><swift> | 2020-02-29 12:50:43 | LQ_CLOSE |
60,468,018 | How can I make a c# application outside of visual studio? | <p>I'm very new to programming and I'm teaching myself. I made a calculator for some calculations we do in the lab I work in and wanted to be able to open the app from the computer at work instead of opening it on visual studio from my laptop. Just curious if this is possible, and I've been trying to Google if this is possible but I don't think I'm using the right words in my searches.</p>
<p>If this is possible, it'd be awesome if someone could help me out with an explanation or a link to a video or thread that already explains this. </p>
<p>Thank you for your time!!</p>
| <c#><visual-studio> | 2020-02-29 17:55:56 | LQ_CLOSE |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.