id
int64
4
73.8M
title
stringlengths
10
150
body
stringlengths
17
50.8k
accepted_answer_id
int64
7
73.8M
answer_count
int64
1
182
comment_count
int64
0
89
community_owned_date
stringlengths
23
27
creation_date
stringlengths
23
27
favorite_count
int64
0
11.6k
last_activity_date
stringlengths
23
27
last_edit_date
stringlengths
23
27
last_editor_display_name
stringlengths
2
29
last_editor_user_id
int64
-1
20M
owner_display_name
stringlengths
1
29
owner_user_id
int64
1
20M
parent_id
null
post_type_id
int64
1
1
score
int64
-146
26.6k
tags
stringlengths
1
125
view_count
int64
122
11.6M
answer_body
stringlengths
19
51k
43,790,137
Why can't type parameter in Kotlin have any other bounds if it's bounded by another type parameter?
<p>Here is the minimal demo code that shows this problem:</p> <pre><code>interface A fun &lt;T1, T2&gt; test() where T2 : T1, T2 : A {} </code></pre> <p>When I try to compile it, compiler will complain:</p> <blockquote> <p>Error:(81, 25) Kotlin: Type parameter cannot have any other bounds if it's bounded by another ty...
43,807,444
2
0
null
2017-05-04 18:19:31.26 UTC
7
2022-06-20 07:26:53.713 UTC
2020-06-20 09:12:55.06 UTC
null
-1
null
7,964,561
null
1
35
types|kotlin
2,468
<p>This restrictions was made because java(language) has it:</p> <pre><code> interface A {} // Error:(7, 26) java: a type variable may not be followed by other bounds &lt;T1, T2 extends T1 &amp; A&gt; void test() {} </code></pre> <p>And we suppose that this forbidden also in bytecode level. I dig into it and se...
204,140
Moving items in Dual Listboxes
<p>How can I move items from one list box control to another listbox control using JavaScript in ASP.NET?</p>
204,429
3
2
null
2008-10-15 09:20:18.74 UTC
9
2009-11-18 20:53:23.803 UTC
2009-07-28 02:03:12.18 UTC
keparo
16,587
balaweblog
22,162
null
1
18
asp.net|javascript|listbox|listbox-control
19,252
<p>This code assumes that you have an anchor or that will trigger to movement when it is clicked:</p> <pre><code>document.getElementById('moveTrigger').onclick = function() { var listTwo = document.getElementById('secondList'); var options = document.getElementById('firstList').getElementsByTagName('option');...
550,703
C#: Difference between ' += anEvent' and ' += new EventHandler(anEvent)'
<p>Take the below code:</p> <pre><code>private void anEvent(object sender, EventArgs e) { //some code } </code></pre> <hr> <p>What is the difference between the following ?</p> <pre><code>[object].[event] += anEvent; //and [object].[event] += new EventHandler(anEvent); </code></pre> <p><strong>[UPDATE]</stro...
550,708
3
4
null
2009-02-15 10:55:46.573 UTC
16
2015-07-03 13:28:32.283 UTC
2013-12-14 22:24:40.707 UTC
Dreas Grech
1,243,762
Dreas Grech
44,084
null
1
78
c#|delegates|event-handling
11,986
<p>There is no difference. In your first example, the compiler will automatically infer the delegate you would like to instantiate. In the second example, you explicitly define the delegate. </p> <p>Delegate inference was added in C# 2.0. So for C# 1.0 projects, second example was your only option. For 2.0 projects, t...
652,186
Why do Objective-C files use the .m extension?
<p>Since I started learning Objective-C and Cocoa, I've been wondering why they have chosen the extension .m for the implementation files - was it supposed to mean something, or was it just a random letter?</p>
652,266
3
3
null
2009-03-16 21:17:51.89 UTC
42
2019-06-26 12:48:41.657 UTC
2019-06-26 12:48:41.657 UTC
epatel
1,033,581
Psionides
78,255
null
1
231
objective-c|file-extension
78,045
<p>Today most people would refer to them as "method files", but</p> <blockquote> <p>"The .m extension originally stood for "<strong>m</strong>essages" when Objective-C was first introduced, referring to a central feature of Objective-C [...]"</p> </blockquote> <p>(from the book "<a href="https://rads.stackove...
28,856,326
Crontab - simple echo not running
<p>I've got such situation: I want to schedule a job with crontab on a linux server. I'm not super-user, so I'm editing (with crontab -l, editor vim) only my crontab file. For testing, I put there:</p> <pre><code>* * * * * echo asdf </code></pre> <p>And the job is not running. Is the restart of the server needed? Or ...
28,856,563
3
1
null
2015-03-04 13:57:42.463 UTC
4
2022-02-09 13:51:06.977 UTC
2015-03-04 17:09:24.69 UTC
null
827,263
null
3,117,006
null
1
33
linux|cron|scheduling
56,166
<p>May be it is, cron jobs will run in their own shell. So you can't expect to see <code>asdf</code> on your console.</p> <p>What you should try is </p> <pre><code>* * * * * echo asdf &gt; somefile_in_your_home_directory_with_complete_path.log </code></pre> <p>Next check the file by doing a tail:</p> <pre><code>tai...
20,883,868
WPF Caliburn.Micro and TabControl with UserControls issue
<p>I'm pretty sure this has been answered somewhere, but I can't seem to find it for the life of me.</p> <p>I'm trying to use a TabControl to switch between UserControls (each tab is different, so not using Items)</p> <p>Here's the breakdown: I have my mainview, and 3 usercontrols. Mainview has a tab control - each ...
20,885,027
2
0
null
2014-01-02 13:16:39.077 UTC
13
2021-10-27 17:50:57.653 UTC
null
null
null
null
773,165
null
1
14
c#|wpf|mvvm|tabcontrol|caliburn.micro
9,421
<p>May I suggest a tad different route?</p> <p>It's something that I have been successfully doing in master-details scenarios. Let's say you have a collection of child view models. I'll prepare a marker interface for all those items, of course you can add properties/methods you see fit if there are such methods that sp...
56,130,792
Will consteval functions allow template parameters dependent on function arguments?
<p>In C++17, this code is illegal:</p> <pre><code>constexpr int foo(int i) { return std::integral_constant&lt;int, i&gt;::value; } </code></pre> <p>That's because even if <code>foo</code> can be evaluated at compile-time, the compiler still needs to produce the instructions to execute it at runtime, thus making t...
56,131,418
3
3
null
2019-05-14 12:43:05.583 UTC
11
2019-06-03 14:55:45.743 UTC
2019-05-14 16:40:35.427 UTC
null
963,864
null
9,987,834
null
1
87
c++|language-lawyer|constexpr|c++20|class-template
4,107
<p>No. </p> <p>Whatever changes the paper will entail, which is little <a href="http://wg21.link/p1073" rel="noreferrer">at this point</a>, it cannot change the fact that a non-template function definition is only typed once. Moreover, if your proposed code would be legal, we could presumably find a way to declare a v...
19,855,426
Can Visual Studio 2013 generate CSS files from .less files?
<p>Visual Studio 2013 is awesome, now with syntax highlight and autocomplete for <code>.less</code> files. But does it also generate the respective CSS files? Do I need to install other extensions for that?</p>
19,855,623
6
0
null
2013-11-08 09:21:04.563 UTC
6
2021-07-26 20:34:28.06 UTC
2013-11-08 09:48:41.193 UTC
null
158,246
null
158,246
null
1
64
css|less|visual-studio-2013
40,067
<p>Yes. While Visual Studio 2013 doesn't come with a LESS compiler built-in (so you'll need to bring your own), you can either use an external compiler, or install an extension so you can compile your LESS files from within the IDE.</p>
5,719,538
Realtime Audio/Video Streaming FROM iPhone to another device (Browser, or iPhone)
<p>I'd like to get real-time video from the iPhone to another device (either desktop browser or another iPhone, e.g. point-to-point). </p> <p>NOTE: It's not one-to-many, just one-to-one at the moment. Audio can be part of stream or via telephone call on iphone. </p> <p>There are four ways I can think of...</p> <ol> ...
5,723,955
3
1
null
2011-04-19 16:23:23.97 UTC
17
2017-03-03 13:38:46.053 UTC
2017-05-23 12:00:10.983 UTC
null
-1
null
79,856
null
1
16
iphone|video-streaming|audio-streaming|http-live-streaming
11,367
<p>Sending raw frames or individual images will never work well enough for you (because of the amount of data and number of frames). Nor can you reasonably serve anything from the phone (WWAN networks have all sorts of firewalls). You'll need to encode the video, and stream it to a server, most likely over a standard s...
6,165,449
c++ error: invalid types 'int[int]' for array subscript
<p>Trying to learn C++ and working through a simple exercise on arrays. </p> <p>Basically, I've created a multidimensional array and I want to create a function that prints out the values.</p> <p>The commented for-loop within Main() works fine, but when I try to turn that for-loop into a function, it doesn't work and...
6,165,546
4
1
null
2011-05-29 01:38:46.46 UTC
null
2020-02-23 17:15:34.243 UTC
2017-09-18 09:28:46.543 UTC
null
2,350,638
null
774,799
null
1
8
c++
74,139
<p>C++ inherits its syntax from C, and tries hard to maintain backward compatibility where the syntax matches. So passing arrays works just like C: the length information is lost.</p> <p>However, C++ does provide a way to automatically pass the length information, using a reference (no backward compatibility concerns...
5,830,549
MVC: Iterating a Viewbag array in javascript
<p>The goal is to get the data from the <code>ViewBag.Array</code> to a Javascript array. The data is calculated in the controller so I cannot fetch it straight from the database. I need the data to draw a chart with jqplot. Code:</p> <pre><code>for(i = 0; i &lt; @ViewBag.Array.Length; i++) { jScriptArray[i] = @Vi...
5,830,594
4
0
null
2011-04-29 09:50:03.733 UTC
7
2020-01-27 14:00:53.15 UTC
2013-11-01 09:04:09.15 UTC
null
779,549
null
730,805
null
1
17
javascript|asp.net-mvc|arrays|razor|viewbag
40,106
<p>You may try the following:</p> <pre><code>var array = @Html.Raw(Json.Encode(@ViewBag.Array)); for(var i = 0; i &lt; array.length; i++) { jScriptArray[i] = array[i]; } </code></pre>
5,914,040
onBackPressed to hide Not destroy activity
<p>i know how to cancel back keypress, so that the activity / main window stays visible:</p> <pre><code>public void onBackPressed() { return; } </code></pre> <p>my aim is to hide the activity, however, without finishing it, how do you do that in the onBackPressed event? </p> <p>i.e. I would like to ...
5,914,566
4
0
null
2011-05-06 16:06:38.477 UTC
5
2016-02-24 10:11:09.477 UTC
null
null
null
null
742,084
null
1
28
android
34,243
<p>If you want to mimic the "Home" button on specific Activities just do this:</p> <p><strong>Below API 5</strong>:</p> <pre><code>@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { moveTaskToBack(true); return true; } return super.onK...
34,531,748
How to get the smallest in lexicographical order?
<p>I am doing a leetcode exercise</p> <p><a href="https://leetcode.com/problems/remove-duplicate-letters/" rel="noreferrer">https://leetcode.com/problems/remove-duplicate-letters/</a></p> <p>The question is:</p> <pre><code># Given a string which contains only lowercase letters, remove duplicate # letters so that eve...
34,531,894
6
1
null
2015-12-30 14:50:21.29 UTC
9
2016-05-29 12:20:41.187 UTC
2015-12-30 23:38:28.597 UTC
null
5,119,700
null
5,119,700
null
1
36
algorithm
67,273
<p>The smallest lexicographical order is an order relation where string <em>s</em> is smaller than <em>t</em>, given the first character of <em>s</em> (<em>s<sub>1</sub></em>) is smaller than the first character of <em>t</em> (<em>t<sub>1</sub></em>), or in case they are equivalent, the second character, etc.</p> <p>S...
29,790,070
Upgraded to AppCompat v22.1.0 and now getting IllegalArgumentException: AppCompat does not support the current theme features
<p>I've just upgraded my app to use the newly released v22.1.0 AppCompat and I'm now getting the following exception when I open my app.</p> <pre><code>Caused by: java.lang.IllegalArgumentException: AppCompat does not support the current theme features at android.support.v7.app.AppCompatDelegateImplV7.ensureSu...
29,790,071
4
0
null
2015-04-22 07:01:41.917 UTC
94
2020-08-10 12:37:13.253 UTC
2020-08-10 12:37:13.253 UTC
null
8,035,260
null
474,997
null
1
340
android|android-appcompat|illegalargumentexception
66,491
<p>AppCompat is now more strict on what it expect in theme window flags, more closely matching what you would get from the framework.</p> <p>The main reason behind this is to support <a href="https://developer.android.com/reference/android/support/v7/app/AppCompatDialog.html">AppCompatDialogs</a> which we were also ad...
32,364,579
Upstream / downstream terminology used backwards? (E.g. nginx)
<p>I've always thought of upstream and downstream along the lines of an actual stream, where the flow of information is like water. So upstream is where water/data comes from (e.g. an HTTP request) and downstream is where it goes (e.g. the underlying system that services the request).</p> <p>I've been looking at API g...
32,365,658
2
1
null
2015-09-02 23:06:21.82 UTC
41
2022-07-13 01:28:20.813 UTC
null
null
null
null
705,288
null
1
123
nginx|definition
29,860
<p>In HTTP world, the &quot;upstream server&quot; term was introduced in the HTTP/1.0 specification, <a href="https://www.rfc-editor.org/rfc/rfc1945#section-9.5" rel="noreferrer">RFC 1945</a>:</p> <blockquote> <p>502 Bad Gateway</p> <p>The server, while acting as a gateway or proxy, received an invalid response from <s...
32,296,209
Dependency Injection Unity - Conditional Resolving
<p>Conditional resolving is the last thing I don't understand at the moment.</p> <p>Lets say we have an interface <code>IAuthenticate</code>:</p> <pre><code>public interface IAuthenticate{ bool Login(string user, string pass); } </code></pre> <p>Now I have two types of authentication.</p> <p><strong>Twitter aut...
32,415,954
2
2
null
2015-08-30 11:45:41.757 UTC
17
2020-11-25 10:30:59.653 UTC
2018-01-30 21:30:26.257 UTC
null
181,087
null
1,395,676
null
1
20
c#|dependency-injection|inversion-of-control|unity-container
13,058
<p>A simple way to solve this is with the <a href="https://sourcemaking.com/design_patterns/strategy" rel="nofollow noreferrer">strategy pattern</a>. Note that you can add or remove login providers without changing the design - you simply need to change the DI configuration.</p> <h1>Interfaces</h1> <pre><code>public in...
5,978,519
How can I use setInterval and clearInterval?
<p>Consider:</p> <pre><code>function doKeyDown(event) { switch (event.keyCode) { case 32: /* Space bar was pressed */ if (x == 4) { setInterval(drawAll, 20); } else { setInterval(drawAll, 20); x += dx; } break; } } </code></...
5,978,560
5
0
null
2011-05-12 13:14:10.887 UTC
38
2022-08-12 21:59:43.96 UTC
2022-08-12 21:52:26.457 UTC
null
63,550
null
715,573
null
1
177
javascript|jquery
304,899
<p><code>setInterval</code> sets up a <em>recurring</em> timer. It returns a handle that you can pass into <code>clearInterval</code> to stop it from firing:</p> <pre><code>var handle = setInterval(drawAll, 20); // When you want to cancel it: clearInterval(handle); handle = 0; // I just do this so I know I've cleared ...
6,081,307
How to connect NetBeans to MySQL database?
<p>I have just installed NetBeans 7.0 and I am a newbie in NetBeans' world. can any one tell me how to connect my application to MySQl / Postgres ? I work on Windows XP.</p>
6,081,579
6
1
null
2011-05-21 11:10:41.077 UTC
3
2016-08-20 12:00:03.317 UTC
2015-07-20 04:36:04.16 UTC
null
720,176
null
720,176
null
1
6
java|mysql|postgresql|netbeans|jdbc
102,420
<p>In the <strong>Services</strong> window you can right click on the <strong>Databases</strong> tab and select <strong>New Connection</strong>. <img src="https://i.stack.imgur.com/6EJsq.png" alt="New Connection"></p> <p>Select <strong>MySQL(Connector/J Driver)</strong> from the drop down list. The driver file should ...
5,901,153
Compress large Integers into smallest possible string
<p>I have a bunch of 10 digit integers that I'm passing in a URL. Something like: "4294965286", "2292964213". They will always be positive and always be 10 digits. </p> <p>I'd like to compress those integers into the smallest possible form that can still be used in in a URL (aka letters and numbers are perfectly fine...
5,901,201
6
1
null
2011-05-05 16:31:41.187 UTC
8
2020-06-24 17:16:22.257 UTC
null
null
null
null
44,336
null
1
30
c#|asp.net|vb.net|compression
24,747
<p>Yes. GZIP is a <em>compression</em> algorithm which both requires compressible data and has an overhead (framing and dictionaries, etc). An <em>encoding</em> algorithm should be used instead.</p> <p><strong>The "simple" method is to use <a href="http://en.wikipedia.org/wiki/Base64" rel="noreferrer">base-64 encoding...
5,908,581
Is hash_map part of the STL?
<p>Quick question...Is hash_map part of the STL?</p>
5,908,859
6
3
null
2011-05-06 08:10:45.84 UTC
18
2019-03-11 23:41:00.003 UTC
2011-05-06 08:15:43.613 UTC
null
27,615
null
501,600
null
1
62
c++|stl|hashmap
95,967
<p><a href="http://www.sgi.com/tech/stl/" rel="noreferrer">The STL</a> has <a href="http://en.wikipedia.org/wiki/Hash_map_%28C++%29" rel="noreferrer"><code>hash_map</code></a>, but the C++ Standard Library <a href="http://jcatki.no-ip.org/fncpp/Resources" rel="noreferrer">does not</a>.</p> <p>Due to <a href="https://s...
5,857,386
How to avoid SQL injection in CodeIgniter?
<p>Is there any method to set in config file to avoid SQL injection? I am using this code for selecting values:</p> <pre><code>$this-&gt;db-&gt;query(&quot;SELECT * FROM tablename WHERE var='$val1'&quot;); </code></pre> <p>And this for inserting values:</p> <pre><code>$this-&gt;db-&gt;query(&quot;INSERT INTO tablename...
5,857,481
7
2
null
2011-05-02 12:55:26.367 UTC
25
2022-09-14 23:22:52.243 UTC
2022-09-14 23:22:52.243 UTC
null
1,839,439
null
667,030
null
1
42
function|codeigniter|sql-injection|built-in|data-security
57,283
<p>CodeIgniter's <a href="https://www.codeigniter.com/userguide2/database/active_record.html" rel="noreferrer">Active Record</a> methods automatically escape queries for you, to prevent sql injection.</p> <pre><code>$this-&gt;db-&gt;select('*')-&gt;from('tablename')-&gt;where('var', $val1); $this-&gt;db-&gt;get(); </c...
6,137,224
Immutable Object with ArrayList member variable - why can this variable be changed?
<p>I have got one class with various member variables. There is a constructor and there are getter-methods, but no setter-methods. In fact, this object should be immutable.</p> <pre><code>public class Example { private ArrayList&lt;String&gt; list; } </code></pre> <p>Now I noticed the following: when I get the va...
6,137,270
10
0
null
2011-05-26 10:39:30.87 UTC
16
2021-11-16 19:31:48.677 UTC
2015-05-11 11:46:56.373 UTC
null
4,554,061
null
669,356
null
1
23
java|object|immutability|member|getter-setter
43,796
<p>Just because <em>the reference</em> to the list is immutable doesn't mean that the list <em>it refers</em> to is immutable.</p> <p>Even if <code>list</code> was made <code>final</code> this would be allowed</p> <pre><code>// changing the object which list refers to example.getList().add("stuff"); </code></pre> <p...
5,741,101
Easy way to print Perl array? (with a little formatting)
<p>Is there an <strong>easy</strong> way to print out a Perl array with commas in between each element?</p> <p>Writing a for loop to do it is pretty easy but not quite elegant....if that makes sense.</p>
5,741,144
11
0
null
2011-04-21 07:48:32.977 UTC
16
2017-10-28 07:58:51.98 UTC
2017-02-05 20:21:38.62 UTC
null
6,862,601
null
455,612
null
1
103
perl
273,784
<p>Just use <a href="http://perldoc.perl.org/functions/join.html" rel="noreferrer"><code>join()</code></a>:</p> <pre><code># assuming @array is your array: print join(", ", @array); </code></pre>
5,784,652
Eclipse "Invalid Project Description" when creating new project from existing source
<p>I am trying to create a new project from existing source code. I keep getting the following error: "Invalid Project Description", project path "overlaps the location of another project" with the same name. The reason is that I created that project from the source code before, but then I deleted that project and dele...
5,784,712
22
10
null
2011-04-26 00:17:56.077 UTC
44
2021-03-04 06:45:58.403 UTC
2017-05-23 11:54:44.17 UTC
null
-1
null
724,195
null
1
252
android|eclipse
186,921
<p>Go into your workspace, and move your project source code folder to another area outside of your workspace (like the desktop). Make sure the project is deleted in eclipse, then create a new project from source from that directory.</p> <p>Another thing you could do is try creating a project of a different name (fro...
39,032,333
Get a value inside a Promise Typescript
<p>One of function inside a typescript class returns a <code>Promise&lt;string&gt;</code>. How do I unwrap/yield the value inside that promise.</p> <pre><code>functionA(): Promise&lt;string&gt; { // api call returns Promise&lt;string&gt; } functionB(): string { return this.functionA() // how to unwrap the value...
39,034,776
2
2
null
2016-08-19 06:22:09.053 UTC
1
2020-05-10 01:02:36.133 UTC
null
null
null
null
3,513,857
null
1
25
javascript|typescript|promise|es6-promise
59,240
<blockquote> <p>How do I unwrap/yield the value inside that promise</p> </blockquote> <p>You can do it with <code>async</code>/<code>await</code>.Don't be fooled into thinking that you just went from async to sync, async await it is just a wrapper around <code>.then</code>. </p> <pre><code>functionA(): Promise&lt;s...
44,714
How to have two remote origins for Git?
<p>Our git server will be local, but we want an server where our local repo is also kept online but only used in a <code>push</code> to fashion.</p> <p>How can one do that?</p>
44,738
1
0
null
2008-09-04 20:36:15.597 UTC
9
2021-10-09 14:16:37.387 UTC
2021-10-09 14:16:37.387 UTC
Ravi Chhabra
285,795
Ravi Chhabra
370,899
null
1
19
git
7,044
<p>You can add remotes with <code>git remote add &lt;name&gt; &lt;url&gt;</code></p> <p>You can then push to a remote with <code>git push &lt;name&gt; master:master</code> to push your local master branch to the remote master branch.</p> <p>When you create a repo with <code>git clone</code> the remote is named <code...
41,567,196
Ansible: How to add variables to "command" or "shell"
<p>Is it possible to use variables on <code>command</code> or <code>shell</code> modules? I have the following code, and I would like to use variable file to provide some configurations:</p> <p>I would like to read the Hadoop version from my variables file. On other modules of ansible I could use <code>{{ansible_versi...
41,567,971
3
0
null
2017-01-10 10:59:36.597 UTC
null
2020-02-13 09:09:45.367 UTC
2019-07-23 17:28:10.49 UTC
null
1,245,190
null
5,621,509
null
1
16
ansible|ansible-2.x
47,702
<p>Quote the full string in the <code>command</code> argument:</p> <pre><code>- name: Iniciar zkfc command: "{{ hadoop_version }}/sbin/hadoop-daemon.sh start zkfc" </code></pre>
47,239,332
Take the sum of every N rows in a pandas series
<p>Suppose </p> <p><code>s = pd.Series(range(50))</code></p> <pre><code>0 0 1 1 2 2 3 3 ... 48 48 49 49 </code></pre> <p>How can I get the new series that consists of sum of every n rows?</p> <p>Expected result is like below, when n = 5;</p> <pre><code>0 10 1 35 2 60 3 ...
47,239,367
2
0
null
2017-11-11 15:05:07.933 UTC
4
2021-02-04 15:53:09.94 UTC
2018-12-05 09:31:29.24 UTC
null
4,909,087
null
869,074
null
1
32
python|pandas
28,687
<h3><code>GroupBy.sum</code></h3> <pre><code>N = 5 s.groupby(s.index // N).sum() 0 10 1 35 2 60 3 85 4 110 5 135 6 160 7 185 8 210 9 235 dtype: int64 </code></pre> <p>Chunk the index into groups of 5 and group accordingly.</p> <hr /> <h3><code>numpy.reshape</code> + <code>sum</co...
30,081,491
Google Sheets ArrayFormula with Sumifs
<p>Usually don't need help with sheets but I think my brain is imploding from thinking on this too much.</p> <p>Trying to fill an entire column with an array formula that sums values from a separate column based on conditions from two other columns. If that sounds strange just check out <a href="https://docs.google.com...
30,105,877
3
0
null
2015-05-06 15:42:04.927 UTC
3
2022-05-14 12:27:07.29 UTC
2020-12-03 12:15:31.553 UTC
null
12,188,861
null
3,689,610
null
1
16
google-sheets|sumifs|array-formulas
39,342
<p>The solution that I ended up using was this:</p> <p>Credit due to 2n9 from google forums. Here is the <a href="https://productforums.google.com/forum/?utm_medium=email&amp;utm_source=footer#!msg/docs/OrriYjusT6k/2XSeq1FhH3oJ" rel="noreferrer">link</a></p> <p><code>=arrayformula(sumif(B3:B8&amp;C3:C8,F3:F8&amp;"A",...
9,445,489
performing HTTP requests with cURL (using PROXY)
<p>I have this proxy address: <code>125.119.175.48:8909</code></p> <p>How can I perform a HTTP request using cURL like <code>curl http://www.example.com</code>, but specifying the proxy address of my network? </p>
9,447,493
17
0
null
2012-02-25 15:47:56.51 UTC
147
2022-06-23 21:51:30.283 UTC
2017-08-22 20:27:13.393 UTC
null
5,780,109
null
873,286
null
1
559
linux|curl|proxy
1,256,420
<p>General way:</p> <pre><code>export http_proxy=http://your.proxy.server:port/ </code></pre> <p>Then you can connect through proxy from (many) application.</p> <p>And, as per comment below, for https:</p> <pre><code>export https_proxy=https://your.proxy.server:port/ </code></pre>
31,109,514
Making GCM work for iOS device in the background
<p>I'm trying to use GCM for IOS and Android clients. It seems to work fine with IOS when app is in the foreground, however, when the app is in the background, the notification center doesn't receive the message and <code>didReceiveRemoteNotification with completionHandler</code> doesn't get called.</p> <p>I identifie...
31,176,165
5
1
null
2015-06-29 06:56:27.937 UTC
18
2016-11-25 14:17:04.83 UTC
2016-11-25 14:17:04.83 UTC
null
1,678,420
null
4,665,643
null
1
26
ios|push-notification|apple-push-notifications|google-cloud-messaging
27,014
<p>For every poor soul wondering in quest for an answer to GCM background mystery. I solved it and the problem was in the format. I'm posting the right format as well as Java code needed to send Http request to GCM with some message. So the Http request should have two field in the header, namely:</p> <pre><code>Autho...
47,302,607
Meaning of H/5 in cron Jenkins
<p>I have a job with as cron:</p> <pre><code>5 3,21 * * 1-5 </code></pre> <p>This will run my job at 03:05AM and 09:05PM. Now I read it's a best practice to use <code>H</code>.</p> <p>I try:</p> <pre><code>H/5 3,21 * * 1-5 </code></pre> <p>What is the meaning now? Will this schedule a build in a range of 5 minutes...
47,302,727
1
1
null
2017-11-15 08:28:22.683 UTC
3
2022-04-15 14:29:19.09 UTC
null
null
null
null
6,077,803
null
1
31
jenkins|cron
64,766
<p>The <code>H</code> will take a numeric hash of the Job name and use this to ensure that different jobs with the same cron settings do not all trigger at the same time. This is a form of <a href="https://stackoverflow.com/questions/1336454/what-is-scheduling-jitter">Scheduling Jitter</a></p> <p><code>H/5</code> in th...
10,539,836
Access: Using query in VBA for recordset
<p>I have been accustomed to do recordssets in the following format:</p> <pre><code>Dim rs As DAO.Recordset Dim strSQL As String strSQL = "Select field1, field2 from myTable where field1 &gt; 30" Set rs = CurrentDb.OpenRecordset(strSQL) '... Do wahtever using rs. </code></pre> <p>Is it possible to use an already c...
10,539,987
1
1
null
2012-05-10 18:09:35.107 UTC
7
2012-05-10 19:07:44.58 UTC
2012-05-10 18:31:36.827 UTC
null
317,589
null
317,589
null
1
6
ms-access|vba
80,444
<p>You can either</p> <ul> <li><p>Use a query that has parameters and specify values for parameters provided that the query uses parameters.</p> <pre><code>Dim dbs As DAO.Database Dim qdf As DAO.QueryDef Dim prm As DAO.Parameter Dim rst As DAO.Recordset Set qdf = CurrentDb.QueryDefs("qry_SomeQueryWithParameters") q...
10,776,539
Comparing dates in MySQL ignoring time portion of a DateTime field
<p>I need to compare dates in MySQL ignoring the time portion in a <code>DateTime</code> column. I have tried the following SQL.</p> <pre><code>SELECT * FROM order_table where order_date=date_format('2012-05-03', '%Y-%m-%d'); </code></pre> <p>It doesn't retrieve any row even though there is a date <code>2012-05-03 10...
10,776,557
8
1
null
2012-05-27 19:10:22.787 UTC
9
2018-02-21 16:54:30.907 UTC
2013-11-27 21:40:00.01 UTC
null
1,391,249
null
1,391,249
null
1
50
mysql|date|datetime|date-comparison
60,575
<p>You could use the <a href="http://dev.mysql.com/doc/refman/5.6/en/date-and-time-functions.html#function_date" rel="noreferrer"><code>DATE</code></a> function:</p> <pre><code>SELECT col1, col2, ..., coln FROM order_table WHERE date(order_date) = '2012-05-03' </code></pre> <p>But this is more efficient, if your tabl...
7,446,301
Autowire reference beans into list by type
<p>I have one class that has a list of objects of <code>Daemon</code> type.</p> <pre><code>class Xyz { List&lt;Daemon&gt; daemons; } </code></pre> <p>My spring configuration looks like this.</p> <pre><code>&lt;bean id="xyz" class="package1.Xyz"&gt; &lt;property name="daemons" ref="daemonsList"&gt; &lt;/be...
7,446,351
2
2
null
2011-09-16 14:36:06.187 UTC
13
2019-07-18 16:36:26.607 UTC
2017-06-19 07:07:55.647 UTC
null
5,091,346
null
372,887
null
1
85
java|spring
77,535
<p>It should work like this (remove the ArrayList bean from your XML):</p> <pre><code>public Class Xyz { private List&lt;Daemon&gt; daemons; @Autowired public void setDaemons(List&lt;Daemon&gt; daemons){ this.daemons = daemons; } } </code></pre> <p>I don't think there's a way to do this...
18,998,671
Set Height and Width of Stage and Scene in javafx
<ul> <li>I develop one javafx application.</li> <li>In my application there are two scenes and one stage.</li> <li>In application the height and width for both scenes are same or constant.</li> <li>so as per my research the height and width for scene remain constant which mention in the constructor but the scene adjust...
19,589,004
3
1
null
2013-09-25 07:23:18.84 UTC
5
2016-12-20 11:55:13.91 UTC
null
null
null
null
2,732,483
null
1
18
java|javafx|stage|scene
100,951
<p>As I understand the problem above posted. I think the stage is good enough to set the preferred height and width as per the listener get the newer request to apply on the windows size. But it has some limitations, if you maximize or minimize the javaFX screen and will try to navigate to other screen then other scree...
35,735,762
What's the difference between `def` and `defp`
<p>I'm going through the Programming Phoenix book and I am wondering what the difference between <code>def</code> and <code>defp</code> is.</p> <p>There are several functions in my controller - most of them are actions like this:</p> <pre><code>def new (conn, _params) do ... end </code></pre> <p>The book had me create ...
35,735,871
2
1
null
2016-03-01 23:35:33.153 UTC
6
2021-08-14 21:45:11.577 UTC
2021-08-14 21:45:11.577 UTC
null
9,935,916
null
1,863,692
null
1
91
elixir
21,934
<p>From <a href="http://elixir-lang.org/getting-started/modules.html#named-functions" rel="noreferrer">Elixir’s documentation on functions within modules</a>:</p> <blockquote> <p>Inside a module, we can define functions with <code>def/2</code> and private functions with <code>defp/2</code>. A function defined with <cod...
21,141,817
Why are callbacks more "tightly coupled" than promises?
<p>Can you explain me the following phrase (taken from <a href="https://stackoverflow.com/a/6824836/196210">an answer to Stack Overflow question <em>What are the differences between Deferred, Promise and Future in Javascript?</em></a>)?</p> <p>What are the pros of using <a href="http://en.wikipedia.org/wiki/JQuery" re...
22,254,599
5
2
null
2014-01-15 15:43:28.623 UTC
18
2016-01-19 11:33:44.333 UTC
2017-05-23 11:53:24.403 UTC
null
-1
null
196,210
null
1
36
javascript|jquery|callback|promise
15,716
<p>I don't think promises are more or less coupled than callbacks, just about the same. </p> <p>Promises however have other benefits: </p> <ul> <li><p>If you expose a callback, you have to document whether it will be called once (like in jQuery.ajax) or more than once (like in Array.map). Promises are called always o...
2,001,920
Calling a class prototype method by a setInterval event
<p>I have a simple javascript class. </p> <p>One method of this class sets up a timer using setInterval function. The method that I want to call every time the event fires is defined inside the same class. </p> <p>The question is, how can I pass this method as a parameter to the setInterval function?</p> <p>One atte...
2,001,955
3
0
null
2010-01-04 20:16:03.017 UTC
8
2019-09-11 03:03:12.82 UTC
null
null
null
null
93,955
null
1
29
javascript
26,090
<p>setInterval can take a function directly, not just a string. <a href="https://developer.mozilla.org/en/DOM/window.setInterval" rel="noreferrer">https://developer.mozilla.org/en/DOM/window.setInterval</a></p> <p>i.e.</p> <pre><code>loadingTimer = setInterval(showLoading, 100); </code></pre> <p>But, for optimal br...
1,649,102
What is a sequence (Database)? When would we need it?
<p>Why would we create a sequence even if there is a primary key?</p>
1,649,126
3
0
null
2009-10-30 10:46:34.83 UTC
14
2020-09-10 14:59:01.377 UTC
2015-07-16 13:50:47.33 UTC
null
4,801,314
null
128,647
null
1
47
database
54,327
<p>The primary key is a column in a table.</p> <p>The primary key needs a unique value, which needs to come from somewhere.</p> <p>The sequence is a feature by some database products which just creates unique values. It just increments a value and returns it. The special thing about it is: there is no transaction iso...
8,452,586
Display a ul class when the mouse hovers over a li class css only
<p>I am currently looking into developing a CSS only drop down menu. The idea is when the mouse hovers over a ul tag it will make another ul class appear. </p> <p>Below is the code that I currently have. </p> <p><strong>HTML</strong></p> <pre><code>&lt;head&gt; &lt;link href="nav.css" rel="stylesheet" type="text/css...
8,453,171
2
1
null
2011-12-09 22:36:59.78 UTC
1
2011-12-10 02:05:47.223 UTC
null
null
null
null
499,448
null
1
1
html|css
48,089
<p>All you really need to do is nest the <code>&lt;ul&gt;</code> within your <code>&lt;li&gt;</code> element.</p> <pre><code>&lt;nav&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;Link&lt;/a&gt;&lt;/li&gt; &lt;li&gt; &lt;a href="#"&gt;Link&lt;/a&gt; &lt;ul&gt; &l...
8,753,286
Nerd tree: enter does not open sub dirs
<p>I installed NERDTree via Pathogen on Mac OSX 10.6.8. </p> <p>When I vim a dir, I cannot enter into sub dirs with enter key. Furthermore, the dirs look like this:</p> <pre><code>?~V? doc/ </code></pre> <p>What's going on?</p>
8,758,710
7
1
null
2012-01-06 04:14:09.34 UTC
12
2018-05-15 22:04:25.717 UTC
null
null
null
null
586,706
null
1
24
vim|nerdtree
12,635
<p>Putting this in my .vimrc solved the problem: <code>let g:NERDTreeDirArrows=0</code></p> <p>The creator gave me the fix: <a href="https://github.com/scrooloose/nerdtree/issues/108" rel="noreferrer">https://github.com/scrooloose/nerdtree/issues/108</a></p>
8,763,451
How to handle urllib's timeout in Python 3?
<p>First off, my problem is quite similar to <a href="https://stackoverflow.com/questions/2712524/handling-urllib2s-timeout-python">this one</a>. I would like a timeout of urllib.urlopen() to generate an exception that I can handle.</p> <p>Doesn't this fall under URLError?</p> <pre><code>try: response = urllib.re...
8,763,542
3
1
null
2012-01-06 19:36:45.01 UTC
11
2022-05-03 15:30:48.663 UTC
2017-05-23 12:34:04.717 UTC
null
-1
null
1,109,785
null
1
30
python|exception|urllib
76,491
<p>Catch the different exceptions with explicit clauses, and check the reason for the exception with URLError (thank you <a href="https://stackoverflow.com/users/356528/r%C3%A9gis-b">Régis B.</a>)</p> <pre class="lang-py prettyprint-override"><code>from socket import timeout try: response = urllib.request.urlopen(u...
8,785,624
How to safely wrap `console.log`?
<p>Suppose I want to include some calls to <code>console.log</code> for some legitimate production reason, say for something like a unit test harness. Obviously I would not want this to throw a premature exception if the browser doesn't have a <code>console</code>, or if <a href="https://stackoverflow.com/questions/547...
8,794,378
10
1
null
2012-01-09 08:32:32.31 UTC
10
2017-01-22 12:15:36.6 UTC
2017-05-23 12:17:28.077 UTC
null
-1
null
886,931
null
1
48
javascript|internet-explorer|console|logging|wrapper
28,123
<blockquote> <p>Can this log function be called normally on IE, and the use of apply here is just to show it's possible?</p> </blockquote> <p>Yes, and yes. That particular example was aimed squarely at the <em>"is it a real function"</em> part of the linked question.</p> <blockquote> <p>And, I assume from the li...
8,605,122
How do I resolve configuration errors with Nant 0.91?
<p>After downloading Nant 0.91, I'm getting some rather cryptic configuration errors relating to configuration or security (see below). </p> <p>I'm trying to simply upgrade my Nant executables from 0.86 to 0.91.</p> <p>How can I resolve the issues below when building on a Windows 7 machine?</p> <blockquote> <p>log...
8,605,149
4
1
null
2011-12-22 14:13:55.537 UTC
14
2021-03-05 06:09:40.47 UTC
2011-12-22 14:27:09.12 UTC
null
6,112
null
6,112
null
1
106
windows-7|build|log4net|nant
21,071
<p>Oddly enough, this is related to how the executables are extracted from the Nant 0.91 archive. (This made no sense to me until I actually tried it, but it does actually work...)</p> <p>Source : <a href="http://surfjungle.blogspot.com/2011/11/tip-running-nant-091-on-windows-7.html">http://surfjungle.blogspot.com/201...
8,839,958
How does origin/HEAD get set?
<p>I have a branch set up to track a ref in origin. <code>git checkout &lt;branchname&gt;</code> switches to that branch, and a <code>git status</code> will show me how far ahead or behind my branch is from origin, but I'm surprised that <code>origin/HEAD</code> still points at <code>origin/master</code>, and not <cod...
8,841,024
7
1
null
2012-01-12 18:03:15.96 UTC
83
2021-05-17 21:01:16.303 UTC
2012-01-12 18:48:06.02 UTC
null
37,838
null
37,838
null
1
187
git
234,086
<p>Note first that your question shows a bit of misunderstanding. <strong>origin/HEAD represents the default branch on the remote</strong>, i.e. the HEAD that's in that remote repository you're calling origin. When you switch branches in your repo, you're not affecting that. The same is true for remote branches; you mi...
27,221,795
Disable automatic doubling of quotes in Notepad++
<p>Notepad++ automatically places another quote if I type a single quote or double quote. How can I disable this?</p>
27,221,822
2
3
null
2014-12-01 04:39:07.497 UTC
1
2019-12-05 13:21:44.733 UTC
2019-12-05 13:21:44.733 UTC
null
2,932,052
null
1,165,493
null
1
31
notepad++|quotes
19,074
<p>Notepad++ has a setting that controls the auto-completion behavior. </p> <pre><code>Settings -&gt; Preferences -&gt; Auto-Completion -&gt;Auto-Insert </code></pre> <p><strong>Edit:</strong> </p> <p>Your requirement:</p> <blockquote> <p>We need to type quotes twice for them to appear and when they do appear, th...
19,619,425
What is the true difference between a real mode program and a protected mode program?
<p>I know the difference between a real mode and protected mode from the OS and hardware perspective. </p> <p>But I am trying to figure out What does a program 'knows' about real mode or protected mode? how can you say while looking at an source code/object code that it is a real mode program or not?</p> <p>Looking f...
19,630,884
3
1
null
2013-10-27 14:54:02.877 UTC
8
2013-10-28 10:06:29.7 UTC
2013-10-27 16:53:02.753 UTC
null
597,858
null
597,858
null
1
12
operating-system|protected-mode|real-mode
24,503
<p>a 'real mode' program uses BIOS subroutines along with OS subroutines whereas a 'protected mode' program uses only OS subroutines. </p> <p>instruction code differs since opcodes for registers are different and offset addresses are of different length.</p>
436,169
IIS7: Setup Integrated Windows Authentication like in IIS6
<p>This is for IIS 7 on a Windows Server 2008 that is not part of an AD domain. I would like to password protect a website, where people have to enter a username/password (a windows account for example) to view the website. The website would then use its own authentication method (forms) to handle user accounts and d...
437,758
4
0
null
2009-01-12 17:15:11.68 UTC
12
2013-05-22 13:28:31.92 UTC
null
null
null
Jim Geurts
3,085
null
1
52
authentication|iis-7|windows-authentication
150,751
<p>Two-stage authentication is not supported with IIS7 Integrated mode. Authentication is now modularized, so rather than IIS performing authentication followed by asp.net performing authentication, it all happens at the same time.</p> <p>You can either:</p> <ol> <li>Change the app domain to be in IIS6 classic mode....
37,357,605
Android Firebase Analytics Custom Events Reporting in Console
<p>Accept my apologies in advance if this is the incorrect place to post this question as I am unsure what would be.</p> <p>What I am trying to accomplish is to record a custom even using Firebase analytics that produces a similar report in the Firebase console to their example of the <code>select_content</code> event...
37,369,326
4
2
null
2016-05-21 00:16:49.363 UTC
3
2020-09-13 09:34:31.6 UTC
2016-05-22 00:12:33.63 UTC
null
1,489,990
null
1,489,990
null
1
36
android|firebase|firebase-analytics
29,389
<p>First, credit to <a href="https://stackoverflow.com/users/268156/adamk">AdamK</a> for adding this:</p> <blockquote> <p>Custom parameters: Custom parameters are not represented directly in your Analytics reports, but they can be used as filters in audience definitions that can be applied to every report. Custom pa...
30,373,343
ReactJS component names must begin with capital letters?
<p>I am playing around with the ReactJS framework on <a href="https://jsbin.com/" rel="noreferrer">JSBin</a>.</p> <p>I have noticed that if my component name starts with a lowercase letter it does not work.</p> <p>For instance the following does not render:</p> <pre><code>var fml = React.createClass({ render: func...
30,373,505
6
1
null
2015-05-21 12:09:50.923 UTC
35
2021-06-27 09:15:39.89 UTC
2019-12-09 20:26:16.117 UTC
null
1,218,980
null
894,903
null
1
176
javascript|reactjs
68,432
<p>In JSX, lower-case tag names are considered to be HTML tags. However, lower-case tag names with a dot (property accessor) aren't.</p> <p>See <a href="https://facebook.github.io/react/docs/jsx-in-depth.html#html-tags-vs.-react-components" rel="noreferrer">HTML tags vs React Components</a>.</p> <ul> <li><code>&lt;co...
46,844,263
Writing json to file in s3 bucket
<p>This code writes json to a file in s3, what i wanted to achieve is instead of opening data.json file and writing to s3 (sample.json) file, </p> <p>how do i pass the json directly and write to a file in s3 ?</p> <pre><code>import boto3 s3 = boto3.resource('s3', aws_access_key_id='aws_key', aws_secret_access_key='a...
46,844,646
4
2
null
2017-10-20 07:28:48.72 UTC
11
2022-07-19 22:04:17.637 UTC
2017-10-20 15:12:48.32 UTC
null
400,617
null
8,782,508
null
1
47
python|boto3
95,635
<p>Amazon S3 is an object store (File store in reality). The primary operations are PUT and GET. You can not add data into an existing object in S3. You can only replace the entire object itself.</p> <p>For a list of available operations you can perform on s3 see this link <a href="http://docs.aws.amazon.com/AmazonS3/...
47,039,812
How to install popper.js with Bootstrap 4?
<p>From what I've read so far, popper.js is a big pain with Bootstrap 4. I can't get it to work. I keep getting this error:</p> <blockquote> <p>Error: Bootstrap dropdown require Popper.js (<a href="https://popper.js.org" rel="noreferrer">https://popper.js.org</a>)</p> </blockquote> <p>I've tried the CDN and NPM ins...
47,041,690
11
3
null
2017-10-31 16:07:21.753 UTC
18
2021-03-19 16:06:54.02 UTC
null
null
null
null
40,106
null
1
66
twitter-bootstrap|popper.js
171,320
<p><a href="https://cdnjs.com/libraries/popper.js" rel="noreferrer">https://cdnjs.com/libraries/popper.js</a> does not look like a right src for popper, it does not specify the file </p> <p>with bootstrap 4 I am using this </p> <pre><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/po...
36,631,762
Returning HTML With fetch()
<p>I'm trying to fetch a file and return it's HTML. However it's not as simple as I'd have imagined.</p> <pre><code> fetch('/path/to/file') .then(function (response) { return response.body; }) .then(function (body) { console.log(body); }); </code></pre> <p>This returns an object called ...
36,632,271
7
5
null
2016-04-14 19:01:03.097 UTC
38
2022-05-10 15:29:44.097 UTC
2019-08-21 13:54:11.033 UTC
null
3,578,997
null
618,584
null
1
93
javascript|fetch-api
117,289
<p>You need to use the <code>.text()</code> method, instead of <code>.json()</code>. This converts the byte stream into plain text, which can be parsed by the browser as HTML.</p>
4,757,890
When the use of a AntiForgeryToken is not required /needed?
<p><strong>UPD:</strong> Same question asked on <a href="https://security.stackexchange.com/questions/2120/when-the-use-of-a-antiforgerytoken-is-not-required-needed">security.stackexchange.com</a> and the answer I got is different. Please follow there, to get the correct answer!</p> <p>I'm running a rather large site ...
4,762,560
1
2
null
2011-01-21 10:49:17.707 UTC
9
2011-02-23 11:03:42.083 UTC
2017-03-17 13:14:46.04 UTC
null
-1
null
254,716
null
1
26
asp.net-mvc-3|csrf|antiforgerytoken
13,269
<p>Anti forgery tokens are useless in public parts of the site where users are not yet authenticated such as login and register forms. The way CSRF attack works is the following:</p> <ol> <li>A malicious user sets a HTML form on his site which resembles your site. This form could contain hidden fields as well.</li> <l...
60,291,987
Idiomatic way of performance evaluation?
<p>I am evaluating a network+rendering workload for my project.</p> <p>The program continuously runs a main loop:</p> <pre><code>while (true) { doSomething() drawSomething() doSomething2() sendSomething() } </code></pre> <p>The main loop runs more than 60 times per second.</p> <p>I want to see the perfo...
60,293,070
1
2
null
2020-02-19 02:06:41.3 UTC
10
2022-08-09 06:43:57.157 UTC
null
null
null
null
11,211,510
null
1
10
benchmarking|microbenchmark
2,740
<p>Generally: For repeated short things, you can just time the whole repeat loop. (But microbenchmarking is hard; easy to distort results unless you understand the implications of doing that; for very short things, throughput and latency are different, so measure both separately by making one iteration use the result ...
31,380,784
Java 8 Stream String Null Or Empty Filter
<p>I've got Google Guava inside Stream:</p> <pre><code>this.map.entrySet().stream() .filter(entity -&gt; !Strings.isNullOrEmpty(entity.getValue())) .map(obj -&gt; String.format("%s=%s", obj.getKey(), obj.getValue())) .collect(Collectors.joining(",")) </code></pre> <p>As you see there is a statement <code>!String.isNu...
31,381,251
6
9
null
2015-07-13 10:21:13.433 UTC
4
2019-10-16 05:46:03.723 UTC
2016-05-05 17:45:01.56 UTC
null
1,196,670
null
1,230,556
null
1
33
java|java-8|guava|java-stream
86,616
<p>You can write your own predicate:</p> <pre><code>final Predicate&lt;Map.Entry&lt;?, String&gt;&gt; valueNotNullOrEmpty = e -&gt; e.getValue() != null &amp;&amp; !e.getValue().isEmpty(); </code></pre> <p>Then just use <code>valueNotNullOrEmpty</code> as your filter argument.</p>
20,011,862
How to change the text color. Simple?
<pre><code>If CDbl(totalAverage) &gt;= 89 Then lblGrade.Text = "A" ElseIf CDbl(totalAverage) &gt;= 79 Then lblGrade.Text = "B" ElseIf CDbl(totalAverage) &gt;= 69 Then lblGrade.Text = "C" ElseIf CDbl(totalAverage) &gt;= 59 Then lblGrade.Text = "D" ...
20,011,926
1
0
null
2013-11-15 22:39:41.54 UTC
null
2017-02-10 21:51:58.623 UTC
2017-02-10 21:51:58.623 UTC
null
6,771,952
null
2,990,050
null
1
2
vb.net
53,752
<p>lblGrade.Forecolor is what your looking for. </p> <p>For orange, it would be "lblGrade.ForeColor = Color.Orange"</p>
55,326,416
fs.FileRead -> TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be one of type string, Buffer, or URL. Received type undefined
<pre><code>function openFileDialog() { dialog.showOpenDialog(win, { properties: ['openFile'] } , filepath =&gt; { if (filepath) { fs.writeFile('path.txt', filepath, function (err, data) { if (err) console.log(err); }); scanFile(filepath) } }) } function scanFile(filepath) ...
55,326,551
1
2
null
2019-03-24 17:17:51.9 UTC
null
2020-01-27 18:08:17.36 UTC
null
null
null
null
7,339,889
null
1
3
javascript|node.js|electron|fs
47,884
<p>The first line of <code>scanFile</code> reads: </p> <p><code>if(!filepath || filepath[0] == 'undefined') return;</code></p> <p>This indicates to me that <code>filepath</code> is an array, not a string (or Buffer or URL). Check the output of the <code>console.log</code> statement to see if this is the case. Since t...
24,138,398
How to implement PhantomJS with Selenium WebDriver using java
<p>I'm going mad, really. I have this code:</p> <pre><code>public class Creazione extends TestCase { private PhantomJSDriver driver; private String baseUrl; private boolean acceptNextAlert = true; private StringBuffer verificationErrors = new StringBuffer(); @Before public void setUp() throws ...
25,444,253
4
1
null
2014-06-10 10:15:44.487 UTC
8
2017-02-14 01:28:47.49 UTC
2016-11-24 08:55:42.717 UTC
null
3,885,376
null
3,725,538
null
1
10
java|selenium|selenium-webdriver|phantomjs|screenshotexception
64,988
<p><strong>Try this, it worked for me</strong> </p> <pre><code>DesiredCapabilities caps = new DesiredCapabilities(); caps.setJavascriptEnabled(true); caps.setCapability("takesScreenshot", true); caps.setCapability( PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, ...
7,939,186
Inno Setup - #define directive - how to use previously defined variable?
<p>I am using Inno Setup version 5.4.2.</p> <p>I want to define the path for the files to copy (the Source: parameter in the [Files] section as two parts, a base path and sub-directory names, that I use for special files (like .dlls). I have tried the following:</p> <pre><code>#define MyAppSetupDir "D:\MyApp\setup" #...
7,940,051
1
0
null
2011-10-29 13:28:02.213 UTC
5
2011-10-29 16:27:02.56 UTC
2017-05-23 10:31:23.45 UTC
null
-1
null
1,019,789
null
1
47
inno-setup
15,711
<pre><code>#define MyAppSetupDir "D:\MyApp\setup" #define MyAppSetupQtDLLs MyAppSetupDir + "\DLLs" </code></pre>
1,554,751
How to handle push notifications if the application is already running?
<p>How do we handle push notifications if the application is <em>already</em> running ? I want to show an alert if the application is running (instead of a push notification alert). Only if the application is not running, then show a push notification alert.</p> <p>Also, if I send a payload to APNs, how can I create a...
1,554,831
4
0
null
2009-10-12 14:00:23.933 UTC
36
2017-06-27 14:54:35.13 UTC
2017-06-27 14:54:35.13 UTC
null
5,175,709
null
83,905
null
1
28
ios|objective-c|push-notification|apple-push-notifications
45,552
<p>You can implement <a href="https://developer.apple.com/library/ios/DOCUMENTATION/UIKit/Reference/UIApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/UIApplicationDelegate/application:didReceiveRemoteNotification:" rel="noreferrer"><code>application:didReceiveRemoteNotification:</code></a></...
1,647,359
Is there a way to get gcc to output raw binary?
<p>Is there a set of command-line options that will convince gcc to produce a flat binary file from a self-contained source file? For example, suppose the contents of foo.c are</p> <pre><code>static int f(int x) { int y = x*x; return y+2; } </code></pre> <p>No external references, nothing to export to the linker...
1,647,405
4
3
null
2009-10-30 00:26:14.077 UTC
18
2020-11-04 16:55:33.267 UTC
2016-10-18 20:49:59.013 UTC
null
1,483,676
null
8,677
null
1
35
linux|gcc|command-line|linker|x86
40,314
<p>Try this out:</p> <pre><code>$ gcc -c test.c $ objcopy -O binary -j .text test.o binfile </code></pre> <p>You can make sure it's correct with <code>objdump</code>:</p> <pre><code>$ objdump -d test.o test.o: file format pe-i386 Disassembly of section .text: 00000000 &lt;_f&gt;: 0: 55 ...
1,487,548
How to get the original value of an attribute in Rails
<p>is there a way to get the original value that an ActiveRecord attribute (=the value that was loaded from the database)?</p> <p>I want something like this in an observer</p> <pre><code>before_save object do_something_with object.original_name end </code></pre> <p>The task is to remove the object from a hash tabl...
1,487,605
4
0
null
2009-09-28 15:03:20.157 UTC
13
2020-05-28 15:52:03.4 UTC
null
null
null
null
6,678
null
1
101
ruby-on-rails|activerecord
39,211
<h3>Before rails 5.1</h3> <p>Appending <code>_was</code> to your attribute will give you the previous value.</p> <h3>For rails 5.1+</h3> <p><strong>Copied from Lucas Andrade's answer below</strong>: <a href="https://stackoverflow.com/a/50973808/9359123">https://stackoverflow.com/a/50973808/9359123</a> </p> <hr> <p...
28,635,496
Difference: LZ77 vs. LZ4 vs. LZ4HC (compression algorithms)?
<p>I understand the LZ77 and LZ78 algorithms. I read about LZ4 <a href="http://www.brutaldeluxe.fr/products/crossdevtools/lz4/index.html" rel="noreferrer">here</a> and <a href="http://fastcompression.blogspot.co.uk/2011/05/lz4-explained.html" rel="noreferrer">here</a> and found <a href="http://code.google.com/p/lz4/so...
28,635,890
1
2
null
2015-02-20 18:09:37.997 UTC
38
2021-11-01 16:47:05.107 UTC
2015-02-27 18:22:54.457 UTC
null
2,714,852
null
4,485,500
null
1
49
lossless-compression|lz4|lz77
41,705
<p><a href="https://github.com/Cyan4973/lz4" rel="noreferrer">LZ4</a> is built to compress fast, at hundreds of MB/s per core. It's a fit for applications where you want compression that's very cheap: for example, you're trying to make a network or on-disk format more compact but can't afford to spend a bunch of CPU ti...
28,537,181
Spring Security OAuth2, which decides security?
<p>I've been trying to implement a OAuth2 authentication server using the guides by Dave Syer with some inspiration from JHipster. But I can't figure out how it all works together.</p> <p>It looks like the security setup using the WebSecurityConfigurerAdapter is overwritten when I use ResourceServerConfigurerAdapter.<...
28,604,260
1
4
null
2015-02-16 08:22:36.14 UTC
22
2018-10-24 14:52:58.807 UTC
null
null
null
null
1,385,837
null
1
42
spring|spring-security|spring-security-oauth2
23,969
<p>You need a <code>WebSecurityConfigurerAdapter</code> to secure the /authorize endpoint and to provide a way for users to authenticate. A Spring Boot application would do that for you (by adding its own <code>WebSecurityConfigurerAdapter</code> with HTTP basic auth). It creates a filter chain with order=0 by default,...
7,579,861
How do I disable and enable macros on the fly?
<p>I would like to test an Excel VBA app I made.<br> However the VBA code messes around with the visibility of cells and that's a pest when editing the sheet. </p> <p>Is there an option is enable and disable macro's on the fly without having to</p> <pre><code>Close the sheet Change the macro settings Reopen the shee...
7,579,986
6
0
null
2011-09-28 07:44:09.84 UTC
2
2020-08-16 09:36:29.41 UTC
2018-04-02 20:06:36.087 UTC
null
8,112,776
null
650,492
null
1
6
vba|excel|visibility
51,092
<p>As far as I know, you can't enable / disable macros from an opened workbook <em>on the fly</em>.<br> Yet, you shouldn't have to because macros are only triggered thanks to a user click.</p> <p>The only case I would see is for the Event Procedures (<code>Worksheet_Change</code> or else).<br> You could then create pr...
7,617,587
Is there an alternative to using time to seed a random number generation?
<p>I'm trying to run several instances of a piece of code (2000 instances or so) concurrently in a computing cluster. The way it works is that I submit the jobs and the cluster will run them as nodes open up every so often, with several jobs per node. This seems to produce the same values for a good number of the ins...
7,617,612
10
10
null
2011-10-01 01:39:41.493 UTC
6
2016-03-29 17:00:35.24 UTC
2013-12-01 03:01:39.073 UTC
null
1,009,479
null
923,757
null
1
32
c|random|random-seed
13,916
<p>The <code>rdtsc</code> instruction is a pretty reliable (and random) seed.</p> <p>In Windows it's accessible via the <code>__rdtsc()</code> intrinsic.</p> <p>In GNU C, it's accessible via:</p> <pre><code>unsigned long long rdtsc(){ unsigned int lo,hi; __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));...
7,190,016
How to update an object in a List<> in C#
<p>I have a <code>List&lt;&gt;</code> of custom objects.</p> <p>I need to find an object in this list by some property which is unique and update another property of this object. </p> <p>What is the quickest way to do it?</p>
7,190,035
11
0
null
2011-08-25 12:04:42.877 UTC
14
2022-06-23 14:36:11.68 UTC
2013-09-18 19:59:35.597 UTC
null
706,363
null
386,817
null
1
122
c#|asp.net|list|generics
323,296
<p>Using Linq to find the object you can do:</p> <pre><code>var obj = myList.FirstOrDefault(x =&gt; x.MyProperty == myValue); if (obj != null) obj.OtherProperty = newValue; </code></pre> <p>But in this case you might want to save the List into a Dictionary and use this instead:</p> <pre><code>// ... define after get...
7,055,489
How to generate a random 10 digit number in C#?
<p>I'm using C# and I need to generate a random 10 digit number. So far, I've only had luck finding examples indicating min maximum value. How would i go about generating a random number that is 10 digits, which can begin with 0, (initially, I was hoping for <code>random.Next(1000000000,9999999999)</code> but I doubt t...
7,055,537
13
5
null
2011-08-14 06:52:14.08 UTC
5
2020-06-22 23:49:14.113 UTC
2020-01-03 09:18:31.747 UTC
null
271,200
null
754,479
null
1
32
c#|.net|asp.net|random
87,368
<p>If you want ten digits but you allow <em>beginning with a 0</em> then it sounds like you want to generate a string, not a long integer.</p> <p>Generate a 10-character string in which each character is randomly selected from '0'..'9'.</p>
13,951,005
Best Practice : Ways to handle errors and exception in web api controllers?
<p>I am working on a project and have relied heavily on web api for all my client side operations, be it account details update, new details added, modify everything has been done with ASP.NET Web Api and Backbone.js</p> <p><strong>Current Scene :</strong></p> <p>In the current scheme of things, I am returning a bool...
13,955,683
2
2
null
2012-12-19 11:07:31.97 UTC
9
2012-12-19 15:29:50.083 UTC
2017-05-23 12:02:39.663 UTC
null
-1
null
1,182,982
null
1
21
asp.net-mvc|asp.net-mvc-4|asp.net-web-api
16,307
<p>You should avoid using try/catch in the controller's action.</p> <p>There are many ways to handle your problem. The simplest and cleanest solution would probably be to use an <code>ActionFilter</code> to handle the exceptions, something along the lines of:</p> <pre><code>public class ExceptionAttribute : Exception...
14,181,180
Why do SQL databases use a write-ahead log over a command log?
<p>I read about Voltdb's <a href="http://voltdb.com/docs/UsingVoltDB/ChapCmdLog.php">command log</a>. The command log records the transaction invocations instead of each row change as in a write-ahead log. By recording only the invocation, the command logs are kept to a bare minimum, limiting the impact the disk I/O wi...
14,260,739
6
4
null
2013-01-06 10:19:18.6 UTC
29
2020-09-15 03:59:07.027 UTC
null
null
null
null
782,220
null
1
56
sql|database|logging|transactions|voltdb
14,579
<p>I think it is better to rephrase: </p> <blockquote> <p>Why does new distributed VoltDB use a command log over write-ahead log?</p> </blockquote> <p>Let's do an experiment and imagine you are going to write your own storage/database implementation. Undoubtedly you are advanced enough to abstract a file system an...
47,269,402
How to center text in a row using Bootstrap 4
<p>The problem is that <code>&lt;p&gt;</code> and <code>&lt;h1&gt;</code> are appearing on same line and no matter what I do they can't be centered. </p> <p><strong>HTML</strong></p> <pre><code>&lt;div class="container"&gt; &lt;div class="row" id="appSummary"&gt; &lt;h1&gt;Why This App Is Awesome&lt;/h1&gt; ...
47,269,516
4
3
null
2017-11-13 16:45:04.857 UTC
null
2018-04-24 14:24:48.783 UTC
2018-04-24 14:24:48.783 UTC
null
8,918,893
null
7,131,162
null
1
4
twitter-bootstrap|bootstrap-4
42,550
<p>Since you're using Bootstrap 4 which uses the flex model, change your CSS rule to:</p> <pre><code>#appSummary{ justify-content:center; } </code></pre> <p><strong><a href="https://www.bootply.com/zcn84QPlzO" rel="noreferrer">Bootply example</a></strong></p>
43,525,052
RxJava2 observable take throws UndeliverableException
<p>As I understand RxJava2 <code>values.take(1)</code> creates another Observable that contains only one element from the original Observable. Which <strong>MUST NOT</strong> throw an exception as it is filtered out by the effect of <code>take(1)</code> as it's happened second.</p> <p>as in the <strong>following</stro...
43,525,858
4
1
null
2017-04-20 16:29:53.6 UTC
15
2020-10-05 13:23:06.32 UTC
2017-04-20 17:46:50.453 UTC
null
4,586,030
null
4,586,030
null
1
41
java|observable|rx-java2|take
35,709
<ol> <li>Yes, but because the observable 'ends' does not mean the code running inside <code>create(...)</code> is stopped. To be fully safe in this case you need to use <code>o.isDisposed()</code> to see if the observable has ended downstream.</li> <li>The exception is there because RxJava 2 has the policy of NEVER all...
19,468,025
Add Items to ListView - Android
<p>This is my first experience with android. I'm trying to add items to my ListView. I use Tabs, and the only way to see that the item was added is to change tab and then come back to the first tab.</p> <p>I searched around, and I've always found</p> <pre><code>adapter.notifyDataSetChanged(); </code></pre> <p>but do...
19,468,504
3
2
null
2013-10-19 15:59:19.083 UTC
7
2016-11-01 08:50:43.223 UTC
2014-10-04 18:51:08.66 UTC
null
885,179
null
2,535,024
null
1
17
java|android|listview|android-listview|fragment
157,854
<pre><code>ListView myListView = (ListView) rootView.findViewById(R.id.myListView); ArrayList&lt;String&gt; myStringArray1 = new ArrayList&lt;String&gt;(); myStringArray1.add("something"); adapter = new CustomAdapter(getActivity(), R.layout.row, myStringArray1); myListView.setAdapter(adapter); </code></pre> <p>Try it ...
34,071,003
Bootstrap 3 datepicker - minDate and maxDate
<p><a href="http://eonasdan.github.io/bootstrap-datetimepicker/" rel="noreferrer">http://eonasdan.github.io/bootstrap-datetimepicker/</a></p> <p>Hi</p> <p>I am trying to use the min max date options but not sure how to use it as the documentation doesn't provide example code.</p> <p>I found on stackoverflow that you...
34,333,138
4
4
null
2015-12-03 16:19:06.847 UTC
1
2019-11-21 12:27:43.08 UTC
2015-12-03 17:27:24.39 UTC
null
4,261,249
null
4,261,249
null
1
9
javascript
89,707
<p>To answer my question. The framework used required you to add moment to a config file otherwise it would not allow to use <a href="http://momentjs.com/" rel="noreferrer">http://momentjs.com/</a> or any other JS - spoke to the person who set up the framework and they did it for security reasons.</p> <p>Kasun's answe...
34,065,670
SQL Server Inner Join using WITH(NOLOCK)
<p>I have a database query:</p> <pre><code>DECLARE @Pager_PageNumber AS INT, @Pager_PageSize AS INT; SET @Pager_PageNumber = 1; SET @Pager_PageSize = 12; SELECT [Name], [Description], [Table1ID], [VersionNo], [Status] FROM (SELECT CAST(Table1.name AS VARCHAR(MAX)) As [Name], CAST(Tabl...
34,065,793
5
4
null
2015-12-03 12:07:30.09 UTC
null
2015-12-03 13:59:15.903 UTC
2015-12-03 12:15:10.687 UTC
null
13,302
null
4,282,901
null
1
2
sql|sql-server|join|inner-join|self-join
40,660
<p>You apply <code>with (nolock)</code> to <em>tables</em>, not to subqueries. So, instead of:</p> <pre><code>(SELECT Table1_id, MAX(version_no) as version_no FROM Table1 where Table1.status='00002' GROUP BY Table1_id ) as BR WITH (NOLOCK) </code></pre> <p>You would write:</p> <pre><code>(SELECT Table1_id, MAX(v...
52,428,973
How to minify a Flutter app with Proguard?
<p>I already made a Flutter app. The release apk is about 14MB. I searched methods to minify this and found this ons: <a href="https://flutter.io/android-release/#enabling-proguard" rel="noreferrer">https://flutter.io/android-release/#enabling-proguard</a></p> <p>But my question is, <strong>how can I get to know all m...
59,202,013
3
5
null
2018-09-20 15:55:58.91 UTC
10
2022-06-08 11:36:55.383 UTC
null
null
null
null
7,657,749
null
1
27
android|dart|flutter|proguard|minify
27,290
<p>First, we will enable shrinking and obfuscation in the build file. Find <code>build.gradle</code> file which sits inside <code>/android/app/</code> folder and add lines in bold</p> <pre><code>android { ... buildTypes { release { signingConfig signingConfigs.debug minif...
44,949,467
When do you embed mutex in struct in Go?
<p>NOTE: I found the word 'embed' in the title was bad choice, but I will keep it. </p> <p>I see a lot of code does like this:</p> <pre><code>type A struct { mu sync.Mutex ... } </code></pre> <p>And use it like this:</p> <pre><code>a := &amp;A{} a.mu.Lock() defer a.mu.Unlock() a.Something() </code></pre> ...
44,950,096
1
2
null
2017-07-06 12:53:27.897 UTC
10
2021-06-29 19:42:30.197 UTC
2017-07-08 16:02:38.207 UTC
null
1,932,530
null
1,932,530
null
1
28
go|struct|embed|mutex
20,035
<p>It's good practice to keep the mutex close to the data it is destined to protect. If a mutex ought to protect concurrent access to fields of a struct value, it's very convenient to add the mutex as a field of that struct, so its purpose is obvious.</p> <p>If in your app there is only a single &quot;instance&quot; of...
35,206,015
Intellij Annotate Option Grayed Out
<p>I am trying to look at who changed a line in Intellij 15. I know I can use git blame but I want to learn how to do it correctly in intellij. I am right clicking on the line numbers on the file but when I get the context menu the <code>annotate</code> option is grayed out. What setting am I missing?</p> <p>I looked ...
35,466,762
12
5
null
2016-02-04 16:13:33.317 UTC
5
2021-05-21 10:19:34.99 UTC
null
null
null
null
2,654,083
null
1
53
intellij-idea|intellij-15
24,687
<p>Looks like its a fresh project. First configure the Version Control like Git and than <strong>commit at least once</strong>. After first commit Annotate option will not be grayed out.</p> <p>Also update git for any new version.</p>
290,513
Regex pattern for numeric values
<p>I need an regular expression pattern to only accept positive whole numbers. It can also accept a single zero.</p> <p>I do not want to accept decimals, negative number and numbers with leading zeros.</p> <p>Any suggestions?</p>
290,539
5
1
null
2008-11-14 15:51:59.98 UTC
13
2015-04-08 18:07:24.507 UTC
2008-11-14 18:55:34.68 UTC
Michael Kniskern
26,327
Michael Kniskern
26,327
null
1
67
regex
323,072
<pre><code>^(0|[1-9][0-9]*)$ </code></pre>
1,009,485
Filter element based on .data() key/value
<p>Say I have 4 div elements with class <code>.navlink</code>, which, when clicked, use <code>.data()</code> to set a key called <code>'selected'</code>, to a value of <code>true</code>:</p> <pre><code>$('.navlink')click(function() { $(this).data('selected', true); }) </code></pre> <p>Every time a new <code>.navlink<...
1,009,523
5
0
null
2009-06-17 20:57:57.397 UTC
26
2018-05-09 20:39:57.123 UTC
2015-11-04 10:17:52.83 UTC
null
4,370,109
null
113,716
null
1
130
jquery|filter
124,856
<p>your filter would work, but you need to return true on matching objects in the function passed to the filter for it to grab them.</p> <pre><code>var $previous = $('.navlink').filter(function() { return $(this).data("selected") == true }); </code></pre>
126,260
Objections against Java Webstart?
<p>Since the release of Adobe AIR I am wondering why Java Web Start has not gained more attention in the past as to me it seems to be very similar, but web start is available for a much longer time.</p> <p>Is it mainly because of bad marketing from Sun, or are there more technical concerns other than the need of havin...
126,314
6
0
null
2008-09-24 09:47:20.297 UTC
11
2012-07-13 06:47:17.947 UTC
null
null
null
Yaba
7,524
null
1
20
java|java-web-start
2,662
<p>In my company we used Java Web Start to deploy Eclipse RCP applications. It was a pain to setup, but it works very well once in place. So the only recommendation I could make is to start small, to get the hang of it. Deploying one simple application first. Trying to deploy a complete product that is already made...
403,218
Does C# .NET support IDispatch late binding?
<hr> <h2>The Question</h2> <p>My question is: <strong>Does C# nativly support late-binding IDispatch?</strong></p> <hr> <p><em>Pretend</em> i'm trying to automate Office, while being compatible with whatever version the customer has installed. </p> <p>In the .NET world if you developed with Office 2000 installed, ...
489,272
6
1
null
2008-12-31 15:33:16.7 UTC
7
2011-11-09 18:33:44.96 UTC
2009-11-01 12:29:37.06 UTC
null
12,597
null
12,597
null
1
28
c#|late-binding|idispatch
16,784
<p>You can, relativly, use late-binding IDispatch binding in C#.</p> <p><a href="http://support.microsoft.com/kb/302902" rel="noreferrer">http://support.microsoft.com/kb/302902</a></p> <p>Here's some sample for using Excel. This way you don't need to add a needless dependancy on Microsoft's bloaty PIA:</p> <pre><cod...
817,087
Call a function with argument list in python
<p>I'm trying to call a function inside another function in python, but can't find the right syntax. What I want to do is something like this:</p> <pre><code>def wrapper(func, args): func(args) def func1(x): print(x) def func2(x, y, z): return x+y+z wrapper(func1, [x]) wrapper(func2, [x, y, z]) </code><...
817,296
6
0
null
2009-05-03 13:43:33.843 UTC
63
2018-02-24 15:18:15.863 UTC
2009-05-03 15:20:08.807 UTC
null
12,855
null
70,898
null
1
166
python|function
363,441
<p>To expand a little on the other answers:</p> <p>In the line:</p> <pre><code>def wrapper(func, *args): </code></pre> <p>The * next to <code>args</code> means "take the rest of the parameters given and put them in a list called <code>args</code>". </p> <p>In the line:</p> <pre><code> func(*args) </code></pre> ...
239,147
How do you import classes in JSP?
<p>I am a complete JSP beginner. I am trying to use a <code>java.util.List</code> in a JSP page. What do I need to do to use classes other than ones in <code>java.lang</code>?</p>
239,293
6
1
null
2008-10-27 05:26:18.683 UTC
43
2017-11-15 14:18:36.16 UTC
2013-04-30 17:05:52.6 UTC
null
2,598
jjnguy
2,598
null
1
249
java|jsp
622,952
<p>Use the following import statement to import <code>java.util.List</code>:</p> <pre><code>&lt;%@ page import="java.util.List" %&gt; </code></pre> <p>BTW, to import more than one class, use the following format:</p> <pre><code>&lt;%@ page import="package1.myClass1,package2.myClass2,....,packageN.myClassN" %&gt; </c...
58,873,022
How can I make a Selenium script undetectable using GeckoDriver and Firefox through Python?
<p>Is there a way to make your Selenium script undetectable in Python using <strong>geckodriver</strong>?</p> <p>I'm using Selenium for scraping. Are there any protections we need to use so websites can't detect Selenium?</p>
58,879,076
4
9
null
2019-11-15 08:29:52.28 UTC
21
2022-03-29 09:41:15.663 UTC
2021-02-06 12:49:10.667 UTC
null
63,550
user12285770
null
null
1
23
python|selenium|firefox|geckodriver|selenium-firefoxdriver
24,912
<p>The fact that <em>selenium driven <strong>Firefox</strong> / <strong>GeckoDriver</strong> gets detected</em> doesn't depends on any specific <em>GeckoDriver</em> or <em>Firefox</em> version. The <em>Websites</em> themselves can detect the network traffic and can identify the <em>Browser Client</em> i.e. <em>Web Brow...
37,788,342
Is it better to define state in constructor or using property initializers?
<p>According to <a href="https://babeljs.io/blog/2015/06/07/react-on-es6-plus" rel="noreferrer">this</a> babel documentation, the correct way to use ES6+ with React is to initial components like this:</p> <pre><code>class Video extends React.Component { static defaultProps = { autoPlay: false, maxLoops: 10, ...
37,788,410
3
3
null
2016-06-13 11:14:14.08 UTC
19
2019-08-20 11:42:06.17 UTC
2016-06-14 02:46:20.867 UTC
null
218,196
null
2,432,961
null
1
58
reactjs|ecmascript-next
16,822
<p>I believe it's a matter of personal preference. The transpiled output is the same in terms of semantics.</p> <ul> <li><strong><a href="https://babeljs.io/repl/#?evaluate=true&amp;lineWrap=false&amp;presets=es2015%2Creact%2Cstage-1%2Cstage-2%2Cstage-3&amp;experimental=false&amp;loose=false&amp;spec=false&amp;code=c...
44,209,368
How to change a single value in a NumPy array?
<p>I want to change a single element of an array. For example, I have:</p> <pre><code>A = np.array([1,2,3,4], [5,6,7,8], [9,10,11,12], [13,14,15,16]) </code></pre> <p>I want to relace <code>A[2][1] = 10</code> with <code>A[2][1] = 150</code>. How can I do it?</p>
44,209,429
1
2
null
2017-05-26 20:03:57.3 UTC
5
2022-05-24 15:55:51.24 UTC
2020-08-01 00:07:15.633 UTC
null
7,851,470
user8072140
null
null
1
47
python|numpy
198,480
<p>Is this what you are after? Just index the element and assign a new value.</p> <pre><code>A[2,1]=150 A Out[345]: array([[ 1, 2, 3, 4], [ 5, 6, 7, 8], [ 9, 150, 11, 12], [13, 14, 15, 16]]) </code></pre>
1,641,008
How to store arbitrary name/value key pairs in a Django model?
<p>I have a fixed data model that has a lot of data fields.</p> <pre> class Widget(Models.model): widget_owner = models.ForeignKey(auth.User) val1 = models.CharField() val2 = models.CharField() ... val568 = ... </pre> <p>I want to cram even more data into this Widget by letting my users specify cu...
1,641,346
5
0
null
2009-10-29 00:37:19.437 UTC
9
2013-09-09 12:25:39.38 UTC
null
null
null
null
36,680
null
1
13
django|django-models
13,549
<p>Consider representing all custom properties with serialized dict. I used this in a recent project and it worked really well.</p> <pre><code> class Widget(models.Model): owner = models.ForeignKey(auth.User) props = models.TextField(blank=True) # serialized custom data @property def props_di...
1,884,979
JSON to Groovy parser
<p>I found many things about converting Groovy to JSON, but oddly enough, not the other way.</p> <p>What is the (best) JSON to Groovy parser around there ?</p>
1,885,496
5
0
null
2009-12-10 23:59:45.957 UTC
8
2022-01-28 10:46:11.967 UTC
null
null
null
null
183,258
null
1
22
json|groovy
40,648
<p>Because compiled Groovy classes are compatible with Java classes, you should be able to use any Java library for converting JSON to POJOs (or POGOs). <a href="http://jackson.codehaus.org/" rel="nofollow noreferrer">Jackson</a> is a fairly popular choice which you can use to convert JSON like this:</p> <pre><code>Str...
2,160,635
Is there a way to print out the type of a variable/pointer in C?
<p>I want to print out (or otherwise ascertain) the type of some variable in my program. Is there a good way to do it? By good, I mean a way that works, even if it means intentionally throwing compiler errors.</p> <p>For example:</p> <pre><code>client.c:55: error: incompatible types in assignment </code></pre> <p>...
2,160,773
5
5
null
2010-01-29 08:06:47.753 UTC
6
2020-12-14 15:31:46.683 UTC
null
null
null
null
239,333
null
1
35
c|types
88,671
<p>try debugging using GDB, it will print all properties associated with the variable including it's type. But, your program should compile before using GDB.</p>
2,288,970
C++: How to build Strings / char*
<p>I'm new to C++. I want to make a <code>char*</code>, but I don't know how.<br> In Java is it just this:</p> <pre><code>int player = 0; int cpu = 0; String s = "You: " + player + " CPU: " + cpu; </code></pre> <p>How can I do this? I need a <code>char*</code>.</p> <p>I'm focusing on pasting the integer after the st...
2,289,025
6
3
null
2010-02-18 13:45:33.887 UTC
4
2014-02-06 18:06:44.01 UTC
2014-02-06 18:04:35.173 UTC
null
1,530,508
null
155,137
null
1
14
c++|string|char
75,934
<p>You almost certainly don't want to deal with char * if you can help it - you need the C++ std::string class:</p> <pre><code>#include &lt;string&gt; .. string name = "fred"; </code></pre> <p>or the related stringstream class:</p> <pre><code>#include &lt;sstream&gt; #include &lt;string&gt; #include &lt;iostream&gt;...
2,261,858
boost::python Export Custom Exception
<p>I am currently writing a C++ extension for Python using Boost.Python. A function in this extension may generate an exception containing information about the error (beyond just a human-readable string describing what happened). I was hoping I could export this exception to Python so I could catch it and do somethi...
2,262,650
6
0
null
2010-02-14 16:47:17.923 UTC
14
2022-01-28 10:54:02.033 UTC
2016-06-13 21:38:10.16 UTC
null
2,069,064
null
61,663
null
1
25
c++|python|exception|boost-python
9,067
<p>The solution is to create your exception class like any normal C++ class</p> <pre><code>class MyCPPException : public std::exception {...} </code></pre> <p>The trick is that all boost::python::class_ instances hold a reference to the object's type which is accessible through their ptr() function. You can get this...
1,473,155
how to get data between quotes in java?
<p>I have this lines of text the number of quotes could change like: </p> <pre><code>Here just one "comillas" But I also could have more "mas" values in "comillas" and that "is" the "trick" I was thinking in a method that return "a" list of "words" that "are" between "comillas" </code></pre> <p>How I obtain the data...
1,473,198
6
0
null
2009-09-24 17:43:03.927 UTC
8
2019-07-23 23:02:23.933 UTC
2019-07-23 23:02:23.933 UTC
null
2,516,301
null
128,237
null
1
31
java|quotes|tokenize
68,054
<p>You can use a regular expression to fish out this sort of information. </p> <pre><code>Pattern p = Pattern.compile("\"([^\"]*)\""); Matcher m = p.matcher(line); while (m.find()) { System.out.println(m.group(1)); } </code></pre> <p>This example assumes that the language of the line being parsed doesn't support es...
1,766,492
Overloading operator== versus Equals()
<p>I'm working on a C# project on which, until now, I've used immutable objects and factories to ensure that objects of type <code>Foo</code> can always be compared for equality with <code>==</code>. </p> <p><code>Foo</code> objects can't be changed once created, and the factory always returns the same object for a gi...
1,766,558
6
1
null
2009-11-19 21:00:12.41 UTC
22
2016-09-16 19:47:06.567 UTC
2015-09-25 20:17:21.05 UTC
null
1,324
null
8,078
null
1
46
c#|operator-overloading|equals
34,218
<p>I believe the standard is that for most types, .Equals checks object similarity, and operator <code>==</code> checks reference equality.</p> <p>I believe best practice is that for immutable types, operator <code>==</code> should be checking for similarity, as well as <code>.Equals</code>. And if you want to know if...
1,474,115
How to find the tag associated with a given git commit?
<p>For releases I usually tag with something like v1.1.0. During my build script I am creating a fwVersion.c file that contains the current git info. Currently, I have commit, and branch info in the file, but I would like to add the tag.</p> <p>Is this possible?</p>
1,474,161
6
0
null
2009-09-24 20:58:22.16 UTC
24
2020-02-27 19:45:50.487 UTC
2018-05-31 16:32:23.597 UTC
null
895,245
null
178,727
null
1
111
git
60,142
<p>Check the documentation for <code>git describe</code>. It finds the nearest tag to a given commit (that is a tag which points to an ancestor of the commit) and describes that commit in terms of the tag.</p> <p>If you only want to know if the commit is pointed to by a tag then you can check the output of:</p> <pre>...
1,536,393
Good hash function for permutations?
<p>I have got numbers in a specific range (usually from 0 to about 1000). An algorithm selects some numbers from this range (about 3 to 10 numbers). This selection is done quite often, and I need to check if a permutation of the chosen numbers has already been selected.</p> <p>e.g one step selects <code>[1, 10, 3, 18]...
1,537,189
7
7
null
2009-10-08 08:22:43.917 UTC
12
2011-03-31 05:48:05.977 UTC
2009-12-29 21:36:59.783 UTC
null
48,181
null
48,181
null
1
15
performance|hash|permutation
8,318
<p>One potential candidate might be this. Fix a odd integer R. For each element e you want to hash compute the factor (R + 2*e). Then compute the product of all these factors. Finally divide the product by 2 to get the hash.</p> <p>The factor 2 in (R + 2e) guarantees that all factors are odd, hence avoiding that the p...
1,677,990
What is the difference between :focus and :active?
<p>What is the difference between the <code>:focus</code> and <code>:active</code> pseudo-classes?</p>
1,678,020
7
0
null
2009-11-05 02:40:58.09 UTC
75
2020-05-31 03:05:45.323 UTC
2011-11-08 07:13:18.46 UTC
null
106,224
null
84,201
null
1
342
css|css-selectors|pseudo-class
277,737
<p><code>:focus</code> and <code>:active</code> are two different states.</p> <ul> <li><code>:focus</code> represents the state when the element is currently selected to receive input and </li> <li><code>:active</code> represents the state when the element is currently being activated by the user.</li> </ul> <p>For e...
1,409,225
Changing a CSS rule-set from Javascript
<p>Is it possible to make changes to a CSS rule-set dynamically (i.e. some JS which would change a CSS rule-set when the user clicks a widget)</p> <p>This particular CSS rule-set is applied to lots of elements (via a class selector) on the page and I want to modify it when the user clicks the widget, so that all the e...
1,409,250
8
3
null
2009-09-11 06:06:33.277 UTC
12
2019-04-02 07:01:02.74 UTC
2019-04-02 07:01:02.74 UTC
null
860,099
null
140,970
null
1
70
javascript|css
46,405
<p>You can, but it's rather cumbersome. The best reference on how to do it is the following article: <a href="http://www.hunlock.com/blogs/Totally_Pwn_CSS_with_Javascript" rel="noreferrer">Totally Pwn CSS with Javascript</a> (<a href="https://web.archive.org/web/20130709232042/http://www.hunlock.com/blogs/Totally_Pwn_C...