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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4,030,436 | Activation error occured while trying to get instance of type Database, key "" <-- blank | <p>I'm trying out the Enterprise Library 5.0 and was doing some unit-tests on my BL, do I need to have a app.config on the DL or on the Test project?</p>
<p>note: I already have the configuration settings on my web.config on my web project.</p>
<p><strong>how I use the DAAB:</strong></p>
<pre><code>private static Da... | 4,040,012 | 7 | 3 | null | 2010-10-27 06:13:45.317 UTC | 2 | 2015-02-25 16:42:58.967 UTC | 2010-10-27 11:00:51.22 UTC | null | 437,301 | null | 162,381 | null | 1 | 11 | c#|unit-testing|enterprise-library | 57,813 | <p>i was referencing the wrong .dll copy. it works now.</p> |
3,805,478 | Internal HSQL database complains about privileges | <p>I'm setting up a standalone Java service with an in-process, in-memory HSQL database.</p>
<p><strong>Persistence.xml</strong></p>
<pre><code><persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persiste... | 3,808,595 | 8 | 2 | null | 2010-09-27 15:48:52.623 UTC | 3 | 2017-04-06 15:27:45.967 UTC | 2011-09-28 10:56:02.563 UTC | null | 85,821 | null | 85,821 | null | 1 | 13 | java|database|jpa|persistence|hsqldb | 44,840 | <p>You need to use Hibernate 3.5.6 or later, together with HSQLDB version 2.2.x or later. Otherwise, older Hibernte jars work with HSQLDB 1.8.x. The name of the table is not a problem.
I have developed the dialect and run the Hibernate tests for this version, but Pascal knows a lot more about Hibernate usage than I do ... |
3,757,071 | PHP - Debugging Curl | <p>I'd like to see what the post fields in the request are before I send it. (For debugging purposes).</p>
<p>The PHP library (class) I am using is already made (not by me), so I am trying to understand it.</p>
<p>As far as I can tell, it uses <code>curl_setopt()</code> to set different options like headers and such ... | 3,760,294 | 8 | 1 | null | 2010-09-21 03:18:53.553 UTC | 69 | 2022-07-04 09:08:02.773 UTC | 2018-12-11 12:34:49.253 UTC | null | 576,746 | null | 299,216 | null | 1 | 250 | php|debugging|curl | 378,525 | <p>You can enable the <code>CURLOPT_VERBOSE</code> option:</p>
<pre><code>curl_setopt($curlhandle, CURLOPT_VERBOSE, true);
</code></pre>
<p>When <code>CURLOPT_VERBOSE</code> is set, output is written to <strong>STDERR</strong> or the file specified using <code>CURLOPT_STDERR</code>. The output is very informative.</p... |
4,030,928 | Extract digits from a string in Java | <p>I have a Java <code>String</code> object. I need to extract only digits from it. I'll give an example:</p>
<p><code>"123-456-789"</code> I want <code>"123456789"</code></p>
<p>Is there a library function that extracts only digits?</p>
<p>Thanks for the answers. Before I try these I need to know if I have to insta... | 4,030,936 | 14 | 0 | null | 2010-10-27 07:41:35.977 UTC | 49 | 2020-07-21 11:55:05.393 UTC | 2010-11-01 23:46:43.523 UTC | null | 227,665 | null | 488,469 | null | 1 | 226 | java|string | 340,253 | <p>You can use regex and delete non-digits.</p>
<pre><code>str = str.replaceAll("\\D+","");
</code></pre> |
3,625,759 | Difference between "while" loop and "do while" loop | <p>What is the difference between while loop and do while loop. I used to think both are completely same.Then I came across following piece of code:</p>
<pre><code>do {
printf("Word length... ");
scanf("%d", &wdlen);
} while(wdlen<2);
</code></pre>
<p>This code works perfe... | 3,625,771 | 16 | 2 | null | 2010-09-02 09:27:01.383 UTC | 13 | 2020-07-19 08:31:10.933 UTC | 2020-07-19 08:31:10.933 UTC | null | 6,296,561 | null | 417,552 | null | 1 | 39 | c|loops | 378,773 | <p>The <strong>do while</strong> loop executes the content of the loop once before checking the condition of the while. </p>
<p>Whereas a <strong>while</strong> loop will check the condition first before executing the content.</p>
<p>In this case you are waiting for user input with scanf(), which will never execute i... |
3,231,804 | In Bash, how to add "Are you sure [Y/n]" to any command or alias? | <p>In this particular case, I'd like to add a confirm in Bash for</p>
<pre>
Are you sure? [Y/n]
</pre>
<p>for Mercurial's <code>hg push ssh://username@www.example.com//somepath/morepath</code>, which is actually an alias. Is there a standard command that can be added to the alias to achieve it?</p>
<p>The reason is... | 3,232,082 | 18 | 9 | null | 2010-07-12 19:58:32.85 UTC | 81 | 2021-12-29 12:43:21.387 UTC | 2017-04-07 22:04:49.15 UTC | null | 325,418 | null | 325,418 | null | 1 | 273 | bash|alias|confirmation | 225,450 | <p>These are more compact and versatile forms of <a href="https://stackoverflow.com/questions/3231804/in-bash-how-to-add-are-you-sure-y-n-to-any-command-or-alias/3231821#3231821"><strong>Hamish's</strong> answer</a>. They handle any mixture of upper and lower case letters:</p>
<pre><code>read -r -p "Are you sure? [y/N... |
8,331,135 | How to prevent java.lang.OutOfMemoryError: PermGen space at Scala compilation? | <p>I have noticed a strange behavior of my scala compiler. It occasionally throws an OutOfMemoryError when compiling a class. Here's the error message:</p>
<pre><code>[info] Compiling 1 Scala source to /Users/gruetter/Workspaces/scala/helloscala/target/scala-2.9.0/test-classes...
java.lang.OutOfMemoryError: PermGen sp... | 8,332,600 | 9 | 1 | null | 2011-11-30 18:41:01.22 UTC | 24 | 2021-03-25 18:29:32.383 UTC | 2017-08-30 11:18:21.113 UTC | null | 4,652,706 | null | 877,324 | null | 1 | 81 | scala|apache-spark|memory-management|sbt|scalatra-sbt | 22,200 | <p>The cause for <code>OutOfMemoryError: PermGen space</code> is that it doesn't have enough <a href="http://mark.koli.ch/2009/01/understanding-javas-perm-gen-maxpermsize-heap-space-etc.html" rel="noreferrer">permanent generation space</a> :) If you are using Oracle JVM, you need to add the <code>-XX:MaxPermSize=256M</... |
8,130,823 | set matplotlib 3d plot aspect ratio | <pre><code>import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
</code></pre>
<p>Setting the aspect ratio works for 2d plots:</p>
<pre><code>ax = plt.axes()
ax.plot([0,1],[0,10])
ax.set_aspect('equal','box')
</code></pre>
<p>But does not for 3d:</p>
<pre><code>ax = plt.axes(projection='3d')
ax.pl... | 8,141,905 | 11 | 1 | null | 2011-11-15 02:35:27.85 UTC | 16 | 2022-09-19 12:23:45.597 UTC | 2021-10-03 12:46:57.637 UTC | null | 7,758,804 | null | 143,476 | null | 1 | 69 | python|matplotlib | 60,515 | <p>My understanding is basically that this isn't implemented yet (see <a href="https://github.com/matplotlib/matplotlib/issues/17172" rel="nofollow noreferrer">this bug in GitHub</a>). I'm also hoping that it is implemented soon. See <a href="http://comments.gmane.org/gmane.comp.python.matplotlib.general/27415" rel="... |
4,544,636 | What does [\S\s]* mean in regex in PHP? | <p>What is meant by <code>[\s\S]*</code> in regex in PHP? Does <code>[\s\S]*</code> actually match every string the same as <code>.*</code>?</p> | 4,544,642 | 3 | 0 | null | 2010-12-28 08:17:25.463 UTC | 8 | 2018-11-30 11:25:12.93 UTC | 2018-11-30 11:25:12.93 UTC | null | 266,309 | null | 477,822 | null | 1 | 40 | php|regex | 41,483 | <p>By default <code>.</code> doesn't match new lines - <code>[\s\S]</code> is a hack around that problem.<br>
This is common in JavaScript, but in PHP you can use the <code>/s</code> flag to to make the dot match all characters.</p> |
4,072,365 | Understanding CSS selector priority / specificity | <p>I'd like to understand how CSS selectors work with property collisions. How is one property selected over another one?</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>div... | 4,072,434 | 4 | 1 | null | 2010-11-01 19:25:23.837 UTC | 15 | 2019-10-31 02:05:18.697 UTC | 2019-10-31 02:05:18.697 UTC | null | 2,930,477 | null | 185,921 | null | 1 | 42 | html|css|css-selectors | 48,146 | <p>I'll just toss in a link to the CSS 2.1 spec itself, and how browsers are <em>supposed</em> to calculate specificity:</p>
<p><a href="http://www.w3.org/TR/CSS2/cascade.html#specificity" rel="noreferrer">CSS 2.1 Section 6.4.3</a>:</p>
<blockquote>
<p>A selector's specificity is calculated as follows:</p>
<ul>
<li>cou... |
4,053,917 | Where is the HTML5 Document Type Definition? | <p>The "old" HTML/XHTML standards have a DTD (Document Type Definition) defined for them:</p>
<p>HTML 4.01 <a href="http://www.w3.org/TR/html401/sgml/dtd.html" rel="nofollow noreferrer">http://www.w3.org/TR/html401/sgml/dtd.html</a><br />
XHTML 1.0 <a href="http://www.w3.org/TR/xhtml1/dtds.html#a_dtd_XHTML-1.... | 15,245,834 | 5 | 5 | null | 2010-10-29 16:31:28.64 UTC | 19 | 2021-09-15 05:45:54.373 UTC | 2021-09-15 05:45:54.373 UTC | null | 4,751,173 | null | 425,275 | null | 1 | 73 | html|dtd|sgml | 27,216 | <p>There is no HTML5 DTD. The HTML5 RC explicitly <a href="http://www.w3.org/TR/html5/the-xhtml-syntax.html#writing-xhtml-documents" rel="noreferrer">says this</a> when discussing XHTML serialization, and this clearly applies to HTML serialization as well.</p>
<p>DTDs have been regarded by the designers of HTML5 as to... |
4,605,588 | How to merge some spannable objects? | <p>I divide a spannable object into 3 parts, do different operations, and then I need to merge them.</p>
<pre><code>Spannable str = editText.getText();
Spannable selectionSpannable = new SpannableStringBuilder(str, selectionStart, selectionEnd);
Spannable endOfModifiedSpannable = new SpannableStringBuilder(str, select... | 4,605,639 | 5 | 0 | null | 2011-01-05 15:10:14.553 UTC | 9 | 2021-01-10 11:44:51.907 UTC | 2019-05-27 14:02:53.91 UTC | null | 1,000,551 | null | 564,122 | null | 1 | 73 | android|spannable|charsequence | 29,336 | <p>You could use this:</p>
<pre><code>TextUtils.concat(span1, span2);
</code></pre>
<p><a href="http://developer.android.com/reference/android/text/TextUtils.html#concat(java.lang.CharSequence...)" rel="noreferrer">http://developer.android.com/reference/android/text/TextUtils.html#concat(java.lang.CharSequence...)</a... |
4,740,984 | c# regex matches example | <p>I am trying to get values from the following text. How can this be done with Regex?</p>
<h3>Input</h3>
<blockquote>
<p>Lorem ipsum dolor sit %download%#456 amet, consectetur adipiscing %download%#3434 elit. Duis non nunc nec mauris feugiat porttitor. Sed tincidunt blandit dui a viverra%download%#298. Aenean dapi... | 4,741,010 | 6 | 0 | null | 2011-01-19 21:29:14.663 UTC | 8 | 2021-05-27 20:53:05.21 UTC | 2020-04-17 06:55:19.23 UTC | null | 1,402,846 | null | 543,565 | null | 1 | 79 | c#|regex | 256,797 | <p>So you're trying to grab numeric values that are preceded by the token "%download%#"?</p>
<p>Try this pattern:</p>
<pre><code>(?<=%download%#)\d+
</code></pre>
<p>That should work. I don't think <code>#</code> or <code>%</code> are special characters in .NET Regex, but you'll have to either escape the backslas... |
4,758,145 | How to use unscoped on associated relations in Rails3? | <p>I have a default scope on products due to information security constraints.</p>
<pre><code>class Product < ActiveRecord::Base
has_many :photos
default_scope where('visible = 1')
end
</code></pre>
<p>In my associated Photo model, however, I also have to find products that should not be visible.</p>
<pre><c... | 4,759,121 | 7 | 6 | null | 2011-01-21 11:16:13.697 UTC | 19 | 2016-10-29 17:32:51.553 UTC | 2011-01-21 12:31:49.913 UTC | null | 231,529 | null | 231,529 | null | 1 | 70 | ruby-on-rails|ruby-on-rails-3|scope|arel | 36,760 | <p>Oh. I fooled myself. Thought the following would not work... but it does:</p>
<pre><code>Product.unscoped do
my_photo.product
end
</code></pre>
<p>Notice that you have to call unscoped on the model with the <code>default_scope</code> that should be bypassed.</p>
<p>Also, inheritance has to be respected. If you ... |
4,567,688 | Problems with a PHP shell script: "Could not open input file" | <p>Ok, I am <em>trying</em> to create an email logger, that uses a PHP shell script. I have set up CPanel to pipe emails to my script. I am sure this is all configured properly. However I am having problems with the script, well any script for that matter when running it from the shell.</p>
<p>here is an example.</p>
... | 4,567,705 | 8 | 1 | null | 2010-12-31 02:29:45.18 UTC | 2 | 2020-12-06 04:51:05.063 UTC | 2010-12-31 02:52:41.84 UTC | null | 23,897 | null | 526,849 | null | 1 | 19 | php|bash|shell | 130,400 | <p>Have you tried:</p>
<pre><code>#!/usr/local/bin/php
</code></pre>
<p>I.e. without the <code>-q</code> part? That's what the error message "Could not open input file: -q" means. The first argument to <code>php</code> if it doesn't look like an option is the name of the PHP file to execute, and <code>-q</code> is CG... |
4,687,208 | Using .htaccess to make all .html pages to run as .php files? | <p>I need to run all of my .html files as .php files and I don't have time to change all of the links before our presentation tomorrow. Is there any way to "hack" this with my Apache server?</p> | 4,687,217 | 18 | 2 | null | 2011-01-14 01:33:55.93 UTC | 16 | 2022-03-24 09:08:31.267 UTC | null | null | null | null | 573,582 | null | 1 | 56 | php|html|apache|.htaccess | 140,960 | <p>Create a .htaccess file at the root of your website and add this line:</p>
<p>[Apache2 @ Ubuntu/Debian: use this directive]</p>
<pre><code>AddType application/x-httpd-php .html .htm
</code></pre>
<p>Or, from comment below:</p>
<pre><code>AddType application/x-httpd-php5 .html .htm
</code></pre>
<p>If your are r... |
14,750,711 | Catch python 'ImportError' if import from source directory | <p>When one tries to import a module <code>foo</code> while being in the source directory, one gets an rather confusing <code>ImportError</code> message: <code>ImportError: No module named foo</code>.</p>
<p>How can I easily catch this case and return a more informative message, e.g. 'Please do not load module foo fro... | 14,750,951 | 1 | 0 | null | 2013-02-07 12:05:43.407 UTC | null | 2013-02-07 13:42:34.423 UTC | 2013-02-07 13:42:34.423 UTC | null | 515,189 | null | 1,116,234 | null | 1 | 34 | python|exception-handling|importerror | 70,380 | <p><code>ImportError: No module named foo</code> actually means the module <code>foo.py</code> or package <code>foo/__init__.py</code> could not be found in any of the directories in the search path (<code>sys.path</code> list).</p>
<p>Since <code>sys.path</code> usually contains <code>.</code> (the current directory)... |
14,453,864 | Use more than one schema per collection on mongodb | <p>I wanted to use more than one schema per collection in mongodb , how to use it....?<br>
It gives me this error when I try to run it:
<br><br>Error: </p>
<blockquote>
<p>OverwriteModelError: Cannot overwrite <code>allUsers</code> model once compiled.
<br> OverwriteModelError: Cannot overwrite <code>checkInOut</c... | 14,454,102 | 3 | 0 | null | 2013-01-22 07:50:57.947 UTC | 13 | 2021-09-21 15:13:12.65 UTC | 2017-09-22 18:01:22.247 UTC | null | -1 | null | 1,949,475 | null | 1 | 39 | node.js|mongodb|mongoose|schema-design|nosql | 36,868 | <p>In mongoose you can do something like this:</p>
<pre><code>var users = mongoose.model('User', loginUserSchema, 'users');
var registerUser = mongoose.model('Registered', registerUserSchema, 'users');
</code></pre>
<p>This two schemas will save on the 'users' collection.</p>
<p>For more information you can refer to... |
14,427,253 | passing several arguments to FUN of lapply (and others *apply) | <p>I have a question regarding passing multiple arguments to a function, when using <code>lapply</code> in <code>R</code>. </p>
<p>When I use lapply with the syntax of <code>lapply(input, myfun);</code> - this is easily understandable, and I can define myfun like that:</p>
<pre><code>myfun <- function(x) {
# doin... | 14,427,278 | 4 | 1 | null | 2013-01-20 17:38:41.697 UTC | 45 | 2019-11-04 06:07:05.917 UTC | 2019-05-22 12:53:36.333 UTC | null | 10,229,584 | null | 1,707,278 | null | 1 | 135 | r|lapply | 128,846 | <p>If you look up the help page, one of the arguments to <code>lapply</code> is the mysterious <code>...</code>. When we look at the Arguments section of the help page, we find the following line:</p>
<pre><code>...: optional arguments to ‘FUN’.
</code></pre>
<p>So all you have to do is include your other argument in... |
2,953,354 | How can I set the current schema for DB2 using Hibernate/JDBC? | <p>I used to use currentSchema=MYSCHEMA; in my JDBC URL connection, but the version of DB2 we're using no longer supports that, showing the error 'The "currentSchema" property is not allowed on the target server'. I've tried using hibernate.default_schema, but it's not automatically adding the schema to my table names.... | 2,953,703 | 2 | 0 | null | 2010-06-01 21:09:00.317 UTC | 4 | 2020-11-18 17:36:42.837 UTC | 2010-06-02 03:00:31.563 UTC | null | 14,619 | null | 14,619 | null | 1 | 18 | jdbc|schema|db2 | 38,403 | <p>All the properties for the 9.7 (Latest) db are here...</p>
<p><a href="https://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=/com.ibm.db2.luw.apdv.java.doc/doc/r0052607.html" rel="noreferrer">https://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=/com.ibm.db2.luw.apdv.java.doc/doc/r00... |
2,578,752 | How can I plot NaN values as a special color with imshow in matplotlib? | <p>I am trying to use imshow in matplotlib to plot data as a heatmap, but some of the values are NaNs. I'd like the NaNs to be rendered as a special color not found in the colormap.</p>
<p>example:</p>
<pre><code>import numpy as np
import matplotlib.pyplot as plt
f = plt.figure()
ax = f.add_subplot(111)
a = np.arange... | 46,649,061 | 2 | 1 | null | 2010-04-05 14:03:56.713 UTC | 33 | 2017-10-09 14:40:32.587 UTC | 2010-04-05 16:44:50.613 UTC | null | 214,035 | null | 214,035 | null | 1 | 96 | python|matplotlib|nan | 72,974 | <p>With newer versions of Matplotlib, it is not necessary to use a masked array anymore.</p>
<p>For example, let’s generate an array where every 7th value is a NaN:</p>
<pre><code>arr = np.arange(100, dtype=float).reshape(10, 10)
arr[~(arr % 7).astype(bool)] = np.nan
</code></pre>
<p>We can modify the current colorm... |
36,869,258 | How to use Graphviz with Anaconda/Spyder? | <p>I am attempting to use Graphviz from Spyder (via an Anaconda install). I am having trouble understanding what is needed to do this and how to go about loading packages, setting variables, etc.</p>
<p>I straight forward approach for a new Python and Graphviz and Spyder user would be great!</p>
<p>Also, apart from j... | 36,869,259 | 3 | 0 | null | 2016-04-26 15:23:37.423 UTC | 7 | 2020-10-06 13:49:22.21 UTC | 2017-11-02 00:31:20.137 UTC | null | 5,639,728 | null | 5,639,728 | null | 1 | 9 | python-3.x|anaconda|graphviz|spyder | 38,259 | <p>Here are the steps that worked for me. Much of this information was available but spread out in several different StackOverflow posts and other websites. I hope that this serves as a good one-stop resource.</p>
<ol>
<li><p>Go to the <a href="http://www.graphviz.org/" rel="noreferrer">Graphviz website</a> and downlo... |
40,445,125 | how can component delete itself in Vue 2.0 | <p>as title, how can I do that</p>
<p>from offical documentation just tell us that $delete can use argument 'object' and 'key'</p>
<p>but I want delete a component by itself like this</p>
<pre><code>this.$delete(this)
</code></pre> | 40,445,367 | 4 | 0 | null | 2016-11-06 01:30:05.123 UTC | 10 | 2022-07-15 20:45:33.873 UTC | null | null | null | null | 6,337,438 | null | 1 | 46 | vue.js|vue-component | 92,198 | <p>No, you will not be able to delete a component directly. The parent component will have to use <code>v-if</code> to remove the child component from the DOM.</p>
<p>Ref: <a href="https://v2.vuejs.org/v2/api/#v-if" rel="nofollow noreferrer">https://v2.vuejs.org/v2/api/#v-if</a></p>
<p>Quoted from docs:</p>
<blockquote... |
27,888,429 | How can I create a stream from an array? | <p>Currently whenever I need to create stream from an array, I do</p>
<pre><code>String[] array = {"x1", "x2"};
Arrays.asList(array).stream();
</code></pre>
<p>Is there some direct way to create stream from an array?</p> | 27,888,447 | 6 | 0 | null | 2015-01-11 14:57:54.587 UTC | 18 | 2019-10-22 21:53:06.263 UTC | 2015-01-12 14:10:15.687 UTC | null | 1,864,167 | null | 4,360,647 | null | 1 | 140 | java|arrays|java-8|java-stream | 68,144 | <p>You can use Arrays.stream E.g.</p>
<pre><code>Arrays.stream(array);
</code></pre>
<p>You can also use <code>Stream.of</code> as mentioned by @fge , which looks like</p>
<pre><code>public static<T> Stream<T> of(T... values) {
return Arrays.stream(values);
}
</code></pre>
<p>But note <code>Stream.o... |
49,930,180 | Flutter, render widget after async call | <p>I would like to render a widget that needs an HTTP call to gather some data.</p>
<p>Got the following code (simplified)</p>
<pre><code>import 'package:flutter/material.dart';
import 'dart:async';
import 'dart:convert';
void main() {
runApp(new MyApp());
}
class MyApp extends StatelessWidget {
// This widget ... | 49,931,743 | 2 | 1 | null | 2018-04-19 21:01:09.197 UTC | 13 | 2021-03-23 05:59:40.947 UTC | null | null | null | null | 5,578,655 | null | 1 | 73 | async-await|dart|flutter | 84,810 | <p>The best way to do this is to use a <a href="https://docs.flutter.io/flutter/widgets/FutureBuilder-class.html" rel="noreferrer">FutureBuilder</a>.</p>
<p>From the FutureBuilder documentation:</p>
<pre><code>new FutureBuilder<String>(
future: _calculation, // a Future<String> or null
builder: (Build... |
32,035,251 | Displaying LaTeX in pyQt/pySide QTableWidget | <p>I would like to add mathematical expressions to the table labels (e.g.: 2^3 should be properly formatted)</p>
<p>Here is a simple example of a table:
<a href="http://thomas-cokelaer.info/blog/2012/10/pyqt4-example-of-tablewidget-usage/" rel="noreferrer">http://thomas-cokelaer.info/blog/2012/10/pyqt4-example-of-tabl... | 32,085,761 | 1 | 0 | null | 2015-08-16 12:47:50.993 UTC | 9 | 2015-08-19 03:14:23.163 UTC | 2017-05-23 11:54:58.497 UTC | null | -1 | null | 760,418 | null | 1 | 12 | python|qt|pyqt|latex|pyside | 5,964 | <p>I've also been trying for some time to display complex labels in the header of a <em>QTableWidget</em>. I was able to do it by reimplementing the <em>paintSection</em> method of a <em>QHeaderView</em> and painting manually the label with a <em>QTextDocument</em> as described in a <a href="https://forum.qt.io/topic/3... |
44,486,532 | react function is not defined no-undef | <p>I get the following error when trying to compile my app - 'getRestaurants' is not defined no-undef</p>
<p>I'm having trouble tracking down why getRestaurants is not defined for zipCodeToCoords</p>
<p>I have an input component that takes a zip code on submit and calls zipCodeToCoords, I then want to call getRestaur... | 44,486,594 | 2 | 0 | null | 2017-06-11 17:12:49.093 UTC | 2 | 2017-06-11 17:39:05.28 UTC | null | null | null | null | 2,631,443 | null | 1 | 16 | reactjs | 109,951 | <p>Get restaurants is not some global function, it is a method on your App class so you need to call it as such. The easiest way to resolve this would probably be to:</p>
<ol>
<li>Change your done callback to an arrow function</li>
<li>Call <code>this.getRestaurants</code> in <code>zipCodeToCoords</code></li>
<li>Bind... |
39,173,982 | What is a NoSuchBeanDefinitionException and how do I fix it? | <p>Please explain the following about <code>NoSuchBeanDefinitionException</code> exception in Spring:</p>
<ul>
<li>What does it mean?</li>
<li>Under what conditions will it be thrown?</li>
<li>How can I prevent it?</li>
</ul>
<hr>
<p><em>This post is designed to be a comprehensive Q&A about occurrences of <code>... | 39,173,983 | 1 | 0 | null | 2016-08-26 20:08:22.763 UTC | 39 | 2020-11-03 16:47:06.913 UTC | 2019-04-12 14:18:40.713 UTC | null | 438,154 | null | 438,154 | null | 1 | 69 | java|spring|applicationcontext | 119,305 | <p>The <a href="http://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/beans/factory/NoSuchBeanDefinitionException.html" rel="noreferrer">javadoc of <code>NoSuchBeanDefinitionException</code></a> explains</p>
<blockquote>
<p>Exception thrown when a <code>BeanFactory</code> is asked for a be... |
39,346,231 | Resume NSUrlSession on iOS10 | <p>iOS 10 is going to be released soon so it worth to test applications for compatibility with it. During such test we've discovered that our app can't resume background downloads on iOS10. Code that worked well on previous versions does not work on new one, both on an emulator and on a device.</p>
<p>Instead of reduc... | 39,347,461 | 3 | 0 | null | 2016-09-06 10:04:49.057 UTC | 39 | 2017-03-16 18:41:34.793 UTC | 2017-05-23 12:10:42.083 UTC | null | -1 | null | 6,799,654 | null | 1 | 35 | ios|nsurlsession|ios10|nsurlsessiondownloadtask | 14,100 | <p>This problem arose from currentRequest and originalRequest NSKeyArchived encoded with an unusual root of "NSKeyedArchiveRootObjectKey" instead of NSKeyedArchiveRootObjectKey constant which is "root" literally and some other misbehaves in encoding process of NSURL(Mutable)Request.</p>
<p>I detected that in beta 1 an... |
34,044,888 | Select multiple nested levels of child tables in Entity Framework Core | <p>I want to get multiple nested levels of child tables in Entity Framework Core using eager loading. I don't think lazy loading is implemented yet.</p>
<p>I found an <a href="https://stackoverflow.com/questions/3356541/entity-framework-linq-query-include-multiple-children-entities">answer</a> for EF6.</p>
<pre><code... | 34,046,250 | 2 | 0 | null | 2015-12-02 14:12:26.353 UTC | 4 | 2019-07-24 19:06:25.97 UTC | 2018-02-15 10:45:36.737 UTC | null | 2,349,045 | null | 5,537,070 | null | 1 | 55 | entity-framework-core | 26,893 | <p>You can use the keyword <code>ThenInclude</code> instead</p>
<p>e.g.</p>
<pre><code>var company = context.Companies
.Include(co => co.Employees).ThenInclude(emp => emp.Employee_Car)
.Include(co => co.Employees).ThenInclude(emp => emp.Employee_Country)
.FirstOrDefa... |
38,576,040 | How to name aggregate columns? | <p>I'm using Spark in Scala and my aggregated columns are anonymous. Is there a convenient way to rename multiple columns from a dataset? I thought about imposing a schema with <code>as</code> but the key column is a struct (due to the <code>groupBy</code> operation), and I can't find out how to define a <code>case cla... | 38,620,860 | 3 | 2 | null | 2016-07-25 19:35:55.303 UTC | 9 | 2021-10-19 19:44:54.717 UTC | 2016-07-27 18:04:32.687 UTC | null | 832,188 | null | 832,188 | null | 1 | 18 | scala|apache-spark|apache-spark-dataset | 19,429 | <p>I ended up using <code>alias</code>es with the <code>select</code> statement; e.g.,</p>
<pre><code>ds.select($"key.src".as[Short],
$"key.dst".as[Short],
$"sum(count)".alias("count").as[Long])
</code></pre>
<p>First I had to use <code>printSchema</code> to determine the derived column names:</... |
32,296,272 | Telegram BOT Api: how to send a photo using PHP? | <p>The <a href="https://core.telegram.org/bots/api#sendphoto" rel="noreferrer">sendPhoto</a> command require an argument <code>photo</code> defined as <code>InputFile or String</code>.</p>
<p>The API doc tells: </p>
<pre><code>Photo to send. You can either pass a file_id as String to resend a photo
that is already on... | 32,296,353 | 7 | 0 | null | 2015-08-30 11:53:46.073 UTC | 12 | 2021-08-16 23:37:13.32 UTC | null | null | null | null | 1,055,279 | null | 1 | 10 | php|curl|telegram|telegram-bot | 59,409 | <p>This is my working solution, but it requires PHP 5.5:</p>
<pre><code>$bot_url = "https://api.telegram.org/bot<bot_id>/";
$url = $bot_url . "sendPhoto?chat_id=" . $chat_id ;
$post_fields = array('chat_id' => $chat_id,
'photo' => new CURLFile(realpath("/path/to/image.png"))
);
$ch = ... |
38,028,388 | Cannot read property 'errors' of undefined in angular 2 | <p>I am validating my template using angular2, but meanwhile it shows this error:</p>
<pre><code> Cannot read the property 'errors' of undefined.
</code></pre>
<p>Here is my template:</p>
<pre><code><h3 class = "head">{{title}}</h3>
<form [ngFormModel]="form" #f="ngForm">
<div class="row">... | 38,028,446 | 1 | 0 | null | 2016-06-25 12:09:57.583 UTC | 0 | 2018-05-18 17:17:04.3 UTC | 2017-07-07 07:21:05.09 UTC | null | 550,094 | null | 6,459,548 | null | 1 | 10 | html|angular | 40,534 | <p>First of all, you have <code>facebok</code> instead of <code>facebook</code> on the error property.</p>
<p>If that doesn't fix it you're probably using the <code>facebook</code> object before it is assigned, which can happen if it's an <code>@Input()</code> for example.</p>
<p>Use the <code>Elvis operator</code>:<... |
35,641,019 | How do you use credentials saved by the browser in auto login script | <p>When I manually open a browser, both firefox and chrome, and proceed to a website where I previously saved my login credentials via the browser, the username and password fields automatically populate as they should. However, when I use the python selenium webdriver to open the browser to a specific page, the fields... | 35,641,449 | 4 | 0 | null | 2016-02-26 00:18:05.22 UTC | 9 | 2022-08-03 18:38:59.86 UTC | 2022-08-03 18:38:59.86 UTC | null | 2,308,683 | null | 5,983,391 | null | 1 | 11 | python|selenium|webdriver | 25,675 | <p>This is because selenium doesn't use your default browser instance, it opens a different instance with a temporary (empty) profile. </p>
<p>If you would like it to load a default profile you need to instruct it to do so.</p>
<p>Here's a chrome example:</p>
<pre><code>from selenium import webdriver
from selenium.w... |
18,668,096 | 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll | <p>I'm writing an application to read the first line of a txt file and write to Excel.</p>
<p>The input line is like this, which has 94 characters in total, the last 8 can be blanks or 0's (the x's are actually blanks): <code>101x071000301x6759601771308202341F094101ACHxxxxxxxxxxxxxxxxxxxxFISxACHxMILWAUKEExxxxxxxx</co... | 18,668,145 | 1 | 3 | null | 2013-09-06 23:36:21.853 UTC | null | 2022-07-20 14:30:55.807 UTC | 2022-07-20 14:23:36.97 UTC | null | 2,756,409 | null | 1,404,321 | null | 1 | 6 | c#|.net|argumentexception|mscorlib | 38,176 | <p>There seems to be no validation in the file content you're reading.</p>
<p><code>.SubString()</code> throws the <code>ArgumentOutOfRangeException</code> if the <a href="http://msdn.microsoft.com/en-us/library/aka44szs.aspx" rel="nofollow noreferrer">"<code>startIndex</code> plus <code>length</code> indicates a ... |
56,086,420 | How to get React Table Row Data Onclick | <p>Hi I am trying to set up my react app such that when you click on a button in a row item in my react-table the data in that row is passed onto another component. At the moment I am simply trying to console.log the correct data but am unsure of how to pass react-table row data based on click. How can I do this?
Thank... | 56,087,117 | 4 | 0 | null | 2019-05-11 01:09:29.467 UTC | 3 | 2021-02-12 13:48:44.06 UTC | 2019-05-11 01:43:14.073 UTC | null | 6,716,062 | null | 6,716,062 | null | 1 | 9 | reactjs|onclick|react-props|react-table | 41,498 | <p>You will need to add an onClick handler for the row</p>
<pre class="lang-js prettyprint-override"><code>const onRowClick = (state, rowInfo, column, instance) => {
return {
onClick: e => {
console.log('A Td Element was clicked!')
console.log('it produced this event:', e)
... |
855,841 | Load balance web application | <p>There are load balanced tomcat web servers. Every request could be served by different tomcat server. </p>
<p>How could we take care of this while writing code for the j2ee (struts) based web application? </p> | 855,864 | 1 | 0 | null | 2009-05-13 02:52:21.887 UTC | 15 | 2012-09-04 09:15:27.933 UTC | null | null | null | null | 32,262 | null | 1 | 17 | java|tomcat|load-balancing | 11,752 | <p>First of all, you'll want to set up your load balancer for session affinity/sticky sessions, so that it continues forwarding all requests to the same Tomcat (as long as it is up) based on JSESSIONID.</p>
<p><a href="http://tomcat.apache.org/tomcat-6.0-doc/cluster-howto.html" rel="noreferrer">The Tomcat clustering d... |
1,248,129 | List all processes and their current memory & CPU consumption? | <p>How can I get a list of all processes in C# and then for each process current memory and CPU consumption?</p>
<p>Sample code is highly appreciated.</p> | 1,248,141 | 1 | 0 | null | 2009-08-08 06:23:08.63 UTC | 11 | 2016-06-29 11:16:06.703 UTC | 2016-06-29 11:16:06.703 UTC | null | 107,625 | null | 114,916 | null | 1 | 19 | c#|.net|memory-management|cpu-usage|performancecounter | 38,926 | <p>The <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.process_members.aspx" rel="noreferrer">Process class</a> has a GetProcesses method that will let you enumerate the running processes and list a bunch of stats like memory usage and CPU time. Look at the documentation under properties for the sta... |
59,115,578 | "httptrace" endpoint of Spring Boot Actuator doesn't exist anymore with Spring Boot 2.2.0 | <p>With Spring Boot 2.2.0 the "httptrace" Actuator endpoint doesn't exist anymore. How can I get this functionality back?</p> | 59,115,579 | 2 | 1 | null | 2019-11-30 11:11:45.437 UTC | 7 | 2022-09-06 09:21:29.65 UTC | 2019-11-30 11:17:07.293 UTC | null | 2,891,595 | null | 2,891,595 | null | 1 | 42 | spring-boot|spring-boot-actuator | 16,428 | <p>The functionality has been <a href="https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.2.0-M3-Release-Notes#actuator-http-trace-and-auditing-are-disabled-by-default" rel="nofollow noreferrer">removed</a> by default in Spring Boot 2.2.0.</p>
<p>As a workaround, add this configuration to the Spring envi... |
21,365,928 | Gradle : how to use BuildConfig in an android-library with a flag that gets set in an app | <p>My (gradle 1.10 and gradle plugin 0.8)-based android project consists of a big android-library that is a dependency for 3 different android-apps</p>
<p>In my library, I would love to be able to use a structure like this</p>
<pre class="lang-java prettyprint-override"><code>if (BuildConfig.SOME_FLAG) {
callToBi... | 21,419,752 | 7 | 0 | null | 2014-01-26 16:17:12.743 UTC | 17 | 2020-12-14 13:32:43.633 UTC | 2018-08-19 14:16:33.807 UTC | null | 2,249,915 | null | 3,092,224 | null | 1 | 66 | android-gradle-plugin|buildconfig | 50,044 | <p>You can't do what you want, because <code>BuildConfig.SOME_FLAG</code> isn't going to get propagated properly to your library; build types themselves aren't propagated to libraries -- they're always built as RELEASE. This is bug <a href="https://code.google.com/p/android/issues/detail?id=52962">https://code.google.c... |
38,554,966 | Controlling column widths with Format-Table | <p>I am trying to get the last reboot time of some PCs from a list. When I use </p>
<pre><code>foreach ($pc in $pclist) {
Get-CimInstance -ClassName win32_operatingsystem -ComputerName $pc |
select csname, lastbootuptime
}
</code></pre>
<p>The output comes as following.</p>
<pre>csname lastbootuptime
--... | 38,576,389 | 2 | 8 | null | 2016-07-24 17:47:02.977 UTC | 8 | 2021-01-28 03:57:22.46 UTC | 2016-07-25 22:00:17.287 UTC | null | 45,375 | null | 3,881,153 | null | 1 | 25 | powershell|formatting|formattable | 80,947 | <p>To summarize and complement the helpful comments made by <a href="https://stackoverflow.com/users/4003407/petseral">PetSerAl</a> and <a href="https://stackoverflow.com/users/1630171/ansgar-wiechers">Ansgar Wiechers</a>:</p>
<p><strong>tl;dr</strong></p>
<pre><code>Get-CimInstance -ClassName win32_operatingsystem -Co... |
7,476,541 | For...in statement Objective-C | <p>I am studying Objective-C and I came across this "for...in" statement. I searched for it but i still don't get how it works. Could someone explain to me in a noob-friendly how this statement works?</p> | 7,476,675 | 1 | 2 | null | 2011-09-19 19:55:26.263 UTC | 8 | 2014-07-02 16:43:19.513 UTC | 2014-07-02 16:43:19.513 UTC | null | 868,270 | null | 868,270 | null | 1 | 33 | objective-c|for-in-loop | 53,774 | <p>See <a href="https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Collections/Articles/Enumerators.html" rel="noreferrer">fast enumeration documentation</a>. </p>
<p>Basically you'd have, usually, an array, and you can obtain each item in the array with a handy loop instead of using NSEnumerator o... |
22,798,826 | In node.js, why is there a util.isArray and an Array.isArray? | <p>I just noticed the API docs for <a href="http://nodejs.org/api/util.html#util_util_isarray_object" rel="noreferrer">Node.js v0.10.26</a> provide for <code>util.isArray</code>,</p>
<blockquote>
<p>util.isArray(object)# Returns true if the given "object" is an Array.</p>
<p>false otherwise.</p>
</blockquote>
... | 22,848,148 | 4 | 0 | null | 2014-04-01 23:27:54.467 UTC | 6 | 2017-12-01 06:44:25.627 UTC | 2015-01-26 01:41:55.637 UTC | null | 1,048,572 | null | 124,486 | null | 1 | 38 | javascript|arrays|node.js | 22,498 | <p>To actually answer <em>why</em> <code>util.isArray</code> exists, we need a bit of a history lesson.</p>
<p>When it was <a href="https://github.com/joyent/node/blob/3c7873bd/lib/sys.js#L194-198" rel="noreferrer">first added to node</a>, it did a bit more than call <code>Array.isArray</code>.</p>
<pre><code>functio... |
39,261,204 | typings vs @types NPM scope | <p>In some cases <code>typings</code> is used for handling TypeScript definitions (e.g. <a href="https://github.com/angular/angular2-seed">angular/angular2-seed</a>).</p>
<p>In other cases scoped NPM <code>@types</code> packages are used with no <code>typings</code> involved (e.g. <a href="https://github.com/AngularCl... | 39,261,890 | 1 | 0 | null | 2016-09-01 01:01:05.287 UTC | 11 | 2016-09-01 02:41:16.24 UTC | null | null | null | null | 3,731,501 | null | 1 | 42 | typescript|npm|typescript-typings | 17,059 | <p>@types is the new way to install the definitions in typescript 2.0.
It unifies the management of definitions and packages. So that you do not need multiple tools and config files. Only going to need npm and package.json instead of having to have npm, package.json, typings, typings.json. It basically makes installing... |
39,320,393 | JSX or HTML autocompletion in Visual Studio Code | <p>Is there any way to use components or HTML completion in Visual Studio Code? Because typing each letter manually is not good idea when we have classes like Bootstrap etc. For example completion as in Emmet: <code>ul>li*2>a</code></p>
<pre><code>var React = require('react');
var Header = React.createClass({
... | 41,920,968 | 22 | 1 | null | 2016-09-04 18:52:13.833 UTC | 62 | 2022-09-20 19:47:53.797 UTC | 2016-09-10 11:55:04.777 UTC | null | 2,393,027 | null | 3,203,959 | null | 1 | 121 | reactjs|autocomplete|visual-studio-code|jsx|emmet | 136,533 | <p>Visual studio code detect .jsx extensions and add emmet support by default ( i'm using VS code 1.8.1)</p>
<p>But if you prefer to use .js extention for all your react files - you can associate JavaScript React mode with .js files in bottom right corner of VS Code window.</p>
<p><a href="https://i.stack.imgur.com/D4n... |
3,095,998 | Oracle: copy row while updating one field | <p>Please note: I <em>am</em> asking the question I want answered. I know this question means the database is set up poorly. So I will vote down any answers that suggest changing the way the table is set up.</p>
<p>I need to duplicate a bunch of rows, while changing one value. </p>
<pre><code>name col1 col2
dave... | 3,096,077 | 3 | 1 | null | 2010-06-22 18:28:48.523 UTC | 4 | 2014-02-06 08:55:38.42 UTC | 2013-03-07 18:37:08.67 UTC | null | 20,146 | null | 168,646 | null | 1 | 15 | sql|oracle|plsql|insert | 40,635 | <p>Use:</p>
<pre><code>INSERT INTO table
(name, col1, col2)
SELECT t.name, t.col1, 'a'
FROM TABLE t
WHERE t.col2 IS NULL
</code></pre>
<p>That's assuming neither the <code>name</code> or <code>col1</code> columns are a primary key or have a unique constraint on either.</p> |
2,585,337 | how to use "tab space" while writing in text file | <pre><code> SimpleDateFormat formatter = new SimpleDateFormat("ddMMyyyy_HHmmSS");
String strCurrDate = formatter.format(new java.util.Date());
String strfileNm = "Cust_Advice_" + strCurrDate + ".txt";
String strFileGenLoc = strFileLocation + "/" + strfileNm;
String strQuery="select name, age, data from basetable";
... | 2,585,347 | 3 | 0 | null | 2010-04-06 13:58:19.57 UTC | 1 | 2015-05-13 17:27:59 UTC | 2010-04-06 14:01:05.847 UTC | null | 166,712 | null | 269,246 | null | 1 | 26 | java|tabs|text-formatting | 241,276 | <p>You can use <code>\t</code> to create a tab in a file.</p> |
2,519,436 | Possible to create this redirecting route in Rails? | <p>Is it possible to do a redirect in the routes file of a Rails app?</p>
<p>Specifically, I'd like to forward <code>/j/e</code> to <code>/javascripts/embed.js</code></p>
<p>Right now the only way I can think to do it is to create a <code>j</code> controller with an <code>e</code> method that redirects to that.</p> | 2,519,614 | 3 | 0 | null | 2010-03-25 21:14:03.283 UTC | 17 | 2022-06-28 17:08:04.223 UTC | null | null | null | null | 147,586 | null | 1 | 52 | ruby-on-rails|redirect|routes | 48,186 | <p>Assuming rails version prior to 3.</p>
<p>You can create a new <code>RedirectController</code> or tuck a single function away in an existing controller, to do something like the following:</p>
<pre><code>map.js_embed '/j/e',
:controller => :redirect_controller,
:action => :some_function,
:path =&... |
2,670,680 | Git basic workflow | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/2816369/git-push-error-remote-rejected-master-master-branch-is-currently-checked">git push error '[remote rejected] master -> master (branch is currently checked out)'</a> </p>
</blockquote>
<p>I am ... | 2,670,812 | 4 | 1 | null | 2010-04-19 20:36:21.657 UTC | 17 | 2011-08-03 16:40:13.747 UTC | 2017-05-23 12:26:20.52 UTC | null | -1 | null | 303,477 | null | 1 | 27 | git|push | 22,898 | <p>First of all, you do not need to clone your local repository. You can use branches to divide development in the same repository.</p>
<p>Git is a Distributed VCS, and if you have experience with Subversion or CVS before it, you need to change your mind.</p>
<p>Git is a very agile and you can use different workflows... |
2,620,377 | Lua - Reflection - Get list of functions/fields on an object? | <p>I'm new to Lua and dealing with Lua as a scripting language in an alpha release of a program. The developer is unresponsive and I need to get a list of functions provided by some C++ objects which are accessible from the Lua code.</p>
<p>Is there any easy way to see what fields and functions these objects expose?</... | 2,620,398 | 4 | 0 | null | 2010-04-12 07:02:29.807 UTC | 13 | 2017-08-16 21:15:49.08 UTC | null | null | null | null | 314,284 | null | 1 | 35 | c++|reflection|function|object|lua | 47,744 | <p>In Lua, to view the members of a object, you can use:</p>
<pre><code>for key,value in pairs(o) do
print("found member " .. key);
end
</code></pre>
<p>Unfortunately I don't know if this will work for objects imported from C++.</p> |
28,995,827 | Yii2 - How To Add a CSS class to an ActiveForm Field | <p>This is the activeform field. I would like to know how to add a css class to it.</p>
<pre><code><?= $form->field($model, 'url')->label(false); ?>
</code></pre> | 28,997,161 | 2 | 0 | null | 2015-03-11 19:38:23.677 UTC | 3 | 2019-01-11 11:06:53.96 UTC | 2016-10-24 16:33:37.983 UTC | null | 4,305,683 | null | 1,923,625 | null | 1 | 27 | yii2 | 57,772 | <p>You can add it with </p>
<pre><code><?= $form->field($model, 'url')->textInput(['maxlength' => 255, 'class' => 'your class'])->label(false); ?>
</code></pre>
<p>As a rule you can pass html elements when telling activeField what type it should be. The default is textInput so that is why your co... |
37,687,427 | Change the thickness of an SVG shape | <p>I'm not familiar enough with svg drawing.</p>
<p>I have this arrow in SVG format. How can I increase the thickness of the arrow?</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><div s... | 37,687,733 | 3 | 0 | null | 2016-06-07 19:08:16.287 UTC | 10 | 2021-08-05 12:32:20.143 UTC | 2016-06-08 07:14:16.153 UTC | null | 1,292,848 | null | 4,980,017 | null | 1 | 53 | html|svg | 68,062 | <p>You can add a stroke with <code>stroke="black" stroke-width="10"</code> and then adjust your viewBox accordingly.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>OLD:
<div style="width... |
28,821,632 | how to configure eb cli with eb env that is already running | <p>I have taken over a project that has been deployed to elastic beanstalk. I would like to configure my eb cli to deploy to the existing environment without modifying that environment. From my research I get the impression that <code>eb init</code> is the proper command, however when I started going through the inte... | 28,823,517 | 2 | 0 | null | 2015-03-02 23:53:42.827 UTC | 4 | 2017-11-30 07:01:33.447 UTC | null | null | null | null | 1,908,882 | null | 1 | 35 | amazon-web-services|amazon-ec2|amazon-elastic-beanstalk | 19,868 | <p>During <code>eb init</code> make sure select an existing application and environment. As long as you do this it will pull down the settings from the environment.</p>
<p>However, that being said, the settings that <code>eb init</code> creates are default setting used for future environments. It will not overwrite an... |
40,357,434 | Pandas df.iterrows() parallelization | <p>I would like to parallelize the following code:</p>
<pre><code>for row in df.iterrows():
idx = row[0]
k = row[1]['Chromosome']
start,end = row[1]['Bin'].split('-')
sequence = sequence_from_coordinates(k,1,start,end) #slow download form http
df.set_value(idx,'GC%',gc_content(sequence,percent=Fa... | 40,428,356 | 4 | 4 | null | 2016-11-01 09:39:12.36 UTC | 24 | 2021-09-18 15:55:00.533 UTC | 2019-05-11 23:38:10.23 UTC | null | 3,190,076 | null | 3,190,076 | null | 1 | 41 | python|pandas|multiprocessing | 25,917 | <p>As @Khris said in his comment, you should split up your dataframe into a few large chunks and iterate over each chunk in parallel. You could arbitrarily split the dataframe into randomly sized chunks, but it makes more sense to divide the dataframe into equally sized chunks based on the number of processes you plan... |
176,720 | Irregular shaped Windows Form (C#) | <p>What is the easiest way to do this? Is it possible with managed code?</p> | 176,734 | 2 | 1 | null | 2008-10-06 23:47:17.633 UTC | 11 | 2019-02-12 00:24:25.683 UTC | 2019-02-12 00:24:25.683 UTC | null | 513,951 | Matias | 4,386 | null | 1 | 19 | c#|.net|winforms | 10,422 | <pre><code>this.BackgroundImage = //Image
this.FormBorderStyle = FormBorderStyle.None;
this.Width = this.BackgroundImage.Width;
this.Height = this.BackgroundImage.Height;
this.TransparencyKey = Color.FromArgb(0, 255, 0); //Contrast Color
</code></pre>
<p>This allows you to create a form based on an image, and use tran... |
1,252,270 | How do I view all ignored patterns set with svn:ignore recursively in an SVN repository? | <p>I see it is possible to view a list of properties set on every directory within an SVN repository using proplist and the -R flag (recursive) and -v flag (verbose):</p>
<pre><code>svn proplist -Rv
</code></pre>
<p>This shows me all properties, such as svn:mime-type or svn:executable. I'm looking to filter this to j... | 1,252,303 | 2 | 4 | null | 2009-08-09 20:56:52.67 UTC | 22 | 2017-03-06 09:14:25.953 UTC | 2016-12-11 14:28:05.577 UTC | null | 63,550 | null | 149,503 | null | 1 | 67 | svn|awk|grep | 33,704 | <pre><code>svn pg -R svn:ignore .
</code></pre>
<p>...with <code>pg</code> being a shorthand notation for <code>propget</code>, so this is equal to...</p>
<pre><code>svn propget -R svn:ignore .
</code></pre> |
2,385,609 | Getting selected text with CKEditor Plugin on IE | <p>I have made a plugin for CKEditor, but it relies on the currently selected text.</p>
<p>In FF and Chrome I can use: </p>
<pre><code>var selectedText = editor.getSelection().getNative();
</code></pre>
<p>but this doesn't work in IE and I only get <code>[object Object]</code></p>
<p>Any suggestions?</p> | 2,387,102 | 5 | 1 | null | 2010-03-05 09:19:34.39 UTC | 9 | 2017-10-23 20:19:21.05 UTC | 2017-10-23 20:19:21.05 UTC | null | 241,211 | null | 286,972 | null | 1 | 15 | javascript|internet-explorer|plugins|ckeditor | 19,321 | <p>This is what I use:</p>
<pre><code>var mySelection = editor.getSelection();
if (CKEDITOR.env.ie) {
mySelection.unlock(true);
selectedText = mySelection.getNative().createRange().text;
} else {
selectedText = mySelection.getNative();
}
</code></pre> |
2,412,720 | How to Make a Basic Finite State Machine in Objective-C | <p>I am attempting to build an FSM to control a timer in (iphone sdk) objective c. I felt it was a necessary step, because I was otherwise ending up with nasty spaghetti code containing pages of if-then statements. The complexity, non-readability, and difficulty of adding/changing features lead me to attempt a more for... | 2,413,173 | 5 | 0 | null | 2010-03-09 21:30:05.567 UTC | 17 | 2013-03-18 23:02:22.9 UTC | 2017-05-23 11:47:12.213 UTC | null | -1 | null | 241,883 | null | 1 | 31 | objective-c|protocols|state-machine | 19,560 | <p>When you use a protocol as a type-modifier, you can provide a comma-separated list of protocols. So all you need to do to get rid of the compiler warning is add NSObject to the protocol list like so:</p>
<pre><code>- (void)setupTimer:(id<TimerState,NSObject>) timerState {
// Create scheduled timers, etc.... |
2,361,851 | C# and F# casting - specifically the 'as' keyword | <p>In C# I can do:</p>
<pre><code>var castValue = inputValue as Type1
</code></pre>
<p>In F#, I can do:</p>
<pre><code>let staticValue = inputValue :> Type1
let dynamicValue = inputValue :?> Type1
</code></pre>
<p>But neither of them is the equivalent of the C#'s keyword <code>as</code>.</p>
<p>I guess I nee... | 2,362,114 | 5 | 0 | null | 2010-03-02 08:55:50.377 UTC | 4 | 2020-06-21 15:46:37.257 UTC | 2018-04-18 06:07:05.64 UTC | null | 544,947 | null | 5,932 | null | 1 | 33 | c#|f#|c#-to-f# | 8,158 | <p>As far as I know, F# doesn't have any built-in operator equivalent to C# <code>as</code> so you need to write some more complicated expression. Alternatively to your code using <code>match</code>, you could also use <code>if</code>, because the operator <code>:?</code> can be use in the same way as <code>is</code> i... |
2,496,267 | Recording user data for heatmap with JavaScript | <p>I was wondering how sites such as crazyegg.com store user click data during a session. Obviously there is some underlying script which is storing each clicks data, but how is that data then populated into a database? It seems to me the simple solution would be to send data via AJAX but when you consider that it's al... | 2,496,550 | 5 | 0 | null | 2010-03-22 22:37:21.827 UTC | 16 | 2020-07-09 08:20:34.36 UTC | 2020-01-16 16:37:00.463 UTC | null | 56,621 | null | 170,488 | null | 1 | 39 | javascript|analytics|heatmap|metrics | 13,863 | <p>The fundamental idea used by many tracking systems uses a 1x1px image which is requested with extra GET parameters. The request is added to server log file, then log files are processed to generate some statistics.
So a minimalist click tracking function might look like this:</p>
<pre><code>document.onclick = funct... |
2,452,987 | Hibernate - why use many-to-one to represent a one-to-one? | <p>I've seen people use many-to-one mappings to represent one-to-one relationships. I've also read this in a book by Gavin King and on articles.</p>
<p>For example, if a customer can have exactly one shipping address, and a shipping address can belong to only one customer, the mapping is given as:</p>
<pre><code><... | 2,456,176 | 5 | 0 | null | 2010-03-16 08:42:59.02 UTC | 15 | 2018-06-29 17:05:49.26 UTC | 2012-12-09 12:41:31.747 UTC | null | 143,732 | null | 124,111 | null | 1 | 49 | hibernate|orm | 30,636 | <p>There are several ways to implement a one-to-one association in a database: you can share a primary key but you can also use a foreign key relationship with a unique constraint (one table has a foreign key column that references the primary key of the associated table). </p>
<p>In the later case, the hibernate way ... |
2,899,201 | 'Microsoft.ACE.OLEDB.12.0' 64x Sql Server and 86x Office? | <p>The error:</p>
<blockquote>
<blockquote>
<p>OLE DB provider 'Microsoft.ACE.OLEDB.12.0' cannot be used for distributed queries because the provider is configured to run in single-threaded apartment mode.</p>
</blockquote>
</blockquote>
<p>And the answers I'm seeing is a conflict between 64 bit Sql Server an... | 2,899,337 | 6 | 0 | null | 2010-05-24 18:17:02.523 UTC | 4 | 2017-08-29 14:17:51.03 UTC | 2015-09-25 18:11:33.473 UTC | null | 103,897 | null | 103,897 | null | 1 | 4 | 64-bit|oledb|32-bit|openrowset | 54,719 | <p>Looks like Microsoft hasn't come up with a solution on this yet.
<a href="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=125117&wa=wsignin1.0" rel="nofollow noreferrer">check Microsoft feedback form of products</a></p>
<p>They have some workarounds like using SSIS</p> |
3,067,113 | XSLT string replace | <p>I don't really know XSL but I need to fix this code, I have reduced it to make it simpler.<br>
I am getting this error </p>
<blockquote>
<p>Invalid XSLT/XPath function</p>
</blockquote>
<p>on this line</p>
<pre><code><xsl:variable name="text" select="replace($text,'a','b')"/>
</code></pre>
<p>This is the... | 3,067,130 | 6 | 1 | null | 2010-06-18 03:54:16.907 UTC | 23 | 2022-01-05 13:38:12.507 UTC | 2015-09-24 23:56:54.197 UTC | null | 111,575 | null | 36,036 | null | 1 | 92 | xslt|xpath|replace|xslt-1.0|xpath-1.0 | 356,533 | <p><code>replace</code> isn't available for XSLT 1.0. </p>
<p>Codesling has a <a href="http://geekswithblogs.net/Erik/archive/2008/04/01/120915.aspx" rel="noreferrer">template for string-replace</a> you can use as a substitute for the function:</p>
<pre><code><xsl:template name="string-replace-all">
<xsl... |
2,369,081 | How to scroll to top of a div using jQuery? | <p>I have a gridview inside a div.. I want to scroll to top of the div from the bottom of the div using jquery.. Any suggestion..</p>
<pre><code><div id="GridDiv">
// gridview inside..
</div>
</code></pre>
<p>My gridview will have custom pagination generated link buttons in it... I will scroll to top of t... | 2,369,092 | 7 | 1 | null | 2010-03-03 05:59:44.337 UTC | 14 | 2020-04-29 05:51:28.44 UTC | 2018-05-16 10:16:18.99 UTC | null | 7,200,083 | null | 146,857 | null | 1 | 54 | jquery|html|scroll|scrolltop | 129,407 | <p>You could just use:</p>
<pre><code><div id="GridDiv">
// gridview inside...
</div>
<a href="#GridDiv">Scroll to top</a>
</code></pre> |
3,137,097 | Check if a string is a valid Windows directory (folder) path | <p>I am trying to determine whether a string input by a user is valid for representing a path to a folder. By valid, I mean formatted properly.</p>
<p>In my application, the folder represents an installation destination. Provided that the folder path <em>is</em> valid, I want to determine if the folder exists, and cre... | 3,137,165 | 8 | 6 | null | 2010-06-29 00:32:35.66 UTC | 26 | 2020-12-07 13:00:40.627 UTC | 2016-12-08 20:58:10.71 UTC | null | 1,497,596 | null | 139,644 | null | 1 | 93 | c#|windows|validation|filesystems|directory | 153,874 | <p>Call <a href="http://msdn.microsoft.com/en-us/library/system.io.path.getfullpath.aspx" rel="noreferrer"><code>Path.GetFullPath</code></a>; it will throw exceptions if the path is invalid.</p>
<p>To disallow relative paths (such as <code>Word</code>), call <a href="http://msdn.microsoft.com/en-us/library/system.io.... |
2,531,255 | jQuery Tag Editor? | <p>Is there any open source tag editor for jQuery that works like the tag editor in stack overflow?</p> | 11,968,549 | 9 | 1 | null | 2010-03-27 23:02:17.763 UTC | 15 | 2013-02-15 01:24:32.373 UTC | 2013-01-18 21:57:01.99 UTC | null | 127,880 | null | 140,937 | null | 1 | 34 | javascript|jquery|tags | 13,174 | <p>I have been looking at a bunch of options. None of them seemed to fit exactly what I was looking for. Here are are least some of the things I found. </p>
<ul>
<li><a href="https://github.com/aehlke/tag-it/">Tag-it</a></li>
<li><a href="http://webspirited.com/tagit/docs.html">Tagit</a></li>
<li><a href="http://xoxco... |
3,067,479 | Determine via C# whether a string is a valid file path | <p>I would like to know how to determine whether string is valid file path.</p>
<p>The file path may or may <em>not</em> exist.</p> | 3,067,600 | 10 | 3 | null | 2010-06-18 05:53:13.203 UTC | 8 | 2020-07-29 10:09:35.483 UTC | 2016-12-08 19:48:39.777 UTC | null | 1,497,596 | null | 279,911 | null | 1 | 52 | c#|.net|validation|path|filesystems | 97,112 | <p>A 100% accurate checking of a path's string format is quite difficult, since it will depend on the filesystem on which it is used (and network protocols if its not on the same computer).</p>
<p>Even within windows or even NTFS its not simple since it still depends on the API .NET is using in the background to commu... |
2,487,931 | LLVM C++ IDE for Windows | <p>Is there some C/C++ IDE for Windows, which is <strong>integrated</strong> with the LLVM compiler (and Clang C/C++ analyzer), just like modern Xcode do.</p>
<p>I have Dev-Cpp (it uses outdated GCC) and <a href="https://en.wikipedia.org/wiki/Code::Blocks" rel="noreferrer">Code::Blocks</a> (with some GCC). But GCC giv... | 5,979,028 | 13 | 2 | null | 2010-03-21 17:12:53.877 UTC | 42 | 2019-11-27 13:25:03.62 UTC | 2017-07-01 03:52:06.827 UTC | null | 1,033,581 | null | 196,561 | null | 1 | 94 | c++|windows|ide|llvm|clang | 61,593 | <p>LLVM is supported in <strong>Eclipse CDT</strong> via plug-in (<strong>llvm4eclipsecdt</strong>). It is the <strong>only Windows supported IDE supporting LLVM</strong> as far as I know. I am the main author of the plug-in so you can ask any questions related to it.</p>
<p>The plug-in offers the basic functionality ... |
2,364,147 | How to get just one file from another branch? | <p>I have a <code>master</code> branch with a file called <code>app.js</code>. I made changes to this file on an <code>experiment</code> branch.</p>
<p>I want to apply only the changes made to <code>app.js</code> from <code>experiment</code> onto the <code>master</code> branch.</p> | 2,364,223 | 14 | 2 | null | 2010-03-02 15:15:18.127 UTC | 424 | 2022-07-25 05:17:03.773 UTC | 2022-07-25 05:17:03.773 UTC | null | 365,102 | null | 253,470 | null | 1 | 1,824 | git|git-branch|git-checkout | 1,082,528 | <pre><code>git checkout master # first get back to master
git checkout experiment -- app.js # then copy the version of app.js
# from branch "experiment"
</code></pre>
<p>See also <a href="https://stackoverflow.com/questions/692246/git-how-to-undo-changes-of-one... |
3,115,191 | Scalable, Delayed PHP Processing | <p>I'm working on an online PHP application that has a need for delayed PHP event. Basically I need to be able to execute arbitrary PHP code x many seconds (but it could be days) after the initial hit to a URL. I need fairly precise execution of these PHP event, also I want it to be fairly scalable. I'm trying to avoid... | 3,115,483 | 15 | 11 | null | 2010-06-25 02:32:57.833 UTC | 13 | 2016-04-17 20:17:13.823 UTC | 2010-07-16 19:54:32.2 UTC | null | 188,044 | null | 188,044 | null | 1 | 21 | php|events|asynchronous|daemon | 6,842 | <p>I think a PHP only solution will be hard(almost impossible) to implement. I came up with two solutions to your problem.</p>
<h2>PHP/Redis solution</h2>
<p>Question asked by Kendall:</p>
<ul>
<li>How stable is redis:</li>
</ul>
<p>Redis is very stable. The developer really writes some clean C code. You should che... |
2,701,192 | What characters can be used for up/down triangle (arrow without stem) for display in HTML? | <p>I'm looking for a <strong>HTML</strong> or <strong>ASCII</strong> character which is a triangle pointing up or down so that I can use it as a toggle switch.</p>
<p>I found ↑ (<code>&uarr;</code>), and ↓ (<code>&darr;</code>) - but those have a narrow stem. I'm looking just for the HTML arrow "head... | 2,701,226 | 20 | 12 | null | 2010-04-23 18:51:54.08 UTC | 480 | 2022-04-11 22:03:25.93 UTC | 2022-04-11 22:03:25.93 UTC | null | 1,946,501 | null | 323,920 | null | 1 | 1,355 | html|css|unicode|icons|symbols | 1,375,629 | <p>Unicode arrows heads:</p>
<ul>
<li>▲ - U+25B2 BLACK UP-POINTING TRIANGLE</li>
<li>▼ - U+25BC BLACK DOWN-POINTING TRIANGLE</li>
<li>▴ - U+25B4 SMALL BLACK UP-POINTING TRIANGLE</li>
<li>▾ - U+25BE SMALL BLACK DOWN-POINTING TRIANGLE</li>
</ul>
<p>For ▲ and ▼ use <code>&#x25B2;</code> and <code>&#x25BC;</code>... |
39,969,202 | Convert UPPERCASE string to sentence case in Python | <p>How does one convert an uppercase string to proper sentence-case? Example string:</p>
<pre><code>"OPERATOR FAIL TO PROPERLY REMOVE SOLID WASTE"
</code></pre>
<p>Using <code>titlecase(str)</code> gives me:</p>
<pre><code>"Operator Fail to Properly Remove Solid Waste"
</code></pre>
<p>What I need is:</p>
<pre><co... | 39,969,258 | 3 | 0 | null | 2016-10-11 01:33:30.533 UTC | 3 | 2022-04-07 01:50:21.827 UTC | null | null | null | null | 1,860,317 | null | 1 | 53 | python | 41,602 | <p>Let's use an even more appropriate function for this: <a href="https://docs.python.org/2/library/string.html#string.capitalize" rel="noreferrer"><code>string.capitalize</code></a></p>
<pre><code>>>> s="OPERATOR FAIL TO PROPERLY REMOVE SOLID WASTE"
>>> s.capitalize()
'Operator fail to properly remo... |
10,458,465 | How to set height of element to match height of another element? | <p>I currently have two columns, with another column in-between them. What I want is to have the left and right columns extend in height as the centre column has more content added to it.</p>
<p>Something to note is that I cannot set an exact height for the parent div and then have the left and right columns set to "h... | 10,458,536 | 2 | 0 | null | 2012-05-05 03:02:51.553 UTC | 3 | 2020-05-26 14:27:57.943 UTC | 2017-02-01 17:36:01.653 UTC | null | 5,798,798 | null | 1,374,827 | null | 1 | 20 | css|html|height | 80,205 | <p>It looks like you're going to have to implement a Javascript approach. The way I would go about it would be to grab the height of <code>.legs</code> then apply it to <code>.flight_no</code> and <code>.price</code>.</p>
<p>The only other option I can think of would be to "fake it" by giving <code>.flight</code> a ba... |
6,139,425 | Can you hint an array's items type? | <p>This question is linked to <a href="https://stackoverflow.com/questions/308027/can-you-hint-return-types-in-php-5-2-5">this one</a> :</p>
<p>Is it possible to hint the type of the items inside a returned array ?</p>
<p>e.g. :</p>
<pre><code>/**
* MyFunction does a lot of things
*
* @param TClass1 $var1
* @pa... | 6,153,912 | 2 | 2 | null | 2011-05-26 13:39:53.303 UTC | 4 | 2014-11-03 17:42:57.967 UTC | 2017-05-23 12:13:57.547 UTC | null | -1 | null | 86,072 | null | 1 | 34 | php|netbeans|return-value|phpdoc|type-hinting | 6,928 | <p>Use</p>
<pre><code>@return TClass3[]
</code></pre>
<p>or</p>
<pre><code>@return TClass3[]|TClass3
</code></pre> |
18,261,214 | Load external js file in another js file | <p>I have this file include in my html and I want to call it from another javascript.
Please suggest me how should I do it?</p>
<pre><code><script type="text/javascript" src="js.js">/*
old:123
new: 456*/
</script>
</code></pre>
<p>I want to include it in my js file, not in the html.</p> | 18,261,253 | 1 | 5 | null | 2013-08-15 20:28:19.433 UTC | 8 | 2019-04-09 19:57:40.153 UTC | 2013-08-15 22:07:09.447 UTC | null | 2,539,720 | null | 1,520,210 | null | 1 | 27 | javascript|jquery | 71,299 | <p>If you want to include a JS file in a JS you can use <a href="https://api.jquery.com/jQuery.getScript/" rel="noreferrer">jQuery.getScript()</a> for that</p>
<pre><code>$.getScript('another_file.js', function() {
//script is loaded and executed put your dependent JS here
});
</code></pre>
<p>And if you cannot u... |
33,415,992 | Ansible: How to iterate over a role with an array? | <p>Is it possible to call a role multiple times in a loop like this:</p>
<pre><code>vars:
my_array:
- foo
- bar
- baz
roles:
- role: foobar
with_items: my_array
</code></pre>
<p>How can we do this?</p> | 40,852,606 | 5 | 0 | null | 2015-10-29 13:45:53.097 UTC | 8 | 2021-10-18 09:08:54.42 UTC | 2017-12-20 13:51:15.01 UTC | null | 1,245,190 | null | 828,473 | null | 1 | 39 | ansible | 48,599 | <p>Now supported as of <a href="https://github.com/ansible/ansible/issues/17966" rel="noreferrer">Ansible 2.3.0</a>:</p>
<pre><code>- name: myrole
with_items:
- "aone"
- "atwo"
include_role:
name: myrole
vars:
thing: "{{ item }}"
</code></pre> |
32,566,416 | Change format of md-datepicker in Angular Material with momentjs | <p>Angular material introduced a new date picker component found <a href="https://material.angularjs.org/HEAD/#/demo/material.components.datepicker">here</a>.</p>
<p>I want the date returned by this component to be in the format <em>yyy-mm-dd</em> but I am not sure how is this done. By searching I found that <code>$md... | 32,566,653 | 13 | 0 | null | 2015-09-14 13:44:17.607 UTC | 10 | 2019-03-22 11:03:27.527 UTC | 2019-02-07 22:52:57.49 UTC | null | 5,490,782 | null | 4,045,121 | null | 1 | 59 | javascript|angularjs|localization|angular-material|momentjs | 94,678 | <p>There is a documentation for <a href="https://material.angularjs.org/latest/api/service/$mdDateLocaleProvider" rel="noreferrer"><code>$mdDateLocaleProvider</code></a> in the Angular Material docs.</p>
<pre><code>angular.module('app').config(function($mdDateLocaleProvider) {
$mdDateLocaleProvider.formatDate = fu... |
47,344,183 | How to align <td rowspan ="value"> value to center vertically? | <p>I need to align <code>td</code> cell value to center, both horizontally and vertically. <code><td></code> has a <code>rowspan</code> attribute.</p>
<p>The output right now is like:</p>
<pre><code>A | B | C | D
1 | 2 | 3 | 4
1 | 2 | 3 |
1 | 2 | 3 |
</code></pre>
<p>Desired:</p>
<p... | 47,344,360 | 10 | 1 | null | 2017-11-17 05:59:09.387 UTC | 1 | 2020-04-16 15:15:12.47 UTC | 2019-11-20 23:16:41.233 UTC | null | 3,345,644 | null | 6,751,456 | null | 1 | 20 | html|css | 44,063 | <p>Try :</p>
<pre><code><td style="vertical-align : middle;text-align:center;">
</code></pre> |
21,322,182 | How to store ECDSA private key in Go | <p>I am using the <code>ecdsa.GenerateKey</code> method to generate a private/public key pair in Go. I would like to store the private key in a file on the users computer, and load it whenever the program starts. There is a method <code>elliptic.Marshal</code> that marshals the public key, but nothing for the private k... | 41,315,404 | 3 | 1 | null | 2014-01-24 00:28:51.957 UTC | 12 | 2018-12-04 22:36:10.27 UTC | null | null | null | null | 58,109 | null | 1 | 24 | go|ecdsa | 15,439 | <p>Here is a code sample that demonstrates encoding and decoding of keys in Go. It helps to know that you need to connect couple of steps. Crypto algorithm is the fist step, in this case ECDSA key. Then you need standard encoding, x509 is most commontly used standard. Finally you need a file format, PEM is again common... |
35,401,041 | Concatenation of 2 1D `numpy` Arrays Along 2nd Axis | <p>Executing</p>
<pre><code>import numpy as np
t1 = np.arange(1,10)
t2 = np.arange(11,20)
t3 = np.concatenate((t1,t2),axis=1)
</code></pre>
<p>results in a </p>
<pre><code>Traceback (most recent call last):
File "<ipython-input-264-85078aa26398>", line 1, in <module>
t3 = np.concatenate((t1,t2),a... | 35,401,356 | 5 | 0 | null | 2016-02-15 03:26:46.83 UTC | 4 | 2019-06-17 20:03:52.417 UTC | 2019-06-17 20:03:52.417 UTC | null | 195,787 | null | 4,139,744 | null | 1 | 22 | arrays|numpy|concatenation|numpy-ndarray|index-error | 62,893 | <p>Your title explains it - a 1d array does not have a 2nd axis!</p>
<p>But having said that, on my system as on <code>@Oliver W.</code>s, it does not produce an error</p>
<pre><code>In [655]: np.concatenate((t1,t2),axis=1)
Out[655]:
array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18,
1... |
35,641,994 | Accessing local filesystem in AWS lambda | <p>Is it possible to access local filesystem in a AWS lambda function? If so, is there any downside to doing so?</p> | 35,642,189 | 2 | 0 | null | 2016-02-26 01:55:02.113 UTC | 1 | 2019-05-20 17:28:39.733 UTC | null | null | null | null | 5,982,369 | null | 1 | 42 | aws-lambda | 36,863 | <p>It is possible. I have python function that does something like</p>
<pre><code> localFilename = '/tmp/{}'.format(os.path.basename(key))
s3.download_file(Bucket=bucket, Key=key, Filename=localFilename)
inFile = open(localFilename, "r")
</code></pre>
<p>Be sure you are using it for temporary storage and not to ... |
29,958,143 | What are en0, en1, p2p, and so on, that are displayed after executing ifconfig? | <p>When I type <code>ifconfig</code> on my Mac terminal, several information is printed. But I can't understand what they are. Can anyone briefly tell me what they are? What are <code>lo0</code>, <code>gif0</code>, <code>en0</code>, and so on?</p>
<p>Here is the results of my terminal.</p>
<pre><code> Last login: We... | 55,232,331 | 3 | 1 | null | 2015-04-30 02:46:18.283 UTC | 12 | 2021-11-22 07:44:52.203 UTC | 2018-12-02 11:35:59.813 UTC | null | 3,924,118 | null | 4,836,234 | null | 1 | 43 | macos|terminal|ifconfig | 45,285 | <p>In arbitrary order of my familarity / widespread relevance:</p>
<p><code>lo0</code> is loopback.</p>
<p><code>en0</code> at one point "ethernet", now is WiFi (and I have no idea what extra <code>en1</code> or <code>en2</code> are used for).</p>
<p><code>fw0</code> is the FireWire network interface.</p>
<p><code>... |
8,915,630 | iOS - UIImageView - how to handle UIImage image orientation | <p>Is it possible to setup <code>UIImageView</code> to handle image orientation? When I set the <code>UIImageView</code> to image with orientation <em>RIGHT</em> (it is photo from camera roll), the image is rotated to right, but I want to show it in proper orientation, as it was taken.</p>
<p>I know I can rotate image... | 8,915,809 | 14 | 0 | null | 2012-01-18 18:49:38.827 UTC | 39 | 2022-01-22 23:46:30.217 UTC | 2019-11-20 13:05:49.3 UTC | null | 10,607,772 | null | 329,242 | null | 1 | 85 | ios|uiimageview|uiimage|orientation | 114,264 | <p>If I understand, what you want to do is disregard the orientation of the UIImage? If so then you could do this:</p>
<pre><code>UIImage *originalImage = [... whatever ...];
UIImage *imageToDisplay =
[UIImage imageWithCGImage:[originalImage CGImage]
scale:[originalImage scale]
orient... |
48,048,299 | Angular 5 Scroll to top on every Route click | <p>I am using Angular 5. I have a dashboard where I have few sections with small content and few sections with so large content that I am facing a problem when changing router while going to top. Every time I need to scroll to go to top.</p>
<p>How can I solve this issue so that when I change the router, my view always... | 48,048,822 | 22 | 1 | null | 2018-01-01 08:46:48.033 UTC | 41 | 2022-09-23 17:43:27.767 UTC | 2022-01-04 12:59:14.173 UTC | null | 8,839,059 | null | 5,330,809 | null | 1 | 169 | javascript|angular|typescript|scrolltop|angular-router | 238,661 | <p>There are some solutions, make sure to check them all :)</p>
<hr>
<p><strong>Option1:</strong></p>
<p>The router outlet will emit the <code>activate</code> event any time a new component is being instantiated, so we could use <code>(activate)</code> to scroll (for example) to the top:</p>
<p><strong>app.component.ht... |
26,966,652 | Class 'App\Http\Controllers\DB' not found and I also cannot use a new Model | <p>I have very basic problem. In L4 thes below methods worked out of the box, so now I am lost. Please help. A few days ago I started a Laravel 5.0 project. I have now fresh, clean installation.</p>
<p>Problem 1: When I try to get anything from database</p>
<pre><code>$headquote = DB::table('quotation_texts')->fin... | 26,967,460 | 7 | 1 | null | 2014-11-17 06:15:51.353 UTC | 11 | 2020-04-21 22:01:01.36 UTC | 2014-11-17 07:19:31.663 UTC | null | 3,593,996 | null | 4,209,866 | null | 1 | 57 | php|laravel|namespaces|models|laravel-5 | 182,222 | <p>The problem here are PHP namespaces. You need to learn how to use them. As your controller are in <code>App\Http\Controllers</code> namespace, if you refer any other class, you need to add leading backslash (or proper namespace) or add <code>use</code> statement at the beginning of file (before class definition). </... |
1,120,228 | How to dynamically call a class' method in .NET? | <p>How to pass a class and a method name as <em>strings</em> and invoke that class' method?</p>
<p>Like</p>
<pre><code>void caller(string myclass, string mymethod){
// call myclass.mymethod();
}
</code></pre>
<p>Thanks</p> | 1,120,238 | 3 | 0 | null | 2009-07-13 15:38:19.18 UTC | 10 | 2009-07-13 16:23:20.523 UTC | 2009-07-13 15:43:35.127 UTC | null | 82 | null | 42,636 | null | 1 | 14 | c#|reflection | 23,060 | <p>You will want to use <a href="http://msdn.microsoft.com/en-us/library/ms173183(VS.80).aspx" rel="noreferrer">reflection</a>.</p>
<p>Here is a simple example:</p>
<pre><code>using System;
using System.Reflection;
class Program
{
static void Main()
{
caller("Foo", "Bar");
}
static void call... |
1,274,405 | How to create new folder? | <p>I want to put output information of my program to a folder. if given folder does not exist, then the program should create a new folder with folder name as given in the program. Is this possible? If yes, please let me know how.</p>
<p>Suppose I have given folder path like <code>"C:\Program Files\alex"</code> and <c... | 1,274,465 | 3 | 1 | null | 2009-08-13 20:33:50.52 UTC | 67 | 2017-09-26 02:20:00.187 UTC | 2013-07-02 08:42:14.097 UTC | null | 807,090 | alex | null | null | 1 | 271 | python|mkdir | 568,902 | <p>You can create a folder with <a href="http://docs.python.org/3/library/os.html?highlight=os.makedirs#os.makedirs" rel="noreferrer">os.makedirs()</a><br>
and use <a href="http://docs.python.org/3/library/os.path.html?highlight=os.path.exists#os.path.exists" rel="noreferrer">os.path.exists()</a> to see if it already e... |
617,706 | Passing an "in" list via stored procedure | <p>How can I construct a stored procedure that will allow me to pass (for example) an <code>@IDList</code> so that I can write:</p>
<pre><code>Select * from Foo Where ID in @IDList
</code></pre>
<p>Is this doable?</p> | 617,736 | 3 | 1 | null | 2009-03-06 04:51:39.007 UTC | 1 | 2016-01-26 14:54:40.56 UTC | 2016-01-26 14:54:40.56 UTC | Mitch Wheat | 419,956 | peiklk | 72,852 | null | 1 | 18 | sql-server|tsql|stored-procedures | 69,661 | <p>see this answer...</p>
<p><a href="https://stackoverflow.com/questions/43249/t-sql-stored-procedure-that-accepts-multiple-id-values/43767#43767">T-SQL stored procedure that accepts multiple Id values</a></p> |
6,798,699 | Monad instance for binary tree | <p>I built binary tree with:</p>
<pre><code>data Tree a = Empty
| Node a (Tree a) (Tree a)
deriving (Eq, Ord, Read, Show)
</code></pre>
<p>How can i make Monad type class instance for this tree? And can i make it on not?</p>
<p>i try:</p>
<pre><code>instance Monad Tree where
return ... | 6,799,885 | 1 | 2 | null | 2011-07-23 06:26:34.087 UTC | 11 | 2012-08-24 06:44:01.303 UTC | null | null | null | null | 274,299 | null | 1 | 28 | haskell|tree|monads | 6,884 | <p>There is no (good) monad for the type you just described, exactly. It would require rebalancing the tree and merging together the intermediate trees that are generated by the bind, and you can't rebalance based on any information in 'a' because you know nothing about it.</p>
<p>However, there is a similar tree stru... |
35,070,217 | What technology does Google Drive use to get real-time updates? | <p>What technology does Google Drive use to do real-time?</p>
<p>When I type in a Google Drive document that is being accessed by multiple users, the Chrome Developer Tools Network tab shows that there are no WebSockets.</p>
<p>I see that the two most frequent types of AJAX call have either "bind?" or "save?" in the ... | 37,514,952 | 2 | 1 | null | 2016-01-28 19:23:35.247 UTC | 30 | 2022-01-06 09:42:01.887 UTC | null | null | null | null | 2,482,570 | null | 1 | 61 | websocket|real-time|long-polling|server-sent-events | 12,211 | <h2>Is there a name for Google's solution for real-time updates in Drive (such as "long polling" or "sockets")?</h2>
<p>It didn't have a name until now. I'll call it "no-polling," to contrast with polling and long-polling.</p>
<p>With polling, the client periodically sends queries for new data.</p>
<p>With long-poll... |
28,604,363 | JsonParseException: Unrecognized token 'http': was expecting ('true', 'false' or 'null') | <p>We have the following string which is a valid JSON written to a file on HDFS. </p>
<pre><code>{
"id":"tag:search.twitter.com,2005:564407444843950080",
"objectType":"activity",
"actor":{
"objectType":"person",
"id":"id:twitter.com:2302910022",
"link":"http%3A%2F%2Fwww.twitter.com%2Fme7me4610012... | 28,604,705 | 6 | 1 | null | 2015-02-19 10:48:10.887 UTC | 2 | 2022-03-05 12:22:30.827 UTC | 2017-04-24 20:44:49.103 UTC | null | 2,275,818 | null | 299,758 | null | 1 | 19 | java|jackson|cloudera | 164,121 | <blockquote>
<p>We have the following string which is a valid JSON ...</p>
</blockquote>
<p>Clearly the JSON parser disagrees!</p>
<p>However, the exception says that the error is at "line 1: column 9", and there is no "http" token near the beginning of the JSON. So I suspect that the parser is trying to parse som... |
42,942,781 | Python - AttributeError: 'numpy.ndarray' object has no attribute 'append' | <p>This is related to my question, <a href="https://stackoverflow.com/questions/42941668/valueerror-could-not-broadcast-input-array-from-shape-22500-3-into-shape-1">here</a>.</p>
<p>I now have the updated code as follows:</p>
<pre><code>import numpy as np
import _pickle as cPickle
from PIL import Image
import sys,os
... | 42,943,379 | 4 | 1 | null | 2017-03-22 04:31:36.193 UTC | 6 | 2019-04-03 08:46:07.023 UTC | 2019-04-03 08:46:07.023 UTC | null | 707,111 | null | 588,855 | null | 1 | 15 | python|numpy|pickle | 295,889 | <pre><code>for root, dirs, files in os.walk(directory):
for file in files:
floc = file
im = Image.open(str(directory) + '\\' + floc)
pix = np.array(im.getdata())
pixels.append(pix)
labels.append(1) # append(i)???
</code></pre>
<p>So far ok. But you want to leave <code>pixe... |
42,952,191 | Is it possible to mock a function imported from a package in golang? | <p>I have the following method to test, which uses a function imported from a package.</p>
<pre><code>import x.y.z
func abc() {
...
v := z.SomeFunc()
...
}
</code></pre>
<p>Is it possible to mock <code>SomeFunc()</code> in golang?</p> | 42,952,311 | 5 | 2 | null | 2017-03-22 12:52:20.453 UTC | 18 | 2022-04-28 04:26:53.6 UTC | 2017-03-22 13:04:13.443 UTC | null | 1,705,598 | null | 1,087,152 | null | 1 | 42 | unit-testing|testing|go|mocking | 31,130 | <p>Yes, with a simple refactoring. Create a <code>zSomeFunc</code> variable of function type, initialized with <code>z.SomeFunc</code>, and have your package call that instead of <code>z.SomeFunc()</code>:</p>
<pre><code>var zSomeFunc = z.SomeFunc
func abc() {
// ...
v := zSomeFunc()
// ...
}
</code></pre... |
69,889,519 | VS 2022 - Convert to file-scoped namespace in all files | <p>I'm converting my project to .NET 6 and I want to use filescoped namespaces everywhere. But the conversion tool exists only in the editor.</p>
<p><a href="https://i.stack.imgur.com/yY5zi.png" rel="noreferrer"><img src="https://i.stack.imgur.com/yY5zi.png" alt="file-scoped namespace conversion" /></a></p>
<p>Has anyo... | 69,889,803 | 4 | 0 | null | 2021-11-08 20:22:45.597 UTC | 7 | 2022-07-11 01:45:40.363 UTC | 2021-11-09 17:09:40.91 UTC | null | 2,501,279 | null | 823,680 | null | 1 | 61 | c#|visual-studio-2022|c#-10.0 | 9,376 | <p>Adding a rule to use file scoped namespaces in <code>.editorconfig</code> worked for me:</p>
<ul>
<li>create an <code>.editorconfig</code> file in the solution directory</li>
<li>add following line/content below (<a href="https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/formatting-rules... |
6,061,722 | How do I set the security.policy file for a specific application from within NetBeans? | <p>I am having a bit of trouble -- a lot actually -- trying to figure out how get NetBeans to read my policy file for a particular application. Please take a look at the below code:</p>
<pre><code> public static void main(final String[] args)
{
System.setSecurityManager(new SecurityManager());
... | 6,061,897 | 4 | 0 | null | 2011-05-19 16:22:35.15 UTC | 4 | 2016-05-04 05:59:53.247 UTC | 2013-10-13 19:59:35.05 UTC | null | 1,576,461 | null | 520,312 | null | 1 | 10 | java|netbeans|security-policy | 50,677 | <p>The easiest way to set a specific security policy is via a runtime argument. For example, this is what we do here for the same problem:</p>
<ol>
<li>Open "Project Properties -> Run"</li>
<li>Select your runtime configuration </li>
<li>Edit the "VM Options" for the runtime configuration </li>
<li><p>Add the followi... |
6,086,981 | What is the difference between OpenNI and OpenKinect? | <p>I am considering using Kinect in one my projects, but I am totally lost between all the libraries. Don't know what is what exactly. Most importantly I am reading stuff about OpenNI and OpenKinect. But don't know their relation/differences. PS. I am using Ubuntu or Mac.</p> | 6,112,661 | 4 | 0 | null | 2011-05-22 09:06:05.887 UTC | 11 | 2014-07-12 06:01:57.553 UTC | 2012-05-25 11:51:19.98 UTC | null | 488,657 | null | 313,245 | null | 1 | 26 | kinect | 20,478 | <p><a href="http://openkinect.org/wiki/Main_Page" rel="noreferrer">OpenKinect</a> is a community of people, not a library. The OpenKinect community releases the <a href="https://github.com/OpenKinect/libfreenect" rel="noreferrer">libfreenect</a> Kinect driver. libfreenect and OpenNI+SensorKinect are two competing, op... |
34,512,880 | How to debug/reset Android 6.0 permissions? | <p>While migrating one of my apps to use the Android 6.0 permissions system, I found it very hard to debug permissions using the emulator.</p>
<p><strong>Findings:</strong></p>
<ul>
<li>Disabling a permission in the app info screen doesn't re-show the grant permission dialog when using the <code>requestPermissions()<... | 34,512,887 | 1 | 1 | null | 2015-12-29 14:15:27.263 UTC | 8 | 2017-10-03 20:27:31.05 UTC | 2017-10-03 20:27:31.05 UTC | null | 1,052,697 | null | 1,052,697 | null | 1 | 27 | android|android-permissions|android-6.0-marshmallow|android-debug|runtime-permissions | 14,249 | <p>It’s actually very easy to debug Android 6.0 permissions. You can reset the permissions to the "install state" for <strike>the current foreground app</strike> <strong>all apps</strong> using the following ADB shell command:</p>
<pre><code>adb shell pm reset-permissions
</code></pre>
<p><strong><em>Note:</strong> C... |
1,812,311 | Displaying fixed and editable items in a Source List | <h2>Background</h2>
<p>I am creating a Source List for my application and I want it structured in a way similar to that of iTunes, with two types of items:</p>
<ul>
<li>"Fixed" items – these do not change and can't be moved around – at the top</li>
<li>Editable items underneath, which <em>can</em> be changed by the u... | 1,812,924 | 2 | 0 | null | 2009-11-28 11:31:11.477 UTC | 14 | 2019-05-13 04:05:36.527 UTC | 2019-05-13 04:05:36.527 UTC | null | 4,751,173 | null | 75,245 | null | 1 | 14 | objective-c|cocoa|core-data | 1,830 | <p>I'm working on an app that has this exact same behavior, and here's how I'm doing it:</p>
<p>I have 5 main entities in my Core Data Model:</p>
<ol>
<li><code>AbstractItem</code> - an abstract Entity that has the attributes common to all items, like <code>name</code>, <code>weight</code>, and <code>editable</code>.... |
59,545,620 | flutter: Too many positional arguments: 0 expected, but 1 found | <p>I've been following <a href="https://resocoder.com/2019/04/06/flutter-nosql-database-sembast-tutorial-w-bloc/" rel="nofollow noreferrer">this NoSQL tutorial</a> which uses BLoC. But when I paste in the code from 'fruit_event.dart' into Visual Studio Code, it gives me an error.</p>
<p>fruit_event.dart:</p>
<pre cla... | 59,545,944 | 1 | 0 | null | 2019-12-31 14:56:30.893 UTC | 2 | 2022-03-29 03:14:45.537 UTC | null | null | null | null | 11,979,688 | null | 1 | 2 | flutter|nosql|bloc | 40,189 | <p>Source code of Equatable class: <a href="https://github.com/felangel/equatable/blob/master/lib/src/equatable.dart" rel="noreferrer">https://github.com/felangel/equatable/blob/master/lib/src/equatable.dart</a></p>
<p>It has only one constructor and the constructor accepts no argument/parameter. So you are not allowe... |
29,192,927 | A graph DB vs a Prolog (or miniKanren) | <p>Recently I have been looking into graph databases like Neo4j and into logic programming in Prolog and miniKanren. From what I have learned so far, both allow specifying facts and relations between them, and also querying the resulting system for some selections. So, actually I cannot see much difference between them... | 29,195,084 | 3 | 2 | null | 2015-03-22 09:44:39.403 UTC | 10 | 2019-11-12 17:46:22.663 UTC | 2015-03-22 09:57:27.06 UTC | null | 980,550 | null | 821,443 | null | 1 | 30 | neo4j|prolog|graph-databases|minikanren | 4,114 | <p>No, logic programming as embodied by those things and neo4j are quite different.</p>
<p>On one level, you're right that they conceptually both amount to graph storage and graph query. But for logic programming, it's only conceptually graph query, there's no guarantee that it's actually stored that way (where with ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.