input
stringlengths
51
42.3k
output
stringlengths
18
55k
Xamarin Forms Animations on startup <p>Im trying to get an image to be animated the moment the page is loaded but my approach doesnt seem to work on startup. But i have tested it with a button and it plays the animation no bother.</p> <p>This is my constructor for my MainPage</p> <pre><code>public MainPage() { In...
<p>Your running the animation before you Content is even set (Possible Animation is finished before you can even view it which help with argument of the animation working on button click I would also do as you suggested and move the animation.commit inside the OnAppearing method and set the animation to a longer length...
How to count common concepts and store the result in a matrix? <p>I want/need to create a matrix of 1's and 0's that contains the information about common terms. I created a matrix of common terms between columns (e.g. with rows like 1,4,2) but I do not figure out how to disaggregate it. </p> <p>Here is a toy and repr...
<p>You can try </p> <pre><code>table(col(my.data.frame), as.matrix(my.data.frame)) apple apple and pear banana orange orange and pear pear 1 1 1 0 0 0 1 2 0 1 1 1 0 0 3 1 0 1 0 ...
Why does DOMXPath->evaluate() return false <p>I am trying to <a href="http://php.net/manual/de/domxpath.evaluate.php" rel="nofollow"><code>evaluate()</code></a> an input XPath by using the DOMXPath object and its evaluate() function. However, I am getting some unexpected results. In the example, the two XPath structure...
<p>That's because the following part of your 2nd XPath is not valid, since XPath 1.0 -which <a href="http://php.net/manual/en/class.domxpath.php" rel="nofollow"><code>DOMXPath</code></a> supports- doesn't support calling function in a path step :</p> <pre><code>../node[@rel="hd" and @pt="n"]/number(@begin)] </code></p...
Save a PDF file of Sharepoint in a directory in java <p>I am working in a jsp file. I have a lot of files available in my Sharepoint intranet with link like this : </p> <blockquote> <p><a href="http://myIntranet.eu/my%pdf%1.pdf" rel="nofollow">http://myIntranet.eu/my%pdf%1.pdf</a></p> </blockquote> <p>I want saved ...
<p>If there is no web service or rest service from sharepoint to get the pdf, you can try to use an http client <a href="http://hc.apache.org/httpcomponents-client-ga/" rel="nofollow">http://hc.apache.org/httpcomponents-client-ga/</a> to make request to sharpoint on java server to get the pdf file. Maybe you need authe...
What does opsmenu do? <p>I noticed that a user on one of the SAS servers I use at work was running the following SAS related process:</p> <pre><code>/opt/apps/sas91/SAS_9.1/SASProfiles/Menus/opsmenu </code></pre> <p>Does anyone know what this does? I can't find any mention of it on Google, this site, the SAS support ...
<p>OPSMENU is used for the administration of SAS user profiles - specifically it refers to the Options Menu. This command would typically be used to perform admin tasks such as creating a new user profile. OPSMENU is an outdated process though, so it's not used in more recent versions of SAS (this is probably why you...
codeigniter - relational table <p>I'm using codeigniter for the first time. I'm used to MVC but only .net, not PHP.</p> <p>So, I have a table 'categories', a table 'countries', and a table 'category-countries'. Let's suppose the first 2 tables only have 'id' and 'name', and the third one have 'country_id' and 'categor...
<p>I'm not writing code for you but will provide some guidance which I hope is helpful.</p> <p>Your work will be easier if you become familiar with Codeigniter's <a href="http://www.codeigniter.com/user_guide/helpers/form_helper.html" rel="nofollow">Form Helper.</a> In particular, to create a multiselect field for the...
Pausing and resuming BackgroundWorker <p>I've been wondering is there any way in which we can move BackgroundWorker to sleep and resume it again just like thread. I've searched in many forums in vain. None of them show any method which would do that. I checked Microsoft documentation and found out there isn't any prede...
<p>If you use Task instead of BackgroundWorker you can use the <a href="https://blogs.msdn.microsoft.com/pfxteam/2013/01/13/cooperatively-pausing-async-methods/" rel="nofollow">PauseTokenSource</a>.<br/><br/> This class is similar to the built in <strong>CancellationTokenSource</strong> only suitable for pausing tasks ...
Dynamically Removing Inputs / DOM Error <p>I've been able to make a section of a form that dynamically adds a tier of inputs on a button click. This new div is appended after the previous div and I am attempting to make a button that can also remove the tier if the user doesn't need it.</p> <p>My problem is I cannot ...
<p>You function is right just add the paramter "this" when you put the function in the onclick attribute, like this:</p> <pre><code>onclick="removeJob(this)" </code></pre>
onClick method in fragment never gets called <p>I tried to set up a onClickListener inside my fragment.</p> <pre><code>public class HomeFragment extends Fragment implements View.OnClickListener { Button btn_eventList; public HomeFragment() { // Required empty public constructor } @Override public View onCreateV...
<h1>EDIT</h1> <p>Since Sevin made me notice I was not giving you a solution but an alternative way for reaching your goal, I'm editing this.</p> <p><strong>First: your code must work</strong></p> <p>The code you posted is correct</p> <p><strong>Now, do some checks:</strong></p> <ul> <li>Check if in debug mode the ...
How to avoid the 'callback hell' with promises? <p>I'm new to Promises and would like to understand what is the correct way to avoid the 'callback hell' with promises, since I'm having the same exact problem as using callbacks</p> <pre><code>foo(a: number): Promise&lt;boolean&gt;{ return doSomething(a).then((b)=&g...
<p>Just chain the promises instead of nesting them:</p> <pre><code>foo(a: number): Promise&lt;boolean&gt; { return doSomething(a).then((b) =&gt; { return doAnotherThing(b); }).then((c) =&gt; { return true; }); } </code></pre> <p>See <a href="https://developer.mozilla.org/en-US/docs/Web/Jav...
How to force Scala to use a different library version? <p>After adding</p> <pre><code>libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.0" % "test" </code></pre> <p>to <strong>build.sbt</strong>, and refreshed the project, I got this msg.</p> <blockquote> <p>SBT project import</p> <p>[warn] Multipl...
<p>Don't substitute; you need both <code>scalaVersion</code> and <code>libraryDependencies</code>. Though use</p> <pre><code>scalaVersion := "2.11.8" libraryDependencies ++= Seq( "org.scala-lang" % "scala-reflect" % scalaVersion.value, "org.scala-lang.modules" %% "scala-xml" % "1.0.5" ) </code></pre> <p>to avoi...
Trouble with using defmulti dispatch function <p>I have written this multi function in clojure.</p> <pre><code>(defmulti printlmt (fn [s] (&gt; (count s) 10))) (defmethod printlmt true [s] (println s)) (defmethod printlmt false [s] (println (take 10 s))) </code></pre> <p>I then try to execute it as below..</p> <pre>...
<p>If you don't want to restart your repl for redefining a method, use <code>remove-method</code></p> <p><a href="https://clojuredocs.org/clojure.core/remove-method" rel="nofollow">https://clojuredocs.org/clojure.core/remove-method</a></p> <pre><code>(remove-method printlmt true) </code></pre> <p>then redefine.</p> ...
what are the different ways to send data between two pages? <p>I've search block which gives multiple results(names) as links, following the link user can edit the details. How can I send the user name to the second page.</p> <p>I have tried passing the results in the url. It is not working in some cases( url encoding...
<p>When there are a lot of data that needs to be sent from one page to another, <strong>SESSION</strong> is the best possible option. It's secure too since it's stored on the server side.</p> <p>For example,</p> <p><strong>page1.php</strong> - <em>Store session values in this page</em> </p> <pre><code>$_SESSION['myV...
Prompt user, wait a few seconds, then end program? <p>Simple project using a switch statement. I have 4 choices, and 1-3 work great. The 4th choice in the switch statement (case 4, duh) has to prompt the user with "thank you!", then wait for a few seconds so they can read it, then have the program end. I got the "thank...
<p>You can make your own portable delay function by using the standard <code>clock()</code> function.</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;time.h&gt; void sleeper(unsigned seconds) { clock_t start, period, elapsed; period = seconds * CLOCKS_PER_SEC; start = clock(); do { elapse...
SSRS IIF IsNothing Calculation <p>I have the following statement input as the background color of a cell which works fine, but if that cell is blank my code returns a shade of red.</p> <pre><code>=IIF(Fields!DBS_Next_Due___App_1.Value &lt;= Today(), "#FF9696", IIF(Fields!DBS_Next_Due___App_1.Value &lt;= dateadd("d",...
<p>You simply need to check for null and OR it with the &lt;=.</p> <pre><code>IIF(IsNothing(Fields!xxx.Value) OR Fields!xxx.Value &lt;= Today()) </code></pre>
Scrapy (python) TypeError: unhashable type: 'list' <p>I have this simple scrappy code. However get this error when i use <code>response.urljoin(port_homepage_url)</code> this portion of the code.</p> <pre><code>import re import scrapy from vesseltracker.items import VesseltrackerItem class GetVessel(scrapy.Spider):...
<p>The <code>ports.xpath('td[7]/a/@href').extract()</code> returns a <em>list</em> and when you try to do the "urljoin" on it, it fails. Use <code>extract_first()</code> instead:</p> <pre><code>port_homepage_url = ports.xpath('td[7]/a/@href').extract_first() </code></pre>
List item text keeps wrapping under icon <p>Just trying to sort out a frustrating issue with my icons i am using inside my list items. When the text wraps onto another line it always goes under the icon instead of directly underneath the first line of text. Cant work out whats going on. I have tried adding a height to ...
<p>A better way is to place icon with <code>position: absolulte</code> and add some left indent on <code>&lt;li&gt;</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-css lang-css prettyprint-override"><code...
Is there a Design Pattern for Data Object structures that frequently change? <p>Is there a Design Pattern for Data Object structures that frequently change? </p> <p>I am refactoring a Genetic Algorithm where the structure of the Chromosomes (number of genes, type of genes and boundary of genes) change from problem to ...
<p>If chromosomes are just a collection of gene objects, they become easier to work with, especially if the boundary is also considered as an object.</p> <pre><code>public class Gene { public string Id { get; set; } public double Value { get; set; } public Boundary Boundary { get; set; } } public class Bo...
How to share a global variable between server and client code in Meteor <p>I'm trying to share a varible between server and client code.I have declared the global variable in /lib/environment.js</p> <pre><code>test = null; </code></pre> <p>In the server/main.js,I'm updating this variable when I receive a POST request...
<p>Because Meteor works in such an integrated way, it makes you think this is possible, but the server process will run on a server, and the client runs in the browser. Easy to forget that.</p> <p>To share data, the easiest way is to use a collection, which if published and subscribed, gives you the same effect as a g...
How do I pass Haskell data through a C FFI as an opaque data type? <p>I'm trying to pass some data through a C library that doesn't read or modify that data.</p> <pre><code>foreign import ccall "lua.h lua_pushlightuserdata" c_lua_pushlightuserdata :: LuaState -&gt; Ptr a -&gt; IO () foreign import ccall "lua.h lua_...
<p>This is what <a href="https://hackage.haskell.org/package/base/docs/Foreign-StablePtr.html#t:StablePtr" rel="nofollow">StablePtr</a> is for. So you have to use <a href="https://hackage.haskell.org/package/base/docs/Foreign-StablePtr.html#v:newStablePtr" rel="nofollow">newStablePtr</a> in place of your <code>dataFrom...
how to use MVC6 Dependency Injection methods <p>I have a translation service and I need to expose a property that I want to use across my application.</p> <pre><code>services.AddScoped&lt;IMyTranslator, MyTranslator&gt;(); </code></pre> <p>I use services.AddScoped to register this interface and its implementation. Wh...
<p>The <code>services.AddScoped</code> is already scoped to the user request, each time a user request reaches the server, an instance is created to serve this specific request only and it is not shard with other users.</p>
Time based Eviction Policy in Apache Ignite <p>Like Hazelcast have Time based Eviction on Listener, Is there any such Policy in Apache's Ignite cache.</p> <p>I tried,</p> <pre><code>setExpiryPolicyFactory(FactoryBuilder.factoryOf( new CreatedExpiryPolicy(new Duration(TimeUnit.SECONDS, 123)))); </code></pre> <p>but i...
<p>You can do it like this:</p> <pre><code>cache.withExpiryPolicy(new CreatedExpiryPolicy(new Duration(TimeUnit.SECONDS, 123))).put(k, v); </code></pre> <p>The expiration will be applied only to this entry.</p>
iOS10: tapping an action from local notification does not bring app to the foreground <p>I am trying to implement the action from notification. And so far I am able to trigger the right delegate functions, but after tapping the app is not brought to the foreground. </p> <p>Relevant code:</p> <pre><code>@available(iOS...
<p>I found out the reason myself, so this might be helpful to someone in the future. The answer turned out to be quite simple. When creating an action of the notification, there is this parameter: options. When you register category, you need to put it either way .Foreground or .Destructive like this:</p> <pre><code>f...
Converting array into object and call a function on it <p>I have an array returned by a query. I want the array to be an object, so I write:</p> <pre><code>$object = (object)($array); </code></pre> <p>I want to call a method on $object, but when I launch:</p> <pre><code>$object-&gt;getUsername(); </code></pre> <p>I...
<p>When you're casting array to object, it created <code>stdClass</code> instance.</p> <p>It's a simple object with all public properties.</p> <p>So simply access them like this:</p> <pre><code>$object-&gt;name; </code></pre> <p>Here's a working example: <a href="https://3v4l.org/Ui9uY" rel="nofollow">https://3v4l....
dart angular2 - function in sub-component <p>I do not manage to call a function within the template of a subcomponent :</p> <p>For instance, the following doesn't work :</p> <pre><code>&lt;button onclick="{{myFunction()}}"&gt; </code></pre> <p>Nothing is displayed, I have the error : Could not find asset MyOuterComp...
<p>Wrapping something with curly braces {{}} is an expression. It is meant for printing a value. What you are trying to do is calling a function. SO just remove the curly braces and assign it with ng-click e.g:</p> <pre><code>&lt;button (click)="myFunction()"&gt;Save&lt;/button&gt; </code></pre> <p>Hope this helps</p...
write unicode objects from loop to list in Python <p>I have a loop that returns me unicode objects:</p> <pre><code>for i in X: print i Output: A B C ... Z </code></pre> <p>How can I make a list of these objects to get the folloving?</p> <pre><code>['A', 'B', ..., 'Z'] </code></pre> <p>If they were num...
<p>try this:</p> <p><code>output_list = [y for y in x]</code></p> <p>in your loop:</p> <pre><code>for i in X: i.append(X) </code></pre> <p>it takes each item in <code>X</code>, which are unicode chars, and tries to append the whole <code>X</code> object to it.</p> <p>I think what you're wanting to do is like t...
PhantomJS - select value from page <p>How to select value from the webpage using PhantomJS? Here is code in html:</p> <pre><code>&lt;html lang="en-US" class="xxx"&gt; &lt;head&gt;&lt;/head&gt; &lt;body class="xxxx"&gt; &lt;section class="Section"&gt; &lt;div id="mocha"&gt; &lt;ul id="mocha-stats"...
<p><code>document.querySelectorAll("li.passes")</code> returns a collection with the single <code>li</code> element that matches that selector. You need to change your code to <code>document.querySelectorAll("li.passes &gt; em")[0].textContent</code>. This will match the <code>em</code> inside the <code>li</code> and r...
error: cannot find symbol method getColor(Context,int) after adding Sugar ORM to project <p>I would like to use SugarOrm in my app.</p> <p>If I add the followings:</p> <pre><code> compile 'com.github.satyan:sugar:1.4' </code></pre> <p>to the gradle file</p> <p>and </p> <pre><code> android:name="com.orm.SugarApp" <...
<p>From the <a href="https://developer.android.com/reference/android/support/v4/content/ContextCompat.html" rel="nofollow">Android Documentation</a>: </p> <blockquote> <p>Helper for accessing features in Context introduced after API level 4 in a backwards compatible fashion.</p> </blockquote> <p>Do you really ne...
Loosing thousands of observations using RODBC <p>Comparing base SAS to RODBC in R for accessing ORACLE SQl databases. </p> <p>I'm trying to access to an ORACLE SQL database. If I run this in SAS with this code: </p> <pre><code>LIBNAME LIBNAME ORACLE SCHEMA=SCHEMA PATH="*****"; PROC SQL ; CREATE TABLE work.eval_view ...
<p>I would troubleshoot it by testing with the <code>ROracle</code> package which runs with the <code>DBI</code> package to connect to the database. I don't have access to an Oracle database to test with, but trying a second package will let you know if the issue with with your database interface or something else.</p>...
Trying to get my data to write to specific columns and to sorted in alphabetical order <p>The following code works, but when I open the CSV file it doesn't come up in alphabetical order or in any specific columns.</p> <p>I would like <code>name</code> to come up in <strong>column 1</strong> and the <code>grade</code>...
<p>in order to write each name and grade in a separate column do this:</p> <p><strong>Switch</strong></p> <pre><code>w.writerow([self.n.get()]) w.writerow([self.e.get()]) </code></pre> <p><strong>For</strong></p> <pre><code>w.writerow([self.n.get(), self.e.get()]) </code></pre> <p>There is already a question on ho...
While with assignment in swift <p>what is the proper way to convert this ObjC code into Swift?</p> <pre><code> while ((size = [inputdata readWithByteArray:buf]) != -1) { //... } </code></pre> <p>I need similar to this (<a href="http://stackoverflow.com/a/25668371/1979882">from here</a>):</p> <pre><code>while ...
<p>You can use <code>while case</code> with a binding pattern plus a boolean condition:</p> <pre><code>// Swift 3 (Xcode 8): while case let size = inputdata.readWithByteArray(&amp;buf), size != -1 { // process data } // Swift 2 (Xcode 7.3.1): while case let size = inputdata.readWithByteArray(&amp;buf) where size...
Firebase Hosting redirect www.site.com to site.com <p>I have completed my site setup via Firebase hosting, and everything works correctly. The problem is that my site make a redirect from <code>www.site.com</code> to <code>site.com</code></p> <p>How can I prevent it? How can I get always <code>www.site.com/</code>?</p...
<p>You have <code>site.com</code> registered as the domain in your <a href="https://firebase.corp.google.com/project/firebase-kato-sandbox/hosting/main" rel="nofollow">Firebase Hosting console</a>. Thus, the domains point there.</p> <p>Register that domain as <code>www.site.com</code> and it will always show as this. ...
JQuery Not equal to selector <p>How can I do something if only the selector's attr is not equal to a certain value?</p> <p>For example:</p> <pre><code> function date_box(thisdiv){ var week = $(thisdiv).attr("week"); $(".gospel_table5[week!="+week+"]").hide(); } </code></pre> <p>To put into human, if the <code>...
<p>You can use the <code>:not()</code> pseudo-class (or whatever they're called):</p> <pre><code>$(".gospel_table5:not([week=" + week + "])").hide(); </code></pre>
Mykrobe predictor AMR prediction not working <p>I am getting the following error message when trying to execute AMR prediction on the command line.</p> <pre><code>mykrobe predict tb_sample_id tb -1 /home/TB/demo_input_file_for_M.tuberculosis_app.fastq </code></pre> <p>The species chosen was Tuberculosis (TB), whereas...
<p>The error indicates that <code>mccortex31</code> is missing. </p> <p>Did you install it according to the <a href="https://github.com/iqbal-lab/Mykrobe-predictor" rel="nofollow">documentation</a>?</p> <pre><code>cd Mykrobe-predictor cd mccortex make export PATH=$PATH:$(pwd)/bin cd .. </code></pre>
how to make a new line in a tag table (Spring MVC)? <p>I have troubles with putting a newLine in a Java String sended to a .jspx file. I have a table and in a cell i want display the content of the string received from the controller as :</p> <p>|-------|<br> | aaa |<br> | bbb |<br> |-------|<br><br> i...
<p>Try enclosing within, </p> <pre><code>String cell= "&lt;pre&gt;"+a +"&lt;br/&gt;"+ b+"&lt;/pre&gt;"; </code></pre>
Protocol being reset in cell <p>I have a cell with a textField and a button. The button opens a page to collect data and has a protocol to pass that data back to the cell and fill the textField. That all works fine, however, when I come back the value is reset to zero. Print statements show that it is passing the data ...
<p>the text field is only set when you call the function. Unless you call this function in cellForRowAtIndex path it wont retain the value</p> <p>I would likely implement it using a setter, do everytime the value is set, the label gets updated</p> <pre><code>protocol DistanceProtocol { func distanceSet(distance: ...
How to insert/remove items from RecyclerView using MVP <p>While using recycler view in MVP, where do you guys keep a reference to the list? I have a <code>ChatManager</code> which can talk to different presenters. I keep two copies of the list of messages , one in the <code>ChatManager</code> and the other in the <cod...
<p>the best practice is to update adapter list from the view implementation but the function for this task should be on view interface and implemented in view implementation (e.g. fragment or activity)</p> <p>firstly add a method to your adapter like below</p> <pre><code>public void updateItemsList(ItemsList itemsLis...
How to use variables in mpn scripts on windows <p>I've got a bare repository from which we start new projects. Inside this repository is another repository that has to be updated seperately. Every project starts with these two repositories, but sometimes during the project they should not both be updated.</p> <p>I'm t...
<p>If you look at the following page: <a href="https://github.com/npm/npm/pull/5518" rel="nofollow">https://github.com/npm/npm/pull/5518</a> (it's on the answer you linked to) </p> <pre><code>"new_project": "git clone x:/parent_repo $PROJECT &amp; cd $PROJECT &amp; git clone x:/child_repo" </code></pre> <p>Then:</p> ...
What command to use to see what branch my actual branch derived from? <p>I'd like to see what branch my actual branch I'm on is derived from. I already took a look at the log but it's so noisy and I want to get 100% sure to find the correct branch in this case.</p>
<p>This problem cannot be answered in every case. Branches are not persistent: you are free to move branches around. The reflog will allow you to see <em>some</em> history of the branch, but the reflog is only local and will be limited to 90 days (by default).</p> <p>You can use <code>git reflog &lt;branch&gt;</code> ...
C# splitting string <p>I have the following piece of code:</p> <pre><code>string FullNote = "aaa bbb ccc"; string ExistingAdminNote = "bbb"; string[] NoteDifference = FullNote.Split(new string[] { ExistingAdminNote }, StringSplitOptions.None); for (int ii = 0; ii &lt; NoteDifference.Length; ii++) Response.Write(...
<p>You're splitting on <code>bbb</code> when you should be splitting on the space character. Your delimiter string will not show up on your result array. The delimiter needs to be the common string that separates the values that you want.</p>
Kotlin: Sum of BigDecimal in a list <p>I have a list that I want to filter, then return a map of id with sum of amounts:</p> <pre><code>val totalById = list .filter { it.status == StatusEnum.Active } .groupBy { it.item.id } .mapValues { it.value.sumBy { it.am...
<p>You can create your own <code>sumByBigDecimal</code> <a href="https://kotlinlang.org/docs/reference/extensions.html#extension-functions" rel="nofollow">extension function</a> similar to <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/sum-by-double.html" rel="nofollow"><code>sumByDouble</code...
Is there a common way of getting the uploaded file across multiple Python frameworks? <p>Is there a common way of getting the uploaded files in Python just like $_FILES is in PHP? </p> <p>In Django there is <code>request.FILES['fieldid']</code>, in Pyramid <code>request.POST['fieldid']</code>, while in Flask <code>req...
<p>I think the answer is no! Because for example in django, the HttpRequest class which has FILES attribute, is a dictionary and is populated by other parts of framework. So this object is created and built by django and only inherited from object class so it is just a dictionary. </p> <pre><code>class HttpRequest(...
What role provides access to the Replica-Set status method (rs.status()) for MongoDB? <p>I would like to create a user that just has access to retrieve the status of our replica-set. Is there a built-in or other role that allows this? The docs do not seem to indicate what role is even needed to call any of <code>rs.</c...
<p>You want the "clusterMonitor" role.</p> <p>See <a href="https://docs.mongodb.com/manual/reference/built-in-roles/#clusterMonitor" rel="nofollow">https://docs.mongodb.com/manual/reference/built-in-roles/#clusterMonitor</a>.</p>
Reverse redirect does not work but inserts data into db <pre><code>from django.db import models from django.core.urlresolvers import reverse class Gallery(models.Model): Title = models.CharField(max_length=250) Category = models.CharField(max_length=250) Gallery_logo = models.CharField(max_length=1000) ...
<p>You're passing <code>kwargs</code> to <code>reverse</code> as a <em>set</em>, when it should be a dictionary:</p> <pre><code>kwargs={'pk': self.pk} # ^ </code></pre>
How to get points coordinate position in the face landmark detection program of dlib? <p>There is one example python program in dlib to detect the face landmark position. <a href="http://dlib.net/face_landmark_detection.py.html" rel="nofollow">face_landmark_detection.py</a></p> <p>This program detect the face feature ...
<p>I slightly modified the code.</p> <pre><code>import dlib import numpy as np from skimage import io predictor_path = "shape_predictor_68_face_landmarks.dat" detector = dlib.get_frontal_face_detector() predictor = dlib.shape_predictor(predictor_path) img = io.imread("FDT.jpg") dets = detector(img) #output face l...
Looping with while function with Selenium throws error NameError: name 'neadaclick' is not defined <p>I am trying to automate a task in my work. I already have the task and every time I click on the program I can accomplish it, however I would want to be able to do the tasks several times with one click so I want to en...
<p>@ElmoVanKielmo pointed out a mistake that i failed to notice, my first declaration is needaclick but on the next line i wrote neadaclick, this has been solved and its working.</p>
Exchanging Data between two different Wordpress databases <p>My wordpress website has two plugins that seems to be taking up a lot of memory. It eventually times out after 30 seconds when I try to pull up data or do certain tasks.</p> <p>When one of the plugins are disabled, it performs a lot better. The problem is, t...
<p>You need to fix the underlying issues in the one WordPress site with the Ecommerce and LearnDash plugins, because 1) and 2) are huge wastes of time that will result in a buggy, unreliable system that will be difficult to maintain.</p> <p>3) look in your server logs for the PHP timeout and memory errors; adjust PHP ...
Why this "segfault" with dplyr arrange function in R <p>Following code consistently produces crash on my R system 3.2.2 : </p> <pre><code>&gt; R.version _ platform i486-slackware-linux-gnu arch i486 os linux-gnu ...
<p>It is a nested <code>list</code>, so one way would be to <code>unlist</code> the inner <code>list</code>, <code>rbind</code> the outer <code>list</code> and convert to <code>data.frame</code></p> <pre><code>dd &lt;- data.frame(do.call(rbind, lapply(lll, unlist))) arrange(dd, X1) # X1 X2 X3 #1 5 3 4 #2 5 3 7 ...
If a bug is fixed on the master branch but hasn't been released on npm, how can I incorporate the fix into my project? <p>A library that we're using has merged a critical bug fix, but it hasn't been released as a new version on npm. How can we pull down the new change?</p>
<p><a href="https://docs.npmjs.com/files/package.json#git-urls-as-dependencies" rel="nofollow">NPM Docs for Git URLs as Dependencies</a></p> <blockquote> <p>Git urls can be of the form:</p> </blockquote> <pre><code>git://github.com/user/project.git#commit-ish git+ssh://user@hostname:project.git#commit-ish git+ssh:/...
Use a date within a query to select which monthly table to query <p>I'm new and asking for help</p> <p>Within ACCESS (Amongst a tangled web of mapping tables)</p> <p>I have a table of approvals that has the date they were set up.</p> <p>I have a years worth of separate monthly HR staff lists that are snapshots inclu...
<p>You can't "conditional join" but you can join to a bunch of things with a left join and ignore the wrong ones.</p> <p>You give no details of your case so I will make it up:</p> <pre><code>select coalesce(jan.field, feb.field, mar.field, ... dec.field, 0) as result from atable a left join jan on a.id = jan.id and a...
missing package in Coldfusion 9 using JavaLoader <p>I have ColdFusion 9.0.2 and Java 1.6.0_29. I'm trying to use the <a href="https://github.com/markmandel/JavaLoader" rel="nofollow">java loader</a> project to compile java code but I am receiving this error. </p> <pre><code>package javax.servlet.http does not exist ...
<p>Yep. ColdFusion itself runs as a servlet (essentially). So the javax.servlet library is already included in the main CF class path, which is why the <code>createObject()</code> call works. However, the <a href="https://github.com/markmandel/JavaLoader/wiki/Class-Loading" rel="nofollow">JavaLoader does not load the ...
React remove component from list <p>Pretty new to React, coming from knockout</p> <p>Below is a simplified example of my problem I have a situation with a list of items, where I need to remove an item based on its expiration date</p> <p>items below is an array of objects</p> <p>Each object contains a name and an exp...
<p>In ReactJS, you can run JS essentially wherever you'd like, including the <code>render()</code> method. So why not just check the <code>expiration</code> prop before rendering the desired content? Now each time your <code>List</code> renders, each <code>ListItem</code> will also re-render() and run the check:</p> <...
How can an Xpath be written for search results that change <p>I have a scenario where i am filling a search field with text 'A' and it returns a bunch of results. These results are always changing and i simply want to select the first 5 options. How is it possible to write an Xpath for this. I am trying to write an acc...
<p>I'm not sure if this is what you're after, but if you need the first 5 elements of a nodeset, you can suffix it with:</p> <pre><code>[position() &lt;= 5] </code></pre> <p>Example:</p> <pre><code>&lt;a&gt; &lt;b&gt;1&lt;/b&gt; &lt;c&gt;2&lt;/c&gt; &lt;d&gt;3&lt;/d&gt; &lt;e&gt;4&lt;/e&gt; &lt;f...
Call C++ function after QML animation finishes <p>I need to call a C++ class method with parameters from UI after animation of SwipeView ends.</p> <p>main.ui</p> <pre><code>ApplicationWindow { visible: true width: 640 height: 480 title: qsTr("Hello World") SwipeView { id: swipeView anchors.fill: parent ...
<p>As a workaround you can bind your action to index changing:</p> <pre><code>xorButton.onClicked: { swipeView.setCurrentIndex(1) } SwipeView { id: swipeView onCurrentItemChanged: { if(currentIndex == 1) xor.crypt(file_path.text, key_path.text, out_path.text) } } </code></pre> <p...
NSTableView Highlight Colour when when table lose its focus <p>I am using NSTableView in my project. When the user has clicked on a line, I use the standard blue selection colour. When the table lost it's focus, the selection colour changes to light grey colour.</p> <p>I am trying to keep the blue selection colour eve...
<p>Try to override <code>NSTableRowView</code>, for example I keep grey color:</p> <pre><code>class CustomRowView: NSTableRowView { override func drawSelectionInRect(dirtyRect: NSRect) { NSColor.secondarySelectedControlColor().set() NSRectFill(dirtyRect) } } </code></pre> <p>However it is a bit tricky to for...
Shell POSIX two nested while read and read from stdin not working <p>I have that sample script:</p> <pre><code>#!/bin/sh while read ll &lt;/dev/fd/4; do echo "1 "$ll while read line; do echo $line read input &lt;/dev/fd/3 echo "$input" done 3&lt;&amp;0 &lt;notify-finishe...
<p>Your code <strong>already has</strong> bashisms. Here, I'm taking them out (and simplifying the FD handling for better readability):</p> <pre><code>#!/bin/sh while read ll &lt;&amp;4; do # read from output_file printf '%s\n' "1 $ll" while read line &lt;&amp;3; do # read from notify-finishe...
Why FixedThreadPool not working properly <p>Here's my following code:</p> <pre><code> ExecutorService executor = Executors.newFixedThreadPool(5); executor.submit(new Runnable() { public void run() { for (int i = 0; i &lt; 5; i++) { System.out.println("Start"+" "+Thread.curren...
<p>You are posting only one <code>Runnable</code> so your <code>ExecutorService</code> runs one task. It will use only one thread. To use multiple threads you must call <code>submit</code> multiple times or you can call <code>invokeAll</code> with a <code>Collection</code> of runnables.</p> <p><strong><em>EDIT</em></s...
Is there a way that I can get a count of rows with a LINQ statement? <p>I have been using this LINQ statement:</p> <pre><code> var phrases = await db.Phrases .AsNoTracking() .ToListAsync(); </code></pre> <p>But what I need is to get a count of the number of rows in Phrases. </p> <p>I ha...
<p>The <a href="https://msdn.microsoft.com/en-us/library/bb468851(v=vs.110).aspx" rel="nofollow">sync version</a>:</p> <pre><code>var phrasesCount = db.Phrases.Count(); </code></pre> <p>The <a href="https://msdn.microsoft.com/en-us/library/system.data.entity.queryableextensions.countasync(v=vs.113).aspx" rel="nofollo...
Sorting Grid data in kendo UI Grid <p>I want to sort the retrieved data wrt to description field but sorting is not working on it. </p> <p>UI Code: Displays the data correctly </p> <pre><code>var gridDataSource = new kendo.data.DataSource({ autoSync: true, data: transformation.Activities, schema: { ...
<p>Try to convert your data array (gridData in your case) to json array by calling <code>gridData.toJson()</code> to it. and try something like:</p> <pre><code>gridData = [{name: "tester 03", param2: "test3"}, {name: "tester 01", param2: "test1"}, {name: "tester 02", param2: "test2"}]; //Assumi...
can kendo editor drag resize handle be made to work like the one here on SO <p>Can the drag handle of the kendo Editor be made to work like the one here on SO, with a thicker bottom border and the handle location center-south?</p> <p>The kendo-editor has a thick top-border and a thin bottom border. If that could be re...
<p>Use this CSS as a starting point and adjust it to your preferences:</p> <pre><code> .k-editor div.k-resize-handle { padding: 0; left: 50%; /* or 0 for full width */ bottom: 0; background-color: red; width: 50px; /* or 100% */ margin-left: -25px; /* or 0 */ height: 10px; cursor: s-r...
How do I remove a string of text inside a div after a br with jquery/javascript? <p>I have been trying to remove variable produced pricing (from a generated list) that comes after a <code>&lt;br&gt;</code> in each div. Here it is:</p> <pre><code>&lt;div class="p-name"&gt; &lt;a href="somelink.html" class="TLink"&g...
<p>Each anchor tag has three childnodes: text + br + text.</p> <p>To remove the br + tx you can do:</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>$('.p-name').find('a').e...
excel change background when gender age and value cell better than other sheet <p>I have a scoresheet with the following headers:</p> <pre><code>name surname gender age resultmission 1 2 3 4 </code></pre> <p>And I have a standard sheet with the following headers:</p> <pre><code>gender age mission 1 2 3 4 </code></p...
<p>Sounds like you need to write a <code>VLOOKUP()</code> to get the <code>norm</code> value. Then, compare it against the user's score using an <code>IF()</code> statement. The <code>IF()</code> statement values should return <code>TRUE</code> and <code>FALSE</code>, so we can apply <code>conditional formatting</cod...
IdentityServer and RessourceClaims <p>I've an api and a webfrontend on which the user gets authenticated with identityServer.</p> <p>Now I can introduce scopes like "customer" to get the according claim on the web project.</p> <p>Now I want to have a user to have claims on specific customers. Is this something I woul...
<p>As a rule of thumb - authorization is done as close as possible to the resource you are trying to protect - e.g. in the API endpoint.</p> <p>IdentityServer is authentication/identity as a service - not permissions or authorization.</p>
How to disable HTML error responses when using Action(parse.json)? <p>In a REST API implemented with Play Framework (2.4), I'm using <a href="https://www.playframework.com/documentation/2.5.x/ScalaJsonHttp#Creating-a-new-entity-instance-in-JSON" rel="nofollow"><code>Action(parse.json)</code></a> to parse JSON from inco...
<p>The long html is produced by the default <code>HttpErrorHandler</code>. You can provide your own by following <a href="https://www.playframework.com/documentation/2.4.x/ScalaErrorHandling#Supplying-a-custom-error-handler" rel="nofollow">this guide</a>. Quoting the example code:</p> <blockquote> <pre><code>class Err...
What is a backward compatible version of PHP 7's Anonymous Class <pre><code>$gen = NEW CLASS { public function Num() { $number = mt_rand('0','9'); function Duplicate($number) { $number = $number.$number; return $number; } return Duplicate($...
<p>You have two solutions to your problem</p> <ul> <li>Create normal named class like @Ryan Vincent mentioned in comment,</li> <li>Create new class through <a href="http://php.net/manual/en/function.eval.php" rel="nofollow">eval</a></li> </ul>
How should I escape commas in Active Directory filters? <p>I'm using python-ldap to query Active Directory</p> <p>I have this DN </p> <pre><code>CN=Whalen\, Sean,OU=Users,OU=Users and Groups,DC=example,DC=net </code></pre> <p>That works fine as a base in a query, but if I try to use it in a search filter like this</...
<p>The LDAP filter specification assigns special meaning to the following characters <code>* ( ) \ NUL</code> that should be escaped with the backslash escape character followed by the two character ASCII hexadecimal representation of the character (<a href="https://tools.ietf.org/search/rfc2254#page-5" rel="nofollow">...
Why doesn't this list comprehension work? <p>The purpose of the code is to collect all the chars in wordlist, I did the following:</p> <pre><code>wordlist = ['cat','dog','rabbit'] [c for c in word for word in wordlist] </code></pre> <p>The output is strange:</p> <pre><code>['r', 'r', 'r', 'a', 'a', 'a', 'b', ...
<p>The problem is with the <em>order</em> of the <code>for</code> statements in the comprehension, they have to be swapped:</p> <pre><code>In [10]: [c for word in wordlist for c in word] Out[10]: ['c', 'a', 't', 'd', 'o', 'g', 'r', 'a', 'b', 'b', 'i', 't'] </code></pre> <hr> <p>Note that the reason it worked for you...
R CMD CHECK Note: information on .o files is not available <p>In RStudio, using devtools and Hadley Wickham's R Packages book procedures on a macbook, I do the Shift-CMD-E to do the equivalent of a R CMD CHECK and I have 0 errors, 0 warnings and 1 note that is persisting :</p> <pre><code> Note: information on .o file...
<p>At bare minimum:</p> <ol> <li>Try removing the Makefile from /src and build again.</li> </ol> <p>Which may be all that is needed. When I was resurrecting some old packages that had a Makefile in the /src and tried to do R CMD Check with RStudio removing the Makefile removed the note. The Makefile looked like thi...
jQuery slider jumps on it's own to different values <p>I have a jQuery UI slider that is basically checking if the user has entered data and then shows an alert if they haven't. The problem is, the alert is showing up fine but when I press close on the alert box the slider jumps to another random value and the alert bo...
<p>The slide event gets triggered multiple times while moving the slider. So if you move the slider it gets triggered a first time, you cancel the alert and it gets triggered immediately again. </p> <p>You may want to look at the stop - event instead: <a href="http://api.jqueryui.com/slider/#event-stop" rel="nofollow"...
Ionic 2 SQLite not opening database <p>I am using Ionic 2, and following <a href="https://www.thepolyglotdeveloper.com/2015/12/use-sqlite-in-ionic-2-instead-of-local-storage/" rel="nofollow">this tutorial</a>.</p> <p>My problem is I cannot seem to open the database. I have it deployed to an Android Emulator called KOP...
<p>My mistake, I forgot the <code>this.database = new SQLite();</code></p> <pre><code>private openDatabase(): void { this.database = new SQLite(); this.database.openDatabase({ name: "data.db", location: "default" }).then(() =&gt; { this.refreshChats(); this.refreshMessages(); }, (error) =&g...
Set an AutoMapper convention to not merge ICollection properties <p>Say I have a domain:</p> <pre><code>public class EmbeddedInBar { public string Name { get; get; } public ICollection&lt;int&gt; ListOfInts { get; set; } } public class Bar { public int Id { get; set; } public string Name { get; set; }...
<p>You can do it by using AutoMapper filtering : <a href="https://github.com/AutoMapper/AutoMapper/wiki/Configuration#global-propertyfield-filtering" rel="nofollow">https://github.com/AutoMapper/AutoMapper/wiki/Configuration#global-propertyfield-filtering</a></p> <p>For your example you can use following:</p> <pre><c...
Rails: dotenv nested hash <p>I've declared this variable in my .env file</p> <pre><code>WARRANTY_DETAILS_PER_MAKE = {"dacia" =&gt; {duration: 3, mileage: 100000}, "honda" =&gt; {duration: 3, mileage: 100000}, "infiniti" =&gt; {duration: 3, mileage: 100000}, "jaguar" =&gt; {duration: 3, mileage: 0}, "land-rover"=&gt; {...
<p>DotEnv <a href="https://github.com/bkeepers/dotenv/blob/master/lib/dotenv/parser.rb" rel="nofollow">does not parse</a> anything else than simple quoted or unqouted values which is consistent with how most shells handle ENV vars.</p> <pre><code>LINE = / \A (?:export\s+)? # optional export ([\w\.]+) ...
Ionic2 White screen error on deploy Android 4.2.2: Use of const in strict mode <p>i can deploy to a real device and to a emulator using <code>Android</code> <strong>4.1.1</strong>, <strong>4.2.2</strong>, <strong>4.4.2</strong>.</p> <p>But it always shows a <em>white</em> screen and in the console I can see the error ...
<p>Could make that work!! =)</p> <p>For those who get here:</p> <ul> <li>ionic platform add browser</li> <li>ionic build browser</li> <li>ionic plugin add cordova-plugin-crosswalk-webview</li> <li>Remove the old app from the device</li> <li>ionic build</li> <li>ionic run android</li> </ul>
jQuery inner error on paste event <p>When I paste (CTRL+V), I have a jQuery error: TypeError: e is null</p> <p>I have quite complicated data table solution with customized <a href="https://handsontable.com/" rel="nofollow">Handsontable</a>. It happens on special cases. I don't know how to handle this error, there's on...
<p>Sorry guys for disturbing, I finally fixed it. I just was frustrated, so I needed to write it about, but it probably wasn't anything you could help me. I had some wrong calls of js libraries there and some wrong js event handling.</p>
Copying an array in c++ - reference <p>I have a matrix2d class which consists of a dobule A[2][2]. I am trying to do a constructor which takes obejct of the same type and copies all its values to A[2][2]. I have a problem, here is the class:</p> <pre><code>class matrix2D { public: double A[2][2]; double Z...
<p>The <code>*</code> in that line does not make sense.</p> <p>Given the data, you don't need a copy constructor at all. However, if you must implement one, it needs to be something along the lines of:</p> <pre><code>// Use const&amp;, not just &amp;. // Use a more suitable variable name for the copy matrix2D(matrix...
Premature setTimeout execution <p>I have a script which should to check user activity on a browser window (mouse and keyboard) and if there is no activity after 5 minutes execute logout function.</p> <p>Simple functionality code looks like:</p> <pre><code>var tempLOT = 300000; console.log('Auto Logout: ' + tempLOT +...
<p>You define <code>t</code> inside of <code>inactivityTime</code> so every time you call it you declare a new <code>t</code> so the other timer will still exist. Also why are you rebinding all those events inside of it?</p> <p>Your code really should just be</p> <p><div class="snippet" data-lang="js" data-hide="fals...
Laravel 4: Model Class not found <p>I am getting a <code>Class 'App\Models\User' not found</code> error when I try too use the <code>User</code> class inside a controller class method. I have looked everywhere and tried everything with no luck! Here's what I've tried:</p> <ol> <li>Check that class exists and is in the...
<p>I have managed to resolve this on my own. It turns out you have to tell Laravel what class and table will be used for authentication (a.k.a your 'User' class). I didn't know this (plus this is an inherited project). Apparently the <code>User</code> class was defined in the root namespace (i.e. <code>\User</code>) an...
0.5px margin between RowDefintions? <p>Apologies if I'm going mad, but as shown in the following image, each <code>RowDefinition</code> inside my grid appears to be adding '0.5'px vertical margin to itself.</p> <p>It's a completely blank project, created from scratch.</p> <p>Have I remembered this incorrectly or is s...
<p>So if you remove both of the properties as mentioned in the comments that are giving permission to adjust based on the measure/arrange pass in this scenario you should be back down to your desired margin.</p> <pre><code>&lt;Grid&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="Auto"&gt;&lt;/Row...
SQL SERVER 2014 Allocation block size snapshot drive <p>I am creating a distribution server with separate drives. One of the drives is going to be for the SNAPSHOT folder. All my other SQL DATA Drives have 64k block Allocation sizes. </p> <p>Should the SNAPSHOT drive also have 64K block Allocation size? I am thin...
<p>I have configured replication many times and never bothered about ,changing block size of drive,snapshot is stored..</p> <p>I also don't see any mention in best practice's section for snapshot mentioning block size,so i would recommend go with defaults</p>
Why can't C++ automatically figure out when to use constexpr without making us write the tag? <p>Item 15 of Scott Meyer's Modern C++ book: "use constexpr whenever possible". He says you can mark a function constexpr and still call it with values that aren't known at compile-time -- in that case it'll behave like any ot...
<p>... when the function receives values which are not known in compile-time. You cannot mark a function to be <code>constexpr</code> if its computation depends on the value of a pointer, or a global value, etc, etc.</p> <p>If the <code>body</code> of that function can be executed in compile time, you can mark it as <...
Javascript: Default prototype fields showing undefined for object created using null constructor <p>I am noticing some behaviour in the code below that I can't explain. I'm hoping that someone can enlighten me about why this is happening.</p> <p>The code example below is available on JSFiddle as well if that's easier...
<p><code>JavaScript</code> is not like <code>Java</code> (or other programming languages) where you can have methods with the same name or multiple constructors if they have different number or type of parameters. In this case, you've replaced <code>Book()</code> with <code>Book(title, author)</code></p> <p>To achieve...
Numpy array trims string values <p>Here is the code I am trying to execute</p> <pre><code>matrix = [] sample = [10,10,'mike',''] for i in range(10): r = [sample] * 3 matrix.append(r) matrix = np.array(matrix) matrix[1][1] = [123,123,'james', 'sdfsdfsdf werwerwer sdfsdfsd werwerwer sdfsdfsdf'] print matrix[1][...
<p>I found the problem.</p> <p>conversion from native Python array to Numpy should take place as the last step.</p> <pre><code>matrix[1][1] = [123,123,'james', 'sdfsdfsdf werwerwer sdfsdfsd werwerwer sdfsdfsdf'] matrix = np.array(matrix) </code></pre> <p>Now works fine.</p>
Google Cloud: Cannot connect to server via SSH <p>Port is up, firewall disabled, but connection is rejected with message: </p> <pre><code>"Read from socket failed: Connection reset by peer". </code></pre> <p>Other services in the same host are responding well.</p> <p>SSH through Google Cloud Console gets the same er...
<p>Yes, there is a way to get shell, and it is through the serial port, a really useful feature Google Cloud provides.</p> <p>There, I saw the error was about key file permissions:</p> <pre><code>Sep 30 10:51:02 localhost sshd: Permissions 0775 for '/etc/ssh/ssh_host_rsa_key' are too open. </code></pre> <p>And by as...
Angular 2 getting components to listen to one another <p>I have a navigation component that I want to be either shown or hidden based on whether or not a user is signed in. To do this, I added a localStorage to confirm that a user is signed in. However, my navigation component only listens to this during <code>OnInit</...
<p>Take a look at the following link. You can use observable's and a shared service to achieve this.</p> <p><a href="https://angular.io/docs/ts/latest/cookbook/component-communication.html#!#bidirectional-service" rel="nofollow">Angular.io Component Interaction using a Service</a></p>
Deserialize first property not matching any target object's properties into specific property <p>I'm doing some web API integration with Newtonsoft.Json, and as always, I have to do dumb stunts to properly deserialize what they're sending back.</p> <p>In this case, the API will send responses resembling this kind of s...
<p>You can use a base class + derivations for each response type.</p> <pre><code>public class APIResponseBase { [JsonProperty("has-more")] public bool HasMore { get; set; } [JsonProperty("offset")] public int Offset { get; set; } } public class ContactsResponse : APIResponseBase { public IEnumerable...
Configuring Identity Framework's ApplicationUserManager in Simple Injector <p>I'm using Simple Injector in my MVC application error and I receive the below error:</p> <blockquote> <p>The constructor of type ApplicationUserManager contains the parameter with name 'store' and type IUserStore that is not registered. Pl...
<pre><code>container.Register&lt;IUserStore&lt;ApplicationUser&gt;&gt;(() =&gt; new UserStore&lt;ApplicationUser&gt;()); </code></pre> <p>Needed to register the user store but it has multiple constructors so you need to add the above line</p>
How do I simulate sleep on a particular program on MacOs <p>How do I simulate sleep on a particular program/application/applet on a MacBook Pro (10.12). For instance, I am working and want Minecraft to run in the background (to play when I am waiting for something to process) but not using any CPU cycles of battery unt...
<p><strong>Ken Thomas commented on this answer with a similar solution that I would recommend over my own for its simplicity. Please check it out.</strong></p> <p>This can be done with a terminal command.</p> <ol> <li><p>The first thing you want to do is open Activity Monitor, a program inside of Applications/Utiliti...
Using SRV DNS records with the python requests library <p>Is it possible to have the Python requests library resolve a consul domain name with a SRV record and utilize the correct IP address and port when making the request?</p> <p>For example, given that I have serviceA running with the IP address 172.18.0.5 on port ...
<p>No, you can't unless you rewrite <code>requests</code>.</p> <p>SRV record is design to find a service.<br> In this case, you already indicate to use http. So client will only query A or AAAA record for <code>serviceA.service.consul</code>.</p>
Setting __proto__ on object without initial prototype <p>Let us create new object, and then change its prototype:</p> <pre><code>var obj = new Object; obj.__proto__ = new Date; obj.setTime // is a function </code></pre> <p>We see that <code>obj</code> now inherits properties from its new prototype, <code>new Date</co...
<p>This is one subtle difference between <code>__proto__</code> and <code>Object.getPrototypeOf()</code> / <code>Object.setPrototypeOf()</code> when we need to explicitly access / modify the prototype of an object.</p> <p>This is one of the reasons why i have convinced myself that we should use <code>Object.setProtot...
Deleting a cookie with Expires / Max-Age of Session <p>When I look in my chrome dev tools (Cookies section) you have 5 relevant columns: Name, Value, Domain, Path and Expires / Max-Age I have a cookie that I can't delete with and Expires / Max-Age of Session. The odd thing is that when I inspect with x-debug it doesnt ...
<p>Set the time to Thu, 01-Jan-1970 00:00:01 GMT. I believe it will solve the problem</p>
Would Too Many Pipes Cause Command To Hang In Script? <p>I have a command that uses grep, awk and sed through several pipes. It runs fine when I execute the command in shell. And, most of the time, it works fine in a looped script. However, once in a while, it does hang. I know it is not the text input since it runs fi...
<p>Too many pipes would make it hard to figure out what is going wrong when things do go wrong. Your command has too many <code>sed</code>s in the pipeline. Looks like you forgot <code>sed</code> has a -e option which can be used for specifying multiple search/replace expressions. Like:</p> <pre><code>sed -e expr1 -...
Empty fileset after copy within a macrodef in Ant <p>I've been banging my head against the wall on this all day!</p> <p>In the below macro I always end up with an empty fileset:</p> <pre><code>&lt;macrodef name="gzipAndUploadFileset"&gt; &lt;attribute name="mimeType"/&gt; &lt;element name="fileset"/&gt; &...
<p>You should <strong>not</strong> name your macro element with the same name as an existing ant task. I suggest you rename <code>fileset</code> element into <code>files</code> for instance :</p> <pre><code>&lt;macrodef name="gzipAndUploadFileset"&gt; &lt;attribute name="mimeType"/&gt; &lt;element name="files"...
Fullcalendar: How to render time from json url - type error hasTime() <p>How can I render time on my fullcalendar from a json url (/comments)? It's showing "object Object" where time is supposed to show. What's the correct way of pulling the time from a json url?</p> <p><strong>json example from url</strong></p> <p><...
<p>In your populate function your start and end date are made using Javascript Date object, that will not work with fullCalendar, it needs moment date object. Change the following</p> <pre><code>start: new Date(value.StartAt), end: new Date(value.EndAt), </code></pre> <p>to this</p> <pre><code>start: moment(value.St...
How to add an extra list item to list view? <p>I need my listview to always have a trailing list item different to the other list items, even when the adapter is empty. </p> <p>I have tried adding a null item at the end of the dataset in the adapter constructor:</p> <pre><code>mDataset.add(null); </code></pre> <p>In...
<p>You can have a ImageView in your XML pointing that listview is empty and make its visibility.gone. In your adapter class check if your dataset is empty, make Imageview Visibility.visible and Listview's visibility change to visibility.gone.</p> <p>Sample short example </p> <p>XML</p> <pre><code> &lt;LinearLayout ...
Right way to pass NSArray of NSNumber as parameter in AFNetworking <p>I am trying to send in POST request AFNetworking this package:</p> <pre><code>NSDictionary*parameters = [NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithObjects:@719,@714, nil],@"rules", nil]; [manager POST:path parameters:parameters su...
<pre><code>NSDictionary *parameters = [NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithObjects:[NSNumber numberWithInt:719],[NSNumber numberWithInt:714],nil],@"rules", nil]; </code></pre> <p>Use above will resolve your issue</p>
adding score when clicking inside rectangle <p>I have the following exercise to do for school:</p> <p>Create a textfield which shows a score as follows "Score: " (You can use the text(StringValue, IntegerXposition, IntegerYposition) for the drawing of text), starting at zero. Make it so that when the user clicks the l...
<p>I'm not quiet sure if this is possible with just <code>Python/Python 3.5.1</code> alone. I think <code>tkinter</code> is more suitable with making shapes with Python (And I'm not quiet sure because, I never used it before). I would suggest you use a <code>class</code> initialization for this. Here is what I got:</p>...
HTML5 form validation triggering on correct value after setting setCustomValidity <p>I've set a <code>setCustomValidity()</code> to every input <code>type=number</code> in my form to translate the default error messages.<br> The messages are now translated and appear when an incorrect number is inserted. The problem is...
<p>Very good question buddy.</p> <p><strong>You need to clear/reset the <code>setCustomValidity</code> after setting a value</strong>. But unfortunately Chrome handles <code>.setCustomValidity</code> in a odd way. And because the <code>.setCustomValidity</code> is handled by the browser the issue is browser dependent....
Splitting nested column to multiple columns UNIX <p>I have a tab delimited data frame with a final column containing nested information that is '|' delimited. Note that all rows maintain this nested parenthetical structure preceded by 'REP='</p> <pre><code>col1 col2 col3 col4 ID1 text text text...RE...
<p><code>awk</code> to the rescue!</p> <pre><code>$ awk -v OFS='\t' 'NR==1{nh=NF; header=$0; next} {v=$NF; sub(/.*REP=/,"",v); sub(/\.\.\.REP=.*/,"",$NF); gsub(/[()]/,"",v); n=split(v,vs,"|")...
How to select only 1 row if duplicate rows (Oracle) <p>I have a table contains order information like below:</p> <p><a href="http://i.stack.imgur.com/jDLHu.png" rel="nofollow">OrderTable</a></p> <p>As we can see from that table, each order_no has several duplicates. So what I want is to keep only one row for each ord...
<p>Something like this, perhaps? You can use the <code>PARTITION BY</code> and <code>ORDER BY</code> clauses to determine which row is returned. Air code:</p> <pre><code>SELECT t.* FROM ( SELECT o.* , ROW_NUMBER() OVER (PARTITION BY o.order_no ORDER BY o.sequence_no) rn FROM ordertable o ) t W...
Iterating through two lists, operating and creating a third list in Python <p>I am a completely Python beginner and am really struggling with iterations on Lists! There's this problem I have been trying to solve using python using Lists:</p> <p>I have a "<strong>TotalList</strong>" for the total costs on each hour fo...
<p>You can create a dictionary from your total cost list and compute the minute costs by referencing the total cost at each hour (from the dict) and multiplying by the percentage minute cost.</p> <p>A <em>list comprehension</em> will do:</p> <pre><code>tc_mapping = dict(totalList) # map hour to cost minute_cost = [(h...