Datasets
Collection
5 items • Updated
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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
43,317,026 | Kotlin- naming convention for boolean returning methods | <p>What is the naming convention for boolean returning methods?</p>
<p>Using an 'is', 'has', 'should', 'can' in the front of method sound ok for some cases, but I'm not sure.
Is there a better way to name such methods?
for example: a function that checks card's validation. Should I call it <code>isValidCard</code> or ... | 43,317,781 | 3 | 0 | null | 2017-04-10 07:20:05.243 UTC | 3 | 2019-12-11 19:59:56.903 UTC | 2019-12-11 19:59:56.903 UTC | null | 4,774,054 | null | 5,188,979 | null | 1 | 29 | naming-conventions|kotlin | 10,878 | <p>Kotlin naming style assumes you use the Java naming conventions to the possible extend. I suggest you use <a href="https://stackoverflow.com/a/3874378/3144601">this answer</a> to the same question about Java.</p>
<p>UPDATE: they have released coding conventions
<a href="http://kotlinlang.org/docs/reference/coding-... |
2,342,935 | How to schedule a stored procedure? | <p>How do I schedule a stored procedure in Sql Server 2005 that it runs once at the start of every month (and on database startup)?</p> | 2,342,947 | 2 | 0 | null | 2010-02-26 16:07:39.397 UTC | 6 | 2018-04-30 15:32:23.833 UTC | 2010-03-06 04:55:56.033 UTC | null | 164,901 | null | 155,077 | null | 1 | 22 | sql|sql-server|stored-procedures|scheduled-tasks | 104,299 | <p>You will need to <a href="http://msdn.microsoft.com/en-us/library/ms186273.aspx" rel="noreferrer">create a job</a> using the <a href="http://msdn.microsoft.com/en-us/library/ms189237.aspx" rel="noreferrer">SQL Server Agent</a>.</p> |
2,873,899 | Javascript in UIWebView callback to C/Objective-C | <p>Is there a way to get a callback to objective-c when a certain event has been detected in a UIWebView? Can Javascript send a callback to Objective-C?</p> | 2,873,952 | 2 | 0 | null | 2010-05-20 13:01:43.79 UTC | 17 | 2015-06-29 14:04:42.527 UTC | 2012-08-10 18:14:02.867 UTC | null | 1,105,514 | null | 56,380 | null | 1 | 35 | javascript|objective-c|ios|cocoa-touch|uiwebview | 26,986 | <p>Update - don't use UIWebView anymore. Use WKWebView, or better yet (if it fits your needs and you're building for iOS 9), a Safari View Controller.</p>
<p>But if you must use UIWebView, in your UIWebView delegate, provide an implementation for <a href="http://developer.apple.com/iphone/library/documentation/uikit/r... |
42,228,653 | Exoplayer adaptive hls streaming | <p>I am looking for good and simple example/explanation how to implement <code>ExoPlayer</code> for <code>HLS Adaptive</code> streaming. I am a newbie and do not have experience and knowledge so I can figure how to do this from code example on git.</p>
<p>There are too many 'moving parts' so beginner can understand an... | 42,362,368 | 2 | 0 | null | 2017-02-14 14:25:37.957 UTC | 8 | 2018-08-06 23:13:48.637 UTC | 2017-02-14 14:57:24.387 UTC | null | 6,340,602 | null | 4,011,802 | null | 1 | 11 | android|http-live-streaming|exoplayer|adaptive-bitrate | 16,756 | <p>The easiest way to get started using ExoPlayer is to add it as a gradle dependency. You need to make sure you have the jcenter repository included in the <strong>build.gradle</strong> file in the root of your project:</p>
<p><code>repositories {
jcenter()
}</code></p>
<p>Next, include the following in your mod... |
18,163,821 | Excel - return "true" if a value exists in both columns | <p>I have two columns of data. column A and column B. in the third column (C) I want to type a formula that will return "true" if a data in column B exists anywhere in column A. Just this :) Thank you in advance. </p> | 18,163,969 | 1 | 0 | null | 2013-08-10 16:14:26.027 UTC | 4 | 2018-01-18 02:26:49.233 UTC | 2013-08-10 16:42:55.727 UTC | null | 2,207,117 | null | 2,207,117 | null | 1 | 6 | excel|compare|lookup | 64,843 | <p><strong>Try This:</strong></p>
<pre><code>=NOT(ISNA(VLOOKUP(B1,A:A,1,0)))
</code></pre>
<p>Assuming you are starting in cell C1.</p>
<p>VLOOKUP returns the value of B1 in the column A, or #N/A if it's not found. ISNA will return TRUE if no value is found, or FALSE if it is, finally NOT negates the result such tha... |
2,503,234 | sql server ports 445 and 1433 | <p>What is the difference between sql server ports 445 and 1433 and what is each port intended for?</p> | 2,503,284 | 3 | 0 | null | 2010-03-23 20:09:27.75 UTC | null | 2014-04-02 18:45:58.887 UTC | 2014-04-02 18:45:58.887 UTC | null | 467,079 | null | 289,877 | null | 1 | 6 | sql-server|sql-server-2005 | 46,177 | <p>445 is not a SQL port, is a SMB port. It is involved in SQL Server only if you use named pipes protocol, as named pipes are over SMB and this in turn uses 445 for '<a href="http://support.microsoft.com/kb/204279" rel="noreferrer">SMB over IP</a>', aka. as SMB 'NETBIOSless' as opposed to the old NetBIOS based SMB, wh... |
7,311,415 | How is the complexity of bucket sort is O(n+k) if we implement buckets using linked lists? | <p>I am curious about why bucket sort has a runtime of O(n + k) if we use buckets implemented with linked lists. For example, suppose that we have this input:</p>
<pre><code>n = no of element= 8
k = range = 3
array = 2,2,1,1,1,3,1,3
</code></pre>
<p>The buckets will look like this:</p>
<pre><code>1: 1 -> 1 ->... | 7,341,355 | 1 | 5 | null | 2011-09-05 18:05:44.203 UTC | 23 | 2015-11-16 13:28:22.893 UTC | 2013-05-09 15:55:44.933 UTC | null | 501,557 | null | 323,422 | null | 1 | 24 | algorithm|sorting|data-structures|big-o | 34,817 | <p>Your analysis is <em>almost</em> correct, but there's an important detail that you're missing.</p>
<p>Right now, you are correct that iterating across the input array to distribute the elements into buckets takes time O(n). However, you are slightly off when you say that the total amount of time required to assemb... |
22,580,623 | Is [CallerMemberName] slow compared to alternatives when implementing INotifyPropertyChanged? | <p>There are good articles that suggest <a href="http://blog.amusedia.com/2013/06/inotifypropertychanged-implementation.html" rel="noreferrer">different ways for implementing <code>INotifyPropertyChanged</code></a>.</p>
<p>Consider the following basic implementation:</p>
<pre><code>class BasicClass : INotifyPropertyC... | 22,580,624 | 1 | 0 | null | 2014-03-22 16:55:44.403 UTC | 24 | 2017-07-27 22:10:48.963 UTC | 2016-12-14 00:52:51.833 UTC | null | 2,157,640 | null | 218,873 | null | 1 | 114 | c#|inotifypropertychanged|callermembername | 34,226 | <p>No, <strong>the use of <code>[CallerMemberName]</code> is not slower</strong> than the upper basic implementation.</p>
<p>This is because, according to <a href="https://msdn.microsoft.com/en-us/library/hh534540(v=vs.110).aspx" rel="noreferrer">this MSDN page</a>, </p>
<blockquote>
<p>Caller Info values are emitt... |
38,916,912 | How to decode JWT (Header and Body) in java using Apache Commons Codec? | <p>I am looking decode the following <code>JWT</code> using <code>Apache Commons Codec</code>. How we can do that ?</p>
<pre><code> eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0Iiwicm9sZXMiOiJST0xFX0FETUlOIiwiaXNzIjoibXlzZ
WxmIiwiZXhwIjoxNDcxMDg2MzgxfQ.1EI2haSz9aMsHjFUXNVz2Z4mtC0nMdZo6bo3-x-aRpw
</code></pre>
<p>This shou... | 38,916,927 | 2 | 0 | null | 2016-08-12 11:29:07.22 UTC | 14 | 2020-02-03 14:16:38.767 UTC | 2018-02-28 22:26:12.533 UTC | null | 3,124,333 | user4821194 | null | null | 1 | 30 | apache|jwt|apache-commons-codec | 70,187 | <p>Here you go:</p>
<pre><code>import org.apache.commons.codec.binary.Base64;
@Test
public void testDecodeJWT(){
String jwtToken = "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0Iiwicm9sZXMiOiJST0xFX0FETUlOIiwiaXNzIjoibXlzZWxmIiwiZXhwIjoxNDcxMDg2MzgxfQ.1EI2haSz9aMsHjFUXNVz2Z4mtC0nMdZo6bo3-x-aRpw";
System.ou... |
31,675,192 | Not able to start Sonar Server | <p>I am using Sonar to generate code review reports of my project. But I am not able to start the server. I am getting </p>
<blockquote>
<p>HeapDumpOnOutOfMemoryError</p>
</blockquote>
<p>while running </p>
<blockquote>
<p>StartSonar.bat</p>
</blockquote>
<p>file.</p>
<p>Please find the logs generated while so... | 31,693,357 | 7 | 0 | null | 2015-07-28 11:37:08.697 UTC | 3 | 2022-07-19 08:19:00.847 UTC | null | null | null | null | 546,888 | null | 1 | 12 | sonarqube-4.5 | 56,921 | <p>I got the solution from sonar log files itself. You can find server start up logs in the sonar.log file under directory "sonarqube-4.5\logs". </p>
<p>I was not able to start the server due to following port binding exception :</p>
<pre><code>2015.07.29 02:46:36 ERROR web[o.a.c.h.Http11Protocol] Failed to initia... |
48,560,072 | How to add vertical scrollbar to select box options list? | <p>I need vertical scrollbar for select box options list. I have to show only first few items of the list. I don't have any control over number of items in the list. </p>
<p>I have checked all similar questions here and nothing worked out. Anyway to do that?</p>
<p><div class="snippet" data-lang="js" data-hide="false... | 48,560,262 | 4 | 0 | null | 2018-02-01 10:07:11.587 UTC | 6 | 2022-08-05 08:52:20.207 UTC | 2020-04-22 09:14:05.657 UTC | null | 8,565,438 | null | 6,603,094 | null | 1 | 11 | javascript|jquery|css|html|twitter-bootstrap | 58,130 | <p><code>Overflow-y</code> doesn't work on select boxes. What I would recommend using is <code>size</code> on your select box. In my example I've used 5 as the value, you can obviously change this to your liking.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div... |
50,571,316 | Strange variable scoping behavior in Jenkinsfile | <p>When I run the below Jenkins pipeline script:</p>
<pre><code>def some_var = "some value"
def pr() {
def another_var = "another " + some_var
echo "${another_var}"
}
pipeline {
agent any
stages {
stage ("Run") {
steps {
pr()
}
}
}
}
</code... | 50,573,082 | 2 | 0 | null | 2018-05-28 17:44:25.263 UTC | 21 | 2019-11-20 14:07:04.157 UTC | 2019-11-20 14:07:04.157 UTC | null | 95,750 | null | 95,750 | null | 1 | 43 | jenkins|groovy|jenkins-pipeline|jenkins-groovy|groovyshell | 21,257 | <h2>TL;DR</h2>
<ul>
<li>variables defined <strong>with</strong> <code>def</code> in the main script body cannot be accessed from other methods.</li>
<li>variables defined <strong>without</strong> <code>def</code> can be accessed directly by any method even from different scripts. It's a bad practice.</li>
<li>variable... |
36,239,903 | What's the difference between Remove and Exclude when refactoring with PyCharm? | <p>The <a href="https://www.jetbrains.com/help/pycharm/2016.1/refactoring-source-code.html?origin=old_help" rel="noreferrer">official PyCharm docs</a> explain <code>Exclude</code> when it comes to refactoring: One can, say, rename something with refactoring (Shift+F6), causing the Find window to pop up with a Preview.... | 48,336,566 | 1 | 0 | null | 2016-03-26 19:29:55.693 UTC | 2 | 2019-02-15 12:24:16.383 UTC | null | null | null | null | 682,515 | null | 1 | 33 | refactoring|pycharm | 1,341 | <p>Final effect is the same - entry which was <code>Removed</code> or <code>Excluded</code> won't be refactored, the difference is in presentation. After selecting <code>Exclude</code> you keep entry in the <code>Refactoring Preview</code>, but <code>Remove</code> deletes it from that window.</p>
<p>I think that <code... |
34,457,568 | How to show options in telegram bot? | <p>I want to write a bot telegram.How to put possible option in my bot.I insert a picture of sample bot with this functionality.<br><br><a href="https://i.stack.imgur.com/PPlQ0.png" rel="noreferrer"><img src="https://i.stack.imgur.com/PPlQ0.png" alt="enter image description here"></a></p> | 34,458,436 | 4 | 0 | null | 2015-12-24 20:21:08.723 UTC | 11 | 2022-08-13 19:47:55.787 UTC | null | null | null | null | 3,733,985 | null | 1 | 39 | telegram-bot | 77,652 | <p>For that, you have to talk to BotFather.</p>
<ol>
<li><p>In the Telegram App, open the chat with BotFather.</p>
</li>
<li><p>Send him <code>/setcommands</code>. He will present you with a list of your bots.</p>
</li>
<li><p>Pick the bot for which you want to set the command menu.</p>
</li>
<li><p>Compose and send th... |
29,742,847 | jenkins trigger build if new tag is released | <p>I want to configure jenkins so that it starts building if a new tag is released in any branch of an git repository. How do I configure this behaviour?</p>
<p><img src="https://i.stack.imgur.com/w7jhD.png" alt="git jenkins config" /></p>
<p>Triggering:
<img src="https://i.stack.imgur.com/2LXTk.png" alt="build trigger... | 29,743,054 | 8 | 0 | null | 2015-04-20 08:34:39.63 UTC | 21 | 2022-04-14 17:21:51.037 UTC | 2021-03-08 09:41:02.043 UTC | null | 4,298,200 | null | 1,771,213 | null | 1 | 68 | git|jenkins|tags | 77,389 | <p>What do you mean by new tag? Does it has some template name?</p>
<p>You can surely define it in <strong>Advanced</strong> --> <strong>Refspec</strong> --><code>refs/tags/{tagname}</code> .</p>
<p>You can even do <code>refs/tags/*</code> for finding really ANY new tags.</p>
<p><img src="https://i.stack.imgur.com/6... |
52,437,946 | Start motion scene programmatically | <p>I have a motion layout with this layoutDescription: <code>app:layoutDescription="@xml/scene"</code></p>
<p><strong>scene.xml</strong></p>
<pre><code><MotionScene
xmlns:motion="http://schemas.android.com/apk/res-auto">
<Transition
motion:constraintSetStart="@layout/view_home_card_start"
... | 52,474,529 | 8 | 0 | null | 2018-09-21 06:36:42.7 UTC | 6 | 2022-09-11 17:13:41.697 UTC | 2019-01-31 14:00:49.193 UTC | null | 3,383,038 | null | 3,994,630 | null | 1 | 52 | android|android-motionlayout | 25,393 | <p>Finally Im doing this:</p>
<pre><code>((MotionLayout)findViewById(R.id.motionLayout)).transitionToEnd();
((MotionLayout)findViewById(R.id.motionLayout)).transitionToStart();
</code></pre> |
31,926,315 | Why do people like to pair CLEAR_TOP and SINGLE_TOP in android | <p>The flag <code>FLAG_ACTIVITY_CLEAR_TOP</code> finds the task containing activity X and clears the top to bring X to its resume state. The flag <code>FLAG_ACTIVITY_SINGLE_TOP</code>, would only keep a single instance of X at the top. Therefore, I should never need to include <code>SINGLE_TOP</code> if I am already us... | 31,926,916 | 1 | 0 | null | 2015-08-10 18:11:47.363 UTC | 8 | 2015-08-10 18:46:15.433 UTC | null | null | null | null | 2,187,407 | null | 1 | 18 | android|android-intent|android-activity | 3,364 | <p>The behaviour of <code>CLEAR_TOP</code> is different, depending on whether or not the Activity is a <code>singleTop</code> activity or the flag <code>SINGLE_TOP</code> is also provided.</p>
<p>Let's first assume that the Activity has a standard launch mode (not <code>singleTop</code>). If you use the <code>CLEAR_TO... |
22,909,227 | How can add space\margin between two elements in iTextSharp\iText? | <p>I am pretty new in <strong>iTextSharpt</strong> (the <strong>iText</strong> porting for C#) and I have the following doubt.</p>
<p>In my code I have something like it:</p>
<pre><code>iTextSharp.text.Paragraph titolo = new iTextSharp.text.Paragraph(currentVuln.Title, _fontTitolo0);
titolo.Alignment = iTextSharp.tex... | 22,913,609 | 2 | 0 | null | 2014-04-07 10:02:00.61 UTC | 4 | 2020-10-22 09:49:29.387 UTC | null | null | null | null | 1,833,945 | null | 1 | 25 | c#|asp.net|.net|itextsharp|itext | 48,388 | <p>You have a couple of different options. You could set the <code>SpacingAfter</code> on your paragraph:</p>
<pre><code>titolo.SpacingAfter = 20;
</code></pre>
<p>You could also set the <code>SpacingBefore</code> on the table:</p>
<pre><code>table.SpacingBefore = 20;
</code></pre>
<p>Or you could just add some ret... |
22,792,848 | Pretty print JSON python | <p>if anybody with some knowledge about pretty printing JSON could help me with this I would be extremely grateful!</p>
<p>I'm looking to convert a complex python string into JSON format, using the function below to move the JSON string to a file:</p>
<pre><code>with open('data.txt', 'wt') as out:
pprint(string, ... | 22,792,883 | 1 | 0 | null | 2014-04-01 17:32:36.643 UTC | 8 | 2014-10-28 08:34:23.497 UTC | 2014-04-02 08:17:59.33 UTC | null | 2,716,029 | null | 2,716,029 | null | 1 | 14 | python|json|string|google-visualization|pprint | 32,620 | <p>You are writing <em>Python representations</em>, not JSON.</p>
<p>Use the <a href="https://docs.python.org/2/library/json.html#json.dump"><code>json.dump()</code> function</a> to write pretty-printed JSON instead, directly to your file:</p>
<pre><code>with open('data.txt', 'wt') as out:
res = json.dump(obj, ou... |
40,599,512 | How to achieve behavior of setTimeout in Elm | <p>I'm writing a web game in Elm with lot of time-dependent events and I'm looking for a way to schedule an event at a specific time delay.</p>
<p>In JavaScript I used <code>setTimeout(f, timeout)</code>, which obviously worked very well, but - for various reasons - I want to avoid JavaScript code and use Elm alone. <... | 40,600,653 | 4 | 2 | null | 2016-11-14 23:22:29.317 UTC | 7 | 2022-04-04 19:33:32.03 UTC | null | null | null | null | 2,671,214 | null | 1 | 30 | elm | 7,516 | <p>One thing that may not be obvious at first is the fact that subscriptions can change based on the model. They are effectively evaluated after every update. You can use this fact, coupled with some fields in your model, to control what subscriptions are active at any time.</p>
<p>Here is an example that allows for a... |
39,354,566 | What is the equivalent of np.std() in TensorFlow? | <p>Just looking for the equivalent of np.std() in TensorFlow to calculate the standard deviation of a tensor.</p> | 39,354,802 | 2 | 0 | null | 2016-09-06 17:19:49.593 UTC | 1 | 2017-07-04 18:50:37.197 UTC | null | null | null | null | 4,962,207 | null | 1 | 29 | python|tensorflow | 21,862 | <p>To get the mean and variance just use <code>tf.nn.moments</code>.</p>
<pre><code>mean, var = tf.nn.moments(x, axes=[1])
</code></pre>
<p>For more on <code>tf.nn.moments</code> params see <a href="https://www.tensorflow.org/api_docs/python/tf/nn/moments" rel="noreferrer">docs</a></p> |
2,639,430 | Graphing perpendicular offsets in a least squares regression plot in R | <p>I'm interested in making a plot with a least squares regression line and line segments connecting the datapoints to the regression line as illustrated here in the graphic called perpendicular offsets:
<a href="http://mathworld.wolfram.com/LeastSquaresFitting.html" rel="nofollow noreferrer">http://mathworld.wolfram.c... | 2,640,087 | 1 | 0 | null | 2010-04-14 17:07:45.077 UTC | 14 | 2019-07-23 01:22:24.713 UTC | 2019-07-23 01:22:24.713 UTC | null | 4,751,173 | null | 255,312 | null | 1 | 16 | r|statistics|plot|linear-regression|least-squares | 2,481 | <p>You first need to figure out the coordinates for the base of the perpendicular segments, then call the <code>segments</code> function which can take vectors of coordinates as inputs (no need for a loop).</p>
<pre><code>perp.segment.coord <- function(x0, y0, lm.mod){
#finds endpoint for a perpendicular segment f... |
50,776,647 | Android - Best Practices for ViewModel State in MVVM? | <p>I am working on an Android App using the MVVM pattern along LiveData (possibly Transformations) and DataBinding between View and ViewModel. Since the app is "growing", now ViewModels contain lots of data, and most of the latter are kept as LiveData to have Views subscribe to them (of course, this data is needed for ... | 51,002,027 | 2 | 0 | null | 2018-06-09 17:05:40.477 UTC | 31 | 2020-02-09 20:19:33.387 UTC | 2018-06-12 10:49:52.477 UTC | null | 9,918,581 | null | 9,918,581 | null | 1 | 30 | android|mvvm|state|viewmodel | 22,876 | <p>I struggled with the same problem at work and can share what is working for us. We're developing 100% in Kotlin so the following code samples will be as well.</p>
<h2>UI state</h2>
<p>To prevent the <code>ViewModel</code> from getting bloated with lots of <code>LiveData</code> properties, expose a single <code>Vie... |
38,536,571 | What is the difference between enum struct and enum class? | <p>Looking at the <a href="http://en.cppreference.com/w/cpp/language/enum" rel="noreferrer"><code>enum</code> documentation</a>, there was one thing that I noticed:</p>
<blockquote>
<p><em><strong>enum-key</strong></em> - one of <code>enum</code>, <code>enum class</code>(since C++11), or <code>enum struct</code>(since ... | 38,536,583 | 2 | 1 | null | 2016-07-22 23:26:19.09 UTC | 5 | 2019-03-04 15:19:37.61 UTC | 2020-06-20 09:12:55.06 UTC | null | -1 | null | 3,980,929 | null | 1 | 39 | c++|c++11|enums | 18,892 | <p><code>enum class</code> and <code>enum struct</code> are the same (emphasis mine).</p>
<blockquote>
<p><strong>7.2 Enumeration declarations</strong><br>...<br>
<sup>2</sup> .... The <em>enum-keys</em> <code>enum class</code> and <code>enum struct</code> are <strong><em>semantically equivalent</em></strong>;
a... |
42,119,750 | What is the difference between strings and characters in Matlab? | <p>What is the difference between string and character class in MATLAB?</p>
<pre><code>a = 'AX'; % This is a character.
b = string(a) % This is a string.
</code></pre> | 42,120,091 | 4 | 0 | null | 2017-02-08 17:26:09.127 UTC | 8 | 2020-03-01 15:28:39.873 UTC | 2018-02-27 16:49:48.023 UTC | null | 3,924,118 | null | 2,991,243 | null | 1 | 15 | string|matlab|char | 14,442 | <p>The <a href="https://www.mathworks.com/help/matlab/matlab_prog/represent-text-with-character-and-string-arrays.html" rel="nofollow noreferrer">documentation suggests</a>:</p>
<blockquote>
<p>There are two ways to represent text in MATLAB®. You can store text in character arrays. A typical use is to store short pi... |
42,094,180 | SpaCy: how to load Google news word2vec vectors? | <p>I've tried several methods of loading the google news word2vec vectors (<a href="https://code.google.com/archive/p/word2vec/" rel="noreferrer">https://code.google.com/archive/p/word2vec/</a>):</p>
<pre><code>en_nlp = spacy.load('en',vector=False)
en_nlp.vocab.load_vectors_from_bin_loc('GoogleNews-vectors-negative30... | 42,115,356 | 4 | 0 | null | 2017-02-07 15:50:16.633 UTC | 9 | 2019-05-13 17:26:27.823 UTC | 2019-05-13 17:26:27.823 UTC | null | 1,165,181 | null | 815,315 | null | 1 | 23 | python|nlp|word2vec|spacy | 17,770 | <p>For spacy 1.x, load Google news vectors into gensim and convert to a new format (each line in .txt contains a single vector: string, vec):</p>
<pre><code>from gensim.models.word2vec import Word2Vec
from gensim.models import KeyedVectors
model = KeyedVectors.load_word2vec_format('GoogleNews-vectors-negative300.bin',... |
35,390,835 | Is comparison of const_iterator with iterator well-defined? | <p>Consider the following code:</p>
<pre><code>#include <vector>
#include <iostream>
int main()
{
std::vector<int> vec{1,2,3,5};
for(auto it=vec.cbegin();it!=vec.cend();++it)
{
std::cout << *it;
// A typo: end instead of cend
if(next(it)!=vec.end()) std::cou... | 35,392,987 | 3 | 0 | null | 2016-02-14 10:43:57.097 UTC | 5 | 2016-02-14 15:13:08.89 UTC | null | null | null | null | 673,852 | null | 1 | 35 | c++|iterator|comparison-operators|const-iterator | 4,147 | <p>Surprisingly, C++98 and C++11 didn't say that you can compare a <code>iterator</code> with a <code>const_iterator</code>. This leads to <a href="http://cplusplus.github.io/LWG/lwg-defects.html#179">LWG issue 179</a> and <a href="http://cplusplus.github.io/LWG/lwg-defects.html#2263">LWG issue 2263</a>. Now in C++14, ... |
25,099,668 | PG::UndefinedTable: ERROR: missing FROM-clause entry for table when using joins and where | <p>I have two models, <code>Courier</code> and <code>Order</code>. </p>
<p>I have the following query below:</p>
<pre><code>active_couriers = Courier.
available_courier_status.
where(:service_region_id => @service_region.id).
includes(:orders)
</code></pre>
<p>This query works, however, it pulls in all orde... | 25,099,818 | 3 | 0 | null | 2014-08-02 21:41:36.503 UTC | 14 | 2019-10-30 12:59:48.74 UTC | 2017-06-15 16:07:48.777 UTC | null | 302,246 | null | 1,154,722 | null | 1 | 58 | ruby-on-rails|ruby-on-rails-4|psql | 56,141 | <p>Hmm it looks like you're trying to include <code>current_orders</code> and include <code>order</code>. Are these the same tables with different conditions? This might be confuse active record. Also, I'm pretty sure it's wise to include the <code>references</code> method when referencing a joined table. Perhaps, try ... |
25,662,723 | Phabricator restrict git push | <p>I want my team including myself to review commits of each other. None of commits should be pushed including mine into repo until it's not audited by other team member. I kind of lost in phabricator documentation, so i'm asking here, is there any way to setup that kind of workflow?</p> | 25,667,786 | 2 | 0 | null | 2014-09-04 10:08:23.877 UTC | 9 | 2014-09-04 14:26:16.543 UTC | null | null | null | null | 1,121,521 | null | 1 | 16 | phabricator | 6,961 | <p>You can only restrict pushes to repositories hosted by Phabricator. If your repository is hosted elsewhere (like GitHub), Phabricator obviously can't prevent users from pushing to it.</p>
<p>To restrict pushes, create a new Herald rule (in the Herald application), like this:</p>
<ul>
<li>Create a new "Commit Hook:... |
43,445,975 | What is a cluster in MongoDB? | <p>I am someone new to mongoDB and has absolutely no knowledge regarding databases so would like to know what is a cluster in MongoDB and what is the point of connecting to one in MongoDB? Is it a must to connect to one or can we just connect to the localhost?</p> | 43,447,558 | 3 | 0 | null | 2017-04-17 06:02:00.297 UTC | 17 | 2020-06-04 01:12:13.05 UTC | null | null | null | null | 7,876,941 | null | 1 | 79 | mongodb | 56,923 | <p>A mongodb cluster is the word usually used for <strong>sharded cluster</strong> in mongodb. The main purposes of a sharded mongodb are:</p>
<ul>
<li>Scale reads and writes along several nodes</li>
<li>Each node does not handle the whole data so you can separate data along all the nodes of the shard. Each node is a ... |
43,321,026 | Can I define multiple agent labels in a declarative Jenkins Pipeline? | <p>I'm using <a href="https://jenkins.io/doc/book/pipeline/syntax/#declarative-pipeline" rel="noreferrer">declarative Jenkins pipelines</a> to run some of my build pipelines and was wondering if it is possible to define multiple agent labels.</p>
<p>I have a number of build agents hooked up to my Jenkins and would lik... | 43,372,100 | 5 | 0 | null | 2017-04-10 10:39:39.793 UTC | 10 | 2022-07-19 07:53:27.23 UTC | 2017-05-24 16:20:23.377 UTC | null | 1,000,551 | null | 6,571,352 | null | 1 | 56 | jenkins|groovy|jenkins-pipeline | 80,488 | <p>You can see the 'Pipeline-syntax' help within your Jenkins installation and see the sample step "node" reference. </p>
<p>You can use <code>exprA||exprB</code>:</p>
<pre><code>node('small||medium') {
// some block
}
</code></pre> |
22,127,754 | How to install C# language support in Atom | <p>I've just started using <a href="https://atom.io/">https://atom.io/</a> on OSX</p>
<p>If I open a C# file it doesn't syntax highlight.</p>
<p>I've found <a href="https://github.com/atom/language-csharp">https://github.com/atom/language-csharp</a></p>
<p>Do I just clone that and copy it into /Applications/Atom.app... | 22,127,785 | 5 | 0 | null | 2014-03-02 12:50:00.413 UTC | 4 | 2018-08-28 03:19:37.397 UTC | 2014-03-20 18:03:25.143 UTC | null | 321,731 | null | 435,129 | null | 1 | 30 | programming-languages|syntax-highlighting|atom-editor | 23,095 | <p>Go into preferences -> Packages and type 'CSharp'</p>
<p><img src="https://i.stack.imgur.com/DkKiP.png" alt="enter image description here"></p>
<p>I've used Lisp in the picture as I already installed CSharp so it won't show up any more.</p> |
2,706,044 | How do I stop jetty server in clojure? | <p>I am writing a web application using ring and clojure. I am using the jetty adapter for the development server and emacs/SLIME for IDE. While wrap-reload does help, run-jetty blocks my slime session and I would like to be able to start/stop it at will without having to run it in a separate terminal session. Ideally,... | 2,706,239 | 3 | 0 | null | 2010-04-24 20:40:51.59 UTC | 21 | 2022-04-22 23:26:16.85 UTC | 2011-03-07 17:58:22.543 UTC | null | 339,701 | null | 302,268 | null | 1 | 62 | clojure|jetty|ring | 14,722 | <p>I usually have a line in my Ring app that looks like the following:</p>
<pre><code>(defonce server (run-jetty #'my-app {:port 8080 :join? false}))
</code></pre>
<p>This prevents locking up the REPL. It also allows me to recompile this file without worrying that my server will get redefined. It also lets you intera... |
2,948,156 | Algorithm Complexity & Security: MD5 or SHA1? | <blockquote>
<p><strong>Which is the best overall hashing algorithm in terms of complexity and security? md5 or sha1?</strong></p>
</blockquote>
<p>From what I know <em>md5</em> is faster than <em>sha1</em> but <em>SHA1</em> is more complex than md5. </p>
<p>Am I missing anything?</p> | 2,948,163 | 3 | 2 | null | 2010-06-01 08:14:28.517 UTC | 23 | 2017-03-16 17:28:19.643 UTC | 2012-04-26 15:24:10.68 UTC | null | 295,264 | null | 295,264 | null | 1 | 70 | algorithm|hash | 91,799 | <p>First of all, MD5 is broken - you can generate a collision, so MD5 should not be used for any security applications. SHA1 is not known to be broken and is believed to be secure. Other than that - yes, MD5 is faster but has 128-bit output, while SHA1 has 160-bit output.</p>
<p><strong>Update:</strong> SHA1 has been ... |
2,465,111 | Dependency Walker reports IESHIMS.DLL and WER.DLL missing? | <p>On a Windows XP Professional SP3 with Internet Explorer 8 box, when I run Dependency Walker on an executable of mine it reports that:
IESHIMS.DLL and WER.DLL can't be found.</p>
<ol>
<li>Do I need these DLL's?</li>
<li>Where can I get them?</li>
</ol>
<p>I believe they are supposed to located in
C:\Windows\System... | 2,465,488 | 4 | 2 | null | 2010-03-17 19:08:37.187 UTC | 14 | 2018-12-06 09:08:02.003 UTC | null | null | null | null | 155,268 | null | 1 | 99 | internet-explorer-8|dll|dependency-walker|windows-xp-sp3 | 157,301 | <p><code>ieshims.dll</code> is an artefact of Vista/7 where a shim DLL is used to proxy certain calls (such as <code>CreateProcess</code>) to handle protected mode IE, which doesn't exist on XP, so it is unnecessary. <code>wer.dll</code> is related to Windows Error Reporting and again is probably unused on Windows XP w... |
40,557,637 | How to return an image in Spring Boot controller and serve like a file system | <p>I've tried the various ways given in Stackoverflow, maybe I missed something.</p>
<p>I have an Android client (whose code I can't change) which is currently getting an image like this:</p>
<pre><code>HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connec... | 40,585,852 | 4 | 5 | null | 2016-11-11 23:12:59.547 UTC | 10 | 2019-03-28 21:55:55.847 UTC | 2016-11-17 23:55:46.64 UTC | null | 1,689,965 | null | 2,393,012 | null | 1 | 17 | java|spring-mvc|spring-boot | 45,438 | <p>Finally fixed this... I had to add a <code>ByteArrayHttpMessageConverter</code> to my <code>WebMvcConfigurerAdapter</code> subclass:</p>
<pre><code>@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
final ByteArrayHttpMessageConverter arrayHttpMessageConvert... |
37,200,162 | Swift: Get an element from a tuple | <p>If I have a tuple like this</p>
<pre><code>var answer: (number: Int, good: Bool)
</code></pre>
<p>How do I get one of the elements?</p>
<p>This doesn't work:</p>
<pre><code>answer["number"]
</code></pre>
<p>I am modeling this question after <a href="https://stackoverflow.com/questions/26536538/swift-get-an-arra... | 37,200,163 | 2 | 0 | null | 2016-05-13 02:10:16.887 UTC | 4 | 2016-05-13 02:39:00.503 UTC | 2017-05-23 12:25:54.497 UTC | null | -1 | null | 3,681,880 | null | 1 | 32 | swift|tuples | 24,485 | <p>According to the <a href="https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/TheBasics.html">documentation</a> (scroll down to Tuples), there are three ways to do it.</p>
<p>Given</p>
<pre><code>var answer: (number: Int, good: Bool) = (100, true)
</code></pre>
<p><st... |
49,196,173 | Move cypress folder from the root of the project | <p>When I install and run cypress, it scaffolds a <code>cypress/</code> folder in the root of my project.</p>
<p>The problem is that all other test related data is stored in the <code>test/</code> folder. Is there an easy way to move it to <code>test/cypress</code> and configure cypress to look there?</p> | 49,196,174 | 4 | 0 | null | 2018-03-09 14:43:01.857 UTC | 7 | 2022-07-07 22:50:22.023 UTC | null | null | null | null | 4,603,159 | null | 1 | 37 | testing|integration-testing|cypress | 21,699 | <p>Cypress has a few configuration options to specify custom folder structure.</p>
<p>For that you will need to have <code>cypress.json</code> file in the root of your project and specify the following structure there for cypress to properly pick up the files in <code>test/cypress/</code>:</p>
<pre><code>{
"fixt... |
49,282,471 | Lombok causing "Actual and formal arguments lists differ in length error" | <p>I have the following class:</p>
<pre><code>@Builder @NoArgsConstructor
public class ConsultationPointOfContact {
private String fullName;
private String phoneNumber;
private String userLogin;
}
</code></pre>
<p>When the <code>@Builder</code> annotation exists, it is causing problems with the <code>@... | 49,282,701 | 3 | 0 | null | 2018-03-14 16:01:53.65 UTC | 9 | 2021-11-26 07:06:56.893 UTC | null | null | null | null | 1,688,441 | null | 1 | 54 | java|lombok|intellij-lombok-plugin | 23,528 | <p>Add <code>@AllArgsConstructor</code> as well and this should fix the issue</p> |
13,747,468 | How to copy rows of from one sheet to another sheet using vbscript | <p>Suppose I have Sheet(1) in an excel. Now i do also have 2500 rows which has data for the columns from A to BO.Now I want the data to copy from these sheet to another sheet of the same Excel file for 2500 rows but not the whole the columns,rather i need only columns from A to AA data to copy to the new sheet.</p>
<p... | 13,748,244 | 3 | 1 | null | 2012-12-06 15:56:05.967 UTC | 1 | 2017-07-17 18:51:55.317 UTC | null | null | null | null | 2,767,755 | null | 1 | 0 | vbscript | 42,213 | <p>To copy data from one sheet to another you can use the Copy en PasteSpecial commands. To do this with a <code>.vbs</code> script do the following:</p>
<pre><code>' Create Excel object
Set objExcel = CreateObject("Excel.Application")
' Open the workbook
Set objWorkbook = objExcel.Workbooks.Open _
("C:\myworkbook... |
1,102,673 | SQL Server subquery syntax | <p>When I run the query :</p>
<pre><code>select count(*) from
(select idCover from x90..dimCover group by idCover having count(*) > 1)
</code></pre>
<p>I get the error :</p>
<pre><code>Server: Msg 170, Level 15, State 1, Line 2
Line 2: Incorrect syntax near ')'
</code></pre>
<p>How do I formulate this query co... | 1,102,679 | 2 | 0 | null | 2009-07-09 09:01:04.637 UTC | 1 | 2014-12-10 15:49:59.903 UTC | 2009-07-09 10:05:49.03 UTC | null | 36,189 | null | 36,189 | null | 1 | 29 | sql|sql-server | 25,869 | <p>Add an alias after your last bracket.</p>
<pre><code>select count(*) from
(select idCover from x90..dimCover group by idCover having count(*) > 1) a
</code></pre> |
939,673 | How is a blob column annotated in Hibernate? | <p>How is a blob column annotated in Hibernate?
So far I have a class that has:</p>
<pre><code>@Column( name = "FILEIMAGE" )
private byte[ ] fileimage ;
//
public byte[ ] getFileimage ( ) { return this.fileimage ; }
public void setFilename ( String filename ) { this.filename = filename ; }
</code></pre> | 939,725 | 2 | 0 | null | 2009-06-02 13:49:46.993 UTC | 5 | 2014-08-22 20:59:47.987 UTC | null | null | null | quinn | null | null | 1 | 35 | hibernate|annotations|blob | 59,485 | <p>@Lob should do the trick for blob and clob (use String as type)</p>
<pre><code>@Column( name = "FILEIMAGE" )
@Lob(type = LobType.BLOB)
private byte[] fileimage;
</code></pre> |
2,903,610 | Visual Studio: reset user settings when debugging | <p>In a C# Winforms-App I have several user settings stored.</p>
<p>Is there an easy way to clear those settings each time I start debugging the project from Visual Studio 2008?</p>
<p>Otherwise it always starts up with the settings from the last debug-session.</p> | 2,903,657 | 6 | 0 | null | 2010-05-25 09:56:33.733 UTC | 10 | 2018-01-26 12:39:50.007 UTC | 2016-10-18 20:36:44.903 UTC | null | 2,840,103 | null | 196,253 | null | 1 | 26 | c#|visual-studio-2008|settings|reset | 40,402 | <p>Add a pre-build action to delete:</p>
<p><code>%USERPROFILE%\Local Settings\Application Data\[AppName]\...\[Version]\user.config</code></p>
<p>or if your version number changes alot just delete</p>
<p><code>%USERPROFILE%\Local Settings\Application Data\[AppName]\</code></p> |
2,396,548 | Appending to boost::filesystem::path | <p>I have a certain <code>boost::filesystem::path</code> in hand and I'd like to append a string (or path) to it.</p>
<pre><code>boost::filesystem::path p("c:\\dir");
p.append(".foo"); // should result in p pointing to c:\dir.foo
</code></pre>
<p>The only overload <code>boost::filesystem::path</code> has of <code>app... | 2,396,827 | 6 | 0 | null | 2010-03-07 14:20:52.773 UTC | 5 | 2022-07-04 08:30:33.793 UTC | null | null | null | null | 210,311 | null | 1 | 40 | c++|boost | 72,904 | <pre><code>#include <iostream>
#include <string>
#include <boost/filesystem.hpp>
int main() {
boost::filesystem::path p (__FILE__);
std::string new_filename = p.leaf() + ".foo";
p.remove_leaf() /= new_filename;
std::cout << p << '\n';
return 0;
}
</code></pre>
<p>Tested with... |
2,776,397 | Create a basic matrix in C (input by user !) | <p>I'm trying to ask the user to enter the number of columns and rows they want in a matrix, and then enter the values in the matrix... I'm going to let them insert numbers one row at a time.</p>
<p>How can I create such function ?</p>
<pre><code>#include<stdio.h>
main(){
int mat[10][10],i,j;
for(i=0;i<2;i... | 2,776,452 | 7 | 0 | null | 2010-05-05 20:07:15.213 UTC | 2 | 2017-10-17 13:10:32.583 UTC | 2017-02-10 12:13:32.59 UTC | null | 3,563,841 | null | 331,734 | null | 1 | 9 | c|matrix | 261,231 | <p>How about the following?</p>
<p>First ask the user for the number of rows and columns, store that in say, <code>nrows</code> and <code>ncols</code> (i.e. <code>scanf("%d", &nrows);</code>) and then <a href="http://pleasemakeanote.blogspot.com/2008/06/2d-arrays-in-c-using-malloc.html" rel="noreferrer">allocate m... |
2,390,230 | Do copyright dates need to be updated? | <p>Every now and then I see a web site that has an old copyright date. In my mind, I always think "Look at the sucker who forgot to update his copyright year!" Then, while I was hard-coding a copyright year into the site I'm currently designing, it suddenly struck me: </p>
<p>How the hell am I going to remember to upd... | 2,391,555 | 7 | 6 | null | 2010-03-05 21:59:53.153 UTC | 84 | 2021-03-09 10:09:06.54 UTC | 2012-10-11 17:53:36.897 UTC | null | 493,939 | null | 84,088 | null | 1 | 340 | server-side|copyright-display | 166,707 | <p>The copyright notice on a work establishes a claim to copyright. The date on the notice establishes how far back the claim is made. This means if you update the date, you are no longer claiming the copyright for the original date and that means if somebody has copied the work in the meantime and they claim its their... |
25,407,428 | How to access CoreData model in today extension (iOS) | <p>Is it possible to work with my CoreData model in the today extension in swift like in the original app? If yes, how can I create the NSManagedObjectContext? <br>
I really have no clue, beside the group-identifier, but unfortunatly I don't know how to get the context.. <br>
In the past I created apps with the check a... | 25,408,472 | 1 | 0 | null | 2014-08-20 14:31:11.45 UTC | 19 | 2015-07-30 23:12:50.693 UTC | 2014-12-23 13:35:59.537 UTC | null | 3,126,646 | null | 2,607,748 | null | 1 | 38 | ios|core-data|swift|ios8|today-extension | 20,343 | <p>What you really want is to access your persistent store (most likely a SQLite database).
In order to achieve that, you need to configure App Groups and make sure that your host app configures the Core Data stack using your shared container (so your store is accessible in extension as well).
Something like:</p>
<pre>... |
25,387,660 | iBeacon region monitoring AND proximity for >20 beacons? | <p>I have been working on a prototype iOS app utilizing iBeacons to provide location-relevant information to office employees depending on where in the office they are. The ideal use case is that whenever an employee enters or exits their office, a callback is fired which provides them some information in the form of a... | 25,389,318 | 3 | 0 | null | 2014-08-19 15:43:33.233 UTC | 11 | 2014-08-28 15:22:49.77 UTC | null | null | null | null | 1,722,048 | null | 1 | 13 | ios|ibeacon | 7,290 | <p>Option #2 is absolutely more complicated, but you must accept these complications in order to get around the 20 region monitoring limit.</p>
<p>A few points:</p>
<ul>
<li><p>In the background, you only have around 5 seconds of ranging time, which does not give you as much time to average RSSI (signal strength) fro... |
25,160,245 | Clang linking with a .so file | <p>I keep getting</p>
<pre class="lang-none prettyprint-override"><code>ld: library not found for -lchaiscript_stdlib-5.3.1.so
clang: error: linker command failed with exit code 1 (use -v to see invocation)
</code></pre>
<p>When trying to link to a <em>.so</em> file.</p>
<p>I'm using this command:</p>
<pre class="lang-... | 25,160,298 | 1 | 0 | null | 2014-08-06 12:20:44.61 UTC | 9 | 2020-12-30 22:43:14.173 UTC | 2020-12-30 22:40:54.563 UTC | null | 63,550 | user245019 | null | null | 1 | 14 | c++|linker|clang|chaiscript | 34,476 | <p>Yes, the <code>-L</code> option adds the search path, but the linker adds the <code>.so</code> (or <code>.a</code>) suffix itself (just like it adds the <code>lib</code> prefix). So you only need to have <code>-lchaiscript_stdlib-5.3.1</code> and the linker will find it.</p>
<p>You can also skip the adding of the pa... |
6,121,276 | Is it possible to Load an assembly from the GAC without the FullName? | <p>I know how to load an assembly from a filename, and also from the GAC.
As My .msi file will put a dll project into the GAC, I'm wondering if it's possible to load it from the GAC unknowing the FullName (I mean just with the assembly name, or even the dll filename), because I have to Load this assembly from another p... | 6,131,116 | 2 | 1 | null | 2011-05-25 07:58:33.403 UTC | 9 | 2017-02-24 23:37:11.843 UTC | 2017-02-24 23:37:11.843 UTC | null | 41,071 | null | 580,319 | null | 1 | 20 | c#|assemblies|load|gac | 6,306 | <p>Here is a piece of code that allows to do this, and an exemple:</p>
<pre><code> string path = GetAssemblyPath("System.DirectoryServices");
Assembly.LoadFrom(path);
</code></pre>
<p>Note if you need a specific processor architecture, since it supports partial name, you can write this kind of things:</p>
<pr... |
18,596,867 | What is the git command to list ignored files? | <p>My netbeans IDE shows ignored files on a different color.
I presume, the IDE is knowing this by using some git command.</p>
<p>I wish to know what files on a project folder and subfolders are being ignored.</p>
<p>What command should we use?</p> | 18,596,993 | 1 | 1 | null | 2013-09-03 16:10:00.427 UTC | 4 | 2013-09-03 16:18:15.3 UTC | null | null | null | null | 378,170 | null | 1 | 29 | git | 24,722 | <p><code>git status --ignored</code> will show all untracked files. It also includes the normal status output. There does not appear to be a status option to only show the ignored files.</p> |
30,942,556 | Laravel: dynamic where clause with Elouquent | <p>I am calling URL with search params which are dynamic. How could I form proper <strong>Eloquent query</strong>?</p>
<p>In theory:</p>
<ol>
<li>query</li>
<li><strong>query where(someParam1)</strong></li>
<li><strong>query where(someParam2)</strong></li>
<li>query orderby(someParam3)</li>
<li>query get</li>
</ol>
... | 30,943,421 | 6 | 0 | null | 2015-06-19 16:04:00.23 UTC | 10 | 2020-08-25 14:55:12.41 UTC | null | null | null | null | 3,103,116 | null | 1 | 35 | laravel|eloquent | 34,754 | <p>It's easy with Laravel. Just do something like this:</p>
<pre><code>$query = User::query();
if ($this == $that) {
$query = $query->where('this', 'that');
}
if ($this == $another_thing) {
$query = $query->where('this', 'another_thing');
}
if ($this == $yet_another_thing) {
$query = $query->orderBy(... |
31,289,895 | Threshold image using opencv (Java) | <p>I am working with Opencv for my project. I need to convert the image below to threshold image </p>
<p><img src="https://i.stack.imgur.com/w8eyt.jpg" alt="Original Image"></p>
<p>I tried this function: </p>
<pre><code>Imgproc.threshold(imgGray, imgThreshold, 0, 255, Imgproc.THRESH_BINARY + Imgproc.THRESH_OTSU);
<... | 31,290,735 | 1 | 1 | null | 2015-07-08 10:24:34.963 UTC | 11 | 2020-11-16 16:51:59.953 UTC | 2015-07-08 11:42:51.24 UTC | null | 4,968,030 | null | 1,840,768 | null | 1 | 12 | java|android|opencv|image-processing|tesseract | 25,749 | <p><code>adaptiveThreshold</code> is the right choice here. <strong>Just need a litte tuning</strong>.
With these parameters (it's C++, but you can easily translate to Java)</p>
<pre><code>Mat1b gray= imread("path_to_image", IMREAD_GRAYSCALE);
Mat1b result;
adaptiveThreshold(gray, result, 255, ADAPTIVE_THRESH_MEAN_C, ... |
31,399,411 | Go to "next" iteration in JavaScript forEach loop | <p>How do I go to the next iteration of a JavaScript <code>Array.forEach()</code> loop?</p>
<p>For example:</p>
<pre><code>var myArr = [1, 2, 3, 4];
myArr.forEach(function(elem){
if (elem === 3) {
// Go to "next" iteration. Or "continue" to next iteration...
}
console.log(elem);
});
</code></pre>
<p><a h... | 31,399,448 | 3 | 1 | null | 2015-07-14 06:38:17.343 UTC | 22 | 2019-08-11 22:45:28.753 UTC | 2019-08-11 22:45:28.753 UTC | null | 4,642,212 | null | 1,001,938 | null | 1 | 310 | javascript|foreach | 227,038 | <p>You can simply <code>return</code> if you want to skip the current iteration.</p>
<p>Since you're in a function, if you <code>return</code> before doing anything else, then you have effectively skipped execution of the code below the <code>return</code> statement.</p> |
19,628,393 | How to begin with Windows Kernel Programming? | <p>I am an application developer mostly work in C#. I have some knowledge of C/C++. I am very much fascinated and interested in windows Kernel Development. I Sketched out a layout to learn this.</p>
<pre><code>1. Understand Windows internals(By books)
2. Try Simple Modules and keep expanding.
</code></pre>
<p>To achi... | 19,634,253 | 2 | 0 | null | 2013-10-28 06:30:49.943 UTC | 27 | 2019-07-07 08:12:11.003 UTC | 2013-10-28 08:19:07.56 UTC | null | 1,157,680 | null | 1,157,680 | null | 1 | 21 | kernel|windows-kernel | 23,446 | <p>Read <a href="http://technet.microsoft.com/en-us/sysinternals/bb963901.aspx" rel="noreferrer">Windows Internals</a>.</p>
<p>Read <a href="http://msdn.microsoft.com/en-us/library/windows/hardware/ff557573%28v=vs.85%29.aspx" rel="noreferrer">Windows Drivers Development</a>.</p>
<p>Follow and read <a href="https://co... |
19,448,902 | Changing the width of Bootstrap popover | <p>I am designing a page using Bootstrap 3. I am trying to use a popover with <code>placement: right</code> on an input element. The new Bootstrap ensures that if you use <code>form-control</code> you basically have a full-width input element.</p>
<p>The HTML code looks something like this: </p>
<pre><code><div cl... | 19,604,395 | 24 | 0 | null | 2013-10-18 11:46:17.187 UTC | 38 | 2022-03-11 09:58:39.987 UTC | 2015-01-17 05:41:34.057 UTC | null | 3,998,712 | null | 1,152,297 | null | 1 | 216 | css|twitter-bootstrap|twitter-bootstrap-3|popover | 308,173 | <pre><code><div class="row" data-toggle="popover" data-trigger="hover"
data-content="My popover content.My popover content.My popover content.My popover content.">
<div class="col-md-6">
<label for="name">Name:</label>
<input id="name" class="form-control" type="text... |
19,140,148 | C++ Get Total File Line Number | <p>Is there a function I can use to get total file line number in <code>C++</code>, or does it have to be manually done by <code>for</code> loop?</p>
<pre><code>#include <iostream>
#include <ifstream>
ifstream aFile ("text.txt");
if (aFile.good()) {
//how do i get total file line number?
}
</code></pre>
... | 19,140,254 | 7 | 0 | null | 2013-10-02 15:01:55.64 UTC | 3 | 2021-04-14 23:19:04.077 UTC | 2016-11-15 13:17:00.827 UTC | null | 7,055,233 | null | 2,797,246 | null | 1 | 6 | c++|get|numbers|size|line | 65,914 | <p>There is no such function. Counting can be done by reading whole lines </p>
<pre><code>std::ifstream f("text.txt");
std::string line;
long i;
for (i = 0; std::getline(f, line); ++i)
;
</code></pre>
<p>A note about scope, variable <code>i</code> must be outside <a href="https://en.cppreference.com/w/cpp/languag... |
19,216,580 | Requirejs: paths vs map | <p>Trying to understand where it's right to use "map" with a wildcard vs "paths". </p>
<p>Looking at the require source (but certainly not being 100% fluent with it) it seems like there would functionally be no difference between these two snippets. Is that true? </p>
<p>Using Paths:</p>
<pre><code> require.config(... | 24,305,846 | 4 | 0 | null | 2013-10-07 03:19:27.317 UTC | 2 | 2022-01-30 20:28:58.313 UTC | 2013-10-26 11:33:51.717 UTC | null | 578,411 | null | 60,247 | null | 1 | 31 | requirejs | 14,253 | <p>From the RequireJS Docs "In addition, the paths config is only for setting up root paths for module IDs, not for mapping one module ID to another one."</p>
<p>This means "paths" is meant for mapping just the path to your resource when it is not in the default location (baseUrl). I guess this is what you were trying... |
37,032,203 | Make syscall in Python | <p>I want to make <code>syscall</code> in Python and the function is not in <code>libc</code>, is there a way to do it in Python?</p>
<p>More specifically, I want to call <a href="http://man7.org/linux/man-pages/man2/getdents.2.html" rel="noreferrer"><code>getdents</code></a>, whose manpage says </p>
<blockquote>
<... | 37,032,683 | 1 | 0 | null | 2016-05-04 15:33:27.393 UTC | 9 | 2016-05-04 16:48:37.88 UTC | 2016-05-04 16:00:45.497 UTC | null | 416,224 | null | 875,044 | null | 1 | 30 | python|python-2.7|system-calls | 19,845 | <p>Libc exposes a function to invoke "custom" syscalls: <a href="http://man7.org/linux/man-pages/man2/syscall.2.html" rel="noreferrer"><code>long syscall(long number, ...);</code></a></p>
<blockquote>
<p><code>syscall()</code> is a small library function that invokes the system call
whose assembly language ... |
29,971,837 | Changing password on p12 file | <p>I was forwarded a p12 file from a client with the push cert. </p>
<p>Can I change the password of this p12 file without any ramifications and if yes, can I use something like this:</p>
<pre><code>openssl pkcs12 -in Certificates.p12 -out temp.pem -passin pass: -passout
pass:temppassword
openssl pkcs12 -expo... | 35,609,431 | 4 | 2 | null | 2015-04-30 15:29:49.83 UTC | 16 | 2019-09-11 15:09:07.75 UTC | 2017-07-21 10:55:08.72 UTC | null | 177,701 | null | 1,819,000 | null | 1 | 38 | ios|push-notification|apple-push-notifications | 54,425 | <p>There will be no problem. </p>
<p>PFX is an encrypted container, changing the password of the container will have no effect on the certificates inside the container.</p> |
48,556,768 | How to configure prometheus with alertmanager? | <p><strong>docker-compose.yml:</strong>
This is the docker-compose to run the prometheus, node-exporter and alert-manager service. All the services are running great. Even the health status in target menu of prometheus shows ok.</p>
<pre><code>version: '2'
services:
prometheus:
image: prom/prometheus
... | 48,559,174 | 2 | 1 | null | 2018-02-01 06:41:29.123 UTC | 9 | 2022-04-28 14:27:32.327 UTC | 2018-02-01 12:29:49.447 UTC | null | 4,966,953 | null | 4,412,382 | null | 1 | 10 | docker-compose|prometheus | 16,812 | <p>Your <code>./alertmanager/alert.rules</code> file is not included in your docker config, so it is not available in the container. You need to add it to the prometheus service:</p>
<pre><code>prometheus:
image: prom/prometheus
privileged: true
volumes:
- ./prometheus.yml:/etc/prometheus/prometheu... |
48,619,733 | react-router Redirect vs history.push | <p>I was reading <a href="https://github.com/ReactTraining/react-router/tree/master/packages/react-router-redux/examples" rel="noreferrer">react-router-redux examples</a> and I confused,
what is the difference beetween:</p>
<pre><code>import { Redirect } from 'react-router-dom'
...
<Redirect to='/login' />
</... | 50,525,884 | 3 | 2 | null | 2018-02-05 09:52:20.297 UTC | 12 | 2021-07-02 14:44:39.45 UTC | null | null | null | null | 4,204,843 | null | 1 | 57 | react-router|react-router-v4|react-router-redux|react-router-dom | 51,623 | <p><strong>Redirect</strong></p>
<p>Rendering a <code><Redirect></code> will navigate to a new location. The new location will <code>override the current location in the history stack,</code> like server-side redirects (HTTP 3xx) do.</p>
<p>whereas <strong>History</strong></p>
<p><strong>push function</strong>... |
8,439,657 | Copy an entire worksheet to a new worksheet in Excel 2010 | <p>I have found similar questions that deal with copying an entire worksheet in one workbook and pasting it to another workbook, but I am interested in simply copying an entire worksheet and pasting it to a new worksheet -- in the same workbook. </p>
<p>I'm in the process of converting a 2003 .xls file to 2010 .xlsm a... | 8,439,771 | 6 | 0 | null | 2011-12-09 00:32:24.483 UTC | 7 | 2018-05-11 15:10:29.91 UTC | 2015-03-26 17:03:36.517 UTC | null | 1,505,120 | user567677 | null | null | 1 | 27 | vba|excel|excel-2010 | 335,509 | <p>It is simpler just to run an exact copy like below to put the copy in as the last sheet</p>
<pre><code>Sub Test()
Dim ws1 As Worksheet
Set ws1 = ThisWorkbook.Worksheets("Master")
ws1.Copy ThisWorkbook.Sheets(Sheets.Count)
End Sub
</code></pre> |
8,868,486 | What's the difference between MemoryCache.Add and MemoryCache.Set? | <p>I read the <a href="https://msdn.microsoft.com/en-us/library/dd780623(v=vs.110).aspx">MSDN documentation</a> but didn't really understand it.</p>
<p>I believe that the behavior of <code>Set</code> is "replace existing, or add" (atomically).</p>
<p>Is that correct?</p> | 8,868,522 | 1 | 0 | null | 2012-01-15 08:40:35.607 UTC | 8 | 2016-11-15 07:00:16.307 UTC | 2015-10-24 15:43:03.457 UTC | null | 3,191,599 | null | 136,999 | null | 1 | 114 | .net|memorycache | 27,752 | <p><code>Add</code> does nothing (returns <code>false</code>) if there is already a value for that key. <code>Set</code> does an insert or update, as necessary.</p>
<p><code>Remove</code> + <code>Add</code> would leave a gap in the middle when another thread querying that key would get no clue (<code>Set</code> does n... |
26,969,166 | counting occurrences in data.frame in r | <p>I have a data frame 200 columns containing 150 genes (rows) in each column.</p>
<p>I want to count the number occurrences for each gene in the whole data frame</p>
<pre><code>mydat <-
V1 V2 V3 V4 V5 V6 V7 V8
1 TGFBR2 TGFBR2 TGFBR2 TGFBR2 TGFBR2 TGF... | 26,969,215 | 2 | 1 | null | 2014-11-17 09:14:15.883 UTC | 3 | 2014-11-17 10:37:12 UTC | 2014-11-17 10:32:48.84 UTC | null | 1,627,235 | null | 4,079,590 | null | 1 | 17 | r|dataframe | 50,936 | <p>try</p>
<pre><code>occurences<-table(unlist(mydat))
</code></pre>
<p>(I assigned the result so you don't get a full screen of gene names and so each gene's occurence can be accessed by <code>occurences["genename"]</code>)</p> |
26,543,127 | PowerShell Setting advanced NTFS permissions | <p>I'm trying to apply NTFS permissions that are defined in the 'Advanced' tab of the Windows security settings. One ACL <code>$Rule</code> is for <code>This folder only</code> and another one is for the <code>Subfolders and files only</code>.</p>
<p>The permissions are heavily modified as you can see below:</p>
<pre... | 26,544,463 | 2 | 0 | null | 2014-10-24 07:12:33.383 UTC | 5 | 2017-12-14 07:12:46.1 UTC | 2014-10-24 12:01:44.457 UTC | null | 2,304,170 | null | 2,304,170 | null | 1 | 9 | powershell|permissions|ntfs | 82,602 | <p>Object access permissions in Windows are controlled via <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa374872%28v=vs.85%29.aspx" rel="noreferrer">Access Control Lists</a> (ACL), which basically consist of a list of <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa374868%28v=vs.8... |
26,649,180 | 'Show' segue in Xcode 6 presents the viewcontroller as a modal in iOS 7 | <p>I have two view controllers in my iPhone application (built with swift) built with Xcode 6.1 and uses storyboards.</p>
<p>The first view controller is embedded in a navigation controller in the storyboard and the segue for the second view controller is a 'Show' segue. </p>
<p>When the application is run, it proper... | 33,377,134 | 11 | 0 | null | 2014-10-30 09:24:06.913 UTC | 3 | 2017-12-05 14:43:00.613 UTC | null | null | null | null | 2,717,398 | null | 1 | 28 | ios|swift|uistoryboardsegue | 13,489 | <blockquote>
<p>This solution is different from the others in the following ways:</p>
</blockquote>
<ol>
<li>It includes a method to examine and verify the issue</li>
<li>The cause of the issue is traced to the source (a change in the segue type)</li>
<li>The solution is very simple (delete and recreate a new segue)... |
61,522,624 | How to create an optional field in a dataclass that is inherited? | <pre class="lang-py prettyprint-override"><code>from typing import Optional
@dataclass
class Event:
id: str
created_at: datetime
updated_at: Optional[datetime]
#updated_at: datetime = field(default_factory=datetime.now) CASE 1
#updated_at: Optional[datetime] = None CASE 2
@datacl... | 61,562,009 | 1 | 0 | null | 2020-04-30 11:44:48.137 UTC | 2 | 2022-07-24 02:49:28.38 UTC | null | null | null | null | 7,125,235 | null | 1 | 31 | python|python-3.x|python-dataclasses | 44,535 | <p>The underlying problem that you have seems to be the same one that is described <a href="https://stackoverflow.com/questions/51575931/class-inheritance-in-python-3-7-dataclasses/53085935#53085935">here</a>. The short version of that post is that in a function signature (including the dataclass-generated <code>__init... |
30,733,904 | Renaming a File() object in JavaScript | <p>I'd like for my users to be able to re-name a file before uploading it.</p>
<p>I have a <code>File</code> object in Javascript which has a <code>name</code> property that is already set, but i'd like for this to be able to be updated. Right now doing the obvious <code>myFile.name = "new-name.txt"</code> returns an... | 30,734,316 | 6 | 0 | null | 2015-06-09 13:46:55.153 UTC | 4 | 2021-11-18 16:08:09.473 UTC | null | null | null | null | 79,677 | null | 1 | 38 | javascript|file|rename|file-rename | 33,182 | <p>You can add an <code>input</code> tag with the name on it and hide the <code>name</code> property from the user. On the server, just use the <code>input</code> as the name and ignore the default name.</p> |
43,841,091 | Spark2.1.0 incompatible Jackson versions 2.7.6 | <p>I am trying to run a simple spark example in intellij, but I get the error like that:</p>
<pre><code>Exception in thread "main" java.lang.ExceptionInInitializerError
at org.apache.spark.SparkContext.withScope(SparkContext.scala:701)
at org.apache.spark.SparkContext.textFile(SparkContext.scala:819)
at spark.test$.ma... | 43,845,063 | 3 | 0 | null | 2017-05-08 06:27:47.367 UTC | 9 | 2020-05-18 05:20:47.557 UTC | 2017-05-08 06:34:19.85 UTC | null | 7,978,963 | null | 7,978,963 | null | 1 | 36 | scala|apache-spark|jackson|sbt|incompatibletypeerror | 25,760 | <p>Spark 2.1.0 contains <code>com.fasterxml.jackson.core</code> as transitive dependency. So, we do not need to include then in <code>libraryDependencies</code>. </p>
<p>But if you want to add a different <code>com.fasterxml.jackson.core</code> dependencies' version then you have to override them. Like this:</p>
<pre... |
880,937 | Vary by control properties using PartialCaching in ASP.NET | <p>I am using the PartialCaching attribute on the base class of a user control.</p>
<p>I would like the cached controls to vary based on the properties set on the control instance.</p>
<p>For example:</p>
<pre><code><mycontrols:control1 runat="server" param1="10" param2="20" />
</code></pre>
<p>...output woul... | 903,429 | 3 | 0 | null | 2009-05-19 04:10:59.683 UTC | 10 | 2014-09-12 19:35:59.19 UTC | null | null | null | null | 52,529 | null | 1 | 12 | asp.net|caching|outputcache | 10,198 | <p>To answer your first Q, let me first tell you that your question itself has the answer ;). 'Shared' ... yes that's the keyword :) To have a single instance in cache for the user control across all the pages, set Shared='true' in the @OutputCache directive. This should be set at the user control level i.e. in the asc... |
282,282 | How does StackOverflow's 'tags' textbox autocomplete work? | <p>I know they're using a jQuery plugin, but I can't seem to find which one they used. In particular, what I'm looking for is autocomplete with exactly the same functionality as SO's autocomplete, where it will perform an AJAX command with each new word typed in and allow you to select one from a dropdown.</p> | 282,328 | 3 | 3 | null | 2008-11-11 21:59:14.723 UTC | 17 | 2014-08-03 03:30:47.26 UTC | null | null | null | Erik | 16,942 | null | 1 | 38 | javascript|jquery|ajax|textbox|autocomplete | 7,569 | <p>Note that the tag editor <a href="https://meta.stackexchange.com/questions/100669/feedback-wanted-improved-tag-editor">has been completely re-written now</a>, and no longer resembles the original, simple text box w/ suggestion drop-down that adorned the site for nearly three years. </p>
<p>If you're interested in t... |