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: Generic repository in Java<p>Let's say I have this class:</p> <pre><code>public class PhotoRepository { private PhotoDao db; PhotoRepository(Photo...
<p>You have to introduce a second type parameter for the <code>Repository</code> class, which will represent the dao, because <code>Class&lt;? extends AbstractDao&lt;T, ?&gt;&gt;</code> is incorrect.</p> <p>Let's call this second type parameter <code>D</code>. It will always have to be a subclass of <code>AbstractDao<...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: 0x800a0e7c - ADODB.Parameters: Parameter object is improperly defined. Inconsistent or incomplete information was provided<p>I want to execute sql queries wi...
<p>Pass in a value for the <strong>Size</strong> argument</p> <p>From the doc for <a href="https://docs.microsoft.com/en-us/sql/ado/reference/ado-api/createparameter-method-ado?view=sql-server-ver15#remarks" rel="nofollow noreferrer">CreateParameter Method (ADO)</a></p> <blockquote> <p>If you specify a variable-len...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: mask for comma separated numbers list<p>I'm trying to creat a mask for comma separated values for my inputs, but I'm having dificulties.</p> <p>Can you guys...
<p>Please, give a try to the below jquery.</p> <pre><code>//We need to capture the keypress event, as this is triggered before the value is displayed in the text box. $(document).on("keypress", ".commaseparated", function (e) { var currentValue = $(this).val(); //If the value is empty, let user enter numerals....
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how can I scroll listbox inside scrollviewer using mouse wheel<p>xaml:</p> <pre><code> &lt;ScrollViewer HorizontalAlignment="Center" PreviewMouseWheel="m...
<p>Add that to your listbox:</p> <p>ScrollViewer.CanContentScroll="True"</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why am I not get getting correct column positions in that parse tree?<p>Say I have a string like this:</p> <pre><code>var code = "Private Sub DoSomething(By...
<p>The <code>Token</code> interface does not include a "column stop" property. However, it does include a method <code>getStopIndex()</code> which it sounds like you may be using. The <code>getStartIndex()</code> and <code>getStopIndex()</code> methods return the absolute indexes into the stream (from the beginning of ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Get variables from a Regex Expression<p>I'm trying to validate the following:</p> <pre><code>/w username message </code></pre> <p>Here is my regex expressi...
<pre><code>Pattern pattern = Pattern.compile("^\\/w\\s+(?&lt;username&gt;\\w+)\\s+(?&lt;message&gt;.+)$"); Matcher matcher = pattern.matcher("/w username message"); if(matcher.matches()) { String username = matcher.group("username"); String message = matcher.group("message"); } </code></pre> <p><a href="https...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Do i have to define every controller method in routes.php?<p>This is my current routes.php file:</p> <pre><code>&lt;?php Route::get('/', 'AdminController@i...
<p>The problem here are your controller action names. If you use implicit controller routes (<code>Route::controllers</code>) your method names have to <strong>start with an HTTP verb</strong>.</p> <p>Instead of <code>index()</code> you need <code>getIndex()</code>.</p> <p>You can easily check what routes Laravel act...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Rest API to get Torrent info based on torrent Hash<p>I need to get details of a TV show episode or a Movie based on a torrent info hash. Is there any REST AP...
<p>BTDigg.org has a Search API (by request), see: <a href="http://btdigg.org/about/" rel="nofollow">http://btdigg.org/about/</a><br> I don't know if it is REST. </p> <p>Otherwise it's not hard to request like:<br> <a href="http://btdigg.org/search?info_hash=7a1073bc39e6b0b01e3730227b8ffea6aeac5d59" rel="nofollow">http...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to apply default post filter with ElasticSearch?<p>I would like to implement an engine of backtesting using elasticsearch. To be able to do that I would ...
<p>You can do that with <a href="http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-aliases.html#filtered" rel="nofollow">Filtered Aliases</a>. When you query through the alias, the filter is automatically applied to your query...which hides it from your application:</p> <pre><code>// Inser...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Await Action() is not awaited<p>I'm using ZXing.Net.Mobile library to scan QR codes. I would like to put the code responsible for scanning to separate class ...
<p>You can't return from <code>Scan()</code> until the <code>OnScanResult</code> event handler has been executed.</p> <p>It's unclear when this event is being raised but provided that it's atually raised when you'd expect, you may block asynchronously in the <code>Scan()</code> method using a <code>SemaphoreSlim</code...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why are h1 and button misaligned<p>I've noticed something quite strange, I can't seem to get h1 and button html elements aligned. I've removed borders and pa...
<p>Use <code>verticle-align: top;</code> instead of <code>verticle-align: text-top;</code> because <code>verticle-align: text-top;</code> effect only text. And there is a default <code>border-width: 2px;</code> to button so remove if you don't need.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-con...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Made commit while resolving git rebase conflicts, can't continue<p>We were rebasing a git branch, using <code>git rebase master</code>, when some conflicts w...
<p>This turned out to be pretty simple, all I had to do was to soft reset the last commit, just like we would if we were <a href="https://stackoverflow.com/a/927386/1860929">removing the last commit from the current branch</a>. (Note that the HEAD points to <code>(no branch)</code> at the moment)</p> <pre><code>$ git ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: I'm rendering a react class Some elements seem to have a problem with closing tags but i made sure there's no unclosed tags in between what can i do?<p>I'm r...
<p>Try out this, your jsx had some issues:</p> <pre><code>var NewComponent = React.createClass({ render: function() { return ( &lt;div&gt; &lt;h1 style={{textAlign: 'center', marginTop: '10px', marginBottom: '30px'}}&gt;&lt;b&gt; Order &lt;/b&gt;&lt;/h1&gt; &lt;div className="for...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: show props value in url in next js<p>I have this scenario When web page load I am getting user location. And on basis of that location show some services lik...
<pre><code>import Router from "next/router"; .... </code></pre> <p><strong>inside onClick</strong></p> <pre><code> router.push(pathname :'/service' query:{service-id:service-name},`/service-${service-name}) </code></pre> <p>the pathname is the filename, the query gets the service-names and the third parameter to...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: jasmine-jquery won't load any fixture<p>I am using karma + jasmine + jquery + jasmine-jquery I have several pure js unit tests and now it's time to move on t...
<p>The fixtures need to be defined in the files list in karma.conf.js. Karma serves the files under the /base directory: <a href="http://karma-runner.github.io/0.8/plus/RequireJS.html">http://karma-runner.github.io/0.8/plus/RequireJS.html</a>. </p> <p>I have setup the project same way you did, defined fixtures in karm...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ArgumentOutOfRangeException when trying to clear combobox<p>I'm having the following error message appear when trying to run .Clear() on my combobox:</p> <p...
<p>It looks like this shouldn't happen, but it obviously is. The actual error might be in this line in the DrawItem handler:</p> <pre><code>Dim text As String = (CType(sender, ComboBox)).Items(e.Index).ToString() </code></pre> <p>Try separating the assignment out of the Dim statement, and check the value of e.Index t...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Ajax pagination with Kaminari works, but how to update page_entries_info?<p>I am new to Ruby on Rails and after an intensive search to find an answer here, ...
<p>I found a solution by adding the following code in index.js.erb:</p> <pre><code> $('#counter').html('&lt;%= escape_javascript(page_entries_info(@favorites, :remote =&gt; true).to_s) %&gt;'); </code></pre> <p>and adding id="counter" to the div in index.html.erb: </p> <pre><code>&lt;div id="counter"class="paginatio...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I resize the google map at flask?<p>I'm using an open source for using Google Map API, but I don't know how to resize the map. Here's my code. Please...
<p>You can easily include inline styling, but adding a stylesheet is largely considered the most maintainable method.</p> <p>This is done by giving your desired tag a class. Then linking a css stylesheet to your html and updating the css as needed. </p> <p>I've included an example.</p> <p><code>projectroot/index.htm...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can I use google Analytics to customise a page dynamically?<p>I have a page on my website that has Google Analytics. Can I add javascript code that uses Goog...
<p>You could use the Real Time Reporting API, however there are latency times and the information is not complete.</p> <p><a href="https://developers.google.com/analytics/devguides/reporting/realtime/v3" rel="nofollow noreferrer">https://developers.google.com/analytics/devguides/reporting/realtime/v3</a></p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I get the coordinates of my current location in yandex mapkit?<p>How do I get the coordinates of my current location in yandex mapkit ? There is very ...
<pre><code>public class MapActivity extends Activity { private static final String TAG = MainActivity.class.getSimpleName(); private static final double DESIRED_ACCURACY = 0; private static final long MINIMAL_TIME = 1000; private static final double MINIMAL_DISTANCE = 1; private static final boolean...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How would you display all the items in an array list in one single line<p>How would you go about showing all the elements in an array list in one single line...
<pre><code>System.out.println(list.stream().collect(Collectors.joining(" "))); </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to use temporary tables in MS Query in Excel?<p>How to use temporary tables in MS Query in Excel? The queries is showing up okay in the preview, but then...
<p>Great answer found: </p> <blockquote> <p>Try adding "SET NOCOUNT ON" at the beginning of your query. The temp-table handling queries may return null-recordsets, the first of which is being processed by MS Query (MS Query can only handle the first returned resultset). By using "SET NOCOUNT ON", you tell SQL ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Angular-UI-Router: ui-sref not building href with parameters<p>I have an HTML page, once loaded in the user's browser the 'list' state is activated and the '...
<p>Hmm, I'm probably misunderstanding your issue but I see at least one obvious difference between the look of your code and the look of mine.</p> <p>My angular-ui-router links look like this:</p> <pre><code>&lt;a ui-sref="reps-show({ id: rep.id })"&gt;{{rep.name}}&lt;/a&gt; </code></pre> <p>The difference is the ab...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Spring JDBC error connection<p>I use Tomcat with Spring (with web services Jersey async) and i set a pool connection in Tomcat like this:</p> <pre><code>&lt...
<p>While it would be helpful to see the error message, it sounds like your MySQL server is disconnecting your pooled connections. </p> <p>You said that you only see this problem when you let your app sit for a while without sending any requests to the database. As your app sits without using the database connections...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Group Rows in group by though it contains NULL value in mysql / postgres<p>I have a table from where I am getting month names and some quantity measures.</p>...
<p>You can use a calendar table which keeps track of all the month names which you want to appear in your report.</p> <pre><code>SELECT m1.month_name, SUM(q1) AS q1_sum, SUM(q2) AS q2_sum FROM ( SELECT 'January' AS month_name UNION ALL SELECT 'February' UNION ALL SELECT 'March' UNION ALL .....
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Make GWT Flextable column resizeable<p>I'm trying to make my flextables columns resizeable. So the user can decide how width a column should be. One solutio...
<p>Hi I found a solution for my own. Maybe this can help someone. </p> <pre><code> public class ResizableFlexTable extends FlexTable { private int mouseDownX; private boolean mouseDown; private int columnWidth; private TableCellElement headerElem; private int column; private ResizeMode resizeMode; /...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: count number of entries in a csv file with mysql to determine further handling<p>I'm receiving different csv files for different customers. The number of ent...
<p>Don't check the number of lines but check file size. <code>100000</code> doesn't need to be a hard limit...</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Hyperlink in PHP file<p>The link in a HTML file:</p> <pre><code>&lt;a href="&lt;?= Config::get('URL') . 'profile/showProfile/' . $user-&gt;user_id; ?&gt;"&g...
<p>You don't need to include <code>&lt;?=</code> when you are already executing as PHP code.</p> <pre><code>echo "&lt;a href='" . Config::get('URL') . 'profile/showProfile/' . $user-&gt;user_id . "'&gt;Profile&lt;/a&gt;"; </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Publishing Of .cs File<p>Recently I added a test.cs file in a folder other than app_Code (let us say Settings) in a .net website project. When I published t...
<p>I recognized my mistake, i was trying to open the project as website, When i opened it as project and then complied it the changes in my .cs files got reflected </p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Cannot bind Input property to directive<p>I want to dynamically disable click events from a certain <strong>DOM</strong>. I figured a directive should do the...
<p>First you need to attach your directive to 'li'. Like: <code>&lt;li eveDisableClickEvent [disableClickEvent]="!exportTypeSelectionModel.Condition" ... &gt;</code>. Then in directive file you should move your function under the host listener decorator. Like: `</p> <pre><code>@HostListener('click', ['$eve...