input
stringlengths
51
42.3k
output
stringlengths
18
55k
Apache2 cant find /index.php error 404 <p>So I've set up an apache2 webserver on linux. Made a .php file but when I try to access <code>http://myhost/index.php</code> it gives me the <code>404 Not Found</code> Error. When I try to acccess <code>http://myhost</code> it gives me the ubuntu default page even though there ...
<p>To start, I would put a simple index.html with some kind of "hello world!" on your server, so when it does come up, it is a clear success.</p> <h3>Things to check</h3> <p>Try only the IP address of the server in the browser, this should give you either the index.php or index.html in the <code>/var/www/html</code>....
Active model Serializers does not work when i try to return a hash of multiple models via Rails? <p>I am working on Rails 5 api only app.</p> <p>So this is my model serializer</p> <pre><code>class MovieSerializer &lt; ActiveModel::Serializer attributes :id ,:name,:release_year,:story,:in_theater,:poster,:score,:use...
<p>You need to set <a href="https://github.com/rails-api/active_model_serializers/blob/master/docs/general/rendering.md#explicit-serializer" rel="nofollow">explicit serializer</a> like this:</p> <pre><code>render json: {movie: movie, casts: casts , directors: directors}, serializer: MovieCastDirectorSerializer </code>...
Can someone help me with this if loop? <p>Can someone tell me how to make an <code>if</code> loop reset? Here is my code</p> <pre><code> import javax.swing.JOptionPane; public class Piss { public static void main(String[] args) { int num1, num2 = 3, num3, num4, num5; String question = JOptionPane....
<pre><code> public static void main(String[] args) { int num1, num2 = 3, num3, num4, num5; while(true) { String question = JOptionPane.showInputDialog("Enter what you think number 2 is"); if (Integer.valueOf(question)!=(num2)){ JOptionPane.showMessageDia...
Handle fail over in High avalibity? <p>Please consider below scenario.</p> <p>I have implemented apache load balancer using mod jk. There are three tomcat behind apache load balancer. They all are in diffrerent machines. Let's say tomcat-1 is serving a request &amp; before completing a request it goes down due to some...
<p>To have your proxy retry your request on another node after a failure, mod jk would need to know that a request was idemopotent.</p> <p>I do see that adding this knowledge of idemoptency was discussed a long time ago. <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=39692" rel="nofollow">https://bz.apache.o...
Writing to address based on its value <p>I was given a task to write numbers from the relative address 10h numbers 0-255 in ascending order if the address is even and numbers from 0-255 in descending order if the adress is not even</p> <p>then we had to sum up all the numbers from address 10h to 210h This is my code...
<p>I would use just AX for all your math. </p> <pre><code>MOV SI,10h MOV AX,FF00h ;Or mov ax,0xff00 or however it is written MOV CX,255 ;One memory write before the loop, 255 writes from the loop WRITE_512_BYTES: MOV [SI],AX DEC AH INC AL ADD SI,2 LOOP WRITE_512_BYES ;Sum up address from 10h to 210h MOV AX,0 MO...
How to add indexing to maketable queries in MS Access? <p>So I work with a remote data source that refreshes daily, so I have to run a few make table queries to translate/process the most up to date snapshot into tables.</p> <p>However I don't see any clear way to add indexing. Right now what I am doing is I use one q...
<p>When you write <code>SELECT INTO</code> statement, the structure of the new table is defined by the attributes of the expressions in the select list, so you won't be able to get the indexes of the source table this way.</p> <p>you should write create index in your query <code>CREATE INDEX NewIndex ON [Results Table...
Push and pop operation for 2D matrix and displaying them in C++ <p>I am new to c++ and just learning stack push and pop operation. I have written a small program to push and pop some elements from stack. My sample program is given below:</p> <pre><code>// stack::push/pop #include &lt;iostream&gt; // std::cout #i...
<p>You can use <code>std::array&lt;std::array&lt;float,3&gt;,3&gt;</code> for this. Plain arrays won't be copied automatically, and do not conform the needs of a data type stored in a <code>std::queue</code>:</p> <pre><code>std::array&lt;std::array&lt;float,3&gt;,3&gt; A {{{1.0,2.0,3.0},{1.0,2.0,3.0},{1.0,2.0,3.0}}}; ...
Spreading key value pairs into columns <p>I'm stuck with the following data wrangling problem. Each dataset has multiple values of <code>aValue</code> per one value of <code>aName</code>. This can be easily represented in a tidy data frame.</p> <pre><code>someDatasets &lt;- list(dataset1 = data.frame(aName = c("a", "a...
<p>As stated in comments by @lukeA and @A Handcart and Mohair, you can add an additional ID to your data to avoid the <strong>duplicate keys</strong> problem.</p> <pre><code>library(dplyr) library(tidyr) tidyData = bind_rows(someDatasets) %&gt;% group_by(dataset, aName) %&gt;% mutate(id = paste0(aName, 1:n())...
JSON Loading in Java: java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer <p>I'm trying out the example from <a href="https://www.mkyong.com/java/json-simple-example-read-and-write-json/" rel="nofollow">here</a>, and am using this code to write to a file: </p> <pre><code> public void W...
<p>When you write your json file all additional information is lost (in your case the <code>Integer</code> type you used. When you read it the JSONParser will automatically use <code>Long</code> when it encounters a number without decimal points. Try using <code>Long</code> in your reader. Note that the reader knows <s...
Determine what script a node process is running <p>I'm using PM2 on a Windows server to run a bunch of different scripts. I have found that sometimes when I issue a stop with PM2 it reports the process as stopped but the node process is still running.</p> <p>I want to be able to determine what script is being run by ...
<p>I think you're looking for <code>tasklist /FI "Imagename eq node"</code> (or something similar)</p> <p>Related: <a href="http://superuser.com/questions/18830/is-there-a-command-in-windows-like-ps-aux-in-unix">http://superuser.com/questions/18830/is-there-a-command-in-windows-like-ps-aux-in-unix</a></p> <p>Docs for...
Reorder Fields of FeinCMS Content Type in Page Admin <p>I let a content type inherit from <code>RichTextContent</code> and add a few fields, like a title.</p> <pre><code>class SimpleTextContent(RichTextContent): title = models.CharField(max_length=20) ... </code></pre> <p>Unfortunately, in the Page Admin the ...
<p>You have to define <code>feincms_item_editor_inline</code> on <code>SimpleTextContent</code> (<a href="https://feincms-django-cms.readthedocs.io/en/latest/admin.html#customizing-the-individual-content-type-forms" rel="nofollow">docs</a>):</p> <pre class="lang-py prettyprint-override"><code>from feincms.admin.item_e...
Center images in masonry <p>I am using <a href="http://masonry.desandro.com/" rel="nofollow">masonry</a> to place my images nicely on a large screen like this:</p> <pre><code> &lt;div class="grid" &gt; &lt;div class="grid-item"&gt;&lt;img class='link img-link' src="images/image1.gif"&gt;&lt;/div&gt; &lt;div c...
<p>You should find the pixels using from which you want to apply the rule and use the following:<br> For example, if you want 360 pixels and below: use the following code at your css file: </p> <pre><code>@media screen and (max-width: 360px) { .box.col3.editorial , .box.col3.poster{ left: 0; ...
Unity Networking [UNET]: Syncronizing static scene objects <p><strong>Hello everyone!</strong></p> <p>I'm relatively new to Unity and currently working around new game project using UNET. I have stuck for a few days with this problem: <strong>how I can syncronize existing (not spawned) scene objects in Unity?</strong>...
<p>I'm afraid <code>transform.scale</code> synchronization is still not supported by UNET. It wasn't 1 year ago and it still is now :(</p> <p>But luckily, you can workaround this problem by using <a href="https://docs.unity3d.com/ScriptReference/Networking.SyncVarAttribute.html" rel="nofollow">[SyncVar attribute]</a>....
android - can't save text file <p>The question is pretty common and I have googled it but it still wont work. I'm simply trying to save a text file using the below code:</p> <pre><code> String state = Environment.getExternalStorageState(); if (!Environment.MEDIA_MOUNTED.equals(state)) { ...
<pre><code>if ((checkSelfPermission(android.Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED)&amp;&amp; Build.VERSION.SDK_INT &gt;= 23 ) { Log.v(TAG,"Permission is granted"); return true;} else{ ActivityCompat.requestPermissio...
WP-Less, Less and PhpStorm compile <p>Im creating wp theme using Redux framework, WP-Less for compiling styles in LESS. Working in PhpStorm.</p> <p>Now, i want to change some colors dynamically from Redux and pass them to my main style.less file which will be compiled in style.css. </p> <p>The problem is, when i want...
<p>You are using WordPress filter add_filter('less_vars', 'my_less_vars', 10, 2); to add your less variables.</p> <p>I'm using Netbeans and I'm sure it is the same in PhpStorm. Netbeans compiler can't use WP filters, simple as that. You can't use PhpStorm compiler to compile unless all vars are in written in the less ...
C# MongoDB Query - Filter where a match exists in Array <p>When I modified my filter to only select an ArtistDocument whose artist_ID contains a match in the artistIds array, I get the following error.</p> <p>"The expression tree is not supported: {document}{artist_ID}" System.Exception {System.NotSupportedException}<...
<p>I believe you can achieve what you want with ElemMatch</p> <pre><code>Builders&lt;ArtistsDocument&gt;.Filter.ElemMatch </code></pre> <p>something like this:</p> <pre><code>var elemMatchFilter = Builders&lt;YourModel&gt; .Filter .ElemMatch(x =&gt; x.YourArray, x =&gt; x.ArrayField1 == field1 &amp;&amp; x.x...
Apache doesn't redirect react requests with more than 2 slashes in url correctly <p>I need to respond every react-app request with the same <code>js/bundle.js</code> file but do not do actual redirect - leave the url the same. Because after <code>bundle.js</code> returns - react-router will get any page it needs from t...
<p>The problem was in index.html - when linking script js/bundle.js I didn't put slash before js - /js/index.js. </p>
D3.js: Drawing rectangles underneath text <p>I am working on a radial collapsible tree in using d3.js. Here is how it looks so far: <a href="https://i.stack.imgur.com/iyPbz.png" rel="nofollow"><img src="https://i.stack.imgur.com/iyPbz.png" alt="enter image description here"></a> As you can see highlighted in red is the...
<p>You have to <code>append</code> the rectangle in the enter selection, not <code>select</code>ing it:</p> <pre><code>nodeEnter.append("rect") </code></pre> <p>Here is your fiddle: <a href="https://jsfiddle.net/wLwn9p98/" rel="nofollow">https://jsfiddle.net/wLwn9p98/</a></p>
Complex Xpage takes long for partial refreshs <p>I have a complex xpage with lots of nested custom controls. Everytime I execute a partial refresh it takes over 4 seconds to finish. If I remove the complexity it works just fine and is fast as wished.</p> <p>I put a test on this complex Xpage and even with partial exec...
<p>Even though it is a partial refresh <em>all</em> XPage controls' values are submitted to server. "partial" means in this case that only the label1 part returns to client. But it is a full <em>submit</em> and this might take time...</p> <p>You can submit partially though. Add </p> <pre><code>execMode="partial" exec...
Why is there no output showing in this python code? <pre><code>man=[] other=[] try: data=open('sketch.txt') for each_line in data: try: (role,line_spoken) = each_line.split(':',1) line_spoken= line_spoken.strip() if role == 'Man': man.append(line_spo...
<p>The indentation in your screenshot is different from your question. In your question you claimed your code was this (with some bits trimmed out):</p> <pre><code>try: # Do something except IOError: # Handle error try: # Write to man_data.txt and other_data.txt except IOError: # Handle error </code></...
child_process not returning correct exit code from batch file <p>I'm trying to get the correct exit code from a batchfile using nodejs on Windows.</p> <p>When run from the command line I see the expected error code:</p> <pre><code>ml.bat profile bootstrap </code></pre> <blockquote> <p>ERROR: [".../deploy/lib/Roxy...
<p>If you want Node to return the child process error code, you need to pass it to the exit function.... </p> <p>process.exit(exitcode);</p> <p>As Tom mentions in his comment, "code" is undefined, so that needs to be fixed.</p> <p>See <a href="https://nodejs.org/api/process.html#process_process_exitcode" rel="nofo...
Jasmin Mock $http (then, catch) <p>Ive been using the following code for ages to test the following code example.</p> <pre><code>function loadAccounts() { return AccountCaller.loadAccounts() .then(function(response){ AccountsModel.accounts = response.accounts; }) .catch(function(error){ ErrorHandler.ra...
<p>In your spy of <code>then</code> you have <code>return callback(response);</code>, but your callback does not return anything, which is why you get the <code>undefined</code> in your error. The thing you're returning will need to at least have a <code>catch</code> method of some kind attached to it. You can test tha...
How to highlight a given word inside hbs? <p>Is there any way to highlight a given word inside an ember template?</p> <p>Example:</p> <pre><code>var givenWord = "hello" </code></pre> <p>ember template is as follows:</p> <pre><code>&lt;div&gt; &lt;p&gt;some text here, some another text with hello, again hello&lt;/p&...
<p>There is no builtin easy mechanism.You can try implement the below stuff in Ember.<br> <a href="https://markjs.io/" rel="nofollow">https://markjs.io/</a></p>
Set size of image in `ImageView` in button where image is set using css <p>I used <code>fitWidth</code> and <code>preserveRatio</code> to size the <code>ImageView</code> in the FXML, but the image does not scale to it but instead shows its full size (too big in my case). How do I set the size of the image using FXML or...
<p>Not tested, but try using the CSS on the <code>ImageView</code> itself:</p> <pre class="lang-xml prettyprint-override"><code>&lt;Button fx:id="buttonUp" GridPane.columnIndex="0" GridPane.rowIndex="0" onAction="#buttonUp"&gt; &lt;graphic&gt; &lt;ImageView id="buttonUpGraph...
rails routing, add path name also keep old urls working <p>in my routes file, when i change</p> <pre><code>resources :foobar </code></pre> <p>to </p> <pre><code>resources :foobars, path: "foo-bars" </code></pre> <p>the urls become <code>example.com/foo-bars</code>, <code>example.com/foo-bars/1</code> etc. this is o...
<p>Define both of them</p> <pre><code>resources :foobars, path: "foo-bars" resources :foobars, path: "foobars" </code></pre> <p><strong>EDIT:</strong></p> <p>For custom actions instead of declaring them twice for each path like this,</p> <pre><code>resources :foobars, path: "foo-bars" collection do get 'bulk_...
Sparx Enterprise Architect: undo get all latest <p>I have Sparx EA setup with version control. Prior to checking in updates to my model I did a get all latest. But doing so has completely mangled one of my diagrams. This is particularly odd as:</p> <ol> <li>The packages that contained the diagram and all the component...
<p>No, you can not undo that unless you have a database backup. If you have not committed your work before, it's your own fault.</p> <p>FWIW: Get All Latest is meant to be used in single distributed EAP files (or RDBMS remote to a central repos). It will erase all work and replace it with what has been stored in the V...
SQL - pick current date from machine and compare the year <p><strong>Scenario 1: Current Year</strong></p> <p>Always code needs to pick </p> <blockquote> <p>The last Sunday of January for the current year. For ex(31-01-2016)</p> </blockquote> <p><em>Current code - picks 1st of Jan 2016</em></p> <pre><code>convert...
<pre><code>-- Sample Demonstrative Data/Test Results Declare @YourTable table (SomeDate date) Insert Into @YourTable values ('2000-06-15'),('2001-06-15'),('2002-06-15'),('2003-06-15'),('2004-06-15'),('2005-06-15'),('2006-06-15') ,('2007-06-15'),('2008-06-15'),('2009-06-15'),('2011-06-15'),('2012-06-15'),('2013-06-15')...
Removing Try failures in collection using flatMap <p>I have a Map[String, String]</p> <p>How can I simply this expression using flatMap?</p> <pre><code> val carNumbers = carMap.keys.map(k =&gt; Try(k.stripPrefix("car_number_").toInt)).toList.filter(_.isSuccess) </code></pre> <p>Note: I want to remove the Failure/Suc...
<p>It looks like you just want to convert <code>Try</code> to <code>Option</code>:</p> <pre><code>for { key &lt;- carMap.keys t &lt;- Try(key.stripPrefix("car_number_").toInt).toOption } yield t </code></pre> <p>this will result <code>Iterable</code> and you can convert it to list with <code>.toList</code> method...
minimum and maximum of moving window, better implementation? <p>I am trying to find a min-max of a moving window by using queues. I was able to create a solution but this feels very slow.</p> <p>Here is my solution:</p> <pre><code>def min_max(value:T, windowSize: Int):(T,T) = { val queue = new scala.collection.muta...
<p>It depends on how your queue is constructed and populated, and how large it is. In short, you can make scanning for min/max faster, but it'll make adding elements to the queue slower, or incur some upfront cost.</p> <p>What you are doing is linear, which is about as good as you can do with a linear data struct, but...
Spring UnsatisfiedDependencyException after upgrading spring from 3.1.1 to 4.3.3 <p>I'm trying to upgrade my application to the latest version of Spring &amp; Camel, but im getting the exception listed below. I also listed the config section that spring is having an issue with. FYI, my application, including this con...
<p><a href="https://github.com/apache/camel/blob/master/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/fixed/BindyFixedLengthDataFormat.java" rel="nofollow">https://github.com/apache/camel/blob/master/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/fixed/BindyFixedLengthDa...
At which pixel do I draw these frequencies lines? <p>I need to plot on a C++ GUI Display some "lines" that identify frequency "bands". Such as these:</p> <p><a href="https://i.stack.imgur.com/z3SqW.png" rel="nofollow"><img src="https://i.stack.imgur.com/z3SqW.png" alt="enter image description here"></a></p> <p>Since ...
<p>You need to find coefficients <code>a</code> and <code>b</code> of equation</p> <pre><code> x = a + b * Log(f) </code></pre> <p>for two border cases <code>f=20, x=0</code> and <code>f=20000, x=269</code> </p>
Href passing page options <p>My current URL is something like this:</p> <pre><code>http://127.0.0.1:8000/browse/?name=&amp;status=any </code></pre> <p>On it I have a paginator which allows me to browse by page number. How would I set the href so it goes to the next page, while passing in the <code>name</code> and <co...
<p>From what I can see you for got the rest. So..</p> <p>in: </p> <pre><code>&lt;a href="?page={{ paginator.previous_page_number }}"&gt; </code></pre> <p>should be</p> <pre><code>&lt;a href="?name=&amp;status=any&amp;page={{ paginator.previous_page_number }}"&gt; </code></pre> <p>Right? I think? Reason is because ...
node.js: get variable's name <pre><code>let f = function(list) //'list' is an array [o1, o2, etc.] { list.forEach(function(e) { console.log('name ', ??); }; }; </code></pre> <p>just wonder how to get current elm's name to have output like that: o1 o2</p> <p>thnx</p> <p>p.s. toString() puts [object Ob...
<p>Referencing forEach here: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach" rel="nofollow">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach</a></p> <p>Doing a forEach you get access (in the callback) to three pieces...
C# nullify a delegate reference <p>let's say I've a class to manage a stack of delegates. For some reason, at some point I need to invalidate a random delegate on the stack so, since I pass a variable of a delegate as reference, I expect that setting to null that variable, will prevent the stack to invoke that method j...
<p>I find your code not very well-designed... Setting local variable to NULL will not make anyone expect any changes in some other classes internal data. It will definitely lead to bugs sooner or later even if you could achieved this.</p> <p>It would be better to just use a <code>List&lt;DlgtVoidVoid&gt;</code> instea...
How can I compose a query such as (A || B || C) && (X || Y) in MongoDB Java Driver 3.2 <p>Unfortunately, I cannot find an example for Mongo 3.2 java driver for query like "(A or B or C) and (D or E or F or G)" </p> <p>Number of parameters inside parentheses will be variable - <strong>up to hundred</strong>.</p> <p>Fu...
<p>You should use an "in" query in such condition when you have a long unknown list of OR conditions.</p> <p>An example code:</p> <pre><code>try { MongoClient mongo = new MongoClient(); DB db = mongo.getDB("so"); DBCollection coll = db.getCollection("employees"); List&lt;Integer&gt; a...
$location.path takes time to work after bootstrap modal hide (hide.bs.modal) event is fired <pre><code> // show mymodal // register an event to route to a different page once modal is closed $('#myModal').on('hide.bs.modal', function() { if ($location.path() == '/') { $location.path('/ser...
<p>Since it is <code>jquery</code> event <code>angular</code> will not be aware of this event immediately. It will have to wait till the next digest cycle and that is causing the delay. You try using <code>$scope.$apply</code></p> <pre><code>$scope.$apply(function() { if ($location.path() == '/') { ...
IP Check Via List <p>I have an ip list file for my country, as like this (txt document):</p> <pre><code>45.123.116.0/22 5.2.80.0/21 5.11.128.0/17 5.23.120.0/21 5.24.0.0/14 etc </code></pre> <p>i have two question about that.</p> <p>1- can i forward the user, if he is in that list via .htaccess file? (if he is, use t...
<p><strong>*1).htaccess file</strong></p> <p>The visitor blocking facilities offered by the Apache Web Server enable us to deny access to specific visitors, or allow access to specific visitors. This is extremely useful for blocking unwanted visitors, or to only allow the web site owner access to certain sections of t...
Codeigniter: common funcs. vs multiple funcs. DB query performance <p>I hope to get answers based on experience and knowledge based on Codeigniter for this question. Lets say I have 10 tables in a database and I want to query all the rows in the 10 tables at the same time in the same controller. and there are two ways ...
<p>Wild guess based on years of experience in backend development: Both will run equally fast/slow depending on how many rows you have in your tables.</p> <p>As you already have the code, just give it a try with a suitable benchmark. Let both routines run a couple thousand times and take the average.</p>
How to create zip file deflate all the entry <p>I have a zip file that i think it was created by zip, but when i unzip it, and try to create a zip from those unziped file, it diferent from zipinfo command. this is result when I do zipinfo command on linux of source file:</p> <pre><code>root@TLBBServer:/home/web/Patch/...
<p>So? Why do you care?</p> <p>A different zip program, or the same zip program with different settings, or a different version of the same zip program with the same settings can all produce different output. However they will all be valid, decompressible zip files, assuring that the contents are uncompressed exactly....
Spark Connector MongoDB - Python API <p>I'd like pull data from Mongo by Spark, especially by PySpark.. I have found official guide from Mongo <a href="https://docs.mongodb.com/spark-connector/python-api/" rel="nofollow">https://docs.mongodb.com/spark-connector/python-api/</a></p> <p>I have all prerequisites:</p> <ul...
<p>It looks like an error I'd expect to see if I were using code compiled in a different version of Scala. Have you tried running it with <code>--packages org.mongodb.spark:mongo-spark-connector_2.10:1.1.0</code>?</p> <p>By default in Spark 1.6.x is compiled against Scala 2.10 and you have to manually build it for Sc...
Rearranging column order in SELECT statement on MySql <p>I'm using the MySql C API and doing various queries I found it very inconvenient to go check the query each time to see the column ordering. Moreover, this approach is very prone to errors in case of a query edit.</p> <p><strong>Is there anything I can do to ass...
<p>It's been a long time since I've coded C, and I'm sorry to answer and not comment (not enough points), but perhaps <code>mysql_fetch_field_direct()</code> (<a href="http://dev.mysql.com/doc/refman/5.7/en/mysql-fetch-field-direct.html" rel="nofollow">http://dev.mysql.com/doc/refman/5.7/en/mysql-fetch-field-direct.htm...
Matlab checking if user input is a point on my plot <p>I've been trying to figure out how to do this now for a couple of hours. I have two equations that become plotted in an (x,y) format</p> <pre><code>x = v*cosd(theta)*t; y = -(g*t.^2)/2 + v*sind(theta)*t; plot(x,y) </code></pre> <p>Variables v, theta, xanimal, yan...
<p>You need a distance function that uses both coordinates instead of each coordinate separately. The following should work:</p> <pre><code>function d = dist(x , y, xpoint, ypoint) d = sqrt( (x - xpoint).^2 + (y - ypoint).^2 ); end </code></pre> <p>You can call this point giving it your x and y vectors and your x...
Show top N items from dropdown-menu with jQuery Slice <p>I am trying to show only the top 10 results of each list in my navigation. I have about 5 UL's and want to show the top 10 results of each. code below works only the first list. What am I missing here.</p> <p><div class="snippet" data-lang="js" data-hide="false"...
<p>You can use <code>css</code> for that:</p> <pre><code>li:nth-child(n+11) { display: none; } </code></pre> <p>This will make sure only the first 10 <code>li</code> elements will be displayed.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snipp...
How to clone blob container and contents <p><strong>Summary</strong><br> I have picked up support for a fairly old website which stores a bunch of blobs in Azure. What I would like to do is duplicate all of my blobs from live to the test environment so I can use them without affecting users. </p> <p><strong>Architectu...
<blockquote> <p>Can I copy all of the blobs from live to test without downloading them? They would need to maintain the same names.</p> </blockquote> <p>Yes, you can. Copying blob is an <code>asynchronous server-side</code> operation. You simply tell the blob service the blobs to copy &amp; destination details and...
SQL join statement on 2 tables <p>i am creating a join between two tables Product_Tree and Product on the two columns Model_Number and Manufacturer to return the matching columns.</p> <p>Here are the 2 tables:</p> <p><strong>Table : Product_Tree</strong></p> <pre><code>Col1,Col2,Model_Number,Col3,Manufacturer,Col4 1...
<p>You'll need to use a concatenation operator to concatenate your <code>%</code> wildcard to your column <code>product_tree.manufacturer</code>:</p> <pre><code>SELECT Product_Tree.col0,Product_Tree.col1,Product_Tree.col2,Product_Tree.col3,Product_Tree.Model_Number,Product_Tree.Manufacturer FROM Product_Tree JOIN Pr...
Mule SMTP not connecting due to password contains special character <p>I need to connect to a gmail account to send an email using the SMTP component in Mule.</p> <p>The password for the account contains the @ sign and it throws the error shown below. How can I resolve this without changing the password? The account...
<p>Thanks. Changing @ to %40 worked</p>
Is there a way to exact match "truthy" and "falsey" values in ColdFusion <p>I recently had the need to match against two strings in ColdFusion and ran into this scenario during my loop:</p> <pre><code>&lt;cfif "0" IS NOT "NO"&gt; </code></pre> <p>Generally during the loop it looks something like this:</p> <pre><code...
<p>The compare function will help you. This:</p> <pre><code>writedump(compare("0", "NO")); </code></pre> <p>returns -1.</p> <p><a href="http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7f84.html" rel="nofollow">This page</a> will tell you what that means.</p>
Mac 10.10.5 throwing error sudo: gpasswd: command not found <p>I have requirement to add jenkins user on "mac mini" to docker group and trying below </p> <p>which sudo /usr/bin/sudo</p> <p>Not working sudo gpasswd -a jenkins docker</p> <p>Not working /usr/bin/sudo gpasswd -a jenkins docker sudo: gpasswd: command n...
<p><a href="http://superuser.com/questions/214004/how-to-add-user-to-a-group-from-mac-os-x-command-line">http://superuser.com/questions/214004/how-to-add-user-to-a-group-from-mac-os-x-command-line</a></p> <p>answered in above link.</p> <p>The command which I was trying is not applicable for Mac OS</p>
Use interpolation in the route-href attribute <p>I'm trying to create a dynamic menu by looping over all routes of the router.</p> <p>Simplified class (TypeScript flavour):</p> <pre class="lang-js prettyprint-override"><code>@inject(Router) export class NavBar { constructor(private router: Router) {} } </code></p...
<p>In the nav bar you do not need to use route-href, you could do:</p> <pre><code>&lt;ul class="nav navbar-nav"&gt; &lt;li repeat.for="route of router.navigation" class="${row.isActive ? 'active' : ''}"&gt; &lt;a data-toggle="collapse" data-target="#bs-example-navbar-collapse-1.in" href.bind="route.href"&g...
Data.table: dynamically creating variables over various subsets of data and grouping by variable x, subsetting final results <p>I am creating three types of variables over multiple time periods for individual customer IDs in my data. These new variables include the sum of a price vector, the mean of a price vector, and...
<p>We can use <code>Map</code> as in the previous post</p> <pre><code>nm1 &lt;- sprintf("%s.%d.%s", "period", seq_along(period_intervals), "price.sum") nm2 &lt;- sprintf("%s.%d.%s", "period", seq_along(period_intervals), "price.mean") nm3 &lt;- sprintf("%s.%d.%s", "period", seq_along(period_intervals), "mean.diff.date...
Angularjs <div ng-controller override second ng-controller <p>I'm using AngularJS for my charts. </p> <p>I have to create two charts, they both use the same nav-bar. </p> <p>I am able to display both charts on the screen, however; only <code>&lt;div ng-controller="first "&gt;</code> work with nav-bar. My second <cod...
<p>So you want to have same filters for two charts, created from the data available in two different controllers.</p> <p>Your current approach will just update the values attached with ng-model for the second controller. Instead, try using a service. Lets call it <code>chart.service</code></p> <p>Now this service can...
SQL server remote access <p>I am trying to connect to a remote SQL database.</p> <p>I have the access and the sql server is configured for remote login. I can login to the server from another machine (B) but not from my machine (A).</p> <p>Both the machines (A and B) are on same domain. None have their IP white-liste...
<p>Are you trying to connect through software? You said "SQL Server" so I'll assume you're talking about using SSMS to connect to a server? </p> <p>You said that you can login to the SQL server from the box that the server is on but not from a remote computer. This sounds like a permissions problem to me. </p> <p>Is ...
Getting Paper Size of a PDF <p>I am using PDFsharp to read / write PDF in our application. I am trying to get the paper size of a page to show in metadata window. I am using following code to do the same:</p> <pre><code> // read PDF document into memory       var pdfDocument = PdfReader.Open(pdfPath);...
<p>The properties you have to use are <code>Width</code> and <code>Height</code>. Convert them to millimeter or inch if you do not want to show the size in points.</p> <p>The property <code>Size</code> is a convenient way to set standard page sizes for new pages as you can specify A4 or Letter. It will not be set for ...
Getting the count of a Filtered Result in a template on Django <p>Im trying to access a related model on the template like this:</p> <pre><code>course.course_set.all.0.section_set.all.0.student_assignation.count </code></pre> <p>The problem is that I would like to count all the student assignations which have an <cod...
<p>Django templates are note meant for such complex queries. There are a few ways you can handle this</p> <p>One, create a custom <a href="https://docs.djangoproject.com/en/1.10/howto/custom-template-tags/#custom-template-tags-and-filters" rel="nofollow">django template tag</a></p> <p>Two, create a class method whic...
How to avoid ExecutorService from overridding Security Principal of a Runnable <p>When the first runnable is submitted is an inject ExecutorService, the security Principal is correctly set for that runnable. Each subsequently submitted runnable is given the security principal of the original user instead of keeping the...
<p>I figured out the issue. I looked into the porcupine code and found out that the ExecutorService was not being managed by the Container. I created a ManagerExecutorService and the SessionContext was then being properly propogated.</p> <pre><code>@Resource(lookup = "java:jboss/ee/concurrency/executor/customExecutor"...
List all category and all posts in wordpress <p>how do can i list all category and all posts in wordpress, like the example below:</p> <pre><code>CATEGORY1 POSTS CATEGORY2 POSTS CATEGORY3 POSTS </code></pre>
<p>Try below code :</p> <pre><code> &lt;?php // get all the categories from the database $cats = get_categories(); // loop through the categries foreach ($cats as $cat) { // setup the cateogory ID $cat_id= $cat-&gt;term_id; // Make a header for the cateogry echo “&lt;h2&gt;”.$cat-&gt;name.”&lt;/h2&gt;”; // cr...
How to scale iOS app for different sizes <p>I'm writing an iOS app and I want app looks similar in iPhone 5 and iPhone 6 Plus. I know about Auto Layouts, Adaptive Layout and Size Classes. Is there any other way to scale view from iPhone 5 to larger screen sizes?</p> <p>It is not so hard to write simple view container ...
<p>Have you heard about <a href="http://asyncdisplaykit.org" rel="nofollow">AsyncDisplayKit</a>? It has its own unique approach to the question of <a href="http://asyncdisplaykit.org/docs/layout2-conversion-guide.html" rel="nofollow">layouts</a>, sizes and etc. It also has its own implementation of tables, collections,...
AJAX variable sending no data (variable returns "0" not required data) <p>I've been trying to use AJAX to send across a variable from a JS file and trigger a PHP file in Wordpress. The function connects to the PHP file however the variable it sends across stores the value "0" . I've tried many solutions, but I can't qu...
<p><code>alert</code> is JavaScript, try using <code>echo</code>, as in </p> <pre><code>echo json_encode($_POST['result']); </code></pre> <p>also action needs to be part of your data parameter</p> <pre><code> data:({result: calc_price, action: 'data_sender'}), </code></pre>
Lookup "Text" Variable between dates <p><em>Let me preface this question with: The data that I was provided is not in the most logical order and the work involved in scrubbing to a more uniform it would be time consuming.</em></p> <p>I am compiling a sales sheet to collect an overall yearly view of each product's reve...
<p>SUMIFS() is the best way to go. But one can make the criteria more dynamic so the formula can be copied from cell to cell instead of having the values "hard coded" in the formula.</p> <p>To do such ensure that your month row is Actual dates that have a number format of <code>mmm</code> instead of text.</p> <p><a ...
ngrok FTP tunneling issue <p>I have installed many FTP Servers on a Windows machine and set ngrok for FTP tunneling.</p> <pre><code>C:\path\to\ngrok&gt; ngrok tcp 21 </code></pre> <p>Using linux, i am able to establish an FTP connection and browse the directories ONLY with the installed ftp client.</p> <pre><code>$ ...
<p>Problem solved in FileZilla via : </p> <p>Edit > Settings > Connection > FTP > Passive mode, and select "Fall back to active mode" and Bingo !</p> <p>The same technique can be applied to the other FTP clients.</p>
Oracle - query failed statements <p>Is there a view (or other method) in Oracle, from which I can extract the failed sql statements, which were executed by the user? I tried to check v$sql but, as it turned out, it contains only the successful ones. I'm using Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - ...
<p>Blaim me if I'm wrong but as far as I understand sql gets logged on shared pool check and statements Laszlo mentioned <code>select nonexistingcolumn from dual;</code> failed on semantic check. My answer is you won't find invalid statements in DB. <a href="https://docs.oracle.com/database/121/TGSQL/tgsql_sqlproc.htm#...
Limit displayed depth of gradle dependencies task <p>Using <code>gradle dependencies</code> I get a huge list of all dependencies. Showing all dependencies the projects I depend on have. Is it possible to limit the depth of the shown list?<br> Example:</p> <pre><code>+--- com.company.common:e-common-junit:0.29.0-SNAPS...
<p>Use grep:</p> <ul> <li><p>Show only top level dependencies:<br> <code>gradle dependencies --configuration compile | grep -v '| '</code></p></li> <li><p>Show two levels:<br> <code>gradle dependencies --configuration compile | grep -v '| | '</code></p></li> </ul> <p>etc</p>
Unity saving foreach? <p>I'm a bit new to unity please help me.</p> <p>How can i save something like this?</p> <pre><code>public float GetMoneyPerSec() { float tick = 0; foreach (UpgradeManager item in items) { tick += item.tickValue; } return tick; } </code></pre>
<p>To 'save' the data in a file you can serialize to a text document using either xml or JSON and deserialize it when the game runs. This is more convenient than player prefs as you can duplicate or edit the values in any text editor with ease. </p> <p>To persist data between scenes just ensure the class that holds th...
PHP function file_exists not working when using .htaccess rewrite rule <p>I am using following in my .htaccess file</p> <pre><code>RewriteCond %{SCRIPT_FILENAME} !-d RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule ^shopping-bag/?$ shoppingbag.php [L,QSA] </code></pre> <p>This changes the url</p> <blockquote> <p><a...
<p><code>foldername/shoppingbag.php</code> is the file you're running and <code>foldername/uploads/image.jpg</code> is the file it's interested in. The relative path should just be <code>uploads/image.jpg</code>.</p> <p>What does this give?</p> <pre><code>var_dump('uploads/image.jpg'); </code></pre>
How to modify a message in Log4J 2? <p>I'm trying to MODIFY, not DENY, certain messages before being logged using Log4J 2. I'm currently trying to use a <code>Filter</code>, but I can't seem to be able to modify a message from any of it's methods. Please be patient with me as I'm totally new to Log4j.</p>
<p>Log4j purposely does not let you modify the LogEvent as it might get passed on to other Filters and Appenders that expected the original event. However, the RewriteAppender will let you create a copy of the LogEvent that is modified and then pass that to a subordinate Appender. The RoutingAppender also supports a Re...
DataTable.ImportSheet operation failed.Invalid file <p>I'm running Excel tests on UFT and sometimes I get the error number 20012 which is "DataTable.ImportSheet operation failed.Invalid file".</p> <p>This is my way of importing the script:</p> <pre><code>DataTable.ImportSheet filepath,scriptname,"Action2" </code></pr...
<p>UFT syntax for importing a worksheet is:</p> <pre><code>DataTable.ImportSheet FileName, vtSrcSheet, vtDstSheet </code></pre> <p>This means you need to pass as parameters the filename (and path) to the excel file, the name (or index) of the source sheet you want to import, and then the destination you want this sh...
Is there an Umbraco plugin to give CRM-type capabilities? <p>In looking at the <a href="https://docs.kentico.com/display/K9/Organizing+contacts+into+accounts" rel="nofollow">Kentico documentation for account and contact management</a>, it seems to give us the ability to create a hierarchy for accounts, such as Account ...
<p>There is a free and open-source (according to the latest update from the creator: <a href="https://twitter.com/theotron/status/784372313773006849" rel="nofollow">https://twitter.com/theotron/status/784372313773006849</a>) plugin called <strong>Pipeline CRM</strong>: <a href="https://www.pipelinecrm.co.uk" rel="nofol...
r grep with or statment <p>I've been working on a r function to filter a large data frame of baseball team batting stats by game id, (i.e."2016/10/11/chnmlb-sfnmlb-1"), to create a list of past team matchups by season.</p> <p>When I use some combinations of teams, output is correct, but others are not. (output contain...
<p>I think that the issue is that regex inside <code>[]</code> behaves differently than you might expect. Specifically, it is looking for <em>any</em> matches to those characters, and in any order. Instead, you might try</p> <pre><code>matchups &lt;- grep(paste0("(", home, "|", away, ")mlb-(", home, "|", away, ")mlb")...
Find item in array using weighed probability and a value <p>Last week I had some problems with a simple program I am doing and somebody here helped me. Now I have run into another problem. I currently have this code:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> ...
<p>You could use this update to that code:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>// Pass the item list and the desired category as arguments: var findItem = funct...
Define file name via macro <p>I have the following piece of code to save a pdf file from an existing excel file.</p> <pre><code>Dim FSO As Object Dim s(1) As String Dim sNewFilePath As String Set FSO = CreateObject("Scripting.FileSystemObject") s(0) = ThisWorkbook.FullName If FSO.FileExists(s(0)) Then '//Change ...
<p><code>FullName</code> property returns the full path &amp; filename &amp; extension. Appending <code>Cells(2,2)</code> to that will give you a value like <code>"c:\path\to\filename.xlsx" &amp; Cells(2,2).Value</code>.</p> <p>You need to insert the week number (<code>Cells(2,2)</code>) <em>before</em> the file exten...
How to highlight function in all project with Eclipse (C/C++) by default? <p>This is the use case: You have a project where specific function is being called all over the files, you don't care about it but visually sometimes is annoying. Is there a way to highlight occurrence of this specific function by default in th...
<p>Check these two ways:</p> <h3>File wide</h3> <p>Change the mark occurrences annotations background color/Text preferences as shown below.</p> <p><a href="https://i.stack.imgur.com/thHy9.png" rel="nofollow"><img src="https://i.stack.imgur.com/thHy9.png" alt="enter image description here"></a></p> <p>But it applie...
Difference between constant time and effective constant time complexity <p>I understand "constant time complexity O(1)" , but when i came across the the term effective constant time complexity , i am very much confused . I got below sentence from Scala cook book about effective constant time . </p> <blockquote> <p...
<p>It means pretty much exactly what the quote says: it is not constant time, but, under some reasonable assumptions, it is only marginally worse than constant time, not enough to be noticeable.</p> <p>So, it's not constant time, but it's so close that the difference doesn't matter, which effectively makes it (almost)...
disjunctive syllogism in prolog <p>I am using swi-prolog. I want to model following statements in program. <em>"Either a or b is criminal. b is not criminal."</em> </p> <p>After modeling these statements. following query should work.</p> <pre><code>?-c(X). X=a. </code></pre> <p>But, when I wrote above statement...
<p>afaik Prolog does not work this way. It tries to match your expression with all statements. So if you want to model "a is a criminal and b is not", then you can write</p> <pre><code>criminal(a). not(criminal(b)). </code></pre> <p>but you can't say criminal(b) and in the next line not(criminal(b)), because this wou...
Linq "Object reference not set to an instance of an object." <p>Am a little lost on this one. Getting the error <code>Object reference not set to an instance of an object.</code> on the line <code>db.EntityRichContents.DeleteAllOnSubmit(q);</code> at runtime. Project builds fine.</p> <pre><code>protected override vo...
<p>I see there are two similar variables: one is <strong>ForEntity</strong> (possibly a class property property?) and the second being <strong>forEntity</strong> (method parameter). Is that a typo?</p> <p>Either way, given that the <em>Where</em> method is enumerated lazily I would assume that one of the lambda parame...
When Using Youtube Embed Code with start end and rel=0 attributes video goes back to zero when it ends not start offset <p>Here is my embed code with responsive wrapper:</p> <pre><code>&lt;div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;"&gt;&lt;iframe style="position: absolute; top:...
<p>Yes this behaviour is by design.</p> <p>And to my knowledge, you cannot override the replay button, so the easiest thing is probably to add a line of text saying when it starts.</p>
How to render parent data of nested object via Active model serializers for Rails? <p>I am working on Rails 5 api only app.</p> <p>So this is my model serializer</p> <pre><code>class MovieSerializer &lt; ActiveModel::Serializer attributes :id ,:name,:release_year,:story,:in_theater,:poster,:score,:user_count bel...
<p>You should add <code>ActiveModelSerializers.config.default_includes = '**'</code> to <code>config/initializers/active_model_serializers.rb</code>. See documentation <a href="https://github.com/rails-api/active_model_serializers/blob/master/docs/general/configuration_options.md#default_includes" rel="nofollow">here</...
Composite bitmaps with transparency <p>I have 2 bitmaps which I wish to overlay one on the other but using <code>Graphics</code> or <code>Magick.net</code> does not give the desired effect.</p> <p>Graphics gave the closest effect and fastest but the transparency seems to mess up.</p> <pre><code>using (Graphics gfcs =...
<p>I was writing the astronaut to the image 4096 times which looked like transparency was messing up.</p> <pre><code> public static void generateGIF() { int zoom = 1; int smileyID = 71; int goldBorder = 1; Console.WriteLine("Starting"); List&lt;Bitmap&gt; images = new Li...
Set Toggle switch based on condition on page load <p>Here is my code - </p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>(function () { $(document).ready(function ()...
<p>I added another javascript function to check for the toggle switch value and change it based on the condition. </p> <p>Here is my updated code - </p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js pre...
undefined reference error when trying to implement abstract class <p>I have an abstract class that is meant to be an interface:</p> <pre><code>//hpp #ifndef IMOVABLE_HPP_INCLUDED #define IMOVABLE_HPP_INCLUDED #include "StaticMovementPath.hpp" class IMovable{ protected: StaticMovementPath *staticMovementPath; pub...
<p>The StaticMovementPath.cpp wasn't targeted for debug nor release, so it wasn't compiling at all.</p>
Overflow Error in Excel VBA with Type Double <p>I have run into an overflow error in Excel VBA and cannot find my way around it. While Microsoft's documentation indicates that the range for doubles should reach ~1.8E308, I am receiving an overflow error for numbers significantly lower than that threshold. My code is as...
<p>Try using Chip Pearson's <code>XMod</code> function:</p> <pre><code>x(i) = XMod((CDbl(48271) * seed), CDbl(2 ^ 31 - 1)) </code></pre> <p>As he notes:</p> <blockquote> <p>You can also get overflow errors in VBA using the Mod operator with very large numbers. For example,</p> <pre><code>Dim Number As Double Di...
Remove newline characters that appear between curly brackets <p>I'm currently writing a text processing script which contains static text and variable values (surrounded by curly brackets). I need to be able to strip out newline characters but only if they appear between the curly brackets:</p> <p><code>Some text\nwit...
<p>You may pass the match object to a lambda in a <code>re.sub</code> and replace all newlines inside <code>{...}</code>:</p> <pre><code>import re text = 'Some text\nwith a {variable\n} value"' print(re.sub(r'{.*?}', lambda m: m.group().replace("\n", ""), text, flags=re.DOTALL)) </code></pre> <p>See <a href="http://i...
Not sure how to print this? <p>I'm supposed to modify code that I've written for an assignment: </p> <pre><code>public class ToweringStrings2 { public static final int H = 2; //constant for the tower public static void main(String[] args) { drawTowers(H); } public static void drawTowers(int ...
<p>You can create an extra variable to print and increment</p> <p>Like that:</p> <pre><code>public class ToweringStrings2 { public static final int H = 10; //constant for the tower public static void main(String[] args) { drawTowers(H); } public static void drawTowers(int H) { int co...
redux-form Migration to v6 throwing error in getValues.js <p>I'm attempting to use v6 of redux-form but running into some pretty undescriptive errors. The setup is straight forward, the reducer verbatim from the site:</p> <pre><code>import { combineReducers } from 'redux' import { reducer as formReducer } from 'redux-...
<p>You are using <code>v6</code> syntax but the version in your <code>node_modules/redux-form</code> is <code>v5</code>. That <code>getValues</code> function no longer exists in <code>v6</code>.</p> <pre><code>rm -rf node_modules/redux-form npm install --save redux-form </code></pre>
How to determine if a QPushButton's released signal is the result of auto repeat or an actual mouse release <p>I have a QPushButton that performs two actions. One action should occur every time the button's pressed slot is called, including calls through autoRepeat. The second action should be performed starting when t...
<p>I found that taking the following steps provided a relatively simple solution that did not require any additional event handling:</p> <ol> <li>Create a class member <code>isHeld</code> of type bool that defaults to false.</li> <li>Within the pressed slot, check <code>isHeld</code>. If if is false, set <code>isHeld<...
How get coordinates from Mediawiki <p>i have to do a web interface with a map inside...this map should take the coordinates of some place/city/or something else from the wikipedia database. I read something about mediawiki api but i can't understand how to use it. At this moment i found this code to take a text from wi...
<p>You should be able to get coordinate data out of Wikidata, using the <a href="https://query.wikidata.org" rel="nofollow">Wikidata Query Service</a> (WDS).</p> <p>For example, the <a href="https://query.wikidata.org/#SELECT%20%2a%20WHERE%20%7B%0A%20%20%3Fplace%20wdt%3AP625%20%3Flocation%20.%0A%20%20%3Fplace%20rdfs%3...
Failed network error while downloading the files from Google Chrome <p>I written the below c# code for downloading the attachments in my application, when i run the code i can download the files using Mozilla, internet explorer but this is not working in Google Chrome.</p> <pre><code> string bas...
<p>Google Chrome will not open a "file save" window for you if <code>"application/octet-stream"</code> is your response from a form. </p> <p>The content-type should be whatever it is known to be, if you know it. E.g. <code>"application/pdf"</code>, <code>"image/png"</code> or whatever. See <a href="https://developer.m...
django: how to make two models share one unique primary key <p>In my case, I have two models: Equipment and Asset, they both have their own fields but they should share one unique field: asset_number. By sharing, I mean that when creating a equipment, the asset_number user inputted would be check against both Equipment...
<p>I think the best solution would be to make a parent class and make both <code>Asset</code> and <code>Equipment</code> inherit from it. </p> <p>For example, you could make a <code>BaseAsset</code> class with an <code>asset_id</code> unique field. As both classes will share the same table for <code>asset_id</code>, t...
Universal Windows App - Auto Startup <p>We have developed a Universal Windows App mainly focusing for Desktops. We are able to install and run the app without any issue.</p> <p>Now our client is asking for Auto Startup facility, whenever the machine is started or restarted, the app should run automatically.</p> <p>We...
<p>Hello I think it could better for you enable kiosk mode for your app here is the doc </p> <p><a href="https://msdn.microsoft.com/en-us/library/windows/hardware/mt633799(v=vs.85).aspx" rel="nofollow">https://msdn.microsoft.com/en-us/library/windows/hardware/mt633799(v=vs.85).aspx</a></p>
How to clear cin Buffer in c++ <p>I have gone through many existing answers here StackOverflow, but I am still stuck.</p> <p>code:</p> <pre><code>int c; cin &gt;&gt; c; if(cin.fail()) { cout &lt;&lt; "Wrong Input"; cin.clear(); cin.ignore(INT_MAX, '\n'); } else { cout &lt;&lt; c*2; } </code></pre> <p...
<p>the max() function needs to be defined in the beginning of the file. <code>cin.ignore()</code> works very well to clear the buffer, however you need the numeric limits function max(), which in my case was giving error.</p> <p>Solution:</p> <pre><code>#ifdef max #define max #endif </code></pre> <p>add these lines ...
Excel VBA copy pasting each named range to word <p>I have dynamic named range of cell. I need to paste each named range in one page of word and move to next page for next named range. I tried copule of code, I am unable to do.Each named range data is overlapping each other. Can anyone help me, please.</p> <pre><cod...
<p>It sounds like you want to copy each range onto different pages so I'm not sure why you're using a union. Here is a quick example of copying each named range 'name' onto a new sheet in a word document. Note: I created a new doc for simplicity.</p> <p><strong>Edit</strong> - I added copy/paste functionality of dat...
Android error during build - "default public constructor with no argument must be declared". What's the cause? <p>Android studio returned an error during build, even after running Clean, and rebuilding:</p> <blockquote> <p>A default public constructor with no argument must be declared if a custom constructor is de...
<p>Example :</p> <pre><code>public class ModelResult { String Ques; String Ans; public String getQues() { return Ques; } public void setQues(String ques) { Ques = ques; } public String getAns() { return Ans; } public void setAns(String ans) { Ans = ans; } public ModelResult(String ques, String an...
zip error - Nothing to do <p>I try to zip all folders in given directory. So I wrote this</p> <pre><code>find /home/user/rep/tests/data/archive/* -maxdepth 0 -type d -exec zip -r "{}" \; </code></pre> <p>but got</p> <pre><code>zip error: Nothing to do! (/home/user/rep/tests/data/archive/tmp.zip) zip error: Nothing ...
<p>The issue is that you have not provided a name for the zip-files it will create.</p> <pre><code>find /home/user/rep/tests/data/archive/* -maxdepth 0 -type d -exec zip -r "{}" "{}" \; </code></pre> <p>This will create separate zipped directories for each of the subfolders <code>tmp</code> <code>tmp_dkjg</code> and...
Google Play services out of date. Requires 9683000 but found 9452230 <p>I've been testing my android app on a phone with Android 5.1.1 and everything's been working fine, but today I tested it on a tablet with Android 5.0.2 and I'm getting the following warning and the app won't run its service: </p> <p><code>GooglePl...
<p>If the tablet's Google Play Services is up-to-date, you may not have the latest SDK versions. </p> <ul> <li>Go to the SDK Manager and open the stand alone SDK Manager</li> <li>Update the Android SDK Tools, The Android SDK Platform-tools and Android SDK Build-tools. </li> </ul> <p>Hopefully the referenced libraries...
Filtering nested array in Mongo Java driver <p>Following NoSQL query returns all reviews of a particular user : </p> <pre><code>db.getCollection('catalog-review').aggregate([ { $project: { reviews: { $filter: { input: "$reviews", as: "review", cond: { $eq: [ "$$rev...
<p>The problem is <code>Arrays.asList(new Document("$$review.userId", 121))</code>. It should be <code>Arrays.asList("$$review.userId", 121)</code>. </p> <p><code>Arrays.asList(new Document("$$review.userId", 121))</code> = <code>[ { "$$review.userId" : 121 } ]</code></p> <p><code>Arrays.asList("$$review.userId", 121...
PHP json_encode returning single row only <p>So I have an associative array <code>$_SESSION['cart_items'])</code> This is the current output when I <code>print_r($_SESSION['cart_items'])</code>:</p> <pre><code>Array ( [3] =&gt; 23 [5] =&gt; 5 [4] =&gt; 1 ) </code></pre> <p>In the output above, the first ...
<p>You show that the array keys in the session array match the <code>id</code>s in the database. <code>implode()</code> implodes/joins the values in the array. So you need to implode the keys:</p> <pre><code>implode(',', array_keys($_SESSION['cart_items'])) </code></pre> <p>Or flip the array:</p> <pre><code>implode...
Linked List using generics, getting "not applicable arguments for parameters" error <p>My Node class:</p> <pre><code>public class Node&lt;T&gt; { protected T data; protected Node&lt;T&gt; next; protected Node&lt;T&gt; previous; public Node() { this.data = null; this.next = null; ...
<p>You need to fix two things. First, the class declaration of LinkedList says:</p> <pre><code>public class LinkedList&lt;T extends Node&lt;T&gt;&gt; { </code></pre> <p>which means that T has to be both a Node and the element of a Node. This doesn't work with Character since a Character is not an instance of Node. If...
Get the number of passed and failed tests with their name from command line <p>I am writing Python script which will run <code>mvn test</code> on different folders, and I want to get number of passed test and failed tests and their names from script.</p> <p>Now I just have managed to run process and get it output</p> ...
<p>There are multiple solutions, but no direct one... they would all involve some parsing (XML or text file).</p> <h3>XML reports</h3> <p>This is probably the safest and simple route. Surefire generates by default XML reports inside <a href="https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#repor...
SQL Server - Convert table data to xml <p>Hi I have the following table data I need to convert to Xml in SQl Server. Any ideas?</p> <p>Thanks in advance</p> <p>From</p> <pre><code>Party_Id HomePhoneNumber WorkPhoneNumber 62356 6314993578 62356 6314590922 62356 6313...
<p>Convert the empty values into NULLs. These NULL values will be excluded from the XML.</p> <pre><code>Declare @YourTable table (Party_Id int,HomePhoneNumber varchar(25),WorkPhoneNumber varchar(25)) Insert Into @YourTable values (62356,'6314993578',''), (62356,'','6314590922'), (62356,'','6313795488') Select Ho...
Detecting the locations of circles and crosses in an image <p>I'm new to OpenCV and was wondering if anybody could direct me to the most suitable algorithm(s) to tackle the challenge of identifying the locations of circles and crosses in images that look like the following . . </p> <p>[<img src="https://i.stack.imgur....
<p>Not an easy task.</p> <p>For the colored case, you should start by separating the color planes. There is some chance that you can get the markers apart.</p> <p>But for the b&amp;w case, there is no escape, you must go deeper.</p> <p>I would try to detect the grid lines first, for example using a Hough line detect...
How can I compare a master list of serial numbers and compare it to a seperate list and have it mark duplicates? <pre><code>Sheets("Die Sizes").Select Columns("A:A").Select Selection.FormatConditions.Add Type:=xlTextString, String:= _ "=cells(i,ForgeSchedule!B2)", TextOperator:=xlContains Selection.FormatCondition...
<p>Sounds like you just need a loop. Perhaps something like this (air code):</p> <pre><code>Dim lngRow As Long Sheets("Die Sizes").Select Columns("A:A").Select For lngRow = 2 To 3200 Selection.FormatConditions.Add Type:=xlTextString, String:= _ "=cells(i,ForgeSchedule!B" &amp; lngRow &amp; ")", TextOpera...