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: How to display an image in a QWeb report?<p>I extended the 'report.external_layout_footer' qweb view to display image.</p> <p>Below is my code in the file r...
<p>Just try this below code and set the image path from your module and run it .</p> <pre class="lang-xml prettyprint-override"><code>&lt;template id="report_footer_custom"inherit_id="report.external_layout_footer"&gt; &lt;xpath expr="//div[@class='footer']" position="replace"&gt; &lt;div class="footer"&gt...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: React: Render children only if condition is true<p>I'm new in React. I'm developing a screen but I have a issue, I don't know how insert the children in the ...
<p>I already solved, first render all the parent divs and after replace the position array with array.splice</p> <pre><code>render() { const array = []; this.state.fillingStations.map((item, index) =&gt; ( array.push(&lt;Parent key={index} title={index + 1} status='' /&gt;), this.state.fillingChildren.map((it, ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: In Django how are user request objects attached to views?<p>When a Django application receives a http request from a browser, what function is responsible fo...
<p><code>request.user</code> is attached by <a href="https://github.com/django/django/blob/dd9cd7923ed62a53e101ce2c3caea37e24d66c0a/django/contrib/auth/middleware.py#L15-L23" rel="nofollow noreferrer"><code>AuthenticationMiddleware</code></a>.</p> <p>Middleware and your view function gets called by <a href="https://gi...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there an equivalant of 'as' for with in knockout.js?<p>In the knockout.js <code>foreach</code> you can use the <code>as</code> parameter to save a value i...
<p>Nope, there is not. You can see how <code>as</code> is implemented in the <a href="https://github.com/knockout/knockout/blob/v3.3.0/src/binding/defaultBindings/foreach.js" rel="nofollow"><code>foreach</code> binding's source code</a> and compare it to the <a href="https://github.com/knockout/knockout/blob/v3.3.0/src...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Symfony2/doctrine insert whi foreign keys<p>In symfony2 when I insert data into to database I receive an exception:</p> <pre><code> An exception occurr...
<p>First of all, it's seems you misunderstood relationship in doctrine2.</p> <pre><code>class ForumPosts { // ... /** * @ORM\ManyToOne(targetEntity="ForumTopics", inversedBy="forum_posts") * @ORM\JoinColumn(name="topic_id", referencedColumnName="id") */ private $topic_id; protected $topi...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Value keeps getting set to None<p>I have a recursive function that calls itself until it gets the correct input. </p> <pre><code>def input_something(prompt ...
<p>Changing the function <code>input_something</code> to:</p> <pre><code>def input_something(prompt = ""): playerInput = input(prompt) if playerInput == "": print("Error: No input") return input_something(prompt) elif not playerInput.isspace(): return playerInput else: ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SwiftUI - How to avoid to refresh a List when a state var from the same struct is modified<p>I have a main view which contains a body with a TabView and each...
<blockquote> <p>At least, is there a way to avoid the list updating animation?</p> </blockquote> <p>The provided code snapshot is not testable, so just on-the-fly... try the following</p> <pre><code>IncidencesView(modalShown: $modalShown.animation(nil)) </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why do I get a java.lang.Exception: No runnable methods exception in this test class?<p>I have implemented the following test class to test my service class ...
<p>@Test annotation is missing in your method.</p> <p>According to me the easiest fix would be adding the same, as mentioned below.</p> <pre><code>@Test public void testCreateExpert(){ Experts expert = new Experts(ObjectId.get(),"Andrea Test", "Software Engineer", Availability.BUSY, Language.C...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Counting concurrent records based on startdate and enddate columns<p>The table structure:</p> <p>StaffingRecords</p> <ul> <li>PersonnelId int</li> <li>Grou...
<p>Here is a solution where I find all of the distinct start and end times, and then query to see how many other people are clocked in at the time. Everytime the answer is less than 4, you know you are understaffed at that time, and presumably until the NEXT start time.</p> <pre><code>with meaningfulDtms(meaningfulTim...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Kendo UI Grid Update - PUT api method not called on create<p>I have a Kendo-UI Grid with an add button in the header. The grid allows editing of episodes of...
<p>Turns out I needed to include a schema definition in my datasource as suggested in the following post I found.</p> <p><a href="https://stackoverflow.com/a/21833949/1691103">https://stackoverflow.com/a/21833949/1691103</a></p> <p>Revised Data Source Code Below</p> <pre><code>var episodeDS = new kendo.data.DataSour...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Weird top margin when using PHP include<p>I am having some weird problem when I use the <code>include '';</code>.</p> <p><strong>The problem is the margin ...
<p>It's been more than 4 years since my last experience with PHP, but I remember having the same problem and text encoding being the reason.</p> <p>Try to open it with <a href="http://notepad-plus-plus.org/" rel="nofollow noreferrer" title="Notepad++">Notepad++</a> and convert to UTF-8 without BOM.</p> <p><a href="ht...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Which things i can put in service in angular Js<p>I have read many articles but still could not find how to put stuff in services.</p> <p>Currently this is ...
<p>The reason to use services is not to avoid the use of <code>.then</code>. In your controller you would use <code>.then</code> like so:</p> <pre><code>objectiveService.getObjectives(filters) .then(function(result) { $scope.gridData = result; }); </code></pre> <p><code>.then</code> is required as the...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Using stbi_write_png, how do you convert a rectangular byte-array of 0s and 1s to a monochrome png file?<p>Using the <a href="https://github.com/nothings/stb...
<p>You need CHANNELS=1 (because it's 1 byte per pixel).</p> <pre><code>stbi_write_png(filename.c_str(), width, height, CHANNELS, bitmap, width * CHANNELS); </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Case insensitive active record query in rails-4<p>Currently I am working on a project in rails 4 in which I have a user-page at example.com/username but it o...
<p>you will have to use something similar to <code>where("username ILIKE ?")</code>. the <code>ILIKE</code> or similar syntax is dependant on your database though.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Create a single query to display the names of all the tables with the following prefixes: V$_, ALL_, USER_<p>this query produces a list of all the tables tha...
<pre><code>SELECT table_name FROM dictionary WHERE table_name LIKE 'V$\_%' ESCAPE '\' OR table_name LIKE 'ALL\_%' ESCAPE '\' OR table_name LIKE 'USER\_%' ESCAPE '\'; </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Bootstrap Date picker<p>Hey this question might have been asked before, however I haven't been able to find a solution.</p> <p>I have two bootstrap date pi...
<p>Ok i figured out how to do it and here i paste my working code.</p> <pre><code>$(document).ready(function() { var nowTemp = new Date(); var end = new Date(); var start; $('#start').datepicker({ startDate: start, endDate: end, autoclose: true }).on('changeDate', function (e){ ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Topshelf: cannot build from sources<p>I try to build topshelf from sources but receive the error:</p> <pre><code> error CS0246: The type or namespace name '...
<p>This project is using Git submodules. Because of that, after cloning, you don't have the full set of required sources yet. You also need to run <code>git submodule init</code> and <code>git submodule update</code>. Or, just <code>git submodule update --init</code>.</p> <p>Or, use <code>git clone --recursive</code> ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SQL tables with boolean variables<p>I am kind of new to SQL using and i am playing with different scenarios. </p> <p>My Example is as follows :</p> <p>Sup...
<p>You can create the table <code>advisory</code> like this:</p> <pre><code>create table advisory ( professor_id char(10), student_id char(10), ISGraduate BOOLEAN default 1, foreign key (professor_id) references professor(net_id), foreign key (student_id, ISGraduate) references student(net_id, ISGraduate),...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Cumulative minimum and maximum by group<p>I'm trying to calculate the range minimum of a dataframe in R. The dataframe looks like this:</p> <pre><code>+----...
<p><strong>[Original answer: dplyr]</strong></p> <p>You can solve this problem by using the <code>dplyr</code> package:</p> <pre><code>library(dplyr) d %&gt;% group_by(Key) %&gt;% mutate(Pmin=cummin(PriceEUR),Pmax=cummax(PriceEUR)) # Key DaysToEvent PriceEUR Pmin Pmax # 1 AAA 120 50 50 50 #...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Eclipse Juno doesn't start - An error has occurred. See the log file [\.metadata\.log.]<p>I am using Eclipse Juno on windows 7 machine.</p> <p>Solution I tr...
<p>Try re_installin Java Runtime Environment(JRE). If the problem keeps, you must change or replace your internal libraries of JAVA. </p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SwiftUI: Redraw after passing dynamic data to content view<p>I have something like below, except I have additional dynamic gestures within "ChildContentView....
<p>I am one month in to SwiftUI, so I don't fully understand why this works. However, setting the variable as a constant "let" passes the view content directly with updates.</p> <p>Change from:</p> <pre><code>struct ChildContentView&lt;Content: View&gt;: View { @State var content: () -&gt; Content var body:...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: running a query and then running a query for each result of that query<p>I am trying to create a query that for a given date range tells me if a person was a...
<p>I like CTEs for readability, and using NOT EXISTS vs OUTER APPLY because it's generally faster, but there are at least 4 or 5 different ways to write this query. Here is one example that shows how to get the absences. I also removed some unneeded code and simplified the query a bit. More comments inline:</p> <pre><...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Return vector of structs by value safe?<p>I read that it is perfectly safe to return a struct by value from a function.</p> <p><a href="https://stackoverflo...
<p>It's safe as long as the <code>mystruct</code> class is properly written, which means it supports copy construction and assignment and/or moving, and proper destruction, with the implied value semantics.</p> <p>Put another way: "returning a vector" thing isn't the hard part here, it's making sure if you've got one...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: regex pattern to match this - start with and end with<pre><code>McDonalds MC Donald's mCDDONALDS m c donaldS MC-DOnald'S </code></pre> <p>Pretty much wan...
<p>You can use this regex:</p> <pre><code>^[mM].*?[sS]$ </code></pre> <p><strong>Explanation:</strong></p> <pre><code>^ # match line start [mM] # match m or M .*? # non-greedy pattern to match 0 or more of any character [sS] # match s or S $ # match line end </code></pre> <p><a href="https://regex101.co...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: html submit button link to next page<pre><code> &lt;a href="main.jsp" &lt;input type="submit" class="fadeIn fourth" id="submit" value="Log In"&gt;&gt; &lt;/...
<p>Agreeing with @pierre, just use the <code>a</code> tag</p> <pre><code> &lt;a href="main.jsp" &lt;input type="submit" class="fadeIn fourth" id="submit" value="Log In"&gt;&gt; &lt;/a&gt; </code></pre> <p>Becomes</p> <pre><code> &lt;a href="main.jsp" class="fadeIn fourth"&gt;Log In&lt;/a&gt; </code></pre> <p>Then ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: OCMock and AVCaptureDeviceInput<p>I'm in the process of updating our test suite from OCMock 2 to OCMock 3 and am running into a few issues. One of the issue ...
<p>You are running into a common issue: only one mock object can mock <em>class</em> methods for a given class. This is is documented in the limitations section (<a href="http://ocmock.org/reference/#limitations" rel="nofollow">http://ocmock.org/reference/#limitations</a>). Currently the last mock created "wins".</p> ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Does .focus() work on elements not present in the DOM on pageload?<p>I have this jQuery code:</p> <pre><code>$('.triggermodal').focus(function(event) { ...
<p>Listen when the modal is <a href="http://foundation.zurb.com/docs/components/reveal.html" rel="nofollow">ready</a>, and then do the focus:</p> <pre><code>$(document).on('opened.fndtn.reveal', '[data-reveal]', function () { if( $(this).id == "myModal" ){ $('.focusme').focus(); } }); </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Google BigQuery - simulate Pandas removeDuplicates() in Google BigQuery SQL<p>Given a Google BigQuery dataset with col_1....col_m, how can you use Google Big...
<p>You can group by all of your columns that you want to remove duplicates from, and use <code>FIRST()</code> of the others. That is, <code>removeDuplicates([col1, col3])</code> would translate to</p> <pre><code>SELECT col1, FIRST(col2) as col2, col3 FROM table GROUP EACH BY col1, col3 </code></pre> <p>Note that in...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Javascript/JQuery Nested if statements not working correctly<p><a href="http://jsfiddle.net/bhyhLctw/" rel="nofollow">JSFiddle</a> demonstrating problem (pre...
<p>Add a <code>slider</code> class (or any other) to each container and link the container with button using <code>data</code> attribute:</p> <p>Button:</p> <pre><code>&lt;button class="serviceButton displayed" data-id="#web-design-slide"&gt;Find Out More!&lt;/button&gt; </code></pre> <p>Container:</p> <pre><code>&...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: box-view , Uploading buffer getting error Unsupported document type<p>view to upload a Buffer to Box. But I have been receiving the following error : </p> <...
<p>Are you actually trying to upload a JPEG image? The View API currently only supports documents and text files (see the full list here: <a href="https://developers.box.com/view/#filetypes" rel="nofollow">https://developers.box.com/view/#filetypes</a>).</p> <p>Otherwise, your code looks fine.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to add fragment in blank activity created in android studio<p>I am trying to add fragment in my main activity which I'd created as blank activity. I actu...
<p>activity blank XML:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/frameLayout" android:layout_width="match_parent" android:layout_height="match_parent"/&gt; </code></pre> <p>Activity Java.</p> <pr...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: C# no implicit fall through in switch statement<p>I am from C++ background. I recently wrote a program that gives information about how many notes of particu...
<p>Dennis_E has the easiest change for you but you can avoid goto and much repetition by using a loop construct :)</p> <p>For example:</p> <pre><code>using System; namespace CurrencyNotes { class Program { static void Main(string[] args) { int amount; int choice; ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What does it mean to 'know' linux, as opposed to other operating systems?<p>I see that this question may appear broad, but it's actually very specific, and s...
<p>You should know</p> <ul> <li>the shell language (and the relevant commands like grep, sed, ...) </li> <li>the most popular package-managers/package-formats and how to use them (deb, rpm, ...)</li> <li>how and where to configure basic system-wide things (e.g. grub, fstab, ...)</li> <li>the basic architecture of linu...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: I Want to get the total of row using mysql query<p>i want to get the total sum of row in one query</p> <pre><code>(SELECT SUM(vatPrivate) AS vatPrivate, SU...
<p>Change </p> <pre><code>SUM(vatPrivate+vatGovernment+vatZero+vatExempt) </code></pre> <p>To</p> <pre><code>COALESCE(SUM(vatPrivate),0) + COALESCE(SUM(vatGovernment),0) +COALESCE(SUM(vatZero),0) + COALESCE(SUM(vatExempt),0) as VatTotal </code></pre> <p><strong>Note</strong>: NULL + Some Value = NULL so if any of t...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Corrupted PDF file after requests.get() with Python<p>I am trying to download a PDF file using requests.get(). It works for most test PDF files I found but f...
<p>Fixing the <strong>header</strong> information makes it work.</p> <pre class="lang-py prettyprint-override"><code>import requests file_url = "http://medianet.edmond-de-rothschild.fr/edram/pdf/kiid_fr0010172767_en_20200120_20200128_1954.pdf" headers = { "User-Agent": "PostmanRuntime/7.20.1", "Accept": "*/*...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: LINQ: Create a Conditional Where Clause in child list<p>I need help to build a "query" using LINQ `where". I'm not getting this alone. </p> <p>I need to cre...
<p>You can use <code>Any</code> function to check if at least one exists with condition</p> <pre class="lang-cs prettyprint-override"><code> Fathers.Where(x =&gt; x.age &gt; 50 &amp;&amp; x.ChildrenGirl.Any(y =&gt; y.ID == 5)); </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: "Downloads" custom post type used for displaying app download links<p>Ok here's the deal I'm creating a custom WP theme for an mobile app. I want to display ...
<p>EDIT: i dont have much experience using the types plugin. But this should run without any issues. </p> <pre><code>&lt;?php $downloads = get_posts(array('post_type'=&gt;'downloads','posts_per_page'=&gt;2, 'order'=&gt;'ASC')); if ($downloads) { foreach ($downloads as $post) { setup_postdata( $post ); ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to calculate 3 month moving mean in R and create a column name for Months?<p>I have a dataframe df</p> <pre><code>str(df) 'data.frame': 396 obs. of ...
<p>Try something like this:</p> <pre class="lang-r prettyprint-override"><code>library(dplyr) #&gt; #&gt; Attaching package: 'dplyr' #&gt; The following objects are masked from 'package:stats': #&gt; #&gt; filter, lag #&gt; The following objects are masked from 'package:base': #&gt; #&gt; intersect, setdiff...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I refactor module name in Go?<p>I have a Go module named <code>mymodule</code>, and I'd like to rename it into <code>github.com/hylowaker/awesome-modu...
<p>This feature is introduced in GoLand version 2021.1.</p> <p>You can invoke the Rename refactoring by pressing <code>Shift+F6</code> on the module name in the <code>go.mod</code> file.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to Get selected option value within PHP page reload<pre><code>&lt;div class="form-group row"&gt; &lt;label for="event_name" class="col-sm-2 col-md-1...
<p>You can do with easily with a session within a form. Just do something at the top like:</p> <pre><code>&lt;?php if (isset($_GET['form'])) { $_SESSION['eName'] = $_GET['event_name']; } ?&gt; &lt;div class="form-group row"&gt; &lt;label for="event_name" class="col-sm-2 col-md-1 col-form-label"&gt;Event Name&...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: There is no implicit conversion between bool and System.DayOfWeek<p>I want to add into a List days if checkboxes are checked so i do the following:</p> <pre...
<p>There is no way of achieving what you want using a collection initializer.</p> <p>Split your code up a bit:</p> <pre><code>List&lt;DayOfWeek&gt; result = null; if (rbDaily.Checked || rbTwoWeeks.Checked) { result = new List&lt;DayOfWeek&gt;(); if (checkboxMon.Checked) result.Add(DayOfWeek.Monday); ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Gradle Kotlin Dsl Build for a Kotlin Gradle Plugin, which depends on a Groovy Class in the same Project<p>I have a Gradle plugin implemented with Kotlin, whi...
<p>I think this is equivalent, though I think it just knocks Java out of the picture, so Groovy/Kotlin/Java buildSrc code won't work...:</p> <pre><code>tasks { val compileJava = named("compileJava", JavaCompile::class).get() val compileKotlin = named("compileKotlin", KotlinCompile::class).get() val compile...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Smart Tables Pagination Wont Work With Server Side Filtering<p>I have a smart table that I am working on in AngularJS. The table uses a custom pipe in order ...
<p>In order to get smart tables to fire the filters off, you have to set the numberofpages on data load. To get the above filter to work simply add:</p> <pre><code>tablestate.pagination.numberOfPages = response.totalPages; </code></pre> <p>Smart Tables seems to require this to be set in order for it to properly bind ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: @value annotation returns me a wrong value<p>When accessing a property with value 7777 @value annotation returns me 20080 </p> <p><strong>code used</strong>...
<p>I think the issue here is that on server there might be an environment variable that could have different value. Spring treats those at highest preference over values defined in property. Check on your server, if there is a environment variable defined with the same name.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Intersystems caché - programmatically create new class<p>Is it possible to write ObjectScript method, which will create new class in namespace and compile it...
<p>Nothing is impossible. Everything in Caché can be created programmatically. And, Classes is not a execution. There are at least two ways to do it: </p> <ul> <li>simple SQL Query <a href="http://docs.intersystems.com/cache20111/csp/docbook/DocBook.UI.Page.cls?KEY=RSQL_createtable" rel="nofollow">CREATE TABLE</a>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: C Xor Encryption (beginner)<p>I found This Code for xor encryption and it works </p> <pre><code>string encryptDecrypt(string toEncrypt) { char key = 'K'...
<blockquote> <p>1- what is the problem in second code?</p> </blockquote> <p>As far as I understand you, you want to encrypt and decrypt a c-string. Strings in C are usually character arrays and terminated with a 0. Also you use the pointer arithmetics wrong here.</p> <p>While:</p> <pre><code>string output = toEncr...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Filter in JQuery<p>I am new to JavaScript. I need to filter (show/hide) lines by chosen option(All - show all rows, Closed - hide all options except Closed, ...
<blockquote> <p>Where am I doing something wrong?</p> </blockquote> <pre><code>$( document ).ready(function() { $('.btn').on('click', '#status-filter', function() { var selectOption = $('#select option:selected').text(); </code></pre> <p>Up until here it looks okay, assuming your <code>&lt;select&gt;</c...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to initialize viewModel using MEF?<p>I have a Module called ModuleMenu. In this module I have a UserControl called MenuView and a Corresponding ViewModel...
<p>You define a <code>DataTemplate</code> as a view for your viewmodel, but don't actually use it.</p> <p>There are many ways to solve your issue using Prism, please refer to <a href="https://msdn.microsoft.com/en-us/library/gg405484(v=pandp.40).aspx#sec17">this topic</a>.</p> <p>You could set the <code>DataContext</...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Get gender of invitable_friends in Facebook SDK<p>I am developing a Facebook application for ladies out there where users can only send invites to other fema...
<p>There is no gender field in the result of <code>invitable_friends</code>, and the ids you get back are not realy ids but invite tokens only.</p> <p>So there is no way to get the gender of friends afaik. Except for friends who authorized your App too. In that case, you can use <code>me/friends?fields=name,gender</co...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: In the AWS Appsync resolver, is it `$util.` or `$utils.`?<p>The AWS Appsync documentation seems to use <code>$util.</code> and <code>$utils.</code> interchan...
<p>Yes, you can do both. It's like ctx and context, they are interchangeable.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: After adding second composite component Error <f:ajax> contains an unknown id<p>I try to use composite components in my application. When i have added first ...
<p>The problem is, that your <code>&lt;h:selectOneMenu id="kladrRegion-dctKladrRegion"&gt;</code> is in another parent component than your <code>&lt;h:commandLink id="searchButton" ...</code>.</p> <p>It will work correctly, if you specify the correct absolute component id (or move your dialog inside the same parent).<...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: GreenSock - after animation links are not clickable in Chrome<p>Have very strange behaviour that is not working only in Google Chrome but works in Firefox. ...
<p>Your problem is not in the greensock animation, it's in cube itself.</p> <p>When you set </p> <pre><code>.cube { -webkit-backface-visibility: hidden; -moz-backface-visibility: hidden; backface-visibility: hidden; } </code></pre> <p>and then rotate the cube 180 deg, the cube itself is hidden.</p> <p...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: makefile - how to exclude file extension suffix from a variable<p>the next makefile receive the file to compile from its command line arg -ARGS. For example ...
<p>The crude way to do what you ask is simply:</p> <pre><code>EXEC := $(basename $(ARGS)) all: Task1 Task1: outputs/output.o gcc -g -m32 -Wall -o $(EXEC) outputs/output.o </code></pre> <p>A better way is:</p> <pre><code>EXEC := $(basename $(ARGS)) all: $(EXEC) $(EXEC): outputs/output.o gcc -g -m32 -Wall -o ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a difference between waiting for a Task and waiting for the Result of a ContinueWith?<p>i.e. Is there any difference between how task 1 and task 2 b...
<p>With <code>t2</code> you are blocking on the continuation of <code>t2</code>. Continuations can run inline as part of task completion or they can run as separate thread-pool work items. This difference is immaterial, though. In all cases one thread will be blocked waiting.</p> <p>Note, that <code>r.Result</code> al...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Collatz Conjecture C++<p>I created this function (see below), that works perfectly; however, I was tasked in changing the function to take a parameter that d...
<p>From the errors OP listed in his comment: </p> <pre><code>error C3861: 'collatztwo': identifier not found </code></pre> <p>When you made your new function, did you include a <a href="http://en.wikipedia.org/wiki/Function_prototype" rel="nofollow">prototype</a> for it before the call site? You have to declare <cod...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: making category link in codeigniter<p>i have a project and i separated items according to their character. For example: Smartphone, Television, Car eg..</p>...
<p>You can create a separate Controller for each category. All the controllers will load the same View and the same Model in the index function with different arguments.</p> <p>Or you can remap the URL with URI Routing.<br> <a href="https://ellislab.com/codeIgniter/user-guide/general/routing.html" rel="nofollow">https...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: send multiple objects to webapi with angularjs<p>I have the following controller in my ASP.NET WebApi Application:</p> <pre><code>[Route("api/PutItem/")] ...
<p>You can not send a complex type along with a primitive type like that to an WebAPI action, you can either send multiple primitive types (Guid's, int's, strings etc.) or a single complex type (<code>Item</code>). If you want to send both, a work around is to use <code>JObject</code>:</p> <pre><code>[HttpPut] public ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Messing with the AutomationId<p>Is it safe to set the AutomationId of a stack layout in xamarin.forms to find elements of a list view? Reason for this: I ha...
<p>AFAIK I would not suggest that since it could cause issues when the Automation framework tries to search this element If that's why you are doing this go ahead otherwise don't.</p> <p>When you read the description for <a href="https://docs.microsoft.com/en-us/dotnet/api/xamarin.forms.element.automationid?view=xamari...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Zxing Android app won't open from website<p>I trying to launch the zxing barecode scanner from website. It used to work 1 or two years ago.</p> <p>Simple co...
<p>Chrome has a new way of handling deeplink: <a href="https://developer.chrome.com/multidevice/android/intents" rel="nofollow noreferrer">https://developer.chrome.com/multidevice/android/intents</a></p> <p>Answered in <a href="https://stackoverflow.com/questions/29189172/google-chrome-does-not-open-application-on-dee...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is the difference between a fabric container and a standalone container?<p>While going through Redhat Fuse ESB documentation , I found mention of fabric...
<p>Fabric containers are real JVMs that are started and controlled by Fabric servers. They are not 'virtual' containers but are real JVM processes.</p> <p>Standalone containers are single JVMs that monitor their "deploy" folder by default to look for artifacts to deploy. You can start a standalone Fuse server by simpl...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Summing factorials in Python<p>I would like to compute sums with factorials using symbolic algebra in python. The simplest version of the problem I can gener...
<p>Using Sympy's own <code>factorial</code> function (instead of the <code>math</code> module's factorial function) could perhaps return what you want.</p> <p>Following your initial setup but omitting <code>from math import factorial</code>, you could then write:</p> <pre><code>&gt;&gt;&gt; from sympy import factoria...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Docker-compose up exited with code 1 but successful docker-compose build<p>When trying to docker-compose up I get errors from the frontend and backend where ...
<p>The setup seems very complicated. My advice for you: Try to reduce the complicated overhead with the certbot as own docker-container.</p> <pre><code>#docker-compose.yml version: '3' services: frontend: build: ./frontend volumes: - ./data/nginx:/etc/nginx/conf.d # no source-code of the fronte...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Private docker registry and high availability<p>We are currently running a private registry on one server hosting all our images on it. If the server crash, ...
<p>There is some <a href="https://github.com/docker/docker-registry/blob/master/ADVANCED.md#high-availability-and-scaling" rel="nofollow">information on this on the docker-registry website</a>. In short, it seems designed to support multiple registries talking to the same data-store so you shouldn't see any problems.</...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Merge many bib tex files into one<p>I have multiple single bibtex files which are like this:</p> <p>first file:</p> <pre><code>@article{DBLP:journals/acces...
<h1>Edited:</h1> <p>I tested the code below and it merges multiple files into one:</p> <p>First, extract all paths to the <code>.bib</code> files (<code>"."</code> if they are in the working directory, <code>"path/to/directory/"</code> or <code>"/absolute/path/to/directory"</code> otherwise:</p> <pre><code>path_to_b...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to set AbsoluteLayout.LayoutBounds by platform?<p>I'm using an absolute layout in my application and I want, for each element in the layout, a specific p...
<p><code>AbsoluteLayout.LayoutBounds="{OnPlatform Android='0,0,1,1', iOS='0,0,.5,.5'}"</code></p> <p>I believe that should work, but i haven't tested it. You just need to use <code>OnPlatform</code> and provide the desired values for each platform you want to cover.</p> <p>Edit: Just tested this. It works.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Swift ios Kanna data returning empty first time in viewDidLoad<p>I am trying to load data from an API into my TableViewController but the first time it loads...
<p>Found it! Use the viewWillAppear (_animated: Bool) method that is called before the view appears on the screen.</p> <pre><code>override func viewWillAppear(_ animated: Bool) { gets() } </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Simultaneously entering into two states when using the statemachine pub package?<p>I have this use-case where I need the state machine to remain in a general...
<p>Not directly, but you could define a nested state-machine that gets started and does its own thing when the parent enters a specific state.</p> <p>In fact, I think it would be easy to add first-class composition of state machines to the library. I will try to address your <a href="https://github.com/renggli/dart-st...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Trying to append a list with immutable list of chars [Python]<p>so I'm trying to append a string of chars to a list, while changing the last char in the list...
<p>The problem is that you are inserting ten references to <em>the same</em> list into your list of lists, and as you modify one of those lists, you are modifying all of them.</p> <p>To fix this, you will have to create a <em>copy</em> of that list at some point in your loop, either before modifying the list, or when ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Team Foundation - can I set it to only allow 1 user to edit?<p>I'm new to Team Foundation and was wondering if it's possible to disallow other people from ed...
<p>Yes, in Visual Studio go to <strong>Team</strong>, <strong>Team Project Settings</strong>, <strong>Source Control...</strong></p> <p>The first option there is Enable multiple check-out.</p> <p>You may also have to disable Local Workspaces if you have them enabled in your Version of TFS.</p> <p>Generally this is n...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Android create folder in internal root directory<p>I need to create a folder in internal memory root directory and create a file inside it, but cannot find t...
<p>You should use <code>getExternalStorageDirectory()</code> and you should ask for write permissions to it.</p> <p>But note <code>getExternalStorageDirectory()</code> was deprecated on android 29, that means you should use <code>getExternalFilesDir()</code>, <code>getExternalCacheDir()</code>, or <code>getExternalMed...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Google Maps API Convert points (stars) to circles with a radius of 1000 feet<p>I'm trying to convert the stars in the below example to circles that have a ra...
<p>1000ft are 304.8 meters, draw a google.maps.Circle with this <code>radius</code> and use the given position as <code>center</code>.</p> <p>To open the infowindow set the position &amp; map-properties (instead of calling the open-method)</p> <pre><code>function createMarker(place) { var circle = new google.maps.C...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to send huge JSON from body inside request? Jmeter<p>I want to test request which is sending JSON using body. How it looks in DevTools:<br> <a href="http...
<p>You can save the JSON into a file like <code>payload.json</code> and store this file in "bin" folder of your JMeter installation. </p> <p>Once done you can load the file in JMeter script via <a href="https://jmeter.apache.org/usermanual/functions.html#__FileToString" rel="nofollow noreferrer">__FileToString() funct...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do i implement ChangeNotifier for a list for working with Provider?<p>I want to implement Provider for my app and after doing some research i found that ...
<p>Todo App is a good example deal with <code>List&lt;Taks&gt;</code> <br> You can reference <a href="https://dev.to/shakib609/create-a-todos-app-with-flutter-and-provider-jdh" rel="noreferrer">https://dev.to/shakib609/create-a-todos-app-with-flutter-and-provider-jdh</a> <br> full example github code <a href="https://g...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Combine data into one single variable laravel php laravel<p>I have three models: <code>Country.php</code>,<code>Category.php</code> and <code>Region.php</cod...
<p>Went for the <code>union</code> query:</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> $opt1 = DB::table('countries') -&gt;select('countries.name'); ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: java printstream image file<p>Is a <code>printstream</code> appropriate for sending image files through a socket? I'm currently doing a homework assignment w...
<p>No, it is never appropriate to treat bytes as text unless you know they are text.</p> <p>Specifically, the InputStreamReader will try to decode your image (which can be treated as a byte array) to a String. Then your PrintStream will try to encode the String back to a byte array.</p> <p>There is no guarantee that ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: document.querySelectorAll(variable class)<p>I just find that document.getElementsByClassName() is not available for IE8. For this reason I want use document....
<p>Use <code>querySelector</code></p> <pre><code>function name(param){ var classValue=param.value; linea = document.querySelector("."+classValue); console.log(linea.length) } </code></pre> <p>Also IE8 does not allow CSS class to begin with a digit.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Query on Wordpress database returns invalid categories for a post<p>I'm trying to get the categories assigned to a post in the WordPress database via the fol...
<p>Looking at a query I have to do something similar (not near a database to confirm), my joins are like this:</p> <pre><code> FROM wp_posts p LEFT JOIN wp_term_relationships tr ON p.ID = tr.object_id LEFT JOIN wp_term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id LEFT JOIN wp_terms t ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Ember / browser refresh button / reload entire site / resetting everything. How to override that behavior?<p>Apparently when you hit the refresh button, the ...
<p>It's not too difficult to keep the state of your app on browser refresh. I chose to store an auth token, user id, and user role in cookies. Here is an Auth Manager object that can be used to manage the client side of user authentication.</p> <p><a href="https://gist.github.com/javascriptcowboy/73410b6b00c8c374401e"...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: images not scaling with CSS<p>i have the following code bellow and the images is currently not scaling to fit. it only changes if if rezise it in for example...
<p>You can use something like this;</p> <pre><code>.intro { width:100%; position:relative; background-image: url(../img/bg1.jpg); background-position: top center; background-repeat: no-repeat; background-size: 100% 100%; } </code></pre> <p>Or use a keyword for background-size which will behav...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Multiple UIButtons only one can be selected - subclass in swift<p>I have written a subclass that selects and deselects buttons. I have put this subclass on a...
<p>Rather than using tag (which I think is quite an ugly solution) I would be inclined to add a property to your class which keeps a reference of the previously selected button. This solution would be much more elegant - Or you could use <code>UINotificationCenter</code> to broadcast a message to all buttons to initiat...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Running multiple Java classes<p>I am trying to run a code with multiple Java class files and a jar file which is from a library I downloaded. I compiled them...
<p>You need to add the <em>classpath</em> while executing the program as well.</p> <pre><code>java -cp .:quickfixj-all-.jar Bot </code></pre> <p>This assumes that the <code>Bot</code> class is in the default package and all the <code>jar</code> and <code>.class</code> dependencies are in the same directory.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Saving Morris charts to image using HTML2CANVAS<p>I have a div in which i have morris and Flot charts I am saving the div in Image using html2canvas which sa...
<p>Flot charts are drawn using canvas, hence can be converted to image using html2canvas. Morris charts are drawn using SVG and not canvas.One of the ways by which you can export Morris charts, is first convert SVG to canvas using one of the below,</p> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/Canva...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Rails routes /new(.:format)<p>Let's say I have a wordsController, I understand that </p> <pre><code>GET /words(.:format) /words#index </code></p...
<p>It's not about querying words with conditions, it's about providing different formats for Rails to respond to. See the period? That's so you can do things like: <code>/words.json</code> and get a JSON response, or <code>/words.csv</code> and get a CSV response.</p> <p>You're right that there's no reason to have a...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: R/Shiny: Changed from readOGR to read_sf and shiny leaflet popups broke<p>UPDATE: Added code fixes and comments below and my popup is working...</p> <p>Shin...
<p>Just in case anyone else ever encounters this sort of problem when switching from readOGR to read_sf.... I bumbled into a solution to this popup issue through the process of elimination and updated the question above with comments to explain where I made the changes. </p> <p>For most of my popups, just adding "stri...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I select distinct from the Django model<p>If only address and address_detail variables are the same among model variables, I want to remove duplicates...
<p>Use <a href="https://docs.djangoproject.com/en/stable/ref/models/querysets/#distinct" rel="nofollow noreferrer"><code>distinct(*fields)</code></a> in your <em>QuerySet</em>. Note this works only with PostgreSQL.</p> <p>Alternatively, if you're not on PostgreSQL, you can do this:</p> <pre><code>from django.db.model...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Multiple errors after splitting main file into header, source and main<p>I had this program working perfectly in one main file.</p> <p>But I needed to separ...
<p>In the header file You have <code>defined</code> the name: <code>JMTDRational</code> to an empty value.</p> <pre><code>#ifndef JMTDRational #define JMTDRational #include &lt;string&gt; #include &lt;sstream&gt; class JMTDRational{ </code></pre> <p>So everywhere in your code where You have the name <code>JMTDRation...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to retrieve the label text and pass to a string in asp.net?<p>I am using a label with the text as numbers. The label text is populated from javascript as...
<p>try this:</p> <p>I am assuming You are using Server side ASP control as <code>Label</code></p> <p>something like this:</p> <p><code>&lt;asp:Label runat="server" ID="label" /&gt;</code></p> <p>then it should be </p> <pre><code>document.getElementById('&lt;%=label.ClientID%&gt;').innerHTML = arrList[2]; </code></...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Button in dialog always return null in onStart() in a Fragment<p>I have Dialog in Fragment. when I click on the OK button inside the dialog, I get <code>null...
<p><strong>You need to intialise Edittext here to fetch value from edittext. Add below line your code</strong></p> <pre><code>var et_one: EditText var btn_ok: Button et_one= layoutInflateView.findViewById(R.id.et_one) btn_ok= layoutInflateView.findViewById(R.id.btn_ok) </code></pre> <p><strong>So Your Code Lo...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Heatmap of correlation matrix using seaborn not displaying properly at the top and bottom row<p>I ran the following code:</p> <pre><code>import matplotlib.p...
<p>Upgrading matplotlib to the last version (3.1.3) should solve the issue.</p> <ul> <li>using anaconda: <code>conda update matplotlib</code></li> <li>using pip: <code>pip install -U matplotlib</code></li> </ul>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Initialize more than one unknown base classes<p>If base class is unknown to library (it is known to client), it is not so difficult to handle its constructor...
<p>What comes in handy here is <a href="https://en.cppreference.com/w/cpp/utility/make_from_tuple" rel="nofollow noreferrer"><code>std::make_from_tuple</code></a>. </p> <p>This is how you can use a tuple for a single parent:</p> <pre><code>#include &lt;tuple&gt; struct foo { foo(int,double){} foo(const foo&a...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Loop through days and create custom week in pandas<p>I have the following df</p> <pre><code>import pandas as pd import datetime as dt start='2020-01-01'...
<p>You can try something like this:</p> <pre><code>#You can create the Day_name column without apply df['Day_name'] = df['Date'].dt.day_name() #Solution starts here week_start = '2020-01-03' #inout date i = df.loc[df['Date'] == week_start,'Date'].dt.day_name().iloc[0] df['wk'] = df['Day_name'].eq(i).cumsum() print(d...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Using classes in Python<p>If I have 5 pieces of relevant data, I think it's fair to use a class in order to sort data effectively. However, I need to add the...
<pre><code># student class, inits with name and student id class Student: def __init__(self,name,grade, attendance): self.name = name self.grade = grade self.attendance = attendance def __str__(self): return self.name # list of students students = [] # creates two students ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Angular material (@angular/material) components don't look like they have to<p>I Updated Angular and Angular Material to the 9th version and I do like the ne...
<p>The form fields have four different styles - you need to provide the one you want, or set it manually on each of them: <a href="https://material.angular.io/components/form-field/overview" rel="nofollow noreferrer">https://material.angular.io/components/form-field/overview</a></p> <p><img src="https://i.stack.imgur....
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can't read file stored in res/raw<p>I'm unable to successfully get the contents of a public key file that I have stored in my res/raw directory. </p> <p>My ...
<blockquote> <p>My objective is to read the contents of this file into a File object that I will then pass along to another function that requires a File object as one of its parameters. </p> </blockquote> <p>That is not possible, unless you make your own local copy of that file.</p> <blockquote> <p>What am I doi...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: file_put_contents into vfsstream raises error `failed to open stream:`<p>I want to write UnitTests, mocking the Filesystem with vfs.</p> <p>My test looks li...
<p>I found it myself: I saved the wrong url, forgetting the root-dir.</p> <p>changing it to did the trick. Sometimes the most trivial things are the nastiest.</p> <pre class="lang-php prettyprint-override"><code> file_put_contents($this-&gt;vfs-&gt;url() . "/root/data/newFile.html", "stuff"); </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: VB script + delete files that contain word and older then X month<p>the following VB script , will remove the files under Temp dir and contain the word <stro...
<p>I don't know if <code>FileDateTime</code>, <code>Date</code> and <code>DateDiff</code> are supported in VBS. If not you can easily port your VBS code to VBA. DateDiff will find the difference between two dates in months.</p> <pre><code>Function CheckMonths(nMonths As Integer, fPath As String) As Boolean CheckMo...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Bootstrap Search Input Dynamically Center<p>I have a search box in a Bootstrap navbar. When I move the screen the content is in the center, but the search bo...
<p>See <a href="http://www.bootply.com/SyzDMZgBzW" rel="nofollow">this bootply</a></p> <p>Fixed the margin, set the max width a little lower, and set the width for the form.</p> <p>The major changes are on these two lines:</p> <pre><code>&lt;div class="search" style="margin: 0px auto; text-align:center; max-width: 4...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: File exists on a shortcut<p>i need check if a shortcut exists into startup window folder. Actually i have a shortcut into:</p> <blockquote> <p>C:\Users\ra...
<pre><code>Environment.GetFolderPath(Environment.SpecialFolder.StartMenu) </code></pre> <p>the line above will return:</p> <blockquote> <p>C:\Users\rama\AppData\Roaming\Microsoft\Windows\Start Menu</p> </blockquote> <p>and you are searching for the file in:</p> <blockquote> <p>C:\Users\rama\AppData\Roaming\Micr...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Highchart (Column Chart) : Few data labels are not appearing for a series<p>I am creating a column chart using High Charts -- I am not able to show all the d...
<p>Set <a href="https://api.highcharts.com/highcharts/plotOptions.series.dataLabels.allowOverlap" rel="noreferrer">plotOptions.series.dataLabels.allowOverlap</a> option to <code>true</code>. See : <a href="http://jsfiddle.net/cthzmsg0/1" rel="noreferrer">http://jsfiddle.net/cthzmsg0/1</a> </p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Run python script from java as subprocess<p>I'm trying to execute python code (live from the console, not just opening a single file).</p> <pre class="lang-...
<p>Your <code>python</code> code doesn't appear to print anything, and handling multiple threads to read and write to another process is a tricky topic; luckily, the functionality is built-in. You could do</p> <pre><code>ProcessBuilder builder = new ProcessBuilder("/usr/bin/env", "python", "-c", "print(2*2); e...