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:
Add a new rows and copy the values of cells under certain conditions<p>l have a csv file that l process using pandas.</p>
<pre><code>id ... | <p>I think you need custom function with <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.apply.html" rel="nofollow noreferrer"><code>apply</code></a> and <code>axis=1</code> for expand <code>DataFrame</code> to <code>list</code>, last use <a href="http://pandas.pydata.org/pandas-docs/sta... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to run few ssh commands in batch?<p>i want to run few commands in batch, one after one.
but the batch stop after 'killall firefox' with error, 'firefox n... | <p>If you want to continue processing commands even after an error, separate the commands with <code>;</code> instead of <code>&&</code>.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Deallocate and reallocate memory. Resetting Polygon in FLTK<pre><code>#include "Simple_window.h"
#include "Graph.h"
#include <math.h>
#inc... | <p>There is no need to reset the poly if you stick the declaration inside the first while loop.</p>
<pre><code>while(over){
Graph_lib::Polygon poly;
...
win.wait_for_button();
}
</code></pre>
<p>Re: why your program won't end. Break is good enough but if you don't like using break</p>
<ul>
<li>use conti... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Use rspec let with array elements<p>I have a function <code>func</code> that returns an array with two arguments which I normally use as follows:</p>
<pre><... | <p>What you're describing can't be done. Let blocks are evaluated outside of the <code>it</code> block context and need to be setup prior to that.</p>
<p>Even the rspec error output suggests as much when you try to dynamically define the <code>let</code>:</p>
<blockquote>
<p><code>let</code> is not available from w... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Finding equal values in dictionary<pre><code>val = dict()
def vote(val,person):
if person not in val:
val[person] = 1
else:
val[person... | <p>In your result function need to check the votes in the elif part.</p>
<pre><code> elif ex[0][1] == ex[1][1]:
print ('***NONE***')
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Matlab Reading the coordinates from txt file and store them in a matrix<p>I generate 4 multivariate normal samples from given mu and sigma and store them in ... | <p>Use <code>dlmread</code>.</p>
<pre><code>A = dlmread('vals.txt')
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
remove array object by its index<p>I'm trying to remove an array object from an array. First, I loop to the array of objects and if that array match to the g... | <p>You can use <code>delete</code>.</p>
<p><strong><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete" rel="nofollow">Here</a></strong> is the reference to it, this is exactly what you looking for.</p>
<pre><code>if (n_array[i].name === 'jason') {
delete n_array[i].name;
}... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using the Context API as a way of mimicking useSelector and useDispatch with redux v5<p>I'm working on a React project where I'm constrained to using React R... | <p>This will cause significant peformance problems. Your mapStateToProps is using the entire state object, so every time anything changes in the state, the provider must rerender. And since the provider rerendered with a new value, so too must every component that consumes the context. In short, you will be forcing mos... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using SwiftNIO and SwiftNIOHTTP2 as an HTTP2 client<p>I'm currently working on a simple HTTP2 client in Swift using SwiftNIO and the SwiftNIOHTTP2 beta.
My i... | <p>That's a very good question! Let's first analyse why this is more complicated than sending a HTTP/1.x request. Broadly speaking these issues fall into two categories:</p>
<ol>
<li>NIO at the moment makes it more complicated than necessary, therefore much of what I'll write further down can be unintuitive at times. ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
iOS UIImage dimension change not working<p>I am resizing a <code>UIImage</code> by changing the dimension. But it shows different dimension. For iPhone 6, I ... | <p>Yes, finally i solved it after few hours. I tried in a wrong way. Actually, the dimension can not be fixed when we resize in a particular memory size. The following method convert the image into ranged size (Byte) and the dimension will be define by the method itself.</p>
<pre><code> NSData *imageData;
imag... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Access97 Compare two Dates<p>I'm trying to compare 2 dates with an SQL Query,</p>
<p>My query is this : </p>
<pre><code>"SELECT table.toto
FROM table
WHERE... | <p>Well, I found a solution to my problem.</p>
<p>I don't know why but I just have set the "$date" format to : <code>n/d/Y</code>
and to wrap it between "#" in code like this :</p>
<pre><code>"SELECT table.toto
FROM table
WHERE
table.date < #date#"
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
New dates are not created when the project is running<p>When the project is running, data is uploaded from the database, which is then formed into excel file... | <p>As a spring bean is a singleton <code>fileDate2</code> and <code>fileDate3</code> will be initialized with the bean, exactly one time. move it into your saveExcel.</p>
<pre><code>@Component
public class SaveProviders {
@Autowired
private ProviderService providerService;
private static final DateFormat ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why Priority queue preferred to implement using heap not by array although Heap itself implemented using array<p>Why Priority queue preferred to implement us... | <p>The binary heap provides a partial ordering, which guarantees O(log n) insertion and O(log n) removal of the highest-priority item.</p>
<p>With a flat array, you have two choices:</p>
<ol>
<li>Maintain an ordered array. Insertion becomes an O(n) operation, and removal of the highest-priority item is O(1).</li>
<li... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pandas - How to convert timedelta64[ns] to HH:MM:SS<p>I have a doubt how can I convert all column from Pandas (Python) from timedelta64[ns] like: <code>2 day... | <p>I don't think that there is a direct way. But you could use a custom function on top of <a href="https://pandas.pydata.org/docs/reference/api/pandas.Series.dt.total_seconds.html" rel="nofollow noreferrer"><code>total_seconds</code></a>:</p>
<pre><code>def sec_to_format(s):
h,s = divmod(int(s),3600)
m,s = div... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Angular reset dropdown values primeng<p>Hello comunity I need some help with Angular and Primeng components, the scenario is the next.</p>
<p>I have a model... | <p>I have the solution in the HTML I've added the angular identifier:</p>
<pre><code>#dropdown_i
<div *ngFor="let item of arrFittingsCombos; let i = index">
<h4>{{item.PropertyDescription}}</h4>
<p-dropdown #dropdown_i [(disabled)]="item.Disabled" [options]="item.Values" optionLabel="Ir... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Thymeleaf not interpreting sec tags<p>I've ran into an issue where thymleaf is not recognising the sec tag in my spring boot project. e.g. the below the sec:... | <p>There could be a few things that might not be set correctly. Anyways, this issue tend to always resolve by adding missing dependencies or changing the ones you are using. So, first, try changing to <code>springsecurity5</code>. And add the following <code>@Bean</code>.</p>
<p><strong>Configuration</strong></p>
<pr... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to edit image uploaded on the some box?<p>HTM like this :</p>
<pre><code><input type='file' multiple id="upload-file"/>
<?php
for($i=0;$i&l... | <p>You need to create a var to set the actual edited container than after the upload launch the function, check if the variable has a value different than null and append the img in the right place.</p>
<p>WORKING FIDDLE HERE: <a href="https://codepen.io/VLK_STUDIO/pen/wdQPRL" rel="nofollow noreferrer">https://codepen... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SAPUI5: Routing with parameters - How get correct path of binding context<p>I am trying to implement routing with parameters as in this walkthrough: <a href=... | <p>Their path is a path to an entity of an <strong>OData</strong> model. Your path is a path to an entity of a <strong>JSON</strong> model.</p>
<p>Those paths are built entirely different. Most importantly your path contains a slash, while theirs does not. This confuses the parser which tries to match <code>details/{d... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Binding custom click events onto chrome console<p>Chrome console is great and I'm looking to use it as a development environment for my app.</p>
<p>I would ... | <p>The <a href="https://developer.chrome.com/extensions/devtools" rel="nofollow noreferrer">Chrome DevTools API</a> doesn't expose anything that would allow you to modify the behaviour of the Console module in an extension from my understanding.</p>
<p>If you need a particular behaviour <em>just for yourself</em>, you... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Error while display json from sql database - PHP<p>I made a script to display data from online SQL database into JSON format.
The problem is, I don't have th... | <p>$rows is already an array.</p>
<p>Try with: <code>$arrray = array("server_response" => $rows);</code></p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to show only first result from select?<p>I'm trying to show <strong>only first result from this select</strong>, but cant figure out how to do it or what... | <p>In Oracle, you need to use a subquery:</p>
<pre><code>select su.*
from (select name || ' ' || surname as meno, role
from system_user
order by surname ASC
) su
where rownum = 1;
</code></pre>
<p>The most recent versions of Oracle (12C) make this simpler by supporting the ANSI standard <code>FETCH F... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I make my dropdown menu close when clicking anywhere on the page (javascript)<p>I have made a dropdown that opens when the user clicks into the input... | <p>You can make use of the <code>focusout</code> event. Add a listener and remove the <code>active</code> class when the user leaves the search input. As shown below:</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-... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Single table with data from multiple database tables<p>In my dotnet Core project I have have 3 database tables: Building, Checklist and answer.</p>
<p>For e... | <p>you should pass a <b>List</b> of <b>myViewModel</b> to view:</p>
<pre><code>public IActionResult viewData()
{
var currentUser = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
var vm = new myViewModel();
vm.myBuildings = (from mb in db.buildings where mb.OwnerId == currentUser select mb).ToList();... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
HTML codding creating area for text<p>Image of what i plan to do:</p>
<p><a href="https://i.stack.imgur.com/dPGsG.png" rel="nofollow noreferrer"><img src="h... | <p>you will have to learn to use some tools and there are many different way to do that. You can use <a href="https://www.w3schools.com/html/html_tables.asp" rel="nofollow noreferrer">html tables</a> to position blocs where you want or <a href="https://www.w3schools.com/bootstrap/bootstrap_get_started.asp" rel="nofollo... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Code Coverage for Integration tests using Jacoco<p>I am passing <code>jacocoagent.jar</code> of version 0.8.1 as a java agent to record the code coverage on ... | <p>Make sure that you use proper JAR file.</p>
<p><code>lib/jacocoagent.jar</code> in <code>jacoco-0.8.1.zip</code> that is linked from <a href="https://www.jacoco.org/jacoco/" rel="noreferrer">JaCoCo homepage</a> has following checksums</p>
<pre><code>$ wget http://repo1.maven.org/maven2/org/jacoco/jacoco/0.8.1/jaco... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Consider only part of what is written in a cell Excel-VBA<p>So in cell let's say "b1" I have a Data validation with the following (whatever is written after ... | <p>If the date is always going to be the 11 characters of dd/mm/yyyy plus the space then the variable assignment would be:</p>
<pre><code>Dim strCellValue As String
Dim strProjectName As String
strCellValue = Sheet1.Range("b1").Value
strProjectName = Right$(strCellValue, Len(strCellValue) - 11)
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to add auth user id or session to logging in Laravel 5.7?<h1>My Goal</h1>
<p>I'm willing to add the current authenticated user id to log lines (I'm usin... | <p>Based on the answer of <em>DigitalDrifter</em> and part of <a href="https://emirkarsiyakali.com/quick-tip-logging-mastery-with-laravel-7282988032a7" rel="nofollow noreferrer">this post from Emir Karşıyakalı</a> I managed to get a fair enough solution.</p>
<p>I could not grab the User ID since (as per my understandi... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to order comments in firebase firestore by createdAt<p>I have a document in which there is a comments array of objects and each object has createdAt prop... | <p>The <a href="https://firebase.google.com/docs/reference/js/firestore_#query" rel="nofollow noreferrer"><code>query()</code></a> function takes a query as parameter and not a DocumentReference. Also the <code>orderBy()</code> clause <em>orders documents</em> when fetching multiple documents from a collection and not ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Apply array of string with string.replace<p>Let's say I have a string like so:</p>
<pre><code>const sentence = "This is my custom string";
</code></pre>
<p... | <p>Your problem is that while replacing words, you replace already added html tag with .class 'highlight'.</p>
<p>Solution here could be to replace anything that is not html tag. Replace this line in you jsfiddle example.</p>
<pre><code>const searchFor = new RegExp(`(${word})(?!([^<]+)?>)`, 'gi');
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
django event attendee list / user events list foreign key backward search chain<p>I am making something like a party planner.
I want users to be able to conf... | <p>First of all, you should <em>really</em> fix your nomenclature. The <code>related_name</code> is the name of the relation in reverse, so this is typically <em>not</em> <code>event</code> in case of an <code>Event</code>, but <code>attendants</code>:</p>
<pre><code>class Attendance(models.Model):
event = models.... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to upload a custom theme for your BigCartel store?<p>I am using the dugway CLI tool to develop my theme. When I do <code>dugway build</code>, it creates ... | <p>Right now it's not possible to upload a theme directly from Dugway to Big Cartel, you'll need to copy/paste the theme code into the appropriate section in Customize Design > Advanced - and any assets like javascript or image files will need to be hosted separately. <a href="https://github.com/bigcartel/dugway#known-... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Missing Member Name ( xaf CriteriaOperator)<p>I get the following error when I set the View Collection Source</p>
<p>My simplified code us</p>
<pre><code>pub... | <p>The cause is when I have a miss-spelled the propertyname</p>
<p>For example if the Product does not have a WeBuyThis property</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Node JS: variable usage between modules<p>I have two modules to represent my problem/confusion:</p>
<p>f2.js:</p>
<pre><code>var user;
var getName = funct... | <p>You can attach the name into an instance of User function like so:</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>function createUser() {
this.name = '';
return {
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
expand colnames to match the last known one<p>Assume a data.frame: </p>
<pre><code>df <- structure(list(Dates = structure(1:2, .Label = c("2017-05-02",
... | <p>Assuming you want to rename columns that start with "X", we could <code>replace</code> them with <code>NA</code> and then use <code>na.locf</code> to get previous names of the column.</p>
<pre><code>library(zoo)
names(df) <- na.locf(replace(names(df), grepl("^X", names(df)), NA))
df
# Dates Var1 Var1 Var1... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Reading multiple objects, in a single object, with in an array, with unique keys. into FlatList<p>I am trying to display this data in a FlatList.</p>
<pre><c... | <p>you can loop over, every single element, and then. de-structure it and combine the key with the body.</p>
<pre><code> const data = Onsnapshot.forEach((childSnapshot) => {
const childKey = childSnapshot.key;
const childData = childSnapshot.val();
console.log({ childKey, ...childData });}
<... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
golang conversion between function accepting abstract interface and function accepting struct implementation<p>An issue I met when creating a layer on top of... | <p>It seems that you are trying to design your classes using class hierarchies (like Java) which is really not how Go tackles OO. I really suggest you design your code around interfaces rather than trying to mimic inheritance. Since we cannot speculate on why you have such types, below is a minimal code snippet which w... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Wordpress: link logo to the splashpage<p>I am working on this <strong>Wordpress</strong> <a href="http://ergon.nowcommu.myhostpoint.ch/home/" rel="nofollow">... | <p>It is basic HTML question. Replace your code in template to:
<code><a href="/" class="logo-a">
<img alt="Ergon-I" src="http://ergon.nowcommu.myhostpoint.ch/wp-content/uploads/2016/05/ergonidee_LOGO-01.png">
</a></code></p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Trying to add all the elements of two-dimensional array<p>sum([[1]]) returns 1, but sum([[1, 2], [3]]) does not return 6, but 1. I am not able to find the pr... | <p>So here's the deal: you need to loop through both arrays and pick up elements.
<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>let d =[[1,2],[3]]
function sum(d) {
let into = 0;
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
iOS App Internal Control Transfer<p>I am a novice to iOS app development. While using the StoryBoards for creating the iOS app, the control transfers from <c... | <p>You have a default storyboard with initial controller (the arrow incoming to controller). this controller is initiated first after Application initialization is done. I mean, there is no explicit code for this, the Cocoa makes it for you.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pulling image from AWS ECR repository without AWS credentials<p>I need to pull docker images from on premise. However, I don't have access to AWS keys to be ... | <p>Yes, you can authenticate temporarily. As document pointed;</p>
<pre><code>You can use temporary security credentials to make programmatic requests for AWS resources using the AWS CLI or AWS API (using the AWS SDKs). The temporary credentials provide the same permissions as long-term security credentials, such as IA... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Javascript regex on array<p>I currently have this example array:</p>
<pre><code>array = [1.2%, 16%, 9.0%, 8%]
</code></pre>
<p>I want to get the highest numb... | <p>You can map the strings to <code>parseFloat</code>, then the "%" will be ignored:</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>let array = ["1.2%", "16%", "9.0%... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Getting Method error : no such DSL method 'success' found among steps<p>I am trying to write a declarative Jenkins Pipeline which needs to echo that the job ... | <p>The success block should be outside of always block. It should be like this</p>
<pre><code>post {
success {
script {
echo ' Sucessful !"
}
}
}
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why can't Travis-CI find my cocoapod dependencies?<p>This Podspec fails on the line <code>pod 'SwiftyTimer', '~> 1.4'</code> with <code>Unable to find a s... | <p>The answer turned out to be: Specify an xcode version in the <code>osx_image</code> key in my .travis.yml:</p>
<pre><code>language: objective-c
osx_image: xcode7.3
xcode_workspace: Example/CWNotificationBanner.xcworkspace
xcode_scheme: CWNotificationBanner-Example
xcode_sdk: iphonesimulator9.3
podfile: Example/Podf... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can anyone generate mongodb query for my scenario<p>I am new to MongoDB and using Mongoose to manage data to and from MongoDB. I have a collection having bel... | <p>You can use <a href="https://docs.mongodb.com/manual/reference/operator/aggregation/addFields/" rel="nofollow noreferrer"><strong><code>$addFields</code></strong></a> along with the <a href="https://docs.mongodb.com/manual/reference/operator/aggregation/in/" rel="nofollow noreferrer"><strong><code>$in</code></strong... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Copying from "ThisWorkbook" problems<p>On the line "x.worksheets..." It keeps throwing back the "Subscript out of range error." The error may have something ... | <p>You don't always need to declare a variable - sometimes it is easier to just refer directly to your object. The below seems like a much simpler approach than you are currently taking. </p>
<p>Just declare a worksheet variable <code>FM</code> for your sheet <code>Closings Template</code> instead of dimming your var... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Show date in specific format date from code?<p>I have an angular2 v4 app and I have to show a date in a specific format.</p>
<p>I have this in my component:... | <p>You need to format the <code>Date</code> object to a <code>string</code>. One way to do that is with moment <code>.format</code> (<a href="https://momentjs.com/docs/#/displaying/" rel="nofollow noreferrer">https://momentjs.com/docs/#/displaying/</a>) </p>
<pre><code>currentDate: Date = moment(new Date()).format('DD... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I loop trough multiple ranges of cells and return values with if,then,elseif?<p>I have hit a dead end with this problem(nearly one month). I need to ... | <p>You can loop using a FOR NEXT:</p>
<blockquote>
<p><a href="https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/fornext-statement" rel="nofollow noreferrer">For...Next
statement</a></p>
</blockquote>
<pre><code>Dim score1 As Integer, score2 As Integer, score3 As Integer
Dim result As S... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Nodejs cluster not listing<p>This is copied from nodejs api:</p>
<p>What I want to do is to do background job in master, and accept http request in worker.<... | <p>Your while loop is blocking the "<a href="https://developer.mozilla.org/en/docs/Web/JavaScript/EventLoop" rel="nofollow noreferrer">event loop</a>" therefore nothing can happen in the main process. you should convert your while loop to this code to prevent blocking IO.</p>
<pre><code>setInterval(() => {
conso... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to apply CORS by using Asp.Net Web Api Core 6 thought client side fetch?<p>I am trying to access my asp.net core 6 Web API (.NET6) from client side fetch... | <p>Thank you everyone.</p>
<p>Issue has been fixed.</p>
<p>I just removed the slash and it worked</p>
<p>from</p>
<pre><code> policy.WithOrigins("https://localhost:7260/","https://localhost:44485/")
</code></pre>
<p>to</p>
<pre><code> policy.WithOrigins("https://localhost:7260","http... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
splitting Interval Date in character and casting into Date in R<p>I have below Date column in character (from ENTSO-E platform). I want to convert into Date... | <pre><code>as.POSIXct(gsub("^.* - (.*)", "\\1", x), format = "%d.%m.%Y %H:%M")
# [1] "2021-01-01 01:00:00 CET" "2021-01-01 02:00:00 CET" "2021-01-01 03:00:00 CET" "2021-01-01 04:00:00 CET"
# [5] "2021-01-01 05:00:00 CET"
</code></pre>
<p><s... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
BFS traversal, same node being accessed twice<p>I am trying to figure out how to write BFS algorithm in C
and I got this</p>
<pre><code>typedef struct graph ... | <p>I am not sure if BFS is the right term for what you are doing. Your graph is not a tree and with a node having multiple parent nodes it is hard to tell on what level a node really is.</p>
<p>But to make your code work as expected, you just need to fix your missing use of <code>visited</code> array:</p>
<pre class="l... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Trying to write a method to create an array list<p>I'm using Netbeans/GUI to make a fantasy basketball game program. I'm trying to create methods that create... | <p>The declaration for <code>alCTeams</code> should be located under the <code>class</code> not the <code>method</code>.</p>
<p>Like this:</p>
<pre><code>public class JFMarchMadness extends javax.swing.JFrame {
ArrayList<BasketballTeam> alCTeams=new ArrayList <>();
public JFMarchMadness()
{
initCom... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Remove pattern from a column if it is present in another one<p>I have this file :</p>
<pre><code>>AX-89916436-Affx-G-[A/G]
TTGTCCGAGAGTGACGTCAATCCGCA
>... | <pre><code>$ awk 'BEGIN{FS=OFS="-"} />/{gsub("[][/]",""); sub($(NF-1),"",$NF)}1' file
>AX-89916436-Affx-G-A
XXXXXXX
>AX-89916437-Affx-A-G
XXXXXXXXXXX
>AX-89916438-Affx-C-A
XXXXXXX
>AX-89916440-Affx-T-G
XXXXXXX
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
replace select indexed attributes with regexp<p>I have the following DOM :</p>
<pre><code><select id="evo_calculatorbundle_ruletype_assertions_0_logicalO... | <p>Regex pattern in javascript is enclosed between slashes, if you wrap it with single quote, it becomes a string.</p>
<p>Use:</p>
<pre><code>var pattern = /_[0-9]+_/g;
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Multiple Preferences for single app using AppCompatPreferenceActivity?<p>I'm making an app that will have a list with multiple devices (let's say that each d... | <p>You will need to use SharedPreferences directly to store the data structures. The scaffolded SettingsActivity is only designed for app global settings.</p>
<p>I would almost be inclined to say you should be using a database, since it sounds like your app allows users to save and read a potentially large amount of d... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ApplicationIntent=ReadOnly with SQL Server Import and Export Wizard<p>I pull data down from an Azure based SQL Server every now and then using the SQL Server... | <p>Don't beat yourself up for using the Import/Export Wizard - for quick and dirty /one-off ETL work, it's a great tool. Under the hood, it uses SSIS. But by design it is a wizard and so is not going to give you all of the knobs to turn.</p>
<p>But all is not lost! To answer your question about using read-only applicat... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Google Sheets: When there are dupe values in a column, determine which value should be included by comparing corresponding dates in a date column<p>I have a ... | <p>try:</p>
<pre><code>=ARRAYFORMULA(IF(A2:A="",,VLOOKUP(A2:A&B2:B,
{SORT(A2:A&B2:B, B2:B, 1), IF(COUNTIFS(SORT(A2:A, B2:B, 1), SORT(A2:A, B2:B, 1),
ROW(A2:A), "<="&ROW(A2:A))=1, "yes", "no")}, 2, 0)))
</code></pre>
<p><a href="https://i.stack.imgur.com/xpDvg.p... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unconventional data frame reshaping using dcast<p>I want to convert table dt:</p>
<pre><code>Who T Res
Pam 2 B
Pam 3 E
Pam 5 F
Bob 2 B
Bob 5 C
</code></pre>
... | <p>You can use -</p>
<pre><code>library(data.table)
setDT(dt)
dcast(dt, Who ~ rowid(Who), value.var = c('T', 'Res'))
# Who T_1 T_2 T_3 Res_1 Res_2 Res_3
#1: Bob 2 5 NA B C <NA>
#2: Pam 2 3 5 B E F
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to convert a vertical grouped bar plot into a horizontal grouped bar plot in python<p>I have a code in which I am plotting a graph in a vertical manner. ... | <p>To change the existing vertical bar graph to horizontal, you only need to update the plot code as below</p>
<pre><code>df.plot.barh(x='Team',
stacked=False,
title='Grouped Bar Graph with dataframe')
</code></pre>
<p>Output graph</p>
<p><a href="https://i.stack.imgur.com/v6W1p.png" rel="nofollow noref... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Convert string to html attributes<p>Is their a way to convert a string (this string can change and contains <strong>asp-route-...</strong> attributes) to a l... | <p>Solved it myself by doing the following:</p>
<h1>1. Create custom Taghelper class</h1>
<pre><code>namespace test
{
[HtmlTargetElement("special-link")]
public class SpecialLinkTagHelper : TagHelper
{
[ViewContext]
public ViewContext ViewContext { get; set; }
public override void... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
keep checkbox disabled and unchecked if any other two checkboxes are checked<p>I am trying to keep <code>#b0</code> disabled and unchecked if <code>#b1</code... | <p>You can enable the checkbox in an <code>else</code> block, like this:</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>let used_for_contact = $('#b1, #b2');
used_for_contact.... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
CSS selector or XPath for elements without specific child<p>Here is the example:</p>
<pre><code><ul>
<li>list item one</li>
<li&... | <p>This XPath,</p>
<pre><code>//ol[not(li/@test="audio")]
</code></pre>
<p>will select all <code>ol</code> elements that do not have an <code>li</code> child with a <code>test</code> attribute value of <code>"audio"</code>.</p>
<hr />
<p><sub><em>Update per OP follow-up comment adding the requiremen... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Eclipse JFace : how to make several changes in my document considered as one single change in the history?<p>I have a command that performs several changes i... | <p>You can use <code>IRewriteTarget</code> which has <code>beginCompoundChange()</code> and <code>endCompoundChange()</code> methods.</p>
<p>Get the target from an editor using</p>
<pre><code>IRewriteTarget target = editor.getAdapter(IRewriteTarget.class);
</code></pre>
<p>If you have a <code>TextViewer</code> (or <... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Extract values from child XML tag that has the same parent tag using python<p>I'm trying to extract roll numbers from an XML file using python. I used to be ... | <p>The problem here is that you are assuming all child nodes of a <code>RollNumber</code> element are Text nodes. However, the parent <code>RollNumber</code> element in your XML document has another element as one of its children and you cannot return the <code>data</code> for an element.</p>
<p>One way to handle the... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
NestJS: Enforce implementation of a service at *compile-time*<p>To keep it brief:</p>
<p>I have a service - let's call it CatsService...</p>
<pre><code>impor... | <p>I have solved my own issue. It was very simple.</p>
<pre><code>import { Module } from '@nestjs/common';
import { CatsController } from './cats.controller';
import { CatsService } from './cats.service';
import * as ProductionCatsService from "./production"
import * as DevelopmentCatsService from "./dev... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I add a new spider arg to my own template in Scrapy/Zyte<p>I am working on a paid proxy spider template and would like the ability to pass in a new a... | <p>This is achievable by using <code>kwargs</code> in your spider's __init__-Method:</p>
<pre class="lang-py prettyprint-override"><code>import scrapy
class YourSpider(scrapy.Spider):
name = your_spider
def __init__(self, *args, **kwargs):
super(YourSpider, self).__init__(*args, **kwargs)
sel... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Spawn another process on same JVM<p>From a Java application I want to run another Java application on the same Java installation but in a separate process.</... | <p>If <code>jlink</code> image used within <code>jpackage</code> based apps is built without using the <a href="https://stackoverflow.com/questions/71924648/jpackage-for-only-one-application/71926280#71926280"><code>--strip-native-commands</code></a> flag then the runtime image will contain <code>bin/java</code> (or <c... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Loop detection in connected graph<p>Most example I found only treat single linked lists. I need a solution for a multiple linked list.</p>
<p>Image is easie... | <p>Just check if a route from 'end of connection node (B)' to 'start of connection node (C)' exists, if yes, a new loop would be created. Doesn't quite answer it, but good enough...</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C# Generic foreach over IEnumerable of unknown type<p>I'm trying to write a generic static function that takes an instance of an IEnumerable class, the name ... | <p>I think you want to do something like this (it does have a null propogation check so if you're using an old version of C# then you'll need to remove that question mark before the '.GetValue(i)'):</p>
<pre><code>public static string EnumerableItem2Str<T>(IEnumerable<T> oItems, string cPropertyName, string... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Handle Network Thread exceptions in Codename One<p>My app tries to do an async network request at app launch, using <code>RequestBuilder request = Rest.get</... | <p>Did you define <code>onError</code>?
It should be invoked for exceptions and might override the global error handling logic once defined. </p>
<p>I tried this case with wifi turned off and it seems to have worked correctly:</p>
<pre><code>Button test = new Button("Test");
test.addActionListener(e -> {
Rest... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to cycle shades of one color on click<p>I'm stuck on a project. I need to use javaScript/jQuery to create a box that changes colors when clicked. However... | <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>var div = document.querySelector('#myDiv')
div.dataset.color = 0;
div.addEventListener('click',()=>{
div.dataset.color = parseI... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Index error, code not splitting my string properly<p>I am trying to run pytest to test my function but I am running into an issue where I am trying to split ... | <p>Line 115 will raise an exception if the <code>parts</code> list has only one (or zero) items in it. Given your code is</p>
<pre class="lang-py prettyprint-override"><code>one = parts[1]
# two = parts[1]
# three = parts[2]
</code></pre>
<p>I would say that you should be assigning <code>parts[0]</code>, rather than <c... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MongoDB addToSet in nested array<p>I'm struggling to insert data inside a nested array in MongoDB.
My schema looks like this:</p>
<pre><code> {
"_id... | <p><a href="https://docs.mongodb.com/manual/tutorial/query-array-of-documents/" rel="nofollow noreferrer">https://docs.mongodb.com/manual/tutorial/query-array-of-documents/</a></p>
<p>Try using $elemMatch </p>
<pre><code> "classes":{ $elemMatch : { _id : ObjectId("5c0c556e2440311ff0353847") }},
"classes.student": { ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
In firefox jquery working fine, but not in chrome?<p>I have a problem please help me.</p>
<p>I'm creating two fields category and subcategory, based on user... | <p>The <code><option></code> tag isn't really supposed to support the <code>onclick</code> event (<code>.click</code> in jQuery) This is why you see it working in some browsers but not others.</p>
<p>Instead, set some meaningful values for the <code>value</code> attribute in your <code><option></code> tags... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
gnu make: rule execution order<p>I am reading <a href="https://www.gnu.org/software/make/manual/make.pdf" rel="nofollow noreferrer">https://www.gnu.org/softw... | <p>This line:</p>
<pre><code>$(OBJS): | $(OBJDIR)
</code></pre>
<p>says that all object files (in the <code>OBJS</code> variable) have the directory (in the <code>OBJDIR</code> variable) as a prerequisite.</p>
<p>Therefore, none of the object files can start to be built until after the directory rule has completed.</p... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How Browsers Work of modern web browsers<p>What are the components of a browser,Which are the settings that control a browser, how cookies works ,how browser... | <p>Huge topic here. Rather than break this down and write forever, I will go through a web scenario: User types in address (or clicks a link?) - NOTE: a bit oversimplified</p>
<ol>
<li>Browser breaks down URI</li>
<li>Browser checks cache to see if site IP address is in cache</li>
<li>If no, browser contacts DNS serve... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Insert values in data-frame's new columns on the right index<p>I would like to obtain the lower_bound of some datas and insert it into a new column on the re... | <p>Assign output to filtered new column:</p>
<pre><code>lower_bound = 0.1
m = df.col1 == 8
df.loc[m, 'newcol'] = df.loc[m, 'col2'].quantile(lower_bound)
#another solution
#df['newcol'] = np.where(m, df.loc[m, 'col2'].quantile(lower_bound), np.nan)
print (df)
0 1 3 NaN
1 2 4 NaN
2 5 8 ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get @value and replace it with a regex in JavaScript<p>I want to get every username ( @name ) out of a text and replace it with the same value as it had befo... | <p>An easy approach using regex:</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>var text = "@one @two @three test";
var matches = text.match(/@\w+/g);
var result = text.repla... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
multiple character replacement in matrix in python<p>I am still learning python and I have a vector which belongs to a pretty big matrix and the entries in t... | <p>Consider the dataframe <code>df</code></p>
<pre><code>np.random.seed([3,1415])
df = pd.DataFrame(dict(emp_length=np.random.choice(list(m.keys()), 20)))
print(df)
emp_length
0 < 1 year
1 2 years
2 10+ years
3 10+ years
4 7 years
5 10+ years
6 3 years
7 8 years
8 7 years
9 10+ ye... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Firestore security rules: get() returns different result than the expected one<p>I have a firestore collection of <code>usernames</code> where each individua... | <p>You don't have to use <code>get()</code> when trying to read data from the document being accessed/updated. Try using <a href="https://firebase.google.com/docs/firestore/security/rules-conditions#data_validation" rel="nofollow noreferrer"><code>resource.data</code></a> instead:</p>
<pre><code>match /usernames/{usern... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
HTML Displaying table data with specific value only<p>I have a html table and I want only those rows to be displayed which is having a specific value in tabl... | <blockquote>
<p>Use <a href="https://api.jquery.com/contains-selector/" rel="nofollow"><strong><code>:contains</code></strong></a> selector to select elements having specified content</p>
</blockquote>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true">
<div class="snippet-code">
<pre class... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MySQL - ORDER BY, CASE and DESC<p>I have a PHP variable called $var. I want to sort my result in dependence of $var. This one works:</p>
<pre><code>$sql = "... | <p>Split this into three <code>case</code> expressions:</p>
<pre><code>ORDER BY (CASE WHEN $var = 1 THEN myText1 END) ASC,
(CASE WHEN $var = 2 THEN myText2 END) ASC,
(CASE WHEN $var = 3 THEN someNumber END) DESC
</code></pre>
<p>The <code>ASC</code> is optional, of course -- there just to contract w... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Breaking down a public IP into components<p>I am programming in PHP and I want to be able to break down a value such as <code>46.222.15.198</code> into disti... | <p>You can go very simple and use <a href="http://php.net/manual/es/function.explode.php" rel="nofollow noreferrer">explode</a>:</p>
<pre><code>$ipParts = explode('.', '46.222.15.198');
</code></pre>
<p>This returns an array with 4 elements, with keys from 0 to 3.</p>
<blockquote>
<p>Explode: Returns an array of s... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Modularizing an Express/Socket.io application<p>I want to be able to load these 4 functions: <code>returnAvailable</code>, <code>processMessage</code>, <code... | <p>The <code>socket</code> variable is only available within <code>io.sockets.on('connection',</code> callback function so you can't use it in other files this easily. But you can pass the <code>socket</code> variable to the function where you are trying to use it like this</p>
<pre><code>util.removeUser(socket);
</co... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Move parent id attribute to it's first child if id matches the given filter XSLT 1<p>I need to move the id attribute of ol/ul tag to it's first li tag child ... | <p>This should help. Let me know, if you have questions.</p>
<pre><code><xsl:template match="ul">
<xsl:choose>
<xsl:when test="translate(@id, '0123456789ABCDEFabcdef', '') = ''
and string-length(@id) = 24">
<xsl:copy>
<xsl:apply-tem... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Deploying a Django application to Heroku - No module named 'django_project.wsgi<p>I'm trying to deploy a django application but I keep getting this error:</p... | <p>With <strong>Procfile</strong> at the root directory (that is, one level above <strong>manage.py</strong>), I've changed its content to the following:</p>
<pre><code>web: gunicorn --pythonpath django_project django_project.wsgi --log-file -
</code></pre>
<p>As per <a href="https://stackoverflow.com/a/19671818/116272... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I add a column which is scaled by value of specific level in r?<p>I have a data set like this (note headings <code>I</code>, <code>J</code> and <code>... | <p>We can try using <code>data.table</code>. Convert the 'data.frame' to 'data.table' (<code>setDT(myData</code>), grouped by "I", we divide 'Value' by the 'Value' where 'J' is 'Z' (assuming there is only a unique 'Z' for the 'J' column in each 'I' group) and assign (<code>:=</code>) it to create a new column.</p>
<p... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
xquery to check xquery how to check if value of boolean variable is true<p>I am writing a xquery in which I have to check if the value of an attribute is tru... | <p>Firstly, it depends a little on whether your query/processor is schema-aware. (Is there an "import schema" declaration?)</p>
<p>The effective boolean value of an attribute is true if the attribute exists, regardless of its value, and regardless whether the data is schema-validated. Both <code>if (@married) ...</cod... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ReferenceError: websiteCheck is not defined discord.js<p>So I was basically coding a discord.js v12 bot and NodeJS keeps giving me this error even though web... | <p>So basically <code>function</code> wasnt being read somehow in the script, it started working with <code>const websiteCheck = async function(){</code>. Now its defined and everything is normal.</p>
<p>I don't know why <code>function</code> wasn't being read but oh well.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python3 translating to TI Basic Store function in for loop being weird (Fibonacci's sequence)<p>I just converted the Fibonacci's sequence from python3 to TI ... | <p>The for loop in ti basic iterates i by doing i = i+1.</p>
<p>The for loop in python sets i to a value from a sequence generated by range.</p>
<p>in other words
the ti code is more similar to</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code"... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to convert a loop into a list comprehension<p>How can I write this loop using list comprehension?</p>
<pre><code>t = [i.find_all('li') for i in soup.sele... | <pre><code>t = [i.find_all('li') for i in soup.select('div.col.col-7-12')]
Des = []
for i in t:
r = []
Des.append(r)
for j in i:
n = j.text
r.append(n)
</code></pre>
<p>Replace one loop:</p>
<pre><code>t = [i.find_all('li') for i in soup.select('div.col.col-7-12')]
Des = []
for i in... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What does the scope resolution operator return in case of Type::var?<p>Consider the following example:</p>
<pre><code>class A { int x; };
</code></pre>
<p>... | <p>It is, in fact, an lvalue. <a href="https://timsong-cpp.github.io/cppwp/expr.prim.id.qual#2" rel="noreferrer">[expr.prim.id.qual]/2</a>:</p>
<blockquote>
<p>A <em>nested-name-specifier</em> that denotes a class [...] followed by the
name of a member of either that class ([class.mem]) or one of its base
classe... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to create new variables based on stacked values in columns in R<p>I have a data set that looks like this</p>
<pre><code>ID a b c d source file
1 ... | <p>Using <code>dcast</code> from <code>data.table</code></p>
<pre><code>library(data.table)
dcast(setDT(df1), ID + a + b + c ~ trimws(source_file,
whitespace = "\\.txt"), value.var = "d")
Key: <ID, a, b, c>
ID a b c april2010 feb2010 march2010
<int> <int> ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Angular2 will not post HTTP<p>I am creating a registration component, and for some reason when I make the API call to the registration service, absolutely no... | <p>Observables are lazy and don't to anything without <code>subscribe()</code> or <code>toPromise()</code>:</p>
<pre><code> post(someUrl, someData).subscribe(result => console.log(result));
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Javascript change name format from AD container<p>I'm trying to change the format of how a name displays when a distinguished name is in the format "CN=Doe\,... | <p>Just like that. This assumes that names are always split with comma + space and there's equal sign.</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>function changeName(name... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Javascript client sends body in POST request, but node.js server gets it empty<p>I would like to be able to see {"content":"test data"} (it is supposed to be... | <p>On server side, you need to add body-parser middleware for parsing the body:</p>
<pre><code>var bodyParser = require('body-parser')
:
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }))
// parse application/json
app.use(bodyParser.json())
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Font not rendering (using bootstrap)<p>So I am trying to use a custom font, actually I'm using two of them. However, only one of them is rendering in the web... | <p>You have a <code>:</code> just after your CSS selector, remove it.</p>
<pre><code>/* Old CSS
.my-text: {
font-family: 'Quattrocento', serif;
} */
/* New CSS */
.my-text {
font-family: 'Quattrocento', serif;
}
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Counting Duplicates in another column in Excel 2013<p>The outcome I am trying to achieve is illustrated in the image below. Here is how I have set it up righ... | <p>In B2 use,</p>
<pre><code>=index(e:e, match(left(c2, 2), f:f, 0))
</code></pre>
<p>If your project codes are not always 2 characters but are separated from the extraneous information by a hyphen use,</p>
<pre><code>=index(e:e, match(left(c2, find("-", c2&"-")-1), f:f, 0))
</code></pre>
<p>It appears I interp... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Scraping from a website based on a search<h3>Objective</h3>
<p>In Java, I want to get the text output of the search result at <a href="https://pin1yin1.com/#... | <p>I checked the website, you can get the data from their rest API directly, try below:</p>
<pre><code>Document doc = Jsoup.connect("https://pin1yin1.com/pinyin/convert/?c=%E6%88%91%E6%98%AF%E8%8B%B1%E5%9B%BD%E4%BA%BA").get();
</code></pre>
<p>The response is below:</p>
<pre><code><html>
<head></head&... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Rest API for enabling advanced filtering in couchbase XDCR<p>From Documentation, we can see REST API available only for enable XDCR.
Do we have REST for Enab... | <p>It doesn't look this is explicitly documented, so I'm not 100% sure if it's supported. But specify <code>filterExpression</code> when you are creating a replication with the <code>/controller/createReplication</code> endpoint.</p>
<p>So, for example, this worked for me when I ran it from Postman:</p>
<blockquote>... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.