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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
40,020,703 | Angular2 - Redirect to calling url after successful login | <p>I have my application up and running with Angular 2.1.0.
The routes are protected via router Guards, canActivate.</p>
<p>When pointing the browser to a protected area like "localhost:8080/customers" I get redirected to my login page just like expected.</p>
<p>But after a successful login, I would like to be redire... | 40,021,645 | 3 | 1 | null | 2016-10-13 12:13:47.01 UTC | 15 | 2020-12-09 09:22:51.09 UTC | 2019-11-04 14:40:38.98 UTC | null | 1,833,602 | null | 2,760,747 | null | 1 | 51 | angular|angular2-routing | 88,625 | <p>There's a tutorial in the Angular Docs, <a href="https://angular.io/guide/router-tutorial-toh#milestone-5-route-guards" rel="noreferrer">Milestone 5: Route guards</a>. One possible way to achieve this is by using your AuthGuard to check for your login status and store the url on your AuthService.</p>
<p><strong>Auth... |
10,826,014 | Suppress some warnings in SQL Server SSDT | <p>In <a href="http://msdn.microsoft.com/en-us/library/hh272686">SQL Server Data Tools</a>, I would like to suppress some, but not all, occurrences of SQL71502 ("--- has an unresolved reference to object ---"). I know I can suppress through Project Properties, Build, Suppress Transact-SQL warnings, but this will global... | 10,854,815 | 5 | 0 | null | 2012-05-31 00:27:47.64 UTC | 4 | 2015-02-09 11:13:29.35 UTC | 2012-05-31 00:34:00.84 UTC | null | 261,997 | null | 14,280 | null | 1 | 34 | sql-server|sql-server-data-tools | 20,162 | <p>You weren't clear on what would determine which 71502 messages would be suppressed and which ones wouldn't but based on my own understanding and research I think the answer is the same. In short, no. </p>
<p>You can suppress all warnings, or warnings based on a specific code ( 71502 ) but that is as granular as i... |
10,772,598 | Vim select the ends of multiple lines (block mode, but where the ending column varies) | <p>Is there any way in vim that I can select the end of all these lines? (I'm only showing the end of the lines in these screenshots).</p>
<p>In block mode I can get them all if the bottom line is longer than the rest, but if the bottom line is shorter, the longer lines are truncated.</p>
<p>EDIT | I guess I can just... | 10,772,658 | 5 | 0 | null | 2012-05-27 08:15:59.75 UTC | 16 | 2022-09-15 18:02:42.063 UTC | null | null | null | null | 322,122 | null | 1 | 39 | vim | 19,954 | <ol>
<li>Put your cursor on the top-left character you want to be part of the block.</li>
<li>Enter block selection mode with <kbd>ctrl</kbd>+<kbd>v</kbd></li>
<li><strong>Select to the end of the line with <kbd>$</kbd></strong> (this is the step you're missing; if you move to the end of the first line using <kbd>$</kb... |
5,931,898 | Persisting & loading metadata in a backbone.js collection | <p>I have a situation using backbone.js where I have a collection of models, and some additional information about the models. For example, imagine that I'm returning a list of amounts: they have a quantity associated with each model. Assume now that the unit for each of the amounts is always the same: say quarts. Th... | 5,932,429 | 2 | 0 | null | 2011-05-09 02:25:05.567 UTC | 10 | 2011-05-09 09:12:04.3 UTC | 2017-05-23 10:27:15.82 UTC | null | -1 | null | 488,927 | null | 1 | 14 | javascript|json|collections|backbone.js | 4,854 | <p>Personally, I would wrap the <code>Collection</code> inside another <code>Model</code>, and then override <code>parse</code>, like so:</p>
<pre><code>var DataPointsCollection = Backbone.Collection.extend({ /* etc etc */ });
var CollectionContainer = Backbone.Model.extend({
defaults: {
dataPoints: new Da... |
5,910,454 | Encrypt/Decrypt using Bouncy Castle in C# | <p>I am using the "BouncyCastle.Crypto.dll" for encrypt/decrypt a string in my app. I am using the
following <a href="https://web.archive.org/web/20140120123730/http://elian.co.uk/post/2009/07/29/Bouncy-Castle-CSharp.aspx" rel="nofollow noreferrer">code from this blog</a>:</p>
<ol>
<li><p>I have a class BCEngine, exac... | 5,910,512 | 2 | 1 | null | 2011-05-06 11:03:58.79 UTC | 4 | 2020-05-09 22:15:18.943 UTC | 2020-05-09 22:15:18.943 UTC | null | 4,449,174 | null | 206,686 | null | 1 | 20 | c#|bouncycastle | 49,064 | <p>Your <code>string key = "DFGFRT";</code> is not 128/192/256 bits. </p>
<p><code>DFGFRT</code> is 6 characters, which is 6 (or 12?) bytes = 8*12 = 96 bits (at most). </p>
<p>To get a 128 bit key you need a 16 byte string, so I'd go on the safe side and use a 16 character string so it will be a 128 bit key if using ... |
23,153,822 | Mysql datetime DEFAULT CURRENT_TIMESTAMP error | <p><strong>1.</strong>
When I ran this MYSQL syntax on windows it ran properly:</p>
<pre><code>CREATE TABLE New
(
id bigint NOT NULL AUTO_INCREMENT,
timeUp datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (id)
)
</code></pre>
<p>But when I tried running this code on Linux I got an error:</p>
<pre><code> #1067 -... | 23,153,922 | 3 | 0 | null | 2014-04-18 12:09:31.203 UTC | 5 | 2020-02-25 06:45:07.86 UTC | 2020-02-25 06:45:07.86 UTC | null | 5,411,817 | null | 2,952,562 | null | 1 | 14 | mysql|linux|windows | 58,562 | <p>The <strong><code>DEFAULT CURRENT_TIMESTAMP</code></strong> support for a <strong><code>DATETIME</code></strong> (datatype) was added in MySQL 5.6.</p>
<p>In 5.5 and earlier versions, this applied only to <strong><code>TIMESTAMP</code></strong> (datatype) columns.</p>
<p>It is possible to use a <strong><code>BEFOR... |
19,820,020 | hg remove all files listed in .hgignore | <p>I have a mercurial repo with <code>.hgignore</code> file. I want to remove all files from disk (<code>hg remove</code>) in this repo which match pattern(s) listed in <code>.hgignore</code>.</p>
<p>I can list all ignored files with <code>hg status -i</code> but I don't know how can I delete them.</p>
<p>.hgignore c... | 19,826,709 | 2 | 0 | null | 2013-11-06 18:35:28.55 UTC | 8 | 2018-02-22 10:27:37.897 UTC | null | null | null | null | 355,507 | null | 1 | 18 | mercurial|ubuntu-13.10 | 5,262 | <p>You can only run <code>hg remove</code> on files that are tracked. To remove tracked files that match the <code>.hgignore</code> patterns, run this command</p>
<pre><code>$ hg forget "set:hgignore() and not ignored()"
</code></pre>
<p>This uses a <a href="http://www.selenic.com/mercurial/hg.1.html#fileset" rel="no... |
34,071,879 | How do I use, or set up sonar-project.properties file? | <p>I have very little exposure to SonarQube but have been asked to make a document explaining how to set up / use "sonar-project.properties file". Any information or input would be greatly appreciated.</p> | 34,083,626 | 2 | 0 | null | 2015-12-03 16:59:35.977 UTC | 6 | 2022-07-18 14:25:29.963 UTC | 2020-12-18 11:09:03.967 UTC | null | 1,783,163 | null | 5,422,190 | null | 1 | 40 | sonarqube|properties-file|sonar-runner | 110,307 | <p>Here are some resources to get you started</p>
<p><a href="https://www.wrightfully.com/setting-up-sonar-analysis-for-c-projects/" rel="noreferrer">https://www.wrightfully.com/setting-up-sonar-analysis-for-c-projects/</a> - See Step 6: The sonar-project.properties file.</p>
<p><a href="https://docs.sonarqube.org/di... |
17,974,255 | Is there a way to see which email address a contact form is sending it content to | <p>Is there any way to see which email address a contact form is sending it content to ? </p>
<p>Someone asked me this today, and i thought the answer would be no, but it got me thinking is there a way..</p>
<p>The only thing i could think of looking at would be the POST data which would show you were the data was po... | 17,974,784 | 1 | 0 | null | 2013-07-31 15:14:25.783 UTC | 2 | 2018-10-13 02:26:25.767 UTC | null | null | null | null | 1,183,150 | null | 1 | 9 | email|reverse-engineering|contact-form|email-address | 70,765 | <p>There are some ocasions when the contact form will send a destination address in a hidden HTML field, but I would say that those are the minority of all contact pages I have seen.</p>
<p>There is no need to pass the recipient of the email address if you only really process it internally.</p>
<p>Actually, the conta... |
35,415,101 | Prevent Android logcat clear during app restart | <p>I am using Android Studio 1.5.1 and it clears the logcat buffer during app restart. Now my app crashes, restarts and I don't see what happens just before the crash.</p>
<p>Is there a way for logcat in Android Studio not to clear during the app restart? I wanted to increase the logcat buffer size, but could not find... | 36,784,131 | 2 | 0 | null | 2016-02-15 17:08:10.057 UTC | 8 | 2021-05-13 15:49:24.157 UTC | 2016-08-03 14:18:50.05 UTC | null | 2,065,587 | null | 96,410 | null | 1 | 70 | android-studio|logcat|android-logcat | 12,793 | <p>I had the same issue, but looks more like a feature than a bug:</p>
<p>In AndroidStudio, the default setting for the Logcat window seems to be "Show only selected Application" (top right corner of the Logcat window)... which is looking at the log of the selected process (your current launch by default). So when you... |
47,070,997 | How to get "key" prop from React element (on change)? | <p>I want to get option's value and key when select <code>onChange</code>.</p>
<p>I know I can get option's <em>value</em> simplicity used <code>event.target.value</code> in <code>onChangeOption</code> function, but how can I get <code>key</code>?</p>
<pre><code><select onChange={this.onChangeOption} value={countr... | 47,071,992 | 7 | 1 | null | 2017-11-02 08:48:28.357 UTC | 4 | 2022-08-03 03:36:04.347 UTC | 2019-06-06 12:42:08.643 UTC | null | 104,380 | null | 8,180,718 | null | 1 | 64 | javascript|reactjs | 137,488 | <p>Passing key as a prop works obviously, but much quicker way could be to include the key as a custom attribute in your html.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="true">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>c... |
27,117,337 | Exclude route from express middleware | <p>I have a node app sitting like a firewall/dispatcher in front of other micro services and it uses a middleware chain like below:</p>
<pre><code>...
app.use app_lookup
app.use timestamp_validator
app.use request_body
app.use checksum_validator
app.use rateLimiter
app.use whitelist
app.use proxy
...
</code></pre>
<p... | 27,118,077 | 8 | 1 | null | 2014-11-25 01:30:11.15 UTC | 14 | 2020-05-09 11:20:38.12 UTC | null | null | null | null | 627,408 | null | 1 | 46 | javascript|node.js|express|coffeescript|middleware | 61,042 | <p>Even though there is no build-in middleware filter system in expressjs, you can achieve this in at least two ways.</p>
<p>First method is to mount all middlewares that you want to skip to a regular expression path than includes a negative lookup:</p>
<pre><code>// Skip all middleware except rateLimiter and proxy w... |
43,484,302 | What does ...rest mean in React JSX? | <p>Looking at this React Router Dom v4 example <a href="https://reacttraining.com/react-router/web/example/auth-workflow" rel="noreferrer">https://reacttraining.com/react-router/web/example/auth-workflow</a> I see that <strong>PrivateRoute</strong> component destructures a rest prop like this</p>
<pre><code>const Priva... | 43,484,565 | 3 | 1 | null | 2017-04-19 00:29:48.277 UTC | 67 | 2022-01-08 07:15:59.64 UTC | 2022-01-08 07:15:59.64 UTC | null | 10,262,805 | null | 820,067 | null | 1 | 121 | javascript|reactjs|react-router | 88,360 | <p>Sorry, I realized my first answer (while hopefully still providing useful/additional context) doesn't answer your question. Let me try again.</p>
<p>You ask:</p>
<blockquote>
<p>I want to be certain that <code>{ component: Component, ...rest }</code> means:</p>
<p>From <code>props</code>, get the <code>Component</co... |
6,603,362 | Ruby on Rails Switch | <p>Can someone provide an example on how to use switch case in Ruby for variable?</p> | 6,603,562 | 1 | 0 | null | 2011-07-06 21:39:48.23 UTC | 5 | 2013-08-06 19:52:04.297 UTC | 2013-08-06 19:52:04.297 UTC | null | 1,017,941 | null | 806,550 | null | 1 | 66 | ruby|switch-statement | 101,226 | <p>I assume you refer to case/when.</p>
<pre><code>case a_variable # a_variable is the variable we want to compare
when 1 #compare to 1
puts "it was 1"
when 2 #compare to 2
puts "it was 2"
else
puts "it was something else"
end
</code></pre>
<p>or</p>
<pre><code>puts case a_variable
when 1
"it was 1"
w... |
56,410,074 | How to set the background color of a Row() in Flutter? | <p>I'm trying to set up a background color for a Row() widget, but Row itself has no background color or color attribute. I've been able to set the background color of a container to grey, right before the purple-backgrounded text, but the text itself does not fill the background completely and the following spacer doe... | 56,410,215 | 5 | 1 | null | 2019-06-01 20:07:53.93 UTC | 5 | 2022-03-22 15:11:21.54 UTC | 2022-01-04 20:17:59.79 UTC | null | 6,618,622 | null | 1,214,761 | null | 1 | 65 | flutter|dart|flutter-layout | 93,787 | <p>Just wrap your Row with a Container with colour property like below: </p>
<pre><code> Container(
color: Colors.black,
child: Row(
children: <Widget>[
Expanded(
child: Text('Demo', style: TextStyle(color: Colors.white),),
... |
24,186,648 | Swift equivalent for MIN and MAX macros | <p>In C / Objective-C it is possible to find the minimum and maximum value between two numbers using MIN and MAX macros. Swift doesn't support macros and it seems that there are no equivalents in the language / base library. Should one go with a custom solution, maybe based on generics like this <a href="http://www.cpl... | 24,186,709 | 5 | 0 | null | 2014-06-12 14:13:34.403 UTC | 13 | 2021-09-23 16:40:09.237 UTC | null | null | null | null | 3,734,205 | null | 1 | 102 | generics|swift | 60,280 | <p><code>min</code> and <code>max</code> are defined in Swift:</p>
<pre><code>func max<T : Comparable>(x: T, y: T, rest: T...) -> T
func min<T : Comparable>(x: T, y: T, rest: T...) -> T
</code></pre>
<p>and used like so:</p>
<pre><code>let min = min(1, 2)
let max = max(1, 2)
</code></pre>
<p>See this ... |
5,891,431 | 416 Requested Range Not Satisfiable | <p>Context: I am using a software package called Social Engine. It is extremely buggy. </p>
<p>Anyway, I asked (paid even) the Social Engine people to do an upgrade and when they finally did so, I logged into the site and noticed that the styles were all missing. I opened a support ticket and all they told me was tha... | 5,898,834 | 3 | 1 | null | 2011-05-05 00:38:12.953 UTC | 2 | 2014-05-09 03:44:20.573 UTC | 2011-05-07 10:35:53.19 UTC | null | 283,078 | null | 418,046 | null | 1 | 23 | apache|http|http-headers|ubuntu-10.10 | 47,242 | <p>The issue could be due to your browser having cached the original CSS files and trying to request byte ranges of the new files. See for example <a href="http://code.google.com/p/chromium/issues/detail?id=68298" rel="noreferrer">this bug with Chrome</a>.</p>
<p>As far as disabling range requesting, it might not be n... |
6,006,494 | git submodule modified files status | <p>I've added a submodule in my main git folder tree and haven't changed anything but it's showing up modified. What do I do about this?</p>
<pre><code>$ git status
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>... | 6,006,919 | 3 | 1 | null | 2011-05-15 04:30:17.85 UTC | 20 | 2019-11-26 22:27:30.893 UTC | 2014-03-20 05:12:07.073 UTC | null | 272,287 | null | 332,913 | null | 1 | 52 | git|git-submodules | 30,996 | <p>The way that the status of git submodules is reported has changed a lot over recent versions of git, so you should really include the output of <code>git --version</code> as well for us to be able to help accurately.</p>
<p>However, in any case, the output of <code>git diff example.com/soundmanager</code> should te... |
6,033,905 | Create the perfect JPA entity | <p>I've been working with JPA (implementation Hibernate) for some time now and each time I need to create entities I find myself struggling with issues as AccessType, immutable properties, equals/hashCode, ... .<br>
So I decided to try and find out the general best practice for each issue and write this down for person... | 14,822,709 | 4 | 5 | null | 2011-05-17 16:16:00.277 UTC | 408 | 2022-09-07 00:29:59.457 UTC | 2018-10-03 11:54:08.817 UTC | null | 3,988,992 | null | 190,596 | null | 1 | 445 | java|hibernate|jpa|equals | 179,381 | <p>I'll try to answer several key points: this is from long Hibernate/ persistence experience including several major applications.</p>
<p><strong>Entity Class: implement Serializable?</strong></p>
<p><em>Keys</em> needs to implement Serializable. Stuff that's going to go in the HttpSession, or be sent over the wire... |
2,168,704 | WCF Dependency injection and abstract factory | <p>I have this wcf method</p>
<pre><code>Profile GetProfileInfo(string profileType, string profileName)
</code></pre>
<p>and a business rule:</p>
<p>if profileType is "A" read from database.</p>
<p>if profileType is "B" read from xml file.</p>
<p>The question is: how to implement it using a dependency injection co... | 2,168,882 | 2 | 0 | null | 2010-01-30 17:26:38.517 UTC | 12 | 2016-04-12 05:26:19.003 UTC | 2014-09-22 14:33:32.267 UTC | null | 1,911,306 | null | 43,162 | null | 1 | 19 | wcf|dependency-injection|factory-pattern | 8,922 | <p>Let's first assume that you have an IProfileRepository something like this:</p>
<pre><code>public interface IProfileRepository
{
Profile GetProfile(string profileName);
}
</code></pre>
<p>as well as two implementations: <code>DatabaseProfileRepository</code> and <code>XmlProfileRepository</code>. The issue is... |
1,785,422 | How do you put HTML or XML into a YAML? | <p>I would like to store HTML snippets inside a <a href="http://en.wikipedia.org/wiki/YAML" rel="noreferrer">YAML</a> file. What is the best way to do that?</p>
<p>Something like:</p>
<pre><code>myhtml: |
<div>
<a href="#">whatever</a>
</div>
</code></pre> | 1,786,044 | 2 | 0 | null | 2009-11-23 19:31:06.263 UTC | 4 | 2018-09-06 00:01:56.12 UTC | 2017-12-26 21:29:13.373 UTC | null | 42,223 | null | 217,275 | null | 1 | 31 | yaml|configuration-files|code-snippets|markup | 31,701 | <p><strong>Example</strong></p>
<p>Here is a sample record from a YAML-based snippet management system I created years ago:</p>
<pre><code>- caption: fieldset msie5
tinycap: fieldset
domain: html
desc: fieldset and legend tag
wwbody: |
<fieldset>
<legend>legend</lege... |
1,470,777 | Forms Authentication Timeout vs Session Timeout | <p>In my asp.net website i am using asp.net form authentication with following configuration</p>
<pre><code><authentication mode="Forms">
<forms loginUrl="~/Pages/Common/Login.aspx"
defaultUrl="~/Pages/index.aspx"
protection="All"
timeout="30"
name="MyAuthCookie... | 1,470,793 | 2 | 0 | null | 2009-09-24 10:03:04.61 UTC | 44 | 2014-12-22 22:36:37.807 UTC | 2014-12-22 22:36:37.807 UTC | null | 284,598 | null | 133,098 | null | 1 | 65 | asp.net|forms|session|timeout|asp.net-3.5 | 101,168 | <ol>
<li>To be on the safe side: TimeOut(Session) <= TimeOut(FormsAuthentication) * 2</li>
<li>If you want to show page other than specified in loginUrl attribute after authentication timeout you need to handle this manually as ASP.NET does not provide a way of doing it.</li>
</ol>
<p>To achieve #2 you can manually... |
29,461,693 | How can I get cargo to recompile changed files automatically? | <p>I have heard cargo has the ability to automatically recompile changed source files, but I'm having a hard time figuring out how to tell it to do so.</p>
<p>For now, I am manually running <code>cargo build</code> or <code>cargo run</code> every time I want to type check my code. I would prefer to instead simply save... | 38,117,745 | 6 | 0 | null | 2015-04-05 20:09:18.943 UTC | 9 | 2022-03-11 12:40:02.687 UTC | 2015-04-05 20:15:30.417 UTC | null | 155,423 | null | 2,343,847 | null | 1 | 57 | rust|rust-cargo | 15,075 | <h3>cargo watch</h3>
<p>In case you are working on a server project (e.g. hyper, iron, etc) that keeps running and you need it to be restarted when files change, you can use <a href="https://github.com/watchexec/cargo-watch" rel="noreferrer"><code>cargo watch</code></a>. Install:</p>
<pre><code>cargo install cargo-watc... |
29,124,126 | Polymorphic JSON Deserialization failing using Json.Net | <p>I'm trying to deserialize some JSON to various sub-classes using a custom <code>JsonConverter</code></p>
<p>I followed <a href="https://stackoverflow.com/a/19308474/1351298">this</a> almost to the point.</p>
<p>My abstract base-class:</p>
<pre><code>abstract class MenuItem
{
public String Title { get; set; }
... | 29,124,962 | 2 | 1 | null | 2015-03-18 14:01:10.857 UTC | 9 | 2015-03-18 14:48:56.057 UTC | 2017-05-23 10:30:48.837 UTC | null | -1 | null | 1,351,298 | null | 1 | 19 | c#|json|serialization|json.net | 6,002 | <p>Firstly, <code>SourceType</code> is missed for menu item "Submenus Test" in your json.</p>
<p>Secondly, you shouldn't simply use <code>ToObject</code> because of the <code>Submenus</code> property, which should be handled recursively.</p>
<p>The following <code>ReadJson</code> will work:</p>
<pre><code>public ove... |
32,588,604 | vim-airline: what is "! trailing[1]" | <p>At the right of my vim-airline display, I have <code>! trailing[1]</code>. </p>
<p>I'm assuming this means trailing whitespace of some sort, but how do I read what vim-airline is telling me and what am I supposed to do?</p> | 32,588,802 | 3 | 2 | null | 2015-09-15 14:25:12.22 UTC | 4 | 2020-12-19 14:27:26.963 UTC | 2015-09-24 07:24:21.313 UTC | null | 1,170,333 | null | 843,542 | null | 1 | 36 | vim|vim-plugin|vim-airline | 15,957 | <p>That means you have a trailing whitespace on the first line (<code>[1]</code>). </p>
<p>You can add to your <code>.vimrc</code> the following:</p>
<pre><code>set list " Display unprintable characters f12 - switches
set listchars=tab:•\ ,trail:•,extends:»,precedes:« " Unprintable chars mapping
</code></pre... |
5,833,912 | Advantages of using const instead of variables inside methods | <p>Whenever I have local variables in a method, ReSharper suggests to convert them to constants:</p>
<pre><code>// instead of this:
var s = "some string";
var flags = BindingFlags.Public | BindingFlags.Instance;
// ReSharper suggest to use this:
const string s = "some string";
const BindingFlags flags = BindingFlags.... | 5,834,005 | 8 | 0 | null | 2011-04-29 15:17:53.09 UTC | 13 | 2019-03-14 13:37:16.013 UTC | 2017-05-23 12:10:39.227 UTC | null | -1 | null | 19,635 | null | 1 | 92 | c#|coding-style|resharper|constants | 44,255 | <p>The compiler will throw an error if you try to assign a value to a constant, thus possibly preventing you from accidentally changing it.</p>
<p>Also, usually there is a small performance benefit to using constants vs. variables. This has to do with the way they are compiled to the MSIL, per <a href="http://msdn.mic... |
6,068,955 | jQuery function after .append | <p>How to call a function after jQuery <code>.append</code> is completely done?</p>
<p>Here's an example:</p>
<pre><code>$("#root").append(child, function(){
// Action after append is completly done
});
</code></pre>
<p>The issue: When a complex DOM structure is appended, calculation of new size of the root eleme... | 6,069,060 | 18 | 3 | null | 2011-05-20 07:46:55.22 UTC | 15 | 2019-09-28 11:12:29.497 UTC | 2016-12-06 14:32:05.53 UTC | null | 600,082 | null | 600,082 | null | 1 | 100 | jquery | 173,557 | <p>You've got many valid answers in here but none of them really tells you why it works as it does.</p>
<p>In JavaScript commands are executed one at a time, synchronously in the order they come, unless you explicitly tell them to be asynchronous by using a timeout or interval.</p>
<p>This means that your <code>.app... |
39,408,793 | Git core.autocrlf line ending default setting | <p>I'm trying to figure out what is the default value for <code>core.autocrlf</code> in Git if the user doesn't change this setting.</p>
<p>I've looked in the docs but can't find this info. Can you please point me in the right direction?</p>
<p>Specifically, on a fresh Git install, would Git automatically convert Win... | 48,230,871 | 5 | 2 | null | 2016-09-09 09:53:56.14 UTC | 5 | 2021-09-09 02:30:14.583 UTC | 2019-11-07 13:40:34.397 UTC | null | 11,808 | null | 570,016 | null | 1 | 46 | git|operating-system|newline | 19,185 | <p>Checking the <a href="https://github.com/git/git/blob/936d1b989416a95f593bf81ccae8ac62cd83f279/environment.c#L48" rel="noreferrer">git source code</a>, core.autocrlf is set to false by default. (And has been since the property's original introduction on <a href="https://github.com/git/git/commit/6c510bee2013022fbce5... |
49,130,558 | Postman can't reach localhost | <p>I am in a corporate env so I have to use a proxy to reach servers. This works well in postman and in browsers. What I can't reach is localhost in postman but I can reach localhost in the browser. </p>
<p>I am running Postman for Linux Version 6.0.9. I have tried reaching localhost:9082/rest/myapi.... and 127.0.0.1:... | 49,131,070 | 21 | 2 | null | 2018-03-06 12:12:30.54 UTC | 15 | 2022-02-17 09:43:58.31 UTC | 2018-03-06 12:16:20.637 UTC | null | 1,968,182 | null | 1,329,339 | null | 1 | 63 | proxy|postman | 161,891 | <p>I found a temporary solution:</p>
<p>In terminal, go to the directory where postman is installed and add:</p>
<pre><code>machine@dev:~/Documents/Postman$ export NO_PROXY=localhost,127.0.0.1
machine@dev:~/Documents/Postman$ ./Postman
</code></pre>
<p>This will make calls to localhost work.</p>
<p>I found a simil... |
33,001,237 | Webpack not excluding node_modules | <p>I'm using webpack for a Node framework that I'm building (though I should probably use gulp, admittedly). When I include the EJS module, webpack includes it in the compiled source, even though I explicitly tell it to exclude the node_modules dir.</p>
<pre><code>module.exports = {
context: __dirname,
target:... | 35,820,388 | 5 | 1 | null | 2015-10-07 19:52:13.543 UTC | 31 | 2021-08-23 22:51:02.727 UTC | null | null | null | null | 1,408,759 | null | 1 | 104 | javascript|webpack | 149,231 | <p>From your config file, it seems like you're only excluding <code>node_modules</code> from being parsed with <code>babel-loader</code>, <strong>but not</strong> from being bundled.</p>
<p>In order to exclude <code>node_modules</code> and native node libraries from bundling, you need to:</p>
<ol>
<li><p>Add <code>targ... |
9,014,764 | Have a parent class's method access the subclass's constants | <p>For example:</p>
<pre><code>class Animal
def make_noise
print NOISE
end
end
class Dog < Animal
NOISE = "bark"
end
d = Dog.new
d.make_noise # I want this to print "bark"
</code></pre>
<p>How do I accomplish the above? Currently it says </p>
<pre><code>uninitialized constant Animal::NOISE
</code><... | 9,014,799 | 5 | 0 | null | 2012-01-26 06:48:11.23 UTC | 3 | 2016-12-16 20:07:43.16 UTC | 2012-01-26 06:54:03.94 UTC | null | 405,017 | null | 553,044 | null | 1 | 28 | ruby|constants | 8,320 | <p>I think that you don't really want a constant; I think that you want an instance variable on the class:</p>
<pre><code>class Animal
@noise = "whaargarble"
class << self
attr_accessor :noise
end
def make_noise
puts self.class.noise
end
end
class Dog < Animal
@noise = "bark"
end
a = Ani... |
9,567,882 | Sobel filter kernel of large size | <p>I am using a sobel filter of size 3x3 to calculate the image derivative. Looking at some articles on the internet, it seems that kernels for sobel filter for size 5x5 and 7x7 are also common, but I am not able to find their kernel values. </p>
<p>Could someone please let me know the kernel values for sobel filter o... | 9,567,940 | 10 | 0 | null | 2012-03-05 13:59:30.26 UTC | 22 | 2021-08-17 06:44:50.42 UTC | 2016-04-06 14:09:05.207 UTC | null | 253,056 | null | 938,221 | null | 1 | 49 | image-processing|computer-vision|edge-detection|sobel | 50,305 | <p><em>UPDATE 23-Apr-2018: it seems that the kernels defined in the link below are not true Sobel kernels (for 5x5 and above) - they may do a reasonable job of edge detection, but they should not be called Sobel kernels. See <a href="https://stackoverflow.com/a/41065243/253056">Daniel’s answer</a> for a more accurate a... |
9,373,104 | Why doesn't ruby support method overloading? | <p>Instead of supporting method overloading Ruby overwrites existing methods. Can anyone explain why the language was designed this way?</p> | 9,373,811 | 9 | 0 | null | 2012-02-21 06:22:49.65 UTC | 40 | 2022-06-29 09:22:03.723 UTC | 2014-06-20 16:49:12.267 UTC | null | 183,380 | null | 489,559 | null | 1 | 153 | ruby | 53,089 | <p>Method overloading can be achieved by declaring two methods with the same name and different signatures. These different signatures can be either,</p>
<ol>
<li>Arguments with different data types, eg: <code>method(int a, int b) vs method(String a, String b)</code></li>
<li>Variable number of arguments, eg: <code>me... |
31,109,345 | Android - How to Convert String to utf-8 in android | <p>I can't convert a String to UTF-8 in android. please help me!!</p>
<pre><code>s1=URLEncoder.encode("臺北市")
</code></pre>
<p>result : <code>%EF%BF%BDO%EF%BF%BD_%EF%BF%BD%EF%BF%BD</code></p>
<p>But "<code>臺北市</code>" should be encoded as "<code>%E8%87%BA%E5%8C%97%E5%B8%82</code>"</p> | 31,109,646 | 4 | 1 | null | 2015-06-29 06:45:49.923 UTC | 2 | 2019-01-18 22:34:59.693 UTC | 2017-03-30 14:38:31.41 UTC | null | 5,530,965 | null | 5,059,958 | null | 1 | 9 | java|android|utf-8|encode | 64,065 | <p>In <a href="http://developer.android.com/reference/java/net/URLEncoder.html">http://developer.android.com/reference/java/net/URLEncoder.html</a> you can read that the you used is deprecated and that you should use <code>static String encode(String s, String charsetName)</code></p>
<p>So <code>URLEncoder.encode("臺北市... |
47,238,245 | Stop swiper slide autoplay on mouse enter and start autoplay on mouse leave | <p>How to stop swiper slide autoplay on mouse enter and start autoplay on mouse leave? I have tried <code>.stopAutoplay()</code> and <code>.startAutoplay()</code> function but not worked for me.</p>
<p>thank you here is code. and i face console error </p>
<blockquote>
<p>Uncaught TypeError: swiper .startAutoplay i... | 47,238,361 | 8 | 1 | null | 2017-11-11 13:11:01.663 UTC | 8 | 2022-04-15 17:55:27.82 UTC | 2018-09-05 18:40:44.843 UTC | null | 3,731,614 | null | 5,287,215 | null | 1 | 9 | javascript|jquery|swiper.js | 59,336 | <p>You need to use the option <code>disableOnInteraction: true</code> rather than binding the events yourself see here for <a href="http://idangero.us/swiper/api/#autoplay" rel="noreferrer">documentation</a>.</p>
<p>Optionally you can use the following for autoplay start stop </p>
<ul>
<li><p><code>swiper.autoplay.st... |
22,774,529 | What is the safest way to removing Python framework files that are located in different place than Brew installs | <p>I want to remove a Python installed in location that brew complains about, when I run <code>brew doctor</code></p>
<blockquote>
<p><strong>Warning:</strong> Python is installed at /Library/Frameworks/Python.framework</p>
</blockquote>
<p><strong>What is the best way?</strong></p>
<p><strong>Here are more detail... | 22,800,774 | 1 | 1 | null | 2014-04-01 00:11:09.9 UTC | 35 | 2017-12-20 21:27:53.01 UTC | 2017-05-23 12:02:21.55 UTC | null | -1 | null | 2,283,965 | null | 1 | 52 | python|macos|homebrew|brew-doctor | 94,766 | <p>I'll self-answer. I went through steps and it's straight forward. Pycharms (the IDE I'm use) automatically found the new libraries too. Here are the steps I followed to remove the extra Python libraries on Mavericks that were not native to it and not installed by brew.</p>
<p><strong>Step 1:</strong>
The native Pyt... |
22,904,216 | What keeps a php session alive? | <p>Are sessions only kept alive each time you access a page with <code>session_start();</code> or do other pages keep it alive too?</p>
<p>Example (with <strong>30 minute</strong> timeout):</p>
<h2>1</h2>
<blockquote>
<p>user accesses page with session_start();<br>
25 mins later they access another session_start... | 22,904,338 | 7 | 2 | null | 2014-04-07 05:25:46.573 UTC | 3 | 2015-05-17 15:31:29.51 UTC | 2014-04-07 06:47:51.287 UTC | null | 1,372,424 | null | 952,170 | null | 1 | 34 | php|session | 10,814 | <p>There is always a session cookie set in your browser whenever you access a page which has <code>session_start()</code>. The cookie name will <code>PHPSESSID</code> if the website is using PHP(although the name can be changed). This session cookie contains a session id which helps the browser to maintain that sessio... |
7,213,549 | Long Polling/HTTP Streaming General Questions | <p>I'm trying to make a theoretical web chat application with <a href="/questions/tagged/php" class="post-tag" title="show questions tagged 'php'" rel="tag">php</a> and <a href="/questions/tagged/jquery" class="post-tag" title="show questions tagged 'jquery'" rel="tag">jquery</a>, I've read about long p... | 7,214,483 | 2 | 3 | null | 2011-08-27 09:05:34.187 UTC | 12 | 2011-09-12 15:33:27.757 UTC | 2020-06-20 09:12:55.06 UTC | null | -1 | null | 871,050 | null | 1 | 19 | php|jquery|comet|long-polling|http-streaming | 6,913 | <p>Yeah, the Comet-like techniques usually blowing up the brain in the beginning -- just making you think in a different way. And another problem is there are not that much resources available for PHP, cuz everyone's doing their Comet in node.js, Python, Java, etc.</p>
<p>I'll try to answer your questions, hope it wou... |
7,029,904 | Looking for the Code Converter which converts C# to Java | <p>Can anybody help me by suggesting the name of an converter which converts C# code to Java code. Actually, I have a tool which is written in C# code and I am trying to modify it. As I have no idea about C# and .NET framework, it seems difficult to me to convert the large code by my own. I found from some web informat... | 7,030,553 | 2 | 9 | null | 2011-08-11 16:58:09.987 UTC | 5 | 2015-07-27 16:15:01.207 UTC | 2015-07-27 16:15:01.207 UTC | null | 1,768,232 | null | 772,399 | null | 1 | 20 | java|c#|code-conversion | 60,646 | <p><strong>Disclaimer:</strong> <em>No tool is perfect.</em></p>
<p>However, if you still want to try then there are these converters available:</p>
<ul>
<li><a href="http://www.cs2j.com/" rel="noreferrer">CS2J</a></li>
<li><a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=14349" rel="n... |
7,314,849 | What is purpose of the property "private" in package.json? | <p>I'm learning node.js and express, I am wondering what is the property "private" in ./package.json file used for?</p> | 7,314,961 | 2 | 0 | null | 2011-09-06 04:14:04.443 UTC | 18 | 2022-01-28 12:54:51.743 UTC | 2019-01-31 12:38:22.463 UTC | null | 5,812,238 | null | 501,963 | null | 1 | 227 | node.js|package.json | 76,192 | <p>From the <a href="https://docs.npmjs.com/cli/v7/configuring-npm/package-json#private" rel="noreferrer">NPM docs on <code>package.json</code></a>:</p>
<blockquote>
<p><code>private</code></p>
<p>If you set <code>"private": true</code> in your package.json, then npm will refuse to publish it.</p>
<p>This is ... |
35,684,436 | Testing file uploads in Flask | <p>I'm using <a href="https://pythonhosted.org/Flask-Testing/" rel="noreferrer">Flask-Testing</a> for my Flask integration tests. I've got a form that has a file upload for a logo that I'm trying to write tests for but I keep getting an error saying: <code>TypeError: 'str' does not support the buffer interface</code>.<... | 35,712,344 | 4 | 1 | null | 2016-02-28 15:33:39.437 UTC | 12 | 2022-02-16 17:39:57.63 UTC | 2020-02-04 23:06:08.593 UTC | null | 400,617 | null | 1,069,232 | null | 1 | 48 | python|flask | 28,381 | <p>The issue ended up not being that when one adds <code>content_type='multipart/form-data'</code> to the <code>post</code> method it expect all values in <code>data</code> to either be files or strings. There were integers in my data dict which I realised thanks to <a href="https://stackoverflow.com/questions/35684436... |
21,065,938 | Read a single column of a CSV and store in an array | <p>What is the best way to read from a csv, but only one specific column, like <code>title</code>?</p>
<pre><code>ID | date| title |
-------------------
1| 2013| abc |
2| 2012| cde |
</code></pre>
<p>The column should then be stored in an array like this:</p>
<pre><code>data = ["abc", "cde"]
</code></pre>... | 21,066,850 | 3 | 2 | null | 2014-01-11 18:07:42.15 UTC | 4 | 2014-01-12 15:10:43.253 UTC | 2017-05-23 11:45:24.007 UTC | null | -1 | null | 1,344,855 | null | 1 | 12 | python|csv|pandas | 47,797 | <p>One option is just to read in the entire csv, then select a column:</p>
<pre><code>data = pd.read_csv("data.csv")
data['title'] # as a Series
data['title'].values # as a numpy array
</code></pre>
<p>As @dawg suggests, you can use the usecols argument, if you also use the squeeze argument to avoid some hackery f... |
18,727,110 | SQL Server Management Studio - Login failed for user (.Net SqlClient Data Provider) | <p>I have very strange problem.</p>
<p>When I try to connect my database (located on shared SQL Server) with SQL Server Management Studio 2008/2012. This database which is hosted by a company for web hosting, I receive this very strange error:</p>
<blockquote>
<p>Cannot connect to tango.rdb.superhosting.bg.</p>
... | 18,729,271 | 1 | 1 | null | 2013-09-10 19:16:33.963 UTC | 5 | 2016-12-30 06:07:43.647 UTC | 2013-09-10 20:29:58.06 UTC | null | 13,302 | null | 1,586,697 | null | 1 | 11 | ssms | 42,723 | <p>This is probably an issue of an orphaned user.</p>
<p>The login 'database_administrator' can either be:</p>
<ul>
<li>On the Database itself. Just navigate to Logins under the database in SSMS.</li>
<li>Or, under the Server -> Security Logins.</li>
</ul>
<p>What I usually do is:</p>
<ol>
<li>Remove the Login tha... |
28,045,787 | How many decimal places does the primitive float and double support? | <p>I have read that double stores 15 digits and float stores 7 digits.</p>
<p>My question is, are these numbers the number of decimal places supported or total number of digits in a number?</p> | 28,045,815 | 4 | 1 | null | 2015-01-20 12:48:39.893 UTC | 2 | 2015-01-20 14:10:02.523 UTC | null | null | null | null | 521,180 | null | 1 | 16 | c++ | 51,375 | <p>Those are the total number of "significant figures" if you will, counting from left to right, regardless of where the decimal point is. Beyond those numbers of digits, accuracy is not preserved.</p>
<p>The counts you listed are for the base 10 representation.</p> |
2,294,250 | .NET MVC - How to assign a class to Html.LabelFor? | <p>This code</p>
<pre><code><%= Html.LabelFor(model => model.Name) %>
</code></pre>
<p>produces this</p>
<pre><code><label for="Name">Name</label>
</code></pre>
<p>But I want this</p>
<pre><code><label for="Name" class="myLabel">Name</label>
</code></pre>
<p>How do you do that?</p... | 2,294,335 | 3 | 0 | null | 2010-02-19 05:25:22.423 UTC | 12 | 2013-11-25 20:33:07.28 UTC | 2012-08-03 12:09:40.077 UTC | null | 457,500 | null | 36,036 | null | 1 | 69 | asp.net-mvc | 69,309 | <p>Okay, looking at the source (System.Web.Mvc.Html.LabelExtensions.cs) for this method, there doesn't seem to be a way to do this with an HtmlHelper in ASP.NET MVC 2. I think your best bet is to either create your own HtmlHelper or do the following for this specific label:</p>
<pre><code><label for="Name" class="m... |
8,518,750 | To show only file name without the entire directory path | <p><code>ls /home/user/new/*.txt</code> prints all txt files in that directory. However it prints the output as follows:</p>
<pre><code>[me@comp]$ ls /home/user/new/*.txt
/home/user/new/file1.txt /home/user/new/file2.txt /home/user/new/file3.txt
</code></pre>
<p>and so on.</p>
<p>I want to run the <code>ls</co... | 8,518,818 | 13 | 1 | null | 2011-12-15 10:41:11.743 UTC | 21 | 2022-02-01 18:34:51.943 UTC | 2015-07-02 15:00:01.653 UTC | null | 1,288 | null | 1,099,285 | null | 1 | 94 | shell|unix|directory|ls | 213,244 | <p><code>ls whateveryouwant | xargs -n 1 basename</code></p>
<p>Does that work for you?</p>
<p>Otherwise you can <code>(cd /the/directory && ls)</code> (yes, parentheses intended)</p> |
19,323,678 | Error in resolving buildtime dependencies while installing CloudStack on ubuntu. | <p>I am installing cloudstack on ubuntu and it uses maven to resolve its dependencies. I am getting the following errors when am running the command <code>mvn -P deps</code> </p>
<pre><code>[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project org.apache.cloudstack:cloudstack:4.... | 19,363,885 | 4 | 1 | null | 2013-10-11 17:10:30.583 UTC | 2 | 2016-10-25 09:53:44.46 UTC | 2013-10-13 12:17:54.353 UTC | null | 1,521,627 | null | 2,871,856 | null | 1 | 12 | maven|apache-cloudstack | 38,970 | <p>This is a <strong>networking</strong> issue: </p>
<p>Your build machine cannot access <a href="http://repo.maven.apache.org/maven2" rel="nofollow noreferrer">http://repo.maven.apache.org/maven2</a></p>
<p>Use <code>wget</code> at command line to check if you can access the website. E.g.</p>
<pre><code>root@mgmts... |
58,896,661 | SwiftUI create image slider with dots as indicators | <p>I want to create a scroll view/slider for images. See my example code:</p>
<pre><code>ScrollView(.horizontal, showsIndicators: true) {
HStack {
Image(shelter.background)
.resizable()
.frame(width: UIScreen.main.bounds.width, height: 300)
Image("pacific")
... | 58,904,512 | 2 | 1 | null | 2019-11-17 01:13:52.543 UTC | 9 | 2021-09-25 21:15:20.87 UTC | 2019-11-17 01:17:07.49 UTC | null | 1,226,963 | null | 11,397,070 | null | 1 | 24 | swift|swiftui | 13,303 | <p>There is no built-in method for this in SwiftUI this year. I'm sure a system-standard implementation will come along in the future.</p>
<p>In the short term, you have two options. As Asperi noted, Apple's own tutorials have a section on wrapping the PageViewController from UIKit for use in SwiftUI (see <a href="htt... |
749,968 | Learning Oracle for the first time | <p>I am a very experienced MS Sql developer, and a few new job positions are coming my way where I will be working with Oracle on a more daily basis.</p>
<p>As with all the technologies I have learned, I want to know the best places and books to get started and up to speed with designing and developing with Oracle, bu... | 749,989 | 4 | 0 | null | 2009-04-15 01:29:29.517 UTC | 10 | 2009-05-12 07:04:02.367 UTC | 2009-05-12 07:04:02.367 UTC | null | 50,552 | null | 13,502 | null | 1 | 8 | c#|.net|sql-server|oracle | 895 | <p><a href="http://www.oracle.com/technology/tech/dotnet/tools/index.html" rel="nofollow noreferrer">Oracle Developer Tools for Visual Studio</a></p>
<p><a href="http://www.oracle.com/technology/tech/dotnet/pdf/ODT11_whatsnew.pdf" rel="nofollow noreferrer">White Paper: New 11g Features in Oracle Developer Tools (PDF)<... |
611,459 | How to sort text in sqlite3 with specified locale? | <p>Sqlite3 by default sorts only by ascii letters. I tried to look in google, but the only thing I found were informations about collations. Sqlite3 has only <code>NOCASE</code>, <code>RTRIM</code> and <code>BIARY</code> collations. How to add support for a specific locale?
(I'm using it in Rails application)</p> | 614,609 | 4 | 0 | null | 2009-03-04 16:50:51.057 UTC | 13 | 2019-11-17 15:21:03.12 UTC | 2016-11-06 19:44:41.51 UTC | null | 178,163 | klew | 58,877 | null | 1 | 16 | ruby-on-rails|sqlite|locale|collation | 16,658 | <p>SQLite <a href="http://www.sqlite.org/src/doc/trunk/ext/icu/README.txt" rel="nofollow noreferrer">supports</a> integration with <a href="http://icu-project.org/" rel="nofollow noreferrer">ICU</a>. According to the Readme file,
<code>sqlite/ext/icu/README.txt</code>
the <code>sqlite/ext/icu/</code> directory contain... |
1,196,467 | OK to put comments before the XML declaration? | <p>Is it OK to put comments before the XML declaration in an XML file?</p>
<pre><code><!--
Is this bad to do?
-->
<?xml version="1.0" encoding="utf-8"?>
<someElement />
</code></pre> | 1,196,485 | 4 | 4 | null | 2009-07-28 20:13:16.373 UTC | 3 | 2021-06-06 04:58:45.327 UTC | null | null | null | null | 111,327 | null | 1 | 32 | xml|xml-declaration | 4,945 | <p>No, it's not OK.</p>
<p><a href="http://www.w3.org/TR/2008/REC-xml-20081126/#sec-guessing" rel="noreferrer">Appendix F of the XML spec</a> says:</p>
<blockquote>
<p>Because each XML entity not
accompanied by external encoding
information and not in UTF-8 or UTF-16
encoding must begin with an XML
encoding... |
51,810,420 | Flutter - InputDecoration border only when focused | <p>I am trying to Design a custom <code>TextFormField</code> and everything is working fine except that I only need to show a border when the <code>TextFormField</code> is focused (someone has tapped into it).</p>
<p>As I don't think that is possible I tried to change the color of the border, but it seems to me that t... | 51,810,972 | 1 | 0 | null | 2018-08-12 15:51:38.253 UTC | 6 | 2018-08-12 17:57:11.76 UTC | null | null | null | null | 6,389,452 | null | 1 | 12 | dart|flutter|flutter-layout | 48,901 | <p>There is a property named <code>focusedBorder</code>, you can use and change it according to your needs, and also set the default border as <code>InputBorder.none</code>, example:</p>
<pre><code> @override
Widget build(BuildContext context) {
return TextFormField(
autocorrect: false,
focu... |
51,680,709 | Colored text output in PowerShell console using ANSI / VT100 codes | <p>I wrote a program which prints a string, which contains <a href="https://blogs.msdn.microsoft.com/commandline/2017/10/11/whats-new-in-windows-console-in-windows-10-fall-creators-update/" rel="noreferrer">ANSI escape sequences</a> to make the text colored. But it doesn't work as expected in the default Windows 10 con... | 51,681,675 | 3 | 0 | null | 2018-08-03 22:19:35.15 UTC | 20 | 2022-09-20 03:26:33.623 UTC | 2018-08-03 23:13:30.293 UTC | null | 5,329,137 | user2226112 | null | null | 1 | 41 | powershell|ansi|windows-console|vt100 | 23,625 | <p>Note:</p>
<ul>
<li><p>The following applies to <em>regular</em> (legacy) console windows on Windows (provided by <code>conhost.exe</code>), which are used <em>by default</em>, including when a console application is launched from a GUI application.</p>
</li>
<li><p>By contrast, the console windows (terminals) provid... |
577,724 | Trouble playing wav in Java | <p>I'm trying to play a</p>
<pre><code>PCM_UNSIGNED 11025.0 Hz, 8 bit, mono, 1 bytes/frame
</code></pre>
<p>file as described <a href="https://stackoverflow.com/questions/26305/how-can-i-play-sound-in-java/26311#26311">here (1)</a> and <a href="https://stackoverflow.com/questions/26305/how-can-i-play-sound-in-java/26... | 577,926 | 1 | 0 | null | 2009-02-23 14:02:07.947 UTC | 9 | 2012-09-27 22:58:08.093 UTC | 2017-05-23 11:58:58.747 UTC | starblue | -1 | gsmd | 15,187 | null | 1 | 9 | java|wav|playback|javasound | 21,170 | <p>I'm not sure why the second approach you linked to starts another thread; I believe the audio will be played in its own thread anyway. Is the problem that your application finishes before the clip has finished playing?</p>
<pre><code>import javax.sound.sampled.*;
import java.io.File;
import java.io.IOException;
imp... |
42,209,875 | Hive 2.1.1 MetaException(message:Version information not found in metastore. ) | <p>I'm running Hadoop 2.7.3, MySQL 5.7.17 and Hive 2.1.1 on Ubuntu 16.04.</p>
<p>When I run ./hive, I keep getting the following warning and exception:</p>
<pre><code>SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/server/hive/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/... | 42,210,184 | 6 | 0 | null | 2017-02-13 17:22:39.737 UTC | 9 | 2022-01-17 16:38:06.38 UTC | 2020-04-15 04:16:40.06 UTC | null | 7,303,447 | null | 7,506,662 | null | 1 | 19 | mysql|hadoop|hive | 29,728 | <p>The necessary tables required for the metastore are missing in MySQL. Manually create the tables and restart hive metastore. </p>
<p>The schema files for MySQL will be available under the path <code>$HIVE_HOME/scripts/metastore/upgrade/mysql/</code>.</p>
<pre><code>cd $HIVE_HOME/scripts/metastore/upgrade/mysql/
&... |
29,889,495 | Count specific string in text file using PowerShell | <p>Is it possible to count specific strings in a file and save the value in a variable?</p>
<p>For me it would be the String "/export" (without quotes).</p> | 29,889,664 | 4 | 0 | null | 2015-04-27 07:17:35.313 UTC | 2 | 2021-09-05 21:30:56.683 UTC | 2018-12-06 23:13:22.723 UTC | null | 63,550 | null | 3,322,838 | null | 1 | 24 | powershell | 65,940 | <p>Here's one method:</p>
<pre><code>$FileContent = Get-Content "YourFile.txt"
$Matches = Select-String -InputObject $FileContent -Pattern "/export" -AllMatches
$Matches.Matches.Count
</code></pre> |
29,999,024 | Adding Thousand Separator to Int in Swift | <p>I am fairly new to Swift and having a great deal of trouble finding a way to add a space as a thousand separator. </p>
<p>What I am hoping to achieve is taking the result of a calculation and displaying it in a textfield so that the format is:</p>
<blockquote>
<p>2 358 000</p>
</blockquote>
<p>instead of</p>
... | 29,999,137 | 7 | 0 | null | 2015-05-02 05:59:57.263 UTC | 11 | 2020-05-26 16:19:48.463 UTC | 2015-05-08 15:05:33.217 UTC | null | 716,216 | null | 4,718,413 | null | 1 | 73 | ios|swift|separator | 52,674 | <p>You can use NSNumberFormatter to specify a different grouping separator as follow:</p>
<p>update: <strong>Xcode 11.5 • Swift 5.2</strong></p>
<pre><code>extension Formatter {
static let withSeparator: NumberFormatter = {
let formatter = NumberFormatter()
formatter.numberStyle = .decimal
... |
35,257,287 | Kestrel shutdown function in Startup.cs in ASP.NET Core | <p>Is there a shutdown function when using <code>Microsoft.AspNet.Server.Kestrel</code>? <code>ASP.NET Core</code> (formerly <code>ASP.NET vNext</code>) clearly has a Startup sequence, but no mention of shutdown sequence and how to handle clean closure.</p> | 35,257,670 | 5 | 0 | null | 2016-02-07 18:23:47.12 UTC | 7 | 2022-07-11 09:39:41.11 UTC | 2019-12-10 10:09:31.993 UTC | null | 9,020,340 | null | 237,315 | null | 1 | 44 | c#|asp.net-core | 22,145 | <p>In ASP.NET Core you can register to the cancellation tokens provided by <code>IApplicationLifetime</code></p>
<pre class="lang-cs prettyprint-override"><code>public class Startup
{
public void Configure(IApplicationBuilder app, IApplicationLifetime applicationLifetime)
{
applicationLifetime.Applica... |
18,139,710 | Using c++11 in MacOS X and compiled Boost libraries conundrum | <p>I am trying to compile a c++ project that uses c++11 standards extensively. Everything was going well with just -std=c++11, until I tried to use unordered_map and MacOS simply doesn't have the unordered_map header file anywhere in usr/include. </p>
<p>I did some research and found that using -stdlib=libc++ would fi... | 18,139,954 | 1 | 3 | null | 2013-08-09 03:39:05.007 UTC | 9 | 2019-08-12 05:14:00.843 UTC | 2013-11-21 19:44:18.853 UTC | null | 309,425 | null | 1,139,854 | null | 1 | 15 | c++|macos|boost|c++11 | 13,842 | <blockquote>
<p>edit: See comments below for modern MacOS; the --c++11 flag is no longer valid</p>
</blockquote>
<p>After a lot of research, I learned the following:</p>
<ul>
<li>Everything on MacOS X is built using stdlibc++ (including everything you install with homebrew -- which was my case)</li>
<li>stdlibc++ t... |
22,310,912 | Bootstrap row with columns of different height | <p>I currently have something like:</p>
<pre><code><div class="row">
<div class="col-md-4">Content</div>
<div class="col-md-4">Content</div>
<div class="col-md-4">Content</div>
<div class="col-md-4">Content</div>
<div class="col-md-4">Cont... | 22,311,212 | 3 | 0 | null | 2014-03-10 20:43:50.78 UTC | 56 | 2021-07-23 12:19:46.297 UTC | 2018-04-03 11:52:03.347 UTC | null | 171,456 | null | 3,379,926 | null | 1 | 105 | html|css|twitter-bootstrap|responsive-design|bootstrap-4 | 96,535 | <p>This is a popular Bootstrap question, so I've <strong>updated</strong> and expanded the answer for Bootstrap 3, Bootstrap 4 and Bootstrap 5...</p>
<p><strong>Bootstrap 5 (update 2021)</strong></p>
<p>Bootstrap columns still use flexbox, but the card-columns previously used to create a Masonry like layout <a href="ht... |
31,147,660 | ImportError: No module named 'selenium' | <p>I'm trying to write a script to check a website. It's the first time I'm using selenium. I'm trying to run the script on a OSX system. Although I checked in /Library/Python/2.7/site-packages and selenium-2.46.0-py2.7.egg is present, when I run the script it keeps telling me that there is no selenium module to import... | 31,149,093 | 21 | 0 | null | 2015-06-30 20:13:56.313 UTC | 15 | 2022-08-31 08:51:20.503 UTC | 2019-08-17 19:52:30.92 UTC | null | 1,839,439 | null | 5,066,924 | null | 1 | 78 | python|macos|selenium|module|webdriver | 404,347 | <p>If you have pip installed you can install selenium like so.</p>
<p><code>pip install selenium</code></p>
<p>or depending on your permissions:</p>
<p><code>sudo pip install selenium</code></p>
<p>For python3:</p>
<p><code>sudo pip3 install selenium</code></p>
<p>As you can see from this question <a href="https://stac... |
20,577,840 | python dictionary sorting in descending order based on values | <p>I want to sort this dictionary d based on value of sub key key3 in descending order. See below:</p>
<pre><code>d = { '123': { 'key1': 3, 'key2': 11, 'key3': 3 },
'124': { 'key1': 6, 'key2': 56, 'key3': 6 },
'125': { 'key1': 7, 'key2': 44, 'key3': 9 },
}
</code></pre>
<p>So final dictionary would lo... | 20,577,876 | 11 | 1 | null | 2013-12-13 23:38:24.52 UTC | 17 | 2022-09-08 09:38:25.993 UTC | 2013-12-13 23:39:59.7 UTC | null | 1,251,918 | null | 1,251,918 | null | 1 | 64 | python|dictionary | 206,949 | <p><a href="http://docs.python.org/3/library/stdtypes.html#dictionary-view-objects" rel="noreferrer">Dictionaries do not have any inherent order</a>. Or, rather, their inherent order is "arbitrary but not random", so it doesn't do you any good.</p>
<p>In different terms, your <code>d</code> and your <code>e</code> wou... |
32,229,170 | Catch all possible android exception globally and reload application | <p>I know the best way to prevent system crashes is catching all possible exception in different methods. So I use try catch blocks every where in my code. However as you know sometimes you forget to test some scenarios which cause some unhanded exceptions and a user gets "Unfortunately App stopped working..." message.... | 32,229,266 | 3 | 2 | null | 2015-08-26 14:16:54.287 UTC | 16 | 2019-03-27 15:57:41.573 UTC | 2018-12-17 14:46:16.95 UTC | null | 2,965,799 | null | 2,965,799 | null | 1 | 28 | android|error-handling|try-catch | 24,514 | <p>In your onCreate</p>
<pre><code>Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread paramThread, Throwable paramThrowable) {
//Catch your exception
// Without System.exit() this will ... |
15,669,091 | Bower install using only https? | <p>I am trying to set up Bower on a build server at our organization's data center, but <code>git</code>'s port does not appear to be open on the data center's firewall. I can use the git command line client to clone via <code>https://[repo]</code>, but not <code>git://[repo]</code>.</p>
<p>Is there a switch or prefe... | 15,684,898 | 3 | 1 | null | 2013-03-27 20:46:05.193 UTC | 172 | 2018-08-05 04:39:37.727 UTC | 2014-07-31 15:09:15.967 UTC | null | 991,458 | null | 182,654 | null | 1 | 258 | git|bower|git-clone | 70,960 | <p>You can make git replace the protocol for you. Just run:</p>
<pre><code>git config --global url."https://".insteadOf git://
</code></pre>
<p>to use HTTPS protocol instead of Git.</p> |
39,595,034 | Git: "Cannot 'squash' without a previous commit" error while rebase | <p>I have the following in the to-do text of <code>git rebase -i HEAD~2</code>:</p>
<pre><code>pick 56bcce7 Closes #2774
pick e43ceba Lint.py: Replace deprecated link
# Rebase 684f917..e43ceba onto 684f917 (2 command(s))
#
...
</code></pre>
<p>Now, when I try to squash the first one(<code>56bcce7</code>) and pick th... | 39,595,642 | 7 | 2 | null | 2016-09-20 13:09:47.197 UTC | 45 | 2020-02-26 06:05:28.983 UTC | 2018-04-13 02:27:13.487 UTC | null | 33,204 | null | 4,993,513 | null | 1 | 154 | git|rebase | 132,126 | <p>Interactive rebase presents commits in the reverse order of what you are used to when using <code>git log</code>. <code>git rebase -i</code> replays the selected commits in the exact (top-down) order they are listed in the saved rebase instructions file. When squashing, the commit selected for squashing is combined ... |
31,387,238 | C++ function returning function | <p>Where in the standard are functions returning functions disallowed? I understand they are conceptually ridiculous, but it seems to me that the grammar would allow them. According to this webpage, a "<a href="http://en.cppreference.com/w/cpp/language/function">noptr-declarator [is] any valid declarator</a>" which wou... | 31,387,510 | 7 | 14 | null | 2015-07-13 15:18:32.367 UTC | 11 | 2020-08-27 16:23:29.493 UTC | 2015-07-13 22:37:37.767 UTC | null | 2,549,876 | null | 2,549,876 | null | 1 | 35 | c++|c++11|standards|language-lawyer | 36,690 | <p>From [dcl.fct], pretty explicitly:</p>
<blockquote>
<p><strong>Functions shall not have a return type of type array or function</strong>, although they may have a return type of
type pointer or reference to such things. There shall be no arrays of functions, although there can be arrays
of pointers to functio... |
39,100,641 | Docker service start failed | <p>I have a CentOS 7.2 VM with Docker installed. Docker service and Docker container worked normally previously. But when I tried to pull a docker image, the VM was shutdown abruptly. After I restarted the VM, the Docker service could not be started:</p>
<pre><code>[root@AY13091717064020986bZ ~]# service docker start
... | 44,467,263 | 13 | 3 | null | 2016-08-23 12:02:57.06 UTC | 12 | 2022-06-09 13:28:35.717 UTC | 2018-08-03 02:55:04.547 UTC | null | 63,550 | null | 2,674,239 | null | 1 | 51 | docker|centos7 | 187,889 | <p>I had a similar issue. This was how I fixed it permanently:</p>
<ul>
<li>Delete everything in <code>/var/lib/docker</code>. This will delete existing container and images:</li>
</ul>
<pre><code>rm -rf /var/lib/docker
</code></pre>
<ul>
<li>Then configure your daemon to use the "overlay" storage driver. Set... |
19,845,950 | AngularJS How to dynamically add HTML and bind to controller | <p>I'm just getting started with angularJS and struggling to figure out proper architecture for what I'm trying to do. I have a single page app but <strong>the URL always should stay the same</strong>; I don't want the user to be able to navigate to any routes beyond the root. In my app, there is one main div that wi... | 19,846,600 | 5 | 1 | null | 2013-11-07 20:24:20.757 UTC | 19 | 2017-08-23 13:28:38.737 UTC | null | null | null | null | 152,517 | null | 1 | 58 | javascript|angularjs | 210,599 | <p>I would use the built-in <a href="http://docs.angularjs.org/api/ng.directive:ngInclude" rel="noreferrer"><code>ngInclude</code></a> directive. In the example below, you don't even need to write any javascript. The templates can just as easily live at a remote url.</p>
<p>Here's a working demo: <a href="http://plnkr... |
7,588,142 | MySQL Left Join + Min | <p>Seemingly simple MySQL question, but I've never had to do this before..</p>
<p>I have two tables, items and prices, with a one-to-many relationship. </p>
<pre><code>Items Table
id, name
Prices Table
id, item_id, price
</code></pre>
<p>Where</p>
<pre><code>prices.item_id = items.id
</code></pre>
<p>What I have ... | 7,588,442 | 4 | 1 | null | 2011-09-28 18:58:21.213 UTC | 8 | 2017-03-08 18:20:56.613 UTC | 2011-09-28 19:01:13.583 UTC | null | 73,226 | null | 616,946 | null | 1 | 22 | mysql|group-by|left-join|greatest-n-per-group|min | 39,569 | <p>This will return multiple records for a record in Items if there are multiple Prices records for it with the minimum price:</p>
<pre><code>select items.id, items.name, prices.price, prices.id
from items
left join prices on (
items.id = prices.item_id
and prices.price = (
select min(price)
f... |
7,239,996 | Android DownloadManager API - opening file after download? | <p>I am facing problem of opening downloaded file after successfull download via DownloadManager API. In my code:</p>
<pre><code>Uri uri=Uri.parse("http://www.nasa.gov/images/content/206402main_jsc2007e113280_hires.jpg");
Environment
.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)
.mkdirs(... | 7,240,108 | 4 | 0 | null | 2011-08-30 07:33:13.953 UTC | 18 | 2020-11-06 09:41:25.057 UTC | 2018-10-31 16:32:50.92 UTC | null | 973,919 | null | 513,956 | null | 1 | 37 | android|download-manager | 63,573 | <p>You need to register a reciever for when the download is complete:</p>
<pre><code>registerReceiver(onComplete, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
</code></pre>
<p>and a BroadcastReciever handler</p>
<pre><code>BroadcastReceiver onComplete=new BroadcastReceiver() {
public void onRecei... |
8,303,004 | Define TRACE Constant in .NET / Visual Studio | <p>In Visual Studio 2010, if you go to a project's properties and go to the Build Tab, there is a checkbox for "Define TRACE Constant." Which is the equivalent of doing a #define TRACE. </p>
<p>All of the methods of System.Diagnostics.Trace have a <code>[Conditional("TRACE")]</code> around them. </p>
<p>My question i... | 8,303,959 | 1 | 3 | null | 2011-11-28 22:04:09.077 UTC | 5 | 2014-05-04 15:38:06.37 UTC | null | null | null | null | 82,208 | null | 1 | 46 | visual-studio|performance|debugging | 27,085 | <p>Presumably this checkbox is equivalent to the <code>/define:TRACE</code> compiler option. You might want to turn this option off for a release build either because you don't want end users to see the trace output for some reason (e.g. security), or to improve performance. Of course, the performance increase will dep... |
8,241,821 | Proper use of the HsOpenSSL API to implement a TLS Server | <p>I'm trying to figure out how to properly use the <a href="http://hackage.haskell.org/packages/archive/HsOpenSSL/0.10.3.1/doc/html/OpenSSL-Session.html" rel="noreferrer">OpenSSL.Session</a> API in a concurrent context</p>
<p>E.g. assume I want to implement a <code>stunnel-style ssl-wrapper</code>, I'd expect to have... | 11,406,599 | 1 | 4 | null | 2011-11-23 12:00:49.63 UTC | 8 | 2012-07-13 20:55:50.91 UTC | 2012-07-13 20:55:50.91 UTC | null | 170,339 | null | 480,398 | null | 1 | 139 | haskell|openssl|ssl | 3,696 | <p>To do this you need to replace <code>copySocket</code> with two different functions, one to handle data from the plain socket to SSL and the other from SSL to the plain socket:</p>
<pre><code> copyIn :: SSL.SSL -> Socket -> IO ()
copyIn src dst = go
where
go = do
buf <- SSL.read src 4096
... |
2,141,799 | & or & what should be used for & (ampersand) if we are using UTF-8 in an XHTML document? | <p>What is the difference between <code>&amp;</code> and <code>&#38;</code> for & (ampersand)?</p>
<p>What should be used with UTF-8?</p> | 2,141,825 | 4 | 1 | null | 2010-01-26 18:55:13.03 UTC | 3 | 2021-11-10 03:02:36.047 UTC | 2021-11-10 02:58:26.647 UTC | null | 63,550 | null | 84,201 | null | 1 | 25 | html|xhtml|html-entities | 55,736 | <p>Both are <a href="http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.3" rel="noreferrer">character references</a> and refer to the same character (<em>AMPERSAND</em>, U+0026). <code>&amp;</code> is a named or entity character reference and <code>&#38;</code> is a numerical character reference.</p>
<p>In fa... |
1,785,615 | #region analogue for eclipse | <p>can somebody tell me, is there an analogue of a Visual Studio #region feature for Eclipse IDE ?<br>
I really need this magic! :)</p> | 1,785,647 | 4 | 1 | null | 2009-11-23 20:08:19.81 UTC | 4 | 2013-10-21 15:13:37.213 UTC | null | null | null | null | 189,017 | null | 1 | 33 | visual-studio|eclipse|ide|region | 17,814 | <p>User-defined regions for code folding can be added by using the <a href="http://code.google.com/p/coffee-bytes/" rel="noreferrer">Coffee-Bytes</a> plugin.</p> |
10,576,686 | C# regex pattern to extract urls from given string - not full html urls but bare links as well | <p>I need a regex which will do the following</p>
<pre><code>Extract all strings which starts with http://
Extract all strings which starts with www.
</code></pre>
<p>So i need to extract these 2.</p>
<p>For example there is this given string text below</p>
<pre><code>house home go www.monstermmorpg.com nice hospit... | 10,576,770 | 3 | 2 | null | 2012-05-14 01:45:30.68 UTC | 16 | 2021-09-13 15:43:45.203 UTC | null | null | null | null | 310,370 | null | 1 | 36 | c#|regex|url|hyperlink|extract | 49,470 | <p>You can write some pretty simple regular expressions to handle this, or go via more traditional string splitting + LINQ methodology.</p>
<h3>Regex</h3>
<pre><code>var linkParser = new Regex(@"\b(?:https?://|www\.)\S+\b", RegexOptions.Compiled | RegexOptions.IgnoreCase);
var rawString = "house home go www.monstermm... |
26,254,619 | Position of the legend in a Bokeh plot | <p>Does anyone know how to carry the legend in bokeh <strong>outside</strong> of the graph? The only manipulation I could do was to choose a position among:</p>
<pre><code>top_right, top_left, bottom_left or bottom_right
</code></pre>
<p>using:</p>
<pre><code>legend()[0].orientation = "bottom_left"
</code></pre>
<p... | 38,146,264 | 2 | 1 | null | 2014-10-08 10:25:58.617 UTC | 8 | 2021-06-02 20:40:06.317 UTC | 2015-04-13 12:29:00.45 UTC | null | 1,251,007 | null | 3,245,539 | null | 1 | 24 | python|visualization|bokeh | 29,323 | <p>As of Bokeh <code>0.12.4</code> it is possible to position legends outside the central plot area. Here is a short example <a href="https://docs.bokeh.org/en/latest/docs/user_guide/styling.html#outside-the-plot-area" rel="nofollow noreferrer">from the user's guide</a>:</p>
<pre><code>import numpy as np
from bokeh.m... |
7,202,453 | SVN Revert Trunk, remove a revision as if it never existed? | <p>Is it possible in the svn server to remove a revision as if it never existed?</p>
<p>So we have the following revisions:</p>
<pre><code>1004 // Commit of some bogus code that broke the build and was just wrong
1003 // Change 1.2
1002 // Change 1.1
1001
1000 *** Initial checkin
</code></pre>
<p>Can we we remove th... | 7,202,483 | 5 | 0 | null | 2011-08-26 09:11:31.09 UTC | 2 | 2016-10-18 19:25:22.84 UTC | 2011-08-30 09:24:59.89 UTC | null | 358,297 | null | 358,297 | null | 1 | 14 | svn|revision|revert|svn-trunk | 40,427 | <p>VCS systems are designed specifically to make this as complicated as possible. You usually do not want to do this.</p>
<p>That being said, from the official documentation:</p>
<blockquote>
<p>There are special cases where you might want to destroy all evidence of a file or commit. (Perhaps somebody accidentally comm... |
7,519,423 | jQuery - How to get attribute of an element when using the 'click' event | <p>I'm using jQuery to get a click on an 'a' element. I have a list of those links where each one has a class which by him I'm capturing the click.</p>
<p>I would like to know which of the links has been clicked (I have an attribute 'setid' for each link) and also get the point where the mouse has been clicked.</p>
<... | 7,519,435 | 5 | 2 | null | 2011-09-22 18:09:41.153 UTC | 7 | 2015-08-09 08:16:37.093 UTC | null | null | null | null | 239,279 | null | 1 | 28 | javascript|jquery | 69,615 | <p>To use jQuery methods you have to wrap <strong>this</strong> with a call to jQuery. </p>
<pre><code>$('.newItem').click(function () {
alert($(this).attr('setid'));
});
</code></pre> |
7,670,280 | Tree plotting in Python | <p>I want to plot trees using Python. Decision trees, Organizational charts, etc. Any library that helps me with that?</p> | 7,673,423 | 6 | 0 | null | 2011-10-06 04:22:51.473 UTC | 32 | 2021-09-02 15:25:53.75 UTC | 2021-03-13 12:54:24.883 UTC | null | 2,956,066 | null | 405,126 | null | 1 | 69 | python|plot|tree|data-visualization|visualization | 131,743 | <p>There's graphviz - <a href="http://www.graphviz.org/" rel="noreferrer">http://www.graphviz.org/</a>. It uses the "DOT" language to plot graphs. You can either generate the DOT code yourself, or use pydot - <a href="https://github.com/pydot/pydot" rel="noreferrer">https://github.com/pydot/pydot</a>. You cou... |
7,605,785 | splitting a string based on multiple char delimiters | <p>I have a string "4,6,8\n9,4"</p>
<p>I want to split this based on ,and \n</p>
<p>Output array should be </p>
<pre><code>4
6
8
9
4
</code></pre>
<p><strong>Edit :</strong></p>
<p>Now i am reading string from console , when i enter a string as above in console , in the code behind i get as <code>"4,6,8\\n9,4"</co... | 7,605,801 | 6 | 0 | null | 2011-09-30 03:58:10.043 UTC | 7 | 2022-04-01 09:16:05.413 UTC | 2011-09-30 04:16:09.34 UTC | null | 769,091 | null | 769,091 | null | 1 | 81 | c#|.net|string|split | 112,475 | <p>Use <a href="http://msdn.microsoft.com/en-us/library/b873y76a.aspx" rel="noreferrer">string.Split(char [])</a></p>
<pre><code>string strings = "4,6,8\n9,4";
string [] split = strings .Split(new Char [] {',' , '\n' });
</code></pre>
<p><strong>EDIT</strong></p>
<p>Try following if you get any unnecessary empty ite... |
7,138,119 | Saving facebook id as int or varchar? | <p>My question is more advisory than technical.
I'm writing a Facebook app in which I am fetching some information about the user, including facebook_id.<br>
I was wondering if I should keep the user id as INT or VARCHAR in the MySQL database?</p> | 7,138,309 | 7 | 1 | null | 2011-08-21 12:02:00.517 UTC | 6 | 2015-03-16 07:31:18.11 UTC | 2011-08-21 12:49:49.58 UTC | null | 762,449 | null | 536,912 | null | 1 | 37 | mysql|facebook|facebook-graph-api | 32,838 | <p>Facebook uses <strong>64-bit integers (bigint)</strong> for their user ids. So you use Bigint UNSIGNED in MySQL.</p>
<p><a href="https://developers.facebook.com/blog/post/226" rel="noreferrer">"As a reminder, in the very near future, we will be rolling out 64 bit user IDs. We encourage you to test your applications... |
7,369,945 | Algorithm for maze generation with no dead ends? | <p>I'm looking for a maze generation algorithm that can generate mazes with no dead ends but only a start and end. Like this: </p>
<p><img src="https://i.stack.imgur.com/izywL.gif" alt="maze"></p>
<p><sub>Image from <a href="http://www.astrolog.org/labyrnth/maze/unicursl.gif" rel="noreferrer">http://www.astrolog.org/... | 7,370,232 | 8 | 6 | null | 2011-09-10 05:57:43.373 UTC | 12 | 2020-09-13 01:40:39.03 UTC | 2013-12-18 23:23:29.43 UTC | null | 321,731 | null | 912,387 | null | 1 | 35 | algorithm|maze | 11,925 | <p>It sounds like you want a pseudo-random space filling curve (for example, see <em><a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.35.3648&rep=rep1&type=pdf">Context-based Space Filling Curves -EUROGRAPHICS ’2000</a></em> (PDF format, 1.1 MB))</p>
<p>Take a look a <em><a href="http://e... |
13,877,405 | What is wrong on this Decimal.TryParse? | <p>Code :</p>
<pre><code>Decimal kilometro = Decimal.TryParse(myRow[0].ToString(), out decimal 0);
</code></pre>
<p>some arguments are not valid?</p> | 13,877,421 | 4 | 0 | null | 2012-12-14 11:04:28.503 UTC | 1 | 2019-11-07 14:29:43.353 UTC | null | null | null | null | 365,251 | null | 1 | 8 | c#|tryparse | 57,956 | <p><code>out decimal 0</code> is not a valid parameter - <code>0</code> is not a valid variable name.</p>
<pre><code>decimal output;
kilometro = decimal.TryParse(myRow[0].ToString(), out output);
</code></pre>
<p>By the way, the return value will be a <code>bool</code> - from the name of the variable, your code shou... |
13,925,724 | providedCompile without war plugin | <p>I want to reuse certain filter for many projects so I want to extract it and use a single jar to just add it to any Web App.</p>
<p>For building I am using Gradle 1.3 and the following <code>build.gradle</code> file:</p>
<pre><code>apply plugin: 'java'
dependencies {
compile group:'org.slf4j', name:'slf4j-ap... | 13,932,897 | 7 | 1 | null | 2012-12-18 03:15:22.423 UTC | 17 | 2016-10-27 13:55:39.687 UTC | null | null | null | null | 1,391,333 | null | 1 | 40 | gradle | 34,315 | <p>There is no such configuration out of the box for the <code>java</code> plugin. However you can build it yourself as follows:</p>
<pre><code>configurations { providedCompile }
dependencies {
providedCompile "javax.servlet:javax.servlet-api:3.+"
}
sourceSets.main.compileClasspath += configurations.providedComp... |
14,099,770 | Casperjs/PhantomJs vs Selenium | <p>We are using Selenium to automate our <code>UI</code> testing. Recently we have seen majority of our users using Chrome. So we wanted to know - pros and cons of using PhantomJS vs Selenium:</p>
<ul>
<li>Is there any real advantage in terms of performance, e.g. time taken to execute the test cases?</li>
<li>When sho... | 14,100,481 | 5 | 0 | null | 2012-12-31 09:24:41.433 UTC | 62 | 2019-03-12 10:38:40.113 UTC | 2017-03-22 11:46:29.49 UTC | null | 4,823,977 | null | 1,315,682 | null | 1 | 152 | google-chrome|user-interface|selenium|automation|phantomjs | 63,679 | <p>They are attacking different problems. Since PhantomJS runs perfectly on the command-line, it is suitable as the first layer of smoke testing, whether as part of development workflow and/or in a continuous integration server. Selenium targets multiple browsers and hence it is very useful to ensure cross-browser cons... |
19,812,988 | How to get a list of the grouped values in linq groupby? | <p>Linq newbie here, struggling with my first group by query.</p>
<p>I have a list of objects of type KeywordInstance which represent a keyword, and the ID of the database record to which the keyword was applied. </p>
<pre><code>Keyword RecordID
macrophages 1
macrophages 2
cell cycle 3
map kinase 2
cell c... | 19,813,346 | 1 | 3 | null | 2013-11-06 13:10:57.803 UTC | 6 | 2013-11-06 13:27:29.493 UTC | null | null | null | null | 1,983,448 | null | 1 | 21 | linq|group-by | 41,525 | <p>I think you are close to you solution.</p>
<pre><code>var keywords = allWords
.GroupBy(w => w.keyword)
.Select(g => new
{
keyword = g.Key,
RecordIDs = g.Select(c => c.ID)
});
</code></pre>
<p>Just <code>Select</code> the records you need.<br/>
T... |
24,651,489 | Asynctask vs Thread vs Services vs Loader | <p>I got slightly confused about the differences between <code>Asynctask</code>, <code>Thread</code>, <code>Service</code>, <code>Loader</code> in Android. </p>
<p>I know how it works. But i still don't understand what and when should i use.</p>
<p>I work with Android for 3 years, and generally still use <code>Async... | 24,652,931 | 6 | 2 | null | 2014-07-09 10:40:08.133 UTC | 17 | 2018-08-17 07:01:51.883 UTC | 2017-09-13 10:51:52.873 UTC | null | 4,999,394 | null | 1,991,579 | null | 1 | 32 | android|multithreading|android-asynctask|android-service | 18,347 | <p>AysncTasks are not 'outdated' as much as they are <strong>incomplete</strong>.
Among other things async tasks do not bother if their parent activity is currently running or not. For the same reason why you include checks for verify the context to be null or not. Besides, unless you are using your own Thread Pool Exe... |
24,838,629 | round off float to nearest 0.5 in python | <p>I'm trying to round off floating digits to the nearest 0.5</p>
<p>For eg.</p>
<pre><code>1.3 -> 1.5
2.6 -> 2.5
3.0 -> 3.0
4.1 -> 4.0
</code></pre>
<p>This is what I'm doing</p>
<pre><code>def round_of_rating(number):
return round((number * 2) / 2)
</code></pre>
<p>This rounds of numbers to c... | 24,838,652 | 1 | 2 | null | 2014-07-19 09:02:04.677 UTC | 5 | 2021-09-17 07:44:45.883 UTC | 2014-07-19 09:38:04.237 UTC | null | 20,670 | null | 3,136,225 | null | 1 | 59 | python | 65,247 | <p>Try to change the parenthesis position so that the rounding happens before the division by 2</p>
<pre><code>def round_off_rating(number):
"""Round a number to the closest half integer.
>>> round_off_rating(1.3)
1.5
>>> round_off_rating(2.6)
2.5
>>> ro... |
490,439 | django-cart or Satchmo? | <p>I'm looking to implement a very basic shopping cart. <a href="http://www.satchmoproject.com/" rel="nofollow noreferrer">Satchmo</a> seems to install a <strong>lot</strong> of applications and extra stuff that I don't need. I've heard others mention <a href="http://code.google.com/p/django-cart/" rel="nofollow nore... | 490,534 | 6 | 0 | null | 2009-01-29 04:00:49.027 UTC | 13 | 2013-06-11 09:52:09 UTC | 2013-06-11 09:52:09 UTC | null | 70,211 | Ryan Duffield | 2,696 | null | 1 | 23 | python|django|e-commerce|satchmo | 12,849 | <p>Well if you want to use django-cart you should view it as a starting point for developing your own. The last commit (r4) for the project was November 2006.</p>
<p>By comparison, the last commit (r1922) to Satchmo was a couple of hours ago.</p>
<p>With Satchmo you get code that is under active development and actu... |
632,475 | Regex to pick characters outside of pair of quotes | <p>I would like to find a regex that will pick out all commas that fall outside quote sets. </p>
<p>For example:</p>
<pre><code>'foo' => 'bar',
'foofoo' => 'bar,bar'
</code></pre>
<p>This would pick out the single comma on line 1, after <code>'bar',</code></p>
<p>I don't really care about single vs double quo... | 632,552 | 6 | 2 | null | 2009-03-10 22:09:41.397 UTC | 28 | 2020-05-31 19:34:37.41 UTC | 2020-05-31 19:34:37.41 UTC | null | 792,066 | SocialCensus | 26,001 | null | 1 | 42 | regex | 34,369 | <p>This will match any string up to and including the first non-quoted ",". Is that what you are wanting?</p>
<pre><code>/^([^"]|"[^"]*")*?(,)/
</code></pre>
<p>If you want all of them (and as a counter-example to the guy who said it wasn't possible) you could write:</p>
<pre><code>/(,)(?=(?:[^"]|"[^"]*")*$)/
</cod... |
785,226 | Practical use of `stackalloc` keyword | <p>Has anyone ever actually used <code>stackalloc</code> while programming in C#? I am aware of what is does, but the only time it shows up in my code is by accident, because Intellisense suggests it when I start typing <code>static</code>, for example.</p>
<p>Although it is not related to the usage scenarios of <code... | 785,264 | 6 | 1 | null | 2009-04-24 09:51:30.78 UTC | 36 | 2022-03-25 15:04:07.067 UTC | 2010-08-16 15:40:26.117 UTC | null | 1,288 | null | 69,809 | null | 1 | 176 | c#|keyword|stackalloc | 37,672 | <p>The sole reason to use <code>stackalloc</code> is performance (either for computations or interop). By using <code>stackalloc</code> instead of a heap allocated array, you create less GC pressure (the GC needs to run less), you don't need to pin the arrays down, it's faster to allocate than a heap array, an it is au... |
35,471,894 | Can I run Jupyter notebook cells in commandline? | <p>I am deploying a Python package, and I would like to run a simple test to see if all cells in my notebook will run without errors. I would like to test this via commandline as I have issues running a notebook in <code>virtualenv</code>. Is there are simple command-line way to test this?</p>
<hr>
<p>Note to the m... | 35,472,438 | 4 | 3 | null | 2016-02-18 02:49:21.697 UTC | 19 | 2022-09-21 07:00:36.85 UTC | 2017-12-12 17:28:41.3 UTC | null | 4,531,270 | null | 4,531,270 | null | 1 | 73 | python|command-line|ipython|jupyter | 61,711 | <p>You can use <a href="https://github.com/paulgb/runipy" rel="noreferrer">runipy</a> to do this.</p>
<p><code>runipy</code> will run all cells in a notebook. If an error occurs, the process will stop.</p>
<blockquote>
<p><code>$ pip install runipy</code></p>
<p><code>$ runipy MyNotebook.ipynb</code></p>
</blockquote>... |
21,317,384 | How to concatenate two dataframes without duplicates? | <p>I'd like to concatenate two dataframes <code>A</code>, <code>B</code> to a new one without duplicate rows (if rows in <code>B</code> already exist in <code>A</code>, don't add):</p>
<p>Dataframe <code>A</code>:</p>
<pre><code> I II
0 1 2
1 3 1
</code></pre>
<p>Dataframe <code>B</code>:</p>
<p... | 21,317,570 | 3 | 5 | null | 2014-01-23 19:16:45.653 UTC | 29 | 2022-05-09 15:19:39.837 UTC | 2022-05-09 15:19:39.837 UTC | null | 18,145,256 | null | 2,961,929 | null | 1 | 95 | python|pandas|duplicates | 143,580 | <p>The simplest way is to just do the concatenation, and then drop duplicates.</p>
<pre><code>>>> df1
A B
0 1 2
1 3 1
>>> df2
A B
0 5 6
1 3 1
>>> pandas.concat([df1,df2]).drop_duplicates().reset_index(drop=True)
A B
0 1 2
1 3 1
2 5 6
</code></pre>
<p>The <code>rese... |
46,684,972 | Jenkins throws java.lang.IllegalArgumentException: Invalid refspec refs/heads/** Error | <p>I am trying to activate a pipeline on any merge request change. This works as long as my pipeline script is in <code>Jenkins UI</code>. Now I outsourced my script on <code>GitLab</code>, and the checkout should happen via the pipeline via scm option.</p>
<p>But all I get on build (yes, it triggers) is:</p>
<blockq... | 58,348,530 | 1 | 4 | null | 2017-10-11 09:45:35.417 UTC | 1 | 2019-10-11 21:14:33.893 UTC | 2017-11-22 23:35:54.487 UTC | null | 2,777,965 | null | 8,439,926 | null | 1 | 36 | jenkins|jenkins-pipeline | 13,169 | <p>Most likely this is a Jenkins bug. <a href="https://issues.jenkins-ci.org/browse/JENKINS-46588" rel="noreferrer">https://issues.jenkins-ci.org/browse/JENKINS-46588</a>
There seems to a solution anyway:</p>
<p>In your project configuration under Pipeline -> SCM -> Branches to build -> "Branch Specifier (blank for 'a... |
46,706,433 | Firebase Firestore get data from collection | <p>I want to get data from my Firebase Firestore database. I have a collection called user and every user has collection of some objects of the same type (My Java custom object). I want to fill my ArrayList with these objects when my Activity is created. </p>
<pre><code>private static ArrayList<Type> mArrayList ... | 46,714,740 | 5 | 6 | null | 2017-10-12 09:47:03.13 UTC | 4 | 2020-10-01 03:07:39.247 UTC | 2017-10-14 03:12:33.55 UTC | null | 209,103 | null | 1,830,590 | null | 1 | 14 | java|android|arraylist|google-cloud-firestore | 99,535 | <p>The <code>get()</code> operation returns a <code>Task<></code> which means it is an <strong>asynchronous operation</strong>. Calling <code>getListItems()</code> only starts the operation, it does not wait for it to complete, that's why you have to add success and failure listeners.</p>
<p>Although there's no... |
33,383,840 | Is there a JavaScript equivalent of the Python pass statement that does nothing? | <p>I am looking for a JavaScript equivalent of the Python:</p>
<p><code>pass</code> statement that does not run the function of the <code>...</code> notation?</p>
<p><strong>Is there such a thing in JavaScript?</strong></p> | 33,383,865 | 10 | 4 | null | 2015-10-28 05:53:58.833 UTC | 10 | 2021-09-27 20:57:50.753 UTC | 2020-12-09 08:40:20.427 UTC | null | 13,903,942 | null | 1,709,088 | null | 1 | 144 | javascript|python|function|lexical | 116,744 | <p>Python's <code>pass</code> mainly exists because in Python whitespace matters within a block. In Javascript, the equivalent would be putting nothing within the block, i.e. <code>{}</code>.</p> |
1,670,138 | PHP IF statement for Boolean values: $var === true vs $var | <p>I know this question is not really important.. however I've been wondering:</p>
<p>Which of the following IF statements is the best and fastest to use?</p>
<pre><code><?php
$variable = true;
if($variable === true)
{
//Something
}
if($variable)
{
// Something
}
?>
</code></pre>
<p>I know === is ... | 1,670,150 | 5 | 2 | null | 2009-11-03 21:07:29.81 UTC | 4 | 2012-01-11 15:55:03.893 UTC | null | null | null | null | 140,901 | null | 1 | 32 | php|coding-style|paradigms | 107,864 | <p>Using <code>if ($var === true)</code> or <code>if ($var)</code> is not a question of style but a question of correctness. Because <code>if ($var)</code> is the same as <code>if ($var == true)</code>. And <code>==</code> comparison doesn’t check the type. So <code>1 == true</code> is true but <code>1 === true</code> ... |
2,231,163 | what tomcat native library should I be using in production? | <p>When I compile my spring mvc app, I get this in the output:</p>
<pre><code>INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.6.0_17\bin;......
</code></pre>
<p>What exactly should I use in ... | 2,231,186 | 6 | 0 | null | 2010-02-09 17:45:05.34 UTC | 7 | 2018-05-09 10:59:57.5 UTC | null | null | null | null | 39,677 | null | 1 | 20 | java|spring|spring-mvc | 49,631 | <p><a href="http://tomcat.apache.org/native-doc/" rel="noreferrer">Tomcat-native</a> is a version of Tomcat that uses the highly optimized Apache Portable Runtime (APR), the same framework that powers the Apache HTTP server.</p> |
1,636,194 | Flexible CountDownLatch? | <p>I have encountered a problem twice now whereby a producer thread produces N work items, submits them to an <code>ExecutorService</code> and then needs to wait until all N items have been processed.</p>
<p><strong>Caveats</strong></p>
<ul>
<li><strong>N is not known in advance</strong>. If it were I would simply c... | 1,637,030 | 6 | 3 | null | 2009-10-28 09:52:16.573 UTC | 12 | 2018-08-08 11:58:33.987 UTC | 2017-05-18 16:35:37.943 UTC | null | 4,999,394 | null | 127,479 | null | 1 | 28 | java|multithreading|concurrency|countdownlatch|phaser | 9,461 | <p><a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Phaser.html" rel="noreferrer"><code>java.util.concurrent.Phaser</code></a> looks like it would work well for you. It is planned to be release in Java 7 but the most stable version can be found at <a href="http://gee.cs.oswego.edu/dl/concurrency... |
2,321,829 | Android AsyncTask testing with Android Test Framework | <p>I have a very simple AsyncTask implementation example and am having problem in testing it using Android JUnit framework. </p>
<p>It works just fine when I instantiate and execute it in normal application.
However when it's executed from any of Android Testing framework classes (i.e. <strong><em>AndroidTestCase</em... | 3,802,487 | 8 | 0 | null | 2010-02-23 21:22:39.067 UTC | 56 | 2022-03-15 20:04:24.883 UTC | 2018-01-15 07:54:53.327 UTC | null | 3,058,050 | null | 209,310 | null | 1 | 99 | android|junit | 61,441 | <p>I met a similar problem while implementing some unit-test. I had to test some service which worked with Executors, and I needed to have my service callbacks sync-ed with the test methods from my ApplicationTestCase classes. Usually the test method itself finished before the callback would be accessed, so the data se... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.