id
int64
4
73.8M
title
stringlengths
10
150
body
stringlengths
17
50.8k
accepted_answer_id
int64
7
73.8M
answer_count
int64
1
182
comment_count
int64
0
89
community_owned_date
stringlengths
23
27
creation_date
stringlengths
23
27
favorite_count
int64
0
11.6k
last_activity_date
stringlengths
23
27
last_edit_date
stringlengths
23
27
last_editor_display_name
stringlengths
2
29
last_editor_user_id
int64
-1
20M
owner_display_name
stringlengths
1
29
owner_user_id
int64
1
20M
parent_id
null
post_type_id
int64
1
1
score
int64
-146
26.6k
tags
stringlengths
1
125
view_count
int64
122
11.6M
answer_body
stringlengths
19
51k
24,766,665
No implementation was bound - Java Guice
<p>Novice here trying to use a dummy Java Facebook app that uses Guice to inject a database dependency into the Facebook factory but continue to have Guice error out telling me:</p> <blockquote> <p>### No implementation for com.example.storage.Db annotated with @com.example.storage.annotations.SystemDb() was bound whil...
24,767,043
2
0
null
2014-07-15 19:33:01.9 UTC
4
2017-11-26 04:17:12.857 UTC
2020-06-20 09:12:55.06 UTC
null
-1
null
3,011,436
null
1
22
java|dependency-injection|annotations|guice
78,116
<p>At first glance it seems like your missing the bindings for the Db annotated dependency and the StatsdClient.</p> <p>You'll need to provide the missing bindings to your module like so</p> <pre><code>bind(Db.class).annotatedWith(SystemDb.class).to(DbImplOfSomeSort.class); bind(StatsdClient.class).to(StatsdClientImp...
37,734,150
How to update meta tags in React.js?
<p>I was working on a single page application in react.js, so what is the best way to update meta tags on page transitions or browser back/forward?</p>
37,734,302
11
0
null
2016-06-09 18:59:48.173 UTC
18
2022-09-16 05:51:58.873 UTC
null
null
null
null
2,485,624
null
1
74
reactjs
148,347
<p>I've used <a href="https://www.npmjs.com/package/react-document-meta" rel="noreferrer">react-document-meta</a> in an older project.</p> <p>Just define your meta values</p> <pre><code>const meta = { title: 'Some Meta Title', description: 'I am a description, and I can create multiple tags', canonical: '...
35,405,618
ngFor with index as value in attribute
<p>I have a simple <code>ngFor</code> loop which also keeps track of the current <code>index</code>. I want to store that <code>index</code> value in an attribute so I can print it. But I can't figure out how this works.</p> <p>I basically have this:</p> <pre><code>&lt;ul *ngFor="#item of items; #i = index" data-inde...
35,405,648
9
0
null
2016-02-15 09:27:57.367 UTC
81
2022-08-19 04:14:27.46 UTC
2018-01-19 15:44:41.57 UTC
null
5,658,060
null
1,175,327
null
1
828
angular|ngfor
1,383,754
<p>I would use this syntax to set the index value into an attribute of the HTML element:</p> <h3>Angular >= 2</h3> <p>You have to use <code>let</code> to declare the value rather than <code>#</code>.</p> <pre class="lang-html prettyprint-override"><code>&lt;ul&gt; &lt;li *ngFor="let item of items; let i = index"...
23,546,255
How to use UrlFetchApp with credentials? Google Scripts
<p>I am trying to use Google Scripts UrlFetchApp to access a website with a basic username and password. As soon as I connect to the site a popup appears that requires authentication. I know the Login and Password, however I do not know how to pass them within the UrlFetchApp.</p> <pre class="lang-js prettyprint-overr...
23,718,759
2
0
null
2014-05-08 15:34:25.953 UTC
19
2020-02-21 23:46:08.207 UTC
2020-02-21 23:46:08.207 UTC
null
9,724,138
null
3,586,062
null
1
46
authentication|google-apps-script|basic-authentication|credentials|urlfetch
43,788
<p>This question has been answered on another else where. Here is the summary:</p> <p><strong>Bruce Mcpherson</strong></p> <blockquote> <pre><code>basic authentication looks like this... var options = {}; options.headers = {"Authorization": "Basic " + Utilities.base64Encode(username + ":" + password)}; </cod...
43,458,971
React Dev tools show my Component as Unknown
<p>I have the following simple component:</p> <pre><code>import React from 'react' import '../css.scss' export default (props) =&gt; { let activeClass = props.out ? 'is-active' : '' return ( &lt;div className='hamburgerWrapper'&gt; &lt;button className={'hamburger hamburger--htla ' + activeClass}&gt; ...
43,459,021
3
0
null
2017-04-17 20:19:02.933 UTC
12
2020-02-13 10:24:01.53 UTC
2017-04-17 20:30:00.267 UTC
null
6,465,572
null
6,465,572
null
1
42
reactjs|google-chrome-devtools
16,972
<p>This happens when you export an anonymous function as your component. If you name the function (component) and then export it, it will show up in the React Dev Tools properly.</p> <pre><code>const MyComponent = (props) =&gt; {} export default MyComponent; </code></pre>
21,381,943
How to configure Spring without persistence.xml?
<p>I'm trying to set up spring xml configuration without having to create a futher <code>persistence.xml</code>. But I'm constantly getting the following exception, even though I included the database properties in the <code>spring.xml</code></p> <pre><code> Exception in thread "main" org.springframework.beans.fact...
21,382,512
4
0
null
2014-01-27 13:17:36.917 UTC
13
2021-01-10 14:11:32.757 UTC
2016-09-20 13:24:46.743 UTC
null
1,025,118
null
1,194,415
null
1
31
java|spring|hibernate|jpa|configuration
54,663
<p>Specify the "packagesToScan" &amp; "persistenceUnitName" properties in the entityManagerFactory bean definition.</p> <pre><code>&lt;bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt; &lt;property name="dataSource" ref="dataSource" /&gt; &lt...
26,054,512
React img tag issue with url and class
<p>I have the following simple react code in my JSX file:</p> <pre><code>/** @jsx React.DOM */ var Hello = React.createClass({ render: function() { return &lt;div&gt;&lt;img src='http://placehold.it/400x20&amp;text=slide1' alt={event.title} class="img-responsive"/&gt;&lt;span&gt;Hello {this.props.name}&lt...
26,065,890
2
0
null
2014-09-26 07:43:31.243 UTC
7
2017-08-20 21:03:10.56 UTC
2014-10-12 18:47:59.403 UTC
null
2,445,990
null
48,050
null
1
43
javascript|css|reactjs
183,453
<p>Remember that your img is not really a DOM element but a javascript expression. </p> <ol> <li><p>This is a JSX attribute expression. Put curly braces around the src string expression and it will work. See <a href="http://facebook.github.io/react/docs/jsx-in-depth.html#attribute-expressions">http://facebook.github.i...
22,652,543
Does new ASP.NET MVC identity framework work without Entity Framework and SQL Server?
<p>I am new to ASP.NET MVC 5 and so I am trying to use it as much as possible to learn it by practice. </p> <p>So I am thinking of using the new OWIN implementation of ASP.NET MVC to implement the authentication and authorization of my project. That said, I am building the project in a way that it can work with variou...
22,677,441
4
0
null
2014-03-26 05:50:25.927 UTC
24
2020-10-08 21:08:29.18 UTC
2014-03-26 06:06:59.123 UTC
null
13,302
null
1,063,345
null
1
41
sql-server|entity-framework|asp.net-mvc-5|owin
27,572
<p>Not that simple. Not that hard either.</p> <p>You'll have to write your custom implementation of:</p> <ol> <li><code>IUserStore&lt;TUser&gt;</code></li> <li><code>IUserPasswordStore&lt;TUser&gt;</code></li> <li><code>IUserTwoFactorStore&lt;TUser&gt;</code></li> <li><code>IUserClaimStore&lt;TUser&gt;</code></li> <li>...
24,522,793
How can I add N milliseconds to a datetime in Python
<p>I'm setting a datetime var as such:</p> <pre><code>fulldate = datetime.datetime.strptime(date + ' ' + time, "%Y-%m-%d %H:%M:%S.%f") </code></pre> <p>where date and time are string of the appropriate nature for datetime. How can I increment this datetime by N milliseconds?</p>
24,522,827
2
0
null
2014-07-02 04:18:47.59 UTC
3
2016-06-10 05:47:37.443 UTC
null
null
null
null
968,233
null
1
34
python|datetime
43,476
<p>Use <code>timedelta</code></p> <p>To increment by 500 ms:</p> <pre><code>fulldate = datetime.datetime.strptime(date + ' ' + time, "%Y-%m-%d %H:%M:%S.%f") fulldate = fulldate + datetime.timedelta(milliseconds=500) </code></pre> <p>You can use it to increment minutes, hours, days etc. Documentation:</p> <p><a href...
2,734,301
Given a set of points, find if any of the three points are collinear
<p>What is the best algorithm to find if any three points are collinear in a set of points say n. Please also explain the complexity if it is not trivial.</p> <p>Thanks<br> Bala</p>
2,786,316
3
6
null
2010-04-29 01:50:02.717 UTC
13
2018-05-07 05:49:13.7 UTC
2010-04-29 09:46:03.92 UTC
null
249,460
null
207,335
null
1
16
algorithm|graphics|data-structures|complexity-theory
16,933
<p>If you can come up with a better than O(N^2) algorithm, you can publish it!</p> <p>This problem is <a href="http://maven.smith.edu/~orourke/TOPP/P11.html" rel="noreferrer">3-SUM Hard</a>, and whether there is a sub-quadratic algorithm (i.e. better than O(N^2)) for it is an open problem. Many common computational ge...
2,628,159
SQL - Add up all row-values of one column in a singletable
<p>I've got a question regarding a SQL-select-query: The table contains several columns, one of which is an Integer-column called "size" - the task I'm trying to perform is query the table for the sum of all rows (their values), or to be more exact get a artifical column in my ResultSet called "overallSize" which conta...
2,628,173
3
0
null
2010-04-13 08:49:35.823 UTC
1
2010-04-13 09:24:20.6 UTC
2010-04-13 09:24:20.6 UTC
null
17,343
null
315,274
null
1
17
sql|sum|hsqldb
72,762
<pre><code>SELECT SUM(size) AS overallSize FROM table WHERE bla = 5; </code></pre>
2,724,820
Tomcat - How to limit the maximum memory Tomcat will use
<p>I am running Tomcat on a small VPS (256MB/512MB) and I want to explicitly limit the amount of memory Tomcat uses. </p> <p>I understand that I can configure this somehow by passing in the java maximum heap and initial heap size arguments;</p> <pre><code>-Xmx256m -Xms128m </code></pre> <p>But I can't find where to ...
2,724,866
3
0
null
2010-04-27 20:26:11.977 UTC
5
2016-12-01 21:47:58.503 UTC
null
null
null
null
111,734
null
1
23
memory|configuration|tomcat
73,877
<p>Set JAVA_OPTS in your init script,</p> <pre><code> export JAVA_OPTS="-Djava.awt.headless=true -server -Xms48m -Xmx1024M -XX:MaxPermSize=512m" </code></pre>
3,074,938
Django m2m form save " through " table
<p>I'm having trouble in saving a m2m data, containing a 'through' class table. I want to save all selected members (selected in the form) in the through table. But i don't know how to initialise the 'through' table in the view.</p> <p>my code:</p> <pre><code>class Classroom(models.Model): user = models.ForeignK...
3,125,398
4
0
null
2010-06-19 08:45:41.48 UTC
12
2019-01-14 15:47:25.77 UTC
2013-12-17 20:25:44.63 UTC
null
321,731
null
342,279
null
1
17
django|forms|m2m
11,212
<p>In case of using normal m2m relation (not through intermediary table) you could replace:</p> <pre><code>membership = Membership(member = HERE SELECTED ITEMS FROM FORM,classroom=new_obj) membership.save() </code></pre> <p>with</p> <pre><code>form.save_m2m() </code></pre> <p>But in case of using intermediary table...
2,531,837
How can I get the PID of the parent process of my application
<p>My winform application is launched by another application (the parent), I need determine the pid of the application which launch my application using C#.</p>
2,533,287
4
1
null
2010-03-28 03:53:11.327 UTC
10
2020-07-26 00:16:38.633 UTC
2020-07-26 00:16:38.633 UTC
null
214,143
null
167,454
null
1
31
c#|.net|winforms|process|pid
29,930
<p>WMI is the easier way to do this in C#. The Win32_Process class has the ParentProcessId property. Here's an example:</p> <pre><code>using System; using System.Management; // &lt;=== Add Reference required!! using System.Diagnostics; class Program { public static void Main() { var myId = Process.GetC...
38,027,877
Spark Transformation - Why is it lazy and what is the advantage?
<p><code>Spark Transformations</code> are lazily evaluated - when we call the action it executes all the transformations based on lineage graph.</p> <p>What is the advantage of having the Transformations Lazily evaluated?</p> <p>Will it improve the <code>performance</code> and less amount of <code>memory consumption</c...
38,028,390
4
0
null
2016-06-25 11:14:43.263 UTC
10
2022-03-24 11:42:50.943 UTC
2021-02-18 16:57:22.617 UTC
null
72,351
null
1,907,755
null
1
23
apache-spark|transformation|lazy-evaluation
29,839
<p>For transformations, Spark adds them to a DAG of computation and only when driver requests some data, does this DAG actually gets executed. </p> <p>One advantage of this is that Spark can make many optimization decisions after it had a chance to look at the DAG in entirety. This would not be possible if it executed...
52,625,979
Confused about useBuiltIns option of @babel/preset-env (using Browserslist Integration)
<p>I'm working on a web project using Babel 7 with Webpack 4. I've never used Babel before and can't really understand some parts of it. Based on the <a href="https://babeljs.io/docs/en/babel-preset-env" rel="noreferrer">documentation</a> I'm using <code>@babel/preset-env</code> because it seems the recommended way (es...
56,505,264
2
0
null
2018-10-03 11:23:28.593 UTC
27
2019-06-08 09:52:25.267 UTC
2018-10-08 08:13:03.373 UTC
null
5,263,363
null
5,263,363
null
1
85
javascript|webpack|babeljs|babel-preset-env
33,943
<blockquote> <p>1) Do I need to use that useBuiltIns: "entry" option?</p> </blockquote> <p>Yes, if you want to include polyfills based on your target environment.</p> <p>TL;DR</p> <p>There're basically 3 options for <code>useBuiltIns</code>:</p> <p><strong>"entry"</strong>: when using this option, <code>@babel/pr...
672,836
Question about Repositories and their Save methods for domain objects
<p>I have a somewhat ridiculous question regarding DDD, Repository Patterns and ORM. In this example, I have 3 classes: <strong>Address</strong>, <strong>Company</strong> and <strong>Person</strong>. A Person is a member of a Company and has an Address. A Company also has an Address. </p> <p>These classes reflect a da...
675,416
2
2
null
2009-03-23 10:18:31.387 UTC
10
2009-03-24 20:12:09.313 UTC
2017-05-23 11:55:43.04 UTC
kitsune
-1
kitsune
13,466
null
1
9
nhibernate|linq-to-sql|orm|domain-driven-design|ddd-repositories
1,240
<p>I myself have used the IRepository approach lately that Keith suggests. But, you should not be focusing on that pattern here. Instead, there are a few more pieces in the DDD playbook that can be applied here.</p> <h2>Use <i>Value Objects</i> for your Addresses</h2> <p>First, there is the concept of Value Objects...
1,311,578
Opening multiple files (OpenFileDialog, C#)
<p>I'm trying to open multiple files at once with the <code>OpenFileDialog</code>, using <code>FileNames</code> instead of <code>FileName</code>. But I cannot see any examples anywhere on how to accomplish this, not even on MSDN. As far as I can tell - there's no documentation on it either. Has anybody done this before...
1,311,594
2
0
null
2009-08-21 12:09:56.373 UTC
9
2020-05-11 11:03:57.793 UTC
2014-08-06 16:50:20.24 UTC
null
152,598
null
152,598
null
1
37
c#|winforms|file|openfiledialog
79,924
<p>You must set the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.openfiledialog.multiselect.aspx" rel="noreferrer"><code>OpenFileDialog.Multiselect</code></a> Property value to true, and then access the <code>OpenFileDialog.FileNames</code> property.</p> <p>Check this sample</p> <pre><code>p...
2,552,371
Setting java.awt.headless=true programmatically
<p>I'm trying to set <code>java.awt.headless=true</code> during the application startup but it appears like I'm too late and the non-headless mode has already started:</p> <pre><code>static { System.setProperty("java.awt.headless", "true"); /* java.awt.GraphicsEnvironment.isHeadless() returns false */ } </code...
2,552,470
5
1
null
2010-03-31 11:17:03.753 UTC
8
2019-12-19 11:49:16.3 UTC
2017-11-10 06:29:19.693 UTC
null
5,105,305
null
102,200
null
1
35
java|awt|headless
65,603
<p>I was working with a <code>main()</code> in a class which statically loads different parts of JFreeChart in Constants (and other static code).</p> <p>Moving the static loading block to the top of the class solved my problem.</p> <p><strong>This doesn't work:</strong></p> <pre><code> public class Foo() { priv...
3,203,286
How to create a read-only class property in Python?
<p>Essentially I want to do something like this:</p> <pre><code>class foo: x = 4 @property @classmethod def number(cls): return x </code></pre> <p>Then I would like the following to work: </p> <pre><code>&gt;&gt;&gt; foo.number 4 </code></pre> <p>Unfortunately, the above doesn't work. Ins...
3,203,659
5
0
null
2010-07-08 12:00:12.16 UTC
31
2020-05-21 17:45:37.88 UTC
null
null
null
null
160,206
null
1
79
python|class|properties
41,009
<p>The <code>property</code> descriptor always returns itself when accessed from a class (ie. when <code>instance</code> is <code>None</code> in its <code>__get__</code> method).</p> <p>If that's not what you want, you can write a new descriptor that always uses the class object (<code>owner</code>) instead of the ins...
2,375,372
Is there a way to get all the querystring name/value pairs into a collection?
<p>Is there a way to get all the querystring name/value pairs into a collection?</p> <p>I'm looking for a built in way in .net, if not I can just split on the &amp; and load a collection.</p>
2,375,380
6
0
null
2010-03-03 22:07:23.433 UTC
7
2022-09-09 04:16:38.563 UTC
null
null
null
null
39,677
null
1
58
c#|asp.net|collections|query-string
80,569
<p>Yes, use the <a href="http://msdn.microsoft.com/en-us/library/system.web.httprequest.querystring.aspx" rel="noreferrer"><code>HttpRequest.QueryString</code></a> collection:</p> <blockquote> <p>Gets the collection of HTTP query string variables.</p> </blockquote> <p>You can use it like this:</p> <pre><code>forea...
2,792,819
R dates "origin" must be supplied
<p>My code:</p> <pre><code>axis.Date(1,sites$date, origin=&quot;1970-01-01&quot;) </code></pre> <p>Error:</p> <blockquote> <p>Error in as.Date.numeric(x) : 'origin' must be supplied</p> </blockquote> <p>Why is it asking me for the origin when I supplied it in the above code?</p>
2,792,839
6
0
null
2010-05-08 03:18:59.59 UTC
10
2022-02-11 12:38:12.877 UTC
2022-02-11 12:38:12.877 UTC
null
6,123,824
null
335,939
null
1
64
r|date
225,443
<p>I suspect you meant:</p> <pre><code>axis.Date(1, as.Date(sites$date, origin = &quot;1970-01-01&quot;)) </code></pre> <p>as the 'x' argument to <code>as.Date()</code> has to be of type <code>Date</code>.</p> <p>As an aside, this would have been appropriate as a follow-up or edit of your previous question.</p>
2,531,952
How to use a custom comparison function in Python 3?
<p>In <strong>Python 2.x</strong>, I could pass custom function to sorted and .sort functions</p> <pre><code>&gt;&gt;&gt; x=['kar','htar','har','ar'] &gt;&gt;&gt; &gt;&gt;&gt; sorted(x) ['ar', 'har', 'htar', 'kar'] &gt;&gt;&gt; &gt;&gt;&gt; sorted(x,cmp=customsort) ['kar', 'htar', 'har', 'ar'] </code></pre> <p>Becau...
2,531,971
6
4
null
2010-03-28 05:04:35.18 UTC
20
2020-01-18 04:31:34.03 UTC
2016-10-17 07:09:54.253 UTC
null
355,230
null
213,464
null
1
124
python|sorting|python-3.x
88,512
<p>Use the <code>key</code> argument (and follow the <a href="http://code.activestate.com/recipes/576653-convert-a-cmp-function-to-a-key-function/" rel="noreferrer">recipe</a> on how to convert your old <code>cmp</code> function to a <code>key</code> function).</p> <p><code>functools</code> has a function <code>cmp_to...
3,041,441
Should checkins be small steps or complete features?
<p>Two uses of version control seem to dictate different checkin styles.</p> <ul> <li><p><strong>distribution centric</strong>: changesets will generally reflect a complete feature. In general these checkins will be larger. This style is more user/maintainer friendly.</p></li> <li><p><strong>rollback centric</strong...
3,041,559
7
2
null
2010-06-14 22:41:08.847 UTC
14
2010-06-15 01:16:40.443 UTC
2010-06-14 22:58:04.797 UTC
null
125,389
null
28,817
null
1
26
git|mercurial|dvcs|bazaar
1,074
<p>The beauty of DVCS systems is that you can have <em>both</em>, because in a DVCS unlike a CVCS, <em>publishing</em> is orthogonal to <em>committing</em>. In a CVCS, every commit is automatically published, but it in a DVCS, commits are only published when they are <em>pushed</em>.</p> <p>So, <em>commit</em> small s...
3,091,010
recv() socket function returning data with length as 0
<p>I am having an application which established a socket connection on a port number 5005 with another device(hardware device with a web server). </p> <p>Now if my hardware device disconnects then i loose connection with the device. </p> <ol> <li><p>Does this mean that the socket i was using until now becomes invalid...
3,091,039
8
2
null
2010-06-22 07:14:31.23 UTC
13
2020-07-29 20:24:09.737 UTC
2018-06-27 02:28:46.203 UTC
null
207,421
null
166,012
null
1
22
c|sockets|tcp
42,988
<p>When <code>recv</code> returns a value of 0 that means the connection has been closed.</p> <p>See the <a href="http://www.kernel.org/doc/man-pages/online/pages/man2/recv.2.html" rel="noreferrer"><code>recv</code> man page:</a></p> <blockquote> <p>These calls return the number of bytes received, or -1 if an error...
33,531,334
Convert directories with java files to java modules in intellij
<p>I recently switched to using IntelliJ. I manually imported some projects and I guess I didn't do it correctly. They are all supposed to be java modules but they are just regular directory folders. Is there a way to convert them to java modules so I can run the programs or will I have to manually recreate new modules...
33,531,901
4
1
null
2015-11-04 20:25:37.273 UTC
2
2021-07-07 12:14:46.097 UTC
2018-11-21 21:33:00.073 UTC
null
4,952,262
null
2,492,620
null
1
27
java|intellij-idea
38,865
<p>There are a few ways to handle this. If your project has an existing build framework such as gradle, maven, etc, generally you can navigate to</p> <p><code>File &gt; New &gt; Project From Existing Sources...</code></p> <p>And then navigate to the gradle.build, pom.xml, or other framework specific build. When this ...
13,947,472
how to increment a value inside stored procedure
<p>How to increment a value of local variable in the loop inside a stored procedure</p> <pre><code>ALTER PROC [dbo].[Usp_SelectQuestion] @NoOfQuestion int AS BEGIN Declare @CNT int Declare @test int Declare @x int Declare @y int set @x = 1; set @y = 1; Select @CNT=(Select Count(*) from (select Distinct(setno)from onl...
13,947,556
1
2
null
2012-12-19 07:28:34.62 UTC
null
2012-12-19 07:35:41.33 UTC
2012-12-19 07:33:21.713 UTC
null
422,353
null
1,633,097
null
1
1
sql|sql-server|stored-procedures
44,449
<p>you have to enclose the while-body in a begin-end block.</p> <pre><code>while @x &lt;= @CNT do begin while @y &lt;= @test begin select * from onlin where setno = @x set @y = @y + 1 end set @x =@x + 1 end </code></pre> <p>I do not understand what you are trying to achive (besides the fact that you want...
10,418,404
Create a DLL in C and link it from a C++ project
<p>As per title, I'm trying to build a DLL using C and link it from a C++ project. I read and followed different tutorials on internet but everytime there is something missing and I don't understand what. </p> <p>Here's what I did, step by step: </p> <p>I created a new Win32 project, named <code>testlib</code>, then,...
10,418,729
4
0
null
2012-05-02 17:03:01.767 UTC
9
2012-05-02 17:26:46.097 UTC
null
null
null
null
465,157
null
1
8
c++|c|dll|linker
10,513
<p>You have several problems:</p> <ol> <li>The header file should mark the functions as exported when being compiled in the DLL but imported when being compiled by a library user.</li> <li>The header file should wrap the function declarations in an <code>extern "C"</code> block when being compiled as C++ to ensure tha...
5,641,427
How to make preprocessor generate a string for __LINE__ keyword?
<p><code>__FILE__</code> is replaced with "MyFile.cpp" by C++ preprocessor. I want <code>__LINE__</code> to be replaced with "256" string not with 256 integer. Without using my own written functions like</p> <pre><code>toString(__LINE__); </code></pre> <p>Is that possible? How can I do it?</p> <p>VS 2008</p> <p><s...
5,641,470
2
2
null
2011-04-12 20:45:16.373 UTC
7
2016-06-20 20:33:28.897 UTC
2016-06-20 20:33:28.897 UTC
null
4,370,109
null
490,529
null
1
32
c++|visual-studio-2008|c-preprocessor
10,153
<p>You need the double expansion trick:</p> <pre><code>#define S(x) #x #define S_(x) S(x) #define S__LINE__ S_(__LINE__) /* use S__LINE__ instead of __LINE__ */ </code></pre> <p>Addendum, years later: It is a good idea to go a little out of one's way to avoid operations that may allocate memory in exception-handlin...
6,151,549
How can I build a specific architecture using xcodebuild?
<p>I have legacy code that relies on pointers being <code>32-bit</code> and want to use <code>xCodeBuild</code> to build that code from <code>command line</code>. This doesn't work for some reason. Here's the command I use:</p> <pre><code>xcodebuild -configuration Debug -arch i386 -workspace MyProject.xcworkspace -...
6,154,460
2
0
null
2011-05-27 11:23:37.47 UTC
11
2021-04-05 12:14:37.04 UTC
2016-02-15 18:58:50.677 UTC
null
299,674
null
686,184
null
1
35
macos|command-line|xcode4|xcodebuild
41,311
<p>You have to set the <code>ONLY_ACTIVE_ARCH</code> to <code>NO</code> if you want <code>xcodebuild</code> to use the <code>ARCHS</code> parameters. By passing these parameters, you can force the proper architecture.</p> <pre><code>xcodebuild ARCHS=i386 ONLY_ACTIVE_ARCH=NO -configuration Debug -workspace MyProject.xc...
33,503,077
Any difference between type assertions and the newer `as` operator in TypeScript?
<p>Is there any difference between what the TypeScript spec calls a type assertion:</p> <pre><code>var circle = &lt;Circle&gt; createShape("circle"); </code></pre> <p>And the <a href="https://github.com/Microsoft/TypeScript/wiki/What&#39;s-new-in-TypeScript#new-tsx-file-extension-and-as-operator" rel="noreferrer">new...
33,503,842
2
0
null
2015-11-03 15:35:16.48 UTC
14
2019-11-27 19:41:44.077 UTC
null
null
null
null
154,066
null
1
183
casting|typescript
57,007
<p>The difference is that <code>as Circle</code> works in TSX files, but <code>&lt;Circle&gt;</code> conflicts with JSX syntax. <code>as</code> was introduced for this reason.</p> <p>For example, the following code in a <code>.tsx</code> file:</p> <pre><code>var circle = &lt;Circle&gt; createShape("circle"); </code><...
33,269,093
How to add <canvas> support to my tests in Jest?
<p>In my <a href="https://facebook.github.io/jest/" rel="noreferrer">Jest</a> unit test I am rendering a component with a <a href="http://casesandberg.github.io/react-color/#usage-display" rel="noreferrer">ColorPicker</a>. The <code>ColorPicker</code> component creates a canvas object and 2d context but returns <code>'...
33,278,679
11
0
null
2015-10-21 20:57:25.793 UTC
3
2022-06-04 03:33:05.31 UTC
2015-10-22 10:19:25.773 UTC
null
115,493
null
448,967
null
1
43
reactjs|html5-canvas|jsdom|jestjs
40,921
<p>It's because your test doesn't run in a real browser. Jest uses <code>jsdom</code> for mocking the necessary parts of the DOM to be able to run the tests in Node, thus avoiding style calculation and rendering that a browser would normally do. This is cool because this makes tests fast.</p> <p>On the other hand, if ...
33,076,495
How can I fix this "Dropzone already attached" error?
<p>I have this sample:</p> <p><a href="https://jsfiddle.net/rfv0afgf/3/" rel="noreferrer">link</a></p> <p>I managed to create this form but unfortunately it does not work because I get error.</p> <pre><code>Dropzone already attached. </code></pre> <p><strong>CODE HTML:</strong></p> <pre><code>&lt;div class="dropzo...
33,076,591
12
0
null
2015-10-12 08:28:43.427 UTC
4
2021-04-26 04:24:42.81 UTC
2019-05-20 03:25:44.067 UTC
null
1,422,059
null
5,341,052
null
1
58
javascript|jquery|html|dropzone.js
100,095
<p>You should use either </p> <pre><code>var myDropzone = new Dropzone("div#myDrop", { url: "/file/post"}); </code></pre> <p>or</p> <pre><code>$("div#myDrop").dropzone({ url: "/file/post" }); </code></pre> <p>not both. Basically what you are doing is calling the same thing twice.</p>
23,218,929
Check if selected dropdown value is empty using jQuery
<p>Here is the dropdown in question:</p> <pre><code>&lt;select name="data" class="autotime" id="EventStartTimeMin"&gt; &lt;option value=""&gt;&lt;/option&gt; &lt;option value="00"&gt;00&lt;/option&gt; &lt;option value="10"&gt;10&lt;/option&gt; &lt;option value="20"&gt;20&lt;/option&gt; &lt;option v...
23,218,951
3
0
null
2014-04-22 12:01:51.203 UTC
4
2019-08-09 09:47:47.647 UTC
2016-04-21 20:57:31.143 UTC
null
519,413
null
2,290,213
null
1
25
jquery
136,571
<p>You forgot the <code>#</code> on the id selector:</p> <pre><code>if ($("#EventStartTimeMin").val() === "") { // ... } </code></pre>
34,387,893
Output matplotlib figure to SVG with text as text, not curves
<p>When I use <code>matplotlib.pyplot.savefig("test.svg", format="svg")</code> to export the figure as SVG, then the resulting SVG file is huge.</p> <p>This is caused by the fact that there are a lot of text annotations in my figure, and each text ends up as paths in the SVG.</p> <p>I want my text to end up as text s...
35,734,729
1
0
null
2015-12-21 01:43:52.75 UTC
15
2021-04-12 13:26:48.35 UTC
null
null
null
null
301,166
null
1
43
svg|matplotlib
12,235
<p>Matplotlibs SVG text rendering can be configured either in the matplotlibrc or in code.<br /> From <a href="https://matplotlib.org/stable/tutorials/introductory/customizing.html" rel="noreferrer">Customizing Matplotlib with style sheets and rcParams</a>:</p> <pre class="lang-py prettyprint-override"><code>#svg.fontt...
21,503,588
Bind HTML string with custom style
<p>I want to bind a HTML string with an custom style to the DOM. However <code>ngSanitize</code> removes the style from the string.</p> <p>For example:</p> <p><em>In the controller:</em></p> <pre><code>$scope.htmlString = &quot;&lt;span style='color: #89a000'&gt;123&lt;/span&gt;!&quot;; </code></pre> <p><em>And in DOM:...
28,502,961
5
0
null
2014-02-01 20:58:49.817 UTC
10
2021-12-28 20:22:51.493 UTC
2021-12-28 20:22:51.493 UTC
null
1,127,428
null
1,717,562
null
1
47
angularjs
41,099
<p>As already mentioned @Beyers, you have to use <code>$sce.trustAsHtml()</code>, to use it directly into the DOM, you could do it like this, JS/controller part:</p> <pre><code>$scope.trustAsHtml = function(string) { return $sce.trustAsHtml(string); }; </code></pre> <p>And in DOM/HTML part</p> <pre><code>&lt;div...
53,260,312
How SELECT ANY TABLE privilege work in Oracle?
<p>I would like to know how the privilege <code>SELECT ANY TABLE</code> works internally in Oracle.</p> <p>Is it treated as a single privilege? Or is it equivalent to make a <code>GRANT SELECT ON MyTable TO MyUser</code> for each table?</p> <p>As example, I would like to know if this work :</p> <pre><code>GRANT SELE...
53,260,699
1
1
null
2018-11-12 10:34:18.737 UTC
null
2018-11-12 11:07:50.123 UTC
2018-11-12 11:07:50.123 UTC
null
7,147,233
null
4,730,196
null
1
3
sql|oracle|privileges
41,035
<p>Yes, all users would still be able to query <code>MY_TABLE</code>.</p> <p>You are looking at different <a href="https://docs.oracle.com/en/database/oracle/oracle-database/12.2/admqs/administering-user-accounts-and-security.html#GUID-289A4BF6-F703-4ED5-8357-89F651A6D1DE" rel="noreferrer">privilege types</a>:</p> <b...
36,895,431
Angular 2: pipes - How to format a phone number?
<p>I've searched here and there, and I am not able to find something specific about formatting a phone number.</p> <p>Currently, I am retrieving phone numbers form a JSON in the following format: </p> <p>25565115</p> <p>However, I want to achieve this result:</p> <p>02-55-65-115</p> <p>For that, I believe that I n...
36,895,706
6
0
null
2016-04-27 16:17:13.61 UTC
8
2022-06-07 19:29:31.577 UTC
2020-03-16 19:57:09.327 UTC
null
5,612,697
null
6,101,493
null
1
32
angular|pipes-filters
65,174
<p><a href="https://stackblitz.com/edit/angular-g29gfr?file=src%2Fapp%2Fapp.component.ts" rel="noreferrer"><strong>StackBlitz</strong></a></p> <p><code>pipe</code> implementation in <strong>TS</strong> would look like this</p> <pre class="lang-ts prettyprint-override"><code>import { Pipe } from "@angular/core"; @Pip...
30,276,503
Where to find a clear explanation about swift alert (UIAlertController)?
<p>Couldn't find a clear and informative explanation for this.</p>
30,594,016
3
2
null
2015-05-16 13:51:12.737 UTC
10
2018-03-12 00:43:38.153 UTC
2016-01-26 12:26:09.59 UTC
null
3,219,049
null
3,219,049
null
1
21
ios|swift|dialog|uialertview|uialertcontroller
28,774
<p>After searching a while on a subject I didn't find a clear explanation , even in it's class reference <a href="https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIAlertController_class/index.html" rel="noreferrer">UIAlertController Reference</a></p> <p>It is ok, but not clear enough for me.</p>...
8,538,427
How to delete all contents of a folder with Ruby-Rails?
<p>I have a <code>public/cache</code> folder which has files and folders. How can I completely empty that folder using a rake task?</p>
8,538,489
3
0
null
2011-12-16 18:19:46.163 UTC
8
2020-09-13 16:44:45.843 UTC
2014-05-22 10:21:13.613 UTC
null
3,279,009
null
1,041,669
null
1
74
ruby|ruby-on-rails-3
41,932
<p>Ruby has the *nix <code>rm -rf</code> equivalent in the <a href="http://ruby-doc.org/stdlib/libdoc/fileutils/rdoc/FileUtils.html" rel="noreferrer">FileUtils</a> module that you can use to delete both files and non-empty folders/directories:</p> <pre><code>FileUtils.rm_rf('dir/to/remove') </code></pre> <p>To keep t...
8,556,604
Is there a way to use two CSS3 box shadows on one element?
<p>I'm trying to replicate a button style in a Photoshop mock-up that has two shadows on it. The first shadow is an inner lighter box shadow (2px), and the second is a drop shadow outside the button (5px) itself.</p> <p><a href="https://i.stack.imgur.com/GF895.png" rel="noreferrer"><img src="https://i.stack.imgur.com/...
8,556,627
2
0
null
2011-12-19 02:41:50.54 UTC
25
2017-06-18 07:46:42.307 UTC
2017-06-18 07:46:42.307 UTC
null
1,143,732
null
1,105,159
null
1
184
css
142,734
<p>You can comma-separate shadows:</p> <pre class="lang-css prettyprint-override"><code>box-shadow: inset 0 2px 0px #dcffa6, 0 2px 5px #000; </code></pre>
27,290,354
ReactJS server-side rendering vs client-side rendering
<p>I just have began to study ReactJS and found that it gives you 2 ways to render pages: server-side and client-side. But, I can't understand how to use it together. Is it 2 separate ways to build the application, or can they be used together? </p> <p>If we can use it together, how to do it - do we need to duplicate ...
27,291,188
4
1
null
2014-12-04 09:25:38.62 UTC
53
2022-08-20 09:03:27.41 UTC
2016-03-26 18:07:34.197 UTC
null
385,273
null
1,640,210
null
1
153
javascript|node.js|client-server|reactjs
80,590
<p>For a given website / web-application, you can use react either <em>client-side</em>, <em>server-side</em> or <em>both</em>.</p> <h3>Client-Side</h3> <p>Over here, you are completely running ReactJS on the browser. This is the simplest setup and includes most examples (including the ones on <a href="http://reactjs...
1,307,512
How to export an entire Access database to SQL Server?
<p>I've just got a lovely Access database, so the first thing I want to do is to move it over to a normal database management system (sqlexpress), but the <a href="http://hosting.intermedia.net/support/kb/default.asp?id=576" rel="nofollow noreferrer">only solution</a> I've found sounds like craziness. </p> <p>Isn't th...
1,307,541
3
0
null
2009-08-20 16:54:11.15 UTC
4
2021-01-19 06:53:29.583 UTC
2015-01-28 10:42:16.75 UTC
null
4,116,112
null
90,691
null
1
12
ms-access|export|sql-server-express
55,856
<p>Is there a reason you don't want to use Management Studio and specify Microsoft Access as the data source for your Import Data operation? (Database->Tasks->Import, Microsoft Access as data source, mdb file as parameter). Or is there a reason it must be done from within Microsoft Access?</p>
638,361
Nullable Method Arguments in C#
<p><strong>Duplicate Question</strong></p> <p><a href="https://stackoverflow.com/questions/271588/passing-null-arguments-to-c-methods/271600">Passing null arguments to C# methods</a></p> <p>Can I do this in c# for .Net 2.0?</p> <pre><code>public void myMethod(string astring, int? anint) { //some code in which I may ...
638,369
3
1
null
2009-03-12 12:16:17.997 UTC
2
2009-03-12 12:27:21.107 UTC
2017-05-23 10:29:18.923 UTC
Longhorn213
-1
One Monkey
null
null
1
22
c#|arguments|nullable
94,773
<p>Yes, assuming you added the chevrons deliberately and you really meant:</p> <pre><code>public void myMethod(string astring, int? anint) </code></pre> <p><code>anint</code> will now have a <code>HasValue</code> property.</p>
1,269,506
Selecting a UITableViewCell in Edit mode
<p>If I create a UITableViewController - drilling down works as expected. If a user selects a cell and I implement 'didSelectRowAtIndexPath', the cell flashes blue and the next view shows up.</p> <p>But, if I include an 'edit' button (self.navigationItem.rightBarButtonItem = self.editButtonItem), when the user clicks ...
1,269,730
3
0
null
2009-08-13 00:51:08.18 UTC
3
2014-09-02 12:11:06.067 UTC
null
null
null
null
4,910
null
1
29
iphone|uitableview
11,325
<p>UITableView has a property <a href="http://developer.apple.com/iphone/library/documentation/uikit/reference/UITableView_Class/Reference/Reference.html#//apple_ref/occ/instp/UITableView/allowsSelectionDuringEditing" rel="noreferrer">allowsSelectionDuringEditing</a> for this.</p> <p>IMHO it should have been YES by de...
22,195,093
Android how to get tomorrow's date
<p>In my android application. I need to display tomorrow's date, for example today is 5th March so I need to display as 6 March. I know the code for getting today's date, month and year.</p> <p>date calculating</p> <pre><code> GregorianCalendar gc = new GregorianCalendar(); yearat = gc.get(Calendar.YEAR); ...
22,195,142
16
0
null
2014-03-05 10:30:37.567 UTC
12
2021-06-29 22:38:15.15 UTC
2018-04-04 10:23:41.257 UTC
null
9,209,546
null
3,180,759
null
1
36
java|android|calendar
56,448
<ol> <li><p>Get today's date as a <code>Calendar</code>.</p></li> <li><p>Add 1 day to it.</p></li> <li><p>Format for display purposes.</p></li> </ol> <p>For example,</p> <pre><code>GregorianCalendar gc = new GregorianCalendar(); gc.add(Calendar.DATE, 1); // now do something with the calendar </code></pre>
6,661,179
VS Designer question. How to change parent control
<p>VS beginner question. How to change parent control of a control? Example. I have TabControl on form, aligned to fit the all form. I have double clicked of toolStrip control to create menu and instead of the form toolStrip was added to TabControl. How to move toolStrip from the TabControl to the Form. I can use copy/...
6,664,636
1
0
null
2011-07-12 08:08:26.06 UTC
3
2011-07-12 13:08:30.69 UTC
null
null
null
null
281,014
null
1
30
visual-studio-2010|user-controls
8,738
<p>In the menu select View -> Other Windows -> Document Outline. In that window you see the hierarchical view of your components. Drag the controls to their new parent.</p>
42,043,611
Could not load the default credentials? (Node.js Google Compute Engine tutorial)
<p><strong>SITUATION:</strong></p> <p>I follow this tutorial: <a href="https://cloud.google.com/nodejs/tutorials/bookshelf-on-compute-engine" rel="noreferrer">https://cloud.google.com/nodejs/tutorials/bookshelf-on-compute-engine</a></p> <p>Everything works fine until I do <code>npm start</code> and go to:</p> <p><a ...
42,059,661
17
1
null
2017-02-04 17:56:05.53 UTC
19
2021-11-04 15:49:13.573 UTC
2017-02-04 18:02:46.803 UTC
null
6,230,185
null
6,230,185
null
1
92
javascript|node.js|google-cloud-platform|google-compute-engine
105,375
<p>Yes, I had the same error. It's annoying cause Google Cloud Platform docs for their "getting started" bookshelf tutorial does not mention this anywhere. Which means that any new developer who tries this tutorial will see this error.</p> <p>Read this: <a href="https://developers.google.com/identity/protocols/applica...
20,449,543
Shell equality operators (=, ==, -eq)
<p>What is the difference between <code>=</code>, <code>==</code> and <code>-eq</code> in shell scripting?</p> <p>Is there any difference between the following?</p> <pre><code>[ $a = $b ] [ $a == $b ] [ $a -eq $b ] </code></pre> <p>Is it simply that <code>=</code> and <code>==</code> are only used when the variables co...
20,449,556
4
0
null
2013-12-08 03:29:58.933 UTC
58
2022-05-28 23:34:46.73 UTC
2021-11-26 23:56:12.473 UTC
null
63,550
null
2,845,038
null
1
258
bash|shell
367,809
<p><code>=</code> and <code>==</code> are for string comparisons<br /> <code>-eq</code> is for numeric comparisons<br /> <code>-eq</code> is in the same family as <code>-lt</code>, <code>-le</code>, <code>-gt</code>, <code>-ge</code>, and <code>-ne</code></p> <p><code>==</code> is specific to bash (not present in sh (B...
36,125,038
Generate array of times (as strings) for every X minutes in JavaScript
<p>I'm trying to create an array of times (strings, not <code>Date</code> objects) for every X minutes throughout a full 24 hours. For example, for a 5 minute interval the array would be:</p> <pre><code>['12:00 AM', '12:05 AM', '12:10 AM', '12:15 AM', ..., '11:55 PM'] </code></pre> <p>My quick and dirty solution was ...
36,126,706
15
2
null
2016-03-21 07:13:17.543 UTC
14
2021-09-10 21:17:04.54 UTC
2018-08-17 17:35:01.563 UTC
null
438,581
null
438,581
null
1
46
javascript|arrays
61,822
<p>If the interval is only to be set in minutes[0-60], then evaluate the below solution w/o creating the date object and in single loop:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-overri...
20,256,909
Django: How to write query to sort using multiple columns, display via template
<p>I'm quite new to Django, and not too experienced with MVC, DB queries. </p> <p>I have a Customer table which includes customer_name, city_name, as well as a state_name (pulled from a foreign key table). In the HTML, I'm trying to display the results in a list first sorted alphabetically by state_name, then by city_...
20,257,999
3
0
null
2013-11-28 02:56:54.33 UTC
6
2018-08-06 05:35:55.29 UTC
2013-11-28 06:08:16.813 UTC
null
952,112
null
2,316,803
null
1
37
python|django|postgresql|sorting|django-queryset
39,560
<p>There are several levels for display ordered models objects in template, each one overwrite the previous level:</p> <ol> <li><strong>(MODEL LEVEL) Meta attribute <code>ordering</code></strong> as shows @Bithin in his answer (<em>more on <a href="https://docs.djangoproject.com/en/dev/ref/models/options/#django.db.mo...
5,681,868
Efficient BigDecimal round Up and down to two decimals
<p>In java am trying to find an efficient way to round a BigDecimal to two decimals, Up or Down based on a condition.</p> <pre><code> IF condition true then: 12.390 ---&gt; 12.39 12.391 ---&gt; 12.40 12.395 ---&gt; 12.40 12.399 ---&gt; 12.40 If condition false then: 12.390 ---&gt; 12.39 12.39...
5,681,953
3
2
null
2011-04-15 20:12:01.993 UTC
2
2011-04-15 23:17:10.063 UTC
null
null
null
null
47,508
null
1
12
java|rounding|bigdecimal
53,897
<pre><code>public static BigDecimal round(BigDecimal d, int scale, boolean roundUp) { int mode = (roundUp) ? BigDecimal.ROUND_UP : BigDecimal.ROUND_DOWN; return d.setScale(scale, mode); } round(new BigDecimal("12.390"), 2, true); // =&gt; 12.39 round(new BigDecimal("12.391"), 2, true); // =&gt; 12.40 round(new BigD...
5,981,162
list of users and roles that have permissions to an object (table) in SQL
<p>You'd think I'd be able to Google such a simple question. But no matter what I try, I hit a brick wall.</p> <p>What is the TSQL statement to find a list of roles that have permissions to a table?</p> <p>The pseudo-code looks like this:</p> <pre><code>SELECT role_name FROM permissions where object_name = 'the_ta...
6,021,753
3
0
null
2011-05-12 16:20:27.4 UTC
4
2016-06-06 20:55:05.567 UTC
2013-02-21 16:42:42.08 UTC
null
44,853
null
200,669
null
1
19
sql|tsql|permissions|azure-sql-database
71,615
<p>It's a bit tricky. First, remember that the built-in roles have pre-defined access; these won't show up in the query below. The proposed query lists custom database roles and which access they were specifically granted or denied. Is this what you were looking for?</p> <pre><code>select permission_name, state_desc, ...
5,930,671
Why use $HOME over ~ (tilde) in a shell script?
<p>Is there any reason to use the variable <code>$HOME</code> instead of a simple <code>~</code> (tilde) in a shell script?</p>
5,930,680
3
0
null
2011-05-08 22:04:47.813 UTC
7
2021-09-16 17:50:41.813 UTC
2021-09-16 17:50:41.813 UTC
null
967,621
null
480,993
null
1
38
shell|scripting|environment-variables|home-directory|tilde-expansion
7,099
<p>Tilde expansion doesn't work in some situations, like in the middle of strings like <code>/foo/bar:~/baz</code></p>
5,990,089
Jquery - Select td value for all the tr with a class
<p>I have a table</p> <pre><code>&lt;table&gt; &lt;tr class="PO1"&gt;&lt;/tr&gt; &lt;tr class="PO2"&gt;&lt;/tr&gt; &lt;tr class="PO3"&gt;&lt;/tr&gt; &lt;/table&gt; </code></pre> <p>How can I loop through all tr with class <code>"PO1"</code> and get the value of each <code>'td'</code> value?</p> ...
5,990,160
4
0
null
2011-05-13 09:47:27.933 UTC
1
2014-01-07 10:50:54.173 UTC
2014-01-07 10:50:54.173 UTC
null
759,866
null
375,971
null
1
9
jquery
39,487
<pre><code>var values = $('table tr.PO1 td').map(function(_, td) { return $(td).text(); }).get(); </code></pre> <p>This would just create an array with the text contents from each <code>td</code>. Probably a better idea to use a map/object instead:</p> <pre><code>var values = $('table tr.PO1 td').map(function(ind...
6,028,981
Using HttpClient and HttpPost in Android with post parameters
<p>I'm writing code for an Android application that is supposed to take data, package it as Json and post it to a web server, that in turn is supposed to respond with json.</p> <p>Using a GET request works fine, but for some reason using POST all data seems to get stripped and the server does not receive anything.</p>...
6,029,205
4
2
null
2011-05-17 09:39:20.25 UTC
15
2018-11-28 12:25:21.097 UTC
null
null
null
null
74,012
null
1
34
java|android|json|httpclient|http-post
118,369
<p>have you tried doing it without the JSON object and just passed two basicnamevaluepairs? also, it might have something to do with your serversettings</p> <p>Update: this is a piece of code I use:</p> <pre><code>InputStream is = null; ArrayList&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt...
2,310,062
How to force an index on inner joined tables?
<p>How do I force indexes on a query similar to this. I need to force an index on foo and bar individually.</p> <pre><code>SELECT foo.*, bar.* FROM foo INNER JOIN bar ON foo.rel_id = bar.rel_id WHERE foo.status = 1 AND bar.status = 1 </code></pre>
2,310,125
2
1
null
2010-02-22 09:59:08.71 UTC
6
2011-02-07 13:07:12.107 UTC
2010-02-22 10:00:45.563 UTC
null
17,343
null
175,562
null
1
22
mysql|inner-join
42,220
<p>Assuming index <strong>a</strong> exists on foo and index <strong>b</strong> on bar:</p> <pre><code>SELECT foo.*, bar.* FROM foo FORCE INDEX (a) INNER JOIN bar FORCE INDEX (b) ON foo.rel_id = bar.rel_id WHERE foo.status = 1 AND bar.status = 1 </code></pre> <p>would force index selection on MySql</p>
59,494,037
How to detect the device on React SSR App with Next.js?
<p>on a web application I want to display two different Menu, one for the Mobile, one for the Desktop browser. I use Next.js application with server-side rendering and the library <a href="https://www.npmjs.com/package/react-device-detect" rel="noreferrer">react-device-detect</a>.</p> <p>Here is the <a href="https://c...
61,519,537
10
1
null
2019-12-26 22:19:24.797 UTC
8
2022-09-20 10:02:09.12 UTC
null
null
null
null
8,562,168
null
1
32
reactjs|next.js|server-side-rendering|device-detection
55,823
<p><strong>LATEST UPDATE:</strong></p> <p>So if you don't mind doing it client side you can use the dynamic importing as suggested by a few people below. This will be for use cases where you use static page generation.</p> <p>i created a component which passes all the <code>react-device-detect</code> exports as props (...
5,721,889
Is there a list that is sorted automatically in .NET?
<p>I have a collection of <code>Layers</code> where they have names and colors. What I want to do is to sort these first based on colors, then based on their names:</p> <pre><code>class Layer { public string Name {get; set;} public LayerColor Color {get; set;} } enum LayerColor { Red, Blue, Green ...
5,721,920
8
2
null
2011-04-19 19:53:59.817 UTC
5
2017-04-27 01:52:36.96 UTC
null
null
null
null
51,816
null
1
29
c#|.net|list|sorting
49,613
<p>Did you search for it? <a href="http://msdn.microsoft.com/en-us/library/ms132319.aspx" rel="noreferrer">Generic SortedList</a> and <a href="http://msdn.microsoft.com/en-us/library/system.collections.sortedlist.aspx" rel="noreferrer">SortedList</a>.</p> <p>So I missed the duplicate part which make it a little bit ha...
6,102,398
php implode (101) with quotes
<p>Imploding a simple array </p> <p>would look like this</p> <pre><code>$array = array('lastname', 'email', 'phone'); $comma_separated = implode(",", $array); </code></pre> <p>and that would return this</p> <pre><code> lastname,email,phone </code></pre> <p>great, so i might do this instead </p> <pre><code>$array...
6,102,446
15
2
null
2011-05-23 20:06:35.183 UTC
28
2021-10-01 10:16:50.92 UTC
null
null
null
null
234,670
null
1
147
php|arrays|string|csv|implode
129,066
<p>No, the way that you're doing it is just fine. <code>implode()</code> only takes 1-2 parameters (if you just supply an array, it joins the pieces by an empty string).</p>
39,241,851
Developing spring boot application with lower footprint
<p>In an attempt to keep our microservices, developed in spring-boot to run on Cloud Foundry, smaller in footprint, we are looking for best approach to achieve the same.</p> <p>Any inputs or pointers in this direction will be most welcomed.</p> <p>It's surely the best that one always builds the application upwards st...
39,249,361
1
2
null
2016-08-31 06:04:01.917 UTC
27
2018-07-18 20:15:39.003 UTC
null
null
null
null
4,741,070
null
1
34
spring-boot
16,521
<p>Below are some personal ideas on how to reach <strong>a smaller footprint</strong> with Spring Boot. Your question is too broad for these recommandations to be taken into account in any other context. I'm not entirely sure you want to follow these in most situation, it simply answers "how to achieve a smaller footpr...
5,127,537
Java 7 new IO API - Paths.exists
<p>Does anyone know what happened to the <code>path.exists()</code> API method in the latest Java 7 API? I cannot find the change in the change logs, and between b123 and b130, the method has been removed from the API.I see that there is a static <code>Files.exists</code> method but I'm not sure if that is the replace...
5,130,959
1
2
null
2011-02-26 14:46:36.603 UTC
2
2016-04-09 02:10:03.38 UTC
2011-02-26 14:53:10.497 UTC
null
378,968
null
370,481
null
1
75
java|api|nio
56,810
<h1><code>Files.exists</code></h1> <p>Look in the <a href="http://docs.oracle.com/javase/8/docs/api/java/nio/file/Files.html" rel="noreferrer"><code>Files</code></a> class for the static methods <a href="http://docs.oracle.com/javase/8/docs/api/java/nio/file/Files.html#exists-java.nio.file.Path-java.nio.file.LinkOptio...
40,956,671
Passing event and argument to v-on in Vue.js
<p>I pass a parameter in <code>v-on:input</code> directives. If I don't pass it, I can access the event in the method. Is there any way I can still access the event when passing the parameter to the function? Note that I am using vue-router.</p> <p>This is without passing the parameter. I can access the event object:</...
40,956,873
4
0
null
2016-12-04 08:07:05.453 UTC
30
2022-07-15 19:47:02.297 UTC
2021-12-02 18:01:38.983 UTC
null
11,047,824
null
4,144,667
null
1
261
vue.js
226,367
<p>If you want to access event object as well as data passed, you have to pass <code>event</code> and <code>ticket.id</code> both as parameters, like following:</p> <p><strong>HTML</strong></p> <pre class="lang-html prettyprint-override"><code>&lt;input type=&quot;number&quot; v-on:input=&quot;addToCart($event, ticket....
33,306,859
The required anti-forgery cookie "__RequestVerificationToken" is not present
<p>My website is raising this exception around 20 times a day, usually the form works fine but there are instances where this issue occur and I don't know why is so random.</p> <p>This is logged exception by elmah</p> <blockquote> <p>500 HttpAntiForgery The required anti-forgery cookie __RequestVerificationToken"...
33,314,529
8
0
null
2015-10-23 16:04:28.93 UTC
10
2020-07-13 10:48:43.517 UTC
2017-05-01 01:37:36.88 UTC
null
584,192
null
1,964,280
null
1
38
c#|jquery|asp.net-mvc|cookies|antiforgerytoken
80,433
<p>It almost sounds as if things are working as expected. </p> <p>The way the anti forgery helper <code>@Html.AntiForgeryToken()</code> works is by injecting a hidden form field named <code>__RequestVerificationToken</code> into the page AND it also sets a cookie into the browser.</p> <p>When the form is posted back...
23,221,096
Hibernate String Primary Key with Annotation
<p>I am trying to create a Privilege class with Annotations whose Primary Key is a String. I will assign them manually while inserting. Therefore no need for hibernate to generate a value for it. I'm trying to do something like that:</p> <pre><code>@Id @GeneratedValue(generator = "assigned") @Column(name = "ROLE_NAME"...
23,221,371
4
0
null
2014-04-22 13:30:29.423 UTC
3
2021-10-21 12:52:46.667 UTC
null
null
null
null
618,279
null
1
11
java|hibernate|annotations|primary-key
41,004
<p>Since the <code>roleName</code> is not auto-generated, you should simply not annotate it with <code>@GeneratedValue</code>:</p> <pre><code>@Id @Column(name = "ROLE_NAME", nullable = false) private String roleName; </code></pre>
19,118,367
How do I set up Bootstrap after downloading via Composer?
<p>I'm a beginner with Composer, so I know little about it and have little experience with web application development.</p> <p>I was reading the <a href="https://net.tutsplus.com/tutorials/javascript-ajax/combining-laravel-4-and-backbone/" rel="nofollow noreferrer">Nettuts+</a> Tutorial, and have a basic question abou...
21,039,021
7
0
null
2013-10-01 14:07:03.09 UTC
7
2019-11-14 14:03:43.243 UTC
2019-07-28 17:50:30.583 UTC
null
964,243
null
1,536,973
null
1
32
laravel|laravel-4|twitter-bootstrap-3|composer-php
47,980
<p>We have artisan command to publish the assets(CSS, JS,..). Something like this should work.</p> <pre><code>php artisan asset:publish --path="vendor/twitter/bootstrap/bootstrap/css" bootstrap/css php artisan asset:publish --path="vendor/twitter/bootstrap/bootstrap/js" bootstrap/js </code></pre> <p>i am not sure abo...
48,151,332
Why are AWS Batch Jobs stuck in RUNNABLE?
<p>I use a computing environment of 0-256 m3.medium on demand instances. My Job definition requires 1 CPU and 3 GB of Ram, which m3.medium has.</p> <p>What are possible reasons why AWS Batch Jobs are stuck in state <code>RUNNABLE</code>?</p> <p><a href="https://docs.aws.amazon.com/batch/latest/userguide/job_states.ht...
48,706,035
5
0
null
2018-01-08 13:29:06.19 UTC
5
2020-03-27 15:29:42.227 UTC
2018-01-08 13:36:50.307 UTC
null
7,531,531
null
7,531,531
null
1
31
amazon-web-services|aws-batch|aws-ecs
13,318
<p>There are other reasons why a Job can get stuck in RUNNABLE:</p> <ul> <li>Insufficient permissions for the role associated to the Computed Environment</li> <li>No internet access from the Compute Environment instance. You will need to associate a <a href="https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-n...
21,341,616
Publish Multiple Projects to Different Locations on Azure Website
<p><em>Feel free to recommend a better title or changes to my explanation below!</em></p> <p>I am using Windows Azure Websites (for the first time) and have connected it to a solution in Visual Studio Online (also my first time). I was also able to connect to Visual Studio Online, create a project, throw up a master p...
21,346,077
1
0
null
2014-01-24 20:11:03.777 UTC
15
2014-01-26 09:52:27.053 UTC
null
null
null
null
1,018,496
null
1
24
azure|visual-studio-2013|azure-web-app-service|azure-devops
7,797
<ol> <li>Go to the Configure tab for the site in Azure portal.</li> <li><p>Scroll all the way to the bottom then add a new application where ever you want like Project2 below. <img src="https://i.stack.imgur.com/e1y8e.jpg" alt=""></p> <p>Basically the 'Project2' part is the URL after the root '/' and the 'site\wwwroot...
29,039,462
Which certificate should I use to sign my Mac OS X application?
<p>We are developing a Mac OS X application that we are going to distribute outside the Mac App Store. We ended up having these certificates in the Mac Developers program:</p> <p><img src="https://i.stack.imgur.com/UETpj.png" alt="List of six certificates: two of type Mac Development, four of types Developer ID Instal...
29,040,068
2
0
null
2015-03-13 18:29:42.567 UTC
9
2018-11-13 18:39:01.643 UTC
2015-03-20 20:37:14.163 UTC
null
2,157,640
null
6,068
null
1
16
xcode|macos|certificate|release
11,646
<p>For development (for example, the Debug configuratino) use the <code>Mac Developer</code> option, which will choose your local Mac Developer certificate (in your case "Mac Developer: José Fernández"), which is meant for team members working on your project (includes testing/debugging).</p> <p>For Release, use "Deve...
21,893,674
Print Function Linked Lists C++
<p>I'm currently learning Linked Lists in C++, and I can't write a print function which prints out the elements of the list; I mean I wrote the function but it doesn't work properly.</p> <pre><code>#include &lt;iostream&gt; using namespace std; struct node { char name[20]; node* next; }; node* addNewPerson(...
21,894,342
6
1
null
2014-02-19 22:13:09.487 UTC
2
2019-12-15 12:05:11.787 UTC
2014-02-20 01:18:44.5 UTC
null
1,009,479
null
2,075,578
null
1
3
c++|function|printing|linked-list
49,193
<p>It is obvious that function addNewPerson is wrong.</p> <pre><code>node* addNewPerson(node* head) { node* person = new node; cout &lt;&lt; "Name: "; cin &gt;&gt; person-&gt;name; person-&gt;next = NULL; if (head == NULL) //is empty { head = person; } else { per...
33,423,702
How to use > (greater-than) inside a template parameter and not get a parsing error?
<p>I want to only define a function based on the size of the template parameter:</p> <pre><code>template &lt;class T&gt; typename std::enable_if&lt;sizeof(T) &gt; 1, void&gt;::type foobify(T v) { // ... } int main() { //foobify((unsigned char)30); // should not compile foobify((long)30); } </code></pre> ...
33,423,740
3
2
null
2015-10-29 20:11:10.843 UTC
2
2021-07-29 03:11:22.373 UTC
null
null
null
null
15,055
null
1
28
c++|parsing|templates
6,048
<p>Yes, expressions using that operator must be parenthesized. See [temp.names]/3:</p> <blockquote> <p>When parsing a <em>template-argument-list</em>, <strong>the first non-nested <code>&gt;</code><sup>138</sup> is taken as the ending delimiter rather than a greater-than operator.</strong> [..] [ <em>Example:</em>...
29,999,360
Upgrading mongodb has no effect and still shows the old version
<p>Following are the commands which I used to upgrade my mongodb version from 2.6.9 to latest, but its still showing me the previous version. Let me know what I am doing wrong with the upgrading process. The problem is that <code>mongod -version</code> still shows the old version installed after upgrade.</p> <p>Docs w...
30,327,520
9
5
null
2015-05-02 06:49:58.95 UTC
8
2022-03-24 03:07:11.007 UTC
2017-06-30 12:50:51.483 UTC
null
1,590,502
null
639,406
null
1
47
mongodb|ubuntu
32,046
<p>I'm in the exact same situation, followed the exact same steps, and had the same issue.</p> <p>What worked for me was:</p> <p><a href="http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/#uninstall-mongodb" rel="nofollow noreferrer">Uninstalling</a>:</p> <pre><code>sudo service mongod stop sudo apt-get...
34,094,030
Log all HTTP requests of Tomcat Server?
<p>Is it possible to print all requests to Tomcat and responses from Tomcat in a logfile?</p> <p>ex:</p> <blockquote> <blockquote> <p>request</p> <p>headers: [header1=a, header2=a]</p> <p>params: [param1=avv, param2=b]</p> <p>response</p> <p>status-code = 200</p> <p>...
34,096,888
3
1
null
2015-12-04 17:25:27.23 UTC
4
2019-01-02 14:39:11.703 UTC
2019-01-02 14:39:11.703 UTC
null
352,319
null
2,836,188
null
1
12
tomcat|logging|request
58,850
<p>Put an <code>AccessLogValve</code> in the <code>Host</code> or <code>Context</code> element e.g.:</p> <pre><code>&lt;Host name="www.mysite.com" appBase="..." &gt; &lt;Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="mysitelog." suffix=".txt" pattern="..." resolveH...
10,553,377
How to make a digital signature in a web application (JavaScript) using a smartcard?
<p>We have written a document management system and would like to digitally sign documents using the web client. Our Java client application is already able to apply and check digital signature, but we would like to make signature even with our web client. This is written in GWT and so, when run on the client side, it ...
10,561,313
5
1
null
2012-05-11 14:31:46.17 UTC
10
2019-04-18 16:29:11.36 UTC
2016-05-24 18:33:32.797 UTC
null
472,495
null
387,880
null
1
9
digital-signature|npapi|pkcs#11
27,262
<p>After some more googling I found the answer. Mozilla export part of its NSS module via <a href="https://developer.mozilla.org/en/JavaScript_crypto" rel="nofollow noreferrer">window.crypto</a> object. A more standard way of doing such operation is probably via <a href="https://wiki.mozilla.org/Privacy/Features/DOMCry...
22,755,795
how to Retrieve data from database and display it in a jsp text fields using jdbc connection
<p>I am retrieving data from database and displaying it in table in a <code>JSP</code> but I do not have any idea about how to display it on text fields.</p> <p>e.g. </p> <ol> <li>when I search a index number.</li> <li>the the result (name , address, age) must come to the textfeilds which are in my <code>JSP</code></...
46,153,735
5
2
null
2014-03-31 07:27:10.873 UTC
1
2017-09-11 10:41:07.017 UTC
2017-09-11 10:08:52.687 UTC
null
7,294,900
null
2,695,450
null
1
5
java|mysql|jsp|jdbc
62,978
<p>Make sure you have included the jdbc driver in your project and "build" it. Then:</p> <ol> <li><p>Make the database connection and retrieve the query result. </p></li> <li><p>Return the query result and save in an object of ResultSet.</p></li> <li><p>Traverse through the object and display the query results.</p></l...
7,626,076
How to set current date and time using prepared statement?
<p>I have a column in database having datatype <code>DATETIME</code>. I want to set this column value to current date and time using `PreparedStatement. How do I do that?</p>
7,626,080
2
0
null
2011-10-02 11:31:08.313 UTC
9
2018-05-04 17:30:57.21 UTC
2011-10-02 11:41:19.95 UTC
null
157,882
null
266,074
null
1
31
java|datetime|jdbc|prepared-statement
84,501
<p>Use <a href="http://download.oracle.com/javase/6/docs/api/java/sql/PreparedStatement.html#setTimestamp%28int,%20java.sql.Timestamp%29" rel="noreferrer"><code>PreparedStatement#setTimestamp()</code></a> wherein you pass a <a href="http://download.oracle.com/javase/6/docs/api/java/sql/Timestamp.html" rel="noreferrer">...
7,063,053
PHP Error handling: die() Vs trigger_error() Vs throw Exception
<p>In regards to Error handling in PHP -- As far I know there are 3 styles:</p> <ol> <li><p><code>die()</code>or <code>exit()</code> style:</p> <pre><code>$con = mysql_connect("localhost","root","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } </code></pre></li> <li><p><code>throw Exception</...
7,063,076
2
3
null
2011-08-15 08:42:08.65 UTC
43
2017-03-21 21:38:53.547 UTC
2017-03-21 21:38:53.547 UTC
null
7,735,647
null
367,985
null
1
131
error-handling|php
32,829
<p>The first one should never be used in production code, since it's transporting information irrelevant to end-users (a user can't do anything about <em>"Cannot connect to database"</em>).</p> <p>You throw Exceptions if you know that at a certain critical code point, your application <em>can fail</em> and you want yo...
22,945,826
What does "unsupported operand type(s) for -: 'int' and 'tuple'" means?
<p>I got a error saying:</p> <pre><code>unsupported operand type(s) for -: 'int' and 'tuple' </code></pre> <p>How do I correct it?</p> <pre><code>from scipy import integrate cpbar = lambda T: (3.826 - (3.979e-3)*T + 24.558e-6*T**2 - 22.733e-9*T**3 + 6.963e-12*T**4)*8.314 deltahbarCH4 = integrate.quad(cpbar,298,1000)...
22,945,940
2
1
null
2014-04-08 18:54:29.797 UTC
2
2014-04-08 19:06:12.483 UTC
2014-04-08 19:03:22.823 UTC
null
100,297
null
3,498,229
null
1
6
python|scipy|tuples
63,016
<p><a href="http://docs.scipy.org/doc/scipy-0.13.0/reference/generated/scipy.integrate.quad.html" rel="nofollow"><code>integrate.quad()</code> returns a tuple</a>; <code>deltahbarCO2 + 2*deltahbarH2O</code> is an integer, you are trying to subtract the <code>var</code> tuple.</p> <p>If you wanted <em>just</em> the int...
23,138,671
how to add authentication header to $window.open
<p>I have angularjs application where users enter data that is saved to database, then on server side it is compiled into pdf file. All access requires appropriate authentication headers in place. After needed data is filled a user presses button to save data and then to retrieve pdf file. Optimally, I call <code>$wind...
33,047,717
3
2
null
2014-04-17 16:31:18.903 UTC
9
2020-01-09 10:04:25.907 UTC
2017-02-22 17:08:45.98 UTC
null
1,272,394
null
2,576,168
null
1
23
angularjs|authentication|download
58,686
<p>I think you can add this authentication parameters in URL and do a GET in your server side</p> <pre><code>//Add authentication headers as params var params = { access_token: 'An access_token', other_header: 'other_header' }; //Add authentication headers in URL var url = [url_generating_pdf, $.param(params)...
37,663,854
Convert ggplot object to plotly in shiny application
<p>I am trying to convert a ggplot object to plotly and show it in a shiny application. But I encountered an error "no applicable method for 'plotly_build' applied to an object of class "NULL""</p> <p>I was able to return the ggplot object to the shiny application successfully, </p> <pre><code>output$plot1 &lt;- rend...
37,664,052
2
1
null
2016-06-06 17:52:43.643 UTC
11
2021-04-23 00:16:54.337 UTC
null
null
null
null
5,016,733
null
1
21
r|ggplot2|shiny|plotly
23,281
<p>Try:</p> <pre><code>library(shiny) library(ggplot2) library(ggthemes) library(plotly) ui &lt;- fluidPage( titlePanel(&quot;Plotly&quot;), sidebarLayout( sidebarPanel(), mainPanel( plotlyOutput(&quot;plot2&quot;)))) server &lt;- function(input, output) { output$plot2 &lt;- renderPlotly({ ggplotly( ggpl...
37,889,914
What is a projection layer in the context of neural networks?
<p>I am currently trying to understand the architecture behind the <em>word2vec</em> neural net learning algorithm, for representing words as vectors based on their context.</p> <p>After reading <a href="http://arxiv.org/pdf/1301.3781v3.pdf" rel="noreferrer">Tomas Mikolov paper</a> I came across what he defines as a <...
58,910,682
3
2
null
2016-06-17 20:30:07.347 UTC
27
2020-12-01 10:25:41.65 UTC
2017-11-18 21:20:45.083 UTC
null
3,924,118
null
4,747,593
null
1
59
machine-learning|nlp|neural-network|word2vec
18,216
<p>I find the previous answers here a bit overcomplicated - a projection layer is just a simple matrix multiplication, or in the context of NN, a regular/dense/linear layer, without the non-linear activation in the end (sigmoid/tanh/relu/etc.) The idea is to <strong>project</strong> the (e.g.) 100K-dimensions discrete ...
37,775,675
Imageview set color filter to gradient
<p>I have a white image that I'd like to color with a gradient. Instead of generating a bunch of images each colored with a specific gradient, I'd like to do this in code (not xml). </p> <p>To change an image's color, I use </p> <pre><code>imageView.setColorFilter(Color.GREEN); </code></pre> <p>And this works fine. ...
37,816,689
3
2
null
2016-06-12 14:59:29.703 UTC
14
2016-06-17 08:55:40.637 UTC
2016-06-16 19:40:30.553 UTC
null
2,022,349
null
2,022,349
null
1
30
android|imageview|gradient
13,389
<p>You have to get <code>Bitmap</code> of your <code>ImageView</code> and redraw same <code>Bitmap</code> with <code>Shader</code></p> <pre><code>public void clickButton(View v){ Bitmap myBitmap = ((BitmapDrawable)myImageView.getDrawable()).getBitmap(); Bitmap newBitmap = addGradient(myBitmap); myImageVie...
37,004,069
Error:Jack is required to support java 8 language features
<p>When I tried to update my android project to use Java 8 after getting android studio 2.1 and android N SDK by adding </p> <pre><code>compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } </code></pre> <p>I had this error </p> <blockquote> <p>Error:Jac...
37,004,259
1
2
null
2016-05-03 12:24:28.437 UTC
27
2017-08-19 04:45:00.2 UTC
2016-07-23 18:16:50.337 UTC
null
6,051,408
null
3,998,402
null
1
138
android|android-studio|android-gradle-plugin|jack-compiler
90,682
<blockquote> <p>Error:Jack is required to support java 8 language features. Either enable Jack or remove sourceCompatibility JavaVersion.VERSION_1_8.</p> </blockquote> <p>The error say that you have to <strong>enable Jack</strong>.</p> <p>To enable support for Java 8 in your Android project, you need to configure...
47,721,246
EF Core 2.0 Enums stored as string
<p>I was able to store an enum as a string in the database.</p> <pre><code>builder.Entity&lt;Company&gt;(eb =&gt; { eb.Property(b =&gt; b.Stage).HasColumnType("varchar(20)"); }); </code></pre> <p>But when it comes time to query EF doesn't know to parse the string into an enum. How can I query like so:</p> <pre><...
50,589,798
3
4
null
2017-12-08 19:50:13.067 UTC
4
2022-07-15 21:08:13.663 UTC
null
null
null
null
2,097,401
null
1
30
entity-framework|ef-core-2.0
23,554
<p>Value Conversions feature is new in EF Core 2.1.</p> <blockquote> <p>Value converters allow property values to be converted when reading from or writing to the database. This conversion can be from one value to another of the same type (for example, encrypting strings) or from a value of one type to a value...
2,051,632
IE8 XSS filter: what does it really do?
<p>Internet Explorer 8 has a new security feature, an <a href="http://msdn.microsoft.com/en-us/library/dd565647%28VS.85%29.aspx" rel="noreferrer">XSS filter</a> that tries to intercept cross-site scripting attempts. It's described this way:</p> <blockquote> <p>The XSS Filter, a feature new to Internet Explorer 8,...
2,052,195
3
1
null
2010-01-12 19:12:58.41 UTC
15
2011-03-25 05:15:40.81 UTC
null
null
null
null
14,343
null
1
45
internet-explorer-8|xss
46,736
<p>What does it really do? It allows third parties to link to a messed-up version of your site.</p> <p>It kicks in when [a few conditions are met and] it sees a string in the query submission that also exists verbatim in the page, and which it thinks might be dangerous.</p> <p>It assumes that if <code>&lt;script&gt;s...
2,092,327
What is the most clever and easy approach to sync data between multiple entities?
<p>In today’s world where a lot of computers, mobile devices or web services share data or act like hubs, syncing gets more important. As we all know solutions that sync aren’t the most comfortable ones and it’s best not to sync at all.</p> <p>I’m still curious how you would implement a syncing solution to sync betwee...
2,094,197
3
0
null
2010-01-19 09:12:52.883 UTC
54
2021-06-17 09:34:32.77 UTC
2016-01-10 15:25:47.153 UTC
null
4,370,109
null
133,166
null
1
51
database|algorithm|mobile|synchronization
13,955
<p>Where I work we have developed an &quot;offline&quot; version of our main (web) application for users to be able to work on their laptops in locations where they do not have internet access. When the user comes back to the main site they need to synchronise the data they entered offline with our main application.</p...
8,671,702
Passing list of parameters to SQL in psycopg2
<p>I have a list of ids of rows to fetch from database. I'm using python and psycopg2, and my problem is how to effectively pass those ids to SQL? I mean that if I know the length of that list, it is pretty easy because I can always manually or automatically add as many "%s" expressions into query string as needed, but...
8,671,854
3
1
null
2011-12-29 18:21:04.927 UTC
10
2022-02-28 12:30:58.253 UTC
2011-12-29 18:27:25.36 UTC
null
183,066
null
785,454
null
1
60
python|postgresql|psycopg2
34,472
<p>Python tuples are converted to sql lists in psycopg2:</p> <pre><code>cur.mogrify("SELECT * FROM table WHERE column IN %s;", ((1,2,3),)) </code></pre> <p>would output</p> <pre><code>'SELECT * FROM table WHERE column IN (1,2,3);' </code></pre> <p>For Python newcomers: It is unfortunately important to use a tuple, ...
19,322,345
How do I change the default index page in Apache?
<p>I would like to change the default web page that shows up when I browse my site. I currently have a reporting program running, and it outputs a file called index.html. I cannot change what it calls the file. Therefore, my landing page must be called something else. Right now, when I browse my site it takes me to the...
19,322,414
3
1
null
2013-10-11 15:54:25.37 UTC
19
2021-08-18 17:09:02.183 UTC
2013-10-11 16:45:14.033 UTC
null
1,340,075
null
1,340,075
null
1
81
html|apache|indexing|default
452,082
<p>I recommend using <code>.htaccess</code>. You only need to add:</p> <pre><code>DirectoryIndex home.php </code></pre> <p>or whatever page name you want to have for it.</p> <p><strong>EDIT</strong>: basic htaccess tutorial.</p> <p>1) Create <code>.htaccess</code> file in the directory where you want to change the ...
562,108
How do I use a GlobalContext property in a log4net appender name?
<p>I'm trying to customise a log4net file path to use a property I have set in the <code>log4net.GlobalContext.Properties</code> dictionary.</p> <pre><code>log4net.GlobalContext.Properties["LogPathModifier"] = "SomeValue"; </code></pre> <p>I can see that this value is set correctly when debugging through it. and then...
572,251
4
0
null
2009-02-18 17:41:41.063 UTC
16
2014-10-07 23:28:13.987 UTC
2013-03-05 14:24:51.637 UTC
null
3,619
Long Pham
67,965
null
1
40
c#|log4net
43,237
<p>I ran into the same behavior and solved it by setting the global variable before calling the XmlConfigurator... Here is what I am successfully using:</p> <p>log4net.config details:</p> <pre><code>&lt;appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender,log4net"&gt; &lt;File type="lo...
42,974,450
Iterate over Worksheets, Rows, Columns
<p>I want to print all data (all rows) of a specific column in python using <code>openpyxl</code> I am working in this way;</p> <pre><code>from openpyxl import load_workbook workbook = load_workbook('----------/dataset.xlsx') sheet = workbook.active for i in sheet: print(sheet.cell(row=i, column=2).value) </code>...
42,977,775
3
3
null
2017-03-23 11:15:11.143 UTC
14
2020-01-10 04:02:17.577 UTC
2018-09-19 07:43:37.5 UTC
null
7,414,759
null
6,705,756
null
1
18
python|openpyxl
52,204
<p>Read the <a href="http://openpyxl.readthedocs.io" rel="noreferrer">OpenPyXL Documentation</a></p> <p>Iteration over all <code>worksheets</code> in a <code>workbook</code>, for instance: </p> <pre><code>for n, sheet in enumerate(wb.worksheets): print('Sheet Index:[{}], Title:{}'.format(n, sheet.title)) </code>...
37,284,216
Spark SQL passing a variable
<p>I have following Spark sql and I want to pass variable to it. How to do that? I tried following way.</p> <pre><code> sqlContext.sql("SELECT count from mytable WHERE id=$id") </code></pre>
37,284,383
6
1
null
2016-05-17 18:57:48.09 UTC
1
2022-07-21 07:28:20.73 UTC
2016-05-17 19:11:17.12 UTC
null
1,410,669
null
1,260,441
null
1
11
sql|select
43,729
<p>You are almost there just missed <code>s</code> :)</p> <pre><code>sqlContext.sql(s"SELECT count from mytable WHERE id=$id") </code></pre>
32,239,353
Command Validation in DDD with CQRS
<p>I am learning DDD and making use of the CQRS pattern. I don't understand how to validate business rules in a command handler without reading from the data store. </p> <p>For example, Chris wants to give Ashley a gift.</p> <p>The command might be GiveGiftCommand. </p> <p>At what point would I verify Chris actua...
32,245,241
3
4
null
2015-08-27 01:41:22.477 UTC
9
2017-07-29 02:53:14.143 UTC
null
null
null
null
234,867
null
1
19
validation|domain-driven-design|cqrs
10,576
<p>There are different views and opinions about validation in command handlers.</p> <p>Command <strong>can be rejected</strong>, we can say <strong>No</strong> to the command if it is not valid.</p> <p>Typically you would have a validation that occurs on the UI and that might be duplicated inside the command handler ...
4,210,254
How to sign a JAR file using a .PFX file
<p>We sign our .net code with a .PFX cert file. A colleague now needs to use the the same cert to sign a .jar file for a customer.</p> <p>Can someone point me to a link or an example of how I can do this please?</p> <p>The jar file will be used on Oracle Web Logic Server running on Solaris.</p> <p>And, once signed d...
4,210,860
1
0
null
2010-11-17 23:26:03.537 UTC
10
2021-11-25 22:01:32.447 UTC
null
null
null
null
30,225
null
1
13
certificate|code-signing|pfx|jar-signing
18,078
<p>[Link updated thanks to @Ezequiel]</p> <p><a href="https://support.comodo.com/index.php?/Knowledgebase/Article/View/1207/7/how-to-sign-java-jar-files" rel="nofollow noreferrer">https://support.comodo.com/index.php?/Knowledgebase/Article/View/1207/7/how-to-sign-java-jar-files</a></p> <p>Check if you can see the certs...
39,135,233
Create a paginated PDF—Mac OS X
<p>I am making a Mac app (in Swift 3 using Xcode 8, Beta 5) with which the user can make a long note and export it as a PDF. </p> <p>To create this PDF, I am using Cocoa's <code>dataWithPDF:</code> method with the following code:</p> <pre><code>do { // define bounds of PDF as the note text view let rect: NSRect...
39,479,101
1
4
null
2016-08-25 01:12:14.25 UTC
9
2017-03-13 00:37:35.047 UTC
2016-09-05 20:34:11.707 UTC
null
5,700,898
null
5,700,898
null
1
13
swift|macos|cocoa|pdf|swift3
3,438
<p>After weeks of frustration, I have come up with the definitive way of creating a paginated PDF in a Swift app. And it's not as complicated as it seems (the following is based on <strong>Swift 2</strong>):</p> <hr> <p><strong><em>Note</em></strong>: Before you read more, you should know I made an easy tool on Githu...
6,834,579
How to replace line-breaks with commas using grep in TextWrangler?
<p>I have a text-file container a number of lines, which I need to turn into a csv. What is the easiest way to replace all the line-breaks with ", ". I have TextWrangler and read that it would do so by using grep and regular expressions, but have very little experience using regular expressions and don't know how grep ...
6,834,707
2
0
null
2011-07-26 18:15:41.743 UTC
3
2020-01-07 04:09:22.23 UTC
null
null
null
null
864,046
null
1
19
regex|grep|line-breaks|textwrangler
70,910
<ol> <li>Choose Find from the Search menu. TextWrangler opens the Find window.</li> <li>Select the "Grep" checkbox</li> <li>Type the string you are looking for ("\n" or "\r\n" or "\r") in the Find textfield.</li> <li>Type the replace string (", ") in the Replace text field.</li> <li>Click "Replace All"</li> </ol> <p>S...
6,860,686
Extend AuthorizeAttribute Override AuthorizeCore or OnAuthorization
<p>Using ASP.NET MVC I am creating a custom Authorize attribute to take care of some custom authorization logic. I have looked at a lot of examples and it is pretty straight forward but my question is which method is best to override, AuthorizeCore or OnAuthorization? I have seen many examples overriding one or the o...
6,860,804
2
1
null
2011-07-28 14:31:01.497 UTC
13
2014-02-17 15:14:57.01 UTC
null
null
null
null
489,213
null
1
55
asp.net-mvc|asp.net-mvc-3|authorization|action-filter
19,076
<p>The clue is in the return types:</p> <p><code>AuthorizeCore</code> returns a boolean - it is <em>decision making</em> code. This should be limited to looking at the user's identity and testing which roles they are in etc. etc. Basically it should answer the question: </p> <p><code>Do I want this user to proceed?</...
7,462,398
Django template, if tag based on current URL value
<p>I want to be able to do an if tag based on the current URL value.</p> <p>for example, if the current page's url is <code>accounts/login/</code> then don't show a link, without passing a variable from the view.</p> <p>I am not sure how I can write an <code>{% if %}</code> tag for this, is it possible?</p>
7,462,469
3
1
null
2011-09-18 15:18:44.96 UTC
5
2021-09-23 07:33:38.893 UTC
null
null
null
null
851,920
null
1
32
django
25,851
<p>If you pass the "request" object to your template, then you are able to use this:</p> <pre><code>{% if request.get_full_path == "/account/login/" %} </code></pre>
7,231,157
How to submit form on change of dropdown list?
<p>I am creating a page in JSP where I have a dropdown list and once the user selects a value he has to click on the go button and then the value is sent to the Servlet.</p> <pre><code> &lt;/select&gt; &lt;input type="submit" name="GO" value="Go"/&gt; </code></pre> <p>How do I make it so that i...
7,231,215
4
0
null
2011-08-29 14:00:58.77 UTC
56
2022-09-15 01:53:36.187 UTC
2011-08-29 14:07:08.223 UTC
null
157,882
null
329,563
null
1
359
html|jsp
761,979
<p>Just ask assistance of JavaScript.</p> <pre><code>&lt;select onchange="this.form.submit()"&gt; ... &lt;/select&gt; </code></pre> <h3>See also:</h3> <ul> <li><a href="http://www.htmldog.com/guides/htmlintermediate/javascript/" rel="noreferrer">HTML dog - JavaScript tutorial</a></li> </ul>
21,775,082
how to remove duplicates in SAS data step
<p>How to remove duplicates in SAS data step. </p> <pre><code>data uscpi; input year month cpi; datalines; 1990 6 129.9 1990 7 130.4 1990 8 131.6 1990 9 132.7 1991 4 135.2 1991 5 135.6 1991 6 136.0 1991 7 136.2 ; run; PROC SORT DATA = uscpi OUT = uscpi_dist NODUPKEY; ...
21,775,491
1
2
null
2014-02-14 09:10:33.97 UTC
1
2014-09-18 10:25:59.117 UTC
2014-02-14 09:14:32.643 UTC
null
426,834
null
3,298,261
null
1
1
duplicates|sas|datastep
38,731
<p>You can use the <code>first.</code> &amp; <code>last.</code> automatic variables created by SAS when using <code>by-group</code> processing. They give more control on which row you consider as duplicate. Please read the manual to <a href="https://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.h...
42,888,024
Git Bash (mintty) is extremely slow on Windows 10 OS
<p>I installed Git on my <strong>Windows 10</strong> a couple of months ago. It worked well for some time. But now, it's running very slow.</p> <p>The <code>git status</code> command takes <strong>7 seconds</strong> to execute, and <code>git stash</code> takes <strong>many minutes</strong> for stashing (even if there i...
43,762,587
20
10
null
2017-03-19 14:55:33.87 UTC
39
2022-07-28 17:32:53.41 UTC
2021-11-28 23:34:02.297 UTC
null
7,263,373
null
7,263,373
null
1
115
git|windows-10|git-bash|mingw-w64|mintty
106,939
<p>I recently ran into the exact same issue. After trying all the advice from this thread and a lot of other threads, I finally found a solution <a href="https://github.com/git-for-windows/git/issues/1129" rel="noreferrer">here</a>, respectively in the linked issue <a href="https://github.com/git-for-windows/git/issues...