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,780,413 | salesforce SOQL : query to fetch all the fields on the entity | <p>I was going through the SOQL documentation , but couldn't find query to fetch all the field data of an entity say , Account , like </p>
<pre><code>select * from Account [ SQL syntax ]
</code></pre>
<p>Is there a syntax like the above in SOQL to fetch all the data of account , or the only way is to list all the ... | 8,780,460 | 6 | 0 | null | 2012-01-08 19:15:00.743 UTC | 2 | 2019-01-09 10:20:06.893 UTC | null | null | null | null | 227,100 | null | 1 | 17 | salesforce|soql | 40,153 | <p>You have to specify the fields, if you want to build something dynamic the describeSObject call returns the metadata about all the fields for an object, so you can build the query from that.</p> |
8,384,120 | Equivalent function for xticks for an AxesSubplot object | <p>So I am trying to use Axes objects to control my matlibplot figure. I am not using plt (aka import matlibplot.pyplot as plt) because I am embedding the figure in my tkinter GUI per <a href="http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_tk.html" rel="noreferrer">this</a>.</p>
<p>However, I... | 8,384,229 | 1 | 0 | null | 2011-12-05 10:46:36.177 UTC | 7 | 2018-06-05 12:46:43.153 UTC | null | null | null | null | 402,632 | null | 1 | 69 | python|matplotlib|tkinter | 71,712 | <p>you can use instead:</p>
<pre><code>axes.set_xticks(ticks, minor=False)
</code></pre>
<p>and</p>
<pre><code>axes.set_xticklabels(labels, fontdict=None, minor=False)
</code></pre> |
8,574,332 | How to change port number for apache in WAMP | <p>I am new to WAMP server and installed it on my system but after installing it when I check it by going to localhost url like this <code>http://localhost/</code> in the browser it is not working. I am getting a <strong>404 error and blank page</strong>. </p>
<p>This is because my 80 port which default in <code>Wa... | 8,574,355 | 8 | 0 | null | 2011-12-20 10:56:03.307 UTC | 31 | 2019-09-13 05:27:40.833 UTC | 2014-01-15 13:48:56.49 UTC | null | 998,627 | null | 998,627 | null | 1 | 123 | apache|wamp | 366,229 | <p>Click on the WAMP server icon and from the menu under <em>Config Files</em> select
<code>httpd.conf</code>. A long text file will open up in notepad. In this file scroll
down to the line that reads <code>Port 80</code> and change this to read <code>Port 8080</code>,
Save the file and close notepad. Once again cli... |
27,322,826 | angular restriction to not allow spaces in text field | <p>I do not want a user to enter spaces in a text field. I don't want it on submit validation but rather - a space will not show up on the text field when they click it. </p> | 27,330,469 | 8 | 1 | null | 2014-12-05 18:56:59.003 UTC | 6 | 2020-06-13 12:45:50.943 UTC | null | null | null | null | 866,206 | null | 1 | 16 | angularjs|angularjs-directive | 45,020 | <pre><code><input ng-model="field" ng-trim="false" ng-change="field = field.split(' ').join('')" type="text">
</code></pre>
<p>Update:
To improve code quality you can create custom directive instead. But don't forget that your directive should prevent input not only from keyboard, but also from pasting.</p>
<pr... |
30,712,235 | Spinner Dropdown Arrow | <p>I am trying to obtain a custom Spinner such as this one:</p>
<p><img src="https://i.stack.imgur.com/lkJ4K.png" alt=""></p>
<p>but I was only able to get this:</p>
<p><img src="https://i.stack.imgur.com/PEUWC.png" alt="enter image description here"></p>
<p>As you can see I experience several problems. </p>
<ol>
... | 30,713,012 | 2 | 0 | null | 2015-06-08 14:43:33.03 UTC | 1 | 2017-07-17 13:49:26.963 UTC | 2015-06-11 20:21:32.327 UTC | null | 2,395,491 | null | 2,395,491 | null | 1 | 7 | android|android-layout|spinner | 44,251 | <p>You have to remove the <code>Imageview</code> into your custom layout <code>row_spinner.xml</code>. In case, you don't need to create an arrow inside your custom layout, because if you do, it'll be created in each row like happened to you. For doing the same you showed us, you must change the <code>Spinner</code> st... |
1,230,753 | jQuery dynamic selector | <p>I have some code which uses a selector in a loop. </p>
<p>This works: </p>
<pre><code>document.getElementById("new_grouping_"+i).value
</code></pre>
<p>This does not: <code>$("#new_grouping_"+i).value</code></p>
<p>Is there a way to do this using jQuery?</p> | 1,230,766 | 3 | 0 | null | 2009-08-05 01:33:01.93 UTC | 5 | 2019-11-04 13:11:54.963 UTC | 2012-01-09 10:38:47.403 UTC | null | 722,783 | null | 14,897 | null | 1 | 23 | jquery | 66,612 | <p>You should use the <a href="http://docs.jquery.com/Attributes/val" rel="noreferrer">val()</a> function:</p>
<pre><code>var myValue = $("#new_grouping_"+i).val(); // to get the value
$("#new_grouping_"+i).val("something"); // to set the value
</code></pre> |
736,514 | R Random Forests Variable Importance | <p>I am trying to use the random forests package for classification in R.</p>
<p>The Variable Importance Measures listed are:</p>
<ul>
<li>mean raw importance score of variable x for class 0</li>
<li>mean raw importance score of variable x for class 1</li>
<li><code>MeanDecreaseAccuracy</code></li>
<li><code>MeanDecr... | 839,718 | 3 | 0 | null | 2009-04-10 02:18:38.49 UTC | 39 | 2012-08-28 13:45:53.623 UTC | 2012-08-28 13:45:53.623 UTC | null | 602,276 | null | 20,895 | null | 1 | 46 | r|statistics|data-mining|random-forest | 49,499 | <blockquote>
<p>An explanation that uses the words 'error', 'summation', or 'permutated'
would be less helpful then a simpler explanation that didn't involve any
discussion of how random forests works.</p>
<p>Like if I wanted someone to explain to me how to use a radio, I wouldn't
expect the explanation to... |
431,752 | Python csv.reader: How do I return to the top of the file? | <p>When I'm moving through a file with a csv.reader, how do I return to the top of the file. If I were doing it with a normal file I could just do something like "file.seek(0)". Is there anything like that for the csv module?</p>
<p>Thanks ahead of time ;)</p> | 431,771 | 3 | 0 | null | 2009-01-10 21:04:49.097 UTC | 7 | 2020-11-09 13:57:58.377 UTC | null | null | null | Casey | 41,718 | null | 1 | 59 | python|csv | 71,422 | <p>You can seek the file directly. For example:</p>
<pre><code>>>> f = open("csv.txt")
>>> c = csv.reader(f)
>>> for row in c: print row
['1', '2', '3']
['4', '5', '6']
>>> f.seek(0)
>>> for row in c: print row # again
['1', '2', '3']
['4', '5', '6']
</code></pre> |
39,828,609 | SonarQube And SonarLint difference | <p>How exactly is sonarQube different from SonarLint ? SonarQube has a server associated with it and Sonar lint works more like a plugin. But what are their specific difference ? </p> | 39,836,205 | 5 | 0 | null | 2016-10-03 09:38:49.977 UTC | 14 | 2022-03-03 14:06:01.09 UTC | 2018-08-29 14:56:52.313 UTC | null | 390,177 | null | 2,854,057 | null | 1 | 118 | sonarqube|sonarlint | 78,541 | <p><a href="http://www.sonarlint.org/"><strong>SonarLint</strong></a> lives only in the IDE (IntelliJ, Eclipse and Visual Studio). Its purpose is to give instantaneous feedback as you type your code. For this, it concentrates on what code you are adding or updating.</p>
<p><a href="http://www.sonarqube.org/"><strong>S... |
34,990,236 | How to use SVG image in ImageView | <p>Good Day, I have a <code>SVG</code> image. How can I add it to <code>ImageView</code> background ?</p>
<p>I tried to use <a href="https://github.com/BigBadaboom/androidsvg" rel="noreferrer">this library</a> But I have problem:</p>
<pre><code>01-25 12:19:02.669 27719-27719/com.dvor.androidapp E/AndroidRuntime: FATA... | 34,990,795 | 6 | 2 | null | 2016-01-25 10:25:54.97 UTC | 8 | 2019-10-12 16:43:32.94 UTC | 2017-03-02 13:04:04.663 UTC | null | 3,585,230 | null | 5,779,142 | null | 1 | 67 | android|svg|androidsvg | 78,525 | <p>In new Android Studio there is possibility to import SVG to XML file, so You don't need to use external library.</p>
<p>In drawable right click -> New -> Vector Asset -> Local SVG file.</p>
<p><a href="https://i.stack.imgur.com/DvrA0.png"><img src="https://i.stack.imgur.com/DvrA0.png" alt="enter image description ... |
24,154,816 | Git Bash: Could not open a connection to your authentication agent | <p>I'm new to Github and Generating SSH Keys look a neccessity. And was informed by my boss about this, so I need to comply.</p>
<p>I successfully created SSH Key but when I'm going to add it to the ssh-agent</p>
<p>this is what happens</p>
<p>What seems to be the problem?</p>
<p><img src="https://i.stack.imgur.com... | 24,156,424 | 8 | 0 | null | 2014-06-11 04:44:36.367 UTC | 42 | 2021-02-14 11:05:32.113 UTC | 2021-02-14 11:05:32.113 UTC | null | 3,082,718 | null | 3,626,672 | null | 1 | 107 | git|github|ssh | 175,255 | <p>It seems you need to run <code>ssh-agent</code> before using it:</p>
<pre><code>eval `ssh-agent -s`
</code></pre>
<p>That question was answered in this topic: <a href="https://stackoverflow.com/questions/17846529/could-not-open-a-connection-to-your-authentication-agent">Could not open a connection to your authenti... |
42,756,354 | Should I use React.PureComponent everywhere? | <p>React says pure render can optimize performance.
And now React has PureComponent.
Should I use React.PureComponent everywhere?
Or when to use React.PureComponent and where is the most proper postion to use React.PureComponent?</p> | 42,756,445 | 2 | 1 | null | 2017-03-13 03:49:11.793 UTC | 18 | 2022-07-26 19:02:55.56 UTC | null | null | null | null | 6,582,606 | null | 1 | 59 | javascript|reactjs | 13,702 | <p>Not always. You should use it when a component could re-render even if it had the same props and state. An example of this is when a parent component had to re-render but the child component props and state didn't change. The child component could benefit from PureComponent because it really didn't need to re-render... |
5,890,576 | Usage of `...` (three-dots or dot-dot-dot) in functions | <p>Where can I find documentation on the usage of <code>...</code> in functions? Examples would be useful.</p> | 5,890,638 | 3 | 1 | null | 2011-05-04 22:26:49.747 UTC | 20 | 2012-08-29 10:19:59.227 UTC | 2012-08-29 10:19:59.227 UTC | null | 1,201,032 | null | 170,352 | null | 1 | 89 | r|ellipsis | 41,259 | <p>The word used to describe <code>...</code> is "ellipsis." Knowing this should make searching for information about the construct easier. For example, the first hit on Google is another question on this site: <a href="https://stackoverflow.com/questions/3057341/how-to-use-rs-ellipsis-feature-when-writing-your-own-f... |
5,955,965 | Move to start and end of search lookup | <p>In vim/gvim I would like to be able to move to the front and end of the current search lookup. Is this possible?</p>
<p>For example, with this file:</p>
<pre><code>A dog and a cat
A hat and a bat
</code></pre>
<p>I would like to be able to perform a search, for example <code>/dog\sand</code> and then be able to m... | 5,956,316 | 4 | 0 | null | 2011-05-10 20:20:10.447 UTC | 8 | 2013-04-19 17:16:23.7 UTC | null | null | null | null | 427,733 | null | 1 | 36 | vim|macvim | 7,551 | <p>You can change to the end of the match with <code>c//e<CR></code>. And <code>//<CR></code> will take you to the beginning of the next match. You could probably work out some kind of bindings for those that make sense. For instance I just tried the following, and it seems to work nicely:</p>
<pre><code>:... |
29,267,896 | How to add multiple values per key in python dictionary | <p>My program needs to output a list of names with three numbers corresponding to each name however I don't know how to code this is there a way I could do it as a dictionary such as <code>cat1 = {"james":6, "bob":3}</code> but with three values for each key?</p> | 29,267,974 | 4 | 2 | null | 2015-03-25 22:42:00.387 UTC | 2 | 2021-01-18 00:34:42.19 UTC | 2015-03-25 22:53:23.84 UTC | null | 355,230 | null | 4,710,153 | null | 1 | 4 | python|dictionary|key | 43,608 | <p>The value for each key can either be a set (distinct list of unordered elements)</p>
<pre><code>cat1 = {"james":{1,2,3}, "bob":{3,4,5}}
for x in cat1['james']:
print x
</code></pre>
<p>or a list (ordered sequence of elements )</p>
<pre><code>cat1 = {"james":[1,2,3], "bob":[3,4,5]}
for x in cat1['james']:
... |
32,357,164 | SparkSQL: How to deal with null values in user defined function? | <p>Given Table 1 with one column "x" of type String.
I want to create Table 2 with a column "y" that is an integer representation of the date strings given in "x".</p>
<p><strong>Essential</strong> is to keep <code>null</code> values in column "y".</p>
<p>Table 1 (Dataframe df1):</p>
<pre><code>+----------+
| ... | 32,358,390 | 3 | 1 | null | 2015-09-02 15:25:15.12 UTC | 15 | 2017-08-20 11:37:00.983 UTC | 2017-08-20 11:37:00.983 UTC | null | 647,053 | null | 1,211,082 | null | 1 | 32 | scala|apache-spark|apache-spark-sql|user-defined-functions|nullable | 48,237 | <p>This is where <code>Option</code>comes in handy:</p>
<pre><code>val extractDateAsOptionInt = udf((d: String) => d match {
case null => None
case s => Some(s.substring(0, 10).filterNot("-".toSet).toInt)
})
</code></pre>
<p>or to make it slightly more secure in general case:</p>
<pre><code>import scala... |
32,243,951 | Java Generics enforcing compatible wildcards | <p>I've these classes.</p>
<pre><code>class RedSocket {}
class GreenSocket {}
class RedWire {}
class GreenWire {}
</code></pre>
<p>I've a class which uses 2 generic types </p>
<pre><code>public class Connection<W, S> {}
</code></pre>
<p>where W is Wire type & S is Socket type. </p>
<p>I'm trying to enfor... | 32,244,114 | 3 | 2 | null | 2015-08-27 08:08:23.097 UTC | 5 | 2015-08-28 15:55:10.91 UTC | 2017-05-23 11:51:37.963 UTC | null | -1 | null | 1,240,899 | null | 1 | 43 | java|generics | 1,355 | <p>Seems that it's better to parameterize <code>Socket</code> and <code>Wire</code> with color:</p>
<pre><code>interface Socket<C extends Color> {}
interface Wire<C extends Color> {}
class RedSocket implements Socket<Red> {}
class GreenSocket implements Socket<Green> {}
class RedWire implement... |
5,816,658 | How to have a set of structs in C++ | <p>I have a struct which has a unique key. I want to insert instances of these structs into a set. I know that to do this the < operator has to be overloaded so that set can make a comparison in order to do the insertion.</p>
<p>The following does not work:</p>
<pre><code>#include <iostream>
#include <set... | 5,816,692 | 7 | 2 | null | 2011-04-28 09:44:38.667 UTC | 9 | 2019-06-28 09:56:44.263 UTC | 2011-04-28 09:53:19.43 UTC | null | 404,020 | null | 404,020 | null | 1 | 24 | c++|struct|set | 46,560 | <p>This might help:</p>
<pre><code>struct foo
{
int key;
};
inline bool operator<(const foo& lhs, const foo& rhs)
{
return lhs.key < rhs.key;
}
</code></pre>
<p>If you are using namespaces, it is a good practice to declare the <code>operator<()</code> function in the same namespace.</p>
<hr>
<... |
6,018,293 | Get the (last part of) current directory name in C# | <p>I need to get the last part of current directory, for example from <code>/Users/smcho/filegen_from_directory/AIRPassthrough</code>, I need to get <code>AIRPassthrough</code>. </p>
<p>With python, I can get it with this code.</p>
<pre><code>import os.path
path = "/Users/smcho/filegen_from_directory/AIRPassthrough... | 6,018,329 | 10 | 2 | null | 2011-05-16 13:39:59.633 UTC | 13 | 2021-03-07 00:09:54.85 UTC | 2015-03-27 11:47:43.273 UTC | null | 260,127 | null | 260,127 | null | 1 | 189 | c#|string|filepath | 179,128 | <p>You're looking for <a href="http://msdn.microsoft.com/en-us/library/system.io.path.getfilename.aspx" rel="noreferrer"><code>Path.GetFileName</code></a>.<br>
Note that this won't work if the path ends in a <code>\</code>. </p> |
4,965,036 | UIGraphicsGetImageFromCurrentImageContext() Retina resolution? | <p>I'm taking a picture of my screen and manipulating it by using <code>UIGraphicsGetImageFromCurrentImageContext()</code>. Everything is working just fine. However, on an iPhone 4, the resolution looks pretty shabby as it seems like the image it uses is standard resolution, not @2x. Is there any way to increase the... | 4,965,155 | 1 | 0 | null | 2011-02-11 02:26:56.347 UTC | 10 | 2011-02-11 02:47:48.623 UTC | null | null | null | null | 456,851 | null | 1 | 36 | iphone|cocoa-touch | 8,517 | <p>You should use <code>UIGraphicsBeginImageContextWithOptions</code> which allows you to set the scale factor. Use a scale factor of 0.0f to use the device's scale factor.</p> |
33,229,806 | How to auto scroll up Recycler view in Android? | <p>I have developed some chat application where i can send and received messages. But the problem is whenever i send or receive messages the recycler view is not scrolling to top so that messages gets diplayed above the keypad. </p>
<p>I have used the above mentioned recycler view <code>android.support.v7.widget.Recyc... | 33,230,129 | 7 | 0 | null | 2015-10-20 06:48:33.753 UTC | 9 | 2022-08-18 21:30:40.627 UTC | 2016-07-02 23:30:56.047 UTC | null | 1,788,806 | null | 5,340,523 | null | 1 | 20 | android|android-activity|android-recyclerview | 42,583 | <p>On updating recyclerview try to run this code :</p>
<pre><code>recyclerView.post(new Runnable() {
@Override
public void run() {
// Call smooth scroll
recyclerView.smoothScrollToPosition(adapter.getItemCount() - 1);
}
});
</code></pre> |
60,096,040 | When should I call StateHasChanged and when Blazor automatically intercepts that something is changed? | <p>I am having a hard time understanding when I should call <code>StateHasChanged()</code> and when Blazor intercepts that something is changed so it must be re-rendered.</p>
<p>I've created a sample project with a button and a custom component called AddItem. This component contains a div with a red border and a butt... | 60,098,274 | 2 | 0 | null | 2020-02-06 13:25:47.367 UTC | 10 | 2021-05-21 13:06:54.433 UTC | 2020-08-31 11:10:09.373 UTC | null | 11,084,254 | null | 11,084,254 | null | 1 | 51 | blazor | 31,025 | <p>Generally speaking, the StateHasChanged() method is automatically called after a UI event is triggered,
as for instance, after clicking a button element, the click event is raised, and the StateHasChanged() method is
automatically called to notify the component that its state has changed and it should re-render.</... |
47,225,280 | iOS11 ARKit: Can ARKit also capture the Texture of the user's face? | <p>I read the whole documentation on all ARKit classes up and down. I don't see any place that describes ability to actually get the user face's Texture. </p>
<p>ARFaceAnchor contains the ARFaceGeometry (topology and geometry comprised of vertices) and the BlendShapeLocation array (coordinates allowing manipulation... | 47,233,232 | 4 | 0 | null | 2017-11-10 14:43:03.323 UTC | 10 | 2021-04-23 08:05:30.207 UTC | null | null | null | null | 1,315,512 | null | 1 | 10 | ios|ios11|arkit|iphone-x | 5,665 | <p>You want a texture-map-style image for the face? There’s no API that gets you exactly that, but all the information you need is there:</p>
<ul>
<li><code>ARFrame.capturedImage</code> gets you the camera image.</li>
<li><code>ARFaceGeometry</code> gets you a 3D mesh of the face.</li>
<li><code>ARAnchor</code> and <c... |
19,859,282 | Check if a string contains a number | <p>Most of the questions I've found are biased on the fact they're looking for letters in their numbers, whereas I'm looking for numbers in what I'd like to be a numberless string.
I need to enter a string and check to see if it contains any numbers and if it does reject it.</p>
<p>The function <code>isdigit()</code> ... | 19,859,308 | 21 | 0 | null | 2013-11-08 12:37:06.45 UTC | 61 | 2022-08-23 12:02:13.653 UTC | 2020-03-24 15:40:43.733 UTC | null | 3,161,575 | null | 2,080,298 | null | 1 | 290 | python|string | 565,594 | <p>You can use <a href="https://docs.python.org/3/library/functions.html#any" rel="noreferrer"><code>any</code></a> function, with the <a href="https://docs.python.org/3/library/stdtypes.html#str.isdigit" rel="noreferrer"><code>str.isdigit</code></a> function, like this</p>
<pre><code>def has_numbers(inputString):
... |
30,313,302 | Is Xamarin free in Visual Studio 2015? | <p>Currently I explore the Visual Studio 2015 RC and realized that Xamarin Studio is integrated into Visual Studio and its installer. My Question is: Is Xamarin from now on free in Visual Studio? </p> | 30,314,359 | 10 | 0 | null | 2015-05-18 21:44:16.42 UTC | 21 | 2019-04-13 12:39:49.063 UTC | 2016-09-20 17:01:18.33 UTC | null | 5,472,865 | null | 1,479,804 | null | 1 | 128 | visual-studio|xamarin|visual-studio-2015 | 105,232 | <p>Updated March 31st, 2016:</p>
<p>We have announced that Visual Studio now includes Xamarin at no extra cost, including Community Edition, which is free for individual developers, open source projects, academic research, education, and small professional teams. There is no size restriction on the Community Edition ... |
24,694,171 | Error when using sendKeys() with Selenium WebDriver Java.lang.CharSequence cannot be resolved | <p>I have imported the following and still get an error when using <code>sendKeys();</code></p>
<pre><code>import org.openqa.selenium.*;
import org.openqa.selenium.firefox.*;
import org.testng.Assert;
import org.openqa.selenium.WebDriver;
</code></pre>
<p>Note: I am using Selenium WebDriver with Eclipse.</p>
<p>The ... | 24,697,196 | 8 | 0 | null | 2014-07-11 09:15:25.48 UTC | 1 | 2020-01-18 22:35:10.44 UTC | 2016-01-07 12:46:56.067 UTC | null | 617,450 | null | 1,926,538 | null | 1 | 4 | java|eclipse|selenium|selenium-webdriver | 42,495 | <p>You could try this, similar issue has been answered here <a href="https://stackoverflow.com/questions/9622454/error-with-selenium-webelement-sendkeys">#sendKeys Issue</a></p>
<pre><code>myElement .sendKeys(new String[] { "text" }); //You could create a string array
</code></pre>
<p>or simply</p>
<pre><code>myEle... |
24,783,530 | Python realtime plotting | <p>I acquire some data in two arrays: one for the time, and one for the value. When I reach 1000 points, I trigger a signal and plot these points (x=time, y=value).</p>
<p>I need to keep on the same figure the previous plots, but only a reasonable number to avoid slowing down the process. For example, I would like to ... | 24,787,171 | 4 | 1 | null | 2014-07-16 14:32:47.993 UTC | 6 | 2018-07-24 07:38:34.047 UTC | 2016-07-14 00:22:56.943 UTC | null | 63,550 | null | 3,824,723 | null | 1 | 7 | python|plot|real-time | 45,576 | <p>The lightest solution you may have is to replace the X and Y values of an existing plot. (Or the Y value only, if your X data does not change. A simple example:</p>
<pre><code>import matplotlib.pyplot as plt
import numpy as np
import time
fig = plt.figure()
ax = fig.add_subplot(111)
# some X and Y data
x = np.ara... |
44,603,429 | Google Spreadsheet adding tooltip | <p>I need to add a tooltip (mouser over a cell) in a Google spreadsheet.</p>
<p>I want the tooltip text to be taken from another cell, some idea?</p>
<p>Thanks in advance!</p> | 44,605,270 | 1 | 1 | null | 2017-06-17 10:23:47.23 UTC | 3 | 2019-03-03 04:17:25.453 UTC | 2017-06-18 19:37:54.897 UTC | null | 1,595,451 | null | 2,099,244 | null | 1 | 22 | google-apps-script|google-sheets | 49,306 | <p>Consider using notes - they appear when you hover mouse over cells in a spreadsheet. You can add notes manually by clicking the right mouse button on a cell and selecting 'insert note'. This can also be done programmatically. </p>
<p>Say, you've got 2 adjacent cells. We'll use text from the second cell to add a not... |
44,567,280 | Where is MSBuild.exe installed in Windows when installed using BuildTools_Full.exe? | <p>I'm trying to set up a build server for .NET, but can't figure out where MSBuild.exe is installed.</p>
<p>I'm trying to install MSBuild using the Microsoft Build Tools 2013:
<a href="https://www.microsoft.com/en-us/download/details.aspx?id=40760" rel="noreferrer">https://www.microsoft.com/en-us/download/details.asp... | 44,789,063 | 6 | 2 | null | 2017-06-15 12:15:40.1 UTC | 9 | 2022-02-14 05:36:31.69 UTC | null | null | null | null | 1,159,674 | null | 1 | 67 | .net|msbuild|windows-server | 109,326 | <p>MSBuild in the previous versions of .NET Framework was installed with it but, they decided to install it with Visual Studio or with the package BuildTools_Full.exe.</p>
<p>The path to MSBuild when installed with the .NET framework:</p>
<blockquote>
<p>C:\Windows\Microsoft.NET\Framework[64 or empty][framework_version... |
9,478,630 | get pitch, yaw, roll from a CMRotationMatrix | <p>I have a CMRotationMatrix *rot and i would like to get the pitch, yaw, roll from the matrix.
Any ideas how i could do that?</p>
<p>Thanks</p> | 18,764,368 | 3 | 0 | null | 2012-02-28 08:30:44.663 UTC | 10 | 2014-07-28 12:27:57.037 UTC | 2012-02-28 15:03:02.97 UTC | null | 734,069 | null | 526,582 | null | 1 | 8 | ios|opengl-es|core-motion | 8,639 | <p>Its better to use the Quaternion than Euler angles.... The roll, pitch and yaw values can be derived from quaternion using these formulae:</p>
<pre><code>roll = atan2(2*y*w - 2*x*z, 1 - 2*y*y - 2*z*z)
pitch = atan2(2*x*w - 2*y*z, 1 - 2*x*x - 2*z*z)
yaw = asin(2*x*y + 2*z*w)
</code></pre>
<p>It can be implement... |
9,530,921 | List all the files from all the folder in a single list | <p>Hi I am looking for the solution to list all the files from root/Android device.</p>
<p>Suppose there are 3 folder inside root directory,but I want to display all the files in all of these folder in a single list..</p>
<p>Now If am using </p>
<pre><code> File f=new File("/sdcard");
</code></pre>
<p>Then it... | 9,531,063 | 3 | 0 | null | 2012-03-02 09:35:10.8 UTC | 22 | 2016-11-17 14:32:48.977 UTC | null | null | null | null | 960,526 | null | 1 | 54 | android|android-file | 74,240 | <p>Try this:</p>
<pre><code> .....
List<File> files = getListFiles(new File("YOUR ROOT"));
....
private List<File> getListFiles(File parentDir) {
ArrayList<File> inFiles = new ArrayList<File>();
File[] files = parentDir.listFiles();
for (File file : files) {
if (file.isD... |
52,366,421 | How to do n-D distance and nearest neighbor calculations on numpy arrays | <p><strong>This question is intended to be a canonical duplicate target</strong></p>
<p>Given two arrays <code>X</code> and <code>Y</code> of shapes <code>(i, n)</code> and <code>(j, n)</code>, representing lists of <code>n</code>-dimensional coordinates, </p>
<pre><code>def test_data(n, i, j, r = 100):
X = np.ra... | 52,366,706 | 1 | 2 | 2018-09-18 07:57:07.12 UTC | 2018-09-17 11:10:56.913 UTC | 11 | 2022-02-16 13:46:05.537 UTC | 2018-09-18 07:15:35.327 UTC | null | 4,427,777 | null | 4,427,777 | null | 1 | 13 | python|arrays|numpy|scikit-learn|scipy | 8,167 | <p>#1. All Distances</p>
<ul>
<li><strong>only using <code>numpy</code></strong></li>
</ul>
<p>The naive method is:</p>
<pre><code>D = np.sqrt(np.sum((X[:, None, :] - Y[None, :, :])**2, axis = -1))
</code></pre>
<p>However this takes up a lot of memory creating an <code>(i, j, n)</code>-shaped intermediate matrix, and ... |
30,953,201 | Adding blur effect to background in swift | <p>I am setting a background image to view controller. But also i want to add blur effect to this background. How can I do this?</p>
<p>I am setting background with following code:</p>
<pre><code>self.view.backgroundColor = UIColor(patternImage: UIImage(named: "testBg")!)
</code></pre>
<p>I found on internet for blu... | 30,953,471 | 13 | 1 | null | 2015-06-20 10:59:40.96 UTC | 77 | 2022-05-03 16:26:23.077 UTC | null | null | null | null | 1,270,400 | null | 1 | 145 | ios|swift | 197,708 | <p>I have tested this code and it's working fine:</p>
<pre><code>let blurEffect = UIBlurEffect(style: UIBlurEffect.Style.dark)
let blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.frame = view.bounds
blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
view.addSubview(blurEffectVie... |
10,538,881 | How to keep text inside a div, always in the middle? | <p>I'm trying to make text stay in the middle of a resizable DIV.
Here's the example:</p>
<p>CSS</p>
<pre><code>#rightmenu {
position: absolute;
z-index: 999999;
right: 0;
height: 60%;
text-align: center;
}
</code></pre>
<p>HTML</p>
<pre><code><div id="rightmenu">This text should be center aligned a... | 10,539,333 | 5 | 1 | null | 2012-05-10 17:00:19.193 UTC | 2 | 2019-12-30 10:04:47.15 UTC | 2012-05-11 08:18:48.737 UTC | null | 728,084 | null | 1,383,179 | null | 1 | 9 | html|css | 71,308 | <p>If you don't care about IE7 support, you can do it like that:</p>
<p>HTML:</p>
<pre><code><div id=wrap>
<div id=inside>
Content, content, content.
</div>
</div>
</code></pre>
<p>CSS:</p>
<pre><code>#wrap {
/* Your styling. */
position: absolute;
z-index: 999999;
r... |
10,445,410 | getting the X and Y coordinates for a div element | <p>I've been trying to make a javascript to get a X and Y coordinates of a <code>div</code> element. After some trying around I have come up with some numbers but I'm not sure how to validate the exact location of them(the script returns the X as 168 and Y as 258) I'm running the script with a screen resolution of 1280... | 10,445,639 | 5 | 1 | null | 2012-05-04 08:33:22.173 UTC | 2 | 2017-12-03 12:47:14.09 UTC | 2012-05-04 09:48:52.67 UTC | null | 1,249,581 | null | 1,360,631 | null | 1 | 22 | javascript|drag-and-drop | 60,459 | <p>Here a simple way to get various information regarding the position of a html element:</p>
<pre><code> var my_div = document.getElementById('my_div_id');
var box = { left: 0, top: 0 };
try {
box = my_div.getBoundingClientRect();
}
catch(e)
{}
var... |
31,867,229 | How can I execute a JavaScript function on the first page load? | <p>I am wondering if there is a way to execute a JavaScript function once only on the first ever page load and then not execute on any subsequent reloads.</p>
<p>Is there a way I can go about doing this?</p> | 31,867,239 | 5 | 1 | null | 2015-08-06 23:08:36.883 UTC | 11 | 2021-04-16 22:09:48.237 UTC | 2018-05-04 17:43:24.39 UTC | null | 2,263,631 | null | 4,330,986 | null | 1 | 21 | javascript | 66,024 | <p>The code below will execute once the <a href="https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onload" rel="noreferrer"><code>onload</code></a> event fires. The statement checks <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/if...else" rel="noreferrer"><code... |
31,841,259 | How do I share dependencies between Android modules | <p>I have an Android application module (app) and an Android library module (library). Both app and library contain these same dependencies:</p>
<pre><code>dependencies {
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'io.reactivex:rxjava:1.0.13'
compi... | 31,842,816 | 6 | 2 | null | 2015-08-05 19:30:43.973 UTC | 7 | 2022-01-31 13:43:26.567 UTC | 2015-08-05 20:39:08.85 UTC | null | 554,464 | null | 554,464 | null | 1 | 47 | android|android-studio|gradle | 17,838 | <p>You can define shared gradle dependencies in the library module, and if the app module has the library as a dependency, you won't need to specify everything twice. Taking this further, you could create a 'common' module that requires the shared gradle dependencies, and have both the app & library module require ... |
3,392,000 | Interop between F# and C# lambdas | <p>F# powerpack comes with a set of conversion methods to translate from Func<...> to F# functions, either standard or tupled ones. But is it possible to achieve the opposite: in case you want to call from F# code a C# method that takes Func<...> and want to use native F# lambda expression (e.g. fun x -> some_fun... | 3,392,043 | 1 | 1 | null | 2010-08-02 21:38:51.543 UTC | 4 | 2010-08-02 21:45:13.543 UTC | null | null | null | null | 223,675 | null | 1 | 28 | f#|interop|lambda | 4,625 | <p>F# provides constructors for all delegate types that take F# values of the corresponding function types. E.g. in your case you want to use <code>System.Func<_,_>(fun x -> ...)</code> which applies the generated constructor of type <code>('a -> 'b) -> System.Func<'a, 'b></code>.</p> |
18,500,336 | Adding column to table & adding data right away to column in PostgreSQL | <p>I am trying to create a new column in an existing table, and using a select statement to do division to create the data I want to insert into my new column. Several of the statements I have written out will work as separate queries but I have not been able to string together the statements into one single query.</p... | 18,501,405 | 2 | 0 | null | 2013-08-29 00:14:28.307 UTC | 5 | 2013-08-29 11:11:53.08 UTC | null | null | null | null | 2,723,210 | null | 1 | 10 | sql|postgresql|sql-insert|alter-table | 44,815 | <p>In general it's not a good idea to add calculated data to a table. You sometimes need to do it when re-normalizing tables, but usually it's not done.</p>
<p>As Gordon says, the appropriate thing to do here would be to <a href="http://www.postgresql.org/docs/current/static/sql-createview.html" rel="noreferrer">creat... |
8,445,669 | Why can attributes in Java be public? | <p>As everybody knows, Java follows the paradigms of object orientation, where data encapsulation says, that fields (attributes) of an object should be hidden for the outer world and only accessed via methods or that methods are the <em>only</em> interface of the class for the outer world. So why is it possible to decl... | 8,445,716 | 12 | 1 | null | 2011-12-09 12:44:54.193 UTC | 16 | 2021-03-21 14:35:11.553 UTC | null | null | null | null | 458,770 | null | 1 | 45 | java|oop|visibility | 13,979 | <p>I think it's possible because every rule has its exception, every best practice can be overridden in certain cases. </p>
<p>For example, I often expose public static final data members as public (e.g., constants). I don't think it's harmful.</p>
<p>I'll point out that this situation is true in other languages be... |
8,589,638 | How to call an action when UISwitch changes state? | <p>I want to perform some action when UISwitch changes its state, thus is set on or off. How do I do this? I need to pass two objects as parameters. </p>
<p>It's created in code, thus not using xib.</p> | 8,589,775 | 3 | 1 | null | 2011-12-21 12:12:38.79 UTC | 1 | 2019-06-03 13:05:00.387 UTC | 2016-03-11 09:50:19.183 UTC | null | 598,057 | null | 1,086,197 | null | 1 | 58 | iphone|ios5|uiswitch | 44,250 | <pre><code>[yourSwitchObject addTarget:self action:@selector(setState:) forControlEvents:UIControlEventValueChanged];
</code></pre>
<p>This will call the below method when your switch state changes</p>
<pre><code>- (void)setState:(id)sender
{
BOOL state = [sender isOn];
NSString *rez = state == YES ? @"YES"... |
1,237,683 | XML Serialization of List<T> - XML Root | <p>First question on Stackoverflow (.Net 2.0):</p>
<p>So I am trying to return an XML of a List with the following:</p>
<pre><code>public XmlDocument GetEntityXml()
{
StringWriter stringWriter = new StringWriter();
XmlDocument xmlDoc = new XmlDocument();
XmlTextWriter ... | 1,334,483 | 4 | 1 | null | 2009-08-06 08:45:12.13 UTC | 10 | 2012-05-21 19:01:02.613 UTC | 2012-05-21 11:50:06.73 UTC | null | 50,776 | null | 151,625 | null | 1 | 13 | c#|xml|xml-serialization|root|generic-list | 53,768 | <p>There is a much easy way:</p>
<pre><code>public XmlDocument GetEntityXml<T>()
{
XmlDocument xmlDoc = new XmlDocument();
XPathNavigator nav = xmlDoc.CreateNavigator();
using (XmlWriter writer = nav.AppendChild())
{
XmlSerializer ser = new XmlSerializer(typeof(List<T>), new XmlRoot... |
620,342 | How to import a Django project settings.py Python file from a sub-directory? | <p>I created a sub-directory of my Django project called <code>bin</code> where I want to put all command-line run Python scripts. Some of these scripts need to import my Django project <code>settings.py</code> file that is in a parent directory of <code>bin</code>.</p>
<p>How can I import the <code>settings.py</code... | 622,457 | 4 | 0 | null | 2009-03-06 20:42:11.763 UTC | 9 | 2020-09-30 16:41:23.003 UTC | 2010-04-12 18:24:01.317 UTC | MikeN | 63,550 | MikeN | 36,680 | null | 1 | 17 | python|django | 25,594 | <p>This is going one level up from your question, but probably the best solution here is to implement your scripts as <a href="http://docs.djangoproject.com/en/dev/howto/custom-management-commands/#howto-custom-management-commands" rel="noreferrer">custom manage.py (django-admin.py) commands</a>. This gives you all of... |
54,307,225 | What's the difference between torch.stack() and torch.cat()? | <p>What's the difference between <a href="https://pytorch.org/docs/stable/generated/torch.cat.html" rel="noreferrer"><code>torch.cat</code></a> and <a href="https://pytorch.org/docs/stable/generated/torch.stack.html" rel="noreferrer"><code>torch.stack</code></a>?</p>
<hr />
<p>OpenAI's <a href="https://github.com/pytor... | 54,307,331 | 4 | 1 | null | 2019-01-22 11:24:47.743 UTC | 22 | 2022-05-08 11:58:25.363 UTC | 2022-04-01 13:00:14.79 UTC | null | 365,102 | null | 913,098 | null | 1 | 92 | python|pytorch | 65,444 | <p><a href="https://pytorch.org/docs/stable/generated/torch.stack.html" rel="noreferrer"><code>stack</code></a></p>
<blockquote>
<p>Concatenates sequence of tensors along a <strong>new dimension</strong>.</p>
</blockquote>
<p><a href="https://pytorch.org/docs/stable/generated/torch.cat.html" rel="noreferrer"><code>cat<... |
39,888,769 | Summary on async (void) Method: What to return? | <p>This is maybe a trivial question but currently im doing some Inline-Documentation for future Coworkers and stumbled upon something like that:</p>
<pre><code>/// <summary>
/// This Class is totaly useless
/// </summary>
public class DummyClass {
/// <summary>
/// Will do nothing
/// </sum... | 39,889,142 | 6 | 2 | null | 2016-10-06 06:15:27.44 UTC | 1 | 2020-01-13 14:48:32.36 UTC | null | null | null | null | 4,558,029 | null | 1 | 28 | c#|visual-studio|async-await | 3,121 | <p>If we take inspiration from <a href="https://msdn.microsoft.com/en-us/library/windows/apps/br227200.aspx">API's that Microsoft</a> have produced recently, you might just state:</p>
<pre class="lang-xml prettyprint-override"><code><returns>No object or value is returned by this method when it completes.</re... |
45,464,138 | JaCoCo returning 0% Coverage with Kotlin and Android 3.0 | <p>I am trying to check my code coverage for a test case that I wrote in Kotlin. When I execute <code>./gradlew createDebugCoverageReport --info</code>, my coverage.ec file is empty and my reports indicate that I have 0% coverage. Please note, the test cases are 100% successful. Can anyone think of any reasons my cover... | 46,083,078 | 3 | 2 | null | 2017-08-02 14:49:59.047 UTC | 8 | 2022-05-04 08:56:31.207 UTC | 2017-08-02 15:44:07.56 UTC | null | 675,383 | null | 4,808,528 | null | 1 | 38 | android|kotlin|code-coverage|jacoco | 10,680 | <p>You can get line-by-line coverage for both Java and Kotlin code by defining the two different directories for generated .class files:</p>
<pre><code>def debugTree = fileTree(dir: "${buildDir}/intermediates/classes/debug", excludes: fileFilter)
def kotlinDebugTree = fileTree(dir: "${buildDir}/tmp/kotli... |
17,278,656 | no suitable method found for print(int,boolean,char,double) error? | <p>I was trying to print (int, boolean, char, double) in a same println statement .</p>
<pre><code>class Test1
{
public static void main(String s[])
{
int a =5;
char c = 'a';
boolean b = true;
double d = 12.46;
System.out.println(a,b,c,d);
/*System.out.println(a); // Here it works fine
System.out.println(b);
System.o... | 17,278,688 | 5 | 4 | null | 2013-06-24 15:00:05.897 UTC | 3 | 2018-01-31 06:56:06.753 UTC | null | null | null | null | 637,377 | null | 1 | 1 | java | 51,465 | <p>The <a href="http://docs.oracle.com/javase/7/docs/api/java/io/PrintStream.html#println%28java.lang.Object%29"><code>println</code></a> method of <code>PrintStream</code> (of which <code>out</code> is an instance) takes a single argument. Perhaps you were you thinking of <a href="http://docs.oracle.com/javase/7/docs/... |
42,869,495 | NumPy version of "Exponential weighted moving average", equivalent to pandas.ewm().mean() | <p>How do I get the exponential weighted moving average in NumPy just like the following in <a href="http://pandas.pydata.org/pandas-docs/stable/computation.html#exponentially-weighted-windows" rel="noreferrer">pandas</a>?</p>
<pre><code>import pandas as pd
import pandas_datareader as pdr
from datetime import datetime... | 52,998,713 | 15 | 3 | null | 2017-03-18 01:36:35.877 UTC | 39 | 2022-02-05 12:43:54.85 UTC | 2020-08-28 07:43:19.007 UTC | null | 10,375,049 | null | 2,480,410 | null | 1 | 55 | python|pandas|numpy|vectorization|smoothing | 72,496 | <p><strong>Updated 08/06/2019</strong></p>
<p><strong>PURE NUMPY, FAST & VECTORIZED SOLUTION FOR LARGE INPUTS</strong></p>
<p><strong><code>out</code> parameter for in-place computation,
<code>dtype</code> parameter,
index <code>order</code> parameter</strong></p>
<p>This function is equivalent to pandas' <cod... |
52,977,079 | Android SDK 28 - versionCode in PackageInfo has been deprecated | <p>I just upgraded my app's <code>compileSdkVersion</code> to <code>28</code> (Pie).</p>
<p>I'm getting a compilation warning:</p>
<blockquote>
<p>warning: [deprecation] versionCode in PackageInfo has been deprecated</p>
</blockquote>
<p>The warning is coming from this code:</p>
<pre><code>final PackageInfo info ... | 52,977,132 | 5 | 1 | null | 2018-10-24 20:00:07.67 UTC | 2 | 2022-03-23 12:20:01.577 UTC | 2020-07-30 16:00:23.873 UTC | null | 4,851,751 | null | 4,851,751 | null | 1 | 48 | java|android|android-9.0-pie|package-info | 21,961 | <p>It says what to do <a href="https://developer.android.com/reference/android/content/pm/PackageInfo#versionCode" rel="noreferrer">on the Java doc</a> (I recommend not using the Kotlin documentation for much; it's not really maintained well):</p>
<blockquote>
<p>versionCode</p>
<p>This field was deprecated in API leve... |
25,814,946 | How to find origin of a branch in git? | <p>Say if my project contains two masters (master and master_ios) and I want to see what the origin of a feature branch is (by origin, i mean the branch the feature branch is based off), how would I accomplish this in git?</p> | 25,815,019 | 4 | 2 | null | 2014-09-12 18:54:13.71 UTC | 6 | 2022-08-08 17:11:24.813 UTC | 2019-03-14 16:02:46.85 UTC | null | 39,036 | null | 812,215 | null | 1 | 37 | git|branch | 52,257 | <pre><code>git remote show origin
</code></pre>
<p>shows remote and local branches with tracking info.</p> |
20,679,842 | Remove trailing whitespace on save in IntelliJ IDEA 12 | <p>Is it possible to remove trailing whitespace automatically on save in IntelliJ IDEA? I know there are some workarounds, for example, using git to trim the whitespace on commit.
Maybe this question is a duplicate of <a href="https://stackoverflow.com/questions/946993/intellij-reformat-on-file-save/5581992#5581992">t... | 20,683,165 | 5 | 1 | null | 2013-12-19 10:56:55.853 UTC | 8 | 2021-10-25 22:02:07.85 UTC | 2018-12-19 00:18:47.983 UTC | null | 3,728,901 | null | 1,706,750 | null | 1 | 123 | git|intellij-idea|reformat | 63,760 | <p>Don't know about 12, but there's the following setting in 13:</p>
<p><em>Settings → Editor → Strip trailing spaces on Save</em></p>
<p>As of IntelliJ 2017.2 it's under</p>
<p><em>Settings → Editor → General → Strip trailing spaces on Save</em></p>
<p><img src="https://i.stack.imgur.com/HUdlt.png" alt="configurat... |
4,591,329 | Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/4532486/failed-to-connect-to-mailserver-at-localhost-port-25">Failed to connect to mailserver at “localhost” port 25</a> </p>
</blockquote>
<p>I used this one however</p>
<pre><code>$to = "somebody... | 4,591,355 | 1 | 2 | null | 2011-01-04 07:05:09.567 UTC | 3 | 2011-01-04 07:11:49.58 UTC | 2017-05-23 12:25:51.447 UTC | null | -1 | null | 562,123 | null | 1 | 9 | php | 114,182 | <p>If you are running your application just on localhost and it is not yet live, I believe it is very difficult to send mail using this.</p>
<p>Once you put your application online, I believe that this problem should be automatically solved.
By the way,ini_set() helps you to change the values in php.ini during run tim... |
14,251,349 | HTML Table cell background image alignment | <p>I need the background image of a table cell to be aligned as</p>
<blockquote>
<p>Top in vertical side - Right in Horizontal</p>
</blockquote>
<p>But it is displaying as,</p>
<blockquote>
<p>Center in Vertical side ; Right in Horizontal</p>
</blockquote>
<p>Take a look at this page: <a href="http://www.chemfl... | 14,251,403 | 2 | 1 | null | 2013-01-10 05:28:03.307 UTC | null | 2015-01-26 07:01:09.123 UTC | null | null | null | null | 975,199 | null | 1 | 4 | html|css | 102,660 | <p>use like this your inline css</p>
<pre><code><td width="178" rowspan="3" valign="top"
align="right" background="images/left.jpg"
style="background-repeat:background-position: right top;">
</td>
</code></pre> |
25,329,375 | Creating a footer for every page using R markdown | <p>I'm writing a document in R Markdown and I'd like it to include a footer on every page when I knit a PDF document. Does anyone have any idea on how to do this?</p> | 25,356,975 | 3 | 2 | null | 2014-08-15 15:32:42.447 UTC | 14 | 2020-02-27 06:33:53.583 UTC | 2018-10-01 11:39:22.68 UTC | null | 7,347,699 | null | 2,387,597 | null | 1 | 31 | r-markdown|knitr|pandoc | 33,763 | <p>Yes, this question has been asked and answered here: <a href="https://tex.stackexchange.com/questions/139139/adding-headers-and-footers-using-pandoc">Adding headers and footers using Pandoc</a>. You just need to sneak a little LaTeX into the YAML header of your markdown document.</p>
<p>This markdown header does th... |
39,432,242 | NSPhotoLibraryUsageDescription in Xcode8 | <p><strong><em>Update</em></strong>:<br>
I attempt to add a String value to the <code>"NSPhotoLibraryUsageDescription"</code> key.<br>
<a href="https://i.stack.imgur.com/BdY0T.png"><img src="https://i.stack.imgur.com/BdY0T.png" alt="enter image description here"></a></p>
<p>And it works.My build version is now availab... | 39,588,338 | 7 | 2 | null | 2016-09-11 02:14:53.82 UTC | 14 | 2017-08-20 20:39:48.287 UTC | 2016-09-11 02:57:50.893 UTC | null | 6,302,694 | null | 6,302,694 | null | 1 | 40 | app-store-connect|testflight|ios10|xcode8 | 39,030 | <p>Localizing of <code>info.plist</code> file may be very unuseful, especially if you use many languages in your apps.
The simplest way for localizing <code>NSPhotoLibraryUsageDescription</code>, <code>NSLocationWhenInUseUsageDescription</code>or <code>NSCameraUsageDescription</code> keys is to describe it in <code>Inf... |
69,798,705 | Regex to match nothing but zeroes after the first zero | <p>Using regular expressions, how can I make sure there are nothing but zeroes after the first zero?</p>
<pre><code>ABC1000000 - valid
3212130000 - valid
0000000000 - valid
ABC1000100 - invalid
0001000000 - invalid
</code></pre>
<p>The regex without validation would be something like this - <code>[A-Z0-9]{10}</code>, m... | 69,798,738 | 6 | 3 | null | 2021-11-01 14:55:29.703 UTC | 1 | 2021-11-03 11:42:47.163 UTC | 2021-11-02 12:49:50.76 UTC | null | 4,182,398 | null | 3,246,362 | null | 1 | 34 | regex | 4,156 | <p>You could update the pattern to:</p>
<pre><code>^(?=[A-Z0-9]{10}$)[A-Z1-9]*0+$
</code></pre>
<p>The pattern matches:</p>
<ul>
<li><code>^</code> Start of string</li>
<li><code>(?=[A-Z0-9]{10}$)</code> Positive looakhead, assert 10 allowed chars</li>
<li><code>[A-Z1-9]*</code> Optionally match any char of <code>[A-Z1... |
55,200,786 | Enable CORS from front-end in React with axios? | <p>I am using React on the front-end and I'm calling API from another domain which I don't own. My axios request: </p>
<pre><code>axios(requestURL, {
method: 'GET',
headers: {
'Access-Control-Allow-Origin': '*',
'Content-Type': 'application/json',
'Authorization': ke... | 55,200,995 | 3 | 1 | null | 2019-03-16 19:42:29.91 UTC | 5 | 2020-09-28 20:37:35.193 UTC | null | null | null | null | 9,438,224 | null | 1 | 17 | reactjs|cors|axios | 65,499 | <p>You will, unfortunately, need to proxy the request somehow. CORS requests will be blocked by the browser for security reasons. To avoid this, backend needs to inject allow origin header for you.</p>
<p>Solutions depend on where you need to proxy, dev or production.</p>
<p><strong>Development environment or node.js... |
24,036,393 | Fatal error: use of unimplemented initializer 'init(coder:)' for class | <p>I decided to continue my remaining project with Swift. When I add the custom class (subclass of <code>UIViewcontroller</code>) to my storyboard view controller and load the project, the app crashes suddenly with the following error:</p>
<blockquote>
<p>fatal error: use of unimplemented initializer 'init(coder:)' ... | 24,036,440 | 6 | 0 | null | 2014-06-04 11:38:18.023 UTC | 59 | 2019-03-29 12:52:48.1 UTC | 2019-03-29 12:51:15.233 UTC | null | 1,752,496 | null | 2,919,739 | null | 1 | 156 | ios|macos|uiviewcontroller|swift | 91,642 | <h1>Issue</h1>
<p>This is caused by the absence of the initializer <code>init?(coder aDecoder: NSCoder)</code> on the target <code>UIViewController</code>. That method is required because instantiating a <code>UIViewController</code> from a <code>UIStoryboard</code> calls it.</p>
<p>To see how we initialize a <code>UIV... |
24,072,876 | Too many warnings about 'circular require' when run rspec | <p>Hi I got lots of warning when run <code>rspec</code> which does annoying me too much,</p>
<p>How to fix it ? because I've tried the Ruby version <code>2.1.2</code> under rbenv, but it didn't work at all.</p>
<p>Here's my Gemfile</p>
<pre><code>source 'https://rubygems.org'
gem 'bootstrap-sass'
gem 'coffee-rails... | 24,074,527 | 3 | 1 | null | 2014-06-06 01:39:18.233 UTC | 2 | 2017-02-18 18:40:04.857 UTC | null | null | null | null | 3,675,188 | null | 1 | 28 | ruby-on-rails|ruby-on-rails-4|rspec | 7,515 | <p>I had same error and fixed it refs the page.</p>
<p><a href="https://stackoverflow.com/questions/24003316/guard-with-rspec-on-rails-4-giving-a-lot-of-warnings">Guard with RSpec on Rails 4 giving a lot of warnings</a></p>
<blockquote>
<p>the <code>--warnings</code> option in the .rspec file by default. Remove tha... |
24,351,377 | Which is the Swift equivalent of isnan()? | <p>Which is the equivalent of <code>isnan()</code> in Swift ?
I need to check if some operation results are valid and delete those invalid like x/0
Thanks</p> | 24,351,407 | 2 | 1 | null | 2014-06-22 12:48:00.903 UTC | 9 | 2020-12-19 07:28:59.48 UTC | null | null | null | null | 1,189,841 | null | 1 | 65 | cocoa|swift|nan | 27,808 | <p>It's defined in the <a href="http://swiftdoc.org/protocol/FloatingPointType/">FloatingPointNumber</a> protocol, which both the <a href="http://swiftdoc.org/type/Float/">Float</a> and <a href="http://swiftdoc.org/type/Double/">Double</a> types conform to. Usage is as follows:</p>
<pre><code>let d = 3.0
let isNan = d... |
21,639,394 | How to select item in collectionview programmatically? | <p>I have a <code>UICollectionView</code>. The <code>UICollectionView</code>'s <code>datasource</code> is a <code>NSArray</code> of students (from <code>CoreData</code>). I want the current student item be <code>selected</code>/<code>highlighted</code>.</p>
<p>How can I do this? I know there is a method:</p>
<pre><c... | 21,640,147 | 8 | 2 | null | 2014-02-07 23:05:06.857 UTC | 4 | 2021-05-11 18:25:32.293 UTC | 2014-03-03 16:11:59.763 UTC | null | 1,141,395 | null | 1,210,095 | null | 1 | 28 | ios|iphone|uicollectionview|uicollectionviewcell | 70,370 | <p>You can simply use this after <code>[self.collectionView reloadData]</code></p>
<pre><code>[self.collectionView
selectItemAtIndexPath:[NSIndexPath indexPathForItem:index inSection:0]
animated:YES
scrollPosition:UICollectionViewScrollPositionCenteredVertically];
</code></pre>
<p>where... |
1,742,909 | Why is the control inaccessible due to its protection level? | <p>I'm trying to access a control's text property from program.cs and it says that it is inaccessible due to protected level. How can I fix this please?</p> | 1,742,914 | 4 | 5 | null | 2009-11-16 15:30:22.17 UTC | 1 | 2019-11-20 23:57:00.26 UTC | 2009-11-16 17:32:55.027 UTC | null | 111,575 | null | 164,203 | null | 1 | 22 | c#|winforms|controls | 56,138 | <p>This is the default property for controls and can be solved by:</p>
<ol>
<li>Going into Design-View for the Form that contains the specified Control</li>
<li>Then changing the Control's Modifiers property to Public or Internal. </li>
</ol>
<p><a href="https://i.stack.imgur.com/wVTn6.png" rel="nofollow noreferrer">... |
52,591,556 | Custom markers with Flutter Google Maps plugin | <p>Is there a way to display custom markers with the official <a href="https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter" rel="noreferrer">Flutter Google Maps plugin</a> on the map? Can't find any way to do it based on the documentation.</p> | 59,114,878 | 12 | 3 | null | 2018-10-01 12:48:54.813 UTC | 8 | 2021-11-01 06:09:37.337 UTC | 2019-06-02 03:49:41.05 UTC | null | 6,513,167 | null | 1,157,401 | null | 1 | 15 | google-maps|plugins|flutter | 51,655 | <pre><code>BitmapDescriptor customIcon;
// make sure to initialize before map loading
BitmapDescriptor.fromAssetImage(ImageConfiguration(size: Size(12, 12)),
'assets/images/car-icon.png')
.then((d) {
customIcon = d;
});
final nearbyCarsLocation = [
LatLng(24.9286825, 67.0403249),
LatLng(24.985577, 6... |
10,414,703 | prop("disabled", true); AND attr('disabled', 'disabled') is not working in chrome and firefox | <p>i have the following script inside my asp.net mvc view:-</p>
<pre><code>function disableform(id) {
$('#' + id).prop("disabled", true);
}
</code></pre>
<p>But the above function will only disable the elements using internet explorer ,, but will fail to work on chrome or firefox, i also tried to write <code>att... | 10,414,865 | 4 | 2 | null | 2012-05-02 13:25:56.187 UTC | 2 | 2017-08-31 20:47:03.47 UTC | null | null | null | null | 1,146,775 | null | 1 | 9 | jquery | 50,483 | <p>Disabling a <strong>form</strong> is wrong! IE is just messing it out! you should disable fields.</p>
<pre><code>function disableform(id) {
$('#' + id+' :input').prop("disabled",true);
}
</code></pre>
<p><a href="http://jsfiddle.net/EGgzT/1/" rel="noreferrer">DEMO</a></p> |
10,475,898 | Receive byte[] using ByteArrayInputStream from a socket | <p>Here is the code but got error:</p>
<pre><code>bin = new ByteArrayInputStream(socket.getInputStream());
</code></pre>
<p>Is it possible to receive <code>byte[]</code> using <code>ByteArrayInputStream</code> from a socket?</p> | 10,475,953 | 2 | 2 | null | 2012-05-07 02:09:10.21 UTC | 3 | 2015-04-15 05:29:24.143 UTC | 2012-05-07 02:19:55.987 UTC | null | 418,556 | null | 925,552 | null | 1 | 10 | java|sockets|io|inputstream|bytearrayinputstream | 44,758 | <p>No. You use <code>ByteArrayInputStream</code> when you have an array of bytes, and you want to read from the array as if it were a file. If you just want to read arrays of bytes from the socket, do this:</p>
<pre><code>InputStream stream = socket.getInputStream();
byte[] data = new byte[100];
int count = stream.rea... |
10,667,543 | Creating fstream object from a FILE* pointer | <p>The well known way of creating an <strong><code>fstream</code></strong> object is:</p>
<pre><code>ifstream fobj("myfile.txt");
</code></pre>
<p>ie. using a filename.</p>
<p>But I want to create an ifstream object using a file descriptor.</p>
<blockquote>
<p><strong>Reason:</strong> I want to execute a command ... | 10,667,570 | 3 | 2 | null | 2012-05-19 17:48:01.263 UTC | 1 | 2022-05-10 07:34:28.743 UTC | 2012-05-19 17:54:51.967 UTC | null | 1,184,247 | null | 1,184,247 | null | 1 | 30 | c++|popen|ifstream | 15,666 | <p>You cannot do that just in standard C++, since iostreams and C I/O are entirely separate and unrelated. You could however write your <em>own</em> iostream that's backed by a C FILE stream. I believe that GCC comes with one such stream class as a library extension.</p>
<p>Alternatively, if all you want is an object-... |
7,447,498 | Why can't a member method be passed to a base class constructor? | <pre><code>class Flarg
{
private readonly Action speak;
public Action Speak
{
get
{
return speak;
}
}
public Flarg(Action speak)
{
this.speak = speak;
}
}
class MuteFlarg : Flarg
{
public MuteFlarg() : base(GiveDumbLook)
{
}
pri... | 7,447,535 | 7 | 2 | null | 2011-09-16 16:04:14.137 UTC | 1 | 2011-09-17 00:59:54.33 UTC | 2017-05-23 10:31:17.15 UTC | null | -1 | null | 7,495 | null | 1 | 29 | c# | 3,756 | <p>Rewrite it like this:</p>
<pre><code>public MuteFlarg() : base(this.GiveDumbLook) { }
</code></pre>
<p>and it is now clear why you can't. It's not legal to refer to <code>this</code> in a base class constructor invocation. This is not legal because it can easily lead to bugs. The constructor for the derived class ... |
7,529,258 | What major ASIHTTPRequest features is AFNetworking missing? | <p>With <a href="http://allseeing-i.com/%5Brequest_release%5D;" rel="nofollow noreferrer">work having recently stopped on ASIHTTPRequest</a>, it seems like attention is shifting to <a href="https://github.com/AFNetworking/AFNetworking" rel="nofollow noreferrer">AFNetworking</a>.</p>
<p>However, I've not yet found a go... | 8,377,096 | 8 | 5 | null | 2011-09-23 12:54:39.013 UTC | 51 | 2016-05-20 09:52:48.327 UTC | 2017-05-23 12:00:20.313 UTC | null | -1 | null | 292,166 | null | 1 | 93 | iphone|ios|ipad|asihttprequest|afnetworking | 17,515 | <p>I loved ASIHTTPRequest and I was sad to see it go. However, the developer of ASI was right, ASIHTTPRequest has become so large and bloated that even he couldn't devote time to bring it to par with newest features of iOS and other frameworks. I moved on and now use AFNetworking.</p>
<p>That said, I must say that AFN... |
7,198,109 | Rails: Using simple_form and integrating Twitter Bootstrap | <p>I'm trying to build a rails app and simple_form looks to be a really useful gem. Problem is that I am using twitter bootstrap css to do the styling and the simple_form doesn't allow you to specify the layout of the html. </p>
<p>Can anyone tell me how I can conform the simple_form html into the format bootstrap css... | 7,300,806 | 9 | 0 | null | 2011-08-25 22:49:50.333 UTC | 14 | 2013-04-13 17:15:51.017 UTC | null | null | null | null | 157,894 | null | 1 | 23 | ruby-on-rails|simple-form|twitter-bootstrap | 13,338 | <p><em>Note: This answer only applies to SimpleForm < 2.0</em></p>
<p>Start with this in <code>config/initializers/simple_form.rb</code>:</p>
<pre><code>SimpleForm.form_class = nil
SimpleForm.wrapper_class = 'clearfix'
SimpleForm.wrapper_error_class = 'error'
SimpleForm.error_class = 'help-inline'
</code></pre>
<... |
7,585,493 | Null parameter checking in C# | <p>In C#, are there any good reasons (other than a better error message) for adding parameter null checks to every function where null is not a valid value? Obviously, the code that uses s will throw an exception anyway. And such checks make code slower and harder to maintain.</p>
<pre><code>void f(SomeType s)
{
if ... | 7,585,528 | 10 | 6 | null | 2011-09-28 15:19:32.023 UTC | 33 | 2022-08-02 08:40:45.693 UTC | 2014-06-25 22:03:50.897 UTC | null | 2,246,344 | null | 527,147 | null | 1 | 90 | c#|function|null | 55,864 | <p>Yes, there are good reasons:</p>
<ul>
<li>It identifies exactly what is null, which may not be obvious from a <code>NullReferenceException</code></li>
<li>It makes the code fail on invalid input even if some other condition means that the value isn't dereferenced</li>
<li>It makes the exception occur <em>before</em>... |
7,490,488 | Convert flat array to a delimited string to be saved in the database | <p>What is the best method for converting a PHP array into a string?<br />
I have the variable <code>$type</code> which is an array of types.</p>
<pre><code>$type = $_POST[type];
</code></pre>
<p>I want to store it as a single string in my database with each entry separated by <code>|</code> :</p>
<pre><code>Sports|Fes... | 7,490,505 | 13 | 5 | null | 2011-09-20 19:13:46.467 UTC | 54 | 2022-07-03 09:04:15.6 UTC | 2022-07-03 09:04:15.6 UTC | null | 2,943,403 | null | 773,263 | null | 1 | 361 | php|arrays|string|implode | 933,074 | <p>Use <a href="http://php.net/implode" rel="noreferrer">implode</a></p>
<pre><code>implode("|",$type);
</code></pre> |
7,305,538 | UITextField with secure entry, always getting cleared before editing | <p>I am having a weird issue in which my <code>UITextField</code> which holds a secure entry is always getting cleared when I try to edit it. I added 3 <code>characters</code> to the field, goes to another field and comes back, the cursor is in 4th <code>character</code> position, but when I try to add another characte... | 7,305,603 | 28 | 2 | null | 2011-09-05 08:26:39.207 UTC | 20 | 2022-03-24 13:17:55.943 UTC | 2019-07-26 19:05:57.337 UTC | null | 11,328,137 | null | 221,153 | null | 1 | 55 | iphone|uitextfield | 52,250 | <p>Set, </p>
<pre><code>textField.clearsOnBeginEditing = NO;
</code></pre>
<p><em>Note: This won't work if <strong>secureTextEntry = YES</strong>.</em> It seems, by default, iOS clears the text of secure entry text fields before editing, no matter <strong>clearsOnBeginEditing</strong> is YES or NO.</p> |
14,344,130 | Convert char array to string use C | <p>I need to convert a char array to string.
Something like this:</p>
<pre><code>char array[20];
char string[100];
array[0]='1';
array[1]='7';
array[2]='8';
array[3]='.';
array[4]='9';
...
</code></pre>
<p>I would like to get something like that:</p>
<pre><code>char string[0]= array // where it was stored 178.9 ...... | 14,344,229 | 3 | 5 | null | 2013-01-15 18:13:17.577 UTC | 10 | 2013-01-17 03:40:08.063 UTC | 2013-01-16 03:00:23.283 UTC | null | 1,437,962 | null | 1,973,988 | null | 1 | 11 | c|arrays | 170,514 | <p>You're saying you have this:</p>
<pre><code>char array[20]; char string[100];
array[0]='1';
array[1]='7';
array[2]='8';
array[3]='.';
array[4]='9';
</code></pre>
<p>And you'd like to have this:</p>
<pre><code>string[0]= "178.9"; // where it was stored 178.9 ....in position [0]
</code></pre>
<p>You can't have... |
14,048,476 | BigInteger to Hex/Decimal/Octal/Binary strings? | <p>In Java, I could do </p>
<pre><code>BigInteger b = new BigInteger(500);
</code></pre>
<p>Then format it as I pleased</p>
<pre><code>b.toString(2); //binary
b.toString(8); //octal
b.toString(10); //decimal
b.toString(16); //hexadecimal
</code></pre>
<p>In C#, I can do</p>
<pre><code>int num = int.Parse(b.ToStrin... | 15,447,131 | 4 | 3 | null | 2012-12-27 01:51:49.98 UTC | 11 | 2022-07-17 04:28:43.903 UTC | 2017-05-23 11:45:52.913 UTC | null | -1 | null | 928,007 | null | 1 | 14 | c#|tostring|biginteger | 24,314 | <h1>Convert <code>BigInteger</code> to decimal, hex, binary, octal string:</h1>
<p>Let's start with a <code>BigInteger</code> value:</p>
<pre><code>BigInteger bigint = BigInteger.Parse("123456789012345678901234567890");
</code></pre>
<h1>Base 10 and Base 16</h1>
<p>The built-in Base 10 (decimal) and base 16 (hexade... |
13,833,568 | Automated way to convert XML files to SQL database? | <p>We have a bunch of XML files, following a schema which is essentially a serialised database form:</p>
<pre><code><table1>
<column1>value</column1>
<column2>value</column2>
</table1>
<table1>
<column1>another value</column1>
<column2>another val... | 13,837,311 | 4 | 2 | null | 2012-12-12 05:45:22.34 UTC | 5 | 2016-03-31 18:31:06.173 UTC | 2012-12-12 06:31:39.47 UTC | null | 13,302 | null | 263,268 | null | 1 | 19 | mysql|xml|postgresql|schema | 105,312 | <p>For Mysql please see the <a href="https://dev.mysql.com/doc/refman/5.5/en/load-xml.html" rel="noreferrer"><code>LOAD XML</code> Syntax<sup><em>Docs</em></sup></a>.</p>
<p>It should work without any additional XML transformation for the XML you've provided, just specify the format and define the table inside the dat... |
14,341,782 | Cross database querying in EF | <p>Is there any way to implement cross database querying in Entity Framework? Let's imagine I've two Entities User and Post, User entity is in database1 and Post is in database2, which means those entities are in separate databases. How should I get user's posts in Entity Framework ?</p> | 14,341,872 | 4 | 2 | null | 2013-01-15 16:05:34.513 UTC | 10 | 2019-08-22 14:53:16.753 UTC | 2018-01-27 06:03:57.643 UTC | null | 560,153 | null | 560,153 | null | 1 | 23 | c#|sql-server|entity-framework|cross-database | 16,179 | <p>EF context does not support cross database queries. You need to expose posts in database1 through SQL View (<a href="http://rachel53461.wordpress.com/2011/05/22/tricking-ef-to-span-multiple-databases/" rel="noreferrer">or synonym</a>) and use it as part of that database. </p> |
13,931,225 | How to zoom div content using jquery? | <p>I have a parent <code><div></code>. Inside that I place some text and images. Now I need to zoom to a particular portion of that parent <code><div></code>. Is it possible?</p> | 13,931,548 | 4 | 6 | null | 2012-12-18 10:44:14.98 UTC | 19 | 2016-05-26 14:18:00.367 UTC | 2012-12-18 10:50:14.813 UTC | null | 796,584 | null | 1,314,503 | null | 1 | 26 | javascript|jquery|html | 110,435 | <p>If you want that image to be zoomed on mouse hover :</p>
<pre><code>$(document).ready( function() {
$('#div img').hover(
function() {
$(this).animate({ 'zoom': 1.2 }, 400);
},
function() {
$(this).animate({ 'zoom': 1 }, 400);
});
});
</code></pre>
<p>or you may do like this if zoom... |
14,245,474 | Apache won't run in xampp | <p>I have just installed XAMPP and everything works fine except that I can't get apache to run. It seems that port 80 is the problem, I have disabled Skype to use port 80 but it doesn't seem to fix it. I read somewhere that the SSL port can be the problem and should be changed. But I cant figure out were the port is... | 14,245,577 | 17 | 2 | null | 2013-01-09 20:02:33.003 UTC | 19 | 2018-07-09 10:05:48.57 UTC | 2013-07-27 16:54:06.12 UTC | null | 445,131 | null | 1,740,712 | null | 1 | 29 | apache|xampp|port | 218,797 | <p>Find out which other service uses port 80.</p>
<p>I have heard skype uses port 80. Check it there isn't another server or database running in the background on port 80.</p>
<p>Two good alternatives to xampp are <a href="http://www.wampserver.com/en/">wamp</a> and <a href="http://www.easyphp.org/">easyphp</a>. Out ... |
13,892,191 | Are empty macro definitions allowed in C? How do they behave? | <p>Suppose the "empty" macro definition</p>
<pre><code>#define FOO
</code></pre>
<p>Is it valid Standard C? If so, what is <code>FOO</code> after this definition?</p> | 13,892,207 | 3 | 2 | null | 2012-12-15 12:29:26.727 UTC | 14 | 2017-06-28 07:34:03.543 UTC | 2017-06-28 07:34:03.543 UTC | null | 1,025,391 | user1150105 | null | null | 1 | 60 | c|c-preprocessor | 38,473 | <p>It is simply a macro that expands to, well, nothing. However, now that the macro has been defined you can check with <code>#if defined</code> (or <code>#ifdef</code>) whether it has been defined.</p>
<pre><code>#define FOO
int main(){
FOO FOO FOO
printf("Hello world");
}
</code></pre>
<p>will expand to </... |
14,149,209 | Read the version from manifest.json | <p>Is there a way for a Chrome extension to read properties from <code>manifest.json</code>? I'd like to be able to read the version number and use it in the extension.</p> | 14,348,395 | 5 | 2 | null | 2013-01-03 23:56:54.057 UTC | 3 | 2020-02-08 18:42:42.71 UTC | 2020-02-08 18:42:42.71 UTC | null | 555,121 | null | 64,421 | null | 1 | 61 | google-chrome-extension | 19,567 | <p>You can just use <code>chrome.runtime.getManifest()</code> to access the manifest data - you don't need to GET it and parse it.</p>
<pre><code>var manifestData = chrome.runtime.getManifest();
console.log(manifestData.version);
console.log(manifestData.default_locale);
</code></pre> |
29,994,402 | Is there a way to throw custom exception without Exception class | <p>Is there any way in C# (i.e. in .NET) to throw a custom exception but without writing all the code to define your own exception class derived from <code>Exception</code>?</p>
<p>I am thinking something similar you have for example in Oracle PL/SQL where you can simply write</p>
<pre><code>raise_application_error(-... | 29,994,439 | 5 | 5 | null | 2015-05-01 20:13:12.623 UTC | 8 | 2018-09-25 14:27:06.21 UTC | 2015-05-01 20:31:51.663 UTC | null | 1,664,443 | null | 3,027,266 | null | 1 | 43 | c#|asp.net|exception | 94,348 | <pre><code>throw new Exception("A custom message for an application specific exception");
</code></pre>
<p>Not good enough?</p>
<p>You could also throw a more specific exception if it's relevant. For example,</p>
<pre><code>throw new AuthenticationException("Message here");
</code></pre>
<p>or</p>
<pre><code>thro... |
9,335,169 | Understanding strange Java hash function | <p>Following is the source code for a hash function in <code>java.util.HashMap</code>. The comments explain well enough what it's accomplishing. <strong>but how?</strong> What are the <code>^</code> and <code>>>></code> operators doing? <strong>Can someone explain how the code actually <em>does</em> what the c... | 9,336,515 | 6 | 1 | null | 2012-02-17 20:47:13.113 UTC | 25 | 2021-02-19 22:02:38.833 UTC | 2012-12-08 20:57:18.577 UTC | null | 815,724 | null | 835,805 | null | 1 | 34 | java|hash | 8,413 | <p>Here is some code and the sample output:</p>
<pre><code>public static void main ( String[] args ) {
int h = 0xffffffff;
int h1 = h >>> 20;
int h2 = h >>> 12;
int h3 = h1 ^ h2;
int h4 = h ^ h3;
int h5 = h4 >>> 7;
int h6 = h4 >>> 4;
int h7 = h5 ^ h6;
... |
24,652,964 | android popup menu text color (AppCompat) | <p>I need to change text color of a popuo menu but I don't find any way for do this, I can change background of popmenu but not the text, I edit the style.xml in this way:</p>
<pre><code><style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<!-- API 14 theme customizations can go here. -->
&l... | 24,653,532 | 4 | 3 | null | 2014-07-09 11:52:09.517 UTC | 2 | 2018-10-27 07:52:16.987 UTC | 2014-10-10 20:57:36.83 UTC | null | 2,653,775 | null | 764,133 | null | 1 | 34 | android|colors|popupmenu | 36,313 | <pre><code><item name="textAppearanceLargePopupMenu">@style/TextAppearance.AppCompat.Light.Widget.PopupMenu.Large</item>
<item name="textAppearanceSmallPopupMenu">@style/TextAppearance.AppCompat.Light.Widget.PopupMenu.Small</item>
</code></pre>
<p>I think that you are using TextAppearance.AppCo... |
1,236,285 | How do I see stdout when running Django tests? | <p>When I run tests with <code>./manage.py test</code>, whatever I send to the standard output through <code>print</code> doesn't show. When tests fail, I see an "stdout" block per failed test, so I guess Django traps it (but doesn't show it when tests pass).</p> | 1,239,545 | 5 | 2 | null | 2009-08-05 23:34:08.85 UTC | 8 | 2020-10-12 13:46:24.777 UTC | 2009-08-06 15:07:07.707 UTC | null | 105,132 | null | 105,132 | null | 1 | 55 | python|django|debugging|testing|stdout | 35,250 | <p>Checked <code>TEST_RUNNER</code> in <code>settings.py</code>, it's using a project-specific runner that calls out to Nose. <em>Nose has the <code>-s</code> option to stop it from capturing <code>stdout</code></em>, but if I run:</p>
<p><code>./manage.py test -s</code></p>
<p><code>manage.py</code> captures it firs... |
243,363 | Can someone explain the structure of a Pid (Process Identifier) in Erlang? | <p>Can someone explain the structure of a Pid in Erlang?</p>
<p>Pids looks like this: <code><A.B.C></code>, e.g. <code><0.30.0></code> , but I would like to know what is the meaning of these three "bits": <code>A</code>, <code>B</code> and <code>C</code>.</p>
<p><code>A</code> seems to be always <... | 262,179 | 5 | 1 | 2008-10-28 13:42:21.24 UTC | 2008-10-28 13:42:21.24 UTC | 32 | 2021-01-31 11:03:40.18 UTC | 2021-01-31 11:03:40.18 UTC | null | 11,880,324 | jideel | 15,539 | null | 1 | 74 | erlang|pid | 24,350 | <p>Printed process ids < A.B.C > are composed of <a href="http://github.com/mfoemmel/erlang-otp/blob/R13B/erts/emulator/beam/erl_term.h#L502" rel="noreferrer">6</a>:</p>
<ul>
<li>A, the node number (0 is the local
node, an arbitrary number for a remote node) </li>
<li>B, the first 15 bits of the process number (an ... |
450,915 | Upload files to Sharepoint document libraries via FTP | <p>I was wondering if anyone knows how to or if it is possible to upload files to a sharepoint (v3/MOSS) document library over FTP. I know it is possible with webdav. If it is possible is this even supported by Microsoft?</p> | 450,930 | 6 | 0 | null | 2009-01-16 16:06:16.167 UTC | 5 | 2020-10-18 23:01:20.63 UTC | null | null | null | Andrew Milsark | 26,540 | null | 1 | 8 | sharepoint|upload|ftp | 69,662 | <p>I don't think so. I think your options are: </p>
<ol>
<li>HTTP (via the upload page)</li>
<li>WebDAV</li>
<li>Web Services</li>
<li>The object model</li>
</ol> |
124,958 | glob() - sort array of files by last modified datetime stamp | <p>I'm trying to display an array of files in order of date (last modified).</p>
<p>I have done this buy looping through the array and sorting it into another array, but is there an easier (more efficient) way to do this?</p> | 125,047 | 6 | 1 | null | 2008-09-24 01:51:54.23 UTC | 17 | 2021-12-16 10:34:11.543 UTC | 2020-10-12 00:38:45.95 UTC | null | 2,943,403 | cole | 910 | null | 1 | 61 | php|arrays|sorting|filemtime | 46,850 | <blockquote>
<p><strong>Warning</strong> <code>create_function()</code> has been DEPRECATED as of PHP 7.2.0. Relying on this function is highly discouraged.</p>
</blockquote>
<p>For the sake of posterity, in case the forum post linked in the accepted answer is lost or unclear to some, the relevant code needed is: </... |
676,250 | Different ways of loading a file as an InputStream | <p>What's the difference between:</p>
<pre><code>InputStream is = this.getClass().getClassLoader().getResourceAsStream(fileName)
</code></pre>
<p>and</p>
<pre><code>InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName)
</code></pre>
<p>and</p>
<pre><code>InputStream is = thi... | 676,273 | 6 | 0 | null | 2009-03-24 05:32:43.56 UTC | 132 | 2020-08-26 09:30:49.753 UTC | 2012-02-02 12:13:25.01 UTC | Dheer | 251,173 | zqudlyba | 81,810 | null | 1 | 235 | java|inputstream | 215,433 | <p>There are subtle differences as to how the <code>fileName</code> you are passing is interpreted. Basically, you have 2 different methods: <code>ClassLoader.getResourceAsStream()</code> and <code>Class.getResourceAsStream()</code>. These two methods will locate the resource differently.</p>
<p>In <code>Class.getResou... |
13,290,841 | NSOperationQueue and background support | <p>I have some problems on elaborating a useful strategy to support background for <code>NSOperationQueue</code> class. In particular, I have a bunch of <code>NSOperation</code>s that perform the following actions:</p>
<ul>
<li>Download a file from the web</li>
<li>Parse the file</li>
<li>Import data file in Core Data... | 13,346,407 | 1 | 0 | null | 2012-11-08 14:22:27.077 UTC | 8 | 2014-04-08 17:17:30.19 UTC | 2017-05-23 12:32:52.993 UTC | null | -1 | null | 231,684 | null | 1 | 4 | ios|background|nsoperation|nsoperationqueue | 8,122 | <p>If I understand you correctly, you have a <code>NSOperationQueue</code> and if your application enters the background, you would like to </p>
<ol>
<li>cancel all operations and </li>
<li>wait until the cancellations are processed.</li>
</ol>
<p>Normally this should not take too much time, so it should be sufficien... |
44,309,044 | UnicodeDecodeError, utf-8 invalid continuation byte | <p>I m trying to extract lines from a log file , using that code :</p>
<pre><code> with open('fichier.01') as f:
content = f.readlines()
print (content)
</code></pre>
<p>but its always makes the error statement </p>
<pre><code> Traceback (most recent call last):
File "./parsepy", line 4, in &... | 44,309,590 | 3 | 2 | null | 2017-06-01 13:35:15.36 UTC | 1 | 2022-05-23 03:05:47.913 UTC | null | null | null | null | 8,097,996 | null | 1 | 8 | python|python-3.5 | 38,933 | <p>If it's not encoded as text then you will have to open it in binary mode e.g.:</p>
<pre><code>with open('fichier.01', 'rb') as f:
content = f.readlines()
</code></pre>
<p>If it's encoded as something other than UTF-8 and it can be opened in text mode then <code>open</code> takes an <code>encoding</code> argume... |
17,877,471 | Running NUnit through Resharper 8 tests fail when crossing between projects due to AppDomain | <p>I recently updated to Resharper 8, and when I tried to run a suite of projects. These tests contain two suites of integration tests that both use IISExpress to run a website, make web requests and check the responses.</p>
<p>Running them in isolation is successful, and running all the tests would previously succeed... | 18,104,565 | 3 | 0 | null | 2013-07-26 09:17:28.477 UTC | 12 | 2014-02-13 16:22:37.427 UTC | null | null | null | null | 402,287 | null | 1 | 48 | c#|nunit|resharper|integration-testing|appdomain | 7,478 | <p><strong>The Workaround:</strong></p>
<p>Have you tried in Visual Studio going to ReSharper -> Options -> Tools -> Unit Testing</p>
<p>Change the setting "Run up to 1 assemblies in parallel" to a higher number. I tried one for each test project. Max is number of cores, I think.</p>
<p>Counterintuitive I know, but ... |
23,188,900 | Display / print all rows of a tibble (tbl_df) | <p><code>tibble</code> (previously <code>tbl_df</code>) is a version of a data frame created by the <code>dplyr</code> data frame manipulation package in R. It prevents long table outputs when accidentally calling the data frame.</p>
<p>Once a data frame has been wrapped by <code>tibble</code>/<code>tbl_df</code>, is ... | 27,294,928 | 7 | 2 | null | 2014-04-20 23:55:04.003 UTC | 55 | 2022-07-16 18:04:48.497 UTC | 2022-07-16 18:04:48.497 UTC | null | 946,915 | null | 3,555,034 | null | 1 | 250 | r|dplyr | 162,213 | <p>You could also use</p>
<pre><code>print(tbl_df(df), n=40)
</code></pre>
<p>or with the help of the pipe operator</p>
<pre><code>df %>% tbl_df %>% print(n=40)
</code></pre>
<p>To print all rows specify <code>tbl_df %>% print(n = Inf)</code></p>
<p>edit 31.07.2021:
<strong>in > dplyr 1.0.0</strong></p>
<pr... |
23,428,793 | NSURLSession: How to increase time out for URL requests? | <p>I am using iOS 7's new <code>NSURLSessionDataTask</code> to retrieve data as follows:</p>
<pre><code>NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:
request completionHandler:
^(NSData *data, NSURLResponse *response, NSError *error) {
//
}];
</co... | 23,428,960 | 7 | 3 | null | 2014-05-02 12:59:26.047 UTC | 18 | 2020-06-12 10:26:35.603 UTC | 2020-06-12 10:26:35.603 UTC | null | 5,175,709 | null | 1,214,667 | null | 1 | 83 | ios|objective-c|swift|http|nsurlsession | 84,983 | <h3>ObjC</h3>
<pre><code>NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration];
sessionConfig.timeoutIntervalForRequest = 30.0;
sessionConfig.timeoutIntervalForResource = 60.0;
</code></pre>
<h3>Swift</h3>
<pre><code>let sessionConfig = URLSessionConfiguration.default
ses... |
2,105,481 | how to cache css, images and js? | <p>I would like to have images, css, and javascript cached client-side on their browser when they load up a web page. There are so many different types of caching I am confused as to which ones to use with asp.net mvc. </p>
<p>Would it also be possible to have their browsers check for new or modified versions of these... | 2,105,492 | 6 | 0 | null | 2010-01-20 22:23:49.123 UTC | 14 | 2015-12-31 14:22:41.99 UTC | 2012-10-28 18:33:19.363 UTC | null | 24,874 | null | 173,432 | null | 1 | 26 | .net|asp.net-mvc|caching|asp.net-caching | 29,695 | <p>Browsers take care of this for you automatically, actually. You have to go out of your way to get them to NOT cache css, js, html and images.</p>
<p>I'm not that familiar with ASP MVC, but I think they type of caching you're thinking of is opcode caching for your created dynamic output server-side?</p> |
1,800,817 | How can I get part of regex match as a variable in python? | <p>In Perl it is possible to do something like this (I hope the syntax is right...):</p>
<pre><code>$string =~ m/lalala(I want this part)lalala/;
$whatIWant = $1;
</code></pre>
<p>I want to do the same in Python and get the text inside the parenthesis in a string like $1.</p> | 1,800,858 | 7 | 0 | null | 2009-11-26 00:07:14.167 UTC | 6 | 2015-06-26 05:52:36.31 UTC | null | null | null | null | 74,660 | null | 1 | 25 | python|regex|perl | 58,054 | <p>See: <a href="https://docs.python.org/2/library/re.html#match-objects" rel="noreferrer">Python regex match objects</a></p>
<pre><code>>>> import re
>>> p = re.compile("lalala(I want this part)lalala")
>>> p.match("lalalaI want this partlalala").group(1)
'I want this part'
</code></pre> |
1,661,800 | Hidden Columns in jqGrid | <p>Is there any way to hide a column in a jqGrid table, but have it show as read-only when the row is edited in the form editor modal dialog?</p> | 5,926,267 | 7 | 0 | null | 2009-11-02 15:02:29.813 UTC | 19 | 2017-08-08 15:38:29.317 UTC | 2012-12-20 11:06:39.533 UTC | null | 702,761 | null | 158,434 | null | 1 | 54 | javascript|jquery|jqgrid | 144,677 | <p>I just want to expand on <strong>queen3</strong>'s suggestion, applying the following does the trick:</p>
<pre><code>editoptions: {
dataInit: function(element) {
$(element).attr("readonly", "readonly");
}
}
</code></pre>
<p><strong>Sc... |
2,021,982 | awk without printing newline | <p>I want the variable sum/NR to be printed side-by-side in each iteration. How do we avoid awk from printing newline in each iteration ? In my code a newline is printed by default in each iteration</p>
<pre><code>for file in cg_c ep_c is_c tau xhpl
printf "\n $file" >> to-plot.xls
for f in 2.54 1.60 800
... | 2,022,026 | 7 | 0 | null | 2010-01-07 16:49:27.333 UTC | 29 | 2022-07-09 15:39:31.53 UTC | 2010-01-07 20:31:42.743 UTC | null | 3,140 | null | 196,093 | null | 1 | 209 | scripting|awk|newline | 218,716 | <p><code>awk '{sum+=$3}; END {printf "%f",sum/NR}' ${file}_${f}_v1.xls >> to-plot-p.xls</code></p>
<p><code>print</code> will insert a newline by default. You dont want that to happen, hence use <code>printf</code> instead.</p> |
2,333,307 | Should Enterprise Java entities be dumb? | <p>In our legacy Java EE application, there are loads of value object (VO) classes which typically contain only getters and setters, maybe <code>equals()</code> and <code>hashCode()</code>. These are (typically) the entities to be saved in persistence storage. (For the record, our app has no EJBs - although that <em>m... | 2,333,921 | 8 | 1 | null | 2010-02-25 10:40:25.413 UTC | 14 | 2020-06-13 18:23:46.04 UTC | 2013-05-09 09:03:38.863 UTC | null | 472,792 | null | 265,143 | null | 1 | 29 | java|oop|jakarta-ee|entity | 6,207 | <p>The <strong>DTO</strong> and <strong>VO</strong> are supposed to be used to transfer data and don't embed logic. The <strong>business objects</strong> on the other hand are supposed to embed some logic. I say <em>some</em>, because there is always a balance to find between what you put in services which coordinate l... |
1,802,597 | Identifying Exception Type in a handler Catch Block | <p>I have created custom exception class</p>
<pre><code>public class Web2PDFException : Exception
{
public Web2PDFException(string message, Exception innerException)
: base(message, innerException) { ... }
}
</code></pre>
<p>In my application how can I find out if it is my custom exception or not? </p>
<... | 1,802,611 | 8 | 0 | null | 2009-11-26 09:34:58.137 UTC | 9 | 2022-01-02 23:08:03.3 UTC | 2020-03-02 15:59:54.577 UTC | null | 285,795 | null | 212,057 | null | 1 | 53 | c#|exception | 121,908 | <p>UPDATED: assuming <a href="https://github.com/dotnet/roslyn/wiki/New-Language-Features-in-C%23-6" rel="noreferrer">C# 6</a>, the chances are that your case can be expressed as an exception filter. This is the ideal approach from a performance perspective assuming your requirement can be expressed in terms of it, e.g... |
1,924,367 | Why do hedge funds and financial services often use OCaml? | <p>Speaking to a number of quants / hedgies, I came to the conclusion that a large number of them seem to be using either a homebrew language or OCaml for many tasks. What many of them couldn't answer was why.</p>
<p>I can certainly understand why they wouldnt want to use C++ for the most part, but why is OCaml superi... | 1,924,726 | 9 | 3 | null | 2009-12-17 20:31:49.273 UTC | 22 | 2017-12-18 14:45:41.89 UTC | 2012-05-05 10:08:58.893 UTC | null | 1,095,817 | null | 207,201 | null | 1 | 26 | programming-languages|ocaml|quantitative-finance | 17,525 | <p>Try reading <a href="https://dl.acm.org/citation.cfm?id=1394798" rel="nofollow noreferrer">Caml trading - experiences with functional programming on Wall Street</a> by Yaron Minsky and Stephen Weeks (apologies, while this article used to be hosted for free at Jane Capital, it is no longer there, so I leave the ACM l... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.