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: Insert characters into string in different locations<p>I have a string which looks like this <code>20141007023617</code>. And I would like to make it look li...
<p>Please try, Record Macro and: </p> <pre><code>=LEFT(A1,4)&amp;"-"&amp;MID(A1,5,2)&amp;"-"&amp;MID(A1,7,2)&amp;"T"&amp;MID(A1,9,2)&amp;":"&amp;MID(A1,11,2)&amp;":"&amp;MID(A1,13,2)&amp;"Z" </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Triggered Web Job Powershell Deployment script<p><strong>I have a powershell script to deploy continues webjob. as shown below</strong></p> <pre><code>`$Hea...
<p>To deploy triggered webjobs, just change the <code>$apiUrl1</code> in your script like below.</p> <pre><code>$apiUrl1 = "https://$webAppName.scm.azurewebsites.net/api/triggeredwebjobs/MyWebJob" </code></pre> <p>Reference - <a href="https://github.com/projectkudu/kudu/wiki/WebJobs-API#upload-a-triggered-job-as-zip...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: define a function in the GraphQL Resolvers file<p>I want to define a function in the same ts file where I define the resolvers</p> <pre><code>export const r...
<p>This is because your function declaration is not valid. You could try it like this:</p> <pre><code>private export function someName(id: string): boolean { return true; } </code></pre> <p>but then you will get another error:</p> <pre><code>'private' modifier cannot appear on a module or namespace element. </c...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Compilation of firefox extension with xulrunner-sdk-36.0 C++<p>I have a FF toolbar working in all previous versions. My toolbar partially written in C++. I'v...
<p><code>_MSC_VER 1800</code> is Visual Studio 2013 and <code>1600</code> is Visual Studio 2010. Both compilers are not compatible to each other in C++ mode, so you'll need to recompile either your project or the SDK so that compilers match.</p> <p><code>1800</code> says to me that the xulrunner SDK was build using VS...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ListView in android for dynamic data<p>how to refresh List View dynamic data content in android? I tried loading dynamic data for the List View in android ap...
<p>Call notifyDataSetChanged() on your Adapter object once you've modified the data in that adapter. Some additional specifics on how/when to call notifyDataSetChanged() can be viewed in this Google I/O video.</p> <p>Or else Look at this link.it may helpful. <a href="https://stackoverflow.com/questions/1917773/dynamic...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Dijkstra's Algorithms and Negative Weights and Cycle<p>I study on Greedy Algorithm. summarize some important aspects about Dijkstra's Algorithms, that will b...
<p><a href="http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm" rel="nofollow">Dijkstra's algorithm</a> only works on graphs with non-negative edges. This is because it assumes that the first time a node is popped off the queue we have found the shortest path to that node and this is not necessarily true as soon as y...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Calling copy constructor on yourself<p>I am curious about what is happening in this code I wrote almost by mistake:</p> <pre><code>#include &lt;iostream&gt;...
<p>Since you have a member variable of type <code>int</code>, whose indeterminate value is copied to itself, the code is technically Undefined Behavior.</p> <p>However, in practice, with current computers nothing bad will happen. But on the third hand, nothing good happens either.</p> <p>Regarding warnings, that's a ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Get all keys that appear on multiple redis sorted sets<p>I have multiple sorted sets on redis that contain a user ID and a score. Is there any way I can filt...
<p>In set theory, it's called intersection. Redis has a <a href="http://redis.io/commands/zinterstore" rel="nofollow">ZINTERSTORE</a> command that intersects the keys of multiple sorted sets and stores them into a new key.</p> <pre><code>ZINTERSTORE LIST-Z 4 A B C D ZRANGE LIST-Z 0 -1 WITHSCORES </code></pre> <p>This...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Run a function between two inputs in the console<p>I have a Script that works well, but I would like to add an implementation to it. In first place, I am usi...
<blockquote> <p>… the script runs the functions between the two inputs in the console, but just once. … I would like it to be running in a loop that starts with an input console and stops with another input console.</p> </blockquote> <p>You could use a <code>KeyboardInterrupt</code> exception to break a loop:</p> <...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Return an array of all the DOM elements, sorted by depth<p>In Javascript How do you create an Array of all the elements in the DOM, ordered by their depth, s...
<p>Ok, I figured it out myself, it was pretty simple in the end.</p> <pre><code> // Every Element in the DOM. var allElements = document.getElementsByTagName('*'), // All the Element's children sorted by depth, // ie. body, then body's children, grandchildren, // so on and so forth. sortedByDept...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: why are the routes undefined<p>Trying to run any (and all) of the React-Router examples <a href="https://github.com/rackt/react-router/tree/master/examples" ...
<p>See <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#Object_destructuring" rel="nofollow">Object Destructuring</a></p> <p><code>var { Route, RouteHandler, Link } = Router;</code> essentially mean:</p> <pre><code>var Route = Router.Route; var RouteHandler...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I create a zero-length file using the Ubuntu terminal?<p>I'm using Ubuntu for the first time and I have to create a directory and then create a zero-l...
<pre><code> mkdir directory_name cd directory_name touch file_name_to_create ls -l file_name_to_create </code></pre> <p>If the file already exists, then <code>touch</code> will <em>not</em> change its length to zero. But if the file does not exist, then it will be created with zero length.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Regex to capture 2 consecutive digits, but don't capture if 3 or more<p>For example. If I have <code>1234X03.04</code></p> <p>I want to capture the <code>0...
<p>You can use:</p> <pre><code>(?&lt;!\d)\d{2}(?!\d) </code></pre> <ul> <li><code>(?&lt;!\d)</code> - prior char is not a digit</li> <li><code>\d{2}</code> - exactly two consecutive digits</li> <li><code>(?!\d)</code> - next char is not a digit</li> </ul> <p>Here's a <a href="https://regex101.com/r/c2OWte/1" rel="no...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I separate the array value in php because my checkbox field contains different values?<p>I have created the checkbox as an array. Now I want to separa...
<p>It seems you are checking the value of <code>$v</code> outside the <code>foreach</code> loop, which does not make sense -- <code>$v</code> is just <em>one</em> of the possibly many values in the array, so you can't use it to draw conclusions safely.</p> <p>You could test with <a href="http://php.net/manual/en/funct...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: CardListView filter<p>I'm using CardListView from <a href="https://github.com/gabrielemariotti/cardslib" rel="nofollow">https://github.com/gabrielemariotti/c...
<p>As I can see in the source code, the library doesn't have an implementation for custom filters so first of all you must implement a custom filter similar to this one:</p> <pre><code>Filter cardFilter = new Filter() { @Override protected FilterResults performFiltering(CharSequence constraint) { Filte...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Defining a flexible structure in Prolog<p>Well, I'm a bit new to Prolog, so my question is on Prolog pattern/logic.</p> <p>I have an relationship called tab...
<p>Since the number of attributes is not fixed and needs to be so flexible, consider to represent these items as in option lists, like this:</p> <pre><code>tablet([name=tablet1, operating_system=ios, ram_capacity=1024, screen=screen([type="IPS", resolution = res(1024,2048...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Create view with multiple tables and one junction table<p>I have the following table schemas:-</p> <pre><code>table1: id1(primary key) col1 table2: id2(pk)...
<p>Try this way, using <code>LEFT JOIN</code>:</p> <pre><code>SELECT T1.Col1,T2.Col2,T3.Col3,J.Juncfield FROM junctable J LEFT JOIN Table1 T1 ON J.id1=T1.id1 LEFT JOIN Table2 T2 ON J.id2=T2.id2 LEFT JOIN Table3 T3 ON J.id3=T3.id3 </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to get current signal handler on iOS?<p>Hi i need to get current signal handler that was set with this method:</p> <pre><code>signal(SIGSEGV, handler); ...
<p>Unfortunately, the C standard does not foresee reading the current value of the handler.</p> <p>But fortunately <a href="https://developer.apple.com/library/ios/documentation/System/Conceptual/ManPages_iPhoneOS/man3/signal.3.html" rel="nofollow noreferrer">signal()</a> returns the previous value when you change the ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Instagram post's caption is not showing properly<p>I am trying to get instagram profile's post with captions, everything is working fine except captions. It ...
<p>The value of the <code>edge_media_to_caption</code> property is an object like this:</p> <pre><code>{ "edges": [{ "node": { "text": "Still alive" } }] } </code></pre> <p>You need to loop over the edges and get the <code>node.text</code> properties.</p> <p><div class="snippet" d...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Software SPI Implementation<p>I'm thinking about creating my own pure-C software SPI library because there are none available (as far as I can tell).</p> <p...
<blockquote> <p>why aren't there any software SPI libraries?</p> </blockquote> <p>Because it's about 10 lines of code each for the WriteByte and ReadByte functions, and most of that is bit banging processor-specific registers. The higher level protocol depends on the device connected to the SPI. Here's <a href="http...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Navigation Issue in Xamarin Forms<p>I need to route pages A -> B -> C -> D, once I got into D, I need to use the navigation button back to page D -> A. I am ...
<p>Your case use the <code>Navigation.PopToRootAsync ();</code></p> <p><code>Navigation.PopToRootAsync ();</code> This method pops all but the <code>RootPage</code> off the navigation stack, therefore making the root page of the application the active page.</p> <p><code>Navigation.PopAsync ();</code> This causes the ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Split string Swift without introducing Newlines<p>In Swift, when you want to separate a string in multiple lines, because is too long, you can do this:</p> ...
<p>End a line with a backslash to suppress the subsequent newline. Like this:</p> <pre><code>let string = """ A \ B \ C \ D \ E """ </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to ping all local IP of a router(192.168.1.1) by using static IP (10...) in Ethernet connection<p>I want to find all local IP of a wifi router (192.168.1...
<p>You could try something like this:</p> <pre><code>#!/bin/bash for I in {1..255} do ping -c 1 192.168.1.$I done </code></pre> <p>... which literally pings all IPs from 192.168.1.1 to 192.168.1.255.</p> <p>But you are probably going to get more useful results faster if you use <code>nmap</code>. Read this artic...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Angular Parent/Child Directive's order of execution<p>As per the angulars documentation, Post link function for "Parent" will be executed only once post link...
<p>This comes about differently, and you can run a simple test in <a href="http://plnkr.co/edit/fRK25cGA9LXU9o7nB7QF?p=preview" rel="noreferrer">plnkr</a>. Here is the <a href="https://docs.angularjs.org/api/ng/service/$compile" rel="noreferrer">api reference</a></p> <p>In a directive you have a <code>compile</code> f...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to create a SQL injection attack with Shift-JIS and CP932?<p>I'm writing some unit tests to ensure my code isn't vulnerable to SQL injection under variou...
<p>The devil is in the details ... let's start with how <a href="https://stackoverflow.com/a/12118602/468027">answer in question</a> describes the list of vulnerable character sets:</p> <blockquote> <p>For this attack to work, we need the encoding that the server's expecting on the connection both to encode <code>'<...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to pass parameters in behave/python<p>I wonder how to pass True or False arguments such like. (<code>config_type = True</code>) using behave in python la...
<p>I think you are close, but need to pass the config_type parm through to someMethod:</p> <pre><code>Scenario Outline: Given upload xls with parameters "shop" xlsx (path: "./upload12.xlsx") definition named "config_short" and "&lt;config_type&gt;" Examples: | config_type| | False | @given('upload xl...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: NSControl isEnabled only available in OS X v10.0 through OS X v10.9<p>Does anybody know why NSControl's isEnabled has been removed while setEnabled: is still...
<p>In OS X 10.10 (and iOS 8), many of the getter/setter method pairs in Apple's frameworks were replaced by <code>@property</code> declarations. This both makes the header interface clearer and makes the import of those APIs into Swift more... well, Swifty.</p> <pre><code>// Before - (BOOL)isEnabled; - (void)setEnable...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to get hyperlinks placed inside of shapes in .docx file using office interop word<p>I’m looking for a way to programmatically replace hyperlinks from ins...
<p>I did a small example which retrieves hyperLinks from shapes within a word file. I am working with Word 2010. You cannot access a text hyperlink from within a shape by <code>Shape.Hyperlink</code> as this will get you</p> <blockquote> <p>Returns a Hyperlink object that represents the hyperlink associated with t...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Reduce and sum array of objects (JS)<p><strong>My data</strong>:</p> <pre><code>arr: [], models: [ { id: 1, name: "samsung", seller_id: 1, count: 56 }, ...
<p>You can use <code>Array.reduce()</code>:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var models = [ { id: 1, name: "samsung", seller_id: 1, count: 56 }, { id: 1...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Use case expression with temp table in where clause?<p><code>StatusId</code> is a comma separated string. If <code>StatusId</code> is '0' then all rows shoul...
<p>You may need to <code>WHERE</code> clause like this</p> <pre><code>WHERE @StatusId = '0' OR EXISTS (SELECT 1 FROM #TempStatusVal WHERE TD.StatusId = StatusId) </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Angular: history.state.data returns undefined instead of the last set data object?<p>I have a table of orders..each table row represents an order entity and ...
<p>Upon some research, I found that <strong>state doesnt work on non-anchor elements</strong>.</p> <p>To solve the issue, On routing programatically we can use state:</p> <p><strong>orders.html</strong></p> <pre><code>&lt;tr *ngFor=&quot;let order of allOrders&quot; (click)=&quot;onNavToOrderDetails(order)&quot;&gt; ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to get rid of goto and flip in the following program<p>How to get rid of <code>goto</code> statement in this program and end the <code>flip:&gt;&gt;&gt;<...
<p>You can refer the below code.</p> <p>Before entering the loop.</p> <pre><code>cout &lt;&lt; "\n\t\t------------------------------------------------" &lt;&lt; endl; cout &lt;&lt; "\t\tlllllllll Menue lllllllllll" &lt;&lt; endl; cout &lt;&lt; "\t\tlllllllll 1. Array Basics lllllllllll...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to work with leading zeros in integers<p>What is the proper way to deal with leading zeros in Ruby?</p> <pre><code>0112.to_s =&gt; "74" 0112.to_i =&gt...
<p>A numeric literal that starts with <code>0</code> is an octal representation, except the literals that start with <code>0x</code> which represent hexadecimal numbers or <code>0b</code> which represent binary numbers.</p> <pre><code>1 * 8**2 + 1 * 8**1 + 2 * 8**0 == 74 </code></pre> <p>To convert it to <code>0112</...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Access results from php/mysql query<p>I have a simple command in php to test whether or not data exists in my mySQL database:</p> <pre><code>$query = "...
<p>You can access elements of an object using the following syntax:</p> <pre><code>echo $crossSupplierResult-&gt;{'num_rows'}; </code></pre> <p>put curly braces around the element, (in this case, <code>num_rows</code>)</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: sql server get concatenated values of two diferrent column data types<p>Need your expert help in building sql query for concatenated values of two different ...
<pre><code>select (CAST(LOCKER.AGRMNT_DATE AS VARCHAR) + cast(LOCKERREG.AGRMNT_MTHS as varchar)) as AGRMNT_DUE_DATE from tableName </code></pre> <p>Simple test:</p> <pre><code>DECLARE @testDate DATE = GETDATE(); DECLARE @testInt INT = 1; SELECT CAST(@testDate AS VARCHAR) + CAST(@testInt AS VARCHAR); </code></pre> <p...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Using Pyro4 to connect python scripts in separate containers using docker-compose<h1>The Problem</h1> <p>I want to use Pyro4 for remote procedure calls acro...
<p>After some help from the balena forums, I was able to successfully get my Pyro example to run. </p> <p>Following are my updated and working files for reference.</p> <h2>---</h2> <p><strong>docker-compose.yml</strong></p> <pre><code>version: '2' services: pyro-ns: privileged: true restart: alw...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Swift - Attribute string background color on next line<p>I have a label where I wish to show some words on line 1 and some words on line 2. I was able to ach...
<p><strong>Simple solution: - Just add /n in the line one string - it will solve the issue</strong></p> <pre><code>let attributedString = NSMutableAttributedString(string: "Line 1 Text\n" ?? "") let attributesForNonSelectedRow = [NSAttributedString.Key.font:UIFont.systemFont(ofSize: 14, weight: UIFont.Weight.semibold)...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: mysql md5 select not returning record<p>I have a table with passwords that are hashed with MD5. When I do a select, no records are returned.</p> <pre><code>...
<p>Have you checked the capitalization? The output from the MD5() function is always lower-case. Also, the capitalization of the password before being hashed is also important; "abc" and "ABC" produce completely different MD5 hashes.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Java ArrayIndexOutOfBoundsException When Trying to Test<p>I seem to be getting an error with my deck of cards project. I'm trying to print out a shuffled dec...
<p>In order to create a Deck of 52 cards you need :</p> <pre><code>deck = new PlayingCard[52]; </code></pre> <p>In addition, it makes little sense for your loop to always assign a card to the 51st position :</p> <pre><code>deck[51] = new PlayingCard(rank, suit); </code></pre> <p>This would make more sense :</p> <pre><c...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to access an object within another class (Java)<p>Here's an abrevated version of what my code looks like: </p> <pre><code>public class ColorFactory exte...
<p>You are facing a design issue; in general, this type of situations require more investigation to understand how to end up with a clean and maintainable design. However, For the specific problem you are reporting, I would:</p> <ol> <li>Create a constructor of <code>ButtonListener</code> that receives a parameter (i....
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Best average rating<p>I have created a simple rating system for news articles. The news articles are stored in the database table called 'articles'. Each art...
<p>MySQL has an <a href="https://dev.mysql.com/doc/refman/8.0/en/group-by-functions.html#function_avg" rel="nofollow noreferrer"><code>avg</code></a> function you can use instead of implementing this logic yourself. From there, it's just a matter of grouping by the article ID and ordering by the average:</p> <pre clas...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Google Datastore overusing entity "kinds"<p>Is it possible to overuse entity "kinds" (say there are 100, 000 for a given namespace) ?</p> <p>Example scenari...
<p>If I understand you correctly, you want to have each user's email as a kind, then have each entity be a post linked to that email. </p> <p>While the system would not stop you from doing that (there is no limit, as far as I know, to the number of kinds you can create), this is DEFINITELY not following best practice...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Split python list into rows without libraries<p>I have a list of letters in Python that I would like to split into even-length chunks that will display as ro...
<p>I would define a new function that prints the chunks line by line.</p> <pre><code>def print_chunks(chunk_result): for chunk in chunks: print(chunk) </code></pre> <p>I believe this will give you the output you're looking for.</p> <p>To get slicing behaviour, you will want to implement your own class. I...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Remove duplicates based on a specific key<p>Got a multidimensional array like this one:</p> <pre><code>$A = array( [0]=&gt; array( ["rel"]=&gt; 4 ...
<p>This function should do the job:</p> <pre><code>function array_key_unique($arr, $key) { $uniquekeys = array(); $output = array(); foreach ($arr as $item) { if (!in_array($item[$key], $uniquekeys)) { $uniquekeys[] = $item[$key]; $output[] = $item; } } ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is 904 Transaction Ended Response for HTTP Request<p>I have a AngularJS web application. My server runs with Java/Spring. I have a login page in UI that...
<p>This happened because I did a clickAndWait on a button of AngularJS. Since it is an ajax request, selenium did not really wait for the response and hence transaction ended. I updated my script to wait for no network traffic after click. </p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: select and click option with jquery<p>hi guys i have one select and many options and many frag .. ineed chose one option and in body 2 frag goes display : no...
<ol> <li>Add onchange event on select</li> <li>Compare class name and hide</li> </ol> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>$("select").on("change", function(){ if($(t...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Swift NSPredicate throwing EXC_BAD_ACCESS(Code=1, address=0x1) when compounding statements<p>I am trying to use NSPredicate in Swift to query Core Data but i...
<p>The <code>%@</code> placeholder in predicate format strings is for Objective-C objects, so you have to wrap the integer into an <code>NSNumber</code>:</p> <pre><code>fetchRequest.predicate = NSPredicate(format: "level = %@", NSNumber(integer: level)) </code></pre> <p>or use <code>ld</code> instead to format a (lon...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I keep the checkbox checked after I submit a form using PHP?<p>I'm trying to get a value from post array then store it in a variable then use the val...
<pre><code>&lt;input type='checkbox' name='$post_Value' value='post_valuebValue' checked='checked'&gt;$post_valuebValue&lt;/input&gt; </code></pre> <p>I would do something like this please forgive any syntax errors in doing this on my phone</p> <pre><code>&lt;input type='checkbox' name='$post_Value' value='pos...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to validate email address in c# console application?<p>I Build some simple code to fill the field like a forms. I put email input and i want to validate ...
<pre><code>using System; using System.Collections.Generic; class Demo { static void Main() { string val; bool validEmail = false; Console.Write("Enter Email: "); val = Console.ReadLine(); int stringSplitCount = val.Split('@').Length; if(stringSplitCount &gt; 1 &amp;&amp; stri...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Laravel not loading view. Error in a storage\framework\view file<p>I'm unable to access my orders_index view from my OrdersController. </p> <p><strong>order...
<p>It should be <code>@extends('app')</code> not <code>@extends 'app'</code>. For Laravel what you did now was like writing: <code>@extends() 'app'</code> So it tries to call the function <code>make</code> with an empty first parameter (because you didn't pass anything to <code>@extends</code>) and hence you get that s...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: NoClassDefFoundError for my own class when creating CallSite with LambdaMetafactory<p>I’m trying to create a small utility to replace my use of reflection ac...
<p>You are using a <code>Lookup</code> object representing the declaring class of the <code>Method</code> object. Therefore, when the target method is <code>Object.class.getDeclaredMethod("toString")</code>, you are creating a lookup object for <code>java.lang.Object</code>, which is loaded by the bootstrap loader.</p>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Meteor template Blaze how to return only first element of array<p>For example I have an array: var arr = ['a', 'b'] and want to get only first element in tem...
<p>Use <code>{{arr.[0]}}</code>. And this is now at least 30 characters. </p> <p><a href="https://github.com/meteor/meteor/blob/devel/packages/spacebars/README.md#identifiers-and-paths">https://github.com/meteor/meteor/blob/devel/packages/spacebars/README.md#identifiers-and-paths</a></p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to mock up a class for several tests in Django<p>I have a class that calls a remote service through HTTP. Right now, this class detects if it is running ...
<p>If you need to do patch for all the tests you can do this in <code>setUpClass</code> method:</p> <pre><code>class RemoteServiceTest(unittest.TestCase): @classmethod def setUpClass(cls): cls.patchers = [] patcher = patch('application.PushService.trigger_event') cls.patchers.append(pa...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Find incremental x amount of numbers in range<p>I don't even know how to explain this... I've been looking for algos but no luck.</p> <p>I need a function t...
<p>How about an exponential curve? Sample Python implementation:</p> <pre><code>begin = 1 end = 1000 diff = end - begin length = 10 X = diff**(1.0/(length-1)) seq = [] for i in range(length): seq.append(int(begin+X**i)) print seq </code></pre> <p>(note: <code>**</code> is the Python operator for exponentiation. O...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is it possible to use media_sideload_image to upload local files in WordPress?<p>I want to add <code>media_sideload_image</code> to upload a file programmati...
<p>Sideloads are used when the media is on another server... you just want a plain upload Try using <a href="http://codex.wordpress.org/Function_Reference/media_handle_upload" rel="nofollow">media_handle_upload()</a></p> <p>Hope that helps</p> <p>Regards</p> <p>Dan</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is the diff between RegDeleteKeyValue and RegDeleteValue?<p>I want to know what is the different between RegDeleteKeyValue and RegDeleteValue in Win32AP...
<p>RegDeleteValue() is the legacy function, it has been around for 22 years. RegDeleteKeyValue() was an <em>addition</em>, first available on Vista. Major version 6, you must set the _WIN32_WINNT macro to 0x600 or higher to be able to use it. Won't work on Windows XP, Server 2003 or earlier.</p> <p>Version 6 altere...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: cgo : Undefined symbols for architecture x86_64<p>I would like to call the go func from the C function space, but the program throws the build error.</p> <p...
<p>Duplicate symbols are generated because I have included the <code>test.c</code> directly to the go file. So the symbols are included twice.</p> <p>I think, the correct way of writing this code is (please comment if I am wrong) to:</p> <ol> <li><p>Define the header file (test.h):</p> <pre><code> #ifndef TEST_H_ #def...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Google Plus SDK delete account and revokeAccessAndDisconnect<p><a href="https://developers.google.com/+/mobile/android/sign-in#revoking_access_tokens_and_dis...
<p>Yes, the sentence (and almost whole SDK documentation for Google+ integration) is a little confusing. But I think it is supposed to mean that you have to provide a way to the user to disconnect their Google+ account from your app. As far as the "delete" part is concerned, you cannot keep the user data if the user de...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to respond to a QUERY intent for devices with a genuinely unknown state (willReportState = false, commandOnly... = true insufficient)?<h3>Problem</h3> <...
<p>We've now been published / certified. Unfortunately this process contradicted some of what Nick's suggested. I suspect Nick's answer is the best one for an implementation, but in order to be certified here's what we had to do...</p> <ol> <li><p>Every single device MUST be marked as <code>willReportState=true</code>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Converting Backbone model to JSON set default values<p>This is my Backbone model code where I set the default values.</p> <pre><code>App.Models.Stock = Back...
<p>You need to put your <code>stock.toJSON()</code> into a callback of <code>fetch</code>. <code>Fetch</code> is asynchronous, so the values from your server are not loaded until after you call <code>stock.toJSON()</code>. At that point, the defaults are still set on <code>stock</code> rather than the values you loade...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can Go (CI server) send mail for each failed build regardless of pipeline?<p>I'm using <a href="http://www.thoughtworks.com/products/go-continuous-delivery/"...
<p>Post Go <a href="http://www.go.cd/releases/#14.3" rel="nofollow noreferrer">14.3</a> you can add notifications for all pipelines and all stages at once. You would need to select the option similar to the one shown in the image below:</p> <p><img src="https://i.stack.imgur.com/BMLpO.png" alt="set notification for an...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to delete node in javascript without where parent node is null<p>I creating couple of <code>Image</code> classes in my javascript code (as I understand -...
<p>If the parent node is null then the element is <em>not</em> in the DOM and does not need to be removed from the DOM - and removing an image node from the DOM will not affect it loading.</p> <p>Simply:</p> <ol> <li><p>Set the <code>Image.src</code> to something else such as an empty string (this is the best that ca...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to format plotly title in python as bold when the title is a variable?<p>I know how to format the title as bold if the title is entered as a string using...
<p>For sake of completeness, I am adding @SyntaxVoid comment as the working solution/answer. This works:</p> <pre><code>title = 'Bold' layout = go.Layout(title='&lt;b&gt;'+title+'&lt;/b&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 fetch the list of errors for invalid objects in Oracle 10g<p>Explanation: I have more than 200 invalid objects in my DB, the reasons could be couple o...
<p>You could query <strong>[DBA/ALL/USER]_ERRORS</strong>. It describes current errors on all stored objects (views, procedures, functions, packages, and package bodies) owned by the current user.</p> <p>Chose which view to query, depending on the privileges you have:</p> <blockquote> <ul> <li><strong>DBA_</stron...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Flutter app can't run on real device or emulator<p>I am new at Flutter. I am getting trouble with running flutter project. <br></p> <p><strong>Problem:</str...
<p>try to re install the SDK of flutter. i have faced the same problem as well. then i re-installed the flutter SDK and everything went perfect.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Error loading a new image into a jlabel while I move<p>What I want is that press the " A", " S ", "D " and " W " the character move in their respective direc...
<p>The <code>setIcon(...)</code> method will invoke:</p> <pre><code>revalidate(); repant(); </code></pre> <p>on the label which causes the layout manager to be invoked. So I would guess you need to use:</p> <pre><code>panel.setLayout( null ); </code></pre> <p>to prevent the size/location of the label from being rec...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Confusion between array and pointer variable<p>we have </p> <pre><code>int a[2] = { 0, 1 } ; std::cout &lt;&lt; &amp;a ; std::cout &lt;&lt; a ; </code></p...
<p>First, regarding</p> <blockquote> <p><strong>&rdquo;</strong> <code>a</code> itself returns a pointer</p> </blockquote> <p>No, the decay of array to pointer only happens in contexts where a pointer is expected. For example, it doesn't happen in a <code>sizeof</code> or <code>decltype</code> or <code>typeid</code...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to grab Category + children in my ForEach Loop<p><a href="https://i.stack.imgur.com/hGi1n.png" rel="nofollow noreferrer"><strong>Modal Bootstrap filter b...
<p>You have a few issues with your query and loop. Try this:</p> <pre><code>&lt;?php $categories = get_terms( array( 'taxonomy' =&gt; 'category', // set the taxonomy 'orderby' =&gt; 'ID', // orderby cat ID 'parent' =&gt; 216 // set parent ID to get child cats ) ); foreach($c...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Firebase Realtime Rules - Give access when some child contains value x?<p>I have been trying to get this rule to work for some time now and I just don't seem...
<p>I don't think you can use such a wildcard.</p> <p>One solution would be to manually look "everywhere", like this:</p> <pre><code>"auth.uid == data.child('0/playerId').val() || auth.uid == data.child('1/playerId').val() || auth.uid == data.child('2/playerId').val()" // up to max allowed players </code></pre> <p>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: OpenCV very slow - webcam<p>I'm using OpenCV to send camera bytes via UDP to another computer.</p> <p>The problem is, that the framerate of the camera is on...
<p>While 30 FPS might be a theoretical maximum for your camera, it might be reachable on a sunny day, outside. I have a sneaking suspicion that the sub-par acquisition frequency might be caused by insufficient lighting. It just needs more time to catch enough photons to produce image of desired quality. I'm not sure wh...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Delphi 2010 - EDirectoryNotFoundException when trying to save logs<p>I'm developing a program in Delphi 2010 that has to save the logs that are stored in a T...
<p>The exception is raised by the call to <code>AppendAllText</code>. If you follow the source for that function you will find a call to <code>InternalCheckFilePathParam</code>, the implementation of which looks like this:</p> <pre><code>class procedure TFile.InternalCheckFilePathParam(const Path: string; const Fi...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: using t.test with apply on some columns of a data frame<p>I am trying to calculate a p-value for some specific columns in a data frame.</p> <pre><code>df &l...
<p>You could try</p> <pre><code> apply(df[-1], 1, function(x) t.test(x[1:3], x[4:6])$p.value) </code></pre> <p>The first column is character/factor. When you do <code>apply</code>, it converts to <code>matrix</code> and the values will be converted to 'character' as 'matrix' can hold only one class.</p> <p>For exam...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I listen to TPL TaskStarted/TaskCompleted ETW events<p>I am interested in listening to ETW (event tracing for Windows) TPL events, in particular I'd l...
<p>Your question challanged me to look into ETW (which I've been wanting to look into for a while). I was able to capture <em>"task start"</em> and <em>"task end"</em> using <a href="https://www.nuget.org/packages/Microsoft.Diagnostics.Tracing.TraceEvent" rel="nofollow">Microsoft.Diagnostics.Tracing.TraceEvent NuGet li...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Looping through a pandas DataFrame accessing previous elements<p>I have two DataFrames, <code>FirstColumn</code> &amp; <code>SecondColumn</code>.</p> <p>How...
<p>You can do:</p> <pre class="lang-py prettyprint-override"><code>df["corr"]=df.rolling(5, min_periods=1).corr()["FirstColumn"].loc[(slice(None), "SecondColumn")] </code></pre> <p>Outputs:</p> <pre class="lang-py prettyprint-override"><code> FirstColumn SecondColumn corr 0 2.0 1.0 ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ASP.NET MVC Query to ViewModel<p>I have a very simple ViewModel (ProductViewModel)</p> <pre><code> public class ProductViewModel { public int ProductID...
<p>You need to execute the query to get the actual object type back. Calling FirstOrDefault() or ToList() will execute the query. There is also .First(), it throws an exception if the item is not found after the query is executed.</p> <p>Try this:</p> <pre><code> Select(p =&gt; new ViewModels.ProductViewModel { C...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: WSO2 throws EmptyStackException while trying federated login<p>I have two WSO2 Identity server running in same machine, one is identity server another on the...
<p>I could locally reproduce this issue in IS 5.9.0 when following the below steps:</p> <ul> <li>Configure a OAuth SP in the primary IS</li> <li>Configure a SAML Identity Provider in the primary IS</li> <li>Configure a SAML Service Provider in the federated IDP.</li> </ul> <p>When the OAuth Service provider in the pr...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I execute a function only if one part of the UI receives input?<p>So far I have this</p> <pre><code>app = Flask(__name__) @app.route('/', methods=['G...
<p>you are almost right, but <code>request.method</code> won't have <code>box1</code> attribute.</p> <p>So this will be correct way:</p> <pre><code>app = Flask(__name__) @app.route('/', methods=['GET', 'POST']) def first(): if request.method == 'GET': return render_template('index.html') if request.me...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Converting a string to a new format<p>I'm running a C# app that extracts a date string in <code>MM/DD/YYYY</code> format except that when the day is less tha...
<p>There are two possible ways which I can think of.</p> <p>First way, which basically converts the string to a <code>DateTime</code> and format it back to the required format:</p> <pre class="lang-cs prettyprint-override"><code>public string GetDate(string input) { return DateTime.Parse(input).ToString("MM/dd/yy...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pandas multiindex from series of dataframes<p>I have a series of dataframes with identical structure that represent results of a simulation for each hour of ...
<p>Here is a different answer from my earlier one, in light of the more fully explained question. Iterate through the files and read them into pandas, parse the date and add it to the dataframe, then use <code>set_index</code> to create your multiindex. Once you've got all your dataframes, use <code>pd.concat</code> to...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Variable containing regex as string/generating regex dynamically and trouble with \b<p>I have these variables:</p> <pre><code>keywords = ["/(?=.*?\bTest1\b)...
<p>This isn't hard, but it appears you're making it that way:</p> <pre><code>foo = '\b[ab]' Regexp.new(foo) # =&gt; /\b[ab]/ /#{foo}/ # =&gt; /\b[ab]/ </code></pre> <p>or:</p> <pre><code>foo = "\\b[ab]" Regexp.new(foo) # =&gt; /\b[ab]/ /#{foo}/ # =&gt; /\b[ab]/ </code></pre> <p>Ruby is perfectly happy to use a stri...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Attaching an IList<T> to an ObservableCollection<T><p><code>Collection&lt;T&gt;</code> is a wrapper around an <a href="http://docs.microsoft.com/en-us/dotnet...
<p>This definately doesn't seem like a bug and I don't know why it would be an inconsistency either.</p> <p>It's the functionality of an <code>ObservableCollection</code> that prevents this. The functionality guarantees that you can be notify of any changes to the <code>ObservableCollection</code>. To be able to do th...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Types for function that applys name of function and arguments<p>I'm trying to type in proper way function that applys name of function and argumens for this ...
<p>The compiler will not be able to understand that this is type safe because it generally does not reason very well about assignability for types that depend on as-yet-unspecified generic type parameters. There is an existing GitHub issue, <a href="https://github.com/microsoft/TypeScript/issues/24085" rel="nofollow n...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: CORS on asp.net core web api doesn't work after deploy on IIS<p>I'm developing a net core webapi with an angular front end. When i was debugging everything w...
<p>I finally managed to solve the problem: I had enabled "Basic Authentication" on IIS because I mistakenly thought it was the right things to do.</p> <p>I found that IIS "Basic authentication" is different from what I had implemented (I created a custom "BasicAuthenticationHandler" that read headers e validate users)...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: post php array to ajax using jquery<p>I have the following : </p> <pre><code>&lt;script charset="UTF-8"&gt; function deleter(theid) { var namme = docume...
<p>Just use <a href="https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify" rel="nofollow"><code>JSON.stringify</code></a> to send the array, and to decode it to array in php, use <a href="http://php.net/manual/en/function.json-decode.php" rel="nofollow"><code>json_decode</code></...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Check the defined variable is empty or not in Ansible<pre><code>- hosts: localhost vars: files_list: #it may contain the file_list li...
<p>Q: <em><strong>&quot;Check the defined variable is empty or not in Ansible.&quot;</strong></em></p> <p>A: Simply test the variable. An empty list evaluates to <code>False</code>. This also covers the case when the variable is not defined. YAML <code>None</code> is Python <code>null</code>. <code>None</code> also eva...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Error while use builder(lombok) in constructor annotation<pre><code>@Data @Builder public static class Common { private String common1; private Strin...
<p><code>@Builder</code> creates a static method <code>builder()</code> in both classes; it returns an instance of the respective builder. But the return types of the methods are not compatible, because <code>SpecialBuilder</code> and <code>CommonBuilder</code> are different and unrelated classes: <code>@Builder</code>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: git cherry pick but recive fatal: Unknown commit pick<p>on my local git have develop branch and feature branch. in feature branch has three commit with hash...
<p>The command you're looking for is <code>git cherry-pick a2</code>.</p> <p>Note there's a dash between <code>cherry</code> and <code>pick</code></p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Calling ServiceBus' IQueueClient.CompleteAsync() from a different thread always fails<p>I'm receiving from a queue using <code>IQueueClient.RegisterMessageHa...
<blockquote> <p>I suspect it's because the Hangfire task re-creates the IQueueClient, that it may be because the call to CompleteAsync() is from a different instance of IQueueClient?</p> </blockquote> <p>That's correct. <code>LockToken</code> is not enough to complete the message. You have to use the same client use...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to view request / response duration?<p>Where in Paw 2 can I see the duration of a request / response? I suppose I could subtract the response time from t...
<p>It's shown in the title bar right after the request is completed.</p> <p><img src="https://i.stack.imgur.com/D40sJ.png" alt="Request / Response time in Paw (HTTP Client)"></p> <p>Though, as of version Paw 2.1.1, this time isn't accurate enough to judge of your server or network connection. The underlying HTTP libr...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Nested foreach loop in R where inner loop returns a matrix<p>I'm trying to parallelize a for loop that I have. There is a nested loop inside the loop in ques...
<p>When using foreach, you never "set up a blank results list to save into", as you suspected. Instead, you combine the results of evaluating the body of the foreach loop, and that combined result is returned. In this case, we want the outer foreach loop to combine vectors (computed by the inner foreach loop) row-wise ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Delphi, search in text file<p>So, I have edit1 and edit2 + button on the form when I put some number to edit1, after on button_clik it will search 12345 in t...
<p><code>tStringList.Values</code> will search for a string of the form <code>Name=Value</code>. If you want to use a different delimiter, such as comma, set <code>NameValueSeparator</code>. The code below displays the message 'BUS'. </p> <pre><code>var SL : tStringList; begin SL := tStringList . Create; SL ....
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Opacity based on scroll position, cap at specific opacity<p>I'm using this piece of code to animate the background of my header, based on the scroll position...
<p>You can use <code>Math.min()</code> to select the lowest value from a list:</p> <pre><code>$('#whitebackground').animate({ opacity: Math.min(st / 200, 0.9) }, 1); </code></pre> <p><a href="http://jsfiddle.net/pfqeaax1/" rel="nofollow"><strong>Example fiddle</strong></a></p> <p>Note that the max value in the fiddl...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is the drawback for using Strings for non-String specific data?<p>I know this might be a kind of "silly" question. I have created software applications ...
<h2>Some reasons to use proper types</h2> <p><strong>1. Least surprise.</strong> If developers are going to grab numerical data from your database, they would find it weird that you're storing them as strings.</p> <p><strong>2. Developer convenience.</strong> Another is the nuisance of having to parse the data into t...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Error with Android .getDrawable()<p>I'm trying to grab a reference to a given imageView's set drawable image and then print out a toast when that imageView i...
<p>Here :</p> <blockquote> <p>String Piece3 = s01.getDrawable().toString();</p> </blockquote> <p>Calling <code>toString()</code> method on Drawable will return string representation of drawable instead of drawable name. </p> <p>Use <code>setTag</code> method in xml for adding name of image and in code use <code>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Excel, using a second index match if first is empty<p>I was wondering if theres an easy way to setup a formula that is an index match one a sheet of data, an...
<p>MATCH will return an error where a matching value is not found. This can be used to switch to an alternative match attempt, eg: </p> <pre><code>=IFERROR(INDEX(Sheet1!A:A,MATCH(C1,Sheet1!B:B,0)),INDEX(Sheet2!A:A,MATCH(C1,Sheet2!B:B,0))) </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Create root XML node with more than 1 namespace<p>I am working with Backbone.js with Restful services. Have to post XML. I want to add more than 1 namespace...
<p>An element node can have only a single namespace, but multiple namespace definitions. You can add them as attribute nodes in the xmlns namespace. This is only needed if the namespace is not used by the element node or one of its attribute nodes.</p> <p><div class="snippet" data-lang="js" data-hide="false"> <div cla...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I remove all attributes from an Specific html tag using preg_replace?<p>Consider a php variable which contains a string of text, this text contains s...
<h3>Regular expression</h3> <p>You can try this:</p> <pre><code>(&lt;)(br|div)([^&gt;]+?)(\/?\s*&gt;) </code></pre> <p><img src="https://www.debuggex.com/i/Q8fIghhsGVt2p0FP.png" alt="Regular expression visualization" /></p> <p>As you can see in the above picture, you can adapt the <code>Group 2</code> to your needs man...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: R rep function returns the wrong number of elements<p>I ran the following code in R version 3.1.2:</p> <pre><code>&gt; 7 - (.05+.1)/.05 [1] 4 &gt; rep(NA, 4...
<blockquote> <p>7.31 Why doesn’t R think these numbers are equal?</p> <p>The only numbers that can be represented exactly in R’s numeric type are integers and fractions whose denominator is a power of 2. Other numbers have to be rounded to (typically) 53 binary digits accuracy. As a result, two floating point nu...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Apache Karaf (4.2.6) shell: Unable to install webconsole<p>I'm trying to do a feature:install webconsole in Karaf, version 4.2.6, but on every machine I try ...
<p>Modify <code>org.ops4j.pax.url.mvn.repositories</code> property in <code>org.ops4j.pax.url.mvn.cfg</code> configuration file in order to use https instead of http. Since January 15th, 2020 http is disabled on Maven central</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Shift/Reduce conflict on C variation grammar<p>I am writing a parser to a C-like grammar, but I am having a problem with a shift/reduce conflict:</p> <p>Bas...
<p>The problem is that a <code>function_def</code> can only occur after a <code>function_list</code>, which means that the parser needs to reduce an empty <code>function_list</code> (using the production <code>function_list &rarr; &epsilon;</code>) before it can recognize a <code>function_def</code>. Furthermore, it ne...