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: Mocked interface doesn't mock<p>I met such a method in one project, and the similar and brief logic is shown as follows</p> <pre class="lang-cs prettyprint-o...
<p>Yes, you can just tell Moq to ignore the argument you provided (and hence consider the setup to be fulfilled for all possible arguments).</p> <p>In the simplest case, you could write:</p> <pre class="lang-cs prettyprint-override"><code>analyzerService.Setup(analyzer =&gt; analyzer.AnalyseExameFile(It.IsAny&l...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Call db.close() on Button_Click (QT/C++)<p>how can i close a database connction from Button_onClick funktion?</p> <pre><code> Artikelverwaltung::Artikelve...
<p>It is not working because db is a local variable in <code>Artikelverwaltung::Artikelverwaltung</code> you need to make it a class attribute.</p> <pre><code>class Artikelverwaltung { private: QSqlDatabase m_db; }; Artikelverwaltung::Artikelverwaltung(QWidget *parent) : QDialog(parent), ui(new Ui::Ar...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: React js stop looping background video<p>I am trying to make a page with looping background video with <code>React js</code>.</p> <p>When I compile the code...
<p>I figure out and might someone have the same problem.</p> <p>use <strong>autoPlay loop muted</strong> so;</p> <pre><code>&lt;video className='VideoTag' autoPlay loop muted&gt; &lt;source src={BackVideo} type='video/mp4'/&gt; &lt;/video&gt; </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to detect if net.Socket connection dies - node.js<h2>Background</h2> <p>I am communicating with a machine using <a href="https://nodejs.org/api/net.html...
<p>Here's an interesting read: <a href="https://blog.stephencleary.com/2009/05/detection-of-half-open-dropped.html" rel="noreferrer">https://blog.stephencleary.com/2009/05/detection-of-half-open-dropped.html</a></p> <p>Note in particular this remark:</p> <blockquote> <p>It is important to note that the act of recei...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Emberjs "eq" in component<p>Got a component that works just fine as follows (selectedId is definitely set):</p> <pre><code>export default Ember.Component.ex...
<p>I would definitely recommend that you use Ember Power select component since they have solved everything you need for Select component</p> <p><a href="http://www.ember-power-select.com/" rel="nofollow">http://www.ember-power-select.com/</a></p> <p>They have two component for single select entry and multiple. There...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Combing different length elements into one list Python using a for and if loops<p>Input : </p> <pre><code>a = [{'layer': 'OVC', 'ceiling': '020', 'type': No...
<p>You can do that with some comprehensions like:</p> <h3>Code:</h3> <pre><code>cloud_group_layer = [[x['layer'] for x in data] for data in d] cloud_group_height = [[x['ceiling'] for x in data] for data in d] </code></pre> <h3>Test Code:</h3> <pre><code>a = [{'layer': 'OVC', 'ceiling': '020', 'type': None}] b = [{...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Angularjs: Create a new scope property inside a directive<p>The value is never shown on the DOM and i'm just trying to see if this way works..</p> <p>What i...
<p>I made <a href="http://plnkr.co/edit/UvlpzCaqP5CZxl3Y8awd" rel="nofollow">this plunker</a> to explain why your directive doesn't work.</p> <pre><code>&lt;div rest="accounts"&gt; &lt;!-- You can't access the directive variable $rest from here The directives variables are only available on it's template...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Convert class 'pandas.indexes.numeric.Int64Index' to numpy<p>I am isolating some row ids from a Pandas dataframe, like this: </p> <pre><code>data = df.loc[d...
<p>try <code>rows = df.index.values</code> instead</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to close an Angular Modal from the outside controller<p>I am using <code>angular-modal-service</code> to open a modal.</p> <pre><code>$scope.showLoader ...
<p>You can assign the modal closing function to the <code>$scope</code> when the modal is completely loaded. I added a dummy function, that it won't execute <code>undefined</code> if the modal is closed, before it is ready. You can also skip that, if you can assure, that it won't be possible.</p> <pre><code>$scope.clo...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to retrieve all posts of a user via Facebook Graph API using promises and recursion?<p>I am currently developing a web app which uses the Facebook Graph ...
<p>Try this:</p> <pre class="lang-javascript prettyprint-override"><code>function getAllPosts() { return new Promise((resolve, reject) =&gt; { let postsArr = []; function recursiveAPICall(apiURL) { FB.api(apiURL, (response) =&gt; { if (response &amp;&amp; response.data) { //add respons...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to display error message in dialog from catched exception in a background task javaFX?<p>I am building javaFX user-interface with user interaction betwee...
<p>The code works fine assuming you're opening the dialog properly:</p> <pre><code>} catch (Exception e) { System.out.println("Exception caught in task!"); Platform.runLater(() -&gt; { Alert dialog = new Alert(AlertType.ERROR, "Error", ButtonType.OK); dialog.show(); }); } </code></pre> <hr...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Disable the XCode LaunchScreen at startup in a React Native app?<p>Is there a way to disable the LaunchScreen at startup? I know how to remove contents of th...
<p>No, Apple <a href="https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/LaunchImages.html" rel="nofollow">requires</a> you to supply a launch screen. You can instead supply a static image, but then you'd have to make different sizes for different devices.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: D3 blur out / lower the opacity of non-related links when dragging a particular node<p>I'm trying to blur out / lower the opacity of non-related links when d...
<p><code>dragged</code> is called throughout the drag so it makes sense to update link opacity in the <code>dragstarted</code> and <code>dragend</code> i.e. the minimum number of times.</p> <p>E.g. in <code>dragstarted</code> run the test on whether links are connected and update the opacity appropriately (e.g. 1 for c...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Reuse the hash-key and generate csv ready format<p>I'm trying to create an csv ready output with jq, and want to reuse the nested hash key on the way.</p> <p...
<p>If you separate accessing <code>.key</code> and the iteration over <code>.value[]</code>, you'll get the cartesian product:</p> <pre class="lang-sh prettyprint-override"><code>jq 'to_entries[] | [.key] + (.value[] | [.dest_url])' </code></pre> <pre class="lang-json prettyprint-override"><code>[ &quot;google.com&qu...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I solve Uncaught TypeError?<p>While trying to push element in array, I receive an error:</p> <blockquote> <p>main.js:1 Uncaught TypeError: Cannot rea...
<h5>There are two mistakes in your code.</h5> <ol> <li>You are targeting the <code>id</code> by using <code>document.getElementById(&quot;.input&quot;)</code>, however; <em><strong>id</strong></em> in html is <code>input</code> not <code>.input</code>. You have to remove <code>.</code> before <code>input</code>.</li> <...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to handle multiple items in RecyclerView<p>I have four radio button inside the radio group in recyclerview. when i click first position of radio button i...
<p>add this in your adapter, it will handle item according to respective position.</p> <pre><code>@Override public int getItemViewType(int position) { return position; } </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Breakpoints in Chrome not working with Sourcemap<p>This is the most annoying problem. I've run into <a href="https://stackoverflow.com/questions/36337972/sou...
<p><strong>FOUND THE PROBLEMATIC PIECE OF CODE</strong></p> <pre><code>var alertVolumeUrl = function(ticker, term_id) { var url = api.alertsVolume; return _.isEmpty(term_id) ? url + ticker : url; }; function alertsVolume(ticker, params) { 
 var url = alertVolumeUrl(ticker, params.term_id); return $htt...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Compare ells A3 and A2, if equal, nothing else color row 3 cells A though F. Repeat with next row<p>What I have are a list of contracts below a header row. ...
<p>if you are interested, this can be done with conditional formatting with the following formula:</p> <pre><code>=ISEVEN(SUMPRODUCT(1/COUNTIFS($A$1:$A1,$A$1:$A1))) </code></pre> <p><a href="https://i.stack.imgur.com/rGN7a.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rGN7a.png" alt="![enter imag...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I make an array instaed of nested arrays in Javascript from myArray?<p>I need to split riskTypeNo from each object and then assign selectedValue to e...
<p>you can use this method instead :</p> <pre><code>const newArray = []; myArray.forEach((item1) =&gt; { item1.riskTypeNo.split(&quot;;&quot;).forEach((item2) =&gt; { newArray.push({ riskTypeNo: item2, selectedValue: item1.selectedValue }); }); }); </code></pre> <p>result will be in <code>newArray</code>.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I combine these two snippets of CoffeeScript into 1 file that works?<p>So I have two snippets that work independently:</p> <pre><code>$ -&gt; $('...
<p>Make sure to name your file <code>jobs.js.coffee</code> (don't forge <code>js</code>). Also, spacing/tabs matter, so make sure you don't indent/unindent part of the code.</p> <pre><code>$ -&gt; $('[data-provider="summernote"]').each -&gt; $(this).summernote height: 300 companySelect = $('#company-sel...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Reading and parsing raw data from JSON file<p>I am using QzTray to print receipt through my nodejs app. I have to create a json array that looks like this </...
<p>Your JSON contains single quotes, rather than double quotes, which will throw an error. <br> You are also using ANSI escape codes, versus UTF-16 codes. UTF-16 codes are what JSON use, therefore producing an error when your Javascript attempts to read the JSON. <br> It's also possible you were using UTF-8 escape code...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Google BigQuery Replace function for string type<p>I am trying to replace certain customer names in my data. I was able to do SQL using Google BigQuery langu...
<p>The <code>CASE WHEN</code> option is pretty reasonable. Another option is to chain them together:</p> <pre><code>REPLACE( REPLACE( REPLACE( CustomerName, 'ABC', 'XYZ'), 'PLO', 'Rustic'), 'Kix', 'BowWow') </code></pre> <p>Which one you pick really depends on the exact scenario. T...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to compare just the date or just date time ignoring seconds in a Python Pandas dataframe column of mixed data types?<p>In a pandas dataframe, I have a co...
<p>Use <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.dt.normalize.html" rel="nofollow noreferrer"><code>Series.dt.normalize</code></a> for compare datetimes with remove times (set them to <code>00:00:00</code>) or with <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Jquery .css to change one style<pre><code>$(document).on('click', '.close-link', function(){ $(this).parent().parent().parent().parent().remove(); ...
<p>You can use</p> <pre><code>$(document).ready(function(){ $('.close-link').on('click', function() { $(this).parent().parent().parent().parent().remove(); $('#followdiv').css( "top", "0px" ); }); }); </code></pre> <p>Your <code>div</code> has an id so you can target it directly wi...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Number of palindromic subsequences of length 5<p>Given a String <code>s</code>, return the number of palindromic subsequences of length 5.</p> <p>Test case 1...
<ul> <li>Whenever 2 characters match, we only have to find how many palindromes of length 3 are possible in between these 2 characters.</li> </ul> <p><strong>For example:</strong></p> <pre><code>a bcbc a ^ ^ |_ _ _ | </code></pre> <p>In the above example, you can find 2 palindromes of length <code>3</code> which i...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: The given ruleset does not contain any rules with type System.Object, mscorlib,<p>First, I am using www.codeeffects.com framework to make a business rule eva...
<p>The GetRuleXml() method returns an XML with the <em>type</em> attribute set to a type of the source object. In your case it would be the name of the type returned by the gen.CreateType() method, e.g.:</p> <pre><code>&lt;rule id='03b33dd0-4389-4ac4-a5aa-bd81fab41e00' eval='true' webrule='4.0.0.8' utc='10/20/2011 4:1...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Javascript Slice: Is is possible to use 2 parameters to select the last character of a string?<p><strong>The Question</strong></p> <p>If I want to use <code...
<p>There you go :)</p> <pre><code>theString.slice(theString.length - 1, theString.length) </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Specify repeated expression in gitlab regex<p>How do you specify a repeated expression in a regular expression in gitlab? More generally, where is the gitla...
<p>GitLab uses <a href="https://github.com/google/re2/wiki/Syntax" rel="nofollow noreferrer">re2</a> with Ruby's <a href="https://ruby-doc.org/core-3.1.2/Regexp.html" rel="nofollow noreferrer">regexp</a> to match the provided parameters. In the source code for GitLab, you can see the current <a href="https://gitlab.com...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Changing column name dynamically<p>I have a Header / Detail custom screen where I'm manipulating which grid columns display based on a dropdown selection in ...
<p>Your display name routine looks correct however to make sure the column names actually update you need to do the following:</p> <ul> <li>In the page source, you need to set the "RepaintColumns=true" value on the grid. This can be done via customization manager or directly from your ASPX source. - This tells the ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Mass replacement of string values of a cell array to integer in Matlab<p>I have a cell array in MATLAB with 1 column and 310 rows which holds the following d...
<p>You can just use <code>ismember</code> to find all of the <code>'AB'</code> values in the cell array. It will yield a <code>1</code> where there is an <code>'AB'</code> and <code>0</code> otherwise.</p> <pre><code>data = {'AB'; 'NO'; 'AB'; 'AB'; 'NO'}; result = ismember(data, 'AB'); % 1 0 1 1 0 </code></...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Find out how many sequences of binary '1' are in list<p>What I am trying to do is to find out how many sequences of '1' are in a list read from the user inpu...
<p>You can use <code>itertools.groupby</code> in a generator expression for <code>sum</code>:</p> <pre><code>from itertools import groupby sum(1 for k, _ in groupby(mylist) if k) </code></pre> <p>This returns: <code>3</code></p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I fill empty values with 0?<p>I've got the following code</p> <pre><code>MyDatabase | project SessionId, NumberOfAlarms </code></pre> <p>I've got some...
<p><a href="https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/coalescefunction" rel="nofollow noreferrer">coalesce()</a></p> <pre><code>let MyTable = datatable(SessionId:int, NumberOfAlarms:int) [ 1,14 ,2,62, 3,int(null) ,4,11 ,5,int(null) ,6,37 ,7,12 ]; MyTable | project SessionId, NumberOfAlarms = ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Java array of object error (cards)<p>Let's start, 3 classes (Card,Start,Deckofcards)</p> <p>1º Card:</p> <pre><code>public class Card { private String ...
<p>The value of <code>take</code> will always be the first card in the array. </p> <p>The <code>while</code> loop never terminates when you set the value equal to null because <code>while2</code> is only set to <code>false</code> when a non-null entry is found. Once a <code>null</code> is found, then nothing happens a...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Move files from folders/subfolders to same folder structure in another folder<p>I have Excel VBA code that move files from one folder to another based on a l...
<p>Something like this should do it:</p> <pre class="lang-vb prettyprint-override"><code>Sub CopySelected() Dim rngFileNames As Range, srcPath As String, destPath As String Dim colFiles As Collection, f On Error Resume Next Set rngFileNames = Application.InputBox(&quot;Please select the file n...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Truncate table Dataverse<p>I am trying to truncate a table in Dataverse, so I have installed SQL Server Management studio, selected my database, and ran the ...
<p>The SQL Connection to Dataverse is read-only</p> <blockquote> <p>The SQL connection provides read-only access to the table data of the target Dataverse environment thereby allowing you to execute SQL queries against the Dataverse data tables.</p> </blockquote> <p><a href="https://docs.microsoft.com/en-us/power-apps/...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Store Result of Bash Command in Shell Variable<p>I am trying to store the result of a bash command within a for loop for use in a command. This is what I cur...
<p>Your <code>for</code> statement is wrong, and your variable assignment statement is also wrong. You shall write something like this:</p> <pre><code>for filename in /home/WIN/USER/files/*; do var=$( your shell code goes here ) # you assign the output of the shell code here echo $var # you echo the results her...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: C++ and ODB: Creating a vector of objects<p>I have an object called TimelineItem which has a datafield called linked_items_ which holds a vector of type Time...
<p>I think your <code>vector&lt;TimelineItem&gt; linked_items_;</code> should actually be <code>vector&lt;TimelineItem*&gt; linked_items_;</code></p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Where do database migrations sit in a Node.js project?<p>I'm currently working on a Node.js project and I've written a number of database migrations using Se...
<p><a href="http://sequelize.readthedocs.io/en/latest/docs/migrations/#skeleton" rel="nofollow noreferrer">http://sequelize.readthedocs.io/en/latest/docs/migrations/#skeleton</a>:</p> <blockquote> <p>All migrations are expected to be located in a folder called <code>migrations</code> at the very top of the project.<...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: c# How to get standard font style object in Word<p>I'm inserting variable text from a *.html file into a Word document and have to adapt the font(name and si...
<p>For built-in styles, the Word object model provides the <a href="https://docs.microsoft.com/en-us/dotnet/api/microsoft.office.interop.word.wdbuiltinstyle?view=word-pia" rel="nofollow noreferrer">enumeration</a> <code>WdBuiltinStyle</code>. Using this instead of a <code>string</code> value (the local name of a style)...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: get a list of tuples with the columns that have only two same strings:<p>I have the following problem:</p> <p>In case I want to get the columns of a datafram...
<p>You want the <em>intersection</em> of both columns to contain two (or more?) values. You can use the <a href="https://docs.python.org/3/library/stdtypes.html#set" rel="nofollow noreferrer"><code>set</code> class</a> and its operations for this.</p> <pre><code>df_example2 = pd.DataFrame({'A':[2,3,4],'B':[1,2,3]}) int...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Multiple calculations on a dataframe based on certain reference points<p>Hi I am a bit new to this, but I am looking to figure out how I can do this on R.</p...
<p>Here's an approach using <code>dplyr::group_by</code> to do the calculation separately for each <code>Name</code>, and <code>dplyr::across</code> to apply the calculation to all the columns that start with &quot;lap.&quot; The funny bit at the end <code>~log(.x/first(.x))</code> means that for every column we specif...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Where is synthetic sugar for generics with two type parameters (ie. that F[A,B] is equal to A F B) documented?<p>I'm learning Scala and I found out that if I...
<p>You're looking for <em>Infix Types</em>, from the <a href="http://www.scala-lang.org/files/archive/spec/2.11/03-types.html#infix-types" rel="nofollow">SLS 3.2.8</a>:</p> <blockquote> <p>An infix type <code>T1 op T2</code> consists of an infix operator <code>op</code> which gets applied to two type operands <code>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Angular 2 inputs properties are not binding correctly<p>My final goal is to build a component to wrap Google Map. A google map object has lots of options.</p...
<p>This may sound dumb, but you cant do this with the root component (my-app).. you need to do this in a child component. Since <code>my-app</code> is the entire angular application.</p> <p>e.g. </p> <p><code>src/my-component.ts</code> file</p> <pre><code>import {Component, Input} from '@angular/core' @Component({ ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why am I getting multiple outputs with this decorated function?<p>I've recently made a move from C/C++ to Python. Having difficulties in understanding closur...
<p>You're decorating the decorated function again. <code>outer</code> takes in a function and returns closure which of course is function by itself. There's nothing preventing you to pass the returned function as a parameter to the following call like you're doing in your example.</p> <p>If you change your code to pri...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Solr query by specific fields<p>I use solr , latest version. I run text query with "OR" condition by different fields. I want to have indication due to which...
<p>If you only want to specify which fields do you want to get back in the response, then you're after the <code>fl</code> parameter, if you do a request like:</p> <pre><code>http://localhost:8983/solr/demo/query? q=title_t:black fl=author,title </code></pre> <p>You're indicating that you only want to get back th...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Right way to parallelize pixel access across multiple images using ImageSharp<p>I'm trying to parallelize the processing of an image using ImageSharp. The do...
<p>Following up on my own question, I had a chance to work through @James's answer and made some discoveries that I thought might be useful to share. If you don't give a shit about what is happening and just want code, skip to the end.</p> <p>First, I looked into his suggestion to avoid using the <code>Advanced</code> ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to update a SQLiteDatabase for a specific argument?<p>I'm VERY new to programming, and my teacher doesn't really teach. I've been trying to learn from he...
<p>I noticed you had &quot;where arguments&quot; set incorrectly.</p> <p>Try the code below.</p> <pre><code>public int updateName(String oldName , String newName , String newPhone, String newRating) { if(newName.isNotEmpty()){ SQLiteDatabase db = myhelper.getWritableDatabase(); ContentValues content...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to check if Metamask is connected after page refreshing<p>My dApp have to connect to MetaMask. There are two rude solutions in the docs: make user to cli...
<p>I finally found a possible solution and it turned out to be as simple as it should be. There is an <a href="https://eth.wiki/json-rpc/API#eth_accounts" rel="noreferrer">eth_accounts</a> method in Ethereum JSON-RPC which allow us to ask for available accounts without actually requesting them. This way we can check if...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Plotting discrete colorbar in legend style using Matplotlib<p>Sometimes, I want to plot discrete value in pcolormesh style. </p> <p>For example, to represe...
<p>Maybe the easiest way is to create corresponding number of Patch instances:</p> <pre><code>import matplotlib.patches as mpatches import matplotlib.pyplot as plt import numpy as np data = np.random.randint(8, size=(100,100)) cmap = plt.cm.get_cmap('PiYG', 8) plt.pcolormesh(data,cmap = cmap,alpha = 0.75) # Set bor...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to get name of a specific item in array and increment its value<p>I am working on a simple cart, for a homework project. I would like to ask, what would ...
<p>It really depends on your coding style, and how its going to self-document.</p> <p>You can use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map#parameters" rel="nofollow noreferrer"><code>map</code></a>:</p> <p><div class="snippet" data-lang="js" data-hide="false" d...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Octave Sockets Package, how to receive large data streams<p>I still have problems with Octave. I need to receive large (>10M) images via a web socket connect...
<p>If you want to read data until disconnect I would suggest</p> <pre><code>data = recv (b, Inf, MSG_WAITALL); </code></pre> <p>without any loop or horcat. And on your client side (netcat) use -q0:</p> <pre><code>netcat.exe -q0 localhost 12345 &lt; test.jpg </code></pre> <p>Btw, if you want to store it on the serve...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Selecting multiple images and setting to a gridView<p>This is probably the worst way to go about this but I'm currently stuck and just going for it. I curren...
<p>i figured this out a long time ago but i figure i should put an answer here for anyone else to use.</p> <pre><code>protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == RESULT_OK) { if(requestCode...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Dataframe Operation Splicing<p>I have a single column dataframe without headers and I want to split it into multiple columns as follows The current dataframe...
<p>Assuming such a DataFrame:</p> <pre><code>df = pd.DataFrame({'col': range(1, 101)}) </code></pre> <p>you can use the underlying numpy array to reshape:</p> <pre><code>df2 = pd.DataFrame(df['col'].to_numpy().reshape(5, -1, order='F')) </code></pre> <p>output:</p> <pre><code> 0 1 2 3 4 5 6 7 8 9 ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Markedly faster to access a numpy array 'arr' than 'arr[:]'<p>In the following scenario, why is it notably faster to access <code>arr</code> than <code>arr[:...
<p>Neither <code>arr</code> nor <code>arr[:]</code> actually <em>access</em> the array's buffer. <code>arr</code> merely loads a reference to the array, while <code>arr[:]</code> constructs a new object backed by the same buffer. <code>arr[:]</code> is much more expensive, what with the object creation, but it still do...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: FullCalendar-2.7.3 events not showing on initial load<p>In my console, I get this error: </p> <pre><code>jQuery.Deferred exception: Cannot read property 'c...
<p>This is compatible problem with newest JQuery 3. I can't help but if you want to get working FullCallendar you should temporary reverse your JQuery to 2.x or 1.x line and wait for FullCalendar update.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: RecyclerViewAdapter only showing the last item<p>I'm working with a tabbed layout with 3 fragments. At first I was using the ListView, then moved to Recycler...
<p>Apparently my adapter was just fine, the problem was where I filled the ArrayList.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to put buttons on two ends of screen in flutter<p>I want the buttons on flutter to be either side of screen i.e one on the bottom right and one on the bo...
<p>One option is to use <code>mainAxisAlignment: MainAxisAlignment.spaceBetween</code> in the <code>Row</code> widget, combined with setting <code>floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat</code>. You can use <code>Padding</code> to add some space horizontally:</p> <pre><code>floatingAction...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Get enum from matching associated value<p>How do I select an enum that's associated value as a UIImage matches a UIImage?</p> <pre><code>enum ClothingType: ...
<p>By doing so, you are violating the philosophy of MVC and the point of using enum. You should use the enum, which is a much simpler data object, for all the underlying operations, and only render the image when displaying, and never read the image back since you should already know its underlying enum value on behalf...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Generate random number in python, such that the likelihood of a number being generated is inversely proportionate to it's value<p>I want to generate a pseudo...
<p>Would you accept an accurate hack?</p> <pre><code>random.choices(range(1,n+1),[1/k for k in range(1,n+1)]) </code></pre> <p>works. Furthermore it has an optional parameter <code>k</code> which lets you generate as many random numbers as you need.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Changing dictionary keys using a separate dictionary?<p>I am using the CIFAR 10 data set and want to create a function which returns the number of images per...
<p>You can use a dict-comprehension.</p> <pre><code>result = {k: img_per_class[v] for k, v in classes_dict.items()} </code></pre> <p>(You can pass this dict to the <code>Counter</code> constructor if you must have a <code>Counter</code>.)</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: python multiprocessing is loosing values<p>I tried to speed up a calculation using Pool from the multiprocessing package. While I did get a significant speed...
<p>You need to protect the modification of your values with <code>Lock</code> (see <a href="https://eli.thegreenplace.net/2012/01/04/shared-counter-with-pythons-multiprocessing" rel="nofollow noreferrer">this article</a>).</p> <pre><code>from multiprocessing import Lock lock = Lock() def some_func(roll): with lo...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How Can I use two differents CSS backgrounds in Angular?<p>I would like to change the background based on a boolean.</p> <p>If I have two backgrounds in CSS:...
<p>You can add different classes depending of a boolean state using angular ngClass and a ternary operator in a HTML tag</p> <p>example:</p> <p>HTML:</p> <pre><code> &lt;div [ngClass]=&quot;boolean ? 'trueClass' : 'falseClass'&quot;&gt; Example Text&lt;/div&gt; </code></pre> <p>&quot;boolean&quot; is a variable and if ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Handle movement after collision is detected<p>I'm making a small platformer in js and I'm having trouble with the collisions. Unfortunately it seems that 90%...
<p>Your code seems to not check where the nearest face collides just that it is the nearest face after collision. Which could cause this kind of problem:</p> <p><a href="https://i.stack.imgur.com/R0nPU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/R0nPU.png" alt="Collision detected after wall" /></...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Returning to a previous choice in python<p>I’m working on a text adventure game for my first big self-made project in Python. I’m trying to figure out how to...
<p>Use while loop here.</p> <pre class="lang-py prettyprint-override"><code>answer_yes = [&quot;Yes&quot; ,&quot;Y&quot; ,&quot;yes&quot; ,&quot;y&quot; ] answer_no = [&quot;No&quot; ,&quot;N&quot;, &quot;no&quot;, &quot;n&quot;] answer_north = [&quot;North&quot;, &quot;N&quot;] answer_south = [&quot;South&quot;, &quot...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Lucene delete index, Java<p>I use Lucene library for search, and when I update info in objects which I search I need reindex this object. So I do following:<...
<p>This isn't working because your ID is an IntField, so it is encoded, not indexed as a simple term.</p> <p>Two good solutions here:</p> <ol> <li><p>Change your <code>idField</code> to a <a href="https://lucene.apache.org/core/6_0_0/core/org/apache/lucene/document/StringField.html" rel="nofollow"><code>StringField</...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Execution failed for task ':app:mergeDebugResources' , Unable to locate resourceFile in source-sets<p>Whenever I made any change to an XML file from the proj...
<p>I found by several testing that proguard rule is the issue for this error. Changing the proguard rules for debug solves the issue. Just need to set <code>shrinkResources false</code> in the debug buildTypes.</p> <pre><code> buildTypes { debug { minifyEnabled true shrinkResources false...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Matplotlib Plot X, Y Line Plot Multiple Columns Fixed X Axis<p>I'm trying to plot a df with the x axis forced to 12, 1, 2 for (Dec, Jan, Feb) and I cannot se...
<p>When you set <code>Month</code> as the x-axis then obviously it's going to plot it in numerical order (0, 1, 2, 3...), because a sequential series does not start with 12, then 1, then 2, ...</p> <p>The trick is to use the original index as x-axis, then label those ticks using the month number:</p> <pre class="lang-p...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Unable to see changes to a global variable from a different Python module<p>Consider the following Python application of two files, namely <code>app.py</code...
<p><strong>Solution</strong>: don't do that. Do not import the entry point Python script as a module. Create a separate small file which is never imported by anyone else and is intended to be run from the shell.</p> <p>When you run the app as <code>./app.py</code> Python actually loads your <code>app.py</code> as a mod...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: cascading drop downs repeatedly populated<p>I have a three level cascading drop down</p> <p>Customer > Project > Task</p> <p>When I pick a customer I just ...
<p>refreshProjectTaskFromProject() is called from with in the $.each. It needs to be outside of that loop.</p> <p>Edit: Oh, and you're missing a semi-colon after the append().</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: can a turtle only variable number be assigned to patches?<p>I'm trying to design a model for the spread of infection from person to environment. Turtles have...
<p>A patch can't ever refer to turtle variables directly: What if there is more than one turtle there...which one? What if there are none?</p> <p>However, a <em>turtle</em> can access the variables <em>of the patch it is standing on</em>. So you would probably do this from the turtle's point of view: I think this also ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Retrieving information from a Mask_RCNN Tensor<p>I've succesfully trained a <a href="https://github.com/matterport/Mask_RCNN" rel="nofollow noreferrer">Mask_...
<p>The following does it right:</p> <pre><code>masks = p['masks'] class_ids = p['class_ids'] rois = p['rois'] scores = p['scores'] bounding_box = rois[enumerator] </code></pre> <p>as for the outline coordinates:</p> <pre><code>def getBoundaryPositions(im): class_ids = p['class_ids'] # for usage convenience ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Find specific part of string based on condition<p>I have below comma separated string. This string contains relation which is needed in the application for p...
<p>You could parse the input string by splitting firstly on the comma, then again on the semi-colon to get the key-value pairs contained in it in dictionary form. For example:</p> <pre><code>string userInputColRela = "input1: Student_Name, input2: Student_Age"; var inputLookup = userInputColRela .Split(',') ....
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I export hive query result to google cloud storage bucket as a CSV from GCE<p>I have a query that writes the query result to a CSV file:</p> <pre><co...
<p>You can write the hive query to your instance then use the <code>gsutil</code> command to move it to your bucket.</p> <p><code>gsutil mv abc.csv gs://my-bucket/abc.csv</code></p> <p>If you do not have gsutil installed on your instance, follow the steps provided here: <a href="https://cloud.google.com/storage/docs/...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Splitting strings into substrings and getting an indicator in each their own column within a dataframe?<p>I have already asked this question once. It was mar...
<p>We can do this with <code>mtabulate</code> from <code>qdapTools</code></p> <pre><code>library(qdapTools) d1 &lt;- mtabulate(strsplit(df1$Q2, "\\s*,\\s*")) names(d1) &lt;- paste0(names(df1)[2], names(d1)) cbind(df1[1:2], d1, df1[3]) # Q1 Q2 Q2A Q2B Q2C Q2D Q2E Q3 #1 1 A, B ,C 1 1 1 0 0 S #2 2 C...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Async resource creation with OData<p>In REST API if I have a resource which creation could take considerable amount of time I could return a temporary resour...
<p>Asynchronous requests are (briefly) mentioned in the <a href="http://docs.oasis-open.org/odata/odata/v4.01/cs01/part1-protocol/odata-v4.01-cs01-part1-protocol.html#sec_AsynchronousRequests" rel="nofollow noreferrer">OData V4 specification</a>. It's probably worth reading for the fine details, but in short:</p> <p>A...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Newline In Email Using Paste Command<p>I am using paste command in the mail that I am sending using shell script. The output on the console looks perfect but...
<p>The problem is your use of the <code>echo</code> statement. <code>echo</code> will not preserve newlines in an unquoted string. For example, if I have a variable containing a newline:</p> <pre><code>my_variable="This is a test" </code></pre> <p>If I echo it without quotes, newlines will be transformed into space...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Flutter : Range error on accessing JSON Response<p>I am accessing a JSON response with the following structure.</p> <pre><code>{ &quot;fullName&quot;: &q...
<pre><code>Class GetCustomerData{ Future&lt;List&lt;CustomerDetails&gt;&gt; fetchData(queryStr) async { try{ var response = await http.get(Uri,parse(apiurl+queryStr); if(reponse.statusCode == 200){ return _parseResponse(response.body); }else{ print('someError'} } on TimeoutException catch ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Remove list element where any of the row sums in the element are less than a certain value (in R)<p>Apologies in advance for what I know is simple. I just ha...
<p>You can use <code>rowSums</code>. If we want to test whether there are any <code>rowSums</code> less than 8 in a given matrix <code>x</code>, we can do <code>any(rowSums(x) &lt; 8)</code>. Therefore the logical negation negation of this will return <code>TRUE</code> if none of the row sums are less than 8.</p> <p>We...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do i add rows according to pandas.Multindex?<p>I am working with a data frame looks like this</p> <pre><code> 0 1 2 3 4 one ...
<p>Try this:</p> <pre><code>idx = pd.MultiIndex.from_product(df.index.levels) df.reindex(idx) </code></pre> <p>Output:</p> <pre><code> 0 1 2 3 4 one x NaN NaN NaN NaN NaN y 8.0 0.0 9.0 11.0 5.0 z 12.0 18.0 7.0 1.0 18.0 three x 15.0 15.0 5.0 14.0 ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to transition to a new controller when clicking on UICollectionViewCell (programatically)<p>I have set up a ViewController with UICollectionViewCells, in...
<p>you have to use: </p> <pre><code>func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { if indexPath.row == 0 { let viewController = UIViewController() // or your custom view controller self.navigationController?.pushViewController(viewContro...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Javascript input value of search bar not updating<p>I've created a search bar on my site with the code below. For some reason the value is not updating when ...
<p>In your code, you changed the <code>searchVal</code> to a string, which does not refer to the input tag anymore, and thus would not have a value that you can set.<br /> To fix, simply assign a new variable when you perform the <code>toUpperCase()</code>.</p> <pre><code>const list = document.querySelector(&quot;.list...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Combination of a list of objects<p>I have a problem that I can't solve. I hope I can make you understand it.</p> <p>Given the following list of Waypoint obje...
<p>If implementing the algorithm is not part of the task, I would recomend a library like <a href="https://github.com/dpaukov/combinatoricslib3" rel="nofollow noreferrer">combinatoricslib3</a> which will generate the combinations for you.</p> <p>Using <code>combinatoricslib3</code> a simple example using Strings:</p> <...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Substitution variable && not working in SQLcl<p>The &quot;new&quot; tool Oracle SQLcl is not interpreting &quot;&amp;&amp;&quot; correctly. Is there an optio...
<p>It's a bug.</p> <p>You should log bugs to My Oracle Support, but I'll handle this one for you.</p> <p>SQLcl debuted in 2014. Not sure if that's &quot;new&quot; or new.</p> <p>Workaround: go download version 21.4 - I've confirmed it's working as expected there.</p> <p><a href="https://i.stack.imgur.com/0mHna.png" rel...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Spring Boot ThymeLeaf Not Loading HTML<p>I have a Java and Maven project in which I have the following controller (src/main/java/com/example/romannumerals/co...
<p>Replace @RestController with @Controller. @RestController will make the returned object the HTTP response body.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do i copy n characters for m lines in a file (in c)?<p>I have a file of 1000 lines with up to 70 characters in them. I want to copy the 13 first in a tab...
<p>The way you copy the substrings is broken:</p> <pre class="lang-c prettyprint-override"><code> while(fgets(str,line,pf)!= NULL) { printf(&quot;%s&quot;, str); number[line][size_num]=str[line]; // here i want number to copy the 13 first characters //o...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to efficiently use RecyclerView<p>I need to create an application that uses the recyclerView to show all the photos in the gallery.</p> <p>An immediate s...
<h2>Background</h2> <p>Well, there are two things:</p> <ol> <li><p><code>RecyclerView</code>: This is a general idea that only loads views for as many viewable on the screen, plus a bit more to buffer ahead of time just in case the user scrolls there.</p> <p>Think of it like how video players buffer a minute worth of v...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Save command output at filename<p>I've got this problem, where I want to save an output of a command as a filename and stream output from a different command...
<p>You're doing too much work. Just output to the desired file in the first awk command:</p> <pre><code>zgrep --no-filename 'some-patter\|other-pattern' /var/something/something/$1/* | awk -F '\t' '{printf $27 &gt; $8}' </code></pre> <p>See <a href="https://www.gnu.org/software/gawk/manual/html_node/Redirection.htm...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Swift: Encryption of a file or plain text<p>Hello i'm about to write an app that enables me to store remote files on iPhone's local disk to make the data per...
<blockquote> <p>So if any iPhone hacker crack the prone with jailbreak and access my local file?</p> </blockquote> <p>Yes. This is true, and there is nothing effective you can do about. You can create some layers of obfuscation. You can slow down attackers by a few hours. With sufficient resources and an ongoing tea...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Search Map & Print Vector<p>I have an STL map that maps a key to a vector of deliverables. I would like to search the map for a certain key and print out all...
<p>The issue is with the code you are not showing:</p> <pre><code>Deliverables::print() </code></pre> <p>It is not <code>const</code>, so you cannot use it. Declare the print function as const, and then you can use a <code>const Deliverables&amp;</code>:</p> <pre><code>Deliverables::print() const </code></pre> <p>T...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python: GUI based "reverse entry" using recursion failing<p>I am trying to make a Python program that asks the user for a number then reverses it using recur...
<p>Your recursive function is perfectly fine but there are several other problems in your code.</p> <p>The main one is that the <code>command</code> parameter of <code>Button</code> must be the function that will be called when the user presses on the buttton. In your code, <code>command</code> is set to the return va...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: dict.get() for each incidence in a multidimensional dict with python<pre><code>d=[{'a':{'b':[]}},{'a':{'b':{'c':[]}}},{'a':{'b':{'c':[],'d':[],'e':[]}}}] </c...
<p>You can try to get the key and handle any exceptions:</p> <pre><code>d = [{'a':{'b':[]}},{'a':{'b':{'c':[]}}},{'a':{'b':{'c':[],'d':[],'e':[]}}}] for i in d: try: print(i['a']['b']['c']) except (KeyError, TypeError): pass </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: where are questions for a Microsoft Azure QnA bot stored?<p>I run a QnA bot (Animal-Rights-Bot) that answers questions via skype or email but there is a disc...
<p>You get all the chatlogs from QnAMaker in the test tab on the portal. There is a download chat logs link.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: AngularJS track by not removing $$hashKey, causing duplicate manipulation<p>I am currently adding "rows" to the DOM via ng-repeat. (AngularJS 1.5)</p> <p>I ...
<p>I've found my problem. Turns out that i was <code>pushing</code> a new row to my <code>$scope.panelRows</code>, but the object i was pushing was an object already parsed by angularjs, with its own $$hashKey.</p> <p>Therefor, angularjs thought he was pushing the same object many times. </p> <p>Before: <code>$scope....
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: JQuery show images with id based on click<p>I'm pretty new at JQuery so my knowledge of syntax and functions may need some in depth explaining. Please be pat...
<p>Replace all your jQ code with following 5 lines of code and try adding new color in html with current naming convention,it should work :)</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-ov...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: AJAX error: "No multipart boundary param in Content-Type"<p>I am trying to upload a file from localhost to a server but I am getting the following error in m...
<p>If you set <code>contentType: false</code> jQuery will automatically apply the correct Content-Type header for sending multipart data. Your inclusion of a <code>header</code> object explicitly specifying the content type is breaking this behaviour. It needs to be removed. Change your AJAX request settings to this:</...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Selecting rows where phrase is in different columns<p>I've tried finding an answer to this, but I've had no luck.</p> <p>I want to select all rows that cont...
<pre><code>SELECT * FROM catalog WHERE name LIKE '%$search%' OR brand LIKE '%$search%' OR model LIKE '%$search%' OR category LIKE '%$search%' OR subcategory LIKE '%$search%' OR stock LIKE '%$search%' OR year LIKE '%$search%' </code></pre> <p>You just need an OR condition so that as long as at least one ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Creating Directed edges javafx<p>Currently, I have a working implementation of an undirected graph where vertices are represented as StackPanes and edges are...
<p>To start with, lets discuss your requirement in terms of vectors. </p> <ul> <li>You have a line (joining the centers of two circles). </li> <li>You want to place a node(arrow) at partical point on a line.</li> <li>And this point is always located at a distance of (totalLineLength - circleRadius) for end arrow and ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Override nav from master page using css<p>I put this block in a child ascx:</p> <pre><code>&lt;style&gt; #HelloStyle { width: 0px !important; } &lt;/sty...
<p>Change #HelloStyle to .HelloStyle </p> <p>You are referencing it by # which is the ID, while you are setting the class only, which should be referenced by the "."</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Using Observable.interval to wait for remote data or timeout<p>I need to wait for a condition or timeout. I came up with the following approach, but there ar...
<p>Here is code. You can use <code>firstElement</code> to get the first item.</p> <pre><code>import io.reactivex.Observable; import io.reactivex.schedulers.Schedulers; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeUnit; public class Q44234633 { public static void main(String[] args...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Flatpak run external programs<p>I am using a flatpak version of my favorite game engine, godot. Using it, I need to be able to export to android. To do this,...
<p>This is a <a href="https://github.com/flathub/org.godotengine.Godot/issues/15" rel="nofollow noreferrer">know issue</a>. Snap package has issues too. The best option is to use the official executable from the website. If want auto updates you can use Steam or Itch.io</p>