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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6,259,844 | ASP.NET Validation of viewstate MAC failed | <p>I've a listView to show list of data. It was all good and suddendly we are receiving the error message below:</p>
<blockquote>
<p>Validation of viewstate MAC failed. If
this application is hosted by a Web
Farm or cluster, ensure that
configuration specifies the same
validationKey and validation
algorith... | 6,260,201 | 5 | 1 | null | 2011-06-07 01:42:32.8 UTC | 11 | 2020-12-10 16:23:34.823 UTC | 2011-06-07 01:48:10.833 UTC | null | 656,348 | null | 656,348 | null | 1 | 16 | asp.net | 37,876 | <p>It could be that IIS recycled your app and therefore you get new keys for the session/view state. To alleviate this, add a machine static key in the web.config.</p>
<p>Generate a key from <a href="http://www.eggheadcafe.com/articles/GenerateMachineKey/GenerateMachineKey.aspx" rel="noreferrer">http://www.eggheadcaf... |
6,235,794 | jQuery mobile- For every live tap event should there be an equivalent click event? | <p>I have replaced the jQuery live click events to jQuery mobile tap events to increase responsiveness.</p>
<p>I have a feeling this was a bad idea for compatibility reasons.</p>
<p>Is it necessary to have both events, and is there any way to write them both for the same function?</p>
<p>Such as ('click','tap')</p> | 6,237,462 | 5 | 0 | null | 2011-06-04 09:04:14.267 UTC | 22 | 2018-08-24 10:24:41.383 UTC | 2011-07-11 21:30:20.33 UTC | null | 63,550 | null | 720,785 | null | 1 | 26 | jquery|jquery-selectors|jquery-mobile | 38,615 | <p>Billy's answer is incredibly complete and actually worked quite well the few times I used it. Additionally however, you may want to look at the vmouse plugin in <a href="http://en.wikipedia.org/wiki/JQuery_Mobile" rel="nofollow noreferrer">JQuery Mobile</a>, it is an attempt to abstract mouse events:</p>
<pre><code... |
6,283,632 | How to know if the next character is EOF in C++ | <p>I'm need to know if the next char in <code>ifstream</code> is the end of file. I'm trying to do this with <code>.peek()</code>:</p>
<pre><code>if (file.peek() == -1)
</code></pre>
<p>and </p>
<pre><code>if (file.peek() == file.eof())
</code></pre>
<p>But neither works. There's a way to do this?</p>
<p><strong>E... | 6,283,787 | 8 | 3 | null | 2011-06-08 18:43:51.097 UTC | 4 | 2020-04-12 15:05:48.113 UTC | 2011-06-08 19:10:44.08 UTC | null | 259,517 | null | 259,517 | null | 1 | 12 | c++|eof | 66,565 | <p><a href="http://www.cplusplus.com/reference/iostream/istream/peek/" rel="noreferrer"><code>istream::peek()</code></a> returns the constant <code>EOF</code> (which is <em>not</em> guaranteed to be equal to -1) when it detects end-of-file <em>or error</em>. To check robustly for end-of-file, do this:</p>
<pre><code>... |
6,258,521 | Clear icon inside input text | <p>Is there a quick way to create an input text element with an icon on the right to clear the input element itself (like the google search box)?</p>
<p>I looked around but I only found how to put an icon as background of the input element. Is there a jQuery plugin or something else?</p>
<p>I want the icon inside the... | 6,258,628 | 18 | 6 | null | 2011-06-06 22:00:35.55 UTC | 76 | 2021-10-14 06:28:35.937 UTC | 2018-07-01 23:12:11.823 UTC | null | 1,287,812 | null | 257,092 | null | 1 | 220 | javascript|jquery|html|css | 324,875 | <p>Add a <code>type="search"</code> to your input<br />
The support is pretty decent but will <strong>not work in IE<10</strong></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-html lang-html prettyprin... |
6,200,533 | How to set TextView textStyle such as bold, italic | <p>How to set <code>TextView</code> style (bold or italic) within Java and without using the XML layout?</p>
<p>In other words, I need to write <code>android:textStyle</code> with Java.</p> | 6,200,841 | 27 | 0 | null | 2011-06-01 11:41:19.843 UTC | 126 | 2020-03-12 10:54:20.77 UTC | 2019-11-12 11:50:57.893 UTC | null | 6,717,610 | null | 778,037 | null | 1 | 941 | android|textview|styles | 552,189 | <pre><code>textView.setTypeface(null, Typeface.BOLD_ITALIC);
textView.setTypeface(null, Typeface.BOLD);
textView.setTypeface(null, Typeface.ITALIC);
textView.setTypeface(null, Typeface.NORMAL);
</code></pre>
<p>To keep the previous typeface</p>
<pre><code>textView.setTypeface(textView.getTypeface(), Typeface.BOLD_ITA... |
39,158,552 | ignore eslint error: 'import' and 'export' may only appear at the top level | <p>Is it possible to deactivate this error in eslint?</p>
<pre><code>Parsing error: 'import' and 'export' may only appear at the top level
</code></pre> | 39,173,590 | 4 | 2 | null | 2016-08-26 04:59:17.917 UTC | 8 | 2022-02-26 11:43:20.317 UTC | 2016-08-26 05:12:53.24 UTC | null | 103,081 | null | 3,142,695 | null | 1 | 50 | lint|eslint | 69,056 | <p>ESLint natively doesnt support this because this is against the spec. But if you use <code>babel-eslint</code> parser then inside your eslint config file you can do this:</p>
<pre><code>{
"parser": "babel-eslint",
"parserOptions": {
"sourceType": "module",
"allowImportExportEverywhere": true
}
}
</cod... |
19,531,262 | Can't phpize or configure an extension in OS X 10.9 Mavericks | <p>I am trying to build the memcached extension on OS X 10.9 Mavericks for use with the built in PHP 5.4, initially I tried <code>pecl install memcached</code> but that threw the following.</p>
<pre><code>checking for zlib location... configure: error: memcached support requires ZLIB. Use --with-zlib-dir=<DIR> t... | 19,531,985 | 4 | 0 | null | 2013-10-23 01:34:51.477 UTC | 15 | 2014-11-18 02:12:15.117 UTC | 2013-10-23 01:48:21.87 UTC | null | 345,350 | null | 345,350 | null | 1 | 34 | php|macos|php-extension|osx-mavericks | 48,436 | <p>run <code>xcode-select --install</code> to install the XCode5 Command Line Tools, then <code>sudo pecl install memcache</code>. You should be good to go.</p> |
19,512,088 | How to generate apk file programmatically through java code | <p>I need to generate or build an APK file through some Java program where I select the Android source project. Suppose I have a button on a web page. When clicked, it generates an <code>.apk</code> file.</p>
<p>I have seen we can build the APK file through Ant and Gradle. But this runs through the command shell. I do... | 19,517,909 | 4 | 0 | null | 2013-10-22 07:51:53.357 UTC | 8 | 2015-12-15 21:38:47.453 UTC | 2015-12-15 20:54:10.097 UTC | null | 266,531 | null | 2,327,111 | null | 1 | 8 | android|apk | 12,639 | <p>You can use the ANT jars <code>ant.jar</code> and <code>ant-launcher.jar</code>.<br>
In this case the path for <code>build.xml</code> should be fully specified.
Call it from your Java class this way:</p>
<pre><code>public class AntTest {
public static void main(String[] args) {
String build = "D:/xampp/htdocs/... |
45,380,280 | How to reverse a Map in Kotlin? | <p>I am trying to reverse a Map in Kotlin. So far, I have come up with:</p>
<pre><code>mapOf("foo" to 42)
.toList()
.map { (k, v) -> v to k }
.toMap()
</code></pre>
<p>Is there any better way of doing this without using a middleman(middlelist)?</p> | 45,380,326 | 6 | 0 | null | 2017-07-28 18:36:51.44 UTC | 4 | 2022-06-02 22:26:00.7 UTC | null | null | null | null | 2,229,438 | null | 1 | 36 | dictionary|kotlin|bimap | 13,646 | <p>Since the <code>Map</code> consists of <code>Entry</code>s and it is not <code>Iterable</code> you can use <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-map/entries.html" rel="noreferrer">Map#entries</a> instead. It will be mapped to <a href="http://docs.oracle.com/javase/8/docs/api/java... |
32,799,282 | Does the Enum#values() allocate memory on each call? | <p>I need to convert an ordinal <code>int</code> value to an enum value in Java. Which is simple:</p>
<pre><code>MyEnumType value = MyEnumType.values()[ordinal];
</code></pre>
<p>The <code>values()</code> method is implicit, and I cannot locate the source code for it, hence the question.</p>
<p>Does the <code>MyEnum... | 32,799,324 | 2 | 0 | null | 2015-09-26 16:22:50.233 UTC | 6 | 2020-05-27 17:01:21.513 UTC | 2015-09-26 21:09:28.75 UTC | null | 63,550 | null | 1,671,081 | null | 1 | 31 | java|memory-management|enums | 3,588 | <p>Yes.</p>
<p>Java doesn't have mechanism which lets us create unmodifiable array. So if <code>values()</code> would return same mutable array, we risk that someone could change its content for everyone.</p>
<p>So until unmodifiable arrays will be introduced to Java, for safety <code>values()</code> must return new/... |
33,021,802 | Why is a generic typed property nullable? | <p>I am trying to create a parameterized class with a <code>lateinit</code> non-nullable property of the generic type:</p>
<pre><code>class Test<T> {
private lateinit var t : T
private lateinit var s : String
}
</code></pre>
<p>The latter is allowed, but the former is not. The compiler returns the follow... | 33,022,160 | 4 | 0 | null | 2015-10-08 16:58:11.98 UTC | 12 | 2020-12-21 22:12:04.19 UTC | 2020-09-05 21:48:02.42 UTC | null | 1,788,806 | null | 675,383 | null | 1 | 80 | kotlin | 15,189 | <blockquote>
<p>The default upper bound (if none specified) is <code>Any?</code> (<a href="http://kotlinlang.org/docs/reference/generics.html#generic-constraints" rel="noreferrer">Source</a>)</p>
</blockquote>
<p>In other words, when you use <code>T</code>, Kotlin assumes that this might be <em>any</em> type, be it pri... |
42,362,027 | Model help using Scikit-learn when using GridSearch | <p>As part of the Enron project, built the attached model, Below is the summary of the steps,</p>
<h3>Below model gives highly perfect scores</h3>
<pre><code>cv = StratifiedShuffleSplit(n_splits = 100, test_size = 0.2, random_state = 42)
gcv = GridSearchCV(pipe, clf_params,cv=cv)
gcv.fit(features,labels) ---> wit... | 42,362,895 | 2 | 0 | null | 2017-02-21 08:20:50.29 UTC | 11 | 2018-08-24 16:28:39.467 UTC | 2018-08-24 16:28:39.467 UTC | null | 3,374,996 | null | 5,574,692 | null | 1 | 5 | python|machine-learning|scikit-learn|cross-validation|grid-search | 5,894 | <p>Basically the grid search will:</p>
<ul>
<li>Try every combination of your parameter grid</li>
<li>For each of them it will do a K-fold cross validation</li>
<li>Select the best available.</li>
</ul>
<p>So your second case is the good one. Otherwise you are actually predicting data that you trained with (which is ... |
33,125,669 | Uncaught ReferenceError: ReactDOM is not defined | <p>So i have Rails applications, i installed react-rails gem, set it up and try to run test application.</p>
<p>Freshly installed, when i tryed to run hello world program, this error hapened: </p>
<blockquote>
<p>Uncaught ReferenceError: ReactDOM is not defined</p>
</blockquote>
<p>This is my react: </p>
<pre><co... | 33,125,828 | 6 | 0 | null | 2015-10-14 12:44:08.09 UTC | 10 | 2022-01-18 16:20:35.25 UTC | 2016-11-27 01:14:46.967 UTC | null | 1,368,342 | null | 2,831,700 | null | 1 | 50 | javascript|ruby-on-rails|ruby|ruby-on-rails-4|reactjs | 87,040 | <p><code>ReactDOM</code> available since version <strong>0.14.0</strong>, so you need to use <code>React.render</code> (because you have a React version <strong>0.13.3</strong>) instead, </p>
<pre><code>setInterval(function() {
React.render(
<HelloWorld date={new Date()} />,
document.getElementById('ex... |
21,608,025 | How to set up theano config | <p>I'm new to Theano.
Trying to set up a config file.</p>
<p>First of all, I notice that I have no .theanorc file:</p>
<ol>
<li><code>locate .theanorc</code> - returns nothing</li>
<li><code>echo $THEANORC</code> - returns nothing</li>
<li><code>theano.test()</code> - passes ok</li>
</ol>
<p>I'm guessing some defaul... | 21,703,319 | 5 | 0 | null | 2014-02-06 16:07:51.887 UTC | 6 | 2017-12-03 13:47:55.66 UTC | null | null | null | null | 1,724,926 | null | 1 | 38 | theano | 45,590 | <p>Theano does not create any configuration file by itself, but has default values for all its configuration flags. You only need such a file if you want to modify the default values.</p>
<p>This can be done by creating a .theanorc file in your home directory. For example, if you want floatX to be always float32, you ... |
21,791,482 | Split list into different variables | <p>I have a list like this: </p>
<pre><code>[('love', 'yes', 'no'), ('valentine', 'no', 'yes'), ('day', 'yes','yes')]
</code></pre>
<p>How do I split this list into three variables with each variable holding respectively</p>
<ul>
<li><code>('love', 'yes', 'no')</code></li>
<li><code>('valentine', 'no', 'yes')</code... | 21,791,491 | 1 | 0 | null | 2014-02-14 23:48:27.89 UTC | 2 | 2017-12-29 04:40:51.423 UTC | 2017-03-17 19:12:59.28 UTC | null | 1,897,495 | null | 2,608,194 | null | 1 | 25 | python|list | 46,931 | <p>Assign to three names:</p>
<pre><code>var1, var2, var3 = listobj
</code></pre>
<p>Demo:</p>
<pre><code>>>> listobj = [('love', 'yes', 'no'), ('valentine', 'no', 'yes'), ('day', 'yes','yes')]
>>> var1, var2, var3 = listobj
>>> var1
('love', 'yes', 'no')
>>> var2
('valentine', 'n... |
20,400,870 | chmod 775 on a folder but not all files under that folder | <p>by assigning 775 rights of user to a folder (project) does that impact the files permissions under the folder?</p>
<pre><code># chown -R root:user1 /var/www/project/
# chmod 775 -R /var/www/project/
</code></pre>
<p>Meaning, if <code>/project/config.html</code> used to have a 664 right does that mean that 664 righ... | 20,400,916 | 2 | 0 | null | 2013-12-05 13:08:07.717 UTC | 1 | 2013-12-05 13:12:59.37 UTC | 2013-12-05 13:12:59.37 UTC | null | 1,223,693 | null | 2,976,220 | null | 1 | 12 | unix|chmod|chown | 63,495 | <p>Remove the <code>-R</code> <a href="http://ss64.com/bash/chmod.html">flag</a>. That means it changes all files and folders in the subdirectory as well.</p>
<pre><code># chown root:user1 /var/www/project/
# chmod 775 /var/www/project/
</code></pre> |
19,161,093 | Convert integer to string Jinja | <p>I have an integer</p>
<pre><code>{% set curYear = 2013 %}
</code></pre>
<p>In <code>{% if %}</code> statement I have to compare it with some string. I can't set <code>curYear</code> to string at the beginning because I have to decrement it in loop.</p>
<p>How can I convert it?</p> | 19,162,679 | 3 | 0 | null | 2013-10-03 13:53:56.193 UTC | 13 | 2022-09-23 09:57:10.863 UTC | 2016-10-26 13:59:03.44 UTC | null | 3,943,954 | null | 1,950,327 | null | 1 | 161 | python|jinja2|nunjucks | 170,087 | <p>I found the answer. </p>
<p>Cast integer to string:</p>
<pre><code>myOldIntValue|string
</code></pre>
<p>Cast string to integer:</p>
<pre><code>myOldStrValue|int
</code></pre> |
42,880,987 | Serverless Framework with AWS Lambda error "Cannot find module" | <p>I'm trying to use the Serverless Framework to create a Lambda function that uses open weather NPM module. However, I'm getting the following exception, but my node_modules contain the specific library.</p>
<p>I have managed to run the sample, (<a href="https://github.com/serverless/examples/tree/master/aws-node-res... | 42,881,471 | 12 | 0 | null | 2017-03-18 23:11:57.17 UTC | 1 | 2022-08-03 00:58:50.273 UTC | 2017-03-21 11:16:46.73 UTC | null | 2,593,745 | null | 718,149 | null | 1 | 35 | node.js|amazon-web-services|aws-lambda|aws-sdk|serverless-framework | 66,454 | <p>Did you <code>npm install</code> in your working directory before doing your <code>serverless deploy</code>? The <code>aws-sdk</code> node module is available to all lambda functions, but for all other node dependencies you must install them so they will be packaged with your lambda when you deploy.</p>
<p>You may ... |
33,322,832 | ~/Library/Developer/Xcode/iOS DeviceSupport/<iOS Version>/Symbols/System/Library consuming 14+GB of my Mac disk space | <p>I have entries in here ranging back to a large number of iOS versions (many GB are for old iOS 8 versions and there are many iOS 6 and 7 versions as well). </p>
<p>I don't expect to care about building apps in Xcode to support these iOS versions any more (maybe I will care about iOS 8.4 for a few more months), I mi... | 33,323,148 | 2 | 1 | null | 2015-10-24 20:13:41.803 UTC | 27 | 2015-10-25 05:30:57.697 UTC | null | null | null | null | 340,947 | null | 1 | 50 | ios|xcode|macos | 18,417 | <p>It's the symbols of the operating system, one for each version for each architecture. It's used for debugging. If you don't need to support those devices any more, you can delete the directory without ill effect. </p> |
9,382,099 | What is the proper way to dismiss a modal when using storyboards? | <p>Using storyboards, what is the proper way to dismiss a modal?</p>
<ul>
<li>using IBAction and writing code to dismiss after a button click?</li>
<li>using segue and notify the parent view controller after a button click?</li>
</ul> | 9,382,189 | 6 | 0 | null | 2012-02-21 17:22:55.057 UTC | 5 | 2018-04-19 17:55:08.683 UTC | 2018-04-19 17:31:02.973 UTC | null | 600,753 | null | 242,769 | null | 1 | 44 | ios|storyboard|modal-dialog | 41,377 | <p>See Here <a href="https://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/ModalViewControllers/ModalViewControllers.html" rel="noreferrer">Dismissing a Presented View Controller</a> about halfway down</p>
<blockquote>
<p>When it comes time to dismiss a presented view controller, the ... |
52,320,831 | cURL send JSON as x-www-form-urlencoded | <p>I want to post the following JSON:</p>
<pre><code>{
"cities": {
"chicago": 123,
"boston": 245
}
}
</code></pre>
<p>Using <code>curl</code> as <code>x-www-form-urlencoded</code> without using a .json file. I cannot figure out how to build the <code>curl -F ...</code> </p> | 52,320,948 | 2 | 2 | null | 2018-09-13 19:49:27.257 UTC | 3 | 2018-09-14 03:07:43.95 UTC | 2018-09-14 03:07:43.95 UTC | null | 1,255,289 | null | 834,045 | null | 1 | 30 | bash|curl | 62,427 | <p>For <code>application/x-www-form-urlencoded</code> you could try:</p>
<pre><code>curl -d "param1=value1&param2=value2" -X POST http://localhost:3000/blahblah
</code></pre>
<p>Where <code>param1=value...</code> have to be your JSON data as <code>chicago=123&boston=245</code></p>
<p>Or explicit form:</p>
<... |
10,781,880 | dynamically created iframe triggers onload event twice | <p>I created an iframe dynamically and found that this iframe trigger onload event twice.</p>
<pre><code>var i=0;
frameOnload=function(){
console.log(i++);
};
var ifr=document.createElement("iframe");
ifr.src="javascript:(function(){document.open();document.write('test');document.close();})();";
ifr.onload=fram... | 15,880,489 | 8 | 1 | null | 2012-05-28 08:55:24.883 UTC | 11 | 2021-03-18 06:36:32.99 UTC | 2017-12-10 12:17:24.377 UTC | null | 1,033,581 | null | 612,428 | null | 1 | 43 | javascript|iframe | 33,275 | <p>I've also encountered the same problem, but get no answer anywhere, so I tested by myself.</p>
<p>The iframe onload event will be triggered twice in webkit browsers ( safari/chrome ), if you attach the onload event BEFORE the iframe is appended to the body.</p>
<p>So you can prevent iframe onload twice by change y... |
57,744,392 | How to make hyperlinks in SwiftUI | <p>In Swift, as shown <a href="https://stackoverflow.com/questions/39238366/uitextview-with-hyperlink-text">here</a>, you can use <code>NSMutableAttributedString</code> to embed links in text.</p>
<p>How can I achieve this with <code>SwiftUI</code>?</p>
<p>I implemented it as the following, but it does not look how I w... | 57,760,247 | 10 | 1 | null | 2019-09-01 08:28:07.537 UTC | 5 | 2022-08-03 07:07:28.373 UTC | 2022-06-11 10:34:46.083 UTC | null | 8,292,178 | null | 12,003,672 | null | 1 | 32 | swiftui | 21,584 | <p><a href="https://stackoverflow.com/users/5623035/mojtaba-hosseini">Motjaba Hosseni</a> is right so far there is nothing that resembles NSAttributedString in SwiftUI.
This should solve your problem for the time being:</p>
<pre><code>import SwiftUI
struct ContentView: View {
var body: some View {
VStack ... |
7,496,913 | How to load XML from URL on XmlDocument() | <p>I have this code :</p>
<pre><code>string m_strFilePath = "http://www.google.com/ig/api?weather=12414&hl=it";
XmlDocument myXmlDocument = new XmlDocument();
myXmlDocument.LoadXml(m_strFilePath);
foreach (XmlNode RootNode in myXmlDocument.ChildNodes)
{
}
</code></pre>
<p>but when I try to execute it, I get thi... | 7,496,968 | 2 | 0 | null | 2011-09-21 08:40:44.79 UTC | 4 | 2020-10-06 17:04:50.55 UTC | 2011-09-21 08:46:45.07 UTC | null | 365,251 | null | 365,251 | null | 1 | 20 | c#|xml | 67,580 | <blockquote>
<p><strong>NOTE</strong>: You're really better off using <a href="https://docs.microsoft.com/en-us/dotnet/standard/linq/xdocument-class-overview" rel="nofollow noreferrer"><code>XDocument</code></a> for most XML parsing needs nowadays.</p>
</blockquote>
<p>It's telling you that the value of <code>m_strFile... |
7,522,034 | Node.js/Express form post req.body not working | <p>I'm using express and having trouble getting form data from the bodyParser. No matter what I do it always comes up as an empty object. Here is my express generated app.js code (the only thing I added was the app.post route at the bottom):</p>
<pre><code>var express = require('express');
var app = module.exports ... | 7,522,084 | 2 | 0 | null | 2011-09-22 22:05:02.603 UTC | 7 | 2013-07-21 10:27:47.333 UTC | null | null | null | null | 350,664 | null | 1 | 29 | post|node.js|express | 41,473 | <pre><code><form id="myform" action="/" method="post" enctype="application/x-www-form-urlencoded">
<input type="text" name="I_appear_in_req_body" id="mytext" />
<input type="submit" id="mysubmit" />
</form>
</code></pre>
<p>The body of a HTTP post is a key/value hash of all the form control... |
23,011,547 | WebService Client Generation Error with JDK8 | <p>I need to consume a web service in my project. I use NetBeans so I right-clicked on my project and tried to add a new "Web Service Client". Last time I checked, this was the way to create a web service client. But it resulted in an AssertionError, saying:</p>
<blockquote>
<p>java.lang.AssertionError: org.xml.sax.... | 23,012,746 | 24 | 1 | null | 2014-04-11 11:39:05.63 UTC | 79 | 2022-08-23 08:01:20.28 UTC | 2017-12-25 16:07:18.047 UTC | null | 918,959 | null | 300,858 | null | 1 | 242 | webservice-client|java-8|netbeans-8 | 188,018 | <p>Well, I found the solution. (based on <a href="http://docs.oracle.com/javase/7/docs/api/javax/xml/XMLConstants.html#ACCESS_EXTERNAL_SCHEMA" rel="noreferrer">http://docs.oracle.com/javase/7/docs/api/javax/xml/XMLConstants.html#ACCESS_EXTERNAL_SCHEMA</a>)</p>
<p>Create a file named <code>jaxp.properties</code> (if it... |
37,919,328 | SearchView hint not showing | <p>I'm trying to display hint text in a search view in my Main Activity. The onqueryTextSubmit launches another activity called SearchResultsActivity which will display the results of the query. My problem is that I cannot display the hint text. My searchable.xml code</p>
<pre><code><searchable xmlns:android="http:... | 37,919,598 | 6 | 2 | null | 2016-06-20 09:48:01.507 UTC | 1 | 2022-08-21 07:02:59.803 UTC | null | null | null | null | 6,372,784 | null | 1 | 38 | android|android-manifest|searchview | 38,736 | <p>To add SearchView hint text use the following code :</p>
<pre><code>search.setQueryHint("Custom Search Hint");
</code></pre> |
18,032,879 | MongoDB difference between error code 11000 and 11001 | <p>According to this <em>HIGHLY incomplete</em> list <a href="http://www.mongodb.org/about/contributors/error-codes/">http://www.mongodb.org/about/contributors/error-codes/</a> they're both related to duplicate keys. But I was not able to get a 11001 error. All of the following threw a 11000 error:</p>
<ul>
<li>insert... | 18,061,379 | 2 | 1 | null | 2013-08-03 12:29:42.233 UTC | 3 | 2020-05-12 07:41:54.193 UTC | null | null | null | null | 1,422,124 | null | 1 | 30 | mongodb | 36,173 | <p>The code <code>11001</code> does not exist in the 2.5/2.6 branch on GitHub, so if you're trying a 2.5 version than you can't create it. I did have a look at the code, but I can't find any path that shows the <code>11001</code> code either directly.</p>
<p>The following few lines will show code <code>11001</code>:</... |
17,853,105 | difference between async.series and async.parallel | <p>What is the difference between async.series and async.parallel. Consider the following exmaple, and i've got the same result.</p>
<pre><code>async.parallel([
function(callback){
setTimeout(function(){
callback(null, 'one');
}, 200);
},
function(callback){
setTimeout(f... | 17,853,217 | 2 | 0 | null | 2013-07-25 08:42:43.973 UTC | 8 | 2017-12-26 07:43:49.19 UTC | null | null | null | null | 1,743,843 | null | 1 | 23 | node.js | 13,719 | <p><code>async.series</code> invokes your functions serially (waiting for each preceding one to finish before starting next). <code>async.parallel</code> will launch them all simultaneously (or whatever passes for simultaneous in one-thread land, anyway).</p>
<p>The main callback is the one optionally supplied in the ... |
20,991,605 | How to remove white spaces from a string in Python? | <p>I need to remove spaces from a string in python. For example.</p>
<pre><code>str1 = "TN 81 NZ 0025"
str1sp = nospace(srt1)
print(str1sp)
>>>TN81NZ0025
</code></pre> | 20,991,634 | 6 | 2 | null | 2014-01-08 09:28:52.83 UTC | 5 | 2017-09-14 19:07:02.977 UTC | 2016-09-22 21:03:02.247 UTC | null | 846,892 | null | 2,797,563 | null | 1 | 4 | python|string|python-2.7|python-3.x|whitespace | 65,942 | <p>Use <code>str.replace</code>:</p>
<pre><code>>>> s = "TN 81 NZ 0025"
>>> s.replace(" ", "")
'TN81NZ0025'
</code></pre>
<p>To remove all types of white-space characters use <code>str.translate</code>:</p>
<pre><code>>>> from string import whitespace
>>> s = "TN 81 NZ\t\t0025\n... |
41,059,264 | Simple CSV to XML Conversion - Python | <p>I am looking for a way to automate the conversion of CSV to XML. </p>
<p>Here is an example of a CSV file, containing a list of movies:</p>
<p><a href="https://i.stack.imgur.com/Htvuy.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/Htvuy.jpg" alt="Movies Csv"></a></p>
<p>Here is the file in XML format:<... | 41,059,491 | 2 | 2 | null | 2016-12-09 11:19:56.403 UTC | 12 | 2022-02-08 20:34:56.667 UTC | 2016-12-09 11:58:19.577 UTC | null | 6,788,162 | null | 6,788,162 | null | 1 | 10 | python|xml|csv|parsing | 40,464 | <p>A possible solution is to first load the csv into Pandas and then convert it row by row into XML, as so:</p>
<pre><code>import pandas as pd
df = pd.read_csv('untitled.txt', sep='|')
</code></pre>
<p>With the sample data (assuming separator and so on) loaded as:</p>
<pre><code> Title Typ... |
28,212,380 | Why docker container exits immediately | <p>I run a container in the background using</p>
<pre><code> docker run -d --name hadoop h_Service
</code></pre>
<p>it exits quickly. But if I run in the foreground, it works fine. I checked logs using</p>
<pre><code>docker logs hadoop
</code></pre>
<p>there was no error. Any ideas?</p>
<p><strong>DOCKERFILE</stro... | 28,214,133 | 16 | 2 | null | 2015-01-29 10:30:21.35 UTC | 99 | 2021-08-19 22:35:03.073 UTC | 2017-02-01 03:01:14.413 UTC | null | 1,718,174 | null | 2,694,184 | null | 1 | 370 | docker | 477,230 | <p>A docker container exits when its main process finishes. </p>
<p>In this case it will exit when your <code>start-all.sh</code> script ends. I don't know enough about hadoop to tell you how to do it in this case, but you need to either leave something running in the foreground or use a process manager such as runit ... |
1,751,856 | How do you select all columns, plus the result of a CASE statement in oracle 11g? | <p>I want to select *, and not have to type out all individual columns, but I also want to include a custom column with a case statement. I tried the following:</p>
<pre><code>select *, (case when PRI_VAL = 1 then 'High'
when PRI_VAL = 2 then 'Med'
when PRI_VAL = 3 then 'Low'
... | 1,751,878 | 3 | 0 | null | 2009-11-17 21:16:46.913 UTC | 10 | 2016-03-14 15:34:41.42 UTC | 2011-04-01 05:40:00.46 UTC | null | 135,152 | null | 19,269 | null | 1 | 31 | sql|oracle|ora-00923 | 34,541 | <p>Add an alias for mytable like this:</p>
<pre><code>select t.*, (case when PRI_VAL = 1 then 'High'
when PRI_VAL = 2 then 'Med'
when PRI_VAL = 3 then 'Low'
end) as PRIORITY
from MYTABLE t;
</code></pre>
<p>This is not dependent on any specific Oracle version, not sure about ... |
8,651,346 | Sorted String Table (SSTable) or B+ Tree for a Database Index? | <p>Using two databases to illustrate this example: <a href="http://couchdb.apache.org/">CouchDB</a> and <a href="http://cassandra.apache.org/">Cassandra</a>.</p>
<h2><strong>CouchDB</strong></h2>
<p>CouchDB uses a B+ Tree for document indexes (using <a href="https://plus.google.com/u/0/107397941677313236670/posts/Cyv... | 8,654,903 | 4 | 1 | null | 2011-12-28 02:47:59.21 UTC | 33 | 2019-10-25 07:47:22.173 UTC | null | null | null | null | 553,524 | null | 1 | 45 | database|indexing|nosql|couchdb|cassandra | 21,245 | <p>When comparing a BTree index to an SSTable index, you should consider the write complexity: </p>
<ul>
<li><p>When writing randomly to a copy-on-write BTree, you will incur random reads (to do the copy of the leaf node and path). So while the writes my be sequential on disk, for datasets larger than RAM, these ran... |
8,448,711 | See Everything In The Terminal/Command Prompt After Long Output | <p>I'm new to ubuntu using the terminal to code some ruby. </p>
<p>Everytime I run this command it outputs like 600 lines of data that I need to analyze. </p>
<p>But when I try to scroll up to see everything alot of the output is cut off.</p>
<p>Is there any way to change the settings of the terminal or another com... | 8,449,567 | 10 | 1 | null | 2011-12-09 16:39:27.997 UTC | 4 | 2022-03-12 14:53:47.347 UTC | null | null | null | null | 251,234 | null | 1 | 46 | ubuntu|command-line|terminal | 69,004 | <p>Inside your Terminal Window, go to <code>Edit | Profile Preferences</code>, click on the <code>Scrolling</code> tab, and check the <code>Unlimited</code> checkbox underneath the <code>Scrollback XXX lines</code> row. Click <code>Close</code> and be happy.</p> |
19,334,374 | How to convert a string of space- and comma- separated numbers into a list of int? | <p>I have a string of numbers, something like:</p>
<pre><code>example_string = '0, 0, 0, 11, 0, 0, 0, 0, 0, 19, 0, 9, 0, 0, 0, 0, 0, 0, 11'
</code></pre>
<p>I would like to convert this into a list:</p>
<pre><code>example_list = [0, 0, 0, 11, 0, 0, 0, 0, 0, 19, 0, 9, 0, 0, 0, 0, 0, 0, 11]
</code></pre>
<p>I tried s... | 19,334,399 | 6 | 1 | null | 2013-10-12 12:50:30.52 UTC | 16 | 2021-08-27 21:32:33.947 UTC | 2021-08-27 21:32:33.947 UTC | null | 2,745,495 | null | 2,874,010 | null | 1 | 49 | python|string|list|integer | 157,298 | <p>Split on commas, then map to integers:</p>
<pre><code>map(int, example_string.split(','))
</code></pre>
<p>Or use a list comprehension:</p>
<pre><code>[int(s) for s in example_string.split(',')]
</code></pre>
<p>The latter works better if you want a list result, or you can wrap the <code>map()</code> call in <code>l... |
62,215,454 | How to get enum key by value in Typescript? | <p>I have an enum like this:</p>
<pre><code>export enum Colors {
RED = "RED COLOR",
BLUE = "BLUE COLOR",
GREEN = "GREEN COLOR"
}
</code></pre>
<p>Could you let me know how to get enum key by value please? i.e., I need to pass "BLUE COLOR" and get 'BLUE'.</p>
<p><code>Colors["BLUE COLOR"]</code> gives err... | 62,215,827 | 7 | 1 | null | 2020-06-05 12:32:23.24 UTC | 9 | 2022-09-11 16:57:00.517 UTC | 2020-06-05 13:00:19.487 UTC | null | 10,959,940 | null | 9,905,102 | null | 1 | 51 | typescript|enums | 74,702 | <blockquote>
<p>If you want to get your <code>enum key</code> by <code>value</code> in that case you have to
re write your enum in following manners: But same format also might be work in older version as well.</p>
</blockquote>
<p><em><strong><code>For Vanilla Js it should be like below:</code></strong></em></p>
<pre>... |
1,242,758 | What is correct behaviour of UpdateModel in ASP.NET MVC? | <p>I am interested to know what you guys feel should be deemed "correct behaviour" in terms of the <code>UpdateModel</code> method in ASP.NET MVC.</p>
<p>The reason I ask here is perhaps if this functionality is "by design" somebody could clarify as to why it is the way it is, and perhaps a way to call it differently ... | 1,242,841 | 4 | 2 | null | 2009-08-07 03:35:22.443 UTC | 10 | 2009-08-08 07:22:12.507 UTC | 2017-05-23 11:48:36.187 UTC | null | -1 | null | 41,211 | null | 1 | 17 | asp.net-mvc|updatemodel|formcollection | 4,347 | <p>The behavior you're experiencing with UpdateModel() sounds like you're list binding, in which case UpdateModel() will blow away the contents of the list and repopulate it. See <a href="http://www.hanselman.com/blog/ASPNETWireFormatForModelBindingToArraysListsCollectionsDictionaries.aspx" rel="noreferrer">Hanselman'... |
796,748 | How can I add a custom url handler on Windows. Like iTunes itms:// | <p>I would like telnet://blah to open putty and not the native windows telnet client.</p>
<p>I don't even know what this 'feature' is called under windows so I'm having no luck find any information about it.</p>
<p>Thanks in advance,
Jan</p> | 796,780 | 4 | 2 | null | 2009-04-28 08:04:26.743 UTC | 15 | 2014-12-27 20:47:54.92 UTC | 2009-04-28 13:17:30.643 UTC | null | 44,330 | null | 460,845 | null | 1 | 19 | windows|url|shell|protocol-handler | 22,326 | <p>If it's simple, you can do it via the command line:</p>
<pre><code>ftype telnet # view current binding
ftype telnet=\path\to\putty.exe %1
</code></pre>
<p>Otherwise you'll need to use the registry as previously posted.</p> |
449,627 | Are line breaks in XML attribute values allowed? | <p>I realise that it's not elegant or desired, but is it allowed (in well-formed XML) for an attribute value in an XML element to span multiple lines?</p>
<p>e.g.</p>
<pre><code><some-xml-element value="this value goes over....
multiple lines!" />
</code></pre>
<p>Yeah I realise there's better ways of writing ... | 449,647 | 4 | 4 | null | 2009-01-16 05:57:13.497 UTC | 11 | 2015-09-12 04:57:23.987 UTC | 2015-09-12 04:56:05.113 UTC | null | 423,105 | Ben Daniel | 26,335 | null | 1 | 103 | xml|xml-parsing | 64,683 | <p><a href="http://www.w3.org/TR/REC-xml/#NT-AttValue" rel="noreferrer">http://www.w3.org/TR/REC-xml/#NT-AttValue</a></p>
<p>Seems to say everything except <code><</code>, <code>&</code>, and your delimiter (<code>'</code> or <code>"</code>) are OK. So newline should be, too.</p> |
23,474,666 | Create DropDownList for an ASP.NET MVC5 Relation | <p>I'm stuck creating a proper create/edit view in ASP.NET MVC5. I've got two models <code>Dog</code> and <code>Human</code>. A dog belongs to one <code>Human</code>. I'm trying to create a dropdown in the <code>create</code> and <code>edit</code> views for <code>Dog</code> that'll allow me to select a <code>Human</cod... | 23,474,889 | 2 | 2 | null | 2014-05-05 14:12:57.433 UTC | 3 | 2015-07-22 06:17:19.257 UTC | 2014-05-05 14:28:03.23 UTC | null | 555,297 | null | 555,297 | null | 1 | 9 | c#|asp.net|asp.net-mvc | 62,215 | <p>Important to note is that if you use <code>DropDownListFor(x => x.Human)</code>, the returned value of the dropdownlist should be a <code>Human</code> object.</p>
<p>It isn't. In your own code snippet, you set the value of the <code>SelectListItem</code> to <strong>the ID of the Human</strong>. Therefore, when y... |
25,657,541 | Merge two Excel tables Based on matching data in Columns | <p>I've been working on a excel problem, that I need to find an answer for I'll explain it below.</p>
<p>I've Table01 with the Columns :</p>
<ul>
<li>Group No</li>
<li>Name</li>
<li>Price</li>
</ul>
<p>I've Table02 with the columns:</p>
<ul>
<li>Group No</li>
<li>City</li>
<li>Code</li>
</ul>
<p>I've merged two ta... | 25,657,614 | 2 | 1 | null | 2014-09-04 04:53:57.84 UTC | 10 | 2016-11-06 23:20:10.443 UTC | 2016-11-06 23:20:10.443 UTC | null | 4,370,109 | null | 1,664,967 | null | 1 | 21 | excel|merge | 115,267 | <p>Put the table in the second image on Sheet2, columns D to F.</p>
<p>In Sheet1, cell D2 use the formula</p>
<pre><code>=iferror(vlookup($A2,Sheet2!$D$1:$F$100,column(A1),false),"")
</code></pre>
<p>copy across and down.</p>
<p><strong>Edit</strong>: here is a picture. The data is in two sheets. On Sheet1, enter t... |
30,348,833 | Check if file exist in Gulp | <p>I need to check if a file exists in a gulp task, i know i can use some node functions from node, there are two:</p>
<p><code>fs.exists()</code> and <code>fs.existsSync()</code></p>
<p>The problem is that in the node documentation, is saying that these functions will be deprecated</p> | 30,348,965 | 5 | 1 | null | 2015-05-20 11:49:47.5 UTC | 3 | 2019-07-08 14:07:56.81 UTC | null | null | null | null | 2,953,308 | null | 1 | 32 | javascript|node.js|gulp | 22,761 | <p>You can use <a href="https://nodejs.org/api/fs.html#fs_fs_access_path_mode_callback" rel="noreferrer"><code>fs.access</code></a></p>
<pre><code>fs.access('/etc/passwd', (err) => {
if (err) {
// file/path is not visible to the calling process
console.log(err.message);
console.log(err.c... |
39,825,034 | iOS 10 App has crashed because it attempted to access privacy-sensitive data | <p>I'm running my project which was working fine previously but after updating my xcode my app crashes and giving this error:</p>
<blockquote>
<p>This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSCameraUsageDescription key ... | 39,825,049 | 5 | 1 | null | 2016-10-03 05:23:46.387 UTC | 6 | 2021-02-28 04:02:32.113 UTC | 2016-10-03 07:06:40.503 UTC | null | 2,227,743 | null | 3,275,134 | null | 1 | 33 | ios|cocoa-touch|ios10 | 31,846 | <p><strong>Privacy Settings in iOS 10</strong></p>
<blockquote>
<p>A significant change in iOS 10 is that you must declare ahead of time any access to private data or your App will crash.</p>
<p>Once you link with iOS 10 you must declare access to any user private data types. You do this by adding a usage key to your a... |
39,511,528 | Exposing .NET events to COM? | <p>I've been trying to expose and fire an event to a VBA client. So far on the VBA client side, the event is exposed and I see the method event handling method added to my module class however the VBA event handling method does not fire. For some reason, when debugging the event is null. Modifying my code with synchron... | 39,703,172 | 1 | 1 | null | 2016-09-15 12:52:17.417 UTC | 10 | 2021-10-19 07:19:36.95 UTC | 2016-09-26 08:05:53.473 UTC | null | 863,240 | null | 3,704,475 | null | 1 | 32 | c#|vba|events|com | 7,379 | <p>The key concept in .NET code is to define event(s) as method(s) on a separate interface and connect it to the class via <code>[ComSourceInterfacesAttribute]</code>. In the example this is done with this code <code>[ComSourceInterfaces(typeof(IEvents))]</code> where <code>IEvents</code> interface defines the event(s)... |
39,336,171 | Executing SQL query on multiple databases | <p>I know my post has a very similar title to other ones in this forum, but I really couldn't find the answer I need.</p>
<p>Here is my problem, I have a SQL Server running on my Windows Server. Inside my SQL Server, I have around 30 databases. All of them have the same tables, and the same stored procedures. </p>
<p... | 46,048,577 | 7 | 3 | null | 2016-09-05 18:47:10.787 UTC | 3 | 2021-03-26 11:54:28.69 UTC | 2016-09-05 19:09:55.033 UTC | null | 13,302 | null | 6,640,681 | null | 1 | 12 | sql|sql-server|database | 54,198 | <p><a href="https://www.apexsql.com/sql_tools_propagate.aspx" rel="noreferrer">ApexSQL Propagate</a> is the tool which can help in this situation. It is used for executing single or multiple scripts on multiple databases, even multiple servers. What you should do is simply select that script, then select all databases ... |
26,883,615 | Using `throw;` on a modified exception | <p>I have a function <code>foo</code> that can throw a <code>bar</code> exception.</p>
<p>In another function I call <code>foo</code> but I have the ability to add some more detail to the <code>bar</code> exception if thrown. (I'd rather not pass such information as a parameter to <code>foo</code> as it doesn't really... | 26,883,786 | 5 | 0 | null | 2014-11-12 09:38:01.693 UTC | 2 | 2016-03-18 10:36:28.677 UTC | 2016-03-18 10:36:28.677 UTC | null | 3,647,361 | null | 3,415,258 | null | 1 | 57 | c++|exception|exception-handling|language-lawyer|throw | 3,061 | <p>C++11 §15.1/8:</p>
<blockquote>
<p><strong>”</strong> A <em>throw-expression</em> with no operand rethrows the currently handled exception (15.3). The exception is
reactivated with the existing temporary; no new temporary exception object is created.</p>
</blockquote> |
26,819,675 | Navbar highlight for current page | <p>I was wondering how I would add the ability to add a highlight box the nav bar on the page your currently on. You know so people know what page their on.</p>
<p>Very much like this site with the white box on the active page:<a href="https://woodycraft.net/home/" rel="noreferrer">https://woodycraft.net/home/</a></p>... | 26,819,796 | 4 | 1 | null | 2014-11-08 16:58:38.45 UTC | 6 | 2021-12-07 21:29:26.473 UTC | 2014-11-08 18:41:00.423 UTC | user4171782 | null | user4171782 | null | null | 1 | 12 | html|css | 54,847 | <p>If you have the same navigation bar in each HTML page of your website, then you can do like this:<br>
For example in <strong>index.html</strong> add <strong>class='active-page'</strong> to the first menu item:</p>
<pre><code><div id="nav_bar">
<ul>
<li><a href="index.html" class='ac... |
7,420,109 | What does style.display = '' actually do? | <p>After researching this issue for a couple of hours, I found that one of the most efficient ways to toggle a page element's display (in HTML) is to do something like:</p>
<pre><code>// showing
document.getElementById('element').style.display = '';
// hiding
document.getElementById('element').style.display = 'none';... | 7,420,125 | 4 | 1 | null | 2011-09-14 16:58:21.757 UTC | 26 | 2012-01-04 18:29:03.497 UTC | null | null | null | null | 914,482 | null | 1 | 51 | javascript|css|syntax | 55,453 | <p>Yes, it resets the element's display property to the default by blanking out the inline "display: none", causing the element to fall back on its display property as defined by the page's ranking CSS rules.</p>
<p>For example, here's a <code><div></code> with the ID of "myElement".</p>
<pre><code><div id="... |
67,018,079 | Error in "from keras.utils import to_categorical" | <p>I have probem with this code , why ?</p>
<p>the code :</p>
<pre><code>import cv2
import numpy as np
from PIL import Image
import os
import numpy as np
import cv2
import os
import h5py
import dlib
from imutils import face_utils
from keras.models import load_model
import sys
from keras.models import Sequential
from ke... | 67,018,610 | 4 | 3 | null | 2021-04-09 08:58:22.287 UTC | 4 | 2022-03-03 11:32:17.047 UTC | 2021-04-09 09:01:26.76 UTC | null | 9,215,780 | null | 15,558,831 | null | 1 | 30 | python|keras | 77,845 | <p><strong>Keras</strong> is now fully intregrated into <strong>Tensorflow</strong>. So, importing only <strong>Keras</strong> causes error.</p>
<p>It should be imported as:</p>
<pre><code>from tensorflow.keras.utils import to_categorical
</code></pre>
<br>
<p><strong>Avoid</strong> importing as:</p>
<pre><code>from ke... |
1,474,702 | Link to a file share through an anchor tag | <p>How do I format an HTML anchor tag to link to a shared network folder?</p>
<p>I tried the following and it does not like it.</p>
<pre><code><a href="file:\\myserver\myfolder\myfile.docx">My Shared Folder</a>
</code></pre> | 1,474,735 | 4 | 0 | null | 2009-09-24 23:33:12.513 UTC | 1 | 2014-04-23 17:45:16.34 UTC | 2009-09-24 23:42:51.993 UTC | null | 9,021 | null | 26,327 | null | 1 | 13 | html | 46,667 | <p>Try this URL:</p>
<pre><code><a href="file://///myserver/myfolder/myfile.docx">
</code></pre> |
1,685,389 | Possible to use more than one argument on __getitem__? | <p>I am trying to use</p>
<pre><code>__getitem__(self, x, y):
</code></pre>
<p>on my Matrix class, but it seems to me it doesn't work (I still don't know very well to use python).
I'm calling it like this:</p>
<pre><code>print matrix[0,0]
</code></pre>
<p>Is it possible at all to use more than one argument? Thanks.... | 1,685,412 | 4 | 0 | null | 2009-11-06 04:21:49.33 UTC | 3 | 2021-10-31 00:11:53.303 UTC | null | null | null | null | 130,758 | null | 1 | 53 | python | 19,365 | <p><code>__getitem__</code> only accepts one argument (other than <code>self</code>), so you get passed a tuple.</p>
<p>You can do this:</p>
<pre><code>class matrix:
def __getitem__(self, pos):
x,y = pos
return "fetching %s, %s" % (x, y)
m = matrix()
print m[1,2]
</code></pre>
<p>outputs</p>
<p... |
2,057,210 | Ruby on rails - Reference the same model twice? | <p>Is it possible to set up a double relationship in <code>activerecord</code> models via the <code>generate scaffold</code> command?</p>
<p>For example, if I had a <code>User</code> model and a <code>PrivateMessage</code> model, the private_messages table would need to keep track of both the <code>sender</code> and <... | 2,057,243 | 4 | 0 | null | 2010-01-13 14:16:15.633 UTC | 35 | 2020-09-04 07:03:43.13 UTC | 2019-10-14 20:47:19.253 UTC | null | 4,880,924 | null | 207,316 | null | 1 | 60 | ruby-on-rails|rails-activerecord|relationship | 28,484 | <p>Add this to your Model</p>
<pre><code>belongs_to :sender, :class_name => "User"
belongs_to :recipient, :class_name => "User"
</code></pre>
<p>And you are able to call <code>@message.sender</code> and <code>@message.recipient</code> and both reference to the User model.</p>
<p>Instead of <co... |
10,331,817 | SQL Server ISDATE() Function - Can someone explain this? | <p>So I was looking at the documentation for the ISDATE() function in SQL Server and saw this in the examples:</p>
<pre><code>SET DATEFORMAT mdy;
SELECT ISDATE('15/04/2008'); --Returns 0.
SET DATEFORMAT mdy;
SELECT ISDATE('15/2008/04'); --Returns 0.
SET DATEFORMAT mdy;
SELECT ISDATE('2008/15/04'); --Returns 0.
SET DAT... | 10,331,903 | 2 | 2 | null | 2012-04-26 10:44:03.633 UTC | 1 | 2012-04-26 11:21:45.26 UTC | null | null | null | null | 424,084 | null | 1 | 5 | sql-server|function|date-formatting | 45,777 | <p>from <a href="http://msdn.microsoft.com/en-us/library/ms187347%28SQL.105%29.aspx#SessionSettingDependencies" rel="noreferrer">http://msdn.microsoft.com/en-us/library/ms187347%28SQL.105%29.aspx#SessionSettingDependencies</a> </p>
<blockquote>
<p>The return value of ISDATE depends on the settings set by SET
DATEF... |
28,557,719 | How do you full text search an Amazon S3 bucket? | <p>I have a bucket on S3 in which I have large amount of text files.</p>
<p>I want to search for some text within a text file. It contains raw data only.
And each text file has a different name.</p>
<p>For example, I have a bucket name:</p>
<p><strong>abc/myfolder/abac.txt</strong></p>
<p><strong>xyx/myfolder1/axc.txt<... | 28,561,175 | 7 | 4 | null | 2015-02-17 08:35:16.903 UTC | 11 | 2022-07-26 05:52:49.663 UTC | 2022-01-04 06:47:34.103 UTC | null | 74,089 | null | 857,500 | null | 1 | 32 | amazon-web-services|amazon-s3 | 17,505 | <p>The only way to do this will be via <a href="http://aws.amazon.com/cloudsearch/faqs/">CloudSearch</a>, which can use S3 as a source. It works using rapid retrieval to build an index. This should work very well but thoroughly check out the pricing model to make sure that this won't be too costly for you. </p>
<p>The... |
36,554,322 | Cannot start Emulator in android studio 2.0 | <p>I just upgraded my android studio from 1.5 to 2.0.And now I am facing some weird bug when I try to start Emulator. I use Ubuntu 15.10 OS</p>
<p>Android monitor returns this message</p>
<pre><code>sh: 1: glxinfo: not found
sh: 1: glxinfo: not found
libGL error: unable to load driver: r600_dri.so
libGL error: driver... | 36,568,949 | 14 | 7 | null | 2016-04-11 16:31:16.213 UTC | 35 | 2019-03-30 13:38:34.147 UTC | 2016-04-11 16:44:53.117 UTC | null | 1,235,698 | null | 3,985,848 | null | 1 | 67 | android | 48,225 | <p>Verify that you have installed in your system lib64stdc++6 </p>
<p>With a 32 bits operating system :</p>
<pre><code># apt-get install lib64stdc++6
</code></pre>
<p>With a 64 bits operating system with multiarch enabled :</p>
<pre><code># apt-get install lib64stdc++6:i386
</code></pre>
<p>Then link the new insta... |
7,608,714 | Why is my pointer not null after free? | <pre><code>void getFree(void *ptr)
{
if(ptr != NULL)
{
free(ptr);
ptr = NULL;
}
return;
}
int main()
{
char *a;
a=malloc(10);
getFree(a);
if(a==NULL)
printf("it is null");
else
printf("not null");
}
</code></pre>
<p><strong>Why is the output of this program not NULL?</strong></p... | 7,608,781 | 6 | 1 | null | 2011-09-30 09:54:41.78 UTC | 10 | 2019-10-19 02:43:08.697 UTC | 2011-09-30 09:59:41.793 UTC | null | 908,515 | null | 775,964 | null | 1 | 15 | c|free | 20,033 | <p>Because the pointer is copied <em>by value</em> to your function. You are assigning <code>NULL</code> to the local copy of the variable (<code>ptr</code>). This does not assign it to the original copy.</p>
<p>The memory will still be freed, so you can no longer safely access it, but your original pointer will not... |
7,113,865 | How to copy/clone a hash/object in JQuery? | <p>I have a simple object (or hash) in Javascript:</p>
<pre><code>var settings = {
link: 'http://example.com',
photo: 'http://photos.com/me.jpg'
};
</code></pre>
<p>I need a copy of it. Is there a <code>settings.clone()</code> type method that will give me another object with the same attributes? I'm using jQue... | 7,113,883 | 6 | 2 | null | 2011-08-18 20:40:01.573 UTC | 5 | 2016-12-16 11:24:28.27 UTC | 2016-12-16 11:24:28.27 UTC | null | 1,320,510 | null | 326,389 | null | 1 | 39 | javascript|jquery|copy|clone|javascript-objects | 33,611 | <p>Yes, <a href="http://api.jquery.com/jQuery.extend/">extend</a> an empty object with the original one; that way, everything will simply be copied:</p>
<pre><code>var clone = $.extend({}, settings);
</code></pre>
<hr>
<p>Extending some filled object with another, e.g.:</p>
<pre><code>$.extend({a:1}, {b:2})
</code>... |
7,014,953 | I need to securely store a username and password in Python, what are my options? | <p>I'm writing a small Python script which will periodically pull information from a 3rd party service using a username and password combo. I don't need to create something that is 100% bulletproof (does 100% even exist?), but I would like to involve a good measure of security so at the very least it would take a long ... | 7,015,578 | 8 | 1 | null | 2011-08-10 17:13:04.213 UTC | 69 | 2020-11-06 22:04:16.253 UTC | 2011-08-10 17:22:41.357 UTC | null | 128,967 | null | 128,967 | null | 1 | 124 | python|security|encryption | 128,526 | <p>I recommend a strategy similar to <a href="http://en.wikipedia.org/wiki/Ssh-agent">ssh-agent</a>. If you can't use ssh-agent directly you could implement something like it, so that your password is only kept in RAM. The cron job could have configured credentials to get the actual password from the agent each time ... |
7,178,170 | All IntelliJ run configurations disappeared | <p>After IntelliJ IDEA froze and was killed from the task manager, all the Run/Debug Configurations disappeared. I have tried invalidating caches, reloading files from disk, synchronizing and restarting, but nothing helped.</p> | 7,178,813 | 12 | 9 | null | 2011-08-24 15:33:01.533 UTC | 4 | 2022-08-12 08:19:26.913 UTC | 2022-02-08 22:04:00.24 UTC | null | 266,531 | null | 630,372 | null | 1 | 64 | intellij-idea | 34,263 | <p>You can try to restore your Run configuration using the <strong>Local History</strong> feature of IntelliJ IDEA.</p>
<p>If you are using <code>.idea</code> directory based format, then your configurations will reside in <code>workspace.xml</code> file under <code>.idea</code> directory, invoke <strong>Local History... |
13,832,866 | unix- show the second line of the file | <p>this command displays the second line of the file :</p>
<pre><code>cat myfile | head -2 | tail -1
</code></pre>
<p>My file contains the following data : </p>
<pre><code>hello
mark
this is the head line
this is the first line
this is the second line
this is the last line
</code></pre>
<p>the command above print... | 13,832,897 | 3 | 2 | null | 2012-12-12 04:37:35.62 UTC | 5 | 2012-12-12 04:49:08.98 UTC | 2012-12-12 04:39:11.097 UTC | null | 390,913 | null | 975,234 | null | 1 | 31 | unix | 90,741 | <p>tail displays the last line of the head output and the last line of the head output is the second line of the file.</p>
<p>Output of head (input to tail):</p>
<pre><code>hello
mark
</code></pre>
<p>Output of tail:</p>
<pre><code>mark
</code></pre> |
14,336,450 | JavaScript frameworks to build single page applications | <p>My goal is to migrate an existing web application to a RESTful <a href="http://en.wikipedia.org/wiki/Single-page_application" rel="nofollow noreferrer">single page application</a> (SPA).
Currently, I'm evaluating several Javascript web application frameworks. </p>
<hr>
<p>My requirements are as follow:</p>
<ul>
<... | 14,338,436 | 2 | 1 | null | 2013-01-15 11:10:05.29 UTC | 69 | 2018-02-04 15:08:40.937 UTC | 2018-02-04 15:08:40.937 UTC | null | 3,924,118 | null | 842,302 | null | 1 | 101 | javascript|singlepage | 75,935 | <p>I recently had to decide on a JavaScript SPA framework on a project too.</p>
<ul>
<li><p><a href="http://emberjs.com/">Ember</a> </p>
<p>Looked at Ember early on and had similar thoughts as you about it - I really liked it but it felt like it was still too early to use... about half the tutorials I read didn't wo... |
29,217,209 | Is it ok to use HTTP REST API for Chat application? | <p>We are building a chat application on Android. We are thinking of using HTTP REST API to send outbound messages. Wanted to know if it's a good approach or has any downsides compared to using WebSockets or XMPP (which seems to be more of a defacto standard for transferring chat messages)?</p>
<p>Some of the pros/cons... | 29,340,059 | 5 | 3 | null | 2015-03-23 18:00:46.863 UTC | 12 | 2021-05-14 09:37:51.63 UTC | 2021-05-14 09:37:51.63 UTC | null | 11,573,842 | null | 507,256 | null | 1 | 32 | android|xmpp|chat | 24,907 | <p>We can use REST API for chat messaging, but IMHO, XMPP is a better alternative. Let's consider what XMPP has to offer.</p>
<p>XMPP beside supporting TCP transport also provides HTTP (via <strong>polling</strong> and <strong>binding</strong>) and <strong>websocket</strong> transports. Read <a href="http://en.wikiped... |
9,345,841 | PHP: is there a way to see "invisible" characters like \n | <p>Is there a way to see invisible characters like whitespace, newlines, and other non-printing characters in a manner like print_r() ?</p>
<p>Reason is there is some sort of character in my array that I can't see and breaking things.</p>
<pre><code>Object Object
(
[name] => name
[numbers] => Array
(
... | 9,345,911 | 5 | 1 | null | 2012-02-19 01:33:56 UTC | 8 | 2016-10-13 18:46:31.713 UTC | null | null | null | null | 255,439 | null | 1 | 29 | php | 32,914 | <p>You can use the <a href="http://www.php.net/manual/en/function.addcslashes.php" rel="nofollow">addcslashes</a> function:</p>
<blockquote>
<p>string addcslashes ( string $str, string $charlist )</p>
</blockquote>
<p>which will return a string with backslashes before characters. An example would be:</p>
<blockquo... |
9,293,721 | AddressFilter mismatch at the EndpointDispatcher - the msg with To | <p>Any ideas how I correct this.. calling a service via js</p>
<blockquote>
<p>The message with To 'http://MySite.svc/GetStateXML' cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver's EndpointAddresses agree</p>
</blockquote>
<p>thank... | 37,167,950 | 12 | 1 | null | 2012-02-15 12:50:26.363 UTC | 8 | 2020-11-09 11:48:54.817 UTC | 2012-09-25 14:03:59.507 UTC | null | 223,386 | null | 1,211,292 | null | 1 | 51 | wcf | 101,551 | <p>Look at <code><webHttp /></code></p>
<pre><code><services>
<service name="SimpleService.SimpleService" behaviorConfiguration="serviceBehaviour">
<endpoint address="" binding="webHttpBinding" contract="SimpleService.ISimpleService" behaviorConfiguration="web">
</endpo... |
9,089,842 | C++ chrono system time in milliseconds, time operations | <p>I've got a small problem caused by insufficient documentation of C++11.</p>
<p>I'd like to obtain a time since epoch in milliseconds, or nanoseconds or seconds and then I will have to "cast" this value to another resolution.
I can do it using gettimeofday() but it will be to easy, so I tried to achieve it using std... | 9,089,870 | 1 | 1 | null | 2012-02-01 02:14:39.883 UTC | 27 | 2017-06-23 10:01:41.1 UTC | 2017-01-02 18:03:17.93 UTC | null | 1,033,581 | null | 784,345 | null | 1 | 87 | c++|time|c++11|chrono | 128,606 | <p>You can do <code>now.time_since_epoch()</code> to get a duration representing the time since the epoch, with <a href="https://stackoverflow.com/q/8386128">the clock's resolution</a>. To convert to milliseconds use <a href="http://en.cppreference.com/w/cpp/chrono/duration/duration_cast" rel="noreferrer"><code>duratio... |
44,409,105 | Invalid datetime format: 1292 Incorrect datetime value - Laravel 5.2 | <p>I'm getting this error when I insert these value into my database table:</p>
<blockquote>
<pre>
SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value:
'24/06/2017' for column 'registration_from' at row 1
(SQL: insert into `campus_registrations` (`campus_major_class_id`,
`registration_from`, `reg... | 44,409,398 | 10 | 3 | null | 2017-06-07 09:46:58.17 UTC | 3 | 2022-08-17 08:41:13.537 UTC | 2017-06-07 13:17:47.233 UTC | null | 5,808,894 | null | 3,822,744 | null | 1 | 10 | php|mysql|laravel | 82,040 | <p>The error is here:</p>
<pre><code>Incorrect datetime value: '24/06/2017' for column 'registration_from' at row 1
</code></pre>
<p>the default format for <code>date</code> column in mysql is <code>Y-m-d</code> and for <code>datetime</code> is <code>Y-m-d H:i:s</code>. So change your date to this format and try agai... |
32,667,398 | Best tool for text extraction from PDF in Python 3.4 | <p>I am using Python 3.4 and need to extract all the text from a PDF and then use it for text processing.</p>
<p>All the answers I have seen suggest options for Python 2.7.</p>
<p>I need something in Python 3.4.</p>
<p>Bonson</p> | 32,669,303 | 5 | 4 | null | 2015-09-19 11:00:49.343 UTC | 17 | 2020-06-24 09:10:46.593 UTC | null | null | null | null | 1,181,744 | null | 1 | 45 | python-3.x|pdf | 63,359 | <p>You need to install PyPDF2 module to be able to work with PDFs in Python 3.4. PyPDF2 cannot extract images, charts or other media but it can extract text and return it as a Python string. To install it run <code>pip install PyPDF2</code> from the command line. This module name is case-sensitive so make sure to type ... |
35,060,111 | Random Number Order in C++ using <random> | <p>I have the following code, that I wrote to test a part of a larger program :</p>
<pre><code>#include <fstream>
#include <random>
#include <iostream>
using namespace std ;
int main()
{
mt19937_64 Generator(12187) ;
mt19937_64 Generator2(12187) ;
uniform_int_distribution<int> D1(1,6) ;
... | 35,060,325 | 4 | 5 | null | 2016-01-28 11:21:21.94 UTC | 1 | 2016-01-28 21:57:35.62 UTC | 2016-01-28 11:32:24.393 UTC | null | 2,684,539 | null | 5,204,967 | null | 1 | 39 | c++|c++11|random|operator-precedence | 2,648 | <p><code>x << y</code> is syntactic sugar for a function call to <code>operator<<(x, y)</code>.</p>
<p>You will remember that the c++ standard places no restriction on the order of evaluation of the arguments of a function call.</p>
<p>So the compiler is free to emit code that computes x first or y first.... |
655,163 | Convert a Static Library to a Shared Library? | <p>I have a third-party library which consists mainly of a large number of static (<code>.a</code>) library files. I can compile this into a single <code>.a</code> library file, but I really need it to be a single <code>.so</code> shared library file.</p>
<p>Is there any way to convert a static <code>.a</code> file i... | 655,175 | 5 | 0 | null | 2009-03-17 17:06:15.2 UTC | 33 | 2019-02-18 15:19:19.827 UTC | 2012-04-06 05:30:24.717 UTC | user166390 | null | Eli Courtwright | 1,694 | null | 1 | 66 | c|linux|shared-libraries|static-libraries | 64,736 | <p>Does this (with appropriate -L's of course)</p>
<pre><code>gcc -shared -o megalib.so foo.o bar.o -la_static_lib -lb_static_lib
</code></pre>
<p>Not do it?</p> |
909,673 | How do I use gems with Ubuntu? | <p>I recently upgraded to Ubuntu 9.04 and I have issues using gems.
I installed Ruby, Rubygems and Rails using apt-get.
The <code>rails</code> command does work.</p>
<p>I then installed capistrano and other gems, such as heroku.
In order to do that, I used the command:</p>
<pre><code>sudo gem install XXX
</code></pr... | 909,980 | 5 | 2 | null | 2009-05-26 08:55:22.733 UTC | 52 | 2013-04-02 11:36:20.517 UTC | 2012-02-04 00:52:47.733 UTC | null | 128,421 | null | 109,525 | null | 1 | 77 | ruby-on-rails|ruby|ubuntu|rubygems|capistrano | 62,817 | <h2>Where are my Gems?</h2>
<p>You can find where your gems are stored using the <code>gem environment</code> command. For example:</p>
<pre><code>chris@chris-laptop:~$ gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.2
- RUBY VERSION: 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
- INSTALLATION D... |
445,067 | If vs. Switch Speed | <p>Switch statements are typically faster than equivalent if-else-if statements (as e.g. descibed in this <a href="http://www.blackwasp.co.uk/SpeedTestIfElseSwitch.aspx" rel="noreferrer">article</a>) due to compiler optimizations.</p>
<p>How does this optimization actually work? Does anyone have a good explanation?</p... | 445,076 | 5 | 2 | null | 2009-01-14 23:13:28.29 UTC | 26 | 2019-03-03 07:30:06.59 UTC | null | null | null | divo | 40,347 | null | 1 | 114 | c#|performance|switch-statement|if-statement | 72,518 | <p>The compiler can build jump tables where applicable. For example, when you use the reflector to look at the code produced, you will see that for huge switches on strings, the compiler will actually generate code that uses a hash table to dispatch these. The hash table uses the strings as keys and delegates to the <c... |
514,771 | Equivalent of ctrl c in command to cancel a program | <p>I am running a long linux program in a remote machine, and I want to stop it, but my problem is that if I use the kill command then the program will exit without saving results. Normally what I do to finish the program is use <kbd>Ctrl</kbd>+<kbd>C</kbd> and in that case the program saves the results, but right now ... | 514,801 | 6 | 0 | null | 2009-02-05 06:14:16.36 UTC | 12 | 2020-01-31 19:24:25.637 UTC | 2020-01-31 19:24:25.637 UTC | Eduardo | 7,487,335 | Eduardo | 39,160 | null | 1 | 79 | linux|command-line|copy-paste | 90,817 | <p>Try:</p>
<pre><code>kill -SIGINT processPIDHere
</code></pre>
<p>Basically <kbd>Ctrl C</kbd> sends the <code>SIGINT</code> (interrupt) signal while kill sends the <code>SIGTERM</code> (termination) signal by default unless you specify the signal to send.</p> |
894,779 | ASP.NET MVC Routing Via Method Attributes | <p>In the <a href="https://blog.stackoverflow.com/2009/05/podcast-54/">StackOverflow Podcast #54</a>, Jeff mentions they register their URL routes in the StackOverflow codebase via an attribute above the method that handles the route. Sounds like a good concept (with the caveat that Phil Haack brought up regarding rout... | 895,176 | 6 | 0 | null | 2009-05-21 19:50:01.02 UTC | 85 | 2012-04-16 06:12:35.153 UTC | 2021-01-18 12:38:11.483 UTC | null | -1 | null | 44,318 | null | 1 | 80 | asp.net-mvc|routing|url-routing|decorator | 25,859 | <p><strong><em>UPDATE</em></strong>: This has been posted on <a href="http://itcloud.codeplex.com" rel="noreferrer">codeplex</a>. The complete source code as well as the pre-compiled assembly are there for download. I haven't had time to post the documentation on the site yet, so this SO post will have to suffice for... |
31,063,474 | Nodejs library without nodejs | <p>How can I integrate a nodejs library into my non nodejs project?
I am particularly needing this library:
<a href="https://github.com/greenify/biojs-io-blast">https://github.com/greenify/biojs-io-blast</a></p> | 31,075,281 | 5 | 3 | null | 2015-06-26 01:29:34.21 UTC | null | 2016-11-25 20:46:44.667 UTC | 2015-06-26 15:16:05.31 UTC | null | 1,259,510 | null | 2,058,333 | null | 1 | 29 | javascript|node.js | 3,891 | <p><a href="http://biojs.io/">BioJS</a> uses <a href="https://wzrd.in/">Browserify CDN</a> to automatically generate a single JS file for usage. Either include </p>
<p><code><script src="http://wzrd.in/bundle/biojs-io-blast@latest"></script></code> </p>
<p>in your html or download the JS file via this lin... |
35,471,261 | Using CefSharp.Offscreen to retrieve a web page that requires Javascript to render | <p>I have what is hopefully a simple task, but it's going to take someone that's versed in CefSharp to solve it.</p>
<p>I have an url that I want to retrieve the HTML from. The problem is this particular url doesn't actually distribute the page on a GET. Instead, it pushes a mound of Javascript to the browser, which... | 35,472,369 | 2 | 3 | null | 2016-02-18 01:45:39.767 UTC | 8 | 2019-08-30 12:47:38.977 UTC | 2016-02-18 01:56:19.61 UTC | null | 102,937 | null | 102,937 | null | 1 | 7 | javascript|c#|cefsharp|headless-browser|cefsharp.offscreen | 20,313 | <p>If you can't get a headless version of Chromium to help you, you could try node.js and <a href="https://github.com/tmpvar/jsdom" rel="nofollow noreferrer">jsdom</a>. Easy to install and play with once you have node up and running. You can see simple examples on Github README where they pull down a URL, run all javas... |
20,936,486 | Node.js - Maximum call stack size exceeded | <p>When I run my code, Node.js throws a <code>"RangeError: Maximum call stack size exceeded"</code> exception caused by too many recursive calls. I tried to increase Node.js stack size by <code>sudo node --stack-size=16000 app</code>, but Node.js crashes without any error message. When I run this again without sudo, th... | 20,999,077 | 11 | 5 | null | 2014-01-05 17:08:47.61 UTC | 43 | 2022-08-25 10:57:48.823 UTC | 2019-09-29 16:34:17.417 UTC | null | 1,709,587 | null | 1,518,183 | null | 1 | 99 | node.js|recursion|stack-overflow|callstack | 195,248 | <p>You should wrap your recursive function call into a </p>
<ul>
<li><code>setTimeout</code>,</li>
<li><code>setImmediate</code> or </li>
<li><code>process.nextTick</code> </li>
</ul>
<p>function to give node.js the chance to clear the stack. If you don't do that and there are many loops without any <strong>real</str... |
44,274,982 | Spring Boot Application - what is default timeout for any rest API endpoint or a easy config to control all endpoint timeout | <p>I am using current Spring boot version (1.4.x) and wondering if it has any default timeout for api calls. I have tested it by putting breakpoints but it was keep waiting and didn't time-out.
I was also trying to configure default timeout for all my spring-boot apps by using some annotation or yml settings. </p>
<p... | 44,916,759 | 5 | 2 | null | 2017-05-31 03:08:28.337 UTC | 8 | 2021-03-18 07:36:45.19 UTC | null | null | null | null | 3,705,491 | null | 1 | 14 | java|spring|rest|spring-boot|microservices | 88,648 | <p>I agree all above options and tried below option in my spring boot application. It works perfectly fine now. Below is the code sample as a bean. Now just need to <code>@Autowire</code> <code>RestTemplate</code> wherever(<code>java class</code>) I need it. </p>
<pre><code> @Bean
public RestTemplate restTempla... |
2,263,186 | In which sequence are queries and sub-queries executed by the SQL engine? | <p>Hello I made a SQL test and dubious/curious about one question:</p>
<p><strong>In which sequence are queries and sub-queries executed by the SQL engine?</strong></p>
<p>the answers was</p>
<ol>
<li>primary query -> sub query -> sub sub query and so on</li>
<li>sub sub query -> sub query -> prime query</li>
<li>th... | 2,264,085 | 5 | 0 | null | 2010-02-14 22:52:57.677 UTC | 9 | 2010-02-15 09:37:45.97 UTC | null | null | null | null | 273,141 | null | 1 | 38 | sql|subquery | 47,100 | <p>Option 4 is close.</p>
<p>SQL is <a href="http://en.wikipedia.org/wiki/Declarative_programming" rel="noreferrer">declarative</a>: you tell the query optimiser what you want and it works out the best (subject to time/"cost" etc) way of doing it. This may vary for outwardly identical queries and tables depending on s... |
1,425,912 | Google Protocol Buffers and HTTP | <p>I'm refactoring legacy C++ system to SOA using gSoap. We have some performance issues (very big XMLs) so my lead asked me to take a look at protocol buffers. I did, and it looks very cool (We need C++ and Java support). However protocol buffers are solution just for serialization and now I need to send it to Java fr... | 1,425,984 | 5 | 4 | null | 2009-09-15 08:38:01.613 UTC | 26 | 2017-09-13 13:26:36.48 UTC | 2016-03-06 15:20:16.163 UTC | null | 3,579 | null | 3,579 | null | 1 | 45 | java|c++|http|protocol-buffers | 68,272 | <p>You can certainly send even a binary payload with an HTTP request, or in an HTTP response. Just write the bytes of the protocol buffer directly into the request/response, and make sure to set the content type to "application/octet-stream". The client, and server, should be able to take care of the rest easily. I don... |
1,418,015 | How to get Python exception text | <p>I want to embed python in my C++ application. I'm using Boost library - great tool. But i have one problem. </p>
<p>If python function throws an exception, i want to catch it and print error in my application or get some detailed information like line number in python script that caused error.</p>
<p>How can i do ... | 1,418,703 | 5 | 0 | null | 2009-09-13 15:36:30.173 UTC | 14 | 2021-09-27 17:07:58.163 UTC | 2009-09-13 18:11:56.193 UTC | null | 157,267 | null | 157,267 | null | 1 | 52 | c++|python|exception|boost-python | 21,715 | <p>Well, I found out how to do it.</p>
<p>Without boost (only error message, because code to extract info from traceback is too heavy to post it here):</p>
<pre><code>PyObject *ptype, *pvalue, *ptraceback;
PyErr_Fetch(&ptype, &pvalue, &ptraceback);
//pvalue contains error message
//ptraceback contains sta... |
2,219,714 | SQL Server tables: what is the difference between @, # and ##? | <p>In SQL Server, what is the difference between a @ table, a # table and a ## table?</p> | 2,219,731 | 6 | 0 | null | 2010-02-08 05:13:24.92 UTC | 21 | 2019-06-21 07:49:38.183 UTC | null | null | null | null | 226,235 | null | 1 | 99 | sql-server | 140,270 | <p><code>#table</code> refers to a local (visible to only the user who created it) temporary table.</p>
<p><code>##table</code> refers to a global (visible to all users) temporary table.</p>
<p><code>@variableName</code> refers to a variable which can hold values depending on its type.</p> |
2,158,759 | Case vs If Else If: Which is more efficient? | <blockquote>
<p><strong>Possible Duplicates:</strong><br>
<a href="https://stackoverflow.com/questions/767821/is-else-if-faster-than-switch-case">is “else if” faster than “switch() case” ?</a><br>
<a href="https://stackoverflow.com/questions/2086529/what-is-the-relative-performance-of-if-e... | 2,158,792 | 7 | 8 | null | 2010-01-28 23:21:05.817 UTC | 17 | 2010-01-29 00:03:30.647 UTC | 2017-05-23 12:26:00.65 UTC | null | -1 | null | 100,652 | null | 1 | 65 | performance|switch-statement|if-statement | 216,524 | <p>It seems that the compiler is better in optimizing a switch-statement than an if-statement.</p>
<p>The compiler doesn't know if the order of evaluating the if-statements is important to you, and can't perform any optimizations there. You could be calling methods in the if-statements, influencing variables. With the... |
2,057,994 | Where can I learn about MEF? | <p>I watched the DNR TV episode with Glenn Block and it looks like MEF would be useful for my company. I am trying to find out more information on it's strengths and weaknesses and some sample projects that use it. Are there any good blogs/tutorials on using MEF?</p>
<p>Note: I use C#, so if the examples are in C#, ... | 2,058,024 | 7 | 0 | null | 2010-01-13 15:49:28.02 UTC | 44 | 2017-12-12 10:11:45.41 UTC | null | null | null | null | 93,431 | null | 1 | 67 | c#|.net|mef | 22,398 | <p>I haven't found a really comprehensive page, but there are a few:</p>
<p><a href="https://docs.microsoft.com/en-us/dotnet/framework/mef/" rel="nofollow noreferrer">Microsoft Docs</a></p>
<p><a href="http://blogs.msdn.com/brada/archive/2009/07/20/simple-example-using-managed-extensibility-framework-in-silverlight.a... |
2,215,458 | Getting started reverse-engineering OS X? | <p>What is a good place to learn reverse engineering, specifically as it applies to Mac OS X? Two apps that I admire in terms of this subject:</p>
<p>Hyperspaces – <a href="https://hyperspacesapp.com" rel="nofollow noreferrer">Link</a></p>
<p>and</p>
<p>Orbit – <a href="http://www.steventroughtonsmith.com/orbit/" rel="... | 2,227,810 | 8 | 7 | null | 2010-02-07 01:05:21.313 UTC | 15 | 2021-10-15 19:42:10.907 UTC | 2021-10-15 19:42:10.907 UTC | null | 4,751,173 | null | 264,843 | null | 1 | 14 | iphone|macos|operating-system|reverse-engineering | 7,080 | <p>Use <a href="http://iphone.freecoder.org/classdump_en.html" rel="nofollow noreferrer">class-dump-x</a>/<a href="http://code.google.com/p/networkpx/wiki/class_dump_z" rel="nofollow noreferrer">-z</a> to get the private Objective-C headers for OS X/iPhone OS system frameworks. There are a lot of classes/methods hidde... |
1,710,809 | When and why should the Strategy Pattern be used? | <p>When would the <a href="http://en.wikipedia.org/wiki/Strategy_pattern" rel="noreferrer">Strategy Pattern</a> be used?</p>
<p>I see client code snippets like this:</p>
<pre>
<code>
class StrategyExample {
public static void main(String[] args) {
Context context;
// Three contexts following di... | 1,710,885 | 10 | 1 | null | 2009-11-10 20:04:45.237 UTC | 13 | 2019-09-14 18:22:03.067 UTC | 2009-11-10 20:31:04.05 UTC | null | 572 | null | 125,380 | null | 1 | 34 | design-patterns|strategy-pattern | 26,064 | <p>The problem with toy examples such as this is that it is often easy to miss the point. In this case, the code could indeed be just implemented as you have shown. In a strategy pattern, the main value is in being able to switch out different implementations for different situations.</p>
<p>The example you have is on... |
1,896,503 | What are people using JScript.Net for? | <p>I'm interested to know who uses JScript.Net and for what sort of applications.
Whenever I'm reading MSDN .Net documentation, I always notice the JScript samples but in all the years I've been a C# dev I've never actually known anyone to use it.</p>
<p>What sort of applications are people using this for, and how doe... | 1,899,810 | 12 | 2 | null | 2009-12-13 13:25:10.1 UTC | 16 | 2017-02-15 23:05:01.85 UTC | 2009-12-15 09:49:00.763 UTC | null | 134,754 | null | 134,754 | null | 1 | 42 | .net|asp.net|jscript.net | 13,095 | <p>Rob - I have used JScript.NET in anger in one place in my code, which is essentially to expose the functionality of its eval method. Here is a cut-down version:</p>
<pre><code>static public class Evaluator
{
private const string _jscriptSource =
@"package Evaluator
{
class Evaluator
... |
18,089,562 | How do I keep the delimiters when splitting a Ruby string? | <p>I have text like:</p>
<pre><code>content = "Do you like to code? How I love to code! I'm always coding."
</code></pre>
<p>I'm trying to split it on either a <code>?</code> or <code>.</code> or <code>!</code>:</p>
<pre><code>content.split(/[?.!]/)
</code></pre>
<p>When I print out the results, the punctuation de... | 18,089,658 | 5 | 2 | null | 2013-08-06 20:12:28.103 UTC | 11 | 2015-12-20 02:50:41.777 UTC | 2015-12-20 02:50:41.777 UTC | null | 102,401 | null | 1,647,484 | null | 1 | 42 | ruby | 14,393 | <p><strong>Answer</strong></p>
<p>Use a positive lookbehind regular expression (i.e. <code>?<=</code>) inside a parenthesis capture group to keep the delimiter at the end of each string:</p>
<pre><code>content.split(/(?<=[?.!])/)
# Returns an array with:
# ["Do you like to code?", " How I love to code!", " I'm... |
44,667,434 | How to solve "Missing Marketing Icon. iOS Apps must include a 1024x1024px" | <p>I am uploading app in iTunes from Xcode 9.0...This error is showing on the last step. How to solve this? 1024x1024px icon is present in my icons list</p>
<p><a href="https://i.stack.imgur.com/aJdy7.png" rel="noreferrer"><img src="https://i.stack.imgur.com/aJdy7.png" alt="enter image description here"></a></p>
<p><... | 44,691,659 | 9 | 6 | null | 2017-06-21 05:24:56.427 UTC | 8 | 2020-10-08 08:57:43.55 UTC | 2017-06-21 05:27:34.827 UTC | null | 1,025,063 | null | 4,970,453 | null | 1 | 67 | ios|xcode | 29,694 | <p>Now onwards we need to add a new icon in our project with the size 1024X1024. Please see below-attached image. This issue was stared from WWDC 2017.</p>
<p><a href="https://i.stack.imgur.com/ccaOa.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ccaOa.png" alt="enter image description here"></a></p>
<p>No... |
6,797,350 | ASP.NET MVC Cookie Implementation | <p>I try to implement a basic cookie helper in my application.
Mainly I check in base controller everytime whether or not if cookie is set.
If cookie </p>
<pre><code>public class MyCookie
{
public static string CookieName {get;set;}
public virtual User User { get; set; }
public virtual Application App { g... | 6,878,527 | 3 | 3 | null | 2011-07-23 00:10:28.483 UTC | 11 | 2017-07-04 08:33:47.45 UTC | 2012-04-11 11:47:19.963 UTC | null | 568,415 | null | 568,415 | null | 1 | 19 | c#|asp.net|asp.net-mvc|httpcookie | 74,673 | <p>My Working Implementation (Basic Version)</p>
<pre><code>public class CookieHelper
{
public static string CookieName {get;set;}
public virtual Application App { get; set; }
public MyCookie(Application app)
{
CookieName = "MyCookie" + app;
}
public static void SetCookie(User user, Community community, int co... |
23,699,809 | Any API or Web UI project to manage a Docker private registry? | <p>I can't find how to manage images in a private registry. I can push or pull an image because i know the id but how to get the list of pushed images ? </p>
<p>Take for example a person who wants to see the available images under the private registry of his organization. How can she do ? </p>
<p>Unless I'm mistaken,... | 23,760,530 | 6 | 2 | null | 2014-05-16 16:03:12.513 UTC | 14 | 2018-01-19 10:04:40.24 UTC | 2015-01-08 01:50:26.95 UTC | null | 308,174 | null | 1,766,008 | null | 1 | 30 | docker|docker-registry | 30,087 | <p>Thanks Thomas !</p>
<p>To allow the use of the search API, you must start the container by specifying the value of the environment variable SEARCH_BACKEND like this :</p>
<pre><code>docker run -d -e SEARCH_BACKEND=sqlalchemy -p 5000:5000 --name registry samalba/docker-registry
</code></pre>
<p>Then i have a resul... |
15,644,845 | postgres: localhost not connecting | <p>My <code>postgreSQL.conf</code> looks like</p>
<pre><code># - Connection Settings -
listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost', '*' = all
... | 15,645,670 | 4 | 2 | null | 2013-03-26 18:36:15.15 UTC | 2 | 2021-05-27 13:56:33.72 UTC | 2013-03-26 18:41:38.18 UTC | null | 379,235 | null | 379,235 | null | 1 | 6 | postgresql|postgresql-9.1 | 39,068 | <p>Not sure why this was happening, but I found <a href="http://postgresapp.com" rel="nofollow">postgresapp.com</a> which is pretty good to use</p>
<p>I am using this with <a href="http://www.pgadmin.org/" rel="nofollow">http://www.pgadmin.org/</a> and I am running it smoothly so far</p> |
15,585,216 | How to randomly generate numbers without repetition in javascript? | <p>I want to generate each number between 0 to 4 randomly using javascript and each number can appear only once. So I wrote the code:</p>
<pre><code>for(var l=0; l<5; l++) {
var randomNumber = Math.floor(Math.random()*5);
alert(randomNumber)
}
</code></pre>
<p>but this code is repeating the values. Pleas... | 15,585,372 | 12 | 1 | null | 2013-03-23 09:31:26.057 UTC | 3 | 2021-08-20 15:48:42.317 UTC | 2013-03-23 10:02:58.707 UTC | null | 949,476 | null | 2,149,532 | null | 1 | 10 | javascript|arrays|random|for-loop | 44,583 | <p>Generate a range of numbers:</p>
<pre><code>var numbers = [1, 2, 3, 4];
</code></pre>
<p>And then <a href="https://stackoverflow.com/a/6274381/464744">shuffle</a> it:</p>
<pre><code>function shuffle(o) {
for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
re... |
19,189,274 | Nested defaultdict of defaultdict | <p>Is there a way to make a defaultdict also be the default for the defaultdict? (i.e. infinite-level recursive defaultdict?)</p>
<p>I want to be able to do:</p>
<pre><code>x = defaultdict(...stuff...)
x[0][1][0]
{}
</code></pre>
<p>So, I can do <code>x = defaultdict(defaultdict)</code>, but that's only a second lev... | 19,189,356 | 10 | 2 | null | 2013-10-04 19:28:50.147 UTC | 43 | 2021-12-22 10:07:09.06 UTC | 2019-01-13 20:06:48.427 UTC | null | 202,229 | null | 349,948 | null | 1 | 194 | python|recursion|defaultdict | 73,830 | <p>For an arbitrary number of levels:</p>
<pre><code>def rec_dd():
return defaultdict(rec_dd)
>>> x = rec_dd()
>>> x['a']['b']['c']['d']
defaultdict(<function rec_dd at 0x7f0dcef81500>, {})
>>> print json.dumps(x)
{"a": {"b": {"c": {"d": {}}}}}
</code></pre>
<p>Of course you coul... |
35,040,978 | Babel unexpected token import when running mocha tests | <p>The solutions offered in other related questions, such as including the proper presets (es2015) in .babelrc, are already implemented in my project.</p>
<p>I have two projects (lets call them A and B) which both use ES6 module syntax. In Project A, I'm importing Project B which is installed via npm and lives in the... | 35,045,012 | 17 | 6 | null | 2016-01-27 15:09:28.617 UTC | 17 | 2020-12-29 05:57:09.66 UTC | 2017-07-23 13:41:48.483 UTC | null | 3,885,376 | null | 324,243 | null | 1 | 97 | node.js|npm|syntax-error|mocha.js|babeljs | 83,010 | <p>It seems the only solution is to explicitly include: </p>
<pre><code>require('babel-core/register')({
ignore: /node_modules/(?!ProjectB)/
});
</code></pre>
<p>in a test helper file, and pass that along to mocha in my test command:</p>
<pre><code>mocha --require ./test/testHelper.js...
</code></pre>
<hr>
<p><... |
40,306,280 | How to transpose a dataframe in tidyverse? | <p>Using basic R, I can transpose a dataframe, say <code>mtcars</code>, which has all columns of the same class:</p>
<pre><code>as.data.frame(t(mtcars))
</code></pre>
<p>Or with pipes:</p>
<pre><code>library(magrittr)
mtcars %>% t %>% as.data.frame
</code></pre>
<p>How to accomplish the same within tidyr or ... | 40,307,807 | 2 | 4 | null | 2016-10-28 13:36:45.67 UTC | 12 | 2022-01-12 13:53:28.813 UTC | 2017-09-12 17:42:11.747 UTC | null | 2,204,410 | null | 2,947,090 | null | 1 | 32 | r|dataframe|transpose|tidyr|tidyverse | 49,221 | <p>Try with <code>add_rownames</code></p>
<pre><code>add_rownames(mtcars) %>%
gather(var, value, -rowname) %>%
spread(rowname, value)
</code></pre>
<p>In the newer version, <code>rownames_to_column</code> replaces <code>add_rownames</code></p>
<pre><code>mtcars %>%
rownames_to_column... |
40,096,470 | Get Webpack not to bundle files | <p>So right now I'm working with a prototype where we're using a combination between webpack (for building .tsx files and copying .html files) and webpack-dev-server for development serving. As you can assume we are also using React and ReactDOM as a couple of library dependencies as well. Our current build output is... | 40,101,789 | 3 | 6 | null | 2016-10-17 22:08:41.92 UTC | 11 | 2019-12-20 09:07:27.81 UTC | 2019-12-20 09:07:03.137 UTC | null | 542,251 | null | 7,004,536 | null | 1 | 48 | javascript|node.js|reactjs|typescript|webpack | 45,866 | <p>Change the <code>output</code> setting to be <em>name driven</em> e.g. </p>
<pre><code> entry: {
dash: 'app/dash.ts',
home: 'app/home.ts',
},
output: {
path: './public',
filename: 'build/[name].js',
sourceMapFilename: 'build/[name].js.map'
},
</code></pre> |
5,063,835 | How can I make a Hashmap in Linux shell? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/1494178/how-to-define-hash-tables-in-bash">How to define hash tables in bash?</a> </p>
</blockquote>
<p>I wish to create a hash map in a Linux shell script which associates string keys with string values. Is th... | 5,063,920 | 2 | 1 | null | 2011-02-21 08:43:21.403 UTC | 1 | 2011-02-21 08:52:58.84 UTC | 2017-05-23 11:58:44.017 UTC | null | -1 | null | 190,822 | null | 1 | 13 | linux|shell | 57,829 | <p>I think you shold refer this question:
<a href="https://stackoverflow.com/questions/1494178/how-to-define-hash-tables-in-bash">How to define hash tables in Bash?</a>, which is useful. :-)</p> |
5,158,032 | Define multiple variables at the same time in MATLAB? | <p>I don't know if MATLAB can do this, and I want it purely for aesthetics in my code, but can MATLAB create two variables at the same time?</p>
<p>Example</p>
<pre><code>x = cell(4,8);
y = cell(4,8);
</code></pre>
<p>Is there a way to write the code something similar to: </p>
<pre><code>x&y = cell(4,8);
</c... | 5,158,206 | 2 | 2 | null | 2011-03-01 17:26:45.8 UTC | 5 | 2015-11-28 11:31:12.777 UTC | 2015-11-28 11:31:12.777 UTC | null | 4,370,109 | null | 379,362 | null | 1 | 17 | matlab|variables | 50,976 | <p>Use comma-separated lists to get multiple variables in the left hand side of an expression.</p>
<p>You can use deal() to put multiple assignments one line.</p>
<pre><code>[x,y] = deal(cell(4,8), cell(4,8));
</code></pre>
<p>Call it with a single input and all the outputs get the same value.</p>
<pre><code>[x,y] ... |
16,325,035 | How to create an automated dynamic line graph in Excel VBA | <p>I have a work problem. I have a data report with tons of information in it and I need to create 3 line graphs to represent 3 different values over time. The time is also in the report and is the same time for all of the values. I am having trouble finding a solution specific to me in forums elsewhere. </p>
<p>The d... | 16,329,765 | 1 | 7 | null | 2013-05-01 19:31:08.367 UTC | 5 | 2015-08-03 12:14:03.93 UTC | 2015-08-03 12:14:03.93 UTC | null | 1,481,116 | null | 2,340,579 | null | 1 | 3 | vba|excel|graph|line | 66,660 | <p>To manipulate the Series title (you only have one series in each of these charts) you could do simply:</p>
<pre><code>With ActiveChart.SeriesCollection(1)
.Name = "RPM"
'## You can further manipulate some series properties, like: '
'.XValues = range_variable '## you can assign a range of categorylabels... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.