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: Laravel Routes with Vue Router (SPA) Not Working as normal<p>I am trying to create a Laravel Vue SPA application. And it seems that I cannot get the route al...
<p>So I finally got it working I've changed my routes to </p> <pre><code> Route::get('/{any}', 'SiteController')-&gt;where('any', '^(?!api).*$'); </code></pre> <p>and move all my API requests to the api.php file</p> <pre><code>Route::resource('/posts', 'WordpressController'); </code></pre> <p>router.js and axios wo...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Ruby on Rails: will_paginate is not working. Next page still showing all comments<p>So I have no idea what I'm doing wrong here, but my will_paginate method ...
<p>Your error is very simple :) This line :</p> <pre><code>&lt;% @user.comments.each do |comment| %&gt; </code></pre> <p>Should be replaced by :</p> <pre><code>&lt;% @comments.each do |comment| %&gt; </code></pre> <p>Because you were not using the filtered array</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: CGRectOffset animation misbehaved when working with TextField<p>The task is to move the textfield up when user done editing.</p> <p>Right now, I have a text...
<p>With <code>auto layout</code> change your <code>moveTextFieldToTheTop</code> method with this:</p> <pre><code> - (void)moveTextFieldToTheTop { //TODO update _textField's constraint to move _textField 100pt up [_textField setNeedsLayout]; [UIView animateWithDuration:0.3 animations:^{...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to show data from database in wordpress?<p>I am trying to add following code in WordPress, but I cant find the right way to do it. Please help me someone...
<p>You should use the Wordpress db connection. Try this simple code and adapt it for your needs.</p> <pre><code>global $wpdb; $query = "SELECT COUNT(*) as t_records FROM wp_posts"; $result = $wpdb-&gt;get_results($query); var_dump($result); </code></pre> <p><a href="http://codex.wordpress.org/Class_Reference/wpdb" re...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Extract uppercase letters and numbers<p>I'm trying to process a string so that only uppercase letters and digits are taken. Trying to use PATINDEX because I ...
<p>You can do this using <a href="https://msdn.microsoft.com/en-us/library/ms184391.aspx"><code>COLLATE</code></a> and the a case sensitive collation such as <code>Latin1_General_BIN</code>:</p> <pre><code>DECLARE @string varchar(100) SET @string = 'AbcDef12-Ghi' WHILE PATINDEX('%[^A-Z0-9]%',@string COLLATE Latin1_G...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: overlay conflict with query live search<p>On a onepager website i've a livesearch implemented which works as a overlay. The results are shown like this:</p> ...
<p>The problem is that you are binding to the click event on elements that don't exist yet. Since the event is bound on page load, but the search function renders the <code>.clk_s</code> elements way after that, they will never trigger the event handler.</p> <p>One way to solve this is to bind the handler on a parent ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Swift didReceiveRemoteNotification - Navigate to rootviewcontroller no matter where in app user is located (Now With Error Message)<p>Upon receiving push not...
<p>Try this code In your method :</p> <pre><code>var rootViewController = self.window!.rootViewController let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil) var setViewController = mainStoryboard .instantiateViewControllerWithIdentifier("CurrentShows") as ViewController_CurrentShow...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Perform conditional operation on records having same keys<p>I have a table which looks like this -</p> <pre><code>City MobilePlan Scranton ...
<p>You had it almost right, what you need i a subquery that is not in city.</p> <p>The Distinct is there, because you have for Seattle 2 Limited Rows and so it shows only once in the result. </p> <blockquote> <pre><code>CREATE TABLE Table1 (`City` varchar(10), `MobilePlan` varchar(10)) ; INSERT INTO Table1 ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What happens when a transaction is being carried out during backing up of LDF files?<p>My DB Admin advised that I should regularly take backup of <code>.ldf...
<p>You must read Article <a href="https://technet.microsoft.com/en-us/magazine/2009.07.sqlbackup.aspx#id0980040" rel="nofollow">Understanding SQL Server backup</a> by Paul Randal. That is the best I can see which is available and can explain you in details various aspects.</p> <p>Coming to your question a transaction ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Angular 8 not updating globally to 9 on mac<p>I am using a mac and I currently have version 8 of Angular installed.</p> <p>I want to upgrade to Angular 9 so...
<p>First you need to uninstall the existing angular cli packages followed by npm cache verify command to clear the cache related problems.</p> <p>And the install the Angular CLI version again by using npm install -g @angular/cli@latest</p> <p>Since you are on mac you can try it with sudo</p> <pre><code>sudo npm unin...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: global variable is not set in jquery<pre><code>$(function(){ var bwr_w = null; //global variable //below function gets the dynamic data function my...
<p>The issue is because the <code>$.ajax</code> call is asynchronous. This means that your <code>myfunc</code> is exited <em>before</em> the data is returned from the AJAX call. To fix this issue, put all code dependent on the returned data within the callback:</p> <pre><code>$(function () { var bwr_w = null; //gl...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to remove all alphanumeric words from the text?<p>I'm trying to write regular expression in PHP which simply would <strong>remove alphanumeric words (wor...
<p>How about replacing <code>\b(?=[a-z]+\d|[a-z]*\d+[a-z]+)\w*\b\s*</code> with nothing?</p> <p>Demo: <a href="https://regex101.com/r/jA2fW3/1" rel="nofollow">https://regex101.com/r/jA2fW3/1</a></p> <p>Pattern code:</p> <pre><code>$pattern = '/\b(?=[a-z]+\d|[a-z]*\d+[a-z]+)\w*\b\s*/i'; </code></pre> <p>To match alp...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Restrict acess to port 8000 ( Using Apache ) - Ubuntu 14.04 Lts<p>I am really need of the help of <code>Stackflow</code> , I'm from Brazil , so.. Sorry for m...
<p>Redirect request coming in on port 8000 to a different virtual host and to this add tighter access restrictions.</p> <p>Then proxy this virtual host to the application listening on port 8000.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to speed up nearest search in Pandas (perhaps by vectorizing code)<p>I have two dataframes. Each one contains locations (X,Y) and a value for that point...
<p>One cool solution to your problem involves leveraging the <code>complex</code> data type (builtin in python and numpy).</p> <pre><code>import numpy as np import pandas as pd df1=pd.DataFrame(np.random.rand(10,3), columns=['val', 'X', 'Y']) df2=pd.DataFrame(np.random.rand(10,3), columns=['val', 'X', 'Y']) # datafr...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is the equivalent of SSLSessionID for TLS1.3 sessions<p>In TLSv1.2 the client was able to resume with the SSLSessionID. This ID stayed constant among mu...
<p>TL;DR: There is no strict equivalent, as the feature was dropped. But new session tickets were introduced for similar needs.</p> <p><a href="https://www.rfc-editor.org/rfc/rfc8446#section-2.2" rel="nofollow noreferrer">RFC 8446</a> on TLS 1.3 says this:</p> <blockquote> <p>2.2. Resumption and Pre-Shared Key (PSK)</...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Scope in Functions vs. Methods<p>I am wondering why a method of a class doesn't look into its enclosing scope, if a name is not defined.</p> <pre><code>def ...
<p>Scopes are searched <a href="https://docs.python.org/3.3/tutorial/classes.html#python-scopes-and-namespaces" rel="nofollow noreferrer">as follows</a>:</p> <blockquote> <ul> <li>the innermost scope, which is searched first, contains the local names</li> <li>the scopes of any enclosing <strong>functions</strong...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Query to Insert the sum of salaries department wise in a table<p>Suppose I have a table whose data is</p> <pre><code>EMPNO ENAME SAL DEPTNO TOTAL 7839 ...
<p>Try this :</p> <pre><code> Update table_name t2 set t2.TOTAL= (select t1.temp from (select DEPTNO ,sum(SAL) temp from table_name group by DEPTNO) t1 where t1.DEPTNO=t2.DEPTNO); </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Using a Javascript font select inside a form<p>I'm currently using this script to select a font style, how would I include <code>name="font_style"</code> and...
<p>In the <code>fd-font-dropdown</code>-div, you should include an <code>&lt;input /&gt;</code>-element that will hold the selected font in the <code>value</code> attribute.</p> <p>In the <code>changeFont</code>-function you're already setting the <code>selectedIdx</code> value, so this should do the trick:</p> <pre>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Absolute path of localhost coming after migrating to server in wordpress<p>My website is <a href="http://clg2.givemyspace.com/" rel="nofollow">http://clg2.gi...
<p>There are many ways you can do to fix that, the first comes to my mind is doing a <a href="https://wordpress.org/plugins/search-and-replace/" rel="nofollow">Search and Replace</a> on your live site.</p> <p>Search for: <code>http://localhost:7443/</code></p> <p>Replace with: <code>http://clg2.givemyspace.com/</code...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: which security modes are allowed for WCF MTOM basicHttpBinding<p>I have created new wcf service with <code>MTOM</code> message-encoding in <code>basicHttpBin...
<p>Neither the Text encoding nor the MTOM encoding will affect the invocation of the remote service. The following two security modes can use <code>Windows Authentication</code>. On my side, it works fine. Please tell me the details of the error. </p> <pre><code>Uri uri = new Uri("http://localhost:21011"); ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Piping stdout of Process to another stdout<p>I'm trying to start a curl download and then pipe it's stdout to the stdout of my program. Here's what I got (st...
<p>Instead of using <code>wait_with_output</code>, just read from the pipes that are part of <code>process</code>. When you can't read anymore, then you can wait for the process. Here's an example with no error handling:</p> <pre><code>#![feature(old_io)] use std::old_io::process::Command; use std::old_io::stdio; fn...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: python - use if statement to check if entry is already in a list<p>I have a list of list of float lists and I want to test if a value pair (e.g. [2.0, 1.1]) ...
<p>Got it solved. I edited the result line now:</p> <pre><code>result[i] = array_a_list.index(array_a_list[i]) </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Fancy indexing with assignment for numpy array<p>I have a 2 dimensional numpy array:</p> <pre><code>A = np.zeros(16).reshape(4,4) </code></pre> <p>I want t...
<p>Normally, when you use arrays to index another array this way, <code>numpy</code> expects each array <code>R</code>, <code>C</code>, and so on, to have the same shape. So for example, suppose you want to extract the nonzero values from this array:</p> <pre><code>&gt;&gt;&gt; a array([[1, 3, 0, 0], [0, 0, 0, ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can you efficiently store many large documents in Firestore?<p>I have blobs of data that are large (greater than 500kB in size), but that will always be smal...
<p>The size of a document has no effect on the performance of queries in the Cloud. What it will affect is the time it takes to transfer the contents of those documents to your client app. Obviously, larger documents will take more time to transfer. But the query itself is not going to take more time.</p> <p>Firest...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to use variable in html in row and column tag shell script<p>I am trying to create a script which uses text file as input, compares values against a thre...
<p>I'm not sure about the output that you are expecting, but this could work?</p> <pre><code>awk 'BEGIN{ FS=" " print "&lt;TABLE border=1 cellspacing=0 cellpadding=3&gt;&lt;TR&gt;&lt;TH&gt;HOST&lt;/TH&gt;&lt;TH&gt;APP_HOST1&lt;/TH&gt;&lt;TH&gt;APP_HOST2&lt;/TH&gt;&lt;TH&gt;APP_HOST3&lt;/TH&gt;&lt;TH&gt;APP_HOST4&lt;/...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PHP: get the number of arguments to script<p>I cannot find (aka: <code>don't have time to read all the manuals</code>) a way to get the number of arguments p...
<p>Use <a href="http://php.net/manual/en/function.count.php" rel="nofollow">count</a></p> <pre><code>$arg_num = count($_GET); </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Integer casting within arithmetic expressions in Kotlin<p>In the following Kotlin code example I expected the value of parameter <code>i</code> to be equal t...
<blockquote> <p>I expected the value of parameter i to be equal to 0</p> </blockquote> <p>The output is arithmetically right: <code>100 * 1 / 100 = (100 * 1) / 100 = 100 / 100 = 1 / 1 = 1</code> </p> <blockquote> <p>, such as is the case for the parameter k.</p> </blockquote> <p>The value <code>j</code> is <cod...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I stop more than 1 bullet firing at once?<pre><code>import pygame pygame.init() red = 255,0,0 blue = 0,0,255 black = 0,0,0 screenWidth = 800 screenH...
<p>The general approach to firing bullets is to store the positions of the bullets in a list (<code>bullet_list</code>). When a bullet is fired, add the bullet's starting position (<code>[start_x, start_y]</code>) to the list. The starting position is the position of the object (player or enemy) that fires the bullet. ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: I'm working on a Metric Converter project for a class and I am not sure how to correctly use radio buttons?<p>I'm working on a Metric Converter project for a...
<p>While I'm not completely sure of the issue you are having, it looks like you have the text you want next to the radio button just hanging out there in the file when you type: "Fahrenheit to celsius" "Miles to kilometers" And "Ounces to grams"</p> <p>This might be causing problems, as you don't want text just sitti...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I use Express and Ampersand simultaneously?<p>I'm creating a D3 app that's going to display some simple data using an Express server, and Ampersand on...
<p>You shouldn't need to use ampersand for this specific example, in fact, I wouldn't use it at all for this specific problem (and I'm an ampersand author).</p> <p>What you're trying to do is load the data.tsv file off the server, and get the data in to d3. Normally you'll grab data from a server from the browser with...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Openpyxl: TypeError - Concatenation of several columns into one cell per row<p>I am new to openpyxl and cannot figure out what the reason for my error is. I ...
<p>Using <code>openpyxl</code>, I created a little function that will do what you want for a line at a time:</p> <pre class="lang-py prettyprint-override"><code>import openpyxl theFile = openpyxl.load_workbook('T013.xlsx') allSheetNames = theFile.sheetnames print("All sheet names: {}" .format(theFile.sheetnames)) s...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How does neo4j do basic storage structure<p>What is the basic 'unit of storage' for the neo4j database engine? For example, for a relational database, it mig...
<p>Since a node can stand alone (without being connected to any relationships), neo4j cannot use a "connection" (ie, "relationship") as the single "basic unit of storage".</p> <p>In fact, if you look in the <a href="https://neo4j.com/docs/operations-manual/current/configuration/file-locations/#file-locations-locations...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Use drawer navigation without having a Screen inside it<p>I have a following <code>stack navigator</code></p> <pre class="lang-js prettyprint-override"><cod...
<p>I saw your issue and I am trying to helping you. I have made a custom design for drawer components. -firstly you can create an extra file for drawer Design like <code>DrawerComponent.js</code> and import in your code where you are creating a drawer navigator</p> <pre><code>import DrawerComponent from "./DrawerCompo...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there any way to use cloudinarydotnet or Cloudinary for .net nuget package in Windows Phone 8<p>I want to Upload Images Captured by CameraCaptureService(...
<p>Seems like the <a href="http://cloudbase.io/blog/tag/storage/" rel="nofollow noreferrer">Windows Phone Helper Class</a> has made it possible for images to upload to <code>Cloudinary</code>.</p> <p>Additional reference:</p> <p><a href="https://stackoverflow.com/questions/19192638/">Win Phone 8 / Asp .Net Web API Im...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Tag changes it value<p>I don't understand why the tag equal 0 for the third times.</p> <pre><code>UIButton *b1; - (void)viewDidLoad { b1 =[[UIButton al...
<p>When you do that:</p> <pre><code>b1 = [UIButton buttonWithType:UIButtonTypeRoundedRect]; </code></pre> <p>You are making a new button.</p> <p>You can change your code for that:</p> <pre><code>UIButton *b1; - (void)viewDidLoad { [super viewDidLoad]; b1 = [UIButton buttonWithType:UIButtonTypeRoundedRect]; b1...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to Replace Or Update div based on its id<p>I have a div as shown </p> <pre><code>&lt;div id="mycontainer"&gt; &lt;div class="lastItm_Wrap" id="lastw...
<p>You had few errors, you was using .replaceadd instead #replaceadd, your was loooking for #mycontainer.lastwrap703 when was #mycontainer > #lastwrap+id, and you must close the <em>"</em> in $("#mycontainer)</p> <p>Code modified:</p> <pre><code>$(document).on('click', '#replaceoradd', function (e) { // update ex...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I always get the same result using the multivariate_normal.cdf function from scipy.stats?<p>In this example, I'm using the function multivariate_norm...
<p>Because the CDF has to be calculated by numeric integration in a multidimensional space, the <code>multivariate_normal</code> object has relatively low relative and absolute tolerances for convergence. Additionally, the number of points to consider for integration is by default <code>1000000 * ndim</code>, which in...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to create a Scala Jdbc program using Option to handle null while returning connection?<p>I am trying to write a scala-jdbc program which will run an anal...
<p><code>asInstanceOf[]</code> doesn't work that way. It won't just create an <code>Option[]</code> for you.</p> <pre><code>val x:Option[Int] = 5.asInstanceOf[Option[Int]] //not gonna happen </code></pre> <p>You have to create the <code>Option[]</code> explicitly.</p> <pre><code>val x:Option[Int] = Option(5) </code...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Finding out which tables are different in two versions of a database<p>I have 2 versions of a database (say <code>db_dev</code> and <code>db_beta</code>). I'...
<p>Using <code>information_schema</code>, here is how it works.</p> <p>First, you know that the <code>information_schema.COLUMNS</code> table contains the columns definition. If one column has been changed, or a table does not exist, it will reflect in the <code>information_schema.COLUMNS</code> table.</p> <p>Difficu...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Passing array by value in c#<p>As far as I understand, the default type or argument passing in <code>c#</code> is by value. Therefore no statement is require...
<blockquote> <p>As far is i understand, the default type or argument passing in c# is by value.</p> </blockquote> <p>Unfortunately it is a bit more complicated and also has some execptions:</p> <p>Reference types like <code>Decomposition</code> you hand in by making a copy of the reference. Unfortunately that means...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What's wrong with this Lambda expression?<p>This is my code:</p> <pre><code>var coordinateTratte = doc.Descendants(ns + "Folder").First().Descendants(ns + "...
<p>The problem is that your lambda expression tries to return items "piecemeal" using a loop, while <code>Select</code> expects it to return the whole thing at once.</p> <p>You can fix your code in several ways - for example, you could convert your <code>foreach</code> loop to a <code>Select</code>, and use <code>Sele...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Self Hosted WCF via MSMQ Simple Injector Lifestyle<p>I'm using WCF (self-hosted) using MSMQ bindings and wanted to use the <a href="https://simpleinjector.re...
<p>I ended up using a per execution scope and defining that scope within the WCF service operation itself. By scoping it that way, it ensured the dependencies opened and closed when I wanted them to.</p> <p>I needed to include <a href="http://www.nuget.org/packages/SimpleInjector.Extensions.ExecutionContextScoping/" ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: AngularJS storing data from ng-repeat models in object<p>I'm trying to get an object like this:</p> <pre><code>$scope.order = { 'client' : '24', ...
<p>In your view:</p> <pre><code>&lt;ul class="list"&gt; &lt;li ng-repeat="product in products | orderBy: 'name'"&gt; &lt;p&gt; &lt;a ng-bind='product.name'&gt;&lt;/a&gt; &lt;input type="checkbox" ng-change="show()" ng-model="order.products.id[$index]" value="1" ng-true-value="{{product.id}}" ng-fal...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: BigQuery - day of week number where Monday = 1<p>Is there a standard way to return "day of week number" (1-7) in ISO standard (Monday = 1) from a date in Big...
<p>Below is example of such function - just one of many options you can come with </p> <pre><code>#standardSQL CREATE TEMP FUNCTION ISODAYOFWEEK(day DATE) AS (( SELECT IF(weekday = 0, 7, weekday) FROM UNNEST([EXTRACT(DAYOFWEEK FROM day) - 1]) weekday )); </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: new product added from admin takes time to show on site<p>I tried to run a couple of tests for adding products from admin login and then checking whether new...
<p>The SOLR indexing service is by default configured to run once every 60 minutes. This setting can be adjusted in the <code>common.properties</code> file, property name <code>solr.index.repeat.interval.</code> So to change the service to run every 3 minutes, the property would be set like this: </p> <pre><code>solr....
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Get first N records from stored procedure result set in SQL Server<p>Is there is any solution / query to get first N records from stored procedure result wit...
<p>You can use <a href="https://www.w3schools.com/sql/sql_top.asp" rel="nofollow noreferrer"><code>TOP</code></a> clause to achieve it</p> <p><strong>Syntax</strong></p> <pre><code>SELECT TOP number|percent column_name(s) FROM table_name WHERE condition; </code></pre> <p>Let's say that you have <code>Your_stored_p...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: LEFT JOIN across three tables (with junction table)<p>In Postgres, is there a way to perform a <code>left join</code> between tables linked by a junction tab...
<p>One method is to do the comparison in the <code>where</code> clause:</p> <pre><code>select h.*, p.* from humans as h left join humans_pets_junction as j on j.human_id = h.id left join pets as p on j.pet_id = p.id and p.name = 'fluffy' where h.id = 13 and (p.name = 'fluffy' or p.id is null); </co...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Xamarin Forms Get Object element on image click<p>I have a problem. I created a CollectionView from a List called: <code>List&lt;Set&gt; Sets</code> and in a...
<p>Instead of using an click event, you should use <code>Command</code> and <code>CommandParameter</code> and use the BindingContext of the parent Collection</p> <pre><code>&lt;CollectionView ItemsSource="{Binding Sets}"&gt; &lt;CollectionView.ItemsLayout&gt; &lt;GridItemsLayout Orientation="Vertical" /&gt...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Fatal error stating "Call to a member function bind_param() on a non-object"<p>I've gotten a fatal error, which I do not know where went wrong.</p> <p>My Ca...
<p>If you have noticed, when you echo your prepared statement, it will look just like this:</p> <pre><code>SELECT c.category, c.title, c.imageFROM category c WHERE status=? </code></pre> <p>That simple space is important also in the middle of <code>c.image</code> and <code>FROM</code> to make the query valid.</p> <p...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Tabs become unresponsive<p>I am trying to replicate the "tabs" section as explained in this tutorial: <a href="http://fezvrasta.github.io/bootstrap-material-...
<p>It was the fault of the DatePicker plugin. This line of code</p> <pre><code>$(document).unbind('click') </code></pre> <p>stopped bootstrap's propagation of the menu.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: IntelliJ Maven/Gradle Proxy isnt working<p>I setup a Android Gradle Application with Robolectric.</p> <p>I used this <a href="http://www.bignerdranch.com/bl...
<p>The problem was that I used the gradle wrapper provided by IntelliJ. I edited the settings.xml of me installed version of Gradle. </p> <p>I changed the used gradle distribution to my local installed one and wow. It works. :)</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python language-center of a circle using OOP<pre><code>class Point: def __init__(self, initX, initY): """ Create a new point at the given coordi...
<p>Both <code>getX</code> and <code>getY</code> are methods in your code, not attributes. So you will need to call them using <code>getX()</code> and <code>getY()</code>.</p> <p>So <code>ma=(p2.getY-p1.getY)/(p2.getX-p1.getX)</code> becomes:</p> <pre><code>ma = (p2.getY()-p1.getY())/(p2.getX()-p1.getX()) </code></pre...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: DatagramChannel Send Missing On Wire<p>I'm seeing some occasional missing data with a datagram channel in a tool I'm developing. UDP is part of the requireme...
<p>I actually ended up discovering the cause with more fiddling in Wireshark. I was unintentionally filtering out ARP requests, which seem to be the cause of the problem, as mentioned in <a href="https://stackoverflow.com/a/12598104/2158663">this answer</a>: </p> <blockquote> <p>ARP queues only one outbound IP datag...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How mobile top up sites work<p>I'm developing mobile top up site, and how i'm planning to implement the idea is below. I've developed a site for user where t...
<p>There is a thing called jolo which gives api for mobile recharge ,dth rechrge etc, Please read this pdf it may be helpful <a href="http://www.jolo.in/Jolo_Recharge_API_Docs.pdf" rel="nofollow">http://www.jolo.in/Jolo_Recharge_API_Docs.pdf</a></p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Regular expression to replace inner credit card numbers with X's?<p>Is it possible to use regex to replace all characters in a card number with an X, except ...
<p>use this pattern </p> <pre><code>(?&lt;=\d{4})\d(?=\d{4}) </code></pre> <p>and replace w/ <code>X</code><br> <a href="https://regex101.com/r/yW4aZ3/195" rel="nofollow">Demo</a></p> <pre><code>(?&lt;= # Look-Behind \d # &lt;digit 0-9&gt; {4} # (repeated {4} times) ) ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to Pivot with Columns in SQL SSRS<p>Would you know if my script is missing anything additional, I am trying to pivot the Table "Pay_Details" and to have ...
<p>In the pivot you are using aliases, you need to use literals. This means you either </p> <p>a. Need to know the names of the columns you want before hand (unlikely as data will change)</p> <p>b. build the pivot statement using dynamic sql. There are plenty of examples of how to do this on SO.</p> <p><strong>Howev...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: the type of namespace of rows could not be found<p>I get the error as below:</p> <blockquote> <p>the type of namespace of rows could not be found</p> </bl...
<p>Your name space DataGridView1 is creating the ambiguity here. Is your control's ID "dataGridView1" with a lower case "d"?</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Save mysql while loop data into arrays and then save into database<p>First of all my apopoliges , this may b a possible duplicate question, I searched and fo...
<p>You can use a <code>foreach</code> loop to loop over one of the repeated inputs, and then use the index to access the corresponding elements in the others:</p> <pre><code>foreach ($offerid as $i =&gt; $offer) { $offer = mysql_real_escape_string($offer); $name = mysql_real_escape_string($offername[$i]); ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: littler determine if running as deployed<p>I am pretty excited to have found Jeff and Dirk's application littler to run R functions from terminal. ¡kudos!<b...
<p>I don’t know whether there’s a littler specific answer. But in general it is <strong>impossible</strong> (or very hard) in R to determine how the code is run, which was one of the motivations for my work on <a href="https://github.com/klmr/modules" rel="nofollow"><em>modules</em></a>.</p> <p>The only thing R knows ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is wrong with my string substitution using sed on Mac OS X?<p>I want to replace <code>#Banner none</code> with <code>Banner /etc/sshd_banner</code> that...
<blockquote> <p>Use another delimiter</p> </blockquote> <p>Eks here I do use <code>&quot;</code> as delimiter</p> <pre><code>sudo sed -i &quot;&quot; &quot;s|#Banner none|Banner /etc/sshd_banner|&quot; /etc/sshd_config </code></pre> <p>By changing the delimiter, you do not need to escape the <code>/</code></p> <p>Your ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can we use OAuth to authenticate the consumers in my Web API?<p>I am developing a web application, mobile application and desktop application which all can a...
<p>Add the following lines in startup class</p> <pre><code> public class Startup { public void Configuration(IAppBuilder app) { var oauthProvider = new OAuthAuthorizationServerProvider { OnGrantResourceOwnerCredentials = async context =&gt; ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Subclassing from classses with Java Constructors throwing Exceptions<p>My understanding is that overriding method in subclass should throw no exception or na...
<blockquote> <p>Why does it work the opposite in constructors, the constructor of subclass has to throw the same exception or wider, Any reasonable explanation for this?</p> </blockquote> <p>A subclass constructor always invokes its parent constructor with a call to <code>super(..)</code>. In this case, the pare...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I get kotlin-logging (MicroUtils) to print to subclass name instead of abstract class name?<p>I'm using kotlin-logging (<a href="https://github.com/Mi...
<p>You may want to send the logger to the abstract class.</p> <pre><code>// in A.kt file: import mu.KotlinLogging abstract class A&lt;T&gt;(private val logger: KLogger) { fun someMethod(item: T?) { logger.info("testing") } } fun main() { val b: A&lt;String&gt; = B() b.someMethod("123") } ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: map an XML file's node<p>I have an XML file of depth-N. (N might vary) I want to travel all nodes and parse node names into a list of string. Basically I wan...
<p>You can use <code>XDocument</code>. Use the following code to get the result : </p> <pre><code>public List&lt;string&gt; GetList() { List&lt;string&gt; result = new List&lt;string&gt;(); XDocument d = XDocument.Load(@"c:\text.xml"); foreach (var name in d.Root.DescendantNodes().OfType&lt;XElement&gt;()....
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: MySQL GROUP on a column based on other column but also exclude duplicates based on the second column<p>I have this database</p> <pre><code>+----+-------+---...
<p>The problem is that, by placing a condition on the <code>status</code> in the <code>where</code> clause, you eliminate rows before you have a chance to check their content. Instead, you can filter with an another <code>having</code> condition that does conditional aggregation:</p> <pre><code>select sceneid, count(*...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Angular JS 1.3 - Animating Ng-Repeat and Ng-Show Elements<p>I have a list of <code>ng-repeat</code> items. Only one of the items are shown at any one time a...
<p>I don't think you will get quite the affect you are looking for with showing/hiding the elements within, because they will always be in the same order. But to accomplish what you are asking you would need to <em>target the class that is being added/removed for the fade out</em>, and the <em>basic</em> class for the ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why does not insert these values in database using Ajax<p>I used tutorialspoint to guide me to insert the values from input text into the db, but unfortunate...
<p>change your code to the bellow </p> <pre><code>var queryString; queryString = "fname=" + fname + "&amp;lname=" + lname+ "&amp;gen=" + gen; ajaxRequest.open("GET", "ajax.php?" + queryString, true); </code></pre> <p>and make sure ajax.php is in the same folder as index.php</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: COBOL85: How to find number of rows in an array dynamically<p>In my program I keep filling the following array with data obtained from a database table then ...
<p>I solved the problem by adding an array line counter (LINE-COUNTER-1) to count (ADD 1 TO LINE-COUNTER-1) how many times I add data to the array and stop writing the report when "WRITE-COUNTER = LINE-COUNTER-1"</p> <pre><code> INSPECT-PROCESS. MOVE 0 TO TALLY-1 ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Button event is not invoked<p>I've problem that my button click is not working ,currently I use the following code ,this is the view</p> <pre><code>&lt;!DOC...
<pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head lang="en"&gt; &lt;meta charset="UTF-8"&gt; &lt;title&gt;&lt;/title&gt; &lt;script src="https://code.jquery.com/jquery-2.1.3.min.js"&gt;&lt;/script&gt; &lt;script src="file.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;input type="button" id...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Ruby multidimensional array assignment disparities<p>Can someone please explain the difference in output between these two cases:</p> <pre><code>array = [['...
<p>The issue with your second technique is that you are creating a single array <code>['a', 'a']</code> and putting it in both positions in the <code>array</code> array. You need to <code>clone</code> the items in <code>array</code> so they aren't literally the same item.</p> <pre><code>array = [['a'] * 2] * 2 # =&gt;...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Plot SVM margins using MATLAB and libsvm<p>I am using svmlib to classify linearly two dimensional non-separable data. I am able to train the svm and obtain w...
<p>It depends on what you mean by "the margins". It also depends on what SVM version you are talking about (separable on non-separable), but since you mentioned libsvm I'll assume you mean the more general, non-separable version.</p> <p>The term "margin" can refer to the Euclidean distance from the separating hyperpla...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Android lollipop shared elements transition blink / flash<p>I see strange thing in my shared element transition on Lollipop. Shared elements are flickering j...
<p>Hurray! I've managed to solve this problem. </p> <p>Blinking screen is common problem described here: <a href="https://stackoverflow.com/q/28364106/844882">Blinking screen on image transition between activities</a> (thx @AlexLockwood)</p> <p>Blinking shared element was caused by DrawerLayout. I was starting new Ac...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Hibernate search across two entities without an embedded index<p>I am trying to use Hibernate Search 6 and elastic search A simple example of what I am tryin...
<p>My entities </p> <pre><code> @Indexed public class Book extends PanacheEntity{ public String title; public String authorName; @OneToMany(mappedBy = "book", fetch = FetchType.LAZY, cascade = { CascadeType.REMOVE }) public List&lt;BookShopRelation&gt; bookShopRelation = new ArrayList&...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Simple vanilla JavaScript event listener not working<p>I have written a simple JavaScript event listener for a JavaScript program I am currently building- I ...
<p>Here <code>var modalbtn = document.getElementsByClassName('style');</code>, modal button is a collection of elements. Therefore , <code>modalbtn.addEventListener('click', openModal);</code> wont work here.</p> <p>Add</p> <pre><code>var modalbtn = document.getElementsByClassName('style'); modalbtn.forEach(function(...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Admob SDK - iOS -File not found<p>I have installed Google Analytics and Google AdMob SDK in my iOS project using Cocoapods. I have implemented both the funct...
<p>Starting at AdMob 7.0, AdMob has made the SDK a framework. Import it like so:</p> <pre><code>#import &lt;GoogleMobileAds/GoogleMobileAds.h&gt; </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Composite index or single index?<p>In a table I have a <code>Date</code> column and I want to group by month and year.</p> <p>I've created two columns: <cod...
<p>Well they say the best way to find out is to actually do it :) </p> <p>Created a table with 100,000 rows . </p> <pre><code>CREATE TABLE DateTable (DateColumn DATETIME , DateMonth INT , DateYear INT) GO declare @FromDate date = '1970-01-01' declare @ToDate date = '2015-12-31' INSERT INTO DateTable(DateColumn) se...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: nullPointer Exception, where do I go wrong?<p>I'm working my way into the Head First Java book, and now trying to build a Chatroom. I have a ChatServer and a...
<p>The <code>clientOutputStreams</code> that you are using in <code>go</code></p> <pre><code>List&lt;PrintWriter&gt;clientOutputStreams = new ArrayList&lt;&gt;(); </code></pre> <p>is local to that method</p> <p>The <code>clientOutputStreams</code> used in</p> <pre><code>public void tellEveryone(String message) { ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Suppress output when running pyInstaller-generated executable<p>I've been able to successfully generate a Windows executable from Python 3.4 code by using py...
<p>This is a <a href="https://github.com/pyinstaller/pyinstaller/issues/1140" rel="nofollow">known issue</a>. The temporary solution is to clone and install <code>matysek</code>'s <a href="https://github.com/matysek/pyinstaller/tree/python3" rel="nofollow">fork</a>. Since <code>matysek</code> is a frequent PyInstaller ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: C# method from List to List<p>I made a list of cars, the factory produces every 4 cars broken (<code>public bool Broken;</code>).</p> <p><strong>My code</st...
<p>LINQ query:</p> <pre><code>var goodCars = cars.Where(car =&gt; !car.Broken).ToList(); </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Get posts by followers laravel<p>I want to display a feed page for an authenticated user which shows the latest posts from users that they follow. I have a f...
<pre><code>&lt;?php /** * Get feed for the provided user * that means, only show the posts from the users that the current user follows. * * @param User $user The user that you're trying get the feed to * @return \Illuminate\Database\Query\...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to color a clicked bar from barchart with r, plolty, shiny when having already event_data("plotly_click")<p>I am trying to understand how <code>event_dat...
<p>Here you go mate, I just added the colours based on your what was clicked.<br><br> The line plot was green by default, so we don't need to worry about it.<br> For the first plot I will mutate red color if a category() is clicked. For some reason I was unable to mutate it directly, so I created a plot_data before the...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Using prototype apply vs this to call function<p>On the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/incl...
<p>The answer is that the version of the polyfill using <code>this.indexOf</code> would not conform to the <a href="http://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.includes" rel="nofollow">spec for <code>String.prototype.includes</code></a>, which allows <code>this</code> to be anything conver...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SharpZipLib - adding a ZipEntry to a ZipFile throws a ZipException<p>I'm trying to create ZIP with file from in-memory string and save it. Here is my code so...
<p>The <code>ZipFile.Add</code> method override you're using is for adding directories, volume labels, etc. to a zip file: it <a href="https://github.com/icsharpcode/SharpZipLib/blob/3285f157292b1ced64459d89207d335f9a6879ee/src/Zip/ZipFile.cs#L1738" rel="nofollow">explicitly throws a <code>ZipException</code></a> if yo...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to turn off ui-grid column header formatting<p>so, I have this column definition for my ui-grid</p> <pre><code>columnDefs: [ { name: 'Usr#', fie...
<p>A workaround to no have your header reformatted is to use the displayName field: For instance:</p> <pre><code>columnDefs: [ ... { name: 'PID', displayName: 'PID', field: 'userPID', width: '*', resizable: true}, ... </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Identifying if time intervals overlap with multiple patient IDs, in r<p>I have admission and discharge data from several clinics and need to determine if the...
<p>You can use a join instead of <code>%in%</code>:</p> <pre><code>setDT(have, key=c("datein","dateout")) overlaps &lt;- unique(foverlaps(have, have)[clinic==i.clinic, dnastrain==i.dnastrain &amp; id!=i.id]) cols &lt;- copy(names(have)) have[, overlap := 0][ overlaps, on=cols, overlap := 1][ order(datein)...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: When using inheritance is it necessary to "#include" the header file of child's parent class. C++<p>I'm working on a multiple inheritance project in C++. I h...
<p><strong>Question</strong></p> <blockquote> <p>Do I need to <code>#include "parent.h"</code> in <code>child.cpp</code>, or is it sufficient to have defined the inheritance relationship in <code>child.h</code></p> </blockquote> <p><strong>Answer</strong></p> <blockquote> <p>No, you don't need to <code>#include ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Return smallest value of an array in a function through a foreach loop?<p>I have an array and I would like to return just the lowest value of the array but n...
<p>This question has almost no sense, but if you really need it to be done try:</p> <pre><code>function myForEachLoop(&amp;$StudentPopulation) { ksort($StudentPopulation); $min = 'NO_MIN'; foreach($StudentPopulation as $aSchool =&gt; $aPop) { if($min=='NO_MIN' || $aPop&lt;$min) { $output = '&lt;strong&gt;S...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Products not adding to Codeigniter cart<p>I have an issue with the Codeigniter cart. I have created the code and checked it but every time I add the same pr...
<p>Since you want to process some action on every of your product, try with this:</p> <pre><code>public function addToCart() { $data = $this-&gt;input-&gt;post(); foreach($cart as $item): $id = $data['id']; $qty = $data['qty']; $color = $data['color']; $cart = $this-&gt;cart-...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Compare datetimes, see if one hour has passed<p>I am trying to see if one hour has passed since the creation of a token object. i am using datetime.utcnow wh...
<p>Instead of <code>DateTime.Compare()</code> you can subtract two <code>DateTime</code> and get total hours of resultant <code>DateTime</code>.</p> <p>Something like,</p> <pre><code>var result = (DateTime.UtcNow - tokenEntity.Time_stamp).TotalHours; if(result &gt; 1) { //Do your business logic for expiring token ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Display List return from a controller to a table in view ASP.NET MVC4<p>I have a function in my controller class, it return a list of data, I want to display...
<p>You view is displaying both a list of <code>sample</code> and what appears t be a form for a new <code>sample</code>. Start by creating a view model to represent what you want to display/edit</p> <pre><code>public class SampleVM { public SampleVM { SampleCollection = new List&lt;sample&gt; } public Li...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Helm Rocket.Chat: Error in /app/bundle/programs/server/node_modules/fibers/future.js<p>I just created a kubernetes cluster in AWS. What I am trying to do is ...
<p>The issue is with the suggested way to generate passwords on rocket chat's helm chart. They tell you to run:</p> <pre><code>helm install stable/rocketchat --set mongodb.mongodbPassword=$(echo -n $(openssl rand -base64 32)),mongodb.mongodbRootPassword=$(echo -n $(openssl rand -base64 32)) </code></pre> <p>I was abl...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: RStudio proxied authetication<p>I've setup proxied authentication for RStudio Server.</p> <p>RStudio Server is redirecting to a middleware implemented using...
<p>The browser won't add this header for you. You need to add it in the layer that proxies traffic through to RStudio Server. If you don't have such a layer already, you will need to add it using e.g. Nginx. This layer could authenticate the request using whatever mechanism your auth provider supports and add the <code...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I create a fixed header?<p>I want a header that is displayed at the top where the content always appears below it. The solutions that I've seen use p...
<p>I think this is what you're looking for. Basically you need to limit <code>&lt;body&gt;</code> height and wrap a viewport <code>&lt;div&gt;</code> around your <code>&lt;table&gt;</code> that's offset and stretched to screen height using <code>position: absolute</code>, and it should take scrolling away from body by ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ExpandableListView with multiple layouts<p>I apologize for my English but translated with google. I need help for my application, I'm using a ExpandableListV...
<p>Right now your list doesn't "know" that it has three different types of records. You need to "tell" it that by overriding the next function of the Adapter:</p> <pre><code>@Override public int getViewTypeCount() { return 3; // &lt;-- Here goes your view types count } </code></pre> <p>Also you need to overri...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Get user installed apps and each app ratings<p>I have created a new facebook application.I am trying using Graph api 2.2, once user installs my app to get hi...
<p>There is no way to get the installed Apps of a user, with or without the Graph API. Everything that may be possible somehow without the the Graph API would not be allowed, because that would be scraping: <a href="https://www.facebook.com/apps/site_scraping_tos_terms.php" rel="nofollow">https://www.facebook.com/apps/...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Variable range operator in PowerShell<p>I am trying to use a range operator to input a series of numbers for use in a PowerShell script. Here is my code:</p>...
<pre><code>1..9 | % { $computers += "servername$_`n" } </code></pre> <p>And the variable $computers will contain:</p> <pre><code>servername1 servername2 servername3 [...] </code></pre> <p>Try running only the <code>1..9</code> part on your command line and it'll be easier to see what's gonig on. You could also read ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: I don't understand a parameter in this class (Swift)<pre><code>public class BinaryNode&lt;Element&gt; { public var value: Element public var leftChi...
<p><strong>1. Declaration</strong></p> <pre><code>visit: (Element) -&gt; Void </code></pre> <p>In the above code <code>visit</code> is declared as a <code>closure</code> of type <code>(Element)-&gt;Void</code>. It'll accept a value of type <code>Element</code> (<em>generic type</em>) wherever called.</p> <p><strong>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Module per Fragment / Activity in Dagger<p>I'm wondering if it is better to have a <code>Module</code> per <code>Activity</code> than a <code>Module</code> p...
<p>The examples assume you're working with several activities, each with their own clear purpose and scope. There exists a scope <code>A</code> for the application wide dependencies, and scopes <code>B</code>, <code>C</code> and <code>D</code> for each of the Activity dependencies.</p> <p>You're basically adding an ex...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to persist cart in UberCart?<p>I have a cart to which I add Products A and B. Product A can be bought without B, but if you buy Product A, you must buy P...
<p>Instead of using a second table for the data I wanted to persist, I realised I could just add any data to the cartContents and it will automatically keep all the information i store when the user logs in and out. </p> <p>This is how I did the update:</p> <pre><code>$cartItemID = 1; // the id of the item in the car...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Putting multiple ggplots generated by a for loop into one image<p>First time asking a question so if I miss any important details, apologises in advance. I'm...
<p>You were trying to use <code>par(mfrow=...)</code>, and this works only with base R plots. For <code>ggplot</code>, if you like something similar, maybe use gridExtra since you already have a list of plot. You can see an example below with <code>iris</code></p> <p>Also as a comment, most likely you don't need to us...