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:
Spring transaction and PersistenceContext<p>I've got situation like this:</p>
<pre><code>@Transactional
@Override
public void register(String username, User... | <p>Correct me if I am wrong, but you are using transaction scoped entitymanager, so during each call to entitymanager it ensure that persistence context exists, here entitymanager creates a new one and uses it to merge - and,as in transaction-scoped entitymanager, persistence context will be removed after each commit.<... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
WordPress/bbPress separate users<p>I want to have user to register separately for WordPress or bbPress. I looked for any kind of plugin with no luck, I even ... | <p>The way to go is to use <a href="https://wordpress.org/plugins/hyperdb/" rel="nofollow">HyperDB</a> to be able to use more than one database in a network.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R, Select a Subset of Matrix<p>Suppose I have 2 matrices m and m.ind. The first one contains actual data while the smaller one contains row indices.</p>
<pr... | <p>You could produce the indices for subsetting <code>m</code> by either</p>
<pre><code>m.ind2 <- m.ind + nrow(m)*(col(m.ind)-1)
</code></pre>
<p>or </p>
<pre><code>m.ind2 <- cbind(as.vector(m.ind),as.vector(col(m.ind)))
</code></pre>
<p>And then do:</p>
<pre><code>matrix(m[m.ind2],nrow=nrow(m.ind))
</code><... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to manage files in Android Studio<p>I'm working in Android Studio right now, but I'm a little new to the whole concept of programming. I know how to code... | <blockquote>
<p>do I have to create a new file with the function and call it from
within the code? or just let the function inside MainActivity.Java? </p>
</blockquote>
<p>You dont need to create a new file ! write your function in MainActivity.Java like this :</p>
<pre><code>private int yourRandomNumberMethod... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C read function Undefined error: 0<p>When I am calling the c read function the perror function tells me that it is an Undefined error: 0.</p>
<p>This is the... | <p>From the <a href="https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man2/read.2.html" rel="nofollow"><code>read(2)</code> man page</a>:</p>
<blockquote>
<p>If successful, the number of bytes actually read is returned. Upon reading end-of-file, zero is returned. Otherwise, a -1 is r... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Java - Cannot gather 2D array inside vector<p>As I mentioned in my previous (not ansvered) question, I'm making a image editor that can be embeded to my prog... | <p>The problem might be, that for undo-redo to work the undo queue has to contain immutable data.</p>
<p>This means that every change (atomic group of changes) to <code>chroma</code> would need a new 2D array copy; expensive.</p>
<p>The solution is to keep only the <em>change actions</em> in the undo/redo queue.</p... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Gson - Convert from Json to List<><p>i'm having an issue converting Json to List<>, I have tried different solutions but no clue </p>
<p>My json result l... | <p>In this JSON, you get a list of {Code, Label} objects, but in the <code>List</code> property of an object.</p>
<p>You first need to encapsulate this list in an other object.
As in:</p>
<pre><code>public class QuestionaireList {
public List<Questionaire> List;
}
List<Questionaire> qsts = gson.fromJso... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
A property of a Array of objects is NULL when before iteration has a value<p>I am working with Files in TypeScript (Angular 8), So I Encoded the files in Bas... | <p>You can solve this by returning array of promises from the function convetTob64.
I added an example below with your modified code.</p>
<p><div class="snippet" data-lang="js" data-hide="true" data-console="true" data-babel="false">
<div class="snippet-code snippet-currently-hidden">
<pre class="snippet-code-js lang-... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C# take a duplicate entry in a CSV file and remove the duplicate by taking an average<p>My program creates a .csv file with a persons name and an integer nex... | <p>To start with, you can write your current <code>CreateCsvFile</code> much more simply like this:</p>
<pre><code>public void CreateCsvFile()
{
var filepath = @"F:\A2 Computing\C# Programming Project\ScheduleFile.csv";
var ListGather = new PaceCalculator();
var records =
ListGather.NameGain()
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Spring integration RecipientListRouter doesn't create multiple payloads<p>Please can any one help me with this issue, I configured my ReceipientListRouter as... | <p>While the message is immutable, the payload is not (unless it's an immutable object such as a String).</p>
<p>If you mutate the payload in service1, the mutation will be seen in service2.</p>
<p>You need to clone/copy the payload before mutating it if you don't want service2 to see the mutation.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MS Access SQL: Adding two COUNT statements returns multiple copies of the sum instead of one<p>So I'm attempting to perform basic Arithmetic functions (+, -,... | <pre><code>SELECT
SUM(IIF(qryAttainment.[Attainment Samples Received]="On Time", 1, 0))
+
SUM(IIF(qryAttainment.[Attainment CofA Issued]="On Time", 1, 0))
FROM qryAttainment
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Item (li) disappears when dragged out of List (ul) region<p>I have a list and I am trying to create a system in which a person can drag an item from that lis... | <p>There are several problems with this code-</p>
<ol>
<li>Your intention is moving a <em>li</em> list item from a valid parent container (a <em>ul</em> unordered list element) to an invalid parent container (a <em>div</em> element).</li>
</ol>
<blockquote>
<p>Permitted parent elements An <ul>, <ol> or ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
PHP Remove Hard Return From Output<p>I realize there are some post on this subject. I have looked at them and tried the code but it is not working for my par... | <p>If you want to remove all new line characters in your return statement this should work for you:</p>
<p>(Here i simply used <a href="http://php.net/manual/en/function.strtr.php" rel="nofollow"><code>strtr()</code></a>)</p>
<pre><code>return strtr($quotes[$num], array(PHP_EOL => " "));
</code></pre>
<p>Or even ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to iterate multiple regex's?<p>So to start out I'm having trouble with making my code cleaner, I know logically it's a mess but I'm relatively new. Anywa... | <p>If you organize your EmergInfo data in a hash instead of an array, you will be able to search and replace all fields at once.</p>
<pre><code>my %EmergInfo = (
Location => 'New York',
LastUpdate => 'Feb 17, 2015',
OPHONE1 => '800-555-1212',
etc => '...',
);
my $joined_keys = join('|', keys %Emer... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
UIImage imageNamed not setting image in iphone6<p>Hi am working on ios project using xcode 6.0.1,ios 8.While I am running my app in iphone6 simulator it is n... | <p>Please check your retina size image i.e. btnbg@2x.png.As may be the retina size image is not being loaded properly.As iphone 6 loads retina size images that is in the form of ImageName@2x.png.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
issue with adding strings to the page dynamically using a for loop<p>I want to add three sentences to the page dynamically using a for loop. The issue is al... | <p>You don't need to center all the three sentence divs, as that will make them overlap on each other. Instead, you use something like below.</p>
<p>Also, it will help to use <code>flex-direction: column</code> if you want each sentence to appear one below the other.</p>
<p>Also, if you need spacing between sentence... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
VBA Select and Copy Not Working After Adding Locked/Unlocked Cells in Excel<p>I created an Excel Sheet that has a Command Button (Active X Control). The butt... | <p>I think you should </p>
<p>A. Unprotect before copy Range</p>
<p>Or</p>
<p>B. Don't call "Worksheet_SelectionChange" during "copyButton_Click" runing</p>
<p>blow code is Case B</p>
<pre><code>Private Sub copyButton_Click()
'Dont Call Sheet events
Application.EnableEvents = false
'Check for blanks'
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is it possible to add a component loaded from an FXML file more than once without rereading it?<p>So I'm getting started with javafx and I was wondering the ... | <p>There's no built-in way to do this. Tom Schindl was working on a project to <a href="http://tomsondev.bestsolution.at/2013/08/29/convert-fxml-to-java-as-part-of-the-build/" rel="nofollow">convert FXML to java source</a> and compile the source at build time. I don't know what the current status of that project is (th... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Excel: Highlighting a whole column depending on date<p>I have made my own Gantt chart in Excel, which is shown in this picture:</p>
<p><img src="https://i.s... | <p>If you'd like an entire range to <code>conditionally format</code> based on the value of one of the fields in the range, use an absolute cell reference. I couldn't figure out perfectly from your picture which cell contains the date, but I'll try to give you an example.</p>
<p>If you have dates in the Cells in <code>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Passing pointer to local variable to function: is it safe?<p>For example:</p>
<pre><code>void func1(){
int i = 123;
func2(&i);
}
void func2(int ... | <p>The scope of <code>i</code> is <code>func1</code> and it outlives the call to <code>func2</code>. So it is perfectly safe.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
gps location xamarin android not working<ul>
<li>In list viewList item get the gps location using this code segment but it is not working(<code>public class ... | <p>I change the Emulator and It worked fine.Use
<a href="http://www.andyroid.net/" rel="nofollow">http://www.andyroid.net/</a> Andyroid emulator. It support Xamarin too</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Correctly finding numbers in a string?<p>I'm trying to read characters (numbers) from a string, and then passing them as integers in a vector. Currently some... | <p>You can make use of the <a href="http://www.cplusplus.com/reference/cctype/isdigit/" rel="nofollow"><code>isdigit</code></a> function to determine if the character is a digit. If so, you can make use of the fact that ASCII orders the digits adjacent.</p>
<p>You can thus solve the problem with the following code:</p... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
PyTorch LSTM: RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 1219 and 440 in dimension 1<p>I have a basic PyTorch L... | <p>This exception is thrown basically because you're loading batches with different shapes. As they're stored in the same tensor, all samples must have the same shape. In this case, you have an input in dimension 0 with 1219 and 440, which is not possible. For example, you have something like:</p>
<pre><code>torch.Size... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
PHP `global` and parameter of the same name?<p>I am reviewing some PHP code and have come across a function that looks like this:</p>
<pre><code>function us... | <p>Almost. There is exists possibility that body of functions contains <a href="http://php.net/func_get_args" rel="nofollow">func_get_args</a>. </p>
<p>This code might be under refactoring process.</p>
<p>In other cases using this <em>post</em> param is useless.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
In what order should a new wordpress theme developer start inspecting the files in default themes?<p>I've already built a simple theme for my website on Word... | <p>I would rather start by learning from the underscore theme (<a href="http://underscores.me/" rel="nofollow">http://underscores.me/</a>). It is a project made by <a href="http://automattic.com/" rel="nofollow">Automattic</a> and is always in development by some of the people who created WordPress. So you are for sure... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
chaining HTML5 classList API without (Jquery)<p>Is there a way to chain HTML5 classList API chaining?. </p>
<p>this will not work</p>
<pre><code>var sideb... | <p>You can create chainability via a little object with chainable methods:</p>
<pre><code>function classList(elt) {
var list = elt.classList;
return {
toggle: function(c) { list.toggle(c); return this; },
add: function(c) { list.add (c); return this; },
remove: function(c) { list.remove(c);... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Vue PWA login works in dev but returns 401 in production<p>I have a <code>Vue.js PWA</code> with a <code>Django Rest Framework</code> backend which works cor... | <p>I eventually figured out the issue. For some reason the following was being POSTed in the header: <code>Authorization: "Token "</code>.</p>
<p>This is really strange because when logging in using the <code>/api/get-token/</code> there is no token required since this is the login route. Also, it works perfectly from... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
JavaFX check if a Node property is being listened<p>I have a method that adds a listener to a certain Node property, during the execution, this method might ... | <p>Just for fun(not recommended):</p>
<pre><code>import javafx.application.Application;
import javafx.beans.property.*;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.stage.Stage;
import java.lang.reflect.Field;
public class Main extends Application {
@Overrid... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Slow application if the number of Markers increases<p>On an OpenStreetMap map with osmDroid and osmBonusPack I display markers and by clicking on it a bubble... | <p>A month has passed, I have a solution, I studied the project <a href="https://github.com/MKergall/osmbonuspack" rel="nofollow noreferrer">https://github.com/MKergall/osmbonuspack</a> in the folder</p>
<p><a href="https://github.com/MKergall/osmbonuspack/tree/master/OSMBonusPack/src/main/java/org/osmdroid/bonuspack/... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Connect different data series with the same line<p>Is there a way to get matplotlib to connect data from two different data sets with the same line?</p>
<p>... | <p>With numpy you can use logical indexing. </p>
<pre><code>import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
x = np.array([10000, 1000, 100, 10, 1, 5, 50, 500, 5000, 50000])
y = np.array([-10000, -1000, -100, -10, -1, 5, 50, 500, 5000, 50000])
ax.plot(x,abs(y),'+-b',la... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Trouble with leaflet maps (GET mapbox tiles unauthorized 401)<p>I am trying to add leaflet maps to my webpage and I am using Mapbox tiles. I am not able to g... | <p>Set up your tileLayer to include your map's id and your user token: </p>
<pre><code>var tileLayer = L.tileLayer('https://{s}.tiles.mapbox.com/v4/{mapId}/{z}/{x}/{y}.png?access_token={token}', {
attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MYSQL Insert for each Item<p>Maybe my question is stupid but... is there a way in mysql (without php or others)
to insert data into one table for each objec... | <p>Your logic suggests:</p>
<pre><code>insert into file_status (itemId, file, status)
select i.itemId, fc.file, 'open'
from items i cross join
file_class fc;
</code></pre>
<p>However, this inserts 15 rows. If you want to "align" the tables, then you need some way to join them. <code>row_number()</c... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Java - Why is this implementation of a binary heap faster than the other?<p>After reading a bit about heaps/priority queues, I recently made my own implement... | <p>Here, your code measured with JMH:</p>
<pre><code>@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@OperationsPerInvocation(Measure.SIZE)
@Warmup(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
@Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
@State(Scope.Thread)
@For... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to install the Word addIn, without the vsto file or the setup.exe<p>I want to install my Word addIn on another PC. I know I can run the vsto file to inst... | <p>I found a solution. You have to write only five things into the registry:
<a href="https://i.stack.imgur.com/lP3Ra.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lP3Ra.png" alt="enter image description here" /></a></p>
<p>This can be done with a small script. The Value "Wert nicht festgelegt... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Convert repeating single dimensional array to multidimensional array in PHP<p>I have a single dimentional PHP Array that has latitude, longitude, and time da... | <p>If I'm not wrong this is what you want.
You just need to change the <code>$arr</code> for your variable.</p>
<pre><code>$coords = array_map(function($coords) {
return array(
"lat" => $coords[0], # latitude
"long" => $coords[1], # longitude
"ts" => $coords[2] # timestamp
);
}, array_chun... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
tf.data.Dataset with stepping batches<p>I have a temporal dataset of 8760 samples. I wonder if there is a way to batch it with a step of 1, that is: the firs... | <p>Since you have only 8760 samples, you probably can afford (in terms of RAM costs) the simplest possible solution - just transform your data using ordinary Python code:</p>
<pre><code>dataset = [sample1, sample2, ... sample8760]
transformed_dataset = []
for i in range(len(dataset) - 3):
transformed_dataset.appen... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Drupal does not support dollar sign for jQuery and its breaking my facebook?<p>The moment I include the Facebook API, I get the error:</p>
<pre><code>Uncaug... | <blockquote>
<p>How can I make Drupal support $</p>
</blockquote>
<p>To make it work just wrap your code inside this function:</p>
<pre><code>(function ($) {
//your code, now you can use "$" with no problems
})(jQuery);
</code></pre>
<p>It's an <a href="https://www.drupal.org/update/modules/6/7#javascript_compat... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get Bitters working in Jekyll?<p>I have been using Bourbon and Neat in Jekyll with no problems. I am now trying to add Bitters to the mix, but am havi... | <p>Be sure to <code>gem install bitters</code></p>
<p>Uncomment the <code>@import 'base/base';</code> in <code>_sass/base.scss</code></p>
<p>Then</p>
<pre><code>cd _sass
bitters install
cd ..
jekyll serve
</code></pre>
<p>Works perfect here on Ubuntu 14.04.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Git push and pull from different repo<p>My colleague and I are working on a project. However, he is the main person in-charge of the project and I am develop... | <p>You can't do that, point 2) go in conflict with 1) and 3).</p>
<p>The best solution for this kind of problem was this:</p>
<ul>
<li><p>Push your project code on the main project repo.</p></li>
<li><p>Create a branch and develop on your project directory that is contained in the main project.</p></li>
<li><p>When y... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is wrong with my CSV import code in Django?<p>I have overridden my admin change_list.html</p>
<pre><code>{% extends "admin/change_list.html" %}
{% blo... | <p>Use the <code>{% url %}</code> tag in the link code:</p>
<pre><code><a href="{% url 'importcsv' %}" class="grp-state-focus addlink">Import CSV</a>
</code></pre>
<p>If you want to use single template for multiple models then <code>change_list.html</code> has the <code>cl.opts</code> context variable whi... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Spring boot JPA insert in TABLE with uppercase name with Hibernate<p>i have a table entity mapped as : </p>
<pre><code>@Entity
public class ItemsToRegister ... | <p>On hibernate 5, it would be </p>
<pre><code>spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
</code></pre>
<p>in your <strong>application.properties</strong> file. </p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
java bindingResult hasError function<p>I have a bean that have some attributes with annotations for certain fields.<br>
I use this bean two times <br>
The fi... | <p>It's possible to create a custom spring validator so you can determine witch attributes should be validated:</p>
<pre><code>@Controller
public class MyController {
@Autowired
private MyFormValidador formValidador;
@InitBinder
private void initBinder(WebDataBinder binder) {
binder.setValida... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
No Provider for NgControl in sub component of Angular app<p>I've installed & am able to use the <em>QuillModule.QuillEditorComponent</em> perfectly fine ... | <p>I guess you need to add the provider as well,</p>
<pre><code>providers: QuillModule.forRoot().providers
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to make a var go from x to y and then back from y to x and always repeat the process<p>Well, I'm looking to apply some functionality to my code, first i'... | <p>The main problem lies in: x < 10 ? x++ : x--. When 9 is incremented to 10, 10-- = 9. Then, when 10 is decremented to 9, 9++ = 10, which means, it will become: 9 10 9 10 9 10 9....</p>
<p>In this case, having the boolean value to dictate this whole process works.</p>
<p>Moreover, printf("Var %d Xy to Yx: %d\n"... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can CSS make a grid of photos remain centered as numbers of rows are reduced?<p>Best to use the analogy of text aligned left but wanting it to align center i... | <p>Try using margin:0 auto on your container and make your container fit content instead of 100% width:</p>
<pre><code>.container {
max-width:1140px;
min-width: 375px;
width: fit-content;
margin: 0 auto;
text-align: center;
}
</code></pre>
<p>The trick? <code>margin: 0 auto;</code> centers a block element h... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
The app is crashing when I navigate while going back using pop()<p>Initially, the app was working fine, after which I created a <code>custom stack</code> ove... | <p>I was passing the wrong object. <code>{{...this.panHandlers}}</code> instead of <code>{ ...this.panHandlers}</code></p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>class Cu... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Jackson ObjectMapper - does changing configurations on ObjectReader impact usage of ObjectMapper by multiple threads<p>We have a Spring based application and... | <p><strong>Short answer:</strong> No, <code>ObjectReader</code> configuration does not change the underlying <code>ObjectMapper</code> configuration.</p>
<p><strong>Explanation:</strong> If you use the <code>ObjectMapper</code> directly and alter the configuration of the mapper it can lead to problems if the mapper is... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MySQL Left Join add doesn't exists rows to result<p>I have this two tables:</p>
<p><strong>Users</strong></p>
<pre><code>uID | NAME |
1 | N1 |
2 | N2 ... | <p>Getting all users with report date could be done as</p>
<pre><code>select
u.*
from users u
join raports r on r.user = u.uID
where r.date = '2015-02-16'
</code></pre>
<p>Getting users who are not in that report date could be done as</p>
<pre><code>select
u.* from users u
left join raports r on r.user = u.uID and ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Install VS.NET Extension from Command Line<p>Is there any way to install a VS.NET extension from the command line? I'm working on setting up development VMs... | <p>You can use VSIXInstaller to automate extension installation:</p>
<p><img src="https://i.stack.imgur.com/DvEvw.png" alt="enter image description here"></p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Custom menu for mobile<p>I have a navigation like so:</p>
<pre><code><nav id="menu">
<ul>
<li><a href="/preview/">Home&l... | <p>There is a simple, and very good solution to do this <a href="http://www.tutorialrepublic.com/codelab.php?topic=bootstrap&file=dropdowns-within-navbar" rel="nofollow">HERE</a>, with <a href="http://www.tutorialrepublic.com/twitter-bootstrap-tutorial/bootstrap-dropdowns.php" rel="nofollow">THIS</a> detailed expla... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
creating an object based on some conditions in django<p>I have a model called <code>Showcase</code> that users use to showcase projects. I am trying to imple... | <p>As the error said, you need to provide value for <code>user</code> attribute in model here. So you can do it like this.</p>
<p>First, update the serializer:</p>
<pre><code>class CollaboratorSerializer(serializers.ModelSerializer):
post = serializers.SlugRelatedField(read_only=True, slug_field='slug')
clas... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Android Custom Dialog Fragment callback not being called<p>So in my app i'm in need of using several confirmation dialogFragments of the same type, basically... | <p>Obviously, there was something missing. I was not calling the callback inside my DialogFragment class!</p>
<pre><code>@OnClick({R.id.positiveButton, R.id.negativeButton})
public void exit(View view){
switch(view.getId()){
case R.id.positiveButton:
if(positiveCallBack == null)
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Power a large number with a large number then mode the result<p>I need to compute <code>r = g</code><sup><code>k</code></sup><code>mod p</code> where both <c... | <p>You can take a look at the <a href="https://msdn.microsoft.com/en-us/library/system.numerics.biginteger.modpow%28v=vs.110%29.aspx" rel="nofollow">BigInteger.ModPow</a> method. <a href="https://msdn.microsoft.com/en-us/library/system.numerics.biginteger(v=vs.110).aspx" rel="nofollow">BigInteger</a> can represent arbi... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SQL: from predicate logic to SQL SELECT<p>I am trying to understand how to effectively translate predicate logic to SQL Queries. I am stuck at:</p>
<pre><co... | <p>Find a list of people who know people that they don't also like. Then select from Persons where they are not in that set.</p>
<pre><code>SELECT FROM Persons
WHERE Persons.ID NOT IN (
SELECT Knows.PersonA
FROM Knows LEFT JOIN Likes
ON Knows.PersonA = Likes.PersonA
AND Knows.Perso... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MATLAB fzero in JAVA using JOM<p>I am trying to reproduce the result of the fzero's MATLAB function in JAVA.
After searching around, I found the library JOM(... | <p>I think that there is an issue here that you have not though about. If you think about it again you would see that minimum of the equation is really at 0.0 in the interval [0,Double.MAX_VALUE). This because the function is monotonically increasing and start with its minimum value -100. To solve the equation you need... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Testing ping and server availability swift<p>For example, there's a site named site.com. I need to check if the site can be loaded and test the ping to the s... | <p>You can use an Objective-C library called <code>SimplePingHelper</code> from Chris Hulbert. It uses the Apple Code "<a href="https://developer.apple.com/library/mac/samplecode/SimplePing/Introduction/Intro.html" rel="nofollow">SimplePing</a>". You can find it on this <a href="https://github.com/chrishulbert/SimplePi... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Forgot Password code: Objective C<p>I'm building an iOS app and I need to provide a forgot password function. I have a db that stores registered users and th... | <p>Change:</p>
<pre><code>@"Your Password is:"
</code></pre>
<p>to:</p>
<pre><code>[NSString stringWithFormat:@"Your Password is: %@", [self.theuser valueForKey:@"password"]]
</code></pre>
<p>You can also change this:</p>
<pre><code> if ([[self.theuser valueForKey:@"password"] > 0 ]) {
</code></pre>
<p>to this... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Conversion error from string to unsigned char<p>I am working on opencv. I am reading color values(in the form: 123,32,123) from a text file. I need to insert... | <p>"Error Reference to type 'const value_type' (aka 'const unsigned char') could not bind to an lvalue of type 'unsigned char *'"</p>
<p>You have a vector of unsigned chars, whose <code>push_back()</code> method only takes unsigned chars, whereas you are trying to push back an unsigned char <em>pointer</em>. If you re... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Getting specific ids from Indexeddb<p>In my project I'm using browser's indexed-DB and I would like to retrieve some objects from the db with specific ids. A... | <p>Getting multiple objects by keys in 1 go is possible by using a cursor.</p>
<p>The keys need to be sorted.</p>
<pre><code>var keys = [91,819,34,24,501].sort(function(a, b) {
return a - b;
});
var results = [];
var i = 0;
var cursorReq = store.openCursor();
cursorReq.onsuccess = function(e) {
var c = e.target... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Expanding a div tag from a button click does not work<p>Below is my code </p>
<pre><code> <div class="card card-inverse card-primary ">
... | <p>You Can Try This Code:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function() {
var showChar = 80;
var ellipsestext = "...";
var moretext = "mor... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I am having an issue with an array of integers; it is hard to explain<p>I'm having trouble with this part of a program where i need to convert from a specifi... | <p>Couple issues:</p>
<pre><code>int len = sizeof(intArr1); // this line returns the number of
// bytes the array occupies (800 in your case)
for(i=0;i<len;i++)
{
printf("%d", intArr1[i]);
}
</code></pre>
<p>The <code>sizeof</code> operation will not be appropriate for your usage.... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to know what to catch with Try/Catch Block<p>I'm simply trying to read in a text file with BufferedReader, and I'm using a <code>try-catch</code> block t... | <p>I assume either Grade.addGrade method or Grade constructor is declared to throw java.lang.Exception</p>
<p>It is also a good practice to catch java.lang.NumberFormatException when using Integer.parse method.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Data at the root level is invalid even when not using xml file<p>I am trying to run this code:</p>
<pre><code>using System;
public class Program
{
publ... | <p>If you haven't, you can create a project first using the command <a href="https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-new" rel="nofollow noreferrer">dotnet new</a>. Below creates a new console application in .NET Core. The -n parameter specifies the name of your project.</p>
<pre><code>dotnet new cons... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Rails number_field that displays whole numbers if nothing to right of decimal<p>In my rails view, I've got the following code for a number field:</p>
<pre><... | <p>you can pass previous value to :value and give it the format like this code below</p>
<pre><code><div class="input-group">
<%= f.number_field :percent, step: :any, :required => true, :class => 'percent-field', :placeholder => "Percent", :value => number_with_precision(f.object.percent,preci... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to embed a websocket pushed timer into a web page?<p>I'm learning to use Web Socket, and followed this example : <a href="https://www.pegaxchange.com/201... | <p>OK, I figured it out :</p>
<pre><code> connect()
{
try
{
this.webSocket = new WebSocket(this.getServerUrl());
// Implement WebSocket event handlers!
this.webSocket.onopen = function (event)
{
console.log('onopen :: ' + JSON.stringify(event, null, 4));
};
this... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Microsoft Graph SDK for PHP - 400 bad request - trying to get data<p>I have an Excel file added to the drive. I want to get data from it so in the first plac... | <p>You cannot use <code>/me</code> with Client Credentials (i.e Application scopes) because there is no "me". You need to specify <code>/users/{userId | userPrincipalName}</code>. </p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How paste works within a function<p>I have data frame like below </p>
<pre><code>Col1 Col2
White Orange
White Blue
Red White
</code></pre>
<... | <p>That function doesn't know anything about columns. It is being deployed via the <code>apply</code> function which has a second argument determining whether to work on rows or columns. That function is given a single row of the dataframe as a vector and <code>pastefun</code> puts the values together using <code>coll... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to check if CTRL and SHIFT are pressed simultaneously in PyQt?<p>I found a lot of examples how to get key modifiers like <a href="https://stackoverflow.c... | <p>My Python is rusty but try
<code>if (modifiers & QtCore.Qt.ControlModifier) and (modifiers & QtCore.Qt.ShiftModifier):</code></p>
<p>This checks if both Control and Shift bitfields are set in <code>modifiers</code>.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to export WaveSurfer js as audio file?<p></p>
<p>I'm using WaveSurfer js for my project where we can edit an audio.
For that i use the region plugin.</p... | <p>See this <a href="https://github.com/katspaugh/wavesurfer.js/issues/419#issuecomment-265530107" rel="nofollow noreferrer">answer</a> and you can create an Audio Wav file from buffer.</p>
<p>So the code and method might be like this:</p>
<p><strong>Method:</strong></p>
<pre><code>// Convert a audio-buffer segment ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to get value of each row in php/mysql where condition is by it's category<p>i am trying to get the values of a few rows but i am only getting the value o... | <p>To fetch rows data you can use </p>
<pre><code>foreach($set as $row)
{
// get values here
}
</code></pre>
<p>Or call <code>MoveNext()</code> before reading another record.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Graphviz syntax shortcuts<p>Writing huge graphs in Graphviz is tedious. One day I will write my graphs in a custom format, which I will then transform into <... | <p>The <a href="http://www.graphviz.org/content/dot-language" rel="nofollow">dot language</a> allows default attributes for <code>graphs</code>, <code>nodes</code> and <code>edges</code>. These default attributes are valid for any new graph/node/edge defined after the default attributes, or until other default attribut... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I get refresh token for Google Oauth 2.0 in my Angular Application?<p>I have already found a way to generate access token using ng-gapi, but is there ... | <p>Have you found the solution for this issue?
I have been stocked with a similar problem. According to <a href="https://developers.google.com/identity/protocols/oauth2/web-server#exchange-authorization-code" rel="nofollow noreferrer">Using OAuth 2.0 for Web Server Applications (Step 5)</a> article, we can get a refres... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I keep the layout of my display when switching from "portait" to "landscape"<p>I have the following problem.
I am developing android app. My problem i... | <p>You have an ImageButton with scaleType set on fitXY, and that's what is causing the strange effect. Just try to not use the scaleType, or try out different values, until you find the one that fits your needs the better. You can read more on scale types here: <a href="https://developer.android.com/reference/android/w... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Recursion to print all paths in a matrix<p>I came across a solution <a href="https://stackoverflow.com/questions/19883097/java-path-from-top-to-the-bottom-of... | <p>A copy of the path so far is created and passed in the first recursive call so that further entries can be added to the path. We do not need to pass it in the second call as whatever entries will be added as a result of second call are part of the first call's path. </p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Output file in Azure-automation script<p>I'm adapting a powershell script I have at work for use in Azure-automation, which outputs 3 different CSV files. I'... | <p>Probably the easiest option is to continue writing the file as you are now, then after the file is written have your Powershell code upload it to Blob storage using <strong>Set-AzureStorageBlobContent</strong>. See <a href="https://savilltech.com/2018/03/25/writing-to-files-with-azure-automation/" rel="nofollow nor... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
error in below code using external tables<p>When I run the below code, it's giving me the following error:</p>
<blockquote>
<p>ORA-00905: missing keyword<... | <p>You need to include escaped quotes around the comma separator value:</p>
<pre><code>FIELDS TERMINATED BY '''||','||'''
</code></pre>
<p>or slightly more simply:</p>
<pre><code>FIELDS TERMINATED BY '',''
</code></pre>
<p>and also around the file name:</p>
<pre><code>LOCATION ('''||v_file||''')
</code></pre>
<p>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to set up page template to redirect to it after Devise sign up?<p>After sign up I want to redirect to a custom page with something like:</p>
<p><strong>... | <ol>
<li><p>Place the page wherever you want; wherever it makes the most sense in your application. (It could be a method and view associated with the new registrations controller you need to create, but it doesn't have to be)</p></li>
<li><p>Yes, you'll need a route for it - just as you would with any other page.</p><... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get element ID of dynamically created div from on array using Java Script<p>I have created dynamic divs based on an array with ID.</p>
<pre><code>NewArray =... | <p>The following simple loop helps me to resolve this issue.
thanks for your answers, based on that i got this thought. </p>
<pre><code>for(i=0; i < newArray.length; i++;)
{
var x = document.getElementById("Parity"+newArray[i].parity);
x.appendChild(taskCont);
}
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Task in same airflow DAG starts before previous task is committed<p>We have a DAG that as first task aggregates a table (A) into a staging table (B).
After t... | <p>You can achieve this goal by setting <code>wait_for_downstream</code> to <code>True</code>.</p>
<p>From <a href="https://airflow.apache.org/docs/stable/_api/airflow/operators/index.html" rel="nofollow noreferrer">https://airflow.apache.org/docs/stable/_api/airflow/operators/index.html</a> :</p>
<blockquote>
<p>w... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Logging queued connections<p>I am using a complex state engine system build with Qt 5.4 (using custom state engine classes).</p>
<p>Part of that code is log... | <p>There is no official API that allows to do what I intend. </p>
<p>Inspecting QMetaCall events (using private framework headers) is a bad idea. First they are private (and may break your code any time) second the QMetaCall event sender() pointer may be invalid if sender was deleted immediately and I could not find a... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to "remove" an element from an array of strings<p><em>Read a lot of different answers but couldn´t find a way to fix this, so here I am with yet a "how-t... | <blockquote>
<pre><code> for(i=position-1; i< placering-1; i++)
{
toDolist[i] = toDolist[i+1]; // wrong: cannot assign to an array
// toDolist[i] is an array of 30 characters
}
</code></pre>
</blockquote>
<p>You want</p>
<pre><code> for (i = position - 1;... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python: Click by coordinate inside a window<p>The goal of the program i'm trying to write is a bot that can click and play flash games and press keys inside ... | <p><a href="https://code.google.com/p/pywinauto/" rel="nofollow noreferrer">pywinauto</a> is even simpler, but it may not recognize Flash controls. The code should just look a bit shorter: </p>
<pre><code>import pywinauto
app = pywinauto.Application().connect(path='process_name.exe')
app.MainDialog.click_input(coords=... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
HashiCorp Vault Database Secrets display Connection URL<p>Following:</p>
<p><a href="https://www.vaultproject.io/docs/secrets/databases/mysql-maria/" rel="n... | <p>if you don't mind me asking, could I ask why you need the connection_url. If it is to provide to an application for config you can potentially use Vault template?</p>
<p><a href="https://www.vaultproject.io/docs/agent/template/" rel="nofollow noreferrer">https://www.vaultproject.io/docs/agent/template/</a></p>
<p>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I set max character length of filenames?<p>I am currently using the following code to remove the defined special characters and white spaces from any ... | <p>You can use Linq as follows:</p>
<pre class="lang-vb prettyprint-override"><code>Dim dir = "c:\myFolder"
Dim except = "[!@#$%^&*()_ ]".ToArray
For Each file As FileInfo In files
Dim maxLen As Integer = 26 - file.Extension.Length
Dim newPath = Path.Combine(dir,
$"{New String(Path... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to upload and deploy zip file to AWS elastic beanstalk via CLI?<p>I do not want to use the console. No manual processes. I need a command line version, s... | <p>I don't think <code>eb</code> CLI supports uploading a ZIP and updating an environment but you can use a combination of AWS CLI commands.</p>
<ol>
<li>Upload the ZIP to S3</li>
<li>Create an application version</li>
<li>Update the environment</li>
</ol>
<p>Example,</p>
<pre><code>aws s3 cp deploy.zip s3://mybucke... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
absolute or fixed positioning not working with bootstraps and css<p>I have a page which is divided into two left and right columns. Am using bootstraps 3.</p... | <p>Give a position to <code>img</code> instead of <code>col-sm-5</code>.</p>
<p>Try This:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html l... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Yii2 Events: How to add multiple event handlers using behavior's events method?<p>Here is my Behavior's class <code>events()</code> method. When I trigger an... | <p>You can override Behavior::attach() so you can have something like this in your UserBehavior and no need of your events()</p>
<pre><code> // UserBehavior.php
public function attach($owner)
{
parent::attach($owner);
$owner->on(self::EVENT_NEW_USER, [$this, 'anotherOne']);
$owner... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Java Basic Game<p>I'm tryin to develop a small text-based fighting game and I'm using eclipse to help me out. I have two classes a Hero and Villian. </p>
<p... | <p>The best way to solve this problem is to use inheritance.</p>
<p>You want to have one class called <code>Entity</code> which holds everything all things need on the game field:</p>
<pre><code>public abstract class Entity {
private int Health;
private int attackDmg;
public Entity(int health, int attac... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ViewPager setOffscreenPageLimit<p>My <code>ViewPager</code> with <code>setOffscreenPageLimit(3)</code> is retarding when user scrolling fragments. I was set ... | <blockquote>
<p>Also 36% of time is going on Typeface.nativeCreateFromAsset()</p>
</blockquote>
<p>Did you write <code>RobottoRegularTextView</code>? If yes, fix it to use a single <code>Typeface</code> rather than creating new ones for each instance of the widget. If not, switch to some other library for providing ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MySQL bulk insert on multiple tables<p>I have a MySQL database with 2 tables <code>products</code> and <code>product_variants</code>. A product has many prod... | <p>Finally, I've used a strategy that uses the MySQL function <code>LAST_INSERT_ID()</code> like @sticky-bit sad but using bulk insert (1 insert for many products) that is much faster. </p>
<p>I attach a simple Ruby script to perform bulk insertions. All seems works well also with concurrency insertions.</p>
<p>I've ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Recompile AngularJS nested directive<p>Is it possible to manually recompile a directive nested inside another directive?</p>
<p>I have a <code>modal-create-... | <p>It is quite rare that a directive requires recompiling. This could be indicative of a wrong approach or design.</p>
<p>Directives react to data. Typically, data is passed to a directive via attributes, or broadcasted events, or a shared service with the controller. Specifically, isolate scope uses one- and two- way... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MySQL select records with multiple joined objects with the same field value<p>Apologies for the title; my question is much clearer with the specific example.... | <p>If a user has no addresses at all they should be omitted yes?
In that case I'd favor something like:</p>
<pre><code>SELECT People.ID, People.Name,
SUM(IF(Addresses.Address_Status = 'I', 1, 0)) AS InactiveCount,
SUM(IF(Addresses.Address_Status != 'I', 1, 0)) AS ActiveCount,
FROM People JOIN Addresses ON Addresses... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Loading text content in background for reusable cell<p>I'll jump right to it.</p>
<p>I have a cell with a titleLabel that prints a code and a detailTextLabe... | <p>The other answers in here are good suggestions, but don't hit the root issue that you're having. Since you've already identified that you need to decode data asynchronously, now you need to figure out how to cancel that operation when you reuse that cell. I would venture a guess that the following method:</p>
<pre>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
JavaScript prototype constructor called only once<p>My javascript class prototype constructor is called only once for all my instances, instead of once per i... | <p>You should not set the Child.prototype with an instance of Parent; especially if you don't re use the Parent constructor (Parent.call(this,...) in Child). All explained in detail here: <a href="https://stackoverflow.com/a/16063711/1641941">https://stackoverflow.com/a/16063711/1641941</a>
and here:
<a href="https://s... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to catch error when program crash?<p>How to catch error when program crashes?</p>
<p>Example - Java when crash writes an error log to file.</p>
<p>I wr... | <p>Though it is <em>undefined behavior</em>, you can use this if you're getting segmentation fault.</p>
<pre><code>#include <signal.h>
#include <stdio.h>
void Segfault_Handler(int signo)
{
fprintf(stderr,"\n[!] Oops! Segmentation fault...\n");
}
int main() {
signal(SIGSEGV,Segfault_Handler);
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to show/hide links according to Switch in NetLogo<p>I'd like to show/hide a breed of links according to the value of a Switch in the UI. I know how to sh... | <p>Adding another "forever" button would be an overkill. There is another solution, but it changes your user interface. </p>
<p>I suppose you have a switch control named <code>show-diffusions?</code> which is automatically a global variable in NetLogo. Instead of that switch control create a global variable <code>show... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
solr shema not considered inside dataset<p>I am struggling to add another data field to my shema.</p>
<p>the entry looks correct:</p>
<pre><code><field ... | <p>restart the Solr server after changing schema and then</p>
<p>you should see the field through solr tool ... if not then you are not changing the correct schema.xml file</p>
<p>As you made the "required" attribute is false.</p>
<p>and the meaning of it is </p>
<p>required : Solr will reject any attempts to add a... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to use a variable in an aggregate query in mongoose/node.js<p>I've got a very basic Mongoose aggregate query</p>
<pre><code>Transaction.aggregate().matc... | <p>Javascript uses plus signs for concatenation, not periods.</p>
<p>Assuming <code>field</code> is a string like <code>currencyFrom</code>, replace</p>
<pre><code>_id : '$' . field,
</code></pre>
<p>with</p>
<pre><code>_id : '$' + field,
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to find record with integer value instead of string<p>I have <strong>column field as string</strong> for ex. start_age("20") and end_age("40").</p>
<p>N... | <p>Do write :</p>
<pre><code>User.where("start_age::integer <= :age AND end_age::integer >= :age", age: age)
# or equivalent
User.where(":age BETWEEN start_age::integer AND end_age::integer", age: age)
</code></pre>
<p>Here is some <em>demo</em> :</p>
<pre><code>test_dev=# select 20 between '1'::integer and '... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Reverse of datetime.weekday()?<p><code>d</code> : <code>Datetime</code> object</p>
<p>Given a date <code>d</code> and a day of the week <code>x</code> in th... | <p>This approach gets the first day in the week and goes from there to find the date requested by the weekday integer:</p>
<pre><code>import datetime as dt
def weekday_in_week(d,weekday=None):
if not weekday:
return None
week_start = d - dt.timedelta(days=d.weekday())
return week_start + dt.t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.