question_id
int64
37.6M
73.2M
input_text
stringlengths
88
52.4k
output_text
stringlengths
37
35.6k
title
stringlengths
15
150
tags
stringlengths
1
107
q_score
int64
-19
397
view_count
int64
3
879k
answer_count
int64
1
21
accepted_answer_id
int64
37.6M
73.8M
answer_id
int64
37.6M
73.8M
a_score
int64
-5
1.29k
is_accepted
bool
1 class
creation_date
stringlengths
20
24
input_text_instruct
stringlengths
251
52.6k
37,747,332
Response whose "body" is locked cannot be used to respond to a request<p>I was just trying <strong>service workers</strong> in google chrome. I stumbled upon an error. <a href="https://www.google.cz/search?q=%22Response%20whose%20%22body%22%20is%20locked%20cannot%20be%20used%20to%20respond%20to%20a%20request.%22" rel="...
<p>The problem is that <code>body</code> of the response (the actual content, such as HTML or JavaScript) can be only used once for certain purposes, such as saving into cache or using as actual response.</p> <p>To solve this, <a href="https://developer.mozilla.org/en-US/docs/Web/API/Response/clone" rel="noreferrer"><...
Response whose "body" is locked cannot be used to respond to a request
javascript|google-chrome|service-worker
14
6,929
1
37,747,473
37,747,473
25
true
2016-06-10T11:38:45.897Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Response whose "body" is locked cannot be used to respond to a request<p>I was just trying <strong>service workers</strong> in google chrome. I stumbled upon...
37,738,128
Custom Content Dialog in UWP with 3+ buttons<p>I'd like to display a content dialog box that has more than the traditional Primary and Secondary results. Since I can't override the ContentDialogResult enum and add options to that property, it seems my only choice may be to create my own custom control that works simil...
<blockquote> <p>I'd like to display a content dialog box that has more than the traditional Primary and Secondary results.</p> </blockquote> <p>The <a href="https://msdn.microsoft.com/library/windows/apps/windows.ui.xaml.controls.contentdialog.aspx" rel="noreferrer">ContentDialog</a> has 2 built-in buttons(the prima...
Custom Content Dialog in UWP with 3+ buttons
c#|dialog|windows-10-universal
7
20,534
2
37,745,476
37,745,476
31
true
2016-06-10T00:16:57.160Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Custom Content Dialog in UWP with 3+ buttons<p>I'd like to display a content dialog box that has more than the traditional Primary and Secondary results. Si...
37,696,412
Karma testing: TypeError: Attempted to assign to readonly property<p>When I am trying to unit test my controller I am getting the error.When I debug the testcase's expect I am getting the expected value but its failing with below error.What am I missing here or whether I am testing the controller variable in a wrong ma...
<p>readonly error is caused by scope.page(in my InformationController) being undefined and then the code is trying to assign a property to undefined.Hence the modified beforeEach block as below</p> <pre><code>beforeEach(inject(function ($controller, $rootScope) { scope = $rootScope.$new(); scope.page3 ...
Karma testing: TypeError: Attempted to assign to readonly property
angularjs|unit-testing|karma-jasmine|angularjs-controller
25
40,246
1
37,700,077
37,700,077
32
true
2016-06-08T07:51:43.377Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Karma testing: TypeError: Attempted to assign to readonly property<p>When I am trying to unit test my controller I am getting the error.When I debug the test...
37,843,155
Angular 2 return html instead of string<p>Let's assume I have a <code>test</code> property like that:</p> <pre><code>export class SomeComponent implements OnInit { testing = '&lt;strong&gt;Just testing&lt;/strong&gt;'; } </code></pre> <p>And I add to my test.component.html this line:</p> <pre><code>{{ testing ...
<p>You can use <code>innerHTML</code> for this:</p> <pre><code>&lt;span [innerHTML]="testing"&gt;&lt;/span&gt; </code></pre>
Angular 2 return html instead of string
html|angular
15
14,601
1
37,843,183
37,843,183
32
true
2016-06-15T18:30:07.753Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Angular 2 return html instead of string<p>Let's assume I have a <code>test</code> property like that:</p> <pre><code>export class SomeComponent implements O...
37,674,187
Rails select_tag/dropdown with enums<p>I'm got a model Lead which has a field Status which consists of multiple values via an enum.</p> <pre><code>enum status: { open: 0, closed: 1, qualified: 2, rejected: 3 } </code></pre> <p>I'm trying to create a select-field (in a table) where the new status will be saved via aja...
<p>I found the answer myself by trial-and-error.</p> <pre><code>&lt;%= select_tag :status, options_for_select(Lead.statuses.map {|k, v| [k.humanize.capitalize, v]}) %&gt; </code></pre>
Rails select_tag/dropdown with enums
ruby-on-rails|drop-down-menu|enums
19
9,242
3
37,674,420
37,674,420
33
true
2016-06-07T08:25:50.093Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Rails select_tag/dropdown with enums<p>I'm got a model Lead which has a field Status which consists of multiple values via an enum.</p> <pre><code>enum stat...
37,654,521
How to Send a body of data to XMLHttpRequest that looks like this?<p>How do I format this correctly?</p> <pre><code>var params = { "range":"Sheet1!A4:C4", "majorDimension": "ROWS", "values": [ ["Hello World","123", "456"] ], } </code></pre> <p>Then send it using <strong>POST</strong> like :</p> <pre><cod...
<pre><code>var xhr = new XMLHttpRequest(); xhr.open(method, url); xhr.setRequestHeader('Authorization', 'Bearer ' + access_token); xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8"); xhr.onload = requestComplete; xhr.send(JSON.stringify(params)); </code></pre> <p>It looks like you ju...
How to Send a body of data to XMLHttpRequest that looks like this?
javascript|ajax|xml|http|xmlhttprequest
23
51,485
2
37,654,822
37,654,822
39
true
2016-06-06T09:59:30.877Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to Send a body of data to XMLHttpRequest that looks like this?<p>How do I format this correctly?</p> <pre><code>var params = { "range":"Sheet1!A4:C4",...
37,711,538
matplotlib 3d axes ticks, labels, and LaTeX<p>I am running <a href="http://matplotlib.org/examples/mplot3d/lines3d_demo.html" rel="noreferrer">this</a> sample script, with the following modifications:</p> <pre><code>import matplotlib as mpl from mpl_toolkits.mplot3d import Axes3D import numpy as np import matplotlib.p...
<blockquote> <p>How do I adjust the axis ticks to that of my choosing? I.e., how would I get the z-axis to only label 2, 0, and -2, and in the font size that I want? I know how to do this in 2D but not 3D.</p> </blockquote> <p>You have to change properties of <code>zticks</code>.</p> <blockquote> <p>Why is th...
matplotlib 3d axes ticks, labels, and LaTeX
python|matplotlib|3d|latex|mplot3d
51
118,343
2
37,713,788
37,713,788
43
true
2016-06-08T19:43:17.617Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: matplotlib 3d axes ticks, labels, and LaTeX<p>I am running <a href="http://matplotlib.org/examples/mplot3d/lines3d_demo.html" rel="noreferrer">this</a> sampl...
37,815,450
flex items ignoring width<p>I've reordered some elements in my html using flexbox in the responsive design of a website which works fine but the elements then won't resize properly.</p> <p>At a breakpoint I have applied a class of flex to the <code>home-promos</code> div and reordered the elements. This works correctl...
<p>When you create a flex container (<code>display: flex</code> or <code>display: inline-flex</code>), it comes with several default settings. Among them are:</p> <ul> <li><code>flex-direction: row</code> - flex items will align horizontally</li> <li><code>justify-content: flex-start</code> - flex items will stack at ...
flex items ignoring width
html|css|flexbox
24
17,438
1
37,818,560
37,818,560
46
true
2016-06-14T14:53:34.767Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: flex items ignoring width<p>I've reordered some elements in my html using flexbox in the responsive design of a website which works fine but the elements the...
37,819,022
Edit maven's settings.xml from Intellij<p>In Netbeans, maven's <code>settings.xml</code> file is part of every project and can easily be edited from each project:</p> <p><a href="https://i.stack.imgur.com/foPEV.png" rel="noreferrer"><img src="https://i.stack.imgur.com/foPEV.png" alt="enter image description here"></a>...
<p>It's not visible by default.</p> <p>Right Click on POM --> Maven --> Open Settings.xml</p> <p><a href="https://i.stack.imgur.com/kDP19.png" rel="noreferrer"><img src="https://i.stack.imgur.com/kDP19.png" alt="enter image description here"></a></p>
Edit maven's settings.xml from Intellij
java|maven|intellij-idea|settings
17
47,132
1
37,819,306
37,819,306
46
true
2016-06-14T17:58:02.280Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Edit maven's settings.xml from Intellij<p>In Netbeans, maven's <code>settings.xml</code> file is part of every project and can easily be edited from each pro...
37,698,996
findIndex() method issue with internet explorer<p>I am doing some tests with differents browsers using the <a href="https://metacpan.org/pod/Selenium::Remote::Driver" rel="noreferrer"><code>Selenium::Remote::Driver</code></a> module.</p> <p>I would like to check if I find some item in my web site list, list from a fra...
<blockquote> <p>So my question is how can i do differently to get my index for every browser ?</p> </blockquote> <p>You have at least three options:</p> <ol> <li><p>Shim <code>Array#findIndex</code>; <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex" rel="nore...
findIndex() method issue with internet explorer
javascript|perl|unit-testing|selenium-webdriver|internet-explorer-11
24
42,038
4
37,699,217
37,699,217
72
true
2016-06-08T09:47:57.400Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: findIndex() method issue with internet explorer<p>I am doing some tests with differents browsers using the <a href="https://metacpan.org/pod/Selenium::Remote...
37,609,662
Docker-compose restart only updated images<p>I have a docker-compose "cluster" and sometime I update the image files for some containers. I rebuild them using <code>docker-compose build</code>. I would like to know if there is a way to restart only the containers that have a new image automatically. Ie. I don't want to...
<p>This command updates the containers that have a newer image (than the one currently running):</p> <pre><code>docker-compose up -d --no-deps &lt;service&gt; </code></pre>
Docker-compose restart only updated images
docker|docker-compose
28
18,441
1
37,614,725
37,614,725
77
true
2016-06-03T08:34:48.407Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Docker-compose restart only updated images<p>I have a docker-compose "cluster" and sometime I update the image files for some containers. I rebuild them usin...
37,738,209
How do I get "firebase login" to work from Google Cloud Shell<p>I logged into Google Cloud Shell and found that that the Firebase CLI is already installed.</p> <p>I then tried to run "firebase list" to see that it was working and was prompted to login.</p> <p>"Visit this URL on any device to log in:" <code>&lt;very l...
<p>Run the following command in your terminal:</p> <pre><code>firebase login --no-localhost </code></pre> <p>This will return a url that you can copy in the browser. After completing the steps, you'll receive back a code which you paste in the terminal.</p>
How do I get "firebase login" to work from Google Cloud Shell
firebase|google-cloud-shell
32
11,529
3
37,746,409
37,746,409
83
true
2016-06-10T00:28:44.013Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I get "firebase login" to work from Google Cloud Shell<p>I logged into Google Cloud Shell and found that that the Firebase CLI is already installed.</...
37,711,302
Validate integer values with mongoose<p>I'm using <a href="http://mongoosejs.com" rel="noreferrer">mongoose</a> and I need to define a schema like the following:</p> <pre><code>const QuestionSchema = new Schema({ text: { type: String, required: true }, number: { type: Number, ...
<p>You can add a <a href="http://mongoosejs.com/docs/validation.html#custom-validators" rel="noreferrer">custom validator</a> for <code>number</code>:</p> <pre><code>number: { type : Number, required : true, unique : true, validate : { validator : Number.isInteger, message : '{VALUE} is not an ...
Validate integer values with mongoose
node.js|mongodb|mongoose
39
26,682
2
37,711,437
37,711,437
85
true
2016-06-08T19:30:40.200Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Validate integer values with mongoose<p>I'm using <a href="http://mongoosejs.com" rel="noreferrer">mongoose</a> and I need to define a schema like the follow...
37,611,327
How do I use pouchdb with typescript?<p>I am trying to use pouchdb with Typescript. I cannot link to the pouchdb module.</p> <pre><code>import { PouchDB } from "pouchdb" </code></pre> <p>reports that it cannot find module pouchdb, even though it is in node_modules.</p> <p>I also cannot find the appropriate typings ...
<p>I managed to get the module recognised by using</p> <pre><code>declare function require(a) var PouchDB = require("pouchdb") </code></pre> <p>I have given up type checking, but at least I can make progress.</p>
How do I use pouchdb with typescript?
node.js|typescript|couchdb|pouchdb|node-modules
8
8,762
5
37,616,099
37,616,099
0
true
2016-06-03T09:58:19.537Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I use pouchdb with typescript?<p>I am trying to use pouchdb with Typescript. I cannot link to the pouchdb module.</p> <pre><code>import { PouchDB } ...
37,722,433
Date format getting automatically changed in java<p>I have a date in the given format : "2016-12-09T01:05:00.148Z" When I try to get this date using "application/json" format , it converts to "1481245500148".</p> <p>Please suggest, how can it be resolved.</p>
<p>1481245500148 is the number of milliseconds.</p> <p>This can be convert this back to ISO 8601 by doing:</p> <pre><code>long ms = 1481245500148L; Instant instant = Instant.ofEpochMilli(ms); System.out.println(instant); </code></pre> <p>Which outputs:</p> <pre><code>2016-12-09T01:05:00.148Z </code></pre>
Date format getting automatically changed in java
java|date|date-format
-3
56
1
37,722,775
37,722,775
0
true
2016-06-09T09:47:43.630Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Date format getting automatically changed in java<p>I have a date in the given format : "2016-12-09T01:05:00.148Z" When I try to get this date using "applica...
37,802,412
PHP Check if date is past in the format 10-08-2015<p>I'm trying to check if the specific given date is past or not with PHP, I cannot change the date format as there are thousands of records like this in the database.</p> <pre><code>$actdate = '10-08-2015'; </code></pre> <p>The format is day-month-year</p> <p>Thank ...
<p>PHP : </p> <pre><code>$today = date("d-m-Y"); </code></pre> <p>you can create a date using date_create function.This will create data object.</p> <pre><code>$actdate = "10-08-2015"; $yourdate = date_create(date($actdate)); </code></pre> <p>format your date as you wish.like this;</p> <pre><code>echo $yourdate-&g...
PHP Check if date is past in the format 10-08-2015
php
-3
36
2
37,802,447
37,802,447
0
true
2016-06-14T03:20:00.260Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PHP Check if date is past in the format 10-08-2015<p>I'm trying to check if the specific given date is past or not with PHP, I cannot change the date format ...
37,809,790
Running (one pass) calculation of covariance<p>I got a set of 3d vectors (x,y,z), and I want to calculate the covariance matrix without storing the vectors.</p> <p>I will do it in C#, but eventually I will implement it in C on a microcontroller, so I need the algorithm in itself, and not a library. </p> <p>Pseudocode...
<p>I think I have found the solution. It is based on this article about <a href="http://www.wikihow.com/Calculate-Covariance" rel="nofollow">how to calculate covariance manually</a> and this one about <a href="http://www.johndcook.com/blog/standard_deviation/" rel="nofollow">calculating running variance</a>. And then ...
Running (one pass) calculation of covariance
c#|statistics|covariance
7
2,578
4
37,811,640
37,811,640
2
true
2016-06-14T10:45:31.880Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Running (one pass) calculation of covariance<p>I got a set of 3d vectors (x,y,z), and I want to calculate the covariance matrix without storing the vectors.<...
37,769,148
how to open chrome in incognito mode from Python<p>This works, in powershell:</p> <pre><code>Start-Process chrome.exe -ArgumentList @( '-incognito', 'www.foo.com' ) </code></pre> <p>How can this be achieved from Python?</p>
<p>Use the <code>os</code> module to execute the command.</p> <pre><code>import os os.system("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe -ArgumentList @( '-incognito', 'www.foo.com'" ) </code></pre> <p>More information on <strong><code>os.system</code></strong> can be found <a href="https://docs.pyth...
how to open chrome in incognito mode from Python
python|python-2.7|google-chrome|python-webbrowser
8
23,044
5
37,769,161
37,769,161
3
true
2016-06-11T22:48:53.150Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to open chrome in incognito mode from Python<p>This works, in powershell:</p> <pre><code>Start-Process chrome.exe -ArgumentList @( '-incognito', 'www.fo...
37,604,747
Merging 1D and 2D lists in python<p>I'm trying to set up data to convert to a numpy array. I have three lists. Two are one dimensional, and one is two dimensional.</p> <pre><code>a = [1,2,3] b = [4,5,6] c = [ [7,8],[9,10],[11,12] ] </code></pre> <p>I want to end up with this:</p> <pre><code>[ [1,4,7,8],[2,5,9,10],...
<p>Assuming you don't mind if the use of NumPy in the conversion itself, the following should work.</p> <pre><code>from numpy import array a = array([1, 2, 3]) b = array([4, 5, 6]) c = array([[7, 8], [9, 10], [11, 12]]) result = array(list(zip(a, b, c[:, 0], c[:, 1]))) </code></pre> <p>Note that <code>c[:, n]</code...
Merging 1D and 2D lists in python
python|list|numpy
7
2,579
5
37,604,883
37,604,883
4
true
2016-06-03T01:55:42.740Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Merging 1D and 2D lists in python<p>I'm trying to set up data to convert to a numpy array. I have three lists. Two are one dimensional, and one is two dime...
37,672,205
How to call nested Async method<p>I want to know what is best way to call nested async methods, if I want both methods to be async. <br /> <strong>First:</strong> Caller method must just return <code>Task</code> <br /></p> <pre><code>public async Task SaveChangesAsync() { await Context.SaveChangesAsync(); } public...
<p>This code should not use <code>async/await</code>, unless there are pieces in those methods you have not shown.</p> <p>In other words, this is how these methods should be written:</p> <pre><code>public Task SaveChangesAsync() { return Context.SaveChangesAsync(); } public Task UpdateAsync(List&lt;TEntity&gt; en...
How to call nested Async method
c#|asynchronous
9
1,545
4
37,673,148
37,673,148
4
true
2016-06-07T06:41:53.757Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to call nested Async method<p>I want to know what is best way to call nested async methods, if I want both methods to be async. <br /> <strong>First:</st...
37,847,912
How to stop React from rendering comments<p>When I inspect the markup rendered by react on the server, I see a lot of comments like:</p> <pre><code>&lt;!-- /react-text --&gt;&lt;!-- react-text: 28 --&gt;&lt;!-- /react-text --&gt; </code></pre> <p>How do I make react stop rendering them?</p>
<p>You can't. Those are needed for React to do its job as far as knowing how to remove/replace items in the DOM. This is an improvement over the previous way React did things, which was <code>data-reactid</code> attributes everywhere.</p>
How to stop React from rendering comments
reactjs|isomorphic-javascript
10
5,144
3
37,848,747
37,848,747
4
true
2016-06-16T00:23:10.887Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to stop React from rendering comments<p>When I inspect the markup rendered by react on the server, I see a lot of comments like:</p> <pre><code>&lt;!-- ...
37,679,629
How do I load an elixir library in a simple elixir script?<p>In ruby scripts, I could simply do:</p> <pre class="lang-rb prettyprint-override"><code>require 'some-gem' SomeGem.do_something! </code></pre> <p><strong>How can I do something similar in elixir <code>exs</code> scripts without creating a brand new mix pro...
<p>There are no global package installs in Elixir like there are in Ruby. While it might be technically possible to compile the dependencies into <code>.beam</code> files and add them to the load path of your scripts (like the article you linked to does), if you want behavior somewhat similar to Ruby, I would recommend...
How do I load an elixir library in a simple elixir script?
elixir
9
1,569
3
37,684,032
37,684,032
5
true
2016-06-07T12:38:53.097Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I load an elixir library in a simple elixir script?<p>In ruby scripts, I could simply do:</p> <pre class="lang-rb prettyprint-override"><code>require...
37,758,050
ggplot displaying expression in x axis<p>Below, I have R code that plots a grouped bar plot. </p> <pre><code>group_name = c('A_1x', 'A_1x', 'A_2x', 'A_2x', 'A_3x', 'A_3x', 'A_4x', 'A_4x') mydata2 &lt;- data.frame(mygroup = group_name, mysubgroup = factor(c("Yes", "No"), ...
<p>Here is a working example - I changed the <code>group_name</code> to 4 elements instead of 8 and manually added them into the <code>ggplot</code> expression. The issue was that the expression type can't be a column name for a <code>data.frame</code>. This escapes that issue.</p> <pre><code>library(ggplot2) group_na...
ggplot displaying expression in x axis
r|ggplot2|expression|bar-chart
8
3,655
3
37,758,149
37,758,149
5
true
2016-06-10T22:35:51.060Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ggplot displaying expression in x axis<p>Below, I have R code that plots a grouped bar plot. </p> <pre><code>group_name = c('A_1x', 'A_1x', 'A_2x', 'A_2x', ...
37,690,083
ElasticSearch - alias auto update for rolling index<p>I have the following rolling index defined:</p> <pre><code>POST /_aliases { "actions": [ { "add": { "index": "elmah_*", "alias": "elmah_all" } } ] } </code></pre> <p>That works great today, it picked up all my <strong>existi...
<p>Yep, you can use a template.</p> <pre><code>PUT /_template/my_elmah_template { "template" : "elmah_*", "alias" : { "elmah_all" : { } } } </code></pre> <p>The empty object is a necessary evil because JSON expects <code>field : value</code>.</p> <p>Whenever a matching index (based on the <code>template</c...
ElasticSearch - alias auto update for rolling index
elasticsearch
7
2,846
2
37,690,686
37,690,686
7
true
2016-06-07T21:55:54.940Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ElasticSearch - alias auto update for rolling index<p>I have the following rolling index defined:</p> <pre><code>POST /_aliases { "actions": [ { ...
37,810,521
Writing a parser for a DSL in OCaml using ppx and extension point<p>Recently, it was announced in OCaml official github that <code>Camlp4</code> is replaced by <code>ppx rewriters and extension points</code> (<a href="https://github.com/ocaml/camlp4">https://github.com/ocaml/camlp4</a>):</p> <blockquote> <p>Camlp4 w...
<p>No. PPX is specialized to extend OCaml language functionality keeping its syntax, possibly using attributes and extension points. It does not provide a parser generator like CamlP4. If you are building a syntax completely different from OCaml, just stick to P4. PPX does not help you.</p> <p>CamlP4 is not discon...
Writing a parser for a DSL in OCaml using ppx and extension point
ocaml|camlp4|ppx
9
842
1
37,813,413
37,813,413
7
true
2016-06-14T11:19:20.807Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Writing a parser for a DSL in OCaml using ppx and extension point<p>Recently, it was announced in OCaml official github that <code>Camlp4</code> is replaced ...
37,819,949
How to insert backslash followed by single quote using paste0 in R?<p>I'm trying to separate the elements in a vector with \' and a comma using paste0. For example:</p> <pre><code>test_vector = c("test1", "test2", "test3") </code></pre> <p>I would like to use paste0 to generate the following output: </p> <blockquot...
<p>How about </p> <pre><code>(x &lt;- paste0("\\'", test_vector, "\\'", collapse = ", ")) # [1] "\\'test1\\', \\'test2\\', \\'test3\\'" </code></pre> <p>We can check the <em>actual</em> result with <code>cat()</code> (since the second backslash is only present when printed to the console).</p> <pre><code>cat(x) # \'...
How to insert backslash followed by single quote using paste0 in R?
r|escaping
11
2,356
1
37,820,289
37,820,289
7
true
2016-06-14T18:52:32.770Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to insert backslash followed by single quote using paste0 in R?<p>I'm trying to separate the elements in a vector with \' and a comma using paste0. For e...
37,700,976
Inheriting from std::true_type vs static constexpr const bool member<p>I know this is not a very pointed question. Is there an advantage (compile time, dependencies, debug symbol sizes, usability, readability etc) of using one over another?</p> <pre><code>template &lt; typename T &gt; struct IsSharedPtr : std::false_...
<p>Inheriting from <code>true_type</code>/<code>false_type</code> will already provide you with corresponding <code>value</code> member, function call operator and implicit conversion to bool. In addition, if you will use inheritance, your type would be eligible for tag dispatch, which is often clearer and easier than ...
Inheriting from std::true_type vs static constexpr const bool member
c++
8
3,120
1
37,701,496
37,701,496
8
true
2016-06-08T11:16:52.657Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Inheriting from std::true_type vs static constexpr const bool member<p>I know this is not a very pointed question. Is there an advantage (compile time, depe...
37,727,380
Plotting discrete colorbar in legend style using Matplotlib<p>Sometimes, I want to plot discrete value in pcolormesh style. </p> <p>For example, to represent a 2-d array in the shape of 100x100 which contain int 0~7</p> <pre><code>data = np.random.randint(8, size=(100,100)) cmap = plt.cm.get_cmap('PiYG', 8) plt.pc...
<p>Maybe the easiest way is to create corresponding number of Patch instances:</p> <pre><code>import matplotlib.patches as mpatches import matplotlib.pyplot as plt import numpy as np data = np.random.randint(8, size=(100,100)) cmap = plt.cm.get_cmap('PiYG', 8) plt.pcolormesh(data,cmap = cmap,alpha = 0.75) # Set bor...
Plotting discrete colorbar in legend style using Matplotlib
python|arrays|python-2.7|matplotlib|visualization
7
2,589
1
37,731,009
37,731,009
9
true
2016-06-09T13:28:40.700Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Plotting discrete colorbar in legend style using Matplotlib<p>Sometimes, I want to plot discrete value in pcolormesh style. </p> <p>For example, to represe...
37,729,298
Serializing inside method field in Django REST framework<p>For example, I have two models: <code>Model1</code> and <code>Model2</code>. They are not related directly to each-other by any key-field on a model level. For both models I have serializers. I am searching the way to have <code>Model2</code> queryset in <code>...
<p><strong>Solution-1: Using <code>Model2Serializer</code> in a <code>Model1</code>'s <a href="http://www.django-rest-framework.org/api-guide/fields/#serializermethodfield" rel="noreferrer"><code>SerializerMethodField()</code></a></strong></p> <p>In this method, we define a <code>model2_data</code> <code>SerializerMet...
Serializing inside method field in Django REST framework
django-rest-framework
7
5,960
1
37,733,776
37,733,776
9
true
2016-06-09T14:49:51.090Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Serializing inside method field in Django REST framework<p>For example, I have two models: <code>Model1</code> and <code>Model2</code>. They are not related ...
37,602,561
ng2: Equivalent of require<p>In angular 1.x, we could reference the parent controller by requiring this inside a directive. However, with the whole naming switch-over in angular 2, I cannot really seem to find an equivalent of that functionality? </p> <p>Things I have tried so far:</p> <ul> <li>One way that I see is ...
<p>I don't know Angular1 well therefore I can't tell what <code>require</code> does exactly or for what purposes it is used.</p> <p>To the bullets mentioned in your question:</p> <ul> <li>Normally you use template binding to wire up parent and children</li> </ul> <p>parent template</p> <pre class="lang-ts prettypri...
ng2: Equivalent of require
angular|angular2-directives
8
2,618
1
37,606,138
37,606,138
10
true
2016-06-02T21:38:35.503Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ng2: Equivalent of require<p>In angular 1.x, we could reference the parent controller by requiring this inside a directive. However, with the whole naming sw...
37,613,169
How To maintain Session over Load Balancer?<p>The Project i am working on is based on multiple server which uses load balancer. The Problem is i can not maintain PHP session through out all servers.What is the best way to manage session over Load Balancer ... ?</p>
<p>i can think of these two methods for this purpose.</p> <ol> <li>Use a clustered web application server where the session are available for all the servers</li> <li>Use IP level information to maintain affinity between a user and a server</li> </ol>
How To maintain Session over Load Balancer?
php|webserver
9
1,833
3
37,613,314
37,613,314
10
true
2016-06-03T11:26:43.140Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How To maintain Session over Load Balancer?<p>The Project i am working on is based on multiple server which uses load balancer. The Problem is i can not main...
37,633,834
How to view phoenix routes in iex?<p>How do i view the output of a route in <code>iex</code>?</p> <p>I know i can do this with <code>mix Phoenix.routes</code> but would like to do this interactively.</p> <p>Here is an example of what I would like to do:</p> <pre><code>iex -S Phoenix.server mymodel_path </code></pre...
<p>All the url/path helpers are compiled into functions in the module <code>YourApp.Router.Helpers</code>. You can import it and call with the same arguments as you would in your templates (you would probably pass <code>conn</code> as the first argument but since we don't have a <code>conn</code> in the <code>iex</code...
How to view phoenix routes in iex?
elixir|phoenix-framework
12
3,623
6
37,634,270
37,634,270
10
true
2016-06-04T18:51:57.603Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to view phoenix routes in iex?<p>How do i view the output of a route in <code>iex</code>?</p> <p>I know i can do this with <code>mix Phoenix.routes</cod...
37,656,099
Change Values without affecting stored objects - Realm swift<p>I'm using realm to save my data. My problem is that I want to have some minor, temporary changes in objects, I don't want those changes to reflect in my stored objects but realm doesn't allow me to change retrieved objects' properties without a write block,...
<p>Unfortunately, as you've already stated, you can't apply new values to Realm properties 'temporarily' once the Realm <code>Object</code> has been written to a <code>Realm</code> file. This is an established fact of Realm's implementation, and there's no official way around it. As such, it'll be necessary to come up ...
Change Values without affecting stored objects - Realm swift
ios|swift|realm
8
2,855
1
37,671,975
37,671,975
10
true
2016-06-06T11:21:16.177Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Change Values without affecting stored objects - Realm swift<p>I'm using realm to save my data. My problem is that I want to have some minor, temporary chang...
37,725,416
Pydub - combine split_on_silence with minimum length / file size<p>I have two scripts, one of them splits audio of a certain length, the other one splits audio on every time there is a silent passage. Would it be possible to split the audio on silence, but only after a certain time passed? I would need chunks of videos...
<p>My advice is to use <a href="https://github.com/jiaaro/pydub/blob/master/pydub/silence.py#L78" rel="noreferrer"><code>pydub.silence.split_on_silence()</code></a> and then recombine the segments as needed so that you have files that are roughly the size you're targeting.</p> <p>something like</p> <pre><code>from py...
Pydub - combine split_on_silence with minimum length / file size
python|pydub
9
13,833
2
37,790,641
37,790,641
10
true
2016-06-09T12:00:45.313Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pydub - combine split_on_silence with minimum length / file size<p>I have two scripts, one of them splits audio of a certain length, the other one splits aud...
37,743,144
How to increase the page width in ipython notebook (jupyter) slides<p>In an ipython notebook (jupyter) slideshow created with</p> <pre><code>ipython nbconvert presentation.ipynb --to slides --post serve </code></pre> <p>images are of poor quality because they seem to be scaled down to the page width. How can I increa...
<p>After a long search I found the answer myself :</p> <ol> <li><p>Copy template file from</p> <p><code>lib/python2.7/site-packages/nbconvert/templates/html/slides_reveal.tpl</code></p> <p>to the directory of the notebook.</p></li> <li><p>Customize it, for example, in <code>Reveal.initialize({ })</code> add</p> <pr...
How to increase the page width in ipython notebook (jupyter) slides
jupyter-notebook|reveal.js|nbconvert
7
3,619
1
37,804,843
37,804,843
10
true
2016-06-10T08:09:38.427Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to increase the page width in ipython notebook (jupyter) slides<p>In an ipython notebook (jupyter) slideshow created with</p> <pre><code>ipython nbconve...
37,814,437
Docker ONBUILD COPY doesn't seem to copy files<p>I am trying to copy files to a docker image when I execute the docker build command. I am not sure what I am doing wrong because this seems to work for the docker <a href="https://github.com/docker-library/rails/blob/9df9b5e6b1519faf22e1565c2caaebf7cc1c665b/onbuild/Dock...
<p>You have to use <code>COPY</code> to build your image. Use <code>ONBUILD</code> if your image is kind of template to build other images.</p> <p>See <a href="https://docs.docker.com/engine/reference/builder/#onbuild" rel="noreferrer">Docker documentation</a>:</p> <blockquote> <p>The ONBUILD instruction adds to th...
Docker ONBUILD COPY doesn't seem to copy files
docker|dockerfile
8
5,182
1
37,815,125
37,815,125
10
true
2016-06-14T14:09:27.977Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Docker ONBUILD COPY doesn't seem to copy files<p>I am trying to copy files to a docker image when I execute the docker build command. I am not sure what I a...
37,615,790
Indexing the elements of a matrix in R<p>The problem is pretty silly, but I am wondering if I am missing something. Let's say that there is a vector <code>k</code> that contains some numbers, say</p> <pre><code>&gt; k [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 </code></pre> <p>I want to transform this to a ma...
<p>A variation on @docendodiscimus' answer: Instead of transposing you can change row and col indices, which you get by wrapping <code>lower.tri</code> in <code>which</code>:</p> <pre><code>n = 5 m = matrix(0, n, n) m[ which(lower.tri(m, diag=TRUE), arr.ind=TRUE)[, 2:1] ] = seq(sum(seq(n))) [,1] [,2] [,3] [,4]...
Indexing the elements of a matrix in R
r|matrix
14
513
4
37,616,430
37,616,430
11
true
2016-06-03T13:31:54.223Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Indexing the elements of a matrix in R<p>The problem is pretty silly, but I am wondering if I am missing something. Let's say that there is a vector <code>k...
37,812,307
CoreData inside CocoaPods library<p>I've developed an iOS framework several months ago, and now I would like to use CocoaPods to develop and distribute it easily. Now I distribute it sending my .framework file, I know this is not the best way and because of that I would like to use CocoaPods.</p> <p>My problem is, ins...
<p>It depends on the cocoapods version you are using, The recommended way to do it in 1.0.x is to add the <code>s.resource_bundles</code> with a list of resource files that should be included in the bundle <a href="https://guides.cocoapods.org/syntax/podspec.html#resource_bundles" rel="noreferrer" title="docs">Cocoapod...
CoreData inside CocoaPods library
ios|objective-c|core-data|cocoapods
9
3,083
2
37,812,994
37,812,994
11
true
2016-06-14T12:39:47.167Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: CoreData inside CocoaPods library<p>I've developed an iOS framework several months ago, and now I would like to use CocoaPods to develop and distribute it ea...
37,654,004
angular2 feeding data back to `<template>` from `[ngTemplateOutlet]`<p>So I have a component with a <code>&lt;template&gt;</code></p> <pre><code>&lt;some-component [data]="someArray"&gt; &lt;template&gt;foo&lt;template&gt; &lt;/some-component&gt; </code></pre> <p>and it's using this to get hold of the template</p> ...
<p>Updated to match Angular 5+ api <code>ngOutletContext</code> was renamed to <code>ngTemplateOutletContext</code> as per <a href="https://stackoverflow.com/a/37654077/301596">https://stackoverflow.com/a/37654077/301596</a></p> <hr> <p>Once this lands <a href="https://github.com/angular/angular/pull/9042" rel="nofol...
angular2 feeding data back to `<template>` from `[ngTemplateOutlet]`
angular
7
7,187
2
37,662,335
37,662,335
12
true
2016-06-06T09:34:21.617Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: angular2 feeding data back to `<template>` from `[ngTemplateOutlet]`<p>So I have a component with a <code>&lt;template&gt;</code></p> <pre><code>&lt;some-co...
37,743,596
gdb catch syscall condition and string comparisson<p>I would like to <code>catch</code> a system call (more specifically <code>access</code>) and set a <code>condition</code> on it based on string comparison (obviously for arguments that <em>are</em> strings). </p> <p>Specific example: when debugging <code>ls</code> I...
<p>You can use the gdb internal function <code>$_streq</code> like this:</p> <pre><code>(gdb) catch syscall access Catchpoint 1 (syscall 'access' [21]) (gdb) condition 1 $_streq((char *)$rdi, "/etc/ld.so.preload") (gdb) ru Starting program: /bin/ls Catchpoint 1 (call to syscall access), 0x00007ffff7df3537 in access ...
gdb catch syscall condition and string comparisson
linux|debugging|gdb|system-calls
10
3,869
1
37,744,150
37,744,150
13
true
2016-06-10T08:34:32.113Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: gdb catch syscall condition and string comparisson<p>I would like to <code>catch</code> a system call (more specifically <code>access</code>) and set a <code...
37,735,619
SonarLint cannot connect to SonarQube Server<p>I have eclipse mars2 with sonarLint 2.1. I try to connect to a SonarQube Server 5.1.2</p> <p>When I try to connect via the eclipse GUI, the following error occurs:</p> <p>The following plugins do not meet the required minimum versions, please upgrade them: java (installe...
<p>The plugin the message is referring to is the Sonar Java Plugin. Log in to Sonar as admin, go to Administration/System/Update Center and you'll see that the current installed plugin version is 3.0. Update it to the newest version available and it should work.</p> <p>[Edit] - The upgrade is triggered by just clickin...
SonarLint cannot connect to SonarQube Server
eclipse|sonarqube|lint
8
13,105
3
37,738,656
37,738,656
14
true
2016-06-09T20:32:16.450Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SonarLint cannot connect to SonarQube Server<p>I have eclipse mars2 with sonarLint 2.1. I try to connect to a SonarQube Server 5.1.2</p> <p>When I try to co...
37,611,485
Display page length and pagination in the same line jquery dataTables<p>Is there any way to display the page-length option and paginate option in the same line? This is how I got:</p> <p><a href="https://i.stack.imgur.com/FuUEF.png" rel="noreferrer"><img src="https://i.stack.imgur.com/FuUEF.png" alt="enter image descr...
<p>Use <a href="https://datatables.net/reference/option/dom#Styling" rel="noreferrer"><code>dom</code></a> option to construct the layout for Bootstrap framework.</p> <pre><code>var table = $('#example').DataTable({ dom: "&lt;'row'&lt;'col-sm-12'tr&gt;&gt;" + "&lt;'row'&lt;'col-sm-4'l&gt;&lt;'col-sm-8'p&g...
Display page length and pagination in the same line jquery dataTables
css|twitter-bootstrap|datatables
7
11,820
4
37,619,575
37,619,575
15
true
2016-06-03T10:06:30.417Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Display page length and pagination in the same line jquery dataTables<p>Is there any way to display the page-length option and paginate option in the same li...
37,662,171
What is the difference between `@Bind` and `@BindView` in butterknife?<p>I Just started using butterknife.<br> In the project, colleagues using butterknife, version is 7.0.0. </p> <p>I saw him write <code>@Bind(R.id.tv_name)</code>.<br> But I see butterknife official website butterknife version is 8.0.1, syntax is <c...
<p>Yup, the syntax changed in the version 8.0.</p> <p>You can check the changelog here: <a href="https://github.com/JakeWharton/butterknife/blob/master/CHANGELOG.md#version-800-2016-04-25">https://github.com/JakeWharton/butterknife/blob/master/CHANGELOG.md#version-800-2016-04-25</a> to see al the changes. But from 7.X...
What is the difference between `@Bind` and `@BindView` in butterknife?
android|inject|butterknife
9
8,261
2
37,662,337
37,662,337
15
true
2016-06-06T16:12:23.883Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is the difference between `@Bind` and `@BindView` in butterknife?<p>I Just started using butterknife.<br> In the project, colleagues using butterknife, ...
37,707,187
Python PEP479 Change StopIteration handling inside generators<p>Could someone help me understand what PEP479 is about? I was reading the doc and couldn't get my head around it.</p> <p>The abstract says:</p> <blockquote> <p>This PEP proposes a change to generators: when StopIteration is raised inside a generator, it...
<p>Your first loop should still work -- <code>StopIteration</code> will still be raised when a generator is exhausted.</p> <p>The difference is that there <em>was</em> ambiguity when a <code>StopIteration</code> was raised in a generator. Did it get raised (implicitly) because the generator ran out of things to yield...
Python PEP479 Change StopIteration handling inside generators
python|runtime-error|stopiteration
11
3,099
1
37,707,387
37,707,387
15
true
2016-06-08T15:45:16.693Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python PEP479 Change StopIteration handling inside generators<p>Could someone help me understand what PEP479 is about? I was reading the doc and couldn't get...
37,743,199
About Global variable for iOS Project<p>I would like to know how to use Global variable for iOS Project.</p> <p>Nowadays, I found one document which is writtern by Swift.</p> <p>This document has some code.</p> <pre><code>import UIKit let log = ColorLogger.defaultInstance @UIApplicationMain class AppDelegate: UIRe...
<p>There are several ways to create "global" variables in Swift, and I will describe some of them. </p> <h2><strong>1. Defining variables in <code>AppDelegate</code></strong></h2> <p><code>AppDelegate</code> seems like a logic place for some global variables. As you said you can create instance of logger or create in...
About Global variable for iOS Project
ios|swift|global-variables
8
9,775
2
37,743,576
37,743,576
16
true
2016-06-10T08:12:52.660Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: About Global variable for iOS Project<p>I would like to know how to use Global variable for iOS Project.</p> <p>Nowadays, I found one document which is writ...
37,750,960
Locally hosted fonts breaking CSP rule<p>I'm setting up <code>Content-Security-Policy</code> headers in <code>Nginx</code> and I am stuck at getting the locally hosted <code>Typekit</code> fonts to work.</p> <p>I'm using the following script for hosting <code>Typekit</code> fonts locally and the result has been very g...
<p>You can see its creating the font-src as <code>data</code> when it loads them in. That is base64 encoded versions of the font rather than links to the fonts themselves.</p> <p>So just change <code>font-src 'self';</code> to <code>font-src 'self' data: ;</code> and it should work fine.</p>
Locally hosted fonts breaking CSP rule
content-security-policy|typekit
7
3,377
1
37,776,436
37,776,436
16
true
2016-06-10T14:37:49.757Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Locally hosted fonts breaking CSP rule<p>I'm setting up <code>Content-Security-Policy</code> headers in <code>Nginx</code> and I am stuck at getting the loca...
37,818,542
Gatsby static site gen. & publishing new content<p>With the <a href="https://github.com/gatsbyjs/gatsby" rel="noreferrer">Gatsby static site generator project</a>, since the site is rendering content files to html during the webpack build, does this mean that for something like a blog, every new post would require a fr...
<p>Yes, static sites must be rebuilt when you change one of your source files. In a database-backed website (e.g. Wordpress) HTML is built on-the-fly on every page request so if you change content in the database, this is immediately reflected in the site's HTML on the next page load.</p> <p>Static websites don't buil...
Gatsby static site gen. & publishing new content
gatsby
7
2,061
2
37,819,078
37,819,078
16
true
2016-06-14T17:29:33.283Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Gatsby static site gen. & publishing new content<p>With the <a href="https://github.com/gatsbyjs/gatsby" rel="noreferrer">Gatsby static site generator projec...
37,731,465
SQL Server - contains an invalid XML identifier as required by FOR XML;<p>I'm running this query and getting below mentioned error. Can anyone help?</p> <blockquote> <p>Column name 'Middle Name' contains an invalid XML identifier as required by FOR XML; ' '(0x0020) is the first character at fault.</p> </blockquote...
<p>You can't have spaces in XML element or attribute names. Use</p> <pre><code>SELECT Username AS [LastName], '' AS [MiddleName], '' AS Birthdate, '' AS [SSN], 0 AS [WageAmount] FROM Employee FOR XML PATH </code></pre>
SQL Server - contains an invalid XML identifier as required by FOR XML;
sql|sql-server|xml
8
13,111
2
37,731,540
37,731,540
17
true
2016-06-09T16:24:20.413Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SQL Server - contains an invalid XML identifier as required by FOR XML;<p>I'm running this query and getting below mentioned error. Can anyone help?</p> <bl...
37,732,050
How to return an unpacked list in Python?<p>I'm trying to do something like this in python:</p> <pre><code>def f(): b = ['c', 8] return 1, 2, b*, 3 </code></pre> <p>Where I want <code>f</code> to return the tuple <code>(1, 2, 'c', 8, 3)</code>. I found a way to do this using <code>itertools</code> followed by...
<p>The unpacking operator <code>*</code> appears before the <code>b</code>, not after it. </p> <pre><code>return (1, 2, *b, 3) # ^ ^^ ^ </code></pre> <p>However, this will only work on Python 3.5+ (<a href="https://www.python.org/dev/peps/pep-0448/" rel="noreferrer">PEP 448</a>), and also you need to add ...
How to return an unpacked list in Python?
python|return|tuples|unpack
10
13,896
1
37,732,122
37,732,122
18
true
2016-06-09T16:57:49.793Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to return an unpacked list in Python?<p>I'm trying to do something like this in python:</p> <pre><code>def f(): b = ['c', 8] return 1, 2, b*, 3 ...
37,726,258
onBeforeUnload not working correctly for Chrome<p>I've been using this code for some time and it worked fine until yesterday:</p> <pre><code>window.onbeforeunload = function() { return "¡Atención! Si continúas no podrás volver atrás y podrías perder datos. Revisa todos los campos y termina el trabajo antes de move...
<p>You're not doing anything wrong. Google has decided to do what Mozilla did and not allow you to show a custom message anymore. It <a href="https://www.chromestatus.com/features/5349061406228480" rel="nofollow noreferrer">took effect in Chrome 51</a>.</p> <p>You still need to return something to trigger the built-in...
onBeforeUnload not working correctly for Chrome
javascript|google-chrome|dom-events|microsoft-edge|onbeforeunload
12
8,246
1
37,726,387
37,726,387
19
true
2016-06-09T12:39:04.213Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: onBeforeUnload not working correctly for Chrome<p>I've been using this code for some time and it worked fine until yesterday:</p> <pre><code>window.onbefore...
37,734,177
Hibernate select elements of collection with a given property<p>Entity <code>Project</code> has a collection property <code>contributors</code> mapped with a <code>@OneToMany</code> relationship to entity <code>User</code></p> <pre><code>@Entity @Table( name = "projects" ) public class Project { ... @OneToMan...
<p><code>contributors</code> is a Collection. As such, it does not have an attribute named id.</p> <p>Id is an attribute of the elements of this Collection.</p> <p>You can fix the issue by joining the collection instead of dereferencing it:</p> <pre><code>SELECT p FROM Project pj JOIN pj.contributors p WHER...
Hibernate select elements of collection with a given property
hibernate|hql
8
18,721
2
37,736,679
37,736,679
19
true
2016-06-09T19:01:04.430Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Hibernate select elements of collection with a given property<p>Entity <code>Project</code> has a collection property <code>contributors</code> mapped with a...
37,668,964
How to declare a typescript property that implements multiple interfaces<p>Say I have 2 interfaces:</p> <pre><code>interface Interface1{} interface Interface2{} </code></pre> <p>is there a way to declare a property as implementing both interfaces? Something like:</p> <pre><code>class MyClass{ public p: Interface1,...
<blockquote> <p>is there a way to declare a property as implementing both interfaces? Something like:</p> </blockquote> <p>Yup. An <code>intersection type</code>:</p> <pre><code>interface Interface1{} interface Interface2{} class MyClass{ public p: Interface1 &amp; Interface2 } </code></pre> <h1>More</h1> <ul> <li>Ty...
How to declare a typescript property that implements multiple interfaces
typescript
15
7,942
2
37,668,981
37,668,981
20
true
2016-06-07T01:00:53.047Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to declare a typescript property that implements multiple interfaces<p>Say I have 2 interfaces:</p> <pre><code>interface Interface1{} interface Interfac...
37,776,186
Adjusting white space between titles and the edge of the plot<p>I want to create space between the titles (the axis title and the plot title) and the edge of the plot. I tried vjust on <code>axis.title</code> and <code>plot.title</code> with no luck. Nothing really changed in the plot when I tried various values for <c...
<p>You want to do this using <code>margin</code></p> <pre><code> p + theme( panel.grid.major = element_line(linetype = "blank"), panel.grid.minor = element_line(linetype = "blank"), axis.title.x = element_text(family = "sans", size = 15, margin=margin(30,0,0,0)), axis.title.y = element_text(famil...
Adjusting white space between titles and the edge of the plot
r|ggplot2
8
21,283
2
37,776,455
37,776,455
20
true
2016-06-12T15:50:24.687Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Adjusting white space between titles and the edge of the plot<p>I want to create space between the titles (the axis title and the plot title) and the edge of...
37,822,668
How to change Border Color of Entry in Xamarin.Forms<p>I'm writing an app in Xamarin.forms cross-platform. There are few Entries in The app and I want to create/change border color to red. Is There any easy way to do this? or Does any way exists?</p>
<p>I think you can only achieve this with a CustomRenderer:</p> <p>iOS:</p> <pre><code>protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) { base.OnElementPropertyChanged(sender, e); Control.Layer.BorderColor = UIColor.Red.CGColor; Control.Layer.BorderWidt...
How to change Border Color of Entry in Xamarin.Forms
xaml|xamarin|cross-platform|xamarin.forms|xamarin-studio
10
33,295
1
37,823,390
37,823,390
22
true
2016-06-14T21:48:29.253Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to change Border Color of Entry in Xamarin.Forms<p>I'm writing an app in Xamarin.forms cross-platform. There are few Entries in The app and I want to cre...
37,610,037
Is there a way to stop VS2015 Typescript compilation on build?<p>I'm running a Asp.Net Core RC2, project.json project and have setup gulp to watch and compile my typescript to a different location. But Visual Studio 2015 is also compiling the typescript each time I compile, giving me duplicates of each js file. How do ...
<p>In RC2, you can disable it by adding <strong>TypeScriptCompileBlocked</strong> to the .xproj file.</p> <pre><code>&lt;PropertyGroup&gt; &lt;TypeScriptCompileBlocked&gt;True&lt;/TypeScriptCompileBlocked&gt; &lt;/PropertyGroup&gt; </code></pre>
Is there a way to stop VS2015 Typescript compilation on build?
asp.net-core
12
2,635
2
37,756,426
37,756,426
24
true
2016-06-03T08:53:53.030Z
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 stop VS2015 Typescript compilation on build?<p>I'm running a Asp.Net Core RC2, project.json project and have setup gulp to watch and compil...
37,799,328
React — inline onfocus placeholder = ''<p>I typically use an inline onfocus / blur to toggle placeholder text in inputs. Like this:</p> <pre><code>&lt;input type="text" placeholder="Name" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Name'"/&gt; </code></pre> <p>This doesn't seem to work in React and I'...
<p>You still can do it inline with React: </p> <pre><code>&lt;input type="text" placeholder="Name" onFocus={(e) =&gt; e.target.placeholder = ""} onBlur={(e) =&gt; e.target.placeholder = "Name"} /&gt; </code></pre>
React — inline onfocus placeholder = ''
input|reactjs|toggle|placeholder
9
7,487
1
37,799,400
37,799,400
24
true
2016-06-13T21:20:42.330Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: React — inline onfocus placeholder = ''<p>I typically use an inline onfocus / blur to toggle placeholder text in inputs. Like this:</p> <pre><code>&lt;input...
37,818,279
TypeError: unsupported operand type(s) for &: 'float' and 'numpy.float64'<p>I'm trying to convert a continuous variable to a categorical variable using the following code:</p> <pre><code>def score_to_categorical(x): if x&lt;0.25: return 'very bad' if x&gt;=0.25 &amp; x&lt;0.5: return 'bad' ...
<p>Here <code>x&gt;=0.25 &amp; x&lt;0.5</code> <code>&amp;</code> performs a <a href="https://docs.python.org/3/reference/datamodel.html#object.__and__" rel="noreferrer"><em>bitwise AND operation</em></a> (for example, <code>1 &amp; 52</code> is zero, which will be treated as <code>False</code>), while you certainly me...
TypeError: unsupported operand type(s) for &: 'float' and 'numpy.float64'
python|numpy|typeerror
13
52,012
1
37,818,344
37,818,344
25
true
2016-06-14T17:12:20.130Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: TypeError: unsupported operand type(s) for &: 'float' and 'numpy.float64'<p>I'm trying to convert a continuous variable to a categorical variable using the f...
37,703,632
Elixir assert_raise doesn't catch exceptions<p>I wrote this test case:</p> <pre><code>assert_raise ArgumentError, myFn(a,b) </code></pre> <p>but it does not evaluate in the way I'd expect. <code>myFn</code> raises an ArgumentError (<code>do: raise ArgumentError</code>), but it is not caught by <code>assert_raise</cod...
<p>Wrapping the function call in a function is the way to go. </p> <pre><code>assert_raise ArgumentError, fn -&gt; myFn(a, b) end </code></pre> <p>I expected <code>assert_raise</code> to take a function call, but it takes a function.</p>
Elixir assert_raise doesn't catch exceptions
elixir|ex-unit
19
4,141
1
37,703,830
37,703,830
26
true
2016-06-08T13:16:44.797Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Elixir assert_raise doesn't catch exceptions<p>I wrote this test case:</p> <pre><code>assert_raise ArgumentError, myFn(a,b) </code></pre> <p>but it does no...
37,772,230
What is typescript tsserver all about?<p>What does <code>tsserver</code> do ?. Got a vague idea that it helps IDEs to implement features like error checking and auto-completion. But I couldn't find any API documentation.</p>
<p>Simply speaking, it's a tool that runs TypeScript compiler in background and can quickly respond to commands like "compile this" or "autocomplete that".</p> <p>It's meant to use by tool developers, and you won't need it in day-to-day work with TypeScript.</p> <p>You can find source code <a href="https://github.com...
What is typescript tsserver all about?
typescript
27
9,521
2
37,773,587
37,773,587
27
true
2016-06-12T08:35:36.520Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is typescript tsserver all about?<p>What does <code>tsserver</code> do ?. Got a vague idea that it helps IDEs to implement features like error checking ...
37,668,680
How to hash password before saving to db to be compatible with passport module (passport local)<p>I am using passport-local strategy of passport for authentication. In my express server, I am getting a register post request and I should save password to db for a new user. But I need to hash the password before saving t...
<p><code>passport-local</code> does not hash your passwords - it <a href="https://github.com/jaredhanson/passport-local/blob/c5a349b1fce71c51d66f78f8fc3e3861444b9a04/lib/strategy.js#L87-L90" rel="noreferrer">passes the credentials to your verify callback</a> for verification and you take care of handling the credential...
How to hash password before saving to db to be compatible with passport module (passport local)
javascript|node.js|passport.js
14
14,129
3
37,693,110
37,693,110
28
true
2016-06-07T00:15:07.943Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to hash password before saving to db to be compatible with passport module (passport local)<p>I am using passport-local strategy of passport for authenti...
37,754,165
Python/Pandas create zip file from csv<p>Is anyone can provide example how to create zip file from csv file using Python/Pandas package? Thank you</p>
<p>Use </p> <pre><code>df.to_csv('my_file.gz', compression='gzip') </code></pre> <p>From the docs:</p> <blockquote> <p>compression : string, optional a string representing the compression to use in the output file, allowed values are ‘gzip’, ‘bz2’, ‘xz’, only used when the first argument is a filename</p> </bl...
Python/Pandas create zip file from csv
python|csv|pandas|zip|compression
24
22,832
4
37,754,204
37,754,204
35
true
2016-06-10T17:36:21.740Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python/Pandas create zip file from csv<p>Is anyone can provide example how to create zip file from csv file using Python/Pandas package? Thank you</p>
37,605,811
Separation of unit tests and integration tests<p>I'm interested in creating full mocked unit tests, as well as integration tests that check if some async operation has returned correctly. I'd like one command for the <code>unit</code> tests and one for the <code>integration</code> tests that way I can run them separate...
<p>Mocha supports directories, file globbing and test name <a href="https://mochajs.org/#usage" rel="nofollow noreferrer">grepping</a> which can be used to create &quot;groups&quot; of tests.</p> <h3>Directories</h3> <pre><code>test/unit/whatever_spec.js test/int/whatever_spec.js </code></pre> <p>Then run tests against...
Separation of unit tests and integration tests
node.js|testing|mocha.js|jestjs
20
6,666
2
37,606,303
37,606,303
42
true
2016-06-03T04:15:03.703Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Separation of unit tests and integration tests<p>I'm interested in creating full mocked unit tests, as well as integration tests that check if some async ope...
37,659,558
Move last element to next line in a flex container<p>I have this structure in my HTML code:</p> <pre><code>&lt;div style="display:flex"&gt; &lt;div class="div_first"&gt;1&lt;/div&gt; &lt;div class="div_second"&gt;2&lt;/div&gt; &lt;div class="div_third"&gt;3&lt;/div&gt; &lt;div class="div_next_line"&gt;...
<p>Apply <code>flex-wrap</code> to the container. </p> <p>Apply <code>flex: 1 0 33%</code> to the first three child divs.</p> <p>To the fourth div apply <code>flex-basis: 100%; display: flex</code>.</p> <p>To the children of the fourth div apply <code>flex: 1 0 33%</code>.</p> <p>The idea is to force the fourth it...
Move last element to next line in a flex container
html|css|flexbox
17
31,308
2
37,660,621
37,660,621
42
true
2016-06-06T14:04:52.717Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Move last element to next line in a flex container<p>I have this structure in my HTML code:</p> <pre><code>&lt;div style="display:flex"&gt; &lt;div clas...
37,613,132
Specifying private key on PuTTY command-line<p>I know there are simple commands to login to remote machine through VBA i.e. by specifying <code>User@hostname</code> and <code>-pw</code> option to provide the password in <code>Wshell.Run</code> function where <code>Wshell</code> is <code>CreateObject("WScript.Shell")</c...
<p>Use the <a href="https://the.earth.li/~sgtatham/putty/latest/htmldoc/Chapter3.html#using-cmdline-identity" rel="noreferrer"><code>-i</code> switch</a> to specify the private key.</p> <pre><code>putty.exe username@example.com -i mykey.ppk </code></pre> <p>See <a href="https://the.earth.li/~sgtatham/putty/latest/htm...
Specifying private key on PuTTY command-line
ssh|command-line|putty|private-key
24
29,443
1
37,615,178
37,615,178
44
true
2016-06-03T11:25:19.977Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Specifying private key on PuTTY command-line<p>I know there are simple commands to login to remote machine through VBA i.e. by specifying <code>User@hostname...
37,661,391
What are Eff and Aff?<p>What is the relationship between the Purescript types <a href="https://pursuit.purescript.org/packages/purescript-eff/0.1.2/docs/Control.Monad.Eff#t:Eff"><code>Eff</code></a> and <a href="https://pursuit.purescript.org/packages/purescript-aff/0.16.1/docs/Control.Monad.Aff#t:Aff"><code>Aff</code>...
<p><code>Eff</code> is a synchronous effect monad. It is used to sequence effectful foreign JavaScript code - things like random number generation, reading and writing mutable values, writing to the console and throwing and catching exceptions.</p> <p><code>Aff</code> is an asynchronous effect monad. It can handle and...
What are Eff and Aff?
purescript
34
2,325
1
37,663,712
37,663,712
52
true
2016-06-06T15:34:57.120Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What are Eff and Aff?<p>What is the relationship between the Purescript types <a href="https://pursuit.purescript.org/packages/purescript-eff/0.1.2/docs/Cont...
37,688,587
Destructuring assignments are not supported by current JavaScript version<p>I followed the steps <a href="https://blog.jetbrains.com/webstorm/2016/05/getting-started-with-electron-in-webstorm/" rel="noreferrer">here</a> to configure code completion and other stuff in WebStorm but I'm still getting the following syntax ...
<p>By changing 'JavaScript language version' (<code>Settings/Languages &amp; Frameworks/JavaScript</code>) accordingly, to either '<code>ECMASCript 6</code>' or '<code>JSX Harmony</code>'. BTW, WebStorm can do it for you: hit <code>Alt+Enter</code> on the highlighted statement, choose 'Change JavaScript version to ECMA...
Destructuring assignments are not supported by current JavaScript version
webstorm|electron
26
9,010
1
37,688,701
37,688,701
56
true
2016-06-07T20:20:20.437Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Destructuring assignments are not supported by current JavaScript version<p>I followed the steps <a href="https://blog.jetbrains.com/webstorm/2016/05/getting...
37,615,086
How to filter a dictionary by value in JavaScript?<p>I am writing a script to create a dictionary called <em>dict</em>, where I store the the frequencies of some words that I have in a text area. My array looks like this:</p> <pre><code>var dict = removeArray.reduce(function(p,c) { if (p[c] === undefined) { ...
<p>You could use <code>reduce</code> again to achieve that in plain JavaScript:</p> <pre><code>var filtered = Object.keys(dict).reduce(function (filtered, key) { if (dict[key] &gt; 1) filtered[key] = dict[key]; return filtered; }, {}); </code></pre> <p>With some ES6 features, such as arrow functions, spread s...
How to filter a dictionary by value in JavaScript?
javascript|html|lodash
31
53,833
1
37,615,234
37,615,234
68
true
2016-06-03T12:59:36.360Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to filter a dictionary by value in JavaScript?<p>I am writing a script to create a dictionary called <em>dict</em>, where I store the the frequencies of ...
37,725,195
Pandas - Replace values based on index<p>If I create a dataframe like so:</p> <pre><code>import pandas as pd, numpy as np df = pd.DataFrame(np.random.randint(0,100,size=(100, 2)), columns=list('AB')) </code></pre> <p>How would I change the entry in column A to be the number 16 from row 0 -15, for example? In other wor...
<p>Use <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.loc.html" rel="noreferrer"><code>loc</code></a>:</p> <pre><code>df.loc[0:15,'A'] = 16 print (df) A B 0 16 45 1 16 5 2 16 97 3 16 58 4 16 26 5 16 87 6 16 51 7 16 17 8 16 39 9 16 73 10 16 94 11 ...
Pandas - Replace values based on index
python|numpy|pandas|replace|dataframe
42
130,347
5
37,725,243
37,725,243
79
true
2016-06-09T11:51:02.033Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pandas - Replace values based on index<p>If I create a dataframe like so:</p> <pre><code>import pandas as pd, numpy as np df = pd.DataFrame(np.random.randin...
37,673,454
JavaScript iterate key & value from json?<p>I am trying to iterate the following json:</p> <pre><code>{ "VERSION" : "2006-10-27.a", "JOBNAME" : "EXEC_", "JOBHOST" : "Test", "LSFQUEUE" : "45", "LSFLIMIT" : "2006-10-27", "NEWUSER" : "3", "NEWGROUP" : "2", "NEWMODUS" : "640" } </code></pre> <p>Here key is dynamic. I wan...
<p>Use <strong><a href="https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/keys" rel="noreferrer"><code>Object.keys()</code></a></strong> to get keys array and use <strong><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach" rel="nore...
JavaScript iterate key & value from json?
javascript|arrays|json
70
127,556
2
37,673,499
37,673,499
133
true
2016-06-07T07:47:50.963Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: JavaScript iterate key & value from json?<p>I am trying to iterate the following json:</p> <pre><code>{ "VERSION" : "2006-10-27.a", "JOBNAME" : "EXEC_", "JO...
37,609,104
container-fluid keeps going to background even whenz-index is set<p>Hi guys I try to implamant a very simple wey of design. I want that the first part of the page will be with fixed position and when I scroll, the rest of the page will overlay it just like on sites like popcoren time here is an <a href="http://popcorn-...
<p>try to change:</p> <pre><code>&lt;div class="container-fluid" style="background-color:#CE1E1A;"&gt; </code></pre> <p>to:</p> <pre><code>&lt;div class="container-fluid" style="background-color:#CE1E1A;position:relative;"&gt; </code></pre>
container-fluid keeps going to background even whenz-index is set
html|css|twitter-bootstrap
-3
21
1
37,609,220
37,609,220
0
true
2016-06-03T08:03:10.093Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: container-fluid keeps going to background even whenz-index is set<p>Hi guys I try to implamant a very simple wey of design. I want that the first part of the...
37,648,210
Unexpected NullpointExpection inside a setter<p>I'm trying to do a simple operation: click a button and show a custom DialogFragment, but I'm getting a NullPointExpection and I can't figure out why.</p> <p><strong>mAlertDialog.java:</strong></p> <pre><code>public class mAlertDialog extends DialogFragment { TextV...
<p>The <code>title</code> is still null when you are calling </p> <pre><code>mAlertDialog dialog = new mAlertDialog(); dialog.setTheTitle(getActivity().getString(R.string.invalidTimeTitle)); </code></pre> <p>so what you can do is</p> <pre><code>public View onCreateView(LayoutInflater inflater, ViewGroup container, B...
Unexpected NullpointExpection inside a setter
java|android|nullpointerexception
-4
68
2
37,648,446
37,648,446
0
true
2016-06-06T00:47:26.973Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Unexpected NullpointExpection inside a setter<p>I'm trying to do a simple operation: click a button and show a custom DialogFragment, but I'm getting a NullP...
37,621,686
Never saw this operator before<p>I was reading a source from laravel project and then i found this line:</p> <pre><code>$this-&gt;crawler() ?: $this-&gt;response-&gt;getContent() </code></pre> <p>Does <code>?:</code> do something special? In php?</p> <p>I dont remember seeing that in any other place</p>
<p>Ternary operator :)</p> <p>Left side determines the course of action if the function called returns anything other than FALSE or 0. If it is false or 0, the right side will be the action taken. </p> <p>This can also be 'stacked' to perform the first statement in a sequence that results in a value of anything but F...
Never saw this operator before
php|operators
-3
51
1
37,621,706
37,621,706
1
true
2016-06-03T19:01:34.160Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Never saw this operator before<p>I was reading a source from laravel project and then i found this line:</p> <pre><code>$this-&gt;crawler() ?: $this-&gt;res...
37,652,526
Firebase dynamic links handled twice<p>I have a problem that firebase dynamic link is relaunched when the android app is restarted. The following sequence produces the problem:</p> <ol> <li>click the deep link URL</li> <li>the app is opened at the view pointed by the deep link (as expected) </li> <li>close the app (co...
<p>You need to call <code>getInvitation()</code> both in your launcher activity, and in the activity which you declared to handle the dynamic link. </p> <p>But in the activity which handles the dynamic link, you need to pass <strong>null</strong> instead of passing the activity as second parameter of <code>getInvitati...
Firebase dynamic links handled twice
android|firebase|firebase-dynamic-links
9
2,631
1
37,689,525
37,689,525
5
true
2016-06-06T08:14:08.993Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Firebase dynamic links handled twice<p>I have a problem that firebase dynamic link is relaunched when the android app is restarted. The following sequence pr...
37,835,055
how to prevent angular2 http library from removing special chars from login data?<p>I'm trying to use http library to issue a login request to a specific api. I'm getting a wrong credentials error because the data sent is encoded somehow and all the plus signs are changed to spaces. so if I enter amani+salah@gamil.com ...
<p>You need to encode the string like shown in <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent" rel="nofollow">encodeURIComponent</a></p> <pre><code>let body = 'email='+encodeURIComponent('+email+'&amp;password='+password); </code></pre>
how to prevent angular2 http library from removing special chars from login data?
http|typescript|angular
7
1,871
2
37,835,115
37,835,115
5
true
2016-06-15T12:08:19.723Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to prevent angular2 http library from removing special chars from login data?<p>I'm trying to use http library to issue a login request to a specific api...
37,633,251
Serving Scala.js assets<p>I've started new project with <a href="https://github.com/finagle/finch" rel="noreferrer">Finch</a> and <a href="https://www.scala-js.org/" rel="noreferrer">Scala.js</a>, where backend and frontend need to share some code.</p> <p>And I'm concerned about a good way to serve JS produced by <cod...
<p>One approach which I've used successfully involves 3 sbt projects and an additional folder at the root for static content:</p> <pre><code>. ├── build.sbt ├── client ├── server ├── shared └── static </code></pre> <p>In the <code>build.sbt</code>, you would then use something like the following:</p> <pre><code>lazy...
Serving Scala.js assets
scala|sbt|asset-pipeline|scala.js|finch
7
573
1
37,633,673
37,633,673
7
true
2016-06-04T17:45:15.950Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Serving Scala.js assets<p>I've started new project with <a href="https://github.com/finagle/finch" rel="noreferrer">Finch</a> and <a href="https://www.scala-...
37,781,426
How to change the color of QStringListModel items?<p>I have </p> <pre><code>QListView *myListView; QStringList *myStringList; QStringListModel *myListModel; </code></pre> <p>which I fill with data like this:</p> <pre><code>myStringList-&gt;append(QString::fromStdString(...)); myListModel-&gt;setStringList(*myStringL...
<p><code>QStringListModel</code> supports only <code>Qt::DisplayRole</code> and <code>Qt::EditRole</code> roles. </p> <p>You have to reimplement the <code>QStringListModel::data()</code> and <code>QStringListModel::setData()</code> methods to support other roles.</p> <p>Example:</p> <pre><code>class CMyListModel : ...
How to change the color of QStringListModel items?
c++|qt|qlistview
7
1,569
1
37,783,141
37,783,141
7
true
2016-06-13T03:29:58.477Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to change the color of QStringListModel items?<p>I have </p> <pre><code>QListView *myListView; QStringList *myStringList; QStringListModel *myListModel;...
37,764,428
Convert a sparse matrix to a full matrix - R<p>I am looking for an efficient way to convert a huge sparse matrix to a full matrix (not to a dataframe) in R?</p> <p>Any idea?</p> <p>Thanks.</p>
<p>We can use <code>as.matrix</code></p> <pre><code>m1 &lt;- as.matrix(sM) </code></pre> <p>where <code>sM</code> is the sparse matrix.</p> <p>We can check the <code>methods</code></p> <pre><code>grep("as.matrix", methods(class = "sparseMatrix"), value = TRUE) #[1] "as.matrix,Matrix-method" </code></pre>
Convert a sparse matrix to a full matrix - R
r
11
8,196
1
37,764,444
37,764,444
9
true
2016-06-11T13:42:37.413Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Convert a sparse matrix to a full matrix - R<p>I am looking for an efficient way to convert a huge sparse matrix to a full matrix (not to a dataframe) in R?<...
37,688,509
Determine and set timezone in POSIXct, POSIXlt, strptime, etc. in R<pre><code>t.ct = as.POSIXct("2009-01-05 14:19 +1200", format="%Y-%m-%d %H:%M %z") t.lt = as.POSIXlt("2009-01-05 14:19 +1200", format="%Y-%m-%d %H:%M %z") t.st = strptime("2009-01-05 14:19 +1200", format="%Y-%m-%d %H:%M %z") </code></pre> <p>These se...
<p>If you do not use a timezone specifically, POSIXct and POSIXlt will reference to your local timezone. However, this is not entirely reliable. POSIXlt will not display the timezone in the output string.</p> <p>Note, the tzone argument is not set.</p> <pre><code>t.ct &lt;- as.POSIXct("2009-01-05 14:19 +1200", format...
Determine and set timezone in POSIXct, POSIXlt, strptime, etc. in R
r|datetime
7
6,976
1
37,689,169
37,689,169
11
true
2016-06-07T20:15:58.290Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Determine and set timezone in POSIXct, POSIXlt, strptime, etc. in R<pre><code>t.ct = as.POSIXct("2009-01-05 14:19 +1200", format="%Y-%m-%d %H:%M %z") t.lt = ...
37,689,632
Max margin loss in TensorFlow<p>I'm trying to implement a max margin loss in TensorFlow. the idea is that I have some positive example and i sample some negative examples and want to compute something like</p> <p><img src="https://latex.codecogs.com/gif.latex?%5Csum_%7Bb%7D%5E%7BB%7D%20%5Csum_%7Bn%7D%5E%7BN%7Dmax%280%...
<p>First we need to clean the input:</p> <ul> <li>we want an array of positive scores, of shape <code>[B, 1]</code></li> <li>we want a matrix of negative scores, of shape <code>[B, N]</code></li> </ul> <pre class="lang-py prettyprint-override"><code>import tensorflow as tf B = 2 N = 2 scores = tf.constant([0.5, 0.2,...
Max margin loss in TensorFlow
python|machine-learning|tensorflow
8
6,150
1
37,690,029
37,690,029
11
true
2016-06-07T21:24:06.193Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Max margin loss in TensorFlow<p>I'm trying to implement a max margin loss in TensorFlow. the idea is that I have some positive example and i sample some nega...
37,777,815
Difference between deployment and provisioning ADF<p>Whenever I create a new pipeline in ADF, and click on 'deploy', at first I see the message saying <strong>"deplyoing"</strong>, right after that I see the message saying <strong>"provisioning"</strong>. What's the difference?</p> <p>Can we have a situation where it ...
<p>In this case provisioning is a part of the deployment process.</p> <p>When you start deployment of solutions like ADF, Azure will initiate provisioning of the needed resources, for example creation of virtual machines, storage accounts etc.</p> <p>Once the correct resources have been provisioned, the selected solu...
Difference between deployment and provisioning ADF
azure|azure-data-factory
7
3,889
1
37,787,387
37,787,387
11
true
2016-06-12T18:41:41.900Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Difference between deployment and provisioning ADF<p>Whenever I create a new pipeline in ADF, and click on 'deploy', at first I see the message saying <stron...
37,640,368
How can I implement video chat in my website using Django?<p>I want to develop a website in which users can have video chat and they can connect to other user anonymously without had been added by the other person as friend. I also want that all the active users list is displayed on the website. So somebody please sugg...
<p>You can use a third party service for this. Or you can use WebRTC. There are some nodejs packages which can help you do this. I like "EasyRTC" for that. </p> <p>Or if you want to use Python, you can use Twisted. Here's a tutorial (found on Google, not tested by myself - <a href="https://ferretfarmer.net/2013/09/05/...
How can I implement video chat in my website using Django?
django|video|chat
10
18,948
2
37,640,485
37,640,485
13
true
2016-06-05T09:27:06.867Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I implement video chat in my website using Django?<p>I want to develop a website in which users can have video chat and they can connect to other use...
37,712,228
Elasticsearch Scripting: updating array value<p>This is my document</p> <pre><code>{ "name": "andrew", "b": [{"x":"c1", "y": 0}, {"x":"c2", "y": 0}] } </code></pre> <p>I want to find element in the array field "b" and update the entire object. I tried this script but it does not update. Any ideas?</p> <pre><...
<p>Use this instead:</p> <pre><code>{ "script": "for (int i=0;i&lt;ctx._source.b.size();i++) { item=ctx._source.b[i]; if (item['x'] == x_id) { ctx._source.b[i] = newobj} };", "params": { "x_id": "c1", "newobj": { "x": "c1", "y": 4222 } }, "lang": "groovy" } </code></pre>
Elasticsearch Scripting: updating array value
elasticsearch
9
8,731
1
37,712,784
37,712,784
13
true
2016-06-08T20:24:53.053Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Elasticsearch Scripting: updating array value<p>This is my document</p> <pre><code>{ "name": "andrew", "b": [{"x":"c1", "y": 0}, {"x":"c2", "y": 0}]...
37,752,719
Message size limit for Facebook messenger bot<p>I am trying to implement a Facebook messenger bot. I have trouble with the bot replying with a response that contains large amount of words. Is there a limit to the number of words that can be used in a response?</p> <p>P.S : It works fine otherwise</p>
<p>As <a href="https://developers.facebook.com/docs/messenger-platform/reference/send-api#message" rel="nofollow noreferrer">described in the doc</a>, text message <em>must be UTF-8 and has a 2000 character limit</em>.</p> <p>There are other restrictions <a href="https://developers.facebook.com/docs/messenger-platform...
Message size limit for Facebook messenger bot
facebook|bots|messenger|facebook-messenger
9
12,355
2
37,792,151
37,792,151
14
true
2016-06-10T16:08:04.957Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Message size limit for Facebook messenger bot<p>I am trying to implement a Facebook messenger bot. I have trouble with the bot replying with a response that ...
37,807,783
Javascript filter check for multiple values?<p>I am wondering how I can return multiple values from an array like this:</p> <pre><code>var countries = [ { key: "Spain", doc_count: 1378 }, { key: "Greece", doc_count: 1259 } ]; </code></pre> <p>This is what I have set up so far and it works fine for returning a...
<p>Change your filter to :</p> <pre><code>var countriesFound = countries.filter(function(country) { return ["Spain","Greece"].indexOf(country.key) != -1 }); </code></pre> <p>Where <code>["Spain","Greece"]</code> is your list of valid countries that you want to filter by. The value returned form the filter functio...
Javascript filter check for multiple values?
javascript|arrays
9
6,201
2
37,807,845
37,807,845
16
true
2016-06-14T09:17:15.790Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Javascript filter check for multiple values?<p>I am wondering how I can return multiple values from an array like this:</p> <pre><code>var countries = [ ...
37,791,547
Selenium WebDriver get Current frame before switch<p>I have a custom action to find elements, by switching in the certain iFrame. It uses the following native action: <code>driver.switchTo().frame(requested_frame)</code> Currently I am switching back to the default content every-time before switch to the exact iframe.<...
<p>As the exact answer for my own question <strong>"Selenium WebDriver get Current frame"</strong> I found the following way to do it.</p> <pre><code>JavascriptExecutor jsExecutor = (JavascriptExecutor)driver; String currentFrame = jsExecutor.executeScript("return self.name"); </code></pre> <p>But in here, the Javasc...
Selenium WebDriver get Current frame before switch
java|selenium|selenium-webdriver
10
28,209
2
37,826,944
37,826,944
16
true
2016-06-13T13:52:00.680Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Selenium WebDriver get Current frame before switch<p>I have a custom action to find elements, by switching in the certain iFrame. It uses the following nativ...
37,602,608
Cygwin error: "child_info_fork::abort: Loaded to different address:"<p>I am trying to build my software using cygwin-x86(32 bit version) on Windows-7. <br>Cygwin-x64(64 bit) works perfectly fine on the same machine. I want to build 32-bit executable. <br>Whenever I try cygwin-x86, I get the following errors:</p> <blo...
<p>The thread is obsolete.</p> <p>run <code>/usr/bin/rebase-trigger</code>, close all cygwin processes and run again <code>setup-x86.exe</code>. Also without installing anything will execute a rebase for you.</p> <p>You can also specify the option full.</p> <p>Additional note: The most likely cause of fork problems ...
Cygwin error: "child_info_fork::abort: Loaded to different address:"
windows|shell|cygwin
19
20,997
5
37,616,907
37,616,907
17
true
2016-06-02T21:42:00.047Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Cygwin error: "child_info_fork::abort: Loaded to different address:"<p>I am trying to build my software using cygwin-x86(32 bit version) on Windows-7. <br>C...
37,684,547
Cassandra Compaction vs Repair vs Cleanup<p>After posting a <a href="https://stackoverflow.com/questions/37661781/cassandra-compaction-tasks-number-keep-growing">question</a> and reading <a href="https://cassandra-zone.com/understanding-repairs/" rel="noreferrer">this</a> and <a href="http://www.datastax.com/dev/blog/c...
<p>A <code>cleanup</code> is a compaction that just removes things outside the nodes token range(s). A <code>repair</code> has a "Validation Compaction" to build a merkle tree to compare with the other nodes, so part of <code>nodetool repair</code> will have a compaction.</p> <blockquote> <p>Is repair task can be pr...
Cassandra Compaction vs Repair vs Cleanup
cassandra|cassandra-2.1|nodetool
10
7,469
1
37,685,697
37,685,697
21
true
2016-06-07T16:22:55.627Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Cassandra Compaction vs Repair vs Cleanup<p>After posting a <a href="https://stackoverflow.com/questions/37661781/cassandra-compaction-tasks-number-keep-grow...
37,798,943
Update SQL column using Rank() function<p>I have a table with existing data. For each unique value in the first column of this table, we have a column that is supposed to be in sequential order, but this table has gotten out of order. I want to run a SQL statement that will put this second column back in order. I wa...
<p>This is one way:</p> <pre><code>WITH CTE AS ( SELECT FORMULA_ID, ATTRIB_CODE, ATTRIB_VAL, ATTRIB_ORDER, RANK() OVER (PARTITION BY formula_id ORDER BY attrib_code, attrib_val) AS WANT_THIS FROM ATTRIB ) UPDATE CTE SET ATTRIB_ORDER ...
Update SQL column using Rank() function
sql|sql-server
10
14,613
1
37,798,986
37,798,986
21
true
2016-06-13T20:54:30.297Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Update SQL column using Rank() function<p>I have a table with existing data. For each unique value in the first column of this table, we have a column that ...
37,686,187
How to convert json array into postgres int array in postgres 9.3<p>I have scenario where i need to convert a json array into postgres int array and query it for the result. Below is my array</p> <pre><code> ID DATA 1 {"bookIds" : [1,2,3,5], "storeIds": [2,3]} 2 {"boo...
<p>The setup in the question should look like this:</p> <pre><code>create table a_table (id int, data json); insert into a_table values (1, '{"bookIds": [1,2,3,5], "storeIds": [2,3]}'), (2, '{"bookIds": [4,5,6,7], "storeIds": [1,3]}'), (3, '{"bookIds": [11,12,10,9], "storeIds": [4,3]}'); </code></pre> <p>Note the pr...
How to convert json array into postgres int array in postgres 9.3
arrays|json|postgresql|postgresql-9.3
17
34,846
4
37,686,469
37,686,469
22
true
2016-06-07T17:57:03.817Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to convert json array into postgres int array in postgres 9.3<p>I have scenario where i need to convert a json array into postgres int array and query it...
37,653,391
Cannot launch AVD in emulator Android Studio<p>Problem with emulator in android studio 2...</p> <p>Cannot launch AVD in emulator</p> <pre><code>Output: libGL error: failed to load driver: nouveau libGL error: unable to load driver: swrast_dri.so libGL error: failed to load driver: swrast X Error of failed request: G...
<p>Problem with the <strong>Sdk path</strong>.....</p> <p>Linked the <strong>Sdk path</strong> instead of <strong>$ANDROID_HOME</strong></p> <pre><code> cd $ANDROID_HOME/android-sdk-linux_x86/tools/lib64/libstdc++ mv libstdc++.so.6 libstdc++.so.6.bak ln -s /usr/lib64/libstdc++.so.6 $ANDROID_HOME/android-sdk-linu...
Cannot launch AVD in emulator Android Studio
android|android-studio|android-emulator
17
18,707
3
37,679,624
37,679,624
26
true
2016-06-06T09:03:16.600Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Cannot launch AVD in emulator Android Studio<p>Problem with emulator in android studio 2...</p> <p>Cannot launch AVD in emulator</p> <pre><code>Output: lib...
37,836,383
Android: Firebase token is null at first run<p>I am using FCM to provide notifications in my app. Everything worked well, but now I realised that, when I install my application using Android Studio (not from GooglePlay) the token is null at first run. When I close my app and restart it, the token is not null anymore. W...
<p>The token is fetched asynchronously on first app start. You have to wait for <code>onTokenRefresh()</code> to be called in your <code>FirebaseInstanceIdService</code> before the token can be accessed.</p>
Android: Firebase token is null at first run
android|firebase|firebase-cloud-messaging
33
43,819
10
37,836,693
37,836,693
30
true
2016-06-15T13:07:51.677Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Android: Firebase token is null at first run<p>I am using FCM to provide notifications in my app. Everything worked well, but now I realised that, when I ins...
37,616,252
iOS option is disabled in Version or platform (iTunes Connect)<p>I uploaded my app to the App Store using xcode. I can see my build in my existing app on iTunes connect. However when I want to add the build using the "+ Version or platform" option it shows me a disabled iOS button:</p> <p>My build version is 2.0.</p> ...
<p>I found the solution. In my case I wanted to update the app to a newer version which wasn't listed in the "+Version or Platform" menu. The possible reason is that a previous build failed, with the status of "Prepare for Submission". </p> <ol> <li>Select the build which is listed as "Prepare for submission" under "i...
iOS option is disabled in Version or platform (iTunes Connect)
app-store|app-store-connect
27
7,452
3
37,620,269
37,620,269
31
true
2016-06-03T13:53:41.497Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: iOS option is disabled in Version or platform (iTunes Connect)<p>I uploaded my app to the App Store using xcode. I can see my build in my existing app on iTu...
37,689,942
Grid-Search finding Parameters for AUC<p>I'm trying to find the parameters for my SVM, which give me the best AUC. But i can't find any scoring function for AUC in sklearn. Does someone have an idea? Here is my Code:</p> <pre><code> parameters = {"C":[0.1, 1, 10, 100, 1000], "gamma":[0.1, 0.01, 0.001, 0.0001, 0.000...
<p>You can simply use:</p> <pre><code>clf = GridSearchCV(clf, parameters, scoring='roc_auc') </code></pre>
Grid-Search finding Parameters for AUC
python|scikit-learn|svm|grid-search
11
18,217
4
37,696,446
37,696,446
31
true
2016-06-07T21:46:38.987Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Grid-Search finding Parameters for AUC<p>I'm trying to find the parameters for my SVM, which give me the best AUC. But i can't find any scoring function for ...
37,727,515
Break lines in blade translation files<p>In my view I have</p> <pre><code>&lt;p&gt;{{ trans('mission-vision-page.mission-description') }}&lt;/p&gt; </code></pre> <p>I've put a block of text in my language file, but I want to maintain the new lines. I've tried:</p> <p>1.</p> <pre><code>return ['mission-description' ...
<p>use <code>{!! !!}</code> instead of <code>{{ }}</code> and <code>&lt;br/&gt;</code> tag in you message </p> <pre><code>&lt;p&gt;{!! trans('mission-vision-page.mission-description') !!}&lt;/p&gt; </code></pre>
Break lines in blade translation files
php|laravel|laravel-blade
14
13,575
3
37,727,854
37,727,854
32
true
2016-06-09T13:34:09.363Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Break lines in blade translation files<p>In my view I have</p> <pre><code>&lt;p&gt;{{ trans('mission-vision-page.mission-description') }}&lt;/p&gt; </code><...
37,644,957
What is the difference between DAL, DTO and DAO in a 3 tier architecture style including with MVC<p>Recently I was learning about ORM (Object Relational Mapping) and the 3 tier architecture style (presentation,business and <strong>data persistence</strong>). If I understand correctly, I can separate the <strong>data p...
<p>Lets start with purpose of each: -</p> <p><strong>DTO</strong></p> <p>Data Transfer Objects. These are generally used to transfer data from controller to client (JS). Term is also used for POCOs/POJOs by few which actually holds the data retrieved from Database.</p> <p><strong>DAO</strong></p> <p>Data Access Obj...
What is the difference between DAL, DTO and DAO in a 3 tier architecture style including with MVC
model-view-controller|orm|dao|data-access-layer|dto
25
21,532
2
37,751,345
37,751,345
32
true
2016-06-05T17:47:34.610Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is the difference between DAL, DTO and DAO in a 3 tier architecture style including with MVC<p>Recently I was learning about ORM (Object Relational Map...
37,771,418
Iterate through methods and properties of an ES6 class<p>So with the growth of new frameworks with JavaScript many have adopted ECMAScript 6 shim's or TypeScript, with many new features. My question is this: </p> <p>How does one iterate over the methods/properties of an ES6 class? </p> <p>e.g. (with objects)</p> <...
<p>The <code>constructor</code> and any defined methods are <em>non-enumerable</em> properties of the class's <code>prototype</code> object.</p> <p>You can therefore get an array of the names (without constructing an instance of the class) with:</p> <pre><code>Object.getOwnPropertyNames(MyClass.prototype) </code></pr...
Iterate through methods and properties of an ES6 class
javascript|loops|ecmascript-6
17
15,131
4
37,771,608
37,771,608
35
true
2016-06-12T06:36:34.057Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Iterate through methods and properties of an ES6 class<p>So with the growth of new frameworks with JavaScript many have adopted ECMAScript 6 shim's or TypeSc...
37,712,871
Why does Immutable.js throw Invalid key path on Map.setIn()<p>I must be missing something here because the <a href="https://facebook.github.io/immutable-js/docs/#/Map/setIn" rel="noreferrer">Docs</a> make it out as if the below code should work just fine but I get an invalid keypath error... Check <a href="http://codep...
<p>This happens because the key <code>'selector'</code> has a non-Map value. <code>setIn</code> will work if we make sure that the value for <code>'selector'</code> is also an Immutable Map:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true"> <div class="snippet-code"> <pre class="snippet...
Why does Immutable.js throw Invalid key path on Map.setIn()
javascript|immutable.js
21
13,353
1
37,713,837
37,713,837
38
true
2016-06-08T21:02:38.003Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why does Immutable.js throw Invalid key path on Map.setIn()<p>I must be missing something here because the <a href="https://facebook.github.io/immutable-js/d...
37,715,276
How do I populate a drop down with a list using thymeleaf and spring<p>I need to populate a drop down with all the values within a list of strings.</p> <p>Controller Class</p> <pre><code>@RequestMapping(value = "/generateIds", method = RequestMethod.GET) public String launchPage(Model model) { List&lt;Municipalit...
<p>This is how I populate the drop down list.I think it may help to you get some idea about it.</p> <p>Controller</p> <pre><code>List&lt;Operator&gt; operators = operatorService.getAllOperaors() model.addAttribute("operators", operators); </code></pre> <p>Model</p> <pre><code> @Entity @Table(name = "operator") ...
How do I populate a drop down with a list using thymeleaf and spring
java|html|spring|thymeleaf
29
77,324
5
37,723,208
37,723,208
39
true
2016-06-09T00:56:30.080Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I populate a drop down with a list using thymeleaf and spring<p>I need to populate a drop down with all the values within a list of strings.</p> <p>C...
37,771,316
React - Triggering click event on table row<p>I am having trouble to invoke click event from a table row in React. Below is my code. I have a separate function to populate the rows alone, but it seems i am messing up the binding information to that. </p> <pre><code>import React, {Component, PropTypes} from 'react'; im...
<p>Firstly, you are passing an evaluated function call to your <code>onClick</code> property.</p> <p>See the following code in isolation:</p> <pre><code> function foo(name) { return 'hello ' + name; } foo('bob'); </code></pre> <p>You expect the output of <code>foo('bob')</code> to be "hello bob". </p> <p>It's th...
React - Triggering click event on table row
javascript|reactjs
18
101,934
4
37,771,414
37,771,414
41
true
2016-06-12T06:21:58.293Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: React - Triggering click event on table row<p>I am having trouble to invoke click event from a table row in React. Below is my code. I have a separate functi...
37,795,760
R shiny: Add weblink to actionButton<p>I have a box in my shiny application that has a button included within a shiny dashboard box like this:</p> <pre><code>shiny::fluidRow( shinydashboard::box(title = "Intro Page", "Some description...", shiny::actionButton(inputId='ab1', label="Learn More", icon = icon("th...
<p>You can add the parameter</p> <pre><code>onclick ="location.href='http://google.com';" </code></pre> <p>To the action button and clicking it will take you to google.com in the current window or you can add</p> <pre><code>onclick ="window.open('http://google.com', '_blank')" </code></pre> <p>and you will be taken...
R shiny: Add weblink to actionButton
html|r|hyperlink|action-button
31
15,912
3
37,796,079
37,796,079
46
true
2016-06-13T17:26:15.280Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: R shiny: Add weblink to actionButton<p>I have a box in my shiny application that has a button included within a shiny dashboard box like this:</p> <pre><cod...