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: This map destructuring isn't working quite how I'd expect. What am I doing wrong?<p>As an example that, hopefully, states things far better than I could in w...
<p>I'm not Rich, so obviously I didn't choose how this works, but I can think of a couple reasons the current behavior is better than the behavior you expected.</p> <ol> <li><p>It's faster. A lot of Clojure's low-level core features get used <em>all the time</em> in your program, and they are optimized more for speed ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Conversion from SYSTEMTIME to time_t gives out Time in UTC/GMT<p>I am trying to convert <code>SYSTEMTIME</code> to <code>time_t</code> through the implementa...
<p>I finally found the Solution from the Windows SDK, through <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms725481%28v=vs.85%29.aspx" rel="nofollow">TIME_ZONE_INFORMATION</a> and <a href="https://msdn.microsoft.com/en-us/library/htb3tdkc.aspx" rel="nofollow">_timezone</a></p> <pre><code>time_t Ge...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: C# index out of range, multi thread, Logs<p>I am trying to grab logs from windows. To make it faster I look for the days where logs are and then for that ran...
<p>Replace <code>var tt2 = test;</code> with <code>var tt2 = test.ToArray();</code></p> <p>The error is a mistake you do numerous times in your code: you are enumerating over a the data countless times. Calling <code>.Count()</code> enumerates the data again, and in this case the data ends up conflicting with cached v...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Wordpress: choose an image size when creating an image gallery<p>Goal: When creating an image gallery in Wordpress 5.3.2 using the Gutenberg editor, I'd like...
<p>I understand what you're going for and unfortunately WordPress and Gutenberg still loads the full-size, original image (and just resizes it in css) :(</p> <p>There are several closely-related issues that describe this</p> <ul> <li><a href="https://core.trac.wordpress.org/ticket/45407" rel="nofollow noreferrer">http...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Transaction results in syntax error<p>This function is created ok without the transaction block. With it as in the following I get the following error...</p>...
<p>Functions in PostgreSQL are running under transaction everywhere. It can be implicit transaction (started by Postgres) or explicit transaction (started by user). And you cannot to commit or rollback this transaction, because it is started outside function.</p> <p>If your function doesn't raise a exception, then res...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is the best solution for adding INDEX to speed up the query?<p>Now I have a Query that runs 50 minutes on Mysql database and I can't accept that...</p> ...
<p>I would write the <code>select</code> as:</p> <pre><code>select mstid, concatkey, 'icmstlocationheader' as sourcetablecode from appianData.IC_MST_LocationHeader lh where not exists (select 1 from appianData.IC_PURGE_LocationHeader lhp where lhp.concatkey = lh.concatkey ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Center Editext in a Linear Layout - Android<p>I'm trying to center the editText which you can see in this screen (the one on the black buttons): <a href="htt...
<p>No need to use <code>layout_marginLeft</code> to align it <code>center_horizontal</code>, remove it. Just add <code>android:gravity</code> to <code>center_horizontal</code> in your <code>LinearLayout</code> enclosing <code>EditText</code>.</p> <pre><code>&lt;LinearLayout android:id="@+id/toprow" android:lay...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Need to write MySQL case statement<p>I need to write a MySQL statement, but not sure how to write it using case statements.</p> <p>I would like to write som...
<p>It's not clear what you want to achieve. Does a row need to satisfy all three conditions, or just one of them? Either result can be achieved without using <code>CASE</code> expressions.</p> <p>If the requirement is to use <code>CASE</code> expressions, and you need all three conditions to be true, you could do some...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Building software collections metapackage fails under Fedora 20/21<p>I am having some problems in building a software collections metapackage under fedora 20...
<p>with scl-utils-2.0 is it possible only to build new type of collections.</p> <p>Instead of using following structure in your metapackage specfile</p> <pre><code>cat &gt;&gt; %{buildroot}%{_scl_scripts}/enable &lt;&lt; EOF export PATH=%{_bindir}\${PATH:+:\${PATH}} export LD_LIBRARY_PATH=%{_libdir}\${LD_LIBRARY_PATH...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I get the count of Azure function execution programmatically in c#?<p>I have timer trigger azure function which runs on every minute. Is it possible ...
<p>Maybe you could implement it like the below picture, the variable will be shared. However if you restart your function, it will reload the variable time.</p> <p><a href="https://i.stack.imgur.com/TemT6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TemT6.png" alt="enter image description here" />...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: the name is not a valid identifier. error in dynamic stored procudure<p>my stored procudure is :</p> <pre><code>ALTER PROCEDURE [dbo].[Asbabbazi_A] @na...
<p>Some parameters in a query string are not parsed correctly, and you are using dynamic sql it must be executed by EXECUTE sp_executesql statement. This is the correct way to execute dynamic sql:</p> <pre><code>ALTER PROCEDURE [dbo].[Asbabbazi_A] @name_product nvarchar(50), @first_price int, @final_price...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Run method only if --collect-only was used<p>I'm trying to collect some stats of how many test cases there are per feature or team, and want to do this only ...
<p>Just check whether the flag is set in the <code>config</code> object. Example with your hookimpl:</p> <pre><code>def pytest_collection_modifyitems(config, items): if config.option.collectonly: print("I will run only with --collectonly flag") else: print("I will run only without --collectonly...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Where is defined nil in Ruby<p>I would like to know there is defined the <code>nil</code> object in Ruby MRI programming language. It looks like a constant, ...
<p>It is defined in <a href="http://ruby-doc.org/docs/keywords/1.9/files/keywords_rb.html#M000026" rel="nofollow noreferrer"><em>keyword.rb</em></a> file :</p> <blockquote> <p>A special &quot;non-object&quot;. <code>nil</code> is, in fact, an object (the sole instance of <code>NilClass</code>), but <em>connotes absence...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Getting data-attributes from slides in slick carousel<p>After the 1.4 update to Slick carousel, the method to pull data attributes from the current slide cha...
<p>You can access the <code>$slides</code> array from the slick object:</p> <pre><code>var elSlide = $(slick.$slides[currentSlide]); var materials = elSlide.data('materials'); </code></pre> <p>I have updated the jsfiddle <a href="http://jsfiddle.net/arcadeGandalf/3b4kqy9p/1/" rel="noreferrer">here</a></p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: onClick active tab add/remove class<p>I'm working on the accordion tabs here on active I want to add the class <code>.elementor-active</code> in the '.elemen...
<p>Here's some changes<br></p> <p>Just remove before adding class <code>$('.elementor-tab-title').removeClass('elementor-active');</code></p> <p>and add class to targeted element <code>$(this).parent().addClass('elementor-active');</code></p> <h2>Edit:</h2> <p>If you want a toggle then you can check using <code>$(this)...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Accessing 32bit assembly array, memory addressing<p>Hi I'm new to assembly currently coding in 32bit assembly and I'm trying to access an array I initialized...
<p>As Michael <a href="https://stackoverflow.com/questions/28593145/accessing-32bit-assembly-array-memory-addressing/28599172#comment45492900_28593145">indicated</a> in the comments, you can't use <code>al</code> in an effective address. Instead, we'll zero-extend <code>al</code> into <code>eax</code>, and use it inste...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: One second delay on EasyPHP - IPV4 vs IPV6<p>Some months ago I got this computer and while running EasyPHP I perceived a 1 second delay to page load that did...
<p>I've earned the tumbleweed badge from this question o/</p> <p>I HAVE THE ANSWEAR GUYS</p> <p>Open the following folder</p> <p>C:\Windows\System32\drivers\etc</p> <p>Now, open the notepad as admin and load the file "hosts" and remove the comment from this line:</p> <pre><code># 127.0.0.1 localhost </code...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to combine 'onchange' and 'blur' HTML DOM events<p>Let <code>MyFunction()</code> be some JavaScript function. Is it possible to combine the 'onblur' and ...
<p><strong>Solution 1:</strong> Declare global variable that tracks if the date has changed and then reset it on blur.</p> <pre><code>var dateValueChanged = false; function onChange(){ dateValueChanged = true; } function onBlur(){ if(dateValueChanged){ //do thing alert('value has changed and blur'); ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Java: create List of List of Maps<p>I have List of Maps and map contains json objects ... I have create separate lists for each json objects which has sam...
<p>You'll first want to create the outer most list. Then, for each service info, you'll add a list to that outer list. And for each json object for that service info, you'll create a map, and then put that map into the inner list. You'll end up with something similar to this.</p> <pre><code>List&lt;List&lt;Map&lt;Str...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Undefined symbol error when trying to mov into variable which defined in C code above assembly<p>I am trying to run assembly code inside C code(on CLion). I ...
<p>Your main issue is that <code>x</code> is a local variable. You will have to use <a href="https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html" rel="nofollow noreferrer">extended assembly</a> to modify it (and use <code>-masm=intel</code> to use Intel syntax):</p> <pre><code>int main(void) { short int x = 0; ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Build all Hamiltonian paths from an edge list<p>I'm having trouble finding a way to build a tree path from a list of related tuples? I only want a list of e...
<p>OK, I was having so much trouble because of the data structure I was trying to work from, since there were duplicates in the original connections graph.</p> <p>Better is to use a data structure like this:</p> <pre><code>connections = {1: [4, 5], 2: [5], 3: [4], 4: [1, 3, 5], 5: [1, 2, 4]} </code></pre> <p>Then t...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: windows cmd not showing python virtualenvwrapper in front of the command<p>I'm try to use "virtualenvwrapper-win" to build django project on my windows 10 pc...
<p>It is because of the new version 20.0.1 which doesn't show that, don't know whether its bug or not,the activate command does activate it, but it no visible. <strong>Solution, uninstall and install last stable release</strong></p> <pre><code>pip install virtualenv==16.7.9 </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Accessing Google cloud API from local Project not Hosted on Google cloud platform<p>I want to use google cloud natural language API from local python code. B...
<p>1.Create or select a project.</p> <pre><code>gcloud projects create nat-lan-api gcloud config set project nat-lan-api </code></pre> <p>2.Enable billing.</p> <pre><code>gcloud alpha billing projects link nat-lan-api --billing-account XXXXXX-XXXXXX-XXXXXX </code></pre> <p>3.Enable the Google Natural Language API...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Search for multiple strings using 'class' at python<p>I have this code, that finds the word |1234| and copy all lines until abcd| is found, it doesn´t copy t...
<pre><code>import glob import os class Collector: def __init__(self, filename, start_marker, stop_marker): self.toggle_collect = False self.f = open(filename, encoding='utf-8', errors='ignore') self.m1s = ['|1234|', 'other_word1', 'other_word2'] self.m2 = 'abcd|' def __enter__...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Directive is not working after changing data<p>I have ceated directive that after using, disable forms element.</p> <pre><code>app.directive('chDisable', fu...
<p><a href="https://docs.angularjs.org/api/ng/type/$rootScope.Scope" rel="nofollow">https://docs.angularjs.org/api/ng/type/$rootScope.Scope</a></p> <p>You would need to use <code>$watch()</code> or <code>$watchCollection()</code> inside your <code>link</code> function in order to refresh the elements when your list ch...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Regex scientific notation<p>I need to float the following strings that represent scientific notation values without the exponent:</p> <pre><code>'-1.366-6' ...
<p>You need to use <code>re.sub</code>,</p> <pre><code>re.sub(r'(?=[-+][^-+]*$)', 'e', string) </code></pre> <p>The above regex matches the boundary which was followed by last <code>+</code> or <code>-</code> character.</p> <p><a href="https://regex101.com/r/eY0yR9/1" rel="nofollow">DEMO</a></p> <p><strong>Example...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: C# not detecting and instantiating classes<p>I started writing a new C# app. I have created a couple of classes that i would like to declare and instantiate ...
<p><code>DataHelper</code> is defined under the <code>BuildID</code> namespace. </p> <p>You have 2 options:</p> <p>The <strong>first</strong> is to declare it like this: </p> <p><code>private BuildID.DataHelper _dataHelper //...;</code></p> <p>The <strong>second</strong> is to add a <code>using BuildID</code> at th...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Get Attribute value of specfic tag<p>I'm trying to extract the values of attributes "address" , "programmaticName" of the tags "datapoint" , "event" &amp; "c...
<p>Here we go.....</p> <pre><code>import java.io.File; import java.util.ArrayList; import java.util.List; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public c...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Scala can't import a class that Java can<p>Why I can do this in Java:</p> <pre class="lang-java prettyprint-override"><code>import javax.swing.GroupLayout.G...
<blockquote> <p>I'd like to generate a generic method that takes as a parameter a Group, that could be either a ParallelGroup or a SequientialGroup</p> </blockquote> <p>That would be a <a href="https://lptk.github.io/programming/2019/09/13/type-projection.html" rel="nofollow noreferrer">type projection</a></p> <pre...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I only store the second part of a string in a list?<p>I have a list Textlist1 that contains only strings. Each item in the list begins with the same ...
<p>See online result: <a href="https://dotnetfiddle.net/MpswLZ" rel="nofollow noreferrer">https://dotnetfiddle.net/MpswLZ</a></p> <p><a href="https://i.stack.imgur.com/KlY4J.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KlY4J.png" alt="enter image description here"></a></p> <pre><code>List&lt;str...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to get the list of all the posts by a particular user in Express/Mongo?<p>I have a User and Posts model, and there's a User's feed where all the posts su...
<p>Since you don't have any reference from user to post, you can use <a href="https://mongoosejs.com/docs/populate.html#populate-virtuals" rel="nofollow noreferrer">virtual population</a> for this:</p> <p>First update the user schema like this: (note that I added <code>toJSON: { virtuals: true }</code> and defined <co...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Problems solving a mixed integer quadratic program (MIQP) in Gurobi<p>I need your help. For my thesis i need to solve a mixed integer quadratic problem (MIQP...
<p><a href="http://link.springer.com/article/10.1007%2FBF00122429" rel="noreferrer">A new reformulation-linearization technique for bilinear programming problems</a> goes through a reformulation technique that would be useful for your problem. Assuming I understand you right, the below is your optimization problem</p> ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to get all factors aka divisors of a number of range 10^18 given that I can do this task in upto 10^6 computations?<p>I am facing problems in getting all...
<p>In my computer it works really fast, it will give you all the factors, but it is in Java, if that helps.</p> <pre><code>public class Factoring { private static Set&lt;Long&gt; findFactors(long num) { Set&lt;Long&gt; nn = new HashSet&lt;&gt;(); for (long i = 2; i &lt;= Math.sqrt(num); i++) ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Streaming Django template with large generator in context<p>I want to render large log files in a Django template.</p> <p>To do so, the template renders ind...
<p>I found a way to do this, but in the process realised that trying to display large log files in the browser is a bad idea, as some of them are really really big.</p> <p>In case anyone is trying to do this (with slightly less large files), note that templates are fundamentally rendered synchronously, so the above ap...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: is it possible to detect operating system in c++?<p>I am using CentOS, and trying to convert perl code into C++. in perl we can detect operating system using...
<p>@Joachim Pileborg Thanks for the suggestion... for uname system call ... from following code i can get system informations.</p> <pre><code> #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;errno.h&gt; #include &lt;sys/utsname.h&gt; int main(void) { struct utsname buffer; errno = 0; if (uname...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Call api resource and return current user<p>I want to return all data of a single user and I want to use a resource for it.</p> <p>As I get it, such resourc...
<p>in order to use request directly from any function you should get current request object by using request helper function inside called function</p> <p><code>$request=request();</code></p> <p>hope this will help</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to use an implicit at runtime?<p>First, this is more for experimentation and learning at this point and I know that I can just pass the parameter in dire...
<p>Implicit parameters are resolved at compile time. By-name parameter captures the values it accesses at the scope where it is passed in.</p> <p>At runtime, there isn't any implicit concept.</p> <pre><code>eval(List(1, 2), test) </code></pre> <p>This needs to be fully resolved at compile time. The Scala compiler ha...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to deal with non-manifold vertices for 3d printing<p>I am working on modeling a shape for 3d printing, but I'm running into a problem with it having non-...
<p>Figured it out. The fact that I was trying to make the long top, outside, and bottom piece one single face was the problem. The vertices where the center section met the inside of the outer part of the design were being overlapped by the edge from the single long face. Instead, I added the vertices (points in red) i...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is the correct way to add the music editor abcjs to my website?<p>1) Since its behavior seems to be similar to the behavior of mathjax (see for instance...
<p>First, you should know that abcjs is not an editor but a javascript component, you can use to build an editor, as pauls shows. But in those examples the editing part is a regular textpane. Your example shows that there is a significant start/end pattern (for tex it is "$" resp. "\(" and \)" to delimit the tex code.<...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to get First and last name to work with my ajax script<p>I have an ajax script That gets the post from textbox Employee_Name and auto fills Employee_Numb...
<p>If the first and Last Name will be typed in the same input, you could split the string and then separate using a logic for know the First and Last Name:</p> <p><strong>Using Javascript:</strong></p> <pre><code>$(document).ready(function(){ $("#Employee_Name").change(function(){ var txt = $(this).val(); ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to filter WP_Query<p>I'm using a WP_Query</p> <p><code>$the_query = new WP_Query( array( 'post_type' =&gt; 'testimonials', 'showposts' =&gt; -1 ) );</co...
<pre><code>$the_query = new WP_Query( array( 'post_type' =&gt; 'testimonials', 'showposts' =&gt; -1, 'meta_key' =&gt; 'rate', 'meta_value' =&gt; 4, 'meta_compare' =&gt; '&lt;=' ) ); </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to change a fill color for an ellipse in discrete steps in c# WPF<p>I have a list of boolean values named <strong>Sequence</strong>. I want to change the...
<pre><code>foreach(bool element in Sequence) { if(element){ ellipse.Fill = new SolidColorBrush(Colors.Yellow); } else{ ellipse.Fill = new SolidColorBrush(Colors.Blue); } int milisecond = 200; Thread.Sleep(miliseconds); } </code></pre> <p>Runs <em>synchronously</em> on the UI thread. Thus, the UI never ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Build failed with an exception: Task '—' not found in root project<p>This what I got when I tried to integrate with SonarQube. I cannot find the error.</p> ...
<p>This is caused by the em-dash being used as an argument. <code>— info</code> should be <code>--info</code>.</p> <p>Perhaps you've copy-pasted the command from another source which automatically changed the two dashes to an em-dash?</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Parse JSON in Swift 5<p>I am trying to write a generic parser for JSON files similar to this.</p> <pre><code>{ "BA": { "name": "Bert Andries", ...
<p><code>Dictionary</code> conforms to <code>Encodable</code> and <code>Decodable</code>, so <code>JSONDecoder</code> may be used with the <code>Dictionary&lt;String, User&gt;</code> type.</p> <p>To decode your JSON object ...</p> <pre><code>let jsonString = """ { "BA": { "name": "Bert Andries", "...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Lerp background colour based on time of day<p>I have been developing a small web project which displays the time and uses p5.js to animate a sun and moon to ...
<p>You could, alternatively, use the <a href="https://p5js.org/reference/#/p5/lerpColor" rel="nofollow noreferrer">lerpColor()</a> function, which will help you make a smooth transition between colors. Since <code>lerpColor</code> will change from one defined color to another, I would change the boundaries of the time ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: View is not showing profile when passing id parameter<p><a href="http://localhost/CodeIgniter/index.php/ContactBook/profile/2" rel="nofollow">http://localhos...
<p>change it like this</p> <pre><code>$data = ''; if((int)$id &gt; 0) { $query = $this-&gt;ContactBook_Model-&gt;get($id); $data['id']['value']=$query[0]['id']; $data['name']['value']=$query[0]['name']; $data['number']['value']=$query[0]['number']; $data['img']['value']=$query[0]['img']; $data[...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: datetime index to datetime series not working in Pandas?<p>I am trying to convert a datetime index to a datetime series but I get an error:</p> <pre><code>t...
<p>Here <code>ticks</code> are already <code>DatetimeIndex</code>, so no convert necessary:</p> <pre><code>ticks = pd.date_range(start = '2019-12-30', end = '2020-02-11', periods = 6) </code></pre> <p>If want <code>Series</code>:</p> <pre><code>s = ticks.to_series() </code></pre> <p>Or:</p> <pre><code>s = pd.Serie...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can you make an MVC Post action only accept form data and not querystring<p>I am using ASP MVC 5 and I have an action on my controller as such</p> <pre><cod...
<p>The model binding process in MVC takes into account something called <strong>Value Providers</strong>. These are implementations of the interface <code>IValueProvider</code> and there are a few of them which look at different data sources: <code>FormValueProvider</code>, <code>RouteDataValueProvider</code>, <code>Qu...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there an R package for modified 2-sample Hotelling's T2 test (unequal covariance matrices)?<p>I need to compare many multivariate means. Usually, I would ...
<p>You can use the function <a href="https://rdrr.io/cran/MVTests/man/TwoSamplesHT2.html" rel="nofollow noreferrer">TwoSamplesHT2</a> of the <code>MVTests</code> package. This package has been removed from CRAN but it is available in the <a href="https://cran.r-project.org/src/contrib/Archive/MVTests/" rel="nofollow no...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I NOT loop already existing keys in a JSON with Javascript<p>I'm not sure my searching skills are strong enough to find a solution on my own, since I ...
<p>First off, my guess is you don't really have JSON, just an object. But it doesn't really matter either way.</p> <p>A JavaScript object (and an object described in JSON notation) can have only <strong>one</strong> property with a given name. If you have what you describe in JavaScript source code:</p> <pre><code>var ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Scipy.optimize - minimize not respecting constraints<p>Using the code below to to understand how Scipy optmization/minimization works. The results are not ma...
<p>Your problem is incompatible. You can eliminate the 3rd constraint (which makes your problem simpler in the first place - only a scalar optimization), after this it is a bit more clear to see what is the problem. From constraint 3 and the lower bound on the original <em>x1</em> follows, that <em>x0</em> is not feasi...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: R, how to increment the a for loop limit within the loop itself?<p>I am working in R and I am trying to change the limit of a for loop within the loop itself...
<p>You could use a <code>while</code> loop like this (note that you must increment <code>exe_i</code> yourself)</p> <pre><code>execution_limit &lt;- 10 exe_i &lt;- 1 while(exe_i &lt;= execution_limit) { cat("(exe_i = ", exe_i," / ", execution_limit, ")\n", sep="") Sys.sleep(0.1) if(exe_i == 7) { ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Trying to import Bootstrap on Next.JS but says "TypeError: Cannot read property 'jquery' of undefined"<p>I'm trying to import Bootstrap from a Next.js projec...
<p>The issue here is that your page is trying to import <code>bootstrap</code> whenever this page loads, including when the page is being rendered server-side by the Next.js server (or by the <code>next export</code> process). Bootstrap, though, can't run on the server-side because it looks for <code>window.jquery</cod...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Xcode swift managing multiple view controllers in multiple storyboard<p>I have a big project. and in future it will have multiple view controllers in each st...
<p>// Please add this extension in your code </p> <pre><code>extension String { func viewController (_ vc: String) -&gt; UIViewController? { let storyboard = UIStoryboard(name: self, bundle: nil) let vc = storyboard.instantiateViewController(withIdentifier: vc) return vc } } </code>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Get attribute from a specific element of a class<p>Basically I have to develop a Tic-Tac-Toe game, here is the HTML file which I can't rewrite only reformat ...
<p>If I understood correctly, you need to access data attributes of your game-cell element. In order to do this, you need to select the element by some ID or class. I have modified your code a little to make it run inside stackoverflow`s platform. I have added an ID which i called "unique" and I also set some values in...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Firestore Database Rules - "Create" Rule Not Working for Cloud Functions<p><strong>Database Rules for Documents Created with HTTP Cloud Function</strong></p>...
<p>Cloud Firestore Security Rules is only for the Android, iOS, and Web client libraries. Not for server side(cloud functions using firebase admin SDK).</p> <p>See <a href="https://firebase.google.com/docs/firestore/security/overview" rel="noreferrer">https://firebase.google.com/docs/firestore/security/overview</a></p...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is it possible to return a JSONArray with @ResponseBody in Spring MVC?<p>I'm trying to use AJAX to load a URL that will return data from my controller, I nee...
<p>I actually just answered a post like this, check out my answer here: <a href="https://stackoverflow.com/questions/28722471/converting-java-object-to-jsonobject-and-transmit-it-at-get-method/28727990#28727990">Converting Java object to JSONObject and transmit it at GET method.</a>.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What best way to pass @PathVariable to my all JSP pages without add it to ModelAndView?<p>I change my path from:</p> <p>/user/home /user/history ...</p> <p...
<p>Use ControllerAdvice and ModelAttribute</p> <pre><code>@ControllerAdvice class Advice { @ModelAttribute public void addAttributes(Model model) { model.addAttribute("orgId", "value1"); } } </code></pre> <p>As of Spring 4, @ControllerAdvice can be customized through annotations(), basePackageCl...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: script is not hitting any validation steps in awk<p>this script is supposed to read in csv in the following format</p> <pre><code> Name,Date,ID,Number Jo...
<p>You don't need to save the file in an array, all you need is:</p> <pre><code>awk -F',' ' # skip the header and blank lines NR == 1 || NF == 0 {next} $1 == "" { fails1++ } $2 == "" { fails2a++ } $2 !~ /^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)[0-9][0-9]$/) { fails2b++ } $3 =...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Invert the key and value of an object while the value is an array<p>I have the following:</p> <pre><code>var object = { a: ["A1"], b: ["B1", "B2"], ...
<p>Try this,</p> <pre><code>var object = { a: ["A1"], b: ["B1", "B2"], c: ["C1", "C2", "C3", "C4"] }; var keys = Object.keys(object); var obj = {}; for(var j=0,l=keys.length;j&lt;l;j++){ for (var i = 0; i &lt; object[keys[j]].length; i++) { obj[object[keys[j]][i]] = keys[j]; } } console.log(obj); </code>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Representing a schedule as a string (or JSON)<p>Is there a good way of representing complex schedules as a string? Failing that, is there a standard way of r...
<p>The most relevant standard is probably iCalendar, as defined in <a href="https://www.rfc-editor.org/rfc/rfc5545" rel="nofollow noreferrer">RFC 5545</a>. It long ago addressed the many, many, many challenges of representing schedule data. Unsurprisingly, an analogous JSON format also exists; also unsurprisingly, it's...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ALTER DATABASE statement not allowed within multi-statement transaction<p>I wrote a data migration script in which I am checking if the previous data migrati...
<p>I Solved this problem by creating a new <code>storedprocedure</code> and place these two lines into the procedure</p> <pre><code>SET IMPLICIT_TRANSACTIONS OFF ALTER DATABASE AlAhsaan2014 SET RESTRICTED_USER WITH ROLLBACK IMMEDIATE; </code></pre> <p>and then call the storedprocedure from my script</p> <pre><cod...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: check if map exists in vimScript<p>I am trying to check if a mapping exists, and if true, unmap it. If I try to do it without checking it runs into error and...
<p>You can use <code>maparg("jjj")</code>, from the <code>:help maparg</code>:</p> <pre class="lang-sh prettyprint-override"><code>maparg({name} [, {mode} [, {abbr} [, {dict}]]]) *maparg()* When {dict} is omitted or zero: Return the rhs of mapping {name} in mode {mode}. The returned String ha...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Populate other Cells while Another Cell is being Editted<p>What I'm trying to do is (just an example), while typing in dgv row 0, col 0, if the value = 10 th...
<p>I believe this question is a duplicate.</p> <p>See this answer <a href="https://stackoverflow.com/a/7226872/2319909">https://stackoverflow.com/a/7226872/2319909</a></p> <p>TL;DR DataGridView.CurrentCellDirtyStateChanged and DataGridView.CellValueChanged events</p> <pre><code>Private Sub YourDGV_CurrentCellDirtySt...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Oracle Archive and Purge Options<p>I am trying to figure out what are the best options to perform archive and purge given our situation.</p> <p>We have roug...
<p>Use <a href="https://docs.oracle.com/database/121/VLDBG/GUID-8F38C8B0-3999-4F4E-8AF2-F41C2F764F47.htm" rel="nofollow noreferrer">composite partitioning</a>, e.g. <em>range</em> (for your time dimension) and <em>list</em> (to distinct between the rows that should be kept long and limited time.</p> <p><strong>Example...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Specified cast not valid Sqlquery<p>i am getting the error Specified cast not valid when reading from an SQL Select statement in C#.</p> <p>my data types fo...
<pre><code>SQl -&gt; c# tinyint -&gt; byte bit -&gt; bool </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to show a text box if value in tablix is empty in RDLC report<p>How to dispaly a message or show a text box if there are no values in another tablix in R...
<p>You can create a <code>TextBox</code> and setting its <code>.Hidden</code> property like this:</p> <pre><code>=IIf(CountRows("YourTablixDataSet") = 0, False, True) </code></pre> <p><a href="https://msdn.microsoft.com/en-us/library/dd255215.aspx" rel="nofollow">CountRows</a> counts all rows in a specified scope, in...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: React Typescript destructure providerValue<p>After a suggestion of a member on my previous post on how to pass <code>setState</code> to children of context A...
<p>I don't work with TypeScript, so my answer might be not very accurate, but this line</p> <pre><code>const ShowContext = React.createContext&lt;IShowProviderProps&gt;({} as IShowProviderProps); </code></pre> <p>fixes the issue. The problem is that since <code>providerValues</code> <em>can</em> be <code>null</code>,...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Unable to Iterate through the function's properties and methods in Javascript<p>I was wondering if it was possible to iterate through methods and properties ...
<p>Use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames" rel="nofollow"><code>Object.getOwnPropertyNames</code></a>:</p> <pre><code>// functions directly within Object Object.getOwnPropertyNames(Object).forEach(function(name) { // do whatever you wa...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Focus chrome window in linux when running using xvfb<p>I am using the following shell script for to get the focus on a specific chrome window:</p> <pre><cod...
<p>It worked even without using windowactivate because I opened just one window that needed focus.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is is ok to call Array#pop inside Array#each?<p>I want to remove unnecessary <code>Hash</code> from a end of <code>Array</code> like a <code>String#strip</co...
<p>According to Matz <a href="https://groups.google.com/forum/#!topic/ruby-core-google/wYAJdScsv9w" rel="nofollow">here</a>, it is undefined behaviour to modify a collection that is being iterated.</p> <p>Instead try something like this:</p> <pre><code>while ! array.last[:foo] array.pop end </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Changing domains, redirecting sub-directories<p>My client is changing his domain, and I'm curious about the best way to make all the existing links on other ...
<p>To the best of my knowledge you would have to keep the old domain and redirect from there with '301's in an .htaccess file or something similar.</p> <p>An example .htaccess file might look like this:</p> <pre><code>RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !newdomain.com$ [NC] RewriteRule ^(.*)$ http...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Combining vectors by position of elements or indices in R<p>This could be ridiculously simple but I am not able to do this, what am trying, is combining 3 ve...
<p>You could try <code>rbind</code> and then convert to "vector" if they are of equal length as shown in the example. (instead of <code>as.vector</code>, <code>c</code> could also do the job)</p> <pre><code> as.vector(rbind(jj, hh,gg)) #[1] "a1" "b1" "c1" "a2" "b2" "c2" "a3" "b3" "c3" "a4" "b4" "c4" </code></pre> <...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Show widget at the center bottom on a gridview<p>I have a gridview with 2/3 columns and I would like to show a loading indicator at the bottom-center of the ...
<p>This should also be possible using <code>CustomScrollView</code>.</p> <p><a href="https://i.stack.imgur.com/QEJTN.png" rel="noreferrer">https://api.flutter.dev/flutter/widgets/CustomScrollView-class.html</a></p> <p>Inside this you can use both <code>SliverGrid</code> and <code>SliverList</code> to create your Layo...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Trying to use JSON but getting '500 Internal Server Error'<p>I'm back with another question.</p> <p>I'm trying to create a JSON file that gets data from my ...
<p>The <code>$array = ['myindex' =&gt; 'somevalue']</code> syntax for arrays has been <a href="http://php.net/manual/en/migration54.new-features.php" rel="nofollow noreferrer">implemented in PHP 5.4</a>. Try with <code>array()</code> instead. </p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: simple authentication using python panel holoviz<p>I am happily deploying jupyter notebooks using the suggested command-line-interface <a href="https://panel...
<p>The best place to start right now (2020-5-14) is to look at the Bokeh documentation and example. You can find the example here <a href="https://github.com/bokeh/bokeh/tree/master/examples/howto/server_auth" rel="nofollow noreferrer">https://github.com/bokeh/bokeh/tree/master/examples/howto/server_auth</a>.</p> <p>I...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Targeting dynamically added text value showing empty when passing value on<p>When I select an option from a dropdown, it auto populates a text field based on...
<p>You need to <a href="https://api.jquery.com/trigger/" rel="nofollow noreferrer"><code>trigger()</code></a> the <code>change</code> event manually, programmatically changing the <code>input</code> element value will not trigger the <code>event</code> handler</p> <pre><code> $('#account-test').val('12345').trigger('c...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Fix SQL Query with SELECT CASE / AND COUNT CASE<p>The following SQL query is not working, it returns error:</p> <p>[42601] ERROR: subquery must return only ...
<p>Well it is very unclear what is you want to do but here it is what I can help you with: </p> <p>In this example if <code>habilitation.actif</code> is <em>true</em> then you will select count of... and if it is not then you will select value <code>0</code> for that row. Please note that you have to use a group by wh...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Javascript/AngularJS: How do I make click event trigger parent?<pre><code>&lt;div id="fb-button-container" style="width:20%; margin:auto;" data-ng-show="!is...
<p>A rather silly approach would be using another element inside the parent, which will act as a main trigger. Inside the checkFacebookLoginState(), listen to the click event, and execute another click to the hidden fb login button when needed.</p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I compile from source on github?<p>First off: Here is the thing. <a href="https://github.com/oscar-broman/sky" rel="nofollow">https://github.com/o...
<p>I looked at the code. This code expects to be compiled either on GNU/Linux, or FreeBSD, or OpenBSD using GCC, or else on Windows using MS Visual C++. It doesn't support being compiled on Windows with GCC (cygwin).</p> <p>As for formatting, if you <a href="https://stackoverflow.com/help/formatting">read the docs</...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: select punctuality report with sql<p>I Have 3 tables.</p> <p>1.tblAccess</p> <pre><code>+------------+--------------+----------+-----------------+---------...
<p>I worked on my query and i came up with a solution. As there is no other better answers posted, I am answering this question myself.</p> <p>Here is what I done.</p> <pre><code>;WITH CTE AS( select EmployeeID, EmployeeName, [Branch], [Date] = CAST(AccessTime AS DATE), [InTim...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to do dynamic setmethod data to entity?<p>I would like set many JSON data for object, but I wouldn't like write lot of set method. Example:</p> <pre><co...
<p>There is no need to use reflection at all. You can use magic methods. Specifically, <code>_call()</code>. <a href="https://www.php.net/manual/en/language.oop5.overloading.php#object.call" rel="nofollow noreferrer">Docs</a>.</p> <p>A very simple, naive implementation:</p> <pre><code>class Category { private $d...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Stopping macro expansion<p>I have a problem with macro expansion deferral. Here is an example:</p> <pre><code>#include &lt;stdio.h&gt; #define CONST_ABC 15...
<p>It requires you to have at least a C99 compiler, since C99 allows <em>empty macro arguments</em>. However some compilers may allow them as an extension, even in C89 mode. Here is the code:</p> <pre><code>#include &lt;stdio.h&gt; #define CONST_ABC 15 #define CONST_5 7 #define ABC 5 #define PRINT(x) printf("CONST=%...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Add Multibinding converter as well as content to a button wpf<p>In my wpf project I have:</p> <pre><code>&lt;DataGridTemplateColumn.CellTemplate&gt; &lt...
<p>You added the <code>Style</code> as the value for <code>Button.Content</code> (which will implicitly call <code>object.ToString()</code> on the <code>Style</code> instance, which will return the fully qualified name of the type):</p> <pre><code>&lt;Button&gt; &lt;!-- this is setting the Content property --&gt; ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Exclude posts from get_posts()<p>Good morning, I found many similar questions, but none of the answer fit to my problem. The point is very simple: I have a c...
<p>Try <code>exclude</code>.</p> <pre><code>$args = array( 'posts_per_page' =&gt; 3, 'orderby' =&gt; 'meta_value', 'order' =&gt; 'ASC', 'post_type' =&gt; 'fasthomepress_pt', 'exclude' =&gt; array(get_the_id()), 'meta_query' =&gt; array( ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: AngularJS directive to focus in an input field: why is the call to setTimeout needed to make it work?<p>I have defined an angularjs directive, whose purpose ...
<p>This is a common directive problem, <code>link</code> function runs before the DOM has finished rendering, so the <code>element</code> has not yet a value. The simplest (and probably cleanest) solution is the usage of <code>$timeout</code> that triggers a new digest cycle and ensures that the DOM has rendered. </p> ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to capture the output of pyistaller.__main__.run<p>I came to a point where I just wanted to make an external programm to make .exe's from Pyhton files vi...
<p>So since it seems no one had an answer I want to post the solution I've found out about:</p> <pre><code>import subprocess from tkinter import * from threading import Thread class App(Tk): def __init__(self): Tk.__init__(self) self.rowconfigure(0,weight=1) self.columnconfigure(0,weight=1...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Relative paths from binary file<p>I have the following folder structure:</p> <pre><code>bin/ &lt;-binary-file is in here include/ src/ data/ Makefile </code...
<p>Probably you are asking a wrong question: the build system has nothing to do with program execution.</p> <p>However, if you look for an answer, how to make my program to correctly use data, that is located relative to program installation, than here is an answer.</p> <p>When you program <code>main</code> gets exec...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python performing calculation in a list<p>I have this list<code>[9,4,5]</code> I want to multiply each element by 2 then I sum the result I will get <code>9*...
<p>There is no need to multiply each element by 2; just multiply the whole sum by 2 afterwards.</p> <pre class="lang-py prettyprint-override"><code>&gt;&gt;&gt; data = [9, 4, 5] &gt;&gt;&gt; 2 * sum(data) 36 </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PHP Cronjob to run every minute not working<p>on 1and1 server/ linux i want to run a php file to redirect to a url every minute (using php header)</p> <pre>...
<p>@Alipour, <strong>Please check below points</strong> for CRON Job.</p> <p><strong>1.</strong> Check your file path is appropriate or not.</p> <p><strong>2.</strong> If file path correct, then check file execute or not. (You can check file execution through send an test email or write output in to any text file).</...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why will this script not execute when all the code is in one script tag?<p>I am trying to make a JavaScript version of buttons I initially created in Objecti...
<p>The problem comes in the callback that is being passed to your <code>mousedown</code> event listener.</p> <p><code>document.addEventListener('mousedown', function(e));</code></p> <p><strong>Firstly</strong>, this is incorrect syntax- you're declaring a function without a code block to be executed. <code>function(e...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Karatsuba algorithm - Error in my implementation<p>I'm having trouble to implement the karatsuba algorithm in python. I'm working with lists in base 2 (the M...
<p>The error is this one:</p> <pre><code>f1 = Multiply(s1, pow2(n)) </code></pre> <p>It should be:</p> <pre><code>f1 = Multiply(s1, pow2(2*m)) </code></pre> <p>Indeed, <code>(a1*2^m+a0)*(b1*2^m+b0)=(a1*b1)*2^(2m) + (a0*b1+a1*b0)*2^m + (a0*b0)</code></p> <p>If <code>n &gt; (2*m)</code>, that is for an odd n, then y...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Simplify jQuery Switch Case<p>I'm using JQVMap, and I have my code to where depending on what state you click, it'll reveal info about that state within a si...
<p>I think you can put it in function instead of writing it all. Create statement dynamically</p> <pre><code>function(code){ $('#info-children').children(':not(#info-'+ code +')).hide("slow"); $('#info-children').children('#info-'+ code +').show("slow"); } </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python IndentationError when I try to create a loop<p>I have this section of Python code which works correctly</p> <pre><code> import mss import mss.to...
<p>there should be always an indent after the <code>:</code></p> <pre><code>import mss import mss.tools import datetime import time while count &lt; 100000000: with mss.mss() as sct: monitor = sct.monitors[1] timestr = time.strftime("%Y%m%d-%H%M%S") sct.compression_level = -1 out...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Getting the organization a project belongs to in GCP using go sdk<p>I am listing my projects as follows:</p> <pre class="lang-golang prettyprint-override"><...
<p>The Go SDK allows to retrieve that information through the methods <a href="https://pkg.go.dev/google.golang.org/api/cloudresourcemanager/v1beta1?tab=doc#ProjectsGetAncestryCall" rel="nofollow noreferrer">"ProjectGetAncestryCall"</a> and <a href="https://pkg.go.dev/google.golang.org/api/cloudresourcemanager/v1beta1?...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Concat filepath & filename in Logic App to delete file from SFTP VM<p>Concat filepath &amp; filename in Logic App to delete file from SFTP VM.</p> <p>Using ...
<p>Below is my logic app, you can refer to the screenshot.</p> <p><a href="https://i.stack.imgur.com/uyOcN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uyOcN.png" alt="enter image description here"></a></p> <p>You just need to use "<a href="https://docs.microsoft.com/en-us/connectors/sftpconnect...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Styling HTML Child Lists<p>I was testing <code>list-style-type</code> changes for child lists and noticed something strange happening. When you try and chang...
<p>That's because using <code>li li</code> means a <em>child</em> <code>li</code> of an <code>li</code>. So in this case, that would apply to the second <code>li</code> below:</p> <pre><code>&lt;li&gt; &lt;li&gt;foo&lt;/li&gt; &lt;li&gt; </code></pre> <p>However, in your example, the nested lists are not inside a...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ANTLR4 Grammar only matching first part of parser rule<p>I'm using ANTLR 4 to try and parse task definitions. The task definitions look a little like the fol...
<p>Your <code>STR_EXT</code> consumes the entire input. That rule has to go: ANTLR's lexer will always try to match as much characters as possible.</p> <p>I also see that <code>CONSTANT</code> might consume that entire input. It has to go to, or at least be changed to consume less chars.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to customize custom drawable defined in XML at runtime?<p>I made a custom, multi-layered drawable to act as the background for a button. Sometimes, I wan...
<p>Like this: </p> <pre><code>InsetDrawable drawable = (InsetDrawable) myButton.getBackground(); GradientDrawable shape = (GradientDrawable) drawable.getDrawable(); shape.setColor(Color.BLUE); </code></pre> <blockquote> <p>I made a custom, multi-layered drawable to act as the background for a button.</p> </block...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Change text content with XPath<p>Although I am able to set a text value inside a node with the code below</p> <pre><code>private static void setPhoneNumber(...
<p>The fact that you're using the non-namespace-aware method <code>getElementsByTagName()</code>, passing it an element name containing a colon, suggests that you're not handling namespaces properly when you parse the XML. If your XML were parsed in a namespace-aware manner then this shouldn't have worked, but somethi...