id
int64
4
73.8M
title
stringlengths
10
150
body
stringlengths
17
50.8k
accepted_answer_id
int64
7
73.8M
answer_count
int64
1
182
comment_count
int64
0
89
community_owned_date
stringlengths
23
27
creation_date
stringlengths
23
27
favorite_count
int64
0
11.6k
last_activity_date
stringlengths
23
27
last_edit_date
stringlengths
23
27
last_editor_display_name
stringlengths
2
29
last_editor_user_id
int64
-1
20M
owner_display_name
stringlengths
1
29
owner_user_id
int64
1
20M
parent_id
null
post_type_id
int64
1
1
score
int64
-146
26.6k
tags
stringlengths
1
125
view_count
int64
122
11.6M
answer_body
stringlengths
19
51k
8,512,802
Checking if a variable is defined in SASS
<p>AS the title says I am trying to check whether a variable is defined in SASS. (I am using compass if that makes any different difference)</p> <p>I've found the Ruby equivalent which is:</p> <pre><code>defined? foo</code></pre> <p>Gave that a shot in the dark but it just gave me the error:</p> <p><code>defined": ...
13,237,776
3
4
null
2011-12-14 22:43:17.927 UTC
15
2020-04-20 20:45:20.473 UTC
2011-12-15 02:06:13.697 UTC
null
708,689
null
708,689
null
1
59
ruby|sass
57,756
<h3>For Sass 3.3 and later</h3> <p>As of Sass 3.3 there is a <code>variable-exists()</code> function. From <a href="http://sass-lang.com/documentation/file.SASS_CHANGELOG.html" rel="noreferrer">the changelog</a>:</p> <blockquote> <ul> <li>It is now possible to determine the existence of different Sass constructs ...
8,512,588
Tomcat: LifecycleException when deploying
<p>I just downloaded the Tomcat 7.0.23 package on my Ubuntu 11.10. </p> <p>I followed the instructions on a Google API website to <a href="http://code.google.com/apis/chart/interactive/docs/dev/dsl_get_started.html#webapp" rel="noreferrer">deploy their example webapp</a>. It basically consists of <code>jar</code> file...
8,512,930
17
5
null
2011-12-14 22:25:09.127 UTC
5
2022-03-21 14:43:59.94 UTC
2016-01-13 10:55:12.257 UTC
null
3,885,376
null
749,588
null
1
50
tomcat|lifecycleexception
213,779
<p>This means something is wrong with your application configuration or startup. </p> <p>There is always information about that in the logs - check <code>logs/catalina.out</code> and figure out what is wrong.</p>
8,389,812
How are generators and coroutines implemented in CPython?
<p>I've read that in CPython, the interpreter stack (the list of Python functions called to reach this point) is mixed with the C stack (the list of C functions that were called in the interpreter's own code). If so, then how are generators and coroutines implemented? How do they remember their execution state? Does CP...
8,390,077
2
5
null
2011-12-05 18:10:16.553 UTC
22
2015-05-06 04:02:59.853 UTC
null
null
null
null
618,967
null
1
58
python|coroutine
6,809
<p>The <code>yield</code> instruction takes the current executing context as a closure, and transforms it into an own living object. This object has a <code>__iter__</code> method which will continue after this yield statement.</p> <p>So the call stack gets transformed into a heap object.</p>
5,111,828
How to have a UISwipeGestureRecognizer AND UIPanGestureRecognizer work on the same view
<p>How would you setup the gesture recognizers so that you could have a <strong>UISwipeGestureRecognizer</strong> and a <strong>UIPanGestureRecognizer</strong> work at the same time? Such that if you touch and move quickly (quick swipe) it detects the gesture as a swipe but if you touch then move (short delay between ...
5,113,187
4
0
null
2011-02-24 23:24:26.373 UTC
14
2019-07-17 23:22:26.743 UTC
null
null
null
null
155,513
null
1
26
iphone|objective-c|uigesturerecognizer|gesture-recognition
15,421
<p>You're going to want to set one of the two <code>UIGestureRecognizer</code>'s delegates to an object that makes sense (likely <code>self</code>) then listen, and return <code>YES</code> for this <a href="http://developer.apple.com/library/ios/#documentation/uikit/reference/UIGestureRecognizerDelegate_Protocol/Refere...
5,029,183
Android dialer application
<p>I am figuring out a way to replace the default dialer application from my custom dialer application, but I am not getting how to achieve this.</p> <p>Here is what I want</p> <ul> <li>Create a custom dialer UI</li> <li>My application is called whenever call button hardware or that one in Android is pressed</li> <li...
5,029,367
4
1
null
2011-02-17 12:56:20.783 UTC
26
2018-04-16 18:26:07.827 UTC
2017-08-18 12:07:13.113 UTC
null
1,000,551
null
517,247
null
1
32
android|phone-call
57,399
<ol> <li><p>Create a simple Android application (our dialer). To actually call someone, you just need that method:</p> <pre><code>private void performDial(String numberString) { if (!numberString.equals("")) { Uri number = Uri.parse("tel:" + numberString); Intent dial = new Intent(Intent.ACTION_CALL,...
4,880,286
Is a Markov chain the same as a finite state machine?
<p>Is a finite state machine just an implementation of a Markov chain? What are the differences between the two?</p>
4,880,350
6
2
null
2011-02-02 21:52:02.137 UTC
22
2019-07-06 22:45:17.14 UTC
2017-07-13 07:56:42.763 UTC
null
527,702
null
200,619
null
1
92
math|statistics|state-machine|fsm|markov-chains
27,805
<p>Markov chains can be represented by finite state machines. The idea is that a Markov chain describes a process in which the transition to a state at time t+1 depends only on the state at time t. The main thing to keep in mind is that the transitions in a Markov chain are probabilistic rather than deterministic, whic...
5,061,640
make arrayList.toArray() return more specific types
<p>So, normally <code>ArrayList.toArray()</code> would return a type of <code>Object[]</code>....but supposed it's an <code>Arraylist</code> of object <code>Custom</code>, how do I make <code>toArray()</code> to return a type of <code>Custom[]</code> rather than <code>Object[]</code>?</p>
5,061,692
6
2
null
2011-02-21 02:07:10.953 UTC
31
2021-10-19 12:51:58.46 UTC
2013-11-26 00:01:57.843 UTC
null
1,102,512
null
380,714
null
1
218
java|arrays|object|types|arraylist
183,065
<p>Like this:</p> <pre><code>List&lt;String&gt; list = new ArrayList&lt;String&gt;(); String[] a = list.toArray(new String[0]); </code></pre> <p>Before Java6 it was recommended to write:</p> <pre><code>String[] a = list.toArray(new String[list.size()]); </code></pre> <p>because the internal implementation would re...
5,183,251
Querying Users who 'like' my Facebook Page
<p>I was wondering if it was possible to query the following:</p> <ul> <li>List of (all) users who like my facebook page, and</li> <li>Additional information those users have made publicly available (beyond first and last name)</li> </ul> <p>Basically looking to generate detailed marketing stats of users who like my ...
5,186,725
8
2
null
2011-03-03 16:03:16.543 UTC
16
2018-09-28 13:49:40.827 UTC
null
null
null
null
643,274
null
1
23
facebook|facebook-graph-api
46,016
<p>I am afraid this is <strong>NOT</strong> possible, follow this <a href="https://developers.facebook.com/bugs/147185208750426">bug</a> for more information. </p> <p>Another proof is the <code>page_fan</code> table you will notice that only the <code>uid</code> field is indexable so you <strong>need</strong> to know...
5,346,694
How to implement a lock in JavaScript
<p>How could something equivalent to <code>lock</code> in C# be implemented in JavaScript?</p> <p>So, to explain what I'm thinking a simple use case is: </p> <p>User clicks button <code>B</code>. <code>B</code> raises an onclick event. If <code>B</code> is in <code>event-state</code> the event waits for <code>B</co...
5,347,055
9
7
null
2011-03-17 23:57:20.66 UTC
30
2022-08-25 05:36:24.097 UTC
2020-07-19 11:17:28.527 UTC
null
4,370,109
null
344,211
null
1
104
javascript|events|locking|dom-events|deadlock
127,898
<p>Lock is a questionable idea in JS which is intended to be threadless and not needing concurrency protection. You're looking to combine calls on deferred execution. The pattern I follow for this is the use of callbacks. Something like this:</p> <pre><code>var functionLock = false; var functionCallbacks = []; var loc...
12,541,419
PHP keep checkbox checked after submitting form
<p>Hi all i have a contact form and captcha is there. i want keep the check is checked after submitting the form. I posted the textbox values and it showing correctly but checkbox is not working. here is my code.</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org /TR/xh...
12,541,453
5
0
null
2012-09-22 06:40:05.347 UTC
2
2021-02-19 06:19:41.067 UTC
null
null
null
null
1,567,706
null
1
11
php|html
54,652
<p>change</p> <pre><code>&lt;input type="checkbox" name="txtCheck" value="&lt;?php echo $_POST['txtCheck'];?&gt;" /&gt;&lt;br /&gt; </code></pre> <p>to</p> <pre><code>&lt;input type="checkbox" name="txtCheck" value="your value" &lt;?php if(isset($_POST['txtCheck'])) echo "checked='checked'"; ?&gt; /&gt;&lt;br /&gt...
12,530,085
How to setup SVN on Mac OS X 10.8.2?
<p>I have found information that SVN comes with Mac OS X. But there was no SVN on my system. I have installed <code>Subversion-1.6.17-1_10.7.x.pkg</code> and all was good. But after update to Mac OS X 10.8.2 all SVN files were automatically removed from the system. I have tried to install <code>Subversion-1.6.17-1_10.7...
12,532,138
1
5
null
2012-09-21 11:54:30.753 UTC
2
2012-09-21 14:04:41.997 UTC
2012-09-21 12:03:55.167 UTC
null
865,475
null
865,475
null
1
12
macos|svn|installation
66,756
<p>After you have installed Xcode 4.5 you need to follow <a href="https://stackoverflow.com/a/9329325/253056">these instructions</a> in order to install the command line tools. Once you've done that successfully then you should see that svn is installed:</p> <pre><code>$ which svn /usr/bin/svn $ svn --version svn, ve...
12,527,433
correct way of comparing string jquery operator =
<p>Is this the correct way? I want the statement to run if the value of somevar equals the string? </p> <pre><code>if (somevar = '836e3ef9-53d4-414b-a401-6eef16ac01d6'){ $("#code").text(data.DATA[0].ID); } </code></pre>
12,527,475
3
1
null
2012-09-21 09:05:08.873 UTC
2
2012-09-21 09:14:38.04 UTC
null
null
null
null
578,822
null
1
19
jquery
161,108
<p>No. = sets somevar to have that value. use === to compare value and type which returns a boolean that you need.</p> <p>Never use or suggest == instead of ===. its a recipe for disaster. e.g 0 == "" is true but "" == '0' is false and many more.</p> <p>More information also in <a href="https://stackoverflow.com/ques...
12,400,860
ActiveRecord includes. Specify included columns
<p>I have model Profile. Profile has_one User. User model has field email. When I call</p> <pre><code>Profile.some_scope.includes(:user) </code></pre> <p>it calls</p> <pre><code>SELECT users.* FROM users WHERE users.id IN (some ids) </code></pre> <p>But my User model has many fields that I am not using in rendering...
12,409,672
6
0
null
2012-09-13 06:48:17.783 UTC
13
2020-06-10 12:47:09.197 UTC
2018-09-08 04:21:36.37 UTC
null
2,262,149
null
1,262,284
null
1
37
ruby-on-rails|ruby-on-rails-3|rails-activerecord
30,132
<p>Rails doesn't have the facility to pass the options for <strong>include</strong> query. But we can pass these params with the <strong>association declaration</strong> under the model.</p> <p>For your scenario, you need to create a new association with users model under the profile model, like below</p> <pre><code>...
12,095,113
R knitr: Possible to programmatically modify chunk labels?
<p>I'm trying to use knitr to generate a report that performs the same set of analyses on different subsets of a data set. The project contains two Rmd files: the first file is a master document that sets up the workspace and the document, the second file only contains chunks that perform the analyses and generates ass...
14,368,148
3
0
null
2012-08-23 15:27:37.567 UTC
26
2019-04-09 00:58:27.92 UTC
null
null
null
null
1,560,000
null
1
50
r|knitr
7,539
<p>For anyone else who comes across this post, I wanted to point out that @Yihui has provided a <a href="https://github.com/yihui/knitr/blob/master/vignettes/knit_expand.Rmd" rel="noreferrer">formal solution</a> to this question in knitr 1.0 with the introduction of the <code>knit_expand()</code> function. It works gre...
12,077,083
What is the difference between allprojects and subprojects
<p>On a multi-project gradle build, can someone tell me what exactly is the difference between the "allprojects" section and the "subprojects" one? Just the parent directory? Does anyone use both? If so, do you have general rules that determines what typically is put in each one?</p> <p>Related question: what is th...
12,077,290
2
0
null
2012-08-22 16:02:50.613 UTC
16
2012-08-22 16:32:51.81 UTC
null
null
null
null
1,538,856
null
1
159
gradle
52,528
<p>In a multi-project gradle build, you have a rootProject and the subprojects. The combination of both is allprojects. The rootProject is where the build is starting from. A common pattern is a rootProject has no code and the subprojects are java projects. In which case, you apply the java plugin to only the subproje...
44,328,225
Can't change emulated performance of AVD in Android Studio
<p>I can't change the graphics to software as I'm sure this is the fix for my AVD not launching. The option is greyed out (see screenshot). Has anyone has experience with this? I couldn't find anyone who had the same issue.</p> <p>I'm running the latest version of Android Studio on Ubuntu 17.04.</p> <p><a href="http...
46,720,472
9
5
null
2017-06-02 11:49:28.987 UTC
26
2021-11-16 14:04:31.703 UTC
null
null
null
null
3,722,568
null
1
131
android|android-studio|avd|ubuntu-17.04
100,819
<p>Actually, this problem seems to be limited to devices with <strong>Play Store</strong> available, so Nexus 5X and Nexus 5 images will be forced to use Automatic Graphics, but all other devices allow you to choose either Automatic, Hardware or Software graphics.</p> <hr> <p><em>edit:</em> I've just tested this toda...
18,824,461
Display data from database inside <table> using wordpress $wpdb
<p>Can someone help me, how to code the logic to print the data from my database into a <code>&lt;table&gt;</code>?</p> <pre><code>&lt;table border=&quot;1&quot;&gt; &lt;tr&gt; &lt;th&gt;Firstname&lt;/th&gt; &lt;th&gt;Lastname&lt;/th&gt; &lt;th&gt;Points&lt;/th&gt; &lt;/tr&gt; &lt;tr&gt; ...
18,824,758
4
5
null
2013-09-16 09:20:32.3 UTC
4
2022-08-05 10:02:02.09 UTC
2022-08-05 10:02:02.09 UTC
null
19,664,042
null
1,933,824
null
1
3
php|wordpress|html-table
61,759
<p>Try this: </p> <pre><code>&lt;table border="1"&gt; &lt;tr&gt; &lt;th&gt;Firstname&lt;/th&gt; &lt;th&gt;Lastname&lt;/th&gt; &lt;th&gt;Points&lt;/th&gt; &lt;/tr&gt; &lt;?php global $wpdb; $result = $wpdb-&gt;get_results ( "SELECT * FROM myTable" ); foreach ( $result as $print ) { ?&gt; &lt...
24,009,119
UTF-8 Encoding ; Only some Japanese characters are not getting converted
<p>I am getting the parameter value as parameter from the <strong>Jersey Web Service</strong>, which is in Japaneses characters.</p> <p>Here, <strong>'japaneseString'</strong> is the web service parameter containing the characters in japanese language.</p> <pre><code> String name = new String(japaneseString.getByte...
24,074,921
3
5
null
2014-06-03 07:13:14.623 UTC
2
2014-06-06 05:40:26.153 UTC
null
null
null
null
2,323,536
null
1
9
java|encoding|utf-8|character-encoding|utf
62,235
<p>Try with JVM parameter file.encoding to set with value UTF-8 in startup of Tomcat(JVM). E.x.: -Dfile.encoding=UTF-8</p>
3,905,734
How to send 100,000 emails weekly?
<p>How can one send an email to 100,000 users on a weekly basis in PHP? This includes mail to subscribers using the following providers:</p> <ul> <li>AOL</li> <li>G-Mail</li> <li>Hotmail</li> <li>Yahoo</li> </ul> <p>It is important that all e-mail actually be delivered, to the extent that it is possible. Obviously, j...
3,905,805
3
0
null
2010-10-11 11:24:18.32 UTC
325
2014-02-05 00:54:39.12 UTC
2012-06-15 10:36:09.943 UTC
null
367,456
null
244,413
null
1
-146
php|email|mailing-list|massmail
163,079
<p><strong>Short answer:</strong> While it's technically possible to send 100k e-mails each week yourself, the simplest, easiest and cheapest solution is to <strong>outsource this</strong> to one of the companies that specialize in it (I <em>did</em> say "cheapest": there's no limit to the amount of development time (a...
38,118,572
Initial job has not accepted any resources; check your cluster UI to ensure that workers are registered and have sufficient resources
<p>I'm trying to run the spark examples from <code>Eclipse</code> and getting this generic error: <code>Initial job has not accepted any resources; check your cluster UI to ensure that workers are registered and have sufficient resources.</code></p> <p>The version I have is <code>spark-1.6.2-bin-hadoop2.6.</code> I st...
38,123,434
7
9
null
2016-06-30 09:07:53.047 UTC
6
2022-05-24 15:57:58.353 UTC
null
null
null
null
373,386
null
1
33
java|hadoop|apache-spark
64,245
<p>The error indicates that you cluster has insufficient resources for current job.Since you have not started the slaves i.e worker . The cluster won't have any resources to allocate to your job. Starting the slaves will work.</p> <pre><code>`start-slave.sh &lt;spark://master-ip:7077&gt;` </code></pre>
8,835,373
UI Issue with kal calendar for ipad?
<p>I have UI issue with Kal Calendar for iPad. On the iPad there is an empty space but on the iPhone it's fine. How can i get it to fit in the frame on the iPad?</p> <pre><code>if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { [kal.view setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.fr...
8,839,910
1
6
null
2012-01-12 12:51:22.763 UTC
10
2014-05-23 12:54:04.063 UTC
2012-08-05 13:13:22.453 UTC
null
106,435
null
905,582
null
1
6
objective-c|ios|cocoa-touch|ipad
1,816
<p>in KalGridView.m you'll find this.</p> <pre><code>const CGSize kTileSize = { 46.f, 44.f }; </code></pre> <p>I'd change the code to a property where you can set the frame dynamically to the idiom and/or orientation.</p> <p>in KalGridView.m</p> <pre><code> const CGSize kTileSize = { 109.0f, 109.0f }; </code></pre>...
8,461,851
What is better, appending new elements via DOM functions, or appending strings with HTML tags?
<p>I have seen a few different methods to add elements to the DOM. The most prevelent seem to be, for example, either </p> <pre><code>document.getElementById('foo').innerHTML ='&lt;p&gt;Here is a brand new paragraph!&lt;/p&gt;'; </code></pre> <p>or</p> <pre><code>newElement = document.createElement('p'); elementText...
8,461,877
6
8
null
2011-12-11 03:55:52.423 UTC
10
2019-03-22 21:51:41.483 UTC
2011-12-11 16:27:03.75 UTC
null
153,110
null
153,110
null
1
23
javascript|dom|appendchild
7,208
<p>Some notes:</p> <ul> <li><p>Using <code>innerHTML</code> is faster in IE, but slower in chrome + firefox. <a href="http://jsperf.com/innerhtml-vs-w3c-dom/6" rel="noreferrer">Here's one benchmark</a> showing this with a constantly varying set of <code>&lt;div&gt;</code>s + <code>&lt;p&gt;</code>s; <a href="http://js...
20,623,883
Sublime text find in selection
<p>When I select multiple lines of text in text editor Sublime Text 3, and try to find (<kbd>Ctrl</kbd>+<kbd>F</kbd>) an existing string in it, it fails. In fact, any highlighting I do somehow makes the string unfindable. For example, if I highlight all text in my file, and <kbd>Ctrl</kbd>+<kbd>F</kbd> an existing stri...
20,799,096
2
4
null
2013-12-17 00:48:13.037 UTC
3
2018-10-02 09:16:59.877 UTC
2014-09-30 00:55:25.08 UTC
null
1,696,030
null
2,827,314
null
1
34
sublimetext|sublimetext3
16,805
<p>I had been fighting with this problem as well and for now (ST3 Build 3059) it still seems to be a bug. It seems like that the editor is not updating the selection for the search/replace bar while you have it open.</p> <p>Here's a workaround:</p> <p>1) Close the find/replace bar</p> <p>2) Make your selection </p> ...
11,204,891
How to open .msu extension file?
<p>I have downloaded a file WINDOWS POWERSHELL that has an .msu extension how do i install this package in my winxp professional sp3 OS.</p>
11,235,020
1
1
null
2012-06-26 09:58:55.807 UTC
1
2016-09-29 19:39:54.85 UTC
2016-09-29 19:39:54.85 UTC
null
848,199
null
1,067,943
null
1
8
windows|windows-xp|windows-update
70,778
<p>There is this link on microsoft support site that explains how to install the .msu file:</p> <ul> <li><a href="https://support.microsoft.com/en-us/kb/934307" rel="nofollow">Description of the Windows Update Standalone Installer in Windows</a> </li> </ul>
11,149,759
Remove all non alphabetic characters from a String array in java
<p>I'm trying to write a method that removes all non alphabetic characters from a Java <code>String[]</code> and then convert the String to an lower case string. I've tried using regular expression to replace the occurence of all non alphabetic characters by <code>""</code> .However, the output that I am getting is not...
11,149,783
9
1
null
2012-06-22 03:21:34.827 UTC
8
2021-06-07 03:50:06.36 UTC
2018-11-19 18:32:47.34 UTC
null
1,475,228
null
1,148,918
null
1
23
java|regex|string
98,779
<p>The problem is your changes are not being stored because Strings are <a href="https://stackoverflow.com/questions/279507/what-is-meant-by-immutable">immutable</a>. Each of the <a href="http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/String.html#replaceAll" rel="noreferrer">method calls</a> is returning a new ...
11,267,309
Importing zipped files in Mysql using command line
<p><a href="https://stackoverflow.com/q/11258811/1488173">Importing zipped files in Mysql using CMD</a></p> <p>What is the right syntax to import sql zipped files into mysql using cmd ?</p> <p>I am doing the following</p> <pre><code>xz &lt; backup.sql.gz | mysql -u root test </code></pre> <p>But always getting the ...
12,154,202
4
0
null
2012-06-29 18:43:46.067 UTC
12
2016-05-05 10:21:17.277 UTC
2017-05-23 12:19:42.377 UTC
null
-1
null
1,488,173
null
1
35
mysql|database|cmd|winzip|xz
70,116
<p>I got the answer from my other question. This is the command to import zipped file when you are using 7zip</p> <blockquote> <p>7z x -so backup.7z | mysql -u root test</p> </blockquote> <p>x is the extraction command</p> <p><code>-so</code> option makes 7-zip write to stdout</p>
11,274,906
Play RTSP streaming in an Android application
<p>I am trying to develop an Android based application, which can play video from a live stream. This live stream is produced using <a href="https://en.wikipedia.org/wiki/Wowza_Streaming_Engine">Wowza Media Server</a>.</p> <p>The URL is:</p> <pre><code>rtsp://tv.hindiworldtv.com:1935/live/getpun </code></pre> <p>I h...
12,833,897
6
5
null
2012-06-30 14:33:37.75 UTC
16
2021-03-24 12:55:25.667 UTC
2015-01-02 16:28:28.15 UTC
null
63,550
null
1,447,054
null
1
36
android|streaming|live|rtsp|wowza
102,368
<p>I found the solution. Transmission should be within the preferred setting by Android. For more details, see <em><a href="http://developer.android.com/guide/appendix/media-formats.html" rel="nofollow">Supported Media Formats</a></em>.</p>
11,274,864
What does 'qualified' mean in 'import qualified Data.List' statement?
<p>I understand <code>import Data.List</code>.</p> <p>But what does <code>qualified</code> mean in the statement <code>import qualified Data.List</code>?</p>
11,274,880
3
0
null
2012-06-30 14:28:58.21 UTC
9
2019-12-03 16:13:45.687 UTC
2019-12-03 16:13:45.687 UTC
null
775,954
null
1,417,244
null
1
56
haskell
10,729
<p>A qualified import makes the imported entities available only in qualified form, e.g.</p> <pre><code>import qualified Data.List result :: [Int] result = Data.List.sort [3,1,2,4] </code></pre> <p>With just <code>import Data.List</code>, the entities are available in qualified form and in unqualified form. Usually,...
12,755,945
Jquery and HTML FormData returns "Uncaught TypeError: Illegal invocation"
<p>I'm using this script to upload my image files: <a href="http://jsfiddle.net/eHmSr/" rel="noreferrer">http://jsfiddle.net/eHmSr/</a></p> <pre><code>$('.uploader input:file').on('change', function() { $this = $(this); $('.alert').remove(); $.each($this[0].files, function(key, file) { $('.files').append('...
12,756,023
5
3
null
2012-10-06 01:36:27.283 UTC
11
2020-11-29 15:58:13.353 UTC
null
null
null
null
977,687
null
1
86
jquery|ajax|html|upload
123,582
<p>jQuery processes the <code>data</code> attribute and converts the values into strings.</p> <p><a href="http://api.jquery.com/jQuery.ajax/" rel="noreferrer">Adding <code>processData: false</code></a> to your options object fixes the error, but I'm not sure if it fixes the problem.</p> <p><strong>Demo: <a href="http...
17,031,999
How to pass user credentials to web service?
<p>I am consuming a webservice using WSDL in windows application. When I try to use method, i get the following error:-</p> <blockquote> <p>The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was '"</p> <p>{"The remote server retur...
17,093,801
2
2
null
2013-06-10 20:11:49.447 UTC
6
2013-06-13 17:52:25.73 UTC
2013-06-10 20:19:15.15 UTC
null
1,327,064
null
1,327,064
null
1
13
c#|winforms|web-services
62,149
<p>Here is the how it is working for me:-</p> <p>Config file setting looks like this:-</p> <pre><code>&lt;configuration&gt; &lt;system.serviceModel&gt; &lt;bindings&gt; &lt;basicHttpBinding&gt; &lt;binding name="bindingName" &gt; &lt;security mode="TransportCredentialO...
16,931,895
Exact number of bins in Histogram in R
<p>I'm having trouble making a histogram in R. The problem is that I tell it to make 5 bins but it makes 4 and I tell to make 5 and it makes 8 of them.</p> <pre><code>data &lt;- c(5.28, 14.64, 37.25, 78.9, 44.92, 8.96, 19.22, 34.81, 33.89, 24.28, 6.5, 4.32, 2.77, 17.6, 33.26, 52.78, 5.98, 22.48, 20.11, 65.74, 35.73, 5...
16,932,344
5
0
null
2013-06-05 05:02:19.48 UTC
9
2020-04-15 20:23:23.183 UTC
2014-04-27 14:34:32.257 UTC
null
2,091,025
null
645,608
null
1
17
r|statistics|histogram
65,995
<p>Use the breaks argument:</p> <pre><code>hist(data, breaks=seq(0,80,l=6), freq=FALSE,col="orange",main="Histogram", xlab="x",ylab="f(x)",yaxs="i",xaxs="i") </code></pre> <p><img src="https://i.stack.imgur.com/BB0Yt.png" alt="enter image description here"></p>
16,749,121
What does `<>` mean in Python?
<p>I'm trying to use in Python 3.3 an old library (dating from 2003!). When I import it, Python throws me an error because there are <code>&lt;&gt;</code> signs in the source file, e.g.:</p> <pre><code>if (cnum &lt; 1000 and nnum &lt;&gt; 1000 and ntext[-1] &lt;&gt; "s": ... </code></pre> <p>I guess it's a now-ab...
16,749,135
5
4
null
2013-05-25 11:33:54.893 UTC
11
2021-10-28 03:47:54.05 UTC
2013-05-26 04:31:07.217 UTC
null
319,931
null
2,002,452
null
1
67
python|syntax|operators|python-2.x
78,005
<p>It means not equal to. It was taken from <code>ABC</code> (python's predecessor) see <a href="http://homepages.cwi.nl/%7Esteven/abc/qr.html#TESTS" rel="noreferrer">here</a>:</p> <blockquote> <p><code>x &lt; y, x &lt;= y, x &gt;= y, x &gt; y, x = y, x &lt;&gt; y, 0 &lt;= d &lt; 10</code></p> <p>Order tests (<code>&lt...
25,860,975
Send Email through Asp.Net Web Api
<p>My client want to send E-mail through asp.net Web API. I am new in web services and have 0 knowledge of this please guide me how to achieve this task and if anyone can provide the code, there must be some web service available like this.</p> <pre><code>using (MailMessage mm = new MailMessage(txtEmail.Text, txtTo.Te...
25,861,230
2
5
null
2014-09-16 04:59:45.103 UTC
1
2015-04-06 07:43:43.973 UTC
2014-09-16 05:15:16.85 UTC
null
2,126,088
null
2,126,088
null
1
3
c#|asp.net|email|asp.net-web-api
43,355
<p>The .NET mail API sends emails via SMTP. The ASP.NET Web API allows you to host a REST interface.</p> <p>You said you know how to program with both, so do that.</p> <p>Create your Web API method which receives the necessary arguments, exactly like you would for a normal method that will do your emailing duties for...
25,680,269
Why is the word `false` written blue and the word `FALSE` written purple in Visual Studio?
<p>Why does Visual Studio change the word color depending on the way it is entered:</p> <p><code>false</code> with blue, but <code>FALSE</code> with purple.<br> <code>true</code> with blue but <code>TRUE</code> with purple.</p> <p>Is there any difference in the meaning of them and if yes what is it?</p>
25,680,325
3
8
null
2014-09-05 07:01:38.54 UTC
0
2014-12-10 20:43:37.293 UTC
2014-09-05 10:19:02.587 UTC
null
445,517
null
2,376,693
null
1
29
c++|visual-studio|ide|syntax-highlighting
4,237
<p><code>true</code> and <code>false</code> are <em>keywords</em> in C++ so your IDE (not the compiler) is painting them blue.</p> <p>TRUE and FALSE are often defined by various headers, primarily for compatibility with C and older C++ compilers where <code>true</code> and <code>false</code> are <strong>not</strong> k...
57,770,464
Android Studio Error "Installation did not succeed. The application could not be installed. Installation failed due to: 'null'"
<p>I am trying to run my app on my Xiaomi RedMi S2 from Android Studio 3.5. It throws an error while installing the app on the phone:</p> <blockquote> <p>Installation did not succeed.<br /> The application could not be installed.<br /> Installation failed due to: 'null'</p> </blockquote> <p>REAL DEVICE: XIAOMI REDMI S2...
58,492,367
27
3
null
2019-09-03 11:09:49.863 UTC
2
2022-09-01 06:48:33.733 UTC
2022-03-25 16:05:50.44 UTC
null
10,749,567
null
1,906,738
null
1
24
android|android-studio|apk|failed-installation|xiaomi
93,181
<p>I had the Same issue on a MAC, this is how I solve it, note: I was tried the method that mention @Manoj Kumar,</p> <p>Un check this field in Preferences/Build,Execution,Deployment/Debugger <img src="https://i.stack.imgur.com/wVIE9.png" alt="" /></p>
4,745,923
prevent div moving on window resize
<p>I have a page with two divs "list_events" and "right_content" one next to each other. When I resize the window "right_content" moves down "list_events" but i dont want that! I dont want those two divs to move neither to scale down on window resizement..how can I achieve that?</p> <p>this is the code </p> <pre><cod...
7,466,816
2
0
null
2011-01-20 10:25:55.043 UTC
2
2011-09-19 05:32:44.493 UTC
null
null
null
null
505,762
null
1
14
html|resize|window|position
43,825
<p>first add a parent div/wrap and put those two divs of yours into it.</p> <p>like so:</p> <pre><code>&lt;div id="wrap"&gt; &lt;div id="list_events"&gt;&lt;/div&gt; &lt;div id="right_content"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>then you can try the </p> <p>min-width(px/ems/ etc) on the parent/wra...
70,374,005
Invalid options object. Dev Server has been initialized using an options object that does not match the API schema
<p>I have been stock on this error on my project when I add <code>&quot;proxy&quot;: &quot;http://localhost:6000&quot;</code> in my package.json.</p> <p>This is the error response after yarn start.</p> <blockquote> <p>Invalid options object. Dev Server has been initialized using an options object that does not match th...
70,413,065
18
3
null
2021-12-16 04:57:13.54 UTC
3
2022-09-22 17:46:29.143 UTC
2021-12-16 06:01:55.78 UTC
null
8,690,857
null
11,194,137
null
1
37
node.js|reactjs|package.json
55,023
<p>Here is a workaround. Delete <strong>&quot;proxy&quot;: &quot;http://localhost:6000&quot;</strong>. Install package http-proxy-middleware with command <strong>npm install http-proxy-middleware --save</strong>. Create a file setupProxy.js inside your src folder or the root of your folder. Add these lines inside:</p> ...
10,167,266
How to set cornerRadius for only top-left and top-right corner of a UIView?
<p>Is there a way to set <code>cornerRadius</code> for only top-left and top-right corner of a <code>UIView</code>?</p> <p>I tried the following, but it end up not seeing the view anymore.</p> <pre><code>UIView *view = [[UIView alloc] initWithFrame:frame]; CALayer *layer = [CALayer layer]; UIBezierPath *shadowPath =...
41,197,790
30
7
null
2012-04-15 23:58:26.2 UTC
171
2022-05-09 15:54:41.353 UTC
2018-09-21 13:46:33.157 UTC
null
1,033,581
null
180,862
null
1
521
ios|cocoa-touch|uiview|cornerradius
353,010
<p>Pay attention to the fact that if you have layout constraints attached to it, you must refresh this as follows in your UIView subclass:</p> <pre><code>override func layoutSubviews() { super.layoutSubviews() roundCorners(corners: [.topLeft, .topRight], radius: 3.0) } </code></pre> <p>If you don't do that it w...
10,090,949
Accessing to enum values by '::' in C++
<p>I have class like following: </p> <pre><code>class Car { public: Car(); // Some functions and members and &lt;b&gt;enums&lt;/b&gt; enum Color { Red, Blue, Black }; Color getColor(); void setColor(Color); private: Color myColor; } </code></pre>...
10,092,148
3
3
null
2012-04-10 14:46:46.05 UTC
3
2018-12-13 15:27:06.047 UTC
2012-04-10 14:51:02.593 UTC
null
11,343
null
1,105,597
null
1
14
c++|enums
66,419
<p>In current C++ (i.e. C++11 and beyond), you <em>can</em> already access enum values like that:</p> <pre><code>enum Color { Red }; Color c = Color::Red; Color d = Red; </code></pre> <p>You can go further and enforce the use of this notation:</p> <pre><code>enum class Color { Red }; Color c = Color::Red; // Color d...
10,114,526
How to build a Meteor smart package
<p>How can one build a <a href="http://docs.meteor.com/#packages" rel="noreferrer">Meteor smart package</a> that would show up in <code>meteor list</code>?</p> <p>Building <a href="http://atmosphere.meteor.com" rel="noreferrer">Atmosphere</a> packages is reasonably well <a href="https://atmosphere.meteor.com/wtf/packa...
23,950,265
5
1
null
2012-04-11 21:53:45.977 UTC
17
2015-07-20 03:45:46.133 UTC
2014-06-04 20:53:38.477 UTC
null
311,744
null
258,689
null
1
42
meteor|package
19,253
<p>Meteor now supports a <strong><code>create --package</code></strong> command.</p> <p>See <a href="http://docs.meteor.com/#/full/writingpackages">the meteor docs</a>.</p> <p>Example (substitute your own <a href="https://www.meteor.com/services/developer-accounts">meteor developer account</a> for "cunneen"):</p> <p...
9,822,313
Remote connect to clearDB heroku database
<p>How can i perform a remote connect to ClearDB MySQL database on heroku using for example MySQL Query Browser. Where to get url, port, login and password?</p>
10,357,757
13
0
null
2012-03-22 12:29:07.443 UTC
39
2021-11-02 07:09:08.563 UTC
null
null
null
null
1,022,108
null
1
119
mysql|database|heroku|database-connection
97,485
<p>In heroku website, go to My Apps and select the app on which you have installed ClearDB. </p> <p>On the top corner click on <strong>Addons</strong> and then select <strong>ClearDB MySQL Database</strong>. Once there, click on your database and choose the '<strong>Endpoint Information</strong>' tab. There you see yo...
9,945,409
How do I fix the error 'Named Pipes Provider, error 40 - Could not open a connection to' SQL Server'?
<p>I can't seem to connect to my database from a site. I get this error:</p> <blockquote> <p>Named Pipes Provider, error: 40 - Could not open a connection to SQL Server</p> </blockquote> <p>I tried using the local IP address to connect as well as a public one. I've tried:</p> <ol> <li>Yes, the site can communicate...
34,573,742
32
6
null
2012-03-30 14:56:12.107 UTC
43
2022-09-20 15:25:20.66 UTC
2013-01-06 10:27:27.267 UTC
null
63,550
null
584,765
null
1
174
sql-server|sql-server-2005|database-connectivity
787,351
<p>Solving this problem is very easy:</p> <ol> <li>Go to control panel.</li> <li>search for services.</li> <li>Open Local services window from your search results</li> <li>Restart your MSSQLSERVER service.</li> </ol> <p>Screenshot of the steps:</p> <p><img src="https://i.stack.imgur.com/KAcPr.png" alt="Screenshot of...
7,765,548
Get a single value from dataSet in asp.net
<p>I am doing a query to get Title and RespondBY from the tbl_message table, I want to decrypt the Title before I do databinding to the repeater. How can I access the title value before doing databind.</p> <pre><code>string MysqlStatement = "SELECT Title, RespondBy FROM tbl_message WHERE tbl_message.MsgID = @MsgID";...
7,765,619
3
1
null
2011-10-14 09:20:14.037 UTC
1
2015-09-24 21:41:05.79 UTC
2011-11-14 22:49:00.51 UTC
null
3,043
null
931,064
null
1
12
c#|asp.net|dataset
88,283
<p>Probably, like following code part you can get the Title and try this coding before</p> <pre><code>rptList.DataSource = ds; rptList.DataBind(); </code></pre> <p>The following code part can get the Title from <a href="http://msdn.microsoft.com/en-us/library/system.data.dataset%28v=vs.71%29.aspx" rel="noreferrer...
11,520,189
Difference between shutdown and shutdownNow of Executor Service
<p>I want to know the basic difference between <code>shutdown()</code> and <code>shutdownNow()</code> for shutting down the <code>Executor Service</code>?</p> <p><strong><em>As far as I understood:</em></strong> </p> <p><code>shutdown()</code> should be used for <strong>graceful</strong> shutdown which means all task...
11,520,233
3
6
null
2012-07-17 10:02:09.293 UTC
38
2020-03-24 18:25:35.767 UTC
2020-03-24 18:25:35.767 UTC
null
1,498,427
null
1,527,084
null
1
82
java|java.util.concurrent
59,261
<p>In summary, you can think of it that way:</p> <ul> <li><code>shutdown()</code> will just tell the executor service that it can't accept new tasks, but the already submitted tasks continue to run</li> <li><code>shutdownNow()</code> will do the same AND will <strong>try to cancel</strong> the already submitted tasks ...
3,462,995
jQuery - keydown / keypress /keyup ENTERKEY detection?
<p>Trying to get jQuery to detect enter input, but space and other keys are detected, enter isn't detected. What's wrong below: </p> <pre><code>$("#entersomething").keyup(function(e) { alert("up"); var code = (e.keyCode ? e.keyCode : e.which); if (code==13) { e.preventDefault(); } if (cod...
3,463,044
4
2
null
2010-08-11 21:28:52.313 UTC
2
2020-02-06 15:42:35.26 UTC
2012-03-14 02:51:58.03 UTC
null
486,233
null
357,189
null
1
49
jquery
111,036
<p>JavaScript/jQuery</p> <pre><code>$("#entersomething").keyup(function(e){ var code = e.key; // recommended to use e.key, it's normalized across devices and languages if(code==="Enter") e.preventDefault(); if(code===" " || code==="Enter" || code===","|| code===";"){ $("#displaysomething").html($(...
3,770,100
How-to init a ListPreference to one of its values
<p>I'm trying to set a defaultValue to a ListPreference item.</p> <p>Here is an sample of my preference.xml file:</p> <pre><code>&lt;ListPreference android:key="notification_delay" android:title="@string/settings_push_delay" android:entries="@array/settings_push_delay_human_value" android:entryValues="@ar...
3,968,752
4
0
null
2010-09-22 14:11:42.047 UTC
12
2014-01-29 22:24:18.937 UTC
2011-08-08 21:22:49.053 UTC
null
39,709
null
384,483
null
1
72
android
43,236
<p>You need to specify the <em>value</em>. So to get the first entry selected by default specify <code>defaultValue="300"</code> in your example.</p>
3,799,935
Sort the rows according to the order specified in WHERE IN clause
<p>I have something like:</p> <pre><code>SELECT * FROM table WHERE id IN (118, 17, 113, 23, 72); </code></pre> <p>It returns the rows ordered by ID, ascending. Is there a way to get back the rows in the order specified in the <code>IN</code> clause?</p>
3,799,966
6
0
null
2010-09-26 21:39:35.013 UTC
16
2022-02-04 12:31:39.55 UTC
2022-02-04 12:31:39.55 UTC
null
87,015
null
378,861
null
1
58
mysql|sql|sql-order-by
60,166
<p>You should use &quot;ORDER BY <a href="https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_field" rel="noreferrer">FIELD</a>&quot;. So, for instance:</p> <pre><code>SELECT * FROM table WHERE id IN (118,17,113,23,72) ORDER BY FIELD(id,118,17,113,23,72) </code></pre>
3,345,857
How to get a list of IP connected in same network (subnet) using Java
<p>How do I get list of IP addresses for devices connected to my same subnet using Java?</p>
3,345,981
8
2
null
2010-07-27 16:41:26.207 UTC
24
2021-02-19 20:55:59.33 UTC
2016-01-05 21:39:41.477 UTC
null
2,676,531
null
260,990
null
1
43
java|networking
80,748
<p>this should work when the hosts on your network react to ICMP packages (ping) (>JDK 5):</p> <pre><code>public void checkHosts(String subnet){ int timeout=1000; for (int i=1;i&lt;255;i++){ String host=subnet + "." + i; if (InetAddress.getByName(host).isReachable(timeout)){ System.out.p...
3,345,348
How to specify a min but no max decimal using the range data annotation attribute?
<p>I would like to specify that a decimal field for a price must be >= 0 but I don't really want to impose a max value.</p> <p>Here's what I have so far...I'm not sure what the correct way to do this is.</p> <pre><code>[Range(typeof(decimal), "0", "??"] public decimal Price { get; set; } </code></pre>
3,352,614
10
1
null
2010-07-27 15:41:17.327 UTC
16
2020-05-19 16:29:48.66 UTC
2015-11-05 17:00:29.577 UTC
null
4,370,109
null
169,867
null
1
200
c#|.net|asp.net-mvc|data-annotations
206,272
<p>It seems there's no choice but to put in the max value manually. I was hoping there was some type of overload where you didn't need to specify one.</p> <pre><code>[Range(typeof(decimal), "0", "79228162514264337593543950335")] public decimal Price { get; set; } </code></pre>
3,762,561
How to animate the background color of a UILabel?
<p>This looks like it should work, but doesn't. The color turns green at once.</p> <pre><code>self.labelCorrection.backgroundColor = [UIColor whiteColor]; [UIView animateWithDuration:2.0 animations:^{ self.labelCorrection.backgroundColor = [UIColor greenColor]; }]; </code></pre>
3,762,950
11
1
null
2010-09-21 16:51:15.063 UTC
17
2018-06-25 02:25:57.44 UTC
2017-01-19 00:36:52.183 UTC
null
3,681,880
null
136
null
1
81
ios|iphone|core-animation
52,758
<p>I can't find it documented anywhere, but it appears the <code>backgroundColor</code> property of <code>UILabel</code> is not animatable, as your code works fine with a vanilla <code>UIView</code>. This hack appears to work, however, as long as you don't set the background color of the label view itself:</p> <pre><c...
3,921,616
Leaking this in constructor warning
<p>I'd like to avoid (most of the) warnings of Netbeans 6.9.1, and I have a problem with the <code>'Leaking this in constructor'</code> warning.</p> <p>I understand the problem, calling a method in the constructor and passing "<code>this</code>" is dangerous, since "<code>this</code>" may not have been fully initializ...
3,921,636
11
3
null
2010-10-13 07:36:17.54 UTC
17
2022-01-20 18:01:15.887 UTC
2017-01-01 21:32:05.923 UTC
null
179,850
null
21,348
null
1
89
java|netbeans|constructor|this|netbeans-6.9
58,341
<p>Since you make sure to put your <code>instances.add(this)</code> at the end of the constructor you <strike>should IMHO be safe to tell the compiler to simply suppress the warning</strike> <strong>(*)</strong>. A warning, by its nature, doesn't necessarily mean that there's something wrong, it just requires your atte...
3,985,619
How to calculate a logistic sigmoid function in Python?
<p>This is a logistic sigmoid function:</p> <p><img src="https://i.stack.imgur.com/SUuRi.png" alt="enter image description here"></p> <p>I know x. How can I calculate F(x) in Python now?</p> <p>Let's say x = 0.458.</p> <p>F(x) = ?</p>
3,985,630
16
0
null
2010-10-21 08:36:07.707 UTC
42
2021-07-25 22:22:43.65 UTC
2020-01-31 13:24:50.503 UTC
null
10,407,023
null
95,944
null
1
204
python|sigmoid
404,634
<p>This should do it:</p> <pre><code>import math def sigmoid(x): return 1 / (1 + math.exp(-x)) </code></pre> <p>And now you can test it by calling:</p> <pre><code>&gt;&gt;&gt; sigmoid(0.458) 0.61253961344091512 </code></pre> <p><strong>Update</strong>: Note that the above was mainly intended as a straight one-to...
8,311,090
Why not use heap sort always
<p>The <strong>Heap Sort</strong> sorting algorithm seems to have a worst case complexity of O(nlogn), and uses O(1) space for the sorting operation.</p> <p>This seems better than most sorting algorithms. Then, why wouldn't one use Heap Sort always as a sorting algorithm (and why do folks use sorting mechanisms like M...
8,312,128
5
7
null
2011-11-29 12:57:30.323 UTC
30
2014-06-16 07:40:30.357 UTC
2011-11-29 13:11:44.273 UTC
null
946,312
null
946,312
null
1
73
algorithm|sorting|heapsort
50,201
<p>A stable sort maintains the relative order of items that have the same key. For example, imagine your data set contains records with an employee id and a name. The initial order is:</p> <pre><code>1, Jim 2, George 3, Jim 4, Sally 5, George </code></pre> <p>You want to sort by name. A stable sort will arrange the i...
8,227,820
Alert Dialog Two Buttons
<p>Hello all i have a simple problem i have a alertDialog and i want it to show two buttons i have searched here but it seems the options before don't work anymore and are deprecated.</p> <p>Anyone know the new way of doing this you can see my code below that doesn't work.</p> <pre><code> Button share = (Button) fin...
8,227,964
7
0
null
2011-11-22 13:45:16.517 UTC
17
2021-02-04 06:56:02.297 UTC
2014-09-30 03:44:31.66 UTC
null
1,075,936
null
993,346
null
1
41
android|android-alertdialog
87,851
<p>try this</p> <pre><code>public void showDialog(Activity activity, String title, CharSequence message) { AlertDialog.Builder builder = new AlertDialog.Builder(activity); if (title != null) builder.setTitle(title); builder.setMessage(message); builder.setPositiveButton("OK", null); builder.setNe...
4,552,893
How to copy as admin in windows7
<p>My requirement is to copy the updated jar into our application directory in Program Files when a new update is available. I face an access denied problem while copying in Windows 7. Can someone kindly help me find out how to copy the file as admin? </p> <p>Any alternate solution for installing the update is welcome...
4,552,957
3
4
null
2010-12-29 09:25:28.28 UTC
null
2013-11-12 14:13:21.253 UTC
2012-06-09 07:34:21.247 UTC
null
306,651
null
556,944
null
1
4
java|windows-7|permissions|admin
38,659
<p>As a one time action, you could give additional permissions for your application directory for the specified user.</p> <ul> <li>From Windows Explorer, right-click specified folder. </li> <li>Goto Properties</li> <li>Click on Security tab</li> <li>Click on Edit...</li> <li>Change permission as suitable</li> </ul>
4,136,632
How to kill a child thread with Ctrl+C?
<p>I would like to stop the execution of a process with <kbd>Ctrl</kbd>+<kbd>C</kbd> in Python. But I have read somewhere that <code>KeyboardInterrupt</code> exceptions are only raised in the main thread. I have also read that the main thread is blocked while the child thread executes. So how can I kill the child threa...
4,749,550
3
2
null
2010-11-09 17:30:52.687 UTC
8
2022-02-04 22:04:36.927 UTC
2021-07-07 14:28:07.993 UTC
null
2,326,961
null
304,932
null
1
22
python|multithreading|kill|keyboardinterrupt
38,687
<p>The problem there is that you are using <code>thread1.join()</code>, which will cause your program to wait until that thread finishes to continue.</p> <p>The signals will always be caught by the main process, because it's the one that receives the signals, it's the process that has threads.</p> <p>Doing it as you ...
4,387,419
Why does ArrayList have "implements List"?
<p>In the Collection Framework we have the interface <code>List</code> and the class <code>AbstractList</code>:</p> <pre><code>AbstractList implements List </code></pre> <p>And <code>ArrayList</code> extends <code>AbstractList</code> and </p> <pre><code>implements List </code></pre> <p>My question: why does <code>A...
4,387,445
3
0
null
2010-12-08 12:29:56.903 UTC
10
2012-12-20 14:12:25.667 UTC
2012-12-20 14:12:25.667 UTC
null
40,342
null
471,011
null
1
41
java|collections
7,458
<p>Yes. It could've been omitted. But thus it is immediately visible that it is a <code>List</code>. Otherwise an extra click through the code / documentation would be required. I think that's the reason - clarity.</p> <p>And to add what Joeri Hendrickx commented - it is for the purpose of showing that <code>ArrayList...
4,047,427
How does async works in C#?
<p>Microsoft announced the <a href="http://msdn.microsoft.com/en-us/vstudio/async.aspx" rel="nofollow noreferrer">Visual Studio Async CTP</a> today (October 28, 2010) that introduces the <code>async</code> and <code>await</code> keywords into C#/VB for asynchronous method execution.</p> <p>First I thought that the comp...
4,047,607
3
0
null
2010-10-28 21:47:43.393 UTC
20
2022-07-18 20:06:05.313 UTC
2021-11-01 11:33:18.33 UTC
null
11,178,549
null
40,347
null
1
47
c#|.net|vb.net|asynchronous|async-await
14,482
<p>It works similarly to the <code>yield return</code> keyword in C# 2.0.</p> <p>An asynchronous method is not actually an ordinary sequential method. It is compiled into a state machine (an object) with some state (local variables are turned into fields of the object). Each block of code between two uses of <code>awa...
4,669,704
How do I install the Visual Web Developer feature for Visual Studio 2010
<p>I have Visual Studio 2010 Premium installed, and I want to install the Silverlight 4 SDK.</p> <p>The SDK says that it requires the Visual Web Developer feature for Visual Studio 2010. Any idea as to how to install, or activate this feature?</p> <hr> <p><img src="https://i.stack.imgur.com/orCLl.png" alt="enter im...
4,669,738
4
1
null
2011-01-12 14:09:51.41 UTC
2
2017-03-08 07:49:59.967 UTC
2013-03-26 11:57:29.337 UTC
null
284,795
null
394,157
null
1
33
visual-studio|visual-studio-2010|visual-web-developer
53,894
<p>Run the Visual Studio installer and double check the installed components. Make sure Web Developer is enabled (Web Developer should be part of the standard installation for VS 2010 Premium) and then hit OK.</p> <p>Once the installation has completed try installing the Silverlight SDK again.</p>
4,492,678
Swap rows with columns (transposition) of a matrix in javascript
<p>For instance I have a matrix like this:</p> <pre><code>|1 2 3| |4 5 6| |7 8 9| </code></pre> <p>and I need it to convert into a matrix like this:</p> <pre><code>|1 4 7| |2 5 8| |3 6 9| </code></pre> <p>What is the best and optimal way to achieve this goal?</p>
4,492,703
5
0
null
2010-12-20 18:31:41.15 UTC
8
2019-05-24 18:56:45.953 UTC
2015-10-10 23:03:08.527 UTC
null
3,183,756
null
282,887
null
1
35
javascript|matrix|multidimensional-array|swap
62,072
<p>See article: <a href="http://www.shamasis.net/2010/02/transpose-an-array-in-javascript-and-jquery" rel="noreferrer">Transpose An Array In JavaScript and jQuery</a></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...
4,050,381
Regular expression for checking if capital letters are found consecutively in a string
<p>I want to know the regexp for the following case:</p> <p>The string should contain only alphabetic letters. It must start with a capital letter followed by small letter. Then it can be small letters or capital letters.</p> <pre><code>^[A-Z][a-z][A-Za-z]*$ </code></pre> <p>But the string must also not contain any con...
4,052,496
5
0
null
2010-10-29 08:54:06.347 UTC
29
2021-11-10 01:45:50.787 UTC
2021-11-10 01:34:13.33 UTC
null
63,550
null
454,660
null
1
78
regex|capitalize
251,956
<p>Take a look at <a href="https://stackoverflow.com/questions/4050381/regular-expression-for-checking-if-capital-letters-are-found-consecutively-in-a#answer-4052294">tchrist's answer</a>, especially if you develop for the web or something more &quot;international&quot;.</p> <p><a href="https://stackoverflow.com/questi...
4,641,476
Using Dynamic Memory allocation for arrays
<p>How am I supposed to use dynamic memory allocations for arrays?</p> <p>For example here is the following array in which i read individual words from a .txt file and save them word by word in the array:</p> <p>Code:</p> <pre><code>char words[1000][15]; </code></pre> <p>Here 1000 defines the number of words the ar...
4,641,532
8
0
null
2011-01-09 20:10:05.427 UTC
5
2015-04-01 06:27:24.053 UTC
2011-01-09 20:13:35.59 UTC
null
260,990
null
569,085
null
1
13
c|arrays|memory|dynamic-memory-allocation
80,580
<p>You use pointers.</p> <p>Specifically, you use a pointer to an address, and using a standard c library function calls, you ask the operating system to expand the heap to allow you to store what you need to.</p> <p>Now, it might refuse, which you will need to handle.</p> <p>The next question becomes - how do you a...
4,389,572
How to fetch a non-ascii url with urlopen?
<p>I need to fetch data from a URL with non-ascii characters but urllib2.urlopen refuses to open the resource and raises:</p> <pre><code>UnicodeEncodeError: 'ascii' codec can't encode character u'\u0131' in position 26: ordinal not in range(128) </code></pre> <p>I know the URL is not standards compliant but I have no...
4,391,299
10
0
null
2010-12-08 16:06:33.36 UTC
21
2021-10-17 06:18:56.15 UTC
2021-04-25 16:05:07.48 UTC
null
355,230
null
287,923
null
1
51
python|unicode|urllib2|non-ascii-characters|urlopen
34,232
<p>Strictly speaking URIs can't contain non-ASCII characters; what you have there is an <a href="http://en.wikipedia.org/wiki/Internationalized_Resource_Identifier">IRI</a>.</p> <p>To convert an IRI to a plain ASCII URI:</p> <ul> <li><p>non-ASCII characters in the hostname part of the address have to be encoded using...
14,540,262
How does git push work with android's repo tool?
<p>I'm used to using <code>git</code> with a single repository. However, I've lately been dabbling with Android development and am trying to wrap my head around <code>repo</code>. I have set up some custom git repos by creating xmls in the <code>.repo/local_manifests</code> directory (I'm using repo 1.19) and <code>rep...
14,545,270
1
0
null
2013-01-26 18:42:51.137 UTC
9
2013-01-27 07:11:54.47 UTC
null
null
null
null
817,950
null
1
13
android|git|github|gerrit|repository
10,973
<p>Technically, if you do</p> <pre><code>git checkout origin/master </code></pre> <p>you immediately get into detached HEAD state.</p> <p>For better or worse, this is exactly what <code>repo sync</code> does by default - such that every one of your repositories listed in manifest is in detached HEAD state after fres...
14,707,742
How to indent my code in codeblocks?
<p>What are the best code blocks short cuts ? Also is there some way we can directly indent all our code ? In addition how can we move through the active tabs in codeblocks ? </p>
14,711,209
6
1
null
2013-02-05 12:37:01.21 UTC
4
2020-11-17 18:44:58.527 UTC
null
null
null
null
1,737,817
null
1
15
codeblocks
65,135
<p>You (these are the default settings I believe) can select a block of code and press the <kbd>Tab</kbd> key. This will <strong>indent</strong> the entire block. </p> <p>So for indenting a whole file: <kbd>Ctrl</kbd> + <kbd>A</kbd>, then <kbd>Tab</kbd>. </p> <p>In addition, you can use <kbd>Shift</kbd> + <kbd>Tab</k...
14,904,776
Parse JavaScript with jsoup
<p>In an <code>HTML</code> page, I want to pick the value of a <code>javascript</code> variable.<br /> Below is the snippet of <code>HTML</code> page:</p> <pre><code>&lt;input id=&quot;hidval&quot; value=&quot;&quot; type=&quot;hidden&quot;&gt; &lt;form method=&quot;post&quot; style=&quot;padding: 0px;margin: 0px;&quo...
14,925,848
2
3
null
2013-02-15 22:58:04.31 UTC
6
2021-11-14 20:04:47.973 UTC
2021-11-14 15:23:30.287 UTC
null
8,583,692
null
1,175,065
null
1
16
javascript|java|html|kotlin|jsoup
40,576
<p>Since jsoup isn't a javascript library you have two ways to solve this:</p> <h2>A. Use a javascript library</h2> <ul> <li><p><strong>Pro:</strong></p> <ul> <li>Full Javascript support</li> </ul></li> <li><p><strong>Con:</strong></p> <ul> <li>Additional libraray / dependencies</li> </ul></li> </ul> <h2>B. Use Js...
14,878,706
Merge xml files with nested elements without external libraries
<p>I am trying to merge multiple XML files together using Python and no external libraries. The XML files have nested elements.</p> <p><strong>Sample File 1:</strong></p> <pre><code>&lt;root&gt; &lt;element1&gt;textA&lt;/element1&gt; &lt;elements&gt; &lt;nested1&gt;text now&lt;/nested1&gt; &lt;/elements&gt;...
14,879,370
3
0
null
2013-02-14 15:51:02.93 UTC
13
2021-05-11 16:00:52.753 UTC
2017-05-23 11:55:10.85 UTC
null
-1
null
1,561,176
null
1
17
python|xml|python-2.7|elementtree
23,317
<p>What the code you posted is doing is combining all the elements regardless of whether or not an element with the same tag already exists. So you need to iterate over the elements and manually check and combine them the way you see fit, because it is not a standard way of handling XML files. I can't explain it better...
14,429,703
When to call .join() on a process?
<p>I am reading various tutorials on the multiprocessing module in Python, and am having trouble understanding why/when to call <code>process.join()</code>. For example, I stumbled across this example:</p> <pre><code>nums = range(100000) nprocs = 4 def worker(nums, out_q): """ The worker function, invoked in a pr...
14,430,044
3
3
null
2013-01-20 21:45:34.94 UTC
15
2020-03-09 22:12:58.827 UTC
2013-01-20 22:09:30.4 UTC
null
815,632
null
1,356,561
null
1
36
python|multiprocessing
40,750
<p>Try to run this:</p> <pre><code>import math import time from multiprocessing import Queue import multiprocessing def factorize_naive(n): factors = [] for div in range(2, int(n**.5)+1): while not n % div: factors.append(div) n //= div if n != 1: factors.append(n) ...
14,665,491
Why are @Scripts and @Styles commands not be recognized in MVC4 Razor layout file?
<p>The following MVC4 Razor layout file loads several script and css bundles created in Bundle.config.</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html class="no-js" lang="en"&gt; &lt;head&gt; &lt;meta charset="utf-8" /&gt; &lt;title&gt;XXX Beta&lt;/title&gt; @Scripts.Render( "~/bundles/bundle_jquery", "~/bundl...
14,665,528
7
0
null
2013-02-02 19:14:32.42 UTC
8
2019-01-10 03:30:50 UTC
null
null
null
null
94,508
null
1
41
asp.net|asp.net-mvc|razor|asp.net-mvc-4
62,506
<p>Make sure that the <code>System.Web.Optimization.dll</code> assembly has been referenced in your project and that the <code>&lt;add namespace="System.Web.Optimization"/&gt;</code> namespace has been added to your <code>~/Views/web.config</code> file (not <code>~/web.config</code> file):</p> <pre><code>&lt;system.we...
14,358,817
Best practice for localization and globalization of strings and labels
<p>I'm a member of a team with more than 20 developers. Each developer works on a separate module (something near 10 modules). In each module we might have at least 50 CRUD forms, which means that we currently have near 500 <strong>add buttons</strong>, <strong>save buttons</strong>, <strong>edit buttons</strong>, etc....
14,359,147
3
1
null
2013-01-16 12:46:05.32 UTC
48
2016-12-26 19:38:15.57 UTC
2016-12-26 19:38:15.57 UTC
null
3,100,587
user1968030
null
null
1
129
javascript|localization|translation|client-side|globalization
134,771
<p>As far as I know, there's a good library called <code>localeplanet</code> for Localization and Internationalization in JavaScript. Furthermore, I think it's native and has no dependencies to other libraries (e.g. jQuery) </p> <p>Here's the website of library: <a href="http://www.localeplanet.com/" rel="noreferrer...
14,541,823
How to use concerns in Rails 4
<p>The default Rails 4 project generator now creates the directory "concerns" under controllers and models. I have found some explanations about how to use routing concerns, but nothing about controllers or models.</p> <p>I am pretty sure it has to do with the current "DCI trend" in the community and would like to giv...
15,078,070
6
0
null
2013-01-26 21:36:27.56 UTC
238
2020-03-28 23:09:45.85 UTC
2015-12-14 10:04:37.48 UTC
null
2,202,702
null
784,270
null
1
642
ruby-on-rails|ruby-on-rails-4|dci
246,277
<p>So I found it out by myself. It is actually a pretty simple but powerful concept. It has to do with code reuse as in the example below. Basically, the idea is to extract common and / or context specific chunks of code in order to clean up the models and avoid them getting too fat and messy.</p> <p>As an example, I'...
62,793,544
Efficient way to remove half of the duplicate items in a list
<p>If I have a list say <code>l = [1, 8, 8, 8, 1, 3, 3, 8]</code> and it's guaranteed that every element occurs an even number of times, how do I make a list with all elements of <code>l</code> now occurring <code>n/2</code> times. So since <code>1</code> occurred <code>2</code> times, it should now occur once. Since <...
62,793,817
12
9
null
2020-07-08 11:14:08.523 UTC
12
2020-07-30 21:25:16.063 UTC
2020-07-22 20:16:37.083 UTC
null
5,446,749
null
13,064,271
null
1
60
python|algorithm
11,016
<p>If order isn't important, a way would be to get the odd or even indexes only after a sort. Those lists will be the same so you only need one of them.</p> <pre><code>l = [1,8,8,8,1,3,3,8] l.sort() # Get all odd indexes odd = l[1::2] # Get all even indexes even = l[::2] print(odd) print(odd == even) </code></pre> <...
2,905,692
PostgreSQL - How to convert seconds in a numeric field to HH:MM:SS
<p>I'm new to PostgreSQL (I have been using MS SQL for many years) and need to convert a numeric column which contains a time in seconds to HH:MM:SS format.</p> <p>I have Googled and found that <code>to_char(interval '1000s', 'HH24:MI:SS')</code> works so I am attempting to use this with my field name:</p> <p><code>t...
2,905,726
2
4
null
2010-05-25 14:42:16.37 UTC
9
2020-01-13 08:26:22.85 UTC
null
null
null
null
243,189
null
1
32
datetime|postgresql
54,770
<pre><code>SELECT TO_CHAR('1000 second'::interval, 'HH24:MI:SS') </code></pre> <p>or, in your case</p> <pre><code>SELECT TO_CHAR((mycolumn || ' second')::interval, 'HH24:MI:SS') FROM mytable </code></pre>
2,804,007
selectively execute task in ssis control flow
<p>I have a SSIS package with a control flow containing a bunch of execute sql tasks in a sequence.</p> <p>I need to check a flag for each of the tasks and run the task if it is set, if not skip and go to the next one.</p> <p>Each of the these task executes a stored proc. So i can check in the proc and "Return" if n...
2,804,229
2
0
null
2010-05-10 15:37:03.277 UTC
1
2019-10-17 21:27:26.71 UTC
2010-05-10 15:45:37.543 UTC
user65663
null
null
212,469
null
1
35
sql-server|sql-server-2008|ssis
56,469
<p>Between your control flow tasks, click on the arrow and choose Edit. When you do this, you get a dialog that allows you to check the "constraint" (success, completion or failure) of the task, an "expression" (i.e. you can have your execute sql task return a value, store that value in a variable, and check the value...
41,337,477
Select non-null rows from a specific column in a DataFrame and take a sub-selection of other columns
<p>I have a dataFrame which has several coulmns, so i choosed some of its coulmns to create a variable like this <code>xtrain = df[['Age','Fare', 'Group_Size','deck', 'Pclass', 'Title' ]]</code> i want to drop from these coulmns all raws that the Survive coulmn in the main dataFrame is nan.</p>
41,337,493
2
0
null
2016-12-27 00:06:47.46 UTC
11
2019-03-08 22:56:48.027 UTC
2019-03-08 22:56:48.027 UTC
null
3,367,799
user7308269
null
null
1
33
python|pandas
94,842
<p>You can pass a boolean mask to your df based on <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.notnull.html" rel="noreferrer"><code>notnull()</code></a> of 'Survive' column and select the cols of interest:</p> <pre><code>In [2]: # make some data df = pd.DataFrame(np.random.randn(5,7), ...
35,206,125
How can I find and update values in an array of objects?
<p>I have an array of objects. I want to find by some field, and then to change it:</p> <pre><code>var item = {...} var items = [{id:2}, {id:2}, {id:2}]; var foundItem = items.find(x =&gt; x.id == item.id); foundItem = item; </code></pre> <p>I want it to change the original object. How? (I don't care if it will be in ...
35,206,193
10
1
null
2016-02-04 16:17:40.857 UTC
54
2022-07-25 21:32:23.803 UTC
2022-01-06 13:48:51.213 UTC
null
1,264,804
null
3,712,353
null
1
237
javascript|arrays|ecmascript-6|lodash
353,338
<p>You can use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex" rel="noreferrer">findIndex</a> to find the index in the array of the object and replace it as required:</p> <pre><code>var item = {...} var items = [{id:2}, {id:2}, {id:2}]; var foundIndex = items...
31,240,148
Spark specify multiple column conditions for dataframe join
<p>How to give more column conditions when joining two dataframes. For example I want to run the following :</p> <pre><code>val Lead_all = Leads.join(Utm_Master, Leaddetails.columns("LeadSource","Utm_Source","Utm_Medium","Utm_Campaign") == Utm_Master.columns("LeadSource","Utm_Source","Utm_Medium","Utm_Campai...
31,247,623
9
0
null
2015-07-06 07:35:53.51 UTC
26
2019-11-17 15:57:37.17 UTC
2015-07-07 10:46:36.203 UTC
null
1,560,062
null
568,109
null
1
52
apache-spark|apache-spark-sql|rdd
140,624
<p>There is a Spark <a href="https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala#L514" rel="noreferrer">column/expression API join</a> for such case:</p> <pre class="lang-scala prettyprint-override"><code>Leaddetails.join( Utm_Master, Leaddetails("LeadSourc...
27,435,798
unhashable type: 'dict' Type Error
<p>Suppose I have this dictionary:</p> <pre><code>items = {1: {'title': u'testing123', 'description': u'testing456'}, 2: {'description': u'testing123', 'description': u'testing456'}, 3: {'description': u'testing123', 'description': u'testing456'}, 4: {'description': u'testing123', 'description': u'testing456'}, 5: {'d...
27,435,964
3
0
null
2014-12-12 02:14:49.313 UTC
3
2014-12-12 02:54:18.483 UTC
2017-05-23 12:25:08.173 UTC
null
-1
null
4,321,788
null
1
3
python|dictionary|python-3.3
45,171
<p>dic.values() return list of dict</p> <pre><code>&gt;&gt;&gt; for key, value in items.items(): ... print dic.values() ... [{'description': u'testing456', 'title': u'testing123'}] [{'description': u'testing456', 'title': u'testing123'}] [{'description': u'testing456', 'title': u'testing123'}] [{'description': u't...
54,069,863
Swap two rows in a numpy array in python
<p>How to swap xth and yth rows of the 2-D NumPy array? x &amp; y are inputs provided by the user. Lets say x = 0 &amp; y =2 , and the input array is as below:</p> <pre><code>a = [[4 3 1] [5 7 0] [9 9 3] [8 2 4]] Expected Output : [[9 9 3] [5 7 0] [4 3 1] [8 2 4]] </code></pre> ...
54,069,951
1
0
null
2019-01-07 07:06:39.66 UTC
4
2019-01-07 07:13:34.557 UTC
null
null
null
null
10,855,019
null
1
39
python|arrays|numpy|swap
63,144
<p>Put the index as a whole:</p> <pre><code>a[[x, y]] = a[[y, x]] </code></pre> <p>With your example:</p> <pre><code>a = np.array([[4,3,1], [5,7,0], [9,9,3], [8,2,4]]) a # array([[4, 3, 1], # [5, 7, 0], # [9, 9, 3], # [8, 2, 4]]) a[[0, 2]] = a[[2, 0]] a # array([[9, 9, 3], # [5, 7, 0], ...
53,842,697
How do you add a label (title text) to a Checkbox in Flutter?
<p>I am playing with Checkbox to see how it works, but I don't see a title option with it. </p> <pre><code>Checkbox( title: Text("Checkbox label"), // The named parameter 'title' isn't defined. value: true, onChanged: (newValue) { }, ); </code></pre> <p>Do I have to create my own widget to add a title to it?</...
53,842,698
4
0
null
2018-12-18 23:43:05.307 UTC
8
2022-06-20 17:44:33.273 UTC
2019-05-02 16:43:04.96 UTC
null
3,681,880
null
3,681,880
null
1
40
checkbox|dart|flutter
40,888
<p>If you need a <a href="https://docs.flutter.io/flutter/material/Checkbox-class.html" rel="noreferrer"><code>Checkbox</code></a> with a label then you can use a <a href="https://docs.flutter.io/flutter/material/CheckboxListTile-class.html" rel="noreferrer"><code>CheckboxListTile</code></a>. </p> <p><a href="https://...
36,133,430
How to call function every 2 mins in angular2?
<p>How do I call a save function every two minutes in Angular2?</p>
36,133,464
1
0
null
2016-03-21 14:16:24.39 UTC
7
2019-08-23 15:57:27.237 UTC
2017-06-20 11:15:24.553 UTC
user663031
null
null
3,953,749
null
1
26
angular|ionic2
49,171
<p><strong>rxjs 6</strong></p> <pre><code> import { interval } from 'rxjs'; interval(2000 * 60).subscribe(x =&gt; { doSomething(); }); </code></pre> <p><strong>rxjs 5</strong></p> <p>You can either use </p> <pre><code>import {Observable} from 'rxjs'; // Angular 6 // import {Observable} from 'rxjs/Rx'; //...
50,032,950
Google gmail script that triggers on incoming email
<p>I've been reading through <a href="https://developers.google.com/gmail/add-ons/how-tos/building" rel="noreferrer" title="gmail add-ons">gmail addons</a>. They have contextual triggers that trigger when you open an email.</p> <p>Is it possible to trigger a service when an email is received by me? Best I can find is ...
50,033,834
4
1
null
2018-04-26 00:04:43.267 UTC
9
2022-03-10 02:42:48.167 UTC
2018-04-26 00:40:49.56 UTC
null
1,595,451
null
843,443
null
1
20
google-apps-script|gmail|gmail-addons
18,545
<p>You can't create a trigger for every email, however you can do something similar <a href="https://stackoverflow.com/questions/36108478/how-to-trigger-a-google-apps-script-once-an-email-get-in-the-inbox">as described in this answer</a>. </p> <p>For example you can:</p> <ol> <li><p>Set up a filter that puts a specia...
22,782,932
MySQL get first non null value after group by
<p>I have a large table with data that is not unique but needs to be. This table is a result of multiple union selects so is not an actual table. I cannot make it an actual table for other reasons.</p> <p>All of the UNION'd tables have an email column which will eventually be unique. The resulting records look like thi...
22,783,112
2
0
null
2014-04-01 10:18:11.38 UTC
8
2021-04-16 17:07:14.387 UTC
2021-04-16 17:07:14.387 UTC
null
3,964,927
null
104,452
null
1
39
mysql|group-by|group-concat
26,917
<p>Try using <code>MAX</code>, like this:</p> <pre><code>SELECT email, MAX(`name`) FROM ( SELECT email, `name` FROM multiple_tables_and_unions ) AS emails GROUP BY email </code></pre>
46,458,657
non-nominal type X does not support explicit initialization
<p>I'm trying to understand what I'm doing wrong with generics in swift.</p> <p>I created this sample playground</p> <pre><code>import UIKit public protocol MainControllerToModelInterface : class { func addGoal() init() } public protocol MainViewControllerInterface : class { associatedtype MODELVIEW ...
46,458,701
3
0
null
2017-09-27 23:22:19.11 UTC
1
2017-09-28 17:46:37.347 UTC
2017-09-28 17:46:37.347 UTC
null
2,104,263
null
2,104,263
null
1
32
ios|swift|xcode|generics|swift4
15,362
<p>You just need to use <code>init</code> explicitly whenever you're initializing a generic parameter rather than a "real" type:</p> <pre><code>self.c = C.init(modelView: m) </code></pre>
37,548,408
D3 4.0 rangeRoundBands equivalent?
<p>I see a lot of D3 code that has something like this:</p> <pre><code>var x = d3.scale.ordinal() .rangeRoundBands([0, width], .1); </code></pre> <p>As of D3 version 4.0 <code>d3.scale.ordinal()</code> is now <code>d3.scaleOrdinal</code> and <code>rangeRoundBands</code> seems to be gone.</p> <pre><code>&gt; d3.sca...
37,548,699
3
0
null
2016-05-31 14:25:00.383 UTC
10
2017-06-28 14:05:57.52 UTC
2017-04-24 08:25:52.41 UTC
null
4,155,792
null
130,006
null
1
65
javascript|d3.js
41,496
<p>In D3 4.x <code>rangeRoundBands</code> was moved to the new <em>Band</em> scale:</p> <pre><code>d3.scaleBand() .range([range]) .round([round]); </code></pre> <p>That's equivalent to:</p> <pre><code>d3.scaleBand() .rangeRound([range]); </code></pre> <p>Here is the API: <a href="https://github.com/d3/d...
37,262,047
React with TypeScript - define defaultProps in stateless function
<p>I'm using React with TypeScript and I've created stateless function. I've removed useless code from the example for readability.</p> <pre><code>interface CenterBoxProps extends React.Props&lt;CenterBoxProps&gt; { minHeight?: number; } export const CenterBox = (props: CenterBoxProps) =&gt; { const minHeight...
37,262,331
7
0
null
2016-05-16 19:46:04.79 UTC
11
2020-02-14 23:16:17.387 UTC
2016-05-16 20:05:41.28 UTC
null
382,971
null
382,971
null
1
29
reactjs|typescript
30,836
<p>After 2 hours of looking for solution... <strong>it's working</strong>.</p> <p>If you want to define <code>defaultProps</code>, your arrow function should look like:</p> <pre><code>export const CenterBox: React.SFC&lt;CenterBoxProps&gt; = props =&gt; { (...) }; </code></pre> <p>Then you can define props like:...
31,484,742
(0xE8008018): The identity used to sign the executable is no longer valid
<p>I'm trying to debug my app on Xcode and I'm having the following error:</p> <pre><code>The identity used to sign the executable is no longer valid. Please verify that your device’s clock is properly set, and that your signing certificate is not expired. (0xE8008018). </code></pre> <p><img src="https://i.stack.im...
31,485,634
11
1
null
2015-07-17 21:08:00.7 UTC
5
2016-06-04 09:28:01.017 UTC
2015-07-17 21:33:31.047 UTC
null
833,031
null
833,031
null
1
44
ios|xcode
35,371
<p>After hours of investigating, the shell script for signing the project was failing at some point, without reporting back to Xcode.</p> <p>I noticed that in the DerivedData folder (found in <code>/Users/yourUsername/Library/Developer/Xcode/DerivedData/</code>) of Xcode there were two folders with the same name of my...
41,859,311
Cumsum as a new column in an existing Pandas data
<p>I have a pandas dataframe defined as:</p> <pre><code>A B SUM_C 1 1 10 1 2 20 </code></pre> <p>I would like to do a cumulative sum of SUM_C and add it as a new column to the same dataframe. In other words, my end goal is to have a dataframe that looks like below:</p> <pre><code>A B SU...
41,859,343
1
0
null
2017-01-25 18:48:09.93 UTC
6
2020-11-29 17:32:23.79 UTC
2018-08-31 10:06:50.543 UTC
null
7,053,679
null
1,124,702
null
1
34
python|pandas|dataframe|cumsum
45,490
<p>Just apply <code>cumsum</code> on the <code>pandas.Series</code> <code>df['SUM_C']</code> and assign it to a new column:</p> <pre><code>df['CUMSUM_C'] = df['SUM_C'].cumsum() </code></pre> <p>Result:</p> <pre><code>df Out[34]: A B SUM_C CUMSUM_C 0 1 1 10 10 1 1 2 20 30 </code></pre>
2,881,682
How to insert Arabic characters into SQL database?
<p>How can I insert Arabic characters into a SQL Server database? I tried to insert Arabic data into a table and the Arabic characters in the insert script were inserted as <code>'??????'</code> in the table.</p> <p>I tried to directly paste the data into the table through SQL Server Management Studio and the Arabic ch...
2,881,793
3
2
null
2010-05-21 11:42:14.047 UTC
8
2022-07-06 06:16:39.14 UTC
2021-09-23 08:29:49.757 UTC
null
1,127,428
null
227,809
null
1
27
sql|sql-server|tsql|insert|arabic
44,689
<p>For the field to be able to store unicode characters, you have to use the type <code>nvarchar</code> (or other similar like <code>ntext</code>, <code>nchar</code>).</p> <p>To insert the unicode characters in the database you have to send the text as unicode by using a parameter type like <code>nvarchar</code> / <co...
3,107,151
Persistent data structures in Scala
<p>Are all immutable data structures in Scala persistent? If not, which of them are and which not? What are the behavioural characteristics of those which are persistent? Also, how do they compare to the persistent data structures in Clojure?</p>
3,108,380
4
0
null
2010-06-24 03:57:56.333 UTC
18
2012-03-12 10:30:28.033 UTC
null
null
null
null
126,916
null
1
27
data-structures|scala|clojure|persistent
10,782
<p>Scala's immutable data structures are all persistent, in the sense that the old value is maintained by an `update' operation. In fact, I do not know of a difference between immutable and persistent; for me the two terms are aliases.</p> <p>Two of Scala's 2.8 immutable data structures are vectors and hash tries, rep...
28,889,977
R boxplot: How to customize the appearance of the box-and-whisker plots (e.g., remove lines or borders, change symbol of outliers)
<p>Today, I was wondering how to customize the appearance of the box-and-whisker plots. E.g., I wanted to remove the line around the box. However, the problem is, that the <code>border</code> argument changes the color of all lines of the box-and-whisker plots simultaneously. So, if one has the great idea to set <code>...
28,890,144
2
0
null
2015-03-05 23:44:04.277 UTC
18
2018-01-24 21:07:22.043 UTC
2018-01-24 21:07:22.043 UTC
null
3,162,788
null
3,162,788
null
1
12
r|shapes|boxplot|appearance|linestyle
39,142
<p>For complete documentation you should look at <code>?bxp</code> (linked from the <code>...</code> description in <code>?boxplot</code>, and in the "See Also" in <code>?boxplot</code>, and in the <code>pars</code> description in <code>?boxplot</code>.). It documents that <code>outpch</code> can change the shape of th...
37,697,866
NEST Conditional filter query with multiple terms
<p>I would like to do a ElasticSearch query like this:</p> <pre><code>{ "query" : { "bool" : { "filter" : [ { "terms" : { "name" : ["name1", "name2"] } }, ...
37,708,493
3
0
null
2016-06-08 09:00:05.873 UTC
9
2018-12-05 10:40:08.157 UTC
null
null
null
null
617,413
null
1
23
c#|elasticsearch|nest
24,792
<p>You can create a list of filters before you make a query if you want to check conditional filters as shown below:</p> <pre><code>var nameList = new[] {"a", "b"}; var colorList = new[] {1, 2}; var filters = new List&lt;Func&lt;QueryContainerDescriptor&lt;MyDocument&gt;, QueryContainer&gt;&gt;(); if (nameList.Any())...
46,316,259
Timer countdown Angular 2
<p>I'm trying to make a countdown timer for my Ionic2 app, the thing is that I was using this method from now <a href="https://stackoverflow.com/a/44489685/4329781"><code>countdown timer</code></a> but now I have to create the countdown like 30:00 min, what's the better way to do it? Time could change, and if I want to...
46,316,755
3
0
null
2017-09-20 07:50:12.413 UTC
4
2021-05-23 21:58:10.313 UTC
2019-05-11 07:47:03.693 UTC
null
5,468,463
null
4,329,781
null
1
10
javascript|angular|typescript|timer|countdown
39,621
<p>You can 'listen' to the timer and trigger the action when the countdown is 0. And to display the timer, use a pipe. </p> <p><strong>HTML</strong></p> <pre><code>{{counter | formatTime}} </code></pre> <p><strong>TypeScript</strong></p> <pre><code> countDown:Subscription; counter = 1800; tick = 1000; ng...
37,512,662
Is there anything wrong with using I/O + ManagedBlocker in Java8 parallelStream()?
<p>The default "paralellStream()" in Java 8 uses the common <code>ForkJoinPool</code> which may be a latency problem if the common Pool threads are exhausted when a task is submitted. However in many cases enough CPU power is available and the tasks are short enough so that this is not a problem. If we do have some lon...
37,518,272
1
0
null
2016-05-29 17:06:45.08 UTC
10
2016-05-30 05:37:44.47 UTC
2017-05-23 11:58:47.887 UTC
null
-1
null
327,301
null
1
28
java|java-stream
3,279
<p>In short, yes, there are some problems with your solution. It definitely improves using blocking code inside parallel stream, and some third-party libraries provide similar solution (see, for example, <a href="http://www.jooq.org/products/jOO%CE%BB/javadoc/0.9.11/org/jooq/lambda/Blocking.html" rel="noreferrer"><code...
49,050,799
What does 'pending' test mean in Mocha, and how can I make it pass/fail?
<p>I am running my tests and noticed:</p> <pre><code>18 passing (150ms) 1 pending </code></pre> <p>I haven't seen this before. Previously test either passed, or failed. Timeouts caused failures. I can see which test is failing because it's also blue. But it has a timeout on it. Here's a simplified version:</p> <pre>...
49,051,847
4
0
null
2018-03-01 13:31:50.817 UTC
4
2019-05-07 07:59:02.923 UTC
2018-03-01 14:26:18.643 UTC
null
123,671
null
123,671
null
1
30
javascript|unit-testing|mocha.js
14,782
<p>The test <a href="https://mochajs.org/#pending-tests" rel="nofollow noreferrer">had a callback</a> (ie, an actual function, not done) but refactoring the code solved the issue. The issue was how code that expects error should run:</p> <pre><code>test('Errors when bad thing happens', function() { var gotExpectedEr...
2,611,747
Rails Resque workers fail with PGError: server closed the connection unexpectedly
<p>I have site running rails application and resque workers running in production mode, on Ubuntu 9.10, Rails 2.3.4, ruby-ee 2010.01, PostgreSQL 8.4.2</p> <p>Workers constantly raised errors: PGError: server closed the connection unexpectedly.</p> <p>My best guess is that master resque process establishes connection ...
2,612,210
5
0
null
2010-04-10 00:27:45.943 UTC
14
2013-09-02 22:20:42.71 UTC
null
null
null
null
313,262
null
1
20
ruby-on-rails|ruby|postgresql|activerecord|resque
7,345
<p>When I created <a href="http://github.com/francois/nestor" rel="nofollow noreferrer">Nestor</a>, I had the same kind of problem. The solution was to re-establish the connection in the forked process. See the relevant code at <a href="http://github.com/francois/nestor/blob/master/lib/nestor/mappers/rails/test/unit.rb...
3,162,551
How do I mock static methods in a class with easymock?
<p>Suppose I have a class like so:</p> <pre><code>public class StaticDude{ public static Object getGroove() { // ... some complex logic which returns an object }; } </code></pre> <p>How do I mock the static method call using easy mock? <code>StaticDude.getGroove()</code>.</p> <p>I am using easy mock ...
3,162,598
5
0
null
2010-07-02 00:27:00.703 UTC
7
2017-02-16 14:15:41.387 UTC
2010-07-17 20:43:40.927 UTC
null
70,604
null
99,033
null
1
34
java|unit-testing|static|tdd|easymock
75,723
<p>Not sure how to with pure EasyMock, but consider using the <a href="https://github.com/jayway/powermock" rel="noreferrer">PowerMock</a> extensions to EasyMock.</p> <p>It has a lot of cool functions for doing just what you need - <a href="https://github.com/jayway/powermock/wiki/MockStatic" rel="noreferrer">https:/...
2,835,627
php is_function() to determine if a variable is a function
<p>I was pretty excited to read about <a href="http://php.net/manual/en/functions.anonymous.php" rel="noreferrer">anonymous functions</a> in php, which let you declare a variable that is function easier than you could do with <a href="http://us2.php.net/manual/en/function.create-function.php" rel="noreferrer">create_fu...
2,835,660
5
0
null
2010-05-14 16:03:44.033 UTC
12
2020-02-27 03:56:49.613 UTC
null
null
null
null
88,310
null
1
95
php|anonymous-function
47,715
<p>Use <a href="http://php.net/manual/en/function.is-callable.php" rel="noreferrer"><code>is_callable</code></a> to determine whether a given variable is a function. For example:</p> <pre><code>$func = function() { echo 'asdf'; }; if( is_callable( $func ) ) { // Will be true. } </code></pre>
2,458,723
C Macro for minimum of two numbers
<p>I want to make a simple macro with #define for returning the smaller of two numbers.</p> <p>How can i do this in C ? Suggest some ideas, and see if you can make it more obfuscated too. </p>
2,458,899
7
1
null
2010-03-16 22:51:39.72 UTC
null
2017-09-19 18:23:48.617 UTC
2015-03-31 02:12:20.9 UTC
null
1,257,035
null
281,619
null
1
5
c|c-preprocessor|minimum
42,696
<p>For slightly obfuscated, try this:</p> <pre><code>#define MIN(a,b) ((((a)-(b))&amp;0x80000000) &gt;&gt; 31)? (a) : (b) </code></pre> <p>Basically, it subtracts them, and looks at the sign-bit as a 1-or-0. If the subtraction results in a negative number, the first parameter is smaller.</p>
3,000,209
Service reference not generating client types
<p>I am trying to consume a WCF service in a class library by adding a service reference to it. In one of the class libraries it gets consumed properly and I can access the client types in order to generate a proxy off of them. However in my second class library (or even in a console test app), when i add the same serv...
3,000,363
7
1
null
2010-06-08 18:35:54.893 UTC
3
2017-11-20 10:52:05.44 UTC
null
null
null
null
313,197
null
1
31
.net|wcf|service|reference
33,368
<p>Apparently you have to add a reference to System.Web in your project before adding the Service Reference. That did it. </p>