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
44,181,945
Kotlin Property: "Type parameter of a property must be used in its receiver type"<p>I have the following simple Kotlin extension functions:</p> <pre><code>// Get the views of ViewGroup inline val ViewGroup.views: List&lt;View&gt; get() = (0..childCount - 1).map { getChildAt(it) } // Get the views of ViewGroup of ...
<p>The error means that you can only have a generic type parameter for an extension property if you're using said type in the receiver type - the type that you're extending. </p> <p>For example, you could have an extension that extends <code>T</code>:</p> <pre><code>val &lt;T: View&gt; T.propName: Unit get() = Un...
Kotlin Property: "Type parameter of a property must be used in its receiver type"
android|generics|kotlin
19
5,376
1
44,182,300
44,182,300
18
true
2017-05-25T13:34:26.473Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Kotlin Property: "Type parameter of a property must be used in its receiver type"<p>I have the following simple Kotlin extension functions:</p> <pre><code>/...
37,943,372
Kafka Consumer - Poll behaviour<p>I'm facing some serious problems trying to implement a solution for my needs, regarding KafkaConsumer (>=0.9).</p> <p>Let's imagine I have a function that has to read just <strong>n</strong> messages from a kafka topic.</p> <p>For example: <code>getMsgs(5)</code> --> <em>gets next 5 ...
<p>You can set <code>max.poll.records</code> to whatever number you like such that at most you will get that many records on each poll. </p> <p>For your use case that you stated in this problem you don't have to commit offsets explicitly by yourself. you can just set <code>enable.auto.commit</code> to <code>true</code...
Kafka Consumer - Poll behaviour
apache-kafka|kafka-consumer-api
17
55,582
4
44,323,273
44,323,273
18
true
2016-06-21T11:37:25.767Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Kafka Consumer - Poll behaviour<p>I'm facing some serious problems trying to implement a solution for my needs, regarding KafkaConsumer (>=0.9).</p> <p>Let'...
43,956,705
Sklearn LabelEncoder throws TypeError in sort<p>I am learning machine learning using Titanic dataset from Kaggle. I am using LabelEncoder of sklearn to transform text data to numeric labels. The following code works fine for "Sex" but not for "Embarked".</p> <pre><code>encoder = preprocessing.LabelEncoder() features["...
<p>I solved it myself. The problem was that the particular feature had NaN values. Replacing it with a numerical value it will still throw an error since it is of different datatypes. So I replaced it with a character value</p> <pre><code> features["Embarked"] = encoder.fit_transform(features["Embarked"].fillna('0')) ...
Sklearn LabelEncoder throws TypeError in sort
machine-learning|scikit-learn|sklearn-pandas
8
11,046
2
43,962,765
43,962,765
19
true
2017-05-13T18:39:04.157Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Sklearn LabelEncoder throws TypeError in sort<p>I am learning machine learning using Titanic dataset from Kaggle. I am using LabelEncoder of sklearn to trans...
44,060,518
Uploading Image to Firebase Storage and Database<p>I want to put the download URL of images into my Firebase Database. I can upload the Image into storage but I can't figure out how to get the URL into my database with the rest of the "post".</p> <pre><code>@IBOutlet weak var titleText: UITextField! @IBOutlet weak var...
<p>Organize your <code>upload</code> and <code>save</code> funcs like this:</p> <pre><code>func uploadMedia(completion: @escaping (_ url: String?) -&gt; Void) { let storageRef = FIRStorage.storage().reference().child(&quot;myImage.png&quot;) if let uploadData = UIImagePNGRepresentation(self.myImageView.image!)...
Uploading Image to Firebase Storage and Database
swift|firebase|swift3|firebase-realtime-database|firebase-storage
14
30,219
5
44,061,967
44,061,967
19
true
2017-05-19T02:34:33.673Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Uploading Image to Firebase Storage and Database<p>I want to put the download URL of images into my Firebase Database. I can upload the Image into storage bu...
43,931,031
Can my ExpressJS website and socket.io port use the same port?<p>I've been coding ExpressJS websites which use socket.io for realtime communication, and I use the same port always</p> <pre><code>const request = require('request') const express = require('express') const app = express() const server = require('http').S...
<blockquote> <p>Is it safe / a healthy practice to use the same port for both the websocket and the express server.</p> </blockquote> <p>It is safe. It is a normal and expected situation to use the same port for your Express server and for your socket.io connections. All socket.io connections start with an http re...
Can my ExpressJS website and socket.io port use the same port?
node.js|sockets|express|socket.io
10
2,372
1
43,931,400
43,931,400
20
true
2017-05-12T06:46:30.683Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can my ExpressJS website and socket.io port use the same port?<p>I've been coding ExpressJS websites which use socket.io for realtime communication, and I us...
43,973,185
ConstraintLayout: Unable to scale image to fit a ratio in RecyclerView<ul> <li>I have a recycler view with StaggeredGridLayoutManager. </li> <li>Within in I have custom items/views. </li> <li>Each item is defined as a ConstraintLayout where there is an image which is supposed to have a constant aspect ratio.</li> <li>B...
<p>For your image, you can specify which dimension should match constraints while the other dimension is adjusted to satisfy the ratio. See the section entitled "Ratio" in the documentation for <a href="https://developer.android.com/reference/android/support/constraint/ConstraintLayout.html#DimensionConstraints" rel="n...
ConstraintLayout: Unable to scale image to fit a ratio in RecyclerView
android|android-recyclerview|aspect-ratio|android-constraintlayout
13
13,380
1
44,009,805
44,009,805
20
true
2017-05-15T06:56:11.583Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ConstraintLayout: Unable to scale image to fit a ratio in RecyclerView<ul> <li>I have a recycler view with StaggeredGridLayoutManager. </li> <li>Within in I ...
44,312,978
Python logger is not printing debug messages, although it is set correctly<p>I have the following code, where I just want to play around with the <em>logging</em> module using <em>contextmanager</em>.</p> <pre><code>from contextlib import contextmanager import logging @contextmanager def log_level(level, name): l...
<p>You haven't attached any handlers to your logger. As a result, an internal "handler of last resort" is used, which only outputs events at levels <code>WARNING</code> and above. See <a href="https://docs.python.org/3/howto/logging.html#what-happens-if-no-configuration-is-provided" rel="noreferrer">this part</a> of th...
Python logger is not printing debug messages, although it is set correctly
python|python-3.x|logging|contextmanager
16
14,115
1
44,313,548
44,313,548
20
true
2017-06-01T16:39:53.947Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python logger is not printing debug messages, although it is set correctly<p>I have the following code, where I just want to play around with the <em>logging...
44,357,112
Image Asset versus Vector Asset<p><a href="https://i.stack.imgur.com/3jVWi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3jVWi.png" alt="immage" /></a></p> <p>When it comes to adding an icon to my app, there're two main options:</p> <blockquote> <p>IMAGE ASSET || IMAGE VECTOR</p> </blockquote> <p>W...
<p>According to Android User Guide :</p> <p><a href="https://developer.android.com/studio/write/image-asset-studio.html" rel="noreferrer">Image Asset Studio</a> helps you create various types of icons at different densities and shows you exactly where they'll be placed in your project. It includes tools for adjusting ...
Image Asset versus Vector Asset
image|android-studio|icons|android-assets
19
11,306
2
44,357,181
44,357,181
20
true
2017-06-04T17:50:33.133Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Image Asset versus Vector Asset<p><a href="https://i.stack.imgur.com/3jVWi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3jVWi.png" alt=...
44,309,807
React Router v4 Redirect unit test<p>How do I unit test the component in react router v4? I am unsuccessfully trying to unit test a simple component with a redirect using jest and enzyme.</p> <p>My component:</p> <pre><code> const AppContainer = ({ location }) =&gt; (isUserAuthenticated() ? &lt;AppWithData /&g...
<p>Answering my own question. Basically I'm making a shallow render of my component and verifying that if authenticated is rendering the redirect component otherwise the App one. Here the code:</p> <pre><code>function setup() { const enzymeWrapper = shallow(&lt;AuthenticatedApp /&gt;); return { enzymeWrapper ...
React Router v4 Redirect unit test
unit-testing|reactjs|react-router
25
23,574
3
44,426,403
44,426,403
23
true
2017-06-01T14:07:30.377Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: React Router v4 Redirect unit test<p>How do I unit test the component in react router v4? I am unsuccessfully trying to unit test a simple component with a ...
44,259,851
Set restAssured to log all requests and responses globally<p>I want to enable logging for all <code>RestAssured</code> responses and requests by default.</p> <p>Here's what I do:</p> <pre><code>RestAssured.requestSpecification = new RequestSpecBuilder(). setBaseUri(&quot;api&quot;). setContentType(Conte...
<p>Add logging filters to RestAssured defaults, see <a href="https://github.com/rest-assured/rest-assured/wiki/Usage#filters" rel="noreferrer">filters</a> and <a href="https://github.com/rest-assured/rest-assured/wiki/Usage#default-values" rel="noreferrer">defaults</a>.</p> <blockquote> <p>To create a filter you nee...
Set restAssured to log all requests and responses globally
java|rest|logging|rest-assured
35
53,264
4
44,316,721
44,316,721
24
true
2017-05-30T10:34:58.833Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Set restAssured to log all requests and responses globally<p>I want to enable logging for all <code>RestAssured</code> responses and requests by default.</p>...
44,110,064
What is the purpose of ng eject?<p>The <a href="https://github.com/angular/angular-cli/wiki/eject" rel="noreferrer">documentation</a> is very brief with this topic:</p> <blockquote> <p><code>ng eject</code> ejects your app and output the proper webpack configuration and scripts</p> </blockquote> <p>What is the pu...
<p>angular-cli is something magic, everything is done in a simple and automatic way.</p> <p>But sometimes, you may want to act on how the package is done, add a plugin or you are simply curious to see the Webpack configuration on which it is based.</p> <p>When running <code>ng eject</code>, you generate a <code>webpa...
What is the purpose of ng eject?
angular|command|angular-cli
31
14,868
2
44,110,463
44,110,463
27
true
2017-05-22T10:02:17.987Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is the purpose of ng eject?<p>The <a href="https://github.com/angular/angular-cli/wiki/eject" rel="noreferrer">documentation</a> is very brief with this...
44,177,276
Android Studio. How export Live Template to file?<p>Android Studio 2.3.2. I want to export <strong>Live Templates-->AndroidLog</strong> to file. <a href="https://i.stack.imgur.com/ePGLT.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ePGLT.png" alt="enter image description here"></a></p> <p>How I can do thi...
<p>IntelliJ IDEA (and Android Studio) stores definitions of custom live templatein automatically generated configuration files <code>&lt;group_name&gt;.xml</code>.</p> <p>Depending on the operating system you are using, the <code>&lt;group_name&gt;.xml</code> files are stored at the following locations:</p> <ul> <li>...
Android Studio. How export Live Template to file?
android-studio
13
4,660
3
44,177,549
44,177,549
27
true
2017-05-25T09:43:14.763Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Android Studio. How export Live Template to file?<p>Android Studio 2.3.2. I want to export <strong>Live Templates-->AndroidLog</strong> to file. <a href="ht...
43,978,468
Django test: TransactionManagementError: You can't execute queries until the end of the 'atomic' block<p>Django newbie here. I'm trying to implement unit tests for a simple API I developed. Below you can find my test implementation which works fine:</p> <pre><code>from django.test import TestCase from my_app.models im...
<p>Apparently, moving from <code>django.test.TestCase</code> to <code>django.test.TransactionTestCase</code> solved the issue. Here are some important points regarding the differences between <code>django.test.TestCase</code> and <code>django.test.TransactionTestCase</code>:</p> <blockquote> <p><code>TransactionTestCas...
Django test: TransactionManagementError: You can't execute queries until the end of the 'atomic' block
python|django|unit-testing
15
10,289
1
43,981,107
43,981,107
29
true
2017-05-15T11:36:02.197Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Django test: TransactionManagementError: You can't execute queries until the end of the 'atomic' block<p>Django newbie here. I'm trying to implement unit tes...
44,364,502
How to set selected item in reactstrap Dropdown?<p>How to set selected item in reactstrap Dropdown?</p> <p>There is example of dropdown: <a href="https://reactstrap.github.io/components/dropdowns/" rel="noreferrer">https://reactstrap.github.io/components/dropdowns/</a></p> <p>When I select item in dropdown, it is not...
<p>Add an onclick on your DropDownItem (inside a div ?) to change your state. Set a "dropDownValue" from your click event. In your dropDownToggle, get your state.dropDownValue.</p> <p>Something like this :</p> <pre><code>changeValue(e) { this.setState({dropDownValue: e.currentTarget.textContent}) } &lt;DropdownTo...
How to set selected item in reactstrap Dropdown?
reactjs|components|reactstrap
22
34,375
3
44,365,421
44,365,421
29
true
2017-06-05T08:11:29.413Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to set selected item in reactstrap Dropdown?<p>How to set selected item in reactstrap Dropdown?</p> <p>There is example of dropdown: <a href="https://re...
44,167,908
AlertController Ionic 2 Uncaught (in promise): inserted view was already destroyed<p>Instantiating the Ionic 2 AlertController on the same page it gives this error: Uncaught (in promise): inserted view was already destroyed</p> <p>I would like to make it run several times equal to the ionic 1 alert instance that can b...
<p>This issue is because of reuse of <em>loading object</em> in your function.</p> <p>Since you " would like to make it run several times ", the loading object is also getting reused. However this object can only be used once. Check <a href="https://ionicframework.com/docs/api/components/loading/LoadingController/" r...
AlertController Ionic 2 Uncaught (in promise): inserted view was already destroyed
ionic-framework|ionic2
9
10,762
1
44,172,199
44,172,199
30
true
2017-05-24T20:27:26.867Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: AlertController Ionic 2 Uncaught (in promise): inserted view was already destroyed<p>Instantiating the Ionic 2 AlertController on the same page it gives this...
44,123,276
How to get ID of the last inserted row in MySQL and Go?<p>How can I use this trick: <a href="https://stackoverflow.com/questions/1388025/how-to-get-id-of-the-last-updated-row-in-mysql">How to get ID of the last updated row in MySQL?</a> in Go (golang)?</p> <p>I am using the go-sql-driver. It should work with these two...
<p>Working solution. It is as simple as that. I hope someone else will find this useful:</p> <pre><code>stmt, err := db.Prepare("INSERT table SET unique_id=? ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id)") res, err := stmt.Exec(unique_id) lid, err := res.LastInsertId() </code></pre>
How to get ID of the last inserted row in MySQL and Go?
mysql|go
21
13,598
2
44,123,398
44,123,398
32
true
2017-05-22T22:52:40.377Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to get ID of the last inserted row in MySQL and Go?<p>How can I use this trick: <a href="https://stackoverflow.com/questions/1388025/how-to-get-id-of-the...
44,238,525
How to iterate over files in an S3 bucket?<p>I have a large number of files (>1,000) stored in an S3 bucket, and I would like to iterate over them (e.g. in a <code>for</code> loop) to extract data from them using <code>boto3</code>.</p> <p>However, I notice that in accordance with <a href="http://boto3.readthedocs.io/...
<p>As kurt-peek notes, <code>boto3</code> has a <a href="http://boto3.readthedocs.io/en/latest/reference/services/s3.html#paginators" rel="noreferrer"><code>Paginator</code></a> class, which allows you to iterator over pages of s3 objects, and can easily be used to provide an iterator over items within the pages:</p> ...
How to iterate over files in an S3 bucket?
python|amazon-web-services|amazon-s3|boto3
20
28,940
3
44,238,708
44,238,708
32
true
2017-05-29T09:02:21.450Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to iterate over files in an S3 bucket?<p>I have a large number of files (>1,000) stored in an S3 bucket, and I would like to iterate over them (e.g. in a...
43,945,705
Returning ERROR: column does not exist in where clause (POSTGRESQL)<p>I need to select a table, but it's keeping returning error when i tried to using "where" for some column.</p> <p>here's my code, and i attach an image file for detail.</p> <pre><code>sirima=# select * from sirima.program_studi; kode | nama ...
<p>use single quotes:</p> <pre><code>select * from sirima.program_studi where jenis_kelas = 'Reguler'; </code></pre> <p><a href="https://www.postgresql.org/docs/current/static/sql-syntax-lexical.html" rel="noreferrer">https://www.postgresql.org/docs/current/static/sql-syntax-lexical.html</a>:</p>
Returning ERROR: column does not exist in where clause (POSTGRESQL)
sql|postgresql
19
9,009
2
43,945,724
43,945,724
34
true
2017-05-12T20:07:23.650Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Returning ERROR: column does not exist in where clause (POSTGRESQL)<p>I need to select a table, but it's keeping returning error when i tried to using "where...
44,305,351
How do you send data in a Request body using HttpURLConnection?<p>I am using <code>HttpURLConnection</code> to make a POST request to a local service deployed locally and created using JAVA Spark. <strong>I want to send some data in request body when I make the POST call using the <code>HttpURLConnection</code> but eve...
<p>You should call <code>httpCon.connect();</code> only after you write your parameters in the body and not before. Your code should look like this:</p> <pre><code>URL url = new URL("http://localhost:4567/"); HttpURLConnection httpCon = (HttpURLConnection) url.openConnection(); httpCon.setDoOutput(true); httpCon.setRe...
How do you send data in a Request body using HttpURLConnection?
java|web-services|httpurlconnection|microservices|spark-java
26
64,053
2
44,305,609
44,305,609
36
true
2017-06-01T10:41:06.280Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do you send data in a Request body using HttpURLConnection?<p>I am using <code>HttpURLConnection</code> to make a POST request to a local service deploye...
44,332,290
Mapbox-gl typing won't allow accessToken assignment<p>I'm using the mapbox-gl library with TypeScript, and I've installed its community sourced type definitions with <code>@types/mapbox-gl</code>. When I try to import and set an accessToken to use the library, my TypeScript compiler throws this error: <code>TS2540: Ca...
<p>Here's a temporary workaround I've been using:</p> <pre><code>Object.getOwnPropertyDescriptor(mapboxgl, "accessToken").set('YOUR_TOKEN'); </code></pre> <h3>Explanation</h3> <p>Since the object was redefined to use a custom setter which places the token inside an internal closure - we can call the setter function ...
Mapbox-gl typing won't allow accessToken assignment
typescript|mapbox
15
7,752
3
44,393,954
44,393,954
37
true
2017-06-02T15:18:04.003Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Mapbox-gl typing won't allow accessToken assignment<p>I'm using the mapbox-gl library with TypeScript, and I've installed its community sourced type definiti...
43,945,675
Division with returning quotient and remainder<p>I try to migrate from Python to Golang. I currently do research some math operations and wonder about how can I get both quotient and remainder value with result of a division. I'm going to share below an equivalent of Python code.</p> <pre><code>hours, remainder = divm...
<p>Integer division plus modulus accomplishes this.</p> <pre><code>func divmod(numerator, denominator int64) (quotient, remainder int64) { quotient = numerator / denominator // integer division, decimals are truncated remainder = numerator % denominator return } </code></pre> <p><a href="https://play.gola...
Division with returning quotient and remainder
go
21
35,134
4
43,945,812
43,945,812
38
true
2017-05-12T20:04:34.087Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Division with returning quotient and remainder<p>I try to migrate from Python to Golang. I currently do research some math operations and wonder about how ca...
43,950,097
How to import manual changes into Terraform remote state<p>I am new to terraform - I have created remote tfstate in s3, and now there are some manual changes too that are done in my AWS infrastructure. I need to import those manual changes into tfstate. </p> <p>I used the import command for some resources, but for som...
<p>Before directly answering this question I think some context would help:</p> <p>Behind the scenes, Terraform maintains a <em>state file</em> that contains a mapping from the resources in your configuration to the objects in the underlying provider API. When you create a new object with Terraform, the id of the obje...
How to import manual changes into Terraform remote state
amazon-web-services|terraform
13
13,579
2
43,985,365
43,985,365
45
true
2017-05-13T06:46:17.510Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to import manual changes into Terraform remote state<p>I am new to terraform - I have created remote tfstate in s3, and now there are some manual changes...
44,272,402
RxJs: Incrementally push stream of data to BehaviorSubject<[]><p>Basically I'm trying to inflate <code>BehaviorSubject&lt;[]&gt;</code> with array of data which will be loaded in chunks.</p> <p><code>BehaviorSubject&lt;[]&gt;</code> will be added with new chunk of data (like <code>Array.push</code>) but I don't want t...
<p>You can use <code>getValue()</code> method to achieve what you want to do.</p> <p>Example:</p> <pre><code>data = new BehaviorSubject&lt;any[]&gt;([]); addData(foo:any):void{ // I'm using concat here to avoid using an intermediate array (push doesn't return the result array, concat does). this.data.next(this.d...
RxJs: Incrementally push stream of data to BehaviorSubject<[]>
angular|rxjs5
25
17,175
2
44,272,602
44,272,602
47
true
2017-05-30T21:39:58.953Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: RxJs: Incrementally push stream of data to BehaviorSubject<[]><p>Basically I'm trying to inflate <code>BehaviorSubject&lt;[]&gt;</code> with array of data wh...
44,023,770
Pandas: getting rid of the multiindex<p>After grouping and counting a dataframe I'm trying to remove the multiindex like this:</p> <pre><code>df = df[['CID','FE', 'FID']].groupby(by=['CID','FE']).count() .unstack().reset_index() </code></pre> <p>Printing the columns (<code>df.colums</code>) shows that it ...
<p>I think you need if is necessary convert <code>MultiIndex</code> to <code>Index</code>:</p> <pre><code>df.columns = df.columns.map(''.join) </code></pre> <p>Or if need remove level use <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.MultiIndex.droplevel.html" rel="noreferrer"><code>droplevel<...
Pandas: getting rid of the multiindex
python|pandas|dataframe
27
30,468
2
44,023,799
44,023,799
48
true
2017-05-17T11:37:27.083Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pandas: getting rid of the multiindex<p>After grouping and counting a dataframe I'm trying to remove the multiindex like this:</p> <pre><code>df = df[['CID',...
44,142,591
Converting a pandas multi-index series to a dataframe by using second index as columns<p>Hi I have a DataFrame/Series with 2-level multi-index and one column. I would like to take the second-level index and use it as a column. For example (code taken from <a href="https://pandas.pydata.org/pandas-docs/stable/advanced.h...
<p>You just need to <code>unstack</code> your series:</p> <pre><code>&gt;&gt;&gt; s.unstack(level=1) second one two first bar -0.713374 0.556993 baz 0.523611 0.328348 foo 0.338351 -0.571854 qux 0.036694 -0.161852 </code></pre>
Converting a pandas multi-index series to a dataframe by using second index as columns
python|pandas|numpy|scipy
25
18,489
3
44,142,665
44,142,665
50
true
2017-05-23T18:37:00.733Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Converting a pandas multi-index series to a dataframe by using second index as columns<p>Hi I have a DataFrame/Series with 2-level multi-index and one column...
44,203,397
python requests.get() returns improperly decoded text instead of UTF-8?<p>When the <code>content-type</code> of the server is <code>'Content-Type:text/html'</code>, <code>requests.get()</code> returns improperly encoded data.</p> <p>However, if we have the content type explicitly as <code>'Content-Type:text/html; char...
<p>From <a href="http://docs.python-requests.org/en/master/user/quickstart/#response-content" rel="noreferrer">requests documentation</a>:</p> <blockquote> <p>When you make a request, Requests makes educated guesses about the encoding of the response based on the HTTP headers. The text encoding guessed by Requests i...
python requests.get() returns improperly decoded text instead of UTF-8?
python|utf-8|python-requests
60
125,974
4
44,203,507
44,203,507
50
true
2017-05-26T13:54:17.343Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: python requests.get() returns improperly decoded text instead of UTF-8?<p>When the <code>content-type</code> of the server is <code>'Content-Type:text/html'<...
44,151,502
Getting the # of days difference between two dates in Powershell<p>I am trying to get the number of days difference in Windows powershell, I am extracting the last date of the year i.e.. <code>20171231(yyyyMMdd)</code> from a text file that I have locally stored the date in that file.</p> <p>Here is the below code that...
<p>Use <code>New-TimeSpan</code> as <a href="https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.utility/new-timespan" rel="noreferrer">it represents a time interval</a>. Like so,</p> <pre><code>$d1 = '2017-01-01' $d2 = '2017-05-01' $ts = New-TimeSpan -Start $d1 -End $d2 $ts.Days # Check res...
Getting the # of days difference between two dates in Powershell
powershell
24
69,415
6
44,151,764
44,151,764
51
true
2017-05-24T07:16:58.227Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Getting the # of days difference between two dates in Powershell<p>I am trying to get the number of days difference in Windows powershell, I am extracting th...
44,204,828
Testing react component enclosed in withRouter (preferably using jest/enzyme)<p>I have a React component which is enclosed within Higher Order Component withRouter as below:</p> <pre><code>module.exports = withRouter(ManageProfilePage); </code></pre> <p>My routes are as below:</p> <pre><code>&lt;Route path="/" compo...
<p>Normally if we try to test such components we won’t be able to render it as it is wrapped within WithRouter (WithRouter is a wrapper over a component which provides Router props like match, route and history to be directly used within the component). module.exports = withRouter(ManageProfilePage);</p> <p>To render...
Testing react component enclosed in withRouter (preferably using jest/enzyme)
reactjs|unit-testing|react-router|jestjs|enzyme
35
23,606
4
44,266,353
44,266,353
53
true
2017-05-26T15:06:45.970Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Testing react component enclosed in withRouter (preferably using jest/enzyme)<p>I have a React component which is enclosed within Higher Order Component with...
44,103,711
Collection Where LIKE Laravel 5.4<p>I know collection doesn't support where LIKE but how can I achieve this.</p> <p>My data is: <a href="https://i.stack.imgur.com/A7ldY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/A7ldY.png" alt="enter image description here" /></a></p> <pre><code>collect($product...
<p>On a collection you can use the <code>filter($callback_function)</code> method to select items in the collection. Pass in a callback function that returns <code>true</code> for every item that should be returned.</p> <p>In your case you can use the <a href="http://php.net/manual/en/function.stristr.php" rel="norefe...
Collection Where LIKE Laravel 5.4
laravel
28
30,213
3
44,103,784
44,103,784
69
true
2017-05-22T02:17:10.200Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Collection Where LIKE Laravel 5.4<p>I know collection doesn't support where LIKE but how can I achieve this.</p> <p>My data is: <a href="https://i.stack.imgu...
44,287,821
How to disable flyway in a certain spring profile?<p>Now I have a spring-boot app which uses MsSQL server. And we use flyway for migrations.</p> <p>I want to add an additional profile for tests. I want to generate tables from entity classes instead of using flyway.</p> <p>I tried smth to write like this in applicatio...
<p><strong>Doesn't for for Spring Boot 2.X !</strong> Correct answer is <a href="https://stackoverflow.com/a/47837303/979772">here</a>.</p> <p>Continue reading if you need an answer for Spring Boot 1.X.</p> <p>There is a property available for spring-boot to disable flyway if it's needed <code>flyway.enabled</code> whi...
How to disable flyway in a certain spring profile?
java|spring|spring-boot|flyway|spring-profiles
79
69,411
5
44,289,489
44,289,489
73
true
2017-05-31T14:43:52.907Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to disable flyway in a certain spring profile?<p>Now I have a spring-boot app which uses MsSQL server. And we use flyway for migrations.</p> <p>I want t...
44,080,733
How to suppress InMemoryEventId.TransactionIgnoredWarning when unit testing with in-memory database with transactions?<p>I'm using an EF Core in-memory database and I'm trying to run a unit test on a method that uses transactions:</p> <pre class="lang-cs prettyprint-override"><code>using (var transaction = await _conte...
<p>In the code where you declare the in-memory database, configure the context to ignore that error as follows:</p> <pre class="lang-cs prettyprint-override"><code>public MyDbContext GetContextWithInMemoryDb() { var options = new DbContextOptionsBuilder&lt;MyDbContext&gt;() .UseInMemoryDatabase(Guid.NewGuid...
How to suppress InMemoryEventId.TransactionIgnoredWarning when unit testing with in-memory database with transactions?
c#|asp.net-core|entity-framework-core|in-memory-database
61
11,522
2
44,080,734
44,080,734
127
true
2017-05-20T00:37:30.787Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to suppress InMemoryEventId.TransactionIgnoredWarning when unit testing with in-memory database with transactions?<p>I'm using an EF Core in-memory datab...
44,012,501
Problems with relations for group chat in Rails 5<p>I'm creating a Chat app on RoR and I want to make such thing: user can create a chat room and then can invite people to it. I have:</p> <p><code>class Conversation &lt; ApplicationRecord has_many :messages, dependent: :destroy belongs_to :creator, :class_name => ...
<p>Not sure you've fully explained what you want, however by looking at the question, you'd probably need: a <strong>User</strong>, <strong>UserConversation</strong> and a <strong>Conversation</strong> class</p> <pre><code>class UserConversation belongs_to :conversation belongs_to :user end class User has_many ...
Problems with relations for group chat in Rails 5
ruby-on-rails
-3
73
1
44,012,775
44,012,775
-1
true
2017-05-16T22:17:08.257Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Problems with relations for group chat in Rails 5<p>I'm creating a Chat app on RoR and I want to make such thing: user can create a chat room and then can in...
43,990,035
What package or event can I use so that my apk can not uninstall?<p>What package or event can I use so that my apk can not uninstall or execute an action when it wants to uninstall?</p>
<p>This is impossible. </p> <p>You can provide messaging to the user and make it slightly more difficult when uninstalling using the admin api.</p> <p>have a look here - <a href="https://stackoverflow.com/a/7540037/1856361">https://stackoverflow.com/a/7540037/1856361</a></p>
What package or event can I use so that my apk can not uninstall?
android|events|action|system|uninstallation
-3
30
1
43,990,075
43,990,075
0
true
2017-05-15T22:58:12.363Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What package or event can I use so that my apk can not uninstall?<p>What package or event can I use so that my apk can not uninstall or execute an action whe...
44,018,143
Having multiple item types in a listview<p>I'm currently working on a xamarin app with xamarin forms. I'd like to make a listview with 2 columns : the first one is a simple label but the second one can be either a label, a combo box or an entry. The type will depend on what i get from the web api.<br> Is there any solu...
<p>I think a solution can be to add in the second column (I think using a Grid) all your controls (a label, a picker....) then set the "IsVisible" Property to a X property present in your Model. If you post your Model it can be useful</p>
Having multiple item types in a listview
c#|listview|xamarin
-4
40
1
44,018,328
44,018,328
0
true
2017-05-17T07:21:00.017Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Having multiple item types in a listview<p>I'm currently working on a xamarin app with xamarin forms. I'd like to make a listview with 2 columns : the first ...
44,215,515
couple questions for a server<p>I have a theoretical question I'm hoping you can help me with.</p> <p>Alright I have a home based server 300 down/30 up Internet (the best I can get where I am at). I have a static IP and Permission from my IP to host my said server.</p> <p>Alright everything's in place right? No, well...
<p>First off, I would drop the Windows 10 OS and go with Ubuntu 16.<br> Be realistic when buying a server, as some companies advertise servers in the low hundreds, and after you really get things built out <em>correctly</em>, you are in the thousands of dollars.<br> Think of it like you are getting a 'chassis only'.</p...
couple questions for a server
php|android|mysql
-4
23
1
44,215,632
44,215,632
0
true
2017-05-27T10:05:31.583Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: couple questions for a server<p>I have a theoretical question I'm hoping you can help me with.</p> <p>Alright I have a home based server 300 down/30 up Inte...
44,275,573
My php file deleted automatically from c panel<p>Hey friends in my hosting my base_facebook.php file is deleted continuously I talked with customer care he says that hosting antivirus detected your file as a virus but same file I tried to other hosting and it is fine what I do? What is the problem in my file and how t...
<p>That first piece of code in your <code>base_facebook.php</code> is malicious. Remove it!</p> <p><a href="https://i.stack.imgur.com/woWZp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/woWZp.png" alt="enter image description here"></a></p> <p><strong>EDIT</strong></p> <p>This file is needed for...
My php file deleted automatically from c panel
php
-3
21
1
44,275,588
44,275,588
0
true
2017-05-31T04:19:41.497Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: My php file deleted automatically from c panel<p>Hey friends in my hosting my base_facebook.php file is deleted continuously I talked with customer care he s...
44,256,770
y-Shear Matrix as a combination of basic transformation?<p>I tried to know and searches very much but I didn't find for y-direction shear [1,0,0] [shy,1,0] [0,0,1]</p>
<p>You can find the answer at <a href="http://web.archive.org/web/20060914224155/http://web.archive.org:80/web/20041029003853/http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q43" rel="nofollow noreferrer">http://web.archive.org/web/20060914224155/http://web.archive.org:80/web/20041029003853/http://www.j3d.org/matrix_...
y-Shear Matrix as a combination of basic transformation?
graphics
-3
261
1
44,317,986
44,317,986
0
true
2017-05-30T08:04:17.833Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: y-Shear Matrix as a combination of basic transformation?<p>I tried to know and searches very much but I didn't find for y-direction shear [1,0,0] [shy,...
44,091,641
How can i Print (via a printer),data that is split into different pages, without having the print dialog box pop up many times?<p>I have a program in PHP that makes score sheets for students after their marks have been keyed in and then generates their score sheets. I need to print all the score sheets for each student...
<p>Generate a single web page which contains all of the score sheets, and print that!</p> <p>You can use the <code>page-break</code> family of CSS properties (e.g, <code>page-break-before: always</code>) to ensure that the score sheets are printed on separate pages.</p>
How can i Print (via a printer),data that is split into different pages, without having the print dialog box pop up many times?
javascript|php
-3
54
1
44,091,982
44,091,982
1
true
2017-05-20T23:11:51.797Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can i Print (via a printer),data that is split into different pages, without having the print dialog box pop up many times?<p>I have a program in PHP tha...
44,221,938
Postgres container crashes with `database files are incompatible with server` after container's image has been updated to the latest one<p><strong>Postgres</strong> container crash on launch with the following error message</p> <pre><code>(project) ➜ project git:(feature/62-api-custom-image-categories) ✗ docker-compo...
<p>You are on time to save it, but you need to rollback to previous version, then:</p> <pre><code>docker exec -it &lt;postgres-container-id&gt; pg_dump db_name &gt; local.dump.sql </code></pre> <p>Then, after checking that the dump is OK, empty the volume of the database, upgrade postgres and restore de dump:</p> <p...
Postgres container crashes with `database files are incompatible with server` after container's image has been updated to the latest one
postgresql|docker|docker-compose
12
12,058
5
44,222,032
44,222,032
3
true
2017-05-27T21:54:29.323Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Postgres container crashes with `database files are incompatible with server` after container's image has been updated to the latest one<p><strong>Postgres</...
44,227,602
Unable to call logged_in? method to view to change layout links<p>Self explanatory title. I have a sessions_helper.rb file which has method logged_in? to check if the user is logged in but when I try to use an if statement to change links in the view file it does not work.</p> <p>Code:</p> <p>sessions_helper</p> <pr...
<p>You have an error in your <code>logged_in?</code> method, just change the <code>:</code> to <code>!</code> (i assume you were looking to negate <code>current_user</code>):</p> <pre><code>def logged_in? !current_user.nil? end </code></pre> <p>Using <code>:</code> creates a symbol (i.e. <code>:current_user</code>)...
Unable to call logged_in? method to view to change layout links
ruby-on-rails
-3
46
1
44,227,808
44,227,808
3
true
2017-05-28T13:00:33.320Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Unable to call logged_in? method to view to change layout links<p>Self explanatory title. I have a sessions_helper.rb file which has method logged_in? to che...
44,245,855
ARIMA models : plot_diagnostics, what's meaning of residuals of our model<p>I am studying the ARIMA models with the following tutorial: <a href="https://www.digitalocean.com/community/tutorials/a-guide-to-time-series-forecasting-with-arima-in-python-3#step-5-" rel="noreferrer">https://www.digitalocean.com/community/tut...
<p>Residual indeed is the difference between true and predicted value. If there are correlations between residuals - there is information left in the residuals which should be used in computing forecasts. If the residuals have a mean other than zero, then the forecasts are biased. For instance if we have a constantly g...
ARIMA models : plot_diagnostics, what's meaning of residuals of our model
python|time-series|statsmodels
7
9,500
1
44,246,134
44,246,134
3
true
2017-05-29T15:19:27.633Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: ARIMA models : plot_diagnostics, what's meaning of residuals of our model<p>I am studying the ARIMA models with the following tutorial: <a href="https://www....
44,109,374
Pure functions when working with DOM manipulation<p>I am trying to wrap my head around pure functions, but I am not sure that I really understand it. I know that pure functions shouldn't mutate external state, and it should return the same output every time as long as it has the same input.</p> <p>I know that for exam...
<p>DOM-manipulation is impure. You cannot clear the canvas in a "pure" way.</p> <p>Anything which changes the system's state or interacts with the outside world is said to have <a href="https://softwareengineering.stackexchange.com/a/40314/224123">side effects</a>, and in a purely-functional programming environment si...
Pure functions when working with DOM manipulation
javascript|dom|canvas|functional-programming
10
1,560
3
44,109,513
44,109,513
4
true
2017-05-22T09:27:41.590Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pure functions when working with DOM manipulation<p>I am trying to wrap my head around pure functions, but I am not sure that I really understand it. I know ...
44,190,644
Broadcast 1D array against 2D array for lexsort : Permutation for sorting each column independently when considering yet another vector<p>Consider the array <code>a</code></p> <pre><code>np.random.seed([3,1415]) a = np.random.randint(10, size=(5, 4)) a array([[0, 2, 7, 3], [8, 7, 0, 6], [8, 6, 0, 2], ...
<p>Here's one approach -</p> <pre><code>def app1(a, g): m,n = a.shape g_idx = np.unique(g, return_inverse=1)[1] N = g_idx.max()+1 g_idx2D = g_idx[:,None] + N*np.arange(n) r_out = np.lexsort([a.ravel('F'), g_idx2D.ravel('F')]).reshape(-1,m).T r_out -= m*np.arange(n) return r_out </code></p...
Broadcast 1D array against 2D array for lexsort : Permutation for sorting each column independently when considering yet another vector
python|pandas|numpy|array-broadcasting
9
264
2
44,190,915
44,190,915
4
true
2017-05-25T22:16:07.840Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Broadcast 1D array against 2D array for lexsort : Permutation for sorting each column independently when considering yet another vector<p>Consider the array ...
44,027,873
How to create a new docker image from a running container on Amazon?<p>Here is my problem:</p> <p>I have a task running a Docker image on Amazon ECS but I would like to make a new Docker image from the running instance of the container.</p> <p>I see the id of the instance on Amazon ECS; I have made an AMI but I would ...
<p>Apart from the answer provided by @Ben Whaley, I personally suggest you to <strong>make use of Docker APIs.</strong> To use Docker APIs you need to <strong>configure the docker daemon port and the procedure is explained here</strong> <a href="https://stackoverflow.com/questions/43699368/unable-to-start-docker-after-...
How to create a new docker image from a running container on Amazon?
amazon-web-services|docker|amazon-ecs
22
33,841
4
44,374,377
44,374,377
4
true
2017-05-17T14:35:37.747Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to create a new docker image from a running container on Amazon?<p>Here is my problem:</p> <p>I have a task running a Docker image on Amazon ECS but I wo...
43,966,427
Matplotlib does not update plot when used in an IDE (PyCharm)<p>I am new to python and just installed pyCharm and tried to run a test example given to the following question: <a href="https://stackoverflow.com/a/4098938/2685320">How to update a plot in matplotlib? </a></p> <p>This example updates the plot to animate a...
<p>The updating in the linked question is based on the assumption that the plot is embedded in a tkinter application, which is not the case here.</p> <p>For an updating plot as a standalone window, you need to have turned interactive mode being on, i.e. <code>plt.ion()</code>. In PyCharm this should be on by default. ...
Matplotlib does not update plot when used in an IDE (PyCharm)
python|matplotlib|plot|ide|show
7
6,674
2
43,967,137
43,967,137
5
true
2017-05-14T16:40:46.807Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Matplotlib does not update plot when used in an IDE (PyCharm)<p>I am new to python and just installed pyCharm and tried to run a test example given to the fo...
43,948,248
Jenkins declarative pipeline: What workspace is associated with a stage when the agent is set only for the pipeline?<p>Here is an example of declarative pipeline where the agent is set for the pipeline but not set in the individual stages:</p> <pre><code>pipeline { agent { node { label 'linux' } } stages { ...
<p>The Pipeline code presented should only create a single workspace and run all stages in it. Unless you create a new <code>agent</code> directive in any of your <code>stages</code> it will not utilize another node or workspace.</p> <p>btw, <code>checkout scm</code> happens automatically at the beginning of the Pipel...
Jenkins declarative pipeline: What workspace is associated with a stage when the agent is set only for the pipeline?
jenkins|jenkins-pipeline|declarative
8
4,915
2
43,985,504
43,985,504
5
true
2017-05-13T01:01:07.197Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Jenkins declarative pipeline: What workspace is associated with a stage when the agent is set only for the pipeline?<p>Here is an example of declarative pipe...
44,262,586
Django tutorial. from . import views<p>I started to learn Django, I don't know python very well, so please forgive me, if the question is quite stupid). </p> <p><code>from . import views</code></p> <p>what is "." in this statement? Module's name?</p>
<p>The single dot is a convention from command line applications. It means the current directory. In terms of Django it stands for the directory/module the current file is on.</p>
Django tutorial. from . import views
python|django|python-import
8
16,674
4
44,262,623
44,262,623
6
true
2017-05-30T12:41:01.937Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Django tutorial. from . import views<p>I started to learn Django, I don't know python very well, so please forgive me, if the question is quite stupid). </p>...
44,337,137
Does Swift have short-circuiting higher-order functions like Any or All?<p>I'm aware of Swift's higher-order functions like Map, Filter, Reduce and FlatMap, but I'm not aware of any like 'All' or 'Any' which return a boolean that short-circuit on a positive test while enumerating the results.</p> <p>For instance, cons...
<p><code>Sequence</code> (and in particular <code>Collection</code> and <code>Array</code>) has a (short-circuiting) <a href="https://developer.apple.com/reference/swift/sequence/2297500-contains" rel="nofollow noreferrer"><code>contains(where:)</code></a> method taking a boolean predicate as argument. For example,</p>...
Does Swift have short-circuiting higher-order functions like Any or All?
swift|higher-order-functions|short-circuiting
8
770
3
44,337,447
44,337,447
6
true
2017-06-02T20:41:58.907Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Does Swift have short-circuiting higher-order functions like Any or All?<p>I'm aware of Swift's higher-order functions like Map, Filter, Reduce and FlatMap, ...
44,161,545
Can HotSpot inline lambda function calls?<p>Considering the code:</p> <pre><code>someList.forEach(x -&gt; System.out.format("element %s", x)); </code></pre> <p>Theoretically, it should be possible to inline this code and eliminate the indirect function calls by first inlining the <code>forEach</code> method, and then...
<p>Your lambda expression is compiled into an ordinary method, while the JRE will generate a class fulfilling the functional interface and calling that method. In current HotSpot versions, this generated class works almost like an ordinary class, the main differences are that it may invoke <code>private</code> target m...
Can HotSpot inline lambda function calls?
java|optimization|jvm|hotspot
7
1,540
2
44,163,106
44,163,106
7
true
2017-05-24T14:36:26.580Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can HotSpot inline lambda function calls?<p>Considering the code:</p> <pre><code>someList.forEach(x -&gt; System.out.format("element %s", x)); </code></pre>...
44,183,679
How to use trained data with pytesseract?<p>Using this tool <a href="http://trainyourtesseract.com/" rel="noreferrer">http://trainyourtesseract.com/</a> I would like to be able to use new fonts with pytesseract. the tool give me a file called *.traineddata</p> <p>Right now I'm using this simple script : </p> <pre><co...
<p>Below is a sample of <code>pytesseract.image_to_string()</code> with options.</p> <pre><code>pytesseract.image_to_string(Image.open("./imagesStackoverflow/xyz-small-gray.png"), lang="eng",boxes=False, config="--psm 4 --oem 3 ...
How to use trained data with pytesseract?
ocr|tesseract|python-tesseract
7
14,147
1
44,203,723
44,203,723
7
true
2017-05-25T14:59:11.127Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to use trained data with pytesseract?<p>Using this tool <a href="http://trainyourtesseract.com/" rel="noreferrer">http://trainyourtesseract.com/</a> I wo...
44,150,253
How to configure pylint for both python2 and python3 in vs code<p>I have two projects in two windows , one in python2 and other in python3.</p> <blockquote> <p>Is there anyway I can use both pylint for python2 and python3 in vscode for different projects on the fly ?</p> </blockquote> <p>I tried, but I can't use bo...
<p>Yes, there is a way. </p> <p>You can set one interpreter for each folder (project) you have open in vscode. And this will dictate the linting (asuming you have the modules installed for each interpreter). This way you can have two different projects open at the same time and each will use their set interpreter and...
How to configure pylint for both python2 and python3 in vs code
python-2.7|python-3.x|visual-studio-code|pylint
7
5,427
1
44,177,534
44,177,534
8
true
2017-05-24T06:09:17.510Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to configure pylint for both python2 and python3 in vs code<p>I have two projects in two windows , one in python2 and other in python3.</p> <blockquote>...
44,179,980
rails group by and order by column<p>In my controller I'm getting all Extras grouped by Category:</p> <pre><code>def index @categories = Extra.all.group_by(&amp;:category) end </code></pre> <p>The result is something like an Array of Hashes:</p> <pre><code>{#&lt;Category id:1, sort:2&gt; =&gt; [#&lt;Extra id:1&gt;,#&...
<p>Try this, <code>group_by</code> will return you <code>hash</code> and you are trying to call <code>[:sort]</code> on an Array of <code>[#&lt;Category id:2, sort:1&gt;, [#&lt;Extra id:3&gt;,#&lt;Extra id:4]]</code></p> <p>You should take them in two variables <code>|key, value|</code> and the key will be <code>categ...
rails group by and order by column
ruby-on-rails|ruby|activerecord
8
14,624
2
44,180,054
44,180,054
8
true
2017-05-25T11:54:43.990Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: rails group by and order by column<p>In my controller I'm getting all Extras grouped by Category:</p> <pre><code>def index @categories = Extra.all.group_by...
44,236,449
How is the categorical_crossentropy implemented in keras?<p>I'm trying to apply the concept of distillation, basically to train a new smaller network to do the same as the original one but with less computation.</p> <p>I have the softmax outputs for every sample instead of the logits.</p> <p>My question is, how is th...
<p>I see that you used the tensorflow tag, so I guess this is the backend you are using?</p> <pre><code>def categorical_crossentropy(output, target, from_logits=False): """Categorical crossentropy between an output tensor and a target tensor. # Arguments output: A tensor resulting from a softmax (unless `f...
How is the categorical_crossentropy implemented in keras?
python|tensorflow|keras|softmax|loss-function
9
17,426
2
44,249,590
44,249,590
8
true
2017-05-29T07:06:38.360Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How is the categorical_crossentropy implemented in keras?<p>I'm trying to apply the concept of distillation, basically to train a new smaller network to do t...
44,261,039
WordPress removes empty span tag<p>I use WordPress-editor and I want to display an icon within a "span"-tag like this: </p> <pre><code>&lt;div id="question1" class="box-around"&gt; &lt;div class="box-left"&gt;&lt;span class="fa fa-search" aria-hidden="true"&gt; &lt;/span&gt;&lt;/div&gt; &lt;div class="box-right"...
<p>Add this code in your active theme functions.php file.</p> <pre><code>function override_mce_options($initArray) { $opts = '*[*]'; $initArray['valid_elements'] = $opts; $initArray['extended_valid_elements'] = $opts; return $initArray; } add_filter('tiny_mce_before_init', 'override_mce_options'); </c...
WordPress removes empty span tag
wordpress|html
7
4,915
3
44,261,285
44,261,285
8
true
2017-05-30T11:28:50.397Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: WordPress removes empty span tag<p>I use WordPress-editor and I want to display an icon within a "span"-tag like this: </p> <pre><code>&lt;div id="question1...
43,962,996
How does Structured Streaming execute separate streaming queries (in parallel or sequentially)?<p>I'm writing a test application that consumes messages from Kafka's topcis and then push data into S3 and into RDBMS tables (flow is similar to presented here: <a href="https://databricks.com/blog/2017/04/26/processing-data...
<blockquote> <p>Will be those queries executed in parallel</p> </blockquote> <p>Yes. These queries are going to be executed in parallel (every <code>trigger</code> which you did not specify and hence is to run them as fast as possible).</p> <hr> <p>Internally, when you execute <code>start</code> on a <a href="http...
How does Structured Streaming execute separate streaming queries (in parallel or sequentially)?
apache-spark|spark-structured-streaming
8
2,067
1
43,967,456
43,967,456
9
true
2017-05-14T10:47:46.317Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How does Structured Streaming execute separate streaming queries (in parallel or sequentially)?<p>I'm writing a test application that consumes messages from ...
44,075,429
How to access and pass parameters to the modules of an Android Instant App<p>With normal installed apps it's possible to use the technique of <b>Deep Linking</b> in order to not only open a specific application from an URL but also to redirect it to a specific section/function such as a specific Facebook post or specif...
<h2>Instant Apps and Deep Linking</h2> <p>Instant Apps <a href="https://developer.android.com/topic/instant-apps/prepare.html#app-links" rel="noreferrer">rely on App Links</a> to work, and App Links are just one type of deep link. So deep linking is still possible for Instant Apps, and is in fact <em>absolutely critic...
How to access and pass parameters to the modules of an Android Instant App
android|deep-linking|android-instant-apps
20
27,662
3
44,078,842
44,078,842
9
true
2017-05-19T17:02:50.553Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to access and pass parameters to the modules of an Android Instant App<p>With normal installed apps it's possible to use the technique of <b>Deep Linking...
44,223,458
How to get query parameters from Django Channels?<p>I need to access the query parameter dict from Django Channels.</p> <p>The url may look like this: <code>ws://127.0.0.1:8000/?hello="world"</code></p> <p>How do I retrieve 'world' like this: <code>query_params["hello"]</code>?</p>
<p>On a websocket connect the message.content dictionary contains the query_string.</p> <pre><code>import urlparse def ws_connect(message): params = urlparse.parse_qs(message.content['query_string']) hello = params.get('hello', (None,))[0] </code></pre> <p>The getting started documentation (<a href="http://ch...
How to get query parameters from Django Channels?
python|django|websocket|django-channels
7
6,180
2
44,224,683
44,224,683
9
true
2017-05-28T03:12:39.720Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to get query parameters from Django Channels?<p>I need to access the query parameter dict from Django Channels.</p> <p>The url may look like this: <code...
44,334,060
Trouble understanding async and await<p>I've been trying to understand async/await and Task in C# but have been failing spectacularly despite watching youtube videos, reading documentation and following a pluralsight course.</p> <p>I was hoping someone might be able to help answer these slightly abstract questions to ...
<blockquote> <p>Isn't adding a suspension point forcing the method to act synchronously, i.e. finish the task marked by the await before moving on.</p> </blockquote> <p>No, the word you're thinking of is "sequential", not "synchronous". <code>await</code> results in asynchronous sequential code. "Sequential" meaning...
Trouble understanding async and await
c#|asynchronous|async-await
8
2,844
3
44,334,678
44,334,678
9
true
2017-06-02T17:02:49.730Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Trouble understanding async and await<p>I've been trying to understand async/await and Task in C# but have been failing spectacularly despite watching youtub...
44,034,773
How do I use .babelrc to get babel-plugin-import working for antd?<p>I'm new to react, babel, and antd.</p> <p>I installed react and started a project using create-react-app. I installed antd (ant.design). It suggests using babel-plugin-import, so I installed that too.</p> <p>If I interpret it right, the usage docum...
<p>[<strong>Update 2018-02-06</strong>: The answer is still correct, but there is a better alternative now, which is to use <code>react-app-rewired</code>. This is also documented in the link.]</p> <p>You need to follow the instructions in <a href="https://ant.design/docs/react/use-with-create-react-app#Import-on-deman...
How do I use .babelrc to get babel-plugin-import working for antd?
babeljs|create-react-app|antd
17
13,635
2
44,042,969
44,042,969
10
true
2017-05-17T21:06:46.700Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I use .babelrc to get babel-plugin-import working for antd?<p>I'm new to react, babel, and antd.</p> <p>I installed react and started a project using...
44,123,610
What does the make() method do in Laravel?<p>In the Laravel documentation, I found the following - <a href="https://laravel.com/docs/5.4/container#the-make-method" rel="noreferrer">https://laravel.com/docs/5.4/container#the-make-method</a></p> <p>but I am still confused as to what exactly the make() method does. I kno...
<p>The <code>make</code> method will return an instance of the class or interface you request. Where you request to make an interface, Laravel will lookup a binding for that interface to a concrete class.</p> <p>E.g. </p> <pre><code>$app-&gt;make('App\Services\MyService'); // new \App\Services\MyService. </code></pre...
What does the make() method do in Laravel?
laravel|methods
8
11,834
2
44,123,685
44,123,685
10
true
2017-05-22T23:36:49.493Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What does the make() method do in Laravel?<p>In the Laravel documentation, I found the following - <a href="https://laravel.com/docs/5.4/container#the-make-m...
44,170,443
Symbolicate crashlog of locally built iOS App<p>I've read numerous threads on stackoverflow and on apple site and I still cannot get basics to work. I make a debug build of my app, I install it on my phone, this build intentionally crashes. I run this app while not connected with Xcode debugger. The app crashes, how do...
<p>Open Project Settings. Go to your Target and set the <strong>Debug Information Format</strong> to <strong>DWARF with dSYM File</strong> for <strong>Debug</strong>. Do the same for the <strong>Project</strong></p> <p><br> <strong>Project</strong>:<br> <a href="https://i.stack.imgur.com/xABQ7.png" rel="noreferrer"><i...
Symbolicate crashlog of locally built iOS App
ios|xcode|debugging|debug-symbols
8
1,098
4
44,175,847
44,175,847
10
true
2017-05-25T00:25:48.373Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Symbolicate crashlog of locally built iOS App<p>I've read numerous threads on stackoverflow and on apple site and I still cannot get basics to work. I make a...
44,202,593
Detect a fetch request in PHP<p>How can I detect requests from the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API" rel="noreferrer">Fetch API</a> in PHP? I am currently using the approach below to detect an AJAX request:</p> <pre><code>$context['isAJAX'] = (!empty($_SERVER['HTTP_X_REQUESTED_WITH']...
<p>There’s no reliable way to distinguish a request made using the Fetch API from one made using XHR or from some AJAX library. The Fetch API doesn’t cause any unique headers to be sent.</p> <p>If you just want to detect if a request probably came from frontend code running in a browser, you can by checking for the <co...
Detect a fetch request in PHP
php|fetch-api
7
4,410
3
44,204,809
44,204,809
10
true
2017-05-26T13:14:32.187Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Detect a fetch request in PHP<p>How can I detect requests from the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API" rel="noreferrer">Fetc...
44,194,392
APN BadDeviceToken iff running dev version<h3>The problem</h3> <p>I'm not receiving Push Notifications to my app when I'm working on it,<br /> and <strong>the APN server returns &quot;<code>BadDeviceToken</code>&quot;</strong>.</p> <h3>The situation</h3> <p>I've got to be missing something simple here, this is the situ...
<p>Deleting the app and reinstalling it (ie. re-running it from Xcode) gave a new token and the new token worked without complaint.</p>
APN BadDeviceToken iff running dev version
ios|node.js|cordova|apple-push-notifications|push
13
8,993
2
44,296,734
44,296,734
10
true
2017-05-26T05:42:48.117Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: APN BadDeviceToken iff running dev version<h3>The problem</h3> <p>I'm not receiving Push Notifications to my app when I'm working on it,<br /> and <strong>th...
44,306,245
Get dimensions from Base64 encoded image<p>I have an Angular application where i need the dimensions of an Base64 encoded image. I have tried to load it into an <code>Image</code> but it just says it is <code>0x0</code></p> <pre><code>const image = new Image(); image.src = 'data:image/jpeg;base64,someBase64ImageStri...
<p>The step between setting the <code>src</code> and the image being in a "loaded" state (thus having dimensions) is asynchronous - this seems to apply to data URIs as well as external resources (at least in Chrome).</p> <p>To safely guarantee the <code>width</code> and <code>height</code> are populated, logic should ...
Get dimensions from Base64 encoded image
javascript|image|base64
9
6,912
2
44,307,162
44,307,162
10
true
2017-06-01T11:26:35.957Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Get dimensions from Base64 encoded image<p>I have an Angular application where i need the dimensions of an Base64 encoded image. I have tried to load it in...
44,129,303
Kafka Consumer outputs excessive DEBUG statements to console (ecilpse)<p>I'm running some sample code from <a href="http://www.javaworld.com/article/3060078/big-data/big-data-messaging-with-kafka-part-1.html?page=2" rel="noreferrer">http://www.javaworld.com/article/3060078/big-data/big-data-messaging-with-kafka-part-1....
<p>Just modify the logging level of the chatty class (chatty interaction). Since in your logs you see log entries originating from <code>org.apache.kafka.clients.consumer.internals.Fetcher</code> you can simply adjust the logging level for that logger by adding following line to <code>log4j.properties</code>:</p> <pr...
Kafka Consumer outputs excessive DEBUG statements to console (ecilpse)
java|logging|apache-kafka|log4j|kafka-consumer-api
14
31,299
4
44,130,933
44,130,933
11
true
2017-05-23T08:12:52.017Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Kafka Consumer outputs excessive DEBUG statements to console (ecilpse)<p>I'm running some sample code from <a href="http://www.javaworld.com/article/3060078/...
44,178,065
Difference between getExternalStorageDirectory and getExternalStoragePublicDirectory?<p>According to google one returns the primary shared/external storage directory and the other gets a top-level shared/external storage directory for placing files of a particular type. Can anyone explain in simple language and example...
<p>I am going to assume that you have used a Windows computer sometime in your life.</p> <p><code>Environment.getExternalStorageDirectory()</code>, if this were Windows, would return <code>C:\</code>.</p> <p><code>Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES)</code>, if this were Windows...
Difference between getExternalStorageDirectory and getExternalStoragePublicDirectory?
java|android|android-studio|permissions|storage
7
2,057
1
44,178,178
44,178,178
11
true
2017-05-25T10:21:18.720Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Difference between getExternalStorageDirectory and getExternalStoragePublicDirectory?<p>According to google one returns the primary shared/external storage d...
44,198,184
How to create stacked bar chart using react-chartjs-2?<p>I have to create stacked bar chart using react-chartjs-2.</p> <pre><code>options : { maintainAspectRatio: false, tooltips: { mode: 'x-axis' }, scales: { yAxes: [{ ticks: { beginAtZero: true } }], x...
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code> const options = { scales: { xAxes: [{ stacked: true }], yAxes: [{ ...
How to create stacked bar chart using react-chartjs-2?
chart.js|react-chartjs
9
13,829
2
44,368,772
44,368,772
11
true
2017-05-26T09:32:14.130Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to create stacked bar chart using react-chartjs-2?<p>I have to create stacked bar chart using react-chartjs-2.</p> <pre><code>options : { maintainAsp...
44,095,985
Why only outdated version of NPM is available on Debian/Ubuntu?<p>I'm using a Debian/Ubuntu based distribution (specifically, AWS Ubuntu 16.04) and trying to install NPM through <code>apt-get</code>. </p> <p>My Angular 2 application needs a higher version than 3.9.x of NPM, but the default version which is getting ins...
<p>You're getting version 3.5.2 of npm, because that's the version in the <a href="http://packages.ubuntu.com/xenial/web/npm" rel="noreferrer">repositories</a>. Debian and Ubuntu are typically <em>terrible</em> at keeping up with Node and npm's fast rate of development, so you'll often find the packages are out of date...
Why only outdated version of NPM is available on Debian/Ubuntu?
node.js|npm|ubuntu-16.04
15
13,621
7
44,096,057
44,096,057
12
true
2017-05-21T10:53:49.947Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why only outdated version of NPM is available on Debian/Ubuntu?<p>I'm using a Debian/Ubuntu based distribution (specifically, AWS Ubuntu 16.04) and trying to...
44,208,501
Getting topic-word distribution from LDA in scikit learn<p>I was wondering if there is a method in the LDA implementation of scikit learn that returns the topic-word distribution. Like the genism show_topics() method. I checked the documentation but didn't find anything.</p>
<p>Take a look at <a href="https://github.com/scikit-learn/scikit-learn/blob/14031f6/sklearn/decomposition/online_lda.py#L227" rel="noreferrer"><code>sklearn.decomposition.LatentDirichletAllocation.components_</code></a>:</p> <blockquote> <p>components_ : array, [n_topics, n_features]</p> <p>Topic word distribu...
Getting topic-word distribution from LDA in scikit learn
python|scikit-learn|lda
14
7,172
1
44,208,825
44,208,825
12
true
2017-05-26T18:58:46.170Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Getting topic-word distribution from LDA in scikit learn<p>I was wondering if there is a method in the LDA implementation of scikit learn that returns the to...
44,237,445
Collection to associative array with specific keys [L5.2]<p>I have the next collection: </p> <pre><code>Collection {#356 ▼ #items: array:31 [▼ 0 =&gt; {#359 ▼ +"id": 17 +"zone_id": 2 +"name_de": "Österreich" +"name_en": "Austria" +"name_iso": "AUSTRIA" +"tld": "at" +"iso...
<p>You want to use function <a href="https://laravel.com/docs/5.4/collections#method-pluck" rel="noreferrer"><code>-&gt;pluck('name_en', 'iso3166')</code></a>.</p>
Collection to associative array with specific keys [L5.2]
laravel|collections|laravel-5.2
7
8,001
1
44,237,468
44,237,468
12
true
2017-05-29T08:04:37.613Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Collection to associative array with specific keys [L5.2]<p>I have the next collection: </p> <pre><code>Collection {#356 ▼ #items: array:31 [▼ 0 =&gt;...
44,344,706
How do I use a monoid instance of a function?<p>Today I tried to reduce a list of functions trough monoid typeclass but the resulting function expects its argument to be an instance of Monoid for some reason.</p> <p>GHCI tells me that the type of <code>mconcat [id, id, id, id]</code> is <code>Monoid a =&gt; a -&gt; a<...
<p>You're using this instance:</p> <pre><code>instance Monoid b =&gt; Monoid (a -&gt; b) where mempty _ = mempty mappend f g x = f x `mappend` g x </code></pre> <p>which is more general because it doesn't require endomorphisms (i.e. <code>a -&gt; a</code>). To get the instance you were expecting, you can wrap...
How do I use a monoid instance of a function?
haskell|monoids
7
1,066
1
44,344,821
44,344,821
12
true
2017-06-03T13:59:50.297Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I use a monoid instance of a function?<p>Today I tried to reduce a list of functions trough monoid typeclass but the resulting function expects its ar...
44,365,009
AssertCalled always fails with testify library<p>I am using testify to test my code and I want to check if a function was called.</p> <p>I am doing the following:</p> <pre><code>type Foo struct { mock.Mock } func (m Foo) Bar() { } func TestFoo(t *testing.T) { m := Foo{} m.Bar() m.AssertCalled(t, "B...
<p>I tried with this and works:</p> <pre><code>type Foo struct { mock.Mock ...
AssertCalled always fails with testify library
go|testify
8
8,780
4
44,484,256
44,484,256
12
true
2017-06-05T08:42:56.750Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: AssertCalled always fails with testify library<p>I am using testify to test my code and I want to check if a function was called.</p> <p>I am doing the foll...
43,992,661
Spark-shell meaning of displayed Number on Stage<pre><code>[Stage 5:=====&gt; (26372 + 264) / 27840] [stage 6:=========&gt; (0 + 200 ) / 200 ] </code></pre> <p>Hi, I'm using spark 1.6.1. </p> <p>I use spark-shell to see the data and i want to know the meaning of each number here. </p> <pre><code>( A + B / C ) <...
<p>The meaning of <code>[Stage 5:=====&gt; (26372 + 264) / 27840]</code> is </p> <pre><code>(numCompletedTasks + numActiveTasks) / totalNumOfTasksInThisStage) </code></pre> <ul> <li>Number of Completed Tasks = 26372</li> <li>Number of Active Tasks = 264</li> <li>Total number of tasks in this stages = 27840</li> </ul>
Spark-shell meaning of displayed Number on Stage
apache-spark
11
803
1
43,992,999
43,992,999
13
true
2017-05-16T04:42:19.390Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Spark-shell meaning of displayed Number on Stage<pre><code>[Stage 5:=====&gt; (26372 + 264) / 27840] [stage 6:=========&gt; (0 + 200 ) / 200 ] </code></p...
44,088,706
"Cannot convert a ndarray into a Tensor or Operation." error when trying to fetch a value from session.run in tensorflow<p>I have created a siamese network in tensorflow. I am calculating the distance between two tensors using the below code:</p> <pre><code>distance = tf.sqrt(tf.reduce_sum(tf.square(tf.subtract(questi...
<p>It looks like you overwrite the Tensor <code>distance = tf.sqrt(...)</code> with a numpy array <code>distance = sess.run(distance)</code>.</p> <p>Your loop is the culprit. Change <code>t_state, distance = sess.run([question1_final_state, distance]</code> to something like <code>t_state, distance_other = sess.run([q...
"Cannot convert a ndarray into a Tensor or Operation." error when trying to fetch a value from session.run in tensorflow
python|numpy|tensorflow
8
12,354
1
44,090,332
44,090,332
13
true
2017-05-20T17:09:12.360Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: "Cannot convert a ndarray into a Tensor or Operation." error when trying to fetch a value from session.run in tensorflow<p>I have created a siamese network i...
44,292,270
Angular 4 get headers from API response<p>I'm sending a request to an API, it returns an array of data, but I don't know how to extract the headers from that url, this is what i've tried in my service</p> <pre><code>@Injectable() export class ResourcesService { private resourcesurl = "http://localhost:9111/v1/resource...
<p>The headers are part of the <a href="https://angular.io/docs/ts/latest/api/http/index/Response-class.html" rel="noreferrer">Response class</a>, so you should be able to see them in a handler like </p> <pre><code>http.get('/path/to/resource') .subscribe((res:Response) =&gt; { console.log(res.headers); // y...
Angular 4 get headers from API response
javascript|angular|typescript
16
55,864
5
44,292,610
44,292,610
13
true
2017-05-31T18:31:09.583Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Angular 4 get headers from API response<p>I'm sending a request to an API, it returns an array of data, but I don't know how to extract the headers from that...
44,331,037
How can I distinguish between a deserialized field that is missing and one that is null?<p>I'd like to use <a href="https://serde.rs/" rel="noreferrer">Serde</a> to parse some JSON as part of a HTTP PATCH request. Since PATCH requests don't pass the entire object, only the relevant data to update, I need the ability to...
<p>Quite likely, the only way to achieve that right now is with a custom deserialization function. Fortunately, it is not hard to implement, even to make it work for any kind of field:</p> <pre><code>fn deserialize_optional_field&lt;'de, T, D&gt;(deserializer: D) -&gt; Result&lt;Option&lt;Option&lt;T&gt;&gt;, D::Error...
How can I distinguish between a deserialized field that is missing and one that is null?
rust|serde
20
4,674
3
44,331,646
44,331,646
13
true
2017-06-02T14:12:29.890Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I distinguish between a deserialized field that is missing and one that is null?<p>I'd like to use <a href="https://serde.rs/" rel="noreferrer">Serde...
44,210,454
Why does TensorFlow's documentation call a softmax's input "logits"?<p><a href="https://www.tensorflow.org/api_docs/python/tf/nn/softmax_cross_entropy_with_logits" rel="noreferrer">TensorFlow calls</a> each of the inputs to a softmax a logit. They go on to define the softmax's inputs/logits as: "Unscaled log probabilit...
<p>Logit is nowadays used in ML community for any non-normalised probability distribution (basically anything that gets mapped to a probability distribution by a parameter-less transformation, like sigmoid function for a binary variable or softmax for multinomial one). It is not a strict mathematical term, but gained e...
Why does TensorFlow's documentation call a softmax's input "logits"?
machine-learning|tensorflow|documentation|logistic-regression|softmax
12
2,342
1
44,210,534
44,210,534
14
true
2017-05-26T21:37:37.770Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why does TensorFlow's documentation call a softmax's input "logits"?<p><a href="https://www.tensorflow.org/api_docs/python/tf/nn/softmax_cross_entropy_with_l...
44,366,563
How to set axis to start from corner in Matplotlib<p>this is a graph that I plotted:</p> <pre><code># MatPlotlib import matplotlib.pyplot as plt # Scientific libraries import numpy as np plt.figure(1) points = np.array([(100, 6.09), (111, 8.42), (119, 10.6), (...
<p>By default, matplotlib adds a 5% margin on all sides of the axes. To get rid of that margin, you can use <a href="http://matplotlib.org/devdocs/api/_as_gen/matplotlib.axes.Axes.margins.html" rel="noreferrer"><code>plt.margins(0)</code></a>.</p> <pre><code>import matplotlib.pyplot as plt plt.plot([1,2,3],[1,2,3], ...
How to set axis to start from corner in Matplotlib
matplotlib
7
11,589
1
44,366,835
44,366,835
14
true
2017-06-05T10:10:07.307Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to set axis to start from corner in Matplotlib<p>this is a graph that I plotted:</p> <pre><code># MatPlotlib import matplotlib.pyplot as plt # Scientifi...
44,192,957
How do I pass an object containing props to React component?<p>A component with props <code>a</code> and <code>b</code> can be rendered using:</p> <pre><code>&lt;Component a={4} b={6} /&gt; </code></pre> <p>Can one pass an object instead that contains the props as keys, something like this?</p> <pre><code>let compon...
<p>Sure. Make sure to use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator" rel="noreferrer">spread syntax</a>. Per <a href="https://facebook.github.io/react/docs/jsx-in-depth.html#spread-attributes" rel="noreferrer">the React documentation</a>:</p> <blockquote> <h...
How do I pass an object containing props to React component?
reactjs
10
8,245
1
44,192,970
44,192,970
15
true
2017-05-26T03:07:13.130Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I pass an object containing props to React component?<p>A component with props <code>a</code> and <code>b</code> can be rendered using:</p> <pre><cod...
44,114,131
TFS: Exception calling "SetRight" with "2" argument(s): "Could not obtain the user information."<p>I have a release definition in TFS with 2 tasks. One of them passes perfectly, while the other throws an exception, though both have very smimlar configuration.</p> <p>The successful task configuration:</p> <pre><code>C...
<p>Please include the <strong>domain</strong> in the username variable. If it’s not domain environment, it should be the machine name.</p> <p>So, just try to update the UPN user name format to <strong>DOMAIN\Username</strong> or <strong>MACHINENAME\Username</strong> format.</p>
TFS: Exception calling "SetRight" with "2" argument(s): "Could not obtain the user information."
powershell|tfs
7
3,138
2
44,130,188
44,130,188
16
true
2017-05-22T13:26:22.827Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: TFS: Exception calling "SetRight" with "2" argument(s): "Could not obtain the user information."<p>I have a release definition in TFS with 2 tasks. One of th...
44,238,154
What is the difference between Luong attention and Bahdanau attention?<p>These two attentions are used in <strong>seq2seq</strong> modules. The two different attentions are introduced as multiplicative and additive attentions in <a href="https://www.tensorflow.org/versions/master/api_guides/python/contrib.seq2seq" rel=...
<p>They are very well explained in <a href="https://github.com/spro/practical-pytorch/blob/master/seq2seq-translation/seq2seq-translation.ipynb" rel="noreferrer">a PyTorch seq2seq tutorial</a>.</p> <p>The main difference is how to score similarities between the current decoder input and encoder outputs.</p>
What is the difference between Luong attention and Bahdanau attention?
tensorflow|deep-learning|nlp|attention-model
35
32,323
5
44,239,754
44,239,754
16
true
2017-05-29T08:43:37.273Z
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 Luong attention and Bahdanau attention?<p>These two attentions are used in <strong>seq2seq</strong> modules. The two different...
44,161,526
WiX: "Copying new files File: [1], Directory: [9], Size [6]" shown during installation of an MSI<p>Recently, I noticed the strange text mesages during installation of our MSI created in WiX 3.11 + VS 2017. I'm seeing "<strong>Copying new files File: [1], Directory: [9], Size [6]</strong>" text:</p> <p><a href="https:/...
<p>I found the solution. All I needed was to add the following line inside the &lt;Product&gt; tag in my main wxs:</p> <pre><code>&lt;UIRef Id="WixUI_ErrorProgressText" /&gt; </code></pre> <p><strong>Explanation</strong></p> <p>Without the above mentioned line, my MSI package was using the stock messages inside Wind...
WiX: "Copying new files File: [1], Directory: [9], Size [6]" shown during installation of an MSI
wix|windows-installer
10
1,605
1
44,182,276
44,182,276
18
true
2017-05-24T14:35:38.940Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: WiX: "Copying new files File: [1], Directory: [9], Size [6]" shown during installation of an MSI<p>Recently, I noticed the strange text mesages during instal...
44,211,804
Javascript Conditional Inside TypeScript Interface<p>Is it possible to have a condition inside of an interface declaration in TypeScript. What I'm looking for is a way to say, based on the value of the first key, the second key can be these values.</p> <p>Example (non functioning):</p> <pre><code>interface getSublist...
<p>No there's not. The best thing to do is to create separate interfaces that describe the two different types of data.</p> <p>For example:</p> <pre><code>interface SublistItem { sublistId: 'item'; fieldId: 'itemname' | 'quantity'; } interface SublistPartners { sublistId: 'partners'; fieldId: 'partne...
Javascript Conditional Inside TypeScript Interface
javascript|typescript
20
16,385
4
44,211,962
44,211,962
18
true
2017-05-27T00:41:14.793Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Javascript Conditional Inside TypeScript Interface<p>Is it possible to have a condition inside of an interface declaration in TypeScript. What I'm looking fo...
44,088,235
How to use jQuery dependant plugins in create-react-app<p>I want to use bootstrap and other jQuery plugins (datepicker, carousel, ...) in my React app which uses <code>create-react-app</code>.</p> <p>Here is how I import jQuery and bootstrap:</p> <pre><code>import React, { Component } from 'react'; import 'bootstrap/...
<p>In this case for using <code>bootstrap</code> or <code>bootstrap-datepicker</code> I needed to <code>require</code> it instead of importing it.</p> <pre><code>import React, { Component } from 'react'; import 'bootstrap/dist/css/bootstrap.min.css'; import $ from 'jquery'; window.jQuery = window.$ = $; require('boots...
How to use jQuery dependant plugins in create-react-app
jquery|import|npm|webpack|create-react-app
12
8,987
2
44,088,566
44,088,566
19
true
2017-05-20T16:22:14.230Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to use jQuery dependant plugins in create-react-app<p>I want to use bootstrap and other jQuery plugins (datepicker, carousel, ...) in my React app which ...
44,297,839
How to transform Future<List<Map> to List<Map> in Dart language?<p>I have a question in coding with dart language. How to transform a Future to the normal List? In my program, I need the result from web to continue next step and I don't know how to do it. In my case, I need to return the value of variable "data" as a L...
<p>You should rewrite your <code>getList</code> method to return a <a href="https://www.dartlang.org/tutorials/language/futures" rel="noreferrer"><code>Future&lt;List&gt;</code></a>. It's possible to do this with a chain of <a href="https://api.dartlang.org/stable/1.23.0/dart-async/Future/then.html" rel="noreferrer"><c...
How to transform Future<List<Map> to List<Map> in Dart language?
dart|flutter
12
25,904
2
44,298,296
44,298,296
19
true
2017-06-01T03:06:59.557Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to transform Future<List<Map> to List<Map> in Dart language?<p>I have a question in coding with dart language. How to transform a Future to the normal Li...
44,333,573
Feature importances - Bagging, scikit-learn<p>For a project I am comparing a number of decision trees, using the regression algorithms (Random Forest, Extra Trees, Adaboost and Bagging) of scikit-learn. To compare and interpret them I use the feature importance , though for the bagging decision tree this does not look ...
<p>Are you talking about BaggingClassifier? It can be used with many base estimators, so there is no feature importances implemented. There are model-independent methods for computing feature importances (see e.g. <a href="https://github.com/scikit-learn/scikit-learn/issues/8898" rel="noreferrer">https://github.com/sci...
Feature importances - Bagging, scikit-learn
machine-learning|scikit-learn|decision-tree|feature-selection
14
10,261
3
44,334,701
44,334,701
19
true
2017-06-02T16:29:40.183Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Feature importances - Bagging, scikit-learn<p>For a project I am comparing a number of decision trees, using the regression algorithms (Random Forest, Extra ...
44,098,013
NodeJS script with async/await causing syntax error (v7.10.0)<p>I am trying to use async/await in NodeJS but my script is throwing a syntax error.</p> <p>I was under the impression that async/await is <a href="https://www.infoq.com/news/2017/02/node-76-async-await" rel="noreferrer">supported naively since Node 7.6</a>...
<p><code>await</code> is only valid inside <code>async</code> functions, so you need, for example, an async <a href="https://en.wikipedia.org/wiki/Immediately-invoked_function_expression" rel="noreferrer">IIFE</a> to wrap your code with:</p> <pre><code>void async function() { let value = await getValueAsync(); con...
NodeJS script with async/await causing syntax error (v7.10.0)
node.js|async-await|syntax-error
19
16,410
1
44,098,204
44,098,204
20
true
2017-05-21T14:25:43.117Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: NodeJS script with async/await causing syntax error (v7.10.0)<p>I am trying to use async/await in NodeJS but my script is throwing a syntax error.</p> <p>I ...
44,224,676
Flutter - Typing Text animation<p>For each of my text widgets, I actually want the text to type in instead of displaying it right away. Is there a simpler approach than using a variable and adding to it inside of setState() ?</p> <p>Thanks</p>
<p>This might be a good use case for an <code>AnimatedBuilder</code>. That will allow you to more easily control the duration of the typing animation and only rebuild your widget when the length changes. Here's an example of how to do that.</p> <p><a href="https://i.stack.imgur.com/LbHi4.gif" rel="noreferrer"><img src...
Flutter - Typing Text animation
dart|flutter
7
8,763
3
44,228,115
44,228,115
20
true
2017-05-28T07:03:52.133Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Flutter - Typing Text animation<p>For each of my text widgets, I actually want the text to type in instead of displaying it right away. Is there a simpler ap...
44,119,841
what is major difference between dotnet publish and dotnet pack<p>What is the major difference between dotnet <code>pack</code> and <code>publish</code>?</p> <p>From <a href="https://docs.microsoft.com/en-us/dotnet/articles/core/tools/dotnet" rel="noreferrer">Microsoft's description</a>, my understanding is that <code...
<p><code>dotnet pack</code> - <em>Produces a NuGet package of your code.</em> </p> <p>That is the key difference - this will enable to publish to <a href="http://nuget.org" rel="noreferrer">http://nuget.org</a>, or to a nuget server that can be pulled down by other developers, or even for use with Octopus Deploy.</p> ...
what is major difference between dotnet publish and dotnet pack
.net|nuget|.net-core|nuget-package|dotnet-cli
24
9,757
3
44,120,118
44,120,118
21
true
2017-05-22T18:33:32.543Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: what is major difference between dotnet publish and dotnet pack<p>What is the major difference between dotnet <code>pack</code> and <code>publish</code>?</p>...
44,141,276
Does jest automatically restore mocked modules between test modules?<p>Does jest automatically restore mocked modules between test files? For example, if I call <code>jest.mock('some_module')</code> in one file, do I need to ensure I call <code>jest.unmock('some_module')</code> after all the tests are run in that file...
<p>You don't have to reset the mocks, as the test are run in parallel, every test file run in its own sandboxed thread. Even mocking JavaScript globals like <code>Date</code> or <code>Math.random</code> only affects the actual test file.</p> <p>The only problem we had so far was mocking <code>process.env.NODE_ENV</cod...
Does jest automatically restore mocked modules between test modules?
unit-testing|reactjs|jestjs
9
2,378
1
44,145,329
44,145,329
21
true
2017-05-23T17:22:12.353Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Does jest automatically restore mocked modules between test modules?<p>Does jest automatically restore mocked modules between test files? For example, if I ...
44,337,154
How to ungit a directory?<p>I have accidentally put my home folder under git version control. How can I undo this? I am running Ubuntu 16.04.</p> <p>Interestingly, running</p> <pre><code>$ git status </code></pre> <p>Informs me that the Mozilla Firefox cache has been altered.</p> <p><a href="https://i.stack.imgur.c...
<p>Try removing the <code>.git</code> directory and <code>.gitignore</code> if exist: <code>rm -Rf .git .gitignore</code></p>
How to ungit a directory?
git
8
14,340
3
44,337,218
44,337,218
21
true
2017-06-02T20:42:54.917Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to ungit a directory?<p>I have accidentally put my home folder under git version control. How can I undo this? I am running Ubuntu 16.04.</p> <p>Interes...
44,140,241
GeoDjango on Windows: Try setting GDAL_LIBRARY_PATH in your settings<p>I've done this a dozen times before, but something isn't working this time..</p> <p>Following the docs:</p> <p><a href="https://docs.djangoproject.com/en/1.11/ref/contrib/gis/install/#windows" rel="noreferrer">https://docs.djangoproject.com/en/1.1...
<p>The issue ended up being a <a href="https://code.djangoproject.com/ticket/28237" rel="noreferrer">version mismatch between Django and GDAL</a>. Django was not searching for the correct file name (<code>gdal202.dll</code> in my case). </p> <p>Fixing it required me to add <code>str('gdal202')</code> to the following...
GeoDjango on Windows: Try setting GDAL_LIBRARY_PATH in your settings
python|django|windows|gdal|geodjango
15
27,951
10
44,204,170
44,204,170
22
true
2017-05-23T16:23:06.550Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: GeoDjango on Windows: Try setting GDAL_LIBRARY_PATH in your settings<p>I've done this a dozen times before, but something isn't working this time..</p> <p>F...
43,935,520
who is the owner of the contracts deployed using truffle?<p>I am using testrpc and truffle to test my contract.</p> <p>When I type <code>truffle migrate</code> , this will deploy my contract to the testrpc network.</p> <p>My question is , which account (from testrpc accounts) has been used to deploy the contract.</p>...
<p>By default the owner is <code>accounts[0]</code> so the first account on the list but you can set the owner by adding "from" in the truffle.js config file</p> <pre><code>module.exports = { networks: { development: { host: "localhost", port: 8545, network_id: "*", from: "0xda9b1a939350...
who is the owner of the contracts deployed using truffle?
solidity|smartcontracts|truffle
13
5,888
1
43,980,953
43,980,953
23
true
2017-05-12T10:29:09.223Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: who is the owner of the contracts deployed using truffle?<p>I am using testrpc and truffle to test my contract.</p> <p>When I type <code>truffle migrate</co...
44,044,031
Grade Plugin 3-alpha1 outputFile causes error<p>I'm trying to update a project to Android Studio 3.</p> <p>The following snippet is no longer accepted in a build.gradle file.</p> <pre><code>applicationVariants.all { variant -&gt; variant.outputs.each { out -&gt; def oFile =out.outputFile // This line c...
<p><em>Update</em>: Fix for <strong>APK renaming</strong>:</p> <p>Use <strong>all</strong> iterators instead of <strong>each</strong>:</p> <pre><code>android.applicationVariants.all { variant -&gt; variant.outputs.all { outputFileName = "${variant.name}-${variant.versionName}.apk" } } </code></pre> <...
Grade Plugin 3-alpha1 outputFile causes error
android|android-studio|android-gradle-plugin
10
2,371
2
44,045,086
44,045,086
23
true
2017-05-18T09:36:11.260Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Grade Plugin 3-alpha1 outputFile causes error<p>I'm trying to update a project to Android Studio 3.</p> <p>The following snippet is no longer accepted in a ...
44,368,643
Verifying firebase custom token to get token ID fails when using jsonwebtoken<p>On the backend a custom token is generated via firebase's admin SDK thusly:</p> <pre><code>router.use('/get-token', (req, res) =&gt; { var uid = "big-secret"; admin.auth().createCustomToken(uid) .then(function(customToken) { ...
<p>It looks like you're calling <code>verifyIdToken</code> with a custom token. That's not going to work. <code>verifyIdToken</code> only accepts "ID tokens". To obtain an ID token from a custom token first call <a href="https://firebase.google.com/docs/auth/web/custom-auth#authenticate-with-firebase" rel="noreferrer">...
Verifying firebase custom token to get token ID fails when using jsonwebtoken
node.js|firebase|jwt|firebase-admin
18
12,842
2
44,374,363
44,374,363
23
true
2017-06-05T12:10:01.833Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Verifying firebase custom token to get token ID fails when using jsonwebtoken<p>On the backend a custom token is generated via firebase's admin SDK thusly:</...
44,098,854
Understanding MetaData() from SQLAlchemy in Python<p>I am trying to understand what the MetaData() created object is in essence. It is used when reflecting and creating databases in Python (using SQLAlchemy package). </p> <p>Consider the following working code:</p> <p>/ with preloaded Engine(sqlite:///chapter5.sqlite...
<p>I think you asked how does python (SQLAlchemy you presumably mean) connect the table to the metadata and the metadata to the database and engine.</p> <p>So database tables in SQLAlchemy belong (are linked to) a metadata object. The table adds itself to the metadata; there is a tables property on the metadata object...
Understanding MetaData() from SQLAlchemy in Python
python|sqlalchemy|metadata
25
15,873
1
44,098,950
44,098,950
24
true
2017-05-21T15:53:04.563Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Understanding MetaData() from SQLAlchemy in Python<p>I am trying to understand what the MetaData() created object is in essence. It is used when reflecting a...
44,246,110
Android Error While using ExifInterface<p>I am trying to check the orientation of bitmap and flip it if there is a need, but I have error while applying the code. Here is my code while i am trying to flipp the image using ExifInterface:</p> <pre><code>@RequiresApi(api = Build.VERSION_CODES.N) public void flipping(...
<p>You are attempting to use <code>android.media.ExifInterface</code>. On Android 7.0+ (API Level 24), that class is safe to use and has a constructor that takes an <code>InputStream</code>. Apparently, you are running your app on an older device. That results in two problems:</p> <ol> <li><p>The older device will not ...
Android Error While using ExifInterface
android
24
17,945
4
44,246,248
44,246,248
26
true
2017-05-29T15:34:53.823Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Android Error While using ExifInterface<p>I am trying to check the orientation of bitmap and flip it if there is a need, but I have error while applying the ...
44,302,258
Custom component FormControl breaking if reinitializing FormGroup from parent<p>I got a problem when reinitializing formGroup from parent component that is used in my custom component. Error that i get is:</p> <blockquote> <p>There is no FormControl instance attached to form control element with name: 'selectedCompany...
<p>I figured out that it is not good to reinitialize <code>formGroup</code> over and over again, because component looses reference to old <code>formGroup</code>.</p> <p>If setting values is what is needed to show fresh form, <code>.setValue</code> is the solution here:</p> <p><strong>Component</strong></p> <p>Instead ...
Custom component FormControl breaking if reinitializing FormGroup from parent
angular|angular-components
24
11,783
3
44,302,259
44,302,259
26
true
2017-06-01T08:24:54.707Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Custom component FormControl breaking if reinitializing FormGroup from parent<p>I got a problem when reinitializing formGroup from parent component that is ...
44,330,537
Need BrowserAnimationsModule in Angular but gives error in Universal<p>Hi I am using Angular that uses the BrowserAnimationsModule. But in the universal server side it gives the error "document is not defined".</p> <p>Because Universal doesn't support BrowserAnimationsModule I need a way to make the server ignore Brow...
<p>Edit: this solution doesn’t appear to work as of version 6.1. I’ll leave the below solution in case it works again someday and update if I find another solution.</p> <p>Original answer:</p> <p>I was having this exact same problem. Full credit goes to <a href="https://github.com/pquarme/cli-universal-demo" rel="nor...
Need BrowserAnimationsModule in Angular but gives error in Universal
angular|angular-universal
9
12,842
1
44,402,938
44,402,938
26
true
2017-06-02T13:48:42.370Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Need BrowserAnimationsModule in Angular but gives error in Universal<p>Hi I am using Angular that uses the BrowserAnimationsModule. But in the universal serv...
44,146,087
Pass user built json encoder into Flask's jsonify<p>I want to pass a numpy JSON serializer I wrote into Flask's <code>jsonify</code> function, but I cannot find a way to do this. I cannot use <code>json.dumps</code>, because I have to set the status_code of the Flask response when handling an error message. Is there a ...
<p>You can custom the json encoder of Flask app with <code>app.json_encoder = JSON_Improved</code>. <code>JSON_Improved</code> inherit from <code>flask.json.JSONEncoder</code></p> <pre><code>class JSON_Improved(JSONEncoder): pass </code></pre> <p>There is a Flask Snippets about it in <a href="https://web.archive...
Pass user built json encoder into Flask's jsonify
python|json|numpy|flask
20
12,851
1
44,158,611
44,158,611
28
true
2017-05-23T22:31:15.360Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pass user built json encoder into Flask's jsonify<p>I want to pass a numpy JSON serializer I wrote into Flask's <code>jsonify</code> function, but I cannot f...