id
int64
4
73.8M
title
stringlengths
10
150
body
stringlengths
17
50.8k
accepted_answer_id
int64
7
73.8M
answer_count
int64
1
182
comment_count
int64
0
89
community_owned_date
stringlengths
23
27
creation_date
stringlengths
23
27
favorite_count
int64
0
11.6k
last_activity_date
stringlengths
23
27
last_edit_date
stringlengths
23
27
last_editor_display_name
stringlengths
2
29
last_editor_user_id
int64
-1
20M
owner_display_name
stringlengths
1
29
owner_user_id
int64
1
20M
parent_id
null
post_type_id
int64
1
1
score
int64
-146
26.6k
tags
stringlengths
1
125
view_count
int64
122
11.6M
answer_body
stringlengths
19
51k
4,666,590
Remove outliers from correlation coefficient calculation
<p>Assume we have two numeric vectors <code>x</code> and <code>y</code>. The Pearson correlation coefficient between <code>x</code> and <code>y</code> is given by</p> <blockquote> <p>cor(x, y)</p> </blockquote> <p>How can I automatically consider only a subset of <code>x</code> and <code>y</code> in the calculation...
4,667,300
5
2
null
2011-01-12 08:20:33.197 UTC
11
2017-03-20 10:17:42.993 UTC
2011-01-12 12:26:29.927 UTC
null
415,690
null
488,719
null
1
10
r|statistics|correlation
25,222
<p>If you <em>really</em> want to do this (remove the largest (absolute) residuals), then we can employ the linear model to estimate the least squares solution and associated residuals and then select the middle n% of the data. Here is an example:</p> <p>Firstly, generate some dummy data:</p> <pre><code>require(MASS)...
4,827,622
Copy several byte arrays to one big byte array
<p>I have one big <code>byte[]</code> array and lot of small <code>byte</code> arrays ( length of big array is sum of lengths small arrays). Is there maybe some quick method to copy one array to another from starting position to ending, not to use for loop for every byte manually ?</p>
4,827,732
5
0
null
2011-01-28 11:19:30.693 UTC
6
2017-04-15 17:36:19.84 UTC
2011-01-28 14:47:01.393 UTC
null
342,852
null
486,578
null
1
35
java|arrays
64,729
<p>You can use a <a href="http://download.oracle.com/javase/6/docs/api/java/nio/ByteBuffer.html" rel="noreferrer"><code>ByteBuffer</code></a>.</p> <pre><code>ByteBuffer target = ByteBuffer.wrap(bigByteArray); target.put(small1); target.put(small2); ...; </code></pre>
4,256,329
Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<AnonymousType#1>' to 'System.Collections.Generic.List<string>
<p>I have the code below:</p> <pre><code>List&lt;string&gt; aa = (from char c in source select new { Data = c.ToString() }).ToList(); </code></pre> <p>But what about </p> <pre><code>List&lt;string&gt; aa = (from char c1 in source from char c2 in source select ...
4,256,387
5
2
null
2010-11-23 13:12:20.247 UTC
4
2016-06-08 05:36:44.217 UTC
2012-08-01 10:30:20.157 UTC
null
41,956
user372724
null
null
1
42
c#|.net|linq|compiler-errors
236,569
<pre><code>IEnumerable&lt;string&gt; e = (from char c in source select new { Data = c.ToString() }).Select(t = &gt; t.Data); // or IEnumerable&lt;string&gt; e = from char c in source select c.ToString(); // or IEnumerable&lt;string&gt; e = source.Select(c = &gt; c.ToStrin...
4,623,328
Select first occurring element after another element
<p>I've got the following HTML code on a page:</p> <pre><code>&lt;h4&gt;Some text&lt;/h4&gt; &lt;p&gt; Some more text! &lt;/p&gt; </code></pre> <p>In my <code>.css</code> I've got the following selector to style the <code>h4</code> element. The HTML code above is just a small part of the entire code; there are severa...
4,623,351
5
0
null
2011-01-07 07:17:54.947 UTC
14
2021-08-10 04:30:08.483 UTC
2019-01-04 21:33:45.717 UTC
null
3,345,644
null
291,293
null
1
149
html|css|css-selectors
166,673
<pre><code>#many .more.selectors h4 + p { ... } </code></pre> <p>This is called the <a href="http://www.w3.org/TR/CSS2/selector.html#adjacent-selectors" rel="noreferrer">adjacent sibling selector</a>.</p>
4,494,404
Find large number of consecutive values fulfilling condition in a numpy array
<p>I have some audio data loaded in a numpy array and I wish to segment the data by finding silent parts, i.e. parts where the audio amplitude is below a certain threshold over a a period in time.</p> <p>An extremely simple way to do this is something like this:</p> <pre><code>values = ''.join(("1" if (abs(x) &lt; SI...
4,495,197
8
0
null
2010-12-20 22:02:05.607 UTC
14
2021-01-31 22:46:58.237 UTC
null
null
null
null
458,320
null
1
25
python|search|numpy
15,279
<p>Here's a numpy-based solution.</p> <p>I think (?) it should be faster than the other options. Hopefully it's fairly clear.</p> <p>However, it does require a twice as much memory as the various generator-based solutions. As long as you can hold a single temporary copy of your data in memory (for the diff), and a boo...
4,101,539
C# removing substring from end of string
<p>I have an array of strings:</p> <pre><code>string[] remove = { "a", "am", "p", "pm" }; </code></pre> <p>And I have a textbox that a user enters text into. If they type any string in the <code>remove</code> array at the end of the text in the textbox, it should be removed. What is the easiest way to do this?</p> <...
4,101,583
8
6
null
2010-11-04 21:23:26.1 UTC
1
2020-02-27 16:20:35.17 UTC
2020-02-27 16:20:35.17 UTC
null
953,496
null
481,702
null
1
56
c#|string|textbox
96,991
<pre><code>string[] remove = { "a", "am", "p", "pm" }; string inputText = "blalahpm"; foreach (string item in remove) if (inputText.EndsWith(item)) { inputText = inputText.Substring(0, inputText.LastIndexOf(item)); break; //only allow one match at most } </code></pre>
4,732,544
Why are only final variables accessible in anonymous class?
<ol> <li><p><code>a</code> can only be final here. Why? How can I reassign <code>a</code> in <code>onClick()</code> method without keeping it as private member?</p> <pre><code>private void f(Button b, final int a){ b.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent e...
4,732,617
15
8
null
2011-01-19 06:58:42.2 UTC
227
2021-03-16 20:41:58.64 UTC
2017-07-14 09:29:07.35 UTC
null
5,091,346
user467871
null
null
1
381
java|event-handling|anonymous-class
125,467
<p>As noted in comments, some of this becomes irrelevant in Java 8, where <code>final</code> can be implicit. Only an <em>effectively</em> final variable can be used in an anonymous inner class or lambda expression though.</p> <hr> <p>It's basically due to the way Java manages <a href="http://en.wikipedia.org/wiki/Cl...
4,105,795
Pretty-Print JSON in Java
<p>I'm using <a href="/questions/tagged/json-simple" class="post-tag" title="show questions tagged &#39;json-simple&#39;" rel="tag">json-simple</a> and I need to pretty-print JSON data (make it more human readable).</p> <p>I haven't been able to find this functionality within that library. How is this commonly achieve...
7,310,424
21
1
null
2010-11-05 12:24:08.397 UTC
55
2022-07-24 19:23:13.617 UTC
2015-09-11 14:35:33.077 UTC
null
3,453,226
null
328,681
null
1
273
java|json|pretty-print|json-simple
342,993
<p>Google's <a href="https://github.com/google/gson" rel="noreferrer">GSON</a> can do this in a nice way:</p> <pre><code>Gson gson = new GsonBuilder().setPrettyPrinting().create(); JsonParser jp = new JsonParser(); JsonElement je = jp.parse(uglyJsonString); String prettyJsonString = gson.toJson(je); </code></pre> <p>or...
4,827,092
unable to install pg gem
<p>I tried using <code>gem install pg</code> but it doesn't seem to work.</p> <p><code>gem install pg</code> gives this error</p> <pre><code>Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... ERROR: Error installing pg: ERROR: Failed to build gem native ex...
4,827,229
23
4
null
2011-01-28 10:19:27.767 UTC
53
2022-03-17 23:13:31.24 UTC
2015-03-09 10:25:42.487 UTC
null
2,641,576
null
429,167
null
1
252
ruby-on-rails|ruby|rubygems|installation
162,157
<p>Answered here: <a href="https://stackoverflow.com/questions/4335750/cant-install-pg-gem-on-windows">Can&#39;t install pg gem on Windows</a></p> <blockquote> <p>There is no Windows native version of latest release of pg (0.10.0) released yesterday, but if you install 0.9.0 it should install binaries without ...
14,501,748
cannot open window service on computer '.' in window application
<p>I develop one window application and I also create one service. I start the service using coding in window application, but I am getting an error like cannot open window service on computer <code>'.'</code> </p> <p>I have used below code.</p> <pre><code>ServiceController controller = new ServiceController("SeoMozS...
14,600,685
7
9
null
2013-01-24 12:48:21.483 UTC
3
2021-09-24 09:20:38.703 UTC
2013-05-15 19:56:00.483 UTC
null
58,074
null
1,253,970
null
1
21
c#|windows-services|windows-applications
48,630
<p>Go to <code>c://Program Files/ApplicationFolder/.exe</code> Right-click on .exe and go to <code>Properties</code> then go <code>Compatibility Tab</code> and check true to <code>Run this Program as an administrator Level</code>.</p>
14,608,250
How can I find the size of a type?
<p>I'm holding a <code>Type*</code> in my hand. How do I find out its size (the size objects of this type will occupy in memory) in bits / bytes? I see all kinds of methods allowing me to get "primitive" or "scalar" size, but that won't help me with aggregate types...</p>
14,608,251
2
1
null
2013-01-30 15:59:16.883 UTC
10
2018-04-08 15:08:11.017 UTC
null
null
null
null
242,762
null
1
26
llvm
10,391
<p>The size depends on the target (for several reasons, alignment being one of them).</p> <p>In LLVM versions 3.2 and above, you need to use <a href="http://llvm.org/docs/doxygen/html/classllvm_1_1DataLayout.html" rel="noreferrer">DataLayout</a>, in particular its <code>getTypeAllocSize</code> method. This returns the...
14,365,725
Easiest/Lightest Replacement For Browser Detection jQuery 1.9?
<p>I had several clients complain yesterday that some code stopped working. Apparently it comes down to plug-ins using the now deprecated <code>jQuery.browser</code> which stopped working yesterday when jQuery 1.9 was released.</p> <p>I (quickly) looked at the 1.9 change docs and it <em>seems</em> like they want me to...
16,194,719
13
3
null
2013-01-16 19:01:02.293 UTC
11
2014-07-10 13:50:57.803 UTC
2013-02-11 22:14:38.673 UTC
null
237,917
null
1,332,527
null
1
64
jquery|browser-detection
63,696
<p>I've use the following code answered by Alexx Roche, but i wanted to detect MSIE so:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function() { if (navigator.userAgent.match(/msie/i) ){ alert('I am an old fashioned Internet Explorer'); } }); &lt;/script&gt; </code>...
14,622,421
How to change legend title in ggplot
<p>I have the following plot like below. It was created with this command:</p> <pre><code>library(ggplot2) df &lt;- data.frame(cond = factor(rep(c(&quot;A&quot;, &quot;B&quot;), each = 200)), rating = c(rnorm(200), rnorm(200, mean=.8))) ggplot(df, aes(x=rating, fill=cond)) + geom_density(alpha = .3...
14,622,513
13
7
null
2013-01-31 09:31:10.45 UTC
97
2022-01-05 21:31:01.18 UTC
2022-01-05 21:31:01.18 UTC
null
15,293,191
null
67,405
null
1
454
r|plot|ggplot2
998,721
<p>This should work:</p> <pre><code>p &lt;- ggplot(df, aes(x=rating, fill=cond)) + geom_density(alpha=.3) + xlab("NEW RATING TITLE") + ylab("NEW DENSITY TITLE") p &lt;- p + guides(fill=guide_legend(title="New Legend Title")) </code></pre> <p>(or alternatively)</p> <pre><code>p + s...
2,936,116
Autotools: how to cleanup files created by "./configure" in lighttpd project?
<p>I'm trying out <code>lighttpd</code> for an embedded Linux project. I got the latest source package and started writing a master Makefile encapsulating all configure, compile, install (for testing) etc stuff. </p> <p>And vice-versa, I want to cleanup every step. After the cleanup there should be no generated files ...
2,937,092
2
2
null
2010-05-29 18:17:43.49 UTC
4
2016-04-03 13:52:18.527 UTC
2016-02-24 10:30:36.647 UTC
null
1,052,126
null
330,272
null
1
37
makefile|autotools|configure|lighttpd|undo
49,287
<p>I personally would really use the features of a source control software (you should use one) for this. This would cleanup make independent of your build process. See e.g. <a href="http://websvn.kde.org/*checkout*/trunk/KDE/kdesdk/scripts/svn-clean?pathrev=499176" rel="noreferrer"><code>svn-cleanup</code></a> or <co...
53,682,247
How to point Go module dependency in go.mod to a latest commit in a repo?
<p>Starting with v1.11 Go added support for modules. Commands</p> <pre><code>go mod init &lt;package name&gt; go build </code></pre> <p>would generate <code>go.mod</code> and <code>go.sum</code> files that contain all found versions for the package dependencies. </p> <p>If a module does not have any releases, the la...
53,682,399
6
0
null
2018-12-08 11:53:31.147 UTC
48
2021-11-26 07:52:12.38 UTC
null
null
null
null
23,080
null
1
195
git|go|module
197,876
<p>Just 'go get' at the commit hash you want:</p> <pre><code>go get github.com/someone/some_module@af044c0995fe </code></pre> <p>'go get' will correctly update the dependency files (go.mod, go.sum).</p> <p>More information: <a href="https://github.com/golang/go/wiki/Modules#how-to-upgrade-and-downgrade-dependencies"...
53,658,208
Custom AppBar Flutter
<p>Im trying to achieve something like the following, <a href="https://i.stack.imgur.com/xRIAc.png" rel="noreferrer"><img src="https://i.stack.imgur.com/xRIAc.png" alt="enter image description here"></a></p> <p>I'm very new to flutter so I couldn't figure it out. I need a custom AppBar with drawer and actions but arr...
53,658,805
5
1
null
2018-12-06 19:15:42.353 UTC
21
2021-07-22 15:19:41.41 UTC
null
null
null
null
3,831,319
null
1
24
dart|flutter|flutter-layout
112,446
<p>As I mentioned in the comment , you can create a Custom widget like your Image attached, there are many ways to do it, this is just an example :</p> <pre><code> class CustomBarWidget extends StatelessWidget { GlobalKey&lt;ScaffoldState&gt; _scaffoldKey = GlobalKey(); @override Widget build(Bu...
30,642,894
Getting Flask to use Python3 (Apache/mod_wsgi)
<p>I've got a basic "hello world" Flask app running.</p> <p>I'm on Ubuntu 14.04, using Apache 2.4. I've installed mod_wsgi.</p> <p>I've created a <code>~/web/piFlask/venv/</code> to hold a virtualenv-created Python2 with flask installed.</p> <p>However, I wish to have my flaskapp import a Python3.x module I have w...
30,643,902
4
0
null
2015-06-04 11:39:56.37 UTC
10
2018-03-13 22:44:23.35 UTC
null
null
null
null
435,129
null
1
14
python-3.x|flask|mod-wsgi
20,578
<p>Correct, mod_wsgi needs to be compiled for a specific Python version as it never actually executes 'python' executable. Instead the Python library is linked into mod_wsgi.</p> <p>The end result is you cannot mix Python 3 code within an application running using the Python 2 interpreter.</p> <p>You would have to co...
44,533,319
How to assign more memory to docker container
<p>As the title reads, I'm trying to assign more memory to my container. I'm using an image from docker hub called "aallam/tomcat-mysql" in case that's relevant.</p> <p>When I start it normally without any special flags, there's a memory limit of 2GB (even though I read that memory is unbounded if not set)</p> <p>Her...
44,533,437
4
0
null
2017-06-13 23:59:34.483 UTC
27
2022-09-20 11:31:47.47 UTC
2018-10-04 03:58:16.667 UTC
null
4,671,027
null
1,007,922
null
1
183
docker|docker-container
236,485
<p>That <code>2GB</code> limit you see is the total memory of the VM (virtual machine) on which docker runs.</p> <p>If you are using <a href="https://docs.docker.com/desktop/" rel="nofollow noreferrer">Docker Desktop</a> you can easily increase it from the Whale icon in the task bar, then go to Preferences -&gt; Advan...
10,834,817
Xcode Simulator: how to remove older unneeded devices?
<p>I'm running Xcode 4.3.1 iOS-Simulator which originally only supports iOS 5.1.</p> <p>I need to test my code with iOS 4.3, so I used Xcode's "Install" feature to install it as described in <a href="https://apple.stackexchange.com/questions/47323">"Installing Xcode with iOS 4.3 device simulator?"</a></p> <p>Now I'm ...
10,835,251
21
0
null
2012-05-31 13:40:49.83 UTC
90
2022-09-13 12:13:10.767 UTC
2018-01-09 11:49:27.803 UTC
null
3,397,217
null
1,633,251
null
1
257
ios|xcode|ios-simulator
165,796
<p>Did you try to just delete the 4.3 SDK from within the Xcode Package?</p> <blockquote> <p>/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs</p> </blockquote> <p>please also delete the corresponding .dmg file in</p> <blockquote> <p>~/Library/Caches/com.apple.dt.Xcode/Downloa...
34,580,662
What does "Stage Skipped" mean in Apache Spark web UI?
<p>From my Spark UI. What does it mean by skipped?</p> <p><a href="https://i.stack.imgur.com/cyvd1.png"><img src="https://i.stack.imgur.com/cyvd1.png" alt="enter image description here"></a></p>
34,581,152
2
0
null
2016-01-03 19:26:29.91 UTC
30
2021-02-05 07:59:55.47 UTC
2017-08-18 21:43:08.447 UTC
null
-1
null
127,320
null
1
106
apache-spark|rdd
31,724
<p>Typically it means that data has been fetched from cache and there was no need to re-execute given stage. It is consistent with your DAG which shows that the next stage requires shuffling (<code>reduceByKey</code>). Whenever there is shuffling involved Spark <a href="https://spark.apache.org/docs/1.5.0/programming-g...
34,490,599
C++11: How to set seed using <random>
<p>I am exercising the random library, new to C++11. I wrote the following minimal program:</p> <pre><code>#include &lt;iostream&gt; #include &lt;random&gt; using namespace std; int main() { default_random_engine eng; uniform_real_distribution&lt;double&gt; urd(0, 1); cout &lt;&lt; "Uniform [0, 1): " &lt;&...
34,493,057
2
0
null
2015-12-28 09:09:05.873 UTC
9
2015-12-29 20:01:59.9 UTC
2015-12-28 12:07:47.913 UTC
null
559,289
null
2,432,059
null
1
27
c++11|random
35,325
<p>The point of having a <code>seed_seq</code> is to increase the entropy of the generated sequence. If you have a random_device on your system, initializing with multiple numbers from that random device may arguably do that. On a system that has a pseudo-random number generator I don't think there is an increase in ra...
34,607,028
How to set Image resource to ImageView using DataBinding
<p>How can we use data binding in android to put image resource in an <code>ImageView</code>? </p> <pre><code> &lt;ImageView android:id="@+id/is_synced" android:src="@{model.pending ? @mipmap/pending: @mipmap/synced}" android:layout_width="wrap_content" android:layout_h...
37,570,135
9
1
null
2016-01-05 08:19:22.633 UTC
13
2020-05-01 21:42:32.077 UTC
2016-01-05 08:38:30.173 UTC
null
2,006,803
null
2,006,803
null
1
89
android|xml|android-databinding
84,224
<p>set image like this,</p> <pre><code> &lt;ImageView android:layout_width="28dp" android:layout_height="28dp" android:src="@{model.isActive ? @drawable/white_activated_icon :@drawable/activated_icon}" tools:src="@mipmap/white_activated_icon" /&gt; </code></pre>
26,157,620
Convert a simple one line string to RDD in Spark
<p>I have a simple line:</p> <pre><code>line = "Hello, world" </code></pre> <p>I would like to convert it to an RDD with only one element. I have tried </p> <pre><code>sc.parallelize(line) </code></pre> <p>But it get:</p> <pre><code>sc.parallelize(line).collect() ['H', 'e', 'l', 'l', 'o', ',', ' ', 'w', 'o', 'r',...
26,158,173
3
0
null
2014-10-02 09:07:14.783 UTC
5
2020-11-20 14:54:56.94 UTC
2016-09-06 23:47:33.047 UTC
null
2,411,320
null
112,976
null
1
29
python|apache-spark|pyspark|distributed-computing|rdd
50,363
<p>try using List as parameter: </p> <pre><code>sc.parallelize(List(line)).collect() </code></pre> <p>it returns </p> <pre><code>res1: Array[String] = Array(hello,world) </code></pre>
38,892,270
DELETE_FAILED_INTERNAL_ERROR Error while Installing APK
<p><a href="https://i.stack.imgur.com/F2Isr.png" rel="noreferrer"><img src="https://i.stack.imgur.com/F2Isr.png" alt="enter image description here" /></a>I am using <strong>Android Studio 2.2</strong> Preview. I am facing the issue</p> <blockquote> <p>Failure: Install failed invalid apk</p> <p>Error: While installing a...
43,734,320
32
8
null
2016-08-11 09:21:24.16 UTC
43
2020-07-28 12:48:04.74 UTC
2020-06-20 09:12:55.06 UTC
null
-1
null
4,301,371
null
1
203
android|android-studio|build.gradle
182,147
<p><strong>Android studio mac/windows/linux:</strong></p> <p><strong>Steps in together (mac):</strong> Android Studio > Preferences > Build, Execution, Deployment > Instant Run > Uncheck : Enable Instant Run</p> <p><strong>Steps in together (windows &amp; linux):</strong> File > Settings > Build, Execution, Deploymen...
49,949,526
Laravel mysql migrate error
<p>I recently format my mac book pro, after cloning the proyect from github and install the things I need like MySql and Sequel Pro I tried to migrate the database information but I get this error:</p> <pre><code> Illuminate\Database\QueryException : SQLSTATE[42000]: Syntax error or access violation: 1231 Variable ...
50,372,200
10
5
null
2018-04-20 20:49:24.193 UTC
16
2021-10-08 12:25:19.317 UTC
null
null
null
null
8,161,086
null
1
66
php|mysql|laravel|laravel-5.6
43,681
<p>I finally found the solutions a days ago and I remembered this post. In the <code>config/database.php</code> file in mysql tag, the sql modes should be added in order to skip this error. <a href="https://dev.mysql.com/doc/refman/8.0/en/sql-mode.html#sql-mode-full" rel="noreferrer">https://dev.mysql.com/doc/refman/8....
3,034,162
Plotting a cumulative graph of python datetimes
<p>Say I have a list of datetimes, and we know each datetime to be the recorded time of an event happening.</p> <p>Is it possible in matplotlib to graph the frequency of this event occurring over time, showing this data in a cumulative graph (so that each point is greater or equal to all of the points that went before...
3,034,217
3
0
null
2010-06-13 22:34:49.937 UTC
9
2017-07-24 06:30:05.62 UTC
2017-07-24 06:30:05.62 UTC
null
3,632,894
null
221,001
null
1
18
python|datetime|graph|matplotlib
11,395
<p>This should work for you:</p> <pre><code>counts = arange(0, len(list_of_dates)) plot(list_of_dates, counts) </code></pre> <p>You can of course give any of the usual options to the <code>plot</code> call to make the graph look the way you want it. (I'll point out that matplotlib is very adept at handling dates and ...
2,714,507
jQuery ajax upload with progress bar - no flash
<p>I am looking for a file uploader similar to <a href="http://www.uploadify.com/" rel="noreferrer">uploadify</a> with progress bar that doesn't rely on flash, preferably using jQuery - is this possible?</p>
2,714,755
3
1
null
2010-04-26 15:05:31.38 UTC
13
2013-03-27 18:45:34.613 UTC
2010-04-26 15:14:05.693 UTC
null
94,278
null
94,278
null
1
20
jquery|ajax|post|upload
66,719
<p>Sure, it's possible. A couple sites with different code and tutorials are:</p> <ul> <li><a href="http://github.com/drogus/jquery-upload-progress" rel="noreferrer">http://github.com/drogus/jquery-upload-progress</a> (ninja'd by DrJokepu ;)</li> <li><a href="http://web.archive.org/web/20120414125425/http://t.wits.sg/...
2,756,923
Javascript if (j === null) do nothing
<p>I'm using <a href="http://www.curvycorners.net/" rel="nofollow noreferrer">CurvyCorners</a> to make my corners curvy in IE, only thing is that when it reads the CSS it takes all the webkit properties and shows me an alert <code>curvyCorners.alert("No object with ID " + arg + " exists yet.\nCall curvyCorners(settings...
2,756,933
5
0
null
2010-05-03 08:37:01.65 UTC
1
2020-04-10 11:56:39.023 UTC
2010-05-03 08:48:01.11 UTC
null
58,635
null
287,047
null
1
5
javascript|html
38,112
<p>Do you have access to the code? If so, you can add this code to the start of the curvyCorners function definition:</p> <pre><code>if (!obj) return; </code></pre> <p>This will quit the curvyCorners function silently if the element doesn't exist.</p>
38,709,886
Call route from button click laravel
<p>I am using the Laravel framework and the blade templating engine for one of my projects, where I have a route which looks like </p> <pre><code>Route::get('/problems/{problem-id}/edit', 'AdminController@editProblem'); </code></pre> <p>I have <strong>editProblem</strong> method in <strong>AdminController</strong> wh...
38,710,638
4
0
null
2016-08-02 00:11:26.13 UTC
5
2022-02-24 04:16:26.773 UTC
2018-01-18 07:59:58.85 UTC
null
4,426,099
null
4,426,099
null
1
13
php|laravel|laravel-5|routes|balde
112,148
<h3>In my opnion, you should use url() Laravel method</h3> <p>To call you route with the problem's id you can do:</p> <pre><code>&lt;a href=&quot;{{ url('/problems/' . $problem-&gt;id . '/edit') }}&quot; class=&quot;btn btn-xs btn-info pull-right&quot;&gt;Edit&lt;/a&gt; </code></pre> <p>I used an anchor tag, but it wil...
54,101,923
1006 Connection closed abnormally error with python 3.7 websockets
<p>I'm having the same problem as this github issue with python websockets: <a href="https://github.com/aaugustin/websockets/issues/367" rel="noreferrer">https://github.com/aaugustin/websockets/issues/367</a></p> <p>The proposed solution isn't working for me though. The error I'm getting is:</p> <p>websockets.excepti...
54,660,106
6
0
null
2019-01-09 01:06:30.653 UTC
9
2021-08-12 00:25:06.003 UTC
null
null
null
null
4,696,535
null
1
18
python|python-3.x|websocket|python-asyncio
27,749
<p>So I found the solution:</p> <p>When the connection closes, it breaks out of the while loop for some reason. So in order to keep the websocket running you have to surround </p> <pre><code>resp = await websocket.recv() </code></pre> <p>with try ... except and have </p> <pre><code>print('Reconnecting') websocket =...
50,670,326
How to check if point is placed inside contour?
<p>I have drawn a contour around extreme points. Inside polygon figure I have others points. How to check if they are inside contour?</p>
50,670,359
1
0
null
2018-06-03 19:40:19.633 UTC
9
2022-08-15 11:43:30.757 UTC
2022-08-15 11:43:30.757 UTC
null
6,885,902
null
8,291,684
null
1
17
python|opencv|contour|opencv3.0
15,493
<p>You can use the <code>cv2.pointPolygonTest()</code> function available in OpenCV.</p> <p>For example:</p> <p><code>dist = cv2.pointPolygonTest(cnt,(50,50),True)</code></p> <p>In this example we are checking whether the coordinate <code>(50, 50)</code> is present withing the contour <code>cnt</code></p> <ol> <li><p><...
49,377,231
When to use Rc vs Box?
<p>I have the following code which uses both <code>Rc</code> and <code>Box</code>; what is the difference between those? Which one is better?</p> <pre><code>use std::rc::Rc; fn main() { let a = Box::new(1); let a1 = &amp;a; let a2 = &amp;a; let b = Rc::new(1); let b1 = b.clone(); let b2 = b.clo...
49,379,201
2
0
null
2018-03-20 05:59:06.893 UTC
10
2022-04-28 04:17:59.757 UTC
2022-04-28 04:17:59.757 UTC
null
8,776,746
null
1,125,621
null
1
32
rust|reference-counting
14,659
<p><a href="https://doc.rust-lang.org/std/rc/" rel="noreferrer"><code>Rc</code></a> provides shared ownership so by default its contents can't be mutated, while <a href="https://doc.rust-lang.org/std/boxed/" rel="noreferrer"><code>Box</code></a> provides exclusive ownership and thus mutation is allowed:</p> <pre><code...
35,280,479
Can I choose where my conda environment is stored?
<p>Can I change the path /Users/nolan/miniconda/envs/ to another one when creating a virtual environment ? I'd like it to be specific to my project directory. (As we can do with virtualenv)</p> <pre><code>$conda info -e Using Anaconda Cloud api site https://api.anaconda.org # conda environments: # _build ...
35,303,953
4
0
null
2016-02-08 22:20:46.217 UTC
17
2021-09-21 09:18:05.687 UTC
null
null
null
null
2,201,037
null
1
50
conda
51,057
<p>You can change the environments directory by editing your .condarc file found in your user directory. Add the following specifying the path to the directory you want:</p> <pre><code>envs_dirs: - /Users/nolan/newpath </code></pre>
53,461,830
Send message using Django Channels from outside Consumer class
<p>I am building an online game, which uses Django channels 2.1.5 for websockets.</p> <p>I am able to build the connection between the client and the server, and also able to send data between them only inside the consumer class:</p> <pre><code>from channels.generic.websocket import WebsocketConsumer import json from...
53,495,618
3
0
null
2018-11-24 19:52:57.857 UTC
11
2019-11-18 18:09:42.957 UTC
2019-11-18 18:09:42.957 UTC
null
6,250,155
null
7,406,460
null
1
22
python|django|websocket|django-channels
13,168
<p>Firstly you need your consumer instance to subscribe to a group. </p> <pre><code>from asgiref.sync import async_to_sync class GameConsumer(WebsocketConsumer): def connect(self): self.accept() self.render() async_to_sync(self.add_group)('render_updates_group') controller.startTu...
42,680,980
How to chain two Completable in RxJava2
<p>I have two Completable. I would like to do following scenario: If first Completable gets to onComplete , continue with second Completable. The final results would be onComplete of second Completable.</p> <p>This is how I do it when I have Single <strong>getUserIdAlreadySavedInDevice()</strong> and Completable <stro...
42,684,401
5
0
null
2017-03-08 20:08:53.053 UTC
13
2021-11-10 17:12:27.777 UTC
2017-03-09 11:45:11.613 UTC
null
7,045,114
null
2,959,120
null
1
80
java|rx-java|rx-java2
42,007
<p>You are looking for <code>andThen</code> operator.</p> <blockquote> <p>Returns a Completable that first runs this Completable and then the other completable.</p> </blockquote> <pre><code>firstCompletable .andThen(secondCompletable) </code></pre> <p>In general, this operator is a "replacement" for a <code>fl...
42,822,948
How should I handle events in Vuex?
<p>I am used to using a global event bus to handle cross-component methods. For example:</p> <pre><code>var bus = new Vue(); ... //Component A bus.$emit('DoSomethingInComponentB'); ... //Component B bus.$on('DoSomethingInComponentB', function(){ this.doSomething() }) </code></pre> <p>However, I am building a larger p...
42,824,182
3
0
null
2017-03-15 23:57:52.36 UTC
12
2022-07-15 19:48:51.59 UTC
null
null
null
null
2,779,909
null
1
36
vue.js|vuejs2|vuex
36,149
<p><a href="https://vuex.vuejs.org/en" rel="nofollow noreferrer">Vuex</a> and <a href="https://v2.vuejs.org/v2/guide/components.html#Non-Parent-Child-Communication" rel="nofollow noreferrer">event bus</a> are two different things in the sense that vuex manages central state of your application while event bus is used t...
32,133,836
remove shadow below AppBarLayout widget android
<p>When using <code>AppBarLayout</code> widget in design support library, a shadow appears on the bottom of the toolbar. How can I remove that shadow?</p>
32,325,432
10
0
null
2015-08-21 06:35:11.267 UTC
13
2022-03-07 07:17:10.533 UTC
2017-12-18 18:15:29.19 UTC
null
2,804,761
null
5,219,069
null
1
113
android|android-layout
40,289
<p>Simply use <code>app:elevation="0dp"</code> inside "AppBarLayout" to remove the shadow. It has always worked for me. Hope it works for you.</p>
28,099,441
Define a recursive function within a function in Go
<p>I am trying to define a recursive function within another function in Go but I am struggling to get the right syntax. I am looking for something like this:</p> <pre><code>func Function1(n) int { a := 10 Function2 := func(m int) int { if m &lt;= a { return a } return Function2(m-1) ...
28,099,510
2
0
null
2015-01-22 21:58:10.393 UTC
5
2018-10-05 19:00:26.767 UTC
2018-01-14 07:20:12.317 UTC
null
1,705,598
null
2,641,547
null
1
29
function|recursion|go
7,945
<p>You can't access <code>Function2</code> inside of it if it is in the line where you declare it. The reason is that you're not referring to a <em>function</em> but to a <em>variable</em> (whose type is a function) and it will be accessible only after the declaration.</p> <p>Quoting from <a href="https://golang.org/r...
28,089,942
Difference between "fill" and "expand" options for tkinter pack method
<p>I know this is a too trivial question, but I am new to python, and I have just started using the <code>tkinter</code> module. I have actually looked up about it everywhere, and I am unable to find the satisfactory answer. I found the following: </p> <blockquote> <p><code>fill</code> option: it determines whether...
28,090,362
3
0
null
2015-01-22 13:26:25.837 UTC
20
2022-02-07 23:12:22.173 UTC
2015-01-22 14:46:48.47 UTC
null
3,924,118
null
4,233,030
null
1
57
python|tkinter
100,978
<p>From <a href="https://web.archive.org/web/20201112024617/http://effbot.org/tkinterbook/pack.htm" rel="nofollow noreferrer">effbot</a>:</p> <blockquote> <p>The <strong>fill</strong> option tells the manager that the widget wants fill the entire space assigned to it. The value controls how to fill the space; <strong>B...
22,579,666
error: out-of-line definition of 'test' does not match any declaration in 'B<dim>'
<p>I have a small problem that is killing me!! I don't know what seems to be wrong with the below code. I should be able to implement the function that is inherited from the super class, shouldn't I? but I get <code>error: out-of-line definition of 'test' does not match any declaration in 'B&lt;dim&gt;'</code> </p> <p...
22,579,699
2
0
null
2014-03-22 15:35:52.207 UTC
3
2020-07-20 17:38:00.167 UTC
null
null
null
null
3,449,968
null
1
16
c++|macos|templates|inheritance|virtual
80,912
<p>Try </p> <pre><code>template &lt;int dim&gt; class B : public A &lt;dim&gt; { public: virtual double test () const; }; // Function definition template &lt;int dim&gt; double B&lt;dim&gt;::test () const { return 0; } </code></pre> <p>You still need to <em>define</em> the function declared the class declarat...
46,441,893
connected component labeling in python
<p>How to implement connected component labeling in python with open cv? This is an image example:</p> <p><img src="https://i.stack.imgur.com/eGaIy.jpg" /></p> <p>I need connected component labeling to separate objects on a black and white image.</p>
46,442,154
2
0
null
2017-09-27 07:28:39.49 UTC
27
2020-02-18 20:56:01.697 UTC
2018-03-13 21:15:29.463 UTC
null
3,419,103
null
8,681,147
null
1
26
python-2.7|opencv|image-processing|connected-components
76,560
<p>The <a href="http://docs.opencv.org/3.0-beta/modules/imgproc/doc/structural_analysis_and_shape_descriptors.html#connectedcomponents" rel="noreferrer">OpenCV 3.0 docs for <code>connectedComponents()</code></a> don't mention Python but it actually is implemented. See for e.g. <a href="https://stackoverflow.com/questio...
34,220,532
How to assign a value to a TensorFlow variable?
<p>I am trying to assign a new value to a tensorflow variable in python.</p> <pre><code>import tensorflow as tf import numpy as np x = tf.Variable(0) init = tf.initialize_all_variables() sess = tf.InteractiveSession() sess.run(init) print(x.eval()) x.assign(1) print(x.eval()) </code></pre> <p>But the output I get ...
34,220,750
8
0
null
2015-12-11 09:51:46.307 UTC
20
2019-12-13 18:33:53.317 UTC
2018-01-29 11:24:11.747 UTC
null
5,096,199
null
3,537,687
null
1
87
python|tensorflow|neural-network|deep-learning|variable-assignment
112,147
<p>In TF1, the statement <a href="https://www.tensorflow.org/api_docs/python/tf/compat/v1/Variable#assign" rel="noreferrer"><code>x.assign(1)</code></a> does not actually assign the value <code>1</code> to <code>x</code>, but rather creates a <a href="https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/Operati...
47,077,210
Using styled-components with props and TypeScript
<p>I'm trying to integrate TypeScript into our project and so far I stumbled upon one issue with <a href="https://www.styled-components.com/" rel="noreferrer">styled-components</a> library.</p> <p>Consider this component</p> <pre><code>import * as React from &quot;react&quot;; import styled from &quot;styled-components...
47,222,056
8
0
null
2017-11-02 14:02:06.36 UTC
21
2022-03-31 12:58:45.703 UTC
2021-08-21 08:16:18.96 UTC
null
6,904,888
null
911,930
null
1
79
javascript|reactjs|typescript|jsx|styled-components
99,201
<p><strong>This answer is outdated, the most current answer is here: <a href="https://stackoverflow.com/a/52045733/1053772">https://stackoverflow.com/a/52045733/1053772</a></strong></p> <p>As far as I can tell there is no official way (yet?) to do this, but you can solve it with a bit of trickery. First, create a <cod...
32,429,076
Develop and Debug Atom Package
<p>I have just began working on <a href="https://atom.io/docs/">Atom.io</a> Package development, and based on <a href="https://atom.io/docs/v1.0.11/hacking-atom-package-word-count">this tutorial</a>, have learnt from how to create package development skelton file to how to publish your package.</p> <p>However, I do no...
32,435,735
2
0
null
2015-09-06 22:57:05.447 UTC
16
2017-03-26 17:37:57.98 UTC
null
null
null
null
2,775,013
null
1
31
atom-editor
8,250
<p>When working on packages locally, here's the recommended workflow:</p> <ul> <li>Clone your package from GitHub using <code>apm develop &lt;package-name&gt;</code>. This will clone the package's repo to your local <code>~/.atom/dev/packages/&lt;package-name&gt;</code></li> <li><code>cd</code> into this directory</li...
31,595,750
How to use Cordova-plugin-purchase to do in-app purchase with ionic framework?
<p>I have been struggling with the implementation of in-app purchase for both iOS and Andriod in ionic. I came across tutorials regarding both the <a href="https://github.com/j3k0/cordova-plugin-purchase">cordova-plugin-purchase</a> and the <a href="https://github.com/AlexDisler/ng-storekit">ng-storekit</a>, but seems ...
35,741,779
2
0
null
2015-07-23 18:49:19.587 UTC
8
2016-05-13 05:09:39.427 UTC
2015-07-23 19:03:29.643 UTC
null
4,198,060
null
4,198,060
null
1
16
cordova|in-app-purchase|ionic-framework
6,624
<p>Maybe this brand new plugin (iOS/Android supported) could help you:</p> <p><a href="https://github.com/AlexDisler/cordova-plugin-inapppurchase">https://github.com/AlexDisler/cordova-plugin-inapppurchase</a></p> <p>The author has written a recent post on his blog:</p> <p><a href="https://alexdisler.com/2016/02/29/...
6,254,447
Using pHash from .NET
<p>I am trying to use <a href="http://phash.org" rel="nofollow noreferrer">pHash</a> from .NET</p> <p>First thing I tried was to register (regsvr32) <code>phash.dll</code> and asked <a href="https://stackoverflow.com/questions/6233343/how-to-add-unmanaged-dll-to-show-up-in-add-references-com-tab">here</a> Second of al...
6,268,367
1
9
null
2011-06-06 15:36:43.163 UTC
9
2013-03-25 14:48:02.917 UTC
2017-05-23 12:02:27.96 UTC
null
-1
null
4,035
null
1
9
c#|.net|c++|dllimport
6,268
<p>The current Windows source code project (as of 7/2011) on <a href="http://msdn.microsoft.com/en-us/library/c1h23y6c%28v=vs.71%29.aspx" rel="nofollow noreferrer">phash.org</a> does not seem to export the ph_ API calls from the DLL. You will need to add these yourself by __declspec(dllexport) at the beginning of the l...
5,941,583
UIDatePicker in UIActionSheet on iPad
<p>In the iPhone version of my app, I have a <code>UIDatePicker</code> in a <code>UIActionSheet</code>. It appears correctly. I am now setting up the iPad version of the app, and the same <code>UIActionSheet</code> when viewed on the iPad appears as a blank blank box. </p> <p>Here is the code I am using:</p> <pre><co...
5,952,179
1
5
null
2011-05-09 19:34:53.763 UTC
9
2011-12-13 14:31:53.107 UTC
2011-05-09 22:02:36.933 UTC
null
300,129
null
300,129
null
1
15
iphone|ipad|uidatepicker|uiactionsheet
11,414
<p>I ended up creating a separate segment of code for the iPad Popover:</p> <pre><code>//build our custom popover view UIViewController* popoverContent = [[UIViewController alloc] init]; UIView* popoverView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 344)]; popoverView.backgroundColor = [UIColor whiteColor];...
5,636,580
Force gfortran to stop program at first NaN
<p>To debug my application (fortran 90) I want to turn all NaNs to signalling NaN. </p> <p>With default settings my program works without any signals and just outputs NaN data in file. I want find the point, where NaN is generated. If I can recompile program with signalling NaN, I will get an <code>SIGFPE</code> signa...
5,636,881
1
0
null
2011-04-12 14:09:53.797 UTC
9
2015-11-03 12:08:00.973 UTC
2013-10-29 14:46:58.443 UTC
null
196,561
null
196,561
null
1
18
gcc|fortran|nan|gfortran
11,592
<p>The flag you're looking for is <code>-ffpe-trap=invalid</code>; I usually add <code>,zero,overflow</code> to check for related floating point exceptions. </p> <pre><code>program nantest real :: a, b, c a = 1. b = 2. c = a/b print *, c,a,b a = 0. b = 0. c = a/b print *, c,a,...
25,815,032
Finding Overlaps between interval sets / Efficient Overlap Joins
<h2>Overview:</h2> <p>I need to join two tables:</p> <p><code>ref</code> contains the time intervals (from <code>t1</code> to <code>t2</code>) along with an <code>id</code> for each interval and a <code>space</code> where this interval occurs.</p> <p><code>map</code> contains time intervals (<code>t1</code> to <cod...
25,818,856
1
0
null
2014-09-12 18:59:39.76 UTC
10
2015-10-03 18:08:23.437 UTC
2014-09-13 01:41:37.47 UTC
null
3,566,491
null
3,566,491
null
1
25
r|data.table|dplyr
6,974
<p>Ha, nice timing :). Just a few days back, overlap joins (or interval joins) was implemented. in data.table The function is <code>foverlaps()</code> and is available from the <a href="https://github.com/Rdatatable/data.table">github project page</a>. Make sure to have a look at <code>?foverlaps</code>.</p> <pre><cod...
25,546,417
Where can I download mysql jdbc jar from?
<p>I installed and tried to use jasper report studio. The first brick wall you hit when you try to create a datasource for your reports is </p> <pre><code>java.lang.ClassNotFoundException: com.mysql.jdbc.Driver </code></pre> <p>The forums say I need to install a jar on the classpath. I have no idea how to do this, so...
25,548,704
3
0
null
2014-08-28 10:21:25.743 UTC
7
2017-09-06 06:41:31.127 UTC
2014-08-28 19:11:12.413 UTC
null
466,862
null
1,072,187
null
1
58
mysql|jdbc|jar
187,229
<p>Go to <a href="http://dev.mysql.com/downloads/connector/j" rel="noreferrer">http://dev.mysql.com/downloads/connector/j</a> and with in the dropdown select "Platform Independent" then it will show you the options to download tar.gz file or zip file.</p> <p>Download zip file and extract it, with in that you will find...
28,478,945
React.js can't change checkbox state
<p>I created this simple TODO list, and when I want to check the checkbox I can't.</p> <pre><code>import React from 'react'; const TodoItem = React.createClass({ render() { return ( &lt;div&gt; &lt;span&gt;{this.props.todo}&lt;/span&gt; &lt;input type="checkbox" checked={this.props.done}...
28,479,290
3
0
null
2015-02-12 13:40:40.39 UTC
2
2020-02-03 17:43:13.84 UTC
2016-04-14 00:03:00.357 UTC
null
140,448
null
4,159,572
null
1
39
javascript|reactjs
73,174
<p>When you haven't specified an <code>onChange</code> handler on your inputs React will render the input field as read-only.</p> <pre><code>getInitialState() { return { done: false }; } </code></pre> <p>and</p> <pre><code>&lt;input type="checkbox" checked={this.state.done || this.props.done } onChan...
52,628,473
How to add multiple policies in action using Authorize attribute using identity 2.0?
<p>I am identity 2.1.2 with asp.net core 2.0, I have application claim table which have claim type and claim value i.e Assets ,Assets Edit,Assets, Assets View, where claim types are same with distinct claim values and I am creating policies using claim type name which is working fine for me no clue about how to add mu...
52,639,938
3
1
null
2018-10-03 13:44:28.987 UTC
11
2021-02-27 13:21:53.997 UTC
2020-08-26 20:43:27.49 UTC
null
6,844,481
null
4,046,078
null
1
14
c#|asp.net-core|claims-based-identity
13,314
<p>For multiple policys, you could implement your own <code>AuthorizeAttribute</code>. </p> <ul> <li><p><code>MultiplePolicysAuthorizeAttribute</code> </p> <pre><code>public class MultiplePolicysAuthorizeAttribute : TypeFilterAttribute { public MultiplePolicysAuthorizeAttribute(string po...
49,104,247
In Redux, where does the state actually get stored?
<p>I searched a bit about this question but found very vague answers. In redux, we know that the state is stored as an object. But where is this state stored actually? Is it somehow saved as a file which can be accessed by us later on? What I know is that it does not store it in a cookie format or in the browser's loca...
49,104,335
2
0
null
2018-03-05 05:52:31.103 UTC
7
2020-11-19 10:59:34.98 UTC
2018-04-26 02:00:56.373 UTC
null
3,928,341
null
5,864,426
null
1
36
javascript|reactjs|redux
17,832
<p>The state in Redux is stored in memory, <a href="https://github.com/reduxjs/redux/blob/master/src/createStore.ts#L61" rel="noreferrer">in the Redux store</a>.</p> <p>This means that, if you refresh the page, that state gets wiped out.</p> <p>You can imagine that store looking something like this:</p> <pre><code>func...
526,890
Best OpenId API for ASP.NET MVC application
<p>I am developing an ASP.NET MVC application and I want to use OpenId.</p> <p>What is the best option? </p> <ul> <li>DotNetOpenId</li> <li>RPX</li> <li>Other???</li> </ul> <p>Does anyone know what StackOverflow uses? Is the Login UI custom-developed, or provided by an API/service?</p>
526,897
2
3
null
2009-02-09 01:35:11.203 UTC
36
2010-12-20 04:06:20.387 UTC
2010-08-02 13:39:17.5 UTC
null
24,874
Jedi Master Spooky
1,154
null
1
46
asp.net-mvc|openid
7,567
<p>We use the excellent DotNetOpenId library here on Stack Overflow:</p> <blockquote> <p><a href="http://code.google.com/p/dotnetopenid/" rel="noreferrer">http://code.google.com/p/dotnetopenid/</a></p> </blockquote> <p>now moved to:</p> <blockquote> <p><a href="http://www.dotnetopenauth.net/" rel="noreferrer">ht...
3,094,126
Best Practice / Standard for storing an Address in a SQL Database
<p>I am wondering if there is some sort of "standard" for storing US addresses in a database? It seems this is a common task, and there should be some sort of a standard. </p> <p>What I am looking for is a <strong>specific</strong> schema of how the database tables should work and interact, already in third normal for...
3,433,390
6
2
null
2010-06-22 14:30:12.843 UTC
13
2021-12-09 13:00:02.407 UTC
2010-08-08 08:55:22.99 UTC
null
233,999
null
233,999
null
1
23
mysql|street-address
47,786
<p>For international addresses, refer to the <a href="https://www.upu.int/en-us" rel="nofollow noreferrer">Universal Postal Union</a>'s <a href="https://www.upu.int/en/Postal-Solutions/Programmes-Services/Addressing-Solutions#postal-addressing-systems-(pas)" rel="nofollow noreferrer">Postal Addressing Systems database<...
2,842,540
Is there a brief syntax for executing a block n times in Scala?
<p>I find myself writing code like this when I want to repeat some execution n times:</p> <pre><code>for (i &lt;- 1 to n) { doSomething() } </code></pre> <p>I'm looking for a shorter syntax like this:</p> <pre><code>n.times(doSomething()) </code></pre> <p>Does something like this exist in Scala already?</p> <p><st...
2,842,640
6
5
null
2010-05-16 03:56:36.397 UTC
12
2019-10-28 08:02:12.25 UTC
2010-05-16 15:40:33.833 UTC
null
23,572
null
23,572
null
1
56
scala
26,650
<p>You could easily define one using Pimp My Library pattern.</p> <pre><code>scala&gt; implicit def intWithTimes(n: Int) = new { | def times(f: =&gt; Unit) = 1 to n foreach {_ =&gt; f} | } intWithTimes: (n: Int)java.lang.Object{def times(f: =&gt; Unit): Unit} scala&gt; 5 times { | println("...
2,972,077
Multiline text as the button label in Windows Forms
<p>Basically, I am creating a button in an oval shape. But my button label is too long to display in one line, so I wanted to split it into multiple lines so that the oval button looks good.</p> <p>How do I enable word wrap on a button?</p>
2,972,371
7
0
null
2010-06-04 06:57:52.323 UTC
2
2018-07-30 10:27:24.603 UTC
2014-01-21 12:33:26.163 UTC
null
63,550
null
321,959
null
1
15
c#|winforms|button|word-wrap|shapes
58,253
<p>Set the label text on form load and add Environment.Newline as the newline string, like this:</p> <pre><code>btnOK.Text = "OK" + Environment.NewLine + "true"; </code></pre>
2,692,340
MySQL - How to count all rows per table in one query
<p>Is there a way to query the DB to find out how many rows there are in all the tables?</p> <p>i.e.</p> <pre><code>table1 1234 table2 222 table3 7888 </code></pre> <p>Hope you can advise</p>
2,692,395
9
1
null
2010-04-22 15:50:10.72 UTC
30
2020-09-22 11:21:01.65 UTC
2017-08-30 14:02:20.557 UTC
null
4,519,059
null
99,877
null
1
73
sql|mysql|count
72,229
<pre><code>SELECT TABLE_NAME, TABLE_ROWS FROM `information_schema`.`tables` WHERE `table_schema` = 'YOUR_DB_NAME'; </code></pre>
2,519,933
GIT clone repo across local file system in windows
<p>I am a complete Noob when it comes to GIT. I have been just taking my first steps over the last few days. I setup a repo on my laptop, pulled down the Trunk from an SVN project (had some issues with branches, not got them working), but all seems ok there.</p> <p>I now want to be able to pull or push from the lapt...
2,520,121
9
6
null
2010-03-25 22:34:47.117 UTC
90
2019-11-22 12:54:01.607 UTC
2014-11-09 09:16:38.583 UTC
null
1,143,013
null
6,486
null
1
208
windows|git|git-clone
207,142
<p>You can specify the remote’s URL by applying the <a href="http://msdn.microsoft.com/en-us/library/gg465305.aspx" rel="noreferrer" title="Universal Naming Convention">UNC</a> path to the file protocol. This requires you to use four slashes:</p> <pre><code>git clone file:////&lt;host&gt;/&lt;share&gt;/&lt;path&gt; </...
3,100,319
Event on a disabled input
<p>Apparently a disabled <code>&lt;input&gt;</code> is not handled by any event</p> <p>Is there a way to work around this issue ?</p> <pre><code>&lt;input type="text" disabled="disabled" name="test" value="test" /&gt; </code></pre> <pre class="lang-javascript prettyprint-override"><code>$(':input').click(function ()...
3,100,395
12
3
null
2010-06-23 09:09:26.457 UTC
54
2021-10-30 00:12:01.73 UTC
2019-11-10 03:44:08.317 UTC
null
667,810
null
305,189
null
1
266
javascript|jquery|html
281,634
<p>Disabled elements don't fire mouse events. Most browsers will propagate an event originating from the disabled element up the DOM tree, so event handlers could be placed on container elements. However, Firefox doesn't exhibit this behaviour, it just does nothing at all when you click on a disabled element.</p> <p...
2,801,882
Generating a PNG with matplotlib when DISPLAY is undefined
<p>I am trying to use networkx with Python. When I run this program it get this error. Is there anything missing?</p> <pre><code>#!/usr/bin/env python import networkx as nx import matplotlib import matplotlib.pyplot import matplotlib.pyplot as plt G=nx.Graph() G.add_node(1) G.add_nodes_from([2,3,4,5,6,7,8,9,10]) #nx...
3,054,314
13
3
null
2010-05-10 10:22:33.093 UTC
113
2022-03-29 17:30:52.143 UTC
2016-08-08 23:37:26.403 UTC
null
2,966,723
null
3,836,677
null
1
331
python|matplotlib|graph
180,462
<p>The main problem is that (on your system) matplotlib chooses an x-using backend by default. I just had the same problem on one of my servers. The solution for me was to add the following code in a place that gets read <em>before</em> any other pylab/matplotlib/<strong>pyplot</strong> import:</p> <pre><code>import ...
25,306,519
Shiny saving URL state subpages and tabs
<p>I would like to have a shiny website that keeps the dynamic choices in the URL as output, so you can copy and share the URL. I took this code as an example: <a href="https://gist.github.com/amackey/6841cf03e54d021175f0" rel="noreferrer">https://gist.github.com/amackey/6841cf03e54d021175f0</a></p> <p>And modified it...
25,385,474
2
0
null
2014-08-14 11:05:24.263 UTC
10
2016-09-15 12:41:54.513 UTC
2014-08-19 08:38:59.427 UTC
null
719,016
null
719,016
null
1
21
r|shiny
6,142
<h1>UPDATE</h1> <p>Shiny .14 now available on CRAN supports saving app state in a URL. See <a href="http://shiny.rstudio.com/articles/bookmarking-state.html" rel="noreferrer">this article</a></p> <hr> <p>This answer is a more in-depth answer than my first that uses the entire sample code provided by OP. I've decided...
45,625,844
Is it advisable to use LinearLayout inside ConstraintLayout in Android?
<p>I am new to <code>ConstraintLayout</code> in Android and newbie to Android too. I have a question. Is it advisable to use <code>LinearLayout</code> inside <code>ConstraintLayout</code>? For example:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;android.support.constraint.ConstraintLayout xmlns...
45,626,000
2
1
null
2017-08-11 02:03:34.873 UTC
2
2022-09-18 08:37:23.013 UTC
2017-11-27 17:05:30.98 UTC
null
1,708,390
null
357,166
null
1
38
android|android-constraintlayout
27,657
<blockquote> <p>Is it advisable to use LinearLayout inside ConstraintLayout?</p> </blockquote> <p>No... usually.</p> <p>In general, the idea behind <code>ConstraintLayout</code> is that it allows you to position all of your children without having to nest any other <code>ViewGroup</code>s inside the <code>Constrain...
10,365,523
Adding a page loader using jQuery
<p>I need a little help. I do not know where to start. I need to add a page loader to my website. I first submit a form it then uses SimpleXML to call an exterior XML Sheet with expedia... It takes a minute to load, so I would like to add the image loader to this page. But how do I go about doing this? I have looked on...
10,365,835
3
0
null
2012-04-28 16:45:09.497 UTC
4
2020-06-22 09:36:19.027 UTC
2020-06-22 09:36:19.027 UTC
null
4,217,744
null
1,094,309
null
1
4
jquery|pageload|page-loading-message
64,874
<p>This has many solutions, but a simple one is to:</p> <p>1- Create an overlay DIV with your loader stuff and prepend to BODY;<br> 2- Add an event listener for <code>window.load</code> or <code>document.ready</code> event that hides this DIV.</p> <pre><code>// On the first line inside BODY tag &lt;script type="text/...
10,543,325
Can't connect to server on SQL Server Management Studio 2008
<p>When I open the Management Studio and try to connect using the [PCNAME]/SQLEXPRESS it shows this error:</p> <blockquote> <p>"Cannot connect to [PCNAME]\SQLEXPRESS"</p> </blockquote> <hr> <p>ADDITIONAL INFORMATION:</p> <p>Error Message:</p> <blockquote> <p>A network-related or instance-specific error occurre...
10,543,353
3
0
null
2012-05-10 23:05:01.877 UTC
2
2021-05-19 20:43:45.147 UTC
2017-01-14 21:31:16.91 UTC
null
13,302
null
1,200,185
null
1
8
sql-server-2008|sql-server-2008-express
38,680
<p>Make sure SQL Server (SQL Express) service is running.</p> <p>in powershell prompt type:</p> <pre><code>Get-Service -Name 'MSSQL$SQLEXPRESS' </code></pre> <p>service "status" property should be reported as "Running"</p> <p>If it is not, type (you need to be in elevated prompt, i.e. "Run as Administrator"):</p> ...
5,833,642
python: APNs SSLError
<p>I am trying to send push notifications to iPhone via python as described <a href="http://leenux.org.uk/2009/07/14/push-on-the-iphone/" rel="noreferrer">here</a> but I am getting the following error:</p> <pre><code>Traceback (most recent call last): File "&lt;console&gt;", line 1, in &lt;module&gt; File "/home/o...
5,855,800
2
2
null
2011-04-29 14:52:15.417 UTC
16
2014-03-19 13:41:55.157 UTC
2011-04-29 15:37:13.867 UTC
null
287,923
null
287,923
null
1
18
python|ssl|apple-push-notifications
12,462
<p>Here is how I get it working:</p> <p>From within KeyChain export the following both in <code>p12</code> format, without giving password:</p> <ul> <li><code>Apple Development Push Services</code> certificate as <code>cert.p12</code></li> <li><code>primary key</code> under <code>Apple Development Push Services</code...
6,084,743
Rails ActiveRecord: building queries dynamically
<p>I'm trying to put together a series of classes that can use ActiveRecord to create and execute complex queries dynamically. I feel very comfortable with the whole practice of doing:</p> <pre><code>MyModel.select("id, name, floober").join(:creator).where(:is_active =&gt; true) </code></pre> <p>What I'm struggling w...
6,085,124
2
0
null
2011-05-21 22:07:00.7 UTC
9
2012-12-14 13:34:29.4 UTC
null
null
null
null
483,040
null
1
29
ruby-on-rails|ruby-on-rails-3|activerecord
16,279
<p>I think I figured it out. I was fairly off base on my understanding of the AR query methods. It turns out that ActiveRecord doesn't actually execute the query until you actually try to use the results. As a result it's possible to do things like:</p> <pre><code>model_query = MyModel.select("column12, column32") mod...
31,343,299
MySQL Improperly Configured Reason: unsafe use of relative path
<p>I'm using Django, and when I run <code>python manage.py runserver</code> I receive the following error: </p> <pre><code>ImproperlyConfigured: Error loading MySQLdb module: dlopen(/Library/Python/2.7/site-packages/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib Referenced from: /Library/Python/2.7/site-...
31,821,332
2
2
null
2015-07-10 14:26:27.13 UTC
15
2016-10-22 07:26:01.883 UTC
2017-05-23 11:47:11.08 UTC
null
-1
null
3,990,714
null
1
27
python|mysql|django|dynamic-linking|osx-elcapitan
11,881
<p>In OS X El Capitan (10.11), Apple added <a href="https://support.apple.com/en-us/HT204899" rel="noreferrer">System Integrity Protection</a>.</p> <p>This prevents programs in protected locations like <code>/usr</code> from calling a shared library that uses a relative reference to another shared library. In the cas...
23,188,932
how do I clean up my docker host machine
<p>As I create/debug a docker image/container docker seems to be leaving all sorts of artifacts on my system. (at one point there was a 48 image limit) But the last time I looked there were 20-25 images; <code>docker images</code>.</p> <p>So the overarching questions are:</p> <ul> <li>how does one properly cleanup?</...
32,464,728
6
0
null
2014-04-21 00:00:37.24 UTC
18
2017-10-02 16:00:31.137 UTC
null
null
null
null
99,542
null
1
30
docker|coreos
19,671
<p>It can also be helpful to remove "dangling" images</p> <p><code>docker rmi $(docker images -f "dangling=true" -q)</code></p>
33,059,933
package org.apache.http.client does not exist
<p>I am trying to check log in credentials , But I am getting these errors again and again , I have tried everything. I am new to android Any kind of help will be appreciated. If there is other good way to implement same , want to know how to imply</p> <p>Error</p> <pre><code>Error:(19, 30) error: package org.apache...
33,059,990
2
0
null
2015-10-10 23:13:17.837 UTC
4
2015-10-11 01:34:25.633 UTC
null
null
null
null
4,974,092
null
1
14
java|android|http|android-studio
67,779
<p>Add that to your build.gradle:</p> <pre><code>android { useLibrary 'org.apache.http.legacy' } </code></pre> <p>Or you use the <code>HttpURLConnection class</code> instead.</p>
21,565,738
Using toastr in the AngularJS way
<p>Currently, I just call <code>toastr.success('my message')</code> within a controller where required. This work fine, but it feels a bit dirty to me. </p> <p>Is there a 'best practice' or recommended 'angularjs' way of using the <a href="https://github.com/CodeSeven/toastr">toastr.js library</a>?</p>
21,565,779
1
0
null
2014-02-04 23:29:13.203 UTC
3
2017-11-14 10:56:10.977 UTC
2015-05-21 13:15:52.28 UTC
null
2,874,896
null
1,248,716
null
1
29
javascript|angularjs|toastr
23,468
<p>Yes. Pretty simply:</p> <pre><code>app.factory('notificationFactory', function () { return { success: function (text) { toastr.success(text,"Success"); }, error: function (text) { toastr.error(text, "Error"); } }; }); </code></pre> <p>Resolve factory ...
25,931,716
Add new lines in VBA email
<p>I'm trying to send an email automatically through Excel, but the new line commands aren't working! I've tried <code>&lt;br/&gt;</code>, <code>vbCrLf</code> and <code>vbNewLine</code></p> <pre><code>.HTMLbody = "Hello" &amp; vbNewLine &amp; "Please find attached the above invoices and backup" &amp; vbNewLine &amp; ...
25,931,889
4
0
null
2014-09-19 10:23:54.133 UTC
1
2022-02-18 13:23:02.253 UTC
null
null
null
null
4,043,074
null
1
11
vba|excel|excel-2007|html-email
121,238
<p>May be you can try this instead: Use</p> <pre><code>.HTMLbody = "Hello" &amp; "&lt;br&gt;" &amp; "Please find attached the above invoices and backup" &amp; "&lt;br&gt;" </code></pre> <p>instead of vbnewline</p>
8,944,860
How to create an IP alias on Windows
<p>I need to create an alias for my network interface such that it can be accessed locally with either 127.0.0.1 or 33.33.33.33.</p> <p>In *nix I would do this:</p> <pre><code>sudo ifconfig en1 inet 33.33.33.33/32 alias </code></pre> <p>It appears that the <code>netsh</code> tool may be able to do the same thing. I...
8,944,928
7
0
null
2012-01-20 16:46:03.273 UTC
7
2022-04-28 17:52:37.4 UTC
null
null
null
null
63,308
null
1
16
windows|ip|netsh
92,502
<p>You'd be correct. Also, you can add multiple addresses without touching the command line using the advanced interface properties screen.</p> <pre><code>netsh interface ip add address "Local Area Connection" 33.33.33.33 255.255.255.255 </code></pre> <p><img src="https://i.stack.imgur.com/nA5wA.png" alt="Windows Adv...
8,905,662
How to change all occurrences of a word in all files in a directory
<p>I was in the process of creating a <code>User</code> class where one of the methods was <code>get_privileges();</code>.</p> <p>After hours of slamming my head into the keyboard, I finally discovered that the previous coder who I inherited this particular database spelled the word "<strong>privileges</strong>" as "...
8,905,787
3
0
null
2012-01-18 05:37:27.723 UTC
15
2020-12-15 23:16:04.947 UTC
2018-07-16 23:25:38.157 UTC
null
5,377,495
null
714,178
null
1
42
linux|ubuntu|replace
49,352
<p>A variation that takes into account subdirectories (untested):</p> <pre><code>find /var/www -type f -exec sed -i 's/privelages/privileges/g' {} \; </code></pre> <p>This will <code>find</code> all files (not directories, specified by <code>-type f</code>) under <code>/var/www</code>, and perform a <code>sed</code> ...
55,269,763
Return a Pandas DataFrame as a data_table from a callback with Plotly Dash for Python
<p>I would like to read a .csv file and return a groupby function as a callback to be displayed as a simple data table with "dash_table" library. @Lawliet's helpful answer shows how to do that with "dash_table_experiments" library. Here is where I’m stuck:</p> <pre><code>import pandas as pd import dash import dash_cor...
55,305,812
2
0
null
2019-03-20 20:37:25.623 UTC
10
2019-11-26 10:25:51.38 UTC
2019-11-26 10:25:51.38 UTC
null
11,733,759
null
5,405,782
null
1
7
python|pandas|plotly-dash
24,538
<p>When you are trying to register the callback <code>Output</code> component as a <code>DataTable</code>, all the required / mandatory attributes for the <code>DataTable</code> component should be updated in the callback and returned. In your code, you are updating just <code>DataTable.data</code> and not <code>DataTa...
43,581,127
What are the benefits of Apache Beam over Spark/Flink for batch processing?
<p><a href="https://beam.apache.org/documentation/" rel="noreferrer">Apache Beam</a> supports multiple runner backends, including Apache Spark and Flink. I'm familiar with Spark/Flink and I'm trying to see the pros/cons of Beam for batch processing.</p> <p>Looking at the <a href="https://beam.apache.org/get-started/wo...
43,672,838
3
0
null
2017-04-24 06:26:45.41 UTC
34
2022-09-03 07:38:16.233 UTC
2017-05-23 12:09:56.457 UTC
null
-1
null
1,804,173
null
1
107
apache-spark|apache-flink|apache-beam
39,373
<p>There's a few things that Beam adds over many of the existing engines.</p> <ul> <li><p><strong>Unifying batch and streaming.</strong> Many systems can handle both batch and streaming, but they often do so via separate APIs. But in Beam, batch and streaming are just two points on a spectrum of latency, completeness,...
1,270,018
Explain the FFT to me
<p>I want to take audio PCM data and find peaks in it. Specifically, I want to return the frequency and time at which a peak occurs.</p> <p>My understanding of this is that I have to take the PCM data and dump it into an array, setting it as the real values with the complex parts set to 0. I then take the FFT, and I...
1,274,663
3
1
null
2009-08-13 04:22:41.827 UTC
14
2009-12-18 19:42:59.403 UTC
null
null
null
null
143,879
null
1
15
audio|signals|frequency|fft
8,329
<p>You may actually be looking for a <em><a href="http://en.wikipedia.org/wiki/Spectrogram" rel="nofollow noreferrer">spectrogram</a></em>, which is basically an FFT of the data in a small window that's slid along the time axis. If you have software that implements this, it might save you some effort. It's what's com...
1,043,378
Print full call stack on printStackTrace()?
<p>I need to write small a log analyzer application to process some log files generated by a 3rd party closed source library (having custom logger inside) used in my project. </p> <p>In case of an exception entry in the log I need to collect aggregated information about the methods involved along the stack trace from ...
1,043,484
3
1
null
2009-06-25 11:19:30.19 UTC
7
2013-01-03 20:13:40.227 UTC
2009-06-25 11:50:58.783 UTC
null
61,158
null
61,158
null
1
48
java|logging|stack-trace
64,777
<p><a href="https://stackoverflow.com/questions/437756/how-do-i-stop-stacktraces-truncating-in-logs">here is an explanation</a> of the 'caused by' and '... <em>n</em> more' lines in the printed trace. see also the <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Throwable.html#printStackTrace%28%29" rel="no...
35,311,318
Opening Shiny App directly in the default browser
<p>Normally the shiny app opens through the inbuilt browser within R-Studio. Is it possible to open the app directly in the web browser, say Google Chrome, without going through the R-Studio.</p>
35,312,401
4
2
null
2016-02-10 09:33:01.013 UTC
8
2022-08-04 14:55:43.07 UTC
2022-08-04 14:55:43.07 UTC
null
5,221,626
null
4,246,716
null
1
34
r|shiny
30,248
<p>To run it using different approach to @Batanichek you can locate the executables of each of your browsers and then specify it in options which to point to, as so:</p> <p><strong>Edit:</strong> You can find the <code>options</code> and its arguments in the R environment (I used RStudio) e.g. <code>options(browser = ...
28,677,638
ngChange-like functionality for the entire form
<p>I would like to do an equivalent of <code>ng-change</code> for the entire form whenever there is a change in one of its input fields.</p> <p>I know that since AngularJS 1.3 I have the debounce option but it applies only for a single input.</p> <p>I'm looking for a "debounce"/"on change" functionality that will app...
28,678,545
4
1
null
2015-02-23 15:49:16.983 UTC
9
2018-08-10 12:26:20.83 UTC
2017-06-02 21:03:31.47 UTC
null
1,264,804
null
1,846,993
null
1
42
angularjs|onchange|forms
38,499
<p>There isn't a built-in way to do <code>ng-change</code> for a form.</p> <p>It may not even be needed, because if you organized your view model properly, then your form inputs are likely bound to a certain scope-exposed property:</p> <pre><code>$scope.formData = {}; </code></pre> <p>and in the View:</p> <pre><cod...
28,742,018
Swift Increase font size of the UITextview,how?
<p>I am trying to add two buttons to my app to set the font size of a UITextview,and i found this function</p> <pre><code>textview.font.increaseSize(...) //and decreaseSize(...) </code></pre> <p>But i don't understand what I have to put inside the parentheses,i want to increase and decrease the font size by one point...
28,742,178
5
1
null
2015-02-26 12:05:50.07 UTC
8
2020-06-05 07:00:30.457 UTC
null
null
null
null
4,561,398
null
1
29
ios|swift|fonts|uitextview
43,923
<p>I don't think there's a method named <code>increaseSize()</code>. May be you've find some <code>UIFont</code> or <code>UITextView</code> category.</p> <p>The <a href="https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIFont_Class/">official <code>UIFont</code></a> class document doesn't reveal a...
56,435,054
Xcode Canvas for SwiftUI previews does not show up
<p>I´m trying to get the new Canvas feature from Xcode 11 running, but the Canvas won´t show up. What am I doing wrong?</p> <p>This new Xcode feature should show a live preview of my SwiftUI views without running the app.</p> <blockquote> <p>When you create a custom View with SwiftUI, Xcode can display a preview of the...
56,435,175
18
1
null
2019-06-03 22:00:20.857 UTC
4
2022-09-16 10:12:48.603 UTC
2022-04-21 19:02:35.423 UTC
null
1,265,393
null
727,742
null
1
45
ios|swift|xcode|swiftui|xcode11
35,003
<p>You need to be on <strong>Catalina</strong> macOS version (10.15), as stated in <a href="https://developer.apple.com/tutorials/swiftui/creating-and-combining-views" rel="noreferrer">official tutorial</a></p> <p>Be warned: Catalina doesn't support 32-bit applications, some old apps will stop working after update.</p...
24,034,588
Static Html Website - Bootstrap - Multi language Support
<p>To begin with I want to state that I am newbie in Web Development.</p> <p>I was asked to build a static website (for a small - size hotel), and I bought <a href="http://themeforest.net/item/sunshine-responsive-hotel-template/5635208?WT.ac=search_item&amp;WT.seg_1=search_item&amp;WT.z_author=aveothemes">this</a> res...
24,035,422
7
0
null
2014-06-04 10:07:35.027 UTC
19
2021-09-27 05:46:47.903 UTC
2015-12-19 03:54:55.903 UTC
null
1,045,902
null
2,254,704
null
1
30
javascript|html|css|twitter-bootstrap-3|multilingual
66,184
<p>You can do this within a single file without using any server-side programming languages. You should check out <a href="http://i18next.com">i18next</a> for a proper <strong>javascript solution</strong>. </p> <p>You can also use pure <strong>CSS</strong> to translate a homepage. Try something like </p> <pre><code>....
42,889,699
Smooth drawing with Apple Pencil
<p>I am developing a diagraming app for Apple Pencil using Qt-5.8/PyQt5 and am trying to get the pencil strokes as smooth as some of the other apps that I am seeing, namely Notability and PDF Expert. I patched Qt-5.8 to provide fast access to the floating-point coalesced and predicted UITouch data provided by Apple and...
42,891,040
2
1
null
2017-03-19 17:25:31.513 UTC
9
2019-08-08 10:52:08.993 UTC
2017-03-19 19:26:23.937 UTC
null
1,271,826
null
414,605
null
1
2
ios|qt|uikit
2,756
<p>Note taking apps tend to actually store and paint the drawings as vectors, which is why they are smooth. It also enables several cool features, like being able to select and move text around, change its color and style, it is also very efficient for storage and can be zoomed in or out without loss of resolution, com...
42,952,979
go version command shows old version number after update to 1.8
<p>Pretty much the title. I downloaded/installed Go 1.8 for OS X, but when I go</p> <pre><code>$ go version go version go1.7.5 darwin/amd64 </code></pre> <p>My .bashrc look like the following</p> <pre><code># some exports omitted NPM_PACKAGES=/Users/&lt;me&gt;/.npm-packages NODE_PATH="$NPM_PACKAGES/lib/node_modules...
42,953,523
6
2
null
2017-03-22 13:24:52.82 UTC
9
2022-05-13 10:39:01.25 UTC
null
null
null
null
1,400,741
null
1
46
macos|go|upgrade
88,719
<p>You obviously have an old version of Go installed, else you couldn't see <code>go version go1.7.5 darwin/amd64</code> as the output of <code>go version</code>.</p> <p>IDEs might have more advanced method of detecting Go installations other that simply scanning <code>PATH</code> and <code>GOROOT</code> (and that's w...
36,200,749
How do you add more property values to a custom object
<p>If I do this</p> <pre><code>$account = New-Object -TypeName psobject -Property @{User="Jimbo"; Password="1234"} </code></pre> <p>How do I add <strong>additional</strong> User and Password values to <code>$account</code> without overwriting the existing one?</p> <p>I cannot pre-populate <code>$account</code> from ...
36,200,906
2
2
null
2016-03-24 12:57:02.983 UTC
4
2018-06-11 08:06:08.543 UTC
2016-03-24 13:24:32.373 UTC
null
1,630,171
null
5,233,104
null
1
18
powershell|object
54,666
<p>If you want to use <code>$account</code> to store user + pwd credentials, you should declare it as an <code>array</code> and add items when you want:</p> <pre><code>$account = @() $account += New-Object -TypeName psobject -Property @{User="Jimbo"; Password="1234"} $account += New-Object -TypeName psobject -Property...
5,739,140
MediaScannerConnection produces android.app.ServiceConnectionLeaked
<p>I'm using the MediaScannerConnection example code from the <a href="http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/content/ExternalStorage.html" rel="nofollow noreferrer">API Demos</a></p> <p>The snippet I'm using is:</p> <pre><code>MediaScannerConnection.scanFile( context...
12,821,924
3
3
null
2011-04-21 03:22:30.08 UTC
6
2019-11-07 09:06:22.1 UTC
2019-11-07 08:54:57.333 UTC
null
63,550
null
341,390
null
1
29
android|sample
7,104
<p>I noticed the same kind of error message using the code snippet provided with the documentation of <a href="http://developer.android.com/reference/android/os/Environment.html#getExternalStoragePublicDirectory%28java.lang.String%29" rel="nofollow noreferrer">Environment.getExternalStoragePublicDirectory</a>.</p> <p>...
5,832,208
WPF Attached Property Data Binding
<p>I try to use binding with an attached property. But can't get it working.</p> <pre><code>public class Attached { public static DependencyProperty TestProperty = DependencyProperty.RegisterAttached("TestProperty", typeof(bool), typeof(Attached), new FrameworkPropertyMetadata(false, FrameworkPrope...
5,832,247
3
0
null
2011-04-29 12:45:30.63 UTC
21
2019-01-10 07:32:33.317 UTC
2018-11-13 18:34:40.78 UTC
null
1,644,522
null
613,320
null
1
80
wpf|xaml|binding|attached-properties
43,253
<p>Believe it or not, just add <code>Path=</code> and use parenthesis when binding to an attached property:</p> <pre><code>IsChecked="{Binding Path=(local:Attached.Test), Mode=TwoWay, RelativeSource={RelativeSource Self}}" </code></pre> <p>In addition, your call to <code>RegisterAttached</code> should pass in "Test" ...
2,200,250
How to "automatically" remove unused units from uses clause?
<p>Does anyone know about a utility, that can automatically detect and remove unrequired units from the <code>uses</code> clause? </p> <p>Preferably it .. </p> <ul> <li>can be run against a unit and/or a project</li> <li>is free and works with Delphi 2010</li> </ul> <p>Thanks in advance.</p>
2,200,324
2
3
null
2010-02-04 14:16:02.137 UTC
13
2019-12-13 08:15:41.843 UTC
2018-10-25 17:09:36.36 UTC
null
9,818,506
null
266,256
null
1
27
delphi|delphi-2010
12,244
<p>Try using the "Uses Unit Cleaner" Wizard from <a href="http://www.cnpack.org/index.php?lang=en" rel="nofollow noreferrer">CnPack</a> you can download from <a href="http://www.cnpack.org/showdetail.php?id=669&amp;lang=en" rel="nofollow noreferrer">here</a></p> <p><a href="https://i.stack.imgur.com/fXzV7.png" rel="no...
1,495,636
Can I have an Action<> or Func<> with an out param?
<p>I have a method with an <code>out</code> parameter, and I'd like to point an <code>Action</code> or <code>Func</code> (or other kind of delegate) at it.</p> <p>This works fine:</p> <pre><code>static void Func(int a, int b) { } Action&lt;int,int&gt; action = Func; </code></pre> <p>However this doesn't</p> <pre><c...
1,495,657
2
1
null
2009-09-30 00:47:24.247 UTC
6
2013-01-23 17:51:51.167 UTC
null
null
null
null
234
null
1
40
c#|delegates
21,101
<p>Action and Func specifically do not take out or ref parameters. However, they are just delegates.</p> <p>You can make a custom delegate type that does take an out parameter, and use it, though.</p> <p>For example, the following works:</p> <pre><code>class Program { static void OutFunc(out int a, out int b) {...
1,655,361
how to clone an old git-commit (and some more questions about git)
<p>I have a git-repository of my project with about 20 commits. I know how to clone the actual commit with <code>git clone</code>, </p> <ul> <li>but how can I "clone" an old commit? </li> <li>is there a really good git-GUI (imho <code>qgit</code> is not a good GUI)? </li> <li>what exactly are "branches"?</li> <li>w...
1,655,666
2
0
null
2009-10-31 19:32:05.96 UTC
32
2016-02-26 13:45:39.36 UTC
null
null
null
null
150,667
null
1
84
git
105,878
<p>A git repository contains the all history at all time.<br> So when you are cloning a repository, you are cloning it with its full history, and <em>then</em>, you can make a branch from whatever commit you want:</p> <pre><code> $ git checkout -b aNewBranch SHA1 </code></pre> <p>with SHA1 representing the commit id ...
32,291,026
Latex table multiple row and multiple column
<p>I'm trying to create a table in Latex but without success. I tried different solutions but no one solves my problem. I would like create a table like the picture below:</p> <p><a href="https://i.stack.imgur.com/xZnUZ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/xZnUZ.png" alt="enter image description he...
32,291,618
2
2
null
2015-08-29 21:53:26.563 UTC
12
2021-02-04 22:40:07.387 UTC
2021-02-04 22:40:07.387 UTC
null
3,543,233
null
1,037,475
null
1
25
latex|multiple-columns|tabular|multirow
126,339
<p>One first sketch may be the following:</p> <pre class="lang-latex prettyprint-override"><code>\documentclass{article} \usepackage{multirow} \begin{document} \begin{tabular}{|c|c|c|c|c|c|} \hline \multirow{3}{*}{A} &amp; \multicolumn{2}{c|}{User B} &amp; % \multicolumn{2}{c|}{User C} &amp; \multirow{3}{*}{D}\\...
6,309,725
Newtonsoft ignore attributes?
<p>I am currently using the same C# DTOs to pull data out of CouchDB, via LoveSeat which I am going to return JSON via an ASP MVC controller.</p> <p>I am using the NewtonSoft library to seralise my DTOs before sending them down through the controller. </p> <p>However, as CouchDB also uses NewtonSoft it is also respec...
6,315,258
5
0
null
2011-06-10 17:04:02.823 UTC
9
2019-10-04 00:46:01.78 UTC
2019-04-04 09:49:51.677 UTC
null
9,267,987
null
208,754
null
1
83
c#|asp.net-mvc|couchdb|json.net
111,269
<p>I ended up making all properties I needed to only add attributes to virtual, and overriding them alone in another class, with the relevant newtonsoft attributes.</p> <p>This allows me to have different serialisation behavior when de-serialising from CouchDB and serialising for a GET, without too much dupe. It is fi...
5,735,592
Determine Keys from Functional Dependencies
<p>I'm taking a database theory course, and it's not clear to me after doing the reading how I can infer keys, given a set of functional dependencies.</p> <p>I have an example problem:</p> <p>Find all keys of the relation R(ABCDEFG) with functional dependencies</p> <pre><code>AB → C CD → E EF → G FG → E DE → C BC → ...
5,736,174
6
2
null
2011-04-20 19:26:53.523 UTC
23
2019-08-04 17:48:16.5 UTC
2012-10-02 16:12:26.81 UTC
null
992,687
null
641,455
null
1
45
database|functional-dependencies
79,557
<p>Take an FD, e.g. AB→C</p> <p>Augment until all attributes are mentioned, e.g. ABDEFG → CDEFG (note that this is equivalent to ABDEFG → ABCDEFG because it is trivially true that A->A and B->B).</p> <p>This tells you that ABDEFG is a superkey.</p> <p>Check the other FDs in which the LHS is a subset of your superkey...
5,687,341
iPhone:Programmatically compressing recorded video to share?
<p>I have implemented an overlay view when calling camera view before recording the video.</p> <pre><code>pickerController.cameraOverlayView =myOverlay; </code></pre> <p>Video recording and saving the video into Album after recording the video and sharing via email etc. all works fine.</p> <p>If i use video quality ...
5,853,354
7
1
null
2011-04-16 14:58:25.43 UTC
47
2022-08-11 13:07:23.75 UTC
2012-03-14 08:40:46.493 UTC
null
125,099
null
187,532
null
1
45
iphone
50,802
<p>If you want to compress the video for remote sharing and keep the original quality for local storage on the iPhone, you should look into <a href="http://developer.apple.com/library/ios/#documentation/AVFoundation/Reference/AVAssetExportSession_Class/Reference/Reference.html#//apple_ref/occ/cl/AVAssetExportSession">A...
5,757,101
Change Input to Upper Case
<p>JS: </p> <pre><code>&lt;script type="text/css"&gt; $(function() { $('#upper').keyup(function() { this.value = this.value.toUpperCase(); }); }); &lt;/script&gt; </code></pre> <p><strong>HTML</strong></p> <pre><code>&lt;div id="search"&gt; &lt;input type="radio" name="table" class="table" va...
5,757,133
15
2
null
2011-04-22 15:41:38.88 UTC
15
2020-04-25 16:06:27.6 UTC
2011-04-22 17:08:38.66 UTC
null
700,070
null
700,070
null
1
83
javascript|jquery
245,376
<p>I think the most elegant way is without any javascript but with css. You can use <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform" rel="noreferrer"><code>text-transform: uppercase</code></a> (this is inline just for the idea):</p> <pre><code>&lt;input id="yourid" style="text-transform: upper...
6,001,654
How to render a DateTime in a specific format in ASP.NET MVC 3?
<p>If I have in my model class a property of type <code>DateTime</code> how can I render it in a specific format - for example in the format which <code>ToLongDateString()</code> returns?</p> <p>I have tried this...</p> <pre><code>@Html.DisplayFor(modelItem =&gt; item.MyDateTime.ToLongDateString()) </code></pre> <p>...
6,001,836
15
0
null
2011-05-14 11:56:01.523 UTC
28
2017-12-28 11:41:02.133 UTC
2011-05-14 12:57:28.6 UTC
null
270,591
null
270,591
null
1
119
asp.net|asp.net-mvc|asp.net-mvc-3
218,759
<p>If all you want to do is display the date with a specific format, just call:</p> <pre><code>@String.Format(myFormat, Model.MyDateTime) </code></pre> <p>Using <code>@Html.DisplayFor(...)</code> is just extra work unless you are specifying a template, or need to use something that is built on templates, like iterati...
55,802,212
Error related to resources_ap after upgrading to Android Studio 3.4
<p>I upgraded Android Studio 3.4 today. I am no longer able to run the the app. I have cleaned the project, restarted Android studio many times. I have also invalidated cache to no avail. I am getting the following error when installing the app:</p> <pre><code>FAILURE: Build failed with an exception. * What went ...
55,824,989
10
3
null
2019-04-22 23:10:36.937 UTC
7
2019-08-09 14:13:58.123 UTC
2019-04-30 01:43:59.477 UTC
null
355,456
null
355,456
null
1
79
android-studio|android-studio-3.4
23,800
<p>Switching off Instant Run as a workaround (File/Settings/Instant Run) seems to eliminate the problem.</p> <p>According to OP it is possible to turn Instant Run back on without the problem recurring for some projects.</p>
39,142,778
How to determine the language of a piece of text?
<p>I want to get this:</p> <pre class="lang-none prettyprint-override"><code>Input text: &quot;ру́сский язы́к&quot; Output text: &quot;Russian&quot; Input text: &quot;中文&quot; Output text: &quot;Chinese&quot; Input text: &quot;にほんご&quot; Output text: &quot;Japanese&quot; Input text: &quot;العَرَبِيَّة&quot; Outpu...
39,143,059
15
3
null
2016-08-25 10:26:00.44 UTC
86
2022-09-19 08:41:41.32 UTC
2022-06-13 15:59:31.613 UTC
null
68,587
null
6,680,564
null
1
162
python|nlp
136,964
<p>Have you had a look at <a href="https://pypi.python.org/pypi/langdetect?" rel="noreferrer">langdetect</a>?</p> <pre><code>from langdetect import detect lang = detect("Ein, zwei, drei, vier") print lang #output: de </code></pre>
4,985,093
jQuery - Send a form asynchronously
<p>I have a form such as :</p> <pre><code>&lt;form action='???' method='post' name='contact'&gt; &lt;input type="text" class="inputContact" name="mittente" /&gt; &lt;textarea class="textContact" name="smex"&gt;&lt;/textarea&gt; &lt;input type="submit" value="Send" /&gt; &lt;/div&gt; &lt;/fo...
4,985,112
1
3
null
2011-02-13 15:44:55.737 UTC
12
2021-04-22 09:09:47.16 UTC
2011-02-13 16:48:47.893 UTC
null
365,251
null
365,251
null
1
34
jquery|ajax|forms
33,610
<pre><code>$('form[name=contact]').submit(function(){ // Maybe show a loading indicator... $.post($(this).attr('action'), $(this).serialize(), function(res){ // Do something with the response `res` console.log(res); // Don't forget to hide the loading indicator! }); return fal...