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:
indescribable behavior of curly brackets<p>This is my code:</p>
<pre><code><script src="jquery-1.11.3.js"></script>
<script>
$(docume... | <p>You're missing a <code>"</code> character after <code>"red 2px solid</code>. Add that in and it'll be fine.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Finding double bookings<p>I have two tables which when linked by a booking ID from table 1 and ID from table 2</p>
<p>Therefore </p>
<pre><code>Table 1 con... | <p>If I understand correctly, you need the member id from the first table and then you are just looking for overlaps:</p>
<pre><code>with t as (
select t2.*, t1.memberid
from table2 t2 join
table1 t1
on t2.id = t1.bookid
)
select t.*
from t
where exists (select 1
fr... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Change bluetooth mac address in Raspbian<p>hi i need to change the bluetooth mac address from my device. i've download the bdaddr utility from <a href="http:... | <p>The bdaddr utility is not part of the bluez package because it uses manufacturer specific code and as such does not work on all devices.</p>
<p><a href="http://ubuntuforums.org/archive/index.php/t-925611.html" rel="nofollow">http://ubuntuforums.org/archive/index.php/t-925611.html</a></p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
UITableView is only populated after I scroll<p>I have 2 table views in 2 view controllers. When i select a cell from first screen i want to load the second t... | <p>You need to reload the <code>UITableView</code> once your asynchronous request has completed. Currently you push the UIViewController onto the stack and then datasource for it gets set later on, so the cell's only get loaded once you scroll.</p>
<p>To fix this, after you set the <code>cd.categ</code> and <code>cd.c... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Linq dynamic query (Except - but SQL SERVER side)<p>I want to return records where the date column is greater than <code>DateTime.Now.AddDays(-3)</code>, but... | <p>Could be this that you need ?</p>
<pre><code> Var results = context.Entity.Where(x=> x.Type != enum.Completed ||( x.Type == enum.Completed && x.Date >=DateTime.Now.AddDays(-3)));
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
div in whole height of parent TD BUT with scrollbar<p>I've figured out a strange thing with scrollable div.</p>
<p>Firstly, I should notice this thing appea... | <p>You can use the following code:</p>
<pre><code>#boxscroll {
border: 2px solid #00f;
height: 100%;
left: 0;
max-height: 100%;
overflow: auto;
padding: 0;
position: absolute;
top: 0;
width: 100%;
}
</code></pre>
<p>and for the parent td:</p>
<pre><code><td valign="top" height=... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Type mismatch when call java generic Java method from Scala code<p>I have a n-quantity of Java classes with one superclass - data model.
The list of the clas... | <p>The issue is that the type of <code>AvroHelper.deSerializeAvroObject(record.value, cl)</code> is <code>SpecificRecordBase</code> (<code>_ <: SpecificRecordBase</code> is only allowed in type <em>parameters</em>, not here). The fix is to extract a helper function:</p>
<pre><code>def processClass[A <: SpecificR... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to preload i18n in advance before page load in react?<p>I am having an issue with preloading I18n in advance, so that the user is not able to see the int... | <p>You should add preload event to your link on mouseEnter event</p>
<pre><code>i18next.loadNamespaces('anotherNamespace', (err, t) => { /* ... */ });
</code></pre>
<p><a href="https://www.i18next.com/principles/namespaces" rel="nofollow noreferrer">Source</a></p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Arduino BLE Project (esp32)<p>I want to make a device project that perform to receive data(device id) continuously from another four BLE(esp32 module). Can I... | <p>A BLE device can have multiple connections, so one should be fine.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
resolved - Sort by A...Z,AA<p>I am in a similar case. despite many tests I find the same as Haleemur Ali my problem is that I need to sort in descending orde... | <pre><code>SELECT * FROM table
ORDER BY LENGTH(value) DESC, value DESC
</code></pre>
<p>See the SQL Fiddle <a href="http://sqlfiddle.com/#!9/822e24c/1/0" rel="nofollow noreferrer">here</a>.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to add row borders and zebra stripes (row striping) to datatables DT in R?<p>I would like to know the proper way to add <a href="https://datatables.net/m... | <p>You can add the <code>stripe</code> and <code>row-border</code> class to the table container:</p>
<pre><code>library(DT)
library(htmltools)
datatable(
head(iris, 20),
container = tags$table(
class="stripe row-border",
tags$thead(tags$tr(lapply(colnames(iris), tags$th)))
)
)
</code></pre>
<p>This will... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to make <div> occupy the whole of the horizontal space<pre><code><html>
<head>
<title> Webpage </title>
</head... | <p><code>div</code> does take entire <code>100%</code> width as it is block-level element, however there is a margin/padding on body tag by default which you want to reset:</p>
<pre><code>body {
padding: 0;
margin: 0;
}
</code></pre>
<p>Also move <code>style</code> block in the <code>body</code> or <code>head</... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to test a function inside a function?<p>If I have a function like this:</p>
<pre><code>def any_function(type_name, field_name):
def another_function... | <p>For testing and debugging purposes only, put a <code>globlal another_function</code> statement at the start, but don't forget to remove it post-testing. This will make you able to debug that inner function after calling the outer function once to initialise it. Otherwise, since <code>another_function()</code> will b... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
value="#{nnController.nnDescr.descr}": Target Unreachable, 'null' returned null<p>I tried to ask question here
<a href="https://stackoverflow.com/questions/... | <blockquote>
<p>value="#{nnController.nnDescr.descr}": Target Unreachable, 'null' returned null</p>
</blockquote>
<p>This means that either <code>#{nnController}</code> or <code>#{nnController.nnDescr}</code> returned <code>null</code> and hence EL isn't able to call the setter for <code>descr</code> on it in order ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unable to switch from AWS Layer to specifying locally built editable pip3 packages when executing function<p>I'm both learning python and attempting to build... | <p>As my dependencies weren't published to pypi, I needed to modify the entries in requirement.txt to use the actual file path to the package.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Iterative calculation to find desired number<p>I am trying to use a circular reference with iterative calculations to find a specific number however my file ... | <p>In general, circular references are a result of an incorrect structure in formulas. Enabling iterative calculations is not a solution to this problem. They are only intended in situations where repeatedly performing a calculation will lead to stable result.</p>
<p>(An example of useful iterative calculations is fie... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
xampp not recognizing the paths<p>I just installed Xampp portable on a flash drive as my test environment and all services works fine. I copied my website fo... | <p>It shouldn't be an issue as long as you aren't hard coding the path. What is your directory structure (just an outline is fine) and can you give us a snipped of the code with the include request in it?</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is my default rails environment set to test?<p>Every time I run <code>rake db:migrate</code>I get the following error when I try to do anything else with rak... | <blockquote>
<p>Is my default rails environment set to test?</p>
</blockquote>
<p>No, you're <em>asking</em> rails to run your tests.</p>
<p>When you run <code>rake</code> with no arguments, it runs the default task, which with Rails means running your tests. You need to set up your test environment to run them. If... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Powershell function dispose or abort handler<p>I have a pipe function that allocates some resources in <code>begin</code> block that need to be disposed at t... | <p>It's possible to write it in C# where one can implement IDisposable - confirmed to be called by powershell in case of <code>ctrl</code>-<code>c</code>.</p>
<p>I'll leave the question open in case someone comes up with some way of doing it in powershell.</p>
<pre><code>using System;
using System.IO;
using System.Ma... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Validate OAuth 2 Access Token for Login<p>Following this <a href="http://aaronparecki.com/articles/2012/07/29/1/oauth2-simplified#browser-based-apps" rel="no... | <p>The implicit grant OAuth flow is typically used by HTML5/JS Single Page Apps that make AJAX calls directly to WebAPIs, using the access token that they receive over the fragment. </p>
<p>The JavaScript app doesn't need to validate the token - the WebAPI that it calls must. The WebAPI (if written in .net) can use th... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Typescript: Property type wildcard<p>I have a given interface which comes from another package, so I can't really change it. For the sake of simplicity, let'... | <p>Get all possible keys of <a href="https://www.typescriptlang.org/docs/handbook/advanced-types.html#mapped-types" rel="nofollow noreferrer">Mapped type</a> by <code>keyof</code></p>
<pre><code>type Keys = keyof SomeInterface;
</code></pre>
<p>Get all possible values of Mapped type by <a href="https://www.typescript... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Accessing nested data in Jekyll for loop<p>I'm having a little bit of a hard time getting my head around accessing some nested data with Jekyll. I'm hoping s... | <p><code>row</code> contains two values, the key (e.g. <code>ios</code>) and its value. So you'll need</p>
<pre><code>{% for row in site.data.prototypes %}
{% for detail in row[1].details %}
<a href="{{ detail.permalink }}" class="c-card c-card--{{ detail.category }}">
<h2>{{ detail.title }}</h2... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Getting current sorted column in DataTable<p>I remember once I used some API to get table's sorted column info but I couldn't find now. I want to find which ... | <p>Assuming your table has an id of <code>mytable</code></p>
<pre><code>var sortedCol = $('#mytable').dataTable().fnSettings().aaSorting[0][0];
var sortedDir = $('#mytable').dataTable().fnSettings().aaSorting[0][1];
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ios - How to select multiple cells in a single gesture?<p>Looking to select multiple UITableviewCells by long pressing and running my finger down to subseque... | <p>This could get tricky, but maybe I can point you down the right path.</p>
<p>First, you need a reliable way to start a long press and keep tracking the pan. You will probably need to use <code>UIPanGestureRecognizer</code> in combination with <code>UILongPressGestureRecognizer</code>, applied to the view itself (no... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Only filter my time in SQL Server where clause<p>I am new to SQL and Programming in general. I have a datetime field which I want to use to filter my results... | <p>This should do the trick, it filters out rows that do not fall in the date interval, from 7pm yesterday to 7am today.</p>
<pre><code>WHERE
createDtTm >= DATEADD(HOUR, 14,CAST(DATEADD(DAY,-1, CAST(GETDATE() AS DATE)) AS DATETIME))
AND createDtTm <= DATEADD(HOUR, 7, CAST(CAST(GETDATE() AS DATE) AS DATET... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Swift String to unsigned char [](CUnsignedChar)<p>Hello i'm trying to use an old legacy C library that uses buffers (unsigned char []) to transform the data.... | <p>If you want to convert a Swift string to an immutable C string to pass to a C function, try this:</p>
<pre><code>let s: String = "hello, world!"
s.nulTerminatedUTF8.withUnsafeBufferPointer { p -> Void in
puts(UnsafePointer<Int8>(p.baseAddress))
Void()
}
</code></pre>
<p>You may need to use <code>U... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Faster logout script PHP<p>I have login functionality in PHP and that is working perfectly fine. When i click on <code>Logout</code> then it takes around 10 ... | <p>To destroy a session, add <code>session_destroy();</code> and <code>exit;</code> after header in order to stop further execution if there's more code below that.</p>
<pre><code><?php
session_start(); // start the session
$_SESSION['logdname'] = "John";
session_destroy(); // destroy active session
$_SESSION = ar... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
AWS "state file" solution for Lambda<p>I'm using a library in lambda where a "state file" is persisted </p>
<p>This is what it looks like in code:</p>
<pre... | <p>Based on the updated information you could store the data in a number of places.</p>
<p><strong>S3</strong> would be perfectly fine, but might be overkill if this is all you're using it for.</p>
<p>The same can be said of <strong>DynamoDB</strong>.</p>
<p><strong>Parameter Store</strong> is a solid option for you... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Multiple for loop variable in vba?<p>I have the following code in VBA: </p>
<p><code>For n = 1 To 15</code></p>
<pre><code>Cells(n, 8) = Application.Combin... | <p>EDIT: after reading the comment: I think what is needed is a counter to count, 1,2,3,4,5,6...15, and another one to count 1,3,5,7...15</p>
<p>For that, here is what is need to be done:
basically, you want the first iterator to be a normal counter,
and the second iterator to be odd numbers only.</p>
<p>So here is a... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
real time online push button based counting system<p>I am doing this project:</p>
<p>I have 4 inputs. These are push buttons, connected to a microcontroller... | <p>To solve this using an MPU like an RPi via the Internet, its pretty trivial. To do this:</p>
<ol>
<li>Wire your switches to the GPIO inputs on the Pi. This is a trivial example: <a href="http://razzpisampler.oreilly.com/ch07.html" rel="nofollow">http://razzpisampler.oreilly.com/ch07.html</a></li>
<li>When the state... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to re-render a child DOM element that has been deleted within a React component?<p>I have the following React component. The top-level component is <code... | <p>You need to use <a href="https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver" rel="nofollow noreferrer">MutationObserver</a>. Here's how I did it - some code with notes for each step:</p>
<pre class="lang-js prettyprint-override"><code>import React, { useState } from 'react';
// Transfer to class co... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Deleting a record older than 6 years in Oracle<p>I have been trying to delete a record that is older than 5 years. I am using sql developer and using this qu... | <p>To do this in Oracle you'd use:</p>
<pre><code>DELETE FROM TBLPATIENT
WHERE DISCHARGE_DATE + INTERVAL '4' YEAR < SYSDATE;
</code></pre>
<p>It might be more efficient to avoid adding a literal to every DISCHARGE_DATE in TBLPATIENT; thus, the following might be worth a try:</p>
<pre><code>DELETE FROM TBLPATIEN... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
sort matrix independently with their corresponding name<p>I have a matrix like below </p>
<pre><code>Name A B C D F
11... | <p>You could try</p>
<pre><code> lst <- Map(function(x,y,z) setNames(data.frame(y,x)[order(-x),],
c('name', z)), df1[-1], list(df1[1]), names(df1)[-1])
names(lst) <- NULL
lst
#[[1]]
# name A
#3 CC 30
#2 BB 20
#4 DD 5
#1 AA 1
#[[2]]
# name B
#4 DD 803
#3 CC 6
#2 BB ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What are the possible data types for canvas' toDataURL() function?<pre><code>canvas.toDataURL(type, encoderOptions);
</code></pre>
<p><a href="https://devel... | <p>Browser support for image output formats is largely implementation dependent. Here's <a href="https://html.spec.whatwg.org/#a-serialisation-of-the-bitmap-as-a-file" rel="noreferrer">the most relevant sentence in the WHATWG living standard</a>:</p>
<blockquote>
<p>User agents must support PNG ("<code>image/png</co... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Picking the right test project<p>I have been learning C# for one and a half year and I also learn Java from time to time. I don't have much experience yet an... | <p>Microsoft has it's own test framework, aptly named 'MSTest', which is a simple and easy way to get started. OFten, you'll see complaints from people who find it slow, however, a few tweaks to the settings here & there, and you'll find it performs briliantly. </p>
<p>However, there are more popular test framewor... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Metaflow - AWS batch task fails after deleting conda folder from S3<p>I am using <a href="https://github.com/Netflix/metaflow" rel="nofollow noreferrer">Meta... | <p>@kanimbla metaflow maintains a manifest folder <code>.metaflow</code> either in the same directory as your flow or in one of the parent directories. Deleting it resets your flow's dependencies.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Need help adding background color to drop-down menu on Bootstrap theme<p>EDIT: </p>
<p>I resized the drop-down menu bar, removed the borders & added a b... | <p>if u want the menu size in half and positioned it under the title,</p>
<p>i just added a little code from @Shanice Morgan</p>
<pre class="lang-css prettyprint-override"><code>@media screen and (max-width:768px){
.navbar-nav{
background-color:gainsboro;
border:blue 2px solid;
float:left; /* left side ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
and (&&) logic in swift<p>I have problem with the (&&) logic in swift, I don't understand why the compiler deal with 'and' logic as 'or' logic, I ent... | <p>You want to show an alert if any of the fields is empty, right?</p>
<p>You need 'or', not 'and'.</p>
<pre><code> if txtAddressNickname.text!.isEmpty ||
txtArea.text!.isEmpty ||
txtHouseNo.text.isEmpty ||
txtAddressType.text!.isEmpty ||
txtStreet.text!.isEmpty ||
txtHouseNo.text!.isEmpty |... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can't set percentage height of an element whose parent element has a min-height set to 100%<p>So I did a little research, and it turns out this issue has be... | <pre><code>add following css
#content_parent {
min-height:100%;
max-width:1250px;
min-width:750px;
box-shadow:0 0 10px 2px rgb(100, 100, 100);
height:100%; /* add this */
}
</code></pre>
<p><a href="http://jsfiddle.net/0c1koxsc/1/" rel="nofollow">Demo</a></p>
<p>Edit after comment</p>
<p>remove ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Excluding unit tests only on specific platform<p>My scenario is as follows:
I'm working on a cross-platform mobile app with Xamarin.Forms. Part of this solut... | <p>Can you not use <a href="http://xunit.codeplex.com/workitem/9728" rel="nofollow">traits to achieve this</a>?</p>
<p>ie add a trait which specifies that the tests shouldn't be run on windows then you can execute only tests which don't have this trait in visual studio using whatever test runner you are using.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Code that is able to search for a string in a text recursively<p>I have a code which satisfies the question above. However, I am personally curious on how to... | <p>Great question. Given the constraint of a <em>recursive</em> function, in layman's terms, what you want to achieve is a sliding-window search on a string.</p>
<p>That is to say, that when you pass your 'text' into the find function, you do not pass it as an array, you pass the text itself.</p>
<p>The 'find' functi... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using insert into where not exists in VBA<p>I have a lovely form and a lovely table in MS access (I promise). I would like to insert into this table at the p... | <p>Well instead of using a SubQuery, you could use a Domain function to get this going,</p>
<pre><code>If Dcount("*", "tbl_MAP_systemTask", "TaskID = " & taskID & " AND SystemID = " &sysID) = 0 Then
strSQL = "INSERT INTO tbl_MAP_systemTask (TaskID, SystemID) " & _
" VALUES (" & tas... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Disregard mathematical precedence in MATLAB<p>Does anyone have any idea about how to make MATLAB take in a string suppose </p>
<p>f(x) = 3*x + 5*(2+100) ,w... | <p>Well, for a simple expression, one way to do it is to:</p>
<ul>
<li>strip the expression of all the parenthesis</li>
<li>split the digits and the operators</li>
<li>rebuild an expression with parenthesis constructing a strict <em>left to right</em> precedence.</li>
</ul>
<p>Of course in your case we also first hav... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Rails Query with ILIKE<p>I have written a finder as follows:</p>
<pre><code>@cars = @cars.joins(:manufacturers).where("manufacturers.name ILIKE ?", params[:... | <p>Since this is a lot similar to a slug system, you should just add a new field and call it whatever you find suitable, just don't forget to add an <code>index</code> so you don't waste time searching in strings.</p>
<p>Also you could add a <code>before_create</code> or <code>before_save</code> callback to auto creat... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Difference between $table->string('some_text'); & $table->text('some_text'); in Laravel?<p>What is the difference between:</p>
<pre><code>$table->string(... | <p>As defined <a href="https://laravel.com/docs/8.x/migrations#available-column-types" rel="noreferrer">here</a>:</p>
<p><code>$table->string()</code> uses a VARCHAR equivalent</p>
<p><code>$table->text()</code> uses a TEXT equivalent</p>
<p>(The actual types can depend on the database system)</p>
<p>The obvious ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Compare keys with llist of values Java<p>Assuming the <code>TreeMap<String,List> one</code> and its copy as bellow,
i want to compare all keys in the ... | <p>What I understand from your problem is to get key which are not there in values and its value also. I think there is no need to create copy of it. I am posting a code snippet, I think this will certainly help you </p>
<p><code>Map<String, List<String>> map = new HashMap<String, List<String>>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Rails 4 - How to select data from a table if in another table is not a specific record?<p>I have this model schedule:</p>
<pre><code>class Question < Act... | <p>You may want to try something like this:</p>
<pre><code>user = User.find(1)
Question.where.not(id: user.closed_questions.pluck(:question_id))
</code></pre>
<p>Note that prior to Rails 4 you might see this written as:</p>
<pre><code>user = User.find(1)
Question.where("id NOT IN (?)", user.closed_questions.pluck(:q... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Having trouble implementing random background images<p>I'd like to get this random background image coding to work: <a href="http://css-tricks.com/snippets/p... | <p>Your file at <a href="http://agentboris.com/newwebsite/index.html" rel="nofollow">http://agentboris.com/newwebsite/index.html</a> is in .html, it should be in .php for you be able to use php code from tutorial.</p>
<p>Try with this simple code (don't forget to save your index file as php extension):</p>
<pre><code... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Should AngularJS web services return a deep copy of a response?<p>I have a long-polling web service. Recent response is cached. Web service notifies subscrib... | <p>At first glance, I think this looks like a case where you need to look broader on the usage.</p>
<p>What is this service providing. It is read-only data or is the service also responsible on managing modifications to the data? Once you answer that, it might be easier so see how you should handle it.</p>
<p>But the... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Delete the last character when a key is pressed on a textbox C#<p>I'm trying to block the user press the same key (by example if the user have "asd" in a <co... | <p>Try <code>KeyPress</code> event (so we have <code>char</code> to operate with, not <em>key</em> which can be, say, <em>left shift</em>) and <code>Handled</code> in order to prevent user input (WinForms example):</p>
<pre><code>private void myTextBox_KeyPress(object sender, KeyPressEventArgs e) {
TextBox box = sen... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Add custom Symfony console commands to Doctrine ORM<p>I am working on a simple todos application that runs in the console. The application has only two depen... | <p>You shouldn't edit anything in the <code>vendor</code> directory. <code>vendor/bin/doctrine</code> should only have to commands that are coming with the Doctrine packages.</p>
<p>If you want to have custom commands, you should create a new executable file (e.g. <code>bin/my_app</code>) with the code that you showed... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Identify the size of the address assigned to the pointer<p>In my code below:</p>
<pre><code>#include <stdio.h>
#include <stdlib.h>
#include <... | <p>You can use </p>
<pre><code> length = strlen(point_to_text);
</code></pre>
<p>String Literals in C means a ASCII character codes stored at consecutive memory location terminated by null char(\0). </p>
<p><code>strlen()</code> expects the input to be a pointer to a constant char string terminated by null char(0... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
postgres select returning no records when a function does not return anything<p>I am having a hard time wording this question--</p>
<p>i have this simple se... | <p>Don't use the function in the SELECT list, use it like a table with an outer join:</p>
<pre><code>SELECT q.qid, q.question, depth, active, g.qid parent
FROM q
JOIN qp ON q.qid = qp.descendant
LEFT JOIN getprevquestiontemp(qid) as g(qid) ON true
where qid=723
order by depth
</code></pre>
<hr>
<p>Unrelated,... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
keep zoom while user interaction matlab<p>Here's my problem: I have an axes object in a figure.
The user can draw a bunch of points on the image.
Up to thi... | <pre><code>% Saving zoom level
xlim = get(handles.axes, 'XLim');
ylim = get(handles.axes, 'YLim');
% Displaying image
imagesc(im, 'Parent', handles.axes, 'ButtonDownFcn', @axes_ButtonDownFcn);
% Setting saved zoom level.
set(handles.axes, 'XLim', xlim);
set(handles.axes, 'YLim', ylim);
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
GtkWarning: Modulpath »clearlooks« no Themen-Engine found<p>German error-message:
GtkWarning: Im Modulpfad »clearlooks« konnte keine Themen-Engine gefunden ... | <p>On (K)Ubuntu you need only to do: </p>
<pre><code>sudo aptitude install gtk2-engines
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Dealing with NAs after running pivot_wider<p>I have a long dataframe that I want to make wide using <code>pivot_wider</code>:</p>
<pre><code>library(tidyr)
... | <p>One way would be to create a dummy column with <code>TRUE</code> values and then use <code>pivot_wider</code>. </p>
<pre><code>library(dplyr)
library(tidyr)
example_data %>%
mutate(val = TRUE) %>%
pivot_wider(names_from = sport,values_from = val,values_fill = list(val = FALSE))
# A tibble: 3 x 5
# nam... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Neo4j best way to model a timeline<p>There is a blog post <a href="https://neo4j.com/blog/modeling-a-multilevel-index-in-neoj4/" rel="nofollow noreferrer">ht... | <p>Since the new temporal types can be <a href="https://neo4j.com/docs/cypher-manual/current/administration/indexes-for-search-performance/" rel="nofollow noreferrer">indexed, and also support range lookups</a>, the multi-level index approach is now obsolete.</p>
<p>For example, assuming that <code>Event</code> nodes ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Will I be able to use CURL to get HTTP/2 headers?<p>Right now I use <code>curl -I</code> to retrieve headers. </p>
<p>Will sites adopt a different way of se... | <p>Yes, you can use curl to see and send HTTP headers with HTTP/2 just as you do with HTTP/1.</p>
<p>curl supports HTTP/2 and it is implemented as a sort of translation layer. It means it shows and "pretends" that headers work 1.1 style. It shows headers as text and it sends headers in callbacks like they wer... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to connect Go application and Apache Solr?<p>I want connect my Go application and Apache solr</p>
<p>I configured apache Solr manually</p>
<pre><code>P... | <p>You can take a look at this library and see if solves your needs</p>
<p><a href="https://github.com/rtt/Go-Solr/" rel="nofollow">https://github.com/rtt/Go-Solr/</a></p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I ping a password protected Redis server using netcat in an initContainer?<p>Note: solution can use netcat or any other built-in Linux utility</p>
<... | <p>You could always send in your <code>AUTH</code> command as part of your probe, like:</p>
<pre><code>`"AUTH ....\r\nPING\r\n"`
</code></pre>
<p>Unless you're getting <code>INFO</code> from the server, you don't seem to care about the nature of the response, so no auth is required, just test for <code>NOAUTH</code>.... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to echo an image according to the value in the database?<p>I have 3 group of images, productimage, productimage2, productimage3.
Some product have image ... | <p>Quick fix:</p>
<pre><code><?php
if (!empty($product[ "productimage"]))
echo "<img class='productimg' src='img/" . $product[ "productimage"] . "'>";
if (!empty($product[ "productimage2"]))
echo "<img class='productimg' src='img/" . $product[ "productimage2"] . "'>";
if (!empty($product[ "productima... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
undefined method `albums_path'<p>I dont understand why this is happening but I am getting this error.
<code>undefined method albums_path</code> and it says ... | <p>Your <code>albums</code> resource is nested within <code>users</code> resource. Therefore you should set user in your <code>new</code> action (or, better, in <code>before_filter</code>):</p>
<pre><code>before_filter :set_user
# ...
def set_user
@user = User.find(params[:user_id])
end
</code></pre>
<p>and add use... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to get formData file by input id<p>I have formData which gets file based on input type</p>
<pre><code>formData.append('idCard', $('input[type=file]')[0]... | <p>Use an ID selector with <code>#</code></p>
<pre><code>formData.append('idCard', $('#idCard')[0].files[0]);
</code></pre>
<p>Replace <code>#idCard</code> with the actual ID of the input element.</p>
<p>You could loop over all the file inputs and append them all to <code>formData</code></p>
<pre><code>$("input[typ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Excel VBA code that moves large amounts of data from multiple ranges to columns<p>I am researching bird migration patterns and I am having trouble trying to ... | <p>Bit more involved that it seemed at first glance. I've made a few assumptions so might need some tweaking if these are not tenable:</p>
<ul>
<li>the starting workbook has only one sheet for each location, i.e. the number of sheets equals the number of locations</li>
<li>data starts in B4 on each sheet (and species ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Vue update dom every second, Simple Clock<p>I am trying to make simple clock, I created the project using <code>@vue/cli</code> and currently have two files ... | <p>You are creating a new date once and referencing this every second (it never changes) - instead, create a new reference within <code>updateClock</code> and remove the other one:</p>
<pre class="lang-js prettyprint-override"><code>methods: {
updateClock(): void {
const date = new Date(); // create a new refere... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
onFinishRender not being fired<p><a href="http://plnkr.co/edit/HG52dgInXkumOA55G1bI?p=preview" rel="nofollow">Plunker</a></p>
<p>I'm loading data into a tab... | <p>You need to add the directive to one of your repeat elements. For example, from your Plunker add <code>on-finish-render</code>.</p>
<pre><code><tr ng-repeat="data in model.DataList" on-finish-render>
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Display Data from sqLite DB into different TextViews<p>Now i have a working sqLite Database, a working Database search on a working ListView that showing the... | <p>In the <code>OnItemClickListener</code> of your <code>ListView</code>, you can create the intent to save the station ID and then start your new activity. I assume that <code>ShowStations</code> is the <code>Details Activity</code>.</p>
<p>Edit the <code>stationsListView</code> <code>OnItemClickListener</code> in yo... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Javascript show under clicked item<p>I have car names list and when user click it i want show model list under its row.But now when i click it split rows.How... | <p>You can make special container for description at the end of each row and copy it there on click.</p>
<p><strong><a href="http://jsfiddle.net/Tymek/vva4pwxq/" rel="nofollow">http://jsfiddle.net/Tymek/vva4pwxq/</a></strong>
<em>Be aware that I modified your HTML</em></p>
<pre><code>$(".row").append('<div class=... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to disconnect a signal from a slot which is a lambda?<p>Suppose the slot takes an argument, e.g.,</p>
<pre><code> self._nam = QtNetwork.QNetworkAcces... | <p>No, it's because the two lambdas are not the same object.</p>
<p>You need to pass the same reference to the <code>disconnect</code> method you used in the <code>connect</code> method. If you use an anonymous lambda function, there is no way to disconnect it other then calling <code>disconnect()</code> (whithout arg... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Which feature descriptors to use and why?<p>I do like to do compute the position and orientation of a camera in a civil aircraft cockpit.</p>
<p>I do use LE... | <p><strong>----Please stop voting this question down----</strong>
Now after having found the solution to my problem, I do realize the question might have been too generic.
Anyways to support other people googeling I am going to describe my answer.</p>
<p>With combinations of OpenCVs functions I create masks which cont... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Appending to Vector<p>I'm having trouble appending to an empty vector in Julia.</p>
<pre><code>v = Int64[]
append!(v,1)
append(v,1)
</code></pre>
<p>The ap... | <p>If you're appending a scalar value, you want <code>push!</code>. If you're adding a list of elements, then you want <code>append!</code>. There's a good reason for the distinction, as you will probably realize if you consider what should happen if you want to build an array-of-arrays.</p>
<p>Typing <code>?append!</... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Change name of file that's uploaded to GCS from AppEngine<p>I have the following code (taken from the sample code) to upload files directly to GCS but it doe... | <p>The <code>filename</code> and other metadata are in the <code>BlobInfo</code> object in the <strong>datastore</strong>, not in the <strong>blobstore</strong> per se. See <a href="https://cloud.google.com/appengine/docs/python/blobstore/blobinfoclass" rel="nofollow">https://cloud.google.com/appengine/docs/python/blo... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Ruby - Get the second most recent file from a directory?<p>I have this piece of script to acquire the most recent file in a directory</p>
<pre><code>dir=Dir... | <p>You can do as below using <strong>Ruby 2.2.0</strong>, which added an <em>optional</em> argument to the methods <code>Enumerable#max_by</code>, <code>Enumerable#min_by</code> and <code>Enumerable#min</code> etc.</p>
<pre><code>Dir.glob("./logs/*").max_by(2) {|f| File.mtime(f)}
# gives first 2 maximun.
# If you want... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to output element.style.marginTop using digits only?<p>There's an <code>elem</code> HTML element, which has a <code>margin-top: 30px</code> property.</p>... | <p>remove everything but the digits, and coerce to number</p>
<pre><code>var mtop = +elem.style.marginTop.replace(/[^0-9-.]/g, '')
</code></pre>
<p><a href="http://jsfiddle.net/adeneo/9mrard4f/1/" rel="nofollow"><strong>FIDDLE</strong></a></p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Getting AspNet Users RoleId for Comparison In permissions<p>I have a area where the RoleId is kept as a string in the permissions table. I am doing a compari... | <p>There are couple of issues in your code. After fixing the current error you will get more errors:</p>
<ol>
<li>You are assigning collection of strings to string (via string roleid). Currently you are getting this error. After fixing this error below errors will come.</li>
</ol>
<p>The reason why you are getting er... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Linq select where in list<p>I have the following class</p>
<pre><code>public class Group
{
public string Id { get; set; }
public string Name { get; ... | <p>Try:</p>
<pre><code>var lst = groups.Where(j => groupRestrict.Any(x=> j.Name.Contains(x))).ToList();
</code></pre>
<p>this would match all groups with names that contain one or more strings from the searchList.</p>
<p>Case insensitive variant would be:</p>
<pre><code>var lst = groups.Where(j => groupRes... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to apply an IN clause in Perl by passing arguments from the command line<p>I am new to Perl, and am trying to apply a filter condition on XML files using... | <p>One way to do this is to store the values that you want to keep in a hash.</p>
<p>Create the hash at the top of the script:</p>
<pre><code>my @origins_to_keep= split /,/, $ARGV[2];
my %keep= map { $_ => 1 } @origins_to_keep;
</code></pre>
<p>Use it in the handler:</p>
<pre><code>$c->delete($STOCK) unless $... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to keep connector running when QuickBooks is close?<p>When I close my QuickBooks on my machine my Web Connector stops running:</p>
<blockquote>
<p>App... | <p>Configure a hook to listen for:</p>
<pre><code>QUICKBOOKS_HANDLERS_HOOK_SENDREQUESTXML
</code></pre>
<p>The hook will pass you the company file path. <a href="http://consolibyte.com/forum/viewtopic.php?id=8047" rel="nofollow">Reference</a></p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
JavaScript accessing variables declared in calling function<p>It's hard to explain my question, so I'm posting some code.</p>
<pre><code>function caller(fun... | <p>eval seems to achieve this rather elegantly.</p>
<pre><code>function caller(func) {
function printMessage(message) {
console.log(message);
}
eval('(' + func.toString() + ')();');
}
function callee() {
printMessage('hello world');
}
caller(callee);
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Replace certain pixels by integers in numpy array<p>I have made myself a numpy array from a picture using</p>
<pre><code>from PIL import Image
import numpy ... | <p>If I understand the question correctly, you can use np.where for this:</p>
<pre><code>>>> arr = np.array(image)
>>> COLOR = [99,214,104,255]
>>> np.where(np.all(arr == COLOR, axis=-1), 1, 0)
</code></pre>
<p>This will produce a 6000*6000 array with <code>1</code> if the pixel is the sele... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using preventDefault() in Jquery and Ajax<p>I,m using PHP, Jquery and Ajax to submit user info, to validate the input fields and submit the info I use this</... | <p>No you are not required to put e.preventDefault(); since jquery validator does that for you. when the form is submitted the default action of form is prevented by the Jquery validator.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Where do invalid variables go when using JavaScript's with(){} statement?<p>When using JavaScript's with statement, where do variables that have invalid name... | <p>If a property is not a valid identifier, it can't be referenced like an identifier inside <code>with</code>. It's not inaccessible, but your only option is to look up the property on the original object manually, like normal:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babe... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
filter a list of posts accepting lowerCase or Uppercase strings<p>I intend to filter a list of posts by the title. </p>
<p>The logic is already implemented ... | <p>You can use either the toUpperCase() or toLowerCase() javascript functions :)</p>
<p><strong>Whichever function you use, be sure to apply it to both sides of the match statement.</strong> Otherwise it will not match if the non transformed side includes a mix of upper case and lower case characters.</p>
<pre><code>in... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to register a custom control in Web.config file using powershell script<p>When Nuget package for a custom control is installed, I want to register the co... | <p>Looks like you already figured out everything, but adding and removing nodes.</p>
<p>To append your new XML node, do something like this:</p>
<pre><code>$parentNode = $xml.SelectSingleNode("system.web/pages")
$childNode = $xml.CreateElement("add")
$childNode.SetAttribute("namespace", "SimpleCustomControl")
$child... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
LINQ to SQL: intermittent AccessViolationException wrapped in TargetInvocationException<p>Since a few weeks we are experiencing W3WP-crashes with our ASP.Net... | <p>I thought I would post a solution, that we found to this issue, because we started experiencing the problem recently. </p>
<p>We have many servers that run our code just fine but only 1 was crashing a couple of times a week with this error. I believe this server was on .net 4.5.2.</p>
<p>We opened a ticket with Mi... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Docker: How to solve the public key error in ubuntu while installing docker<p>I am getting the below error message when running the below command for install... | <p><strong>EDIT: This apparently does not work any more.</strong></p>
<p>Run this to add the correct key:</p>
<pre><code># Does not work any more
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
</code></pre>
<p>Source: <a href="https://docs.docker.com/install/linux/docker-ce/ubuntu/" rel="n... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to draw text through line and How to highlight the text on mouse enter using Html Canvas. Please help me<p>I can draw a line as per direction but I am no... | <p>You need to figure out how wide the text will be and that can be solved with:</p>
<pre><code>ctx.measureText(text).width;
</code></pre>
<p>Then just create a funtion that draws lines on either side of it (and a arrow head). Finish everything off with rotating the whole canvas before drawing it, like so:</p>
<p>Or... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
why can't I use partial struct initialization for a malloced struct in C<p>Apperently in C99 you can simply initialize a statically allocated struct in this ... | <p>There is a difference between struct initialization, and assignment.</p>
<p>When using heap memory, it's always assignment, since initialization only happens when you're actually declaring the instance (not just a pointer to an instance).</p>
<p>You can use <a href="https://gcc.gnu.org/onlinedocs/gcc-3.3.3/gcc/Com... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Returning Char Pointer Without Heap<p>I was working on a program and I noticed something that didn't really make a lot of sense to me. <code>std::string</cod... | <p>Pointers can point to any variable, whether on the heap or stack. <code>c_str</code> returns a pointer to the string object's internal buffer. Usually this is on the heap, however some compilers, at their discretion, may place the data of small strings on the stack instead. How do you know, though, that the returned... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Need help regarding plotting the pixel from binary images to a sparse image<p>I have a binary image and I want to plot only the foreground pixels into a spar... | <p>You don't need the x-y, if you just want to pick some subset of pixels, linear indexing is easier. The syntax <code>1:step:end</code> is a very useful way of picking out a subset of a vector or matrix. It works even if the size of the matrix is not an exact multiple of your <code>step</code>, e.g. check out at the... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Submit multidimensional arrays POST corrupt<p>I encountered a strange problem and i really don't have any idea why this happens.</p>
<p>Taking this form:</p... | <p>I found the issue.. </p>
<p>The first server was accessed via DNS redirect. <br/>
Client -> www.x.com -> www.z.com (Server). <br>
Both domains were from different companies. <br/>
The second one was accessed directly. <br/>So after calling the form on www.z.com, it worked as always.
The redirect wasn't configured a... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Do I have to split up Lodash orderby calls to make it work?<p>I'm trying to sort some data in my front-end client code but lodash is acting weird.</p>
<p>No... | <p>The second parameter should be an iterator resolving to an array of the names (strings) of the parameters to order by like so: </p>
<p><code>const sortedData = _.orderBy( data, ['isInPriceList', 'listOrder', 'name'], [ "desc", "desc", "asc"]);</code> </p>
<p>see documentation example: <a href="https://lodash.com... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Spring mvc throwing exception- IllegalStateException: Neither BindingResult nor plain target object for bean , when using form tld in jsp page<p>When i use p... | <p>You have to put bean into model before rendering the jsp.
For example, you need to declare a method below at <code>EmployeeController</code> and access the jsp through the method. </p>
<pre><code> @RequestMapping("index")
public String index(Model model) {
model.addAttribute("employee", new Employee());
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to return distance along result in two different sub values using $geoNear<p>I have this query:</p>
<pre><code>db.places.aggregate([
{ "$geoNear" :
... | <p>You can run <a href="https://docs.mongodb.com/manual/reference/operator/aggregation/project/" rel="nofollow noreferrer">$project</a> to reshape your aggregation result. <code>$$ROOT</code> represents the document that's being passed to a pipeline stage as input:</p>
<pre><code>db.places.aggregate([
{ "$geoNear"... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Multiple counts for certain values in same column with group by<p>I have an event table that run different accounts. We I need to count certain types of even... | <p>Your query is missing a <code>from</code> clause but I assume this is a typo.</p>
<p>Consider:</p>
<pre><code>select
accountId,
sum(eventType = 'start') as starts,
sum(eventType = 'stop') as stops
from ???
GROUP BY accountId
</code></pre>
<p>Rationale: <code>count()</code> takes in account all val... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to perform image segmentation of apples using Python OpenCV?<p>I have pictures of apple slices that have been soaked in an iodine solution. The goal is t... | <p>An alternative approach to segmenting the apples is to perform Kmeans color segmentation before thresholding then using contour filtering to isolate the apple objects:</p>
<ol>
<li><p><strong>Apply Kmeans color segmentation.</strong> We load the image, resize smaller using <a href="https://github.com/jrosebr1/imuti... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is going on with Args..., Args&..., Args&&<p>I have this code. To get it to work I had to use Args&&... instead of Args... or Args&... I no... | <p>When deducing a template argument <code>T</code> with an argument of the form <code>T&&</code> the type <code>T</code> will retain whether it is an lvalue or an rvalue as well as the cv-qualifiers for lvalues. That is if you pass an object of type <code>X</code> to a function declared as</p>
<pre><code>temp... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Make sliding window (size MxN) without nfilter function to do local and adaptive operation like local thresholding?<p>I need a matlab code to make <code>MxN<... | <p>This is a complete rewrite of my original post as I now know what you're trying to do. Your code does work in that you want to extract <code>M x N</code> <strong>distinct</strong> neighbourhoods, perform Otsu's algorithm on each neighbourhood, then set these neighbourhoods to an output image.</p>
<p>However, you a... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
issues trying to make rows in c program<pre><code>#include <stdio.h>
int prime(int limit,int col);
int main(){
int limit,col,count,i;
... | <p>I suggest you to make separate functions for finding primes and displaying primes, so you will have more control on displaying those primes:</p>
<pre><code>#include <stdio.h>
#include <math.h> // sqrt
int is_prime (int x);
void prime(int limit, int col);
int main ()
{
int limit, col;
printf("... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Paypal Client Website Payment Options<p>Currently we are using Paypal's REST API to setup a paypal payment process on our client's website.</p>
<p>Our webco... | <p>Your observation is correct: the REST API service does not (currently) support placing API Calls for other users. </p>
<p>Alternatives: </p>
<ol>
<li><p>Classic API: You can call the API in the name of a customer (who first needs to grant your API user access to his account) by passing the "SUBJECT=E-Mail Address... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.