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:
How do I get the next item in a Laravel collection?<p>Let's say I have a child of a parent collection and I want to know who the next sibling is. My parent c... | <p>This did the trick:</p>
<pre><code>public function next()
{
$previous = null;
foreach ($this->album->media as $media)
{
if(!empty($previous && $previous->id == $this->id))
{
// Yay! Our current record is the 'next' record.
return $media->id... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to set up a listener in ionic angular to listen to the response from another listener in codorva plugin<p>I am working on the mobile app using ionic angu... | <p>refer to this websites: </p>
<p><a href="https://ourcodeworld.com/articles/read/33/how-to-execute-a-cordova-callback-more-than-once-in-java-android-" rel="nofollow noreferrer">https://ourcodeworld.com/articles/read/33/how-to-execute-a-cordova-callback-more-than-once-in-java-android-</a></p>
<p><a href="https://sta... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Arrayformula to find next value for criteria in Google Sheets<p>I have Form Responses tab in my sheets where I collate information containing starting dateti... | <p>try:</p>
<pre><code>={""; ARRAYFORMULA(IFNA(VLOOKUP(C2:C, SORT({C2:C, A2:A}, 2, 0), 2, 0)))}
</code></pre>
<p><a href="https://i.stack.imgur.com/KoFfN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KoFfN.png" alt="enter image description here" /></a></p>
<hr />
<h1>UPDATE:</h1>
<pre><co... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
add and remove class with jquery<p>how can I add a class on the second element when I click on the first one and remove it when I click on the second element... | <pre><code>//On DOM ready, add click event handlers to elements with className element1
//When element1 is clicked, it gets all siblings with className element2 and adds the className you want
//Adds event handler for click on elements with className element2 and removes the className
//This solution is done using JQue... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
JavaFX clock number transitions<p>I am attempting to create a clock in JavaFX, everything worked out well, except for the numbers which represent the time (f... | <p>If you combine <code>Translate</code> with <code>Rotate</code> transforms:</p>
<pre><code>Group numbers = new Group();
for(int i = 0; i < 12; i++){
//create a label.
Label label = new Label(String.valueOf(i==0?12:i));
label.getTransforms().add(new Rotate(i * (360d / 12d)));
label.getTransforms().... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Privileges in an Ubuntu Docker container after USER statement in Dockerfile<p>I created a Dockerfile</p>
<pre><code>FROM ubuntu:latest
</code></pre>
... | <p>If you don't want to use sudo, you could have a Dockerfile without <code>USER</code> (so it runs the command as root) and <code>CMD</code> pointing to a script that does the user switching, that way a <code>docker exec</code> would run as root.</p>
<p>Other way is to set the root password and use <code>su</code>.
A... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
can't open a shape file with pysal<p>i try to open a file using pysal wth that code:</p>
<pre><code>import pysal
f=pysal.open()
</code></pre>
<p>and this t... | <p>pysal released breaking changes with version 2. <code>open</code> is no longer a top level import. </p>
<p>You can still open shapefiles with pysal, but you’ll need to first import <code>pysal.lib.io.open</code></p>
<p>import pysal.lib.io.open
pysal.lib.io.open('Path/to/file.shp')</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why a mapped key in vim does not work in netrw?<p>While exploring with <code>netrw</code>, you can hit <code>t</code> to open the directory in a new tab.</p>... | <p>Duh.</p>
<p><code>netrw</code> already has <code>v</code> mapped to split to a new window.</p>
<p>If I <code>map K</code>, this works.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Felix OSGi Web Console and Grizzly HTTP Server (HTTP Port Conflict)<p>When my Felix (OSGi) starts it launches Felix Web Console bundle. This bundle uses Jett... | <p>After investigating on this HTTP port conflict problem. I got intrigued why Felix Web Console requires Jetty in particular. So I decided to remove Felix Web Console bundle from Felix, and I downloaded it from Maven Central along with it's dependencies. </p>
<p>During this process I haven't seen any dependency on Je... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to interpret returncodes from Python's subprocess.run<p>I'm currently running a set of unittests, that actually crash. So, in order to run all of them an... | <p>Those return codes are defined within the program you are running via a subprocess, they are not general OS error codes or Python codes. Look for documentation on the code you are calling via the subprocess. As an example, here is a batch script that returns an error code.</p>
<pre><code>@echo off
if /I "%~1"=="T... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Find closest past date in list of dates<p>I'm trying to find the closest past date in a list of dates to the current date. I've found several examples of sea... | <p>Using <code>min</code> with two <code>key</code>s would be one way:</p>
<pre><code>from datetime import datetime
now = datetime.now()
min(datelist, key=lambda x: (x>now, abs(x-now)) )
</code></pre>
<p>Output:</p>
<pre><code>datetime.datetime(2020, 1, 31, 0, 0)
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Issue with array_agg method when aggregating arrays of different lengths<p>Here is a lateral query which is part of a bigger query:</p>
<pre><code>lateral (... | <p>Unnest the arrays and re-aggregate:</p>
<pre><code>lateral
(select array_agg(dogfilter) filter (where dogfilter is not null) as dependencyOfFoods
from shelter sh cross join
unnest(sh.dogsfilters) dogfilter
where sh.shelterid = ${shelterid}
) filtersOfAnimals,
</code></pre>
<p>It is interesting that Postgre... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Need to convert std::vector<ButtonElement> buttonList to std::vector<BYTE> byteVector<p>I need to convert std::vector buttonList to std::vector byteVector.
I... | <blockquote>
<p>If it isn't, can you point the correct way.</p>
</blockquote>
<p>That depends on what you are trying to accomplish.</p>
<p>You have a sequence (a <code>vector</code>) of <code>TenderButtonList_Element</code>, right?</p>
<p>You're looking to produce a sequence of bytes containing the same bit patter... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Having a problem with getting 2 properties in one object<p>Alright so basically I have this object called user utils and I'm supposed to add an object to it ... | <p>You are redeclaring the definition of 'userUtils.search' each time. My recommendation to you would be to declare what 'userUtils.search' is first, and then start with its children.</p>
<pre><code>userUtils.search = {};
userUtils.search.byName = function(name, fuzzy) {
let matchedNames;
matchedNames = user... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Select rows based on multiple conditions<p>I have a table from which I have to select some rows based on the following conditions.</p>
<ol>
<li>If more than... | <p>Use window functions:</p>
<pre><code>select t.*
from (select t.*,
sum(case when blocknumber is not null then 1 else 0 end) over (partition by documentref) as num_bn_notnull,
rank() over (partition by documentref
order by (case when blocknumber is not null then doc... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get image dimensions after it draws in screen<p>I have an <code>ImageView</code> with <code>MathParent</code> height and width<br/>
In my activity it loads a... | <p>You can do a lot with the <a href="http://developer.android.com/reference/android/widget/ImageView.html#getImageMatrix()" rel="nofollow noreferrer">matrix</a> the view uses to display the image.</p>
<p>Here I calculate the scale the image is drawn at:</p>
<pre><code>private float scaleOfImageView(ImageView image) ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Determining Tab's Object at Run-time<p>I have a tab control in WPF and want to get it's current (tab's) object at run-time. How can I do it?</p> | <p>This is a simple tab control:</p>
<pre><code><TabControl x:Name="tab">
<TabItem Header="tab1">
<TextBlock Text="text1"/>
</TabItem>
<TabItem Header="tab2">
<TextBlock Text="text2"/>
</TabItem>
</TabControl>
</code></pre>
<p>You can fin... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Objective C / C. I get wrong Value when i try to get Mac Adress on IOS device<p>I'm trying to use a C code to obtain mac adress on any IOS device.
I'm tryin... | <p>That is some pretty nasty low-level code.</p>
<p>I personally think that anyone who writes code of the form:</p>
<pre><code>if ((a=b)==c)
</code></pre>
<p>...should be shot. We're not writing assembler here - Don't write code that looks like a typo to save 1 statement. (That rant is directed at the original auth... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Javascript: Map in for loop always return last item<p>I am attempting to modify an array of objects and I use a map inside a for loop. My implementation alwa... | <p>Your problem here come from the shadowing that you do with <code>item</code>:</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 testArray = [{
body: 'test sentence',
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Fixed width items in a responsive grid?<p>I have fixed width elements that I'd like to make a grid of. The only issue is that I want it to be responsive. Bas... | <p>I do not think that there is a more general solution with jeet-grid. Using <code>cycle</code> and <code>uncycle</code> is certainly the intended way to do it, though you might want to consider using media queries instead of calculating the item width (see <a href="https://www.youtube.com/watch?v=xXwBotyA_D0" rel="no... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
External image not displaying in Android<p>I am developing an app with VS 2019 for Windows, using Xamarin (version 3.6). My app loads images from an externa... | <p>This apparently was caused by updating my Visual Studio version. I had been using VS 2019 for Windows, and had been on an interim version (As of December, they were still in beta, I believe).</p>
<p>I found a suggestion in another thread to update to the last version of Xamarin Forms. I did this (version 4.4....)... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SQL Server where clause with null column<p>I have an <code>Employee</code> table and how it works is, when a new employee is added, the column <code>[DOR]</c... | <p>You need to use <code>IS NULL</code> operator instead of <code>= NULL</code> in your condition, like this:</p>
<pre><code>SELECT *
FROM Employee
WHERE DOJ <= '2015-02-15'
AND (DOR IS NULL OR DOR > '2015-02-15')
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to select a random row with a group by clause?<p>I have the following table</p>
<p><a href="http://sqlfiddle.com/#!2/7dbf1e/4" rel="noreferrer">SQLFiddl... | <p>What you need is a Random aggregate function. Usually there are no such functions in the current RDBMSs.</p>
<p>Similar question has <a href="https://stackoverflow.com/questions/1890155/how-do-i-create-a-table-alias-in-mysql">been asked</a>.</p>
<p>So the basic idea is shuffle the elements, then group by, and then... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
VScode plugin for angular<p>Is there a VSCode plugin, which --- can cross check a variable in app.component.html, to see if it exists in the app.component.ts... | <p>You can install <code>Angular Essentials extension pack for VS Code</code>. This should have what you need.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Spring MVC : Multiple <a> tag in one form<p>I have looked at different solutions but they didn't work for me. I want to pass data through my tags. But I thi... | <p>You can do it via form. It is a workaround but it will work. Just create two form inside your for each loop rather than making one at the top. Inside your for Each loop just place a form for edit and another one for delete. </p>
<pre><code><form action="editOrDelete/edit/${list.id}" method="get">
<input t... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Proper way to traverse the dom with jquery and javascript and usage of "this"<p>Here is my HTML:</p>
<pre><code><div class="tour" data-daily-price="357"&... | <p>It should work just fine unless <code>#nights</code> is not a unique ID. For example if there are multiple <code>"tour"</code> divs each having a <code>#nights</code> element. That said, <code>$(this)</code> is better because it doesn't require jQuery to go and parse the DOM again...</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to verify that email field is not blank before submitting form<p><strong>Updated Question:</strong></p>
<p>I added "required" to all fields, except the ... | <p>Use <code>required</code> in your input tags</p>
<p>The required attribute is a boolean attribute.</p>
<p>When present, it specifies that an input field must be filled out before submitting the form.</p>
<p>So your input should be </p>
<pre><code><input type="email" name="MERGE0" id="MERGE0" placeholder="Your... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
jQuery mouseleave - mouseenter just work in the First Element<p>I'm struggling trying to set a <code>mouseenter</code> and <code>mouseleave</code> event in s... | <p>Your function play gets only the first video because you specified the <code>0</code> index. You need to pass the current video index you're hovering to trigger the playback.
EDIT: Working code.
I made your functions taking an argument, which I'm setting to the first video element children of the element triggering ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
User registration fields not being saved in Laravel 5<p>I am using Laravel 5 and have amended the default registrar a bit to use first_name and last_name ins... | <p>The <code>first_name</code> and <code>last_name</code> fields need to be mass assignable in the model through the <code>$fillable</code>/<code>$guarded</code> arrays.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Dead-lettering dead-lettered messages in RabbitMQ<p>Here's what we have here:</p>
<ul>
<li>Topic Exchange <code>DLE</code>, which is intended to be a Dead-L... | <p>Yes, you can do this. We are currently doing this in production and it works great. The code is too long to include here but I will show you the diagram I created that represents the process. The basic idea is that the First DLX has a TTL, once that TTL expires the message goes into a 2nd queue to be re-sent back... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Improving Run Time for deduping lists based on only certain columns in Python<p>I have csv two files. I'm trying to remove all rows where certain columns mat... | <p>@kindall is correct in suggesting <code>set()</code> or <code>dict</code> to keep track of what you've seen so far.</p>
<pre><code>def getKey(row):
return (row[0], row[7], row[9], row[10])
# create a set of all the keys you care about
lead_keys = {getKey(r) for r in Leads_rows}
# save this off due to reverse ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Does PTX actually have a 64-bit warp shuffle instruction?<p>I noticed that in the docs for <code>__shfl_sync()</code> and it's relatives that 64-bit datatype... | <p>Currently, there is <a href="https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#data-movement-and-conversion-instructions-shfl-sync" rel="nofollow noreferrer">no 64-bit shuffle instruction in PTX</a>. The basic register unit in all current CUDA GPUs are 32-bits. 64-bit quantities have no correspondi... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
error [No relevant source lines] only on 1 data set, only on local machine<p>I'm trying to fix a bug in a particular page on our website, so I've pulled the ... | <p>Looking at the call stack, it appears that the error is casued by something failing in Browser Link:</p>
<pre>
[No relevant source lines]
[WebException: The request was aborted: The request was canceled.]
System.Net.ConnectStream.InternalWrite(Boolean async, Byte[] buffer, Int32 offset, Int32 size, AsyncCallback... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ReCaptcha doesn't work when used with Polymer in Firefox and IE<p>For some reason Polymer and recaptcha will on work together in Chrome, Safari, and Opera, b... | <p>This is a bug as confirmed here :
<a href="https://github.com/GoogleWebComponents/google-recaptcha/issues/5" rel="nofollow">https://github.com/GoogleWebComponents/google-recaptcha/issues/5</a></p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
HTML5 range slider values on the go using jQuery (not UI)<p>I'm using default HTML5 range slider. It works, but is it possible to change the value of this s... | <p>Use <code>oninput</code></p>
<pre><code> $(document).ready(function(){
$('#oc-max-price').on("input", function () {
var mP = $('#oc-max-price').val();
$('#oc-max-price-val').text(mP);
console.log(mP);
});
});
</code></pre>
<p>Pure <code>JavaScript</code></p>
<pre><code>va... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Does realloc(p, 0) really involves free(p) in glibc?<p>I found that some people and references like books state that if <code>p != NULL</code> and <code>p</c... | <p>Edit: Your glibc seems to be a pre-2.18, in 2.18 a bug was fixed in mtrace (see <a href="https://sourceware.org/bugzilla/show_bug.cgi?id=14981" rel="nofollow">here</a>). On a 2.20 glibc your test program reports: "No memory leaks."</p>
<p><code>free</code> is called in glibc. From the sources of current glibc 2.21 ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Calling function with restricted arguments that are already restricted in current scope<p>I have trouble understanding what <code>restrict</code> means in te... | <p>Here are the promises you are making:</p>
<pre><code>void foo(int *restrict p1, int *restrict p2) {
// a() can't modify p1[...] or p2[...]
a(p1, p2);
// b() CAN modify p1[...] or p2[...]
// Note that you are still making this promise if you don't use
// "restrict" in the declaration of b()
b... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to make Dropzone.js appear like the theme on the site?<p>I've been trying to make Dropzone.js look like the theme on the site (dropzonejs.com) using a sh... | <p>For the theme itself, it seems to work fine as long as you follow the same structure in the <code>css</code> rules: <code>main section .dropzone</code>.</p>
<pre><code><html>
<head>
<link rel="stylesheet" href="dropzone.css">
<link rel="stylesheet" href="style.css">
&... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Adding Margins to Prototype Cells in UITableView<p>How can I add top, bottom, left, and right margin spacings between each individual prototype cell in UITab... | <p>You can't set margins between cells, but you can make it look like there are margins by giving the cell a clear background color, and adding a subview (to which you would add any other subviews you need) that is inset from the edges of the cell by whatever margins you want. Give this view a background color, and tur... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I count up how many males and females are in a text file?<p>going off of the assumption that the file contains 2 columns with the first column corres... | <pre><code> //Use a try with resources so that the scanner is closed on completion
int maleCount = 0;
int femaleCount = 0;
try (Scanner scanner = new Scanner(f)) {
while (scanner.hasNextLine()) {
String line = scanner.nextLine();
//TODO Check line is not empty whitespace... A good way of doing t... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do you apply multiple filters and sum in ruby?<p>I have an array of objects of the type Order</p>
<pre><code>Order
:status
:amount
</code></pre>
<p>s... | <p>If </p>
<pre><code>a = [[:post, 100],[:pre, 10], [:pre, 15],[:canc, 20],[:canc, 45]]
</code></pre>
<p>there are many wants to obtain the sums. Here's are two.</p>
<p><strong>Use <a href="http://ruby-doc.org/core-2.2.0/Enumerable.html#method-i-each_with_object" rel="nofollow">Enumerable#each_with_object</a></stron... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python: Shell with grep value stored in variable appends always a additional line<p>I forgot add, I must call shell from python,
I have a file </p>
<pre><c... | <p>Try opening the file and reading it either line by line or as a whole:</p>
<ul>
<li>As a whole</li>
</ul>
<pre class="lang-py prettyprint-override"><code> with open("file.txt", "r") as file:
data = file.read()
if "bbb" in data:
print("Pass")
else:
print("Fail")
</... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there any way to get rid of the second while loop here?<p>For <a href="https://leetcode.com/problems/merge-sorted-array/" rel="nofollow noreferrer">this p... | <p>Are you sure it is an IndexOutOfBoundsException? To me the problem seems to be that you will get an endless loop if n < 0 and m >= 0.</p>
<p>Here is a working solution, I basically just simplified yours and corrected the error:</p>
<pre><code>class Solution {
public void merge(int[] nums1, int m, int[] nums... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Java - Can we set firstNode to null in a linked node to remove all entries?<p>I have the below code:</p>
<pre><code>public final class LinkedBag<T> imp... | <p>Yes; except you should also remember to set <code>numberOfEntries = 0;</code> too. Then your linked list is in the same state as if a new empty linked list was just created (note that your constructor does the same two things), so it correctly represents an empty list.</p>
<p>Regarding the garbage collector, this w... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
group by rows into multiple groups<p>I have a table</p>
<pre><code>id index value
1 1 2
2 1 3
3 2 6
4 3 ... | <p>One sum for each "index >" group, use case to chose values to sum:</p>
<pre><code>select sum(case when index >= 1 then value else 0 end) sum1,
sum(case when index >= 2 then value else 0 end) sum2,
sum(case when index >= 3 then value else 0 end) sum3
from table group by index
</code></pre>
<p... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Should I teach C89, C18 or something else?<p>I am TA in a course where I have had to give a crash course in C and one of my students asked, why we still use ... | <blockquote>
<p>So would it be more appropriate to teach the students this or should we stick with C89? </p>
</blockquote>
<p>Unfortunately, this question cannot be answered in an objective way, so it will be a bit opinionated.</p>
<p>If I was a teacher, I would use modern C, that is C11 or newer. But I would also ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Counting instances of various unique strings in a column on Excel<p>I have a column in Excel that lists many unique strings. Some strings come up only once, ... | <p>If you have a version of Excel that supports the new Dynamic Array feature:</p>
<p>Assuming your data is in column <code>A</code>, place this formula in say, <code>C1</code></p>
<pre><code>=UNIQUE(FILTER(A:A,A:A<>0),FALSE)
</code></pre>
<p>Then, in D1 put this formula</p>
<pre><code>=COUNTIFS(A:A,C1#)
</co... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Grayscale, monochrome, binary image in matlab<p>In Matlab,</p>
<ol>
<li>An 8-bit gray scale image has pixel values ranging from 0 to 255. The pixel depth ma... | <p>Monochrome and grayscale are mostly interchangeable. Monochrome data has only one color, but it's not always gray. For example digital x-ray data is monochrome because it has only intensity. The printout is typically grayscale but you could also use any other color.
Sepia images are also monochrome, but strictly sp... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Getting the textbox value into the jquery<p>Can i get the textbox value into the jquery using its name property and not by the Id property.
For example</p>
... | <p>Yes, of course. Try it:</p>
<pre><code>$('input[name="text-box"]').val();
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Change session variables without reloading page<p>So my webpage has a Link <code>remove Advertisment</code> which should remove the ads from my website and r... | <p>Play keeps session information on client side within a signed cookie. </p>
<p>So you have 2 options (I would go with the 2nd):</p>
<p>1) Ajax call to update play's session data (because you will not want to modify this on client side with javascript since it is a signed cookie and break things)</p>
<p>2) Create a... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Use Apache HttpClient with caching enabled as Jersey 2 client<p>How can I use a custom configured Apache HttpClient with Jersey Client 2?</p>
<p>HttpClient ... | <p>You can use <a href="https://github.com/eclipse-ee4j/jersey/blob/master/connectors/apache-connector/src/main/java/org/glassfish/jersey/apache/connector/ApacheHttpClientBuilderConfigurator.java" rel="nofollow noreferrer">ApacheHttpClientBuilderConfigurator</a>. So you can do:</p>
<pre><code>config.register(new Apach... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to add date column to already existing time column in python?<p>I have a <code>df</code> as follows:</p>
<pre><code> Time Werktag
0 00:15:00... | <p>Use cross join by <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.merge.html" rel="nofollow noreferrer"><code>DataFrame.merge</code></a> with helper <code>DataFrame</code> created by <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.date_range.html" rel="no... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Bits function in Radix-sort<p>Radix-sort is the sort keys as the numbers represented in the base of M-number. In order to use Radix sort, I need to understan... | <p>In the function <code>unsigned bits(int x, int k, int j)</code>, <code>x</code> is the value to be sorted, <code>k</code> is the right most position of the bits to extract from <code>x</code>, and <code>j</code> is the number of bits to extract from <code>x</code>. </p>
<p>If you want to do a radix sort with 4 bit ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Emoticons on domain names<p>I recently came across with a really strange campaign on the Internet (<a href="http://www.emoticoke.com/" rel="nofollow noreferr... | <p>One can map these emoticons to some character sequences or Unicode characters and make an <a href="https://en.wikipedia.org/wiki/Internationalized_domain_name" rel="nofollow">Internationalized Domain Name</a> - these can contain any Unicode characters.</p>
<p>Hints to which characters/sequences these particular emo... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to check if a SQL query from a variable input returns a row in Python?<p>I'm trying to create a function to check if a username is already taken.</p>
<p... | <p>There's two issues in your code, the first one being that you're not changing the query inside your loop and thus still fetching data with the original username.<br><br>The second one being that <code>.rowcount</code> always returns <code>-1</code> for <code>SELECT</code> queries. If you tried printing your variable... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
TypeError: Cannot find default value for object<p>I have a google ads script which is failing with the following error. </p>
<pre><code>TypeError: Cannot fi... | <p>After a few hours head scratching, I fixed this by removing <code>adGroup</code> from the <code>.build()</code> method. <code>build()</code> doesn't take any parameters and I'm not sure why I was passing it. Still a very strange error.</p>
<pre class="lang-js prettyprint-override"><code>var adOperation = adGroup
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Hardcode C# byte property into a model<p>I'm writing xunit to test <code>Authenticate</code> method. It's pretty straightforward:</p>
<pre class="lang-c# ... | <p>I would factor out the code to create the hash values into it's own method you can unit test separately.</p>
<p>So this:</p>
<pre><code>private static bool VerifyPasswordHash(string password, byte[] storedHash, byte[] storedSalt)
{
if (password == null) throw new ArgumentNullException("password");
if (stri... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Xamarin.Forms gRPC Error starting gRPC call: unexpected end of stream on Connection<p>i programming an Application for my study.</p>
<p>I try to use gRPC in... | <p>Solved it by Replacing</p>
<pre><code>channel = GrpcChannel.ForAddress(connectionString);
</code></pre>
<p>with</p>
<pre><code> if (connectionString.Contains("http://"))
{
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
string newCon... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I set a NSTimer based on what button is pressed?<p>I have a game where I set a timer.</p>
<pre><code>-(void)setTimer{
self->mTimer = [NSTimer sch... | <p>Rather than using an explicit 5.0 in <code>setTimer</code>, create an integer property and reference that. So, create <code>interval</code> in your <code>@interface</code></p>
<pre><code>@property (nonatomic) CGFloat interval;
</code></pre>
<p>And then set it to 5.0 or 10.0 as appropriate. And then your <code>setT... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do you replace specific characters in beautifulSoup?<p>I'm well aware on how to replace texts in tags using bs4 but how would I actually change a specifi... | <p>If you want to insert tags into text, you'll have to break up the whole text into 3 pieces; everything before, the text going into the tag, and everything after.</p>
<p>This has to be done every time you find a match in the text, so you need to keep track of the end piece after insertion too:</p>
<pre><code>def in... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
CLLocationDistance not working - swift<p>I'm having problems with this code, I can't calculate the distance between two locations. I've already searched all ... | <p>You just need to declare you var startLocation as an optional but not inside your function.</p>
<pre><code>var startLocation :CLLocation!
</code></pre>
<p>then inside your didUpdate function you just test if the startLocation var is nil:</p>
<pre><code>func locationManager(manager: CLLocationManager!, didUpdate... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Found 2 elements with non-unique id for Radio Buttons MVC<p>I have this Gender field on an MVC page that generates an error in Chrome's console for duplicate... | <p>Apparently, adding the is through HTML attribute is the only way:</p>
<pre><code><label>@Html.RadioButtonFor(m => m.UserGender, "true", new { id = "radio" + Guid.NewGuid(), @checked = "checked" }) Male </label>
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Code simplification for authorized chars only<p>I get a string that contains <code>"@string.number (other stuff)"</code>.
I want to filter input from start+1... | <p>You can replace them to an allowed character, say <code>a</code>. That way the string will never be empty.</p>
<p>Sidenote: I'm horrified (but not surprised) to hear that <code>ctype_alnum("")</code> returns <code>false</code>. It totally contradicts what the manual says... and the behaviour is even different in so... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What SQL user is used by TFS to send alerts?<p>We are running into a few issues with our TFS installation (TFS 2013 Update 4, SQL 2014 Standard) as a result ... | <p>I'm going to advise you that a DBA should not be making changes to the TFS databases. I suggest opening a ticket with MSFT and getting assistance from the product support group.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Arraylist not working, items do not stack up<p>So, I am trying to get some info from <code>database</code> and save it into an <code>ArrayList</code>, so lat... | <p><code>AsyncTask</code> executes asynchronously, so you have to wait till finish the execution to get data. Better options is to use a callback to invoke when operation completed.</p>
<p><strong>Step - 1:</strong> Remove button creation code from <code>onCreate</code> and add it in callback</p>
<pre><code>@Override... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Where can you find the location-id for Instagram's API? Or using LAT LNG?<p>Looking through Instagram's API documentation, you can pull photos based on a <co... | <p>If you have lat and lng you can search for locations by geographic coordinate using this endpoint.
<a href="https://api.instagram.com/v1/locations/search?lat=1&lng=2&access_token=Your-Act" rel="nofollow">https://api.instagram.com/v1/locations/search?lat=1&lng=2&access_token=Your-Act</a>
You'll get li... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
java.lang.NoSuchMethodError: org.mockito.MockingDetails.getMockCreationSettings()Lorg/mockito/mock/MockCreationSettings<p>After migrating an application to s... | <p>After facing the same issue, I looked at the stack trace:</p>
<pre><code>Suppressed: java.lang.NoSuchMethodError: org.mockito.MockingDetails.getMockCreationSettings()Lorg/mockito/mock/MockCreationSettings;
at org.springframework.boot.test.mock.mockito.MockReset.get(MockReset.java:107)
at org.springframework... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Bootstrap 3.3.2 - fire JS when content of collapse is visible<p>I am using Twitter's Bootstrap 3 "collapse" to show and hide some content in one column and h... | <p>Try initializing your Jquery plugin for equal height after collapse content gets visible, using event of collapse "<strong>shown.bs.collapse</strong>"</p>
<pre><code>$('.collapse-text').on('shown.bs.collapse', function () {
// Initialize here
})
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Django static files in live server using nginx<p>I have a live server running django, the address is <a href="http://179.188.3.54/" rel="nofollow">http://179... | <p>Add the static serving to the nginx conf before the <code>/</code> pattern:</p>
<pre><code>location /static {
alias /cinegloria/cinegloria/cinegloria/static/;
}
location / {
...
}
</code></pre>
<p>Or set the <code>STATIC_ROOT</code> to the directory under the www root:</p>
<pre><code>STATIC_ROOT = '/usr/... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Conditions on the Trust Policy of an IAM Role<p>Can someone explain why Roles were designed by AWS to have a Principal like entire service (EC2, Lambda etc.)... | <p>No, it is not possible to put limitations in the Trust Policy.</p>
<p>If you only want certain IAM Roles to be used on particular instances, you would need to enforce that through the use of <code>iam:PassRole</code>. This is the permission that determines whether somebody has permission to pass a particular role t... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
graphic layout implementation<p>i'm new on android programming.
what is the best way to implement this graphic layout on android?</p>
<p><a href="http://8pi... | <p>1) That's up to you. If you think the layout looks as it should, then yes. It's correct.</p>
<p>However, if you are asking for my subjective opinion, I would use that layout for landscape mode only, and implement a more "portrait-friendly" layout for portrait mode.</p>
<p>Example:</p>
<p><img src="https://i.stack... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I login with multiple discord bot accounts WITHOUT hardcoding?<p>I have been trying to get this to work for a bit now, with no avail.</p>
<p>What i h... | <p>you can do it in a simple way. At first do a loop on a your tokens and do your job.</p>
<p>This will look likes:</p>
<pre class="lang-js prettyprint-override"><code>const auth = require('./tokens.json')
const Discord = require('discord.js')
for (const token of auth.Tokens) {
const client = new Discord.Client(... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Query to fill ID column based on matching columns from different tables<p>SQL question. </p>
<p>I have 2 tables:</p>
<pre><code>1. Clubs (2 columns - CID, ... | <p>It is pretty simple query:</p>
<pre><code>UPDATE Players
JOIN Clubs ON Clubs.Club = Players.Club
SET Players.CID = Clubs.CID;
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
bundle install fails installing ffi (1.9.6)<p>ON ubuntu 12.04 Drupalpro Development VM</p>
<p>Gem::Installer::ExtensionBuildError: ERROR: Failed to build ge... | <p>Ok After reading this question
<a href="https://stackoverflow.com/questions/7645918/require-no-such-file-to-load-mkmf-loaderror">Answer for `require': no such file to load -- mkmf (LoadError) </a></p>
<ol>
<li>Find out what version of ruby you are using <code>$ruby -v</code></li>
<li>Mine was ruby 1.8.7</li>
<li>Th... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
GQL query where field is not null<p>I have an entity kind called Account. One of the fields is a String named <code>selfie</code>, which is basically the url... | <p>This should be as simple as</p>
<pre><code>Filter selfie = new FilterPredicate("selfie", FilterOperator.NOT_EQUAL, null);
</code></pre>
<p>where you actually pass the Java null value (not a String) and filter with not equals (see <a href="https://stackoverflow.com/a/22200137">https://stackoverflow.com/a/22200137</... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to search word in column A and count it based on column B in Pandas?<p>I have dataframe based on Text, Date and Author like this: </p>
<pre><code>TEXT ... | <p>Use <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.str.count.html" rel="nofollow noreferrer"><code>Series.str.count</code></a> with ignore lower and upper cases, but also are counts words like <code>cation</code>, <code>locate</code> because contains subtring <code>cat</code>:</p>
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get body of Expression<Func<T>><p>In my application I have several parts where I use an <code>Expression<Func<T>></code>. I use this to invoke <c... | <p>Assuming that this will always be used on properties on the current object, the below should work - and builds on top of what you've got in your comment:</p>
<pre><code>private void AddItemsToCollectionAndInvokePropertyChanged<T,U>(Expression<Func<U>> propertyNameExpression, IList<T> addItem... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
The first number have been repating every time ı couldnt understand why this happen<pre><code>#include<stdio.h>
int main(){
int x;
scanf("%d... | <p>It is standard behavior for not just the output to be written to the screen, but also the input. So, if you enter the number 1 and press enter, it will echo the number 1 onto the screen.</p>
<p>In order to make it clear what the input is and what the output is, I suggest you change your program to the following:</p... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How does the request.timeout.ms of producer config and request.timeout.ms of broker config play together<p>I'm trying to understand the request timeout mecha... | <p>I ran a test and observed that send() is failing with below exception </p>
<p>Failed to send; nested exception is org.apache.kafka.common.errors.TimeoutException: Topic test.topic not present in metadata after 45000 ms</p>
<p>in this 45000 ms is the 'max.block.ms'.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Performance consideration looking up localized strings in ASP.NET MVC view<p>We have a ASP.NET MVC website that uses strongly typed resource class to look up... | <p>No difference, everything, i.e. all view rendering, is done on a server side. Of course there will be a little performace difference because rendering engine has to look up 3 resources instaed of one, but this can be safely ignored because, again, it will be done on a server side.</p>
<p>To make sure this is actual... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to create video from multiple sequence of images using FFMpeg?<p>Hello all i am new in android developing. I want to create video from sequence of images... | <p>You can use <code>-loop</code> command like this <code>ffmpeg -loop 1 -i img.png -c:v libx264 -t 30 -pix_fmt yuv420p out.mp4</code>. This will loop single image as mentioned here.
<a href="https://trac.ffmpeg.org/wiki/Create%20a%20video%20slideshow%20from%20images" rel="nofollow">https://trac.ffmpeg.org/wiki/Create%... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Verify JWT signature PS256 algorithm<p>Hey guys i am pretty new to java and i can't manage to succeed in verifying a JWT signature with the bouncy castle pro... | <p>This is where you are wrong:</p>
<pre><code>sig.update(signature.decode());
</code></pre>
<p>You are trying to verify a signature over the signature bytes itself.</p>
<p>According to <a href="https://docs.oracle.com/javase/8/docs/api/java/security/Signature.html" rel="nofollow noreferrer"><code>java.security.Sign... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
GROK Pattern for following log<p>I'm having difficulty coming up with a pattern for the following log entry.</p>
<pre><code>[INFO ] 2020-02-07 16:11:56.148 ... | <p>Your grok-pattern has multiple issues (order is based on occurrence in grok pattern):</p>
<ul>
<li>The log-level is inside square brackets. The LOGLEVEL-pattern does not include any characters besides the defined words. Also, there is a whitespace after the loglevel and before the closing square bracket</li>
<li>Yo... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unable to add image to ZPL through SharpZebra<p>I am trying to generate a ZPL file using <a href="https://sharpzebra.codeplex.com/" rel="nofollow">SharpZebra... | <p>Your generated ZPL code contains the ~DG command needed to upload the image to the printer, but does not contain a ZPL command to actually display the image.</p>
<p>I'm not familiar with SharpZebra, but if you add the following right before the last ^XZ, you'll get something to print (although the image looks weird... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
WEB API 2 : get profile data during oauth RegisterExternal (facebook)<p>In the out of the box ASP.NET WEB API oAuth implementation after a new user calls:</p... | <p>John Mc really pointed me in the right direction, here is a more full solution.</p>
<pre><code>// POST api/Account/RegisterExternalToken
[OverrideAuthentication]
[HostAuthentication(DefaultAuthenticationTypes.ExternalBearer)]
[Route("RegisterExternalToken")]
public async Task<IHttpActionResult> RegisterExtern... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Changing Id of nodes in different controllers<p>I have this code in Application class</p>
<pre><code>scene.getStylesheets().add(getClass().getResource(CONST... | <p>The selector</p>
<pre><code>#stoperButton .button { ... }
</code></pre>
<p>matches a node that has the style class "button" and is a descendent of a node with css id "stoperButton".</p>
<p>I think what you want is just</p>
<pre><code>#stoperButton {
-fx-background-color: linear-gradient( from 50.0% 100.0% t... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to listen for changes on formik field with nested values?<p>What I want to do is when certain field from formik change, do something.</p>
<p>e.g.</p>
<... | <p>I figure it out, I need to use <code>getIn</code> from <code>formik</code></p>
<pre><code>import { useFormikContext, getIn } from `formik`
const MyComponent = ({ name }) => {
const { values } = useFormikContext()
const fieldValue = getIn(values, name)
useEffect(() => {
// do something w... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
And condition in Yii with condition<p>How can i use AND in Mysql in Yii.</p>
<p>I tried.Here is my condition</p>
<pre><code>$cid =$list['cid'];
$sid =$list... | <p>Not "array_push", try this:</p>
<pre><code>$arr[':sid'] = $sid;
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to make UI responsive even clicking loading button<p>Can anyone help me out how to make list view responsive even clicking loading button.I am trying wit... | <p>Firstly It looks like you are using an asyncTask.</p>
<p>I would look at the android Developer documentation for proper usage: <a href="http://developer.android.com/reference/android/os/AsyncTask.html" rel="nofollow">AsyncTask</a></p>
<p>An asyctask has 3 main parts:</p>
<ol>
<li>onPreExecute- runs on UI Thread</... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Error sending AJAX POST request from local .html file to localhost:8080. CORS: "It does not have HTTP ok status."<p>I am getting an error when attempting to ... | <p>Add @CrossOrigin annotation (import org.springframework.web.bind.annotation.CrossOrigin) to the top of the controller class that is handling the request.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
engine.node: undefined symbol: _ZTV6Config<p>I have written my first <strong>Node.JS</strong> N-Api addon but it crashes with log: </p>
<pre><code>internal... | <p><code>_ZTV6Config</code> is the <a href="https://demangler.com/" rel="nofollow noreferrer">mangled name</a> for <code>vtable for Config</code>. </p>
<p>Confusingly this is actually caused by a missing implementation of the destructor method for <code>Config</code>.</p>
<p>The compiler defines the vtable in the sam... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Scala - How to define map, where value depends on key?<p>Is there a way to define a Map, where Map value depends on its key, like </p>
<pre><code>Map(key -... | <p>Lets say you have your keys in a list like this, and you want to convert it map with squares as values.</p>
<pre><code>scala> val keyList = ( 1 to 10 ).toList
keyList: List[Int] = List(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
scala> val doSquare = ( x: Int ) => x * x
doSquare: Int => Int = <function1>
// ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
php regex pairing words and numbers<p>I have some structured words and numbers separated by / and there is a space between words and numbers.</p>
<pre><code... | <p><a href="https://regex101.com/r/sLbcHF/1/" rel="nofollow noreferrer">See Regex Demo</a></p>
<p>The assumption is that in the second grouping we can have digits, comma and decimal point, i.e. <code>[\d,.]+</code>.</p>
<pre><code><?php
$tests = [
"blabla apple/banana/cherry 15/33/45,2 blabla ",
"blabla or... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Spring XML - ignore $ in url which is writen in xml , without using propeties file<p>I have a spring bean which contain list of strings. Every string represe... | <p>Try this:</p>
<pre><code>http://server/domain/main.aspx?pagetype=entityrecord&amp;id=#{'$'}{id}
</code></pre>
<p>This should be escape the dollar sign. The <code>${...}</code> are special character for PropertyPlaceHolder and have to been escaped for your issue.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Accessing ViewBag variables in View<p>Finally giving up on asking the Google Gods...</p>
<p>I'm trying to access ViewBag variables in my view from the query... | <p>With anonymous type object in ViewBag, you cannot access their properties just by using a <code>.</code> operator. That's because the anonymous type is generated as <a href="https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/internal" rel="nofollow noreferrer"><code>internal</code></a>. So be... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to show progress dialog even touch the screen in Android<p>I am using progress dialog to retrieve Flickr photos, my requirement is to 1)Display progres... | <blockquote>
<p>1)Display progress dialog even I touch the screen</p>
</blockquote>
<p>Add <code>setCancelable</code> after creating <code>ProgressDialog</code> :</p>
<pre><code>pDialog.setCanceledOnTouchOutside(false);
pDialog.setCancelable(false);
</code></pre>
<blockquote>
<p>2)If I click back button the asyn... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
model.save receives Not JSON Serializable error. tensorflow1.14.0<p>i tried to implement a simple architecture</p>
<pre><code>def conv_block_A(layer):
b... | <p>after going through <a href="https://www.tensorflow.org/api_docs/python/tf" rel="nofollow noreferrer">tensorflow documentations</a> for each and every line in my code, i changed </p>
<pre><code>dense = tf.keras.activations.sigmoid(dense)
</code></pre>
<p>to </p>
<pre><code>tf.keras.layers.Dense(units=1, activatio... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Saving figures using plt.savfig on Google Colab with axes<p>I'm trying to automatically save figures in my code using:</p>
<p><div class="snippet" data-lang... | <p>try </p>
<pre><code>plt.savefig(<name>, bbox_inches = 'tight')
</code></pre>
<p>or try specifying a fixed size for your figure
and then save it.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Swift - Sorting array of dollar values<p>I have an array of deals formatted like this:</p>
<p>"$2.25 Drink A"</p>
<p>"$5 Drink B"</p>
<p>"$10 Drink C"</p>... | <p>The root of your problem is that you're sorting alphabetically rather than numerically. Numerically, 4.25 sorts before 10.25 because <code>4.25 < 10.25</code>. Alphabetically, 10.99 comes before 4.25 because the character code for <code>1</code> is less than that for <code>4</code>. To fix the problem, you obviou... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Show ProgressDialog from outside class<p>I want show a ProgressDialog on the current activity from an outside class, other than passing the variable into the... | <p>A possible solution is to change the method passing the current Activity as a parameter from Test2:</p>
<pre><code>public void change(Context context) {
mDialog = new ProgressDialog(context);
mDialog.setMessage("Testing");
mDialog.setCancelable(true);
mDialog.show();
}
</code></pre>
<p>And then in ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.