id
int64
4
73.8M
title
stringlengths
10
150
body
stringlengths
17
50.8k
accepted_answer_id
int64
7
73.8M
answer_count
int64
1
182
comment_count
int64
0
89
community_owned_date
stringlengths
23
27
creation_date
stringlengths
23
27
favorite_count
int64
0
11.6k
last_activity_date
stringlengths
23
27
last_edit_date
stringlengths
23
27
last_editor_display_name
stringlengths
2
29
last_editor_user_id
int64
-1
20M
owner_display_name
stringlengths
1
29
owner_user_id
int64
1
20M
parent_id
null
post_type_id
int64
1
1
score
int64
-146
26.6k
tags
stringlengths
1
125
view_count
int64
122
11.6M
answer_body
stringlengths
19
51k
4,825,907
Convert Int to Guid
<p>I have to convert Convert Int32 into Guids and this is what I came up with.</p> <pre><code>public static class IntExtensions { public static Guid ToGuid(this Int32 value) { if (value &gt;= 0) // if value is positive return new Guid(string.Format("00000000-0000-0000-0000-00{0:0000000000}"...
4,826,200
5
7
null
2011-01-28 07:34:56.39 UTC
11
2020-06-12 15:01:19.263 UTC
2017-01-20 12:16:44.833 UTC
null
996,815
null
213,722
null
1
55
c#
58,694
<p>Here is a simple way to do it:</p> <pre><code>public static Guid ToGuid(int value) { byte[] bytes = new byte[16]; BitConverter.GetBytes(value).CopyTo(bytes, 0); return new Guid(bytes); } </code></pre> <p>You can change where the copy will happen (vary the index from 0 to 12). It really depends on how y...
4,349,075
BitmapFactory.decodeResource returns a mutable Bitmap in Android 2.2 and an immutable Bitmap in Android 1.6
<p>I am developing an application and testing it on my device running Android 2.2. In my code, I make use of a Bitmap that I retrieve using BitmapFactory.decodeResource, and I am able to make changes by calling <code>bitmap.setPixels()</code> on it. When I test this on a friend's device running Android 1.6, I get an ...
9,194,259
7
0
null
2010-12-03 19:19:39.867 UTC
26
2021-05-21 10:39:33.69 UTC
2013-05-01 08:29:43.073 UTC
null
1,618,135
null
53,501
null
1
43
java|android|bitmap
59,219
<p>You can convert your immutable bitmap to a mutable bitmap.</p> <p>I found an acceptable solution that uses only the memory of one bitmap. </p> <p>A source bitmap is raw saved (RandomAccessFile) on disk (no ram memory), then source bitmap is released, (now, there's no bitmap at memory), and after that, the file inf...
4,371,724
Having to restart tomcat whenever you make a change
<p>Is there a way around having to restart tomcat every time a small change is made in java code?</p>
4,371,821
8
1
null
2010-12-06 22:49:11.433 UTC
14
2016-05-06 05:56:02.267 UTC
2010-12-07 00:57:04.29 UTC
null
495,341
null
495,341
null
1
25
java|tomcat
29,720
<p>Set <code>reloadable</code> attribute of <a href="http://tomcat.apache.org/tomcat-6.0-doc/config/context.html" rel="noreferrer"><code>&lt;Context&gt;</code></a> element in <code>context.xml</code> to <code>true</code>.</p> <pre><code>&lt;Context reloadable="true"&gt; </code></pre> <p>Then Tomcat will monitor chang...
4,156,055
static linking only some libraries
<p>How can I statically link only a some specific libraries to my binary when linking with GCC?</p> <p><code>gcc ... -static ...</code> tries to statically link <strong>all</strong> the linked libraries, but I haven't got the static version of some of them (eg: libX11).</p>
4,156,190
8
1
null
2010-11-11 15:28:47.363 UTC
57
2018-02-26 16:53:03.087 UTC
2018-02-26 16:53:03.087 UTC
null
13,860
null
300,805
null
1
126
gcc|linker|static-libraries
166,342
<p><code>gcc -lsome_dynamic_lib code.c some_static_lib.a</code></p>
4,137,824
How to elegantly rename all keys in a hash in Ruby?
<p>I have a Ruby hash:</p> <pre><code>ages = { "Bruce" =&gt; 32, "Clark" =&gt; 28 } </code></pre> <p>Assuming I have another hash of replacement names, is there an elegant way to rename all the keys so that I end up with:</p> <pre><code>ages = { "Bruce Wayne" =&gt; 32, "Clark Kent" =&gt; 28 ...
4,137,966
11
0
null
2010-11-09 19:48:32.813 UTC
46
2021-06-25 20:05:19.05 UTC
2016-03-28 23:08:17.447 UTC
null
128,421
null
497,469
null
1
101
ruby|hash|key
59,850
<pre><code>ages = { 'Bruce' =&gt; 32, 'Clark' =&gt; 28 } mappings = { 'Bruce' =&gt; 'Bruce Wayne', 'Clark' =&gt; 'Clark Kent' } ages.transform_keys(&amp;mappings.method(:[])) #=&gt; { 'Bruce Wayne' =&gt; 32, 'Clark Kent' =&gt; 28 } </code></pre>
4,418,708
What's the rationale for null terminated strings?
<p>As much as I love C and C++, I can't help but scratch my head at the choice of null terminated strings:</p> <ul> <li>Length prefixed (i.e. Pascal) strings existed before C</li> <li>Length prefixed strings make several algorithms faster by allowing constant time length lookup.</li> <li>Length prefixed strings make i...
4,418,774
20
43
null
2010-12-11 20:13:28.317 UTC
101
2021-12-28 03:41:57.023 UTC
2017-03-21 19:44:47.827 UTC
null
7,392,286
null
82,320
null
1
302
c++|c|string|null-terminated
30,475
<p>From the <a href="https://www.bell-labs.com/usr/dmr/www/chist.html" rel="noreferrer">horse's mouth</a> </p> <blockquote> <p>None of BCPL, B, or C supports character data strongly in the language; each treats strings much like vectors of integers and supplements general rules by a few conventions. In b...
14,473,488
Is String a primitive or an Object in Android or Java?
<p>In the Android API <a href="http://developer.android.com/guide/topics/data/data-storage.html#pref" rel="noreferrer">http://developer.android.com/guide/topics/data/data-storage.html#pref</a> </p> <p>It says:</p> <blockquote> <p>Shared Preference allows you to save and retrieve persistent key-value pairs of prim...
14,473,567
6
6
null
2013-01-23 06:08:57.097 UTC
6
2018-10-11 08:22:55.947 UTC
2015-02-09 15:43:44.553 UTC
null
445,131
null
804,486
null
1
21
java|android|string|sharedpreferences|primitive
45,585
<p>As far as <code>Java</code> programming language is considered,</p> <blockquote> <p>A primitive type is predefined by the language and is named by a reserved keyword.</p> <p>In addition to the eight primitive data types listed above, the Java programming language also provides special support for character strings v...
14,654,998
How do I fix the error "Only one usage of each socket address (protocol/network address/port) is normally permitted"?
<p>I've done a lot of googling but not had much luck with my issues. I am new to network programming and trying to learn, I've attempted to set up a simple server &amp; client that communicate (following an online tutorial located here -> <a href="http://tech.pro/tutorial/704/csharp-tutorial-simple-threaded-tcp-server"...
14,655,041
3
1
null
2013-02-01 21:03:00.907 UTC
7
2018-07-16 03:25:24.277 UTC
2017-05-30 09:40:58.69 UTC
null
133
null
1,319,751
null
1
43
c#|exception|networking|tcplistener
114,115
<p><code>ListenForClients</code> is getting invoked twice (on two different threads) - once from the constructor, once from the explicit method call in <code>Main</code>. When two instances of the <code>TcpListener</code> try to listen on the same port, you get that error.</p>
14,778,364
Select All checkboxes using jQuery
<p>I have the following html code:</p> <pre><code> &lt;input type="checkbox" id="ckbCheckAll" /&gt; &lt;p id="checkBoxes"&gt; &lt;input type="checkbox" class="checkBoxClass" id="Checkbox1" /&gt; &lt;br /&gt; &lt;input type="checkbox" class="checkBoxClass" id="Checkbox2" /&gt; &lt...
14,778,444
16
1
null
2013-02-08 17:47:15.41 UTC
8
2021-02-07 13:17:26.587 UTC
2018-01-10 16:35:37.497 UTC
null
55,075
null
953,975
null
1
50
javascript|jquery
141,282
<p>Use prop</p> <pre><code>$(".checkBoxClass").prop('checked', true); </code></pre> <p>or to uncheck:</p> <pre><code>$(".checkBoxClass").prop('checked', false); </code></pre> <p><a href="http://jsfiddle.net/sVQwA/">http://jsfiddle.net/sVQwA/</a></p> <pre><code>$("#ckbCheckAll").click(function () { $(".checkBox...
14,882,642
Scala: Why mapValues produces a view and is there any stable alternatives?
<p>Just now I am surprised to learn that <code>mapValues</code> produces a view. The consequence is shown in the following example:</p> <pre><code>case class thing(id: Int) val rand = new java.util.Random val distribution = Map(thing(0) -&gt; 0.5, thing(1) -&gt; 0.5) val perturbed = distribution mapValues { _ + 0.1 * ...
14,883,167
3
6
null
2013-02-14 19:34:03.383 UTC
8
2019-11-11 15:45:25.567 UTC
null
null
null
null
1,830,538
null
1
63
scala|map
9,378
<p>There's a ticket about this, <a href="https://issues.scala-lang.org/browse/SI-4776" rel="noreferrer">SI-4776</a> (by YT).</p> <p>The commit that introduces it has this to say:</p> <blockquote> <p>Following a suggestion of jrudolph, made <code>filterKeys</code> and <code>mapValues</code> transform abstract maps...
23,896,690
Securing OAuth clientId/clientSecret in AngularJS application
<p>I know this is probably an age-old question, but...are there any best practices for securing client secrets for performing OAuth2 authentication in AngularJS applications? I've been racking my brain trying to think of a solution to providing truly secure access to an API from modern style web applications (they need...
24,621,760
2
0
null
2014-05-27 18:40:54.14 UTC
8
2016-03-14 08:10:14.117 UTC
null
null
null
null
111,554
null
1
15
angularjs|security|oauth|token|secret-key
12,918
<p>Remember that <em><strong>OAuth</strong></em> is less about protecting against impersonation and more about protecting credentials. 3rd parties authenticated a user's identity for you without exposing the user's credentials. Since Tokens are not credentials, the amount of harm a hacker can do and his window to act a...
45,655,019
How do I add SSL with Firebase Hosting?
<p>I uploaded my angular 4 project to Firebase Hosting and it works well on Firebase's domain. However, when I connect it to my custom domain it should use SSL but as you can see on the image below, SSL is not active.</p> <p><a href="https://i.stack.imgur.com/bPZs9.png" rel="noreferrer"><img src="https://i.stack.imgur....
45,656,420
1
0
null
2017-08-12 21:17:20.37 UTC
5
2020-09-17 16:17:19.42 UTC
2020-09-17 16:17:19.42 UTC
null
10,871,073
null
8,310,147
null
1
30
firebase|firebase-hosting
21,842
<p>Firebase Hosting will only serve traffic over SSL. However it may take a bit of time before your custom domain propagates. During this time, you'll see the "not secure" warning and may even see a different domain name when you click it.</p> <p>If the problem persists and you're not able/willing to share the domain ...
3,000,653
Using NLog as a rollover file logger
<p>How - if possible - can I use NLog as a rollover file logger? as if:</p> <p>I want to have at most 31 files for 31 days and when a new day started, if there is an old day log file ##.log, then it should be deleted but during that day all logs are appended and will be there at least for 27 days.</p>
17,743,051
2
0
null
2010-06-08 19:39:11.22 UTC
13
2016-11-26 01:14:19.123 UTC
null
null
null
null
54,467
null
1
24
c#|.net|nlog
32,401
<p>Finally I have settled with <a href="https://github.com/nlog/NLog/wiki/File-target#size-based-file-archival" rel="noreferrer">size-based file archival</a>. I use a trick to name the file after just the day of month and I needed the size-based file archival because it really helps when you logs begin to grow beyond s...
2,645,293
Automapper failing to map on IEnumerable
<p>I have two classes like so:</p> <pre><code>public class SentEmailAttachment : ISentEmailAttachment { public SentEmailAttachment(); public string FileName { get; set; } public string ID { get; set; } public string SentEmailID { get; set; } public string StorageService { get; set; } public st...
2,646,570
2
0
null
2010-04-15 12:47:21.94 UTC
7
2015-11-18 15:29:48.077 UTC
2011-11-09 23:38:17.547 UTC
null
221,708
null
131,809
null
1
55
c#|automapper
45,809
<p>You do not need to explicitly map collection types, only the item types. Just do:</p> <pre><code>Mapper.CreateMap&lt;SentEmailAttachment, SentEmailAttachmentItem&gt;(); var attachments = Mapper.Map&lt;IEnumerable&lt;SentEmailAttachment&gt;, List&lt;SentEmailAttachmentItem&gt;&gt;(someList); </code></pre> <p>That ...
48,686,826
React js - What is the difference betwen HOC and decorator
<p>Can someone explain what is the difference between these two? I mean except the syntactic difference, do both of these techniques are used to achieve the same thing (which is to reuse component logic)?</p>
48,688,778
3
1
null
2018-02-08 13:38:05.257 UTC
5
2021-10-16 18:47:40.987 UTC
null
null
null
null
5,108,111
null
1
33
reactjs|python-decorators|higher-order-components
13,605
<p>For all practical reasons, decorators and HOC (Higher-Order-Component aka Wrapper) do the same thing.</p> <p>One major difference is that, once you add a decorator, the property/class can only be used in it's decorated form. HOC pattern leaves higher order as well as the lower order components available for use.</p>...
1,360,579
Post Publish Events
<p>For normal (say Windows Forms) C# applications, to execute commands after a successful build I would use the Build Events->Post-build event command line in Project Properties.</p> <p>I have a Web Site project which I "Publish", using the "Publish..." command in the context menu in the solution explorer.</p> <p>Is ...
1,360,604
1
0
null
2009-09-01 04:53:06.363 UTC
3
2009-10-29 03:22:17.85 UTC
null
null
null
null
154,186
null
1
35
c#|asp.net|visual-studio-2008|events|publish
21,405
<p><strong>Update:</strong> Since Publish Web does not apply to folder-based web site projects, this answer assumes you are asking about a Web Application project.</p> <p>You can't do this from inside the VS IDE. However, you can edit your project file in Notepad or your favorite XML editor and add a new target at the...
2,157,554
How to handle command-line arguments in PowerShell
<p>What is the "best" way to handle command-line arguments?</p> <p>It seems like there are several answers on what the "best" way is and as a result I am stuck on how to handle something as simple as:</p> <pre><code>script.ps1 /n name /d domain </code></pre> <p>AND</p> <pre><code>script.ps1 /d domain /n name. </cod...
2,157,625
1
0
null
2010-01-28 20:01:10.357 UTC
147
2022-04-22 17:47:56.18 UTC
2015-06-29 19:15:30.243 UTC
null
299,327
null
261,317
null
1
571
powershell|command-line-arguments
832,861
<p>You are reinventing the wheel. Normal PowerShell scripts have parameters starting with <code>-</code>, like <code>script.ps1 -server http://devserver</code></p> <p>Then you handle them in a <code>param</code> section (note that this <strong>must</strong> begin at the first non-commented line in your script).</p> <p>...
31,302,232
Gradle task check if property is defined
<p>I have a Gradle task that executes a TestNG test suite. I want to be able to pass a flag to the task in order to use a special TestNG XML suite file (or just use the default suite if the flag isn't set).</p> <pre class="lang-bash prettyprint-override"><code>gradle test </code></pre> <p>... should run the default sta...
31,302,279
4
0
null
2015-07-08 19:42:34.25 UTC
null
2022-06-07 16:21:28.817 UTC
2022-06-07 16:21:28.817 UTC
null
8,583,692
null
2,506,293
null
1
55
gradle|properties|testng|build.gradle|task
49,252
<pre><code>if (project.hasProperty('special')) </code></pre> <p>should do it.</p> <p>Note that what you're doing to select a testng suite won't work, AFAIK: the test task doesn't have any <code>test()</code> method. Refer to <a href="https://discuss.gradle.org/t/how-to-run-acceptance-tests-with-testng-from-gradle/410...
40,557,606
How to URL encode in Python 3?
<p>I have tried to follow <a href="https://docs.python.org/3.0/library/urllib.parse.html" rel="noreferrer">the documentation</a> but was not able to use <code>urlparse.parse.quote_plus()</code> in <code>Python 3</code>:</p> <pre><code>from urllib.parse import urlparse params = urlparse.parse.quote_plus({'username': '...
40,557,716
3
0
null
2016-11-11 23:09:21.333 UTC
14
2022-08-26 20:54:45.923 UTC
null
null
null
null
1,312,080
null
1
90
python|urlencode
197,922
<p>You misread the documentation. You need to do two things:</p> <ol> <li>Quote each key and value from your dictionary, and</li> <li>Encode those into a URL</li> </ol> <p>Luckily <code>urllib.parse.urlencode</code> does both those things in a single step, and that's the function you should be using.</p> <pre><code>...
40,710,811
Count items greater than a value in pandas groupby
<p>I have the Yelp dataset and I want to count all reviews which have greater than 3 stars. I get the count of reviews by doing this:</p> <pre><code>reviews.groupby('business_id')['stars'].count() </code></pre> <p>Now I want to get the count of reviews which had more than 3 stars, so I tried this by taking inspiratio...
40,710,862
6
0
null
2016-11-20 23:47:25.59 UTC
2
2022-02-03 09:01:28.93 UTC
2017-05-23 11:59:55.387 UTC
null
-1
null
4,928,920
null
1
22
python|python-3.x|pandas
50,503
<p>You can try to do : </p> <pre><code>reviews[reviews['stars'] &gt; 3].groupby('business_id')['stars'].count() </code></pre>
55,679,401
Remove prefix (or suffix) substring from column headers in pandas
<p>I'm trying to remove the sub string _x that is located in the end of part of my df column names.</p> <p><strong>Sample df code:</strong></p> <pre><code>import pandas as pd d = {'W_x': ['abcde','abcde','abcde']} df = pd.DataFrame(data=d) df['First_x']=[0,0,0] df['Last_x']=[1,2,3] df['Slice']=['abFC=0.01#%sdadf','...
58,322,479
7
0
null
2019-04-14 19:49:19.657 UTC
9
2022-02-15 10:21:00.78 UTC
2019-04-14 19:55:21.907 UTC
null
4,909,087
null
9,185,511
null
1
35
python|pandas
58,118
<p>I usually use @cs95 way but wrapping it in a data frame method just for convenience:</p> <pre><code>import pandas as pd def drop_prefix(self, prefix): self.columns = self.columns.str.lstrip(prefix) return self pd.core.frame.DataFrame.drop_prefix = drop_prefix </code></pre> <p>Then you can use it as with...
63,592,900
Plotly-Dash: How to design the layout using dash bootstrap components?
<p>I'm very new to Dash Plotly and I'm trying to figure out how can I design a layout like this.</p> <p><a href="https://i.stack.imgur.com/WesWm.png" rel="noreferrer">Layout</a>:</p> <p><a href="https://i.stack.imgur.com/MNz5W.png" rel="noreferrer"><img src="https://i.stack.imgur.com/MNz5W.png" alt="enter image descrip...
63,602,391
2
0
null
2020-08-26 07:47:26.023 UTC
12
2021-06-14 07:33:32.073 UTC
2020-08-28 22:00:35.487 UTC
null
3,437,787
null
12,934,613
null
1
14
plotly|plotly-dash
24,583
<p>You should check out this <a href="https://dash-bootstrap-components.opensource.faculty.ai/docs/components/layout/" rel="noreferrer">link</a> to learn more about Dash Bootstrap Components, and how to structure your layout.</p> <p>I have made an example using <code>JupyterDash</code> that matches your desired layout....
35,332,784
How to call a controller function inside a view in laravel 5
<p>In laravel 4 i just used a function </p> <pre><code>$varbl = App::make("ControllerName")-&gt;FunctionName($params); </code></pre> <p>to call a controller function from a my balde template(view page). Now i'm using Laravel 5 to do a new project and i tried this method to call a controller function from my blade tem...
35,335,014
10
0
null
2016-02-11 07:03:06.18 UTC
10
2021-04-27 02:35:05.597 UTC
null
null
null
null
2,854,591
null
1
21
php|laravel-5
111,911
<p>If you have a function which is being used at multiple places you should define it in helpers file, to do so create one (may be) in app/Http/Helpers folder and name it helpers.php, mention this file in the <code>autoload</code> block of your composer.json in following way : </p> <pre><code>"autoload": { "classm...
28,952,747
Calculate Total Traveled Distance iOS Swift
<p>How can I calculate the total distance traveled use CoreLocation in Swift</p> <p>I haven't been able to so far find any resources for how to do this in Swift for iOS 8,</p> <p>How would you calculate the total distance moved since you began tracking your location?</p> <p>From what I've read so far, I need to save...
28,953,613
3
0
null
2015-03-09 22:15:40.27 UTC
8
2017-11-30 00:32:30.26 UTC
2015-06-12 23:06:15.597 UTC
null
2,303,865
null
3,786,510
null
1
10
ios|xcode|swift|core-location|cllocation
15,713
<p>update: <strong>Xcode 8.3.2 • Swift 3.1</strong></p> <p>The problem there is because you are always getting the same location over and over again. Try like this:</p> <pre><code>import UIKit import MapKit class ViewController: UIViewController, CLLocationManagerDelegate { @IBOutlet weak var mapView: MKMapView...
36,623,177
Property initialization using "by lazy" vs. "lateinit"
<p>In Kotlin, if you don't want to initialize a class property inside the constructor or in the top of the class body, you have basically these two options (from the language reference):</p> <ol> <li><a href="https://kotlinlang.org/docs/reference/delegated-properties.html#lazy" rel="noreferrer">Lazy Initialization</a><...
36,623,703
9
0
null
2016-04-14 12:30:00.12 UTC
124
2022-07-20 14:19:54.347 UTC
2021-10-03 10:44:06.993 UTC
null
466,862
null
2,327,342
null
1
448
properties|kotlin
194,576
<p>Here are the significant differences between <code>lateinit var</code> and <code>by lazy { ... }</code> delegated property:</p> <ul> <li><p><code>lazy { ... }</code> delegate can only be used for <code>val</code> properties, whereas <code>lateinit</code> can only be applied to <code>var</code>s, because it can't be ...
26,128,815
UIWebView delegate method shouldStartLoadWithRequest: equivalent in WKWebView?
<p>I have a module inside my iOS 7+ app which is a UIWebView. The html page loads a javascript that creates custom-shaped buttons (using the Raphaeljs library). With UIWebView, I set delegate to self. The delegate method <code>webView: shouldStartLoadWithRequest: navigationType:</code> is called each time one of my cus...
26,227,729
8
0
null
2014-09-30 19:42:37.67 UTC
27
2022-07-20 08:19:18.62 UTC
null
null
null
null
873,436
null
1
60
ios|objective-c|uiwebview|wkwebview
58,733
<p>Re-reading your description it looks like what you actually need to know about is how to reimplement a Javascript/Objective-C bridge using WKWebView.</p> <p>I've just done this myself, following the tutorial at <a href="http://tetontech.wordpress.com/2014/07/17/objective-c-wkwebview-to-javascript-and-back/" rel="no...
28,006,913
RSpec allow/expect vs just expect/and_return
<p>In RSpec, specifically version >= 3, is there any difference between:</p> <ul> <li>Using <code>allow</code> to set up message expectations with parameters that return test doubles, and then using <code>expect</code> to make an assertion on the returned test doubles</li> <li>Just using <code>expect</code> to set up ...
28,007,007
1
0
null
2015-01-18 03:41:16.23 UTC
34
2021-09-23 10:54:49.41 UTC
2017-05-23 12:26:35.83 UTC
null
-1
null
567,863
null
1
58
ruby|testing|rspec|mocking|rspec3
43,868
<p>See the classic article <a href="http://martinfowler.com/articles/mocksArentStubs.html">Mocks Aren't Stubs</a>. <code>allow</code> makes a stub while <code>expect</code> makes a mock. That is <code>allow</code> allows an object to return X instead of whatever it would return unstubbed, and <code>expect</code> is an ...
22,859,953
TortoiseSVN - "revert changes from this revision" vs "revert to this revision"
<p>The link:</p> <p><a href="http://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-howto-rollback.html">http://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-howto-rollback.html</a> </p> <p>describes two ways of rolling back an SVN directory after a wrongful commit. What is the difference between the two options...
22,860,652
4
0
null
2014-04-04 10:16:35.513 UTC
14
2016-04-29 13:17:20.467 UTC
2016-04-29 13:17:20.467 UTC
null
5,395,773
null
288,393
null
1
50
svn|version-control|tortoisesvn|revert
42,001
<p>Let's say you have these N sucessive commits: 1, 2, 3 and 4.</p> <p>If you select the commit 2 and choose "Revert to this revision", your working copy will contain the changes brought by commits 1 and 2. Commits 3 and 4 will be "canceled".</p> <p>If you select the commit 2 and choose "Revert changes from this revi...
22,814,378
ng-Animate not working for a Hide and Show setting
<p>I'm using AngularJS version 1.2.11. I've set a toolbar to slide in and out with a transition using ng-Animate (show and hide).</p> <p>Here is the HTML:</p> <pre><code> &lt;div&gt; &lt;div class="full-height"&gt; &lt;menu-main class="full-height pull-left"&gt;&lt;/menu-main&gt; &lt;menu-sub class="full-he...
22,934,732
1
0
null
2014-04-02 14:18:50.2 UTC
6
2016-06-30 10:04:35.89 UTC
2016-06-30 10:04:35.89 UTC
null
2,333,214
null
3,368,623
null
1
23
angularjs|ng-animate|ng-show|ng-hide
48,732
<p>The ng-animate attribute is deprecated in 1.2 and no longer used. Instead, animations are now class based.</p> <p>Also make sure you are referencing <code>angular-animate.js</code> and adding ngAnimate as a dependent module:</p> <pre><code>var app = angular.module('myApp', ['ngAnimate']); </code></pre> <p>You the...
34,264,710
What is the point of float('inf') in Python?
<p>Just wondering over here, what is the point of having a variable store an infinite value in a program? Is there any actual use and is there any case where it would be preferable to use <code>foo = float('inf')</code>, or is it just a little snippet they stuck in for the sake of putting it in?</p>
34,264,749
6
0
null
2015-12-14 10:28:56.297 UTC
22
2022-02-22 11:23:34.267 UTC
2020-03-07 14:00:35.86 UTC
null
10,436,547
null
3,262,301
null
1
111
python
178,285
<p>It acts as an unbounded upper value for comparison. This is useful for finding lowest values for something. for example, calculating path route costs when traversing trees.</p> <p>e.g. Finding the "cheapest" path in a list of options:</p> <pre><code>&gt;&gt;&gt; lowest_path_cost = float('inf') &gt;&gt;&gt; # pret...
37,225,035
Serialize in JSON a base64 encoded data
<p>I'm writing a script to automate data generation for a demo and I need to serialize in a JSON some data. Part of this data is an image, so I encoded it in base64, but when I try to run my script I get:</p> <pre><code>Traceback (most recent call last): File "lazyAutomationScript.py", line 113, in &lt;module&gt; ...
37,239,382
3
0
null
2016-05-14 09:35:16.317 UTC
27
2019-12-13 16:39:52.613 UTC
null
null
null
null
3,110,448
null
1
59
json|python-3.x|serialization|base64
79,203
<p>You must be careful about the datatypes.</p> <p>If you read a binary image, you get bytes. If you encode these bytes in base64, you get ... bytes again! (see documentation on <a href="https://docs.python.org/3/library/base64.html#base64.b64encode">b64encode</a>)</p> <p>json can't handle raw bytes, that's why you g...
41,912,629
angular2 wait until observable finishes in if condition
<p>I have implemented a if statement like this</p> <pre class="lang-ts prettyprint-override"><code>if (this.service.check() ) { return true; } else { } </code></pre> <p>this if condition waits for a response from the backend. But before the observable gets executed it's going into the else statement and...
41,912,670
1
0
null
2017-01-28 17:23:13.65 UTC
6
2017-01-28 17:27:01.347 UTC
2017-01-28 17:27:01.347 UTC
null
217,408
null
3,843,856
null
1
29
angular|observable
91,445
<p>You can't wait for an <code>Observable</code> or <code>Promise</code> to complete. You can only subscribe to it to get notified when it completes or emits an event.</p> <pre class="lang-ts prettyprint-override"><code>public check(){ return this.getActorRole() // &lt;&lt;&lt;=== add return .map(resp =&gt; { ...
38,727,047
Duplicate line in Visual Studio Code
<p>I am trying to find the shortcut for duplicating a line in Visual Studio Code (I am using 1.3.1) I tried the obvious <kbd>CTRL</kbd> + <kbd>D</kbd> but that doesn't seem to work. </p>
38,727,104
16
5
null
2016-08-02 17:36:32.207 UTC
43
2022-08-22 09:58:01.67 UTC
2017-09-26 12:07:55.237 UTC
null
114,664
null
266,360
null
1
337
visual-studio-code
264,185
<p>Click <strong>File</strong> > <strong>Preferences</strong> > <strong>Keyboard Shortcuts</strong>:</p> <p><a href="https://i.stack.imgur.com/QtEgE.png" rel="noreferrer"><img src="https://i.stack.imgur.com/QtEgE.png" alt="enter image description here"></a></p> <p>Search for <code>copyLinesDownAction</code> or <code>...
45,008,016
Check if a string is not NULL or EMPTY
<p>In below code, I need to check if version string is not empty then append its value to the request variable.</p> <pre><code>if ([string]::IsNullOrEmpty($version)) { $request += "/" + $version } </code></pre> <p>How to check not in if condition?</p>
45,008,087
7
1
null
2017-07-10 09:11:07.3 UTC
9
2021-09-01 02:13:01.5 UTC
2017-07-10 09:27:09.033 UTC
null
1,630,171
null
8,171,406
null
1
65
powershell
256,343
<pre><code>if (-not ([string]::IsNullOrEmpty($version))) { $request += "/" + $version } </code></pre> <p>You can also use <code>!</code> as an alternative to <code>-not</code>.</p>
38,730,273
How to limit FPS in a loop with C++?
<p>I'm trying to limit the frames per second in a loop that is performing intersection checking, using C++ with chrono and thread.</p> <p>Here is my code:</p> <pre><code>std::chrono::system_clock::time_point now = std::chrono::system_clock::now(); std::chrono::system_clock::time_point lastFrame = std::chrono::system_...
38,730,516
4
9
null
2016-08-02 20:55:17.737 UTC
13
2017-05-30 18:01:47.44 UTC
2016-08-03 15:32:15.07 UTC
null
3,457,728
null
3,457,728
null
1
28
c++|chrono
14,664
<p>If you think about how your code works, you'll find out that it works exactly how you wrote it. Delta oscillates because of a logical mistake in the code.</p> <p>This is what happens:</p> <ul> <li>We start with <code>delta == 0</code>.</li> <li>Because the delta is smaller than <code>200</code>, you code sleeps <c...
7,576,217
Assigning a domain name to localhost for development environment
<p>I am building a website and would not like to reconfigure the website from pointing to <code>http://127.0.0.1</code> to <code>http://www.example.com</code>. Furthermore, the certificate that I am using is of course made with the proper domain name of <code>www.example.com</code> but my test environment makes calls t...
7,576,369
1
2
null
2011-09-27 22:04:35.44 UTC
24
2018-03-04 16:37:23.733 UTC
2018-03-04 16:37:23.733 UTC
null
608,639
null
967,974
null
1
67
node.js|macos|ssl|dns|ssl-certificate
71,194
<p>If you edit your etc/hosts file you can assign an arbitrary host name to be set to 127.0.0.1. Open up /etc/hosts in your favorite text editor and add this line:</p> <pre><code>127.0.0.1 www.example.com </code></pre> <p>Unsure of how to avoid specifying the port in the HTTP requests you make to example.com, but i...
22,588,518
Lambda Expression and generic defined only in method
<p>Suppose I've a generic interface:</p> <pre><code>interface MyComparable&lt;T extends Comparable&lt;T&gt;&gt; { public int compare(T obj1, T obj2); } </code></pre> <p>And a method <code>sort</code>:</p> <pre><code>public static &lt;T extends Comparable&lt;T&gt;&gt; void sort(List&lt;T&gt; list, MyComp...
22,588,738
5
0
null
2014-03-23 08:18:00.177 UTC
27
2022-01-06 12:35:10.68 UTC
2021-11-17 18:58:09.17 UTC
null
32,453
null
1,679,863
null
1
119
java|generics|lambda|java-8
85,706
<p>You can't use a <em>lambda expression</em> for a <em>functional interface</em>, if the method in the <em>functional interface</em> has <em>type parameters</em>. See <a href="http://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.27.3">section §15.27.3 in JLS8</a>:</p> <blockquote> <p>A lambda express...
3,042,304
How to determine what user and group a Python script is running as?
<p>I have a CGI script that is getting an <code>"IOError: [Errno 13] Permission denied"</code> error in the stack trace in the web server's error log.</p> <p>As part of debugging this problem, I'd like to add a little bit of code to the script to print the user and (especially) group that the script is running as, int...
3,042,321
3
0
null
2010-06-15 03:15:11.55 UTC
4
2020-02-28 17:53:22.833 UTC
2020-02-28 17:53:10.563 UTC
null
4,304,503
null
204,291
null
1
32
python|unix|permissions
30,725
<p>You can use the following piece of code:</p> <pre><code>import os print(os.getegid()) </code></pre>
2,365,701
Decorating class methods - how to pass the instance to the decorator?
<p>This is Python 2.5, and it's <a href="https://developers.google.com/appengine/docs/python/" rel="nofollow noreferrer">GAE</a> too, not that it matters.</p> <p>I have the following code. I'm decorating the foo() method in bar, using the <code>dec_check</code> class as a decorator.</p> <pre><code>class dec_check(objec...
2,365,771
3
0
null
2010-03-02 18:38:03.747 UTC
40
2021-12-03 00:40:16.353 UTC
2021-12-03 00:28:58.85 UTC
null
355,230
null
120,390
null
1
71
python|python-decorators
42,402
<p>You need to make the decorator into a <a href="https://docs.python.org/3/howto/descriptor.html" rel="nofollow noreferrer">descriptor</a> -- either by ensuring its (meta)class has a <code>__get__</code> method, or, <strong>way</strong> simpler, by using a decorator <em>function</em> instead of a decorator <em>class</...
3,166,951
writing some characters like '<' in an xml file
<p>since the beginning of my programmation, I used some special character like "&lt;-", ""&lt;&lt;" im my string.xml in Eclipse while developping for Android.</p> <p>All worked fine for one year, but today, i just wanted to make some minor changes and began to edit my xml files.</p> <p>I get now compilation error on ...
3,166,967
3
1
null
2010-07-02 15:11:15.213 UTC
23
2016-07-07 19:48:21.68 UTC
null
null
null
null
327,402
null
1
115
android|xml|special-characters
72,479
<p>Use</p> <p><code>&amp;lt;</code> for <code>&lt;</code></p> <p><code>&amp;gt;</code> for <code>&gt;</code></p> <p><code>&amp;amp;</code> for <code>&amp;</code></p>
3,126,201
Javascript && operator versus nested if statements: what is faster?
<p>Now, before you all jump on me and say "you're over concerned about performance," let it hereby stand that I ask this more out of curiosity than rather an overzealous nature. That said...</p> <p>I am curious if there is a performance difference between use of the &amp;&amp; ("and") operator and nested if statement...
3,126,211
4
1
null
2010-06-27 02:46:17.647 UTC
8
2015-05-11 12:57:01.183 UTC
null
null
null
null
209,803
null
1
38
javascript|performance|conditional-operator
55,292
<p>The performance difference is negligible. The <code>&amp;&amp;</code> operator won't check the right hand expression when the left hand expression evaluates <code>false</code>. However, the <code>&amp;</code> operator will check <em>both</em> regardless, maybe your confusion is caused by this fact.</p> <p>In this p...
29,231,013
How can I use a simple Dropdown list in the search box of GridView::widget, Yii2?
<p>I am trying to make a dropdown list in the search box of a <code>GridView::widget</code>, Yii2 for searching related data. So, how can I create a simple dropdown list in the search box of <code>GridView::widget</code>, Yii2 framework?<br></p> <p>Thanks.</p>
32,580,108
2
0
null
2015-03-24 11:08:39.86 UTC
19
2017-03-20 08:49:03.247 UTC
2015-10-13 12:50:59.443 UTC
null
4,097,436
null
4,473,768
null
1
50
php|search|gridview|drop-down-menu|yii2
57,041
<p>You can also use below code </p> <pre><code>[ 'attribute'=&gt;'attribute name', 'filter'=&gt;array("ID1"=&gt;"Name1","ID2"=&gt;"Name2"), ], </code></pre> <p>OR</p> <pre><code>[ 'attribute'=&gt;'attribute name', 'filter'=&gt;ArrayHelper::map(Model::find()-&gt;asArray()-&gt;all(), 'ID', 'Name'), ], ...
28,404,817
AnnotationConfigApplicationContext has not been refreshed yet - what's wrong?
<p>My very basic spring application stopped working and I can't understand what's happened. <strong>pom.xml:</strong></p> <pre><code>&lt;properties&gt; &lt;spring.version&gt;4.1.1.RELEASE&lt;/spring.version&gt; &lt;/properties&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;org.springframew...
28,404,863
3
0
null
2015-02-09 07:31:34.56 UTC
1
2022-08-15 20:05:10.807 UTC
null
null
null
null
2,659,898
null
1
27
java|spring|configuration
47,600
<p>You have to call <code>ctx.refresh()</code> before you can call <code>ctx.getBean(HelloWorld.class);</code></p>
40,678,930
Use switch with number case and char case
<p>I want to make a <code>switch</code> loop. </p> <p>If input is from <code>1</code> to <code>5</code>. It will print a number. Else it will print <code>"this is not a number"</code>. And if the input is <code>'e'</code>. The <code>switch</code> loop should be ended. </p> <p>I can make the number part, but I don't k...
40,679,033
5
4
null
2016-11-18 13:57:58.977 UTC
null
2021-05-03 20:05:15.827 UTC
2016-11-18 14:17:59.573 UTC
null
1,085,062
null
7,032,877
null
1
2
c|char|switch-statement|case
63,460
<p>Just treat the integers as characters like this;</p> <p>By the way, you probably want to read a new character each time through the while loop, otherwise you'll get stuck printing forever. The default case below allows us to break from the loop.</p> <pre><code>int main() { char i,a = 0; printf(&quot;Write so...
2,664,618
What does it mean that "Lisp can be written in itself?"
<p>Paul Graham wrote that <a href="http://www.paulgraham.com/rootsoflisp.html" rel="noreferrer">"The unusual thing about Lisp-- in fact, the defining quality of Lisp-- is that it can be written in itself."</a> But that doesn't seem the least bit unusual or definitive to me.</p> <p>ISTM that a programming language is ...
2,664,632
5
2
null
2010-04-19 00:46:03.873 UTC
13
2020-05-14 11:18:29.867 UTC
2012-04-29 15:20:30.177 UTC
null
50,776
null
32,914
null
1
25
programming-languages|lisp
7,198
<p>Probably what Paul means is that the representation of Lisp <em>syntax</em> as a Lisp <em>value</em> is standardized and pervasive. That is, a Lisp program is just a special kind of S-expression, and it's exceptionally easy to write Lisp code that manipulates Lisp code. Writing a Lisp interpreter in Lisp is a spec...
2,378,402
Jackson Vs. Gson
<p>After searching through some existing libraries for JSON, I have finally ended up with these two:</p> <ul> <li>Jackson</li> <li>Google GSon</li> </ul> <p>I am a bit partial towards GSON, but word on the net is that GSon suffers from a certain celestial performance <a href="http://www.cowtowncoder.com/blog/archives...
2,378,615
5
10
null
2010-03-04 10:20:30.693 UTC
115
2014-12-30 17:58:41.26 UTC
2013-08-22 21:23:52.923 UTC
null
13,295
null
119,772
null
1
396
java|json|comparison|gson|jackson
193,288
<p>I did this research the last week and I ended up with the same 2 libraries. As I'm using Spring 3 (that adopts Jackson in its default Json view '<a href="http://static.springsource.org/spring/docs/3.0.0.RC2/javadoc-api/org/springframework/web/servlet/view/json/MappingJacksonJsonView.html" rel="noreferrer">JacksonJso...
3,089,151
Specifying an order to junit 4 tests at the Method level (not class level)
<p>I know this is bad practice, but it needs to be done, or I'll need to switch to <code>testng</code>. Is there a way, similar to JUnit 3's testSuite, to specify the order of the tests to be run in a class?</p>
3,623,660
6
0
null
2010-06-21 23:18:27.147 UTC
18
2020-12-08 18:24:12.023 UTC
2015-02-19 00:39:55.903 UTC
null
445,131
null
357,848
null
1
39
java|unit-testing|junit4|junit3
25,356
<p>If you're sure you <em>really</em> want to do this: There may be a better way, but this is all I could come up with...</p> <p>JUnit4 has an annotation: <code>@RunWith</code> which lets you override the default Runner for your tests.</p> <p>In your case you would want to create a special subclass of <code>BlockJuni...
2,503,705
How to get a child element to show behind (lower z-index) than its parent?
<p>I need a certain dynamic element to always appear on top of another element, no matter what order in the DOM tree they are. Is this possible? I've tried <code>z-index</code> (with <code>position: relative</code>), and it doesn't seem to work.</p> <p>I need:</p> <pre><code>&lt;div class="a"&gt; &lt;div class="b...
2,503,782
7
1
null
2010-03-23 21:19:39.21 UTC
9
2022-05-17 03:39:21.99 UTC
2018-10-16 20:43:08.663 UTC
user166390
2,756,409
null
257,878
null
1
45
html|css|dom
29,066
<p>If the elements make a hierarchy, it cannot be done that way, because every positioned element creates new <a href="http://css-discuss.incutio.com/wiki/Overlapping_And_ZIndex" rel="noreferrer">stacking context</a>, and z-index is relative to the elements of the same stacking context.</p>
3,066,703
Blocks and yields in Ruby
<p>I am trying to understand blocks and <code>yield</code> and how they work in Ruby.</p> <p>How is <code>yield</code> used? Many of the Rails applications I've looked at use <code>yield</code> in a weird way.</p> <p>Can someone explain to me or show me where to go to understand them?</p>
3,066,939
10
1
null
2010-06-18 01:34:40.26 UTC
126
2022-05-19 13:29:29.653 UTC
2022-05-19 13:29:29.653 UTC
null
4,294,399
null
223,367
null
1
307
ruby|ruby-block
154,543
<p>Yes, it is a bit puzzling at first.</p> <p>In Ruby, methods can receive a code block in order to perform arbitrary segments of code.</p> <p>When a method expects a block, you can invoke it by calling the <code>yield</code> function.</p> <p>Example:</p> <p>Take <code>Person</code>, a class with a <code>name</code> at...
2,588,149
What is the "->" PHP operator called?
<p>What do you call this arrow looking <code>-&gt;</code> operator found in PHP? </p> <p>It's either a minus sign, dash or hyphen followed by a greater than sign (or right chevron). </p> <p>How do you pronounce it when reading code out loud?</p>
2,588,183
15
1
null
2010-04-06 20:41:44.43 UTC
36
2020-11-12 13:52:36.833 UTC
2020-11-12 13:34:50.773 UTC
null
2,370,483
null
192,227
null
1
128
php|operators|terminology
78,289
<p>The official name is &quot;object operator&quot; - <a href="http://php.net/manual/en/tokens.php" rel="nofollow noreferrer">T_OBJECT_OPERATOR</a>.</p>
25,075,706
Automatic failing/non-execution of interdependent tests in Robot Framework
<p>I have a large number of test cases, in which several test cases are interdependent. Is it possible that while a later test case is getting executed you can find out the status of a previously executed test case? In my case, the 99th test case depends on the status of some prior test cases and thus, if either the 24...
25,079,032
2
0
null
2014-08-01 08:11:29.323 UTC
10
2022-07-15 17:01:48.403 UTC
2020-01-21 21:05:27.35 UTC
null
699,665
null
3,802,759
null
1
11
python|testing|automated-tests|robotframework
9,845
<p>Robot is very extensible, and a feature that was introduced in version 2.8.5 makes it easy to write a keyword that will fail if another test has failed. This feature is the ability for a <a href="https://github.com/robotframework/robotframework/issues/811" rel="nofollow noreferrer">library to act as a listener</a>. ...
23,805,915
Run parallel test task using gradle
<p>We use JUnit as a test framework. We have many projects. We use gradle (version 1.12) as a build tool. To run the unit tests in parallel using gradle we use the below script in every project under test task.</p> <pre><code>maxParallelForks = Runtime.runtime.availableProcessors() </code></pre> <p>Ex:</p> <pre><code>t...
23,807,352
4
0
null
2014-05-22 11:45:24.23 UTC
17
2022-09-17 16:41:22.017 UTC
2020-12-15 11:13:15.073 UTC
null
1,080,523
null
2,122,885
null
1
54
junit|gradle|build.gradle
57,823
<p><code>$rootDir/build.gradle</code>:</p> <pre><code>subprojects { tasks.withType(Test) { maxParallelForks = Runtime.runtime.availableProcessors() } } </code></pre>
51,049,663
Python3.6 error: ModuleNotFoundError: No module named 'src'
<p>I know similar questions have been asked before... But I had a quick doubt... I have been following this link: <a href="https://www.python-course.eu/python3_packages.php" rel="nofollow noreferrer">https://www.python-course.eu/python3_packages.php</a></p> <p>my code structure:</p> <pre><code>my-project -- __init__....
51,050,147
4
0
null
2018-06-26 18:50:52.933 UTC
5
2022-08-01 20:47:29.847 UTC
2022-04-08 12:53:25.817 UTC
null
11,103,856
null
3,868,051
null
1
32
python-3.6|python-unittest
94,403
<p>You have to run the test from the <code>my-project</code> folder, rather than from the <code>test</code> folder.</p> <pre><code>python -m unittest test.test_file1.TestWriteDataBRToOS </code></pre>
40,059,929
Cannot find the UseMysql method on DbContextOptions
<p>I am playing around with the dotnet core on linux, and i am trying to configure my DbContext with a connection string to a mysql Server.</p> <p>my DbContext looks like so:</p> <pre><code>using Microsoft.EntityFrameworkCore; using Models.Entities; namespace Models { public class SomeContext : DbContext { ...
40,060,297
4
0
null
2016-10-15 13:58:54.53 UTC
4
2021-04-30 20:26:29.613 UTC
2021-04-30 20:26:29.613 UTC
null
2,992,311
null
2,992,311
null
1
17
c#|mysql|entity-framework|asp.net-core
40,861
<p>You need</p> <pre><code>using Microsoft.EntityFrameworkCore; using MySQL.Data.EntityFrameworkCore.Extensions; </code></pre> <p>Oracle is not complying to the standard practices when using Dependency Injection, so its all a bit different. The standard practice is to put the extension methods for Depedency Injection...
10,687,035
Stop build execution in Jenkins
<p>I am using Jenkins to run a Maven project having Junit tests in Sauce Connect. I created a job and to stop/abort the build in between I clicked the Cross button (X) shown near progress bar for build execution. But the build execution does not get stopped. When I moved to console output for the build, it was showing ...
10,689,249
2
0
null
2012-05-21 14:19:15.387 UTC
3
2015-10-20 08:24:22.477 UTC
2015-10-20 08:24:22.477 UTC
null
322,020
null
968,813
null
1
16
jenkins
45,599
<p>Jenkins will terminate the build nicely, i.e. wait for the running processes to end after sending the termination signal. If the processes take a long time to terminate, it will wait. The easiest way is to change your build/code such that it terminates immediately, or has a timeout for closing connections etc.</p> ...
10,392,987
visibility:visible/hidden div
<p>What is the best way to show a div when clicked on a button and then hide it with a close button??</p> <p>My Jquery code is as follows:</p> <pre><code>$(".imageIcon").click(function(){ $('.imageShowWrapper').css("visibility", 'visible'); }); $(".imageShowWrapper").click(function(){ $('.imageShowWrapper').css("vis...
10,393,008
6
0
null
2012-05-01 02:50:02.34 UTC
2
2019-01-16 01:46:07.7 UTC
null
null
null
null
1,347,112
null
1
18
jquery|css|html|visibility
95,353
<p>You can use the <code>show</code> and <code>hide</code> methods:</p> <pre><code>$(".imageIcon").click(function() { $('.imageShowWrapper').show(); }); $(".imageShowWrapper").click(function() { $(this).hide(); }); </code></pre>
10,586,838
Illegal characters in path when loading a string with XDocument
<p>I have very simple XML in a string that I'm trying to load via <code>XDocument</code> so that I can use LINQ to XML:</p> <pre><code> var xmlString = @"&lt;?xml version=""1.0"" encoding=""utf-8"" standalone=""yes""?&gt; &lt;person&gt;Test Person&lt;/person&gt;"; var doc = XDocument.Load(xmlString); //'Illegal cha...
10,586,880
3
0
null
2012-05-14 15:56:46.643 UTC
5
2017-09-05 06:32:41.217 UTC
2015-12-03 19:50:11.46 UTC
null
98,713
null
1,202,717
null
1
45
c#|xml|.net-4.0
29,685
<p>You are looking for <code>XDocument.Parse</code> - <code>XDocument.Load</code> is for <em>files</em> not xml strings:</p> <pre><code>var doc = XDocument.Parse(xmlString); </code></pre>
10,697,161
Why FloatBuffer instead of float[]?
<p>I've been using FloatBuffers in my Android code for a while (copied it from some opengles tutorial), but I cannot understand exactly what this construct is and why it is needed.</p> <p>For example this code (or similar) I see in many many peoples' code and android tutorials:</p> <pre><code>float[] vertices = ...so...
10,697,239
2
0
null
2012-05-22 06:53:25.937 UTC
24
2012-08-24 09:38:29.45 UTC
null
null
null
null
1,236,185
null
1
50
java|android|opengl-es
21,024
<p>The main reason is performance: ByteBuffers and the other NIO classes enable accelerated operations when interfacing with native code (typically by avoiding the need to copy data into a temporary buffer).</p> <p>This is pretty important if you are doing a lot of OpenGL rendering calls for example.</p> <p>The reaso...
30,806,119
NestedScrollView and CoordinatorLayout. Issue on Scrolling
<p>I have a strange issue with the <code>CoordinatorLayout</code> and the <code>NestedScrollView</code> (with the design support library 22.2.0)</p> <p>Using a content smaller than <code>NestedScrollView</code> I should have a fixed content. However trying to scroll up and down the content I can obtain that the conten...
30,807,149
5
1
null
2015-06-12 14:54:21.72 UTC
14
2018-12-21 13:06:57.827 UTC
2015-12-13 09:59:40.043 UTC
null
2,016,562
null
2,016,562
null
1
35
android|material-design|android-support-library|android-design-library|android-coordinatorlayout
64,284
<p>This can also be observed in the <a href="https://github.com/chrisbanes/cheesesquare">cheesesquare</a> demo when removing all but one card in the details fragment.</p> <p>I was able to solve this (for now) using this class: <a href="https://gist.github.com/EmmanuelVinas/c598292f43713c75d18e">https://gist.github.com...
31,245,959
How to add JBoss Server in Eclipse?
<p>I am new to JBoss and have just installed Eclipse. I have added a project to the workspace and now I want to deploy it to a Jboss server. However, in the <em>New Server Runtime Environment</em> list, JBoss is not available:</p> <p><img src="https://i.stack.imgur.com/UZbC0.png" alt="New Server Runtime Environment wi...
31,248,157
7
1
null
2015-07-06 12:33:26.01 UTC
6
2019-12-15 18:05:25.113 UTC
2015-07-06 15:04:05.693 UTC
null
1,421,925
null
476,828
null
1
22
java|eclipse|jboss|server
115,366
<p>Here is the solution follow below steps</p> <ol> <li>In Eclipse Mars go to Help-> Install New Software </li> <li>Click on add button and paste the URL of the update site which is in our case: <a href="http://download.jboss.org/jbosstools/updates/development/mars/" rel="noreferrer">Eclipse Mars tools for Jboss</a></...
19,355,818
How to make scrollviewer work with Height set to Auto in WPF?
<p>I have learned that if the height of a grid row, where the <code>ScrollViewer</code> resides, is set as <code>Auto</code>, the vertical scroll bar will not take effect since the actual size of the <code>ScrollViewer</code> can be larger than the height in sight. So in order to make the scroll bar work, I should set ...
19,356,424
5
0
null
2013-10-14 08:02:57.367 UTC
8
2020-06-15 13:15:56.893 UTC
2019-02-05 02:49:09.693 UTC
null
196,919
null
944,213
null
1
17
wpf|xaml|uwp-xaml|scrollviewer|autosize
46,008
<p>Change Height from <code>Auto</code> to <code>*</code>, if you can.</p> <p>Example:</p> <pre><code> &lt;Window x:Class="WpfApplication3.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" ...
19,537,116
Can we delete duplicate records from a table in teradata without using intermediate table
<p>Can we delete duplicate records from a multiset table in teradata without using intermediate table.</p> <p>Suppose we have 2 rows with values 1, 2, 3 and 1, 2, 3 in my multiset table then after delete i should have only one row i.e. 1, 2, 3.</p>
19,549,032
4
0
null
2013-10-23 08:51:52.077 UTC
1
2021-03-30 19:23:00.753 UTC
null
null
null
null
1,948,361
null
1
1
teradata
41,420
<p>You can't unless the ROWID usage has been enabled on your system (and probablity is quite low). You can easily test it by trying to explain a SELECT ROWID FROM table;</p> <p>Otherwise there are two possible ways.</p> <p>Low number of duplicates:</p> <ul> <li>create a new table as result of <code>SELECT all column...
20,960,405
Bootstrap 3 Dropdown on iPad not working
<p>I have a simple Bootstrap 3 dropdown that is working in all browsers that I've tested (Chrome, FF, IE, Chrome on Android) but it is not working in Safari or Chrome on the iPad (ios 7.04).</p> <p>I thought this was an issue with the ontouchstart as suggested in some other posts dealing with Bootstrap 2 but I've trie...
20,963,048
6
1
null
2014-01-06 22:21:25.327 UTC
7
2019-02-21 09:59:52.883 UTC
2018-08-23 12:15:46.373 UTC
null
1,342,185
null
1,342,185
null
1
30
javascript|ios|css|twitter-bootstrap-3
34,362
<p>I figured it out. I was missing the href="#" in my anchor tag. It was working fine in other browsers but not chrome or safari on IOS. Works fine now. Here's the final code for anyone that's interested:</p> <pre><code> &lt;div class="dropdown"&gt; &lt;a class="dropdown-toggle" id="ddAction" data-toggle="d...
21,096,819
JNI and Gradle in Android Studio
<p>I'm trying to add native code to my app. I have everything in <code>../main/jni</code> as it was in my Eclipse project. I have added <code>ndk.dir=...</code> to my <code>local.properties</code>. I haven't done anything else yet (I'm not sure what else is actually required, so if I've missed something let me know). W...
26,693,354
6
1
null
2014-01-13 16:51:04.907 UTC
43
2017-10-13 11:28:13.19 UTC
2014-07-14 12:30:43.867 UTC
null
1,368,342
null
319,618
null
1
76
android|java-native-interface|gradle|android-studio|android-ndk-r7
126,267
<h2>Gradle Build Tools 2.2.0+ - The closest the NDK has ever come to being called 'magic'</h2> <p>In trying to avoid experimental and frankly fed up with the NDK and all its hackery I am happy that 2.2.x of the Gradle Build Tools came out and now it just works. The key is the <code>externalNativeBuild</code> and point...
21,495,616
Difference between modelAttribute and commandName attributes in form tag in spring?
<p>In Spring 3, I have seen two different attribute in form tag in jsp</p> <pre><code>&lt;form:form method="post" modelAttribute="login"&gt; </code></pre> <p>in this the attribute modelAttribute is the name of the form object whose properties are used to populate the form. And I used it in posting a form and in cont...
21,500,148
5
0
null
2014-02-01 07:57:00.377 UTC
27
2018-05-24 01:43:30.493 UTC
2018-05-24 01:43:30.493 UTC
null
1,033,581
null
2,219,920
null
1
97
forms|spring-mvc|modelattribute
85,630
<p>If you look at the <a href="https://github.com/spring-projects/spring-framework/blob/4.3.x/spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/FormTag.java#L53" rel="noreferrer">source code of <code>FormTag</code> (4.3.x)</a> which backs your <code>&lt;form&gt;</code> element, you'll notice this</p...
18,902,072
What standard do language codes of the form "zh-Hans" belong to?
<p>Through the REST API of an application, I receive language codes of the following form: <code>ll-Xxxx</code>. </p> <ul> <li>two lowercase letters languages (looks like <a href="http://en.wikipedia.org/wiki/ISO_639-1" rel="noreferrer">ISO 639-1</a>), </li> <li>a dash, </li> <li>a code going up to four letters, star...
38,959,322
2
0
null
2013-09-19 18:14:04.99 UTC
7
2016-12-09 17:40:36.51 UTC
2016-08-15 19:23:37.39 UTC
null
6,002,174
null
1,030,960
null
1
30
internationalization|iso
39,302
<p>The current reference for identifying languages is <a href="https://tools.ietf.org/html/bcp47" rel="noreferrer"><strong>IETF BCP 47</strong></a>, which combines IETF RFC 5646 and RFC 4647. </p> <p>Codes of the form <code>ll-Xxxx</code> combine an ISO 639-1 <em>language code</em> (two letters) and an <a href="https:...
8,573,603
Redirect to page with add page tab dialog
<p>Facebook recently notified they are <a href="http://developers.facebook.com/blog/post/611/" rel="noreferrer">deprecating support for app profile pages</a>. </p> <p>Apps created after Dec 10th no longer have the app page option, together with the "add to my page" functionality, and must use the new <a href="http://...
8,768,363
3
0
null
2011-12-20 09:53:41.027 UTC
12
2012-11-10 12:19:57.76 UTC
2011-12-20 12:30:17.973 UTC
null
1,005,886
null
1,005,886
null
1
9
facebook|dialog|tabs
9,209
<pre><code>&lt;script type="text/javascript"&gt; function addToPage() { // calling the API ... FB.ui( { method: 'pagetab' }, function(response) { if (response != null &amp;&amp; response.tabs_added != null) { $.each(response.tabs_added,...
8,697,706
Exclude one folder in htaccess protected directory
<p>I have a directory protected by htaccess. Here is the code I use now:</p> <pre><code>AuthName "Test Area" Require valid-user AuthUserFile "/***/.htpasswd" AuthType basic </code></pre> <p>This is working fine. However, I now have a directory inside of this folder that I would like to allow anyone to access, but am ...
8,697,894
5
0
null
2012-01-02 05:31:03.67 UTC
7
2019-10-27 00:34:45.05 UTC
2012-01-02 06:01:15.06 UTC
null
350,858
null
979,573
null
1
28
apache|.htaccess|authentication
43,144
<p>According to <a href="http://perishablepress.com/press/2007/11/26/enable-file-or-directory-access-to-your-htaccess-password-protected-site/" rel="noreferrer">this article</a> you can accomplish this by using <code>SetEnvIf</code>. You match each of the folders and files you want to grand access to and define an envi...
26,863,242
SignalR MVC 5 Websocket no valid Credentials
<p>i try to use SignalR in MVC Application. It works well but i get the following Error in the Chrome console</p> <pre><code> WebSocket connection to 'ws://localhost:18245/signalr/connect?transport=webSockets&amp;clientProtocol=1.4&amp;connectionToken=bNDGLnbSQThqY%2FSjo1bt 8%2FL45Xs22BDs2VcY8O7HIkJdDaUJ4ftIc54av%2BEL...
26,896,208
4
0
null
2014-11-11 10:57:14.283 UTC
8
2019-07-08 02:53:18.03 UTC
null
null
null
null
1,088,603
null
1
30
jquery|asp.net-mvc|controller|signalr|owin
20,186
<p>It looks like you are running into a Chrome issue. The problem is that Chrome doesn't properly handle Windows Authentication for WebSockets.</p> <p>Below is the initial issue submitted a couple years ago reporting that Chrome did not support any form of HTTP authentication:</p> <p><a href="https://code.google.com/...
26,652,611
Laravel Recursive Relationships
<p>I'm working on a project in <em>Laravel</em>. I have an Account model that can have a parent or can have children, so I have my model set up like so:</p> <pre><code>public function immediateChildAccounts() { return $this-&gt;hasMany('Account', 'act_parent', 'act_id'); } public function parentAccount() { re...
26,654,139
9
0
null
2014-10-30 12:08:07.873 UTC
32
2021-04-12 00:42:16.093 UTC
2014-10-31 01:36:44.713 UTC
null
1,378,470
null
1,378,470
null
1
57
php|laravel|eloquent
50,906
<p>This is how you can use recursive relations:</p> <pre><code>public function childrenAccounts() { return $this-&gt;hasMany('Account', 'act_parent', 'act_id'); } public function allChildrenAccounts() { return $this-&gt;childrenAccounts()-&gt;with('allChildrenAccounts'); } </code></pre> <p>Then:</p> <pre><c...
264,175
Entity Framework & LINQ To SQL - Conflict of interest?
<p>I've been reading on the blogosphere for the past week that Linq to SQL is dead [and long live EF and Linq to Entities]. But when I read the overview on MSDN, it appeared to me Linq to Entities generates eSQL just the way Linq to SQL generates SQL queries.</p> <p>Now, since the underlying implementation (and since...
265,109
3
0
null
2008-11-05 02:10:28.79 UTC
9
2017-05-26 18:49:11.947 UTC
2017-05-26 18:49:11.947 UTC
Kevin Fairchild
15,168
Vyas Bharghava
28,413
null
1
13
entity-framework|linq|linq-to-sql|linq-to-entities|entity-sql
2,544
<p>It is worth noting that Entity Framework has (at least) three ways of being consumed:</p> <ul> <li>LINQ to Entities over Object Services over Entity Client</li> <li>Entity SQL over Object Services over Entity Client</li> <li>Entity SQL using Entity Client command objects (most similar to classic ADO.NET)</li> </ul>...
228,775
.NET Web Service & BackgroundWorker threads
<p>I'm trying to do some async stuff in a webservice method. Let say I have the following API call: <a href="http://www.example.com/api.asmx" rel="nofollow noreferrer">http://www.example.com/api.asmx</a></p> <p>and the method is called <em>GetProducts()</em>.</p> <p>I this GetProducts methods, I do some stuff (eg. ge...
228,798
3
0
null
2008-10-23 06:54:59.247 UTC
9
2016-12-31 08:17:59.66 UTC
2016-12-31 08:17:59.66 UTC
null
1,033,581
PK
30,674
null
1
14
c#|asp.net|multithreading|backgroundworker
17,990
<p><code>BackgroundWorker</code> is useful when you need to synchronize back to (for example) a UI* thread, eg for affinity reasons. In this case, it would seem that simply using <code>ThreadPool</code> would be more than adequate (and much simpler). If you have high volumes, then a producer/consumer queue may allow be...
509,978
Something faster than HttpHandlers?
<p>What is the fastest way to execute a method on an ASP.NET website?</p> <p>The scenario is pretty simple: I have a method which should be executed when a web page is hit. Nothing else is happening on the page, the only rendered output is a "done" message. I want the processing to be as fast as possible.</p> <p>Ever...
510,001
3
0
null
2009-02-04 03:40:39.213 UTC
12
2010-02-25 21:13:44.837 UTC
null
null
null
Jakob Gade
10,932
null
1
19
asp.net|performance|httphandler
3,926
<p>Depending on what you're doing, I wouldn't expect to see a lot of improvement over just using an HttpHandler. I'd start by just writing the HttpHandler and seeing how it performs. If you need it to be faster, try looking more closely at the things you're actually doing while processing the request and seeing what ca...
17,960
PowerShell App.Config
<p>Has anyone worked out how to get PowerShell to use <code>app.config</code> files? I have a couple of .NET DLL's I'd like to use in one of my scripts but they expect their own config sections to be present in <code>app.config</code>/<code>web.config</code>.</p>
5,625,350
3
0
null
2008-08-20 13:33:58.057 UTC
12
2018-08-10 05:04:56.33 UTC
2011-04-11 18:25:49.03 UTC
Chris
419
Kev
419
null
1
27
powershell|configuration-files
20,113
<p>Cross-referencing with this thread, which helped me with the same question: <a href="https://stackoverflow.com/questions/2789920/subsonic-access-to-app-config-connection-strings-from-referenced-dll-in-powershel">Subsonic Access To App.Config Connection Strings From Referenced DLL in Powershell Script</a></p> <p>I a...
64,727,165
Is it OK for a class constructor to block forever?
<p>Let's say I have an object that provides some sort of functionality in an infinite loop.</p> <p>Is is acceptable to just put the infinite loop in the constructor?</p> <p>Example:</p> <pre><code>class Server { public: Server() { for(;;) { //... } } }; </code></pre> <p>Or is the...
64,728,578
6
11
null
2020-11-07 11:27:20.627 UTC
1
2020-11-12 05:55:49.32 UTC
2020-11-08 17:50:10.87 UTC
null
224,132
null
1,219,247
null
1
41
c++|multithreading|constructor|infinite-loop
4,399
<p>It's not wrong per standard, it's just a bad design.</p> <p>Constructors don't usually block. Their purpose is to take a raw chunk of memory, and transform it into a valid C++ object. Destructors do the opposite: they take valid C++ objects and turn them back into raw chunks of memory.</p> <p>If your constructor blo...
22,414,524
How can I make Laravel return a custom error for a JSON REST API
<p>I'm developing some kind of RESTful API. When some error occurs, I throw an <code>App::abort($code, $message)</code> error. </p> <p>The problem is: I want him to throw a json formed array with keys "code" and "message", each one containing the above mentioned data. </p> <pre><code>Array ( [code] =&gt; 401 ...
22,417,496
10
0
null
2014-03-14 19:53:37.313 UTC
15
2022-04-20 08:28:41.56 UTC
2014-03-14 23:32:11.44 UTC
null
3,134,069
null
1,243,382
null
1
42
php|json|rest|laravel-4|restful-architecture
126,626
<p>go to your <code>app/start/global.php</code>.</p> <p>This will convert all errors for <code>401</code> and <code>404</code> to a custom json error instead of the Whoops stacktrace. Add this:</p> <pre><code>App::error(function(Exception $exception, $code) { Log::error($exception); $message = $exception-&gt...
6,503,562
Which algorithm is used for noise canceling in earphones?
<p>I want to program software for noise canceling in real time, the same way it happens in earphones with active noise canceling. Are there any open algorithms or, at least, science papers about it? A Google search found info about non-realtime noise reduction only.</p>
6,504,135
1
1
null
2011-06-28 08:19:44.137 UTC
13
2017-09-24 21:50:07.05 UTC
2015-06-20 21:38:28.677 UTC
null
7,920
null
818,748
null
1
19
algorithm|audio|noise-reduction
15,980
<p>from <a href="http://www.best-headphone-review.com/bestnoisecancellingheadphones.html" rel="nofollow noreferrer">This site</a></p> <p><em>Active noise cancelling headphones in addition to all the normal headphone circuitry, have a microphone and additional special circuitry. At a basic level the microphone on the h...
41,755,276
'runtimes' Folder after Publishing a .Net Core App to Azure Publish Via VS Online
<p>What is the purpose of the 'runtimes' folder that gets published along with all my project files? I have a VS Online account, and have the build/deploy process configured through there. The 'runtimes' folder is certainly not a folder that exists in source control or my project folder.</p> <p>'runtimes' folder con...
42,162,767
5
1
null
2017-01-20 02:50:21.753 UTC
1
2022-01-20 09:09:45.27 UTC
2017-01-20 04:11:52.51 UTC
null
4,758,255
null
3,444,821
null
1
29
asp.net-core|.net-core|azure-web-app-service
13,665
<p>These exist because you are building your application as a self contained application as opposed to one that is dependent upon the framework being installed on the machine executing it. Documentation can be found at <a href="https://docs.microsoft.com/en-us/dotnet/articles/core/deploying/" rel="noreferrer">https://...
41,740,632
How to change activity on bottom navigation button click?
<p>I want to use bottom navigation bar in my existing android app but the problem is all screen are activity ,is it possible to load activity without hiding the bottom navigation bar.</p> <p><strong>example:</strong> <strong>activity_main.xml</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;an...
43,256,816
2
2
null
2017-01-19 11:25:42.697 UTC
8
2018-06-18 20:37:28.283 UTC
2017-01-19 12:42:39.047 UTC
null
2,308,683
null
5,421,844
null
1
20
android|android-layout|android-fragments|android-bottomnav
44,966
<p>I have solved this problem in following way:</p> <p>1.Create one <strong>BaseActivity</strong> with bottom nav bar.</p> <pre><code> package com.example.apple.bottomnavbarwithactivity; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util....
34,881,775
Automatic cookie handling with OkHttp 3
<p>I am using okhttp 3.0.1. </p> <p>Every where I am getting example for cookie handling that is with okhttp2 </p> <pre><code>OkHttpClient client = new OkHttpClient(); CookieManager cookieManager = new CookieManager(); cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ALL); client.setCookieHandler(cookieManager); </c...
34,886,860
12
1
null
2016-01-19 16:19:45.387 UTC
25
2022-08-03 20:34:14.343 UTC
2022-08-03 20:34:14.343 UTC
null
1,457,596
null
2,672,763
null
1
54
java|cookies|okhttp
75,758
<p>right now I'm playing with it. try <a href="https://gist.github.com/franmontiel/ed12a2295566b7076161">PersistentCookieStore</a>, add gradle dependencies for <em>JavaNetCookieJar</em>:</p> <p><code>compile "com.squareup.okhttp3:okhttp-urlconnection:3.0.0-RC1"</code></p> <p>and init</p> <pre class="lang-js prettyp...
24,356,993
Removing special characters VBA Excel
<p>I'm using VBA to read some TITLES and then copy that information to a powerpoint presentation.</p> <p>My Problem is, that the TITLES have special characters, but Image files that I am also coping over do not.</p> <p>The TITLE forms part of a path to load a JPEG into a picture container. E.g. "P k.jpg", but the tit...
24,357,636
4
0
null
2014-06-23 00:23:15.073 UTC
8
2018-03-29 14:21:11.123 UTC
null
null
null
null
2,063,535
null
1
20
vba|excel|excel-2010
189,894
<p>What do you consider "special" characters, just simple punctuation? You should be able to use the <code>Replace</code> function: <code>Replace("p.k","."," ")</code>. </p> <pre><code>Sub Test() Dim myString as String Dim newString as String myString = "p.k" newString = replace(myString, ".", " ") MsgBox newStri...
42,648,610
Error when executing `jupyter notebook` (No such file or directory)
<p>When I execute <code>jupyter notebook</code> in my virtual environment in Arch Linux, the following error occurred.</p> <p><code>Error executing Jupyter command 'notebook': [Errno 2] No such file or directory</code></p> <p>My Python version is 3.6, and my Jupyter version is 4.3.0</p> <p>How can I resolve this issue?...
42,667,069
12
2
null
2017-03-07 12:41:09.983 UTC
19
2020-11-19 09:12:18.273 UTC
2020-07-14 02:08:55.74 UTC
null
6,355,435
null
6,355,435
null
1
126
python-3.x|jupyter-notebook
134,938
<p>It seems to me as though the installation has messed up somehow. Try running:</p> <pre><code># For Python 2 pip install --upgrade --force-reinstall --no-cache-dir jupyter # For Python 3 pip3 install --upgrade --force-reinstall --no-cache-dir jupyter </code></pre> <p>This should reinstall everything from PyPi. This...
41,497,871
Importing self-signed cert into Docker's JRE cacert is not recognized by the service
<ul> <li>A Java Service is running inside the Docker container, which access the external HTTPS url and its self-sign certificate is unavailable to the service/ JRE cacert keystore and therefore connection fails.</li> <li>Hence imported the self-signed certificate of HTTPS external URL into Docker container's JRE cacer...
41,499,582
3
0
null
2017-01-06 02:12:46.063 UTC
16
2021-10-25 14:11:53.817 UTC
2018-11-19 11:19:25.167 UTC
null
476,828
null
2,649,698
null
1
36
java|docker|https|docker-compose|docker-machine
65,023
<blockquote> <p>Hence imported the self-signed certificate of HTTPS external URL into Docker container's JRE cacert keystore.</p> </blockquote> <p>No: you need to import it into the Docker <em>image</em> from which you run your container.</p> <p>Importing it into the container would only create a <a href="https://d...
5,626,327
How to shift elements of an array to the left without using loops in matlab?
<p>I have a fixed sized array in Matlab. When I want to insert a new element I do the following: </p> <ol> <li>To make room first array element will be overwritten</li> <li>Every other element will be shifted at new location <code>index-1</code> ---left shift.</li> <li>The new element will be inserted at the place of...
5,626,350
3
1
null
2011-04-11 19:17:27.88 UTC
null
2016-02-25 14:04:39.363 UTC
2011-04-11 19:23:18.083 UTC
null
505,088
null
623,300
null
1
7
matlab
60,945
<p>I'm not sure I understand your question, but I think you mean this:</p> <pre><code>A = [ A(1:pos) newElem A((pos+1):end) ] </code></pre> <p>That will insert the variable (or array) <code>newElem</code> after position <code>pos</code> in array <code>A</code>.</p> <p>Let me know if that works for you!</p> <p><stro...
5,967,426
Select day of week from date
<p>I have the following table in MySQL that records event counts of stuff happening each day</p> <pre><code>event_date event_count 2011-05-03 21 2011-05-04 12 2011-05-05 12 </code></pre> <p>I want to be able to query this efficiently by date range AND by day of week. For example - "What is the event_c...
5,967,514
3
1
null
2011-05-11 16:16:30.147 UTC
6
2017-10-30 10:20:47.367 UTC
2011-05-11 16:27:08.13 UTC
null
560,648
null
156,477
null
1
27
mysql
52,697
<p>Use <a href="http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_dayofweek" rel="noreferrer">DAYOFWEEK</a> in your query, something like:</p> <pre><code>SELECT * FROM mytable WHERE MONTH(event_date) = 5 AND DAYOFWEEK(event_date) = 7; </code></pre> <p>This will find all info for Saturdays i...
5,987,242
How to search over huge non-text based data sets?
<p>In a project I am working, the client has a an old and massive(terabyte range) RDBMS. Queries of all kinds are slow and there is no time to fix/refactor the schema. I've identified the sets of common queries that need to be optimized. This set is divided in two: full-text and metadata queries.</p> <p>My plan is to ...
6,101,323
4
5
null
2011-05-13 04:31:07.2 UTC
11
2011-05-23 18:30:35.387 UTC
2011-05-16 20:27:43.78 UTC
null
49,881
null
49,881
null
1
36
c#|search|solr|nosql|ravendb
1,332
<p>Use <strong>MongoDB</strong> for your metadata store:</p> <ul> <li>Built-in <a href="http://www.mongodb.org/display/DOCS/Sharding" rel="nofollow">sharding</a></li> <li>Built-in replication</li> <li>Failover &amp; high availability</li> <li><a href="http://www.mongodb.org/display/DOCS/Querying" rel="nofollow">Simple...
1,526,912
Impossibly Fast C++ Delegates and different translation units
<p>According to Sergey Ryazanov, his <a href="https://www.codeproject.com/Articles/11015/The-Impossibly-Fast-C-Delegates" rel="nofollow noreferrer">Impossibly Fast C++ Delegates</a> are not comparable:</p> <blockquote> <p>My delegates cannot be compared. Comparison operators are not defined because a delegate doesn'...
1,526,972
2
1
null
2009-10-06 17:14:13.533 UTC
11
2019-04-01 07:53:39.747 UTC
2019-03-31 14:06:34.4 UTC
null
2,430,597
null
50,251
null
1
19
c++|delegates|language-lawyer|one-definition-rule
8,172
<p>The code is both standard compliant, and fine. I don't see any place where he violates ODR, and it is true that all instantiations of a function template with the same template parameters should have "the same address" (in a sense that pointers to functions should all be equal) - how this is achieved is not importan...
2,024,062
Is it possible to wildcard logger names in log4net configuration?
<p>In my application, I use log4net, with all types creating their own logger based on their type - e.g. :</p> <pre><code>private static readonly ILog Log = LogManager.GetLogger(typeof(Program)); </code></pre> <p>As I am developing, I leave the root logger on DEBUG so as to catch all log output from my code. </p> <p...
2,024,103
2
0
null
2010-01-07 22:11:33.997 UTC
3
2013-11-25 12:01:08.803 UTC
null
null
null
null
134,754
null
1
30
c#|.net|log4net
10,554
<p>You can just specify part of a namespace so it will apply to all messages within that namespace (including nested). </p> <p>Here is the example I often use:</p> <pre class="lang-xml prettyprint-override"><code> &lt;root&gt; &lt;level value="FATAL" /&gt; &lt;appender-ref ref="RollingFile" /&gt; &lt;/roo...
2,013,758
How to start doing TDD in a django project?
<p>I have read a lot of essays talking about benifits TDD can bring to a project, but I have never practiced TDD in my own project before.</p> <p>Now I'm starting an experimental project with Django, and I think maybe I can have a try of TDD.</p> <p>But what I find now is that I don't even know how to answer the ques...
2,016,334
2
0
null
2010-01-06 14:59:05.903 UTC
16
2013-12-05 13:23:57.987 UTC
null
null
null
null
225,262
null
1
39
django|tdd
8,829
<p>Your first step should be to read over the django test documentation...</p> <p><a href="http://docs.djangoproject.com/en/dev/topics/testing/#topics-testing" rel="noreferrer">http://docs.djangoproject.com/en/dev/topics/testing/#topics-testing</a></p> <p>After that your first test should be as simple as</p> <ul> <l...
46,009,471
Xcode 9 "no iTunes Connect account" error when uploading
<p>With a certain project in Xcode 9 beta 6 when I try to Upload to the App Store I get:</p> <p><a href="https://i.stack.imgur.com/Et9wt.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Et9wt.png" alt="enter image description here"></a></p> <p>I am the "Admin" role for this account.</p> <ul> <li>All contrac...
46,279,679
24
2
null
2017-09-02 00:38:39.653 UTC
12
2020-05-20 06:32:22.303 UTC
2017-09-02 18:56:24.26 UTC
null
2,904,769
null
2,904,769
null
1
50
xcode|app-store-connect
20,095
<p>I encountered the same issue with xCode 9 GM build and others reported it as well in xCode 10 and xCode 11. Deleting the derived data actually solved it for me. Hopefully it will help others as well.</p> <ol> <li>Close xCode</li> <li><code>rm -fr ~/Library/Developer/Xcode/DerivedData/ </code></li> <li>Reopen xCode ...
29,256,519
I implemented a trait for another trait but cannot call methods from both traits
<p>I have a trait called <code>Sleep</code>:</p> <pre><code>pub trait Sleep { fn sleep(&amp;self); } </code></pre> <p>I could provide a different implementation of sleep for every struct, but it turns out that most people sleep in a very small number of ways. You can sleep in a bed:</p> <pre><code>pub trait HasB...
29,256,897
3
1
null
2015-03-25 13:05:10.043 UTC
9
2022-09-24 04:25:10.697 UTC
2019-06-11 14:01:40.037 UTC
null
155,423
null
116,834
null
1
57
rust|traits
21,119
<p>You need to implement the second trait <em>for objects that implement the first trait</em>:</p> <pre><code>impl&lt;T&gt; Sleep for T where T: HasBed, { fn sleep(&amp;self) { self.sleep_in_bed() } } </code></pre> <p>Previously, you were implementing <code>Sleep</code> for the trait's type, bette...
29,282,457
equivalent to Files.readAllLines() for InputStream or Reader?
<p>I have a file that I've been reading into a List via the following method:</p> <pre><code>List&lt;String&gt; doc = java.nio.file.Files.readAllLines(new File("/path/to/src/resources/citylist.csv").toPath(), StandardCharsets.UTF_8); </code></pre> <p>Is there any nice (single-line) Java 7/8/nio2 way to pull off the s...
29,282,588
2
2
null
2015-03-26 15:25:59.633 UTC
8
2021-04-01 16:29:36.487 UTC
null
null
null
null
388,603
null
1
57
java|jar|nio2
35,646
<p>An <code>InputStream</code> represents a stream of bytes. Those bytes don't necessarily form (text) content that can be read line by line.</p> <p>If you know that the <code>InputStream</code> can be interpreted as text, you can wrap it in a <code>InputStreamReader</code> and use <a href="http://docs.oracle.com/javas...
6,295,148
What is the opposite of OOP?
<p>I started in High School learning java and python and I guess I just always learned OOP and nothing else my question is <strong>What are the other programming paradigms or types of programming languages beside OOP?</strong></p>
6,295,260
5
6
null
2011-06-09 15:15:51.863 UTC
14
2020-04-11 20:14:41.953 UTC
2017-01-18 08:17:20.053 UTC
null
-1
null
783,280
null
1
19
oop|paradigms
18,772
<p>"Opposite" isn't really a good way of putting it. What's the "opposite" of Democracy? OOP is a a paradigm -- a way of viewing the problem of programming.</p> <p>The four main coding paradigms are:</p> <ol> <li><strong>functional</strong> (viewing programs as mathematical formulas)</li> <li><strong>imperative</stro...
6,152,979
How can I create a new folder in asp.net using c#?
<p>How can I create a new folder in asp.net using c#? </p>
6,152,988
7
0
null
2011-05-27 13:34:00.787 UTC
4
2015-11-18 11:27:30.447 UTC
2011-09-05 11:46:59.577 UTC
null
508,702
null
773,175
null
1
24
c#|asp.net|directory
55,782
<p><code>path</code> is the variable holding the directory name</p> <pre><code>Directory.CreateDirectory(path); </code></pre> <p>You can read more about it <a href="http://msdn.microsoft.com/en-us/library/system.io.directory.createdirectory(v=VS.100).aspx" rel="noreferrer">here</a></p>
5,744,233
How to empty the content of a div
<p>Does someone know how to empty the content of a div (without destroying it) in JavaScript?</p> <p>Thanks,</p> <p>Bruno</p>
5,744,262
8
3
null
2011-04-21 12:40:18.25 UTC
8
2021-06-24 06:45:04.72 UTC
2011-04-21 12:42:33.967 UTC
null
20,578
null
422,667
null
1
38
javascript|html
118,375
<p>If your div looks like this: </p> <p><code>&lt;div id="MyDiv"&gt;content in here&lt;/div&gt;</code></p> <p>Then this Javascript: </p> <p><code>document.getElementById("MyDiv").innerHTML = "";</code> </p> <p>will make it look like this: </p> <p><code>&lt;div id="MyDiv"&gt;&lt;/div&gt;</code></p>
5,785,724
How to insert a row between two rows in an existing excel with HSSF (Apache POI)
<p>Somehow I manage to create new rows between two rows in an existing excel file. The problem is, some of the formatting were not include along the shifting of the rows. </p> <p>One of this, is the row that are hide are not relatively go along during the shift. What I mean is(ex.), rows from 20 to 30 is hidden, but w...
5,786,426
8
2
null
2011-04-26 03:53:31.26 UTC
21
2019-11-20 05:17:42.2 UTC
2011-05-31 15:08:03.04 UTC
null
761,828
null
527,577
null
1
58
java|excel|apache-poi|poi-hssf
116,892
<p>Helper function to copy rows shamelessly adapted from <a href="http://www.zachhunter.com/2010/05/npoi-copy-row-helper/" rel="noreferrer">here</a></p> <pre><code>import org.apache.poi.hssf.usermodel.*; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.util.CellRangeAddress; import java.io.FileInputS...
6,016,405
How to get a Facebook access token on iOS
<p>iOS beginner here. I have the following code:</p> <pre><code>[facebook authorize:nil delegate:self]; NSString *string1=[facebook accessToken]; NSLog(string1); </code></pre> <p>The log shows: <code>miFOG1WS_7DL88g6d95Uxmzz7GCShsWx_FHuvZkmW0E.eyJpdiI6IjNZZkFBY1c5ZnBaMGEzOWM2RzNKbEEifQ.LNjl06lsOQCO9ArVARqff3Ur2XQHku3...
6,016,470
10
0
null
2011-05-16 11:01:07.377 UTC
11
2019-09-20 08:01:50.123 UTC
null
null
null
null
584,432
null
1
36
iphone|facebook|access-token
49,308
<p>You can use delegate method:</p> <pre><code>- (void)fbDialogLogin:(NSString *)token expirationDate:(NSDate *)expirationDate </code></pre> <p>for more information you can refer to the following question :<a href="https://stackoverflow.com/questions/5151122/any-way-to-pull-out-session-key-from-access-token-returned...
6,028,750
How to assert an actual value against 2 or more expected values?
<p>I'm testing a method to see if it returns the correct string. This string is made up of a lot of lines whose order might change, thus usually giving 2 possible combinations. That order is not important for my application.</p> <p>However, because the order of the lines might change, writing just an Assert statement ...
6,028,873
15
0
null
2011-05-17 09:20:32.59 UTC
8
2022-04-21 17:01:22.13 UTC
2011-05-17 09:28:31.247 UTC
null
40,342
null
279,362
null
1
42
java|unit-testing|junit|assert
87,614
<p>Using the Hamcrest <a href="https://code.google.com/p/hamcrest/wiki/Tutorial" rel="noreferrer"><code>CoreMatcher</code></a> (included in JUnit 4.4 and later) and <code>assertThat()</code>:</p> <pre><code>assertThat(myString, anyOf(is(&quot;value1&quot;), is(&quot;value2&quot;))); </code></pre>
4,960,513
Using mod_rewrite to convert paths with hash characters into query strings
<p>I have a PHP project where I need to send a hash character (#) within the path of a URL. (<a href="http://www.example.com/parameter#23/parameter#67/index.php" rel="nofollow noreferrer">http://www.example.com/parameter#23/parameter#67/index.php</a>) I thought that urlencode would allow that, converting the hash to ...
19,616,196
1
5
null
2011-02-10 17:27:18.08 UTC
4
2017-09-19 16:47:09.187 UTC
2017-09-19 16:47:09.187 UTC
null
318,831
null
318,831
null
1
35
php|apache|mod-rewrite|hash|urlencode
36,861
<p>Encode the Hash in the URL with %23</p> <pre><code>http://twitter.com/home?status=I+believe+in+%23love </code></pre> <p>"I believe in #love"</p> <p>URL Encoding Reference: <a href="http://www.w3schools.com/tags/ref_urlencode.asp">http://www.w3schools.com/tags/ref_urlencode.asp</a></p>
5,119,994
get current user in Django Form
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/1202839/get-request-data-in-django-form">get request data in Django form</a> </p> </blockquote> <p>There's part of my Guest Model:</p> <pre><code>class Guest(models.Model): event = models.ForeignKey(Event,...
5,122,029
1
0
null
2011-02-25 16:45:21.047 UTC
12
2017-10-24 09:58:03.03 UTC
2017-05-23 12:03:05.203 UTC
null
-1
null
616,173
null
1
36
django-forms|django-users
43,103
<p>I found the way :)</p> <ol> <li><p>Write a <code>__init__</code> method on the form :</p> <pre><code>def __init__(self, user, *args, **kwargs): self.user = user super(RSVPForm, self).__init__(*args, **kwargs) </code></pre></li> <li><p>Change view function, and pass request.user to the form</p> <pre><code>...