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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7,685,458 | Can I use the same keystore file to sign two different applications? | <p>I have to upload a new application, It's just the design that's a little different. Yesterday I generated the keystore file to sign application. Can I use the same?</p> | 7,685,529 | 7 | 2 | null | 2011-10-07 09:36:28.85 UTC | 17 | 2020-10-15 13:38:58.507 UTC | 2016-12-09 13:48:21.883 UTC | null | 4,540,701 | null | 806,972 | null | 1 | 101 | android|android-keystore | 51,221 | <p>You can use that <code>keystore</code> for any number of applications.</p>
<p>No need to generate a new keystore.</p> |
7,143,788 | Try-catch-finally in java | <p>In Java, will the finally block not get executed if we insert a return statement inside
the try block of a try-catch-finally ?</p> | 7,143,836 | 8 | 5 | null | 2011-08-22 06:20:19.473 UTC | 8 | 2016-11-14 09:30:59.54 UTC | null | null | null | null | 904,696 | null | 1 | 27 | java|try-catch|try-catch-finally | 53,587 | <p>The only time a <code>finally</code> block will not be executed is when you call <code>exit()</code> before <code>finally</code> is reached. The <code>exit()</code> call will shutdown the JVM, so no subsequent line of code will be run.</p>
<p>EDIT: This is not entirely correct. See the comments below for additional... |
13,994,164 | SOAPUI Certificate authentication | <p>I am trying to hit a remote web service and check if the service is working. To hit the service I am using SOAPUI client. The first time I tried, I got a 403/Forbidden response. The team developing the remote service provided me with a digital certificate to use to making the request.
How should I use this certific... | 14,001,192 | 1 | 0 | null | 2012-12-21 16:56:16.02 UTC | 1 | 2021-11-22 21:53:11.26 UTC | 2017-12-13 07:28:34.597 UTC | null | 1,033,581 | null | 1,639,616 | null | 1 | 17 | web-services|authentication|encryption|certificate|soapui | 123,754 | <p>You need to configure soapui for client certificate authentication.</p>
<p>There are a number of ways to do this.</p>
<ol>
<li>You can add an authentication option under the connection details for the project.</li>
<li>You can configure the certificates for the request under the ws-auth tab</li>
</ol>
<p>Have a look... |
14,189,254 | PGError: Error: column of relation does not exist | <p>I'm trying to change the value of a column "isGroup" to the value "public". </p>
<p>I created a migration:</p>
<pre><code>Post.connection.execute("update Posts set isgroup='public'")
</code></pre>
<p>However, I get the following error:</p>
<pre class="lang-none prettyprint-override"><code>PGError: ERROR: colum... | 14,189,391 | 1 | 2 | null | 2013-01-07 02:58:45.473 UTC | 2 | 2018-06-15 17:50:06.49 UTC | 2018-06-15 17:50:06.49 UTC | null | 2,747,593 | null | 749,798 | null | 1 | 28 | ruby-on-rails-3|postgresql|heroku|migration | 48,540 | <p>If you are sure that column <code>isGroup</code> exists, then you should quote it like:</p>
<pre><code>UPDATE posts SET "isGroup" = 'public'
</code></pre>
<p>Note that PostgreSQL by default folds all unquoted named to lowercase.</p>
<p>To avoid this confusion and necessity to quote, you might want to rename <code... |
14,260,126 | How python-Levenshtein.ratio is computed | <p>According to the <code>python-Levenshtein.ratio</code> source:</p>
<p><a href="https://github.com/miohtama/python-Levenshtein/blob/master/Levenshtein.c#L722" rel="noreferrer">https://github.com/miohtama/python-Levenshtein/blob/master/Levenshtein.c#L722</a></p>
<p>it's computed as <code>(lensum - ldist) / lensum</c... | 14,296,743 | 4 | 1 | null | 2013-01-10 14:26:40.9 UTC | 16 | 2020-02-27 01:10:58.94 UTC | 2020-02-27 01:10:58.94 UTC | null | 395,857 | null | 787,842 | null | 1 | 40 | python|levenshtein-distance | 29,114 | <p>By looking more carefully at the C code, I found that this apparent contradiction is due to the fact that <code>ratio</code> treats the "replace" edit operation differently than the other operations (i.e. with a cost of 2), whereas <code>distance</code> treats them all the same with a cost of 1.</p>
<p>This can be ... |
14,098,735 | How to remove the default button highlighting in Safari when using jQuery | <p>I have noticed that under Safari on OS X my default jQuery buttons appear to have a blue glow highlight around them. Just checked and the same thing happens on the <a href="http://jqueryui.com/dialog/#modal-message" rel="noreferrer">jQuery UI Demo page</a>.</p>
<p><img src="https://i.stack.imgur.com/PpncS.png" alt=... | 14,098,770 | 4 | 2 | null | 2012-12-31 07:22:46.18 UTC | 4 | 2016-06-21 13:41:06.01 UTC | 2012-12-31 07:30:55.967 UTC | null | 205,997 | null | 525,138 | null | 1 | 60 | css|jquery-ui | 71,407 | <p>To remove any highlight of inputs that any browser may apply as default action you can always use <code>outline:none</code> for their css. in your case it's a <code>button</code> element. so this should work:</p>
<pre><code>button {
outline: none;
}
</code></pre>
<p><a href="http://a11yproject.com/posts/never-... |
13,988,145 | How to unset max-height? | <p>How to I reset the <code>max-height</code> property to its default, if it has been previously set in some CSS rule? This doesn't work:</p>
<pre><code>pre {
max-height: 250px;
}
pre.doNotLimitHeight {
max-height: auto; // Doesn't work at least in Chrome
}
</code></pre> | 13,988,177 | 5 | 0 | null | 2012-12-21 10:12:21.41 UTC | 13 | 2019-11-21 11:01:00.88 UTC | 2019-11-21 11:01:00.88 UTC | null | 8,343,610 | null | 521,257 | null | 1 | 201 | css | 121,267 | <p>Reset it to <code>none</code>:</p>
<pre><code>pre {
max-height: 250px;
}
pre.doNotLimitHeight {
max-height: none;
}
</code></pre>
<p><strong><a href="https://developer.mozilla.org/en-US/docs/CSS/max-height">Reference</a></strong></p> |
30,116,430 | ReactJS giving error Uncaught TypeError: Super expression must either be null or a function, not undefined | <p>I am using ReactJS.</p>
<p>When I run the code below the browser says:</p>
<blockquote>
<p><strong>Uncaught TypeError: Super expression must either be null or a function, not undefined</strong></p>
</blockquote>
<p>Any hints at all as to what is wrong would be appreciated.</p>
<p>First the line used to compile the c... | 30,168,874 | 44 | 11 | null | 2015-05-08 05:29:27.2 UTC | 40 | 2021-09-27 03:17:20.187 UTC | 2021-08-26 09:11:26.773 UTC | null | 6,904,888 | null | 627,492 | null | 1 | 292 | reactjs|ecmascript-6 | 323,632 | <p><strong>Class Names</strong></p>
<p>Firstly, if you're certain that you're extending from the correctly named class, e.g. <strong>React.Component</strong>, not React.component or React.createComponent, you may need to upgrade your React version. See answers below for more information on the classes to extend from.<... |
9,276,078 | What's the right approach for calling functions after a flask app is run? | <p>I'm a little confused about how to do something that I thought would be quite simple. I have a simple app written using <code>Flask</code>. It looks something like this:</p>
<pre><code>from flask import Flask
app = Flask(__name__)
def _run_on_start(a_string):
print "doing something important with %s" % a_stri... | 9,314,134 | 3 | 1 | null | 2012-02-14 11:31:23.517 UTC | 9 | 2019-02-17 16:54:32.427 UTC | null | null | null | null | 646,300 | null | 1 | 33 | python|web-frameworks|flask|werkzeug | 25,309 | <p>The duplicate output from your function can be explained by the reloader. The first thing it does is start the main function in a new thread so it can monitor the source files and restart the thread when they change. Disable this with the <code>use_reloader=False</code> option.</p>
<p>If you want to be able to ru... |
19,703,753 | How to make the @Html.EditorFor Disabled | <p>I have the following inside my asp.net mvc web application :-</p>
<pre><code><div><span class="f">Data Center Name</span> @Html.EditorFor(model => model.Switch.TMSRack.DataCenter.Name, new { disabled = "disabled" })</div>
</code></pre>
<p>but the field will not be disabled ,, can anyone... | 19,703,838 | 6 | 2 | null | 2013-10-31 10:17:50.243 UTC | 5 | 2020-11-06 07:18:50.143 UTC | null | null | null | null | 1,146,775 | null | 1 | 42 | asp.net-mvc|html-helper | 93,902 | <p><code>@Html.EditorFor()</code> does not have an overload to support htmlAttributes. You could try <code>@Html.TextBoxFor()</code> </p>
<pre><code>@Html.TextBoxFor(model => model.propertyName, new {disabled= "disabled" })
</code></pre>
<p>If you are using system key words such as <code>class</code> in htmlAttrib... |
19,643,001 | How to route EVERYTHING other than Web API to /index.html | <p>I've been working on an <strong>AngularJS</strong> project, inside of ASP.NET MVC using Web API. It works great except when you try to go directly to an angular routed URL or refresh the page. Rather than monkeying with server config, I thought this would be something I could handle with <strong>MVC's routing engi... | 19,643,149 | 6 | 3 | null | 2013-10-28 19:03:34.167 UTC | 19 | 2020-06-21 18:11:01.42 UTC | 2014-06-17 10:03:49.18 UTC | null | 122,005 | null | 1,187,752 | null | 1 | 55 | c#|asp.net|asp.net-mvc|asp.net-mvc-4|angularjs | 35,972 | <p>Use a wildcard segment:</p>
<pre><code>routes.MapRoute(
name: "Default",
url: "{*anything}",
defaults: new { controller = "Home", action = "Index" }
);
</code></pre> |
24,865,501 | Chart.js: chart not displayed | <p>I'd like to use <strong><a href="http://www.chartjs.org/" rel="noreferrer">Chart.js</a></strong> to create stunning charts into a webpage.</p>
<p>Following the documentation, I wrote the code as follows:</p>
<pre><code><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
... | 24,865,688 | 4 | 3 | null | 2014-07-21 12:48:14 UTC | 3 | 2022-09-18 20:50:54.907 UTC | 2014-07-21 12:54:27.733 UTC | null | 2,274,686 | null | 2,274,686 | null | 1 | 22 | javascript|html|html5-canvas | 77,101 | <p>First, you have to put your script after the canvas declaration.
After that, delete the pie options (or define them).</p>
<pre><code><html>
<head>
<meta charset="utf-8"/>
<title>Chart.js demo</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/0.2.0/Char... |
45,046,728 | Unit testing React click outside component | <p>Using the code from <a href="https://stackoverflow.com/a/42234988/766958">this answer</a> to solve clicking outside of a component:</p>
<pre><code>componentDidMount() {
document.addEventListener('mousedown', this.handleClickOutside);
}
componentWillUnmount() {
document.removeEventListener('mousedown', this... | 45,201,372 | 5 | 2 | null | 2017-07-12 01:12:15.2 UTC | 5 | 2020-04-29 00:49:07.91 UTC | 2017-07-12 01:25:02.617 UTC | null | 766,958 | null | 766,958 | null | 1 | 30 | javascript|unit-testing|reactjs|jestjs|enzyme | 24,735 | <pre><code>import { mount } from 'enzyme'
import React from 'react'
import ReactDOM from 'react-dom'
it('Should not call action on click inside the component', () => {
const map = {}
document.addEventListener = jest.fn((event, cb) => {
map[event] = cb
})
const props = {
actions: {
somethi... |
1,040,479 | Documenting C++/CLI library code for use from c# - best tools and practices? | <p>I'm working on a project where a c++/cli library is being used primarily from a c# application.</p>
<p>Is there any way to make the code comments in c++/cli visible to c# intellisence within visual studio?</p>
<p>Assuming there isn't, what would be the best way to document the c++/cli code to enable its easier use... | 1,071,967 | 5 | 0 | null | 2009-06-24 19:34:24.22 UTC | 11 | 2019-03-24 17:27:04.08 UTC | 2010-04-16 20:33:52.023 UTC | null | 1,288 | null | 45,875 | null | 1 | 51 | documentation|c++-cli|doxygen|documentation-generation | 12,209 | <p>I have gotten it to work as follows:</p>
<ol>
<li><p>Use XML style comments for your C++/CLI header entries. This means the full XML comment is required (triple-slash comments, <code><summary></code> tag at a minimum)</p></li>
<li><p>Make sure that the C++ compiler option <a href="http://msdn.microsoft.com/e... |
1,228,701 | Code for decoding/encoding a modified base64 URL (in ASP.NET Framework) | <p>I want to base64 encode data to put it in a URL and then decode it within my HttpHandler.</p>
<p>I have found that <a href="http://en.wikipedia.org/wiki/Base64" rel="noreferrer">Base64 Encoding</a> allows for a '/' character which will mess up my UriTemplate matching. Then I found that there is a concept of a "mod... | 1,228,744 | 5 | 0 | null | 2009-08-04 16:58:54.083 UTC | 43 | 2022-02-18 14:41:32.187 UTC | 2022-02-18 14:41:32.187 UTC | null | 67,593 | null | 74,276 | null | 1 | 121 | c#|url|base64|encode|decode | 102,310 | <p>This ought to pad it out correctly:-</p>
<pre><code> base64 = base64.PadRight(base64.Length + (4 - base64.Length % 4) % 4, '=');
</code></pre> |
233,455 | Webcam usage in C# | <p>I am making a program in C# to connect to a webcam and do some image manipulation with it.</p>
<p>I have a working application that uses win32 api (avicap32.dll) to connect to the webcam and send messages to it that sends it to the clipboard. The problem is that, while accessible from paint, reading it from the prog... | 234,423 | 6 | 0 | null | 2008-10-24 13:06:04.93 UTC | 15 | 2022-06-03 03:28:16.47 UTC | 2022-06-03 03:28:16.47 UTC | null | 19,123,103 | null | 31,151 | null | 1 | 22 | c#|clipboard|webcam | 39,479 | <p>I've recently started doing some hobby work in this area.</p>
<p>We settled on using the <a href="http://sourceforge.net/projects/opencv/" rel="noreferrer">OpenCV</a> library with the <a href="http://code.google.com/p/opencvdotnet/" rel="noreferrer">opencvdotnet</a> wrapper. It supports capturing frames from a web... |
544,791 | Django + PostgreSQL: How to reset primary key? | <p>I have been working on an application in Django. To begin with, for simplicity, I had been using sqlite3 for the database.</p>
<p>However, once I moved to PostgreSQL, I've run into a bit of a problem: the primary key does not reset once I clear out a table.</p>
<p>This app is a game that is played over a long ti... | 545,008 | 6 | 2 | null | 2009-02-13 05:00:33.74 UTC | 13 | 2021-02-01 08:56:51.833 UTC | 2016-09-16 19:02:17.627 UTC | null | 4,370,109 | TM | 12,983 | null | 1 | 31 | django|database|postgresql|primary-key | 15,604 | <p>In your app directory try this:</p>
<pre><code>python manage.py help sqlsequencereset
</code></pre>
<p>Pipe it into psql like this to actually run the reset:</p>
<pre><code>python manage.py sqlsequencereset myapp1 myapp2 | psql
</code></pre>
<p>Edit: here's an example of the output from this command on one of my... |
568,929 | What are the url parameters naming convention or standards to follow | <p>Are there any naming conventions or standards for Url parameters to be followed. I generally use camel casing like <code>userId</code> or <code>itemNumber</code>. As I am about to start off a new project, I was searching whether there is anything for this, and could not find anything. I am not looking at this from a... | 568,999 | 6 | 1 | null | 2009-02-20 09:43:42.12 UTC | 10 | 2019-05-29 10:51:22.51 UTC | 2019-05-29 10:51:22.51 UTC | null | 4,922,375 | Dinesh Manne | 50,853 | null | 1 | 50 | coding-style|web-standards | 46,983 | <p>I recommend reading <a href="http://www.w3.org/Provider/Style/URI" rel="noreferrer">Cool URI's Don't Change</a> by Tim Berners-Lee for an insight into this question. If you're using parameters in your URI, it might be better to rewrite them to reflect what the data actually means.</p>
<p>So instead of having the f... |
442,862 | How can I protect MySQL username and password from decompiling? | <p>Java <code>.class</code> files can be decompiled fairly easily. How can I protect my database if I have to use the login data in the code?</p> | 442,872 | 6 | 7 | null | 2009-01-14 13:04:39.907 UTC | 42 | 2017-10-19 11:48:02.71 UTC | 2012-06-29 20:50:46.133 UTC | William Brendel | 834,176 | Midday | 54,988 | null | 1 | 89 | java|mysql|security|reverse-engineering|decompiling | 48,390 | <p>Never hard-code passwords into your code. This was brought up recently in the <a href="http://blog.codinghorror.com/top-25-most-dangerous-programming-mistakes/" rel="noreferrer">Top 25 Most Dangerous Programming Mistakes</a>:</p>
<blockquote>
<p>Hard-coding a secret account and
password into your software is
... |
32,163,436 | Python Decorator for printing every line executed by a function | <p>I want to, for debugging purposes, print out something pertaining to each and every line executed in a python method. </p>
<p>For example if there was some assignment in the line, i want to print what value was assigned for that variable, and if there was a function call, i want to print out the value returned by t... | 32,261,446 | 1 | 8 | null | 2015-08-23 05:19:30.493 UTC | 16 | 2015-09-03 21:14:52.833 UTC | 2015-08-23 05:26:41.15 UTC | null | 4,054,472 | null | 4,054,472 | null | 1 | 16 | python|debugging|decorator|python-decorators | 3,486 | <p>How about something like this? Would this work for you?</p>
<p>Debug Context:</p>
<pre><code>import sys
class debug_context():
""" Debug context to trace any function calls inside the context """
def __init__(self, name):
self.name = name
def __enter__(self):
print('Entering Debug De... |
21,081,598 | Import Google Play Services library in Android Studio | <p>I have an Android project that has been developed entirely within Android Studio (currently version 4.2, gradle version 1.9-all). I want to add functionality from Google Play Services.</p>
<p>The project is unable to resolve <code>GooglePlayServicesUtil</code>, and when I enter the import manually (shown below), I g... | 21,086,904 | 7 | 4 | null | 2014-01-12 23:19:57.807 UTC | 7 | 2017-05-18 09:28:15.317 UTC | 2020-06-20 09:12:55.06 UTC | null | -1 | null | 697,231 | null | 1 | 51 | java|android|gradle|android-studio|google-play-services | 142,787 | <p>Try this once and make sure you are not getting any error in project Structure saying that "ComGoogleAndroidGmsPlay not added"</p>
<p>Open <code>File > Project Structure</code> and check for below all. If error is shown click on Red bulb marked and click on "Add to dependency".</p>
<p><img src="https://i.stack.... |
54,605,286 | What is destructuring assignment and its uses? | <p>I have been reading about <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment" rel="noreferrer">Destructuring assignment</a> introduced in ES6.</p>
<p>What is the purpose of this syntax, why was it introduced, and what are some examples of how it might be us... | 54,605,288 | 3 | 5 | null | 2019-02-09 10:20:40.697 UTC | 15 | 2021-02-17 21:37:21.067 UTC | 2020-01-23 09:36:05.29 UTC | null | 5,648,954 | null | 9,624,435 | null | 1 | 16 | javascript|ecmascript-6|destructuring|object-destructuring | 4,946 | <blockquote>
<p><em><strong>What is destructuring assignment ?</strong></em></p>
</blockquote>
<p><em>The <strong>destructuring assignment</strong> syntax is a JavaScript expression that makes it possible to unpack values from arrays, or properties from objects, into distinct variables.</em></p>
<p>- <a href="https://d... |
33,260,093 | Node JS and Webpack Unexpected token < | <p>I've started studing <em>Node JS</em>.</p>
<p>So here is my files.</p>
<p><strong><em>index.html</em></strong></p>
<pre><code><!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="app">
<h1>Hello<h1>
</div>
<script src='assets/bundle.js'></s... | 33,260,351 | 5 | 3 | null | 2015-10-21 13:02:56.857 UTC | 12 | 2019-04-20 19:57:26.803 UTC | 2015-10-21 13:12:39.157 UTC | user5471583 | null | user5471583 | null | null | 1 | 27 | javascript|node.js|webpack | 31,837 | <p>Your server:</p>
<blockquote>
<pre><code>var Server = http.createServer(function(request, response) {
var filename = path.join(__dirname, 'index.html');
</code></pre>
</blockquote>
<p>… is configured to ignore everything in the request and always return the contents of <code>index.html</code>.</p>
<p>So when th... |
33,119,748 | Convert time.Time to string | <p>I'm trying to add some values from my database to a <code>[]string</code> in Go. Some of these are timestamps.</p>
<p>I get the error:</p>
<blockquote>
<p>cannot use U.Created_date (type time.Time) as type string in array element</p>
</blockquote>
<p>Can I convert <code>time.Time</code> to <code>string</code>?<... | 33,119,937 | 6 | 3 | null | 2015-10-14 07:57:18.757 UTC | 25 | 2021-01-04 18:05:26.82 UTC | 2018-09-04 14:49:53.94 UTC | null | 13,860 | null | 4,273,851 | null | 1 | 156 | string|time|go | 309,924 | <p>You can use the <a href="https://golang.org/pkg/time/#Time.String" rel="noreferrer"><code>Time.String()</code></a> method to convert a <a href="https://golang.org/pkg/time/#Time" rel="noreferrer"><code>time.Time</code></a> to a <code>string</code>. This uses the format string <code>"2006-01-02 15:04:05.99999999... |
33,259,763 | UWP Enable local network loopback | <p>I wrote a UWP-App and after generating and installing the .appxbundle, every time I start the App I get a <code>net_http_client_execution_error</code>. The App is starting and running fine, when started in Visual Studio 2015. So there is no chance for me to get the problem, if I debug the app. <br/></p>
<p><strong>... | 33,263,253 | 1 | 5 | null | 2015-10-21 12:47:56.407 UTC | 18 | 2021-05-11 15:29:03.157 UTC | 2019-03-11 13:36:52.943 UTC | null | 686,985 | null | 5,036,353 | null | 1 | 30 | c#|uwp|win-universal-app | 29,739 | <p>For a line of business app use the checknetisolation.exe tool to grant the app a loopback exception.</p>
<p>To enable loopback use this command:</p>
<pre><code>c:\>checknetisolation loopbackexempt -a -n=<package family name>
</code></pre>
<p>To disable loopback use this command:</p>
<pre><code>c:\>ch... |
1,913,685 | How to copy views from one database to another database | <p>I have two databases with same structure in MS SQL server.</p>
<p>I'd like to copy all views another database.</p>
<p>I tried to use Export data functionality by DTS (that works with the table objects).</p>
<p>But that executes the SQL & creates the table object.</p>
<p>I don't want to execute that just want... | 1,913,707 | 5 | 0 | null | 2009-12-16 10:19:00.143 UTC | 8 | 2018-11-27 09:38:09.27 UTC | null | null | null | null | 415,865 | null | 1 | 25 | sql-server|views | 80,244 | <p>Right click on your database and say Tasks->Generate scripts. SQL Server Management Studio is able to generate the CREATE scripts for you.</p>
<p>Then you simple copy this script and execute it on the target server/database.</p> |
1,387,354 | How Would I Change ASP.NET MVC Views Based on Device Type? | <p>I'm working my way through some ASP.NET MVC reading and I have a web app at work that I'll be migrating from WebForms to MVC. One of the feature requests I expect to get in the process is to have a simplified view returned if the user is coming from a mobile device. </p>
<p>I can't quite see where the best place ... | 1,387,555 | 5 | 0 | null | 2009-09-07 02:40:36.793 UTC | 21 | 2013-04-05 12:33:53.377 UTC | 2009-09-07 02:46:21.027 UTC | null | 19,626 | null | 19,626 | null | 1 | 27 | asp.net-mvc|views|mobile-devices | 11,956 | <p><strong>Update</strong>: This solution has a subtle bug. The MVC framework will call into <code>FindView</code>/<code>FindPartialView</code> twice: once with <code>useCache=true</code>, and if that doesn't return a result, once with <code>useCache=false</code>. Since there's only one cache for all types of views, m... |
2,088,969 | Generating confirmation code for an email confirmation | <p>Using PHP, what are some ways to generate a random confirmation code that can be stored in a DB and be used for email confirmation? I can't for the life of me think of a way to generate a unique number that can be generated from a user's profile. That way I can use a function to make the number small enough to be in... | 2,088,983 | 5 | 0 | null | 2010-01-18 20:29:10.517 UTC | 33 | 2019-06-04 10:05:10.337 UTC | 2012-06-22 13:01:44.207 UTC | null | 250,259 | null | 166,836 | null | 1 | 34 | php|email-validation | 51,293 | <pre><code>$random_hash = md5(uniqid(rand(), true));
</code></pre>
<p>That will be 32 alphanumeric characters long and unique. If you want it to be shorter just use substr():</p>
<pre><code>$random_hash = substr(md5(uniqid(rand(), true)), 16, 16); // 16 characters long
</code></pre>
<p>Alternative methods to generat... |
1,904,049 | In F# what does the >> operator mean? | <p>I noticed in some code in this <a href="http://www.navision-blog.de/2009/12/12/christmas-tree-in-fsharp/" rel="noreferrer">sample</a> that contained the >> operator:</p>
<pre><code>let printTree =
tree >> Seq.iter (Seq.fold (+) "" >> printfn "%s")
</code></pre>
<p>What does the >> operator mean/do?</... | 1,904,063 | 5 | 6 | null | 2009-12-14 22:44:39.393 UTC | 9 | 2019-08-06 11:19:07.427 UTC | 2019-08-06 11:19:07.427 UTC | null | 3,345,375 | null | 154,186 | null | 1 | 44 | f#|operators | 15,441 | <p>It's the function composition operator.</p>
<p>More info on <a href="http://blogs.msdn.com/chrsmith/archive/2008/06/14/function-composition.aspx" rel="noreferrer">Chris Smith's blogpost</a>.</p>
<blockquote>
<p>Introducing the Function Composition
operator (>>):</p>
<p><code>let inline (>>) f g x = ... |
2,295,119 | When should I use attribute in C#? | <p>I saw some of the examples of utilize attribute, e.g.
(as a map for dynamic factory)
<a href="http://msdn.microsoft.com/en-us/magazine/cc164170.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/magazine/cc164170.aspx</a></p>
<p>Just wondering what is the advantage of using attribute?
I can find the reference o... | 2,295,161 | 5 | 1 | null | 2010-02-19 09:17:33.287 UTC | 13 | 2020-06-04 19:08:39.533 UTC | 2012-09-21 15:32:21.823 UTC | null | 512,251 | null | 275,133 | null | 1 | 50 | c#|attributes | 25,191 | <p>In the .NET Framework, attributes can be used for many reasons -- like</p>
<ul>
<li><p>Defining which classes are
serializable </p></li>
<li><p>Choosing which methods are exposed in
a Web service</p></li>
</ul>
<p><code>Attributes</code> allow us to add <code>descriptions</code> to classes, properties, and methods... |
1,384,163 | Looking for a web based diff component | <p>In a content management system, moderators have to approve changes to existing articles. Currently the system shows the old and the revised version of the text in plain text. It is a pain to find the actual differences.</p>
<p>In GoogleDocs, there is a 'Compare revisions' feature which highlights the differences be... | 1,384,190 | 6 | 1 | null | 2009-09-05 20:16:02.373 UTC | 9 | 2017-02-16 01:52:57.02 UTC | null | null | null | null | 66,169 | null | 1 | 17 | diff|compare | 9,583 | <p>John Resig wrote one in JavaScript that looks interesting.</p>
<p><a href="http://ejohn.org/projects/javascript-diff-algorithm/" rel="nofollow noreferrer">Here it is</a>.</p> |
1,808,036 | Is SqlCommand.Dispose() required if associated SqlConnection will be disposed? | <p>I usually use code like this:</p>
<pre><code>using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConn"].ConnectionString))
{
var command = connection.CreateCommand();
command.CommandText = "...";
connection.Open();
command.ExecuteNonQuery();
}
</code></pre>
<p>Will my <c... | 1,808,056 | 6 | 0 | null | 2009-11-27 10:47:21.713 UTC | 7 | 2020-03-17 00:27:54.28 UTC | null | null | null | null | 41,956 | null | 1 | 30 | c#|ado.net|dispose|sqlconnection|sqlcommand | 35,127 | <p>Just do this:</p>
<pre><code>using(var connection = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConn"].ConnectionString))
using(var command = connection.CreateCommand())
{
command.CommandText = "...";
connection.Open();
command.ExecuteNonQuery();
}
</code></pre>
<p>Not calling dispose on t... |
1,618,280 | Where can I set path to make.exe on Windows? | <p>When I try run <code>make</code> from cmd-console on Windows, it runs Turbo Delphi's <code>make.exe</code> but I need MSYS's <code>make.exe</code>. There is no mention about Turbo Delphi in <code>%path%</code> variable, maybe I can change it to MSYS in registry?</p> | 1,618,297 | 6 | 1 | null | 2009-10-24 15:33:09.19 UTC | 17 | 2021-06-17 17:54:34.17 UTC | 2021-06-17 14:49:52.903 UTC | null | 2,756,409 | null | 1,760,643 | null | 1 | 55 | c++|registry|makefile|path|msys | 232,156 | <p>The path is in the registry but usually you edit through this interface:</p>
<ol>
<li>Go to <code>Control Panel</code> -> <code>System</code> -> <code>System settings</code> -> <code>Environment Variables</code>.</li>
<li>Scroll down in system variables until you find <code>PATH</code>.</li>
<li>Click edit and chan... |
2,200,566 | Using keep-alive feature in .htaccess | <p>I want to use the <code>keep-alive</code> feature in Apache. How can I do this with my host (.htaccess file), and what are the best values for the parameters like <code>KeepAliveTimeout</code>?</p> | 2,200,697 | 7 | 0 | null | 2010-02-04 14:54:42.347 UTC | 9 | 2017-07-15 03:54:29.917 UTC | 2017-03-31 14:06:33.907 UTC | null | 1,183,764 | null | 129,099 | null | 1 | 28 | apache|.htaccess | 74,258 | <p>You can't control keepalive behaviour in an <code>.htaccess</code>. Keepalives are a host-level feature, not one where different directories can behave differently depending on the per-directory htaccess info.</p>
<p>If you are on the kind of basic shared hosting that only gives you <code>.htaccess</code> to config... |
1,563,844 | Best HashTag Regex | <p>I'm trying to find all the hash tags in a string. The hashtags are from a stream like twitter, they could be anywhere in the text like:</p>
<blockquote>
<p>this is a #awesome event, lets use the
tag #fun</p>
</blockquote>
<p>I'm using the .NET framework (c#), I was thinking this would be a suitable regex patte... | 1,563,867 | 9 | 0 | null | 2009-10-14 01:40:51.183 UTC | 15 | 2019-04-25 01:24:44.763 UTC | 2012-12-10 18:38:20.887 UTC | user195488 | null | user189528 | null | null | 1 | 12 | .net|regex|twitter | 34,170 | <p>It depends on whether you want to match hashtags inside other strings ("Some#Word") or things that probably aren't hashtags ("We're #1"). The regex you gave <code>#\w+</code> will match in both these cases. If you slightly modify your regex to <code>\B#\w\w+</code>, you can eliminate these cases and only match has... |
1,596,337 | How to exclude designer.cs from Visual Studio file search | <p>Is there a way to exclude a particular type of .cs file when doing a search in Visual Studio 2005/8?</p>
<p><strong>Example:</strong> In a refactoring scenario i might search to identify string literals in my code so that i can refactor them into constants or some such. However, *designer.cs files are full of strin... | 28,427,240 | 10 | 2 | null | 2009-10-20 18:04:32.03 UTC | 10 | 2020-07-06 17:53:36.247 UTC | null | null | null | null | 47,550 | null | 1 | 50 | visual-studio|search | 16,846 | <p>I see it's pretty late, but looking at the number of votes and activity on this page, I'm posting my answer; maybe someone else finds it useful. Here's how you can do this in VS2010 and above:</p>
<ol>
<li>Open Package Manager Console (Tools > NuGet Package Manager > Package Manager Console). Let PowerShell initial... |
1,943,892 | SQL Server PRINT SELECT (Print a select query result)? | <p>I am trying to print a selected value, is this possible?</p>
<p>Example:</p>
<pre><code>PRINT
SELECT SUM(Amount) FROM Expense
</code></pre> | 1,943,913 | 10 | 2 | null | 2009-12-22 02:44:16.367 UTC | 12 | 2020-10-16 11:45:41.04 UTC | 2010-01-01 19:51:24.037 UTC | null | 4,035 | null | 75,500 | null | 1 | 81 | sql-server|tsql|select-query | 354,072 | <p>You know, there might be an easier way but the first thing that pops to mind is:</p>
<pre><code>Declare @SumVal int;
Select @SumVal=Sum(Amount) From Expense;
Print @SumVal;
</code></pre>
<p>You can, of course, print any number of fields from the table in this way. Of course, if you want to print all of the result... |
33,646,049 | How to Customise the angular material date-picker? | <p>I am using the material design date picker </p>
<pre><code><md-content flex class="padding-top-0 padding-bottom-0" layout="row">
<md-datepicker ng-model="user.submissionDate" md-placeholder="Start date" flex ng-click="ctrl.openCalendarPane($event)"></md-datepicker>
... | 33,699,069 | 4 | 2 | null | 2015-11-11 07:36:39.633 UTC | 8 | 2017-08-16 16:30:10.093 UTC | 2015-11-11 08:37:01.837 UTC | null | 1,391,499 | null | 1,391,499 | null | 1 | 13 | javascript|html|css|angularjs|angular-material | 38,652 | <p>Use the function for manipulate event and hide image of calendar as:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var app = angular.module('StarterApp', ['ngMaterial'])... |
18,111,739 | Why do some Android phones cause our app to throw an java.lang.UnsatisfiedLinkError? | <p>We're experiencing a <code>java.lang.UnsatisfiedLinkError</code> on some of the Android phones that are using our app in the market.</p>
<p><strong>Problem description:</strong></p>
<pre><code>static
{
System.loadLibrary("stlport_shared"); // C++ STL
System.loadLibrary("lib2");
System.loadLibr... | 24,296,556 | 5 | 12 | null | 2013-08-07 19:06:27.457 UTC | 21 | 2021-06-28 20:01:06.383 UTC | 2016-02-25 00:39:19.81 UTC | null | 366,967 | null | 366,967 | null | 1 | 42 | android|android-ndk|java-native-interface|native|unsatisfiedlinkerror | 16,129 | <p>I have the same trouble, and the UnsatisfiedLinkErrors comes on all versions of Android - over the past 6 months, for an app that currently has over 90000 active installs, I had:</p>
<pre><code>Android 4.2 36 57.1%
Android 4.1 11 17.5%
Android 4.3 8 12.7%
Android 2.3.x 6 9.5%
Android 4.4 1 ... |
17,911,091 | Append integer to beginning of list in Python | <p>How do I prepend an integer to the beginning of a list?</p>
<pre><code>[1, 2, 3] ⟶ [42, 1, 2, 3]
</code></pre> | 17,911,209 | 10 | 1 | null | 2013-07-28 17:54:33.54 UTC | 97 | 2022-07-28 09:04:27.55 UTC | 2022-07-28 09:04:27.55 UTC | null | 365,102 | null | 1,509,744 | null | 1 | 704 | python|list|prepend | 1,148,608 | <pre><code>>>> x = 42
>>> xs = [1, 2, 3]
>>> xs.insert(0, x)
>>> xs
[42, 1, 2, 3]
</code></pre>
<p>How it works:</p>
<p><code>list.insert(index, value)</code></p>
<p>Insert an item at a given position. The first argument is the index of the element before which to insert, so <code>xs... |
17,870,303 | IDE "Cannot Resolve @style/Theme.Appcompat" when using v7 compatibility support theme | <p>This is not really a huge issue, as my project still builds and runs correctly (using gradle), but I'm having trouble getting Android Studio to recognize the application compatibility theme released in the API 18 SDK (for allowing actionbar support for android 2.1 and above).</p>
<p>I have the support libraries loa... | 18,649,788 | 13 | 6 | null | 2013-07-25 23:09:54.813 UTC | 7 | 2019-02-07 23:48:40.067 UTC | 2013-08-04 07:52:35.243 UTC | null | 1,197,775 | null | 342,745 | null | 1 | 41 | android|eclipse|android-studio|android-support-library | 55,662 | <p>This problem was fixed in Android Studio v0.2.7.</p>
<ul>
<li><a href="https://code.google.com/p/android/issues/detail?id=56312" rel="nofollow">https://code.google.com/p/android/issues/detail?id=56312</a></li>
<li><a href="https://android-review.googlesource.com/#/c/64533/" rel="nofollow">https://android-review.goo... |
16,019,729 | Deserializing JSON object into a C# list | <p>I'm trying to deserialize a given JSON file in C# using a <a href="http://www.billreiss.com/making-json-web-requests-easier-with-async-and-await/" rel="nofollow noreferrer">tutorial by Bill Reiss</a>. For XML data in a non-list this method works pretty well, though I would like to deserialize a JSON file with the fo... | 16,020,050 | 1 | 3 | null | 2013-04-15 16:02:14.773 UTC | 3 | 2016-12-15 15:52:16.193 UTC | 2016-12-15 15:52:16.193 UTC | null | 236,247 | null | 2,282,587 | null | 1 | 8 | c#|json|list|json.net|deserialization | 59,423 | <p>So I think you're probably trying to deserialize to the wrong type. If you serialized it to RootObject and try to deserialize to List it's going to fail.</p>
<p>See this example code</p>
<pre><code>public void TestMethod1()
{
var items = new List<Item>
{
... |
15,930,880 | Unlist all list elements in a dataframe | <p>I have a data frame with the following classes of variables for each column:</p>
<pre><code>"date" "numeric" "numeric" "list" "list" "numeric"
</code></pre>
<p>The data in each row looks like this:</p>
<pre><code> 1978-01-01, 12.5, 6.3, c(0,0,0.25,0.45,0.3), c(0,0,0,0.1,0.9), 72
</code></pre>
<p>I would like ... | 15,932,091 | 1 | 1 | null | 2013-04-10 16:02:54.247 UTC | 4 | 2016-03-08 17:36:25.453 UTC | 2013-04-10 16:38:26.207 UTC | null | 1,883,615 | null | 1,883,615 | null | 1 | 10 | r|dataframe | 40,302 | <p>This is somewhat messy and probably pretty inefficient, but should help get you started:</p>
<p>Here's some sample data:</p>
<pre><code>mydf <- data.frame(Date = as.Date(c("1978-01-01", "1978-01-02")),
V1 = c(10, 10),
V2 = c(11, 11))
mydf$V3 <- list(c(1:10),
... |
15,539,617 | String append with format in android | <p>Anybody help me please. I don't know how to append the String with format in android similar to this:</p>
<pre><code>String key = "";
append("%d-%d-%d", 0, 1, 2));
</code></pre>
<p>Please give me an example. Thank you in advance.</p> | 15,539,701 | 3 | 0 | null | 2013-03-21 04:39:36.437 UTC | 1 | 2013-03-21 05:09:58.633 UTC | null | null | null | null | 1,597,700 | null | 1 | 11 | android|string | 42,237 | <p>Use StringBuilder or StringBuffer but with adequate initial capacity to avoid re-allocation. The default capacity is 16, so once you exceed that, the data has to be copied into a new bigger place. Use append not +.</p>
<pre><code>int integer = 5;
StringBuilder s = new StringBuilder(100);
s.append("something");
s... |
35,026,120 | Is there a pure virtual function in the C++ Standard Library? | <p>In <a href="https://isocpp.org/blog/2016/01/functional-programming-in-cpp-nicola-gigante-meetingcpp-2015" rel="nofollow noreferrer">Nicola Gigante's lecture in 2015</a>, he mentions (at the beginning) that there are no pure virtual functions in the Standard Library (or he's not aware of any). I believe that Alex Ste... | 35,026,367 | 2 | 14 | null | 2016-01-26 23:38:10.933 UTC | 4 | 2019-10-26 05:53:10.603 UTC | 2019-10-26 05:53:10.603 UTC | null | 963,864 | null | 4,224,575 | null | 1 | 35 | c++|language-lawyer|virtual-functions|c++-standard-library|pure-virtual | 2,417 | <p><strong>[syserr.errcat.overview]</strong> has <a href="http://en.cppreference.com/w/cpp/error/error_category" rel="noreferrer"><code>std::error_category</code></a></p>
<pre><code>class error_category {
virtual const char* name() const noexcept = 0;
virtual string message(int ev) const = 0;
};
</code></pre>
<p>... |
5,372,872 | MySQL trigger if condition exists | <p>I'm trying to write an update trigger that will only update a password when a new password is set in the update statement but I'm having a terrible time trying to nail down the syntax. This should be a no-brainer but I'm just not finding the solution.</p>
<p>Here's my code:</p>
<pre><code>CREATE TRIGGER upd_user ... | 5,372,987 | 2 | 0 | null | 2011-03-21 01:10:24.447 UTC | 5 | 2021-12-06 18:39:52.757 UTC | null | null | null | null | 319,969 | null | 1 | 16 | mysql|triggers | 129,590 | <p>I think you mean to update it back to the <code>OLD</code> password, when the NEW one is not supplied.</p>
<pre><code>DROP TRIGGER IF EXISTS upd_user;
DELIMITER $$
CREATE TRIGGER upd_user BEFORE UPDATE ON `user`
FOR EACH ROW BEGIN
IF (NEW.password IS NULL OR NEW.password = '') THEN
SET N... |
875,033 | Getters/setters in Java | <p>I'm new to Java, but have some OOP experience with ActionScript 3, so I'm trying to migrate relying on stuff I know.</p>
<p>In ActionScript 3 you can create getters and setters using the get and set keywords, meaning you create a method in the class and access data through a property of an instance of that class. I... | 875,041 | 7 | 1 | null | 2009-05-17 17:24:54.54 UTC | 2 | 2012-03-06 23:25:33.163 UTC | 2010-09-18 11:20:26.823 UTC | null | 63,550 | null | 89,766 | null | 1 | 23 | java|actionscript-3|setter|getter|accessor | 45,185 | <p>Nope. AS3 getters and setters are an ECMAScript thing. In Java, you're stuck with the getVal() and setVal() style functions--there isn't any syntactic sugar to make things easy for you.</p>
<p>I think Eclipse can help auto-generating those types of things though...</p> |
749,622 | How to get Return Value of a Stored Procedure | <p>Probably an easy-to-answer question. I have this procedure:</p>
<pre><code>CREATE PROCEDURE [dbo].[AccountExists]
@UserName nvarchar(16)
AS
IF EXISTS (SELECT Id FROM Account WHERE UserName=@UserName)
SELECT 1
ELSE SELECT 0
</code></pre>
<p>When I have ADO.NET code that calls this procedure and does this:</p>
... | 749,633 | 7 | 2 | null | 2009-04-14 22:39:36.727 UTC | 9 | 2017-10-05 10:13:52.837 UTC | 2012-06-14 22:28:02.35 UTC | null | 76,337 | null | 11,574 | null | 1 | 35 | sql|tsql|stored-procedures|ado.net | 63,459 | <p>Add a parameter, using <code>ParameterDirection.ReturnValue</code>. The return value will be present in the paramter after the execution.</p> |
240,244 | vim -- How to read range of lines from a file into current buffer | <p>I want to read line n1->n2 from file foo.c into the current buffer.</p>
<p>I tried: <code>147,227r /path/to/foo/foo.c</code></p>
<p>But I get: "E16: Invalid range", though I am certain that foo.c contains more than 1000 lines.</p> | 240,274 | 7 | 0 | null | 2008-10-27 15:12:27.97 UTC | 25 | 2019-11-25 00:44:22.17 UTC | 2012-08-14 04:16:47.29 UTC | null | 128,421 | Aman Jain | 29,405 | null | 1 | 67 | vim | 34,678 | <pre><code>:r! sed -n 147,227p /path/to/foo/foo.c
</code></pre> |
491,376 | Why doesn't .NET/C# optimize for tail-call recursion? | <p>I found <a href="https://stackoverflow.com/questions/340762/which-languages-support-tail-recursion-optimization">this question</a> about which languages optimize tail recursion. Why C# doesn't optimize tail recursion, whenever possible?</p>
<p>For a concrete case, why isn't this method optimized into a loop (<a hre... | 491,463 | 7 | 4 | null | 2009-01-29 12:20:21.227 UTC | 33 | 2021-11-11 21:03:05.033 UTC | 2017-05-23 12:17:52.443 UTC | null | -1 | ripper234 | 11,236 | null | 1 | 122 | c#|.net|optimization|tail-recursion | 35,552 | <p>JIT compilation is a tricky balancing act between not spending too much time doing the compilation phase (thus slowing down short lived applications considerably) vs. not doing enough analysis to keep the application competitive in the long term with a standard ahead-of-time compilation.</p>
<p>Interestingly the <a ... |
330,737 | jQuery datepicker- 2 inputs/textboxes and restricting range | <p>I am using the jQuery Datepicker widget with two input boxes, one for the <strong>"From"</strong> date and the second with the <strong>"To"</strong> date. I am using the <a href="http://jqueryui.com/datepicker/" rel="noreferrer">jQuery Datepicker functional demo</a> as a basis for getting the two input boxes to work... | 333,585 | 8 | 1 | null | 2008-12-01 12:49:37.677 UTC | 33 | 2014-03-21 21:50:05.707 UTC | 2014-03-21 21:50:05.707 UTC | Russ Cam | 814,702 | Russ Cam | 1,831 | null | 1 | 53 | jquery|jquery-plugins|datepicker|jquery-ui-datepicker | 95,649 | <p>Many thanks for your help Ben, I have built upon your posts and have come up with this. It is now complete and works brilliantly!</p>
<p>Here's a <strong><a href="http://jsbin.com/evudo" rel="noreferrer">Working Demo</a></strong>. Add <strong>/edit</strong> to the URL to see the code</p>
<p>Complete Code below-</p... |
1,296,501 | Find path to currently running file | <p>How can I find the full path to the currently running Python script? That is to say, what do I have to do to achieve this:</p>
<pre><code>$ pwd
/tmp
$ python baz.py
running from /tmp
file is baz.py
</code></pre> | 1,297,407 | 8 | 1 | null | 2009-08-18 21:02:54.523 UTC | 18 | 2019-08-01 06:45:03.24 UTC | 2019-08-01 06:45:03.24 UTC | null | 6,862,601 | null | 422 | null | 1 | 53 | python | 97,431 | <p><strong><code>__file__</code> is NOT what you are looking for.</strong> Don't use accidental side-effects</p>
<p><code>sys.argv[0]</code> is <strong>always</strong> the path to the script (if in fact a script has been invoked) -- see <a href="http://docs.python.org/library/sys.html#sys.argv" rel="noreferrer">http:/... |
502,002 | How do I move a file to the Recycle Bin using PowerShell? | <p>When using the <code>rm</code> command to delete files in Powershell, they are permanently deleted.</p>
<p>Instead of this, I would like to have the deleted item go to the recycle bin, like what happens when files are deleted through the UI.</p>
<p>How can you do this in PowerShell?</p> | 503,768 | 8 | 1 | null | 2009-02-02 01:47:04.373 UTC | 18 | 2022-07-01 05:48:44.907 UTC | 2022-07-01 05:48:44.907 UTC | null | 13,710,015 | null | 1,496 | null | 1 | 54 | powershell|recycle-bin | 29,863 | <p>Here is a shorter version that reduces a bit of work</p>
<pre><code>$path = "<path to file>"
$shell = new-object -comobject "Shell.Application"
$item = $shell.Namespace(0).ParseName("$path")
$item.InvokeVerb("delete")
</code></pre> |
426,609 | How to assign Profile values? | <p>I don't know what I am missing, but I added Profile properties in the Web.config file but cannot access Profile.<em>Item</em> in the code or create a new profile.</p> | 1,111,714 | 10 | 0 | null | 2009-01-09 00:16:58.267 UTC | 71 | 2015-11-27 16:56:58.293 UTC | 2010-05-22 12:50:31.777 UTC | null | 6,068 | zsharp | 49,632 | null | 1 | 110 | asp.net|asp.net-mvc|asp.net-membership|profile | 60,379 | <p>I had the same problem today, and learned a lot.</p>
<p>There are two kinds of project in Visual Studio -- "Web Site Projects" and "Web Application Projects." For reasons which are a complete mystery to me, Web Application Projects cannot use <strong>Profile.</strong> directly... the strongly-typed class is not mag... |
1,222,935 | Why don't structs support inheritance? | <p>I know that structs in .NET do not support inheritance, but its not exactly clear <em>why</em> they are limited in this way.</p>
<p>What technical reason prevents structs from inheriting from other structs?</p> | 1,223,227 | 10 | 6 | null | 2009-08-03 15:19:50.493 UTC | 41 | 2015-10-09 11:53:04.31 UTC | 2009-08-03 22:26:48.237 UTC | null | 82,118 | null | 40,516 | null | 1 | 139 | .net|inheritance|struct | 37,634 | <p>The reason value types can't support inheritance is because of arrays.</p>
<p>The problem is that, for performance and GC reasons, arrays of value types are stored "inline". For example, given <code>new FooType[10] {...}</code>, if <code>FooType</code> is a reference type, 11 objects will be created on the managed... |
462,477 | sql primary key and index | <p>Say I have an ID row (int) in a database set as the primary key. If I query off the ID often do I also need to index it? Or does it being a primary key mean it's already indexed?</p>
<p>Reason I ask is because in MS SQL Server I can create an index on this ID, which as I stated is my primary key.</p>
<p>Edit: an a... | 462,578 | 11 | 0 | null | 2009-01-20 18:28:00.21 UTC | 18 | 2021-08-07 14:50:59.83 UTC | 2020-09-17 12:29:05.953 UTC | danifo | 1,080,354 | danifo | 56,302 | null | 1 | 112 | sql|sql-server|tsql|indexing|primary-key | 114,989 | <p>You are right, it's confusing that SQL Server allows you to create duplicate indexes on the same field(s). But the fact that you can create another doesn't indicate that the PK index doesn't also already exist.</p>
<p>The additional index does no good, but the only harm (very small) is the additional file size and ... |
326,062 | In STL maps, is it better to use map::insert than []? | <p>A while ago, I had a discussion with a colleague about how to insert values in STL <a href="http://www.sgi.com/tech/stl/Map.html" rel="noreferrer">maps</a>. I preferred <code>map[key] = value;</code> because it feels natural and is clear to read whereas he preferred <code>map.insert(std::make_pair(key, value))</code... | 327,289 | 13 | 6 | null | 2008-11-28 15:42:52.337 UTC | 93 | 2020-08-10 12:33:10.85 UTC | 2020-08-10 12:33:10.85 UTC | danio | 2,675,154 | danio | 12,663 | null | 1 | 209 | c++|dictionary|stl|insert|stdmap | 164,481 | <p>When you write</p>
<pre><code>map[key] = value;
</code></pre>
<p>there's no way to tell if you <strong>replaced</strong> the <code>value</code> for <code>key</code>, or if you <strong>created</strong> a new <code>key</code> with <code>value</code>.</p>
<p><a href="http://en.cppreference.com/w/cpp/container/map/in... |
171,326 | How can I increase the key repeat rate beyond the OS's limit? | <p>I have a bad habit of using the cursor keys of my keyboard to navigate source code. It's something I've done for 15 years and this of course means that my navigating speed is limited by the speed of the keyboard. On both Vista and OS X (I dual boot a MacBook), I have my key repeat rate turned all the way up. But in ... | 429,465 | 15 | 0 | null | 2008-10-05 01:33:28.903 UTC | 33 | 2021-06-26 10:25:22.06 UTC | 2016-10-06 11:49:10.01 UTC | ΤΖΩΤΖΙΟΥ | 19,405 | Frank Krueger | 338 | null | 1 | 60 | windows|visual-studio|macos|keyboard | 44,605 | <p>On Mac OS X, open the Global Preferences plist</p>
<pre><code>open ~/Library/Preferences/.GlobalPreferences.plist
</code></pre>
<p>Then change the KeyRepeat field. Smaller numbers will speed up your cursor rate. The settings dialog will only set it to a minimum of 2, so if you go to 0 or 1, you'll get a faster cur... |
203,174 | Is there a Java API that can create rich Word documents? | <p>I have a new app I'll be working on where I have to generate a Word document that contains tables, graphs, a table of contents and text. What's a good API to use for this? How sure are you that it supports graphs, ToCs, and tables? What are some hidden gotcha's in using them?</p>
<p>Some clarifications:</p>
<ul... | 257,001 | 16 | 4 | null | 2008-10-14 23:09:59.847 UTC | 63 | 2018-09-21 02:16:19.643 UTC | 2018-09-20 17:39:16.307 UTC | Bill James | 4,815,184 | Bill James | 13,824 | null | 1 | 112 | java|ms-word|docx|doc | 155,294 | <p>In 2007 my project successfully used OpenOffice.org's <a href="https://www.openoffice.org/udk/common/man/uno.html" rel="noreferrer">Universal Network Objects</a> (UNO) interface to programmatically generate MS-Word compatible documents (*.doc), as well as corresponding PDF documents, from a Java Web application (a S... |
562,904 | Clustering Algorithm for Paper Boys | <p>I need help selecting or creating a clustering algorithm according to certain criteria.</p>
<p>Imagine you are managing newspaper delivery persons.</p>
<ul>
<li>You have a set of street addresses, each of which is geocoded.</li>
<li>You want to cluster the addresses so that each cluster is assigned to a delivery p... | 563,091 | 17 | 7 | null | 2009-02-18 21:25:06.177 UTC | 24 | 2021-03-03 02:19:38.29 UTC | 2009-03-05 15:34:09.983 UTC | carrier | 20,498 | carrier | 20,498 | null | 1 | 34 | algorithm|language-agnostic|cluster-analysis | 5,532 | <p>I think you want a <a href="http://en.wikipedia.org/wiki/Hierarchical_clustering#Hierarchical_clustering" rel="noreferrer">hierarchical agglomeration</a> technique rather than k-means. If you get your algorithm right you can stop it when you have the right number of clusters. As someone else mentioned you can seed... |
1,334,143 | DateTime2 vs DateTime in SQL Server | <p>Which one: </p>
<ul>
<li><a href="https://msdn.microsoft.com/en-us/library/ms187819.aspx" rel="noreferrer"><code>datetime</code></a></li>
<li><a href="https://msdn.microsoft.com/en-us/library/bb677335.aspx" rel="noreferrer"><code>datetime2</code></a></li>
</ul>
<p>is <em>the</em> recommended way to store date and ... | 1,884,088 | 17 | 0 | null | 2009-08-26 11:45:10.697 UTC | 139 | 2022-09-11 11:22:47.607 UTC | 2017-03-20 19:25:50.977 UTC | null | 41,956 | null | 158,801 | null | 1 | 853 | sql|sql-server|tsql|datetime|datetime2 | 602,718 | <p>The MSDN documentation for <a href="http://technet.microsoft.com/en-us/library/ms187819.aspx" rel="noreferrer">datetime</a> recommends using <a href="http://technet.microsoft.com/en-us/library/bb677335.aspx" rel="noreferrer">datetime2</a>. Here is their recommendation:</p>
<blockquote>
<p>Use the <code>time</code... |
64,649 | How do I get the find command to print out the file size with the file name? | <p>If I issue the <a href="https://en.wikipedia.org/wiki/Find_(Unix)" rel="noreferrer">find</a> command as follows:</p>
<pre><code>find . -name *.ear
</code></pre>
<p>It prints out:</p>
<pre><code>./dir1/dir2/earFile1.ear
./dir1/dir2/earFile2.ear
./dir1/dir3/earFile1.ear
</code></pre>
<p>I want to 'print' the name and ... | 64,699 | 17 | 0 | 2009-05-06 04:08:09.053 UTC | 2008-09-15 16:53:13.353 UTC | 36 | 2022-01-18 17:28:20.773 UTC | 2022-01-18 17:21:01.917 UTC | null | 63,550 | Brian | 700 | null | 1 | 150 | unix|command-line|find|solaris | 192,304 | <pre><code>find . -name '*.ear' -exec ls -lh {} \;
</code></pre>
<p>just the h extra from jer.drab.org's reply. saves time converting to MB mentally ;)</p> |
1,262,737 | IntelliJ IDEA way of editing multiple lines | <p>I've seen this done in TextMate and I was wondering if there's a way to do it in IDEA.</p>
<p>Say I have the following code:</p>
<pre><code> leaseLabel = "Lease";
leaseLabelPlural = "Leases";
portfolioLabel = "Portfolio";
portfolioLabelPlural = "Portfolios";
buildingLabel = "Building";
</code></pre>
<p>What i... | 22,526,528 | 21 | 4 | null | 2009-08-11 20:29:55.74 UTC | 41 | 2021-11-19 12:27:33.977 UTC | 2020-01-28 19:07:20.137 UTC | null | 974,045 | null | 125,491 | null | 1 | 186 | java|android-studio|intellij-idea|ide|text-editor | 149,794 | <p>Since Idea IntelliJ IDEA 13.1 there is a possibility to edit multiple lines.</p>
<h2>Windows</h2>
<p><kbd>Alt</kbd> + <kbd>Shift</kbd> + Mouse click</p>
<h2>macOS</h2>
<p><kbd>Option</kbd> + <kbd>Shift</kbd> + Mouse click</p>
<p>for selection. More about this new improvement in the IntelliJ blog post <a href="http:/... |
468,119 | What's the best way to calculate the size of a directory in .NET? | <p>I've written the following routine to manually traverse through a directory and calculate its size in C#/.NET:</p>
<pre>
<code>
protected static float CalculateFolderSize(string folder)
{
float folderSize = 0.0f;
try
{
//Checks if the path is valid or not
if (!Directory.Exists(folder))
... | 468,143 | 23 | 0 | null | 2009-01-22 05:21:16.647 UTC | 22 | 2022-07-07 11:12:49.033 UTC | null | null | null | Steve W | 3,429 | null | 1 | 86 | c#|.net|windows | 121,547 | <p>I do not believe there is a Win32 API to calculate the space consumed by a directory, although I stand to be corrected on this. If there were then I would assume Explorer would use it. If you get the Properties of a large directory in Explorer, the time it takes to give you the folder size is proportional to the num... |
6,979,747 | Read stdin stream in a batch file | <p>Is it possible to use a piped stdin stream inside a batch file?</p>
<p>I want to be able to redirect the output of one command into my batch file <code>process.bat</code> list so:</p>
<pre><code>C:\>someOtherProgram.exe | process.bat
</code></pre>
<p>My first attempt looked like:</p>
<pre><code>echo OFF
setlo... | 6,980,605 | 4 | 1 | null | 2011-08-08 08:57:47.633 UTC | 12 | 2022-03-09 06:41:04.44 UTC | 2013-06-05 10:16:08.23 UTC | null | 611,007 | null | 305,264 | null | 1 | 38 | windows|batch-file|stdout|stdin | 34,903 | <p><code>set /p</code> doesn't work with pipes, it takes one (randomly) line from the input.<br />
But you can use <code>more</code> inside of an for-loop.</p>
<pre><code>@echo off
setlocal
for /F "tokens=*" %%a in ('more') do (
echo #%%a
)
</code></pre>
<p>But this fails with lines beginning with a semicol... |
6,895,098 | PDO/MySQL memory consumption with large result set | <p>I'm having a strange time dealing with selecting from a table with about 30,000 rows.</p>
<p>It seems my script is using an outrageous amount of memory for what is a simple, forward only walk over a query result.</p>
<p>Please note that this example is a somewhat contrived, absolute bare minimum example which bear... | 6,935,271 | 5 | 1 | null | 2011-08-01 06:59:39.8 UTC | 12 | 2013-05-12 21:15:25.11 UTC | 2011-08-04 01:54:28.75 UTC | null | 15,004 | null | 15,004 | null | 1 | 25 | php|mysql|pdo | 25,584 | <p>After creating the connection, you need to set <a href="http://www.php.net/manual/en/ref.pdo-mysql.php" rel="noreferrer"><code>PDO::MYSQL_ATTR_USE_BUFFERED_QUERY</code></a> to false:</p>
<pre><code><?php
$pdo = new PDO('mysql:host=127.0.0.1', 'foo', 'bar', array(
PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION,... |
6,329,468 | How to create a HTTP server in Android? | <p>I would like to create a simple HTTP server in Android for serving some content to a client.</p>
<p>Any advice on how to build the server or use any existing library? </p> | 6,329,508 | 6 | 1 | null | 2011-06-13 10:52:36.263 UTC | 70 | 2020-09-09 10:09:12.66 UTC | 2016-05-21 14:48:54.26 UTC | null | 4,717,992 | null | 217,527 | null | 1 | 127 | android|http | 151,313 | <p>Consider this one:
<a href="https://github.com/NanoHttpd/nanohttpd" rel="noreferrer">https://github.com/NanoHttpd/nanohttpd</a>.
Very small, written in Java. I used it without any problem.</p> |
6,390,138 | Combining multiple conditional expressions in C# | <p>In C#, instead of doing <code>if(index == 7 || index == 8)</code>, is there a way to combine them? I'm thinking of something like <code>if(index == (7, 8))</code>.</p> | 6,390,220 | 9 | 4 | null | 2011-06-17 18:28:17.61 UTC | 16 | 2014-10-22 00:18:32.543 UTC | null | null | null | null | 759,705 | null | 1 | 23 | c#|conditional-statements | 3,899 | <p>You can accomplish this with an extension method.</p>
<pre><code>public static bool In<T>(this T obj, params T[] collection) {
return collection.Contains(obj);
}
</code></pre>
<p>Then...</p>
<pre><code>if(index.In(7,8))
{
...
}
</code></pre> |
6,751,920 | Tomcat 7 - Servlet 3.0: Invalid byte tag in constant pool | <ul>
<li>tomcat 7.0.16 </li>
<li>Java 1.6.0_22 </li>
<li>CentOS 5.6</li>
</ul>
<p>I just switched the web.xml to servlet 3.0 (from a app running 2.4 previously) and now I'm seeing the following error (turned on fine logging for org.apache.tomcat.util):</p>
<pre><code>mtyson FINE: Scanning JAR [file:/usr/java/jdk1.6.... | 6,765,398 | 11 | 1 | null | 2011-07-19 18:07:46.55 UTC | 14 | 2022-06-23 09:53:31.747 UTC | 2011-07-20 00:39:49.653 UTC | null | 467,240 | null | 467,240 | null | 1 | 33 | tomcat7|servlet-3.0 | 104,478 | <p>It may not be your issue, but mine was the <a href="http://maven.40175.n5.nabble.com/Problem-when-mvn-site-site-Generating-quot-Dependencies-quot-report-td113470.html" rel="nofollow noreferrer">same as this one</a> -- an old version of <code>com.ibm.icu:icu4j</code>. I solved the problem by changing my build configu... |
15,700,148 | Getting value from html radio button - in aspx-c# | <p>I have the following HTML source</p>
<pre><code><form name="Register1" action="Register.aspx" id="registerform" method="post"
runat="server" style="margin-top: 15px;">
<input type="radio" name="Gender" value="male" />male
<input type="radio" name="Gender" value="female" />female
<... | 15,700,330 | 4 | 4 | null | 2013-03-29 08:56:37.337 UTC | 9 | 2018-10-22 10:33:48.86 UTC | 2013-03-29 09:31:01.21 UTC | null | 184,842 | null | 1,873,436 | null | 1 | 13 | c#|asp.net|html|radio-button|radiobuttonlist | 76,943 | <p>place your code like this:</p>
<pre><code> if (Request.Form["Gender"] != null)
{
string selectedGender = Request.Form["Gender"].ToString();
}
</code></pre>
<p>Note that <code>Request.Form["Gender"]</code> will be null if none of the RadioButtons are selected.</p>
<p>see the markup below</p>
<pre><code><... |
15,726,795 | Offsetting Anchor Links with Fixed Header | <p>There've been a few similar posts (<a href="https://stackoverflow.com/questions/10732690/offsetting-an-html-anchor-to-adjust-for-fixed-header">offsetting an html anchor to adjust for fixed header</a>, for example), but those solution doesn't work for my particular case.</p>
<p>I am using jQuery to populate a Table ... | 15,726,864 | 5 | 0 | null | 2013-03-31 05:55:36.1 UTC | 10 | 2020-11-26 05:45:56.56 UTC | 2017-05-23 12:34:10.563 UTC | null | -1 | null | 1,562,018 | null | 1 | 16 | jquery|html|css|header | 28,652 | <p>You could include <code>padding-top</code> and then use negative <code>margin-top</code> to balance it out.</p>
<p><a href="http://jsfiddle.net/Tyriar/pp9dg/">jsFiddle</a></p>
<pre><code>h2 {
padding-top: 70px;
margin-top: -70px;
}
</code></pre> |
15,532,667 | ASP.NET+Azure 400 Bad Request doesn't return JSON data | <p>There is an action in my ASP.NET MVC controller that returns JSON data with a 400 Bad Request when invalid parameters are passed to the action.</p>
<pre><code>[HttpDelete]
public ActionResult RemoveObject(string id) {
if(!Validate(id)) {
Response.StatusCode = (int)HttpStatusCode.BadRequest;
ret... | 15,532,685 | 1 | 0 | null | 2013-03-20 19:14:10.003 UTC | 14 | 2013-03-20 19:15:03.013 UTC | null | null | null | null | 1,698,415 | null | 1 | 30 | asp.net-mvc|azure | 7,445 | <p>Add the following entry to your 'web.config'.</p>
<pre><code><system.webServer>
<httpErrors existingResponse="PassThrough"/>
</system.webServer>
</code></pre>
<p>This will allow HTTP errors to pass through un-molested.</p> |
35,988,315 | Convert Java List to Scala Seq | <p>I need to implement a method that returns a Scala <code>Seq</code>, in Java.</p>
<p>But I encounter this error:</p>
<pre><code>java.util.ArrayList cannot be cast to scala.collection.Seq
</code></pre>
<p>Here is my code so far:</p>
<pre><code>@Override
public Seq<String> columnNames() {
List<String&g... | 35,988,913 | 7 | 5 | null | 2016-03-14 13:02:04.783 UTC | 6 | 2022-01-03 10:30:04.063 UTC | 2020-02-03 16:11:12.483 UTC | null | 4,708,077 | null | 4,708,077 | null | 1 | 43 | java|scala|seq|scala-java-interop | 68,350 | <p>JavaConverters is what I needed to solve this.</p>
<pre><code>import scala.collection.JavaConverters;
public Seq<String> convertListToSeq(List<String> inputList) {
return JavaConverters.asScalaIteratorConverter(inputList.iterator()).asScala().toSeq();
}
</code></pre> |
10,434,736 | Difference between BufferedReader and BufferedInputStream | <p>What are the differences between <code>BufferedReader</code> , <code>BufferedInputStream</code> and <code>Scanner</code> in java? <code>BufferedReader</code> reads the text and <code>BufferedInputStream</code> reads <code>byte</code>. Is there any difference other than this?</p> | 10,434,770 | 2 | 3 | null | 2012-05-03 15:39:54.533 UTC | 7 | 2017-03-24 12:12:37.563 UTC | 2017-03-24 12:12:37.563 UTC | null | 3,151,210 | null | 1,357,722 | null | 1 | 31 | java|io|java.util.scanner|bufferedreader | 22,523 | <p>I guess, the difference is the same as between reader and inputstream: one is character-based, another is byte-based. For example, reader normally supports encoding...</p>
<p><strong>Edit:</strong> Check this question: <a href="https://stackoverflow.com/questions/5764065/inputstream-and-reader-in-java-io">The diffe... |
37,827,073 | Does this 'for' loop stop, and why/why not? for (var i=0; 1/i > 0; i++) { } | <p>Does this <code>for</code> loop ever stop?</p>
<pre><code>for (var i=0; 1/i > 0; i++) {
}
</code></pre>
<p>If so, when and why? I was told that it stops, but I was given no reason for that.</p>
<h3>Upddate</h3>
<p>As part of the investigation I've written quite lengthy and detailed article that explains everythin... | 37,830,614 | 3 | 12 | null | 2016-06-15 05:48:26.003 UTC | 30 | 2017-08-08 09:59:25.627 UTC | 2020-06-20 09:12:55.06 UTC | null | -1 | null | 2,545,680 | null | 1 | 103 | javascript | 7,628 | <p><em>(I'm not a fan of meta-content, but: <a href="https://stackoverflow.com/a/37827271/157247">gotnull's</a> and <a href="https://stackoverflow.com/a/37827313/157247">le_m's</a> answers are both correct and useful. They were originally, and are <strong>even more so</strong> with the edits made after this Community W... |
41,135,875 | Unable to simulate keypress event in Angular 2 unit test (Jasmine) | <p>I am using a directive to get the data from input used as a filter text.</p>
<p>here is my hostlistener in the directive:</p>
<pre><code>@HostListener('input', ['$event.target.value'])
public onChangeFilter(event: any): void {
console.log('input event fired, value: ' + event);
this.columnFiltering.filter... | 42,156,063 | 3 | 8 | null | 2016-12-14 06:05:28.037 UTC | 4 | 2021-02-16 12:46:17.093 UTC | 2016-12-14 06:13:12.4 UTC | null | 1,124,913 | null | 1,124,913 | null | 1 | 35 | unit-testing|angular|input|jasmine|keypress | 51,148 | <p>I've had some trouble simulating a keypress in a unit test also. But came across an answer by Seyed Jalal Hosseini. It might be what you're after.</p>
<p>If you're attempting to simulate a keypress you can trigger an event by calling <code>dispatchEvent(new Event('keypress'));</code> on the element.</p>
<p>Here is... |
13,296,461 | (Im)perfect forwarding with variadic templates | <h1>Synopsis</h1>
<p>Given a type with a variadic template constructor that forwards the arguments to an implementation class, is it possible to restrict the types being forwarded with SFINAE?</p>
<h1>Details</h1>
<p>First, consider the non-variadic case with a constructor taking a universal reference. Here one can dis... | 13,328,507 | 2 | 1 | null | 2012-11-08 19:38:30.29 UTC | 8 | 2022-06-15 20:02:19.547 UTC | 2022-06-15 20:02:19.547 UTC | null | 4,751,173 | null | 1,170,277 | null | 1 | 14 | c++|c++11|variadic-templates|sfinae|variadic-functions | 2,566 | <p>Here are the different ways to write a properly constrained constructor template, in increasing order of complexity and corresponding increasing order of feature-richness and decreasing order of number of gotchas.</p>
<p><a href="https://rmf.io/cxx11/almost-static-if/" rel="nofollow">This particular form of EnableI... |
13,630,641 | Backup AWS Dynamodb to S3 | <p>It has been suggested on <a href="http://aws.amazon.com/dynamodb/" rel="noreferrer">Amazon docs</a> <a href="http://aws.amazon.com/dynamodb/" rel="noreferrer">http://aws.amazon.com/dynamodb/</a> among other places, that you can backup your dynamodb tables using Elastic Map Reduce,<br>
I have a general understanding ... | 14,689,749 | 9 | 2 | null | 2012-11-29 16:49:27.813 UTC | 16 | 2021-04-11 18:44:05.95 UTC | null | null | null | null | 487,855 | null | 1 | 36 | amazon-s3|backup|amazon-dynamodb|elastic-map-reduce | 44,647 | <p>With introduction of AWS Data Pipeline, with a ready made template for dynamodb to S3 backup, the easiest way is to schedule a back up in the Data Pipeline <a href="http://docs.aws.amazon.com/datapipeline/latest/DeveloperGuide/dp-importexport-ddb-part2.html" rel="noreferrer">[link]</a>, </p>
<p>In case you have s... |
13,501,217 | ggplot2 for grayscale printouts | <p>ggplot2 produces fancy graphs for screen/color prints, but the gray background and the colors interfere when printing them to grayscale. For better readablility, I'd prefer to disable the gray background and use color generators that produce either different shades of gray or different kinds of filling strokes to di... | 13,507,514 | 3 | 0 | null | 2012-11-21 20:07:11.04 UTC | 11 | 2016-01-29 11:52:09.06 UTC | 2012-11-22 07:14:30.243 UTC | null | 419,994 | null | 411,944 | null | 1 | 37 | r|ggplot2 | 63,685 | <p>** EDIT ** Updated code: <code>geom_bar</code> requires a <code>stat</code>.</p>
<p><code>theme_bw</code> could be what you're after. If you are plotting a geom that has a fill such as bars, the <code>scale_fill_grey</code> function will give you control over the shades of grey. If you are plotting a geom that has ... |
13,700,798 | Basic communication between two fragments | <p>I have one activity - <code>MainActivity</code>. Within this activity I have two fragments, both of which I created declaratively within the xml. </p>
<p>I am trying to pass the <code>String</code> of text input by the user into <code>Fragment A</code> to the text view in <code>Fragment B</code>. However, this is p... | 13,701,071 | 14 | 0 | null | 2012-12-04 10:26:46.04 UTC | 37 | 2022-02-02 12:29:57.863 UTC | 2019-10-20 20:19:37.28 UTC | null | 4,607,733 | null | 1,732,515 | null | 1 | 75 | android|android-fragments | 125,199 | <p>Have a look at the Android developers page:
<a href="http://developer.android.com/training/basics/fragments/communicating.html#DefineInterface" rel="noreferrer">http://developer.android.com/training/basics/fragments/communicating.html#DefineInterface</a></p>
<p>Basically, you define an interface in your Fragment A,... |
13,681,213 | What is the difference between Amazon SNS and Amazon SQS? | <p>When would I use SNS versus SQS, and why are they always coupled together?</p> | 13,692,720 | 8 | 5 | null | 2012-12-03 10:22:12.477 UTC | 169 | 2021-12-22 09:36:12.183 UTC | 2021-02-02 10:42:01.687 UTC | null | 63,550 | null | 972,789 | null | 1 | 674 | amazon-web-services|amazon-sqs|amazon-sns | 282,380 | <p><strong>SNS</strong> is a distributed <strong>publish-subscribe</strong> system. Messages are <strong>pushed</strong> to subscribers as and when they are sent by publishers to SNS.</p>
<p><strong>SQS</strong> is distributed <strong>queuing</strong> system. Messages are <em>not</em> pushed to receivers. Receivers hav... |
51,996,175 | How to break out of nested loops in Go? | <p>I have an outer and inner loop, each iterating over a range. I want to exit the outer loop when a condition is satisfied inside the inner loop.</p>
<p>I have a solution which works using two 'break's, one inside the inner loop and one inside the outerloop, just outside the inner loop (a very simplified case for dem... | 51,996,305 | 6 | 5 | null | 2018-08-24 01:07:22.783 UTC | 11 | 2019-12-05 10:15:04.773 UTC | 2019-08-26 10:56:33.51 UTC | null | 55,504 | null | 1,479,093 | null | 1 | 62 | loops|go | 56,302 | <p>use function</p>
<pre><code>package main
import (
"fmt"
)
func getWord() string {
word := ""
for word != "DC" {
for _, i := range "ABCDE" {
for _, j := range "ABCDE" {
word = string(i) + string(j)
fmt.Println(word)
if word == "DC" {
... |
3,943,801 | Objective C - How do I use initWithCoder method? | <p>I have the following method for my class which intends to load a nib file and instantiate the object:</p>
<pre><code>- (id)initWithCoder:(NSCoder*)aDecoder
{
if(self = [super initWithCoder:aDecoder]) {
// Do something
}
return self;
}
</code></pre>
<p>How does one instantiate an object of this... | 3,943,938 | 2 | 0 | null | 2010-10-15 15:41:54.887 UTC | 11 | 2014-01-17 20:28:16.75 UTC | 2014-01-17 20:28:16.75 UTC | null | 1,038,379 | null | 242,769 | null | 1 | 49 | objective-c|cocoa-touch|nscoder | 66,900 | <p>You also need to define the following method as follows:</p>
<pre><code>- (void)encodeWithCoder:(NSCoder *)enCoder {
[super encodeWithCoder:enCoder];
[enCoder encodeObject:instanceVariable forKey:INSTANCEVARIABLE_KEY];
// Similarly for the other instance variables.
....
}
</code></pre>
<p>And in ... |
16,448,002 | Android: FileObserver monitors only top directory | <p>According to the documentation, </p>
<pre><code>"Each FileObserver instance monitors a single file or directory. If a directory is monitored,
events will be triggered for all files and subdirectories inside the monitored directory."
</code></pre>
<p>My code goes like,</p>
<pre><code> FileObserver fobsv = new ... | 16,449,501 | 2 | 0 | null | 2013-05-08 18:47:26.763 UTC | 10 | 2014-03-12 14:22:46.833 UTC | 2014-01-10 15:05:12.567 UTC | null | 2,360,535 | null | 1,176,304 | null | 1 | 13 | android|android-sdcard|fileobserver | 12,061 | <blockquote>
<p>According to the documentation</p>
</blockquote>
<p>The documentation is incorrect, as is noted in <a href="https://code.google.com/p/android/issues/detail?id=33659" rel="noreferrer">this issue</a>.</p>
<blockquote>
<p>Is there any problem with the code?</p>
</blockquote>
<p>No, but <code>FileObs... |
16,552,801 | How do I conditionally add a class with Add-Type -TypeDefinition if it isn't added already? | <p>Consider the following PowerShell snippet:</p>
<pre><code>$csharpString = @"
using System;
public sealed class MyClass
{
public MyClass() { }
public override string ToString() {
return "This is my class. There are many others " +
"like it, but this one is mine.";
}
}
"@
Add-Type -Ty... | 22,156,833 | 5 | 1 | null | 2013-05-14 21:02:04.543 UTC | 3 | 2018-04-10 20:02:45.273 UTC | 2013-05-14 21:07:47.357 UTC | null | 6,920 | null | 95,195 | null | 1 | 51 | powershell|add-type | 18,037 | <p>This technique works well for me:</p>
<pre><code>if (-not ([System.Management.Automation.PSTypeName]'MyClass').Type)
{
Add-Type -TypeDefinition 'public class MyClass { }'
}
</code></pre>
<ul>
<li>The type name can be enclosed in quotes 'MyClass', square brackets [MyClass], or both '[MyClass]' (v3+ only).</li>
... |
16,423,774 | string representation of a numpy array with commas separating its elements | <p>I have a numpy array, for example: </p>
<pre><code>points = np.array([[-468.927, -11.299, 76.271, -536.723],
[-429.379, -694.915, -214.689, 745.763],
[ 0., 0., 0., 0. ]])
</code></pre>
<p>if I print it or turn it into a string with str() I get:</p>
<... | 16,423,805 | 4 | 1 | null | 2013-05-07 16:11:46.97 UTC | 6 | 2021-04-15 16:57:12.343 UTC | null | null | null | null | 874,829 | null | 1 | 61 | python|numpy | 50,710 | <p>Try using <code>repr</code></p>
<pre><code>>>> import numpy as np
>>> points = np.array([[-468.927, -11.299, 76.271, -536.723],
... [-429.379, -694.915, -214.689, 745.763],
... [ 0., 0., 0., 0. ]])
>>> print(repr(points))
arra... |
15,090,185 | AngularJS + Bootstrap Dropdown : can't do ng-click in ng-repeat | <p>I'm trying to create a picker with Bootstrap Dropdown and AngularJS.</p>
<p><a href="http://jsfiddle.net/qbjfQ/" rel="noreferrer">http://jsfiddle.net/qbjfQ/</a></p>
<pre><code><li ng-repeat="item in list"><a ng-click="current = item">Dynamic set {{item}}</a></li>
</code></pre>
<p>When I us... | 15,090,254 | 3 | 0 | null | 2013-02-26 13:21:22.557 UTC | 1 | 2013-12-29 14:11:48.267 UTC | 2013-02-26 18:22:25.143 UTC | null | 422,353 | null | 2,111,343 | null | 1 | 9 | drop-down-menu|twitter-bootstrap|angularjs|ng-repeat | 41,339 | <p>It is a known problem with scoping in directives. You can read the article <a href="https://github.com/angular/angular.js/wiki/The-Nuances-of-Scope-Prototypal-Inheritance" rel="nofollow noreferrer">The Nuances of Scope Prototypal Inheritance</a> to learn more about the scoping in angular js.</p>
<p>You need to chan... |
17,541,739 | How to add the bubbles to textview android? | <p>In my application, I want to set bubbles to a text view, in the text view I add the <code>setBackgroundResource()</code> as you can see in the code.</p>
<p>With this code i'm getting an image like this:</p>
<p><img src="https://i.stack.imgur.com/IlcYQ.png" alt="enter image description here"> </p>
<p>I want a bubb... | 17,542,066 | 2 | 1 | null | 2013-07-09 06:47:35.957 UTC | 11 | 2018-09-15 09:45:09.137 UTC | 2017-10-26 21:24:02.493 UTC | null | 5,706,778 | null | 2,353,676 | null | 1 | 18 | android|android-intent|android-custom-view|nine-patch | 28,425 | <p>What you need to use is essentially a 9-patch image (<em>As already pointed out by <strong>Ken Wolf</strong> in this comment</em>).</p>
<p>To get you started, I am including a set of 9-patch images from one of my apps along with a brief piece of code on how to use it when creating a layout XMl. ;-)</p>
<p><strong>... |
27,390,989 | Swift enum with custom initializer loses rawValue initializer | <p>I have tried to boil this issue down to its simplest form with the following.</p>
<h2>Setup</h2>
<p>Xcode Version 6.1.1 (6A2008a)</p>
<p>An enum defined in <code>MyEnum.swift</code>:</p>
<pre><code>internal enum MyEnum: Int {
case Zero = 0, One, Two
}
extension MyEnum {
init?(string: String) {
s... | 31,711,091 | 6 | 5 | null | 2014-12-09 23:46:16.297 UTC | 15 | 2018-03-17 09:35:31.82 UTC | null | null | null | null | 2,712,445 | null | 1 | 104 | swift|enums | 65,791 | <p>This bug is solved in Xcode 7 and Swift 2 </p> |
21,694,302 | What are the mechanics of short string optimization in libc++? | <p><a href="https://stackoverflow.com/a/10319672/1805388">This answer</a> gives a nice high-level overview of short string optimization (SSO). However, I would like to know in more detail how it works in practice, specifically in the libc++ implementation:</p>
<ul>
<li><p>How short does the string have to be in order ... | 21,710,033 | 2 | 4 | null | 2014-02-11 06:01:50.807 UTC | 57 | 2019-02-08 06:56:21.15 UTC | 2019-02-08 06:56:21.15 UTC | null | 1,805,388 | null | 1,805,388 | null | 1 | 121 | c++|string|optimization|c++-standard-library|libc++ | 49,155 | <p>The libc++ <code>basic_string</code> is designed to have a <code>sizeof</code> 3 words on all architectures, where <code>sizeof(word) == sizeof(void*)</code>. You have correctly dissected the long/short flag, and the size field in the short form.</p>
<blockquote>
<p>what value would __min_cap, the capacity of sh... |
39,805,018 | How do I resolve peer dependency error: The package react@15.3.2 does not satisfy its siblings' peerDependencies requirements | <p>I am getting this error when I run npm install. This seems because I am unable to satisfy some peer dependency but I am unsure which peer dependency I need to fix. </p>
<pre><code>λ npm install
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modul... | 39,819,731 | 4 | 6 | null | 2016-10-01 09:30:24.957 UTC | 4 | 2022-09-07 05:14:08.133 UTC | 2016-10-01 17:45:32.76 UTC | null | 2,816,509 | null | 2,816,509 | null | 1 | 16 | node.js|reactjs|npm|package.json | 59,511 | <p>it worked when I:</p>
<hr>
<ol>
<li>updated npm <code>"npm install npm -g"</code> </li>
<li>downgraded react to; <code>"react": "15.3.0"</code></li>
<li>cleared cache: <code>npm cache clear</code></li>
<li>removed node_modules, <code>rm -rf node_modules</code>, </li>
<li>reinstalled node_modules, <code>npm install... |
19,395,200 | Does all asynchronous I/O ultimately implemented in polling? | <p>I have been though asynchronous I/O is always has a callback form. But recently I discovered some low level implementations are using polling style API.</p>
<ol>
<li><a href="http://julipedia.meroh.net/2004/10/example-of-kqueue.html" rel="nofollow noreferrer">kqueue</a></li>
<li><a href="https://stackoverflow.com/q... | 19,395,425 | 1 | 3 | null | 2013-10-16 04:22:13.94 UTC | 9 | 2013-10-16 04:51:17.337 UTC | 2017-05-23 11:53:46.983 UTC | null | -1 | null | 246,776 | null | 1 | 12 | asynchronous|io | 980 | <p>At the lowest (or at least, lowest worth looking at) hardware level, asynchronous operations truly <em>are</em> asynchronous in modern operating systems.</p>
<p>For example, when you read a file from the disk, the operating system translates your call to <code>read</code> to a series of disk operations (seek to loc... |
19,664,993 | Is it possible to implement Common Lisp's macro system in scheme? | <p>Hopefully this is not a redundant question. </p>
<p>As a newcomer to scheme I am aware that <code>syntax-case</code> macros are more powerful than the <code>syntax-rules</code> alternative, at the cost of unwanted complexity. </p>
<p>Is it possible, however, to implement Common Lisp's macro system in scheme, which... | 19,670,813 | 3 | 6 | null | 2013-10-29 17:18:52.457 UTC | 15 | 2013-10-30 01:38:47.137 UTC | null | null | null | null | 1,693,831 | null | 1 | 23 | compiler-construction|macros|scheme|common-lisp | 5,448 | <p>I'll try to be brief -- which is hard since this is generally a very deep issue, more than the average SO level of Q&A... so this is still going to be pretty long. I'll also try to be unbiased; even though I come from a Racket perspective, I have been using Common Lisp in the past, and I always liked to use mac... |
17,647,872 | PDFsharp edit a pdf file | <p>Environment - PDFsharp Library, Visual Studio 2012 and C# as the language.</p>
<p>I am trying to:</p>
<ol>
<li>read Test1.pdf (Width = 17 inches, Height – 11 inches) with 1 page</li>
<li>add some text to it</li>
<li>save it as another file (Test2.pdf)</li>
</ol>
<p>I am able to do all the following. But when I op... | 17,649,357 | 1 | 2 | null | 2013-07-15 06:20:21.01 UTC | 8 | 2013-07-15 09:33:36.863 UTC | 2013-07-15 09:33:36.863 UTC | null | 1,571,189 | null | 1,571,189 | null | 1 | 24 | c#-4.0|pdf|pdfsharp | 43,338 | <p>Instead of modifying the document, please create a new document and copy the pages from the old document to the new document.</p>
<p>Sample code can be found in this post on the PDFsharp forum:<br>
<a href="http://forum.pdfsharp.net/viewtopic.php?p=2637#p2637" rel="noreferrer">http://forum.pdfsharp.net/viewtopic.ph... |
17,555,699 | Internal Server Error with Django and uWSGI | <p>I am trying to follow the steps in this guide: <a href="http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html">http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html</a></p>
<p>Before I even get to the nginx part I am trying to make sure that uWSGI works correctly</p>
<p>... | 17,555,858 | 6 | 0 | null | 2013-07-09 18:37:14.463 UTC | 13 | 2021-11-03 21:20:50.857 UTC | null | null | null | null | 1,555,963 | null | 1 | 47 | django|uwsgi | 94,189 | <p>I have solved this</p>
<p>in my original command line did not include full path to the wsgi.py file to run uWSGI</p>
<pre><code>uwsgi --http :8000 --chdir /srv/www/databankinfo.com/projectdatabank/ --wsgi-file wsgi.py
</code></pre>
<p>to this</p>
<pre><code>uwsgi --http :8000 --chdir /srv/www/databankinfo.com/pr... |
17,556,250 | How to ignore Icon? in git | <p>While trying to setup a dropbox folder with git, I saw a "Icon\r" file which is not created by me. I try to ignore it in the ~/.gitignore file. But adding <code>Icon\r</code> <code>Icon\r\r</code> <code>Icon?</code> won't work at all. </p> | 30,755,378 | 10 | 4 | null | 2013-07-09 19:07:39.903 UTC | 22 | 2022-07-02 06:58:09.333 UTC | null | null | null | null | 768,823 | null | 1 | 62 | macos|git | 15,744 | <p>(This improves on the original answer, following a suggestion by <strong>robotspacer</strong>, according to <strong>hidn</strong>'s <a href="https://stackoverflow.com/a/33974028/192740">explanation</a>.)</p>
<p>The <code>Icon?</code> is the file of OS X folder icon. The "<code>?</code>" is a special charac... |
17,663,186 | Initializing a two dimensional std::vector | <p>So, I have the following:</p>
<pre><code>std::vector< std::vector <int> > fog;
</code></pre>
<p>and I am initializing it very naively like:</p>
<pre><code> for(int i=0; i<A_NUMBER; i++)
{
std::vector <int> fogRow;
for(int j=0; j<OTHER_NUMBER; j++)
... | 17,663,236 | 13 | 2 | null | 2013-07-15 20:21:47.863 UTC | 84 | 2022-08-19 08:22:11.853 UTC | 2013-07-15 20:28:24.78 UTC | null | 186,193 | null | 186,193 | null | 1 | 170 | c++|vector | 359,160 | <p>Use the <a href="http://en.cppreference.com/w/cpp/container/vector/vector" rel="noreferrer"><code>std::vector::vector(count, value)</code></a> constructor that accepts an initial size and a default value:</p>
<pre><code>std::vector<std::vector<int> > fog(
ROW_COUNT,
std::vector<int>(COLUMN_... |
37,083,445 | Reset SQLite database in Django | <p>I am trying to refactor a Django project. I renamed a couple apps and added a new one, as well as shuffled some models around. I want to clear my database and migrations and start fresh, but I am not sure how to accomplish this. Here's what I did:</p>
<pre><code>rm -r myapp/migrations // I ran this for all my apps ... | 37,083,740 | 5 | 4 | null | 2016-05-07 01:10:35.44 UTC | 10 | 2021-09-26 18:12:11.703 UTC | 2017-05-23 11:47:24.667 UTC | null | -1 | null | 3,593,889 | null | 1 | 18 | python|django|sqlite | 37,382 | <p>Delete database and delete migration files (<code>.py</code> and <code>.pyc</code>) in <code>migrations</code> directory of your app (don't delete <code>__init__.py</code> file). Then run <code>python manage.py makemigrations app</code> and <code>python manage.py migrate</code>.</p> |
18,269,338 | Keep animated View at final Animation Position | <p>So I'm animating a view using animation:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator" >
<translate
android:duration="1000"
android:fromYDelta=... | 18,269,477 | 3 | 3 | null | 2013-08-16 08:47:55.163 UTC | 8 | 2015-07-06 15:40:03.673 UTC | 2013-08-16 12:28:53.897 UTC | null | 1,811,719 | null | 1,811,719 | null | 1 | 24 | android|animation | 37,035 | <p>Please consider <strong>setFillAfter(boolean);</strong> setting it to true will make the view stay at the animated position.</p>
<pre><code>Animation anim = new TranslateAnimation(0, 0, 0, 100);
// or like this
Animation anim = AnimationUtils.loadAnimation(this, R.anim.animation_name);
anim.setFillAfter(true);
a... |
18,437,594 | Angularjs: call other scope which in iframe | <p>In my test, given 2 document, A and B. In A document, there is an iframe, the iframe source is B document. My question is how to modify B document certain scope of variable?</p>
<p>Here is my code: A document</p>
<p></p>
<pre><code><html lang="en" ng-app="">
<head>
<meta charset="utf-8">
<... | 21,733,164 | 4 | 2 | null | 2013-08-26 06:03:41.343 UTC | 19 | 2018-10-19 09:51:38.657 UTC | null | null | null | null | 1,528,153 | null | 1 | 25 | javascript|angularjs|angularjs-scope | 41,067 | <p>To access and communicate in two directions (parent to iFrame, iFrame to parent), in case they are both in the same domain, with access to the angular scope, try following those steps: </p>
<p>*You don’t need the parent to have reference to angularJS library…</p>
<p><strong>Calling to child iFrame from parent</str... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.