input
stringlengths
51
42.3k
output
stringlengths
18
55k
Unable to compile [MinGW] <p></p> <p>I try to run this code, but I encounter the error as shown above (first picture). My first assumption is the linker file (second picture) is incorrect. If my linker file is incorrect, then what should I change for the linker file? </p> <p>My second assumption is I set a wrong path...
<p>Not sure where you got the idea that the entry point should be called <code>run</code>. It should be called <a href="http://en.cppreference.com/w/cpp/language/main_function" rel="nofollow"><code>main</code></a>, just rename it:</p> <pre><code>int main () { .... } </code></pre> <p>That particular error message...
MockBean annotation in Spring Boot test causes NoUniqueBeanDefinitionException <p>I am having trouble using the @MockBean annotation. The docs say MockBean can replace a bean within the context, but I am getting a NoUniqueBeanDefinitionException within my unit test. I can't see how to use the annotation. If I can mock ...
<p>It's a bug: <a href="https://github.com/spring-projects/spring-boot/issues/6541" rel="nofollow">https://github.com/spring-projects/spring-boot/issues/6541</a></p> <p>You can work around it by declaring the mock with its name:</p> <pre><code>@MockBean(name="myMongoRepository") private MyMongoRepository repository; ...
How set default value for a property using CodeFirst WITHOUT editing the generated migration? <p>I would like to set default value for some properties in a POCO class. however I rather not to change manually the generated migrations.</p> <p>Is there any annotation or command in OnModelCreating that can set some defaul...
<p>Using EF6, properties value can be configured in OnModelCreating method of FluentAPI. Suppose I have User class and I want Country property always USA.</p> <pre><code>public class User { public int Id { get; set; } public string Name { get; set; } public string Country { get; set; } } public class Cont...
Delete Document in DocumentDB if I do not know the Id? <p>I have a document db collection. Now, I got a json string, which is one of the document in the DocumentDB. How can I delete this document?</p> <p>I know we can delete it using document's id. Does it mean I need to get the id from the document's json string?</p>...
<p>You could use JObject.Parse() and then retrieve the id property. </p> <p><a href="http://www.newtonsoft.com/json/help/html/T_Newtonsoft_Json_Linq_JObject.htm" rel="nofollow">http://www.newtonsoft.com/json/help/html/T_Newtonsoft_Json_Linq_JObject.htm</a></p>
Constrain digits postgresql <p>I want to constrain a number such that it has strictly 8 digits.... no more and no less. There are leading zeros if the number is less than 8 digits long. </p> <pre><code>ALTER TABLE mytable ADD CONSTRAINT digit_chk CHECK (mynum ~ '[0-9]{8}'); </code></pre> <p>However, using the above s...
<p>Use:</p> <pre><code>ALTER TABLE mytable ADD CONSTRAINT digit_chk CHECK (mynum ~ '^[0-9]{8}$'); </code></pre> <p>Per <a href="https://www.postgresql.org/docs/current/static/functions-matching.html#FUNCTIONS-POSIX-REGEXP" rel="nofollow">the documentation</a>:</p> <blockquote> <p>Unlike LIKE patterns, a regular ex...
PHP Why is my globals array empty in my extended class <p>I am having trouble getting a global array in my extended class. The array is populated by paramaters that are passed using the url. </p> <p>I get my url then explode it. Then I set the first two parameters to a class and method. Then re-base my array keys so p...
<p>I was way off. I fixed my problem by parsing the params to the method with call_user_func_array like so</p> <pre><code>class App { protected $controller = 'home'; protected $method = 'index'; protected $params = []; public function init() { $url = $this-&gt;parseUrl(); if (file_...
Angular2 cross domain http get <p>I am trying to fetch a JSON file from a remote server. I wrote the following module :</p> <pre><code>import { Component } from '@angular/core'; import { Injectable } from '@angular/core'; import { Http, Response, Headers } from '@angular/http'; import { Obse...
<p>This is Angular2 I presume.</p> <p>I think you have a CORS issue. Check your network tab in your dev tools.</p> <p>You can't fetch data from another server. (unless the other server supports jsonp or returns the right access-control headers). This probably works locally because your are serving your app from local...
'float' object is not iterable error <p>I am trying to get a a variable that reads out a load value (given in xml document) for a given length of a time (also a list of values). The list for t is from a value 'start' to 'end' with an interval of 15 min. Essentially what I want is that I want one load value to print for...
<p><code>self.load</code> i an array of <code>float</code>s, so <code>self.load[j]</code> will be a float, which is what you are trying to iterate over; hence the error message.</p>
day and month in date string exchange when writting in Excel using Range.values in Office.js library <p>i am developing an office addin using office.js, <a href="https://github.com/OfficeDev/office-js-docs/blob/master/reference/excel/range.md#property-access-examples" rel="nofollow">https://github.com/OfficeDev/office-...
<p>There are a couple of ways to do this:</p> <p>The cleanest and most reliable way is to set the date as an OLE Automation Date value. There is a library called <a href="http://momentjs.com/" rel="nofollow">moment.js</a>, and a plugin for it called <a href="https://github.com/markitondemand/moment-msdate" rel="nofol...
Storing and accessing data in memory using pointers from txt file <p>So I'm currently working on a project that uses data from a txt file. The user is prompted for the filename, and the first two lines of the txt file are integers that essentially contain the row and column values of the txt file. There are two things ...
<p>First off, your prof apparently wants you to become familiar with walking a pointer through a collection of both <em>strings</em> (the labels) and <em>numbers</em> (the floating-point values) using <em>pointer arithmetic</em> without using <em>array indexing</em>. A solid pointer familiarity assignment.</p> <p>To h...
Getting a bit value from stored procedure in C# <p>The situation is following, i have a stored procedure in SQL Server , this has a few output parameters, one of them is a bit type, what I want is to take the value of that parameter, but I have a conversion error, <code>InvalidCastException</code>.</p> <p>This is my c...
<p>Use this following Line </p> <pre><code>bool isConfirmed = (bool)cmd.Parameters["@bit"].Value; if(isConfirmed ){ desc.Text = cmd.Parameters["@desc"].Value.ToString(); stt.Text = cmd.Parameters["@st"].Value.ToString(); camp = cmd.Parameters["@camp"].Value.ToString(); ...
FPDF/FPDI watermark goes behind the page <p>I have a script that generates a pdf with a watermark image on the top right of every page. It works fine except for when I have PNG images that were converted to PDFs. The watermark appears behind the images in the PDF. Is there a way to prioritize the watermark to appear up...
<p>Your script is somewhat strange and confusing. But your main question is answered that simple: Use the imported page BEFORE you call the Image() or text methods and not afterwards.</p>
In order to mutually corresponding to multiple input at Mithril? <p><strong>default code</strong></p> <p>・When the user input, display twice four times as a result of</p> <pre><code> var Model = function () { this.num = m.prop(10); }; var MyApp = { controller: function() { this.d...
<p>Your second code snippet's inputs shouldn't be executing the props: <code>args.mainCtrl.data.num4()</code> shouldn't have the parentheses at the end.</p>
NoReverseMatch - How to add url parameter to render? <p>Is there any method to provide <code>url</code> argument in case of <code>render</code> or any other solution? Somehow I need to provide <code>user_url</code>.</p> <pre><code># view def create_gallery(request, user_url): if request.method == 'POST': ...
<p>You should pass <code>user_url</code> into the <code>context</code> parameter of <code>render()</code>, so that it can be used in the template.</p> <p>Then, inside the template, you can add <code>user_url</code> as a parameter to the <a href="https://docs.djangoproject.com/en/1.10/ref/templates/builtins/#url" rel="...
Bluetooth Communication flow in Android <p>I am trying to understand the communication flow from Bluetooth stack to Bluetooth Chip for Android. I found documentation regarding Bluetooth for Android <a href="https://source.android.com/devices/bluetooth.html#customizing" rel="nofollow">here</a>. However, it does not desc...
<blockquote> <p>What are the System modules involved in communication to BT chip and its flow?</p> </blockquote> <p>Generally the Bluetooth stack(not only Bluedroid) will talk to the chip via uart(embedded device such as phone or carkit) or USB(most used on PC), then at one thread used for read from chip(use H4 pr...
C++ Segmentation fault at std::map::insert <p>I'm trying to teach myself C++ (actually I should say re-learn, but I first learned it when I didn't know a thing about coding and year ago so it doesn't count) and I'm doing my first project after finishing the online tutorial. I figured since I had a good C# and VB.Net ba...
<p>Based on the information in your question:</p> <ol> <li><p>The compiled code in your DLL appears to declare a <code>MyChroma</code> class containing a bunch of internal class members, in its header file.</p></li> <li><p>Then your main application uses a completely different header file, that defines a class called ...
I can't expand the template django <p>I can't expand the template <code>base.html</code> template <code>header.html</code></p> <p>Content <code>base.html</code></p> <pre><code>&lt;div id="main-container"&gt; &lt;!-- HEADER --&gt; {% block header %}{% endblock %} &lt;!-- END HEADER --&gt; &lt;/div&gt; </code></...
<p>I think you would have confused between the include and extend in django templates. </p> <p>Based on your file names, I assume that <code>header.html</code> is the partial which is to be included in the base.html and you are rendering <code>base.html</code> . </p> <p>Django templating engine does not work this way...
Stack Smashing while using strcpy and strcat <p>I've been trying to debug this for a while, still can't figure out why this causes a stack smashing error (I think the error code is 6, or abort. Essentially this function takes a directory, opens a file and then puts that file into a function so it can use the file, and ...
<p>First problem: change</p> <pre><code> char copyDirectory[strlen(dir)+1]; </code></pre> <p>to</p> <pre><code> char copyDirectory[strlen(dir)+2]; </code></pre> <p>Second problem: change</p> <pre><code> char filePath[filePathLength]; </code></pre> <p>to</p> <pre><code> char filePath[filePathLen...
pandas: Keep only every row that has cumulated change by a threshold? <p>I'm interested to extract the rows where a column's value has either gone up cumulatively by at least 5 or gone down cumulatively by at least 5, then get the signs of these cumulative changes, <code>up_or_down</code>.</p> <p>For example, let's sa...
<p>see <a class='doc-link' href="http://stackoverflow.com/documentation/pandas/1751/indexing-and-selecting-data/19351/path-dependent-slicing#t=201609082151350926644">Path Dependent Slicing</a></p> <p>This is the core of the solution</p> <pre><code>def big_diff(y): val = y.values r = val[0] for i, x in enu...
Optimizing Keras to use all available CPU resources <p>Ok, I don't really know what I'm talking about here so bear with me. </p> <p>I am running Keras with Theano backend to run a basic neural net (just a tutorial set up for now) on MNIST images. In the past, I have been using my old HP laptop because I have a dual bo...
<p>Ok of course I figured it out right after I posted the question. Sorry if I wasted anyone's time. </p> <p>I just reinstalled everything using apt-get instead of pip and that worked. Not sure why, maybe I missed something the first time. Anyway, </p> <pre><code>sudo apt-get install python-numpy python-scipy python...
OpenRefine GREL to change <p class="myclass"> to <h2> <p>I'm using OpenRefine to clean about 300 records and have some html text that has multiple paragraph tags with a specific class (class="essay-header") that wraps text that I'd like to convert to h2 tags. What kind of GREL would I need to use to transform these cel...
<p>I hope this will help you.</p> <pre><code> value.parseHtml().select("p")[0] + value.parseHtml().select(".essay-header")[0].replace('&lt;p class="essay-header"&gt;',"&lt;h2&gt;").replace("&lt;/p&gt;","&lt;/h2&gt;") + value.parseHtml().select(".essay-header")[1].replace(' class="essay-header"', '') </code></pre>...
JavaScript Dice Roll When Button Is Clicked <p>I am trying to make a simple dice roller with Javascript that will display a random number between 1 and 6 when the button is clicked.</p> <p>I have a button:</p> <pre><code>&lt;button id="roll"&gt;Click to Roll&lt;/button&gt; </code></pre> <p>With this script:</p> <pr...
<p>Use this instead:</p> <pre><code>document.getElementById("roll").onclick = function() { diceRoll(1, 6); }; </code></pre> <p>The issue with your current code is that when that line is run, <code>diceRoll(1, 6)</code> is executed, and then the result of calling that function is assigned to the <code>onclick</cod...
RAILS TUTORIAL & HEROKU DEPLOYMENT :rake aborted! Gem::LoadError: Specified 'postgresql' for database adapter, <p>Hi I've been following www.railstutorial.org's tutorial, when I need to deploy my code to heroku and do 'heroku run rake db:migrate' it keep throw me the same error</p> <pre><code>rake aborted! Gem::LoadEr...
<p>Looks like the gem pg is only loaded in your local environment. Delete your Gemfile.lock file and run <code>bundle install</code> then commit to your github -> <code>git add -A</code>, <code>git commit -m "some message"</code>, <code>git push</code>, then do <code>git push heroku master</code> heroku run rake db:mig...
Moving an object in a periodical circular path around a point <p>I'm working on a game for a game jam right now, and the problem is related to the flight path of a certain game enemy. I'm trying to have several of them fly in formation, and the idea was to have them fly in a wide radius circle around the center of the ...
<p>The following pseudocode gives the standard way to make an object move in a circular path:</p> <pre><code>double r = (...); // Radius of circle double cX = (...); // x-coordinate of center of rotation double cY = (...); // y-coordinate of center of rotation double omega = (...); // Angular velocity, like 1 do...
Using a macro to replace "using namespace ...;" <p>The question I have is related to style in C++, and is an issue I'm currently debating with in my own library. Consider the following example:</p> <p>Under library convention, everything in the library is encased in a namespace with the name of the library. Suppose it...
<p>Another suggestion:</p> <pre><code>namespace la=lib::a; la::X x; // short, sweet and safe </code></pre> <p>represents a good compromise between the amount you type and the safety of still using namespace qualification (thus avoid naming collision).</p> <p><sup>E.g. it's quite easy to forget that <code>std</code>...
How do I calculate cosine similarity from TfidfVectorizer? <p>I have two CSV files - train and test, with 18000 reviews each. I need to use the train file to do feature extraction and calculate the similarity metric between each review in the train file and each review in the test file. </p> <p>I generated a vocabular...
<p>You are almost there. Using <code>vect.fit_transform</code> returns a sparse-representation of a <a href="https://en.wikipedia.org/wiki/Document-term_matrix" rel="nofollow">document-term matrix.</a> It is the document-term matrix representation of your training set. You would then need to transform the testing set w...
how can I display labels on apple watch? <p><strong>Xcode 8.0</strong></p> <p>I try to code my very first app for <strong>watchOS</strong>. I simply want to show a note when pressing the button. Here is what I've got so far:</p> <pre><code>import WatchKit import Foundation class InterfaceController: WKInterfaceCont...
<p>You need to use <code>setText</code> instead of <code>text</code>.</p> <pre><code>myLabel.setText("here is your note") </code></pre> <p>Here's the <a href="https://developer.apple.com/library/ios/documentation/WatchKit/Reference/WKInterfaceLabel_class/index.html" rel="nofollow">reference</a></p>
Error Animating in image slider jQuery <p>I am trying to do an image slider in jquery. I have written the below code. I am unable to understand how to animate the images instead of changing the src attribute.</p> <blockquote> <p><a href="https://jsfiddle.net/2tsfnauk/2/" rel="nofollow">https://jsfiddle.net/2tsfnauk/...
<p>what if you tried the following code?</p> <pre><code>$(document).ready(function() { var carousel= $('#carousel'); var head= $('#head'); // variable will be used to loop on all images var count = 1; // find all images inside the ul with id = images var max = $('#images img').length; // make sure that ...
Post file and data in same request to node server <p>I have a form in HTML with two inputs - 1 text and 1 file.</p> <pre><code>&lt;form method="post" action="http://localhost:3000/users"&gt; &lt;input type="text" name="username" /&gt; &lt;input type="file" name="file" /&gt; &lt;butt...
<p>You're only listening for file fields. If you want to be notified about non-file fields, then you need to also add a <code>'field'</code> event listener:</p> <pre><code>req.busboy.on('field', function(key, val, keyTrunc, valTrunc) { console.log(key, val); }); </code></pre>
JS Breaking out of nested for loop <p>writing code for the following algorithmic problem and no idea why it's not working. Following a debugger, I found that the elem variable never iterates beyond 's'. I'm concerned that this could be because of my understanding of how to break out of a parent for loop. I read this q...
<p>My suggestion would be to use single for loop instead of using two loops.</p> <pre><code>for( var i = 0; i&lt;s.length - 1;i++) { var lastIndex = s.lastIndexOf(s[i]); if ( lastIndex == i) { return s[i]; } } </code></pre>
Visual Basic - ReDim Preserve - Object reference not set to an instance of an object <p>I'm very new to programming and trying to write a program where it reads data about real estate properties from a txt file and has the option of adding another property on a new line under the rest of the properties in the txt file....
<p>When you resize the array, the new elements are Nothing by default so you need to set them to something before you use them:</p> <pre><code>ReDim Preserve arrListings(arrListings.Length) arrListings(UBound(arrListings)) = New Listing arrListings(UBound(arrListings)).address = txtAddress.Text ... </code></pre> <p>o...
C++11 transform with shared_ptr to a vector and class <p>I am trying to apply transform to a <code>shared_ptr</code> and store to a <code>shared_ptr</code> while also using a function in a class.</p> <p>I created this example:</p> <pre><code>#include &lt;vector&gt; #include &lt;iostream&gt; #include &lt;memory&gt; #i...
<pre><code> shared_ptr&lt;vector&lt;int&gt; &gt; result(new vector&lt;int&gt;() ); </code></pre> <p>You construct a new, empty vector.</p> <pre><code> transform(numbers-&gt;begin(), numbers-&gt;end(), result-&gt;begin(), [this](int x){ return factor * x; }); </code></pre> <p>Since <code>result</code> i...
Convert string to dd/mm/yyyy in C# WPF <p>I have a value (as a date) that gets returned from the selected combobox item. I wish to convert this value to a proper DateTime string. Problem is the string from the combobox.selectedItem to convert is;</p> <pre><code>July 2016 </code></pre> <p>and I want to convert it to (...
<pre><code>DateTime dt; if (DateTime.TryParseExact("July 2016", "MMMM yyyy", null, DateTimeStyles.None, out dt)) { // Parse success Console.WriteLine(dt); } else { // parse failed Console.WriteLine("Failed"); } </code></pre> <p>Checkout <a href="https://msdn.microsoft.com/en-us/library/h9b85w22(v=vs.11...
Jquery selecting span is not working <p>I have this in my code</p> <pre><code>&lt;div class="prof-infos"&gt;Email:&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span&gt;blahblah@email.com&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class="change"&gt;change&lt;/span&gt;&lt;/div&gt; </code></pre> <p>and I have this</p> <pre...
<p>This works perfectly. Can you post any other additional details and please import Jquery library in case you forgot to import it.</p> <p>[JS Fiddle link][1] <a href="https://jsfiddle.net/c7m1b4ke/" rel="nofollow">https://jsfiddle.net/c7m1b4ke/</a></p> <pre><code>&lt;script type="text/javascript" src="https://cdnj...
Can't search in Lucene 6.2 using Scala <p>I'm trying to index the data from MySQL(using Slick in Scala) using Lucene 6.2. Here is the code below</p> <pre><code>package oc.api.services /** * Created by sujit on 9/7/16. */ import org.apache.lucene.document._ import org.apache.lucene.analysis.standard.StandardAnalyz...
<p>The main reason here is probably a mismatch of your analyzers. You use the <code>KeywordAnalyzer</code> for indexing, which does not analyze at all. For search, you use the <code>StandardAnalyzer</code>. In your example, the query <code>"Donec"</code> will be parsed and analyzed to <code>title:donec</code> as if you...
Two formats shows different complex numbers in Octave <p>Complex numbers are differently displayed in Octave depending on the format. But, I cannot stand with any of the formats (so far).</p> <p>Here's my code:</p> <pre><code>a = [-0.067000,-0.067000,-0.068000,-0.069000,-0.069000,-0.070000,-0.070000,-0.071000,-0.0710...
<p>If you call <code>num2str</code> with an array, you will get back a single string that represents that array. If that array is a row vector, you get back a string with one line (it's all one row), if the array is a column vector, you get back one element per line:</p> <pre><code>octave&gt; Y = [-0.694+0i 0.003309-0...
linked list and file I/O C++ <p>I am trying to make a program that allows the user to name a file, and then create that file. My problem came when i needed to error check to make sure there wasn't already a file with that name. I decided to put the file name into a linked list and then each time after one was created i...
<p>Problems I see:</p> <p><strong>Problem 1</strong></p> <p>Implementation of <code>List::search()</code> is not correct. You have:</p> <pre><code>bool List::search(string fName){ curr = head; // The initial value of match is true. // When the list is empty, the function will return true. // Not good. ...
python os.walk returns nothing <p>I have a problem with using <code>os.walk</code> on Mac. If I call it from <code>python terminal</code>, it works perfect, but if I call it via a <code>python script</code>, it returns empty list. For example:</p> <pre><code> import os path = "/Users/temp/Desktop/test/" fo...
<p>You most likely need to intantiate the test list outside the for loop, for this to work.</p> <pre><code>import os path = "/Users/temp/Desktop/test/" test = [] for _ ,_ , files in os.walk(path): test.extend([my_file for my_file in files]) print test </code></pre>
Vue JS. Insert an item at random position inside a Vue component <p>I am working a project using Laravel and currently building a feature using Vue JS in my home page where I want to put an "Advertisement" at random position within the list. Right now, I have setup a vue component called "panel" which is then populate...
<p>You should avoid using jQuery to manipulate the dom when you are using Vue. Since Vue updates the dom when data changes, it may affect the element you inserted. It's better to let Vue handle the dom and you just deal with the data. This code would insert an item into the array at a random position:</p> <pre><code...
How to return large vector from class without copying data <p>I am writing a program in which a class has a data member that is a big <code>std::vector</code> (on the order of 100k - 1M items). Other classes need to be able to access this vector. At the moment I have a standard accessor function that returns the vector...
<p>To avoid the performance penalties, return references.</p> <pre><code>// Non-const version std::vector&lt;MyObj&gt;&amp; getObjects() { return objects_;} // const version std::vector&lt;MyObj&gt; const&amp; getObjects() const { return objects_; } </code></pre> <p>However, before you make that change, you have to ...
Joomla Component Development: Searchable category form field <p>I am creating a custom component which allows the backend user to associate a content category with an record in my database table. I would like to have the same form field that is displayed throughout the backend in Joomla where the user is able to filter...
<p>The category field type is a standard form field type so it is available to you anywhere you are creating a form in joomla. You can read more about standard form fields at <a href="https://docs.joomla.org/Standard_form_field_types" rel="nofollow">https://docs.joomla.org/Standard_form_field_types</a>. However the cat...
MYSQL Select user name and SUM the reviews for them <p>I need to create a sql that contains a list of users, and for each user the number they have reviewed.</p> <p>I tried this, but it didnt give the desired output because i didnt know how to work the SUM into it. </p> <pre><code>SELECT review.revID, reviewer.name F...
<p>Select count(*) as no, revId from review Group by revId</p> <p>You can use the above query</p>
<li> height fit with content <p>How to make the border cover all the text content? I got the problems when the text was very long, then it will overflow the border. Thanks for any help.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pr...
<pre><code>Adding the **overflow:auto** property to **li** to fit the content inside the div. avoiding the overflow. </code></pre> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><c...
SQL Sub-Query and Table Joins Issue <p>Hi I need a help regarding this problem. I tried subqueries but I did not get the results I want.</p> <p>Theses are my tables:</p> <pre><code>**tblefruitdesc** ID Desc 1 Round 2 Smooth 3 Rough **tblefruit** ID Name 1 apple 2 ...
<p>Join the three tables together through <code>tblmultidesc</code>, and use <code>GROUP_CONCAT</code> to get a comma-separated list of descriptions for each fruit.</p> <pre><code>SELECT t3.Name, GROUP_CONCAT(t2.Desc) AS Desc FROM tblmultidesc t1 INNER JOIN tblefruitdesc t2 ON t1.fruit_desc = t2.ID INNER JO...
"Contact us" page with ASP.NET Core - SMTP server issue <p>I'm new to web programming and am using ASP.NET core to make a website. I'm trying to create a standard "contact me" page where the user enters in a name, email, subject and username. I'm using the MailKit library to send the emails: </p> <pre><code>public IAc...
<p>First of all there is a problem with your code </p> <pre><code> public IActionResult SendEmail(Contact contact) { var emailMessage = new MimeMessage(); emailMessage.From.Add(new MailboxAddress("myname", "mymail@mail.com")); emailMessage.To.Add(new MailboxAddress("myname", "mymail@mail...
Class concept (a class accessing property then accessing method) <p>I have a class called Car:</p> <pre><code>Public Class Car Public theColor As Color Public speed As Double Public Function run() Return speed End Function End Class </code></pre> <p>In another class I create an instance of Ca...
<p>This code:</p> <pre><code>Dim dgv As New DataGridView dgv.Rows.Add() </code></pre> <p>is simply a more succinct equivalent of this:</p> <pre><code>Dim dgv As New DataGridView Dim rows As DataGridViewRowCollection = dgv.Rows rows.Add() </code></pre> <p>So, this code:</p> <pre><code>newCar.theColor.resetColor(...
Laptop Keyboard Issue with Few Keys [Caps, A, Q, Z, 1 and Esc] <p>In My Laptop keyboard's few keys are not working [Caps, A, Z, Q, 1 and Esc], also sometime it working fine on startup with few seconds.</p> <p>After that again its going to disable. </p> <p>What's wrong with this ?</p> <p>Hardware/ Software Issue ?</p...
<p>Can you try with external Keyboard then you can confirm if the SW is running fine. Second thing you can check the keyboard layout, e.g. bottom right corner for EN/SV or in other keyboard type.</p>
Java - Skipping values in CSV file <p>I'm trying to read the CSV file located here: <a href="http://archive.ics.uci.edu/ml/machine-learning-databases/haberman/haberman.data" rel="nofollow">http://archive.ics.uci.edu/ml/machine-learning-databases/haberman/haberman.data</a></p> <p>I want to skip the first two values, bu...
<p>CSV is trickier to parse than you realize. </p> <p>Do not write your own CSV parsing code, use a CSV library, such as OpenCSV or Commons CSV. Then you can ignore whatever you want to.</p>
Node.js web deploying with a home base server like Apache <p>I am using Express framework to built my app and Forever to deploy it but it doesn't seem to work because im not using a cloud based computer as suggested on the internet like in this video : <a href="https://www.youtube.com/watch?v=XxRuW1pfGTI" rel="nofollow...
<p>Just like you would not host a Java app in your <code>htdocs</code> dir via Apache, you can't put a Node.js app into your Apache <code>htdocs</code> dir and expect Apache to launch the Node.js runtime. Sure, it works that way with CGI scripts and PHP, thanks to mod_cgi and mod_php respectively. There's no mod_nodejs...
Branching / merging strategy for TFS 2015 with Git repository for multi-team efforts? <p>We are planning to use TFS 2015 with Git repository and need ideas for branching and merging strategy? We have one team working on new enhancements and another team working on defects fixes (O&amp;M). How do merge these efforts and...
<p>Based on what you have described, although, some more information would be required, and also your question can be considered subjective and can result in opinion based answers, it would seem that the git flow branching model might be a good fit.</p> <p>It handles the ability to have multiple streams of work throug...
Programmatically upload / add file via Dropzone e.g. by Selenium <p>I am writing a Selenium test case where one of the steps is to upload a file via Dropzone.js.</p> <p>(As Selenium can run Javascript in the browser, so if it can be done programmatically in Javascript that would be fine too.)</p> <p>I want to avoid g...
<p>Click to Input button -> Use web driver clipboard/java robot -> Paste/type file location + file name > Hit robot enter.</p> <pre><code>final String fileName = "textfile.txt"; final String filePath = "\\data\\public\\other\\" + fileName; zUploadFile (filePath ); public void zUploadFile (String filePath) throws Harn...
How to overload all math functions simultaneously for a class of numerical arrays <p>I have designed a class of numerical array called <code>ndarray</code>, which basically contains a double array member <code>double *data</code>. I have overloaded the math function <code>double log(double)</code> such that it is a fri...
<p>One approach would be to add a member to your ndarray class for applying a function to each element and returning the result. This doesn't overload all the math functions, but lets you do things like <code>ndarray.apply(sin)</code>. Perhaps something like the following (untested):</p> <pre><code>class myNdarray {...
MySQL Error in Syntax near '@points <p>need your help,</p> <p>this is the complete message of the error:</p> <pre><code>[SQL]: DB error - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@points </code></pre> <p>now, this is my sql...
<p>I think it should be more like </p> <pre><code>&lt;?php $query_sql=("UPDATE `cp_v4p_voters` SET `points` = (.@points - " + .@usedPoints + ") WHERE account_id = '" + .@account_id + "'"); ?&gt; </code></pre> <p>but you seem to be using + and . and - not really sure what you are trying to achieve maybe give m...
subquery MY SQL <p>I'm doing a searcher in my website and I need to include all the constraits that I need in my select query. </p> <p>In my searcher the user can write a key word, write a min price and a max price, and choose between some categories, but it's not necessary to find a result by filling all the fields, ...
<p>Try using PHP's implode function:</p> <pre><code>" AND(" . implode("OR ", $var4) . ")" </code></pre> <p>You'll want to make sure $var is non empty array. </p> <p>Also, please read up on SQL Injection and how to properly escape SQL queries with PHP so that your code interacting with your database is secure:</p> <...
HTML file redirect <p>I am not sure if you would do this in the .htacess file but,</p> <p>I have a page <code>www.website.com/page2.html</code></p> <p>How would I make the URL look like <code>www.website.com/page2</code></p>
<p>With .htaccess under apache you can do the redirect like this:</p> <pre><code>RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)\.html$ /$1 [L,R=301] </code></pre> <p>As for removing of .html from the url, simply link to the page without .html</p> <pre><cod...
Powershell: using -replace with regular expression <p>How can I use a regular expression to replace any text between quotes for a <code>-replace</code> statement? I can get it to work with static text, but it could be virtually any text.</p> <p>Example:</p> <pre><code>$filecontent -replace 'AssemblyCopyright("text")...
<p>Try it like this </p> <pre><code>... -replace 'AssemblyCopyright\("[^"]*"\)', 'AssemblyCopyright("Copyright © 2016 myCompany")' </code></pre> <p>Please note however, that this will assume that the text within the quotes does not contain another quote.</p> <hr> <p>Example due to comment </p> <p><a href="http:/...
Voldemort types in C# <p>As you probably know in D language we have an ability called <a href="https://wiki.dlang.org/Voldemort_types" rel="nofollow">Voldemort Types</a> and they are used as internal types that implement particular range function:</p> <pre><code>auto createVoldemortType(int value) { struct TheUnn...
<p>There isn't an <em>exact</em> equivalent of a Voldermort type in C#. The closest you have to such local scope classes is called <a class='doc-link' href="http://stackoverflow.com/documentation/c%23/765/anonymous-types#t=201609110654235394612">Anonymous Types</a>. Problem is, unlike Voldermort types, you can't refer ...
Dockerfile versioning best practice <p>We are a few developers currently developing a C++ app.</p> <p>In order to be sure that everyone use the same libraries and dependencies than the remote production server, we are using docker to compile the code source in our localhost.</p> <p>My question is what the best practi...
<p>Keep your Dockerfile with the source code. We use labels to add versioning info to the produced image. We add:</p> <ul> <li>the git commit and branch</li> <li>whether it's "dirty" meaning that changes were made locally on the src code from what's in git</li> <li>a CI version number (publicly visible)</li> <li>the p...
Definition of a language in Automata Theory <p>I'm currently taking a class in Automata Theory, and while still at Finite Automata, I do find it both interesting and challenging.</p> <p>We are using 'Introduction to Automata Theory...' by Hopcroft and it talks about a DFA in the notation: </p> <h2>A = (Q,Σ, δ, q 0,...
<blockquote> <p>L = 010</p> </blockquote> <p>This is sort of an abuse of notation and most likely means L = {010}. That is, L is the language consisting only of the word 010. A DFA for it has five states: q(-), q(0), q(01), q(010), and q(r). q(-) is the initial state, q(r) is a dead state, and q(010) is accepting. T...
angularjs and expressjs route crash (Aw, Snap!) <p>I create routing in angularjs and expressjs and create <code>app.all('/*'...)</code> to make it can rander index.html, but every time I use <code>/*</code> the page will gona crash (Aw, Snap!)</p> <p><strong>angularjs</strong></p> <pre><code>home.config(function($rou...
<p>finaly I found another solution, even I didn't use html5 mode in angularjs, but it's work</p> <p>so, I only make views folder work's like public folder </p> <p>change from</p> <pre><code>app.set('views', path.join(__dirname, 'views')); </code></pre> <p>to</p> <pre><code>app.use(express.static(path.join(__dirnam...
VBoxManage: error: Failed to create the host-only adapter (II) <p>This error has previously been reported in post: <a href="http://stackoverflow.com/questions/21069908/vboxmanage-error-failed-to-create-the-host-only-adapter">VBoxManage: error: Failed to create the host-only adapter</a> and it keeps reoccurring for new ...
<p>The solution to this problem appears to be the same as reported in the related post: </p> <p>Although the VM in the Oracle VB GUI appears as not running, you must manually start it through Oracle VB GUI (this should work and allow you to login to the box) and then manually power it off again (also through Oracle VB...
jQuery targeting elements with index() <p>So I have two unordered lists, with the same amount of items in them. So let's assume items in unordered list #2 are all hidden. The only way to make them appear is if you click on the items in unordered list #1.</p> <p>so basically</p> <pre><code>&lt;ul class="list1"&gt; &...
<p>Jquery <a href="https://api.jquery.com/index/"><code>.index()</code></a> return index of selected element. You need to use <a href="https://api.jquery.com/eq-selector/"><code>:eq()</code></a> selector or <a href="https://api.jquery.com/eq/"><code>.eq()</code></a> method to selecting element with index.</p> <p><div ...
Adding a namespace vs adding std:: to every line of code <p>I've been coding for many years as a hobby and I'm now studying computer science which is a great way to answer the "why"s as well as the "how"s of the programming world. I've seen many great code examples across multiple message boards including this one and ...
<p>Well, if it is not a matter of coding style, people including myself here usually goes to "std::" to avoid name collisions that may happen when you start "using" a few namespaces in your code. By specifying the entire scope (ex "std::string") of a type you are reducing the name collision risk to pretty much zero. </...
Converting from different values to Enum value <p>My application gets external data which needs to be translated to a corresponding Enum value. This was my first approach:</p> <pre><code>public enum Side { LEFT, RIGHT; public static Side fromByte(Byte b) throws Exception { switch(b) { ...
<p>I usually go for something like this,</p> <pre><code>public enum Side { LEFT('l'), RIGHT('r'); private byte byteValue; private Side(byte byteValue) { this.byteValue = byteValue; } public byte getByteValue() { return byteValue; } public static Side findByBy...
installing opencsv in eclipse + where is the documentation <p>I'm not sure how I can get openCSV working in Eclipse.</p> <p>I've tried downloading the latest version (3.8) and only got a .jar. Similarly I downloaded 2.3 and a .gz archive. What do?</p> <p>Once we get that sorted out, where is the documentation for usi...
<p>When you want to use any jar, place the file in the project and add the file to the build path of the project. You will then be able to use the classes from the library.</p> <p><a href="http://i.stack.imgur.com/011Ro.png" rel="nofollow"><img src="http://i.stack.imgur.com/011Ro.png" alt="enter image description here...
Declaring a variable of type `String` does not work <p>I just read <a href="https://doc.rust-lang.org/book/strings.html" rel="nofollow">the Rust documentation about string data types</a>, which states:</p> <blockquote> <p>Rust has more than only <code>&amp;str</code>s though. A <code>String</code> is a heap-allocate...
<p>Because a <code>&amp;str</code> is not a <code>String</code>.</p> <p>There are a few ways you can make that string literal a <code>String</code> instance though:</p> <pre><code>let mystring = String::from("Hello"); // ..or.. let mystring: String = "Hello".into(); // ..or.. let mystring: String = "Hello".to_string(...
What happens with strings in russian when I POST form <p>Have an edit form in my web application, when using English language everything ok, but when I've tried create new test record in Russian I've got something like this, after submit form: <code>&amp;#1053;&amp;#1072; &amp;#1088;&amp;#1091;&amp;#1089;&amp;#1089;&am...
<p>Its the encoding issue. You need to use <code>CharacterEncodingFilter</code> to set UTF-8 encoding here. </p> <p><strong>Specify below filter in web.xml</strong></p> <pre><code>&lt;filter&gt; &lt;filter-name&gt;encodingFilter&lt;/filter-name&gt; &lt;filter-class&gt;org.springframework.web.filter.Charac...
How to converting a nested Json object/array to multiple lists based on keys Dynamically without knowing the keys <blockquote> <p>The below is a sample Json file.</p> </blockquote> <pre><code>{"Yjson": [ { "Name": "crunchify.com", "Author": "App Shah", "Address": "New York", "Company Services": [{ ...
<p>Here is code for reading your JSON text using <a href="https://github.com/FasterXML/jackson#core-modules" rel="nofollow">Jackson Databind</a> and writing it to CSV using <a href="https://commons.apache.org/proper/commons-csv/" rel="nofollow">Apache Commons CSV</a>.</p> <p>When using Databind, you need Java POJO cla...
does not eval to a function error in couch db <p>I'm using Couchdb 1.6.1. I have a show inside <code>test</code> design.</p> <pre><code>{ "select": { "map": "function(a){emit(null,a._id)}" } } </code></pre> <p>i'm using <code>Nano</code> Node modules to interact with the database. When i run js file belo...
<p>So first of all, you are using a show function like if it was a view function(wich is completely different. </p> <p>If you really want to use a show "function", then I suggest you get a look into <a href="http://docs.couchdb.org/en/stable/couchapp/ddocs.html#show-functions" rel="nofollow">this documentation.</a> Sh...
how to get wordpress post with by category with images <p>I have installed wordpress and opencart in same database. Trying to get wordpress posts table inside opencart module. got the mysql query to fetch all information except image. I dont why images are different from the post in loop of result. Kindly guide, follow...
<p>Run your query in phpMyAdmin and check if result you got is the same as you want (you get those pictures that you want).</p> <p>Then I advise you to set the checkpoint inside the loop and look at the data. Debugging is a very powerful thing in finding errors, it's time to start using <a href="https://xdebug.org/dow...
Not able to "Unlock the Jenkins". Even I'm entering the right secret key. The page is reloading <p>After deploying the jenkins.war in Apache Tomcat server. the Jenkins is started running.</p> <p>Once I hit on the browser <a href="http://localhost:8080/jenkins" rel="nofollow">http://localhost:8080/jenkins</a>. Its aski...
<p>If all else fails, you can also skip that initial admin password page by creating a dummy file called <code>jenkins.install.InstallUtil.lastExecVersion</code> in Jenkins home. See <a href="http://stackoverflow.com/a/37172067/6606196">this answer</a> for more information.</p> <p>Once you place that file in the jenk...
JAVAFX - Change specific Pane only using 1 window <p>Can you Help me how to change the Spesific pane in 1 scene. </p> <p><img src="http://i.stack.imgur.com/aVDdB.png" alt="Description"></p> <p>So when i want to click the Menu A. The Content will change to content A. And when i click the menu B. The Content will be c...
<p>As an option. Make FXML and controller for any "Content" and when the some button is clicked to delete the old "Content" and upload new.</p> <p>Working example below (edited according to James_D comment):</p> <p>Main.java</p> <pre><code>public class Main extends Application { Parent root; Stage stage; ...
How to include all Cpp libraries for CLION <p>I am using CLION IDE for C++ coding. The IDE is pretty good but I dont get the autocompletion for the included libraries.</p> <p>For example :-</p> <pre><code>#include&lt;vector&gt; using namespace std; int main(){ vector&lt;int&gt; A; A. } </code></pre> <p>this line gi...
<p>Clion parses the CMakeLists.txt file in order to build it's index. I recommend you read CMake documentation (or Clion documentation, for that matter).</p> <p>For example, this is the default CMakeLists.txt I use:</p> <pre class="lang-sh prettyprint-override"><code>cmake_minimum_required(VERSION 3.0) project(my_pro...
Sequentially/recursively replace the first numeric element of a column in a matrix with zero, until all = zero <p>I want to iteratively remove the first numeric elements, in all columns of a matrix, one iteration at a time, until all values=0. i.e. </p> <pre><code>matrix(nrow=3,ncol=2,Iteration1) Iteration1=c(1,1,0,1,...
<p>There are two problems to be solved here. The first one is that your <code>fun1()</code> fails as soon as one of the columns does not contain any non-zero values. The second one is how to do the recursion and store the intermediate results. I will address both of them below.</p> <h2>Improving fun1()</h2> <p>Your <...
I can't understand why "ax=ax" meaning in matplotlib <pre><code>from datetime import datetime fig=plt.figure() ax=fig.add_subplot(1,1,1) data=pd.read_csv(r"C:\Users\champion\Desktop\ch02\spx.csv") spx=data["SPX"] spx.plot(**ax=ax**,style="k-") </code></pre> <p>I can't understand why "ax=ax" meaning in matplotlib.</p>
<p>From the documentation of <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.plot.html" rel="nofollow">plot()</a>:</p> <blockquote> <p>DataFrame.plot(x=None, y=None, kind='line', ax=None, subplots=False, sharex=None, sharey=False, layout=None, figsize=None, use_index=True, title=N...
Unable to create a maven project in eclipse---" Invalid group id: 'org.' is an invalid name on this platform." <p>I am not able to create a maven web-app project in eclipse. It is giving me an error when I am creating the group ID</p> <p>" Invalid group id: 'org.' is an invalid name on this platform."</p> <p>When i t...
<p>Theoretically if you will look at the maven xsd <a href="https://maven.apache.org/xsd/maven-4.0.0.xsd" rel="nofollow">https://maven.apache.org/xsd/maven-4.0.0.xsd</a> it does not apply any restriction on the group id, just ask for string.</p> <p>Internally it will validate using the regex "[A-Za-z0-9_\-.]+" see <...
Unable to add data to an array taken out from a cookie <p>Am not able to add data to an array taken out from a cookie .</p> <pre><code>var x1 =[]; if($cookies.get(uid )== undefined) { var arr =[]; arr.push($scope.stock); $cookies.put("arr",JSON.stringify(a...
<p>That is because you use <code>JSON.stringify</code>, wich turns the array into a string looking like the array.</p> <p>Try to get the value without stringify:</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-j...
getJSONObject(String) is undefined for the type JSONObject <p>I have included all the libraries including <code>jason-simple-1.1.1.jar</code>, <code>org.json.20120521.jar</code>. Still I am facing this error:</p> <blockquote> <p>getJSONObject(String) is undefined for the type JSONObject</p> </blockquote> <p>I have ...
<p>Your code isn't working because it's attempting to use a mish-mash of the APIs for json-simple and org.json.</p> <p>The method <code>getJSONObject(String)</code> is part of the org.json API. The rest of your code uses the json-simple API. It's unfortunate that both libraries have a class named <code>JSONObject</c...
how to check null in javaScript function? <p>I want to check null and empty id in JavaScript function,but if syntax isn't work ?</p> <pre><code>var id = "&lt;%=Request["Id"]%&gt;"; if (id !== "") if (id !== null) {var id = "&lt;%=new Guid(Request["ID"].ToString())%&gt;"; window.location = "/Controller/Action.aspx?I...
<p>With javascript,</p> <p>If you are trying to test for not-null (any value that is not explicitly NULL) this should work for you:</p> <pre><code>if( myVar !== null ) { // your code } </code></pre> <p>If you are only interested to test for not-empty (null value, zero number, empty string etc..) then try:</p> ...
Update previous line instead print new line <p>Here is a simple program in c. It take two integers and add them. In this code, I want to update previous line by new line instead making a new one, Can any body help me on this topic.</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; int main() { int a,b...
<p>You cannot move up in the terminal like that, unless using some complex lib as curses. You can use the "clear screen" trick, maybe that would achieve what you want.</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; int main() { int a,b; system("clear"); // or "cls" on windows pr...
How can I tell Closure compiler that something exists in a separate file? <p>I have a project which includes <code>library.js</code> and <code>mycode.js</code>. My code includes</p> <pre><code>let x = new LibraryObject (); </code></pre> <p>I tried running <code>mycode.js</code> through <a href="https://developers.goo...
<p>Extern files are used to provide type information to the compiler for symbols that are not included in the compilation. Extern files are valid JavaScript, but only contain type definitions - don't try to use the library itself.</p> <p>Use the <code>--externs</code> flag to pass an extern file to the compiler.</p> ...
php Call to a member function query() on null <p>Hello Im getting this error</p> <pre><code>Call to a member function query() on null </code></pre> <p><a href="http://stackoverflow.com/questions/30992830/fatal-error-call-to-a-member-function-query-on-null">Fatal error: Call to a member function query() on null</a></p...
<p>You have a couple of errors here:</p> <ol> <li><p>As you define own construct in <code>UserModel</code> class, parent <code>__construct</code>, where <code>$link</code> var is defined, is not run. You can add <code>parent::__construct();</code> to child constructor.</p></li> <li><p>In your parent class you have <co...
Type 'number' is not assignable to type 'Date' - Typescript not compiling <p>I've got the following code for a jquery timer plugin. The compiler gives me the error: "Type 'number' is not assignable to type 'Date'"</p> <pre><code>$(function(){ var note = $('#note'), ts = new Date(2012, 0, 1), newYea...
<p>You need to create a new instance of <code>Date</code>:</p> <pre><code>if((new Date()) &gt; ts){ ts = new Date((new Date()).getTime() + 24*60*60*1000); newYear = false; } </code></pre> <p>This way <code>ts</code> is assigned with a new <code>Date</code> with the given time.<br> Also, there's no need to cre...
Pick values from mysql database ad populate select in struts2 <p>I want to pick values from my database "Prodotti1" and populate a dropdown list with them in Struts2. I'm using </p> <pre><code>&lt;sql:setDataSource var="ds" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/Prodotti1" user="root" password...
<p>You might use <code>#attr</code> which will search the variable in all scopes. </p> <pre><code>&lt;s:select label="Producer" headerKey="-1" headerValue="--Select--" list="%{#attr.result.rows.{producer_name}}" name="producer" /&gt; </code></pre>
The last element (bitstring.BitArray) in list is incorrect after XORing python <p>I have snippet of code:</p> <pre><code>#!/usr/bin/python3 from bitstring import BitArray import itertools # Helper functions def get_bitset_by_letter(letter, encoding): return encoding[letter] if letter in encoding else None def ...
<p>I solved this using <code>__xor__</code> instead of <code>__ixor__</code>.</p>
Why doesn't innerHTML work with white spaces? <p>In the below html, the front button doesn't respond while the back button changes the content of the tag.</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...
<p>That is just invalid HTML.</p> <p>You have to put quotes around your whole <code>onclick</code> attribute value, otherwise it will end at the space.</p> <pre><code>onClick = document.getElementById('para').innerHTML="move // cut off here front" // a second (meaningless) attribute for your button tag. </code><...
Turn birthday into age in R <p>I have retrieved my birthday in the format 06/23/1993 from Facebook and I want to turn this birthday into my age.</p> <p>This is the code I have so far:</p> <pre><code>install.packages("eeptools") library(eeptools) as.POSIXct(facebook$birthday, tz = "", format = "%m/%d/%Y", origin="197...
<p>I'm not sure what fails. This is what I do and it works for me:</p> <pre><code>install.packages("eeptools") library(eeptools) date = "06/23/1993" date = as.POSIXct(date, tz = "", format = "%m/%d/%Y", origin="1970-01-01") floor(age_calc(as.Date(date), units = "years")) #[1] 23 </code></pre> <p>Or without the POSI...
Is there any advantage to using a object based run() method instead of the static main? <p>Is there any advantage to using the following code</p> <pre><code>public void run(){ //Code } public static void main(String[] args){ new Main().run(); } </code></pre> <p>instead of</p> <pre><code>public static void m...
<p>For instructional purposes, or really any other purposes, the difference in memory is negligible. It's also not any more object-oriented to hide code in sub-routines, if the data that code accesses is the same either way and there are no other sub-routines.</p> <p>So, unless there's actually more to your code than...
log4j2 JDBC appender with Spring <p>Log4j2 JDBC appender can be setup using a pooled connection factory that is defined using calls and method (see <a href="https://logging.apache.org/log4j/log4j-2.2/manual/appenders.html" rel="nofollow">log4j2 Appenders</a>):</p> <pre><code> &lt;ConnectionFactory class="net.example....
<p>I mange to create a 3-steps solution :</p> <ol> <li>Define a bean in spring context that provide access to a data source</li> <li>Build an implementation of the bean that provide the desired connection. </li> <li>Build a static wrapper that can be accessed by the log4j JDBC appender.</li> </ol> <p>...
Is it possible to make a instance null in the class itself? <p>can we make a instance reference null in the class itself? like bellow:</p> <pre><code>public class ClassA{ public void clear(){ //make this class be null } } ClassA a = new ClassA(); a.clear(); //now a == null </code></pre> <p>can we imp...
<p><strong>Short answer: No.</strong></p> <p>Longer answer:</p> <p>Instances cannot be <code>null</code> at all. Variables that are typed as references to the class can be set to <code>null</code>, but not instances. There can be many variables referring to the same instance. The instance has no way of knowing about ...
How to read one .CAP file with C? <p>My code in C/C++, shoud <strong>read some data from a .CAP</strong> file, (by the TCPDUMP). One good example could be by WireShark, but I need realy less data.</p> <p>This .CAP seems to be writen in HEXA and, when I try to read it, the <strong>variables are coming "codified"</stro...
<p>You do know that in C a string is a sequence of characters terminated by the special character <code>'\0'</code>?</p> <p>If you print a single character as a string, the <code>printf</code> function will loop printing characters until it finds the terminator character, and that will be beyond the limits of your one...
md-virtual-repeat refresh and stay in scroll index <p>I have a list of md-virtual-repeat.</p> <p>While scrolling I want to refresh from server.</p> <p>What i currently do is recreate the list object:</p> <pre><code>$scope.dynamicItems = new DynamicItems(); </code></pre> <p>But it takes the list back to top (scroll ...
<p>Got it!</p> <p>Just needed to reset the inner loadedPages.</p> <pre><code>DynamicItems.prototype.reset = function() { this.loadedPages = {}; }; </code></pre> <p><a href="http://codepen.io/mikila85/pen/rrOQkB" rel="nofollow">CodePen Demo</a></p>
Date business handling Windows Service on C# <p>I have a requirement where I need to work on a date field, which everyday I need manage a sending and receive tape for processing backup, but there any special condition for operator, they nobody agree to work on holiday, so the requirement is some thing like this</p> <p...
<p>I can't think of a generic approach here since holiday's normally are arbitrary accounting to country or organisation which intend to use your service. According to me, you must separate your service logic which send/process tape and Holiday list separately. When you define holiday list ( in db table or simply in xm...
SQL Server SUM(Values) <p>I have the following query that works perfectly well. The query sums the values in a given day.</p> <pre><code>SELECT SUM(fldValue) AS 'kWh', DAY(fldDateTime) AS 'Day', MONTH(fldDateTime) AS 'Month', YEAR(fldDateTime) AS 'Year' FROM [Data.tblData] WHERE ...
<p>First, I have no idea what the <code>WHERE</code> clause is doing, so I'm going to remove it.</p> <p>Second, don't use single quotes for column names.</p> <p>Third, your <code>GROUP BY</code> clause is too complicated. You only need to include the unaggregated columns in the <code>SELECT</code>.</p> <p>Finally, ...
MongoDB: Match operation with dayOfWeek filter <p>I have the following object:</p> <pre><code>{ ... "junctionId" : "6301", "ts" : ISODate("2016-08-10T11:17:47.000Z") ... } </code></pre> <p>I want to filter the documents that which doesn't have timestamp of particular day of week.</p> <p>I can this by...
<p>The most powerful solution will be the easiest one: add field <code>dayOfWeek</code>your base document. </p> <p>The create an index on it ... and everything works perfect :-)</p> <p>=================</p> <p>That was the easy way - but there be a cost - every time <code>ts</code> field will be updated, then <code>...
How to upload artifacts to maven central with gradle and the maven plugin via a proxy <p>I try to upload some artifacts to maven central (<a href="http://central.sonatype.org/pages/releasing-the-deployment.html#releasing-deployment-from-ossrh-to-the-central-repository-introduction" rel="nofollow">well actually to the s...
<p>you're almost there. The proxy setup must be within the repository configuration block:</p> <pre><code>uploadArchives { repositories { mavenDeployer { repository(url:"http://someupload.url"){ proxy(host: "localhost", port: 8080, type: 'http', userName:"proxyusername", passwor...
how share image and text on whatspp using javascript <p>hello till now i can share my contant on whatsapp using javascript code but still not able to share image with text. does anyone done it here is my javascript code</p> <pre><code>$(document).ready(function() { $(document).on("click", '.mct_whatsapp_btn', functi...
<p>If you are trying to do this from browser then as per whatsapp docs, you can only send text or link through this. read it here : <a href="https://www.whatsapp.com/faq/en/iphone/23559013" rel="nofollow">https://www.whatsapp.com/faq/en/iphone/23559013</a></p> <p>If you want to send image with this whatsapp protocol, ...
site messes up in small screen <p>I am making a site with bootstrap and although most of it is responsive, there are a few elements that mess up a bit when the screen size is reduced. Could you tell me how to correct this?</p> <p>Here's what the element looks like in big screen. <a href="http://i.stack.imgur.com/N3Ith...
<p>I have two solutions at the moment for you:</p> <p>1) to remove <code>max-height</code> from <code>.usediv</code>.<br> <strong>Affect:</strong> divs going to be "longer".<br> <a href="http://i.stack.imgur.com/jBye3.png" rel="nofollow">Check the output here</a></p> <p>2) to add <code>overflow:auto;</code> to <code>...
Why does Firefox ignore additional arguments to setTimeout()? <p>I just ran into an issue with <code>setTimeout()</code> on Firefox that seems like it would be a huge problem if everyone had it, yet I see no mention of it when I search around for it… so I'm wondering if I've screwed this up locally somehow.</p> <p>T...
<p>Found it. Turns out <a href="https://addons.mozilla.org/en-US/firefox/addon/righttoclick/" rel="nofollow">RightToClick</a> is overriding setTimeout with its own version (which doesn't accept the extra parameters).</p>
Ranking tweets from most relevant to least relevant in a document using Python <p>I have a document with, say, 15 tweets. Given a query, how can we rank the tweets from most relevant to the query to least relevant?</p> <p>That is, let D be the document containing 15 tweets:</p> <pre><code>D = ['Tweet 1', 'Tweet 2' .....
<p>It can be on the basis of how many words contained in the tweet are contained on the tweet topic. If they are on the same topic or the top topic, ranking should be a good idea.</p>