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:
Unable to toggle/click/hover answers<p>I am working on a template and in that I have 3 questions and answers which I an trying to hide and only after using t... | <p>As zzzzBov said, toggle is a better option. I've mocked it up here:</p>
<p><a href="http://jsfiddle.net/tjtp9jf5/1/" rel="nofollow">http://jsfiddle.net/tjtp9jf5/1/</a></p>
<pre><code> $(document).ready(function () {
$('.main h2').click(function () {
$(this).next().toggle();
});
});
</code></pre... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why I can't use uniform1f instead of uniform4f for setting a vec4 uniform?<p>I learn WebGL step by step via <a href="https://sites.google.com/site/webglbook/... | <p>You have to use the correct type to set a uniform. If your uniform is <code>vec4</code> then you have to use either <code>gl.uniform4f</code> or <code>gl.uniform4fv</code>.</p>
<pre><code>uniform valid
type functions
----------------------------------------------
float gl.uniform1f gl.unifo... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is it possible to avoid setting project_id explicitly when authing with service account?<p>I'm trying to authenticate in a bash script and enable my service ... | <p>No -- <code>gcloud</code> will not change your working core project when authenticating. </p>
<p>The trick here is that authenticating & setting your "default" working project for <code>gcloud</code> are separate concerns. You can set your project without authenticating, and you can authenticate without chang... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Wordpress - change order by on click<p>Considering the following code, I have the loop in my Wordpress blog which will order posts from oldest to newer.</p>
... | <p>If you change your sort direction to a parameter, e.g</p>
<pre><code><?php
$args = array(
'order' => (isset($_GET['dir']) ? $_GET['dir'] : 'ASC')
);
query_posts( $args );
?>
</code></pre>
<p>then you can create a link like:</p>
<pre><code><a href="http:exampl... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Resize button in Tkinter GUI Python<p>I've created a simple GUI application with Tkinter.</p>
<p>I have two questions about this code:</p>
<pre><code>impor... | <p>Because you have called <code>columnconfigure(0, weight=1)</code> only, therefore only the <code>Forget</code> button will be resized when the window is resized.</p>
<p>To move the buttons to the top of the window, you need to rearrange the buttons to <code>row=0</code> and the <code>Treeview</code> to <code>row=1<... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can I move on to React without knowing JS inside out?<p>If I have had experience with JS, yet still need to learn a lot more, es6 and up, would it be ok to s... | <p>You should first learn the basics of vanilla JavaScript and modern syntax and features found in ES6. Like Jared said above, frameworks come and go. If your fundamentals in JavaScript are strong, you would easily be able to pick up on any framework/library. Also, as you learn/work on a framework, keep practicing cod... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using SED, How can I add '#' to the beginning of the last line of the file?<p>Lets say I have this file:</p>
<pre><code>##
# You should look at the followin... | <p>The last line of the file is addressed as <code>$</code>.</p>
<p>We can replace the beginning of the line (<code>^</code>) with <code>#</code> using the <code>s</code> command.</p>
<p>Putting that together, we have a very simple <code>sed</code> program:</p>
<pre><code>$s/^/#/
</code></pre>
<p>We can execute tha... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Meteor, Iron Router, & Google Analytics Embed API<p>After trying to authenticate Google API calls through Meteor's <code>accounts-google</code> package, I de... | <p>Turns out to be pretty simple—just needed to add some Meteor sugar to get things behaving properly. Simple explanation: on a change from the viewSelector, set the current view as a Session variable; then add <code>Tracker.autorun()</code> blocks to grab updates and have the chart update itself. Also, be aggressive u... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can you make git apply with a dry run?<p>I would like to know, which files would be written when applying a .patch file with git apply.</p>
<p>Is there a wa... | <pre><code>git apply --summary path/to/patch
</code></pre>
<p>would output info <em>without</em> applying the patch.</p>
<p>See in the <a href="https://git-scm.com/docs/git-apply#Documentation/git-apply.txt---summary" rel="noreferrer">doc</a>.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Kafka Consumer - continue calling poll() while paused?<p>I read the docs on using the pause and resume methods for a kafka consumer, and they seem easy enoug... | <p>From version 0.10.1.0 heartbeat is sent via a separate thread so pausing your process thread wouldn't affect heartbeat thread.</p>
<p>You can check <a href="https://cwiki.apache.org/confluence/display/KAFKA/KIP-62%3A+Allow+consumer+to+send+heartbeats+from+a+background+thread" rel="nofollow noreferrer">this</a> for ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Alter Database to utf8 In Rails<p>I'm trying to Alter a database to accept <code>utf8_general_ci</code> in migration file </p>
<pre><code>class AlterTableTo... | <p>generate migration file and paste this code</p>
<pre><code>class ConvertTablesToUtf8 < ActiveRecord::Migration[5.2]
def change_encoding(encoding,collation)
connection = ActiveRecord::Base.connection
tables = connection.tables
dbname =connection.current_database
execute <<-SQL
ALTER DATABASE #{dbnam... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
RemoveClass AddClass When Page Load<p>I have several <code><div></code> tags with different class names.
When the page loads, I want to remove and add ... | <p>In jQuery, .load is for loading data from a server and inserting it into an element: <a href="http://api.jquery.com/load/" rel="noreferrer">http://api.jquery.com/load/</a></p>
<p>Here's jQuery for the page load and changing the classes:</p>
<pre><code>$(document).ready(function() {
$('.redBG').removeClass('redBG... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ONS Toolbar in ANDROID<p>i am designing a page in mobile app using ONSEN UI.
in page, i have used onsen toolbar. the problem i am facing is the text i am wri... | <p>Use the attribute <code>fixed-style</code> to center the toolbar on Android:</p>
<pre><code><ons-toolbar fixed-style>
<div class="center">
Centered title
</div>
</ons-toolbar>
</code></pre>
<p>The reason why it isn't centered on Android is that for native Android apps the title is o... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Add marker on Leaflet map from another angular component<p>I have declared, in my Angular application, a const map variable in my mapComponent and I am able ... | <p>You can use a service to achieve communication between two components. </p>
<p>Create a service which will hold your coords array value. </p>
<pre><code>class MarkerService {
coords: any;
coordsChange: Subject<LatLngExpression> = new Subject<LatLngExpression>();
constructor() {
this.coords =... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
convert int or long to byte hex array<p>what is the easiest way to convert an integer or a long value to a byte buffer?</p>
<p>example:</p>
<p>input : 3256... | <p>You allocated a 4 bytes buffer, but when calling <code>putLong</code>, you attempted to put 8 bytes in it. Hence the overflow. Calling <code>ByteBuffer.allocate(8)</code> will prevent the exception.</p>
<p>Alternately, if the encoded number is an integer (as in your snippet), it's enough to allocate 4 bytes and cal... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Making a WordPress site accesible from inside LAN and outside it<p>I configured WordPress on a PC inside my LAN. So I can access it from the same computer wi... | <p>One option I found is to edit /etc/hosts file and redirect the freedns url to my localhost. So it's working now but I don't know if it's the right way of doing this...</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ember-cli won't parse jquery/src/intro.js<p>i'm using ember-cli version 0.1.15 and it fails to run a newly created ember app.</p>
<p>Here are the commands i... | <p>Try not capitalizing the new ember app's name:</p>
<pre><code>ember new query
</code></pre>
<p>Also, you don't need to specify the ember cli version:</p>
<pre><code>npm install -g ember-cli
</code></pre>
<p>In case <em>query</em> is a reserved keyword, if you still get errors, try another name.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
format ‘%c’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[0]’<p>I wanted to create a program where you would give input and it would g... | <p><code>&string</code> is a pointer to an array, just passing <code>string</code> is sufficient. <code>string</code> has length 1 and will fit a single character, but don't try to interpret it as a string because it will not be null-terminated.</p>
<pre><code>#include <stdio.h>
#include <stdlib.h>
in... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Angular Web call API in same IIS without using public IP<p>I have 2 webapp on IIS 1 Fontend code with Angular 6 and 1 API with .netcore. Can i call API from ... | <p>As far as I know, if you want to use angualr application to call the backend angular in clinet user's browser, it will not work. </p>
<p>Since the client-side angualr applciation is running on the user's browser without using public IP address, it will send the request to local's localhost application not server's ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
calloc returns a pointer to itself<p>I have problems when allocating memory on a Tiva C launchpad (ARM Cortex M4), what I am trying to do is to dynamically a... | <p>I think your first calloc call is allocating insufficient memory. From the screenshot of the debugger you posted:</p>
<pre><code>SpiRfid = (fSpi_Mod*) calloc(1, sizeof(SpiRfid));
</code></pre>
<p>This will allocate only enough memory for the pointer, not the structure. You probably want</p>
<pre><code>SpiRfid = (... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a way to change MongoDB _id field name in MongoEngine from $oid to $id?<p>When querying MongoDB using <code>mongoengine</code> it returns result wit... | <p>You need to use <code>aggregate</code> method with <a href="https://docs.mongodb.com/manual/reference/operator/aggregation/toString/" rel="nofollow noreferrer">$toString</a> operator</p>
<pre><code>pipeline = [
{"$addFields" : {"_id" : {"$toString" : "$_id"} } }
]
data = MyModel.objects().aggregate(pipeline)
</... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
PyImport_Import failing when submodules are imported in a python module<p>I have a cpp code like this:</p>
<pre class="lang-cpp prettyprint-override"><code>... | <p>Use <code>PyList_Insert</code> in place of <code>PyList_Append</code> to get test imported from the location you want.</p>
<p>as @DavidW mentioned there is an importable module in the core libs called <code>test</code>.</p>
<p>change</p>
<pre><code>PyList_Append(sysPath, PyUnicode_FromString("/jarvis_repo/src/cpp... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Where should I start for a flowchart drawing application in Java<p>I want to build a desktop application using Java. The purpose will be drawing a kind of fl... | <p>I have used <a href="http://prefuse.org/" rel="nofollow">Prefuse</a> to do something similar. It hasn't had any activity since 2011 but still works in Java 8. </p>
<p>You could also try JavaFX.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Php error: "Filename cannot be empty"<p>I'm creating a site that let's the user put in information and later save it to a document on the computer using PHP ... | <p>You try to work with <code>$_POST</code> before the form is sent.</p>
<pre><code><?php
if (!empty($_POST['6'])) {
$file = $_POST['6'];
$myfile = fopen($file, "a") or die("Unable to open file!");
$one = "\r\n" . $_POST['1'] . "\r\n";
fwrite($myfile, $one);
$two = $_POST['2'] . "\r\n";
fwr... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Oracle database schema<p>How to get an Oracle database schema? How to get all table names and columns in those tables and any foreign keys?</p> | <p><strong>How to get all table names</strong></p>
<p>There is a lot you are asking here but this will work for tables from schema:</p>
<pre><code>SELECT *
FROM DBA_OBJECTS
WHERE OBJECT_TYPE = 'TABLE'
AND OWNER = 'SCHEMA_NAME'
</code></pre>
<p>This will also work:</p>
<pre><code>SELECT *
FROM DBA_OBJECTS
W... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can javascript collect values from the same classname in select-option?<p>I made table for the individual summation of the same classnames as like '30', ... | <p>I think this is probably what you want, but it's a tiny bit unclear from the requirements. (I'm unsure why you run the "summation" function on the last two selects when you are not including them in the calculation.)</p>
<p>From a code point of view, <code>querySelectorAll</code> is used to find all elements with t... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SOAP usage => SAAJ0537: Invalid Content-Type. in an applet<p>I'm trying to develop an application under C# which has some applets in Java and when I run it, ... | <p>I had to remove an / from the end of my endpoint. After doing it. It works.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How R class are handled inside aab format (android app bundle)?<p>I have a native app (I mean compiled in ARM) made in Delphi. This app was working pretty fi... | <p>The Dex file must be the same for 32 bits and 64 bits, so you should have a single classes.dex and a single resource table (resources.arsc) to generate.</p>
<p>Also the AAB uses a resource table in a different format, which must be generated with aapt2, not aapt. See
<a href="https://developer.android.com/studio/b... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Laravel 4 - Datatables - Call to a member function getQuery() on array<p>The following query MySQL works correctly in MySQL MyAdmin.</p>
<pre><code>SELECT c... | <p>Your error says all.</p>
<p>You should convert $usuarios <strong>array to Collection</strong> as:</p>
<pre><code>$usuarios = DB::select( DB::raw($sql), array('idGrupo' => $idGrupo));
$usuarios= collect($usuarios);
</code></pre>
<p>GO AHEAD...
<a href="https://stackoverflow.com/questions/35520046/call-to-a-... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
nginx, passenger only showing root page, all other routes fail<p>Nginx + passenger is only showing the root page / path, all other routes fail with 404 Not F... | <p>Try removing <code>try_files $uri $uri/ =404;</code>
Remove or comment out the <code>try_files</code> line completely and it will work.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get data from json object inside csv using apache-nifi<p>My csv contain</p>
<pre><code>date,name,department
2020-2-4,sachith,{dep_name:computer,location:232... | <p>plain groovy to test script in groovyConsole:</p>
<pre class="lang-groovy prettyprint-override"><code>import groovy.json.*
def parser = new JsonSlurper().setType(JsonParserType.LAX) //LAX to accept strings without double-quotes
def w = System.out
new StringReader('''date,name,department
2020-2-4,sachith,{"dep_nam... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is my if statement ignoring my conditions?<p>I'm working on a calculator app and I have given each button a value corresponding to their numbers or character... | <p>You need to use <strong>AND</strong> operator, because it should not be 'C' and 'del'</p>
<pre><code>value != "C" && value != "del"
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Kendo UI Grid, Group Header not collapsed when using row template<p>I'm using Kendo UI grid, which has a Group by default. In the group header, it shows some... | <p>This does not answer the question of whether this is a bug but you can see if this makes your grid work. Where you are having an issue with the row header not collapsing. Is wonder if there a hidden exception. As a workaround, you can add the image to the column using a column template the same way you are adding yo... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get i18next.t() in plain JS file?<p><strong>Overview</strong></p>
<p>React application in which internationalization is required, using <a href="http... | <p>You can import <code>i18n</code> instance from your <code>i18n.js</code> file, it contains <code>t</code> on it.</p>
<pre class="lang-js prettyprint-override"><code>import i18n from '../i18n';
i18n.t // <- use it.
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to associate an Azure app service with an application insights resource (new or existing) using terraform?<p>I looked at the documentation of both <a hre... | <p>It seems that enabling application insights using Terraform is not working yet currently. There is a <a href="https://github.com/terraform-providers/terraform-provider-azurerm/issues/1303" rel="nofollow noreferrer">Feature Request: Attach azurerm_application_insights to a azurerm_app_service</a> in Github.</p>
<p>I... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Checking if a String contains a String that follows a format using Regex<p>I was wondering if someone could help me with determining whether or not a string ... | <blockquote>
<p>This [does not work] if it has other characters surrounding it.</p>
</blockquote>
<p>This is because <code>matches</code> looks for the regex to match the entire string. If you need to know if there's a partial match, use <code>find()</code> instead:</p>
<pre><code>System.out.println("" + matcher.fi... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Android : How to save an Object class in bundle before screen rotate?<p><pre>package com.explorateurfichier;</p>
<p>import java.util.ArrayList;
import java.... | <p>The standard way is to have your class implement either <code>Serializable</code> or <code>Parcelable</code> and then you can put an instance into a <code>Bundle</code>.</p>
<p>However, since your class contains <code>File</code> objects, you might be better off using <code>onRetainNonConfigurationInstance()</code>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Correct way to pass in a SQL function as a value<p>I want to update a record's DateUpdated field each time the user updates the record.</p>
<p>I thought I s... | <p>The first one won't work because you parameterized the SQL function name, so it will pass "GetDate()" as a literal string. However, if you replaced "GetDate()" with "#Now()#" it should work, since you are passing the value from a ColdFusion function. </p>
<p>The second one should work as-is though. </p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
JDeveloper 12c | IntegratedWebLogicServer | Error while building the default domain<p>I'm trying to run IntegratedWebLogicServer using JDeveloper Version 12.... | <p>Follow the following steps to fix this issues in 12.2.1.4</p>
<ol>
<li>Go to Oracle_Home\jdeveloper\ide\bin folder.</li>
<li>Edit ide.conf file.</li>
<li>Under <em><strong># Other OSGi configuration options for locating bundles and boot delegation</strong></em> section (or any other section) add the following line</... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
cant update mysql data with json<p>look this my code for update data in mysql </p>
<pre><code>$id = intval($_REQUEST['id']);
$user = htmlspecialchars($_REQU... | <p>You have not posted any errors, so I am going to go based on what I know.</p>
<p>on this line:</p>
<pre><code>$result = @mysql_query($sql);
</code></pre>
<p>You should remove the <code>@</code> which will supress your warnings, because you have an error in your mysql query.</p>
<p>Your query will evaluate to thi... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Check if FK order is numbered correctly<p>I have some absences, and each absence has an FK to an employee, which I wanna display in a generated HTML table. H... | <p>If employee_ID corresponds to employee_FK, then you should not iterate over <code>$count_user</code>, but rather over <code>$array_user</code> - then your select would looke like this:</p>
<pre><code>$result = mysql_query("select start, end, type_FK, employee_FK FROM absences where employee_FK = {$array_user[$i]['e... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to reflect product price and quantity changes on journal entries of an invoice<p>I create a wizard that change price and quantity for each product but th... | <p>You should call <code>_onchange_price_subtotal()</code> on every changed invoice line (model <code>account.move.line</code>) to trigger the recomputation. The recomputation is only implemented for changes in the view, that's why it's isn't triggered when using a wizard. But the implementation can be used in the wiza... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to measure request and response time of server?<p>I am using asynctask and json parsing for getting response from server,How can i measure request and re... | <p>Please see below code you will get an idea about how to do this.</p>
<pre><code> long startTime = System.currentTimeMillis();
//Write this above before your httprequest
HttpResponse httpResponse = httpClient.execute(httpGet);
HttpEntity httpEntity = httpResponse.getEntit... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
html/mysql echo query results into table?<p>I am using the following MySQL query to select data from my database and echo the results in a table.</p>
<p>My ... | <p>You close the table in the loop.The first set of results is echoed correctly because it's still in the first loop and it'll output how you want it, but because of the closing table, the other results are messed up. The <code></table></code> tag is in the loop but the <code><table></code> isn't so the <co... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Calculate minimum value for each column of multi-indexed DataFrame in pandas<p>I have a multi-indexed DataFrame with the following structure:</p>
<pre><code... | <p>You can take the min, max, and mean then use pd.concat to stitch everything together. You'll need to transpose (T) then transpose back to get the dataframe to concat the way you want. </p>
<pre><code>In [91]: df = pd.DataFrame(dict(exp1=[1.2,2.1],exp2=[1.5,0.7]), index=["run1", "run2"])
In [92]: df_min, df_max, df... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to add nested comments in a Django blog<p>I have a blog app where I have a comments section. The comments can be made by only authenticated user. I want ... | <p>Since you would want to be able to add multiple replies to a comment you need to create another model called Replies with a many-to-one relationship to the Comment model. That way each article can have multiple comments and each comment can have multiple replies. Your Replies model will look something like this- </... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Need Help for Optimizing MySQL query with few joins<p>Hello I have the follow sql query it works but it is kind of slow </p>
<pre><code>SELECT
ep . *,
... | <p>In your case it is easier to perform some operations not using mysql but using php.
I have seen in my practice cases when you win time. Please, try to divide a complex query into several simple queries. Then perform the necessary filtering using php scripts.
Hope it helps.
Thanks!</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Iterating over XML and selecting specific element tree content<p>I have an XML which looks like this:</p>
<pre><code><openie>
<triple confidence=... | <p>To get your <code>t_object</code> you're running <code>triple.get()</code> instead of <code>triple.find()</code>. Changing that fixes your problem.<br></p>
<pre><code>def get_openie():
print('OpenIE parser start...')
tree = ET.parse('./tmp/nlp_output.xml')
root = tree.getroot()
for triple in root.fi... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Creating a which command in bash script<p>For an assignment, I'm supposed to create a script called <code>my_which.sh</code> that will "do the same thing as ... | <ol>
<li><p>Split your <code>PATH</code> variable <em>safely</em>. This is a general method to split a string at delimiters, that is 100% safe regarding any possible characters (including newlines):</p>
<pre><code>IFS=: read -r -d '' -a paths < <(printf '%s:\0' "$PATH")
</code></pre>
<p>We artificially added <c... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
When not to use APNS in an IOS app?<p>I am adding push notification services to my iOS app. I understand that I can either use APNS or another party like "Pu... | <blockquote>
<p>Why is it advantageous to use Pusher over APNS?</p>
</blockquote>
<h3>Speed</h3>
<p>Pusher is better in most cases for in-application notifications, when the application is already open. It will be faster at delivering the messages (<250ms) than native Push Notifications since Pusher maintains a ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
API Architecture for User Accounts<p>I'm currently developing a side-project, which will consist of a Database, Web API, and then different Apps on top which... | <p>You should use a special view model without the password property for this purpose. Then inside your API you will map between your data model and the view model and return the view model out from your Web API method. Same stands true for the <code>Salt</code> property as well.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Manipulate canvas bytes directly from WebAssembly<p>I'm a total beginner to Rust and WebAssembly. I was trying to find a way to draw on a <code>canvas</code>... | <p>WebAssembly has very limited I/O capabilities. The only way it can interact with its host environment (typically the browser) is directly via imported / exported functions or indirectly by linear memory. </p>
<p>The example you cite has a WebAssembly module where its linear memory is shared with the host allowing i... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to show comments notification in php<p>I have three tables "posts", "comments" and "friend_request"</p>
<p>screenshot
<img src="https://i.stack.imgur.co... | <p>The way I would approach this is to use a client side AJAX request to a php fetch script that looks at the logged in users <code>SESSION['id']</code> to find all comments made by post authors that are children of a comment the logged in user has made</p>
<h1>Frontend</h1>
<p>You may use whatever way you want to send... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to make duplicates of values in a list python<p>Quick question... searched and didn't find anything. I have this list:</p>
<pre><code>list = [1, 2, 3, 4... | <p>Use nested loops in a list comprehension.</p>
<pre><code>>>> [x for x in L for y in range(4)]
[1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to convert preg_replace with pattern in array into preg_replace_callback?<p>I am trying to migrate my sites from <strong>PHP 5.4 to HHVM</strong>. I lear... | <p>Calling <a href="http://php.net/manual/en/function.preg-replace-callback.php" rel="nofollow"><code>preg_replace_callback()</code></a> with an array of search strings is possible only when there is a single replacement for them (when the parameter <code>$replacement</code> of the call to <a href="http://php.net/manua... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Implementing Listener from Java in C#<p>I'm trying to write a C# program. The functionality is already implemented (But in Java).</p>
<p>Is there any way to... | <p>create your own interface like </p>
<pre><code>interface IOnDeviceControllerListener
{
void OnError(ControllerError.Error error, String message);
void OnRead(MobileServiceList<Device> devices);
void OnInsert(Device device);
}
</code></pre>
<p>next class:</p>
<pre><code>DeviceControll... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
PHP password_hash and password_verify Not Working with MySQL<p>I am using <code>password_hash</code> to store passwords in a MySQL database field of type VAR... | <p>This proves that something is wrong with your hash</p>
<pre><code><?php
// See the password_hash() example to see where this came from.
$password = 'pass1234567890';
$hash = '$2y$10$JLP/pPei6RYRdUmoH8H5RO7iJyImOtrBLsrRRfq3XpeqNE3lQ/l7O';
$hash2 = '$2y$10$gMJKYZUc1FKSZBnsONxLOebOHj.uuEWSiCP0jo4Zv0iAHBz6iz.NG';
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How come my Bootstrap Pills dropdown won't work?<p>I basically copied the components of a Pills dropdown menu from <a href="http://getbootstrap.com/component... | <p>You have to insert the Bootstrap JavaScript file and the JQuery JavaScritp file within the <code><head></code> tag. Have a closer look at the following code snippet:</p>
<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-ove... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to run more logic after user registration in Laravel 5<p>I am using the default user registrar in Laravel 5. When the user registers there is some inform... | <p>You can use a model event, place this code in your model.</p>
<pre><code>public static function boot()
{
static::created(function($model)
{
//do other logic here
});
}
</code></pre>
<p><a href="http://laravel.com/docs/5.0/eloquent#model-events" rel="nofollow">http://laravel.com/docs/5.0/eloquen... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Playing Random Audio Tracks on mobile browsers<p>Objective:</p>
<p>User taps a button.</p>
<p>A random audio track is selected (among 3 tracks) and plays i... | <p>Actually it appears that it is autoplay, because you're not playing the file on event (tap), you're simply loading new HTML code which then requests for an autoplay.</p>
<p>It might work if you request the play action in javascript immediately after replacing the HTML:
<code>document.getElementById('background_aud... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Violation on primary key with multiple keys in table<pre><code>CREATE TABLE parameters (
tag_id BIGINT,
id NVARCHAR(255),
idx NVARCHAR(255),
primary ... | <p>You can use same column <code>idx</code> in single <code>values</code> construct : </p>
<pre><code>SELECT t.oid, a.id, a.idx
FROM tag t CROSS JOIN
( VALUES ('1', 'a'), ('0', 'b'), ('A', 'c'), ('2', 'd')
) AS a(id, idx);
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
pl/sql stored procedure to select from a table where date is equal to stored procedure parameter<p>I am new to PL/SQL and oracle, I am using SQL developer 19... | <p>The simplest option to make this query return data in data grid is to ... well, run it outside of the stored procedure. Procedures are <em>nice</em>, but not <em>that nice</em> for doing what you want. </p>
<p>When returning something, a function might be a better choice. For example:</p>
<p>Create it first:</p>
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python script set to run on boot on Mac will not stay running<p>I have a Python script I want to run at startup and remain running continuously on a Mac. I b... | <p>I just removed the scheduling inside the Python script and set up the function to fire when the script is called. Then created a cron job to run every day at 2pm.</p>
<pre><code>EDITOR=/usr/bin/nano crontab -e
</code></pre>
<p>
0 14 * * * is everyday at 2pm</p>
<pre><code>0 14 * * * /anaconda3/bin/python /Users/m... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Reading SDMX in R - parse error?<p>I've been trying to develop a shiny app in R with INEGI (mexican statistics agency) data through their recently initiated ... | <p>You could try <a href="http://cran.r-project.org/web/packages/RJSDMX/index.html" rel="nofollow">RJSDMX</a> . </p>
<p>To download all the time series of the <strong>DF_PIB_PB2008</strong> dataflow you just need to hit: </p>
<pre><code>library(RJSDMX)
result = getSDMX('INEGI', 'DF_PIB_PB2008/.................')
</co... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Aether to fetch the artifact from repository at runtime<p>This is a sample code that i took from the aether sample codes to fetch an artifact.</p>
<pre><cod... | <p>This is a general problem with the latest version (1.13.1) of the org.apache.maven.wagon:wagon-http-lightweight. When used with the latest version of the other aether and maven dependencies it is throwing error.</p>
<p>So don't use the latest version, use the older version. These are the dependencies that i used wh... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Mysql function count() counts rows individually<p>I have the following query, where i want to get the total number of rows but this seems to count each indiv... | <p>I manage to count rows by the following query.</p>
<pre><code>"SELECT COUNT(*) as count FROM (SELECT
*
FROM
product_categories WHERE subcategory_id IN (77,76)
GROUP BY product_id
HAVING COUNT(DISTINCT subcategory_id) = 2) as subc";
}
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
optparse-applicative parser fails due to partial input being consumed<pre><code>module Main where
import Options.Applicative
import Control.Monad
import Con... | <p>The problem here is in the <code>(<|>)</code> operator. It only tried the second parser when the first parser didn't consume any input. But in your exaple it did. You can verify this by specifying the arguments in reverse order. Then the first parser will not consume any input and fail and the second parser wi... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I replace a Java Jackson TextNode by another one (update)?<p>My goal is to update some textual fields in a JsonNode.</p>
<pre><code> List<Json... | <p>The short answer is: you can't. <code>TextNode</code> does not expose any operations that allows you to alter the contents.</p>
<p>With that being said, you can easily traverse the nodes in a loop or via recursion to get the desired behaviour. Imagine the following:</p>
<pre><code>public class JsonTest {
publi... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get values of DataGridView.Rows.Columns from Form 2 to Form 1<ul>
<li>DataGridView - Placed in Form - 2</li>
<li>TextBox1 - Placed in Form - 1</li>
</... | <p>You are making an new instance of Form2 in your Form1, thus having an empty DatagridView. You should pass the current instance of DatagridView , e.g:</p>
<p>Form1:</p>
<p>Fawad Edited:</p>
<p>You forgot to create object: this does the job, but it pops up form 2 for a second to get data and then recloses, which is... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Game Over Style Popup View<p>I'm having a hard time coding a pop up view to display on the screen after my timer has ended. I'm trying to accomplish that "Ga... | <p>You can create an <code>UIView</code> and then show it up animated. Like that:</p>
<pre><code>var gameOver = UIView(frame: CGRectMake(100, 100, 0, 0))
gameOver.backgroundColor = UIColor.redColor()
self.view.addSubview(gameOver)
//Call whenever you want to show it and change the size to whatever size you want
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Scrapy - Extract Data from mutliple pages<pre><code>class HomedepotcrawlSpider(scrapy.Spider):
name = 'homeDepotCrawl'
allowed_domains = ['homede... | <p>Here is some working code for what you want to do:</p>
<pre><code>import scrapy
from urllib.parse import urlsplit, urljoin
class HomedepotSpider(scrapy.Spider):
name = 'homedepot'
start_urls = ['https://www.homedepot.com/b/N-5yc1v/Ntk-ProductInfoMatch/Ntt-zline?NCNI-5&experienceName=default&Nao=0']... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using functions defined in primitive modules<p>I'd like to make use of this function: </p>
<p><a href="http://doc.rust-lang.org/std/primitive.u8.html#method... | <p>The trick here is that <code>from_str</code> is actually part of the trait <a href="http://doc.rust-lang.org/std/str/trait.FromStr.html"><code>FromStr</code></a>. You need to use that trait, then specify which implementation you want to use:</p>
<pre><code>use std::str::FromStr;
fn main() {
match <u8 as Fro... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SQL finding max value of column where another column has got maximum but repetable value<p>I have following table:</p>
<pre><code>id year month
1 2019... | <p>Use <code>order by</code> and <code>limit</code>;</p>
<pre><code>select t.*
from t
order by year desc, month desc
limit 1;
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
JavaFx combobox dropdown list design issue<p>I am trying to change the background color and text color for combbox and is using following style</p>
<pre><co... | <p>While @James_D solution works, if you override the background color you won't see hover, filled or selected pseudo classes.</p>
<p>This will give you the chance to define your styling for them too:</p>
<pre><code>.combo-box-popup > .list-view {
-fx-background-color: -normal; // or define other color to high... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
GLTF loaded object drag and drop using three js<p>I tried to load the gltf (object) which is made up of multiple elements when I try to select and drag the o... | <pre><code>use following code to drag multi mesh GLTF. It is Work for me.
var dragobjects =[];
//add following code in init function
var gltfobject = addGLTFObjectIntoScene();
scene.add(gltfobject);
dragControls = new THREE.DragControls(dragobjects, camera, renderer.domElement);
dragControls.addEventListener('dra... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Android Layout - list within a list<p>I am new to Android and need help in creating the following layout:</p>
<p><img src="https://i.stack.imgur.com/tlFJZ.pn... | <p>You can use the ExpandableListView for this. The ExpandableListView is a List within a List:
<a href="http://developer.android.com/reference/android/widget/ExpandableListView.html" rel="nofollow">http://developer.android.com/reference/android/widget/ExpandableListView.html</a></p>
<p>Here is a nice tutorial which e... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Android Navigation Bar has half transparant square behind it when making background color transparant<p>I have a project for which I'm doing a transparant bo... | <p>So it turns out that adding the following attribute to the <code><BottomNavigationView /></code> inside the XML fixes the problem:</p>
<pre><code>app:elevation="0dp"
</code></pre>
<p>(Just putting the answer from the comments into a regular answer)</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
why view is not updated if my table definition is updated?<p>Suppose i have a table as the definition below:</p>
<pre><code>CREATE TABLE Test
(
a INT,
... | <p>When you create a view it stores the view definition as metadata in the system tables. Even if you use <code>SELECT * FROM</code> it will store the exact column names e.g. <code>SELECT a, b FROM</code></p>
<p>If you then update the base table the metadata definition for the view still remains the same so any new co... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Flatlist won't fill the entire screen<p>So i'm new to react native and mobile dev,
i Have a <strong>flatlist</strong> that i want to stretch on the <strong>... | <p>tbh i don't know why the other options didn't work but i found a way around as i mentioned;
i changed the <code>paddingVertical:10</code> to become <code>paddingVertical: '25%'</code> in the <code>rectButton{}</code> style </p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
confusion about .html() and .append() when I'm trying to overwrite elements in a loop<p>Sorry about the gory title. Effectively I'm trying to loop through a ... | <p>You should blank your $('#result') with $('#result').html('') <strong>before</strong> your for() statement, and then use .append() inside the loop.</p>
<p>Could you provide your array so as I can confirm that I understood well your problem ?</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Flume agent does not stop retrying for unrecoverable solr error<p>I am using Morphline Solr Sink to store information in Solr. The problem that I am facing i... | <p>You should fix the reason for the failed requests.</p>
<p>Flume is doing exactly what it's designed to do. It's transactionally trying to store the batch of events in your store. If it can't store those events then, yes, it keeps on trying. </p>
<p>You haven't explained what the problem is causing these failures. ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Performance tuning and optimization of XML::Twig in Perl<p>Following is the code I have scribbled in order to filter my 3 to 5 GB XML file based on four cond... | <p>If you're worried about the memory footprint, you really want to be using flush/purge in a twig handler.
That way it's called as the file is being parsed. </p>
<p>Your calls to purge are being made <em>after</em> your parsefile, which means - it has to load and parse the whole thing first. </p>
<p>You might be abl... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
XML - System.Xml.XmlException - hexadecimal value 0x06<p>I get this error. Later I searched and found out the reason of illegal characters in my XML and its ... | <p>This is a very simple example of character "filter" that will replae the 0x06 character with a space:</p>
<pre><code>public class MyStreamReader : StreamReader {
public MyStreamReader(string path)
: base(path) {
}
public override int Read(char[] buffer, int index, int count) {
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Scrollbar is not displayed in sap.m.table<p>I am using an sap.m.table. The number of rows is too big to fit on the page.
Therefore, I expect the table to of... | <p>I'm guessing you are launching your app with the <code>Component.js</code> as entry point so in your <code>App.view.xml</code> wrap your table in </p>
<pre><code><Shell id="shell">
<App id="app">
<pages>
<Page id="page" title="{i18n>title}">
<con... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Substitute Multi Values Excel using VBA<p>I have a working function created(written by someone else) with the help of VBA to replace multiple strings, my pro... | <p>If considering the full cell value is OK then:</p>
<pre><code>Function SubstituteMultiple(text As String, old_text As Range, new_text As Range)
Dim i As Single, Result as String
Result = text
For i = 1 To old_text.Cells.Count
If text = old_text.Cells(i).Value Then
Result = new_text.... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Linq to get a list of models per Make into DTO<p>I have a DTO class like this</p>
<pre><code>public string Make { get; set; };
public List<string> Mod... | <p><strong>Firstly,</strong> In condition you can do this</p>
<pre><code>Where(x => make_list.Contains(x.Make)
</code></pre>
<p>or</p>
<pre><code>Where(x => make_list.Any(m => m == x.Make)
</code></pre>
<p><strong>Secondly,</strong> the method is returning <code>List<MakeModelDTO></code>, So you shou... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Catch the "sender" from Panel in ToolStripMenuItem_Click<p>I am trying to catch the "System Object" sender of a "Panel" object, but within ToolStripMenuItem,... | <p>If you only have one level of menu items then you can always access the <code>SourceControl</code> of the menu item that was clicked:</p>
<pre><code>Private Sub ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ToolStripMenuItem.Click
Dim clickedPanel = DirectCast(DirectCast(DirectCast(sender,
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Create new calendar with Microsoft Graph<p>I have set <code>user.read, calendars.readwrite</code> permisssion and can successfully authenticate. However I g... | <p>actually it was</p>
<pre><code>await graphClient.Me.Calendars.Request().AddAsync(new Calendar(){Name = "test"});
</code></pre>
<p>and not </p>
<pre><code>graphClient.Me.Calendar
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
View bounds and coordinates in Cocoa Mac OS X<p>I have a simple custom view in my Mac OS X application that is essentially empty. Here is the code:</p>
<pre... | <p>the view is 713 points wide. 713*screenscale = pixel size which you can then use with dpi to get the inches shown ;)</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
event year view in fullcalendar v4<p>I would like to display year view of events in fullcalendar v4. Year view has been added to full calendar until version ... | <p>My aim is to use version 3 and above since it support the valid range function and version 3 custom view is quite understandable. So, I had use version 3 to do year view. This year view limited for only one year that consist of 12 months. Declare custom view in fullcalendar instantiation. </p>
<blockquote>
<p>vie... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How does SetState() decide whether a widget needs rebuilding?<p>I'm trying to wrap my head around the concept of state, the <code>setState</code> function, a... | <p>The setState((){}) rebuilds the current widget state i.e it just calls the build method if you have updated any value inside the setState((){}) or have updated before calling the setState((){}), it will behave same.</p>
<p>For some values which have been initialised or defined inside the build method it will not ta... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can std::string reallocation invalidate pointer to heap?<p>My question is regarding the following scenario:</p>
<pre><code>std::string *ps = new std::string... | <blockquote>
<p>What usually happens from my experience is that aVeryLargeString
exceeds the capacity of *ps, so *ps allocates extra memory, keeping
the starting position the same.</p>
</blockquote>
<p>No, this is not generally true. When you exceed the capacity, the string uses its allocator to allocate a compl... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Color string along with bracket if its value is greater than 0 in vba<p>With below code I'm trying to color sting along with bracket when its value is > 0. B... | <p>The problematic line is <code>IFind = InStr(cell.Value, sFind)</code>.</p>
<p><code>InStr</code> finds the <em>first</em> occurrence of <code>sFind</code>, which may not be the number inside the parentheses but rather an earlier instance.</p>
<p>Although I would approach this differently, an easy fix might be to u... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
NameError: uninitialized constant in Rails app when attempting to import CSV<p>I am making a rails application which relies on a database based on a CSV file... | <p>Rake can automatically loads all your models etc. for you. Additionally, you should put that task into its own file, not the Rakefile that rails uses.</p>
<p>Try something like this:</p>
<p><strong>lib/tasks/import.rake</strong> (any file name ending with .rake will work)</p>
<pre><code>desc "Imports stuff from ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to speed up DataFrame setting?<p>Now I have a <code>list</code> of records whose format is <code>(index,column,value)</code>, and a <code>DataFrame</cod... | <p>As it turns out, you can indeed use a NumPy array instead of a Pandas DataFrame. This particular solution takes advantage of <a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ufunc.at.html" rel="nofollow noreferrer"><code>numpy.ufunc.at</code></a>.</p>
<pre class="lang-py prettyprint-override"><co... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Make a query making groups on the same result row<p>I have two tables. Like this.</p>
<pre><code>select * from extrafieldvalues;
+--------------------------... | <p>If you have only two fields, then <code>left join</code> is an option for this:</p>
<pre><code>select i.*, efv1.value as value_1, efv2.value as value_2
from items i left join
extrafieldvalues efv1
on efv1.iditem = i.id and
efv1.type = 1 left join
extrafieldvalues efv2
on efv1.iditem = i.... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
AWS Lambda - Get API Gateway path in the lambda function<p>I have a Lambda function that is tied to API Gateway and i am trying to fetch the path and stage f... | <p>The <code>stage</code> value is available in <code>event.context.stage</code>. So change your code to this:</p>
<pre class="lang-js prettyprint-override"><code>exports.handler = function(event, context) {
console.log("Stage: " + event.context.stage);
...
}
</code></pre>
<p>We are using a basic mapping template l... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why does CORS not make a request?<p>I have a problem with a CORS request</p>
<pre><code>Access to fetch at 'https://webhook.site/f9087e12-b444-4e6b-9e64-06b... | <p>CORS is a server side thing. Your browser is contacting webhook.site and saying "I want to download that thing f9087e12-b444-4e6b-9e64-06ba47b8c24e, what domains will you serve it to?" and webhook.site is saying e.g. "I'll only serve it to scripts that were downloaded from <em>whatever.com</em>" and your browser is ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Undefined method on custom has_many with source<pre><code>Run.rb:
has_many :schedule_machines, through: :schedule_locations
Schedule.rb:
has_many :sched... | <pre><code>has_many :runs, dependent: :destroy
has_many :assigned_schedule_machines, through: :runs, source: :schedule_machines
</code></pre>
<p>You need to order the "runs" first. The assigned_schedule wants to use runs; but in your original code the runs wasn't defined yet. </p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how do i marshal data for TCP streaming?<p>So for a homework assignment, I have a example of how to marshal data and unmarshal. </p>
<p>The structure they g... | <p>You're not initializing WireFormatWidget#identifier. It's declared but never initialized. Add a constructor to WireFormatWidget and provide a String as the identifier. </p> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.