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
50,430
CSS - Placement of a div in the lower left-hand corner
<p>I wish I were a CSS smarty .... </p> <p>How can you place a div container in the lower left-hand corner of the web page; taking into account the users scroll-position?</p>
50,442
1
0
null
2008-09-08 19:03:27.093 UTC
1
2017-02-20 17:19:24.917 UTC
2016-03-04 15:56:13.58 UTC
Brian Warshaw
996,815
deadbug
4,646
null
1
28
css|html|positioning
39,863
<p>To position an element relative to the "viewport" (the window or frame it's in), and have it ignore how that viewport is scrolled, you can use the <code>position: fixed;</code> property value (<a href="https://developer.mozilla.org/en/docs/Web/CSS/position#Fixed_positioning" rel="noreferrer">MDN documentation</a>). ...
44,447,232
Error while executing test, if using CreateResponse extention method to return Azure Function HttpResonseMessage
<p>My Azure Function code is like below</p> <pre><code>public static class MyHttpTriggerFunction { public static async Task&lt;HttpResponseMessage&gt; Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]HttpRequestMessage req, TraceWriter log) { // some business logic ...
44,447,349
2
0
null
2017-06-08 23:51:30.243 UTC
3
2017-09-18 09:48:28.977 UTC
2017-09-18 09:48:28.977 UTC
null
1,878,728
null
4,372,824
null
1
30
c#|unit-testing|azure|visual-studio-2017|azure-functions
13,984
<p>The Error message is telling you the problem.</p> <blockquote> <p>The request does not have an associated <strong>configuration</strong> object or the provided configuration was null.</p> </blockquote> <p>When testing the request out side of a httpserver you need to give the request a <code>HttpConfiguration.</c...
38,855,891
Angular Cli Webpack, How to add or bundle external js files?
<p>I am not sure how to include JS files (vendors) after switching Angular Cli from SystemJs to Webpack.</p> <p><strong>For example</strong></p> <p>Option A</p> <p><em>I have some js files that were installed via npm. Adding script tags to the head tag like this does not work. Nor does it seem like the best way.</em...
39,661,714
5
4
null
2016-08-09 16:20:01.047 UTC
22
2021-03-31 13:58:01.63 UTC
2017-11-29 14:53:57.95 UTC
null
1,949,099
null
1,949,099
null
1
87
javascript|angular|angular-cli
103,402
<p><strong>Last tested using angular-cli 11.x.x with Angular 11.x.x</strong></p> <p>This can be accomplished using <code>scripts:[]</code> in <code>angular.json</code>.</p> <pre><code>{ &quot;project&quot;: { &quot;version&quot;: &quot;1.0.0&quot;, &quot;name&quot;: &quot;my-project&quot; }, &quot;apps&qu...
38,757,538
Android Design Layout ListItem RecyclerView Horizontal
<p>I am using the tools:listitem attribute to show my views in the design layout with a recyclerview. Problem is, they always show up in a vertical list. Is there a way to have the Design Layout Editor display them horizontally?</p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/androi...
40,020,239
4
5
null
2016-08-04 02:24:53.743 UTC
3
2021-08-22 12:49:05.69 UTC
2016-10-16 22:54:23.427 UTC
null
796,231
null
796,231
null
1
28
android|xml|android-studio
11,301
<p>Please Check this code</p> <pre><code> &lt;android.support.v7.widget.RecyclerView android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" app:layoutManager="android.support.v7.widget.LinearLayoutManager" /&gt; </code></pre>
26,093,962
Can I change my Android app icon and name in later release?
<p>This is going to sound stupid in a way, but I want to know if it is possible to change the application logo (icon) and Android name in my subsequent releases?</p> <p>Say, today I push my app in the Android market, and tomorrow I want to change the logo/icon (I know I "should" not do this), but is it possible to do ...
26,094,044
5
0
null
2014-09-29 06:47:49.013 UTC
5
2020-12-26 01:17:35.727 UTC
2019-07-29 03:31:33.297 UTC
null
6,214,491
null
216,190
null
1
28
android|google-play|android-icons
52,711
<p>Yes, you can change the name and logo whenever you want by changing <code>android:label</code> and <code>android:logo</code> attribute of your application tag in <code>AndroidManifest.xml file</code>.</p> <p>But, you can't change <code>Package</code> name once you uploaded app on play store.</p>
54,839,672
Difference between Swagger & HATEOAS
<p>Can anyone explain difference between Swagger &amp; HATEOAS. I can Search many time but no buddy can explain the proper detailed answer this two aspects. </p>
54,841,309
3
0
null
2019-02-23 08:28:45.53 UTC
9
2021-08-18 18:40:19.753 UTC
null
null
null
null
10,870,476
null
1
18
rest|spring-mvc|swagger|spring-hateoas
10,484
<p>The main difference between Swagger and HATEOAS IMO, which is not covered in the accepted answer, is, that Swagger is only needed for RPC'esque APIs. Such APIs, however, have actually hardly anything to do with REST.</p> <p>There is a further, widespread misconception that anything exchanged via HTTP is automaticall...
7,283,134
What is the benefit of import in a namespace in R?
<p>The namespace mechanism of R allows one to <code>export</code> functions which then are visible to the user. Furthermore, it allows to <code>import</code> functions from other packages. Whereas the benefit of export is obvious, I have more problems understanding the benefit of import.</p> <p>One benefit seems to be...
7,283,511
1
0
null
2011-09-02 12:04:09 UTC
13
2013-05-23 01:09:39.02 UTC
null
null
null
null
289,572
null
1
30
r|namespaces|package
5,852
<p>If a function <code>foo</code> is imported from package Bar then it is found regardless of what the user does to their search path, e.g., by attaching a package Baz that also has a function <code>foo</code>. Without a name space, the package code would suddenly find itself using <code>Baz::foo</code>. There are also...
22,861,828
java string.getBytes("UTF-8") javascript equivalent
<p>I have this string in java: </p> <pre><code>"test.message" byte[] bytes = plaintext.getBytes("UTF-8"); //result: [116, 101, 115, 116, 46, 109, 101, 115, 115, 97, 103, 101] </code></pre> <p>If I do the same thing in javascript: </p> <pre><code> stringToByteArray: function (str) { str = unescap...
22,861,911
2
0
null
2014-04-04 11:40:36.003 UTC
2
2014-09-01 03:48:25.48 UTC
2014-04-04 11:49:53.183 UTC
user429620
null
user429620
null
null
1
13
java|javascript|utf-8|byte|utf-16
44,451
<p><em>JavaScript</em> has no concept of character encoding for <em>String</em>, everything is in <em>UTF-16</em>. Most of time time the value of a <code>char</code> in <em>UTF-16</em> matches <em>UTF-8</em>, so you can forget it's any different.</p> <p>There are more optimal ways to do this but</p> <pre><code>functi...
22,507,671
bootstrap datepicker change date event doesnt fire up when manually editing dates or clearing date
<pre><code>&lt;script type="text/javascript"&gt; // When the document is ready $(document).ready(function () { $('.datepicker').datepicker({ format: "yyyy-mm-dd", }).on('changeDate', function(ev){ // do what you want here $(this).datepicker('hide'); })...
22,507,814
11
0
null
2014-03-19 13:37:47.437 UTC
6
2021-08-30 18:24:34.843 UTC
2017-09-18 09:10:55.223 UTC
null
8,311,909
null
555,479
null
1
25
javascript|jquery|twitter-bootstrap|datepicker|bootstrap-datepicker
137,164
<p>You have to use the <code>change</code> event on the input itself if you want to respond to manual input, because the <code>changeDate</code> event is only for when the date is changed using the datepicker.</p> <p>Try something like this:</p> <pre><code>$(document).ready(function() { $('.datepicker').datepicke...
56,246,416
How can I configure NLog in .NET Core with appsettings.json instead of an nlog.config file?
<p>The NLog documentation explains how to configure NLog for .NET Core applications by using an <code>nlog.config</code> XML file. However, I'd prefer to have just one configuration file for my application - <code>appsettings.json</code>. For .NET Framework apps, it's possible to put the NLog configuration in <code>app...
56,246,417
3
0
null
2019-05-21 21:10:35.907 UTC
10
2022-02-01 18:01:41.657 UTC
2019-05-21 21:19:52.273 UTC
null
2,457,005
null
2,457,005
null
1
23
asp.net-core|.net-core|configuration-files|nlog
29,827
<p>Yes, this is possible but has a minimum version requirement. You must be using <strong>NLog.Extensions.Logging &gt;= 1.5.0</strong>. Note that for ASP.NET Core applications this will be installed as a dependency if you install <strong>NLog.Web.AspNetCore &gt;= 4.8.2</strong>.</p> <p>You can then create an <code>NLog...
56,275,425
Pandas: TypeError: '>' not supported between instances of 'int' and 'str' when selecting on date column
<p>I have a Pandas DataFrame with a column with TimeStamps. I can select date ranges from this column. But after I make change to other columns in the DataFrame, I can no longer and I get the error "TypeError: '>' not supported between instances of 'int' and 'str'".</p> <p>The code below reproduce the problem: </p> <...
56,275,604
3
0
null
2019-05-23 12:37:53.55 UTC
1
2021-12-23 12:06:02.307 UTC
2019-05-23 14:10:38.43 UTC
null
1,263,935
null
1,263,935
null
1
15
python|pandas
42,235
<p>You can compare a timestamp (<code>Timestamp('2000-01-01 00:00:00')</code>) to a string, pandas will convert the string to <code>Timestamp</code> for you. But once you set the value to <code>0</code>, you cannot compare an <code>int</code> to a <code>str</code>.</p> <p>Another way to go around this is to change ord...
41,904,806
How to upload a file to S3 and make it public using boto3?
<p>I am able to upload an image file using:</p> <pre><code>s3 = session.resource('s3') bucket = s3.Bucket(S3_BUCKET) bucket.upload_file(file, key) </code></pre> <p>However, I want to make the file public too. I tried looking up for some functions to set ACL for the file but seems like boto3 have changes their API and...
41,909,293
5
0
null
2017-01-27 23:45:09.767 UTC
17
2022-02-25 01:38:04.333 UTC
null
null
null
null
1,993,709
null
1
82
python|amazon-s3|boto|boto3
52,891
<p>I was able to do it using objectAcl API:</p> <pre><code>s3 = boto3.resource('s3') object_acl = s3.ObjectAcl('bucket_name','object_key') response = object_acl.put(ACL='public-read') </code></pre> <p>For details: <a href="http://boto3.readthedocs.io/en/latest/reference/services/s3.html#objectacl" rel="noreferrer">ht...
50,548,629
How to open an existing Flutter Project in Android Studio
<p>I might sound noob here but I can't see a clear way of opening existing Flutter Project in Android Studio <code>3.1.2</code>.</p> <p>I checked <a href="https://stackoverflow.com/questions/49067999/flutter-how-to-import-existing-flutter-project-as-a-gradle-project">this</a> but it didn't work. So I want to know if t...
50,548,664
7
0
null
2018-05-27 02:51:00.09 UTC
1
2021-09-19 04:53:44.65 UTC
2018-05-27 03:09:53.627 UTC
null
7,337,723
null
7,337,723
null
1
23
android-studio|flutter
42,213
<ol> <li><p>Install Flutter plugin for Android studio: <a href="https://flutter.io/get-started/editor/" rel="noreferrer">https://flutter.io/get-started/editor/</a></p></li> <li><p>Open Android Studio</p></li> <li><p>Open existing Android Studio project by using one of below methods:</p></li> </ol> <hr> <p><strong>EAS...
2,477,321
Sync GIT and ClearCase
<p>I am currently working on ClearCase and now migrating to GIT. But we need this migration in a way that all work will be done in GIT and the data will be synced backed to ClearCase stream. We will have the same branch names and stream names in both GIT and CC, so scripting shouldn't be a problem. The problem here is,...
2,478,707
3
0
null
2010-03-19 12:45:44.14 UTC
10
2016-08-12 14:29:48.65 UTC
null
null
null
null
289,715
null
1
13
git|clearcase|git-branch
19,141
<blockquote> <p>Have all the Vobs in CC as single repo in GIT, and have the major stream in CC as various branches in GIT</p> </blockquote> <p>No and yes</p> <blockquote> <p>Have important CC branches as independent GIT repositories and each repository having all the CC VOBs</p> </blockquote> <p>No and No</p> <...
3,105,003
Literal does not match format string for Oracle SQL to_date on a string column
<p>Dear SQL Gurus from Stack Overflow:</p> <p><strong>Environment:</strong> Oracle</p> <p>I'm trying to understand why I can't do a to_date selection on a table column that contains strings. Note tableZ with a column of name Value in the example below contains a bunch of strings, some of which are the correct format,...
3,105,218
4
0
null
2010-06-23 19:50:06.7 UTC
null
2013-11-27 10:16:57.18 UTC
null
null
null
null
129,735
null
1
6
sql|oracle|datetime|to-date
46,320
<p>The order that Oracle evaluates the conditions found in the where clause is not fixed. That is to say that it can choose to evaluate the condition containing TO_DATE before the other criteria, in which case the query will fail. To prevent that, add the ordered_predicates hint to your query, but be aware that this ...
2,877,436
How can I ask Maven for a list of the default repositories?
<p>What command can I use to ask Maven for a list of the default repositories that it searches for its dependencies? If no such command exists, where else may I look to find this default list?</p>
2,878,312
4
0
null
2010-05-20 20:11:31.757 UTC
7
2018-11-22 12:34:18.717 UTC
2010-07-27 10:28:17.13 UTC
null
342,852
null
107,158
null
1
32
java|maven-2|build-process
26,751
<p>on the command line, execute</p> <pre><code>mvn help:evaluate </code></pre> <p>then, when prompted, enter</p> <pre><code>${project.repositories} </code></pre> <p>see <a href="http://maven.apache.org/plugins/maven-help-plugin/evaluate-mojo.html" rel="noreferrer">http://maven.apache.org/plugins/maven-help-plugin/e...
2,618,989
How can I remove my last commit in my local git repository
<p>When I do a 'git pull', I have conflict with the head commit. So I did a 'git rebase --abort'</p> <p>Can I 'save' my commit to a "patch" and then do a git pull?</p> <p>What I want to emulate is:</p> <ul> <li>I did not commit, but I did a 'git stash' instead</li> <li>Do a git pull to avoid any merge error</li> </u...
2,619,068
4
0
null
2010-04-11 22:44:23.127 UTC
19
2016-01-12 19:40:17.317 UTC
2016-01-12 19:40:17.317 UTC
null
1,139,725
null
286,802
null
1
36
git
52,142
<p>Your <code>7826b2</code> patch will still cause a conflict when it's applied after pulling, but you can do the following:</p> <pre><code>git reset --soft HEAD^ git stash git pull git stash pop # Will cause a conflict git commit # Re-commit 7826b2 </code></pre> <p>Another workflow is also possible:</p> <pre><co...
31,909,664
Display phone numbers as left-to-right in right-to-left language
<p>I have a display of a users contact details where the user can alternate the display between left-to-right and right-to-left text.</p> <p><em>In the Arabic language, the text is displayed and read from right-to-left, but phone numbers, web addresses and email addresses are displayed and read left-to-right in Arabic...
31,909,788
3
0
null
2015-08-09 23:03:11.983 UTC
8
2021-12-10 00:06:37.277 UTC
null
null
null
null
1,261,774
null
1
20
html|css|right-to-left|left-to-right
10,627
<p>I just figured this out!</p> <p>I added the <code>unicode-bidi: embed;</code> to the <code>contact_dir_reverse</code> css class, like so:</p> <pre><code>.contact_dir_reverse { background-color: lime; direction: ltr; unicode-bidi: embed; } </code></pre> <p>I hope that this will help someone.</p>
32,029,094
how to make <svg> 100% width
<p>I am trying to make this <code>&lt;svg&gt;</code> element stretch to 100% of the screen width:</p> <pre><code> &lt;svg height="100" width="100"&gt; &lt;path d="M0 0 L100 0 L50 100 Z" /&gt; &lt;/svg&gt; </code></pre> <p>What do I need to do?</p>
32,029,371
1
0
null
2015-08-15 20:35:10.443 UTC
5
2018-12-18 10:06:17.19 UTC
2018-12-18 10:06:17.19 UTC
null
63,810
null
5,180,453
null
1
23
html|svg
39,106
<p>The viewBox defines the co-ordinates you can see. Height and width define the size of the SVG. E.g.</p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>html, body { width: 100%; height: 100%; }</code></pre> <p...
31,943,989
Spring Data JPA And NamedEntityGraphs
<p>currently I am wrestling with being able to fetch only the data I need. The findAll() method needs to fetch data dependant on where its getting called. I do not want to end up writing different methods for each entity graph. Also, I would avoid calling entitymanagers and forming the (repetitive) queries myself. Basi...
33,373,905
6
1
null
2015-08-11 14:03:07.6 UTC
22
2021-06-28 19:04:55.75 UTC
null
null
null
null
3,540,120
null
1
58
jpa|fetch|spring-data-jpa|entitygraph
52,527
<p>We ran into a similar problem and devised several prospective solutions but there doesn't seem to be an elegant solution for what seems to be a common problem.</p> <p>1) Prefixes. Data jpa affords several prefixes (find, get, ...) for a method name. One possibility is to use different prefixes with different named ...
28,417,140
Styling default JavaFX Dialogs
<p>I'm looking for a way to style the default JavaFX Dialog (<code>javafx.scene.control.Dialog</code>). </p> <p>I tried to get the DialogPane and add a stylesheet, but it covers only a small piece of the dialog. I would prefer to style only with an external css file and without to add styleClasses over the code. This ...
28,421,229
1
0
null
2015-02-09 18:53:16.56 UTC
11
2016-12-22 16:21:17.04 UTC
2016-12-22 16:21:17.04 UTC
null
1,266,705
null
1,266,705
null
1
35
javafx|dialog|javafx-8
41,385
<p>You can style your dialogs with your own css file, but for that you need to take into consideration that the dialog is in fact a new stage, with a new scene, and the root node is a <code>DialogPane</code> instance.</p> <p>So once you create some dialog instance:</p> <pre><code>@Override public void start(Stage pri...
51,389,042
Difference between auto_now and auto_now_add
<p>What I understood in <code>Django</code> models field's attributes is </p> <ul> <li><code>auto_now</code> - updates the value of field to current time and date every time the Model.save() is called.</li> <li><code>auto_now_add</code> - updates the value with the time and date of creation of record.</li> </ul> <p>...
51,389,274
5
0
null
2018-07-17 19:38:08.173 UTC
7
2021-11-10 09:04:06.903 UTC
2019-07-04 13:59:05.767 UTC
null
4,626,254
null
10,095,725
null
1
69
python|django|django-models|django-forms|django-templates
36,014
<p><code>auto_now</code> takes precedence (obviously, because it updates field each time, while <code>auto_now_add</code> updates on creation only). Here is the code for <a href="https://docs.djangoproject.com/en/2.0/_modules/django/db/models/fields/#DateField" rel="noreferrer"><code>DateField.pre_save</code></a> metho...
38,387,125
How do I make a fetch request using NSManagedObject's new fetchRequest function?
<p>In iOS 10 the CoreData team added a new "fetchRequest" method to NSManagedObject. It looks like this:</p> <pre><code>public class func fetchRequest() -&gt; NSFetchRequest&lt;NSFetchRequestResult&gt; </code></pre> <p>Which, from what I understand, allows us to replace this:</p> <pre><code>let request = NSFetchRequ...
38,387,472
2
0
null
2016-07-15 02:46:39.617 UTC
4
2017-01-24 07:45:57.92 UTC
null
null
null
null
1,664,443
null
1
30
ios|core-data|nsfetchrequest|swift3|xcode8-beta2
15,815
<p>Ok, I figured out two ways of doing this. The <strong>first approach</strong>, which is similar to my example code is just simply:</p> <pre><code>var moc: NSManagedObjectContext! let request = MyEntity.fetchRequest() var results : [MyEntity] do { results = try moc.fetch(request) } catch { // error stuff} </...
470,040
boost::bind with functions that have parameters that are references
<p>I noticed that when passing reference parameters to boost bind, those parameters won't act like references. Instead boost creates another copy of the member and the original passed in variable remains unchanged. </p> <p>When I change the references to pointers, everything works ok.</p> <p>My question is:</p> <p>...
470,053
2
0
null
2009-01-22 17:19:34.45 UTC
4
2014-01-13 18:18:14.433 UTC
2009-07-11 18:49:28.973 UTC
null
95,735
Brian R. Bondy
3,153
null
1
31
c++|boost-bind
23,207
<p>The <a href="http://www.boost.org/doc/libs/1_37_0/libs/bind/bind.html#with_functions" rel="noreferrer">boost documentation for bind</a> suggests that you can use boost::ref and boost::cref for this.</p>
2,636,068
Hide cursor in Chrome (and IE)
<p>I have the following CSS that hides the mouse cursor for anything on the web page. It works perfectly in Firefox, but in IE and Chrome, it doesn't work.</p> <pre><code>html { cursor: none; } </code></pre> <p>In Chrome, I always see the mouse pointer. In IE, however, I see whatever cursor was last 'active' when...
2,636,106
6
7
null
2010-04-14 08:55:52.397 UTC
6
2021-12-23 15:42:47.293 UTC
2021-12-23 15:42:47.293 UTC
null
4,294,399
null
94,278
null
1
18
html|css|mouse-cursor
38,117
<p>This property <code>cursor:none;</code> isn't part of the standard</p> <p>See here <a href="http://www.w3schools.com/css/pr_class_cursor.asp" rel="noreferrer">w3c cursor CSS properties</a>.</p> <p>You might want to look into hiding it with Javascript or JQuery.</p> <p>Also, look at blank cursor files <a href="htt...
2,578,930
Understanding this matrix transposition function in Haskell
<p>This matrix transposition function works, but I'm trying to understand its step by step execurtion and I don't get it.</p> <pre><code> transpose:: [[a]]-&gt;[[a]] transpose ([]:_) = [] transpose x = (map head x) : transpose (map tail x) </code></pre> <p>with </p> <pre><code>transpose [[1,2,3],[4,5,6],[...
2,578,979
7
1
null
2010-04-05 14:40:11.077 UTC
3
2022-06-22 15:15:37.27 UTC
2011-04-18 23:31:11.383 UTC
null
83,805
null
45,963
null
1
30
algorithm|list|haskell
19,844
<p>Let's look at what the function does for your example input:</p> <pre><code>transpose [[1,2,3],[4,5,6],[7,8,9]] &lt;=&gt; (map head [[1,2,3],[4,5,6],[7,8,9]]) : (transpose (map tail [[1,2,3],[4,5,6],[7,8,9]])) &lt;=&gt; [1,4,7] : (transpose [[2,3],[5,6],[8,9]]) &lt;=&gt; [1,4,7] : (map head [[2,3],[5,6],[8,9]]) : (...
2,932,421
Detect if a method was overridden using Reflection (C#)
<p>Say I have a base class TestBase where I define a virtual method TestMe()</p> <pre><code>class TestBase { public virtual bool TestMe() { } } </code></pre> <p>Now I inherit this class:</p> <pre><code>class Test1 : TestBase { public override bool TestMe() {} } </code></pre> <p>Now, using Reflection, I nee...
2,932,448
9
1
null
2010-05-28 20:47:28.133 UTC
17
2022-08-31 12:40:03.273 UTC
2013-08-24 13:13:30.44 UTC
null
126,014
null
151,200
null
1
63
c#|reflection|overriding
27,793
<p>Given the type <code>Test1</code>, you can determine whether it has its own <strike>implementation</strike> declaration of <code>TestMe</code>:</p> <pre><code>typeof(Test1).GetMethod("TestMe").DeclaringType == typeof(Test1) </code></pre> <p>If the declaration came from a base type, this will evaluate false.</p> <...
25,230,812
When should I use Docker's container name?
<p>When I ran <code>docker ps -a</code>, I got</p> <pre><code>CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES e3be2faeb751 centos:latest touch /var/log/test 2 minutes ago Exited (1) 2 minutes ago ...
25,231,029
3
0
null
2014-08-10 16:42:15.02 UTC
9
2021-02-22 16:55:25.553 UTC
2019-11-17 23:05:18.83 UTC
null
63,550
null
1,254,250
null
1
72
docker
79,287
<p>You can name your own containers with <code>--name</code> when you use <code>docker run</code>. If you do not provide a name, Docker will generate a random one like the one you have.</p> <p>Check their documentation for naming at <em><a href="https://docs.docker.com/network/links/#the-importance-of-naming" rel="nor...
23,587,862
How to get all elements into list or string with Selenium using C#?
<p>I've tried using WebElement (and IWebElement) and string lists, but I keep getting errors. How can I get a list or strings of all the elements text by classname? I have all Selenium references. Do I need some java.util dll? </p> <p>Should I implement a foreach loop?</p> <pre><code>IList&lt;IWebElement&gt; all = ne...
23,587,903
5
0
null
2014-05-11 01:00:30.437 UTC
2
2017-04-02 10:59:14.437 UTC
2017-04-02 10:59:14.437 UTC
null
617,450
null
3,609,872
null
1
6
c#|list|selenium|selenium-webdriver
71,293
<p>You can get all of the element text like this:</p> <pre><code>IList&lt;IWebElement&gt; all = driver.FindElements(By.ClassName("comments")); String[] allText = new String[all.Count]; int i = 0; foreach (IWebElement element in all) { allText[i++] = element.Text; } </code></pre>
6,087,716
Setting CSS position using Javascript
<p>How to set <code>relative 50% 50%</code> position using JS?</p> <p>I tried:</p> <pre><code>document.getElementById("id").style.position = "relative 50% 50%"; </code></pre> <p>but it don't seems to work...</p>
6,087,730
2
1
null
2011-05-22 11:46:24.03 UTC
1
2015-08-27 05:55:56.823 UTC
null
null
null
null
746,841
null
1
10
javascript|css
48,538
<p>You have to set them individually.</p> <p>I made a variable to point to the <code>style</code> object, because we are modifying more than one property and because <code>with() { ... }</code> is <a href="http://www.yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/" rel="noreferrer">considered harmful</a...
5,744,694
Extract matrix column values by matrix column name
<p>Is it possible to get a matrix column by name from a matrix?</p> <p>I tried various approaches such as <code>myMatrix["test", ]</code> but nothing seems to work.</p>
5,744,722
2
0
null
2011-04-21 13:20:52.177 UTC
11
2018-06-20 11:22:28.137 UTC
2018-06-20 11:22:28.137 UTC
null
680,068
null
356,790
null
1
53
r|matrix|subset
144,603
<p>Yes. But place your "test" after the comma if you want the column...</p> <pre><code>&gt; A &lt;- matrix(sample(1:12,12,T),ncol=4) &gt; rownames(A) &lt;- letters[1:3] &gt; colnames(A) &lt;- letters[11:14] &gt; A[,"l"] a b c 6 10 1 </code></pre> <p>see also <code>help(Extract)</code></p>
31,381,992
Java equivalent of Where Clause in C# Linq
<p>I can do this in C# : </p> <pre><code>int CheetahNumber = 77; Animal Cheetah = Model.Animals .Where(e =&gt; e.AnimalNo.Equals(CheetahNumber)) .FirstOrDefault(); </code></pre> <p>For example in Java I have <code>ArrayList&lt;Animal&gt; Animals</code></p> <p>How can I query such an ArrayList? Thanks.</p>
31,382,223
3
2
null
2015-07-13 11:20:00.187 UTC
9
2017-09-15 00:19:22.953 UTC
2017-09-15 00:19:22.953 UTC
null
57,611
null
1,954,132
null
1
32
java|lambda
37,519
<p>Java 8 introduces the <a href="http://www.oracle.com/technetwork/articles/java/ma14-java-se-8-streams-2177646.html">Stream API</a> that allows similar constructs to those in Linq.</p> <p>Your query for example, could be expressed:</p> <pre><code>int cheetahNumber = 77; Animal cheetah = animals.stream() .filter(...
32,998,902
MSVCP140.dll missing
<p>I just developed my first program in C++ and I wanted to share it with one of my friends.<br /> But when he tries to open the exe it gets an error which says &quot;MSVCP140.dll is missing&quot;. Why is this issue happening and how can we fix it?</p>
32,999,084
4
0
null
2015-10-07 17:37:48.367 UTC
23
2022-08-26 14:58:20.483 UTC
2022-08-26 14:58:20.483 UTC
null
5,323,015
null
5,323,015
null
1
67
c++|windows|visual-studio-2015
195,275
<p>Either make your friends download the runtime DLL (@Kay's answer), or compile the app with static linking.</p> <p>In visual studio, go to <code>Project tab -&gt; properties - &gt; configuration properties -&gt; C/C++ -&gt; Code Generation</code> on runtime library choose <code>/MTd</code> for debug mode and <code>/...
21,634,088
Execute "ffmpeg" command in a loop
<p>I have three <code>.wav</code> files in my folder and I want to convert them into <code>.mp3</code> with ffmpeg.</p> <p>I wrote this bash script, but when I execute it, only the first one is converted to mp3.</p> <p>What should I do to make script keep going through my files?</p> <p>This is the script:</p> <pre><cod...
21,634,265
3
0
null
2014-02-07 17:28:03.567 UTC
8
2021-01-07 17:33:51.363 UTC
2021-01-07 17:33:51.363 UTC
null
10,248,678
null
1,891,264
null
1
26
bash|ffmpeg
26,286
<p>No reason for <a href="/questions/tagged/find" class="post-tag" title="show questions tagged &#39;find&#39;" rel="tag">find</a>, just use <a href="/questions/tagged/bash" class="post-tag" title="show questions tagged &#39;bash&#39;" rel="tag">bash</a> wildcard globbing</p> <pre><code>#!/bin/bash for name in *.wav; ...
21,786,184
Setting up a 2D view in Three.js
<p>I'm new to <code>three.js</code> and am trying to set up what amounts to a 2D visualization (for an assortment of layered sprites) using these 3D tools. I'd like some guidance on the <code>PerspectiveCamera()</code> arguments and <code>camera.position.set()</code> arguments. I already have a nudge in the right direc...
21,787,531
1
0
null
2014-02-14 17:51:36.617 UTC
9
2020-01-21 07:14:29.717 UTC
2018-10-18 13:25:11.6 UTC
null
2,441,384
null
2,441,384
null
1
18
javascript|graphics|three.js|2d|perspectivecamera
19,433
<p>What is your goal? If you do not need perspective distortion, use the orthographic camera. Also just check the documentation:</p> <p><a href="https://threejs.org/docs/#api/en/cameras/PerspectiveCamera" rel="nofollow noreferrer">https://threejs.org/docs/#api/en/cameras/PerspectiveCamera</a></p> <p>View Angle/Fieldo...
35,361,467
TensorFlow: numpy.repeat() alternative
<p>I want to compare the predicted values <code>yp</code> from my neural network in a pairwise fashion, and so I was using (back in my old numpy implementation):</p> <pre><code>idx = np.repeat(np.arange(len(yp)), len(yp)) jdx = np.tile(np.arange(len(yp)), len(yp)) s = yp[[idx]] - yp[[jdx]] </code></pre> <p>This basic...
35,367,161
10
0
null
2016-02-12 11:28:07.753 UTC
9
2021-12-09 09:06:52.187 UTC
2016-02-12 17:06:42.05 UTC
null
2,680,707
null
2,680,707
null
1
44
tensorflow
37,284
<p>You can achieve the effect of <code>np.repeat()</code> using a combination of <a href="https://www.tensorflow.org/versions/r1.2/api_docs/python/tf/tile" rel="noreferrer"><code>tf.tile()</code></a> and <a href="https://www.tensorflow.org/versions/r1.2/api_docs/python/tf/reshape" rel="noreferrer"><code>tf.reshape()</c...
25,553,711
Disable magnification gesture in WKWebView
<p>I'm looking for a way to disable the "pinch to zoom" magnification gesture on the iOS implementation of WKWebView. There is a magnification BOOL property available for OS X but it doesn't seem to be available on iOS.</p> <p>WKWebView.h</p> <pre><code>#if !TARGET_OS_IPHONE /* @abstract A Boolean value indicating wh...
31,943,976
21
0
null
2014-08-28 16:31:14.533 UTC
17
2021-09-07 12:35:48.06 UTC
null
null
null
null
397,453
null
1
62
ios|webkit|ios8|wkwebview
52,699
<p>You can prevent your users from zooming by setting the delegate of your WKWebKit's UIScrollView and implementing <code>viewForZooming(in:)</code> as in the following:</p> <pre><code>class MyClass { let webView = WKWebView() init() { super.init() webView.scrollView.delegate = self } ...
8,450,817
Increase size of list-style-bullet type
<p>Is there a way to increase the size of <em>just</em> the bullet list-style-type using CSS? I don't want to increase the size of the bullet text, just the bullet type. I can't use images or JavaScript either. It has to be something I can embed inside <code>&lt;style&gt;</code> tags within the <code>&lt;head&gt;</c...
8,450,930
7
0
null
2011-12-09 19:40:51.813 UTC
2
2022-05-19 22:38:41.883 UTC
2015-12-11 16:55:05.167 UTC
null
2,301,450
null
773,202
null
1
27
css|html-lists
69,623
<p>Might not work in old version of IE.</p> <p><code>li:before{ content:'\00b7'; font-size:100px; }</code></p> <p><a href="http://jsfiddle.net/GuzCm/1/">Demo</a></p> <p><strong>For IE6:</strong></p> <p>Without javascript or images, I would recommend putting a <code>&lt;span&gt;&amp;#183;&lt;/span&gt;</code> in the ...
30,669,015
autoscroll of text and scrollbar in python text box
<p>I have a tkinter 'Text' and 'Scrollbar' working fine. In my program in the text window automatically lines will keep on adding. So When a new line of text is inserted and data reached out of limit I would like the text and scrollbar to be scrolled to the bottom automatically, so that the latest line of text is alway...
30,671,211
3
0
null
2015-06-05 14:24:38.653 UTC
4
2021-10-13 17:15:42.42 UTC
null
null
null
null
4,946,244
null
1
19
python|tkinter
46,820
<p>You can cause the text widget to scroll to any location with the <code>see</code> which takes an index.</p> <p>For example, to make the last line of the widget visible you can use the index <code>&quot;end&quot;</code>:</p> <pre><code>outputwindow.see(&quot;end&quot;) </code></pre> <p>Here's a complete working exam...
43,681,644
Is there a way to stop/disable a Google Cloud Function?
<p>I have running multiple Google Cloud functions. One is not operating well, so I want to stop them until I've fixed the situation.</p> <p>I have seen that I can remove the function, but is there a way to disable and later; enable the function?</p>
43,684,556
7
1
null
2017-04-28 13:39:45.64 UTC
3
2021-03-28 17:01:30.713 UTC
null
null
null
null
7,328,924
null
1
31
google-cloud-functions
17,727
<p>You cannot disable a function. Just comment the function body. It would be a good practice to log the call in the console and then return null so you can keep track whenever the function is invoked.</p>
1,217,772
C# Put string into TextBox
<p>I want to show the results of this code in my TextBox:</p> <pre><code> string txtout1 = txtOrgText.Text.Replace(parm, txtTo.Text).ToString(); txtout = txtout1; </code></pre> <p>I have a textbox, <code>txtOrgtext</code>, into which the user inputs text. I want to put some text into txtout now. I have s...
1,217,774
3
2
null
2009-08-01 23:29:52.56 UTC
1
2018-09-12 12:01:41.027 UTC
2017-04-29 15:43:01.273 UTC
null
543,538
null
149,130
null
1
7
c#
94,612
<p>What you need to do is:</p> <pre><code> txtout.Text = txtout1; </code></pre> <p>This is because <code>txtout1</code> is just a string of characters, while <code>txtout</code> is a full TextBox, with all the drawing and colouring and stuff like that.</p> <p>I see that you were on the right lines with your first li...
132,940
Why does Castle Windsor hold onto transient objects?
<p>Recently I noticed my application appears to be eating memory that never gets released. After profiling with CLRProfiler I've found that the Castle Windsor container I'm using is holding onto objects. These objects are declared with the lifestyle="transient" attribute in the config xml.</p> <p>I've found if I put a...
166,523
3
0
null
2008-09-25 12:16:08.73 UTC
8
2015-09-11 07:34:01.227 UTC
2015-09-11 07:32:34.89 UTC
null
542,251
Scott Langham
11,898
null
1
30
c#|castle-windsor
7,038
<p>I think the answers here are missing a vital point - that this behavior is configurable out of the box via release policies - check out the documentation on the castle project site <a href="http://www.castleproject.org/container/documentation/trunk/advanced/releasepolicy.html" rel="nofollow noreferrer">here</a>.</p>...
181,693
What are the complexity guarantees of the standard containers?
<p>Apparently ;-) the standard containers provide some form of guarantees.</p> <p>What type of guarantees and what exactly are the differences between the different types of container?</p> <p>Working from <a href="http://www.sgi.com/tech/stl/" rel="noreferrer">the SGI page</a> (about <a href="http://en.wikipedia.org/wi...
26,395,804
3
10
null
2008-10-08 07:35:11.323 UTC
168
2021-11-09 17:15:45.417 UTC
2021-11-09 17:15:45.417 UTC
Martin York
14,065
Martin York
14,065
null
1
178
c++|stl|containers|big-o
144,800
<p>I found the nice resource <em><a href="http://www.cs.northwestern.edu/~riesbeck/programming/c++/stl-summary.html" rel="noreferrer">Standard C++ Containers</a></em>. Probably this is what you all looking for.</p> <p><strong>VECTOR</strong></p> <p><strong>Constructors</strong></p> <pre><code>vector&lt;T&gt; v; ...
28,845,058
constexpr const vs constexpr variables?
<p>It seems obvious that constexpr implies const and thus it is common to see:</p> <pre><code>constexpr int foo = 42; // no const here </code></pre> <p>However if you write:</p> <pre><code>constexpr char *const str = "foo"; </code></pre> <p>Then GCC will spawn "warning: deprecated conversion from string constant to...
28,845,237
3
2
null
2015-03-04 01:13:55.137 UTC
16
2020-02-27 19:47:23.557 UTC
2020-02-27 19:47:23.557 UTC
null
1,410,669
null
1,442,517
null
1
65
c++|c++11|constants|constexpr
24,926
<p>The issue is that in a variable declaration, <code>constexpr</code> always applies the <code>const</code>-ness to the object declared; <code>const</code> on the other hand can apply to a different type, depending on the placement.</p> <p>Thus</p> <pre><code>constexpr const int i = 3; constexpr int i = 3; </code></...
20,606,432
Number validate at keypress
<p>I validate the phone number using below code its working fine but i allow char at first time while user entering the values. how i can solve it. . . .</p> <pre><code>$('.Number').keypress(function () { $('.Number').keypress(function (event) { var keycode; keycode = event.keyCode ? event.keyCode...
20,606,478
5
0
null
2013-12-16 08:34:40.347 UTC
1
2019-02-04 11:02:01.03 UTC
2013-12-16 08:38:48.543 UTC
null
2,074,608
null
2,830,895
null
1
5
javascript|jquery|asp.net-mvc|jquery-ui
42,132
<p>The first character is unrestricted because you have nested <code>keypress</code> handlers. Try this:</p> <pre><code>$('.Number').keypress(function (event) { var keycode = event.which; if (!(event.shiftKey == false &amp;&amp; (keycode == 46 || keycode == 8 || keycode == 37 || keycode == 39 || (keycode &gt;=...
24,320,237
change the text of the button on click using angular JS
<p>How I can change the text of the button on click of the button.</p> <p>Here it is what I have tried.</p> <p>HTML:</p> <pre><code>&lt;button ng-click="toggle = !toggle"&gt;Toggle!&lt;/button&gt; &lt;div class="box on" ng-show="toggle" ng-animate="'box'"&gt;On&lt;/div&gt; </code></pre> <p>JS:</p> <pre><code>funct...
24,320,257
4
0
null
2014-06-20 04:59:43 UTC
3
2016-10-24 21:54:44.843 UTC
2014-06-20 05:05:52.643 UTC
null
3,563,847
null
1,853,128
null
1
18
javascript|jquery|angularjs
49,793
<p>I think, using a watch of <code>toggle</code> should do it</p> <pre><code>&lt;button ng-click="toggle = !toggle"&gt;{{toggleText}}&lt;/button&gt; &lt;div class="box on" ng-show="toggle" ng-animate="'box'"&gt;On&lt;/div&gt; </code></pre> <p>then</p> <pre><code>app.controller('AppController', function ($scope) { ...
65,553,800
Why does an optional in fast enumeration cause an infinite loop?
<p>Evaluating the following code, I would expect a single printing of <code>Hello World</code>. Instead, it causes an infinite loop. Can someone explain why?</p> <pre><code>let array = [&quot;what&quot;] for text: String? in array { print(&quot;Hello World&quot;) } </code></pre> <p>(Removing the optional <code>?</c...
65,554,547
2
1
null
2021-01-03 19:07:55.413 UTC
3
2021-02-01 12:05:17.003 UTC
2021-01-03 20:28:04.387 UTC
null
14,531,220
null
3,749,617
null
1
30
swift
464
<p>This is an unexpected result, but it is happening because of the way Swift <code>for in</code> loops work under the hood.</p> <p><code>for in</code> takes a variable and a <code>Sequence</code>. Swift calls <code>makeIterator()</code> on the <code>Sequence</code> to get an <code>IteratorProtocol</code> which return...
5,765,962
How to execute a update statement using Oracle ODP.Net in C#
<p>I am using <code>Oracle.DataAccess.Client</code> to work with <strong>Oracle</strong> database in my <strong>ASP.Net</strong> application. There is no help documentation in <strong>MSDN</strong> for <strong>ODP.Net</strong> and <strong>Oracle</strong>'s documentation is really really bad. I am not able find the answ...
5,766,007
3
1
null
2011-04-23 18:09:03.29 UTC
2
2017-08-30 13:29:40.09 UTC
2017-08-30 13:29:40.09 UTC
null
7,920,473
null
399,186
null
1
9
c#|asp.net|odp.net
51,833
<p>I will need to check the exact syntax, but here is some quick code off the top of my head</p> <pre><code>using (OracleConnection con = new OracleConnection(...)) { con.Open(); OracleCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "update table set col1 = :param1, col...
5,642,021
Batch process all files in directory
<p>Right now i have a batch job I wrote that calls another file and passes in the variables that executable needs to run (password and filename). </p> <p>Ex:</p> <pre><code>&gt; cd f:\test\utils &gt; admin import-xml -Dimport.file=f:\DB\file1.xml -Dadmin.db.password=test123 </code></pre> <p>I wrote a job that does...
5,644,619
3
0
null
2011-04-12 21:48:01.993 UTC
5
2013-03-14 06:42:57.483 UTC
null
null
null
null
697,671
null
1
10
windows|batch-file|cmd
50,084
<pre><code>pushd C:\test\utils for %%F in (F:\DB\*.xml) do ( admin import-xml "-Dimport.file=%%~dpnxF" -Dadmin.db.password=test123 ) popd </code></pre> <p>The <code>%%~dpnxF</code> expands to <strong>d</strong>‎rive, <strong>p</strong>‎ath, base‎<strong>n</strong>‎ame and e‎<strong>x</strong>‎tension of the current...
5,746,319
Get cell contents of a selected row in a DataGridView
<p>I have a <code>DataGridView</code> populated from a database.</p> <p>I am trying to get the contents of the row that is selected on the <code>RowEnter</code> event. I have set the grid's selection mode to <code>FullRowSelect</code></p> <p>I have tried the following: </p> <pre><code>int orderId = (int)dgUnprocesse...
5,746,524
4
0
null
2011-04-21 15:31:22.843 UTC
1
2021-12-12 11:28:41.607 UTC
2011-06-21 15:02:13.383 UTC
null
556,595
null
705,803
null
1
8
c#|winforms|datagridview
62,222
<p>I've just tried this in a sample datagridview app and it works just fine so there must be something going on which you haven't told us about.</p> <p>First thing to do is break your one big statement up into discrete smaller statements so you can see exactly where the failure is.</p> <p>You can rewrite the code abo...
6,012,019
How to echo a custom object in PHP?
<p>Given a particular class, <code>TheClass</code>, with an instance <em>foo</em>, is there any way to have PHP <code>echo foo;</code> in a customized manner?</p> <pre><code>class TheClass { public $Name; public $Number; function MrFunction() { /* bla bla bla */ } } $foo = new TheClass(); echo $foo; </cod...
6,012,035
4
3
null
2011-05-15 23:42:12.523 UTC
4
2021-12-25 03:10:25.493 UTC
2021-12-25 03:10:25.493 UTC
user1228
578,023
null
578,023
null
1
24
php|class|object|echo
58,025
<pre><code>class TheClass { public $Name; public $Number; function MrFunction() { /* bla bla bla */ } public function __toString() { return $this-&gt;Name . ' '. $this-&gt;Number; } } echo $theClassInstance; </code></pre>
5,855,985
sass :first-child not working
<p>I have not been using SASS for a very long time and wanted to know if there are some issues with pseudo-elements such as <code>:first-child</code> or <code>:last-child</code> ?</p>
6,061,731
4
1
null
2011-05-02 10:19:47.973 UTC
2
2022-01-20 17:17:49.157 UTC
null
null
null
null
348,869
null
1
41
css|sass|pseudo-element
177,349
<p>While @Andre is correct that there are issues with pseudo elements and their support, especially in older (IE) browsers, that support is improving all the time.</p> <p>As for your question of, are there any issues, I'd say I've not really seen any, although the syntax for the pseudo-element can be a bit tricky, esp...
6,223,355
Static variables in member functions
<p>Can someone please explain how static variables in member functions work in C++. </p> <p>Given the following class:</p> <pre><code>class A { void foo() { static int i; i++; } } </code></pre> <p>If I declare multiple instances of <code>A</code>, does calling <code>foo()</code> on one instance inc...
6,223,371
4
0
null
2011-06-03 05:33:53.487 UTC
57
2020-06-26 14:25:53.79 UTC
2018-05-05 12:09:30.207 UTC
null
873,025
null
2,499,176
null
1
196
c++|static|scope
105,229
<p>Since <code>class A</code> is a non-template class and <code>A::foo()</code> is a non-template function. There will be only one copy of <code>static int i</code> inside the program.</p> <p>Any instance of <code>A</code> object will affect the same <code>i</code> and lifetime of <code>i</code> will remain through ou...
1,707,310
Is it possible to use ref types in C# built-in Action<> delegate?
<p>C# has built-in delegates <code>Action&lt;&gt;</code> and <code>Func&lt;&gt;</code>. Is it possible to use 'ref' type parameters for this delegates? For example, this code:</p> <pre><code>public delegate void DTest( ref Guid a ); public event DTest ETest; </code></pre> <p>Will compile. But if I use <code>Action&lt...
1,707,325
2
0
null
2009-11-10 11:31:22.86 UTC
9
2011-11-13 16:04:13.083 UTC
2009-11-10 11:35:47.393 UTC
null
5,380
null
69,882
null
1
45
c#
21,450
<p>No, you can't use pass-by-reference with the <code>Action</code> delegates. While there is a concept of "type passed by reference" as a <code>Type</code> in the framework, it's not really a type in the normal sense as far as C# is concerned. <code>ref</code> is a modifier for the parameter, not part of the type name...
1,379,247
Tell if a Django Field is required from template
<p>I'm rendering a form. I would like to put a mark next to all the fields that must be filled in. Simple stuff usually... but I've no idea how to access that information!</p> <pre><code>{% if field.required %}REQUIRED!!{% endif %} </code></pre> <p>doesn't bring any love...</p>
1,379,288
2
1
null
2009-09-04 13:26:59.11 UTC
9
2009-09-04 13:31:51.867 UTC
null
null
null
null
12,870
null
1
59
django|django-templates
17,723
<pre><code>{% if field.field.required %} </code></pre> <p>From <a href="http://www.djangosnippets.org/snippets/474/" rel="noreferrer">this snippet</a></p>
45,815,899
LocalNotification with AlarmManager and BroadcastReceiver not firing up in Android O (oreo)
<p><strong>I've got my local notifications running on androids prior to SDK 26</strong></p> <p>But in a Android O I've got the following warning, and the broadcast receiver is not fired.</p> <pre><code>W/BroadcastQueue: Background execution not allowed: receiving Intent { act=package.name.action.LOCAL_NOTIFICATION ca...
45,825,690
4
3
null
2017-08-22 11:03:23.683 UTC
10
2019-06-15 11:56:28.1 UTC
2019-06-15 11:56:28.1 UTC
null
8,375,325
null
1,894,850
null
1
25
android|broadcastreceiver|alarmmanager|android-8.0-oreo
19,505
<p>Android O are pretty new to-date. Hence, I try to digest and provide as accurate possible information.</p> <p>From <a href="https://developer.android.com/about/versions/oreo/background.html#broadcasts" rel="noreferrer">https://developer.android.com/about/versions/oreo/background.html#broadcasts</a></p> <ul> <li>Ap...
29,392,281
Manually trigger Django email error report
<p><a href="https://docs.djangoproject.com/en/1.7/howto/error-reporting/">Django error reporting</a> handles uncaught exceptions by sending an email, and (optionally) shows user a nice 500 error page. </p> <p>This works very well, but in a few instances I'd like to allow users to continue with their business uninterru...
29,878,519
6
0
null
2015-04-01 13:37:28.753 UTC
5
2020-12-15 15:20:33.63 UTC
null
null
null
null
236,195
null
1
35
python|django|exception-handling|django-email|django-errors
6,089
<p>You can use the following code to send manually an email about a <code>request</code> and an exception <code>e</code>:</p> <pre><code>import sys import traceback from django.core import mail from django.views.debug import ExceptionReporter def send_manually_exception_email(request, e): exc_info = sys.exc_info(...
53,674,529
Is there a way on VS Code to import Makefile projects?
<p>As the title said, can I populate automatically c_cpp_properties.json from an existing Makefile?</p> <p>Edit:</p> <p>For others trying to import makefiles, I have found a set of scripts that perform exactly what I wanted to achieve, the management of STM32 embedded projects through VS Code. If you dig into the scr...
53,687,462
4
3
null
2018-12-07 17:46:18.247 UTC
4
2020-07-11 08:19:44.817 UTC
2020-02-06 14:55:56.073 UTC
null
3,240,596
null
3,240,596
null
1
12
visual-studio-code|makefile|stm32|stm32cubemx
42,020
<p>This answer may not entirely give you what you want, but hopefully it helps you setting up your VS Code environment.</p> <p>In your question title, you mention "Makefile projects", which is an indication that you have the wrong impression that (GNU) Makefiles capture project settings in a way similar to Visual Stud...
5,832,693
regex to find a word before and after a specific word
<p>I need a regex that gives me the word before and after a specific word, included the search word itself.</p> <p>Like: "<em>This is some dummy text to find a word</em>" should give me a string of "dummy <strong>text</strong> to" when <strong>text</strong> is my search word.</p> <p>Another question, it's possible th...
5,833,319
5
3
null
2011-04-29 13:29:42.853 UTC
10
2020-05-22 13:25:51.16 UTC
2017-12-01 11:43:02.297 UTC
null
3,885,376
null
731,127
null
1
13
c#|regex
47,112
<p><strong>EDIT:</strong></p> <p>If you want to <em>grab all the content from the space before first word to the space after the word</em> use:</p> <pre><code>(?:\S+\s)?\S*text\S*(?:\s\S+)? </code></pre> <p>A simple tests:</p> <pre><code>string input = @" This is some dummy text to find a word in a string full ...
5,603,910
Define enums within a method in C#?
<p>I have mainly a C++ background and I am learning C#. So, I need some help with C# idioms and style.</p> <p>I am trying to write, in C#, a small text-file parsing method in which I need a simple state variable with three states. In C++ I would declare an <code>enum</code> like this for the state variable:</p> <pre ...
5,603,939
5
3
null
2011-04-09 08:45:42.677 UTC
1
2020-06-25 13:02:43.083 UTC
2016-06-10 13:49:25.257 UTC
null
1,497,596
null
19,884
null
1
29
c#|enums|coding-style
23,592
<p>The closest you can get is a private nested enum with in the class:</p> <pre><code>public class TheClass { private enum TheEnum { stHeader, stBody, stFooter } // ...the rest of the methods properties etc... } </code></pre>
6,032,032
How do I compute the non-client window size in WPF?
<p>WPF has the <a href="http://msdn.microsoft.com/en-us/library/system.windows.systemparameters.aspx" rel="noreferrer"><code>SystemParameters</code> class</a> that exposes a great number of system metrics. On my computer I have noticed that a normal window has a title that is 30 pixels high and a border that is 8 pixel...
6,032,318
5
1
null
2011-05-17 14:06:57.27 UTC
10
2020-05-29 10:01:42.947 UTC
2011-05-17 17:47:18.783 UTC
null
98,607
null
98,607
null
1
36
c#|.net|wpf|windows|winapi
10,443
<p>For a resizable window you need to use a different set of parameters to compute the size:</p> <pre><code>var titleHeight = SystemParameters.WindowCaptionHeight + SystemParameters.ResizeFrameHorizontalBorderHeight; var verticalBorderWidth = SystemParameters.ResizeFrameVerticalBorderWidth; </code></pre> <p>These s...
5,891,555
Display the date, like "May 5th", using pythons strftime?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/739241/python-date-ordinal-output">Python: Date Ordinal Output?</a> </p> </blockquote> <p>In Python time.strftime can produce output like "Thursday May 05" easily enough, but I would like to generate a string l...
5,891,598
5
4
null
2011-05-05 01:00:46.893 UTC
7
2011-05-05 15:27:19.23 UTC
2017-05-23 12:02:06.967 UTC
null
-1
null
565,879
null
1
43
python|strftime
34,471
<p><code>strftime</code> doesn't allow you to format a date with a suffix.</p> <p>Here's a way to get the correct suffix:</p> <pre><code>if 4 &lt;= day &lt;= 20 or 24 &lt;= day &lt;= 30: suffix = "th" else: suffix = ["st", "nd", "rd"][day % 10 - 1] </code></pre> <p><a href="http://snipplr.com/view/3468/pytho...
5,748,661
Most efficient way to check if an object is a value type
<p><strong>WARNING: THIS CODE SUCKS, SEE ANTHONY'S COMMENTS</strong></p> <p>Which is faster?</p> <p>1.</p> <pre><code> public bool IsValueType&lt;T&gt;(T obj){ return obj is ValueType; } </code></pre> <p>2.</p> <pre><code> public bool IsValueType&lt;T&gt;(T obj){ return obj == null ? false : obj....
5,748,763
6
8
null
2011-04-21 19:11:34.873 UTC
16
2021-07-28 14:11:18.023 UTC
2011-04-21 19:34:50.667 UTC
null
344,211
null
344,211
null
1
53
c#|.net|performance|value-type
64,413
<p>You aren't really testing an object - you want to test the <em>type</em>. To call those, the caller must know the type, but... meh. Given a signature <code>&lt;T&gt;(T obj)</code> the only sane answer is:</p> <pre><code>public bool IsValueType&lt;T&gt;() { return typeof(T).IsValueType; } </code></pre> <p>or if...
6,029,916
How to enable file sharing for my app?
<p>I have an image editing app where users can apply effects to photos. How could I enable it so that users can see my app in iTunes in the File Sharing tab and then just drag+drop photos to the app?</p> <p>Some of the eBook readers like Stanza works like this and it would be a cool option. Maybe someone can point out...
6,029,954
7
1
null
2011-05-17 11:07:36.977 UTC
56
2020-08-13 04:40:13.813 UTC
null
null
null
null
472,300
null
1
170
ios|file-sharing
161,876
<p>You just have to set <a href="https://developer.apple.com/documentation/bundleresources/information_property_list/uifilesharingenabled" rel="noreferrer"><code>UIFileSharingEnabled</code></a> (<code>Application Supports iTunes file sharing</code>) key in the info plist of your app. <a href="https://web.archive.org/we...
39,231,880
Kubernetes API - Get Pods on Specific Nodes
<p>Reading the <a href="http://kubernetes.io/docs/user-guide/labels/#selecting-sets-of-nodes" rel="noreferrer">Kubernets documentation</a> it looks to be possible to select a certain range of pods based on labels. I want to select all the pods on one node but I don't want to label each pod on their corresponding node.<...
50,811,992
6
1
null
2016-08-30 15:42:02.073 UTC
51
2022-01-26 14:44:42.117 UTC
2022-01-26 00:07:42.46 UTC
null
5,963,316
null
3,556,705
null
1
191
kubernetes|kubectl
152,005
<p>As mentioned in the accepted answer the PR is now merged and you can get pods by node as follows:</p> <pre><code>kubectl get pods --all-namespaces -o wide --field-selector spec.nodeName=&lt;node&gt; </code></pre>
5,365,464
MATLAB: Is it possible to overload operators on native constructs (cells, structs, etc)?
<p>I'm using cells to manage data in some stuff I'm working on. I'd like to be able to do things like:</p> <pre><code>A = cellfun( @(X)( randn( 5,5 ) ), cell( 5,1 ), 'UniformOutput', 0 ); B = cellfun( @(X)( randn( 5,5 ) ), cell( 5,1 ), 'UniformOutput', 0 ); %# %# Each of the following would fail if cell member dimens...
5,373,729
1
2
null
2011-03-19 22:50:29.383 UTC
14
2017-03-30 05:03:56.953 UTC
2017-03-30 05:03:56.953 UTC
null
52,738
null
549,246
null
1
17
matlab|operator-overloading|cell|arithmetic-expressions
2,876
<p>It is in fact possible to create new operators or overload existing ones for built-in data types in MATLAB. I describe one example of this in <a href="https://stackoverflow.com/a/2430278/52738">my answer</a> to another SO question about <a href="https://stackoverflow.com/q/2425251/52738">modifying the default overfl...
5,453,109
How to round all values in a matrix?
<p>I use the following method to store all my correlations in a matrix:</p> <pre><code>corrs &lt;- cor(dataset, use="pairwise.complete.obs") </code></pre> <p>But now I'd like to round the values to two digits after the comma. How can I do that? I just found a round function but don't know how to apply it to all value...
5,453,122
1
0
null
2011-03-27 23:07:21.31 UTC
1
2016-11-17 09:30:10.527 UTC
2011-03-27 23:10:36.673 UTC
null
142,162
anon
null
null
1
17
r|rounding
42,376
<p>Just as in your other question, use the function (<code>round</code>) you found :)</p> <pre><code>corrs &lt;- round(cor(dataset, use="pairwise.complete.obs"), 2) </code></pre> <p>For example:</p> <pre><code>&gt; round(cor(cars),2) speed dist speed 1.00 0.81 dist 0.81 1.00 </code></pre>
24,570,932
postgresql group by and inner join
<p>I want a query in SQL which does <code>INNER JOIN</code> and <code>GROUP BY</code> at the same time. I tried the following which doesn't work:</p> <pre><code>SELECT customer.first_name, SUM(payment.amount) FROM customer GROUP BY customer.customer_id INNER JOIN payment ON payment.customer_id = customer.customer_id; ...
24,571,047
2
1
null
2014-07-04 09:23:38.677 UTC
9
2019-03-27 22:09:20.39 UTC
null
null
null
null
3,797,850
null
1
28
sql|postgresql|group-by|inner-join
32,792
<p>First, <code>GROUP BY</code> comes at the end of the query (just before <code>order by</code> or <code>having</code> clauses if you have some).</p> <p>Then, all fields in the select which are not in an aggregation function must be in the group by clause.</p> <p>so</p> <pre><code>SELECT customer.first_name, SUM(pa...
24,497,881
boost::asio::spawn yield as callback
<p>I'm trying to rewrite a project using <code>boost::asio::spawn</code> coroutines. Some parts of the project cannot be changed. For example, the storage protocol library is also written with <code>boost::asio</code>, but without coroutines. </p> <p>The problem is how to convert <code>yield_context</code> into a norm...
24,645,114
4
1
null
2014-06-30 19:49:20.657 UTC
8
2022-08-13 17:31:09.633 UTC
2014-07-06 04:16:46.073 UTC
null
3,697,273
null
1,671,032
null
1
13
c++|boost|boost-asio|coroutine
5,359
<p>Looks like the best documentation for this feature can be found in a C++ standard proposal written by the boost asio author:</p> <p><a href="http://www.open-std.org/Jtc1/sc22/wg21/docs/papers/2014/n4045.pdf" rel="noreferrer">N4045 – Library Foundations for Asynchronous Operations, Revision 2</a></p> <p>See section...
19,674,311
JSON serializing Mongodb
<p>I am using the python package pymongo to retrieve data from a mongodb database.</p> <pre><code>&gt;&gt;&gt; r = collection.find() # returns an object of class 'Cursor' </code></pre> <p>Then I convert to a list</p> <pre><code>&gt;&gt;&gt; l = list(r) # returns a 'list' of 'dict' </code></pre> <p>her...
19,674,373
5
0
null
2013-10-30 05:09:45.743 UTC
11
2021-11-07 14:43:16.983 UTC
2020-05-20 06:44:02.597 UTC
null
958,409
null
482,711
null
1
32
python|mongodb|pymongo
67,608
<p>The pymongo documentation you pointed is obsolete. If you're using version 1.7 I recommend updating. With a more recent version you can do this:</p> <pre><code>from bson.json_util import dumps dumps(l) </code></pre> <p><a href="https://pymongo.readthedocs.io/en/stable/api/bson/json_util.html" rel="noreferrer">https...
42,358,448
How to backup git stash content?
<ul> <li>I have pending uncommitted works</li> <li>I need to switch to another branch for some urgent work</li> <li>As my current Work in Progress is not finished, I don't want to commit it. I use <code>git stash</code> to put it aside.</li> </ul> <p>Additionally, I would like to backup that stash content on a shared...
42,358,522
5
0
null
2017-02-21 04:02:53.143 UTC
9
2022-04-01 22:01:59.96 UTC
null
null
null
null
657,067
null
1
29
git
11,030
<p>You can get the diff by running show command:</p> <pre><code>git stash show -p &gt; stash.diff </code></pre> <p>This is the diff file which you can use as a backup.</p> <p>Later you can apply the diff to the existing repository:</p> <pre><code>git apply stash.diff # and potentially stash again: git stash </code>...
33,436,525
How to parse excel rows back to types using EPPlus
<p>EPPlus has a convenient <code>LoadFromCollection&lt;T&gt;</code> method to get data of my own type into a worksheet.</p> <p>For example if I have a class:</p> <pre><code>public class Customer { public int Id { get; set; } public string Firstname { get; set; } public string Surname { get; set; } pub...
37,746,915
2
0
null
2015-10-30 12:55:29.923 UTC
12
2016-06-10 12:14:42.227 UTC
2017-05-23 12:10:19.85 UTC
null
-1
null
2,952,809
null
1
35
c#|epplus
34,088
<p>Inspired by the above I took it a slightly different route. </p> <ol> <li>I created an attribute and mapped each property to a column. </li> <li>I use the DTO type to define what I expect each column to be</li> <li>Allow columns to not be requried</li> <li>Use EPPlus to convert the types</li> </ol> <p>By doing so...
41,573,283
Seaborn, violin plot with one data per column
<p>I would like to combine this violin plot <a href="http://seaborn.pydata.org/generated/seaborn.violinplot.html" rel="noreferrer">http://seaborn.pydata.org/generated/seaborn.violinplot.html</a> (fourth example with split=True) with this one <a href="http://seaborn.pydata.org/examples/elaborate_violinplot.html" rel="no...
41,575,149
2
0
null
2017-01-10 16:11:24.827 UTC
10
2017-07-21 08:36:10.083 UTC
null
null
null
null
1,421,907
null
1
10
python|seaborn
15,108
<p>If understand your question correctly, you need to reshape your dataframe to have it in long format:</p> <pre><code>df = pd.melt(df, value_vars=['A', 'B'], id_vars='Success') sns.violinplot(x='variable', y='value', hue='Success', data=df) plt.show() </code></pre> <p><a href="https://i.stack.imgur.com/IXNT9.png" re...
69,696,321
IntelliJ - Invalid source release: 17
<p>I've created a new Java project in IntelliJ with Gradle that uses Java 17. When running my app it has the error <code>Cause: error: invalid source release: 17</code>.</p> <p><strong>My Settings</strong></p> <p>I've installed <code>openjdk-17</code> through <code>IntelliJ</code> and set it as my <code>Project SDK</co...
70,215,091
10
0
null
2021-10-24 11:32:37.483 UTC
4
2022-08-24 20:02:30.053 UTC
null
null
null
null
2,934,534
null
1
76
java|gradle|intellij-idea|java-17
60,758
<p>In intellij just set Gradle JVM to Java version 17.</p> <p>&quot;File -&gt; Settings.. -&gt; Build, Execution, Deployment -&gt; Build Tools -&gt; Gradle&quot; there select your project and set Gradle JVM to your java 17.0.1</p>
23,116,330
MongoDB SELECT COUNT GROUP BY
<p>I am playing around with MongoDB trying to figure out how to do a simple</p> <pre><code>SELECT province, COUNT(*) FROM contest GROUP BY province </code></pre> <p>But I can't seem to figure it out using the aggregate function. I can do it using some really weird group syntax</p> <pre><code>db.user.group({ "key...
23,116,396
9
0
null
2014-04-16 17:34:52.713 UTC
64
2021-07-13 16:25:38.867 UTC
2020-04-13 15:38:23.5 UTC
null
1,108,305
null
150,062
null
1
296
mongodb|group-by|aggregation-framework
388,132
<p>This would be the easier way to do it using <a href="http://docs.mongodb.org/manual/reference/method/db.collection.aggregate/"><code>aggregate</code></a>:</p> <pre class="lang-js prettyprint-override"><code>db.contest.aggregate([ {"$group" : {_id:"$province", count:{$sum:1}}} ]) </code></pre>
20,219,796
bootstrap collapse menu disappears when resizing screen
<p>I used bootstrap menu for my app. It looks like this: <img src="https://i.stack.imgur.com/uTGot.png" alt="menu ok"> but when I change window size to smaller, it disappears - looks like this: <img src="https://i.stack.imgur.com/Pbwt4.png" alt="menu disappears"> It disappears when its about ~965px wide (so its probabl...
20,221,317
1
0
null
2013-11-26 14:28:06.79 UTC
2
2013-12-11 01:32:05.647 UTC
2017-05-23 12:34:24.807 UTC
null
-1
null
2,026,022
null
1
16
css|twitter-bootstrap|collapse
44,825
<p>If you do not want your navbar links to be collapsed on smaller devices, then you need to remove the <code>&lt;div class="nav-collapse collapse"&gt;</code> element.</p> <p>The basic structure should look something like this....</p> <pre><code>&lt;div class="navbar navbar-inverse navbar-fixed-top"&gt; &lt;div cla...
63,967,346
Install vue 3.0 in laravel
<p>Is there a way to install vue 3.0 to Laravel 8? When I run</p> <pre><code>npm install vue@next </code></pre> <p>It started installing Vue 3.0, but for some reason it also began installing <code>vue-template-compiler</code> v2.6.12. The following appears:</p> <blockquote> <pre><code> Additional dependencies must b...
63,968,220
2
0
null
2020-09-19 09:40:37.403 UTC
9
2022-05-13 11:06:46.823 UTC
2021-11-24 08:17:08.7 UTC
null
8,172,857
null
3,263,252
null
1
23
laravel|vue.js|webpack|vue-component|vuejs3
23,180
<p><strong><strong>Update 2022</strong></strong></p> <p><img src="https://i.stack.imgur.com/r3F27.png" alt="enter image description here" /></p> <p>For those who prefer <a href="https://vitejs.dev/" rel="nofollow noreferrer">Vite</a>, there's a tool called <a href="https://laravel-vite.dev/" rel="nofollow noreferrer">L...
53,448,450
How to resolve error "Failed to resolve: org.jetbrains.kotlin:kotlin-stdlib-jre7..." when building in Android Studio
<p>I've created a new project by checking the "include kotlin" box in Android Studio 3 and out of the box I get an error while compiling</p> <pre><code>"Failed to resolve: org.jetbrains.kotlin:kotlin-stdlib-jre7..." </code></pre> <p>I have made sure all plugins are up to date and that the Android SDK is properly inst...
53,448,758
2
0
null
2018-11-23 14:24:37.95 UTC
15
2020-05-12 15:03:38.413 UTC
2020-05-12 15:03:38.413 UTC
null
63,550
null
5,175,097
null
1
86
kotlin
71,823
<p><code>kotlin-stdlib-jre[7/8]</code> was deprecated a while ago, and has since been removed. The deprecation note was kept until <a href="https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-stdlib-jre7" rel="noreferrer">1.2.71</a>, which was the last version to release those artifacts. The official depreca...
19,017,555
SASS Math Calculation
<p>Trying to create a responsive grid of videos. Instead of using different %'s for each media query, I was hoping to use a standard SASS formula that calculates based on 100% width, however not sure if SASS can do this. The 40 in the below formula, takes into account 2 x 20px fixed margins (i.e this would be a 3-colum...
19,017,700
3
0
null
2013-09-26 00:51:04.227 UTC
8
2018-03-02 18:45:06.92 UTC
null
null
null
null
1,309,527
null
1
27
css|responsive-design|sass
80,684
<p>Unfortunately you can't subtract 40px from 33%. SASS generates a standard CSS file to be interpreted by the browser, and at build time SASS doesn't know the dimensions of the browser.</p> <p>However, you should be able to achieve the desired effect by using CSS margins, eg</p> <pre><code>ul.videos { li { wi...
26,715,634
Variables in nested Foreach-Object and Where-Object
<p>I'm wondering how to work with nested Forach-Object, Where-Object and other Cmdlets in Powershell. For example this code:</p> <pre><code>$obj1 | Foreach-Object { $obj2 | Where-Object { $_ .... } } </code></pre> <p>So in the code block of Foreach-Object I use the elements of <code>$obj1</code> as <code>$_</cod...
26,715,697
3
0
null
2014-11-03 13:44:38.077 UTC
4
2021-02-17 00:29:33.35 UTC
null
null
null
null
3,898,725
null
1
41
powershell
41,752
<p>afaik, You'll need to keep a reference to the outer loop by putting it in a local variable.</p> <pre><code>$obj1 | Foreach-Object { $myobj1 = $_ $obj2 | Where-Object { $_ .... } } </code></pre>
43,931,986
How to upgrade Angular CLI to the latest version
<p>Using <code>ng --version</code> I got:</p> <blockquote> <p>@angular/cli: 1.0.0</p> </blockquote> <p>which is not the latest release available.</p> <p>Since I have Angular CLI globally installed on my system, in order to upgrade it I tried:</p> <p><code>npm update angular-cli -g</code></p> <p>But it does not w...
43,931,987
10
0
null
2017-05-12 07:35:19.97 UTC
196
2022-08-09 08:30:30.233 UTC
null
null
null
null
3,497,671
null
1
102
angular|angular-cli
878,607
<p>After reading some issues reported on the GitHub repository, I found the solution.</p> <p>In order to update the angular-cli package installed globally in your system, you need to run:</p> <pre><code>npm uninstall -g @angular/cli npm install -g @angular/cli@latest </code></pre> <p>Depending on your system, you may n...
21,912,197
Setting Different error bar colors in bar plot in matplotlib
<p>Following <a href="https://stackoverflow.com/questions/18973404/settting-different-bar-color-in-matplotlib-python/18973430#18973430">Setting Different Bar color in matplotlib Python</a></p> <p>I would like to change the error bar colors. I have figured out a way after a number of attempts:</p> <pre><code>a = plt.g...
21,915,157
2
0
null
2014-02-20 15:26:56.213 UTC
4
2017-10-06 05:41:26.323 UTC
2017-10-06 05:41:26.323 UTC
null
6,885,902
null
691,867
null
1
28
python|matplotlib
44,275
<p>If you just want to set them to a single color, use the <code>error_kw</code> kwarg (expected to be a dict of keyword arguments that's passed on to <code>ax.errorbar</code>). </p> <p>Also, just so you know, you can pass a sequence of facecolors directly to <code>bar</code>, though this won't change the errorbar col...
21,464,918
Django bulk update with string replace
<p>I am trying to update and modify a string field Django's ORM. The equivalent SQL to do this is:</p> <pre><code>UPDATE example_table SET string_field = REPLACE(string_field, 'old text', 'new text'); </code></pre> <p>With that query, I expect <code>old text</code> and <code>old text more text</code> to be replaced ...
41,597,477
4
1
null
2014-01-30 18:42:13.007 UTC
8
2021-06-13 13:17:37.593 UTC
2017-05-23 10:30:49.21 UTC
null
-1
null
2,475,775
null
1
24
python|django|django-orm
12,591
<p>Tested with django 1.9</p> <pre><code>from django.db.models import F, Func, Value ExampleModel.objects.filter(&lt;condition&gt;).update( string_field=Func( F('string_field'), Value('old text'), Value('new text'), function='replace', ) ) </code></pre> <p><strong>UPDATE Django 2.1</str...
21,622,193
Python-3.2 coroutine: AttributeError: 'generator' object has no attribute 'next'
<p>Quoting from <em>Python Essential Reference</em>, by David Beazley, page 20:</p> <blockquote> <p>Normally, functions operate on a single set of input arguments. However, a function can also be written to operate as a task that processes a sequence of inputs sent to it. This type of function is known as a <em>corouti...
21,622,696
3
1
null
2014-02-07 07:54:13.93 UTC
5
2022-07-19 16:48:54.593 UTC
2022-07-19 16:48:54.593 UTC
null
523,612
user621819
null
null
1
42
python|python-3.x
67,504
<p>You're getting thrown off by the error message; type-wise, Python doesn't make a distinction - you can <code>.send</code> to anything that uses <code>yield</code>, even if it doesn't do anything with the sent value internally.</p> <p>In 3.x, there is no longer a <code>.next</code> method attached to these; instead,...
9,216,185
Nodejs Passport display username
<p>In nodeJS I am using the passport module for authentication. I would like to show the username of the currently logged in user.</p> <p>I tried the following code:</p> <pre><code>passport.displayName </code></pre> <p>and</p> <pre><code>Localstrategy.username </code></pre> <p>And for more info please also see: <a...
9,218,855
5
0
null
2012-02-09 17:57:36.43 UTC
11
2019-01-24 13:07:32.96 UTC
2015-06-24 14:16:57.343 UTC
null
2,297,345
null
1,177,899
null
1
28
node.js|passport.js
42,541
<p>The user (as supplied by the verify callback), is set as a property on the request at <code>req.user</code>.</p> <p>Any properties of the user can be accessed through that object, in your case <code>req.user.username</code> and <code>req.user.displayName</code>.</p> <p>If you're using Express, and want to expose t...
9,022,656
TypeError: unhashable type: 'numpy.ndarray'
<p>From a text file containing three columns of data I want to be able to just take a <code>slice</code> of data from all three columns where the values in the first column are equal to the values defined in <code>above</code>. I then want to put the slice of data into a new array called <code>slice</code> (I am using ...
9,022,915
2
0
null
2012-01-26 17:39:55.083 UTC
5
2018-12-26 09:41:40.513 UTC
2015-09-30 15:41:13.453 UTC
null
2,062,965
null
1,171,835
null
1
69
python|numpy
384,337
<p>Your variable <code>energies</code> probably has the wrong shape:</p> <pre><code>&gt;&gt;&gt; from numpy import array &gt;&gt;&gt; set([1,2,3]) &amp; set(range(2, 10)) set([2, 3]) &gt;&gt;&gt; set(array([1,2,3])) &amp; set(range(2,10)) set([2, 3]) &gt;&gt;&gt; set(array([[1,2,3],])) &amp; set(range(2,10)) Traceback...
33,993,461
PHP - remove all non-numeric characters from a string
<p>What is the best way for me to do this? Should I use regex or is there another in-built PHP function I can use?</p> <p>For example, I'd want: <code>12 months</code> to become <code>12</code>. <code>Every 6 months</code> to become <code>6</code>, <code>1M</code> to become <code>1</code>, etc.</p>
33,993,530
2
1
null
2015-11-30 07:29:00.13 UTC
18
2022-01-12 00:44:46.013 UTC
2022-01-12 00:44:46.013 UTC
null
2,370,483
null
2,884,981
null
1
107
php|string
160,600
<p>You can use <a href="http://php.net/manual/en/function.preg-replace.php" rel="noreferrer">preg_replace</a> in this case;</p> <pre><code>$res = preg_replace("/[^0-9]/", "", "Every 6 Months" ); </code></pre> <p>$res return 6 in this case.</p> <p>If want also to include decimal separator or thousand separator check ...
22,849,661
How to make Task.WaitAll() to break if any exception happened?
<p>I want to make Task.WaitAll() to break out if any of the running tasks throws an exception, so that I don't have to wait for 60 seconds to finish. How do I achieve such behavior? If WaitAll() cannot achieve that, is there any other c# feature or workaround?</p> <pre><code>Task task1 = Task.Run(() =&gt; throw new In...
22,851,991
4
1
null
2014-04-03 21:49:26.323 UTC
5
2019-12-04 17:01:31.15 UTC
2014-04-04 01:36:53.63 UTC
null
1,768,303
null
926,958
null
1
33
c#|task-parallel-library|task|async-await
9,247
<p>The following should do it without altering the code of the original tasks (untested): </p> <pre><code>static bool WaitAll(Task[] tasks, int timeout, CancellationToken token) { var cts = CancellationTokenSource.CreateLinkedTokenSource(token); var proxyTasks = tasks.Select(task =&gt; task.ContinueW...
7,641,130
Center text in table cell
<p>I can't seem to find the answer to my issue. I have a table with two rows and two columns (like the code shown below), how do I center align the text in specific cells. I would like to center align the text in one or two of the cells - not all the cells. </p> <pre class="lang-html prettyprint-override"><code>&lt;di...
7,641,142
2
0
null
2011-10-03 21:57:41.237 UTC
1
2017-07-10 17:44:59.747 UTC
2017-07-10 17:44:59.747 UTC
null
4,370,109
null
973,738
null
1
36
html|html-table|alignment|center
159,309
<p>I would recommend using CSS for this. You should create a CSS rule to enforce the centering, for example:</p> <pre><code>.ui-helper-center { text-align: center; } </code></pre> <p>And then add the <code>ui-helper-center</code> class to the table cells for which you wish to control the alignment:</p> <pre><cod...
31,414,106
Get list of Excel files in a folder using VBA
<p>I need to get the names of all the Excel files in a folder and then make changes to each file. I've gotten the "make changes" part sorted out. Is there a way to get a list of the <code>.xlsx</code> files in one folder, say <code>D:\Personal</code> and store it in a String Array.</p> <p>I then need to iterate throug...
31,428,399
6
4
null
2015-07-14 18:07:03.313 UTC
6
2020-02-13 17:50:05.44 UTC
2018-07-09 19:34:03.733 UTC
null
-1
null
5,020,807
null
1
31
vba|excel|excel-2010
235,785
<p>Ok well this might work for you, a function that takes a path and returns an array of file names in the folder. You could use an if statement to get just the excel files when looping through the array.</p> <pre><code>Function listfiles(ByVal sPath As String) Dim vaArray As Variant Dim i As I...
18,878,083
Can I use variables on an IPython notebook markup cell?
<p>I have an IPython notebook and I would like to use one of my variables inside a markup cell. Is this even possible? If so, how do you do it?</p>
19,328,029
4
0
null
2013-09-18 16:57:44.737 UTC
12
2019-10-20 05:26:32.053 UTC
2019-10-20 05:26:32.053 UTC
null
6,873,133
null
2,748,066
null
1
77
jupyter-notebook|ipython
69,612
<p><strike>Currently, this is not possible, however there is a large discussion on this topic here <a href="https://github.com/ipython/ipython/pull/2592" rel="noreferrer">https://github.com/ipython/ipython/pull/2592</a>.</strike> The PR is currently closed, but a corresponding issue is opened <a href="https://github.co...
19,101,361
iOS7 - Change UINavigationBar border color
<p>Is it possible to change the grey border-bottom color of the UINavigationBar in iOS7?</p> <p>I already tried to remove to border, but this is not working:</p> <pre><code>[[UINavigationBar appearance] setShadowImage:[[UIImage alloc] init]]; </code></pre> <p>Thanks!</p>
19,102,874
15
1
null
2013-09-30 18:37:36.337 UTC
21
2017-07-24 10:09:08.093 UTC
null
null
null
null
2,820,349
null
1
29
colors|border|uinavigationbar|ios7|xcode5
40,238
<p>This will help you :)</p> <pre><code>[self.navigationController.navigationBar.layer setBorderWidth:2.0];// Just to make sure its working [self.navigationController.navigationBar.layer setBorderColor:[[UIColor redColor] CGColor]]; </code></pre>
18,956,063
Memory usage of Docker containers
<p>I am using Docker to run some containerized apps. I am interested in measuring how much resources they consume (as far as regarding CPU and Memory usage).</p> <p>Is there any way to measure the resources consumed by Docker containers like RAM &amp; CPU usage?</p> <p>Thank you.</p>
18,979,217
4
1
null
2013-09-23 09:38:52.5 UTC
3
2022-04-29 11:37:13.193 UTC
null
null
null
null
577,598
null
1
42
memory|resources|cpu-usage|measurement|docker
24,436
<p>Update: See @Adrian Mouat's answer below as docker now supports <code>docker stats</code>! </p> <p>There isn't a way to do this that's built into docker in the current version. Future versions will support this via an api or plugin. </p> <ul> <li><a href="https://github.com/dotcloud/docker/issues/36" rel="norefe...
36,835,615
Difference between input-group and form-group
<p>What is the difference in use between the css classes <code>input-group</code> and <code>form-group</code> in Bootstrap?</p>
36,837,392
2
2
null
2016-04-25 08:38:06.8 UTC
22
2019-06-12 13:12:28.28 UTC
2019-06-12 13:12:28.28 UTC
null
2,440
null
5,520,621
null
1
68
html|twitter-bootstrap|twitter-bootstrap-3
49,572
<p>Input groups are extended Form Controls. Using input groups you can easily prepend and append text or buttons to the text-based inputs. For example, you can add the $ symbol, @ for a Twitter username, or anything else as required.</p> <p>Form groups are used to wrap labels and form controls in a div to get optimum ...
40,847,472
Why @Nonnull annotation checked at runtime?
<p>I have a function with following signature</p> <pre><code>public static String myFunction(@Nonnull String param) </code></pre> <p>When I call it with param as null, I get the following exception:</p> <pre><code>Caused by: java.lang.IllegalArgumentException: Argument for @Nonnull parameter 'param' of com/MyClass.m...
40,847,858
1
2
null
2016-11-28 15:06:47.16 UTC
10
2019-09-05 05:43:05.8 UTC
null
null
null
null
3,004,779
null
1
58
java|intellij-idea|non-nullable
14,288
<p>When you compile your project in IntelliJ IDEA, it instruments the bytecode of compiled classes to add runtime checks for various flavors of <code>@Nonnull</code> annotations. This behavior is controlled by the option:</p> <p>Settings | Build, Execution, Deployment | Compiler | [x] Add runtime assertions for not-nu...
18,278,774
Search Git remote all branches for file contents
<p>Is it possible to search all of my Git remote branches for specific file contents (not just a file, but contents within them)?</p> <p>My remotes are on GitHub, in case that helps...</p>
18,279,145
2
0
null
2013-08-16 17:14:11.173 UTC
10
2019-06-20 17:06:24.347 UTC
2019-06-20 17:03:39.18 UTC
null
63,550
null
418,864
null
1
21
git|github
11,049
<p>You can try this:</p> <pre><code>git grep 'search-string' $(git ls-remote . 'refs/remotes/*' | cut -f 2) </code></pre> <p>That will search all remote branches for <code>search-string</code>. Since the symbolic reference <code>HEAD</code> is mirrored, you may end up searching the same commit twice. Hopefully that...
1,053,396
Updating report parameters based on parameter selection? (SSRS)
<p>I've created a report in SSRS with two report parameters. I'd like the second to update it's values based on the selection in the first. The first is a list of sales agents, and the second is a list of distributors. Each agent can have many distributors.</p> <p>So if the report user selects an agent, I'd like only ...
1,053,407
4
0
null
2009-06-27 18:46:18.313 UTC
9
2016-09-14 16:54:53.893 UTC
2016-09-14 16:54:53.893 UTC
null
3,347,858
null
1,365
null
1
11
sql-server-2005|reporting-services
35,916
<p>This works automagically if you order your parameters and datasets correctly</p> <ul> <li>First, set up a primary (report) dataset, then a dataset for each parameter dropdown. Code the <code>WHERE</code> clause in the datasets to make the dependencies correct across parameter variables</li> <li>Secondly, order your...
1,333,922
CouchDB versioning strategy
<p>Would the following be a viable strategy for implementing versioning(using "example" as a sample document type):</p> <p>Have one original document where the type field is named example_original.</p> <p>Subsequent changes to the document all have type example_change and the id of example_original document as a key....
1,334,016
4
2
null
2009-08-26 11:02:44.277 UTC
12
2015-09-20 16:12:53.887 UTC
2009-08-26 11:46:08.807 UTC
null
146,325
null
53,943
null
1
23
versioning|couchdb|database-versioning|document-storage
12,378
<p>My first worry is: When &quot;getting&quot; a certain version, can you apply the changes to the original without modifying the database?</p> <p>Will you ever need to delete something from the history? Are you really sure? Really, really sure? How about branches?</p> <p>All in all, this looks like a complex strategy....
10,006
What is the easiest way to add compression to WCF in Silverlight?
<p>I have a silverlight 2 beta 2 application that accesses a WCF web service. Because of this, it currently can only use basicHttp binding. The webservice will return fairly large amounts of XML data. This seems fairly wasteful from a bandwidth usage standpoint as the response, if zipped, would be smaller by a facto...
10,162
4
1
null
2008-08-13 16:08:43.68 UTC
13
2017-06-14 11:14:01.457 UTC
2009-07-08 07:18:28.38 UTC
caryden
24,874
caryden
313
null
1
24
wcf|silverlight|compression|gzip
19,644
<p>If you are using IIS7, take a look at the <a href="http://blogs.iis.net/ksingla/archive/2006/06/13/changes-to-compression-in-iis7.aspx" rel="noreferrer">Compression Module</a>. This allows you to configure compression for HTTP requests to your server.</p>
23,702,982
how to get selected value for Kendo DropDownList
<p>I can't figure out how to determine which item is selected in the my kendo dropdownlist. My view defines it's model as:</p> <pre><code>@model KendoApp.Models.SelectorViewModel </code></pre> <p>The ViewModel is defined as:</p> <pre><code>public class SelectorViewModel { //I want to set this to the selected ite...
23,709,341
7
1
null
2014-05-16 19:13:49.003 UTC
2
2021-06-02 12:11:26.643 UTC
null
null
null
null
195,356
null
1
14
kendo-ui|kendo-dropdown
104,598
<p>Maybe you should be using the DropDownListFor construct of the Kendo DropDownList like so in your view:</p> <pre><code>@(Html.Kendo().DropDownListFor(m =&gt; m.EncSelected) .Name("EncounterTypes") .DataTextField("Description") .DataValueField("ID") ...