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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8,889,302 | What is the meaning of a question mark in bash variable parameter expansion as in ${var?}? | <p>What is the meaning of a bash variable used like this:</p>
<pre><code> ${Server?}
</code></pre> | 8,889,350 | 4 | 0 | null | 2012-01-17 03:23:36.943 UTC | 11 | 2019-10-29 16:27:25.817 UTC | 2018-10-17 18:12:07.73 UTC | null | 6,862,601 | null | 612,418 | null | 1 | 62 | bash|variables|syntax | 20,509 | <p>It works almost the same as (from the <code>bash</code> manpage):</p>
<blockquote>
<p><strong><code>${parameter:?word}</code></strong> <br> <code>Display Error if Null or Unset. If parameter is null or unset, the expansion of word (or a message to that effect if word is not present) is written to the standard err... |
8,592,921 | How to return HTTP 204 in a Rails controller | <p>This seems to be basic but I'm a Ruby/Rails beginner. I need to simply return HTTP 204 in a controller.
Would </p>
<pre><code>respond_to do |format|
format.html
end
</code></pre>
<p>return a 204?</p> | 11,485,810 | 3 | 0 | null | 2011-12-21 16:16:29.94 UTC | 8 | 2018-07-06 03:58:12.51 UTC | 2018-04-25 11:23:48.587 UTC | null | 2,423,164 | null | 1,098,917 | null | 1 | 69 | ruby-on-rails|ruby | 37,321 | <pre><code>head :no_content
</code></pre>
<p>Tested with Rails 3.2.x, 4.x. It causes the controller method to respond with the 204 No Content HTTP status code. </p>
<p>An example of using this inside a controller method named <code>foobar</code>:</p>
<pre><code>def foobar
head :no_content
end
</code></pre> |
30,485,151 | Python pandas: exclude rows below a certain frequency count | <p>So I have a pandas DataFrame that looks like this:</p>
<pre><code>r vals positions
1.2 1
1.8 2
2.3 1
1.8 1
2.1 3
2.0 3
1.9 1
... ...
</code></pre>
<p>I would like the filter out all rows by position that do not appear at least 20 times. I have seen something like ... | 30,485,620 | 4 | 0 | null | 2015-05-27 14:15:31.783 UTC | 14 | 2021-05-24 08:35:46.877 UTC | 2015-05-27 14:46:35.137 UTC | null | 704,848 | null | 1,628,702 | null | 1 | 22 | python|pandas|filter|dataframe | 24,523 | <p>On your limited dataset the following works:</p>
<pre><code>In [125]:
df.groupby('positions')['r vals'].filter(lambda x: len(x) >= 3)
Out[125]:
0 1.2
2 2.3
3 1.8
6 1.9
Name: r vals, dtype: float64
</code></pre>
<p>You can assign the result of this filter and use this with <a href="http://pandas.pyd... |
30,748,480 | Swift - Get device's WIFI IP Address | <p>I need to get IP Address of iOS device in Swift. This is not a duplicate of other questions about this! I need to get only WiFi IP address, if there is no wifi ip address - I need to handle it. There are a few questions about it on Stack Overflow, but there are only functions that return ip addresses. For example (f... | 30,754,194 | 17 | 0 | null | 2015-06-10 06:16:12.917 UTC | 51 | 2021-08-20 04:22:38.197 UTC | 2018-09-10 10:39:01.873 UTC | null | 129,202 | null | 2,938,258 | null | 1 | 83 | ios|swift|network-programming | 105,971 | <p>According to several SO threads (e.g. <a href="https://stackoverflow.com/questions/14334076/what-exactly-means-ios-networking-interface-name-whats-pdp-ip-whats-ap">What exactly means iOS networking interface name? what's pdp_ip ? what's ap?</a>), the WiFi interface on an iOS device always has then name "en0"... |
43,556,212 | Failed form propType: You provided a `value` prop to a form field without an `onChange` handler | <p>When I load my react app I get this error in the console.</p>
<blockquote>
<p>Warning: Failed form propType: You provided a <code>value</code> prop to a form
field without an <code>onChange</code> handler. This will render a read-only
field. If the field should be mutable use <code>defaultValue</code>. Otherw... | 72,252,485 | 5 | 0 | null | 2017-04-22 06:50:27.613 UTC | 13 | 2022-06-13 15:15:02.557 UTC | null | null | null | null | 7,304,216 | null | 1 | 119 | javascript|jquery|forms|reactjs | 161,963 | <h3>Try this,</h3>
<pre><code>const [email, SetEmail] = useState("");
</code></pre>
<pre><code><Form.Control
onChange={e => SetEmail(e.target.value)}
type="email"
name="email"
value={email || ""}
/>
</code></pre> |
504,431 | T-Sql How to return a table from a storedproc in another stored proc | <p>I would like to do the following. Basically have a stored procedure call another stored procedure that returns a table. How is this done? </p>
<pre><code> ALTER PROC [GETSomeStuff]
AS
BEGIN
@table = exec CB_GetLedgerView @accountId, @fromDate, @toDate, @pageSize, @pageNumber, @filter, @status, @... | 504,449 | 3 | 0 | null | 2009-02-02 19:00:25.63 UTC | 5 | 2013-06-25 18:32:34.66 UTC | null | null | null | Arron | 16,628 | null | 1 | 15 | tsql|stored-procedures | 44,581 | <p>The target of a stored procedure has to be a temp or actual table so you can </p>
<pre><code> Insert into #table exec CB_GetLedgerView @accountId, @fromDate,
@toDate, @pageSize, @pageNumber,
@filter, @status, @sortExpression,
@sortOrder, @virtualCount OUTPUT
</code></pre>
<p>If the output result set of the s... |
276,543 | How to run a console application with command line parameters in Visual C++ 6.0? | <p>I've got a console application that compiles and executes fine with Visual C++ 6.0, except that it will then only get as far as telling me about missing command line parameters. There doesn't seem to be anywhere obvious to enter these. How do I run or debug it with command line parameters?</p> | 276,547 | 3 | 0 | null | 2008-11-09 22:02:15.56 UTC | 3 | 2013-01-17 10:06:22.8 UTC | 2008-11-09 22:16:50.68 UTC | Martin York | 14,065 | Rob Kam | 25,093 | null | 1 | 31 | c++|command-line|parameters|visual-c++-6 | 42,321 | <p>I assume you're talking about setting the command line parameters for running in the IDE.</p>
<p>Open the Project/Settings property page and go to the Debug tab.</p>
<p>There's a "Program arguments" field you can put them into.</p> |
41,683,195 | Access Control Allow Origin issue in Angular 2 | <p>I have a problem with getting data from my node.js server.</p>
<p>The client side is:</p>
<pre><code> public getTestLines() : Observable<TestLine[]> {
let headers = new Headers({ 'Access-Control-Allow-Origin': '*' });
let options = new RequestOptions({ headers: headers });
return this.http.ge... | 41,684,356 | 5 | 2 | null | 2017-01-16 18:52:55.647 UTC | 1 | 2019-09-23 14:11:00.42 UTC | 2017-01-17 10:20:34.88 UTC | null | 4,927,984 | null | 7,235,292 | null | 1 | 10 | html|angular|http-headers | 51,127 | <p><code>Access-Control-Allow-Origin</code> is a <strong>response</strong> header, not a request header.</p>
<p>You need to have it appear on the response, not the request.</p>
<p>You have attempted to put it on the response:</p>
<blockquote>
<pre><code>resp.setHeader('Access-Control-Allow-Origin','*')
</code></pre... |
28,619,113 | Start a new Activity from Fragment | <p>Using Android Studio, I have my MainActiviy class with a Placeholder fragment. This fragment has buttons, but one has to load an Activity. How does one do this? I was told to try something like the below, but the new Intent does not work.</p>
<pre><code>Button button = (Button) rootView.findViewById(R.id.button1... | 28,619,264 | 7 | 1 | null | 2015-02-19 23:36:05.597 UTC | 10 | 2019-08-08 12:23:38.587 UTC | 2017-02-22 02:38:18.647 UTC | null | 4,758,255 | null | 4,586,140 | null | 1 | 18 | android|android-activity | 69,769 | <p>If you have a look at the <a href="http://developer.android.com/training/basics/firstapp/starting-activity.html" rel="noreferrer">documentation</a> you can see that to start an activity you'll want to use the following code</p>
<pre><code>Intent intent = new Intent(getActivity(), AnotherActivity.class);
startActivi... |
24,427,009 | Is there a cleaner way of getting the last N characters of every line? | <p>To simplify the discussion, let <code>N = 3</code>.</p>
<p>My current approach to extracting the last three characters of every line in a file or stream is to use <code>sed</code> to capture the last three characters in a group and replace the entire line with that group. </p>
<pre><code>sed 's/^.*\(.\{3\}\)/\1/'
... | 24,427,087 | 4 | 0 | null | 2014-06-26 09:32:41.343 UTC | 8 | 2014-11-25 20:05:34.567 UTC | 2014-06-26 09:38:41.513 UTC | null | 391,161 | null | 391,161 | null | 1 | 18 | bash|command-line|awk|sed|cut | 42,147 | <p>It's very simple with <code>grep -o '...$'</code>:</p>
<pre><code>cat /etc/passwd | grep -o '...$'
ash
/sh
/sh
/sh
ync
/sh
/sh
/sh
</code></pre>
<p>Or better yer:</p>
<pre><code>N=3; grep -o ".\{$N\}$" </etc/passwd
ash
/sh
/sh
/sh
ync
/sh
/sh
</code></pre>
<p>That way you can adjust your <code>N</code> for ... |
42,606,091 | Change another module state from one module in Vuex | <p>I have two modules in my vuex store.</p>
<pre><code>var store = new Vuex.Store({
modules: {
loading: loading
posts: posts
}
});
</code></pre>
<p>In the module <code>loading</code>, I have a property <code>saving</code> which can be set either <code>true</code> or <code>false</code> and also ... | 42,606,829 | 4 | 1 | null | 2017-03-05 08:21:35.927 UTC | 18 | 2022-04-21 15:33:35.943 UTC | 2022-04-21 15:33:35.943 UTC | null | 3,518,515 | null | 1,154,350 | null | 1 | 112 | vue.js|vuejs2|vuex | 61,438 | <p>Try it with following parameters as suggested <a href="https://vuex.vuejs.org/en/modules.html" rel="noreferrer">here</a>;</p>
<pre><code>commit('TOGGLE_LOADING', null, { root: true })
</code></pre>
<p>If you have <code>namespaced</code> set to true (in Nuxt that's the default when in modules mode), this becomes:</... |
5,616,684 | Recursive Fibonacci in Assembly | <p>I'm attempting to implement a recursive Fibonacci program in Assembly. However, my program crashes, with an unhandled exception, and I can't seem to pick out the problem. I don't doubt that it involves my improper use of the stack, but I can't seem to point out where...</p>
<pre><code>.386
.model Flat
public Fibona... | 5,616,829 | 3 | 0 | null | 2011-04-11 04:15:35.653 UTC | 2 | 2018-05-24 04:05:24.433 UTC | null | null | null | null | 386,869 | null | 1 | 8 | assembly|fibonacci | 53,710 | <p>When you perform a <code>call</code>, the address of the next operation is pushed to the stack as a return value. When creating a function, it is often customary to create a "stack frame". This frame can be used to print the call stack, as well as an offset for local variables and arguments. The frame is created thr... |
6,118,814 | is there anywhere where I could start MobileSubstrate tweaks programming? | <p>After a search here on the forum I found a question like that, and it redirected me to a tutorial which gave em some basic instructions on manipulating SpringBoard with CapitainHook.</p>
<p>To start I'd like to do it with normal %hooks only. Any hint where I could start?</p> | 11,553,722 | 3 | 0 | null | 2011-05-25 02:11:14.003 UTC | 51 | 2012-07-19 11:50:26.887 UTC | 2011-05-25 02:24:20.833 UTC | null | 639,668 | null | 768,779 | null | 1 | 30 | objective-c|cocoa-touch|ios|jailbreak | 19,711 | <p>So, since I (hope I) am far away from a noob with MobileSubstrate programming now, and saw this question as quite popular, I decided to create an answer covering everything you need to know about the subject hopefully briefly.</p>
<p>This little introduction is meant for whoever <strong>has a minimal knowledge on O... |
6,211,575 | Proper way (move semantics) to return a std::vector from function calling in C++11 | <p>I want to fill std::vector (or some other STL container):</p>
<pre><code>class Foo {
public:
Foo(int _n, const Bar &_m);
private:
std::vector<Foo> fooes_;
}
</code></pre>
<p><em>1.Good looking ctor, expensive performance</em></p>
<pre><code>std::vector<Foo> get_vector(int _n, const Bar &_m... | 6,211,604 | 3 | 3 | null | 2011-06-02 07:14:47.33 UTC | 2 | 2012-10-11 12:18:05.427 UTC | 2012-10-11 12:18:05.427 UTC | null | 723,845 | null | 723,845 | null | 1 | 33 | c++|stl|c++11|move-semantics|return-value-optimization | 20,400 | <p>If you're using a C++0x-compatible compiler and standard library, you get better performance from the first example <strong>without doing anything</strong>. The return value of <code>get_vector(_n, _m)</code> is a temporary, and the move constructor for <code>std::vector</code> (a constructor taking an rvalue refere... |
5,816,417 | How to properly express JPQL "join fetch" with "where" clause as JPA 2 CriteriaQuery? | <p>Consider the following JPQL query:</p>
<pre><code>SELECT foo FROM Foo foo
INNER JOIN FETCH foo.bar bar
WHERE bar.baz = :baz
</code></pre>
<p>I'm trying to translate this into a Criteria query. This is as far as I have gotten:</p>
<pre><code>CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Foo> cq = ... | 5,819,631 | 3 | 3 | null | 2011-04-28 09:23:47.89 UTC | 34 | 2022-01-19 17:34:27.723 UTC | 2020-11-17 17:39:58.37 UTC | null | 2,387,977 | null | 531,232 | null | 1 | 65 | java|jpa|criteria|jpa-2.0 | 130,289 | <p>In JPQL the same is actually true in the spec. The JPA spec does not allow an alias to be given to a fetch join. The issue is that you can easily shoot yourself in the foot with this by restricting the context of the join fetch. It is safer to join twice.</p>
<p>This is normally more an issue with ToMany than To... |
6,263,453 | Retrieve client ip address in mysql | <p>I'm trying to get with a simple SQL statement the IP address of the client. I do not want to use PHP or other techniques. Only pure SQL. When I use </p>
<pre><code>SELECT USER();
</code></pre>
<p>I get</p>
<pre><code>dbouser@host.i.do.not.care.of
</code></pre>
<p>When I use </p>
<pre><code>SELECT CURRENT_USER()... | 6,263,482 | 4 | 0 | null | 2011-06-07 09:47:18.84 UTC | 8 | 2017-01-14 02:42:59.21 UTC | null | null | null | null | 787,191 | null | 1 | 27 | mysql|sql | 48,806 | <p>You will only get the IP address of the client process communicating with MySQL. Assuming this is what you want:</p>
<pre><code>select host from information_schema.processlist WHERE ID=connection_id();
</code></pre>
<p>Will give you the host name (or IP address if name resolution is not enabled, which it is usuall... |
6,152,231 | Is there a Ruby library/gem that will generate a URL based on a set of parameters? | <p>Rails' URL generation mechanism (most of which routes through <code>polymorphic_url</code> at some point) allows for the passing of a hash that gets serialized into a query string at least for GET requests. What's the best way to get that sort of functionality, but on top of any base path?</p>
<p>For instance, I'd ... | 6,152,484 | 4 | 0 | null | 2011-05-27 12:27:38.523 UTC | 3 | 2020-12-21 22:26:09.58 UTC | null | null | null | null | 203,137 | null | 1 | 29 | ruby-on-rails|ruby|gem | 18,678 | <p>Yes, in Ruby's standard library you'll find a whole module of classes for working with URI's. There's one for HTTP. You can call <code>#build</code> with some arguments, much like you showed.</p>
<p><a href="http://www.ruby-doc.org/stdlib/libdoc/uri/rdoc/classes/URI/HTTP.html#M009497" rel="noreferrer">http://www.... |
2,150,138 | How to parse milliseconds? | <p>How do I use <code>strptime</code> or any other functions to parse time stamps with milliseconds in R?</p>
<pre><code>time[1]
# [1] "2010-01-15 13:55:23.975"
strptime(time[1], format="%Y-%m-%d %H:%M:%S.%f")
# [1] NA
strptime(time[1], format="%Y-%m-%d %H:%M:%S")
# [1] "2010-01-15 13:55:23"`
</code></pre> | 2,150,179 | 2 | 0 | null | 2010-01-27 20:48:38.73 UTC | 19 | 2022-08-04 14:52:40.453 UTC | 2017-07-29 06:35:40.387 UTC | null | 3,576,984 | null | 220,120 | null | 1 | 90 | r|datetime|time-series|strptime | 51,026 | <p>Courtesy of the <code>?strptime</code> help file (with the example changed to your value):</p>
<pre><code>> z <- strptime("2010-01-15 13:55:23.975", "%Y-%m-%d %H:%M:%OS")
> z # prints without fractional seconds
[1] "2010-01-15 13:55:23 UTC"
> op <- options(digits.secs=3)... |
29,058,229 | Download Xcode simulator directly | <p>I have downloaded Xcode 6.2 today which replaced previous Xcode 6.1
now to use simulator 7.1 & 8.1 it asks to download both simulators , but for some reason after trying 4-5 times it shows network issues in downloading or request time out (note: in n/w diagnostic after it shows net is working properly)</p>
<p>s... | 29,111,012 | 9 | 1 | null | 2015-03-15 07:20:59.617 UTC | 54 | 2022-08-09 12:45:25.52 UTC | 2018-06-04 15:14:42.277 UTC | null | 5,638,630 | null | 4,557,505 | null | 1 | 88 | ios|xcode|ios-simulator|simulator|xcode-6.2 | 114,247 | <p>Clicking on Download in Xcode didn't do anything - the progress bar did not progress (does that make it a regress bar?).</p>
<p>This is what worked for me:</p>
<ol>
<li><p>Open Xcode, open preferences, go to the Components section.</p>
</li>
<li><p>Open the Console App, clear the console.</p>
</li>
<li><p>Go back to... |
28,867,975 | Unable to Sign In to iTunes Connect: "Your Apple ID isn't enabled for iTunes Connect" | <p>I am a member of my company's development team, with the role of Admin. I can access the Member Center of the team at <a href="https://developer.apple.com/" rel="nofollow noreferrer">https://developer.apple.com/</a></p>
<p>However, when I I attempt to sign in at <a href="https://itunesconnect.apple.com" rel="nofoll... | 28,867,976 | 9 | 2 | null | 2015-03-05 00:40:14.813 UTC | 11 | 2022-07-28 18:51:15.06 UTC | 2019-10-31 21:02:05.827 UTC | null | 1,265,393 | null | 1,265,393 | null | 1 | 46 | app-store-connect|iphone-developer-program | 65,078 | <p>It is not enough to be a member of the Apple Developer Account / Member Center team.</p>
<p>The account must <strong>also</strong> be added as an iTunes Connect User.</p>
<p>From an <strong>existing iTunes Connect admin account</strong>, add the new user to iTunes Connect:</p>
<p><code>iTunes Connect > Users a... |
5,695,240 | PHP: Regex to ignore escaped quotes within quotes | <p>I looked through related questions before posting this and I couldn't modify any relevant answers to work with my method (not good at regex).</p>
<p>Basically, here are my existing lines:</p>
<pre><code>$code = preg_replace_callback( '/"(.*?)"/', array( &$this, '_getPHPString' ), $code );
$code = preg_replace... | 5,696,141 | 6 | 3 | null | 2011-04-17 17:48:07.98 UTC | 20 | 2021-01-30 08:50:08.193 UTC | 2013-10-24 01:10:35.47 UTC | null | 15,168 | null | 711,416 | null | 1 | 35 | php|regex | 21,154 | <p>For most strings, you need to allow escaped <em>anything</em> (not just escaped quotes). e.g. you most likely need to allow escaped characters like <code>"\n"</code> and <code>"\t"</code> and of course, the escaped-escape: <code>"\\"</code>.</p>
<p>This is a frequently asked question, and one which was solved (and ... |
6,184,691 | if statement for throwing Exception? | <p>Hi I wanted to ask because I'm not sure if is it propriete using of Exception:</p>
<pre><code>public int Method(int a, int b) {
if(a<b) throw new ArgumentException("the first argument cannot be less than the second");
//do stuff...
}
</code></pre>
<p>can I throw Exception after if statement? or should I ... | 6,184,712 | 7 | 0 | null | 2011-05-31 08:11:02.317 UTC | 2 | 2021-10-15 06:59:35.717 UTC | null | null | null | null | 422,235 | null | 1 | 23 | c#|exception|exception-handling | 40,888 | <p>That is perfectly valid. That is exactly what exceptions are used for, to check for "Exceptions" in your logic, things that weren't suppose to be.</p>
<p>The idea behind catching an exception is that when you pass data somewhere and process it, you might not always know if the result will be valid, that is when you... |
5,625,524 | How to Close a program using python? | <p>Is there a way that python can close a windows application (example: Firefox) ?</p>
<p>I know how to start an app, but now I need to know how to close one.</p> | 10,457,565 | 7 | 5 | null | 2011-04-11 18:09:13.777 UTC | 11 | 2022-08-10 18:24:05.787 UTC | 2020-06-18 16:05:27.67 UTC | null | 6,451,573 | null | 514,584 | null | 1 | 29 | python | 97,457 | <pre><code># I have used subprocess comands for a while
# this program will try to close a firefox window every ten secounds
import subprocess
import time
# creating a forever loop
while 1 :
subprocess.call("TASKKILL /F /IM firefox.exe", shell=True)
time.sleep(10)
</code></pre> |
5,753,680 | Change CSS of class in Javascript? | <p>I've got a class with the display set to <code>none</code> I'd like to in Javascript now set it to <code>inline</code> I'm aware I can do this with an <code>id</code> with <code>getElementById</code> but what's the cleanest way to do it with a class?</p> | 5,753,733 | 8 | 2 | null | 2011-04-22 08:33:28.45 UTC | 6 | 2021-05-01 11:50:40.43 UTC | 2019-04-02 06:54:01.623 UTC | null | 860,099 | null | 358,438 | null | 1 | 35 | javascript|css | 104,346 | <p>You <strong>can</strong> do that — actually change style rules related to a class — using the <code>styleSheets</code> array (<a href="https://developer.mozilla.org/en-US/docs/Web/API/StyleSheetList" rel="nofollow noreferrer">MDN link</a>), but frankly you're probably better off (as changelog said) having a separate... |
5,757,555 | How do I trigger the success callback on a model.save()? | <pre><code>this.model.save({
success: function(model, response){
console.log('success');
},
error: function(){
console.log('error');
}
})
</code></pre>
<p>The model is correctly posted to the server which handles the save, but the success callback is not fired. Do I need to send something back from th... | 5,759,860 | 8 | 4 | null | 2011-04-22 16:25:12.733 UTC | 21 | 2015-07-02 16:58:54.177 UTC | 2011-04-22 16:28:11.567 UTC | null | 560,648 | null | 565,299 | null | 1 | 107 | backbone.js | 70,182 | <p>The first argument of save is the attributes to save on the model:</p>
<pre><code>this.model.save( {att1 : "value"}, {success :handler1, error: handler2});
</code></pre> |
5,631,618 | How to fix "Configuration system failed to initialize/Root element is missing" error when loading config file? | <p>I got this error in my c# windows application: "Configuration system failed to initialize". </p>
<p>It was working fine. Suddenly I got this exception. It shows inner exception detail as "Root element is missing". (C:\Users\company\AppData\Local\Clickbase_Corp_Sverige_AB\TouchStation.vshost.exe_Url_no1nets4fg3oy2p2... | 5,631,775 | 12 | 3 | null | 2011-04-12 07:10:51.583 UTC | 2 | 2022-06-14 02:30:28.17 UTC | 2011-04-12 08:59:02.677 UTC | null | 447,356 | null | 703,526 | null | 1 | 15 | c#|config | 54,367 | <p>The cause of the <code>XmlException</code> entitled Root element is missing means the XML document (The config file here) you're trying to load is not formatted properly, more exactly it's missing the root node.</p>
<p>Each XML file must have a root element / node which encloses all the other elements.</p>
<p>You... |
44,173,624 | How to apply NLTK word_tokenize library on a Pandas dataframe for Twitter data? | <p>This is the Code that I am using for semantic analysis of twitter:-</p>
<pre><code>import pandas as pd
import datetime
import numpy as np
import re
from nltk.tokenize import word_tokenize
from nltk.corpus import stopwords
from nltk.stem.wordnet import WordNetLemmatizer
from nltk.stem.porter import PorterStemmer
df... | 44,174,565 | 1 | 0 | null | 2017-05-25 06:21:49.383 UTC | 12 | 2020-08-22 03:06:13.1 UTC | 2018-10-19 18:58:35.077 UTC | null | 8,047,559 | null | 8,047,559 | null | 1 | 13 | python|pandas|twitter|nltk|tokenize | 37,100 | <p>In short:</p>
<pre><code>df['Text'].apply(word_tokenize)
</code></pre>
<p>Or if you want to add another column to store the tokenized list of strings:</p>
<pre><code>df['tokenized_text'] = df['Text'].apply(word_tokenize)
</code></pre>
<p>There are tokenizers written specifically for twitter text, see <a href="h... |
49,648,270 | how to define index in angular material table | <p>how should I define an index variable when angular material table is used as ngFor is not used in this table. </p>
<p>I did search for it in the documentation but index is not mentioned any where in it. </p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class... | 49,648,620 | 9 | 2 | null | 2018-04-04 10:05:10.06 UTC | 11 | 2021-12-31 13:02:31.43 UTC | 2021-01-11 08:43:49.4 UTC | null | 7,436,489 | null | 8,483,823 | null | 1 | 85 | javascript|angular|typescript|angular-material2 | 103,591 | <p>Can you add <code>index</code> to <code>let element; let i = index;"</code> as you'd do with <code>*ngFor</code>?</p>
<pre class="lang-xml prettyprint-override"><code><mat-row *matRowDef="let row; columns: displayedColumns; let i = index"></mat-row>
</code></pre>
<p>Or like so:</p>
<pre cl... |
41,068,599 | How do I set the animation color of a LinearProgressIndicator? | <p>The <a href="https://docs.flutter.io/flutter/material/LinearProgressIndicator-class.html" rel="noreferrer">LinearProgressIndicator documentation</a> helpfully displays the existence of a valueColor property and even mentions "To specify a constant color use: new AlwaysStoppedAnimation(color).", but if I tr... | 41,069,053 | 5 | 0 | null | 2016-12-09 20:44:44.327 UTC | 2 | 2022-09-24 22:35:54.563 UTC | 2020-06-20 09:12:55.06 UTC | null | -1 | null | 3,134,918 | null | 1 | 40 | flutter | 26,964 | <p>Looks like it's controlled from the Theme's accent color:
<a href="https://github.com/flutter/flutter/blob/b670ce4bcc49bbab745221eae24fcebcbc9dba7c/packages/flutter/lib/src/material/progress_indicator.dart#L61" rel="noreferrer">https://github.com/flutter/flutter/blob/b670ce4bcc49bbab745221eae24fcebcbc9dba7c/packages... |
40,836,208 | Set maximum value (upper bound) in pandas DataFrame | <p>I'm trying to set a maximum value of a pandas DataFrame column. For example:</p>
<pre><code>my_dict = {'a':[10,12,15,17,19,20]}
df = pd.DataFrame(my_dict)
df['a'].set_max(15)
</code></pre>
<p>would yield:</p>
<pre><code> a
0 10
1 12
2 15
3 15
4 15
5 15
</code></pre>
<p>But it doesn't. </p>
<p>T... | 40,836,266 | 3 | 0 | null | 2016-11-28 02:11:08.86 UTC | 4 | 2019-06-04 19:44:31.023 UTC | 2019-01-03 13:45:46.043 UTC | null | 4,909,087 | null | 6,163,621 | null | 1 | 29 | python|pandas|dataframe|max | 40,276 | <p>I suppose you can do:</p>
<pre><code>maxVal = 15
df['a'].where(df['a'] <= maxVal, maxVal) # where replace values with other when the
# condition is not satisfied
#0 10
#1 12
#2 15
#3 15
#4 15
#5 15
#Name: a, dtype: int64
</code></pre>
<p>Or:... |
38,393,343 | How to use ansible 'expect' module for multiple different responses? | <p>Here I am trying to test my bash script where it is prompting four times.</p>
<pre><code>#!/bin/bash
date >/opt/prompt.txt
read -p "enter one: " one
echo $one
echo $one >>/opt/prompt.txt
read -p "enter two: " two
echo $two
echo $two >>/opt/prompt.txt
read -p "enter three: " three
echo $three
echo $th... | 39,458,575 | 1 | 0 | null | 2016-07-15 10:04:40.157 UTC | 3 | 2019-10-04 18:59:37.053 UTC | 2019-10-04 18:59:37.053 UTC | null | 2,123,530 | null | 5,433,567 | null | 1 | 21 | python|python-2.7|ansible|ansible-2.x | 42,590 | <p>The reason is that the questions are interpreted as regexps. Hence you must escape characters with a special meaning in regular expressions, such as -()[]\?*. et cetara.</p>
<p>Hence:</p>
<pre><code>'Enter current password for root (enter for none):'
</code></pre>
<p>should instead be:</p>
<pre><code>'Enter curr... |
35,154,717 | Is dependency-reduced-pom.xml automatically used instead of pom.xml? | <p>Is <code>dependency-reduced-pom.xml</code> created by <a href="http://maven.apache.org/plugins/maven-shade-plugin/" rel="noreferrer">Maven shade plugin</a> <strong>automatically</strong> used in projects that depends on the uberjar (instead of the ordinary <code>pom.xml</code>)?</p>
<p>Asking this after reading a nu... | 35,155,294 | 1 | 0 | null | 2016-02-02 13:22:55.687 UTC | 5 | 2021-01-11 16:46:43.187 UTC | 2021-01-11 16:46:43.187 UTC | null | 6,156,700 | null | 2,811,258 | null | 1 | 36 | maven|maven-3|maven-shade-plugin | 14,516 | <p>The <code>dependency-reduced-pom.xml</code> is generated at build time into <code>${basedir}</code> of the project. This file is a temporary file that is only used for packaging into the shaded jar. Quoting the documentation of the <a href="https://maven.apache.org/plugins/maven-shade-plugin/shade-mojo.html#createDe... |
27,580,267 | How to make all interactions before using glmnet | <p>I have an x-matrix of 8 columns. I want to run <code>glmnet</code> to do a lasso regression. I know I need to call:</p>
<pre><code>glmnet(x, y, family = "binomial", ...).
</code></pre>
<p>However, how do I get <code>x</code> to consider all one way interactions as well? Do I have to manually remake the data frame... | 27,583,931 | 2 | 0 | null | 2014-12-19 23:58:24.177 UTC | 12 | 2020-02-25 22:44:58.46 UTC | 2017-01-31 06:58:11.533 UTC | null | 202,229 | user1357015 | 1,357,015 | null | 1 | 21 | r|formula|interaction|glmnet | 10,425 | <p>Yes, there is a convenient way for that. Two steps in it are important.</p>
<pre><code>library(glmnet)
# Sample data
data <- data.frame(matrix(rnorm(9 * 10), ncol = 9))
names(data) <- c(paste0("x", 1:8), "y")
# First step: using .*. for all interactions
f <- as.formula(y ~ .*.)
y <- data$y
# Second step... |
43,770,579 | how to change the color in geom_point or lines in ggplot | <p>I have a data like this</p>
<pre><code>data<- structure(list(sample = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("A",
"B"), class = "factor"), y = c(0.99999652, 0.99626012, 0.94070452,
0.37332406, 0.57810894, 0.37673758, 0.22784684, 0.35358141, 0.21... | 43,770,608 | 2 | 0 | null | 2017-05-03 21:50:00.107 UTC | 1 | 2017-05-03 22:14:14.573 UTC | null | null | null | null | 5,919,561 | null | 1 | 10 | r|ggplot2 | 54,295 | <p>You could use <code>scale_color_manual</code>:</p>
<pre><code>ggplot() +
geom_point(data = data, aes(x = time, y = y, color = sample),size=4) +
scale_color_manual(values = c("A" = "black", "B" = "red"))
</code></pre>
<p><a href="https://i.stack.imgur.com/3m6bP.png" rel="noreferrer"><img src="https://i.stack.i... |
49,660,399 | Is it possible to create and handle a custom Event in a Customized UserForm? | <p>I have a <code>UserForm</code> to which I added a property with the adequate Let and Get statements. I would like to have an event fire when the property changes. Event, <code>RaiseEvent</code> and Routine have been stated, all in the <code>UserForm</code> module. However, I can't find a way to assign the routine to... | 49,661,053 | 1 | 0 | null | 2018-04-04 21:03:44.463 UTC | 16 | 2018-04-14 22:31:13.92 UTC | 2018-07-09 19:34:03.733 UTC | null | -1 | null | 7,350,537 | null | 1 | 7 | vba|excel | 3,537 | <p>Yes, but you need to understand how VBA/COM events work first.</p>
<h3>A bit of background...</h3>
<p>Notice the dropdowns/comboboxes at the top of the VBE's code panes? The leftmost one is listing all available <em>interfaces</em> and <em>event providers</em> - the rightmost one is listing the available <em>membe... |
44,129,108 | How to get path from file upload input in angular 4 | <p>I want to upload an image and create a preview of it in angular 4. <br>
The template is given below:<br></p>
<pre><code><div>
<input type="file" (onchange)="handleUpload($event)">
<img [src]="Logo" >
</div
</code></pre>
<p>I want to call a function <code>handleUpload()</code> whenever a fi... | 44,129,206 | 3 | 0 | null | 2017-05-23 08:02:38.043 UTC | 1 | 2021-12-17 06:24:37.437 UTC | null | null | null | null | 4,645,774 | null | 1 | 5 | angular|typescript | 46,339 | <p>In angular you write javascript events without the "on" suffix.</p>
<p>Change:</p>
<pre><code><input type="file" (onchange)="handleUpload($event)">
</code></pre>
<p>To:</p>
<pre><code><input type="file" (change)="handleUpload($event)">
</code></pre> |
37,556,972 | HIVE - date_format( your_date_column, '%Y-%m-%d %H' ) | <p>I'm trying to achieve the MySQL equivalent of <code>date_format( your_date_column, '%Y-%m-%d %H' ) as my_date</code> in Hive. I've tried a few options from <a href="http://www.folkstalk.com/2011/11/date-functions-in-hive.html" rel="nofollow">Hive date formatting</a> but can't get the format right. I haven't found an... | 37,558,015 | 4 | 0 | null | 2016-05-31 22:57:13.62 UTC | 1 | 2019-04-16 19:20:01.213 UTC | 2016-06-01 00:51:43.367 UTC | null | 3,222,797 | null | 5,366,075 | null | 1 | 1 | hive | 38,268 | <p>I worked around this by using <code>concat(substr(your_date_column,1,13), ':00')</code></p>
<p>In case the date column has a reserved keyword such as <code>timestamp</code> as in my case, this works - concat(substr(`timestamp`,1,13), ':00')</p> |
49,189,402 | auth.User.groups: (fields.E304) Reverse accessor for 'User.groups' clashes with reverse accessor for 'UserManage.groups' | <p>In my Django project I have a <code>user_manage</code> app.</p>
<p>I create a model named <code>UserManage</code> in my <code>user_manage</code> app's model.py:</p>
<pre><code>from django.db import models
from django.contrib.auth.models import AbstractUser
class UserManage(AbstractUser):
username = models.Cha... | 49,189,522 | 8 | 1 | null | 2018-03-09 08:21:16.76 UTC | 24 | 2022-04-27 04:10:12.673 UTC | null | null | null | null | 6,523,163 | null | 1 | 129 | python|django | 93,643 | <p>Add the following to <code>settings.py</code>: </p>
<pre><code>AUTH_USER_MODEL = "users_management.UserManage"
</code></pre>
<p>More generally,</p>
<pre><code>AUTH_USER_MODEL = 'YourAppName.YourClassName'
</code></pre>
<ul>
<li><em>YourAppName</em>: This is the name of the app that will have the User Model</li>... |
27,440,953 | std::unique_ptr for C functions that need free | <p>Think to a C function that return something that must be <code>free</code>d, for example the POSIX's <code>strdup()</code>. I want to use that function in C++11 and avoid any chance of leaks, is this a correct way?</p>
<pre><code>#include <memory>
#include <iostream>
#include <string.h>
int main(... | 27,441,139 | 5 | 2 | null | 2014-12-12 09:51:59.183 UTC | 11 | 2022-09-23 20:03:57.253 UTC | 2014-12-12 09:58:28.883 UTC | user3920237 | null | null | 1,876,111 | null | 1 | 60 | c++|c++11 | 17,191 | <p>What you have is extremely likely to work in practice, but not strictly correct. You can make it even more likely to work as follows:</p>
<pre><code>std::unique_ptr<char, decltype(std::free) *>
t_copy { strdup(t), std::free };
</code></pre>
<p>The reason is that the function type of <code>std::free</code... |
42,497,479 | Uncaught ReferenceError: exports is not defined in filed generated by Typescript | <p>I'm trying to get started with Typescript for Electron development. After wrestling with getting typing for node and jquery, I finally got my .ts file error free.</p>
<p>The problem is now that when I run my app, I get this error:</p>
<pre><code>index.js:2 Uncaught ReferenceError: exports is not defined
</code></p... | 42,510,255 | 9 | 1 | null | 2017-02-27 23:11:16.497 UTC | 10 | 2021-06-01 22:49:19.253 UTC | null | null | null | null | 3,667,074 | null | 1 | 53 | javascript|typescript | 104,301 | <p>There is an issue with the new version of typescript 2.2.1, try using the older version 2.1.6, that solved the exact same issue which you have for me.</p>
<p>Version 2.2.1 on compiling adds this line <code>Object.defineProperty(exports, "__esModule", { value: true });</code> while the older 2.1.6 does not.</p> |
9,560,709 | Adding a registry key in windows with quotes needed in the data using a batch script | <p>Little Willis here. I am trying to using a batch script to edit an existing registry key that is used when double clicking a .jar file. The issue is that the data that I'm trying to enter contains quotes but I also need quotes for it to be considered a string. </p>
<p>Example:</p>
<pre><code>reg add "HKEY_LOCAL_MA... | 9,560,889 | 4 | 0 | null | 2012-03-05 01:45:06.027 UTC | 7 | 2019-05-19 15:31:09.053 UTC | 2012-03-05 03:03:55.553 UTC | null | 1,248,873 | null | 1,248,873 | null | 1 | 13 | windows|batch-file|double-quotes|registrykey | 42,643 | <p>Use backslashes to escape the inner quotes, i.e.:</p>
<pre><code>reg add "HKEY_LOCAL_MACHINE\Software\Classes\jarfile\shell\open\command" /v "" /t REG_EXPAND_SZ /d "\"C:\Program Files\Java\jre7\bin\javaw.exe\" -jar \"%1\" %*" /f
</code></pre> |
9,562,761 | Is filemerge still available after Xcode 4.3 installation? | <p>Where can I find <code>filemerge</code> after Xcode is upgraded to 4.3?</p> | 9,562,898 | 2 | 0 | null | 2012-03-05 06:57:58.293 UTC | 8 | 2014-04-22 09:24:13.017 UTC | null | null | null | null | 88,597 | null | 1 | 41 | xcode|xcode4|osx-lion | 14,467 | <p>In Xcode, choose this menu item: Xcode -> Open Developer Tool -> FileMerge. The app itself is here:</p>
<pre><code>/Applications/Xcode.app/Contents/Applications/FileMerge.app
</code></pre>
<p>On the command line, use <code>opendiff</code>. You must have the command line tools installed -- go to Xcode, Preferences,... |
30,054,911 | How to determine the version of Gradle? | <p>How can I know which version of Gradle I am using in my Android Studio? Please guide. </p>
<p>I want to make sure I am using Gradle version 2.2.1.</p> | 30,055,088 | 13 | 3 | null | 2015-05-05 13:51:22.503 UTC | 21 | 2022-08-22 15:37:12.53 UTC | 2015-05-05 13:58:32.4 UTC | null | 1,253,844 | user379888 | null | null | 1 | 203 | android|gradle | 310,395 | <p><strong>Option 1- From Studio</strong></p>
<p>In Android Studio, go to File > Project Structure. Then select the "project" tab on the left.</p>
<p>Your Gradle version will be displayed here.</p>
<p><strong>Option 2- gradle-wrapper.properties</strong></p>
<p>If you are using the Gradle wrapper, then your project ... |
47,384,952 | Directive to disable Cut, Copy and Paste function for textbox using Angular2 | <p>I am using Angular2 to restrict the copy and paste in textbox. But how do i write a custom directive, so that it will be easy to apply for all the text fields.</p>
<p>Below is the working code to restrict the copy and paste functionality.</p>
<pre><code><ion-input formControlName="confirmpass" type="tel" (cut)=... | 47,385,485 | 3 | 2 | null | 2017-11-20 04:09:36.147 UTC | 7 | 2022-04-25 15:45:14.24 UTC | 2017-11-20 05:28:31.09 UTC | null | 5,621,827 | null | 4,376,984 | null | 1 | 18 | angular|ionic2 | 38,742 | <p>You can use a <a href="https://angular.io/api/core/HostListener" rel="noreferrer">HostListener</a> in your directive to catch <a href="https://developer.mozilla.org/en-US/docs/Web/Events/cut" rel="noreferrer">cut</a>, <a href="https://developer.mozilla.org/en-US/docs/Web/Events/paste" rel="noreferrer">paste</a> and ... |
10,653,549 | IIS 7.5 and images not being cached | <p>I cannot get the image files to cache. I have tried everything that I have found on this site and others and still cannot get them to cache.</p>
<p>Web config setting that I have tried</p>
<pre><code> <staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="1.00:00:00" />
... | 10,687,548 | 2 | 1 | null | 2012-05-18 13:28:02.09 UTC | 11 | 2018-05-29 21:54:25.843 UTC | 2012-07-04 19:49:18.13 UTC | null | 225,647 | null | 1,167,466 | null | 1 | 21 | iis|caching|iis-7.5|browser-cache | 29,227 | <p>The following should cause the browsers to cache your images:</p>
<pre><code><staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="1.00:00:00" />
</staticContent>
<httpProtocol>
<customHeaders>
<add name="Cache-Control" value="public" />
... |
10,633,564 | How does one change the language of the command line interface of Git? | <p>I’d like to change the language of git (to English) in my Linux installation without changing the language for other programs and couldn’t find the settings.
How to do it?</p> | 10,872,202 | 8 | 1 | null | 2012-05-17 10:03:49.42 UTC | 24 | 2022-08-07 13:27:35.97 UTC | 2019-01-18 10:02:51.647 UTC | null | 905,686 | null | 905,686 | null | 1 | 137 | bash|git|localization|environment-variables|locale | 71,229 | <p>Add these lines to your <code>~/.bashrc</code>, <code>~/.bash_profile</code> or <code>~/.zprofile</code> to force git to display all messages in English:</p>
<pre><code># Set Git language to English
#alias git='LANG=en_US git'
alias git='LANG=en_GB git'
</code></pre>
<p>The alias needs to override <code>LC_ALL</code... |
7,605,328 | Batch how to set FINDSTR result to a variable and disable findstr print to console | <p>My batch program </p>
<pre><code>FINDSTR /C:"Result Comparison failure" %tmp_result_file%
</code></pre>
<p>I want to do the folloiwng , set the result of the above command to a variable.
If found, set the first line to varible or set the all found line to a varible is OK for me. </p>
<p>also the above commman... | 7,607,120 | 2 | 0 | null | 2011-09-30 02:15:54.86 UTC | 1 | 2020-04-27 08:56:55.293 UTC | 2011-09-30 04:28:50.67 UTC | null | 310,574 | null | 778,659 | null | 1 | 12 | batch-file | 76,065 | <p>The first problem is because you just take the first token from FOR. To solve it, you have two solutions, either to echo the complete line where the string is found...</p>
<pre><code>for /f "tokens=*" %%i in ('FINDSTR /C:"Result Comparison Failure" %tmp_result_file%') do echo %%i
</code></pre>
<p>or echo the three... |
7,527,118 | Search in many-to-many relationship with Doctrine2 | <p>This is probably an easy one but I can't figure it out nor find an answer.</p>
<p>I have a simple Article and ArticleTag Entities with many to many relationship. How can I get all articles with a certain tag (or tags)?</p>
<p>My following tries:</p>
<pre><code>$qb = $repository->createQueryBuilder('a')
// ... | 7,598,827 | 2 | 4 | null | 2011-09-23 09:48:04.057 UTC | 10 | 2011-09-29 14:27:00.397 UTC | null | null | null | null | 523,100 | null | 1 | 15 | php|many-to-many|doctrine-orm|symfony | 7,215 | <p>And the winner is ... <em>drumroll, please</em> ...</p>
<pre><code>$qb = $repository->createQueryBuilder('a')
// ...
->andWhere(':tag MEMBER OF a.tags');
->setParameter('tag', $tag);
// ...
</code></pre>
<p>Thanks to everyone who has taken the time to read and think about my question!</p> |
31,387,653 | What is the fastest way to clear a SQL table? | <p>I have a table with about 300,000 rows and 30 columns. How can I quickly clear it out? If I do a <code>DROP FROM MyTable</code> query, it takes a long time to run. I'm trying the following stored procedure to basically make a copy of the table with no data, drop the original table, and rename the new table as the or... | 31,387,807 | 1 | 3 | null | 2015-07-13 15:39:19.63 UTC | 2 | 2015-07-14 08:03:13.257 UTC | 2015-07-13 19:43:54.133 UTC | null | 1,783,592 | null | 1,783,592 | null | 1 | 13 | sql-server|stored-procedures | 43,679 | <p>Best way to clear a table is with <a href="https://msdn.microsoft.com/en-us/library/ms177570.aspx" rel="noreferrer">TRUNCATE</a>.</p>
<p>Since you are creating and droping ill assume you have no constraints.</p>
<pre><code>TRUNCATE TABLE <target table>
</code></pre>
<p>Some advantages:</p>
<blockquote>
<... |
31,489,386 | How do I declare a variable of enum type in Kotlin? | <p>Following <a href="https://kotlinlang.org/docs/reference/enum-classes.html" rel="noreferrer">the documentation</a>, I created an enum class:</p>
<pre><code>enum class BitCount public constructor(val value : Int)
{
x32(32),
x64(64)
}
</code></pre>
<p>Then, I'm trying to declare a variable in some function:</p>
<p... | 34,625,163 | 3 | 4 | null | 2015-07-18 08:41:38.62 UTC | 7 | 2022-03-12 05:14:41.44 UTC | 2020-10-28 00:24:27.097 UTC | null | 1,402,846 | null | 779,822 | null | 1 | 35 | enums|kotlin | 33,578 | <p>As stated in other answers, you can reference any value of the <code>enum</code> that exists by name, but not construct a new one. That does not prevent you from doing something similar to what you were trying...</p>
<pre class="lang-kotlin prettyprint-override"><code>// wrong, it is a sealed hierarchy, you cannot... |
37,616,521 | How can I connect to SQLServer running on VirtualBox from my host Macbook | <p>I want to run SQLServer on my Mac but I can't do it natively. How can I host a SQLServer with <a href="https://www.virtualbox.org" rel="nofollow noreferrer">VirtualBox</a> and connect to it from my MacBook for local development?</p> | 37,616,522 | 1 | 2 | null | 2016-06-03 14:05:21.693 UTC | 31 | 2022-08-25 08:00:22.12 UTC | 2022-08-25 08:00:22.12 UTC | null | 4,751,173 | null | 2,282,538 | null | 1 | 45 | sql-server|macos|virtualbox | 40,220 | <ol>
<li>Download <a href="https://www.virtualbox.org" rel="noreferrer">VirtualBox</a></li>
<li>Download a Windows 10 ISO from <a href="https://www.microsoft.com/software-download/windows10ISO" rel="noreferrer">here</a></li>
<li>Create a new Windows 10 VM with VirtualBox. When it asks for the "Virtual Optical Disk Fil... |
35,649,045 | Integration test with IOptions<> in .NET Core | <p>I pass <code>IOption<T></code> to my <code>CommandBus</code> so I can get the settings from my <code>ServiceBusSetting</code> class. I want to do an integration test of my Bus. I do not want to resolve it just use <code>new QueueCommandBus</code> and need to pass <code>IOptions</code> to it. </p>
<pre><code>v... | 41,990,001 | 1 | 1 | null | 2016-02-26 10:18:45.287 UTC | 8 | 2017-02-01 21:23:03.81 UTC | 2016-02-26 11:52:30.49 UTC | null | 455,493 | null | 2,530,473 | null | 1 | 16 | asp.net-mvc|integration-testing|asp.net-core | 9,049 | <p>You don't need to create the <code>ServiceCollection</code> or <code>IServiceProvider</code>. The <code>IConfiguration</code> interface has a <code>Bind()</code> method, or from .NET Core 1.1 onwards, <code>Get<T></code> which you can use to get the strongly-typed object directly:</p>
<pre><code>var config = ... |
3,340,051 | What does the output of git pull actually mean? | <p>I'm trying to gain a more thorough understanding of git.</p>
<p>Can someone give me a simple line-by-line explanation of what basic git <code>pull</code> output means? Example: </p>
<pre><code>remote: Counting objects: 11, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 7 (delta 2), reused 0 (de... | 3,340,304 | 1 | 0 | null | 2010-07-27 00:59:58.37 UTC | 11 | 2014-09-28 12:07:02.587 UTC | null | null | null | null | 402,851 | null | 1 | 46 | git | 9,356 | <p>Under the hood, <code>git pull</code> is <code>git fetch</code> followed by <code>git merge</code>. Here's the fetch portion:</p>
<pre><code>remote: Counting objects: 11, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 7 (delta 2), reused 0 (delta 0)
</code></pre>
<p>At this point, you've told t... |
3,357,953 | default a column with empty string | <p>Is there a way, via a SQL statement, to ensure a column's default value is an empty string <code>''</code> instead of <code>NULL</code>?</p> | 3,357,962 | 1 | 0 | null | 2010-07-28 22:08:29.493 UTC | 4 | 2010-07-28 22:14:25.063 UTC | 2010-07-28 22:14:25.063 UTC | null | 23,199 | null | 441,664 | null | 1 | 49 | sql|mysql|default-constraint | 71,189 | <p>Yes - use a DEFAULT constraint:</p>
<pre><code>DROP TABLE IF EXISTS `example`.`test`;
CREATE TABLE `example`.`test` (
`string_test` varchar(45) NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
</code></pre> |
20,911,283 | Why do programming contests want answers modulo some large prime? | <p>I have been testing the waters of competitive programming and I have already seen this statement mentioned a lot of times:</p>
<blockquote>
<p>Print the result modulo 10<sup>9</sup> + 7</p>
</blockquote>
<p>Now I can figure out that this is some way of preventing overflow of digits when dealing with very large n... | 20,912,351 | 1 | 3 | null | 2014-01-03 19:29:44.867 UTC | 11 | 2015-01-21 18:09:53.983 UTC | 2015-01-21 18:09:53.983 UTC | null | 100,297 | null | 1,691,530 | null | 1 | 25 | math|primes|modulus | 3,526 | <p>Many contest questions ask you to compute some very, very large number (say, the number of permutations of an 150-element sequence containing some large number of duplicates). Many programming languages don't natively support arbitrary-precision arithmetic, so in the interest of fairness it makes sense for those con... |
40,844,903 | How can I run a Python script in HTML? | <p>Currently I have some Python files which connect to an <a href="https://en.wikipedia.org/wiki/SQLite" rel="nofollow noreferrer">SQLite</a> database for user inputs and then perform some calculations which set the output of the program. I'm new to Python web programming and I want to know: What is the best method to ... | 40,845,057 | 8 | 2 | null | 2016-11-28 12:56:24.993 UTC | 12 | 2022-05-29 16:54:29.323 UTC | 2022-05-29 16:28:55.97 UTC | null | 63,550 | null | 6,193,415 | null | 1 | 27 | python|html|web | 157,358 | <p>It probably would depend on what you want to do. I personally use CGI and it might be simpler if your inputs from the web page are simple, and it takes less time to learn. Here are some resources for it:</p>
<ul>
<li><em><a href="https://docs.python.org/2/library/cgi.html" rel="nofollow noreferrer">cgi — Common Gate... |
18,384,883 | Why is Google's TrueTime API hard to duplicate? | <p>I'm not sure why the press in general says that Google's TrueTime API is hard to replicate (Wired, Slashdot, etc).</p>
<p>I can understand how it would be a tough thing to get the low error intervals that Google is achieving, but I don't see how the API itself would be very difficult.</p>
<p>For example, I whipped... | 18,492,024 | 1 | 0 | null | 2013-08-22 15:32:43.763 UTC | 12 | 2018-12-19 02:55:31.81 UTC | 2018-12-19 02:55:31.81 UTC | null | 9,146,820 | null | 107,728 | null | 1 | 34 | c|time|google-cloud-platform|distributed-computing|google-cloud-spanner | 12,796 | <p>The challenge in implementing a TrueTime API lies in the <em>guarantees</em> you must provide. Namely, the absolute time must <strong>never</strong> be outside the TrueTime interval on any server in the system. If this can happen, then absolute ordering of events is lost, as are most of the guarantees of Spanner.</p... |
28,023,606 | Extend GridView ActionColumn with additional icon | <p>I'm building a webapp with Yii2 framework that will provide users (logged in) the capability to download pre-uploaded files by administrators.</p>
<p>I've created the action <code>actionDownload</code> in the specific controller that call the <code>sendFile()</code> method.</p>
<p>How can I create a button that ca... | 28,028,556 | 3 | 2 | null | 2015-01-19 11:28:21.983 UTC | 9 | 2017-09-19 12:11:35.807 UTC | 2015-01-24 17:23:40.853 UTC | null | 1,387,346 | null | 1,662,191 | null | 1 | 24 | gridview|yii2 | 28,485 | <p>Extend declaration of <a href="http://www.yiiframework.com/doc-2.0/yii-grid-actioncolumn.html#$template-detail" rel="noreferrer">template</a> and <a href="http://www.yiiframework.com/doc-2.0/yii-grid-actioncolumn.html#$buttons-detail" rel="noreferrer">buttons</a> like this:</p>
<pre><code>[
'class' => 'yii\g... |
1,803,043 | How do I display an arrow positioned at a specific angle in MATLAB? | <p>I am working in MATLAB and I'm stuck on a very simple problem: I've got an object defined by its position <code>(x,y)</code> and <code>theta</code> (an angle, in degrees). I would like to plot the point and add an arrow, starting from the point and pointing toward the direction defined by the angle. It actually does... | 1,804,725 | 3 | 0 | null | 2009-11-26 11:03:55.403 UTC | 4 | 2017-08-08 20:07:16.437 UTC | 2015-08-18 08:42:35.173 UTC | null | 4,374,739 | null | 217,903 | null | 1 | 13 | matlab|plot|angle | 47,230 | <p>The quiver() plotting function plots arrows like this. Take your theta value and convert it to (x,y) cartesian coordinates representing the vector you want to plot as an arrow and use those as the (u,v) parameters to quiver().</p>
<pre><code>theta = pi/9;
r = 3; % magnitude (length) of arrow to plot
x = 4; y = 5;
u... |
8,781,240 | A way to restrict Git branch access? | <p>I have four branches in my git repository, which is managed using GitHub:</p>
<ul>
<li>Production</li>
<li>Staging</li>
<li>Master</li>
<li>[person's name]-development</li>
</ul>
<p>Is there a way to restrict write access to only a single branch ([person's name]-development)? How would I do this? </p>
<p>For refe... | 8,781,450 | 9 | 1 | null | 2012-01-08 20:54:13.387 UTC | 12 | 2017-12-05 03:48:16.23 UTC | 2017-05-23 12:02:56.39 UTC | null | -1 | null | 651,174 | null | 1 | 72 | git|github | 76,231 | <p>When using GitHub, your best option would be for each developer to have their own fork of the master repository. Everybody pushes to their own repository and somebody with push access to the master repository handles pulling from each developer's repository. This is how most open source projects work.</p>
<p>If usi... |
716,049 | What is the difference between 'classic' and 'integrated' pipeline mode in IIS7? | <p>I was deploying an ASP.NET MVC application last night, and found out that it is less work to deploy with IIS7 set to integrated mode. My question is what is the difference? And what are the implications of using one or the other?</p> | 716,067 | 4 | 3 | null | 2009-04-03 23:10:49.42 UTC | 141 | 2017-02-21 00:49:40.393 UTC | 2016-08-09 17:12:35.39 UTC | Mehrdad | 2,411,320 | Jon Erickson | 1,950 | null | 1 | 517 | asp.net|asp.net-mvc|iis|iis-7|integrated-pipeline-mode | 306,593 | <p>Classic mode (the only mode in IIS6 and below) is a mode where IIS only works with ISAPI extensions and ISAPI filters directly. In fact, in this mode, ASP.NET is just an ISAPI extension (aspnet_isapi.dll) and an ISAPI filter (aspnet_filter.dll). IIS just treats ASP.NET as an external plugin implemented in ISAPI and ... |
472,179 | How to read the header with pycurl | <p>How do I read the response headers returned from a PyCurl request?</p> | 472,243 | 4 | 0 | null | 2009-01-23 07:21:48.353 UTC | 10 | 2014-02-14 18:13:56.087 UTC | null | null | null | sverrejoh | 473 | null | 1 | 25 | python|curl|pycurl | 17,262 | <p>There are several solutions (by default, they are dropped). Here is an
example using the option HEADERFUNCTION which lets you indicate a
function to handle them.</p>
<p>Other solutions are options WRITEHEADER (not compatible with
WRITEFUNCTION) or setting HEADER to True so that they are transmitted
with the body.</... |
335,104 | Is there a program to decompile Delphi? | <p>Someone just sent me a decompile of a program into C. It was a very good decompile, producing nice, mostly readabe C code (if you overlook the fact that none of the variables or functions had a human-readable name) that mostly looked like it would actually compile.</p>
<p>There was one big problem, though. I happ... | 335,122 | 4 | 3 | null | 2008-12-02 19:17:42.557 UTC | 12 | 2020-07-03 21:38:53.773 UTC | 2008-12-02 19:40:55.27 UTC | Tim Farley | 4,425 | Mason Wheeler | 32,914 | null | 1 | 30 | delphi|reverse-engineering|decompiling | 118,463 | <p>I don't think there are any machine code decompilers that produce Pascal code. Most "Delphi decompilers" parse form and RTTI data, but do not actually decompile the machine code. I can only recommend using something like DeDe (or <a href="http://delphi.about.com/od/devutilities/a/decompiling_3.htm" rel="noreferrer">... |
40,028,035 | Remove Last Two Characters in a String | <p>Is there a quick way to remove the last two characters in a String in Swift? I see there is a simple way to remove the last character as clearly noted <a href="https://stackoverflow.com/questions/24122288/remove-last-character-from-string-swift-language">here</a>. Do you know how to remove the last two characters?... | 40,028,338 | 5 | 1 | null | 2016-10-13 18:07:49.413 UTC | 14 | 2020-03-26 22:55:20.897 UTC | 2020-03-26 22:55:20.897 UTC | null | 6,110,783 | null | 6,110,783 | null | 1 | 72 | ios|swift|string|swift3 | 56,190 | <p>update: <strong>Xcode 9 • Swift 4 or later</strong></p>
<p>String now conforms to RangeReplaceableCollection so you can use collection method dropLast straight in the String and therefore an extension it is not necessary anymore. The only difference is that it returns a Substring. If you need a String you need to i... |
22,081,140 | How to execute parent directive before child directive? | <p>I'm looking to write two angular directives, a parent and a child directive, to create sortable and cloneable widgets. The intended markup is:</p>
<pre class="lang-html prettyprint-override"><code><div class="widget-container" data-sortable-widgets>
<section class="widget" data-cloneable-widget>&l... | 22,081,483 | 1 | 0 | null | 2014-02-27 21:43:48.98 UTC | 10 | 2015-11-06 15:47:03.573 UTC | 2014-09-08 23:50:43.567 UTC | null | 439,427 | null | 1,267,778 | null | 1 | 23 | javascript|angularjs|angularjs-directive | 10,233 | <h2>Reasoning</h2>
<p><code>postLink()</code> is executed in reverse order, which means the child directive's <code>postLink()</code> will be called before the parent's (i.e. depth first). For some reason, this is the default behavior (<code>link()</code> actually refers to <code>postLink()</code>). Luckily we also h... |
30,684,581 | java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference | <p>I'm getting error when runtime my project.</p>
<pre><code>java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.olympic/com.prima.olympic.ProductDetail}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object refe... | 30,684,669 | 3 | 2 | null | 2015-06-06 15:30:36.03 UTC | 1 | 2022-02-24 09:12:20.433 UTC | 2022-02-24 09:12:20.433 UTC | null | 17,436,751 | null | 4,069,252 | null | 1 | -1 | java|android|nullpointerexception | 59,155 | <p>Your String <code>checkOrigin</code> is <code>null</code> thus giving you a <code>NullPointerException</code>. This is what is causing it:</p>
<pre><code>String checkOrigin = i.getStringExtra("from_activity");
if(checkOrigin.equals("shoppinglist")){
btnAddtoShoppingList.setVisibility(View.GONE);
btnDeleteSh... |
29,619,376 | How to exclude Log Tag in logcat Android Studio? | <p>I'm not sure if this kind of question been asked before (I did Google it but not found the proper way to solve my question).</p>
<p><em>what I hope is I can disable (exclude) Log Tag from libraries used in my project.</em></p>
<p>I tried to go in <strong>Logcat console > Edit Filter Configuration > Log Tag(regex)<... | 29,619,554 | 1 | 1 | null | 2015-04-14 04:49:52.92 UTC | 19 | 2021-09-09 19:57:50.2 UTC | 2017-05-23 11:33:26.547 UTC | null | -1 | null | 4,019,662 | null | 1 | 63 | android-studio|logcat|android-logcat | 23,407 | <p>I'm sorry for answering my own question after 20 minutes of asking.
My friend just sent me a link that solves my question</p>
<p>here it is: <a href="https://stackoverflow.com/questions/5511433/how-to-exclude-certain-messages-by-tag-name-using-android-adb-logcat">How to exclude certain messages by TAG name using And... |
29,485,035 | dyld: Library not loaded: @rpath/Alamofire.framework/Versions/A/Alamofire Reason: image not found | <p>I'm using <code>CocoaPods v0.36</code> with my <code>Swift</code> project and the following pods: <code>Alamofire</code>, <code>CocoaLumberjack</code>, <code>SwiftyJSON</code>.</p>
<p>Everything was fine till I used my Developer ID.
Compiler started to have problems to compile the project, after some fixes and upda... | 35,882,506 | 14 | 2 | null | 2015-04-07 06:19:43.097 UTC | 9 | 2020-06-26 18:29:34.64 UTC | 2018-10-26 08:15:11.707 UTC | null | 3,950,397 | null | 1,734,106 | null | 1 | 33 | ios|xcode|cocoa|cocoapods | 37,121 | <p>Solved Below the steps I did:</p>
<ul>
<li>pod deintegrate, pod update, pod install</li>
<li>Reimported the three swift library files (generated by cocoapods)</li>
<li>Imported the three frameworks only in the Linked Frameworks and Libraries</li>
<li>Full clean and a build</li>
</ul> |
36,577,020 | PHP - Failed to open stream : No such file or directory | <p>In PHP scripts, whether calling <code>include()</code>, <code>require()</code>, <code>fopen()</code>, or their derivatives such as <code>include_once</code>, <code>require_once</code>, or even, <code>move_uploaded_file()</code>, one often runs into an error or warning: </p>
<blockquote>
<p>Failed to open stream :... | 36,577,021 | 10 | 3 | null | 2016-04-12 14:58:40.19 UTC | 84 | 2022-06-01 20:54:02.817 UTC | 2017-08-19 10:13:32.623 UTC | null | 1,033,581 | null | 2,873,507 | null | 1 | 214 | php|require|fopen|include-path | 733,005 | <p>There are many reasons why one might run into this error and thus a good checklist of what to check first helps considerably.</p>
<p>Let's consider that we are troubleshooting the following line:</p>
<pre><code>require "/path/to/file"
</code></pre>
<p><br></p>
<h1>Checklist</h1>
<p><br></p>
<h2>1. Check the fi... |
14,268,141 | Services with missing/unavailable dependencies | <p>Any idea why I'm getting this error:</p>
<pre><code>JBAS014775: New missing/unsatisfied dependencies:
service jboss.jdbc-driver.mysql (missing) dependents: [service jboss.data-source.jboss/datasources/UserDS]
</code></pre>
<hr>
<pre><code>ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-thr... | 19,552,619 | 3 | 0 | null | 2013-01-10 22:06:54.687 UTC | null | 2019-11-14 09:17:48.817 UTC | 2013-01-10 22:54:40.91 UTC | null | 1,243,905 | null | 1,243,905 | null | 1 | 6 | java|mysql|persistence|ejb-3.0 | 48,547 | <p>the reason for the error is you are missing the dependence java:jboss/datasources/UserDS.
With Jboss 7.x+ these datasource can be added directly to the app servers configuration as you discovered.</p>
<p>the difference between Standalone and Domain configuration is the standalone configuration is designed for only ... |
31,553,560 | Visual Studio 2015 is very slow | <p>I just finished the installation and the whole IDE is super slow. It seems like it's making some kind of heavy CPU calls in the background where the whole IDE literally freezes and becomes unresponsive for about 2-3 seconds.</p>
<p>I was not having this issue with Visual Studio 2013 Ultimate. I am running Visual St... | 31,655,079 | 19 | 14 | null | 2015-07-22 03:52:39.077 UTC | 27 | 2019-07-17 21:46:09.69 UTC | 2016-12-26 20:41:52.623 UTC | null | 63,550 | null | 862,919 | null | 1 | 145 | visual-studio-2015 | 139,466 | <p>My Visual Studio 2015 RTM was also very slow using ReSharper 9.1.2, but it has worked fine since I upgraded to 9.1.3 (see <a href="http://blog.jetbrains.com/dotnet/2015/07/24/resharper-9-1-3-to-the-rescue/" rel="noreferrer" title="ReSharper 9.1.3 to the Rescue">ReSharper 9.1.3 to the Rescue</a>). Perhaps a cue.</p>
... |
48,673,408 | Should JavaScript npm packages be minified? | <p>I have created <a href="https://www.npmjs.com/~mrmartineau" rel="noreferrer">quite a few npm packages</a>, but I still don't know the right answer to this question: "Should JavaScript npm packages be minified?"</p>
<p>I have always understood that minifying minified code is a bad idea so have not done that in my np... | 48,673,965 | 1 | 5 | null | 2018-02-07 21:18:23.917 UTC | 9 | 2020-07-13 03:53:49.417 UTC | null | null | null | null | 91,359 | null | 1 | 43 | javascript|node.js|npm | 9,709 | <p><strong>It all depends on the environment of your package consumers</strong></p>
<hr>
<h2>NodeJS</h2>
<p>For a NodeJS audience your package does not have to be minified, since node runtimes normally have <em>direct file access</em> to the <code>node_modules</code> folder. No network transfers are required, and no... |
6,587,360 | change to database to 'online' and set db to 'multi-user' | <p>I have a 2008 sql database that is offline that I would like to take online and set to multi-user. Using sql server management studio - new query window - when i execute the following:</p>
<pre><code> ALTER DATABASE mydb SET ONLINE;
ALTER DATABASE mydb SET MULTI_USER;
</code></pre>
<p>I receive this error ... | 6,587,461 | 2 | 0 | null | 2011-07-05 18:44:47.113 UTC | 2 | 2021-05-12 13:34:26.92 UTC | 2011-07-05 18:48:13.203 UTC | null | 527,185 | null | 185,961 | null | 1 | 9 | sql|sql-server-2008 | 55,144 | <blockquote>
<p>a user is currently connected to it</p>
</blockquote>
<p>^ This is the problem you need to solve.</p>
<p>Make sure you are not IN that database. Close any query windows that are connected to it, shut down Object Explorer Details, close SSMS and re-open it without Object Explorer connected to that server... |
7,406,946 | Why is Apple Deprecating OpenSSL in MacOS 10.7 (Lion)? | <p>Apple has marked most (but not all) of the OpenSSL API as "deprecated" in MacOS 10.7. Has Apple made any statements explaining why they are moving from OpenSSL to Common Crypto?</p> | 7,406,994 | 3 | 4 | null | 2011-09-13 18:52:20.157 UTC | 8 | 2018-04-09 01:34:05.92 UTC | 2018-04-09 01:34:05.92 UTC | null | 51,167 | null | 51,167 | null | 1 | 30 | openssl|osx-lion | 17,708 | <p>Apple is migrating from OpenSSL to Common Crypto (which Apple develops).</p>
<p>Some docs:
<a href="http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/CC_crypto.3cc.html" rel="noreferrer">http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/CC_crypto... |
7,641,876 | Java - The difference between class "ClassName" and public class "ClassName" | <p>What's the difference between</p>
<pre><code>class x {
//code here
}
</code></pre>
<p>and</p>
<pre><code>public class x {
//code here
}
</code></pre>
<p>Sometimes I see examples on the Internet and they'll have <code>public class</code> instead of <code>class</code> and they're all simple programs. I use... | 7,641,889 | 4 | 1 | null | 2011-10-03 23:40:17.31 UTC | 12 | 2014-06-18 08:01:24.887 UTC | null | null | null | null | 706,853 | null | 1 | 28 | java|class | 31,066 | <p>The first one will result in your class being assigned the default visibility, that is <code>package-private</code> (ie: accessible within the same <code>package</code>).</p>
<p>The second one makes it <code>public</code>, that is, visible to any other class.</p>
<h3>Reference: <a href="http://download.oracle.com/ja... |
7,958,738 | Example of implementation of Baum-Welch | <p>I'm trying to learn about Baum-Welch algorithm(to be used with a hidden markov model). I understand the basic theory of forward-backward models, but it would be nice for someone to help explain it with some code(I find it easier to read code because I can play around to understand it). I checked github and bitbuck... | 7,962,692 | 1 | 0 | null | 2011-10-31 19:35:42.19 UTC | 11 | 2014-07-15 16:55:11.757 UTC | 2011-11-01 09:31:08.403 UTC | null | 344,821 | null | 640,558 | null | 1 | 15 | java|python|algorithm|statistics|machine-learning | 14,544 | <p>Here's some code that I wrote several years ago for a class, based on the presentation in Jurafsky/Martin (2nd edition, chapter 6, if you have access to the book). It's really not very good code, doesn't use numpy which it absolutely should, and it does some crap to have the arrays be 1-indexed instead of just tweak... |
1,558,291 | Push elements from one array into rows of another array (one element per row) | <p>I need to push elements from one array into respective rows of another array.</p>
<p>The 2 arrays are created from <code>$_POST</code> and <code>$_FILES</code> and I need them to be associated with each other based on their indexes.</p>
<pre><code>$array1 = [
[123, "Title #1", "Name #1"],
... | 1,558,316 | 4 | 0 | null | 2009-10-13 05:10:21.58 UTC | 3 | 2022-09-16 12:45:07.833 UTC | 2022-09-16 12:45:07.833 UTC | null | 2,943,403 | null | 99,106 | null | 1 | 19 | php|multidimensional-array|merge|append|array-push | 56,696 | <pre><code>$i=0;
$NewArray = array();
foreach($OriginalArray as $value) {
$NewArray[] = array_merge($value,array($_FILES['Upload']['name'][$i]));
$i++;
}
</code></pre>
<p>the [] will append it to the array instead of overwriting.</p> |
2,264,750 | Poll Database Schema | <p>What is the best database schema for polls? Is one-to-many relationship good for this? I'm thinking about having two tables:</p>
<pre><code>poll_questions
int id
varchar body
datetime created_at
datetime updated_at
poll_answers
int id
varchar body
int votes default 0
int question_id... | 2,264,761 | 4 | 2 | null | 2010-02-15 08:39:47.877 UTC | 10 | 2019-08-08 04:17:12.71 UTC | 2010-02-15 08:51:10.107 UTC | null | 95,944 | null | 95,944 | null | 1 | 25 | mysql|database-schema | 9,890 | <p>The schema looks good, and yes, you'd need to <a href="https://stackoverflow.com/questions/2260406/voting-stopping-abuse-from-client-side-asp-net-mvc/2263045#2263045">track the user votes as well</a>.</p> |
1,814,169 | Geographical boundaries of states/provinces -> Google Maps Polygon | <p>I'm building a web application that is going to dynamically highlight certain U.S. states and Canadian provinces on a Google Map, based on buttons and click events.</p>
<p>Plan A) Polygons</p>
<p>My primary idea for this was to draw Polygons. For this I need lists of coordinates (latitude + longitude) of all state... | 1,814,325 | 4 | 1 | null | 2009-11-28 23:49:09.097 UTC | 34 | 2018-05-11 18:47:54.83 UTC | null | null | null | null | 149,231 | null | 1 | 36 | google-maps|coordinates|geography|gis | 51,589 | <p>I've got XML for US state polygons <a href="http://econym.org.uk/gmap/states.xml" rel="noreferrer">here</a>. I use them like <a href="http://econym.org.uk/gmap/example_states4.htm" rel="noreferrer">this</a>.</p>
<p>I deliberately kept the detail fairly light to reduce the loading time and end up with a map that's r... |
2,314,179 | How to browse TFS changesets? | <p>I want to browse TFS changesets.</p>
<p>I do NOT want to search changesets by specifying a file contained within the changeset. I do not want to specify which user I think created the changeset.</p>
<p>I simply want to key in a changeset number and look at that changeset. Or maybe view a range, and then browse tho... | 2,316,695 | 4 | 4 | null | 2010-02-22 21:05:06.763 UTC | 11 | 2017-11-30 22:27:31.51 UTC | null | null | null | null | 630 | null | 1 | 66 | tfs | 50,537 | <p>In Source Control Explorer, hit CTRL+G. This will bring up the Find Changesets dialog. Unfortunately it's kind of one-size-fits-all in VS 2008: you have to work inside a big bulky search dialog, even if you already know the number(s). In your case, flip the radio button to search by range and then key in the desi... |
10,584,948 | Doubles, commas and dots | <p>I'm making an Android Java program which is taking double values from the user. If I run the program on the computer, it works great because of the locale of my computer, EN_UK. But when I run it on my mobile phone with FI_FI locale, it won't work. I know the reason: In UK, people use dot as decimal separator but he... | 10,585,046 | 7 | 2 | null | 2012-05-14 14:06:54.867 UTC | 7 | 2019-07-21 11:59:29.073 UTC | 2019-07-21 11:59:29.073 UTC | null | 7,983,864 | null | 1,279,334 | null | 1 | 18 | java|android|decimal | 41,512 | <p>Use one of the other constructors of DecimalFormat:</p>
<pre><code>new DecimalFormat("#.#", new DecimalFormatSymbols(Locale.US))
</code></pre>
<p>And then try and parse it using both separators.</p> |
49,296,318 | How to set different font sizes for different devices using Xcode Storyboard? | <p>I want to set different font sizes for iPhone 5, iPhone 6 Plus, iPhone 7 Plus and iPhone X using Xcode Storyboard.</p>
<p>Can anyone offer any advice?</p>
<p><a href="https://i.stack.imgur.com/rqADm.png" rel="noreferrer"><img src="https://i.stack.imgur.com/rqADm.png" alt="Example is shown in the image where i was ... | 49,296,508 | 3 | 4 | null | 2018-03-15 09:56:50.397 UTC | 10 | 2019-06-13 07:40:59.77 UTC | 2019-06-13 07:40:59.77 UTC | null | 5,638,630 | null | 7,241,050 | null | 1 | 14 | ios|fonts|font-size|xcode-storyboard | 8,279 | <p>Use <a href="https://developer.apple.com/library/content/featuredarticles/ViewControllerPGforiPhoneOS/TheAdaptiveModel.html" rel="noreferrer">Size-Class</a> and add size variation for fonts from <code>Attribute Inspector</code> of Label property.</p>
<p>Here are different possible variations, you can set with Size c... |
49,042,830 | Why does the node inspector not start when I am using nodemon and ts-node? | <p>I have a simple node server written in typescript. My package.json is configured as:</p>
<pre><code>"scripts": {
"build": "tsc",
"dev": "nodemon --watch src/**/* -e ts,json --exec ts-node ./src/server.ts",
"debug": "nodemon --verbose --watch src/**/* -e ts,json --exec ts-node --inspect ./src/server.ts"
},
<... | 49,122,820 | 6 | 4 | null | 2018-03-01 04:51:30.977 UTC | 10 | 2022-05-05 10:30:51.033 UTC | null | null | null | user60456 | null | null | 1 | 33 | node.js|typescript|debugging|nodemon|ts-node | 22,406 | <p>With ts-node 5.0.0 you no longer pass the <code>--inspect flag</code> the same way. The suggested way is <code>node --inspect -r ts-node/register path/to/ts</code>. For example:</p>
<p><code>nodemon --watch src/**/* -e ts,json --exec node --inspect-brk -r ts-node/register src/app.ts</code></p>
<p>see <a href="ht... |
7,637,482 | How do browsers resolve conflicting classes? | <p>I know it's possible to specify multiple classes on an element in HTML: </p>
<pre><code><div class='one two'>Text</div>
</code></pre>
<p>It seems like classes are accessible from Javascript as a single string. </p>
<p>What happens when the classes are specified with conflicting properties? For instanc... | 7,637,536 | 6 | 6 | null | 2011-10-03 15:59:05.217 UTC | 2 | 2011-10-03 21:27:40.35 UTC | 2011-10-03 16:06:16.82 UTC | null | 798,818 | null | 340,947 | null | 1 | 32 | html|css|dom | 11,831 | <p>Read about specificity:</p>
<ul>
<li><a href="http://www.htmldog.com/guides/cssadvanced/specificity/" rel="noreferrer">Simple explanation</a></li>
<li><a href="http://coding.smashingmagazine.com/2007/07/27/css-specificity-things-you-should-know/" rel="noreferrer">More in depth explanation</a></li>
</ul>
<p>Short a... |
7,420,937 | run program in Python shell | <p>I have a demo file: <code>test.py</code>.
In the Windows Console I can run the file with: <code>C:\>test.py</code></p>
<p>How can I execute the file in the Python Shell instead?</p> | 7,420,972 | 6 | 2 | null | 2011-09-14 18:09:14.167 UTC | 41 | 2021-02-07 22:00:14.207 UTC | 2018-05-27 17:09:45.443 UTC | null | 9,170,457 | null | 537,173 | null | 1 | 65 | python|executable | 246,292 | <p>Use <a href="https://docs.python.org/2.7/library/functions.html#execfile" rel="noreferrer">execfile</a> for <strong>Python 2</strong>:</p>
<pre><code>>>> execfile('C:\\test.py')
</code></pre>
<p>Use <a href="https://docs.python.org/3/library/functions.html#exec" rel="noreferrer">exec</a> for <strong>Pytho... |
7,439,977 | Changing date format in R | <p>I have some very simple data in R that needs to have its date format changed:</p>
<pre><code> date midpoint
1 31/08/2011 0.8378
2 31/07/2011 0.8457
3 30/06/2011 0.8147
4 31/05/2011 0.7970
5 30/04/2011 0.7877
6 31/03/2011 0.7411
7 28/02/2011 0.7624
8 31/01/2011 0.7665
9 31/12/2010 ... | 7,440,055 | 7 | 0 | null | 2011-09-16 03:56:48.34 UTC | 20 | 2020-07-12 11:26:45.973 UTC | 2020-07-12 11:26:45.973 UTC | null | 1,851,712 | null | 855,046 | null | 1 | 36 | r|date|format|strptime|r-faq | 222,424 | <p>There are two steps here:</p>
<ul>
<li>Parse the data. Your example is not fully reproducible, is the data in a file, or the variable in a text or factor variable? Let us assume the latter, then if you data.frame is called X, you can do</li>
</ul>
<blockquote>
<pre><code> X$newdate <- strptime(as.character(X$d... |
7,456,807 | Python name mangling | <p>In other languages, a general guideline that helps produce better code is always make everything as hidden as possible. If in doubt about whether a variable should be private or protected, it's better to go with private.</p>
<p>Does the same hold true for Python? Should I use two leading underscores on everything a... | 7,456,865 | 11 | 0 | null | 2011-09-17 18:07:49.92 UTC | 68 | 2021-08-06 17:38:39.44 UTC | 2017-05-23 11:54:31.18 UTC | null | -1 | null | 627,005 | null | 1 | 141 | python|naming-conventions | 57,661 | <p>When in doubt, leave it "public" - I mean, do not add anything to obscure the name of your attribute. If you have a class with some internal value, do not bother about it. Instead of writing:</p>
<pre><code>class Stack(object):
def __init__(self):
self.__storage = [] # Too uptight
def pus... |
7,402,801 | "Cannot connect to iTunes Store" in-app purchases | <p>I am having problems testing my in-app purchases. I get back valid product identifiers, but upon purchase I receive the dreaded "Cannot connect to iTunes Store". Interesting thing is that restore purchases seems to work - iTunes login pops up.</p>
<p>I have:
- Checked that my in-app purchases are cleared for sale
-... | 13,666,186 | 17 | 2 | null | 2011-09-13 13:36:39.213 UTC | 10 | 2020-08-24 10:03:28.31 UTC | 2015-08-10 07:27:21.97 UTC | null | 916,299 | null | 942,654 | null | 1 | 102 | ios|cocoa-touch|in-app-purchase | 64,038 | <p>Make sure you have signed out of any production iTunes accounts on the device.</p>
<p>I was getting this error on my test phone which was logged in with my actual iTunes account. You cannot test apps using your production iTunes account, hence the error. I just wish Apple provided a better error so as to avoid this... |
29,887,429 | How can I programmatically force stop an Android app with Java? | <p>How can I force stop an app with Java? I'm trying to build a memory cleaner that can help clean out background processes.</p>
<p>I know there is a way to kill the process of an app, but when you go to the running list, the app is still there even after you have killed it. And I have tried a lot of similar memory cl... | 29,887,666 | 2 | 9 | null | 2015-04-27 04:51:03.83 UTC | 10 | 2019-04-11 15:19:28.45 UTC | 2019-04-11 15:16:56.66 UTC | null | 6,782,707 | null | 4,817,254 | null | 1 | 11 | java|android|process | 28,726 | <p>get the process ID of your application, and kill that process onDestroy() method</p>
<pre><code>@Override
public void onDestroy()
{
super.onDestroy();
int id= android.os.Process.myPid();
android.os.Process.killProcess(id);
}
</code></pre>
<p>or </p>
<pre><code>getActivity().finish();
System.exit(0)... |
43,329,654 | Android Back Button on a Progressive Web Application closes de App | <p>Can a "pure" HTML5/Javascript (progressive) web application intercept the mobile device back button in order to avoid the App to exit?</p>
<p>This question is similar to <a href="https://stackoverflow.com/questions/8602722/phonegap-android-back-button-close-app-with-back-button-on-homepage">this one</a> but I want ... | 49,719,812 | 5 | 1 | null | 2017-04-10 17:41:56.137 UTC | 18 | 2021-03-18 19:48:29.747 UTC | 2017-05-23 11:46:36.667 UTC | null | -1 | null | 1,260,910 | null | 1 | 30 | android|html|service-worker|progressive-web-apps | 21,465 | <p>While the android back button cannot be directly hooked into from within a progressive web app context, there exists a history api which we can use to achieve your desired result.</p>
<p>First up, when there's no browser history for the page that the user is on, pressing the back button immediately closes the app.<... |
43,360,852 | Cannot parse String in ISO 8601 format, lacking colon in offset, to Java 8 Date | <p>I'm a little bit frustrated of java 8 date format/parse functionality. I was trying to find Jackson configuration and <code>DateTimeFormatter</code> to parse <code>"2018-02-13T10:20:12.120+0000"</code> string to any Java 8 date, and didn't find it.<br>
This is <code>java.util.Date</code> example which works fine:</... | 43,361,405 | 3 | 1 | null | 2017-04-12 05:18:41.533 UTC | 9 | 2020-09-08 05:50:08.61 UTC | 2018-02-03 04:59:43.48 UTC | null | 642,706 | null | 7,854,401 | null | 1 | 25 | java|parsing|datetime|java-8|iso8601 | 7,161 | <h1>tl;dr</h1>
<p>Until bug is fixed:</p>
<pre><code>OffsetDateTime.parse(
"2018-02-13T10:20:12.120+0000" ,
DateTimeFormatter.ofPattern( "uuuu-MM-dd'T'HH:mm:ss.SSSX" )
)
</code></pre>
<p>When bug is fixed:</p>
<pre><code>OffsetDateTime.parse( "2018-02-13T10:20:12.120+0000" )
</code></pre>
<h1>Details</h1... |
43,122,113 | Sizing elements to percentage of screen width/height | <p>Is there a simple (non-LayoutBuilder) way to size an element relative to screen size (width/height)? For example: how do I set the width of a CardView to be 65% of the screen width.</p>
<p>It can't be done inside the <code>build</code> method (obviously) so it would have to be deferred until post build. Is there a ... | 43,130,622 | 14 | 2 | null | 2017-03-30 15:26:13.63 UTC | 79 | 2022-07-22 13:15:23.383 UTC | 2021-12-26 09:41:49.583 UTC | user10563627 | null | null | 353,463 | null | 1 | 303 | flutter|dart|flutter-layout|screen-size | 296,567 | <p><code>FractionallySizedBox</code> may also be useful.
You can also read the screen width directly out of <code>MediaQuery.of(context).size</code> and create a sized box based on that</p>
<pre><code>MediaQuery.of(context).size.width * 0.65
</code></pre>
<p>if you really want to size as a fraction of the screen rega... |
9,220,432 | HTTP 401 Unauthorized or 403 Forbidden for a "disabled" user? | <p>An authentication service allows user accounts be disabled (a sort of soft-delete).</p>
<p>If the server then receives an authentication request for a disabled user that would otherwise be valid, should the server return 401 or 403? With either status code, I would return a message indicating that the account had be... | 9,281,494 | 3 | 1 | null | 2012-02-09 23:14:38.73 UTC | 10 | 2019-11-20 22:58:06.557 UTC | 2021-10-07 05:46:31.917 UTC | null | -1 | null | 176,741 | null | 1 | 28 | http|rest|restful-authentication | 64,800 | <p>Based on <a href="http://lists.w3.org/Archives/Public/ietf-http-wg/2010JulSep/0085.html" rel="noreferrer">an email</a> written by <a href="http://roy.gbiv.com/" rel="noreferrer">Roy T. Fielding</a>, there's apparently <a href="http://trac.tools.ietf.org/wg/httpbis/trac/ticket/294" rel="noreferrer">a bug</a> in the c... |
9,623,258 | Passing an Array or List to @Pathvariable - Spring/Java | <p>I am doing a simple 'get' in JBoss/Spring. I want the client to pass me an array of integers in the url. How do I set that up on the server? And show should the client send the message? </p>
<p>This is what I have right now. </p>
<pre><code>@RequestMapping(value="/test/{firstNameIds}", method=RequestMethod.GET)
@R... | 22,298,768 | 5 | 1 | null | 2012-03-08 18:58:16.813 UTC | 19 | 2020-05-10 05:33:35.42 UTC | 2012-03-08 21:47:52.36 UTC | null | 21,234 | null | 805,082 | null | 1 | 71 | java|spring-mvc|path-variables | 105,564 | <pre><code>GET http://localhost:8080/public/test/1,2,3,4
@RequestMapping(value="/test/{firstNameIds}", method=RequestMethod.GET)
@ResponseBody
public String test(@PathVariable String[] firstNameIds)
{
// firstNameIds: [1,2,3,4]
return "Dummy";
}
</code></pre>
<p>(tested with Spring MVC 4.0.1)</p> |
45,723,819 | What is a "span" and when should I use one? | <p>Recently I've gotten suggestions to use <code>span<T></code>'s in my code, or have seen some answers here on the site which use <code>span</code>'s - supposedly some kind of container. But - I can't find anything like that in the C++17 standard library. </p>
<p>So what is this mysterious <code>span<T></... | 45,723,820 | 3 | 5 | null | 2017-08-16 22:15:05.487 UTC | 102 | 2022-09-10 16:31:52.07 UTC | 2020-04-09 12:19:48.257 UTC | null | 1,593,077 | null | 1,593,077 | null | 1 | 367 | c++|c++20|c++-faq|cpp-core-guidelines|std-span | 120,516 | <h2>What is it?</h2>
<p>A <code>span<T></code> is:</p>
<ul>
<li>A very lightweight abstraction of a contiguous sequence of values of type <code>T</code> somewhere in memory.</li>
<li>Basically a <code>struct { T * ptr; std::size_t length; }</code> with a bunch of convenience methods.</li>
<li>A non-owning type (i... |
19,314,228 | Find Positions of a Character in a String | <p>How can I find a character in a <code>String</code> and print the position of character all over the string? For example, I want to find positions of <code>'o'</code> in this string : <code>"you are awesome honey"</code> and get the answer = <code>1 12 17</code>.</p>
<p>I wrote this, but it doesn't work : </p>
<pr... | 19,314,980 | 5 | 2 | null | 2013-10-11 09:02:46.1 UTC | 0 | 2017-02-14 19:00:30.52 UTC | 2016-11-06 11:47:47.847 UTC | null | 3,885,376 | null | 2,870,273 | null | 1 | 8 | java|string|character|indices | 63,042 | <p>You were almost right. The issue is your last line. You should print <code>i</code> instead of <code>string.indexOf(i)</code>:</p>
<pre><code>public class Pos{
public static void main(String args[]){
String string = ("You are awesome honey");
for (int i = 0 ; i<string.length() ; i++)
... |
19,719,767 | override class variable in python? | <p>Below, <code>base_id</code> and <code>_id</code> is a class variable and shared among all child classes.<br>
Is there a way to separate them into each class?</p>
<pre><code>from itertools import count
class Parent(object):
base_id = 0
_id = count(0)
def __init__(self):
self.id = self.base_id +... | 19,719,831 | 3 | 2 | null | 2013-11-01 02:09:40.143 UTC | 2 | 2013-11-01 03:37:22.903 UTC | 2013-11-01 02:14:41.623 UTC | null | 2,225,682 | null | 433,570 | null | 1 | 15 | python|class | 44,456 | <p>If you don't want to violate the DRY principle like falsetru suggests, you'll need to use metaclasses. I was thinking of writing something up, but <a href="https://stackoverflow.com/questions/100003/what-is-a-metaclass-in-python">there's already a good long description of metaclasses on SO</a>, so check it out.</p>
... |
19,446,544 | Post request to include 'Content-Type' and JSON | <p>I'm to work with goo.gl for URL shortening. I need to make the following request: </p>
<pre><code>POST https://www.googleapis.com/urlshortener/v1/url
Content-Type: application/json
{"longUrl": "http://www.google.com/"}
</code></pre>
<p>my html:-</p>
<pre><code><form method="post" action="https://www.googleapis... | 19,446,993 | 4 | 3 | null | 2013-10-18 09:46:45.52 UTC | 8 | 2020-10-27 05:44:26.957 UTC | null | null | null | null | 2,596,724 | null | 1 | 19 | html|http|post | 59,765 | <p>Browsers do not support JSON as a media type for form submissions (the supported types are <a href="https://www.w3.org/TR/html5/sec-forms.html#element-attrdef-form-enctype" rel="noreferrer">listed in the spec</a>).</p>
<p>The only way to make such a request from a web page is to use the XMLHttpRequest object.</p>
... |
432,637 | Materials for SICP with python? | <p>I want to try out SICP with Python.</p>
<p>Can any one point to materials (video.article...) that teaches Structure and Interpretation of Computer Programs in <strong>python</strong>.</p>
<p>Currently learning from SICP videos of Abelson, Sussman, and Sussman.</p> | 433,688 | 5 | 1 | null | 2009-01-11 09:13:48.41 UTC | 11 | 2018-11-14 11:59:07.45 UTC | 2011-12-09 15:20:13.9 UTC | null | 3,043 | rajKumar | 22,076 | null | 1 | 6 | python|sicp | 12,062 | <p>Don't think there is a complete set of materials, <a href="http://www.codepoetics.com/wiki/index.php?title=Topics:SICP_in_other_languages" rel="noreferrer">this</a> is the best I know.</p>
<p>If you are up to generating the material yourself, a bunch of us plan to work through SICP collectively <a href="http://hn-s... |
233,411 | How do I enable a second monitor in C#? | <p>Is it possible to enable a second monitor programatically and extend the Windows Desktop onto it in C#? It needs to do the equivalent of turning on the checkbox in the image below.</p>
<p><img src="https://i.stack.imgur.com/ss2sE.png" alt="alt text"></p> | 233,826 | 5 | 0 | null | 2008-10-24 12:55:47.603 UTC | 16 | 2019-02-14 20:40:30.677 UTC | 2019-02-14 20:40:30.677 UTC | whatknott | 4,751,173 | matt | 4,500 | null | 1 | 21 | c#|winforms|desktop|multiple-monitors | 22,631 | <p><a href="http://msdn.microsoft.com/en-us/library/ms533259.aspx" rel="noreferrer">MSDN Device Context Functions</a></p>
<p>What you basically need to do:</p>
<blockquote>
<p>Use the EnumDisplayDevices() API call
to enumerate the display devices on
the system and look for those that
don't have the
<code>DI... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.