input_text_instruct stringlengths 288 45.8k | output_text stringlengths 37 33.2k |
|---|---|
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Configure vue-echart-v3 with Vue for supporting IE<p>I am trying to use echarts with vuejs. I have found <a href="https://www.npmjs.com/package/vue-echarts-v... | <p>Try this.</p>
<p>The documentation of vue-echarts-v3 does not inform it, but you have to add the echarts on your webpack (or any other bundler you are using) configuration as well.</p>
<pre><code>{
test: /\.js$/,
loader: 'babel-loader',
include: [
resolve('src'),
resolve('test'),
reso... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to run a subquery based on results of a query SQL<p>I have 2 queries i'd like to run. The idea here is to run a query on the transaction table by the tr... | <p>If I understand the requirements properly you can use <a href="https://msdn.microsoft.com/en-GB/library/ms186734.aspx" rel="nofollow"><code>ROW_NUMBER</code></a> to determine which record is the latest per customerID. Then you can JOIN this back to the transactions table to determine if there is a match in ServiceID... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unable to deploy Angular app to Spring Boot<p>I have an Angular app as well as a rest API using Spring Boot that I need to package as a single war file to be... | <p>Your build order should be the following for this to work:</p>
<ul>
<li>Build the front-end application (Angular)</li>
<li>Build the REST application (the Spring Boot app)</li>
</ul>
<p>You will need to do this because you are going to need the <code>dist</code> folder in the angular app, which contains the produc... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Sending mail with attachment with JavaMail - Exception while writing Multipart<p>I want to send mails with attachments using JavaMail, but I am encountering ... | <p>I don't understand what you're trying to do here:</p>
<pre><code>messageBodyPart.setContent(message, "text/plain; charset=" +
MimeUtility.quote("us-ascii", HeaderTokenizer.MIME));
</code></pre>
<p>I'm sure you don't mean to add the MimeMessage object itself as
the content of a message body part. A... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Complex query with mongoose, including subdocuments, near condition,<p>I have a very (at least for me) complex query using Mongoose.</p>
<p>First of all my ... | <p>This is how it worked for me:</p>
<pre><code>ObjectSchema
.where('handoverStartDate').gte(trip.startDate)
.where('handoverEndDate').lte(trip.endDate)
.where('handoverAddress.loc').near({
center: {
type: 'Point',
coordinates: trip.address.loc
},
maxDistance... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
change of histogram to line plot by ggplot<p>I need to plot the geom_histogram but as the plots overlap, I want to plot it linear instead of bars, i.e, the x... | <p>You can use <code>geom_freqpoly</code>:</p>
<pre><code>library(ggplot2)
library(scales)
ggplot(mtcars, aes(x=hp, y=..count../sum(..count..))) +
geom_freqpoly(binwidth=5) +
scale_y_continuous(labels = percent_format()) +
ylab("Percent")
</code></pre>
<p><a href="https://i.stack.imgur.com/N5Hvi.png" rel="nof... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is it possible to create data with a specific slope and pearson correlation coefficient in R?<p>For example, I would like two variables, <code>x</code> and <... | <p>Changes of scale will not change the correlation coef:</p>
<pre><code>> out2[,2] <- out[,2]*10
> cor(out2)
[,1] [,2]
[1,] 1.0 0.5
[2,] 0.5 1.0
plot(out2)
> lm(out2[,2]~out2[,1])
Call:
lm(formula = out2[, 2] ~ out2[, 1])
Coefficients:
(Intercept) out2[, 1]
-5.732e-16 5.000e+00
</... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Best Local Storage Techniques for a Meteor/Cordova App<p>I am building a Meteor/Cordova application that I need to store data even between application restar... | <p>I think that you are looking for the <a href="https://atmospherejs.com/ground/db" rel="noreferrer">ground:db</a> package it works perfectly offline.</p>
<p>Concept (from docs.)</p>
<blockquote>
<p>Localstorage is simple and widely supported - but slow - Thats why we
only use it for caching databases and method... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Display file name for custom input file using Reactjs<p>I have a custom input for files but the choosen file is not displayed and I don't know how to display... | <p>You can save the file name in the <code>handleselectedFile</code> event like this:</p>
<pre><code>handleselectedFile = event => {
this.setState({
selectedFile: event.target.files[0]
//**** added line below ****//
selectedFileName: event.target.files[0].name
});
};
</code></pre>
<... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Shiny : How to get vector of options in selectInput<p>My ui.R file has a selectInput like this:</p>
<pre><code>selectInput("cluster", "Cluster:",
... | <p>In your case, I would probably just use a <code>switch</code> statement. I also took the liberty of adding a <code>validate</code> statement requiring an option to be selected.</p>
<pre><code>library(shiny)
East <- c("Strasbourg","Grenoble","Nice")
South <- c("Nice","Montpellier","Marseille")
Total <- c... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to infer travel mode using a mobile phone?<p>I am writing a travel optimization app. I would like to get some feedback on what would be the best way to d... | <p>You can use <a href="https://developer.android.com/reference/com/google/android/gms/location/DetectedActivity.html" rel="nofollow">DetectedActivity</a> that should solve your problem. You may use ActivityRecognition<a href="https://developer.android.com/reference/com/google/android/gms/location/ActivityRecognition.h... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Chef windows Bootstrap ignoring knife.rb chef_server_url setting<p>Command Ran from Chef Workstation to bootstrap a node:</p>
<p>knife bootstrap windows win... | <p>I found the answer here: <a href="https://github.com/chef/chef/issues/2796" rel="nofollow">https://github.com/chef/chef/issues/2796</a>
The issue was -l debug. This is not valid syntax for knife bootstrap command which was somehow causing knife to try and use chef zero</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to optimize my performances using FlatFileItemReader and Asynchronous Processors<p>I have a simple csv file with ~400,000 line(one column only)
It takes ... | <p>Increasing your commit count is where I'd begin. Keep in mind what the commit count means. Since you have it set at 1, you are doing the following <strong>for each item</strong>:</p>
<ol>
<li>Start a transaction</li>
<li>Read an item</li>
<li>Process the item</li>
<li>Write the item</li>
<li>Update the job reposi... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Socket Exceptions when trying to connect to MySql database from gitpod IDE (ubuntu server)<p>I'm working with the gitpod online IDE ( vs code in the browser ... | <p>From the call stack, it looks like you're compiling your code to wasm using Blazor. This code is running in the browser and is subject to all the limitations of the browser sandbox. More specifically, there is no ability in a browser to open a TCP socket for network communication.</p>
<p>Some more background info i... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
CSS coding not applying to <a><p>It will Apply to other elements, but not the first one, no matter what I try It will not work, suspect its a missing tag so... | <p>You've got a double bracket which breaks the CSS. Just remove it</p>
<pre><code>}
} <== this one
.makethelinknice {
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to solve this problem:Multi Line Task: Hello World (Easy one) on codewars.com<p><a href="https://www.codewars.com/kata/5e41c408b72541002eda0982" rel="nof... | <p>Interesting puzzle. To get around the need to explicitly pass an argument to <code>f</code>, you can create a class with <code>t</code> (which is <code>type</code>), and use <code>k</code> to create a <code>__new__</code> method that returns <code>'Hello, world!'</code>. Since <code>__new__</code> is a class method,... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
jQuery slideDown() error<p>When I set up my site like this:</p>
<p>HTML:</p>
<pre><code><form action="">
<div id="leftStreak">
<... | <p>If this isn't what you're seeing, you'll have to give us more animation code to analyze or post an image. It seems to work for me.</p>
<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>$('#mainLabel').slideDown();</co... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
getApplicationContext() error Android<p>I have a fragment that allows a user to enter in a message and a phone number to which the message will be delivered.... | <p>The method getApplicationContext() does not exist in the class <code>Fragment</code>. It does exist, however, in the class <code>Activity</code>, so you can use <code>getActivity().getApplicationContext()</code> to get the context from within a fragment object. (Assuming the fragment is attached to an activity so <c... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Indexes on BigQuery Table<p>I have a use case in which we have a few tables in BigQuery.
Now I want to implement an index on one of the columns in the BigQue... | <p>2019 update: Check out how c<a href="https://medium.com/google-cloud/bigquery-optimized-cluster-your-tables-65e2f684594b" rel="noreferrer">lusters improve your querying times and data scanned</a>:</p>
<ul>
<li><a href="https://medium.com/google-cloud/bigquery-optimized-cluster-your-tables-65e2f684594b" rel="norefer... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
HTTP post xml data .net4 c#<p>I am trying to post a xml data </p>
<p>Current I am doing this. requestXml is XmlDocument.</p>
<pre><code>var connectionStrin... | <p>This code says that you want to receive a .net String object serialized as XML or JSON.</p>
<pre><code>// POST api/Contact
public SomeObject[] Post([FromBody]string message)
{
return new SomeObject[];
}
</code></pre>
<p>That would look something like </p>
<pre><code><string xmlns="...">some string</s... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R foreach parallel can not find global function<p>I try to replace <code>lapply</code> function with parallel <code>foreach</code>.
I have two functions:</p>... | <p>Use the foreach <code>.export</code> option to explicitly export <code>dRet</code> to the workers:</p>
<pre><code>Es_2 <- foreach(a = stlst, .export='dRet') %dopar% dRetlst(a)
</code></pre>
<p>Also, I think the foreach loop would be more readable as:</p>
<pre><code>Es_2 <- foreach(a = stlst, .export='dRet')... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Triggering a Javascript/jQuery on next page<p>I am writing an in house jobs management workflow and want to trigger a JavaScript function when I redirect the... | <p>If you're using jQuery, You can display an alert on DOMContentLoaded like this</p>
<pre><code>$(document).ready(function(){
alert('Operation Success!');
});
</code></pre>
<p><code>DOMContentLoaded</code> event is fired when HTML is parsed and scripts are executed but before other resources like css/images are co... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Specific Regex Pattern<p>I wish to take a string input from the user and extract words or numbers like so:</p>
<pre><code>String problem = "I'm lo#o@king t%... | <p>You could do like the below.</p>
<pre><code>String s = "I'm lo#o@king t%o ext!r$act a^ll 6 su*bs(tr]i{ngs.";
String parts[] = s.replaceAll("[^\\s\\w']|(?<!\\b)'|'(?!\\b)", "").split("\\s+");
System.out.println(Arrays.toString(parts));
</code></pre>
<p>Output:</p>
<pre><code>[I'm, looking, to, extract, all, 6, ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I use a models id while making a factory of the same model?<p>What I'm trying to do is get the user id in a factory so I can store a hashed version of... | <p>You should make an observer to follow every database record creation.</p>
<p>That will allow you to proxy the creation and modify the data.</p>
<p>See: <a href="https://laravel.com/docs/5.8/eloquent#observers" rel="nofollow noreferrer">https://laravel.com/docs/5.8/eloquent#observers</a></p>
<p>Or you can directly... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Listview OnClick does not work<p>I have some code that displays a ListView and allows an item to be clicked to take it to a single view activity. However, fo... | <p>Use <code>android:descendantFocusability="blocksDescendants"</code> in your list item layout</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Losing colors after rotating an RGBA image using PIL<p>I'm trying to rotate an RGBA image using PIL, this is what the image looks like:</p>
<p><img src="htt... | <p>Short answer:</p>
<pre class="lang-py prettyprint-override"><code>alpha = image.split()[-1]
image = image.convert('RGB').rotate(angle)
image.putalpha(alpha.rotate(angle))
</code></pre>
<hr>
<p>Refer to the source code:</p>
<p><a href="https://github.com/python-pillow/Pillow/blob/master/src/PIL/Image.py#L2324" re... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Displaying data from Vuex store in component based on route<p>I have the following data in Vuex store:</p>
<pre><code> state: {
news: [
{ id: 1, ... | <p>'error that newsId is not defined'</p>
<p>so what you want is vuex getters</p>
<pre><code><script>
import { mapGetters } from 'vuex'
computed: {
...mapGetters([
news
]),
newsId() {
return this.news.find((newsId) => { return newsId.id == this.$route.params.id})
}
}
</code></pre>
<p>i... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Speed of summation over a boolean array<p>suppose I want to sum over an array of booleans:</p>
<pre><code>bool arrray[LARGE_SIZE];
</code></pre>
<p>which o... | <p>Always <strong>MEASURE</strong>. Only measurement can tell you how the code behaves in a given context (given compiler and options, given machine, given load etc.). Still, the code without a choice has a better chance of performing well, if the choice is not optimized away by the compiler.</p>
<hr>
<p>If the speed... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Selecting one checkbox deselects other options in tkinter<p>I have an LED panel with UV, Green, and Blue. Trying to figure out how once I click "No Light" (... | <p>You can assign a callback using <code>command</code> option for the four <code>Checkbutton</code> and in the callback, reset the other three checkbuttons or reset the <code>No light</code> checkbutton based on the passed value of the callback and the current states of the checkbuttons:</p>
<pre><code>def reset(flag... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Difference between reasoners in Protege 5.0.0<p>I have build a small ontology in Protege 5.0.0. When I run Hermit 1.3.8.3 reasoner, it outputs status as:</p>... | <p>(This correspond to the ontology linked to in <strong>UPDATE 1</strong>)</p>
<p>The ontology is inconsistent according to the OWL 2 DL Standard, FaCT++ is correct there. The reason why the ontology is inconsistent is as follows.</p>
<p>1) There is a data property <code>measures</code> in the ontology, described as... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
RSpec Devise Session Testing<p>With rails 4.2.0 and the latest version of RSpec I generated a controller test. </p>
<p>How would I ensure my admin user is l... | <p>First you need to add the devise helpers in <code>spec_helper</code> file to be accessible in the tests, <a href="https://github.com/plataformatec/devise/wiki/How-To:-Test-controllers-with-Rails-3-and-4-%28and-RSpec%29#controller-specs" rel="noreferrer">as mentioned in the wiki</a></p>
<pre><code>RSpec.configure do... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What's the real difference between Alternate Key and HasIndex with uniqueness in EF core?<p>I'm intrested in what is the real difference between this</p>
<p... | <p>From the <a href="https://docs.microsoft.com/en-us/ef/core/modeling/keys?tabs=data-annotations#alternate-keys" rel="noreferrer">official documentation</a>:</p>
<blockquote>
<p>If you just want to enforce uniqueness on a column, define a unique
index rather than an alternate key (see Indexes). In EF, alternate
keys a... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I create a pattern to only match a specific set of characters?<p>I'm looking for a way search in a string for a very specific set of characters: <code... | <p>To check if a string contains <code>"</code>, <code>(</code>, <code>)</code>, <code>,</code>, <code>:</code>, <code>;</code>, <code><</code>, <code>></code>, <code>@</code>, <code>[</code>, <code>\</code> or <code>]</code> you may use</p>
<pre><code>function ContainsSpecialChar(input)
return string.find(... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ngOnInit() is bing called again and again after authentication failure from a call from inside of ngOnInit()<p>I am working on a simple angular app. There ar... | <p>You have an <code>ErrorInterceptor</code> which reloads when there is 401.You said there is some authentication issue in post service, see if it returns 401 then your <code>ErrorInterceptor</code> causes page to reload again and again.</p>
<pre><code> if (err.status === 401) {
// auto logout if 401 resp... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python: Efficient way to iterate over a list and a dictionary simultaneously containing similar values<p>I have two data structures: a list and a defaultdict... | <p>Loop over the terms in the list, not the key-value pairs in the dictionary:</p>
<pre><code>>>> l = [500,800,1500]
>>> d = {800:3, 1500:1, 500:4}
>>> [d[x] for x in l]
[4, 3, 1]
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SQL expected 0 arguments, got 1<p>I'm executing the following stored procedure:</p>
<pre><code>rows, err := w.repo.GetConn().Queryx("EXEC [Users].[User_Get]... | <p>The problem was in <code>driverName</code> I put <code>mssql</code> there instead of <code>sqlserver</code>)</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Trying to scale svg to a parent container<p>I have been trying to scale <code>SVG</code> but failing to do so, I have banged my head enough but none of the s... | <p>I believe the key property you are looking for is <code>preserveAspectRatio="none"</code>, as well as width/height set on the svg element. I altered the CSS to reduce it to just what you need. You'll need to set the size where you'd like it. I simplified your svg file as well</p>
<p><div class="snippet" data-lang="... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get a value for liquid variable<p>If I have this:</p>
<pre><code>"attributes": {
"color": [
{
"id": 29907472,
"name": "Green",
"display... | <p>'name' at the beginning of the loop isn't the property, it's creating a local variable for the loop. Take a look at <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in" rel="nofollow">MDN's for-in loop documentation for Javascript</a>. It works similarly.</p>
<p>Try this:<... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Custom UITableViewCell abandoned memory issue on Select<p>I'm having an issue on iOS using a custom UITableView with a custom UITableViewCell. When I run the... | <p>If you just have to pass keyFile name you use this way. Make sure you have linked keyFile in interface builder</p>
<pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath2:(NSIndexPath *)indexPath
{
NSString *cellIdentifier = @"cellID";
customViewCell *cell = (customViewCe... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
AttributeError: [class] object has no attribute [variable in class]?<p>A part of my program needs to be able to play MIDI files, so I have an Entry in tkinte... | <p><code>SongPath</code> is defined as a local variable in the <code>__init__</code> method. To made this variable an attribute, write</p>
<pre><code>self.SongPath = tk.Entry(self)
</code></pre>
<p>Do note that the naming conventions you are using for instance vairables conflicts with <a href="https://www.python.org/... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Process.Start cmd.exe won't run cmd file that is passed as agument when running in IIS<p>I've been searching and experimenting all morning with this one and ... | <p>Running a batch file or any process per say from an ASPX page is futile as IIS does not run under a true Windows User Context. Because of this, regardless of how many settings and rights you give to the user that the AppPool is running under or whatever type of config changes you make, it simply will never work. I r... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to programmatically escape wildcards in SQL LIKE?<p>I'm creating a stored procedure that accepts a string parameter used for searching a table. Following... | <p>Need to insert on each special character a escape character. As you said, you can stack a bunch of <code>REPLACE</code> functions:</p>
<pre><code>DECLARE @Prefix VARCHAR(100) = 'My%Prefix_'
DECLARE @Replaced VARCHAR(100) = REPLACE(REPLACE(REPLACE(REPLACE(@Prefix, '%', '\%'), '^', '\^'), '_', '\_'), '[', '\[')
SEL... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
iOS PDF native search<p>I need to present and open pdf documents in my app. I would like to avoid third part libraries, because of update reasons (and I coul... | <p>You'll likely wont find any 3rd-party frameworks written in Swift yet, simply because as of Swift 2.2 it's not binary compatible yet, and any binary framework written in Swift would be very fragile to break with even a minor update of Xcode (and updates to the compiler, that is).</p>
<p>I'm working on the commercia... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What shall I do if I want use new feature without update compiler?<p>eg. I want to use <code>std::byte</code> only, I don't need other new features in 17. bu... | <p>When you want your code to be backward-compatible with older C++ versions, you typically provide your own implementations of the missing component in your compatibility layer. For example, you create a <code>byte.h</code> header that defines <code>byte</code> type in your own namespace, something like this:</p>
<pr... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Run Roslyn analyzers during live code editing but not during build<p>The Roslyn code analyzers work both in live code editing and at build time.</p>
<p>Howe... | <p>You can use <code>RunAnalyzersDuringBuild</code> in the .csproj:</p>
<pre class="lang-xml prettyprint-override"><code><PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RunAnalyzersDuringBuild>false</RunAnalyzersDuringBuild>
</PropertyGroup>
</code... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Exception Access Violation?<p>I don't understand, i am learning LWJGL but when i put that code:</p>
<pre><code>public void render()
{
glBindBuff... | <p>Access violations in LWJGL are mainly caused by buffer sizes and render call counts not fitting.</p>
<p>You should check if your <em>vID</em> really holds <code>CHUNK_SIZE * CHUNK_SIZE * CHUNK_SIZE * (3 * 4 * 6)</code> elements to draw. See <a href="https://www.opengl.org/sdk/docs/man3/xhtml/glDrawArrays.xml" rel="... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to plot the next period value of a variable against its past period in R<p>I am trying to plot a difference equation using R. I have the following MWE:</... | <p>I see two problems:</p>
<p>1.The N in your example is to small. To see the stable spiral set the N to 100 or 1000</p>
<p>2.Your plots show exactly what I would expect, but I don't think they do what you want to do ;)</p>
<p>p1 plots the second last element of <code>x</code> <code>x[t]</code> on the x axis (<code>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there any PDF command, that scales rectangle coordinates?<p>I have an application, that extracts text and rectangles from pdf files for further analysis. ... | <p>The command you are looking for is <code>cm</code>. Did you read <a href="https://leanpub.com/itext_pdfabc/" rel="nofollow noreferrer">The ABC of PDF with iText</a>? The book isn't finished yet, but you can already download the first five chapters.</p>
<p>This is a screen shot of the table that shows the <code>cm</... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I get a count of percent negative and order by most negative?<p>I figured out a way to do a group by and get counts based on two fields:</p>
<pre><c... | <p>Try</p>
<pre><code>x = df.groupby(['brand'])['result'].value_counts(normalize=True)
</code></pre>
<p>Sample data output</p>
<pre><code>>>> y = x.loc[(x.index.get_level_values(1) == 'negative')]
>>> y[y>0.2]
airline airline_sentiment
American negative 0.710402
Delta... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to update FullCalendar events using a search function?<p>I have my search set up like so.</p>
<pre><code># Viewings controller
def index
@rmque... | <p>You probably need to tie the search function to calling the calendar function in events.js.coffee:</p>
<pre><code>$(document).ready ->
$("#calendar").fullCalendar(
events: '/events.json'
)
</code></pre>
<p>Not sure how to do this, but you want to trigger this function after each search, because you are ge... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I'm not able to test my sails.js controller with chai and sinon<p>I have a controller <strong>Acounts</strong> with a method <strong>sum</strong>, and a serv... | <p>The problem was the lifecycle file I created trusting in sails docs. That documentation is for integrated testing due to the fact that it lifts sails before any other test. This is quite slow while unit tests should be fast. Erasing that file was enough to test the controller successfully. Otherwise sails messes up ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Exporting CSS Rules with awk<p>I'm trying to export a css rule from a css file with awk but I am not able to do it. I need only the rules containing the "bac... | <p>Turn accumulation on after matching an open brace. Accumulate all lines while flag is on. Turn off after closing brace is seen. Print only if background-image found during accumulation. If you want to include lines before the match you do do something like this.</p>
<pre><code>{ line4 = line3; line3 = line2; line2 ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How send N get requests where N > 10 URLS<p>I'm trying to make N get requests, but my code work for 8 URLs but 10 always stack without issue.</p>
<p>I'm new... | <p>The first issue here is that you aren't returning a response in the case of an error, so the <code>len(responses) == len(urls)</code> is likely to never match, forcing your loop to continue forever.</p>
<p>Start by adding a <code>sync.WaitGroup</code> for the concurrent requests</p>
<pre><code> var wg sync.Wait... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Handling exceptions inside of multithreaded splitter/aggregator orchestration to go to aggregator instead of MessagingGatewaySupport's errorChannel<p>I curre... | <p>You need another gateway between the splitter and chain, with a flow on its error channel to transform and send the failure to the aggregator.</p>
<p>The reply from your inner gateway will go to the chain's output channel.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to know if an RDF graph is lean?<p>I just discovered the definition of a <a href="https://www.w3.org/TR/rdf11-mt/#dfn-lean" rel="nofollow noreferrer">lea... | <p>The example at <a href="https://www.w3.org/TR/rdf11-mt/#dfn-lean" rel="nofollow noreferrer">https://www.w3.org/TR/rdf11-mt/#dfn-lean</a></p>
<blockquote>
<p>For example, the graph</p>
<p>ex:a ex:p _:x .<br>
_:y ex:p _:x .</p>
<p>is not lean, but</p>
<p>ex:a ex:p _:x .<br>
_:x ex:p _:x .</p>
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get rowCount before execute query JPA<p>I'm trying to build a Pagination inside my system. In DAO i'm using "setFirstResult()" and "setMaxResults()" to limit... | <p>There is no way to calculate the total count of results without using Criteria API or (as you said) creating another query manually. Both of them will cause to a separate query against database to calculate the total counts. I had some experiences in this context. It may doubles your response time if your query is g... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to use include in javascript in my code?<p>groupMapdata from API is coming as </p>
<pre><code>[
{
"menu_id": 1666667,
"menu_name_mes... | <p>You should use <code>Array.prototype.some</code> to detect the presence of at least one match.</p>
<p>Also, <code>Array.prototype.includes</code> will not locate the integer version of the number; you will need to map/parse the role ids into integers before checking.</p>
<pre class="lang-js prettyprint-override"><... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python `open` function memory usage<p>Does Python interpreter load all the file to RAM when it is opened for writing?</p>
<pre><code>with open('file.txt' 'w'... | <p>No. As per <a href="https://docs.python.org/2/library/functions.html#open" rel="noreferrer">the docs</a>, open() wraps a system call and returns a file object, the file contents are not loaded into RAM (unless you invoke, E.G., readlines()).</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Argument must be a string or a number issue, Not 'Type' - Pyspark<p><strong>Update:</strong>
So i have been looking into the issue, the problem is with sciki... | <p>Problem was with select_data() function, data type of variables was being changed during the execution. This issue is fixed now.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Binding scope values to ui-select-match attributes in angular's ui-select<p>I'm using AngularUI's UI-Select to create rich selects in my application, and I'm... | <p>If I got you right, you could just wrap your value in <code>{{...}}</code> to make it work, like this:</p>
<pre><code><ui-select-match placeholder="..." allow-clear="{{!!$parent.allowClear}}">{{$select.selected.DisplayText}}</ui-select-match>
</code></pre>
<p>See little <a href="http://plnkr.co/edit/MY... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python 64 bit not storing as long of string as 32 bit python<p>I have two computers, both running 64-bit Windows 7. One machine has python 32-bit, one is run... | <p>This is not a 32bit / 64bit issue. You are most likely a <em>parser</em> issue; one machine using <code>lxml</code> vs. <code>html.parser</code> on the other, for example.</p>
<p>Different parsers deal differently with broken HTML, and <code>lxml</code> is the default only when installed.</p>
<p>See for example:</... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
User specific database in MongoDB<p>I am currently working on an inventory management software in Node js and MongoDB. I am pretty new to MongoDB, having wor... | <p>Before starting to invest a lot of time in the development of your project, check out other possible approaches to the scenario that you are trying to build.</p>
<p>I did a quick search on SO and found some additional threads with similar scenarios:</p>
<ul>
<li><p><a href="https://stackoverflow.com/questions/1393... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I use an env file with GitHub Actions?<p>I have multiple environments (dev, qa, prod) and I'm using .env files to store secrets etc... Now I'm switchi... | <p>a quick solution here could be having a step to manually create the <code>.env</code> file before you need it.</p>
<pre><code> - name: 'Create env file'
run: |
touch .env
echo API_ENDPOINT="https://xxx.execute-api.us-west-2.amazonaws.com" >> .env
echo API_KE... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SearchView with OneClick to enter text<p>In the android default search view, 2 clicks are required to input text for search as the first click is used to exp... | <p>The two clicks happen if we put the searchView inside a ListView as the searchView lost focus after that. I suspect searchView behave a similar property with editText view in listView.</p>
<p>With reference to
<a href="https://stackoverflow.com/questions/6918494/edit-text-in-listactivity-listview-loses-focus-when-... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Passing file parameter directly to FileReader<p>I'm trying to make a webpage for school closings, so I have to write to a file using javascript. I've been lo... | <p>I decided to use PHP to read and write the files on the server.
<br>
<br>
<br>
Replace $filename with file path
<br></p>
<pre><code>//READ FILE
$file = fopen($filename, "r");
$filecontents = fread($file, filesize($filename));
echo nl2br($filecontents); //if you want to display the text as it would appear in the fi... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Raft leader election algorithm one vote for term?<p>i have a doubt in undersanting the leader election algorithm of the Raft algorithm. In the paper i read t... | <p>In a raft cluster, let's have a node that wants to become the leader and call it a candidate. All other nodes, including the current leader, we'll simply call peers.</p>
<p>Let's see what happens when a peer receives a <code>RequestVoteRPC</code> from a candidate.</p>
<p>If the term of the peer is greater than the... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Calculating grouped variance from a frequency table in R<p>How can I, in R calculate the overall variance and the variance for each group from a dataset that... | <p>One option is using <code>data.table</code>. Convert the data.frame to data.table (<code>setDT</code>) and get the <code>var</code> of "Value" and <code>sum</code> of "Count" by "Group".</p>
<pre><code>library(data.table)
setDT(df1)[, list(GroupVariance=var(rep(Value, Count)),
TotalCount=sum(... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Inject DI instance directly in function method (Azure Functions)<p>I want to inject instances of the objects directly in Azure function method/body like this... | <p>Injecting custom class directly into Function is not possible, you still need to inject constructor to achieve your idea. If you don't choose to inject the constructor, the dependencies will be unavailable. Writing additional code is necessary. This is the right way:</p>
<p><a href="https://docs.microsoft.com/en-us... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to copy information from previous rows into a blank row in R<p>I am trying to create a new table of sample information based on a previous experiment. We... | <p>We can first <code>fill</code> the first 3 columns, then grouped by 'Sample_ID' <code>mutate</code> the 'condition' as the sequence of rows (<code>row_number()</code>)</p>
<pre><code>library(dplyr)
library(tidyr)
df1 %>%
mutate_at(vars(Sample_ID, dx, gender), na_if, y = "") %>%
fill(Sample_ID, dx, gend... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
spacing padding not working between 2 views, with visual layout constraints?<p>I would like to add a padding between field1 and field2, it works in the story... | <p>You should change</p>
<pre><code>str = "V:|[field1]-(==spacingV)-[field2]"
</code></pre>
<p>to </p>
<pre><code>str = "V:|[field1]-(spacingV)-[field2]"
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Call random function Javascript, but not twice the same function<p>I use a function that randomly selects another function, which works.
But sometimes it ru... | <p>You can simply store the index of the last function called and the next time, get a random number which is not the last seen index, like this</p>
<pre><code>var lastIndex, arr = [func1, func2, func3];
window.setInterval(function() {
var rand;
while ((rand = Math.floor(Math.random() * arr.length)) === lastI... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Passing injected service references and observables to plain class outside of dependency injection<p>I have inherited an angular project where java style ent... | <p>Finally i solved it like this, a static class that gets a reference to the Injector during app module init:</p>
<pre><code>export class GlobalInjector {
static injector: Injector;
}
</code></pre>
<p>... and in app.module or wherever it's soon enough:</p>
<pre><code>export class AppModule {
constructor (priv... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Java Android getContentResolver().query for specific Camera folder to get cursor in Android API level <= 28 devices<p>I want to get the last taken image from... | <p>I can query for specific directory by using </p>
<pre><code>MediaStore.Images.Media.BUCKET_DISPLAY_NAME
</code></pre>
<p>Now my code works like this and without any problems:</p>
<pre><code>cursor = MainActivity.this.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
null,
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get data without (HABTM) associated data<p>I have a HABTM relation that works well, when I do a <code>find()</code> on <code>Foo</code> I get something like ... | <p>After some digging, I found this in the Model Attributes documentation:
<a href="http://book.cakephp.org/2.0/en/models/model-attributes.html#recursive" rel="nofollow">http://book.cakephp.org/2.0/en/models/model-attributes.html#recursive</a></p>
<p>In my case, <code>Model->find('all', array('recursive' => -1))... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why does this quote about quicksort's worst-case runtime use Ω notation?<p>I just read this excerpt from <em>Introduction to Algorithms</em>:</p>
<blockquot... | <p>Big-O notation, which is what you're probably used to, is used to describe <em>upper bounds.</em> If we say that an algorithm has runtime O(n<sup>2</sup>), we mean that runtime of the algorithm is <em>at most</em> some quadratic function. You can think of O notation as a "less than or equal to" sign.</p>
<p>Big-&Om... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
left join in hive<p>would anyone kindly answer the question below?</p>
<p>Is left join outer join or inner join in hive?</p>
<p>(Do we need to type left <s... | <p>Just like in most, if not all, databases, the <code>outer</code> word is optional in <code>left [outer] join</code>, while both syntaxs have the exact same meaning.</p>
<p>A quick glance at <a href="https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Joins" rel="nofollow noreferrer">the hive documentati... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Chart.js draw y-axis only up to point<p>I'm wondering how to draw the y-axis only up to the point of one dataset. Like in this example: </p>
<p><a href="htt... | <p>You can draw you own lines directly on to the <code>canvas</code> using the <a href="https://www.chartjs.org/docs/latest/developers/plugins.html#plugin-core-api" rel="nofollow noreferrer">Plugin Core API</a>. It offers different hooks that may be used for executing custom code. In below code snippet, I use the <code... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Fill an array with random non-consecutive numbers<p>I want to create an array (<code>indexes</code>) that should be filled with random numbers from <strong>0... | <p>Your algorithm takes random values and you have a problem with the last value, if the only left over value is the incremented value of the value before the last value.</p>
<p>For example, the taken values are <code>1</code>, <code>0</code>, <code>2</code> and leftover value is <code>3</code></p>
<pre><code> ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Insert string with null character intermediate in oracle table<p>I have a variable of type StringBuffer which has null character i.e. '\0' intermediate. I ca... | <p>Yes, In Oracle Varchar2 behaves like a NULL-terminated STRING. </p>
<p>You can search in this document <a href="http://docs.oracle.com/cd/B14117_01/appdev.101/b10779/oci03typ.htm" rel="nofollow">http://docs.oracle.com/cd/B14117_01/appdev.101/b10779/oci03typ.htm</a></p>
<p>So, try some different character instead o... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pipe data from Writable to Readable<p>I am working on getting files from an SFTP server and piping the data to Box.com using their sdk. The Box sdk takes a r... | <p>So after doing some more research into this it turns out that the issue is actually with the Box sdk for Node. The sdk is terminating the body of the stream before it is actually done. This is because under the hood they are using the <code>request</code> library which requires a <code>content-length</code> header t... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
select dropdown value default of first index of array angular 7 safari<p>I am using Safari and try to make the array first index as default option in the sel... | <p>Here is my solution </p>
<blockquote>
<p>On your template</p>
</blockquote>
<pre><code><select formControlName="country" class="rounded-inputs20 select-select col-md-3" (change)="onChange($event.target.value)">
<option value = "default" selected> Select Cities </option>
<option... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What could be the possible reason behind huge difference between response time of a page in chrome and same in chromium?<p>I have me testing a application us... | <p>Could you please tell me the detail about where did you get the response time of a page as 50 seconds? Is is it from the browser devtool or TruClient transaction time? As @Alex said, TruClient is using end event to statistic the reponse time. TruClient have injected its own logic to static the network traffic inform... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MySql query accumlate count for each record before the time point of the record in the same table<p>I have a table to store student attendance with a date ti... | <p>I'm assuming the example output was including of some other data. In this case you can do a <code>LEFT JOIN</code> to itself and perform <code>COUNT(*)</code> afterwards. Refer following example:</p>
<pre><code>SELECT a.id, a.sid, a.isattend, max(a.date),COUNT(b.date)
FROM mytable a
LEFT JOIN mytable b
O... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get windows system folders (user home directory, "My documents", etc) path in R<p>I would like to get the full path of user's home folder (usually something ... | <p>I think you want:</p>
<pre><code>path.expand('~')
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Jwplayer 6.11 doesn't show controllers buttons<p>I upgrade jyplayer to 6.11, but now in playing controlls button doesn't appear, also i try it with skin. scr... | <p>Change:</p>
<pre><code>jwplayer("mediaplayer_test-_internet_archive.mp4").setup({
</code></pre>
<p>To:</p>
<pre><code>jwplayer("mediaplayer_test-_internet_archive_mp4").setup({
</code></pre>
<p>The period is messing up things.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how can i make this code better?because it doesn't work now<p>I have written this simple code in visual studio but it doesn't work.
please help me :)</p>
<p... | <p>First of all your script tag is in the wrong place.
You should include it or inside your tags or after your like:</p>
<pre><code> <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" lang="en">
<script>
function showpicture1() {
var imgMain = documen... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Footer link not working properly when being hovered<p>Hi there I have a rather strange problem going on here with one social media link in the footer section... | <p>Add the following code</p>
<pre><code>.vc_icon_element.vc_icon_element-outer .vc_icon_element-inner.vc_icon_element-size-sm .vc_icon_element-icon:hover, html .vc_icon_element.vc_icon_element-outer .vc_icon_element-inner:hover > span {
color: #07918A !important;
}
</code></pre>
<p>Problem: you hovered the &l... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to pass data from factory to controller in angular js?<p>I have one factory contains <strong>save customer function</strong>.On success I want to <strong... | <p>Various ways, the first one that comes to mind is something like this:</p>
<pre><code>//in your factory
return {
saveCustomer: function(data) {
var request = $http({...});
return request;
}
}
//in your controller
authFactor
.saveCustomer(data)
.success(function() {
//update controller ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Add different suffix to column names on multiple data frames in R<p>I'm trying to add different suffixes to my data frames so that I can distinguish them aft... | <p>You could use an index number within <code>lapply</code> to reference both the list and your vector of suffixes. Because there are a couple steps, I'll wrap the process in a <code>function()</code>. (Called an <em>anonymous function</em> because we aren't assigning a name to it.)</p>
<pre><code>data2016v2 <- lap... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
for loop does not check if condition after looping once in javascript<p>Here loop runs once and checks every <code>if</code> condition but next time it does ... | <p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var array3 = ['seat 2', 'seat 5', 'seat 7'];
for (i = 0; i < array3.length; i++)
{
alert(array3[i]);
if (array3[i] == "seat5")
{
alert("match 1");
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a way of grouping or reducing this array of objects<p>Example below, getting total math values corresponding to the same values of <code>period_str<... | <p>You can just use the <code>period_str</code> as a unique key:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>const arr = [
{math: 40, period_str: "Period 1, 03 2019"},
{... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Remove amenities NAMES from openstreetmap<p>Doe is exists a way to remove all the business from the OSM map? Also like shops, bars, restorations, hotels etc.... | <p>The short answer: No.</p>
<p>The map you see on openstreetmap.org is composed of static PNG images. You cannot affect how they are generated.</p>
<p>But then, OpenStreetMap isn't really intended to serve up maps to end-users. The project's primary product is the raw map data you can download from planet.osm.org no... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Method in another class cannot be applied to given types<p>Basically, there are two classes... One is supposed to work out the area of a circle, the other is... | <p>This call</p>
<pre><code>double area = circle1.calcArea(radius);
</code></pre>
<p>doesn't match the method defined in the Prac4 class, which takes no arguments:</p>
<pre><code>public double calcArea()
</code></pre>
<p>Change it to :</p>
<pre><code>double area = circle1.calcArea();
</code></pre>
<p>You don't ha... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Swift: How to check a core data NSSet for an object<p>I am upgrading my code to Swift and am stuck on how to replicate my objective-c code to check for an ex... | <p>Swift also has these elegant methods. ;) Just use the same method in swift as you did in objective-c:</p>
<pre><code>var existingRecord = self.employeeRecord.absences.valueForKey("id").containsObject(myId)
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to sort a list by key with None type elements?<p>I have a list where some elements are None type. I need to sort this list, but I receive this error beca... | <p>Try this for your key function: </p>
<pre class="lang-py prettyprint-override"><code>import math
def takeSecond(elem):
return elem[1] if elem[1] is not None else math.inf
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
determine if value exist in tuple from mysql query in python<p>I am trying to determine if a value exists in a tuple from a mysql query in python. Here is my... | <p>I figured out not necessarily an answer to my exact question but something that does exactly what I was trying to do at the time of my original post. The problem is that using mysql.connector the values are returned to the cursor in a tuple of tuples. I instead took each individual element from the tuple of tuples ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Wordpress Javascript injection not working<p>I created a js file in my child theme containing this code</p>
<pre><code> const prID = "10496";
const EL_pr... | <p>If your JS file is in the header, it means when it executes, the DOM of the page is not fully loaded. Wrap the stuff inside a load event listener (if you must do it in vanilla JS):</p>
<pre><code>window.addEventListener('load', function() {
const prID = "10496";
const EL_prID = document.querySelector(`[data-pro... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python Typing: declare return value type based on function argument<p>Suppose I have function that takes type as argument and returns instance of that type:<... | <p>TLDR: You need a <code>TypeVar</code> for <em>the return type of calling</em> <code>t</code>:</p>
<pre><code>def fun(t: Callable[[int], R]) -> R:
...
</code></pre>
<hr>
<p>Constraining on a type is too restrictive here. The function accepts any <a href="https://docs.python.org/3/library/typing.html#typing.... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Use value in table as column name in query result<p>I have the following table which you can also find in the <code>SQL fiddle</code> <a href="http://www.sql... | <p>You can do conditional aggreagation. This requires you to remove column <code>FlowType</code> from the <code>GROUP BY</code> clause and use it in conditional expressions within aggregate functions:</p>
<pre><code>SELECT
Product,
sum(case when FlowType = 'Inbound' then Quantity else 0 end) Inbound,
sum... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Need help IntentService not starting<p>After unsuccessful attempts to find what is the problem with my IntentService, (reading and googling) I decide to ask ... | <p>I think the name of Service in the AndroidManifest.xml is not correct. It can be:</p>
<ol>
<li>It is not the fully qualified name.</li>
<li>There is some spelling mistake.</li>
</ol>
<p>Try giving full package name with the service name and give it a try.</p> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.