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 can node.js keep track of many requests made to the same endpoint?<p>Let say I have an endpoint that perform some background IO work before sending a res...
<p>JavaScript closures make it work. The callback to your <code>someIOWork()</code> has a reference to the <code>req</code> and <code>res</code> objects. They are tied to that one specific connection you are responding to. Other invocations or your route handler have different <code>req</code> and <code>res</code> obje...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Reading pictures from the storage<p>I am practicing working with android programming and ran into this problem. In the view pager I have a fragment that hold...
<p>Problem you are having is not about loading the images but aquiring them.</p> <p>I faced similar situation recently but my needs weren't specific to images. So I will give you my solution and you can modify the way you want.</p> <pre><code>fun choosePicker(filePicker: FilePickerOption) { // FilePickerOption is jus...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: MySQL Query Optimization for for Count Query<p>I need help with optimization for this count query. Here are the tables:</p> <pre><code>activities - activity...
<p>For this query:</p> <pre><code>select count(*) as total_items, count(distinct a.user_id) as total_users from activities a join retail_activities ra on ra.activity_id = a.activity_id join users u on u.user_id = a.user_id where u.is_private = 0 and a.item_id &lt;&gt; ra.item_id and ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ReactJS - getting data from DB and returning promise results from .then back to return function<p><strong>TLDR;</strong> Basically I'm trying to figure out h...
<p>You should waite for API result </p> <pre><code>const Schedule = () =&gt; { const { orders, setOrders, filteredOrders, setFilteredOrders, pendingOrderIDs, setPendingOrderIDs } = useContext(ScheduleContext) ||[]; </code></pre> <p>Or use <code>useEffect</code></p> <pre><code>const data =...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Set Access control in routing file like @Secure annotation above controller action<p>I have the following ACL settings in my secirity.yml file</p> <pre><cod...
<p>Nope, there is no such argument for securing routes directly in your routing file. The common part between ACL and routing are <strong>paths</strong>.</p> <p>See all the details in the <a href="http://symfony.com/doc/current/book/security.html" rel="nofollow">Security chapter of Symfony doc</a>.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to pass one entry from a list as prop in Vue<p>Lets say I have the following list in data:</p> <pre><code>data: { todos: [ { id: 1, title: "Le...
<p>Sure, you can pass any <code>data</code> on. Just don't forget to add quotation marks and mind the off-by-one problem. So if you want to pass the <em>second</em> element in a (zero-indexed) array, you'd write something like:</p> <pre><code>&lt;dynamic-prop :id="todos[1].id" :title="todos[1].title"&gt; &lt;/dynamic-...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Offset when reading binary file in python<p>I have an <a href="http://wiki.openstreetmap.org/wiki/PBF_Format" rel="nofollow">OSM PBF file</a> which I am tryi...
<p>You're opening the file in "text mode", which causes some unwanted newline handling (<a href="https://docs.python.org/2/library/functions.html#open" rel="nofollow">docs</a>).</p> <p>To solve your problem, open it in binary mode, like:</p> <pre><code>PBFfile = open(r'MyFilePath.osm.pbf', 'rb') </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Mongodb Java add new array element in document<p>I'm using mongo 2.2.3 and the java driver. My dilemma, I have to $push a field and value into an array eleme...
<p>Try this update with <a href="http://docs.mongodb.org/manual/reference/operator/update/set/" rel="nofollow">Set</a> and reference:</p> <pre><code>db.Sample.update({"scores.type" : "english"},{"$set" : {"scores.$.grade":"A"}}) </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: pelican taking longer and longer as I write more and more posts.. is it re-making the old posts too?<p>Hi I started using <a href="http://docs.getpelican.com...
<p><strong><em>Is it re-making the old posts as well?</em></strong></p> <p>Yes, it does! In fact it's said writing the files each time is a lot faster and a lot more reliable than to compare, save and generate hash. From the Pelican FAQ:</p> <blockquote> <p>In order to reliably determine whether the HTML output is...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Evaluating a list-like string into a string<p>Say that I have a string that looks something like this:</p> <pre class="lang-py prettyprint-override"><code> ...
<p>Is it ok ? </p> <pre class="lang-py prettyprint-override"><code>import ast x = "['345565', '1234213', '12313523', '1232346345', '1223123']" print(ast.literal_eval(x)) </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: C++ float value of a local variable explanation?<p>I have a simple math vector struct</p> <pre><code>struct vec3d { float x; float y; float z; float...
<pre><code>vec3d(float a, float b, float c) { a = x; b = y; c = z; w = 1; } </code></pre> <p>Is assigning to the constructor arguments from the uninitialised member variables. Obviously wrong. You'd want to reverse the order of assignment.</p> <p>Additionally, you should use the constructors initialization list to in...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: flip image using jquery on button click?<p>I'm trying to create a simple drag and drop web application using jquery.</p> <p>everything so far works as it sh...
<p>When selecting an image, you can set a class to it. Let's add <code>selected</code> to it. When selecting another image we just remove the <code>selected</code> class from other elements and add it to the one we just selected.</p> <p><a href="http://jsfiddle.net/7btkn17q/10/" rel="nofollow">Here's my fiddle</a></p>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: .NET ElasticSearch NEST - NGram Analyzer on Multiple Fields for Partial Matches<p>I'm trying to use ElasticSearch for partial matches on multiple fields usin...
<p><code>client.Indices.Create</code> call is invalid, there are two reasons for that:</p> <ol> <li>Difference between <code>MinGram</code> and <code>MaxGram</code> can't be bigger than 1, thus getting this error</li> </ol> <pre><code>Elasticsearch.Net.ElasticsearchClientException: Request failed to execute. Call: St...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: In typescript, how to return sub class instance in a static function in base class?<p>Here is my code:</p> <pre class="lang-js prettyprint-override"><code>c...
<p>I would avoid mixing generic type parameters and conditional types unless you are prepared to use <a href="https://www.typescriptlang.org/docs/handbook/basic-types.html#type-assertions" rel="nofollow noreferrer">type assertions</a> inside the method implementations: the compiler isn't really able to verify that a va...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I swap my master repository location in mercurial<p>I have a local mercurial repository. And I back it up with a clone in a separate folder that lives...
<p>Your question reveals an illuminating misconception. When one says that Mercurial is a <em>Distributed</em> Version Control System (DVCS), it means that there is <em>no</em> ‘master‘ repository.</p> <p>When you type <code>hg push &lt;repo&gt;</code> or <code>hg pull &lt;repo&gt;</code>, then Mercurial compares the...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to install Psycopg2 for Python 3.5<p>I am trying the following command on Windows 7 using powershell</p> <pre><code>pip install psycopg2 </code></pre> ...
<p>I ran into a similar issue on Windows. I had to install a compiled version of it and then easy_install it.</p> <p>You can find a compiled version of psycopg2 here: <a href="http://www.lfd.uci.edu/~gohlke/pythonlibs/">http://www.lfd.uci.edu/~gohlke/pythonlibs/</a></p> <p>And then do easy_install C:/locaiton/of/down...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Dynamically adding one object to another in JavaScript<p>I have an object that needs to have another object added to it when a user selects a certain value. ...
<p>Adding existing objects to each other in JS is very easy. </p> <p>In your case, <code>Player.weapon = Sword;</code></p> <p>That would give you</p> <pre><code>Player = { name: "One", weapon: { type: "Bronze", speed: 1.25, min_damage: 15, max_damage: 20, str_required:...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ggplot: placing facet strips above axis title<p>I want to create a plot where the axis titles are on the top/left and the axis labels on the bottom/right. Th...
<p>This behaviour is generally desired. This becomes particularly clear when removing <code>theme(strip.placement = 'outside')</code>. I personally feel that it is visually much clearer this way. </p> <p>I also feel that you are possibly looking for a plot title (you could use <code>labs(title = 'Sepal.Length')</cod...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: System.StackOverflowException after HttpPost returning view - asp mvc<p>The error that I get is this (no more info) : System.StackOverflowException</p> <p>E...
<p>just get your info in LayoutView if you using the DI first inject your repo </p> <pre><code> var _repoMenu = DependencyResolver.Current.GetService&lt;IMenuRepository&gt;(); var MenuModel = _repoMenu.Select(); </code></pre> <p>then instead of </p> <pre><code>@Html.Action("TuorMenu", "Home", new { area = "Site" })...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Fetching data of a dynamic column from a dynamic view using cursor<p>The requirement is to check data consistency of a view. It's a bit complicated, so let's...
<p>This function worked in simple tests. It checks nulls and length, you have to add rest of validations.</p> <pre><code>create or replace function CheckData(i_viewname VARCHAR2) RETURN VARCHAR2 Is query_v VARCHAR2(2000); v_cnt number := 0; CURSOR ddc_c IS SELECT * FROM check_data_column where viewna...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Redirect in Route Service Provider<p>I'm currently using the route/model binding to check if there is a valid id for a <code>Tag</code> in my database. It's ...
<p>I don't particularly like this way but you can trigger the redirect without having it to return from a controller action or route closure by calling <code>send()</code> on it. (That works for all kind responses by the way)</p> <pre><code>if ($tag-&gt;slug !== \Request::segment(3)) { redirect('/tags/' . $tag-&gt...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to know how many elements are in the result of thrust::partition_copy<p>I am trying to partition an array with the thrust library's partition_copy functi...
<p>Your compile error is due to the fact that you are passing vectors instead of iterators here:</p> <pre><code>thrust::partition_copy(dptr_data, dptr_data + N, out_true, out_false, is_even()); ^^^^^^^^^^^^^^^^^^^ </code></pre> <p>Instead you should pass iterators based ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to retrieve a sequence of records from a Pandas dataframe that contains a certain value at the end of one of the columns?<p>I'm using event based data, l...
<p>I think there's a better way to approach the problem. First, aggregate up to the level of the possession, keeping the actions and some way to sequence them (<code>second</code>?)</p> <pre class="lang-py prettyprint-override"><code>posses = data.groupby('possession_number')[['second', 'action_name']].apply(lambda ac...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: QML ListView anchor, margin = 0 goes outside parent fill?<p>I was wondering why this draws the <code>Icon</code> components outside of the <code>Item</code> ...
<p>The objective of the ListView is to show a set of items as a list so the anchors cannot be established since the geometry is handled by the ListView, instead Repeater must be used:</p> <pre><code>import QtQuick 2.5 Item { id: root // width: 960 // Actually set in the higher level view // height: 54...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Fetch-mock don't work in version 3.2.0 redux-api-middleware test<p>I use the latest version of redux-api-middleware and i do the same test of documentation b...
<p>Solved. I found the problem, is needed add "<strong>fetch:fetch</strong>" inside the action creator like this:</p> <pre><code>export const USER_REQUEST = '@@user/USER_REQUEST' export const USER_SUCCESS = '@@user/USER_SUCCESS' export const USER_FAILURE = '@@user/USER_FAILURE' export const getUser = () =&gt; createA...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: piping a vector into all() to test equality<p>I'm trying to pipe a vector into an <code>all()</code> statement to check if all elements are equal to a certai...
<p>The way pipe works is it takes the left-hand side of the pipe operator and passes it as a first argument to the right hand side function. So here, in this case as we need to modify the data argument to <code>all</code> , we need to stop pipe from passing the LHS to the RHS. We can do that by using <code>{}</code>. <...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: rxjs check outerobservable is not null and only then subscribe to inner observeable<p>I want to subscribe to inner observable only when the outer observable ...
<p>You can chain the observable pipeline with the RxJS <a href="https://www.learnrxjs.io/learn-rxjs/operators/filtering/filter" rel="nofollow noreferrer">filter</a> operator, such only values that aren't null will be emitted, and be passed onto the subsequent <code>concatMap()</code>. </p> <pre><code>const example = s...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: error when using Kotlin groupBy function applied to list<p>I'm very new in Kotlin, and I can't seem to figure out how to do something that is really quite si...
<p>Since <code>groupBy</code> returns a <code>Map</code> not a <code>List</code>, you get an error when you do </p> <pre><code>return reportBatchesList.groupBy({it.adlsFullPath}, {it}) </code></pre> <p>From a <code>function</code> having <code>return</code> type <code>List&lt;ReportWithBatches&gt;</code>. So you will...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I get the specific element value<p>I have the following XML:</p> <p>&lt;--one or more this--></p> <pre><code>&lt;Supplement&gt; &lt;ID&gt;321 &...
<p>Your approach does not work because</p> <pre><code>&lt;xsl:value-of select="."/&gt; </code></pre> <p>returns the <em>string value</em> of the context element. The string value is the concatenation of all descendant text nodes, not only the immediate children.</p> <p>You should not simply match <code>/</code> (I g...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: update datagrid from a button click in xaml<p>I have in code behind</p> <pre><code>private void Button_Click(object sender, RoutedEventArgs e) { this.ca...
<p>I got through Blend Actions</p> <pre><code>&lt;Window.Triggers&gt; &lt;EventTrigger RoutedEvent="ButtonBase.Click" SourceName="button"/&gt; &lt;/Window.Triggers&gt; &lt;Button x:Name="button" Content="Button" HorizontalAlignment="Left" Margin="108,150,0,0" VerticalAlignment="Top" Width="75" Command="{Binding S...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do you configure commitlint to ignore certain commit messages such as any that contain the string "WIP"?<p>We are using commitlint to enforce a naming co...
<p>The syntax is given by the type information provided by <code>ignores?: ((message: string) =&gt; boolean)[];</code>. </p> <p>You need to add a function that takes a string argument <code>message</code>, does something with it, then returns a boolean. An example:</p> <pre><code>ignores: [ (message) =&gt; messag...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is it possible to check a condition after every method in a loop? If so, how?<p>Like I said in the title I have a loop in an RPG I'm making about High School...
<p>You would have to do it manually. To help you write a little less code, make a method that checks both conditions:</p> <pre><code>private boolean stopTheLoop() { return g.getBeat() || g.getLost(); } </code></pre> <p>Now convert your loop to infinite with checks after each method:</p> <pre><code>while (true) {...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PHP code write in Smarty<p>can any one tell me that how can i write these PHP codes in Smarty .</p> <pre><code>&lt;?php (($user_info.bank != "") ? echo "rea...
<p>Not sure if this is what you want but a standard if statement in smarty looks like this.</p> <pre><code>{if $user_info.bank != ""}readonly{/if} </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Not able to play song using Python when compiled from terminal<pre><code>import pygame import time pygame.mixer.init() pygame.mixer.music.load('/home/baha...
<p>Pygame requires an active display which you have not initialized. I suggest you try installing and using <code>mpg123</code> command line tool.</p> <p>Install:</p> <pre><code>$ sudo apt-get install mpg123 </code></pre> <p>Program:</p> <pre><code>import os, time os.system('mpg123 /home/bahara.mp3') </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Bad request (400) using nginx on ubuntu with Django<p>I made my own config for my web server and everything is working perfectly if I access my website by IP...
<p>What mean proxy_pass http://<strong>0.0.0.0</strong>:8000/ ? Maybe there must be 127.0.0.1 or 179.188.3.54 </p> <p>And check your port in proxy_pass</p> <pre><code>root@RDE-1.3:~# curl -I http://179.188.3.54 HTTP/1.1 200 OK Server: nginx/1.1.19 Date: Tue, 24 Feb 2015 15:46:10 GMT Content-Type: text/html; charset=u...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Firebase getSignedUrl inside loop<p>I need to get urls of all files in 'bucket/loads/:loadID' path. I'm able to get these files in array called 'files'. Then...
<p>The <a href="https://googleapis.dev/nodejs/storage/latest/File.html#getSignedUrl" rel="nofollow noreferrer"><code>getSignedUrl()</code></a> method is asynchronous and returns a Promise.</p> <p>Since you want to concurrently execute multiple calls to this method, you need to use <a href="https://developer.mozilla.or...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PHP: Number of consecutive elements in array<p>I have been working on one problem: </p> <p>Find the largest group of consecutive numbers in an array. </p> ...
<pre><code>$a = [8, 13, 14, 10, 6, 7, 8, 14, 5, 3, 5, 2, 6, 7, 4]; $res = []; $stage = []; foreach($a as $i) { if(count($stage) &gt; 0 &amp;&amp; $i != $stage[count($stage)-1]+1) { if(count($stage) &gt; 1) { $res[] = $stage; } $stage = []; } $stage[] = $i; } print_r($r...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Simplest way to mix anonymous conditions with IO<p>How to avoid boilerplate assignments like <code>doesExist &lt;- doesDirectoryExist path</code> and <code>c...
<p><code>LambdaCase</code> is applicable here:</p> <pre><code>{-# LANGUAGE LambdaCase #-} import System.Directory import System.Environment main = do path:_ &lt;- getArgs doesDirectoryExist path &gt;&gt;= \case True -&gt; putStrLn $ path ++ " Exists" _ -&gt; putStrLn $ path ++ " Does not exist" <...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: why does my statement prints "loading" twice?<p>$("div").append("LOGO");</p> <p>$('div').append("Loading");</p> <blockquote> <p>When I append them, I hav...
<p>This is because you are appending LOGO and Loading in <code>div</code> directly, Which means every <code>div</code></p> <p>You should be doing</p> <pre><code>$(document).ready(function(){ $('&lt;div id="maine2"&gt;').appendTo('body').html("LOGO"); $('&lt;div id="maine"&gt;').appendTo('body').html("Loading"...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Javascript, contain image inside windows edges<p>I'm trying to learn more javascript and right now I'm just playing around with the event listener method. I'...
<p>Limiting its movement to the left and top of your window should be very straight-forward. When the image is at the top of the screen, its offsetTop will be 0. And at the left, its offsetLeft will be 0. So you can add this after your switch statement:</p> <pre><code>if (left &lt; 0) { left = 0; } if (top &lt;...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: check if else condition in jquery<p>I have jquery which print the remaining time of quiz to my page. It works fine. Now I want to put condition if else to ou...
<p>Rather than using the load function you could try using an ajax function.Hope this might give you some idea mate.. :)</p> <pre><code> $(document).ready(function() { refreshTable(); }); function refreshTable(){ $.ajax({ url: "timer_check.php", succ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Starting multiple tomcat instances in one server with init.d script<p>I'm trying to configure tomcat init.d start script to work with multiple instances (at ...
<p>found a workaround, but expecting better solution</p> <p>using netstat we can find process id via running port number</p> <pre><code>echo `netstat -tlnp | awk '/:80 */ {split($NF,a,"/"); print a[1]}'` </code></pre> <p>So i modified the function tomcat_pid() as below</p> <pre><code>tomcat_pid() { echo `netst...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Detect if another app is running<p>Is it possible on Android to detect if another app is running? I need to trigger some action in my app when a Map applicat...
<p>You can use ActivityManager class:</p> <pre><code>final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); final List&lt;RunningTaskInfo&gt; recentTasks = activityManager.getRunningTasks(Integer.MAX_VALUE); for (int i = 0; i &lt; recentTasks.size(); i++) { ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Angular.forEach returning only one result?<pre><code> $scope.$watch('selectedPoll', function(newValue, oldValue){ if(newValue !== oldValue) { ...
<p>You're setting $scope.arrayResult = []; at the beginning of each loop overwriting anything that was set on previous loops.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Write unit test for reducer but - TypeError: state.commentList is not iterable<p><strong>this is the commnetsReducer.js file</strong></p> <pre><code>import ...
<pre><code>commnetsReducer([], { type: ADD_COMMENT, payload: "new comment" }) </code></pre> <p>You've passed in an array as the state. Arrays have no <code>.commentList</code> property, so when your reducer tries to spread <code>state.commentList</code> you get that error from trying to spread undefined.</p> <p>Inste...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Xamarin: Picker Title dont change programmatically<p>I am working on an iOS App, written in C#, Xamarin. I use a Picker in MVVM Architecture and want to chan...
<p>I wrote a demo and the title of Picker can be changed after I change the selectedItem. Here is the code you can refer:</p> <pre><code>public partial class MainPage : ContentPage { List&lt;string&gt; monkeyList = new List&lt;string&gt;(); TestModel model = new TestModel(); public MainPage() { ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to track change on an input in a Marionette.LayoutView<p>I am current trying to get my input field in a LayoutView to track when it's change as they happ...
<p>I updated your <a href="http://jsfiddle.net/nyTZU/16/" rel="nofollow">fiddle</a>. There was nothing <em>intrinsically</em> wrong with the event binding. All you had to do was <code>.extend()</code> a <code>Marionette.LayoutView</code>, not a <code>Backbone.LayoutView</code>.</p> <p>In my fiddle I decide to populate...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Finding square of a number<p>I found this question, </p> <p>write a function that returns a square of given integer n without using multiplication.</p> <p>...
<p>Because multiplication distributes over addition. This probably sounds mysterious, but that really is the reason. Consider this multiplication:</p> <pre><code>100 * 111 </code></pre> <p>Obviously that just 111 shifted left by two: 11100</p> <p>This code is doing that for every bit that is 1 in <code>i</code>, and...
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 compress a file into a customized extension?<p>As the title says, I'm thinking about a project, and that project involves file compression,...
<p>You could actually just rename it. We did that one a project some years ago. Compress the file with a zip library, renam and done. </p> <p>Even microsoft does it. Go rename an xlsx or docx file to .zip and take a looksie inside. </p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to set Vuetify tabs to active based on url<p>I'm using <code>vue 2.6.11</code>, <code>vuetify 2.2.9</code> and <a href="https://github.com/tightenco/zigg...
<p>Looks like that setting the <code>v-model</code> attribute of <code>v-tabs</code> equal to <code>window.location.href</code> in the <code>data</code> object solves it.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Oracle join rows in order where order is defined differently on each table<p>I have two tables</p> <p>TABLE_A with columns project_id, id and load_date</p> ...
<p>This merge should do the work, as far as I properly understood your criteria:</p> <pre><code>merge into table_a ta using ( select pid project_id, id, delete_date from ( select project_id pid, id, row_number() over (partition by project_id order by id) rn from table_a) a join ( ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Sending SMS via Serial Port in C# but getting garbage<p>I am sending sms via serial Port but receiving ????. Please help me to receive sms properly and in bu...
<p>This is three months late, but it might help someone reading this in the future.</p> <p>To send an SMS via a serial port, you need to convert your text into an hexadecimal representation of your message then send the result instead. For example :</p> <pre><code>_serialPort.Write(StrToHex(smstxt) + char.ConvertFrom...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Vuetify v-carousel multiple components<p>I want to display the carousel component inside multiple components. That's my carousel component:</p> <pre><code>&...
<p>You'll add a property called "images" to your carousel component in the script block. Then, you'll use the component elsewhere.</p> <p>Carousel Component:</p> <pre class="lang-html prettyprint-override"><code>&lt;template&gt; &lt;v-container&gt; &lt;v-carousel&gt; &lt;v-carousel-item v-for="image in im...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to send a PUT request with wreq?<p>Here is how I would expect to be able to send a PUT request with <code>wreq</code>:</p> <pre><code>{-# LANGUAGE Overl...
<p>I believe the issue is that if you try to <code>put</code> using a <code>[FormParam]</code>, the method gets overridden and changed to <code>POST</code>. If you <code>put</code> a different kind of payload:</p> <pre><code>main = put "http://httpbin.org/put" ("xyz" :: ByteString) </code></pre> <p>then it works fin...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Imagick only giving single page for gif resize<p>I've looked over different questions (such as <a href="https://stackoverflow.com/questions/11221927/php-imag...
<p>It works fine for me. It's possible you're using an older version of Imagick which has <a href="https://bugs.php.net/bug.php?id=61879" rel="nofollow">this bug</a></p> <p>If so, you could either upgrade or work around it with:</p> <pre><code>file_put_contents('img' . rand().".gif", $imageObject-&gt;getImagesBlob())...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Type error when using as="element" on a variable<p>I'm consuming a web service which returns escaped XML. I need to un-escape it and do a transform on it. ...
<p>Well with Saxon EE you have full access to XSLT 3.0 or to Saxon's extension functions <a href="http://saxonica.com/html/documentation/functions/saxon/parse.html" rel="nofollow">http://saxonica.com/html/documentation/functions/saxon/parse.html</a> so I would simply parse the result with e.g. <code>&lt;xsl:variable na...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python text parsing - how to capture and write multiple lines<p>I am trying to use Python to extract certain four data elements from @ 6,500 form-generated e...
<pre><code>with open("samplefile.txt") as inf, open("samplefileout.txt", "w") as outf: for line in inf: if line.startswith("Subject: ") or line.startswith("From: "): outf.write(line) elif line.startswith("Date: "): outf.write(line) skip = next(inf, "") # sk...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I import jDatePicker into a BlueJ Java program?<p>I'm trying to use the jDatePicker tool from here: sourceforge.net/projects/jdatepicker/files/latest...
<p>To import other classes in your Java files, you need to add an import statement with the full qualified name of the class (The file name with the package). </p> <p>To import the <code>JDatePicker</code> class, you need to add:</p> <pre><code>import org.jdatepicker.JDatePicker; </code></pre> <p>If you want to impo...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to create mentioned specific JSON format<p>This is the JSON format which I am getting through the API.</p> <p><strong>Currently generated JSON format</s...
<ol> <li>You can create java pojos for both JSON structures. pojo for source structure:</li> </ol> <pre class="lang-java prettyprint-override"><code>class SourceData { private String question; private String option; // getters and setters } </code></pre> <ol start="2"> <li>Target JSON pojo:</li> </ol> <p...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Having trouble adding more than 2 objects to a vector<p>I'm working on a Parallax scrolling project, in which I need to get multiple sprites up on the screen...
<pre><code>vector&lt;ParallaxSegment&gt; parsega; [...] ParallaxSegment* seg = new ParallaxSegment(...); parsega.push_back(*seg); </code></pre> <p>Your vector doesn't hold pointers to ParallaxSegments but 'real' ParallaxSegment objects. Thus you create a pointer to a ParallaxSegment object, dereference it to store the...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: create column from other columns in python pandas<p>i want to create ids for every row in a new column . which has first four characters of name and last fou...
<pre><code>df["id"] = df["Name"].apply(lambda s: s[:4]) + df["Number"].apply(lambda n: str(n)[-4:]) </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Sorting Network SWAPs for 64 elements<p>I am trying to use <a href="https://en.wikipedia.org/wiki/Sorting_network" rel="nofollow noreferrer">Sorting Network<...
<p>This is related to shifting a circular array (Approach #3 in <a href="https://leetcode.com/articles/rotate-array/#" rel="nofollow noreferrer">https://leetcode.com/articles/rotate-array/#</a> )</p> <p>There are algorithms to determine the sequence i.e. <em>Bose-Nelson algorithm</em> (<a href="https://metacpan.org/po...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Scala generics in an abstract function<p>There is an abstract class <code>Animal</code>. <code>Animal</code> is extended by <code>Dog</code> and <code>Cow</c...
<p>Essentially <code>CT</code> must be invariant for your approach to work. Your concrete implementation of Dog has no control over the type of <code>CT</code>, for example it's impossible to account for this with your approach (hence the compiler error):</p> <pre><code>new Dog[Int]().copy[Cow[Int]]() </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 store requests when circuit breaker is open?<p>I need to save our requests to process them later when the circuit breaker leaves the fault ...
<blockquote> <p>I need to save our requests to process them later when the circuit breaker leaves the fault state and goes back to closed. The only way I found was using rabbit-mq, ​​is there another way using the Polly library?</p> </blockquote> <p>Polly is only concerned with handling transient faults during the l...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Send HTML email in Appengine [PYTHON] using HTML file<p>I want to send a HTML email to the users after they signup to the website. Earlier I wrote this scrip...
<p>Probably the best way to do this would be to <a href="https://cloud.google.com/appengine/docs/python/gettingstartedpython27/templates" rel="nofollow">use a templating engine</a> to load and generate the HTML as a string from the HTML file. For example, if you use the <a href="https://webapp-improved.appspot.com/_mod...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: I need help writing a check constraint on a smalldatetime column<p>I need to add a Check constraint to a Column named Departure. This column has the smalldat...
<p>This should do it:</p> <pre><code>ALTER TABLE [YourTableName] ADD CONSTRAINT DepartureLaterThan6Hours CHECK ([Departure] &gt; dateadd(HOUR, 6, GetDate())); </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Determine number of threads waiting in threadpool in C#<p>Is it possible to see how many threads are waiting to execute in the queue of the Threadpool?</p> ...
<p>There is a ThreadPool.PendingWorkItemCount property.</p> <p><a href="https://docs.microsoft.com/en-us/dotnet/api/system.threading.threadpool.pendingworkitemcount?view=netcore-3.1" rel="noreferrer">https://docs.microsoft.com/en-us/dotnet/api/system.threading.threadpool.pendingworkitemcount?view=netcore-3.1</a></p> <p...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Ionic 4 Observables<p>I have been trying to implement the rxjs Observable pattern in a Ionic 4 upgrade project with no success and I would like to know how t...
<p>Here's one approach that might work for you. In your auth service you can create a private BehaviorSubject property to store the last value of a private login property. Then you can create a public observable with the BehaviorSubject as its source. Finally you can subscribe to the service's public observable in your...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SQL Server - Group By<p>Input Data</p> <pre><code>ID Value1 Value2 Value3 Value4 100 10 ABC 15:00 4551 100 20 DEF ...
<p>This should work i think. The <code>tmpTable</code> is just for example data. The <code>partition by</code> is for the min values. But i think the XML part could be... better.</p> <pre><code>WITH tmpTable (ID, Value1, Value2, Value3, Value4) AS ( SELECT 100, 10, 'ABC', '15:00', 4551 UNION SELECT 100, ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I deploy to Google Compute Engine using the Ruby stack?<p>I'm totally lost trying to deploy a demo Rails app to <em>my-app-name</em>.appspot.com. I se...
<p>Thanks to the posters who commented, I now understand that I was barking up the wrong tree. The appspot.com domain is not compatible with compute engine; I will have to access my project via the IP address.</p> <p>Also, since I was only trying to put up a test app as proof of concept, <strong>I needed to set the Ra...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: calculate the percentage with sql and DOMO<p>I have a table where I want to calculate the percentage of revenue using the following formula: (Advertiser Reve...
<p>In Domo, this calculation would best be done at the visualization layer using Beast Mode. Just create your beast mode that is <code>Revenue</code> / <code>Total Revenue</code>.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Mage_Core_Model_App' not found magento XAMPP<p>I am setting up magento on my mac in XAMPP server but when I hit the url:</p> <p><a href="http://localhost/ma...
<p>I got the solution the issue was only about permissions in folder app/etc,var,media</p> <p>cd /path_to_magento_folder/magento chmod -R 777 app/etc chmod -R 777 var chmod -R 777 media</p> <p>finally run successfully.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is using position: relative on html tag advised?<p>I just found out a solution for creating sticky footers:</p> <pre><code>html { position: relative; } ...
<p>While the root element <code>html</code> is stylable by CSS just like any other element, certain properties may behave differently by virtue of it being the root element. <code>position</code> is one of those properties: in particular the <a href="http://www.w3.org/TR/CSS21/visuren.html#choose-position" rel="nofollo...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to start React project with HTTPS<p>I'm trying to start my React project with HTTPS instead of HTTP. I have my project in an Ubuntu Server and I want to ...
<p>You can set HTTPS in development as below.</p> <h3>Windows (cmd.exe)</h3> <pre><code>set HTTPS=true&amp;&amp;npm start </code></pre> <h3>Windows (Powershell)</h3> <pre><code>($env:HTTPS = "true") -and (npm start) </code></pre> <h3>Linux, macOS (Bash)</h3> <pre><code>HTTPS=true npm start </code></pre> <p>Note ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to design a MapReduce model for merge two text files<p>For example I have two files, A and B. Both of them are text files.</p> <p>A contains one line te...
<p>This is a cross join - joining each record in A to each record in B. Luckily this is a pretty well-covered MapReduce design pattern.</p> <p>The solution depends on how large your dataset is. If A or B can fit into memory, you're in luck. Simply add either of them to the DistributedCache and only read the other into...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: When are the local remote-tracking branches created in Git?<p>In the local Git repository this folder contains the HEAD file just after a clone:</p> <pre><c...
<p>You should not care <em>where</em> branches are stored (as you should use the "advertised" interfaces, <code>git branch</code>, <code>git for-each-ref</code>, and so on). The <em>when</em> question is more interesting though.</p> <p>A remote-tracking branch is simply a reference in the <code>refs/remotes</code> na...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Php array format is google api analytics<p>Here is my current array : <code>$stats-&gt;rows</code> </p> <p><code>[["Austria","1","1","1"],["Brazil","5","5",...
<p>Using <code>array_map</code>:</p> <pre><code>$newData = array_map(function($value) { return array($value[0], array_sum(array_slice($value, 1))); }, $stats-&gt;rows); </code></pre> <p>To insert a new value at the beginning of the array:</p> <pre><code>array_unshift($newData, array("Country","Enter")); </code><...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to have pointer members in F#<p>I am stuck trying to write in F# something that I conceive well in C++: a class that has as a member a list of pointers t...
<p>You can't have pointers to Fred in f#. Instead, you would just have a list of Freds. The actual contents of the list are in fact pointers to Freds, but the language doesn't conceptualize them that way. Instead, they are .NET object references. If you're unfamiliar with the concepts, read up on reference types vs...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Kendo Grid MVC: Change a value in all rows with a master checkbox<p>First of all, I'm a javascript noob, so my code is neither pretty nor smart. :(</p> <p>I...
<p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>function toggleCheckbox() { $(".masterCheckBox").on("click", function (e) { var grid = $("#TestGrid").data("kendoGrid"); var ds = grid.dataSource.data(...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Odata Restlet code generation failed<pre><code>public static void main(String[] args) { // TODO Auto-generated method stub String[] arguments = ...
<p>I saw that you use an OData v4 service with the restlet OData extension. This extension currently only supports older versions of OData (v2 and v3).</p> <p>I know that there is a contribution in progress to support this latest version or OData.</p> <p>I'm almost sure that it's the reason of your problem...</p> <p...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Balde - setup problems<p>I am trying to setup Balde (<a href="http://balde.io" rel="nofollow">http://balde.io</a>).</p> <p>I referred <a href="http://docs.b...
<p>You must change <code>&lt;Directory /path/to&gt;</code> to <code>&lt;Directory /home/ubuntu/workspace/try&gt;</code>. This should fix your issue </p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python Matplotlib (1) format x-axis labels to Year-Quarter and (2) set major_locator to end of month<p>I want to do two things:</p> <ol> <li>I want to forma...
<p>Try this instead, using <code>pd.DataFrame.to_period</code> and pandas plot:</p> <pre><code>import pandas as pd import numpy as np import matplotlib.pyplot as plt import matplotlib.dates as mdates from datetime import datetime from datetime import timedelta %matplotlib inline from pandas.plotting import register_m...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Search SqlDatabase using different data ASP.NET C#<p>Hi i can currently search the sql database using the following code, but i can only search using the Cus...
<p>You should be able to simply add a second condition for the surname. For example:</p> <pre><code>string staSearch = "select * FROM [PMR] where (Customer_Firstname like '%" + TextBox_cus_pmr.Text.ToString() + "% OR Customer_Surname like '%" + TextBox_surName.Text.ToString() + "%')"; </code></pre> <p>Replace TextBox...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Validate users of Remote Active Directory in C#<p>I try to authenticate users belonging to remote ActiveDirectory from my machine, which is not the same dom...
<p><strong><em>First some basics (independent of this question)</em></strong></p> <p><strong>Authentication</strong></p> <p>The system checks if Bob is really Bob. In an Active Directory environment, this is usually done with a domain login from the workstation, Bob enters his username and password, and he gets a Ker...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Saved object array not showing up in new ViewController<p>Every time my add button is pressed I am attempting to append that specific item into an array of I...
<p>The issue is that in the <code>FinishViewController</code> you are initializing a new instance of <code>CollectionViewController</code>, so the property has the default empty array value.</p> <p>You need to pass in the array to the <code>FinishViewController</code> when you present or segue to it.</p> <p>In <code>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Kotlin async callback unit test<p>I have a class:</p> <pre><code>class SomeClass(private val executor: Executor) { fun doSomething(id: Int, callback...
<p>I have researched this question for about 3 days. I was hoping this could be resolved using Mockito. Fortunately today I found <a href="https://github.com/jhalterman/concurrentunit" rel="nofollow noreferrer">ConcurrentUnit</a> utils for testing async code.</p> <p>My solution:</p> <pre><code>val executor = Executor...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: JavaScript: how can I put multiple items after my e.preventDefault?<p>I use JavaScript to add and remove things, but I need to add multiple items here: <a hr...
<p>Depending on how you like to organise code you could do it a couple of ways. </p> <p>jQuery/Javascript would happily allow either of the following: </p> <pre><code>(function($) { $('#slideshow-pause-icon').click(function(e) { e.preventDefault(); // Add as many elements and actions as you need ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Autocomplete users lastname in PHP form selection field<p>I have tried to search for an answer, but I don't know the exact terms to use. I'm sorry if this ha...
<p>Use <a href="http://jqueryui.com/autocomplete/" rel="nofollow"><code>autocomplete</code></a> provided by <code>jQuery UI</code></p> <p>I am assuming you have an <code>Array</code> of names in <code>PHP</code> then you can do it this way </p> <pre><code>&lt;script&gt; var username= $.parseJSON('&lt;?php echo json_e...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Css/HTML positioning<p>Having problems keeping all my stuff in place when I zoom and rezoom in. I would like someone to help me out.</p> <p>Also how can I a...
<p>since you are making a text-based game in HTML and css, I first urge you to make sure you have actions to prevent any kind of hacking if it is multiplayer. Anyway, using absolute positioning is a great way to go for items that need to be placed in one spot.</p> <pre><code>.example{ position:absolute; top:5p...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I format a Javascript date like 1950-12-30T18:25:43.511Z<p>I have an API where I the date need to be formatted like this </p> <pre><code>1950-12-30T1...
<p>You are trying to put the date into ISO format and the native <code>Date</code> object will do that for you, fairly simply, with the <code>.toISOString()</code> method:</p> <pre><code>var newDate = new Date("0977-03-28"); console.log(newDate.toISOString()); </code></pre> <p>The result of that is: <code>0977-03-28T...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: android get an integer from a spinner similar to that of the method used for strings<p>In two parts of my app I have spinners. One spinner provides a set of...
<p>If I understand your problem, I think you need a conversion from string to int. Try that : </p> <p>Java Method:</p> <pre><code>//Get spinner selection final Spinner userInputSpinner = (Spinner) findViewById(R.id.spinnerInt); int TYPE = Integer.parseInt(userInputSpinner.getSelectedItem().toString()); </code></pre> ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Spring Integration Http with Spring Boot and @RequestMapping<p>i try to develop a SpringBoot Rest Server with Spring Integration HTTP -> inboundGateway.</p> ...
<p>No; you seem to have a basic misunderstanding.</p> <p>With Spring Integration, the inbound-gateway <strong>replaces</strong> the<code>@Controller</code>, and sends the inbound (possibly converted) object as the payload of a message to the <code>requestChannel</code>.</p> <p>Some other component (not a controller) ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to escape backspace in XML with Java?<p>How to escape backspace ('\b') in XML with Java? StringEscapeUtils.escapeXml doesn't work. </p> <p>Thank you in ...
<p>Backspace (0x08) is not a legal character in XML 1.0; no amount of escaping will change this. It is a legal character in XML 1.1, provided that it is written in escaped form as <code>&amp;#x8;</code> or equivalent.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Merging nested object fields into a single nested array field in MongoDB Aggregation<p>As part of my aggregation pipeline I have the following scenario. This...
<p>You can try this :</p> <pre><code>db.collection.aggregate([ { $unwind: '$TopLevelField' }, { $group: { _id: '', 'UniqueFieldName': { $push: '$TopLevelField.UniqueFieldName' }, 'UniqueFieldName2': { $push: '$TopLevelField.UniqueFieldName2' }, 'UniqueFieldName3': { ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: XSD Validation Using Schema Issue<p>I have a xml file like</p> <pre><code>&lt;root&gt; &lt;requestId&gt;1&lt;/requestId&gt; &lt;subRequest&gt; &lt;i...
<p>You could do the following:</p> <h2>Unmarshaller.Listener &amp; ValidationEventHandler</h2> <p>You could create a combination <code>Unmarshaller.Listener</code> and <code>ValidationEventHandler</code> for this use case.</p> <pre><code>import javax.xml.bind.*; public class SubRequestValidator extends Unmarshaller...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Delphi dynamic array with tlist<p>I'm creating a simple interpreter in Delphi/Lazarus for a language similar to BASIC. I already achieved a lot of functional...
<p>As I read your question, you want to convert from a tuple of indices to a linear index, assuming row major storage. </p> <p>Suppose the dimensions are held in a dynamic array, <code>dim</code> and the indices are in a dynamic array, <code>idx</code>. Then the linear index is calculated like this:</p> <pre><code>fu...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Installing SynEdit gives errors<p>I have been trying to install SynEdit for the last two weeks but no luck. i downloaded its latest version, (I have Delphi X...
<p>Follow these instructions:</p> <ol> <li>Clone the github repo: <a href="https://github.com/SynEdit/SynEdit" rel="nofollow">https://github.com/SynEdit/SynEdit</a></li> <li>Open the XE2 group project in <code>Packages\DelphiXE2.groupproj</code>.</li> <li>Add <code>SynHighlighterJSON</code> to <code>SynEdit_DXE2</code...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Append image to <td> via jquery<p>I'm struggling with an issue appending an image to an <code>&lt;td&gt;</code>-element . Unfortunately I'm not able to show ...
<p>I hope this will work, don't go for function</p> <pre><code> var img = "&lt;img src='img/green_circle.png' /&gt;"; if(picIdentifier != 'green') { img = "&lt;img src='img/red_circle.png' /&gt;"; } $(table).find(tbody).append( "&lt;td&gt;"+ img +"&lt;/td&gt;"); </code></pre> <p>you can not return the el...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Storing a constant in SSE register (GCC, C++)<p>Hello StackOverflow community</p> <p>I have encountered a following challenge: In my C++ application I have ...
<p>One note, you need to be more specific on how you do compile things and probably provide minimal example. I know it might not be best answer because of this, but I think it's good enough. It got long but it's because of codes. </p> <p><strong>Bottom line of below work is that it should be safe to leave for the comp...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Azure Container Instance not using public IP<p>Tldr: The issue is that the IP address the agent uses doesn't match the public IP address attached to the cont...
<p>I just tried with a simple curl container, outgoing IP is different with the IP the container is exposed on. This is something I'd expect to see as well (I believe it would be using Kubernetes underneath). Nothing you can do about that.</p> <p>You can create a container in the VNet, hence you won't need to whitelis...