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:
Splice data based off page<pre><code>import React,{Component} from 'react';
import Pagination from "@material-ui/lab/Pagination";
import axios fro... | <p>When you use splice you are modifying the original array itself. Initially api data has 10 elements. When you performed the splice operation on api data you removed 2 elements and now the total elements in api data are 8. Then you calculated total pages on api data which is <code>8 / 2 = 4</code>.</p>
<p>You can fix... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
'GlobalKey().currentContext' in ListWheelScrollView is null in flutter<p>I'm trying to select/scroll automatically to a particular element in ListWheelScroll... | <p>After doing a bit of ground work, I've figured out that it can be done through <code>FixedExtentScrollController</code>.</p>
<p>Here is the complete example if someone is facing the same issue.</p>
<pre><code>
void main() {
runApp(
const MaterialApp(home: StatefulWidgetsExample()), // use MaterialApp
);
}
c... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why is it not show all informations as xml?<p>PHP </p>
<pre><code>$ch = curl_init() ;
$url = "http://www.espnfc.com/rss" ;
curl_setopt($ch, CURLOPT_URL ,... | <p>Because of the magic syntax that SimpleXML uses, functions like <code>print_r()</code> and <code>var_dump()</code> will not always output all available data. They will still ne there if you access them. Use <code>SimpleXMLElement::asXML()</code> to fetch the serialized XML of an element node.</p>
<pre><code>$rss = ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to assign different markers to the max value found in each column in the plot<p>How would I assign markers of different symbols to each of the max values... | <p>You can do it this way. Note that I used a <code>V</code> instead of <code>,</code> as the comma (pixel) wasn't showing up clearly.</p>
<pre><code>import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
df = pd.DataFrame(np.random.randint(0,1000,size=(100, 4)), columns=list('ABCD'))
df.plot(fig... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Rails nested_form find element added<p>I have a nested form in a form, which on clicking on a button adds a bunch of fields for the user to complete.</p>
<p... | <p>You have to delegate the element</p>
<pre><code>$('body').on('click', '.delete-client-button', function() {
do something...
});
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Asp.Net Core MVC - Image does not load/display while converting view into pdf<p>This is related to my last question. I am trying to convert a view into pdf. ... | <p>Your image src needs to use the address of the full accessible path for it to work properly.</p>
<p>Like :</p>
<pre><code><img id="mainImage" style="width:200px;height:160px" src="https://localhost:5001/Images/ProductImages/d0f8bbb9-effd-4f93-b5bc-b28fdfe4a233Capture.PNG">
</code>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get a Kinect JointType by its ID number instead of its name<p>Is there anyway to retrieve a "joint type" by its value, instead of by its name?</p>
<p>For ex... | <p>This is the way I use in my sources. </p>
<p>You just need to do a cast : </p>
<pre><code>JointType myJoint;
myJoint = (JointType)8;
</code></pre>
<p>after that you can write: </p>
<pre><code>(joints[myJoint]);
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
In ruby, symbols that cannot be replaced by strings?<p>As far as I understand, symbols are ways to reduce the memory footprint of strings. So functionally <c... | <p><code>String</code>s and <code>Symbol</code>s in Ruby are never directly equal. The difference in class is important in more than one way, and</p>
<pre><code>:my_label != "my_label"
</code></pre>
<p>However,</p>
<pre><code>:my_label.to_s == "my_label"
</code></pre>
<p>A Ruby <code>Symbol</code> is more efficient... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Dart equivalent of anonymous type object from TypeScript<p>In TypeScript, I can simply define an anonymous object like below and still get intellisense for i... | <p><strong>You can't.</strong></p>
<p>Dart doesn't support anonymous types.</p>
<p>You can define a <code>Map</code>:</p>
<pre class="lang-dart prettyprint-override"><code>final person = <String, int>{'age': 10};
</code></pre>
<p>But in the intellisense perspective it is only a <code>Map</code> which contains key... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Adding excel formula to appendRow<p>I am new to Apps Script, but I have a code that fills form data in to a spreadsheet. It's working fine, but I want to mak... | <p>With <a href="https://developers.google.com/apps-script/reference/spreadsheet/sheet#appendrowrowcontents" rel="nofollow noreferrer">appendRow</a>, you can also assign formulas as contents.</p>
<p>So, you can concatenate the values on your script and add a <a href="https://support.google.com/docs/answer/3093313" rel=... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
python regex search for elimitation<p>i have the following case</p>
<pre><code>import re
target_regex = '^(?!P\-[5678]).*'
pattern = re.compile(target_rege... | <p>You <code>join</code>ed the items in <code>mylist</code> and <code>P-5</code> is no longer at the start of the string.</p>
<p>You may use</p>
<pre><code>import re
target_regex = 'P-[5-8]'
pattern = re.compile(target_regex, re.IGNORECASE)
mylists=['p-1.1', 'P-5']
target_object_is_found = [x for x in mylists if not... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Printing strings and characters as hexadecimal in Go<p>Why cyrillic strings in hexadecimal format differ from cyrillic chars in hexadecimal format?</p>
<pre>... | <p>Printing the hexadecimal representation of a <code>string</code> prints the hex representation of its bytes, and printing the hexadecimal representation of a <code>rune</code> prints the hex representation of the number it is an alias to (<code>rune</code> is an alias to <code>int32</code>).</p>
<p>And <code>string<... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
PyPDF2 writer function creates blank page<p>Trying to write a function to combine pages in a PDF document. Streaming the output creates a blank page for an u... | <p>Since you're using a context manager, you don't need to explicitly call <code>.close()</code>. Try this:</p>
<pre class="lang-py prettyprint-override"><code>from PyPDF2 import PdfReader, PdfWriter
dr = r"C:\GC"
ldr = dr + r"\12L.pdf"
writer = PdfWriter()
with open(ldr, "rb") as f:
r... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Recyclerview with GridLayout. Add a divider only if date of next item differ<p>I have a <code>RecyclerView</code> with a <code>GridLayout</code>. My data is ... | <p>Add a view in item_image.xml file with height 2dp & width fill_parent, it works as a divider, assign id as well.</p>
<p>onBindViewHolder method write one logic to check the dates based on the position, if true then make it visible the divider view, if not make the divider View.gone</p>
<p>Hope this will help y... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Edit a record using Wicked gem<p>I have to use multi step form to create an assignment, for that i use wicked gem.</p>
<p>assignment_steps_controller.rb</p>... | <p>I have to create a new route for edit links, it looks like this</p>
<pre><code>resources :assignment_steps, only: [:show, :update] # to create
resources :assignments do
resources :assignment_steps, only: [:show, :update] # to edit
end
</code></pre>
<p>And now my controller goes something like this</p>
<pre><cod... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unable to display GUI application from Windows container : Windows 2019 Server<p>I need to use Docker Windows containers for Windows applications to run on ... | <p>The short answer here is no. Windows containers don't have the underlying GUI components available, so you can't run any desktop application on Windows containers.</p>
<p>The longer answer is that this depends on what you're trying to achieve. The actual components for the GUI (GUI APIs) are present on the Server Co... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Divide a integer value in for method and show the start and end limit<p>I need to divide the integer value and show the start and end limit
example:</p>
<... | <p>division is also summing;) so take a look at this trick:</p>
<pre><code><?php
$n = 666;
$d = 60;
$x = 0;
$res = [];
while ($x < $n) {
$res[] = [
$x,
$x = $x+60
];
}
var_dump($res);
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MongoDB: Aggregate query is not passing value inside the function<p>I am facing a problem with the Mongoose aggregation query. I have the following schema wh... | <p>You can achieve without momentjs. Use <code>$toDate</code> to convert date-time string to date</p>
<pre><code>db.collection.aggregate([
{
$addFields: {
"isPast": {
$gt: [
new Date(),
{
$toDate: "$endDate"
}
]
}
}
}
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to exclude certain styling in page2 in pagination<p>I have followed Jeffery Way in Laravel 8 from scratch amazing series but I'm having a trouble in pagi... | <p>You can use <code>currentPage()</code> method on paginator and check if it's on first page. May not be fanciest way but here is an example:</p>
<pre><code><x-bloglayout>
@include('posts.__header')
@if ($posts->count())
<x-featuredCard :post="$posts[0]" />
@if ($posts->c... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Numpy group by multiple vectors, get group indices<p>I have several numpy arrays; I want to build a groupby method that would have group ids for these arrays... | <p>After using <code>np.stack</code> on the arrays <code>a</code> and <code>b</code>, if you set the parameter <code>return_inverse</code> to <code>True</code> in <a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.unique.html" rel="nofollow noreferrer"><code>np.unique</code></a> then it is the output y... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Binding element property to a following element property<p>I need to have two elements, one of which has a proerpty which binds to another element's property... | <p>The warning is purely a cosmetic issue.
If you want, you may get rid of it by supplying a FallbackValue in the binding:</p>
<p><code>Visibility="{Binding Text.IsEmpty, Converter={StaticResource BooleanToVisibilityConverter}, ElementName=second, FallbackValue=Collapsed}</code></p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Best way to find the angle between two nodes in an lattice graph?<p>If I have a lattice graph which looks like this:</p>
<pre><code>0:0 0:1 0:2 0:3
1:0 1:1 1... | <p>Assuming x:y format, and an angle measured clockwise from the horizontal:</p>
<pre><code>angle(x1:y1, x2:y2) = arctan((x2-x1)/(y2-y1))
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Insert counter in a reactjs map<p>I'm starting to ReactJs and have a doubt when generating a list with an ordering. How do I include a counter inside my <cod... | <p>Use the second argument (array index) of the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map" rel="nofollow noreferrer">map method</a>:</p>
<pre><code><div>
{
data.contacts.data.map((contact, index) => (
<div>
<span>{ind... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
xpath - select classes after specific text in php<p>I would like to find nodes after a specific text inside an HTML page.
The text is <code>Search results: H... | <p>You should remove <code>//</code> before <code>a</code> as</p>
<pre><code>//*[contains(., "Search results: Hits")]/following::a[contains(@class,"tooltip")]
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python 3 if/elif issue<p>i have a if/elif statement in my code snippet below... for some reason even when i trigger the elif statement the console still prin... | <p>It's because you're missing an <code>in use_stim</code> in the first if statement after the <code>"You bet"</code>;</p>
<pre><code> if "ok" in use_stim or "okay" in use_stim or "yes" in use_stim or "sure" in use_stim or "you bet" in use_stim or "good idea" in use_stim:
char_health = char_health + char_stim... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Proper model relationship for Player and Prizes?<p>I seem to have a mental impediment when it comes to abstracting model relationships.</p>
<p>I want to hav... | <p>You can use <code>ManyToManyField</code> for <code>Player</code> model:</p>
<pre><code>class Player(models.Model):
prizes = models.ManyToManyField("Prize")
class Prize(models.Model):
# prize_name = ...
# prize_amount = ...
</code></pre>
<p>Then you can get all prizes for one specific player with:</p>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to gitlab.com:443<p>I try to clone my repo from GitLab to my local folder.
I am on Windows 10 and using... | <p>I was just having this issue.</p>
<p>In my case it was because git was using my global git user settings, but for this particular repo I had been given access under a different email address.</p>
<p>The solution was to set my user information for the repo to use the right email address.</p>
<p>In SourceTree, I cl... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Finding all obligations in spl-token-lending program<p>If an <code>Obligation</code> becomes unhealthy, it can be liquidated by calling <code>LiquidateObliga... | <p>The only way to get all of the <code>Obligation</code> accounts is to use the <code>getProgramAccounts</code> RPC endpoint with a filter, which fetches every account owned by the lending program that has a certain size. Since an <code>Obligation</code> has a size of 916 according to the code: <a href="https://githu... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to disable past date in daterangepicker?<p>I using two date selected daterangepicker. this working perfect but how to disable past date. below is my code... | <p>I had the same issue. I checked <a href="http://www.daterangepicker.com/#options" rel="noreferrer">http://www.daterangepicker.com/#options</a> and seems to me minDate would do the job. </p>
<pre><code> var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
v... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Source control for images with jquery?<p>I have 3 attribute for my images as below</p>
<pre><code> data-web-src
data-tablet-src
data-mobil-src
</code></pr... | <p>Instead of using <code>.attr</code> I would use <code>.each</code> as you can then hide the image if the condition is not met:</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"><co... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
React MaterialUI - ExpansionPanelSummary - Add counter to div id<p>I need a functionality that can <strong>add a counter to the div id</strong> whenever the ... | <p>The <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map" rel="nofollow noreferrer">map</a> function has an index/counter that's passed on to the function callback.</p>
<p>So what you want to do is:</p>
<pre><code>{someFunction.map((output, index) =>
<Expansio... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a script to upgrade Grails 3.1.x apps to latest 3.1 version?<p>Is there a recommended process, script, or reference for upgrading Grails 3.1 apps to... | <p>Stumbled across this handy repo to automate the app comparison process <a href="https://github.com/erichelgeson/grails-versions" rel="nofollow">https://github.com/erichelgeson/grails-versions</a></p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Type attribute with Condition in TypeScript<p>Currently I pass a Type Attribute to a class.</p>
<pre><code>public class MyClass<Type> {...}
</code></pr... | <p>In TypeScript these are called <a href="https://www.typescriptlang.org/docs/handbook/2/generics.html#generic-constraints" rel="nofollow noreferrer">generic constraints</a>.</p>
<p>This is how you would write it in your case:</p>
<pre><code>public class MyClass<Type extends MyInterface> {...}
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Getting SQL error SQL State S1009<p>I'm trying to insert values into a table (inquiry) the first value is of type Date , and I'm getting an SQL error SQL Sta... | <pre><code>sqlStatement = "INSERT INTO inquiry (INQUIRY_DATE,INQUIRY_NOTE,INQUIRER_ID,PROGRAM_ID,CLASS_ID,CORPORATE_ID)\n"
+ "VALUES (?,?,?,?);";
</code></pre>
<p>The parameterized query doesn't have enough <code>?</code>, you queried 6 columns with 2 <code>?</code> missing, it should be <code>VALUES (... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
My button is not appearing on my Tkinter project<p>Why isn't my button showing up on my Tkinter project?</p>
<pre><code>def mainMenu():
window = tk.Tk()
... | <p>You have a problem with your grid, try this:</p>
<p>Change <code>window.columnconfigure(1, minsize=200, weight=1)</code> to <code>window.columnconfigure(0, minsize=200, weight=1)</code></p>
<p>or if you need columnconfigure as 1 then</p>
<p>Change <code>buttonsFrame.grid(row=0,column=0,sticky="nsew")</code... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
A function to automate the classification of value ranges<p>How could I classify this data according to <a href="https://i.stack.imgur.com/sNkkb.png" rel="no... | <p>The criteria can be simplified:</p>
<pre><code>if 42 <= Af < 55:
Class 3
else if 21 <= Af < 68:
Class 2
else:
Class 1
</code></pre>
<p>This can be expressed in a formula, formatted to match the layout of the pseudocode:</p>
<pre><code>=IF(AND(42 <= @A:A, @A:A < 55),
"Class 3&qu... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to real-time update range in the x-tick using matplotlib?<p>I have a log file that will update every 10 seconds. This is log content at 30th seconds</p>
... | <p>I think you have two options here. In any case, you need to create the axes outside the loop, otherwise you'll end up with lots of overlaying axes.</p>
<ol>
<li><p><strong>Clear the axes</strong>: </p>
<pre><code>import matplotlib.pyplot as plt
import re
from mpl_toolkits.axes_grid1 import host_subplot
plt.ion()
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Diferrence in inititializing array in python by these methods<p>I declared an array of array by two methods:</p>
<p>Method 1:
<code>bucket = [[]] * 6)</code>... | <p>So this is what happening:</p>
<ul>
<li>when you do this <code>bucket = [[]]*(len(nums)+1)</code> all the nested lists<br />
are same.</li>
<li>To confirm that you can <code>print(id(bucket[0]))</code> and<br />
<code>print(id(bucket[1]))</code>.</li>
<li>Both will print same memory address as all are same. So, wh... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Filtering queryset if one value is greater than another value<p>I am trying to filter in view my queryset based on relation between 2 fields .</p>
<p>however... | <p>Django cannot write a query which is conditioned on a field whose value is unknown. You need to use a <code>F</code> expression for this:</p>
<pre><code>from django.db.models import F
queryset = Material.objects.filter(total__lte = F('min_quantity'))
</code></pre>
<p>And your <code>FilterSet</code> becomes:</p>
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
AWS Sagemaker, InvokeEndpoint operation, Model error: "setting an array element with a sequence."<p>I am trying to Invoke Endpoint, previously deployed on Am... | <p>This works:</p>
<pre><code>import numpy as np
import boto3
client = boto3.client('sagemaker-runtime')
endpoint_name = 'DEMO-XGBoostEndpoint-2018-12-12-22-07-28'
test_vector = [3.60606061e+00,
3.91395664e+00,
1.34200000e+03,
4.56100000e+03,
2.00000000e+... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to escape "@" when reading from a JSON response?<p>Let's say I have below sample JSON response from which I want to extract value for "@type":<... | <p>You can read in <a href="http://goessner.net/articles/JsonPath/" rel="nofollow noreferrer">this documentation</a>:</p>
<blockquote>
<p>Please note, that the return value of jsonPath is an array, which is
also a valid JSON structure.</p>
</blockquote>
<p>So basically it always returns an array.</p>
<pre><code>var pho... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get event notification on orientation change from Landscape Left to LandScape Right?<p>I have an <code>Activity</code> which override <code>public voi... | <p>You can detect rotation side with accelerometer. When you are certain of some orientation landscape/portrait set the current angle. If orientation is changed calculate the difference to see if its 90>(roughly) and if it is, obviously screen was rotated from portrait to potrait or landscape to landscape. With that ca... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Masking a dataframe left unexpected values in the index.levels<p>My dataframe has multiindex rows, where the values are datetimes.</p>
<p>I want to filter o... | <p>There is a necessary function, <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.MultiIndex.remove_unused_levels.html" rel="nofollow noreferrer"><code>MultiIndex.remove_unused_levels</code></a>, for removing these values, and more information about this problem is on <a href="https://github.com/p... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Adding a onclick function to AJAX<p>So I have 5 Tab Buttons and 5 Tab Containers. Each container is attached to an AJAX that sends Longitude and Latitude to ... | <p>Some remarks:</p>
<ul>
<li><p>I would use <code>active</code> class instead of an <code>inactive</code> class as you only really care about the active one. </p></li>
<li><p>You might find it useful to use <a href="https://www.w3schools.com/tags/att_global_data.asp" rel="nofollow noreferrer">HTML5 data attributes</a... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to indicate when the game is saving to file and then show something on screen?<p>I have a saving system and today i'm using a canvas and text and just di... | <p>Use Async/Threading, or in Unity's case, <a href="https://docs.unity3d.com/Manual/Coroutines.html" rel="nofollow noreferrer"><code>Coroutines</code></a>.</p>
<pre class="lang-cs prettyprint-override"><code>bool isSaving;
public void SaveGame(){
StartCoroutine(SaveGameCoroutine());
}
private IEnumerator SaveGam... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to make crossprod faster<p>It takes (on my MBP with 2.9 GHz Intel Core i7 and 16 GB memory) more than 20 seconds to get cross-product of a 40,000 x 1,000... | <p>By changing your code? Basically no. <code>crossprod</code> directly calls compiled code, you'll be hard pressed to find any performance gains, and any you find will be small.</p>
<p>(Barring extenuating circumstances--how dense is your matrix? If you've got a lot of 0s, then using a sparse matrix may help. I'm als... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Service Worker cache limit?<p>Does anyone know what the limit is with service workers caching content? I've read a size limit of about 50MB (lowest one, but ... | <p>I realized this was just Google Chrome only showing 50 files per page, and there's a paging system at the top. There are around 102 files cached right now.
In case anyone else is confused by this as I was.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Add link text to span class name<p>I have a list of links. And I want that link texts inserts as span span data-hover names. Please tell me how can i do this... | <p>The below code will work -</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 links = document.querySelectorAll('a.className');
for (i = 0; i < links.length; i++) {
li... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Django REST Framework - Adding 2 PKs in URL<p>I am designing a REST API for an application that has both companies and departments. Some number of users can ... | <p>Use different names for parameters in you url:</p>
<pre><code>/companies/<company_pk>/membership/<membership_pk>/
</code></pre>
<p>And in you ViewSet add <code>lookup_field</code> and <code>lookup_url_kwarg</code> to point to company pk field/parameter:</p>
<pre><code>class CompanyViewSet(viewsets.Mod... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
strange behavior when creating array in javascript<p>I have following code </p>
<pre><code> if(ssnFlag == false){
console.log(userName)
... | <p>You have to add some brackets to turn it into a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer" rel="nofollow noreferrer">"Computed property name"</a>:</p>
<pre><code> { [userName]: /*...*/ }
</code></pre>
<p>If you omit them, it is the same as:</p>
<pre><... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Test ignored and failing when running IT test in Spring Boot (MongoDB Test Container)<p>I am trying to run an IT test using a MongoDB test container. However... | <p>You did likely run into this issue:
<a href="https://github.com/testcontainers/testcontainers-java/issues/5121" rel="nofollow noreferrer">https://github.com/testcontainers/testcontainers-java/issues/5121</a></p>
<p>As a workaround, login to Docker Hub using this URL:</p>
<pre><code>docker login index.docker.io
</cod... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
start xAxis and yAxis value from 0 and set custom xAxis value in Charts library<p>How to start xAxis and yAxis value from 0 and set custom xAxis value in Cha... | <blockquote>
<p>You can set custom values for xAxis by using following code,</p>
</blockquote>
<pre><code>self.barChartView.xAxis.valueFormatter = IndexAxisValueFormatter(values: self.arrUserCount)
self.barChartView.xAxis.granularity = 1
self.barChartView.xAxis.labelCount = self.arrUserCount.count
</code></pre>
<bl... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to write custom excetion for Mutilple exceptions in java?<p>I am using smtp api which throws MessageException and IOException</p>
<p>But in our applicati... | <p>Sure. Exceptions just are, and can wrap anything; you don't need to write them as specifically wrapping only IOException or MessageExceptions.</p>
<pre class="lang-java prettyprint-override"><code>public class MyCustomException extends Exception {
public MyCustomException(String msg) {
super(msg);
}
publi... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Initializing a variable sized array of booleans in C<p>so I currently have a struct that looks like this:</p>
<pre><code>typedef struct example {
bool a... | <p>In C99 you can use <a href="https://en.wikipedia.org/wiki/Flexible_array_member" rel="nofollow noreferrer">flexible array members</a> where the last member can be an array without a given dimension, but there must be at least 2 members in the <code>struct</code>.</p>
<p>You can use a pointer (here I am using <code>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
TIMESTAMP (6) WITH TIME ZONE to Time stamp<p>I have a query in my Java class that fetches (Order_num) VARCHAR and Time_Field(TIMESTAMP (6) WITH TIME ZONE) as... | <p>I finally figured it out by running the below query:</p>
<pre><code>SELECT order_num,TO_CHAR(
FROM_TZ( CAST( time_Field AS TIMESTAMP ), 'UTC' )
AT LOCAL,
'YYYY-MM-DD HH:MI:SS PM'
) AS local_time
FROM MY_TABLE
where ord_num='123456789'
ORDER BY time_Field desc;
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Rendering string from MYSQL in div removes all white space<p>I am trying to render a string with spaces and line spaces in it.</p>
<p>When I render the strin... | <p>You could apply <code>white-space: pre-wrap;</code> style to your <code>div</code>, so the white spaces will be displayed</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Want to add <input> html element with autoincrement id using ANGULAR<p>I have following html content</p>
<pre><code><div id="abc"></div>
<in... | <p>You can do it with <code>ng-repeat</code></p>
<pre><code><div id="abc">
<input type="text" id="{{input.id}}" ng-repeat="input in inputs">
</div>
<input type="button" name="xyz" value="Add Input" ng-click="addInput()">
</code></pre>
<p>In your controller</p>
<pre><code>$scope.inputs = ... |
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 value of an entry and enter it in Ssol.txt?<pre><code>from tkinter import *
from tkinter import ttk
win = Tk()
win.title("hello")
win.geome... | <p>You need to use <code>.get()</code> to access the value of your <code>IntVar</code>:</p>
<pre><code>from tkinter import *
win = Tk()
Block = IntVar()
def Block_to_file():
contents = str(Block.get())
with open("Ssol.txt", 'w') as f:
f.write(contents)
Entry(win, width=15, textvariable=Block).grid(c... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C++ change parent class based on option<p>There is a <strong>Student</strong> class inherited from <strong>Person</strong>.
And there is <strong>Student</str... | <p>Since we can't know what <code>option.person</code> is at compile-time, we need to find a way to work around that at runtime.</p>
<p>One option for doing so is <code>std::variant</code>, which can store any number of different types; but does so at the cost of always having the same size as the largest templated typ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Ways to fix muttable borrowing of self in arguments to function that borrows muttable self<p>I have some code like this (<a href="https://play.rust-lang.org/... | <p>Taking apart that your methods do not need to be <code>&mut</code> and that is just for the example.</p>
<blockquote>
<p>How can i solve this problem without adding new variable that storing argument as the compiler tells?</p>
</blockquote>
<p><strong>At the moment, you can't</strong>. The way is to move the inn... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Julia | How to access nested key in a json file<p>I have the contacts.json file:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="... | <p>This is a poorly specified question:</p>
<ol>
<li>There is no "firstname" key.</li>
<li>There is no "Employees" array.</li>
</ol>
<p>Presumably, you are looking for</p>
<pre><code>julia> first_names = String[]
0-element Array{String,1}
julia> for contact in dict["emergencyContacts"]
push!(first_... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to change the colors of the modified lines indicator in version 17.2?<p>I updated Visual Studio 2022 Preview to version 17.2 Preview 6.0, and after doing... | <p>This is apart of the "Line Staging" feature, which is actually tied to Git. In update 17.2 of Visual Studio, <a href="https://devblogs.microsoft.com/visualstudio/line-staging-interactive-staging/#color-margin-support" rel="nofollow noreferrer">the feature was turned on by default</a>. The patch notes <a ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Regex matches specific number in capturing group<p>I would like to understand how I can implement a Regex that matches a specific number in a capturing group... | <pre><code>(0) (\*|16) (\*) (\*) (\*|1|.*,1|1,.*|.*,1,.*)$
</code></pre>
<p>if we focus on the last part, we have either:</p>
<pre><code>\*
1
.*,1
1,.*
.*,1,.*
</code></pre>
<p>the <code>$</code> at the end is important for the first 3 cases to prevent e.g. <code>11</code>, <code>*1</code></p>
<p>Hoping it's what you w... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Adjust date's timezone so that hour is accurate (doesn't just add offset at the end)<p>Difficult to word but easy to show:</p>
<pre><code>select getutcdate(... | <p>Try this:</p>
<pre><code>select getutcdate() AT TIME ZONE 'UTC'
select getutcdate() AT TIME ZONE 'UTC' AT TIME ZONE 'US Eastern Standard Time'
select CONVERT(datetime2, getutcdate() AT TIME ZONE 'UTC' AT TIME ZONE 'US Eastern Standard Time', 1)
</code></pre>
<p><a href="https://i.stack.imgur.com/cNmRP.png" rel=... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
in Javascript, is `let a;` ever any different to `let a=undefined;`<p>Are the statements:</p>
<p><code>let a;</code></p>
<p>and</p>
<p><code>let a=undefined;... | <p><a href="https://tc39.es/ecma262/#sec-declarations-and-the-variable-statement" rel="nofollow noreferrer">They are equivalent.</a>.</p>
<blockquote>
<p>A variable defined by a LexicalBinding with an Initializer is assigned the value of its Initializer's AssignmentExpression when the LexicalBinding is evaluated, not w... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
XML Internal DTD don't validate<p>I'm having a headache with the follwoing xml with an internal dtd, i don't quite undesrtand where's the problem...</p>
<p... | <p>You have a small typo in an ATTLIST declaration. The quotes around <code>"Euro"</code> are closed incorrectly.</p>
<p>This:</p>
<pre><code><!ATTLIST preu moneda CDATA #FIXED "Euro''>
</code></pre>
<p>Should be:</p>
<pre><code><!ATTLIST preu moneda CDATA #FIXED "Euro">
</code></pre>
<p>After fixing... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to properly pass variables through different functions PYTHON<p>I am working on a hangman game for a couple days. I am currently making the functions. I'... | <p>First of all, <code>string.casefold() == "History"</code> will never be true because <code>casefold</code> acts as a <code>lower</code> but more aggressive. Just change "History" to "history" and it'll work.</p>
<p>Second, you might want to look into <a href="http://www.jesshamrick.com/2011/05/18/an-introduction-to... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Shopify - Heavy Liquid Loop<p>I'd like to know if this type of loop would cause performance problems. It would happen in a product grid.</p>
<p>(not the cor... | <p>It will cause an overload on the system.</p>
<p>You can achieve this using a custom collection template with product fields listed in <code>json</code> and <code>AJAX</code></p>
<p><s>You can use the idea implemented in this - <a href="https://help.shopify.com/themes/customization/store/enable-autocomplete-for-sea... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
skipping a readline and repeating unlimited times with arrays c#<p>when i run it skips the first readline and repeats the first "for" unlimited times<br>
at ... | <p>You need to take care when using <code>Console.Read()</code> and <code>Console.ReadLine()</code>.</p>
<p><code>Read()</code> only reads the first availabe character. All other (available) characters are left in the input buffer.</p>
<p><code>ReadLine()</code> reads until it finds a line-end character (typically <c... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to display no value for particular legend in amchart?<p><a href="https://i.stack.imgur.com/VanAA.png" rel="nofollow noreferrer"><img src="https://i.stack... | <p>You should use the <code>values</code> property in your legendData property to base your logic off of when to display N/A on hover or when to display N/A when you mouse out of the chart. This will make detecting what value to display easier to manage.</p>
<p>Here's how to default "N/A" for D1 and D2 on mouse out an... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
"Undefined variable" error on Ansible when run over Windows machines<p>This is a very simple Ansible playbook I run from AWX to get information about hosts, ... | <p>From the documentation:</p>
<blockquote>
<h3>ansible_facts</h3>
<p>This key should contain a dictionary which will be appended to the facts assigned to the host. These will be directly accessible and don’t require using a registered variable.</p>
</blockquote>
<p><sup><em>Source: <a href="https://docs.ansible.com/an... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to show braintree user interface in codename one<p>How do I display the UI of the braintree in codename one? I only have this code ` </p>
<pre><cod... | <p>The call to <code>startOrder</code> will show the UI implicitly on the device once you implement the server side functionality that returns the token. </p>
<p>To test this in a mockup go to the <a href="https://developers.braintreepayments.com/start/hello-client/android/v2" rel="nofollow noreferrer">braintree getti... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is it necessary to save the field itself to generate inverted index in lucene<p>I am saving a fields id and msg in lucene to support full text search. When u... | <p>In Lucene, what you store for document creation/fetch purposes (The purpose that you describe via DB ) and what you index as inverted index for search purpose are two very different things. </p>
<p>You have not shown any code as how you Index. </p>
<p>Storing data in Lucene is Optional and folks choose to store da... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Spring Boot how to replace string in Springboot Application Class<p>my main file looks as follows.</p>
<pre><code>@SpringBootApplication
@OpenAPIDefinition(i... | <p>The following should do the trick</p>
<pre><code>authorizationUrl = "${your.custom.path}",
</code></pre>
<p>and obviously in your application.propperties</p>
<pre><code>your.custom.path=http://localhost:8080/auth/realms/master/protocol/openid-connect/auth
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Google Forms Performance<p>I have a form that is running a script in the background that populates many drop down lists where the performance is very slow. I... | <p>Multiple single read/write incidents (calls) will slow things down for sure. To speed things up, try to group as many reads as possible into an array and then write them from the array. </p>
<p>You mentioned that a form is being filled out, you should be able to pull all of response information into an array thro... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using datepicker plugin in Onsen UI 2<p>In my app, I want to use native datepicker and tried to use <a href="https://github.com/VitaliiBlagodir/cordova-plugi... | <p>Your angular code looks ok. The only problem is that you don't have a <code>DatePicker</code> variable. </p>
<p>Looking at docs of the plugin which you're using it seems that it doesn't export a <code>DatePicker</code> function.</p>
<p>In the docs they are using just <code>datePicker.show</code>, so maybe they are... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
moving maximum in postgresql<p>how can i implement a moving maximum in postgresql?</p>
<p>For example, if we have a table ordered by b desc:</p>
<pre><code... | <p>Use the <code>max</code> window function.</p>
<pre><code>select a,b,max(a) over(order by b desc,a) as running_a_max
from t
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SQL statement giving no result<p>Hy, Im having trouble with sql, oracle..</p>
<pre><code>SELECT MODEL, V_GODINA, DATUM_OSIGURANJA FROM EVP_V_KASKO_ZB WHERE... | <pre><code>SELECT MODEL, V_GODINA, DATUM_OSIGURANJA FROM EVP_V_KASKO_ZB WHERE
DATUM_OSIGURANJA = (select MAX(DATUM_OSIGURANJA) FROM EVP_V_KASKO_ZB;);
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I calculate the average between two text files based on matrixes?<p>I am fairly new to using MATLAB. I have two text files that have 500 rows x 100 c... | <p>assuming the files are named 'a' and 'b':</p>
<pre><code>load a
load b
c=(a+b)/2;
save('c','c','-ascii');
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How many customers made a purchase for the first time at STORE 1 per month?<p>Hey guys I'm having trouble solving an exercise of SQL:
I can't seem to underst... | <p>I'd approach the problem from user, not from order.</p>
<pre><code>SELECT
COUNT(*) as new_customers,
EXTRACT(YEAR FROM custs.first_order_date) AS year,
EXTRACT(MONTH FROM custs.first_order_date) AS month
FROM
(SELECT
MIN(o.order_date) as first_order_date,
o.customerID
FROM store1.Orders o
GROUP BY c... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SAPUI5 Access controls in List or Table Controls<p>I have a n XML View which holds a List and the the List holds CustomListItems with Input, ComboBox and so ... | <p>The <code>ListItemBase</code> objects od <code>List.getItems()</code> are actually your CustomListItems.
You can access all properties and methods of them directly (no casting in JavaScript).</p>
<pre><code>var listItems = list.getItems();
for (var i = 0, len = listItems.length; i < len; i++){
var controls = ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
passing a callback function via props to child component is undefined in child vue<p>I have a Vue component that passes a callback function to another child ... | <p><code>callback</code> is undefined because you define your <code>data</code> property (App.vue from your repo) with an arrow function and loose the Vue context on <code>this</code>:</p>
<pre><code>data: () => {
return {
testingForm: {
//...
dialog: {
props: {
buttonCallback: t... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What does this PowerShell syntax mean?<p>In powershell what does the syntax $x = . { ... } mean? How is it different from $x = @( ... )
From what I can tell ... | <blockquote>
<p>In PowerShell what does the syntax <code>$x = . { ... }</code> mean?</p>
</blockquote>
<ul>
<li><code>{ ... }</code> is a <a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_script_blocks?view=powershell-7.2" rel="nofollow noreferrer">Script Block</a> which ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Java Card Object Instance in Transient Memory<p>I am working on a Java Card applet (for Java Card 2.2.1) which requires some temporary objects for processing... | <p>Unfortunately what you are trying to do is not possible in the classic specification of Java Card. Object instances are always stored in EEPROM, as you already noticed yourself. So you have to work around the issue.</p>
<p>Java is a relatively high level language where objects are always stored in one particular pi... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Could not read from remote repository, in other words push rejectec<p>I'm trying to push my branch, made the necessary changes and made the commit. However o... | <p>The ultimate error is simple enough, but let's go through each error one at a time.</p>
<h3>The first error</h3>
<p>When you ran this:</p>
<blockquote>
<pre><code>git remote add origin https://github.com/XCMachine/Rijs-museum.git
</code></pre>
</blockquote>
<p>you got an error message:</p>
<blockquote>
<pre><code>er... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Reduce() an object of an element that has already been reduced<p>I was doing some data manipulation, but I made a mistake and got the wrong data structure, s... | <p>Because your input items and output items are one-to-one, you should use <code>.map</code> on <code>employees</code> instead of <code>.reduce</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 pr... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
jQuery slideToggle and then scrollTop not working togther<p>I am trying to close a slideToggle from the bottom of the element and then have the browser windo... | <p>You're gonna get a weird effect sliding up then sliding again in a callback. Here you go though...</p>
<pre><code> jQuery(".closedetails").click(function () {
$closedetails = $(this);
$morecontent = $(this).parents(".hotel");
// Close more content when clicked
$morecontent.s... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Consistent HashCode for a List of String accross processes/platforms<p>I had a look at the following question:</p>
<p><a href="https://stackoverflow.com/que... | <p>Per the comments to my previous answer:</p>
<pre><code> private int GetHashCode(IEnumerable<string> value)
{
var encoder = new UTF8Encoding();
var hash = new SHA256CryptoServiceProvider();
var sb = new StringBuilder();
foreach (var item in value)
{
s... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Version 0.0.0.0 when creating strong named assembly<p>We're building a C# wrapper for a C library in embedded Linux, and we want to install it into the GAC o... | <p>Add an assembly level attribute called <code>AssemblyVersion</code> to your C# source. This is <em>usually</em> added in a file named <code>AssemblyInfo.cs</code> :</p>
<p><em>Note: This is a cut/paste of an auto-generated project file, I updated the AssemblyVersion attribute and you only have to include the attrib... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SQL GROUP BY Column Value<p>When selecting the below data I want to make it so that I can group by the columns so that there should be all "Y". The below ima... | <pre><code>SELECT p.FirstName
,p.Surname
,CASE WHEN SUM(CASE
WHEN a.ActivityName = 'Jumping' THEN 1
ELSE 0 END) > 0 THEN 'Y'
ELSE 'N'
END AS 'Jumping'
,CASE WHEN SUM(CASE
WHEN a.ActivityName = 'Dancing' THEN 1
ELSE 0 END) > 0 THEN 'Y'
ELSE 'N'
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a Pythonic way to type a function parameter to a specific django model object?<p>Let's say I have a model like this:</p>
<pre class="lang-py prettyp... | <p>a pythonic way should be</p>
<pre class="lang-py prettyprint-override"><code>class Foo():
name = models.CharField()
def change_name(self, new_name: str):
self.name = new_name
self.save()
</code></pre>
<p>if you really wanna do it out of Foo scope, in a global function or from a Bar class... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Working bin/bas returns error when executed from run script Xcode<p>I have a working shell script that works with no problems but when I executed it with a r... | <p>I was calling the script from the directory it was located. When Xcode executes the the script that assumption is false. So I am getting the directory where the script is located and I do the logic with that path </p>
<pre><code>#!/bin/bash
#Get Directory where the script is located
baseDirectory=$(dirname "$0")
e... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Calculations using totals in PowerBI<p>I have two columns of data, QuestionsAskedDaily and QuestionsAnsweredDaily. </p>
<p>I want to calculate the total per... | <p>Create two measures, one for QuestionsAskedDaily and one for QuestionsAnsweredDaily that look like this:</p>
<pre><code>QuestionsAskedDaily = COUNT(<key column from questions table>)
QuestionsAnsweredDaily = COUNT(key column from answers table>)
</code></pre>
<p>With those two measures in place, you can c... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Scala way of merging tuples in a list using functional programming techniques<p>Say I have:</p>
<pre><code>val list: List[(Long, Boolean)] = List((0, false)... | <pre><code>val result = list.groupBy(_._1) // group by key
.mapValues(_.map(_._2)) // remove keys from grouped values
.mapValues(_.reduce(_ && _)) // reduce grouped values using &&
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Transpiling next.js server code<p>I have a fresh install of Next.js and am wanting to be able to use <code>import</code> and <code>async/await</code> etc.</p... | <blockquote>
<p>I have a fresh install of Next.js and am wanting to be able to use import and async/await etc.</p>
</blockquote>
<p>I believe async/await works on the current release without an modification, but dynamic import requires the v3 beta:</p>
<pre><code>npm install next.js@beta
</code></pre>
<p>See <a hr... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Display div upon hover<p>I am trying to make a <code>div</code> display when hovering over an <code>a</code> tag. I also want the <code>div</code> to not dis... | <p>What you describe can be achieved using CSS only. Instead of the adjacent sibling selector <code>+</code> use the sibling selector <code>~</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-css lang-css pre... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
If cell is empty, skip and go to the next<p>I am working with some code that will take a predefined range and copy data to a sheet with the same name as in c... | <p>Just use </p>
<pre><code> if (data[n][0]) {
// do something;
}
</code></pre>
<p>In the 'if' operator, the statement between the brackets will be evaluated as 'false' if the value is null, undefined or an empty string "". </p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Adding another variable to an array in angularJS<p>So im editing some code and I would like to add another variable to an array. The code below works perfect... | <p>Your array is empty so you can't set a second level field before the first</p>
<p>If you have </p>
<pre><code>var obj = {};
</code></pre>
<p>You have to set</p>
<pre><code>obj.firstItem
</code></pre>
<p>before</p>
<pre><code>obj.firstItem.secondItem
</code></pre>
<p>Here is an <a href="http://jsfiddle.net/ADu... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ImageMagick: Divide AE distortion by total pixels in fx output info format<p>I am trying to use ImageMagick 7 to detect if a specific channel in an image is ... | <p>I believe the following is what you want in Imagemagick. Basically you save the distortion in <code>-set option:</code> argument and then use it in <code>-fx</code> later.</p>
<p>However, <code>+clone</code> gives you just the b channel, so there should be no need for <code>-channel b -separate</code> in your second... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Create a user with email which has been processed from the previous page with UserCreationForm Django<p>I am trying to create a user with email as username a... | <p>You can try like this:</p>
<pre><code> # Form
class RegistrationForm(UserCreationForm):
class Meta:
model = CUser
fields = ('first_name', 'last_name', 'password1', 'password2')
def save(self, **kwargs):
email = kwargs.pop('email')
user = super(RegistrationForm, self).save(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.