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: Implementing loginform with react issue<p>I'm trying to implement SpringBoot Security's LoginForm and have it talk with my react application. I'm currently f...
<p>At the bottom of the article, they provide a link to <a href="https://github.com/eugenp/tutorials/tree/master/spring-security-modules/spring-security-web-login" rel="nofollow noreferrer">their GitHub project</a> containing all of the code from the article.</p> <p><a href="https://github.com/eugenp/tutorials/blob/6c0...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: make onbeforeunload fire for certain subpages<p>I'm quite new to javascript. I have a simple onbeforeunload function, which currently works for all the page...
<p>"window.location.href" returns the entire <code>URL</code>, use <code>location.pathname</code> instead. Also, make sure to add the path names (including extension) to the <code>pathsToAddTheScript</code> Array.</p> <p>Try this.</p> <pre><code>var pathsToAddTheScript = ['clients', 'products']; if(window.location.p...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SELECT INTO using union of two old tables<p>I am trying to issue a <code>SELECT * INTO &lt;new_table_name&gt; FROM &lt;old_table_name&gt;</code> statement wh...
<p><code>INTO</code> will go immediate after <code>SELECT</code> statement (<code>SELECT . . . INTO</code>) :</p> <pre><code>SELECT * INTO &lt;new_table&gt; FROM &lt;table1&gt; UNION ALL SELECT * FROM &lt;table2&gt; </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Diff and Patch an existing docker image<p>I have a docker image, <code>test:1.0.0</code>, on an external stack in a bandwidth constrained environment. Locall...
<p>At present, there's no way to do anything like this. The contents of a layer are not processed by registries, they are treated as a byte stream, and only the digest of that entire blob is verified for the content addressable store. If one file in a layer changes, or anything else that would change the digest, the en...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Unity 3D - rotating gameobject without rotating axis<p>Hope my title summarises my problem. I have a rocket on a 2d game that only moves horizontally across ...
<p>One thing you can do is to modify <code>rigidbody.rotation</code> of your rocket rocket to make it tilt, when it moves, to one direction or to another. For example:</p> <pre><code>float tilt - 0.3f; //In case you prefer the rotation in another axis you just need to modify the position of the rigidbody.velocity.x * ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Format string dict in dict<p>I want to have define a payload with variables, and the payload contains a dict inside a dict, like so:</p> <pre><code>payload =...
<p>You can do:</p> <pre class="lang-py prettyprint-override"><code>myVar = 123 payload = {&quot;columns&quot;: &quot;{x,y,z}&quot;, &quot;number&quot;: f&quot;{{n:{myVar}}}&quot;} print(payload) </code></pre> <hr /> <p>Or:</p> <pre><code>payload = {&quot;columns&quot;: &quot;{x,y,z}&quot;, &quot;number&quot;: &quot;{n...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why does TensorFlow's documentation call a softmax's input "logits"?<p><a href="https://www.tensorflow.org/api_docs/python/tf/nn/softmax_cross_entropy_with_l...
<p>Logit is nowadays used in ML community for any non-normalised probability distribution (basically anything that gets mapped to a probability distribution by a parameter-less transformation, like sigmoid function for a binary variable or softmax for multinomial one). It is not a strict mathematical term, but gained e...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Columns with height same as other columns<p>I have code that makes columns. In this column I will have text, but text won't be same height, is there a way ma...
<p>You can use <code>Flexbox</code> to do this</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>.container { display: flex; } .col-3 { flex: 1; border: 1px solid black; margin: 5px; }</...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to convert CMSampleBuffer to OpenCV's Mat instance in swift<p>I am working on an OpenCV project where I am taking input from iPhone native camera as <cod...
<p>First, convert CMSampleBuffer To UIImage.</p> <pre><code>extension CMSampleBuffer { func asUIImage()-&gt; UIImage? { guard let imageBuffer: CVPixelBuffer = CMSampleBufferGetImageBuffer(self) else { return nil } let ciImage = CIImage(cvPixelBuffer: imageBuffer) return c...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Does Firefox allow extensions to bypass a normal web page's CSP?<p>I have a web page with a CSP like this: <code> &lt;meta http-equiv="Content-Security-Polic...
<p>Extensions don't care about the page CSP at all. They can run code alongside your code (where they are not bound by the page CSP), or inject arbitrary code in the page JavaScript context.</p> <p>Further, extensions have enough power to override the page CSP on the fly (e.g. by rewriting response headers), but they ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Spring AMQP RabbitMQ - Error Handling for Direct reply-to<p>I am trying to handle exceptions that are resulting from a amq.rabbitmq.reply-to queue specificia...
<p>As discussed in <a href="https://stackoverflow.com/questions/53748079/spring-amqp-rabbitmq-rpc-handle-response-exceptions">Spring AMQP RabbitMQ RPC - Handle response exceptions</a> you need an explicit reply container to handle replies with more sophistication; you can wire an error handler into that container.</p> ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: CXXFLAGS has changed since the previous run when building gdb<p>In my situation, I build gdb with <br> <code>./configure --prefix=/home/vv/Desktop/gdb --enab...
<p>I delete the whole folder. And extract gdb source files again. And configure and make, this time, it works well.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to get live stream from a webpage<p>I want to add a live stream to my site. Is it possible?</p> <p>The source: <a href="https://istanbuluseyret.ibb.gov.t...
<p>You cannot use M3U8 files in a <code>&lt;video&gt;</code> tag.</p> <p>To play the video you must read the M3U8 (text) file and pass the inside links to the <code>&lt;video&gt;</code> tag using a <strong>buffer</strong>, so this means using <strong>MediaSource Extensions</strong> (MSE) method. There are tutorials onl...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to store vars in context. Cucumber, groovy<p>I want to save several variables for 1 scenario like have a scope for several steps. For example, if I have ...
<p>That's where cucumber-spring comes to the rescue. You can create A <code>State</code> class, mark it with <code>@Component</code> and inject in any StepDefs classes. So the <code>State</code> class will contain shared state that may be used in any scenario. </p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to determine an inverse relationship of a to-one relationship using Realm?<p>Is it possible in Realm to obtain the inverse relation of a to-one relations...
<p>The <code>LinkingObjects</code> object has to be a property of your model object for Realm to know what object it goes with:</p> <pre><code>class Person: Object { dynamic var name: String? let _dogs = LinkingObjects(fromType: Dog.self, property: "owner") var dog: Dog? { return _dogs.first } } </code></p...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: RewriteRule with dynamic two parameters and one maybe missing<p>I have Rewriterule with two parameters and its working as it should. But there is sometimes t...
<p>You can make trailing hyphen optional in your first rule as:</p> <pre><code>RewriteRule ^(\d+)-?/?$ ./index.php?firma=$1 [L,QSA] RewriteRule ^(\d+)-(.+)/?$ ./index.php?firma=$1&amp;nimi=$2 [L,QSA] </code></pre> <p>It is suggested to use <code>QSA</code> flag (Query String Append) when rewriting query string in yo...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SpreadsheetGear Excel using EPPLUS/NPOI not readable<p>Have anyone comes across this? I receive file from client which is generated through SpreadsheetGear. ...
<p>It could be that EPPlus depends on certain cell address-related attributes that are marked as "Optional" in the Open XML file format, but which SpreadsheetGear does not write out by default, in order to reduce the size of the file.</p> <p>If you have access the SpreadsheetGear application that is generating these f...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Angular data binding - data changed in service also<p>Hope someone can help me understand this behavior in Angular. </p> <p>There is a simple input bound to...
<p>The problem is with this part of code. </p> <pre><code>ngOnInit() { this.employee = this.service.getEmp(); } </code></pre> <p>In JavaScript, variables only hold a reference to the object, not the object itself. Thus <code>this.employee</code> have a reference to <code>this.service.getEmp();</code></p...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Equivalent of `exclusion` in sequel<p>What is the Sequel equivalent of "exclusion"?</p> <p>For a simple example, in Active Record:</p> <pre><code>validates...
<p>Sequel doesn't provide the exclusion helper by default, but you could customize it yourself.</p> <pre><code>class Host &lt; Sequel::Model def validate super errors.add(:subdomain, "#{subdomain} is reserved.") if %w(www us ca jp).include?(subdomain) end end </code></pre> <p>See "<a href="https://github....
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to spy on window.location functions?<p>i need to cover my code with some unit tests and in one of then i have the following situation.</p> <p>app.tsx</p>...
<p>One way to test it is:</p> <p>Create a mock function to <code>location.replace</code>:</p> <pre><code>const replaceMock = jest.fn(); </code></pre> <p>And spyOn <code>window</code>, replacing location object and setting the <code>replaceMock</code> to replace.</p> <p>Complete test example:</p> <pre class="lang-js pre...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Xamarin Binding Grid to ViewModel<p>Is there any way to bind the properties of a grid (rowdefinitions, columndefintions, rowspacing, columnspacing, etc.) to ...
<p>It always help to look at the source code: <a href="https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Core/Grid.cs#L20" rel="nofollow noreferrer">https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Core/Grid.cs#L20</a></p> <p>So it does look like rowdefinitions, columndefintions, row...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Jenkins declarative pipeline: What workspace is associated with a stage when the agent is set only for the pipeline?<p>Here is an example of declarative pipe...
<p>The Pipeline code presented should only create a single workspace and run all stages in it. Unless you create a new <code>agent</code> directive in any of your <code>stages</code> it will not utilize another node or workspace.</p> <p>btw, <code>checkout scm</code> happens automatically at the beginning of the Pipel...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How many CuratorFramework must be created within a large scale project?<p>We're creating large-scale projects. spring-boot project which uses curator to inte...
<p>As noted on Curator's website - <a href="http://curator.apache.org/curator-framework/index.html" rel="noreferrer">http://curator.apache.org/curator-framework/index.html</a> - "CuratorFramework instances are fully thread-safe. You should share one CuratorFramework per ZooKeeper cluster in your application."</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How should I join to achieve this<p>I am in kind of situation where I don't know where to go. I have to write a query such that it is kind of hierarchical. <...
<p>It can be done easily using several <code>LEFT JOINS</code> on different criteria:</p> <pre><code>DECLARE @Countries TABLE ( [Country] VARCHAR(12) ,[State] VARCHAR(16) ,[City] VARCHAR(16) ); INSERT INTO @Countries ([Country], [State], [City]) VALUES ('India', 'Punjab', 'Amristar') ,('India', 'Punja...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Neural Network Architectures that add layers based on complexity?<p>I'm searching for existing work on Neural Net architectures that grow based on need or co...
<p>An example of this is called neuro-evolution. What you could do is combine backprop with evolution to find the optimal structure for your dataset. <a href="https://github.com/wagenaartje/neataptic" rel="nofollow noreferrer">Neataptic</a> is one of the NN libraries which offers neuro-evolution. With some simple codin...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Recognizing and getting value(s) from pre-defined sentences using PHP (Regex?)<p>Using PHP I would like to recognize pre-defined sentences in a string, and o...
<p>Yes, use regular expressions, via <a href="http://php.net/manual/en/function.preg-match.php" rel="nofollow noreferrer">preg_match</a>:</p> <pre><code>$input = 'where is the airport heathrow located?'; $templates = [ '/where is the airport (.*) located\?/i', '/how many airports are there in (.*)\?/i', '...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Validate current_user if it is already in DB<p>I can't get validation error to be displayed, only IntegrityError from SQLAlchemy</p> <p><em>(sqlalchemy.exc.I...
<p>I don't see the error. You could add a <code>print (user)</code> in the validation function to see what's in there.</p> <p>Anyway this is still open to a race condition: if the same user books in another request between the check (&quot;validation&quot;)and the commit. As a general rule, I'd rather try to commit and...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What python data structure can easily add new variables on the fly?<p>I'm trying to iteratively capture data on a fixed list of items but the data fields/att...
<p>Try using a multi-dimensional dictionary. These are formatted as</p> <pre><code>dict2d = { &quot;Person1&quot;:{&quot;Height&quot;: &quot;168cm&quot;, &quot;Eyes&quot;: &quot;Brown&quot;} &quot;Person2&quot;:{&quot;Height&quot;: &quot;155cm&quot;, &quot;Occupation&quot;: &quot;Teacher&quot;} &quot;Person3&quot;:{&qu...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: image.Mat in EmguCV is always in BGR format?<p>My code is all done thinking that the input <code>Mat</code> is in BGR format, so I am wondering if given an <...
<p>Just checked the behaviour of EmguCV creating an <code>Image</code> object, and the <code>.Mat</code> property has the same representation as the <code>Image</code> object, meaning that could be BGR or RGB.</p> <p>I filled two vectors of size 750000 (500x500x3), this is what I've done:</p> <pre><code>byte[] rgbChar ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Specifying Conditions on Multiple Nested Eager Loaded Associations<p>I'm trying to query on ActiveRecord multiple nested eager loaded associations with condi...
<p><code>includes</code> eager loads association records, while <code>joins</code> does what you want to do. </p> <p>This question has been asked here numerous times. Please make sure that you look and try to find a similar question here before you ask one. </p> <p>So you want to change your code like this:</p> <p><...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PHP iterate multi dimensional array with missing rows<p>Suppose I have 2d array, where only some rows actually have some values in the columns, whereas other...
<p>You can effectively use <code>foreach</code> in this case:</p> <pre><code>foreach($array as $s =&gt; $arrayElement) { for($t=0; $t&lt;6; $t++) if ($arrayElement[$t] == 10) { // do something - $s is the row index, $t is the column index } } </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Save cropped image in SQL<p>I would like to save an photo in my SQL database, in a BLOB field. Now I'm doing it saving a byte array, but too much effort for ...
<p>Try this</p> <pre><code> private void selectImage() { final CharSequence[] options = { "Take Photo", "Choose from Gallery","Cancel" }; AlertDialog.Builder builder = new AlertDialog.Builder(ProfileSettings.this); builder.setTitle("Profile Picture!"); builder.setItems(options, new Di...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Parse JSON string inside another JSON<p>I have some JSON that contains another JSON object inside <strong>in a form of a string</strong> (note quotes around ...
<p>The error is saying that the whole JSON isn't valid, not just the <code>jsonString</code> value.</p> <p>While it's true that (you can test it in online validator like <a href="https://jsonlint.com" rel="nofollow noreferrer">JSONLint</a> for instance):</p> <pre><code>{ &quot;jsonString&quot;: &quot;{\&quot;someKe...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is it possible to user PowerBI to create a table using data from an excel spreadsheet?<p>Here's my scenario</p> <p>I have a spreadsheet that is stored on a s...
<p>This is a solution that works with OneDrive. Not sure where you shared data resides??</p> <p>Yes, I am doing this currently from OneDrive. I can be kinda a pain in the butt to get this working. Go to your OneDive speadsheet and open it in excel desktop (Open in app). Then do File, Info, copy path. For example,</...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why does free() of a struct result in segfault (wrong usage of pointers)?<p>When I try to free my struct, the program crashes because of a segfault. Inspecti...
<p>There never was a hashtable to begin with. The issue lies in <code>initHashTable</code>. It should be accepting a double pointer since it is given a pointer to a pointer it should initialize. The reason it can segfault despite the check in <code>destroyHashTable</code> is that the pointer is left uninitialized and m...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to change my statement to print frequencies of object member type in hashmap?<p>I created an arrayList of student objects with various attributes. Among ...
<p>Essentially what you're doing is called "grouping" based on the favourite color.</p> <p>Here is another approach:</p> <pre><code> Map&lt;String, Integer&gt; result = studentList.stream() .collect(toMap(Student::getFavouriteColor, s -&gt; 1, Math::addExact)); </code></pre> <p>This use...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Passing props to Vue.js components instantiated by Vue-router<p>Suppose I have a Vue.js component like this:</p> <pre><code>var Bar = Vue.extend({ props...
<pre><code>&lt;router-view :some-value-to-pass="localValue"&gt;&lt;/router-view&gt; </code></pre> <p>and in your components just add prop:</p> <pre><code>props: { someValueToPass: String }, </code></pre> <p>vue-router will match prop in component</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: rolling most recent index where a value ocurred<p>I have a dataframe</p> <pre><code>pd.DataFrame([1,2,3,4,1,2,3]) 0 0 1 1 2 2 3 3 4 4 1 5 2 6...
<p>Using a mask on the index and <code>ffill</code>:</p> <pre><code>df = pd.DataFrame({'data': [1,2,3,4,1,2,3]}) df['new'] = (df.index.to_series() .where(df['data'].eq(1)) .ffill(downcast='infer') ) </code></pre> <p>Output:</p> <pre><code> data new 0 1 0 1 2 ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Change style in react child componnet from event in parent componnet<p>I have a react component wihch contains two child components, In the parent component ...
<p>Pass on the style as prop to the child component and then use it there like</p> <p>Parent: </p> <pre><code> &lt;HTML HTMLstyle={this.state.HTMLstyle}/&gt; </code></pre> <p>Now in child</p> <pre><code>var HTML = React.createClass({ componentWillMount: function(){ this.setState({HTMLstyle: this.props.HTMLsty...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Placing a repeater inside an AjaxToolKit Accordion<p>I am trying to use a repeater inside an AjaxToolKit Accordion. This is necessary because I need paginati...
<p>I found the solution. Place the repeater inside separate content tags and within the accordion's content tags. Also, no need to call the repeater by an outside repeater through code behind as stated above. I removed the outside repeater. It's working now.</p> <pre><code>&lt;content&gt;repeater goes here&lt;/content...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why can't I locate this element?<p>I am planning on web scraping GPU stock data from NVIDIA however when trying to load the full page by clicking on the load...
<p>The call to find the element is executed before it is present on the page. Take a look at the wait timeout <a href="https://selenium-python.readthedocs.io/waits.html" rel="nofollow noreferrer">documentation</a>. Here is an example from the docs</p> <pre><code>from selenium import webdriver from selenium.webdriver.co...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to import an interface in external ngModule library<p>I'm new on angular 4<br> I created a ngModule package named <code>mds.angular.bootstrap.datetimepic...
<p>Finally, I found the solution:</p> <p><strong>First:</strong> Creating <code>index.ts</code> (I named it index, you can change the name) and write <code>export</code> for each type we want to use in external libraries.</p> <pre><code>export * from "./mds-datetimePicker.module"; export * from "./services/mds-dateti...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Read shapefile with Tkinter produce error<p>I'm trying to load and read shapefile via Tkinter and tkFileDialog.</p> <p>Following code shows what done .</p> ...
<p><strong>Short answer:</strong> try:</p> <pre><code>arenafile_tk = tkFileDialog.askopenfilename() </code></pre> <p>instead of:</p> <pre><code>arenafile_tk = tkFileDialog.askopenfile() </code></pre> <p>and adjust the arguments accordingly.</p> <p><strong>Long answer:</strong> A shapefile consists of multiple fil...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Controller doesn't seem to be registered<p>I'm attempting to get <code>ngRoute</code> to work for the first time by myself.</p> <p>However I'm hitting a <co...
<p>when binding controllers to <code>routes</code>, there is no need for the file path. refer the below example:</p> <pre><code> $routeProvider.when("/", { controller: "homeController", controllerAs: "vm", templateUrl: "../../app/home/home.html" }); $routePro...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Should templates, views, and models go in the Django config app?<p>Is it considered against Django "best practices" to place templates, views, or models insi...
<blockquote> <p>There’s no restriction that a project package can’t also be considered an application and have models, etc. (which would require adding it to INSTALLED_APPS).</p> </blockquote> <p><a href="https://docs.djangoproject.com/en/1.11/ref/applications/" rel="nofollow noreferrer">https://docs.djangoproje...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Laravel how to validate if exists and belong to user<p>I need to check if the shift_id in the request exists in the database, which can be done by the follow...
<p>You can use inline validation by adding the name and value of the column after your first column check Like,</p> <pre><code>'shift_id' =&gt; 'required|exists:shifts,id,user_id,'.auth()-&gt;user()-&gt;id, </code></pre> <p>And If you would like to customize the query executed by the validation rule, you may use the Ru...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: C++ crashing:push_back on nested vectors<pre><code>#include &lt;iostream&gt; #include &lt;vector&gt; using namespace std; struct Neighbor { int index; ...
<p>When <code>graph[0].push_back(Neighbor(1, 5));</code>, <code>graph</code> is still empty, it has no elements and <code>graph[0]</code> leads to UB.</p> <p>You should add elements firstly, like:</p> <pre><code>graph.push_back(vector&lt;Neighbor&gt;()); // add one element ... </code></pre> <p>or</p> <pre><code>vec...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Maximum setlocal recursion level reached & endlocal. Workaround?<p>I have a block of code that is being executed anywhere from 0-100,000 times. The problemat...
<p>Keep <a href="http://ss64.com/nt/setlocal.html" rel="nofollow">Delayed Expansion</a> disabled using <a href="http://ss64.com/nt/call.html" rel="nofollow"><code>call</code> command</a> as follows:</p> <pre><code>@ECHO OFF SETLOCAL EnableExtensions DisableDelayedExpansion FOR /R %%f IN (*.*) DO ( SET "FILES_TEMP=%%...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do you update database when using composer/jenkins and wordpress with plugins?<p>I am trying to get wordpress and all plugins managed by composer. I have...
<p>So I used the following to create my solution</p> <p><a href="https://roots.io/using-composer-with-wordpress/" rel="nofollow noreferrer">https://roots.io/using-composer-with-wordpress/</a></p> <p>and</p> <p><a href="https://roots.io/wordpress-plugins-with-composer/" rel="nofollow noreferrer">https://roots.io/wordpre...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do you define constants in the MIPS assembly language?<p>I looked online, but the only thing I was able to find was this syntax <code>PI = 3.1415</code>,...
<p>What you want is a substitution macro. MIPS is an instruction set, it doesn't define much beside the instructions themselves. Instructions sets usually don't have a concept of named constants like higher level languages do. Substitution macros are implemented by the assembler, so you need to check your assembler doc...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Error in tuneRF in R in if (n == 0) stop("data (x) has 0 rows") : argument is of length zero<p>I would like to optimize the values of hyperparameters of <cod...
<p>There were a couple of issues,</p> <pre><code>bestmtry &lt;- tuneRF(train[, V2:V9], train$V1, stepFactor = 1.5, improve = 1e-5, ntree = 500) </code></pre> <p>works.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Variable size of container in flutter? Either width or height<p>I am currently developing my first flutter-application and I need some help with my onboardin...
<p>Did you try wrapping your Column or Container in an Expanded widget?</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Import CSV into Database using Pymysql Python 3<p>I couldn't understand while file is not considered by the interpreter</p> <pre><code>csv_data = csv.reader...
<p>I assume you are suing Python 3. If you are using Python 3. <code>File()</code> is not availabe instead use <code>open()</code></p> <pre><code>import csv with open('yourfile.csv') as csv_file: do you code </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I prevent this repetition of results when merge sorting an array of strings?<p>I have written a merge sort algorithm which sorts an array containing ...
<p>I suspect the problem is in the <code>flattenArray</code> method that you haven't shown. I couldn't see any obvious problems in your code so I ran it but replaced the references to <code>flatArray</code> to <code>actualArray</code> and it worked exactly as you'd expect. Try breaking with your debugger after the arra...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: htaccess with 301 redirection<p>I want to do a simple redirection 301</p> <p>I want to redirect this uri <a href="http://www.blabla.com/test" rel="nofollow...
<p>Try with redirect match with end <code>$</code> anchor.</p> <pre><code>RedirectMatch 301 /test$ http://www.blabla.com/azerty </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PHP: mktime() parse error invalid numeric literal<p>I need to set variable, let's call it <code>$times</code> to specific amount of 8AM. I tried using <code>...
<p>Just remove the leading zeros.</p> <pre><code>mktime(8, 0); </code></pre> <p>It's because PHP is interpreting <code>08</code> as an octal number, and 8 is out of range in octal (0-7).</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: MongoDB best optimisation on embedded documents using index<p>In MondoDB, how can you optimize better a collection with embedded documents using index, if yo...
<p>for given query proposal number 3</p> <blockquote> <p>db.collection.createIndex({"address.city ":1, "address.street":1})</p> </blockquote> <p>will do the job as there is logical relation city=> street</p> <p>if you need to get more precise output how mongo uses index and perform your own test use query.explain(...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why use AddScoped() instead of AddSingleton()?<p>Why I should use <code>AddScoped()</code> for my repositories or services? Why not <code>AddSingleton()</cod...
<p>As you said, you know the difference so I won't get into that.</p> <p>The reason you don't want addSingleton for your repositories or services is because typically your repositories and services are considered &quot;business logic&quot; and &quot;persistence logic&quot;. And in your business logic you might have som...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: No video output by WebChimera and wcjs-prebuilt on Ubuntu 16.04<p>WebChimera is not supported Linux officially, But I have used that on a Ubuntu 16.04 by upg...
<p>Updating VLC to 2.2.4 and upper resolved my problem.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Adding an li element with text component on click with javascript<p>This is what I've done so far - but I also need to handle and empty comment, clear the fi...
<p>Take a look to this code <a href="https://plnkr.co/edit/Gng86q8SY6ItyTvlVzIK?p=preview" rel="nofollow">working example</a>, basically you have syntax error:</p> <blockquote> <p>change all ocurrencies of getElementByID for getElementById</p> </blockquote> <pre><code>document.getElementByID('postComment'); </code>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a way I run this script?<p>I have a large dataset that I intend generating a sample of 10% from it to run my machine learning model 20 times. To tes...
<p>Here is the loop corrected and tested.</p> <pre class="lang-r prettyprint-override"><code>suppressPackageStartupMessages({ library(randomForest) library(caret) }) set.seed(2022) part &lt;- sample(1:150, size = 100, replace = FALSE) training &lt;- iris[part,] testing &lt;- iris[-part,] ## using a loop result &...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Array - PHP - implementing values<p>I wrote a function that retruns this array data.. (Symfony)</p> <pre><code>"data": [ { "1": "2" }, {...
<p>Use array_combine </p> <pre><code>$days = ['Sun', 'Mon', 'Tue']; $arr = ['2', '10', '4']; $combineArray = array_combine($days, $arr); </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to achieve this motion blur shader effect?<p>I tried to create the snow effect like the one on the bottom page of this link <a href="http://blog.edankwan...
<p>In snippet code you treat variable <code>speed</code> differently in your update loop and in vertex shader.</p> <ol> <li>Update: <code>uniforms.u_time.value += conf.speed * 0.003</code></li> <li>Shader usage: <code>float prevRatio = mod(u_time - u_speed - indexRatio * 3.0, thershold);</code></li> </ol> <p>You'll g...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PowerShell: get-adgroupmember and ignore ForeignSecurityPrincipals account<p>The objective is to get the group members and ignore the ForeignSecurityPrincipa...
<p>You should be able to get the members of the group by using getting the members attribute and looking up those distinguishednames. Like this:</p> <pre><code>Get-ADGroup -Identity zzapsdba_c -Properties Members -Server nw | Select-Object -ExpandProperty Members | Get-ADObject -Server nw </code></pre> <p>I tend to u...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: jquery, js. custom text color<p>How can i change the color of the text inside input box to different color. eg. text to green, red, purple etc.. I planned to...
<p>I made a small demo based on your requirements. You can read the comments in the code.</p> <p>Something like this:</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>(functio...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Express Passport Session not working<p>I'm building a Node application in which the users must register or login, then when they drag and drop some elements ...
<p>You need the <a href="https://github.com/expressjs/session" rel="noreferrer">express session middleware</a> before calling <code>passport.session()</code>. Read the <a href="http://passportjs.org/docs/configure" rel="noreferrer">passportjs configuration section</a> on documentation for more info.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Difference between static function and singleton class in swift<p>I want to create a class where all utility methods will be kept and these methods will be u...
<p>Sure this sounds confusing and can be debated. However, from the best practices i can put some suggestions. </p> <p><strong>Singleton</strong> is usually used to create a resource intensive and one timer initialisation for instance: a database connector, login handler and such. </p> <p><strong>Utility class</stron...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How create bar chart with 2d data bars with different scale axis<p>I would like to create graph like this:</p> <p><a href="https://i.stack.imgur.com/AKFH4.jp...
<p>You could plot it by combining two plots, which seems to be what the provided output is doing:</p> <pre><code># dummy data x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] y = [10000, 200000, 30000, 40000, 50000, 60000, 70000, 80000, 90000, 100000, 100001, 12000] y2 = [1, 2, 45, 4, 5, 6, 2, 8, 9, 10, 11, 1] fig = plt.fi...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Insert column specific NaN and drop rows depending on value<p>I have performed several hypothetical tests on insects. I want to drop rows with low <strong>re...
<p>I think you can use:</p> <pre><code>#add NaN by condition df.loc[df.result_1 &lt; 10, ['result_1','result_2']] = np.nan #drop duplicated by column insect df[df.result_1.isnull()] = df[df.result_1.isnull()].drop_duplicates(subset='insect') df = df.dropna(how='all') print (df) test insect result_1 result_2 0 ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Spring Repository is null despite being autowired<p>I'm trying to create a user login system for an application. This login system works by allowing a user t...
<p>The problem in your code is here:</p> <pre class="lang-java prettyprint-override"><code>private UserService userService = new UserService(); </code></pre> <p>You expect that the object will be created by the container through dependency injection, but instead, you create it manually. It does not work like that.</p> ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: The button expand is displayed on the page, despite the fact that it should be hidden before clicking on the button itself<pre><code> &lt;head&gt; ...
<p>Your CSS makes use of a <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Class_selectors" rel="nofollow noreferrer"><strong>class</strong> selector</a> (<code>.b1</code>) when you're looking for an <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/ID_selectors" rel="nofollow noreferrer"><strong>ID</...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Get the all values of "a" tags<p>I make a mini-project to reach a better level but I stuck here. Here is my code:</p> <pre><code>from bs4 import BeautifulSou...
<p>To get all <code>&lt;a&gt;</code> tags under tag with <code>class=&quot;liste&quot;</code> you can use CSS selector <code>&quot;.liste a&quot;</code>. For example:</p> <pre class="lang-py prettyprint-override"><code>import requests from bs4 import BeautifulSoup html_from = requests.get(&quot;http://www.muhfak.hacet...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Validate last letters of input field in Rails<p>How would I validate the last letters of a link which is posted into my model?</p> <p>Example:</p> <pre><co...
<p>You can use something like this</p> <pre><code>validates :link, presence: true, format: { with: /.(mp3|ogv|wav)\z/} </code></pre> <p>where you have a dot <code>.</code> and after one of the valid extensions <code>(mp3|ogv|wav)</code>, just at the end of the line <code>\z</code></p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Snowflake Timezone<p>I am having a small doubt regarding time zone in snowflake Like different region contains different default time zone or it is the same ...
<p>Default timezone is set to America/Los_Angeles irrespective where the account is located.</p> <p>Documentation is <a href="https://docs.snowflake.com/en/sql-reference/parameters.html#timezone" rel="nofollow noreferrer">here</a></p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Selenium/VBA/Javascript: Trigger Mouse Event<p>I have some Webdriver (java) code that I am looking to translate to VBA. The code is as follows:</p> <pre><co...
<p>I was able to figure it out:</p> <pre><code> JsTest = "document.getElementById('autoAssocitionForm:categoryDetailCombinationId:23').checked = true;" Set Pos = bot.FindElementById("autoAssocitionForm:categoryDetailCombinationId:23") Pos.ExecuteScript (JsTest) </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to extract only one element per tag with scrapy?<p>I am trying to extract text from the page tag <code>&lt;dd&gt;&lt;/dd&gt;</code> with this command in ...
<p>You could use:</p> <pre><code>[w.xpath('string()').extract_first().strip() for w in response.xpath('//ul[@class="attribute-list"]/li/dl/dd')] </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: excel365 - Conditionally format rows based on two string values?<p>Excel noob here. Lets say I have a sheet.</p> <div class="s-table-container"> <table class...
<p>Your observed behaviour is because of the commonality between rules 2 &amp; 3, i.e. if C2 differs from D2 then it is, superficially, because the content of those cells differ but, if one of the cells is blank, when the other isn't, then both rules 2 &amp; 3 are satisfied <em>simultaneously</em>.</p> <p>In the screen...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Match two dataframes columnwise and extract values from another column in a particular order<p>I have two <code>dataframe</code>s that look like this</p> <p...
<p>If duplicates in <code>df2['fileName']</code> then create <a href="http://pandas.pydata.org/pandas-docs/stable/categorical.html" rel="nofollow noreferrer"><code>ordered categorical</code></a> column, sorting and select <code>Value</code>:</p> <pre><code>print (df2) fileName Value 0 file3 0 1 file2 ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: display a value only if none of the dependent values are nul<img src="https://i.stack.imgur.com/rFXwJ.png"> <p>I am quite new to SQL and would need some sugg...
<p>There are many ways to skin this cat but this should return you all the A2 rows:</p> <pre><code>select * from yourTable d where d.col1 in (select col1 from (select col1 ,sum(case when col3 is null then 1 else 0 end) null_values from yourTable ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Bokeh HoverTool datetime formatter not working<p>My code for the bokeh HoverTool is the following:</p> <pre><code>p = figure( plot_height=250, ...
<p>Your solution works, if you use <code>$x</code> instead of <code>@x</code> and add one of the listed formats supported by the <a href="https://docs.bokeh.org/en/latest/docs/reference/models/formatters.html#datetimetickformatter" rel="nofollow noreferrer"><code>DatetimeTickFormatter</code></a> to <code>('Date', '$x')...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What would be the appropriate syntax for clicking the "send to" drop down menu? (See image for reference)<p>I would like to know what the best syntax would b...
<p>Try an <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors" rel="nofollow noreferrer">attribute = value</a> CSS selector to target the element by an attribute and its value.</p> <pre><code>IE.document.querySelector("[sourcecontent='send_to_menu']").click </code></pre> <p>Make sure you hav...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Merge multiple arrays in object<p>I'm looking at an efficient way to merge multiple array props in an object.</p> <p>The object, can have multiple array prop...
<p>You can get an array of arrays using <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_objects/Object/values" rel="nofollow noreferrer"><code>Object.values()</code></a>, and then flatten them to a single array using <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: bash subshell command execution order with su<p>Normally I expect bash to execute commands in order when separated by a semicolon</p> <p>eg, cmd1 executes b...
<pre><code>$ echo "hello $(echo world)" hello world </code></pre> <p><code>$( ... )</code> runs the command inside and substitutes the collected output, i.e. the command above ends up running <code>echo "hello world"</code>.</p> <p>Similarly,</p> <pre><code>sudo -S su -c "echo a 1&gt;&amp;2 ; $(echo b)" </code></pre...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: django - tuple in a template only returning first character?<p>I am trying to access a tuple in a django template but for some reason i am only seeing the fi...
<p>When you iterate over <code>circuit_providers</code> this way:</p> <pre><code>{% for key, tuple in circuit_providers %} ... {% endfor %} </code></pre> <p>You <em>unpack</em> every inner tuple, <code>key</code> is becoming <code>KCOM</code>, <code>tuple</code> is becoming <code>KCOM</code>, then <code>key</code...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to implement multiple CompareTo methods?<p>I have a custom generic array/container and it has a sort method:</p> <pre><code>public void Sort() { for...
<p>You should implement an <code>IComparer&lt;T&gt;</code>. You can then change your sort method to accept it:</p> <pre><code>public class PlayerNameComparer : IComparer&lt;Player&gt; { public int Compare(Player x, Player y) { if (x.Name.CompareTo(y.Name) &lt; 0) return -1; else if ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to put overflowed widgets in the next column in flutter?<p>I have a list of Widgets and I'm representing them in a row. Now the list is quite large so I ...
<p>Use <code>Wrap</code> widget.</p> <pre><code>Wrap( direction: Axis.horizontal, children: tags), </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Change source on audio end [multiple audios] JS & jQuery<pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset="utf-8"&gt; &lt;title&gt;...
<ul> <li>Set your Array outside of your functions,</li> <li>Name your variables and functions in a more descriptive manner</li> <li>You don't necessarily need the <code>source</code> child</li> <li>Suggestion: manipulate in-memory Elements attributes and stuff <strong><em>before</em></strong> appending them to the DOM,...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Add custom data scale to Chart.js<p>I'm using a basic chart in Chart.js - I'd like to know if it would be possible to use a <strong>custom scale</strong> on ...
<p>Check out my question and answer <a href="https://stackoverflow.com/questions/26394207/chartjs-radar-scale-points">HERE</a></p> <p>You need to set the <code>scaleSteps</code>,<code>scaleStepWidth</code> and <code>scaleStartValue</code>. In the above example it is: </p> <pre><code>scaleSteps: 4, scaleStepWidth: 5, ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: raise InvalidIndexError: Filling the columns of one data-frame with another multilevel data-frame<p>I have two data-frames. df1 is multilevel data-frame and ...
<p>A <code>MultiIndex</code> can be indexed with a tuple. Form <code>tuples</code> from <code>df2</code> and slice <code>df1</code>:</p> <pre><code>df1.loc[[tuple(x) for x in df2.values]] step 0 step 1 step 2 step 3 step 4 D1 E1 S1 0.372621 0.211435 0.162299 0.149502 0.104143 S2 0....
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to transfer GET/POST data when using pagination Using Session in PHP<p>This is my code: </p> <pre><code>$tag1 = $_GET['tag1']; $tag2 = $_GET['tag2']; $...
<p>you can pass your get value into your link, be sure that vars are set before</p> <p>try this please </p> <pre><code>echo "&lt;a href='?page=".$pagenumber."&amp;tag1=".$tag1."&amp;tag2=".$tag2."'&gt;".$pagenumber."&lt;/a&gt;"; </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a way to know alle the positions of a certain part of a string?<p>I'm looking for a way to know all the positions of a certain part of a string, so ...
<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>let x = "test" let y = [] for (let i = 0; i &lt; x.length; i++){ if (x[i] == "t") y.push(i) } console.log(y)</code></pre> </div> ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to transform SQL result with complex JSON column containing dots in properties using Azure Data Factory?<p>Using an Azure Data Factory Flow I'm reading d...
<p>The column name with special characters should be included within braces <code>{}</code> in the Azure data factory.</p> <p>Example:</p> <p>To parse the JSON value with dot in the property name, the property name should be used within braces <code>{}</code>.</p> <p><code>({dt.topic} as string)</code></p> <p><a href="...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to get if children exists<p>I have two Entity:</p> <pre><code>/** * @ORM\Entity * @ORM\Table(name="main") */ class Main { /** * @ORM\Id ...
<p>You can use <code>-&gt;where('m.subs IS NOT EMPTY');</code></p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python logger formatting not appearing when output to file<p>I've set my Python program to log output, but although it logs correctly to the console, it does...
<p>You can separately set the <code>Formatter</code> for the <code>RotatingFileHandler</code></p> <pre><code>handler.formatter = logging.Formatter(fmt='%(levelname)s %(asctime)s - %(message)s', datefmt='%d-%b-%y %H:%M:%S') </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Return all results from xpath Dom parse?<p>I want to scrape a website using PHP, Here is the code :</p> <pre><code>&lt;?php $url = 'http://sample.com'; $...
<p>$contents->item($i) is DomElement object. You can print <code>$contents-&gt;item($i)-&gt;nodeValue</code> to get, for example , text of paragraph or in such way <code>$content = $dom-&gt;saveHTML($contents-&gt;item($i))</code> to get outerhtml. </p> <p>But I would prefer such loop</p> <pre><code>$xpath = new DOM...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Ansible/Junos_OS - Return of variable comes unindented<p>so I'm using this simple playbook as an example:</p> <pre><code>- name: Show interfaces junos_com...
<p>You can try one of the formatting filters, e.g. like this:</p> <pre><code>- name: Saving logs to output copy: content: "{{ json_response.stdout | to_nice_json(indent=4) }}" dest: "./output.txt" </code></pre> <p>More details and examples can be found in the <a href="https://docs.ansible.com/ansible/late...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Creating graphs using code from Pari-GP, but using Sage's graphing tools<p>everyone!</p> <p>I know this is probably a dumb question, but I'm having a lot of ...
<p>Let us start with:</p> <pre><code>sage: gp(&quot;test(x, y) = sin(x*y)&quot;) (x,y)-&gt;sin(x*y) sage: gp(&quot;test(1, 1)&quot;) 0.84147098480789650665250232163029899962 sage: type(_) &lt;class 'sage.interfaces.gp.GpElement'&gt; </code></pre> <p>So the printed version of <code>gp(&quot;test(1, 1)&quot;)</code> look...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Multiple toggle clicks calls same AJAX, inconsistent database updates<p>I have several toggles on my page, all using class psettings which allows the trigger...
<p>Your problem happens when multiple requests will be sent to server but their responses won't come back in order. So this what stores on server will not be same as one on the UI.</p> <p>To Solve this issue you can use many techniques but simplest on is that to block that specific UI element till the response received...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Size mismatch for fc.bias and fc.weight in PyTorch<p>I used the transfer learning approach to train a model and saved the best-detected weights. In another s...
<h2>Cause:</h2> <p>You trained a model derived from <code>resnet18</code> in this way:</p> <pre><code>model_ft = models.resnet18(pretrained=True) num_ftrs = model_ft.fc.in_features model_ft.fc = nn.Linear(num_ftrs, 4) </code></pre> <p>That is, you <strong>changed</strong> the last <code>nn.Linear</code> layer to out...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: AWS SageMaker: CapacityError: Unable to provision requested ML compute capacity.<p>We were running two TrainingJob instances of type (1) <em>ml.p3.8xlarge</e...
<p>This message mean SageMaker tried to launch the instance but EC2 was not having enough capacity of this instance hence after waiting for some time(in this case 1 hour) SageMaker gave up and failed the training job.</p> <p>For more information about capacity issue from ec2, please visit: <a href="https://docs.aws.a...