input_text_instruct
stringlengths
288
45.8k
output_text
stringlengths
37
33.2k
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: .NET Core MVC - AJAX POST Request with prefix binding<p>I would like to post a request via AJAX to a Controller with a model prefix. I need a prefix as I hav...
<p>For Asp.Net Core, there are two ways to bind the model, <code>ModelBinding</code> and <code>JsonInputFormatter</code>. For sending request with json, it will use <code>JsonInputFormatter</code>. <code>Bind</code> will not work with <code>JsonInputFormatter</code>.</p> <p>Here is a working demo like below:</p> <p>1...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Inheritance with templates<pre><code>#include&lt;iostream&gt; using namespace std; class C { public: C (){}; virtual void nothing()=0; virtual ~C (){}; ...
<p>In the main routine, the three lines shown below create an array of <code>C*</code>. So any element of that array is treated as a <code>C*</code> regardless of what the actual type of the element is. That is, when you pass <code>*array [0]</code> to the function <code>hi()</code>, the function that gets called is <...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Fetch data from Object type c#<p>I have a WebAPI controller written in c# which look like this:</p> <pre><code>public void Post(Object obj) { } </code></pr...
<p>The easiest way is to use a DTO so you would have something like this.</p> <pre><code>public void Post(MyDTO dto){ doStuff(dto.name) } public class MyDTO{ public String name {get;set;} } </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: tastypie and x-editable using patch<p>I almost have x-editable working with the django API built with tastypie thanks to various other answers on stackoverfl...
<p>So the problem was that the patch being sent was a key value pair and that was not being recognised by tastypie, but a quick modifiation to hydrate fixes it. Maybe not the best solution but here is what is working for me:</p> <p>The html:</p> <pre><code> &lt;a href="#" id="name" class="editable editable_defaul...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to get any script component from a Game Object<p>I have lots of different enemies in my game. Each of these enemies have different scripts. When the play...
<h1>Solution</h1> <p>The solution to your problem is to create a base class called Enemy that stores the health and possibly contains some virtual behaviour functions. For each different type of enemy, your enemy class would inherit from the base enemy class.</p> <p>For example:</p> <p>Enemy.cs</p> <pre><code>public cl...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Returning content of XML element<p>I'm trying to use xmlstarlet to extract the text in certain elements in this XML feed:</p> <p><a href="https://services.b...
<p>The XML in the link you supplied declares a default namespace in the <code>VehicleRemarking</code> tag:</p> <pre><code> &lt;VehicleRemarketing xmlns="http://www.starstandard.org/STAR/5" ...&gt; </code></pre> <p>That means you have to declare it with a prefix which you should use to qualify <em>each</em> step of yo...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I give my own names to colours in R?<p>I've got a series of charts to plot, and I'd like to use the colours from my company's branding for all of the...
<p>Why not use variables to hold the hex values?</p> <pre><code>mycompanycol &lt;- "#0FF0F0" plot(rnorm(100), rnorm(100), col = mycompanycol) </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: CSS menu child align<p>Need some help with a drop down menu. I made a fiddle here: <a href="http://jsfiddle.net/bLL0rmbd/" rel="nofollow noreferrer">http://j...
<p>i hope this works for you .</p> <pre><code> #navbar ul { padding: 0; margin:0px; list-style: none; float:left; background:#FF6; position: relative; } #navbar ul ul { position:absolute; display: none; right: 0; top: 100%; } </code></pre> <p>I have only aded 3 lines of code po...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: FastAPI (starlette) get client real IP<p>I have an API on FastAPI and i need to get the client real IP address when he request my page.</p> <p>I'm ty to use...
<p><code>request.client</code> should work, unless you're running behind a proxy (e.g. nginx) in that case use uvicorn's <code>--proxy-headers</code> flag to accept these incoming headers and make sure the proxy forwards them.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: iPad landscape dimensions issue<p>I have application using Landscape orientation only. I have set Device orientation to "Landscape Left" only in project prop...
<p>The issue solved itself. I have got a new device, iPad 3 > iPad Air 2 and issue doesn't appear here : )</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: htmltextwriter and cross site scripting<p>Just a quick question I was asked to go through a vb app and fix all the places where cross site scripting could ha...
<p>Yes, it does protect you from XSS when writing into a HTML document, however the <a href="https://msdn.microsoft.com/en-us/library/system.web.ui.htmltextwriter.writeencodedtext%28v=vs.110%29.aspx" rel="nofollow noreferrer"><code>HtmlTextWriter.WriteEncodedText</code></a> method must be used.</p> <pre><code>' Assign...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to convert a string of numbers to an array<p>I have a pretty big JavaScript array with integers between -10 and 10. I want to save those in a database, s...
<p>use <code>print_r</code> or <code>var_dump</code> for echoing the array details for $pws. If you want through <code>echo</code> then try </p> <pre><code>`echo implode(" ",$pws);` </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Get status message of MySQL query (including execution time) with JDBC<p>Suppose that I am implementing a query in MySQL say </p> <pre><code>Create Database...
<p>The following code works for me</p> <pre class="lang-java prettyprint-override"><code>try (Statement s = conn.createStatement()) { s.execute("SET PROFILING=1;"); s.execute("CREATE DATABASE newdb;"); try (ResultSet rs = s.executeQuery("SHOW PROFILES;")) { rs.next(); System.out.printf( ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Create password protected Samba storage pool<pre><code>&lt;pool type="netfs"&gt; &lt;name&gt;virtimages&lt;/name&gt; &lt;source&gt; &lt;host name="0....
<p>You have to add an auth section inside your source, for example:</p> <pre><code> &lt;name&gt;YourStorage&lt;/name&gt; &lt;source&gt; &lt;host name="storage.example.com" /&gt; &lt;dir path="/backup" /&gt; &lt;format type="cifs" /&gt; &lt;auth type='chap' username='SomeSecretUsername'&gt; &lt...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to make relative paths in property fields resolve correctly in persistence.xml?<p>We have a JSF web application and are using JPA to manage some persiste...
<p><s>Nothing missing you have an extra :) remove the <em>file:</em> in the relative path configuration, so: </p> <p><code>&lt;property name="javax.persistence.schema-generation.create-script-source" value="META-INF/data_insert.sql"/</code>></p> <p>the location set in the value is relative to the root of the persiste...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to distinguish between multiple shapes in a figure or array?<p>I have a 2D array in Python containing values of either 0 or 1, arranged to form various s...
<p>I suspect you are looking for <a href="http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.ndimage.measurements.label.html" rel="nofollow">label features</a> which is available in <code>scipy.ndimage</code>. Despite the name, it is not neccessarily specific to image analysis. Quoting from the documentat...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: NodeJS on multiple processors (PM2, Cluster, Recluster, Naught)<p>I am investigating options for running node in a multi-core environment.</p> <p>I'm trying...
<p>I've been using the default cluster library, and it works very well. I've had over 10,000 concurrents(multiple clusters on multiple servers) and it works very well.</p> <p>It is suggested to use clusters with domain for error handling.</p> <p>This is lifted straight from <a href="http://nodejs.org/api/domain.html"...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how can i capture the output of an echoed string<p>I have the following code:</p> <pre><code> &lt;?php //Page info $PageTitle = "Johnson electrician"; $sear...
<p>You can keep the values of $name in another variable for future reference. For example, in another array:</p> <pre><code>&lt;?php //Page info $PageTitle = "Johnson electrician"; $nameArray = array(); $search_for = array('Electrical Serviceh' =&gt; array('electrical', 'audio', 'electrician', 'security'), 'Plumbing S...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Android E/Parcel﹕ Class not found when unmarshalling (only on Samsung Tab3)<p>I've been unable to resolve why this error occurs, and only on a Samsung Tab3 d...
<p>For some strange reason it looks like the class loader isn't set up properly.</p> <p>Try one of the following in <code>TestActivity.onCreate()</code>:</p> <hr> <pre><code>TestParcel cfgOptions = getIntent().getParcelableExtra("cfgOptions"); </code></pre> <hr> <pre><code>Intent intent = getIntent(); intent.setEx...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Create textplot on another page after ggplot<p>Here is a sample of my code:</p> <pre><code>pdf("foo.pdf") toplot=data.frame(Vals, Factor, Group) ggp...
<p>You could just put the text into a second blank ggplot using a custom <code>grob</code>.</p> <p>I have had to create some dummy data to do this:</p> <pre><code>info &lt;- c("info 1", "info 2", "info 3", "info 4") toplot &lt;- data.frame(Vals = rnorm(1000), Factor = rep(LETTERS[1:4], each =...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Equals pointer in ternary search tree and limitations<p><a href="http://www.geeksforgeeks.org/ternary-search-tree/" rel="nofollow">HERE</a> it is said that e...
<p>A1: The equals pointer marks the continuation of the current prefix. Thus C -> CA -> CAT -> CATS but not C -> CB[UGS].</p> <p>A2: This would be a ternary search tree for the given set of expressions ( termination flags and leaf node expansion omitted):</p> <pre><code> C ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to get Containers to fill available vertical space in a Row?<p>can anyone help me out?</p> <p>I'm struggling to figure out how I can get the coloured co...
<p>To adjust row items height to biggest one wrap row of items with <code>IntrinsicHeight</code> widget:</p> <pre class="lang-dart prettyprint-override"><code> IntrinsicHeight( child:Row( crossAxisAlignment: CrossAxisAlignment.stretch, children: _homePageContent(), ), ), </code></pre> <p><a hre...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can I monitor multiple servers using Prometheus?<p>I want to monitor different servers for my entreprise and I'm going to use Prometheus for that, I want to ...
<p>Yes you can. You need to install Prometheus on a server (see how to install <a href="https://prometheus.io/docs/prometheus/latest/installation/" rel="noreferrer">here</a>) and install "exporters" in the other servers (see a list of exporters <a href="https://prometheus.io/docs/instrumenting/exporters/" rel="noreferr...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How will Parallel.Foreach behave when Iterating over the results of a method call?<p><strong>Scope:</strong></p> <p>I am currently implementing an applicati...
<p>I think there's an issue with <code>Parallel.ForEach</code> partitioning... Your question is a typical producer / consumer scenario. For such a case, you should have independent logics for dequeuing on one side, and processing on the other. It will respect separation of concerns, and will simplify debugging. </p> <...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: I want to search a text within a cell range and return the value to the left of the cell (Google App Script)<p>I am trying to write a script to organize a la...
<p><a href="https://developers.google.com/apps-script/guides/sheets" rel="nofollow noreferrer">https://developers.google.com/apps-script/guides/sheets</a> Will guide you on using the information needed to edit/make Google App spreadsheets</p> <p>So editing the values would just have to change the for loop for that. Si...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Call php function in view from mustache and pass a mustache array value into the function call<p>I would like to pass an array value to a view function so th...
<p>It's a headache because you're fighting against the fundamentals of Mustache :)</p> <p>This is a bit backwards from the "Mustache way". Instead of trying to shoehorn in logic via lambdas, you should extract the logic into your view/viewmodel/model, and limit your template to simple sections and string interpolation...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Getting all expenses from Quickbooks Desktop<p>I'm able to read all expenses from QuickBooks Desktop with C# code using QuickBooks SDK. Once I have the expen...
<blockquote> <p>Do I have to read CreditCard and Check separately or is there a way to get all expenses from one place?</p> </blockquote> <p>QuickBooks does support a <code>TransactionQuery</code> request type that you could use to get this data in a single request, <em>but</em> it only returns summary details -- it...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Allow the selection of multiple images in NetlifyCMS<p>I am currently integrating NetlifyCMS into my Gatsby project and I am stuck allowing the selection of ...
<p>Turns out you need to add a third party media library to support this.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Firing angular js animation within a directive<p>I have a simple directive along these lines:</p> <p><div class="snippet" data-lang="js" data-hide="false"> ...
<p>DOM event handlers attached by for example <code>addEventListener()</code> or the jqLite/jQuery methods <code>bind</code> and <code>on</code> are executed outside of the current Angular context and will not trigger the digest loop.</p> <p>You will have to do it manually by using for example <a href="https://docs.a...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to determine if a bit is set in a hex-decimal string?<p>I have a string in hex format like:</p> <pre><code>AAE04471 </code></pre> <p>In my opinion, in ...
<p>I hacked this together quickly: This solution does not convert the whole string into a number first, but tries to pick out the right character before checking the bit:</p> <pre><code>public class Test { public static void main(String[] args) { for (int i = 0; i &lt; 16; i++) { test("DEAD", ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Timestamp conversion in Oracle SQL<p>I'm using Oracle SQL and i have a dates issue.</p> <p>I got a long script with many <code>Insert</code> commands such a...
<p>It suspect that your <strong>locale_specific NLS_DATE_LANGUAGE</strong> is different.</p> <p>Try the following query with <strong>NLS_DATE_LANGUAGE</strong> parameter included in the <strong>to_timestamp</strong>:</p> <p><code>to_timestamp('13-NOV-14 03.38.27.785000000 PM','DD-MON-RR HH.MI.SSXFF AM','NLS_DATE_LANG...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Return id after insert C# using SQL Server<p>I know this question has been on this site many times, but I can't get my code working.</p> <p>I have an <code>...
<p>Try this:</p> <pre><code>public int CreateAlbum(string _titel, string _name, string _thumb, int _userid) { // define return value - newly inserted ID int returnValue = -1; // define query to be executed string query = @"INSERT INTO tblFotoalbum (fldAlbumHead, fldAlbumName, fldAlbumThumb, fldUserID_...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to stick an overlay to user location with MapKit in Swift<p>I created a mapView which find user's location and draws a green circle overlay around the us...
<p>In this section of code:</p> <pre><code>var newCircle = MKCircle(centerCoordinate: locationObj.coordinate, radius: 100 as CLLocationDistance) if locations.count&gt;1 { //I tried dispatch but still tail of green circles dispatch_sync(dispatch_queue_t(), { () -&gt; Void in self.treesMap.removeOverlay(newC...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to effect a peoperty on the first the h1 element on CSS?<p>I want to effect the text as the first h1 below .contactSection. However I used nth-child(1) f...
<p>If you're trying to grab the first <code>&lt;h1 /&gt;</code> within <code>.contactSection</code>, your best bet is to use a <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Child_combinator" rel="nofollow noreferrer">child combinator</a>:</p> <pre><code>.contactSection &gt; h1 { margin-top: 15px; } </cod...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Unselectable overlay in java<p>My question is essentially is if there was a way, in Java, to have some type of un-selectable overlay on the screen. By 'un-se...
<p>Only option i can see of achieving this is to use JNA, and this works. You have to refer <a href="https://github.com/twall/jna" rel="nofollow">JNA</a> libraries</p> <pre><code>public class Main { public static void main(String[] args) { TestFrame frame = new TestFrame(); frame.setVisible(tru...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Azure Devops + Coverlet + SonarQube shows 0%<p>Good morning,</p> <p>Sorry to bother you, I have a problem and I have no leads.</p> <p>I have a pipeline on ...
<p>I did a lot of things to finally managed to get the coverage working but I think that the problem was the "ProjectGUID" missing in each .csproj of my solution making the projects ignored by SonarQube scanner.</p> <p>I also upgraded from SonarQube 6.2 to 8.1 at the same time which may have solved the problem. </p> ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Easiest way ever to create bitmap in wxPython<p>Sometimes it is required to create a dummy bitmap for test purposes. To make the bitmap discernable (e. g. a ...
<p>Try using <code>alpha=255</code> (or <code>wx.ALPHA_OPAQUE</code>). That is the alpha level for fully opaque. Zero is fully transparent, and one is almost fully transparent.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Free tool to generate all paths from a diagram<p>Good afternoon everyone,</p> <p>Dispite a lot of research on the web I didn't found a solution that meets m...
<p>I am not sure that such tool on the shell exists. My advise would be to choose one modelling tool which </p> <ol> <li>supports your modelisation (BPMN, Activity, etc.), </li> <li>can be extended with a language you are confortable with (Python, Java, C#, etc.).</li> </ol> <p>In this case, you will find several too...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to style font size of event text in RadCalendar Day Cell<p>I am using nativescript <a href="https://docs.nativescript.org/ui/components/Calendar/Styling/...
<p>Try setting the text size natively in loaded event of calendar</p> <pre><code> // Android only if (event.object.nativeView.getEventAdapter()) { event.object.nativeView.getEventAdapter().getRenderer().setEventTextSize(20 * utilsModule.layout.getDisplayDensity()); } </code></pre> <p><a href="https://play.na...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ImpressPages 4.5.1 seems to be missing the theme setting after install<p>I have just installed a fresh copy of ImpressPages 4.5.1 and I am getting the follow...
<p>The theme can be set in the database by creating a following record:</p> <p>Plugin: Ip Key: theme Value: "Air" //Quotes are important. As this must be json'ed value.</p> <p>Looks like reinstalling would be also not a bad idea.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Change value of text input in flutter<p>I do the following to change the value of the input field. Regarding documentation this should work but it don't. Pur...
<p>This will do what you are looking for:</p> <pre><code>class TapTextFormIssue extends StatefulWidget { @override _TapTextFormIssueState createState() =&gt; _TapTextFormIssueState(); } class _TapTextFormIssueState extends State&lt;TapTextFormIssue&gt; { TextEditingController _textEditingController = TextEditin...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is a good pattern for correctly appending to a file with async await?<p>Is it safe to call functions like <code>fs.appendFile()</code> repeatedly? A con...
<p><strong>Your code is theoretically subject to race conditions</strong> because the various writes in different <code>fs.appendFile()</code> operations could clash and could be in flight at the same time because your <code>for</code> loop runs to completion before all the <code>fs.appendFile()</code> operations are d...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Azure AD B2C Why Display Control on password reset for email verification is not rendered?<p>I followed the sample in the documentation to integrate custom e...
<p>Make sure you updated the content definition page contract version for that technical profile which supports display controls.</p> <pre class="lang-xml prettyprint-override"><code>&lt;Item Key="ContentDefinitionReferenceId"&gt;api.localaccountpasswordreset&lt;/Item&gt; </code></pre> <pre class="lang-xml prettyprin...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pulling an Array from a JSON object in C# (New<p>I'm using Newtonsoft JSON in C#.</p> <p>I have a log file which I am trying to parse so I can populate a da...
<p>All of the answers above are completely valid for the question you're asking, however, for better code readability and debugging you're better converting those json strings to actual c# objects. For example you'd set up some models like this:</p> <pre><code>public class Friends { public string Timestamp { get; ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: TinyTDS: chek if query succeded<p>I am using tiny_tds gem in a rails project (working with a legacy MSSQL 2008 database)</p> <p>I execute the following quer...
<p>When you call 'execute' method, your sql does not actually run. TinyTDS sends it to sql server only when you begin manipulating results, and if there is an error, you can catch it</p> <pre><code>res = Client.Execute('sql script') begin res.entries #now sql script is being sent to the sql server rescue =&gt; e ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: TextField lose focus<p>I have a problem with TreeView and TextField. I wrapped those components in TreeViewContainer. I'd like to filter tree nodes by typing...
<p><code>TreeView</code> maintains the <a href="https://github.com/mui-org/material-ui/blob/v4.9.2/packages/material-ui-lab/src/TreeView/TreeView.js#L44" rel="nofollow noreferrer">focused node id within its state</a>. When you re-render the tree with a different structure (e.g. removing the "Root" node), the <code>Tree...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: One Loop with two actions VS two loops with one action performance?<p>I have long time interested in this newbie question.</p> <p>For example we have two si...
<p>From a purely theoretical viewpoint, there's no difference between the two. Either way, it's O(N), and that's the end of that.</p> <p>From a more practical viewpoint, caching can change that simple answer quite a bit. One may use the cache considerably more effectively than the other. That <em>won't</em> necessarily...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: JPA Not Maintaining Connections<p>So it looks like once the program ends, the object connections aren't persisted. Let me explain with a simple example: </p>...
<p>I'm sorry, after looking at your question again, I'm afraid I've answered incorrectly. I think the problem is because your code doesn't cross-link the friends and the parentFriend field. Your code should look more like:</p> <pre><code>Friend a = new Friend(); Friend b = new Friend(); a.getFriends().add(b); b.setPar...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: openshift. Do not deploy WAR<p>i created app on the openshift. Tomcat 7 + maven + spring + hibernate + postgresql. When i deploy war, i get a blank page with...
<p>The problem was an incorrected version of tomcat. I built in verion 8 , but server wanted version 7.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: insert and get Query for Time as AM/PM in JPA using java<p><a href="https://stackoverflow.com/questions/2086313/store-am-pm-time-string-into-time-datatype-in...
<p>I got the solution. it will be achieved by this process.</p> <p>@Farrellmr Thanks for your support</p> <pre><code>package util; import javax.persistence.AttributeConverter; import javax.persistence.Converter; import java.sql.Time; /** * Created by aratan on 2/25/2015. */ @Converter public class MyConverter imp...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Not getting form_for errors for required fields<p>I have a form that when submitted runs a sidekiq worker. Currently if you click submit on the empty form i...
<p>The simplest thing I can think of (without seeing your code) would be to add logic to the controller action (<code>:call_score_range</code> ?) to check for the presence of those fields manually, and add messages to the model there, bypassing the sidekiq logic.</p> <pre><code>def call_score_range @call = Call.new(...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Wordpress from guestform add image into post_content<p>I'm trying to let guests post events in my wordpress page via post categories, they need to set a post...
<p>I'm finding this question a bit vague so I will answer with what I think you mean.</p> <p>First you'll need the <code>enctype</code> attribute on your form.</p> <pre class="lang-html prettyprint-override"><code>&lt;form ... enctype="multipart/form-data"&gt; &lt;input name="file" type="file"&gt; &lt;input n...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: "TypeError: quotechar must be set if quoting enabled" In csv module<p>When creating a <code>csv.DictReader</code> with parameters from the configuration (or ...
<p>The problem in this case was that I passed a <code>None</code> value to the <code>quotechar</code> parameter, which is only allowed if quoting is explicitly disabled using the additional parameter <code>quoting=QUOTE_NONE</code> (more information about these formatting parameters is given <a href="https://docs.pytho...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Temporal median image of multiple images<p>Is there any other way to calculate the median image of multiple images, other than calculating the median for eac...
<p>Here's an example of the way to put 3 toy images into a (height) x (width) x (number of images) array and then invoke <code>numpy.median</code> along the (number of images) axis (which will be the time axis if the images are arranged along it in temporal order).</p> <pre><code>In [1]: img1 = np.array([[1, 2], [3, 4...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Text left align issue<p>I'm using remodal.js (<a href="https://github.com/VodkaBears/Remodal" rel="nofollow">https://github.com/VodkaBears/Remodal</a>) to cr...
<blockquote> <p>[..] for some reason <code>&lt;label&gt;</code> doesn't work</p> </blockquote> <p>It's because the label element is inline by default. Thus, its width is determined by its content, in this case the text. If the width of the element is determined by the text, the text won't appear to be centered.</p> ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to BEST extract information from multiple dataframes based on a series of if\else conditions and matching values? (Guidance needed!))<p>So I have three D...
<p>You can use <code>pandas.pivot(...)</code> for this:</p> <pre class="lang-py prettyprint-override"><code>#assuming it's sorted by Seconds Passed: df_Event["Event_order"]=df_Event.groupby("Event Type").cumcount() df_Event["X"]=df_Event.merge(df_X, on="Seconds Passed").apply(lambda x: x[x["Player"]], axis=1) df_Even...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Display NSManagedObject field in SwiftUI form<p>I want to display a form using the data from an NSManagedObject.</p> <p>Here is my form:</p> <pre><code>str...
<p><code>Binding</code> has explicit constructor for optionals. Try the following</p> <pre><code>Form { TextField("name", text: Binding&lt;String&gt;($record.recordName)) } </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Clarification on sqlTransaction operations<p>My understanding of a transaction is that it is one or multiple SQL commands that will all be executed as a grou...
<p>According to the <a href="https://docs.microsoft.com/en-us/dotnet/api/system.data.sqlclient.sqltransaction?redirectedfrom=MSDN&amp;view=netframework-4.8#examples" rel="nofollow noreferrer">Microsoft documentation</a> that you linked: "The transaction is rolled back on any error, <em>or if it is disposed without firs...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Console Web Service App Doesn't Work When Compiled, but works in Visual Studio<p>I am working on a console application that utilizes the Reporting Services e...
<p>When reading args from the command line, make sure to put the values in double quotes if they contain spaces or special characters.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a way to auto-size pictures when placing them in code using HTML?<p>So I am making a biography page in HTML and I have to place a picture in it. Thi...
<p>Try This: <a href="http://jsfiddle.net/w7xvqn85/" rel="nofollow"><strong>Demo</strong></a></p> <pre><code>&lt;p&gt; &lt;a href="MY WEBSITE LINK" target="_blank"&gt; &lt;img src="https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcQuQ1LDwNtA8y5pylsvvBcWPBazSue1uPsFiBbUEghPBd9QrRmXSG7itA" style='width:100%;' ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How use "ejabber_sm" in my ejabber module?<p>I try write ejabber module. I try to use ejabber_sm, but I can't find examples. I try:</p> <pre><code>-module(m...
<p>The project is called <code>ejabberd</code> with a <code>d</code> at the end, and so are the modules: it should be <code>ejabberd_sm</code>, not <code>ejabber_sm</code>.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Android Navigation with nested bottom navigation<p>I'm new to Android Navigation Component and want to understand how can I use it in my relatively simple sc...
<p>As per the <a href="https://developer.android.com/guide/navigation/navigation-ui#listen_for_navigation_events" rel="nofollow noreferrer">Listen for navigation events documentation</a>:</p> <blockquote> <p>As an example, you might have common UI elements that you intend to show in some areas of your app while hidi...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Getting this exception "Newtonsoft.Json.JsonSerializationException", when trying to deserialize Json to object<p>As part of my Xamarin Forms app, developed f...
<p>It would seem you are doing this because you are unaware of some of the features of the library. This is the one of the most commonly used libraries out there (to the point Microsoft includes it by default in most web based project types) - please look at the features of the library before driving yourself crazy try...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Twilio Dial transfer failing<p>In my app I am attempting to transfer the call to a different phone number. Currently it redirects to the correct xml page, s...
<p>Twilio developer evangelist here.</p> <p>The problem is that <a href="https://www.twilio.com/docs/api/twiml/gather#nesting-rules" rel="nofollow">you cannot use a <code>&lt;Dial&gt;</code> verb inside of the <code>&lt;Gather&gt;</code> verb</a>. I'm not sure exactly what you're trying to achieve with that setup, but...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Currency converter in JS or C#<p>I am just wondering if anyone knows of an online file that can be accessed from JavaScript or C# that contains up-to-date cu...
<p>You'll need to make use of an API if you want real-time updates. <a href="https://openexchangerates.org/" rel="nofollow">Open Exchange Rates API</a> has tiered pricing, but they do seem to have a <a href="https://openexchangerates.org/signup/free" rel="nofollow">basic version</a> which is free for personal use .</p>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: List files from the root folder with onedrive Android API<p>I'm using OneDrive in an Android App and I can't find how to list the root folder contents.</p> ...
<p>You can issue a request against the users root OneDrive folder at me/skydrive/files</p> <pre><code>GET https://apis.live.net/v5.0/me/skydrive/files HTTP/1.1 Authorization: bearer EwCIAq... Host: apis.live.net </code></pre> <p>If you were using the <a href="https://github.com/liveservices/LiveSDK-for-android" rel="...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Highcharts 'Cannot read property tooltipOptions of null'<p>If have the following highchart:</p> <p><div class="snippet" data-lang="js" data-hide="false"> <d...
<p>This issue was probably a Highcharts' bug, see <a href="https://github.com/highslide-software/highcharts.com/issues/3863" rel="nofollow"><strong><em>Tooltip exceptions when using addSeries on a chart with dataGrouping</em></strong></a> - reported one day after you aked the question.</p> <p>Since it <a href="https:/...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Destroy Direct2D bitmap?<p>I'm using C++ Builder XE7. Whenever a form resizes I need to rebuild a D2D bitmap, which I create with CreateBitmap(). As this wil...
<p><code>_di_ID2D1Bitmap</code> is a <a href="http://docwiki.embarcadero.com/Libraries/XE7/en/System.DelphiInterface" rel="nofollow"><code>DelphiInterface</code></a>. An interface reference in Delphi is a pointer to pointer to an IMT. So, a variable of <code>_di_ID2D1Bitmap</code> type is a pointer. </p> <p>You don't ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Google Home SYNC and ReportState "online" values don't seem to be read by iOS client but Android is OK<h3>Problem</h3> <p>When fulfilling SYNC requests, QUE...
<p>I came back to this issue after around a year away from this project. It turns out that this is actually due to misreading the response structure of the QUERY Intent. The SYNC Intent expects an array of objects with &quot;id&quot; fields. The QUERY Intent expects a dictionary keyed by the id.</p> <p>Bizarrely, even ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: change mathjax renderer in R notebooks (with "self_contained: false")<p>I am creating R notebooks that contain equations. I am using RStudio 1.2.5033 on Wind...
<p>The solution is simply to omit the <code>self_contained</code> line in the YAML header or, equivalently, to set <code>self_contained</code> to <code>true</code>. Here is a minimal example of an R notebook for which the user has chosen the mathjax renderer:</p> <pre><code>--- title: "Self-contained notebook with non...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to add 3 drop down in single variable in php?<p>Two days ago I had an interview as a php developer and they gave me a task to perform. I completed 90% of...
<p>The reason is your are not concatenating the variables in php. Check below code. You are almost there but with small coding mistake. </p> <p>What you are trying to do is concatenate a variable with a string. So you have to concatenate variable with a '.' and then add your string. In here <code>/</code> works as the...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python: Accidentally assigned repr an int value<p>I don't exactly know how I whiffed this, but at some point I input</p> <pre><code>repr = 64 </code></pre> ...
<p>Delete your variable:</p> <pre><code>del repr </code></pre> <p>This will clear the binding you created, unhiding the builtin. (It will not remove the builtin <code>repr</code>.) This gets you back to a slightly cleaner state than <code>repr = builtins.repr</code> would, though it usually won't matter.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: WPF: How to prevent reading underscore character of the AccessText element by Narrator?<p>I faced a strange issue when trying to support both keyboard and Na...
<p>Your approach of using your own (say) AccessTextToAutomationPropertiesNameConverter() which strips the underscore, would be an attractive way to go for some apps. What was the performance impact in your app when you did that, (and how many controls were having to run through the converter)? Did your converter have a...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I run a protractor config file (.ts) with ts-node?<p>I used to compile e2e protractor tests written in TS before run, but now I figured out how to co...
<p>Just create another .js file that will have following</p> <p>launcher.js</p> <pre><code> require('ts-node').register({ compilerOptions: { module: 'commonjs' }, disableWarnings: true, fast: true }); module.export.config = require...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Logback initialization<p>I start java application with this configuration to force use my configuration of logback and never write on standard output:</p> <...
<p>You requested that to happen with this line in your configuration file:</p> <pre><code>&lt;configuration debug="true"&gt; </code></pre> <p>Debug info from logback initialization always goes to the standard output; otherwise you'd have a chicken-and-egg problem trying to set up your configuration.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: XAMPP - Windows - SSH2 - Failed to get banner<p>After much stress I was able to get SSH2 working with XAMPP on a Windows 2008 R2 server on a LAN network. At...
<p>@Anshu already pointed out that you seem to have a Web server running on port 8880, so SSH cannot possibly be listening on the same port (and IP address).</p> <p>My best guesses are that either, you don't have SSH running on port 22, or that the Windows firewall blocks port 22. Also, it has been a while since I use...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Chart Building Issue With SQL Server<p>I am in the process of trying to build a pie chart based on data from a table in SQL Server, Here is my code, both ASP...
<p>Where you write </p> <pre><code>chartData.Add(new object[] { sdr["Amount"].ToString(), sdr["Month Year"].ToString() }); </code></pre> <p>change it to </p> <pre><code>chartData.Add(new object[] { sdr["Month Year"].ToString(), sdr["Amount"] }); </code></pre> <p>And that should fix it. Also, change the head...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to chain a series of functions which return promises, and require different parameters?<p>I have two asynchronous functions, which use parameters already...
<p>Provide anonymous function and place <code>func2</code> invocation in it:</p> <pre><code>func1(a, b).then(function() { func2(c, d); }); </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Alternative to dec2hex in MATLAB?<p>I am using <code>dec2hex</code> up to 100 times in MATLAB. Because of this, the speed of code decreases. for one point I ...
<p>Function calls are (still) expensive in MATLAB. This is one of the reasons why vectorization and pseudo-vectorization is strongly recommended: processing an entire array of <code>N</code> values in one function call is way better than calling the processing function <code>N</code> times for each element, thus saving...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: regex in python, replace all vowels in word except #hashtag and @username<p>I'm trying to learn regex in python to replace all vowels in word except #hashtag...
<p>You may use</p> <pre><code>import re s = "@username blah blah #blah blah #hashtag @blah blah blah" print(re.sub(r'([@#][\w-]+)|[aiueoAIUEO]', r'\1', s)) </code></pre> <p>See the <a href="https://regex101.com/r/14nFIi/1" rel="nofollow noreferrer">regex demo</a> and the <a href="https://ideone.com/aRZ6kB" rel="nofol...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Ruby extract substring from an array of strings<p>I have an array of strings.</p> <pre><code>irb(main):009:0* str_arr =&gt; ["hello how are you?", "I am fin...
<p>Here is your array:</p> <pre><code>arr = ["hello how are you?", "I am fine. What are you doing?", "Hey, I am having a haircut. See you at Hotel KingsMen at 10 am."] </code></pre> <p>The first step is to join the elements into a string. I've chosen to use a space for the separator, but you could use s...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Redefining variable according to Text Box Error<p>I'm new to coding and C# so sorry if this is a stupid question.</p> <p>I need to redefine a variable accor...
<p>First and foremost, the error message is trying to point out that you have asked for something that does not exist. As an additional bit of information, it also points out that <code>int</code> is a keyword, and is not suitable as a variable name.</p> <p>If you have entered a number into a text box and would like ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: AWS Extract Volume AttachmentID Boto3<p>I need to produce a list of all ebs volumes and instance attachments in my account. I understand how to do this will ...
<p><code>describe_volumes()</code> already returns the information you need in <code>'Attachments'</code>. To print all volumes, you will need to query all regions and handle pagination.</p> <pre><code>import boto3 import botocore.exceptions session = boto3.Session() for region in session.get_available_regions('ec2')...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a way to check whether an object referenced by a WeakReference has a GC root?<p>Is there a way to check whether an object referenced by a WeakRefere...
<p>As far I know, no.</p> <p>In order to determine whenever the reference has GCRoot which is holding it alive, garbage collection algorithm needs to happen. </p> <p>There's nothing wrong with <code>GC.Collect()</code> in unit tests, imo.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: sum function issue<p>i am not good at python right now, i have been trying something for a long time but i couldn't do, i want to sum values in a column but ...
<p>Use <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.sum.html" rel="nofollow noreferrer"><code>pd.Series.sum</code></a> and check threshold with <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.gt.html" rel="nofollow noreferrer"><code>pd.Series.gt</co...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I add multiple RPC endpoints using hyper?<p>I want to create multiple RPC methods using <a href="https://hyper.rs/" rel="nofollow noreferrer">hyper</a...
<p>One approach I've taken in the past is to make one service act as a routing table. I've written the service containing nothing but a match that matches the path and http method which then calls the appropriate function in each arm.</p> <p>E.g: </p> <pre><code>pub async fn route(req: Request&lt;Body&gt;) -&gt; Resu...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: GLEW and glfw compile error: undefined reference to symbol 'XConvertSelection'<p>I'm trying to compile this code:</p> <pre><code>#include &lt;stdio.h&gt; #i...
<p>Ok, after some research I found that the DSO error which I got means that the order of the includes I've implemented is incorrect and cause the compilation to fail.</p> <p>So what I did is I used the command:</p> <pre><code>pkg-config --static --libs x11 xrandr xi xxf86vm glew glfw3 </code></pre> <p>To get the pa...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Output last row of dataframe with datetime objects?<p>Total Python novice here, and I'm hoping this is a simple issue, but I have searched far and wide and h...
<p>Pandas doc provides the solution you're looking for: <a href="https://pandas.pydata.org/pandas-docs/version/0.17.0/generated/pandas.core.groupby.GroupBy.tail.html" rel="nofollow noreferrer">https://pandas.pydata.org/pandas-docs/version/0.17.0/generated/pandas.core.groupby.GroupBy.tail.html</a></p> <pre><code>df.gro...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What does visibility Timeout mean for AWS SQS<p>What is the meaning of "Visibility Timeout" for Amazon SQS service ? What factors determine an ideal value fo...
<p>When using sqs as queuing service, when you read the message off the queue it does not automatically delete the message off the queue. So when you are processing the message, sqs will wait for the time period defined as visibility timeout before other consumers will get the same message again. </p> <p>The best tim...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Load a website within wordpress plugin<p>I developed a plugin that needs to show some information at the end, and for that purpose I have a template inside m...
<p>Ok, I already figure this up. At the end I just called the core wordpress components as it was a template, and change the content to what I wanted.</p> <pre><code>get_header(); get_footer(); </code></pre> <p>With those 2 functions I could call everything that I needed to create my website withing my plugin.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: GPU: converting floating-point vertex coordinates to fixed-point. How To?<p>I am essentially trying to understand how GPUs work when it comes to converting f...
<blockquote> <ol> <li>First, this suggests that vertex coordinates can be negative. However what I don't understand is that technically at that stage vertex coordinates are in raster space, and all triangles should have been clipped before. Thus technically there should only be vertex coordinates in the range [0, i...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: NavigationDrawer unable to instatiate application java.lang.classnotfoundexception<p>I`m developing an app. And at this part I only have an activity for my N...
<p>Ive already fixed it. Ive tried so many things that didn't work on Eclipse. Than I tried to do it on Android Studio.. And it worked! Thanks for your help, though!</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Bubble sort not sorting properly in python<p>I'm making bubble sort in Python but have no idea why it doesn't sort properly.</p> <pre><code>N = [80000, 20, ...
<p>You should compare <code>N[j]</code> with <code>N[j+1]</code>, because you need repeatedly <em>swapping</em> the <em>adjacent</em> <code>elements</code> if they are in wrong order.</p> <pre><code>N = [80000, 20, 40 , 50, 10000, 50, 60, 90, 100, 5000, 22] for i in range(len(N)-1): for j in range(len(N)-i-1): ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to avoid generic in hierarchy of classes?<p>I have next hierarchy of classes</p> <pre><code> class MyObject { } class FirstChild extends MyObject { ...
<blockquote> <p>How can I resolve my problem without generic in AbstractUsefulService?</p> </blockquote> <p>You can't, if you are going to pass the <code>calculator</code> to <code>AbstractUsefulService</code>.</p> <p>You need to know what type of object the <code>calculator.calculateValue</code> will accept.</p> ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Jsoup Selector Regex matching<p>I want to get just the elements with this id pattern "answer-[0-9]*"</p> <p>I'm using this regex in select <code>"div[id~=an...
<p>Based on example from <a href="http://jsoup.org/cookbook/extracting-data/selector-syntax" rel="nofollow">official tutorial</a></p> <pre><code>[attr~=regex]: elements with attribute values that match the regular expression; e.g. img[src~=(?i)\.(png|jpe?g)] </code></pre> <p>it looks like jsoup simply checks if attr...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can't return mysql db query results in Netlify Lambda function<p>I am working off <a href="https://functions-playground.netlify.com/" rel="nofollow noreferre...
<p>Try using JSON.stringify on the results, the body should be a string.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to connect to SQlite using cl-dbi<p>Tried:</p> <blockquote> <p>(defvar <em>connection</em> (dbi:connect :mysql :database-...
<blockquote> <p>(cl-dbi:connect :sqlite3 :database-name "db.db")</p> </blockquote> <p>Use <code>:sqlite3</code> as the driver name. </p> <p>You had a clue on the README: <a href="https://github.com/fukamachi/cl-dbi#using-dbiwith-connection-to-ensure-connections-are-closed" rel="nofollow noreferrer">https://github.c...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Count the amount of records are associated to another record<p>In my Ruby on Rails application I am creating a cinema system, and on the bookings/new page I ...
<p>In your <code>Screen</code> class add:</p> <pre><code>has_many :bookings, through: :showings </code></pre> <p>And then your code becomes something like:</p> <pre><code>def remaining_seats seats.count - bookings.sum(:seats_quantity) # &lt;-- edited when I realized there was a quantity in a booking end def scre...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Shape error for Vanilla RNN's dense layer in Keras?<p>I am trying to do the timeseries forecasting using Vanilla RNN (No LSTM).</p> <blockquote> <p>Error ...
<p>The problem is, that your output has -- just as the error states -- shape <code>(2,)</code>, because it's produced by a <code>Dense(2)</code> layer. If you replace it with <code>Dense(1)</code>, shapes will match.</p> <p>However note that there is nothing recurrent yet and you're just modeling <code>y(t_i)</code> a...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Conditionally Include Dependency package.json<p>I have a dependency that is only needed for Mac OS in an npm project and was wondering if there is some way t...
<p>You can use an optional dependency.</p> <p>Like this in your package.json:</p> <pre><code>"optionalDependencies":{ "grunt-appdmg":"0.2.0" } </code></pre> <p>More info on <a href="https://docs.npmjs.com/files/package.json#optionaldependencies">NPM documentation</a></p> <p><code>npm install</code> will then just...