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
8,674,831
How do you increment an assigned variable in smarty without displaying it
<p>So I have an assigned variable in smarty:</p> <pre><code>{assign var=number value=0} </code></pre> <p>Now I can increment it using</p> <pre><code>{$number++} </code></pre> <p>or</p> <pre><code>{++$number} </code></pre> <p>Which is exactly what I need, only problem is, it displays the value of $number on the pa...
8,674,976
4
0
null
2011-12-29 23:48:42.703 UTC
5
2021-12-07 17:11:31.21 UTC
2011-12-30 01:08:06.24 UTC
null
1,047,662
null
572,014
null
1
44
php|smarty
78,149
<p>You could do this:</p> <pre><code>{assign var=val value=1} {assign var=val value=$val+1} {$val} // displays 2 </code></pre> <p>The above will be compiled to:</p> <pre><code>$this-&gt;assign('val', 1); $this-&gt;assign('val', $this-&gt;_tpl_vars['val']+1); echo $this-&gt;_tpl_vars['val']; </code></pre> <p>or</p> <pre...
8,896,178
Eclipse - how to remove light bulb on warnings
<p>Super quick question here that has been bugging me for a very long time - Is there any way to remove the light bulb that appears on the left side of the line when there is a warning in Eclipse (Specifically using Java IDE, if it matters).</p> <p>It is very annoying the way it hides breakpoints, and honestly - I can...
8,896,409
5
0
null
2012-01-17 14:19:52.43 UTC
8
2019-10-29 21:03:16.29 UTC
2019-10-29 21:03:16.29 UTC
null
736,508
null
736,508
null
1
51
eclipse
15,301
<p>Go to <code>Windows &gt; Preferences &gt; General &gt; Editors &gt; Text Editors &gt; Annotations</code>. Select <code>Warnings</code> option in the <code>Annotation Types</code> list box, un-select <code>Vertical Ruler</code></p>
26,763,344
Convert Pandas Column to DateTime
<p>I have one field in a pandas DataFrame that was imported as string format. It should be a datetime variable. How do I convert it to a datetime column and then filter based on date.</p> <p>Example:</p> <ul> <li>DataFrame Name: <strong>raw_data</strong> </li> <li>Column Name: <strong>Mycol</strong> </li> <li>...
26,763,793
7
0
null
2014-11-05 17:24:34.143 UTC
124
2022-08-23 08:12:20.733 UTC
2014-11-05 17:25:51.54 UTC
null
2,867,928
null
3,971,910
null
1
422
python|datetime|pandas
901,546
<p>Use the <a href="https://pandas.pydata.org/pandas-docs/stable/generated/pandas.to_datetime.html" rel="noreferrer"><code>to_datetime</code></a> function, specifying a <a href="http://strftime.org/" rel="noreferrer">format</a> to match your data.</p> <pre><code>raw_data['Mycol'] = pd.to_datetime(raw_data['Mycol'], f...
862,668
.NET CLR that does not require an operating system?
<p>In the world of Java, BEA (now Oracle) has created LiquidVM which doesn't require an OS. Likewise, there are a variety of open source projects including <a href="http://www.jbox.dk/sanos/" rel="nofollow noreferrer">SANOS</a>, <a href="http://www.jnode.org/" rel="nofollow noreferrer">JNODE OS</a>, <a href="http://res...
862,734
3
0
null
2009-05-14 10:46:16.973 UTC
9
2009-06-03 01:11:47.85 UTC
null
null
null
null
85,095
null
1
4
java|.net|linux|mono|kernel
829
<p>Some googling found out:</p> <ul> <li><a href="http://research.microsoft.com/en-us/projects/singularity/" rel="noreferrer">Singularity</a> (a Microsoft research project)</li> <li><a href="http://en.wikipedia.org/wiki/Midori_(operating_system)" rel="noreferrer">Midori</a> (another Microsoft research project, which a...
1,223,311
Is it possible to read from a url into a System.IO.Stream object?
<p>I am attempting to read from a url into a System.IO.Stream object. I tried to use </p> <pre><code>Dim stream as Stream = New FileStream(msgURL, FileMode.Open) </code></pre> <p>but I get an error that URI formats are not supported with FileStream objects. Is there some method I can use that inherits from System.I...
1,223,333
3
0
null
2009-08-03 16:34:31.793 UTC
2
2018-07-30 04:56:00.863 UTC
2015-04-05 10:10:25.583 UTC
null
447,214
null
119,387
null
1
22
.net|vb.net|io|iostream
41,853
<p>VB.Net:</p> <pre><code>Dim req As WebRequest = HttpWebRequest.Create("url here") Using stream As Stream = req.GetResponse().GetResponseStream() End Using </code></pre> <p>C#:</p> <pre><code>var req = System.Net.WebRequest.Create("url here"); using (Stream stream = req.GetResponse().GetResponseStream()) { } </co...
302,977
Tomcat VS Jetty
<p>I'm wondering about the downsides of each servers in respect to a production environment. Did anyone have big problems with one of the features? Performance, etc. I also quickly took a look at the new Glassfish, does it match up the simple servlet containers (it seems to have a good management interface at least)?</...
302,990
3
3
null
2008-11-19 19:03:47.75 UTC
42
2017-08-01 11:54:03.577 UTC
2017-08-01 11:54:03.577 UTC
null
350,713
null
39,057
null
1
172
java|tomcat|servlets|webserver|jetty
103,506
<p>I love Jetty for its low maintenance cost. It's just unpack and it's ready to roll. Tomcat is a bit high maintenance, requires more configuration and it's heavier. Besides, Jetty's continuations are very cool.</p> <p>EDIT: In 2013, there are reports that Tomcat has gotten easier. See comments. I haven't verified th...
21,938,008
Bootstrap's tooltip moves table cells to right a bit on hover
<p>I am using Bootstrap 3.1.1 for my project. Each cell in my table contains data like <code>000</code> or <code>111</code>. On hover, I want to display this data as a tooltip. So far, this works. However, when I hover over a <code>&lt;td&gt;</code>, all adjacent cells shift to the right.</p> <p><a href="http://jsfidd...
21,938,112
3
0
null
2014-02-21 15:08:49.013 UTC
7
2021-10-26 21:41:18.967 UTC
2014-02-24 09:25:56.243 UTC
null
1,494,102
null
1,494,102
null
1
72
javascript|jquery|html|css|twitter-bootstrap
50,847
<p>You have to add the <code>data-container="body"</code> as per documentation.</p> <pre><code>&lt;td data-original-title="999" data-container="body" data-toggle="tooltip" data-placement="bottom" title=""&gt; &amp;nbsp; &lt;/td&gt; </code></pre> <p><a href="http://jsfiddle.net/uEqF2/2/">http://jsfiddle.net/uEqF2/2/...
41,753,358
Creating custom exceptions in C++
<p>I am learning C++ and I am experiencing when I try and create my own exception and throw them on Linux. </p> <p>I've created a small test project to test my implementation and below is my exception class header file.</p> <pre><code>class TestClass : public std::runtime_error { public: TestClass(char const* con...
41,753,430
3
1
null
2017-01-19 23:06:45.197 UTC
10
2017-07-16 03:56:29.843 UTC
2017-07-16 03:56:29.843 UTC
null
4,505,446
null
499,448
null
1
43
c++|exception
70,729
<p>Your <code>what()</code> returns:</p> <pre><code> return exception::what(); </code></pre> <p>The return value from <code>std::exception::what()</code> is <a href="http://en.cppreference.com/w/cpp/error/exception/what" rel="noreferrer">specified as follows</a>:</p> <blockquote> <p>Pointer to a null-terminated st...
41,683,444
Check to see if a value is within a range?
<p>I have a dataset in a <code>data.table</code> format that looks as such:</p> <pre><code>ID time.s time.e 1 1 2 2 1 4 3 2 3 4 2 4 </code></pre> <p>I want to check to see if the value 1 is within <code>time.s</code> and <code>time.e</code> so that the e...
41,683,627
7
2
null
2017-01-16 19:10:46.343 UTC
3
2022-08-10 08:16:41.61 UTC
2017-09-26 06:17:02.673 UTC
null
2,204,410
null
3,591,401
null
1
14
r
51,825
<p>Assuming that the values of <code>ID</code> are unique:</p> <pre><code>DT[, list(OK = 1 %in% seq(time.s, time.e)), by = ID] </code></pre> <p>giving;</p> <pre><code> ID OK 1: 1 TRUE 2: 2 TRUE 3: 3 FALSE 4: 4 FALSE </code></pre>
54,758,872
Spring Boot Security - Postman gives 401 Unauthorized
<p>I am developing rest APIs in Spring Boot. I am able to do CRUD operations and postman gives correct responses, but when I add Spring Security username and password Postman gives 401 Unauthorized.</p> <p>I have provided a spring boot security username and password as below.</p> <p>application.proptries</p> <pre><c...
54,761,015
2
2
null
2019-02-19 04:29:59.017 UTC
3
2021-01-14 10:21:52.347 UTC
2019-07-03 14:53:23.3 UTC
null
10,961,238
null
10,961,238
null
1
15
java|spring|spring-boot|spring-security|postman
41,684
<pre><code>@Configuration public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter { @Override public void configure(HttpSecurity http) throws Exception { http.csrf().disable().authorizeRequests() .antMatchers("/").permitAll() .antMatchers(HttpMethod.POST,"/newuser").pe...
42,920,602
Calling a lambda with a numpy array
<p>While familiarizing myself with <code>numpy</code>, I noticed an interesting behaviour in <code>numpy</code> arrays:</p> <pre><code>import numpy as np arr = np.array([1, 2, 3]) scale = lambda x: x * 3 scale(arr) # Gives array([3, 6, 9]) </code></pre> <p>Contrast this with normal Python lists:</p> <pre><code>arr...
42,921,093
3
2
null
2017-03-21 07:19:12.833 UTC
3
2020-07-29 15:27:07.27 UTC
2017-03-21 07:53:36.367 UTC
null
1,111,252
null
1,111,252
null
1
11
python|arrays|numpy
62,265
<p><code>numpy.ndarray</code> <a href="https://stackoverflow.com/questions/6892616/python-multiplication-override">overloads</a> the <code>*</code> operator by defining its own <code>__mul__</code> method. Likewise for <code>+</code>, <code>-</code>, etc. This allows for vector arithmetic.</p>
35,976,870
How to set redirect_uri parameter on OpenIdConnectOptions for ASP.NET Core
<p>I'm trying to connect an ASP.NET application to Salesforce using OpenId, Currently this is my connecting code so far. I think I got everything except the redirect_uri parameter, which has to match the value on the other end exactly.</p> <pre class="lang-cs prettyprint-override"><code> app.UseCookieAuthentication(x ...
35,977,924
2
1
null
2016-03-13 22:48:03.82 UTC
9
2020-10-20 11:23:47.57 UTC
2020-10-20 11:23:47.57 UTC
null
1,945,651
null
637,811
null
1
21
asp.net-core|openid-connect
23,490
<p><code>redirect_uri</code> is automatically computed for you using the scheme, host, port and path extracted from the current request and the <code>CallbackPath</code> you specify.</p> <p><code>x.RedirectUri = "https://login.salesforce.com/services/oauth2/success"</code> looks highly suspicious (unless you work for ...
5,941,832
PHP Using RegEx to get substring of a string
<p>I'm looking for an way to parse a substring using PHP, and have come across preg_match however I can't seem to work out the rule that I need. </p> <p>I am parsing a web page and need to grab a numeric value from the string, the string is like this</p> <pre><code>producturl.php?id=736375493?=tm </code></pre> <p>I ...
5,941,925
4
0
null
2011-05-09 19:57:43.183 UTC
7
2019-05-27 02:33:08.093 UTC
null
null
null
null
503,569
null
1
80
php|regex|parsing|substring
129,607
<pre><code>$matches = array(); preg_match('/id=([0-9]+)\?/', $url, $matches); </code></pre> <p>This is safe for if the format changes. slandau's answer won't work if you ever have any other numbers in the URL.</p> <p><a href="http://php.net/manual/en/function.preg-match.php" rel="noreferrer">php.net/preg-match</a></p...
5,856,451
CSS a href styling
<p>i have a href with <code>class="button"</code></p> <p>I am trying to style this like that:</p> <pre><code>.button a:link {text-decoration: none} .button a:visited {text-decoration: none} .button a:active {text-decoration: none} .button a:hover {text-decoration: none; background-color:yellow;color:blue} </code><...
5,856,480
5
5
null
2011-05-02 11:15:41.017 UTC
3
2016-02-19 10:28:11.92 UTC
null
null
null
null
733,323
null
1
6
css
107,198
<p><code>.button a</code> is a <em>descendant selector</em>. It matches all <code>&lt;a&gt;</code> tags that are <em>descendants of</em> <code>.button</code>.</p> <p>You need to write <code>a.button:link</code> to match tags that are both <code>&lt;a&gt;</code> and <code>.button</code>.</p>
2,073,543
Use WinMerge as TortoiseHG Merge tool
<p>I am trying to set up WinMerge as the Merge tool into TortoiseHG; Here is my Mercurial.ini:</p> <pre><code>; User specific Mercurial config file. ; See the hgrc man page for details. [ui] username = Bargio &lt;&gt; merge = winmergeu [extdiff] cmd.winmerge = C:\Program Files (x86)\WinMerge\WinMergeU.exe opts.winm...
2,076,255
2
0
null
2010-01-15 17:30:34.833 UTC
8
2018-09-13 16:51:44.047 UTC
2018-09-13 16:51:44.047 UTC
null
779,956
null
243,873
null
1
31
mercurial|merge|tortoisehg|winmerge
10,788
<p>You can add</p> <pre><code>winmergeu.binary=True </code></pre> <p>as found <a href="https://www.mercurial-scm.org/wiki/MergeToolConfiguration" rel="nofollow noreferrer">here</a> if winmerge can merge binary files. If it can't you'll want to configure another merge tool that can and use matters to send the binary ...
2,140,964
Source of Android's lock screen
<p>I am looking for the source code of the android lock screen. It can be for any version of Android (1.5, 1.6, 2.0, etc).</p> <p>I tried looking in the repository at: <a href="https://android.googlesource.com/" rel="nofollow noreferrer">https://android.googlesource.com/</a>, but it doesn't look like it's under <code>...
2,141,321
2
0
null
2010-01-26 16:50:14.013 UTC
20
2017-07-24 10:13:34.503 UTC
2017-07-24 10:13:34.503 UTC
null
1,000,551
null
237,115
null
1
34
android|android-source
65,403
<p>Do an actual full checkout of the source according to <a href="http://source.android.com/source/downloading.html" rel="noreferrer">Google's directions</a>.</p> <p>As of Android 4.2, the keyguard source is at <code>frameworks/base/policy/src/com/android/internal/policy/impl/keyguard</code>. There's a <a href="https:...
1,434,451
What does "connection reset by peer" mean?
<p>What is the meaning of the "connection reset by peer" error on a TCP connection? Is it a fatal error or just a notification or related to the network failure?</p>
1,434,506
2
0
null
2009-09-16 17:38:58.233 UTC
195
2019-11-03 10:46:18.783 UTC
2017-04-28 09:58:30.533 UTC
null
2,850,474
null
138,579
null
1
827
sockets|tcp
1,163,807
<p>It's fatal. The remote server has sent you a RST packet, which indicates an immediate dropping of the connection, rather than the usual handshake. This bypasses the normal half-closed state transition. I like <a href="http://everything2.com/title/Connection+reset+by+peer" rel="noreferrer">this description</a>:</p> ...
29,648,907
Using geom_rect for time series shading in R
<p>I am trying to shade a certain section of a time series plot (a bit like recession shading - similarly to the graph at the bottom of <a href="https://research.stlouisfed.org/tips/200511/recession_bars.pdf" rel="noreferrer">this article on recession shading in excel</a>). I have put a little, possibly clumsy, sample ...
29,649,575
4
0
null
2015-04-15 11:23:11.48 UTC
9
2019-08-14 16:24:32.123 UTC
2019-02-14 06:51:39.187 UTC
null
680,068
null
857,185
null
1
28
r|date|ggplot2|time-series
34,546
<p>Code works fine, conversion to decimal date is needed for <em>xmin</em> and <em>xmax</em>, see below, requires <em>lubridate</em> package. </p> <pre><code>library("lubridate") library("ggplot2") ggplot(a_series_df)+ geom_line(mapping = aes_string(x = "month", y = "big")) + geom_rect( fill = "red", alpha = ...
5,938,694
DateTime.Parse American Date Format C#
<p>Probably a simple question - </p> <p>I'm reading in data from a number of files. </p> <p>My problem is, that when I'm reading in the date from an american file, I parse it like so:</p> <pre><code>DateSold = DateTime.Parse(t.Date) </code></pre> <p>This parses the string t.Date into a date format, however it forma...
5,938,717
5
0
null
2011-05-09 14:59:01.847 UTC
4
2012-09-14 07:36:57.427 UTC
null
null
null
null
376,083
null
1
26
c#|asp.net|datetime
65,538
<pre><code>var dt = DateTime.ParseExact(t.Date, "MM/dd/yyyy", CultureInfo.InvariantCulture); </code></pre> <p>The DateTime itself has no formatting, it is only when you convert it to or from a string that the format is relevant.</p> <p>To view your date with American format, you pass the format to the ToString method...
5,963,228
Regex for names with special characters (Unicode)
<p>Okay, I have read about regex all day now, and still don't understand it properly. What i'm trying to do is validate a name, but the functions i can find for this on the internet only use <code>[a-zA-Z]</code>, leaving characters out that i need to accept to.</p> <p>I basically need a regex that checks that the nam...
5,963,425
7
0
null
2011-05-11 11:08:08.76 UTC
11
2017-05-16 16:28:56.377 UTC
2017-05-23 10:31:16.803 UTC
null
-1
null
676,713
null
1
13
php|javascript|regex|character-properties
22,250
<p>Try the following regular expression:</p> <pre><code>^(?:[\p{L}\p{Mn}\p{Pd}\'\x{2019}]+\s[\p{L}\p{Mn}\p{Pd}\'\x{2019}]+\s?)+$ </code></pre> <p>In PHP this translates to:</p> <pre><code>if (preg_match('~^(?:[\p{L}\p{Mn}\p{Pd}\'\x{2019}]+\s[\p{L}\p{Mn}\p{Pd}\'\x{2019}]+\s?)+$~u', $name) &gt; 0) { // valid } </c...
17,685,502
In R, getting the following error: "attempt to replicate an object of type 'closure'"
<p>I am trying to write an R function that takes a data set and outputs the plot() function with the data set read in its environment. This means you don't have to use attach() anymore, which is good practice. Here's my example:</p> <pre><code>mydata &lt;- data.frame(a = rnorm(100), b = rnorm(100,0,.2)) plot(mydata$a...
17,687,610
1
1
null
2013-07-16 19:37:41.463 UTC
1
2021-03-06 09:00:30.777 UTC
2021-03-06 09:00:30.777 UTC
null
6,123,824
null
1,997,537
null
1
19
r|functional-programming|closures
50,636
<p>There are a few small issues. <code>ifelse</code> is a vectorized function, but you just need a simple <code>if</code>. In fact, you don't really need an <code>else</code> -- you could just throw an error immediately if the data set does not exist. Note that your error message is not using the name of the object,...
19,305,994
How to Set Banner-Like Background Image With CSS
<p>I have been looking at a lot of the source code for sites and can't seem to figure this out. I want to have an image that's in the background, behind everything. I don't, however, want the entire background to be that image; I only want it towards the top kinda like a banner of sorts. Some examples can be found at <...
19,306,261
1
0
null
2013-10-10 20:51:56.067 UTC
1
2016-12-24 17:15:22.39 UTC
null
null
null
null
2,751,120
null
1
5
html|asp.net|css
53,559
<p>There are several ways to accomplish this.</p> <p>CSS3 allows you to have multiple background images. You can do this:</p> <pre><code>body { background-color: #000; background-image: url(texture.png), url(banner.png); background-position: center center, center top; background-repeat: repeat, no-repeat; } <...
41,621,071
Restore subset of variables in Tensorflow
<p>I am training a Generative Adversarial Network (GAN) in tensorflow, where basically we have two different networks each one with its own optimizer.</p> <pre><code>self.G, self.layer = self.generator(self.inputCT,batch_size_tf) self.D, self.D_logits = self.discriminator(self.GT_1hot) ... self.g_optim = tf.train.Mo...
41,642,426
4
0
null
2017-01-12 19:11:01.147 UTC
13
2018-05-07 14:47:05.17 UTC
2017-01-12 23:42:49.4 UTC
null
472,495
null
2,847,699
null
1
16
python|tensorflow
22,797
<p>To restore a subset of variables, you must create a new <a href="https://www.tensorflow.org/api_docs/python/state_ops/saving_and_restoring_variables#Saver.__init__" rel="noreferrer"><code>tf.train.Saver</code></a> and pass it a specific list of variables to restore in the optional <code>var_list</code> argument.</p>...
69,182,132
A value of type 'Null' can't be assigned to a parameter of type 'String' in a const constructor
<p>I'm unable to use <code>questions[questionNumber]</code> as a Text Constructor in Flutter.</p> <p><strong>Errors:</strong></p> <p>Evaluation of this constant expression throws an exception.dart(const_eval_throws_exception)</p> <p>A value of type 'Null' can't be assigned to a parameter of type 'String' in a const con...
69,182,239
1
0
null
2021-09-14 17:26:07.467 UTC
1
2021-09-14 17:34:58.687 UTC
null
null
null
null
10,559,515
null
1
38
flutter|dart
21,963
<p>Well, the error is due to using the keyword <code>const</code> for the <code>Expanded</code> widget. Just remove it and you will be all good.</p> <p>So this:</p> <pre><code> @override Widget build(BuildContext context) { return Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAl...
31,096,130
How to JSON stringify a javascript Date and preserve timezone
<p>I have a date object that's created by the user, with the timezone filled in by the browser, like so:</p> <pre><code>var date = new Date(2011, 05, 07, 04, 0, 0); &gt; Tue Jun 07 2011 04:00:00 GMT+1000 (E. Australia Standard Time) </code></pre> <p>When I stringify it, though, the timezone goes bye-bye</p> <pre><co...
31,104,671
7
0
null
2015-06-28 04:23:13.11 UTC
28
2022-06-28 19:11:21.927 UTC
null
null
null
null
185,422
null
1
90
javascript|json|date|datetime|momentjs
83,981
<p>Assuming you have some kind of object that contains a <code>Date</code>:</p> <pre><code>var o = { d : new Date() }; </code></pre> <p>You can override the <code>toJSON</code> function of the <code>Date</code> prototype. Here I use moment.js to create a <code>moment</code> object from the date, then use moment's <c...
37,055,382
How can I enable IntelliSense for JavaScript inside HTML?
<p>I want to use VS Code to try out the examples of a JavaScript book, but there's no IntelliSense, or at least I don't know how to activate it.</p> <p>In Visual Studio this feature works out of the box :</p> <p><a href="https://i.stack.imgur.com/kpKTs.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/...
37,082,868
5
0
null
2016-05-05 16:15:09.78 UTC
5
2022-03-21 12:41:58.82 UTC
2022-03-21 12:41:58.82 UTC
null
9,213,345
null
2,736,344
null
1
28
visual-studio-code|intellisense|javascript-intellisense
31,064
<h2>Currently Unsupported</h2> <p><a href="https://github.com/Microsoft/vscode/issues/4369" rel="nofollow noreferrer">JS intellisense doesnt work in HTML script tag - VSCode GitHub Issues #4369</a></p> <p><a href="https://stackoverflow.com/questions/37039910/smart-javascript-suggestions-inside-html-files-no-loger-wor...
24,189,068
Is there a command for formatting HTML in the Atom editor?
<p>I would like to format my HTML with a command, as I do in Visual Studio, using <kbd>Ctrl</kbd>+<kbd>K</kbd>+<kbd>D</kbd>. Is this possible in <a href="https://atom.io/" rel="noreferrer">Atom</a>? If not, are there other options?</p>
25,026,804
6
0
null
2014-06-12 16:08:16.2 UTC
30
2020-08-27 03:11:02.973 UTC
2020-05-29 09:17:42.287 UTC
null
6,904,888
null
376,456
null
1
248
html|atom-editor|code-formatting
186,413
<p>Atom does not have a built-in command for formatting html. However, you can install the <a href="https://atom.io/packages/atom-beautify" rel="noreferrer">atom-beautify</a> package to get this behavior.</p> <ol> <li>Press <kbd>CTRL</kbd> + <kbd>SHFT</kbd> + <kbd>P</kbd> to bring up the command palette (<kbd>CMD</kbd...
33,143,743
read data from MultipartFile which has csv uploaded from browser
<p>May be I am doing it worng by using MultipartFile upload feature.</p> <p>I have to read data from csv file which will be chosen by the client through the browser. I used MultipartFile to upload file. The file is coming to the controller but now I am unable to read csv data from it. Please guide the best way to do i...
33,168,456
3
1
null
2015-10-15 08:40:12.003 UTC
7
2020-12-18 01:55:13.513 UTC
null
null
null
null
3,323,380
null
1
20
spring|spring-mvc|csv
52,707
<p>I figured out a workaround. I converted the file to bytes and then converted the bytes to String. From String I applied string.split() to get what I wanted out of the file.</p> <pre><code> @RequestMapping(value = "/uploadFile", method = RequestMethod.POST) public String uploadFileHandler(@RequestParam("file") Mu...
10,784,208
draw rounded edge arc in android with embossed effect
<p>I am trying to develop a custom component i.e. arc slider, I am done with the arc and the thumb but not able to figure out how can I draw the rounded edge arc and also the embossed effect in it. at the moment the slider looks something like this</p> <p><img src="https://i.stack.imgur.com/Vetl1.png" alt="enter image...
10,797,042
4
1
null
2012-05-28 11:50:23.463 UTC
19
2017-04-30 16:54:22.857 UTC
2012-05-29 08:51:32.577 UTC
null
206,809
null
739,076
null
1
29
android|android-canvas
11,666
<p>I managed to build the arc some what like below</p> <p><img src="https://i.stack.imgur.com/CdKfw.png" alt="enter image description here"></p> <p>What I did is I calculated the arc starting and ending point and there I draw the circle with diameter equal to arc thickness.</p> <p>The code for this is </p> <pre><co...
10,736,238
In a finally block, can I tell if an exception has been thrown
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/184704/is-it-possible-to-detect-if-an-exception-occurred-before-i-entered-a-finally-blo">Is it possible to detect if an exception occurred before I entered a finally block?</a> </p> </blockquote> <p>I have a wo...
10,736,274
3
1
null
2012-05-24 11:03:35.263 UTC
2
2012-05-24 11:14:39.493 UTC
2017-05-23 12:18:15.267 UTC
null
-1
null
156,477
null
1
50
java|exception|try-catch-finally
24,235
<p>There is no automatic way provided by Java. You could use a boolean flag:</p> <pre><code>boolean success = false; try { reportStartWorkflow(); doThis(); doThat(); workHarder(); success = true; } finally { if (!success) System.out.println("No success"); } </code></pre>
7,426,451
what are uri, contentValues
<p>Can anyone explain me about each term that I have used in working with calendar events?</p> <ol> <li><p><code>Uri event_uri = Uri.parse("content://com.android.calendar/" + "events");</code><br> What is uri here, what actually is content, as we can initialize int value to 0? Is it<br> possible to initialize a uri wi...
7,492,847
2
0
null
2011-09-15 05:58:05.15 UTC
17
2015-11-02 07:45:54.753 UTC
2015-11-02 07:45:54.753 UTC
null
2,660,176
null
806,106
null
1
30
android|uri|android-contentresolver
40,034
<p>Regarding questions 1 and 2, A <code>Uri</code> is an address that points to something of significance. In the case of <code>ContentProvider</code>s, the <code>Uri</code> is usually used to determine which table to use. So <code>event_uri</code> points to the events table and the <code>reminder_uri</code> points to ...
23,238,041
Move and resize legends-box in matplotlib
<p>I'm creating plots using Matplotlib that I save as SVG, export to .pdf + .pdf_tex using Inkscape, and include the .pdf_tex-file in a LaTeX document. </p> <p>This means that I can input LaTeX-commands in titles, legends etc., giving an image like this <img src="https://i.stack.imgur.com/NSoiJ.png" alt="plot"></p> <...
23,254,538
3
1
null
2014-04-23 07:46:08.813 UTC
5
2022-08-25 08:15:08.103 UTC
null
null
null
null
1,850,917
null
1
24
python|matplotlib|legend
72,982
<p>You can move a legend after automatically placing it by drawing it, and then getting the bbox position. Here's an example:</p> <pre><code>import matplotlib.pyplot as plt import numpy as np # Plot data x = np.linspace(0,1,100) y = x**2 fig = plt.figure() ax = fig.add_subplot(221) #small subplot to show how the lege...
35,486,826
Transform and filter a Java Map with streams
<p>I have a Java Map that I'd like to transform and filter. As a trivial example, suppose I want to convert all values to Integers then remove the odd entries.</p> <pre><code>Map&lt;String, String&gt; input = new HashMap&lt;&gt;(); input.put("a", "1234"); input.put("b", "2345"); input.put("c", "3456"); input.put("d", ...
35,487,026
6
2
null
2016-02-18 16:19:51.627 UTC
13
2019-01-29 06:09:25.383 UTC
2016-02-18 21:20:08.883 UTC
null
1,743,880
null
2,267,316
null
1
55
java|java-8|java-stream|collectors
68,363
<p>Yes, you can map each entry to another temporary entry that will hold the key and the parsed integer value. Then you can filter each entry based on their value.</p> <pre><code>Map&lt;String, Integer&gt; output = input.entrySet() .stream() .map(e -&gt; new AbstractMap.SimpleEntry&lt;&gt;(e.getK...
35,451,629
redux-form is Destroying my state once the component is unmounted, what gives?
<p>I am not passing in any special config settings nor am I setting/or calling Destroy... but my state is being cleaned... anyway to prevent this? I need the state to stick around as I need that data thruout my application.</p> <pre><code>prev state: I see it in there... via redux-logger action: redux-form/Destroy ne...
40,849,164
2
2
null
2016-02-17 08:41:02.097 UTC
8
2018-02-12 16:22:46.587 UTC
2017-04-24 04:56:35.073 UTC
null
1,082,449
null
1,054,992
null
1
39
javascript|redux|redux-form
21,399
<p>The form's state subtree <em>is</em> destroyed when the form is unmounted, by design. This is the default and expected behaviour. </p> <p><strong>From <a href="https://github.com/erikras/redux-form/pull/2113" rel="noreferrer">v6.2.1</a> onwards</strong> there is a form config property <code>destroyOnUnmount</code>,...
3,701,264
Passing a hash to a function ( *args ) and its meaning
<p>When using an idiom such as:</p> <pre><code>def func(*args) # some code end </code></pre> <p>What is the meaning of <code>*args</code>? Googling this specific question was pretty hard, and I couldn't find anything.</p> <p>It seems all the arguments actually appear in <code>args[0]</code> so I find myself writin...
3,701,314
1
0
null
2010-09-13 14:17:14.877 UTC
25
2018-07-29 17:29:12.9 UTC
2018-07-29 17:29:12.9 UTC
null
2,252,927
null
252,348
null
1
72
ruby
47,453
<p>The <code>*</code> is the <em>splat</em> (or asterisk) operator. In the context of a method, it specifies a variable length argument list. In your case, all arguments passed to <code>func</code> will be putting into an array called <code>args</code>. You could also specify specific arguments before a variable-length...
8,611,700
How exactly does !function(){}() work?
<p>I've seen:</p> <pre><code>!function(){ //code }(); </code></pre> <p>Used in several places to immediately execute an anonymous function. Normally, it's used in lieu of:</p> <pre><code>(function(){ //code }()) </code></pre> <p>Anyone know how the <code>!</code> actually makes the function execute?</p>
8,611,734
2
1
null
2011-12-23 02:36:09.897 UTC
10
2011-12-27 14:52:22.947 UTC
null
null
null
null
84,380
null
1
18
javascript
1,664
<p><em><strong>What the ! does</em></strong></p> <p>When you use <code>!</code>, the function becomes the single operand of the <em>unary (logical) NOT</em> operator. </p> <p>This forces the function to be evaluated as an expression, which allows it to be invoked immediately inline.</p> <hr> <p><em><strong>Other al...
977,090
Fading in a background image
<p>I have a web page that uses a large image for its background. I was hoping to use jQuery to load the image once it is downloaded (basically the way that bing.com loads its background image). Is this possible with jQuery? If so, is there a plugin that you would recommend? </p>
977,161
4
1
null
2009-06-10 17:36:17.63 UTC
8
2012-06-30 10:23:09.42 UTC
2012-06-30 10:23:09.42 UTC
null
502,381
null
118,513
null
1
20
jquery|background-image
90,111
<p>This <a href="http://jqueryfordesigners.com/image-loading/" rel="noreferrer">article</a> may be useful. Copying from there:</p> <p><strong>HTML</strong></p> <pre><code>&lt;div id="loader" class="loading"&gt;&lt;/div&gt; </code></pre> <p><strong>CSS</strong></p> <pre><code>DIV#loader { border: 1px solid #ccc; ...
939,677
Signing assemblies - basics
<p>What does it mean to sign an assembly? And why is it done?</p> <p>What is the simplest way to sign it? What is the .snk file for?</p>
940,767
4
0
null
2009-06-02 13:50:51.703 UTC
11
2013-01-04 03:13:49.597 UTC
2013-01-04 03:10:09.887 UTC
null
63,550
null
66,975
null
1
27
c#|.net|assemblies
10,124
<p>The other two answers are fine, but one additional point. It is easy to get confused between "certificate" signing and "strong name" signing. </p> <p>The purpose of strong name signing is as Stefan Steinegger says: to allow your customer to establish that the code they THINK they're loading really is precisely the ...
399,648
Preventing same Event handler assignment multiple times
<p>If I am assigning an event handler at runtime and it is in a spot that can be called multiple times, what is the recommended practice to prevent multiple assignments of the same handler to the same event.</p> <pre><code>object.Event += MyFunction </code></pre> <p>Adding this in a spot that will be called more than...
399,772
4
2
null
2008-12-30 06:31:21.163 UTC
9
2011-06-08 07:33:21.37 UTC
2011-06-08 07:33:21.37 UTC
null
16,076
overpalm
null
null
1
47
c#|events
20,459
<p>Baget is right about using an explicitly implemented event (although there's a mixture there of explicit interface implementation and the full event syntax). You can probably get away with this:</p> <pre><code>private EventHandler foo; public event EventHandler Foo { add { // First try to remove th...
45,585,000
Azure CLI vs Powershell?
<p>Not precisely able to understand the merit of Azure CLI on Windows environment.</p> <p>Is it targetted for the audience who want to manage Azure IAAS from Linux environment?</p> <p>I thought <a href="https://github.com/PowerShell/PowerShell" rel="noreferrer">Powershell core</a> is going to be the way for non-Windo...
45,585,899
12
1
null
2017-08-09 08:06:36.61 UTC
7
2022-08-10 22:57:40.24 UTC
2021-08-19 09:38:26.55 UTC
null
4,167,200
null
1,431,250
null
1
80
azure|powershell|azure-powershell|azure-cli|azure-cli2
55,762
<p>Azure CLI is a PowerShell-like-tool available for all platforms. You can use the same commands no matter what platform you use: Windows, Linux or Mac.</p> <p>Now, there are two version Azure CLI. The Azure CLI 1.0 was written with Node.js to achieve cross-platform capabilities, and the new Azure CLI 2.0 is written ...
22,295,768
How to use OSM map in an android application.? Is there any tutorial to learn about using OSM in android.?
<p>I am searching for a tutorial/manual or steps to include Open street map into my android application. All I found is either a big project with lot more functionality on it, otherwise so many questions ended without proper conclusion about &quot;HOW&quot;..!</p> <p>Is there any proper blog/site or document that can a...
22,297,373
5
1
null
2014-03-10 08:58:36.433 UTC
13
2020-12-27 13:14:57.867 UTC
2020-12-27 13:14:57.867 UTC
null
1,783,163
null
3,291,467
null
1
17
android|google-maps-api-3|openstreetmap|osmdroid
34,784
<p>I don't know of any tutorials but here's the code I wrote for a minimal example using Osmdroid.</p> <pre><code>// This is all you need to display an OSM map using osmdroid package osmdemo.demo; import org.osmdroid.tileprovider.tilesource.TileSourceFactory; import org.osmdroid.util.GeoPoint; import org.osmdroid.vie...
48,145,432
javascript includes() case insensitive
<p>I have an array of strings that I need to loop and check against with another passed in string.</p> <pre><code>var filterstrings = ['firststring','secondstring','thridstring']; var passedinstring = localStorage.getItem(&quot;passedinstring&quot;); for (i = 0; i &lt; filterstrings.lines.length; i++) { if (passed...
48,145,521
11
2
null
2018-01-08 06:43:02.203 UTC
13
2022-06-22 15:47:17.44 UTC
2021-05-18 23:43:14.863 UTC
null
1,730,638
null
5,921,881
null
1
144
javascript|regex
184,042
<p>You can create a <strong>RegExp</strong> from <code>filterstrings</code> first</p> <pre><code>var filterstrings = ['firststring','secondstring','thridstring']; var regex = new RegExp( filterstrings.join( &quot;|&quot; ), &quot;i&quot;); </code></pre> <p>then <code>test</code> if the <code>passedinstring</code> is th...
29,756,194
Access denied for user 'homestead'@'localhost' (using password: YES)
<p>I'm on a Mac OS Yosemite using Laravel 5.0.</p> <p>While in my <strong>local</strong> environment, I run <code>php artisan migrate</code> I keep getting :</p> <blockquote> <p>Access denied for user 'homestead'@'localhost' (using password: YES)</p> </blockquote> <p><strong>Configuration</strong></p> <p>Here is my <st...
29,772,274
32
2
null
2015-04-20 18:59:20.15 UTC
49
2022-04-15 16:21:38.51 UTC
2020-06-20 09:12:55.06 UTC
null
-1
null
4,480,164
null
1
177
php|laravel|laravel-5|database-migration|homestead
315,956
<h1>Check MySQL UNIX Socket</h1> <p>Find <strong>unix_socket</strong> location using MySQL</p> <p><code>mysql -u homestead -p</code></p> <pre><code>mysql&gt; show variables like '%sock%'; +-----------------------------------------+-----------------------------+ | Variable_name | Value ...
4,235,078
How to avoid infinite recursion with super()?
<p>I have code like this:</p> <pre><code>class A(object): def __init__(self): self.a = 1 class B(A): def __init__(self): self.b = 2 super(self.__class__, self).__init__() class C(B): def __init__(self): self.c = 3 super(self.__class__, self).__init__() </code></p...
4,235,084
1
0
null
2010-11-20 21:22:34.043 UTC
8
2010-11-21 10:32:30.32 UTC
null
null
null
null
477,933
null
1
28
python|oop|multiple-inheritance|super
6,175
<p>When instantiating C calls <code>B.__init__</code>, <code>self.__class__</code> will still be C, so the super() call brings it back to B.</p> <p>When calling super(), use the class names directly. So in B, call <code>super(B, self)</code>, rather than <code>super(self.__class__, self)</code> (and for good measure, ...
4,254,694
Is it possible to access the TempData key/value from HttpContext?
<p>I'm trying to crate a custom action filter attribute. And some where, I need facilities, such us TempData[key] and TryUpdateModel... My custom attribute class deriving from the <strong>ActionFilterAttribute</strong>, I can access both below methods.</p> <pre><code>public override void OnActionExecuting(ActionExecut...
4,254,731
1
0
null
2010-11-23 09:48:46.153 UTC
3
2018-07-25 14:50:13.507 UTC
2018-07-25 14:50:13.507 UTC
null
1,180,926
null
202,382
null
1
31
asp.net-mvc|attributes|tempdata
8,769
<pre><code>var foo = filterContext.Controller.TempData["foo"]; </code></pre>
25,049,751
Constructing an Abstract Syntax Tree with a list of Tokens
<p>I want to construct an AST from a list of tokens. I'm making a scripting language and I've already done the lexical analysis part, but I have no idea how to create an AST. So the question is, how do I take something like this:</p> <pre><code>WORD, int WORD, x SYMBOL, = NUMBER, 5 SYMBOL, ; </code></pre> <p>and conv...
25,106,688
1
3
null
2014-07-31 02:08:41.01 UTC
40
2018-05-06 11:40:17.793 UTC
null
null
null
null
3,839,220
null
1
48
java|interpreter|abstract-syntax-tree
33,858
<p>The fundamental trick is to recognize that parsing, however accomplished, happens in incremental steps, including the reading of the tokens one by one.</p> <p>At each incremental step, there is an opportunity to build part of the AST by combining AST fragments built by other incremental steps. This is a recursive ...
20,211,890
SVG - Change fill color on button click
<p>I've done a simple test svg-image. </p> <p>I would like to make toggle buttons so when I click on btn-test1, the path1 will be fill="#000" and the others "#FFF". I'm going to make a map with around 40 different paths, but I'm trying this first (don't know if it's possible) ? </p> <p><strong>Here's the HTML so far:...
20,212,046
3
1
null
2013-11-26 08:29:31.487 UTC
7
2017-02-11 10:49:39.11 UTC
2013-11-26 08:47:31.687 UTC
null
1,472,067
null
1,472,067
null
1
18
jquery|svg
74,240
<p>You are looking for the <code>fill</code> property.</p> <p>See this fiddle: <strong><a href="http://jsfiddle.net/P6t2B/">http://jsfiddle.net/P6t2B/</a></strong></p> <p>For example:</p> <pre><code>$('#btn-test1').on("click", function() { $('#path1').css({ fill: "#ff0000" }); }); </code></pre>
7,585,210
WebView, add local .CSS file to an HTML page?
<p>In android I'm using WebView to display a part of a webpage which I fetched from the internet using HttpClient from Apache. To only have the part I want from the html, I use Jsoup.</p> <pre><code>String htmlString = EntityUtils.toString(entity4); // full html as a string Document htm...
7,736,654
3
3
null
2011-09-28 14:56:31.313 UTC
29
2020-07-30 05:40:09.747 UTC
2020-07-30 05:40:09.747 UTC
null
214,143
null
717,572
null
1
39
android|html|css|resources|httpclient
50,548
<p>Seva Alekseyev is right, you should store CSS files in <code>assets</code> folder, but referring by <code>file:///android_asset/filename.css</code> URL doesn't working for me.</p> <p>There is another solution: put CSS in <code>assets</code> folder, do your manipulation with HTML, but <strong>refer to CSS by relativ...
7,598,422
Is it better to use the mapred or the mapreduce package to create a Hadoop Job?
<p>To create MapReduce jobs you can either use the old <code>org.apache.hadoop.mapred</code> package or the newer <code>org.apache.hadoop.mapreduce</code> package for Mappers and Reducers, Jobs ... The first one had been marked as deprecated but this got reverted meanwhile. Now I wonder whether it is better to use the ...
7,600,339
3
2
null
2011-09-29 13:57:54.757 UTC
18
2015-03-22 15:27:10.09 UTC
2015-03-22 15:27:10.09 UTC
null
3,275,167
null
808,388
null
1
46
hadoop|mapreduce
16,176
<p>Functionality wise there is not much difference between the old (<code>o.a.h.mapred</code>) and the new (<code>o.a.h.mapreduce</code>) API. The only significant difference is that records are pushed to the mapper/reducer in the old API. While the new API supports both pull/push mechanism. You can get more informatio...
7,655,393
Clear Contents of a Column
<p>How would I clear the contents of a column from cell A3 to cell __ where __ represents the last entry in the column (assuming there are no empty spaces between entries).</p> <p>Thanks for the help.</p>
7,655,488
4
0
null
2011-10-05 00:08:01.06 UTC
0
2021-03-13 07:58:26.48 UTC
2018-04-02 18:31:47.213 UTC
null
8,112,776
null
977,343
null
1
5
vba|excel
71,171
<pre><code>range(&quot;A3&quot;, Range(&quot;A&quot; &amp; Columns(&quot;A&quot;).SpecialCells(xlCellTypeLastCell).Row)).Delete </code></pre> <p>That will delete A3 through the last cell in column A, regardless of any blanks in the column.</p> <pre><code>range(&quot;A3&quot;, range(&quot;A3&quot;).End(xlDown)).Delete <...
7,199,911
how to File.listFiles in alphabetical order?
<p>I've got code as below:</p> <pre><code>class ListPageXMLFiles implements FileFilter { @Override public boolean accept(File pathname) { DebugLog.i("ListPageXMLFiles", "pathname is " + pathname); String regex = ".*page_\\d{2}\\.xml"; if(pathname.getAbs...
7,199,929
4
1
null
2011-08-26 04:04:31.753 UTC
13
2019-03-14 13:30:20.603 UTC
2011-08-26 04:22:40.913 UTC
null
272,824
null
194,309
null
1
105
java|java-io
133,414
<p>The <code>listFiles</code> method, with or without a filter does not guarantee any order.</p> <p>It does, however, return an array, which you can sort with <code>Arrays.sort()</code>.</p> <pre><code>File[] files = XMLDirectory.listFiles(filter_xml_files); Arrays.sort(files); for(File _xml_file : files) { ... }...
7,814,794
How to structure a Node, Express, Connect-Auth and Backbone application on the server-side?
<p>I'm a client-side guy that just stepped into the world of server-side javascript. I've got this idea about how I think I want to build my first Nodejs application. I want a server-side that pretty much only serves an empty shell and lots of JSON. I want to put the rest of the logic in a Backbone.js-equipped front-en...
7,821,013
1
2
null
2011-10-18 23:02:25.41 UTC
15
2011-10-19 12:05:32.463 UTC
2011-10-19 10:11:11.44 UTC
null
672,132
null
672,132
null
1
10
javascript|node.js|backbone.js|express
6,956
<p>I think you have the right idea, although I'll throw out a couple of thoughts:</p> <ul> <li><strong>Defining Routes</strong> - If you are defining a lot of routes, especially with JSON, you may want to define them dynamically via an MVC type framework. You can find a good example of that <a href="https://github.com...
1,415,256
Alignment requirements for atomic x86 instructions vs. MS's InterlockedCompareExchange documentation?
<p>Microsoft offers the <a href="http://msdn.microsoft.com/en-us/library/ms683560%28VS.85%29.aspx" rel="nofollow noreferrer"><code>InterlockedCompareExchange</code></a> function for performing atomic compare-and-swap operations. There is also an <a href="https://msdn.microsoft.com/en-us/library/ttk2z1ws.aspx" rel="nofo...
5,178,914
4
2
null
2009-09-12 14:24:08.14 UTC
14
2019-11-27 07:40:09.043 UTC
2019-11-27 07:40:09.043 UTC
null
224,132
null
33,213
null
1
37
winapi|x86|atomic|memory-alignment|interlocked
6,417
<p>The <a href="http://download.intel.com/design/intarch/manuals/24319101.pdf">PDF you are quoting from</a> is from 1999 and CLEARLY outdated.</p> <p>The <a href="http://www.intel.com/products/processor/manuals/">up-to-date Intel documentation</a>, specifically <a href="http://www.intel.com/Assets/PDF/manual/253668.pd...
1,699,582
JavaScript: How to select "Cancel" by default in confirm box?
<p>I am displaying a JavaScript confirm box when the user clicks on the "Delete Data" button. I am displaying it as shown in this image: </p> <p><img src="https://i.stack.imgur.com/7KQn2.jpg" alt="alt text"></p> <p>In the image, the "OK" button is selected by default. I want to select the "Cancel" button by default, ...
1,699,600
4
4
null
2009-11-09 07:33:37.82 UTC
6
2021-02-17 20:35:22.03 UTC
2014-09-20 07:39:44.757 UTC
null
1,402,846
null
45,261
null
1
37
javascript|jquery|confirm
35,967
<p>If you can use jQuery plugin then here is a nice one</p> <p><a href="http://trentrichardson.com/Impromptu/" rel="nofollow noreferrer">jQuery Impromptu</a></p> <p>To change the default focused button:</p> <pre><code>$.prompt('Example 4',{ buttons: { Ok: true, Cancel: false }, focus: 1 }); </code></pre>
1,379,565
How to fetch the first and last record of a grouped record in a MySQL query with aggregate functions?
<p>I am trying to fetch the first and the last record of a 'grouped' record.<br> More precisely, I am doing a query like this</p> <pre><code>SELECT MIN(low_price), MAX(high_price), open, close FROM symbols WHERE date BETWEEN(.. ..) GROUP BY YEARWEEK(date) </code></pre> <p>but I'd like to get the first and the last re...
1,552,389
4
1
null
2009-09-04 14:20:14.54 UTC
24
2019-02-07 23:35:34.86 UTC
2016-08-09 16:22:00.943 UTC
null
182,371
null
93,480
null
1
39
mysql|aggregate-functions
90,809
<p>You want to use <code>GROUP_CONCAT</code> and <code>SUBSTRING_INDEX</code>:</p> <pre><code>SUBSTRING_INDEX( GROUP_CONCAT(CAST(open AS CHAR) ORDER BY datetime), ',', 1 ) AS open SUBSTRING_INDEX( GROUP_CONCAT(CAST(close AS CHAR) ORDER BY datetime DESC), ',', 1 ) AS close </code></pre> <p>This avoids expensive sub q...
49,720,178
Xcode not supported for iOS 11.3 by Xcode 9.2 needed 9.3
<p>Apparently, with the latest IOS update, my version of Xcode could not build due to the following error.</p> <blockquote> <p>Could not locate device support files. This iPhone 7 Plus (Model 1661, 1784, 1785, 1786) is running iOS 11.3 (15E216), which may not be supported by this version of Xcode.</p> </blockquote> ...
49,790,425
8
6
null
2018-04-08 16:36:59.78 UTC
15
2020-02-14 09:17:18.7 UTC
2018-04-08 16:40:58.793 UTC
null
4,812,515
null
4,812,515
null
1
48
ios|xcode|xcode9.3
63,469
<p>Another option is to download the 11.3 device support at:</p> <p><a href="https://github.com/filsv/iPhoneOSDeviceSupport/issues/7" rel="noreferrer">iOS 11.3 (15E217)</a></p> <p>And don't forget to remove "(15E217)" from folder name, so it became "11.3". Restart Xcode afterwards.</p> <p><a href="https://i.stack.im...
10,491,631
Need to select ALL columns while using COUNT/Group By
<p>Ok so I have a table in which ONE of the columns have a FEW REPEATING records.</p> <p>My task is to select the REPEATING records with all attributes.</p> <p>CustID FN LN DOB City State</p> <p>the DOB has some repeating values which I need to select from the whole table and list all columns of all records that are...
10,491,917
4
2
null
2012-05-08 02:10:35.197 UTC
3
2016-03-02 08:51:58.477 UTC
null
null
null
null
1,373,003
null
1
8
sql|sql-server|database|group-by
40,430
<p>I think a more general solution is to use windows functions:</p> <pre><code>select * from (select *, count(*) over (partition by dob) as NumDOB from table ) t where numDOB &gt; 1 </code></pre> <p>The reason this is more general is because it is easy to change to duplicates across two or more columns.</p...
10,487,104
Difference between List and Array
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/7869212/primitive-array-vs-arraylist">Primitive Array vs ArrayList</a> </p> </blockquote> <p>What is the difference between List and Array in java? or the difference between Array and Vector!</p>
10,487,175
1
2
null
2012-05-07 18:25:40.4 UTC
12
2019-06-10 19:30:59.227 UTC
2017-05-23 11:54:07.15 UTC
null
-1
null
1,380,430
null
1
37
java
95,658
<p>In general (and in Java) an array is a data structure generally consisting of sequential memory storing a collection of objects.</p> <p><code>List</code> is an <a href="http://en.wikipedia.org/wiki/Interface_%28Java%29" rel="noreferrer">interface</a> in Java, which means that it may have multiple implementations. O...
49,215,791
VS Code C# - System.NotSupportedException: No data is available for encoding 1252
<p>I am trying to use ExcelDataReader to read an .xls file on Ubuntu. I am using VS Code with C#. Here is the code:</p> <pre><code>var stream = File.Open(filePath, mode: FileMode.Open, access: FileAccess.Read); var reader = ExcelReaderFactory.CreateReader(stream); </code></pre> <p>I also tried this:</p> <pre><code>v...
49,701,230
1
4
null
2018-03-11 01:36:25.727 UTC
9
2022-05-16 06:00:44.527 UTC
null
null
null
null
1,930,814
null
1
69
c#|visual-studio-code|xls|exceldatareader
37,322
<p>I faced the same problem with .net Core application. I added the <code>System.Text.Encoding.CodePages</code> nuget package and registered the encoding provider before <code>ExcelReaderFactory.CreateReader(stream)</code> which resolved the issue.</p> <pre><code>System.Text.Encoding.RegisterProvider(System.Text.CodeP...
7,221,981
How to allocate and deallocate heap memory for 2D array?
<p>I'm used to PHP, but I'm starting to learn C. I'm trying to create a program that reads a file line by line and stores each line to an array.</p> <p>So far I have a program that reads the file line by line, and even prints each line as it goes, but now I just need to add each line to an array.</p> <p>My buddy last...
7,222,039
6
2
null
2011-08-28 15:51:16.28 UTC
4
2020-05-13 06:20:32.507 UTC
2020-05-13 06:20:32.507 UTC
null
3,396,951
null
266,542
null
1
15
c|arrays|file|loops|multidimensional-array
48,031
<p>To dynamically allocate a 2D array:</p> <pre><code>char **p; int i, dim1, dim2; /* Allocate the first dimension, which is actually a pointer to pointer to char */ p = malloc (sizeof (char *) * dim1); /* Then allocate each of the pointers allocated in previous step arrays of pointer to chars * within each of t...
7,305,612
junit arrays not equal test
<p>I'm trying to write a test case where my scenario is that two <strong>byte arrays</strong> should be <strong>not equal</strong>.</p> <p>Can I do this with junit?</p> <p>Or do I have to use something external like Hamcrest? <a href="https://stackoverflow.com/questions/1096650/why-doesnt-junit-provide-assertnotequa...
7,305,637
6
0
null
2011-09-05 08:34:14.497 UTC
2
2022-09-23 21:15:02.82 UTC
2018-08-17 12:27:49.957 UTC
null
1,610,034
null
928,499
null
1
45
java|arrays|junit
40,382
<p>I prefer doing this the Hamcrest way, which is more expressive:</p> <pre><code>Assert.assertThat(array1, IsNot.not(IsEqual.equalTo(array2))); </code></pre> <p>Or the short version with static imports:</p> <pre><code>assertThat(array1, not(equalTo(array2))); </code></pre> <p>(The <code>IsEqual</code> matcher is s...
7,054,188
Is it possible to negate a scope in Rails?
<p>I have the following scope for my class called <code>Collection</code>:</p> <pre><code>scope :with_missing_coins, joins(:coins).where("coins.is_missing = ?", true) </code></pre> <p>I can run <code>Collection.with_missing_coins.count</code> and get a result back -- it works great! Currently, if I want to get collec...
7,054,274
7
0
null
2011-08-14 00:30:57.627 UTC
4
2022-06-07 09:03:28.623 UTC
2022-02-12 10:14:54.693 UTC
null
1,511,504
null
118,175
null
1
44
ruby-on-rails|ruby|named-scope
27,554
<p>I wouldn't use a single scope for this, but two:</p> <pre><code>scope :with_missing_coins, joins(:coins).where("coins.is_missing = ?", true) scope :without_missing_coins, joins(:coins).where("coins.is_missing = ?", false) </code></pre> <p>That way, when these scopes are used then it's explicit what's happening. Wi...
7,271,082
How to reload a module's function in Python?
<p>Following up on <a href="https://stackoverflow.com/questions/437589/how-do-i-unload-reload-a-python-module">this question regarding reloading a module</a>, how do I reload a specific function from a changed module?</p> <p>pseudo-code:</p> <pre><code>from foo import bar if foo.py has changed: reload bar </code...
7,274,356
8
0
null
2011-09-01 13:34:03.777 UTC
12
2020-10-18 23:36:03.727 UTC
2017-05-23 10:30:49.48 UTC
null
-1
null
348,545
null
1
60
python|methods|import|reload
61,615
<p>What you want is possible, but requires reloading two things... first <code>reload(foo)</code>, but then you also have to <code>reload(baz)</code> (assuming <code>baz</code> is the name of the module containing the <code>from foo import bar</code> statement).</p> <p>As to why... When <code>foo</code> is first loade...
7,334,035
get ec2 pricing programmatically?
<p>Is there a way to get AWS pricing programmatically (cost per hour of each instance type, cost per GB/month of storage on S3, and etc)?</p> <p>Also, are there cost monitoring tools? For example, is there a tool that can report your EC2 instance usage on an hourly basis (versus a monthly basis, which is what Amazon ...
7,334,197
12
0
null
2011-09-07 12:40:43.147 UTC
33
2022-07-13 13:43:57.33 UTC
null
null
null
null
891,441
null
1
50
amazon-ec2|amazon-web-services
32,930
<p><strong>UPDATE:</strong></p> <p>There is now AWS pricing API: <a href="https://aws.amazon.com/blogs/aws/new-aws-price-list-api/" rel="noreferrer">https://aws.amazon.com/blogs/aws/new-aws-price-list-api/</a></p> <p><strong>Orginal answer:</strong></p> <p>The price lists are available in form of JSONP files (you ne...
7,376,966
Heroku problem : The page you were looking for doesn't exist
<p>I have followed book until chapter 5 finished and it's working OK in my linux workstation when I push to Heroku, all data pushed correctly but when I try to open Heroku (http://vivid-sky-685.heroku.com)</p> <p>I get a 404 message.</p> <blockquote> <p>The page you were looking for doesn't exist. You may have mi...
7,546,073
13
3
null
2011-09-11 07:46:18.58 UTC
10
2019-12-02 17:22:32.693 UTC
2013-06-06 13:49:30.49 UTC
user1228
null
null
938,947
null
1
29
ruby-on-rails
57,869
<p>I got the same problem; however, after changing 1 line code of production.rb located in <code>config/environments/production.rb</code> from</p> <pre><code>config.assets.compile = false </code></pre> <p>to</p> <pre><code>config.assets.compile = true </code></pre> <p>commit the new change. Then my sample app works...
14,338,156
Formatting Excel cells (currency)
<p>I developed an Add-In for Excel so you can insert some numbers from a MySQL database into specific cells. Now I tried to format these cells to currency and I have two problems with that. 1. When using a formula on formatted cells, the sum for example is displayed like that: "353,2574€". What do I have to do to displ...
14,338,842
1
0
null
2013-01-15 12:51:06.823 UTC
2
2017-02-22 02:39:55.837 UTC
2013-01-15 13:23:03.797 UTC
null
238,902
null
1,980,278
null
1
19
c#|excel|format|currency
60,174
<p>This one works for me. I have excel test app that formats the currency into 2 decimal places with comma as thousand separator. Below is the Console Application that writes data on Excel File.</p> <p>Make sure you have referenced Microsoft.Office.Interop.Excel dll</p> <pre><code>using System.Collections.Generic; u...
14,097,388
Can an algorithm detect sarcasm
<p>I was asked to write an algorithm to detect sarcasm but I came across a flaw (or what seems like one) in the logic.</p> <p>For example if a person says</p> <blockquote> <p>A: I love Justin Beiber. Do you like him to?</p> <p>B: Yeah. Sure. <i>I absolutely love him.</i></p> </blockquote> <p>Now this may be considered ...
14,099,786
4
18
null
2012-12-31 04:21:12.483 UTC
19
2012-12-31 09:37:35.437 UTC
2020-06-20 09:12:55.06 UTC
null
-1
null
1,059,273
null
1
37
algorithm|nlp
10,054
<p>Looks like there are studies that attempted just that, but they have yet to come up with a well working algorithm.</p> <p>From <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.207.5253&amp;rep=rep1&amp;type=pdf" rel="noreferrer">González-Ibáñez, R. et al. "Identifying sarcasm in Twitter: a closer l...
13,900,515
How can I access a classmethod from inside a class in Python
<p>I would like to create a class in Python that manages above all static members. These members should be initiliazed during definition of the class already. Due to the fact that there will be the requirement to reinitialize the static members later on I would put this code into a classmethod.</p> <p>My question: How...
13,900,861
7
2
null
2012-12-16 10:47:01.777 UTC
6
2021-11-14 18:28:22.23 UTC
null
null
null
null
1,907,681
null
1
41
python|class-members
43,500
<p>At the time that <code>x=10</code> is executed in your example, not only does the class not exist, but the classmethod doesn't exist either.</p> <p>Execution in Python goes top to bottom. If <code>x=10</code> is above the classmethod, there is no way you can access the classmethod at that point, because it hasn't ...
14,119,277
Subtract two dates in SQL and get days of the result
<pre><code>Select I.Fee From Item I WHERE GETDATE() - I.DateCreated &lt; 365 days </code></pre> <p>How can I subtract two days? Result should be days. Ex: 365 days. 500 days.. etc...</p>
14,119,294
7
0
null
2013-01-02 09:03:11.85 UTC
4
2021-02-01 05:39:41.777 UTC
2013-01-02 09:19:27.833 UTC
null
13,302
null
1,218,067
null
1
44
sql|sql-server|tsql
189,188
<p>Use <a href="http://msdn.microsoft.com/en-us/library/ms189794.aspx">DATEDIFF</a></p> <pre><code>Select I.Fee From Item I WHERE DATEDIFF(day, GETDATE(), I.DateCreated) &lt; 365 </code></pre>
14,007,545
Python Regex instantly replace groups
<p>Is there any way to directly replace all groups using regex syntax?</p> <p>The normal way:</p> <pre><code>re.match(r"(?:aaa)(_bbb)", string1).group(1) </code></pre> <p>But I want to achieve something like this:</p> <pre><code>re.match(r"(\d.*?)\s(\d.*?)", "(CALL_GROUP_1) (CALL_GROUP_2)") </code></pre> <p>I want...
14,007,559
2
0
null
2012-12-22 23:45:57.31 UTC
17
2019-09-11 08:51:47.837 UTC
2018-05-04 01:16:10.173 UTC
null
3,071,419
user1467267
null
null
1
157
python|regex|regex-group
119,944
<p>Have a look at <a href="http://docs.python.org/2/library/re.html#re.sub" rel="noreferrer"><code>re.sub</code></a>:</p> <pre><code>result = re.sub(r"(\d.*?)\s(\d.*?)", r"\1 \2", string1) </code></pre> <p>This is Python's regex substitution (replace) function. The replacement string can be filled with so-called back...
30,045,417
Android Gradle Could not reserve enough space for object heap
<p>I've installed Android Studio 1.1.0. I haven't done anything yet like start new Android application or import anything. Somehow it is trying to build something and it throws sync error.</p> <blockquote> <p>Error:Unable to start the daemon process. This problem might be caused by incorrect configuration of the d...
31,760,855
8
7
null
2015-05-05 06:10:25.033 UTC
28
2021-10-08 22:10:01.74 UTC
2021-10-08 22:10:01.74 UTC
null
5,459,839
null
1,031,959
null
1
101
android|gradle|jvm|heap-memory
145,422
<p>For Android Studio 1.3 : (Method 1)</p> <p>Step 1 : Open <strong>gradle.properties</strong> file in your Android Studio project.</p> <p>Step 2 : Add this line at the end of the file</p> <pre><code>org.gradle.jvmargs=-XX\:MaxHeapSize\=256m -Xmx256m </code></pre> <p>Above methods seems to work but if in case it wo...
30,211,605
Javascript HTML collection showing as 0 length
<pre><code> var eval_table = document.getElementsByClassName("evaluation_table"); console.log(eval_table); </code></pre> <p>This displays as:</p> <pre><code>[item: function, namedItem: function]0: table.widefat.fixed.evaluation_table length: 1 __proto__: HTMLCollection </code></pre> <p>However, when ...
30,212,541
3
7
null
2015-05-13 10:04:41.58 UTC
8
2019-06-09 03:31:49.683 UTC
2015-05-13 10:16:13.083 UTC
null
4,141,176
null
4,141,176
null
1
31
javascript
42,956
<p>This is because your JS is running before the elements are rendered to the DOM. I bet the script you have running is loaded before the <code>&lt;body&gt;</code> of your html. You have two options:</p> <ol> <li>Add the self-executing <code>&lt;script&gt;</code> as the last thing in your <code>&lt;body&gt;</code> tag...
44,956,653
Selecting block of code in Visual Studio Code
<p>Is there a keyboard shortcut or an extension that would allow me to select a block of code?</p> <p>I'd like to select everything between curly braces, between HTML tags, etc.</p>
64,222,679
8
2
null
2017-07-06 18:42:46.763 UTC
5
2022-07-01 12:03:33.823 UTC
2020-12-30 05:35:39.353 UTC
null
63,550
null
336,431
null
1
46
visual-studio-code
36,878
<p>On Mac <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>→</kbd> to expand the selection. Press multiple times to expand to the block.</p>
1,176,427
Shared libraries and .h files
<p>I have some doubt about how do programs use shared library.</p> <p>When I build a shared library ( with -shared -fPIC switches) I make some functions available from an external program. Usually I do a dlopen() to load the library and then dlsym() to link the said functions to some function pointers. This approach d...
1,186,836
5
0
null
2009-07-24 08:36:51.397 UTC
21
2021-12-30 01:53:08.633 UTC
null
null
null
null
144,333
null
1
14
c++|c|shared-libraries|fpic
24,799
<p>Nick, I think all the other answers are actually answering your question, which is how you link libraries, but the way you phrase your question suggests you have a misunderstanding of the difference between headers files and libraries. They are not the same. You need <em>both</em>, and they are not doing the same t...
1,096,591
How to hide cmd window while running a batch file?
<p>How to hide cmd window while running a batch file?</p> <p>I use the following code to run batch file</p> <pre><code>process = new Process(); process.StartInfo.FileName = batchFilePath; process.Start(); </code></pre>
1,096,626
5
0
null
2009-07-08 07:22:28.933 UTC
7
2020-11-08 22:00:49.407 UTC
2010-03-08 02:28:16.277 UTC
null
164,901
null
14,118
null
1
22
c#|process|batch-file
45,742
<p>If proc.StartInfo.UseShellExecute is <strong>false</strong>, then you are launching the process and can use:</p> <pre><code>proc.StartInfo.CreateNoWindow = true; </code></pre> <p>If proc.StartInfo.UseShellExecute is <strong>true</strong>, then the OS is launching the process and you have to provide a "hint" to the...
257,433
PostgreSQL UNIX domain sockets vs TCP sockets
<p>I wonder if the UNIX domain socket connections with postgresql are faster then tcp connections from localhost in high concurrency rate and if it does, by how much?</p>
257,479
5
1
null
2008-11-02 21:50:29.797 UTC
27
2012-08-24 09:13:14.447 UTC
2008-11-02 22:16:08.92 UTC
null
20,955
null
20,955
null
1
53
performance|postgresql|tcp|sockets
23,744
<p>UNIX domain sockets should offer better performance than TCP sockets over loopback interface (less copying of data, fewer context switches), but I don't know whether the performance increase can be demonstrated with PostgreSQL.</p> <p>I found a small comparison on the FreeBSD mailinglist: <a href="http://lists.free...
1,107,437
Learn Joomla in a Weekend
<p>Long story short, I need to get up to speed with Joomla <em>fast</em>. I only have this weekend to do that which translates to about 12 hours of time. Right now I only know that Joomla is an open source CMS written in PHP. What would be the best way to familiarize myself with Joomla in this short amount of time? Off...
1,131,288
6
3
null
2009-07-10 02:45:43.18 UTC
12
2011-12-27 19:29:40.203 UTC
null
null
null
null
66,449
null
1
15
joomla
4,786
<p>I was in a similar situation. I purchased "Joomla! A User's Guide: Building a Successful Joomla! Powered Website" by Barrie M. North. This was big help.</p> <p>Next, I'd start out with some really good Joomla templates that were created by others. I like to learn from example, so here are the good examples I'd reco...
313,839
What is the best way to write event log entries?
<p>I recently had a problem during the deployment of a windows service. Four computers did not cause any problems, but on the fifth any attempt to start the service failed due to an exception. The exception stack trace is written to the event log, so I though it should be easy to identify the cause:</p> <pre><code>pro...
313,865
6
0
null
2008-11-24 10:33:23.27 UTC
10
2009-06-04 12:17:09.173 UTC
2009-03-11 15:34:46.047 UTC
Treb
22,114
Treb
22,114
null
1
16
.net|event-log
19,893
<p>I think logging exceptions is one of the rare cases where you are better off swallowing the exception. In most cases you don't want your app to fail on this.</p> <p>But why are you writing your logging code yourself anyway? Use a framework like NLog or Log4Net! These also swallow exceptions like I just said but you...
1,273,687
Why or why not should I use 'UL' to specify unsigned long?
<pre><code>ulong foo = 0; ulong bar = 0UL;//this seems redundant and unnecessary. but I see it a lot. </code></pre> <p>I also see this in referencing the first element of arrays a good amount</p> <pre><code>blah = arr[0UL];//this seems silly since I don't expect the compiler to magically //turn '0' in...
1,273,749
6
0
null
2009-08-13 18:15:38.823 UTC
4
2015-06-08 15:11:42.5 UTC
null
null
null
null
136,396
null
1
16
c++
42,903
<pre><code>void f(unsigned int x) { // } void f(int x) { // } ... f(3); // f(int x) f(3u); // f(unsigned int x) </code></pre> <p>It is just another tool in C++; if you don't need it don't use it!</p>
44,034
How can I get the definition (body) of a trigger in SQL Server?
<p>Unable to find a SQL diff tool that meets my needs, I am writing my own. Between the INFORMATION_SCHEMA and sys tables, I have a mostly-complete working version. But one thing I can't find in the metadata is the <em>definition</em> of a trigger, you know, the actual SQL code. Am I overlooking something?</p> <p>T...
44,045
6
2
null
2008-09-04 15:46:07.743 UTC
8
2019-12-10 11:15:44.07 UTC
2013-01-24 12:22:04.033 UTC
null
50,776
null
4,525
null
1
29
sql-server|triggers|metadata
51,463
<p>sp_helptext works to get the sql that makes up a trigger.</p> <p>The text column in the syscomments view also contains the sql used for object creation.</p>
37,772,798
Unable to self-update Composer
<p>I am trying to update Composer without any luck!</p> <p>What I have tried:</p> <pre><code>$ composer self-update </code></pre> <blockquote> <p>[InvalidArgumentException] Command &quot;self-update&quot; is not defined.</p> </blockquote> <pre><code>$ sudo -H composer self-update </code></pre> <blockquote> <p>[InvalidA...
37,788,750
10
3
null
2016-06-12 09:42:28.297 UTC
14
2022-05-19 13:45:39.843 UTC
2021-04-21 15:21:09.713 UTC
null
63,550
null
1,431,096
null
1
88
php|composer-php
152,133
<p>Since I posted my answer, I have learnt a new easier way to install Composer programmatically: <em><a href="https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md" rel="noreferrer">How do I install Composer programmatically?</a></em></p> <h2>Old Answer:</h2> <hr /> <p>As per @JimL comment, I wa...
37,700,536
Visual studio code terminal, how to run a command with administrator rights?
<p>The new version 1.2.0 include a terminal, but when I try to install any pack with node I get the npm ERR! code EPERM that I usually solve right clicking and running it as administrator. So how I do that in the vscode terminal? There is something like sudo for linux?</p> <p><a href="https://cloud.githubusercontent.c...
39,948,482
7
3
null
2016-06-08 10:55:28.183 UTC
42
2022-08-31 18:06:21.9 UTC
2019-04-12 22:39:27.813 UTC
null
349,659
null
1,475,004
null
1
151
windows|npm|visual-studio-code
212,634
<h3>Option 1 - Easier &amp; Persistent</h3> <p>Running Visual Studio Code as Administrator should do the trick.</p> <p>If you're on Windows you can:</p> <ol> <li>Right click the shortcut or app/exe</li> <li>Go to properties</li> <li>Compatibility tab</li> <li>Check "Run this program as an administrator"</li> </ol> ...
20,930,401
Smooth transitioning between tree, cluster, radial tree, and radial cluster layouts
<p>For a project, I need to interactively change hierarchical data layout of a visualization - without any change of the underlying data whatsoever. The layouts capable of switching between themselves should be tree, cluster, radial tree, and radial cluster. And transitioning should be preferably an animation.</p> <p>...
20,972,522
2
4
null
2014-01-05 05:20:42.173 UTC
22
2014-01-07 13:11:35.917 UTC
2014-01-06 19:36:44.623 UTC
null
3,052,751
null
3,052,751
null
1
22
d3.js|hierarchy|hierarchical-data|dendrogram
9,346
<p>I don't have enough reputation to make a comment...so, I am just giving this tiny contribution as a pseudo-answer. After looking at this <a href="https://stackoverflow.com/questions/20970688/d3-js-drag-and-drop-zoomable-panning-collapsible-tree-with-auto-sizing-need">post</a>, and based on @VividD's perfect comment ...
44,070,437
How to get a File() or Blob() from an URL in javascript?
<p>I try to upload an image to the Firebase storage from an URL (with <code>ref().put(file)</code>)(www.example.com/img.jpg). </p> <p>To do so i need a File or Blob, but whenever I try <code>new File(url)</code> it says "not enough arguments“…</p> <p>EDIT: And I actually want to upload a whole directory of files, tha...
44,070,566
5
2
null
2017-05-19 12:41:52.127 UTC
14
2022-07-15 19:06:51.003 UTC
null
null
null
null
3,343,292
null
1
44
javascript|file|url|blob|firebase-storage
95,064
<p>Try using the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API" rel="nofollow noreferrer">fetch API</a>. You can use it like so:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prett...
17,880,171
SQL Server table to json
<p>I am looking to pull some columns (Col1 and 2) of a table and put in JSON format and also write some hardcoded JSON in each node, like this. </p> <blockquote> <p>{ "col1":"xxxx", "col2":"xxxx", "hardcodedString":"xxxx", "hardcodedString":"xxxx", "hardcodedString":"xxxx", "hardcodedString":"xxxx", "hardcodedSt...
17,882,333
3
2
null
2013-07-26 11:29:08.807 UTC
7
2019-05-02 05:31:04.383 UTC
2013-07-26 13:02:10.66 UTC
null
510,981
null
510,981
null
1
15
sql|json|sql-server-2008
42,832
<p>I wouldn't really advise it, there are much better ways of doing this in the application layer, but the following avoids loops, and is a lot less verbose than your current method:</p> <pre><code>CREATE PROCEDURE dbo.GetJSON @ObjectName VARCHAR(255), @registries_per_request smallint = null AS BEGIN IF OBJECT_ID(...
18,168,286
How can I style external links like Wikipedia?
<p>I would like to distinguish between external and internal links using just CSS. </p> <p>I would like to add a small icon to the right side of these links, without it covering up other text.</p> <p>The icon I would like to use is the <a href="http://commons.wikimedia.org/wiki/File:Icon_External_Link.png" rel="nore...
18,168,287
3
0
null
2013-08-11 02:52:14.63 UTC
12
2021-08-16 17:17:18.073 UTC
2013-08-11 03:11:29.187 UTC
null
1,074,592
null
1,074,592
null
1
32
css|progressive-enhancement
21,848
<h2><a href="http://codepen.io/brigand/pen/vsdIi">demo</a></h2> <h2>Basics</h2> <p>Using <code>:after</code> we can inject content after each matched selector.</p> <p>The first selector matches any <code>href</code> attribute starting with <code>//</code>. This is for links that keep the same protocol (http or http...
33,431,591
Pass checkbox value to angular's ng-click
<p>Is there a way to pass to angular directive ng-click the value of the associated input?</p> <p>In other words, what should replace <em><code>this.value</code></em> in the following:</p> <pre><code>&lt;input type="checkbox" id="cb1" ng-click="checkAll(this.value)" /&gt; </code></pre> <p><strong>PS.</strong> I don'...
33,431,731
5
3
null
2015-10-30 08:28:44.923 UTC
6
2021-02-11 13:17:49.03 UTC
2017-07-19 17:22:23.757 UTC
null
961,631
null
961,631
null
1
26
javascript|angularjs|checkbox|angularjs-ng-click
60,666
<p>You can do the following things:</p> <ul> <li>Use <a href="https://docs.angularjs.org/api/ng/directive/ngModel" rel="noreferrer"><strong>ng-model</strong></a> if you want to bind a html component to angular scope </li> <li>Change <code>ng-click</code> to <code>ng-change</code></li> <li>If you have to bind some valu...
2,150,161
WebClient generates (401) Unauthorized error
<p>I have the following code running in a windows service:</p> <pre><code>WebClient webClient = new WebClient(); webClient.Credentials = new NetworkCredential("me", "12345", "evilcorp.com"); webClient.DownloadFile(downloadUrl, filePath); </code></pre> <p>Each time, I get the following exception</p> <pre><code>{"The ...
2,150,244
5
1
null
2010-01-27 20:53:28.997 UTC
4
2020-01-22 13:08:23.463 UTC
null
null
null
null
127,257
null
1
37
c#|webclient|download
63,879
<p>Apparently the OS you are running on matters, as the default encryption has changed between OSes. This blog has more details: <a href="http://ferozedaud.blogspot.com/2009/10/ntlm-auth-fails-with.html" rel="nofollow noreferrer">http://ferozedaud.blogspot.com/2009/10/ntlm-auth-fails-with.html</a></p> <p>This has appa...
2,131,305
how to jump back to the previous edit place
<p>Is it possible to go back to the previous edit place in vim? I know using marks, one can move back and forth between different places within a file, but I don't know whether or not vim could automatically remember the previous edit place for you.</p>
2,131,318
5
0
null
2010-01-25 09:35:22.273 UTC
20
2018-02-01 22:05:14.24 UTC
2012-08-23 08:54:36.32 UTC
null
225,037
null
157,300
null
1
60
vim
18,664
<p>The last change is held in the mark named <code>.</code> so you can jump to the mark with <kbd>`</kbd><kbd>.</kbd> (backtick, dot) or <kbd>'</kbd><kbd>.</kbd> (apostrophe, dot). See:</p> <pre><code>:help mark-motions :help '. </code></pre>
2,148,115
How can I remove CSS element style inline (without JavaScript)?
<p>I have a style assigned for a specific HTML element in my stylesheet file, like this</p> <pre><code> label { width: 200px; color: red; } </code></pre> <p>In one special case, I would like to use a label element in the HTML document, but ignore the style specified for the label element (just for one instance i...
2,148,164
6
0
null
2010-01-27 15:28:37.53 UTC
1
2016-06-01 12:56:51.49 UTC
2010-01-27 15:35:13.18 UTC
null
76,777
null
76,777
null
1
14
html|css|inheritance|overriding
48,455
<p>From the <a href="https://developer.mozilla.org/en/Common_CSS_Questions" rel="noreferrer">Mozilla developer center</a>:</p> <blockquote> <p>Because CSS does not provide a &quot;default&quot; keyword, the only way to restore the default value of a property is to explicitly re-declare that property.</p> <p>Thus, parti...
1,573,170
How can I count the number of elements that match my CSS selector?
<p>I am trying to use SeleniumRC to test my GWT App and am trying to match elements using CSS selectors.</p> <p>I want to count the number of enabled buttons in the following HTML.</p> <p>A button is enabled if it is under a <code>&lt;td&gt;</code> with <code>class="x-panel-btn-td "</code> and disabled if it is under...
1,573,301
6
1
null
2009-10-15 15:37:00.46 UTC
2
2014-01-11 04:37:30.597 UTC
2011-10-19 12:36:16.39 UTC
null
496,830
null
190,695
null
1
27
selenium|css-selectors|selenium-rc
53,066
<p>As far as I am aware you can't do this using CSS selectors, but there is a command in Selenium for counting by XPath. The following command will verify there are two disabled buttons:</p> <pre><code>verifyXpathCount | //td[contains(@class, 'x-hide-offsets')]//button | 2 </code></pre> <p>In Selenium RC (Java) this ...
1,475,701
How to know if MySQLnd is the active driver?
<p>Maybe it's an obvious question, but I want to be sure.</p> <p>How can i know if it MySQLnd is the active driver?</p> <p>I'm runing PHP 5.3 and MySQL 5.1.37. In phpinfo() mysqlnd is listed but only with this I can't be sure if I'm using MySQLnd or the old driver...</p> <p>Extract of phpinfo() output</p> <pre><cod...
1,475,996
6
1
null
2009-09-25 06:20:55.233 UTC
22
2021-07-08 19:30:04.003 UTC
2012-12-23 21:39:34.853 UTC
null
168,868
null
92,462
null
1
59
php|mysql|mysqlnd
45,645
<blockquote> <p><strong>Warning!</strong> This method is unreliable and does not work since PHP 8.1</p> </blockquote> <p>If you are accessing via <code>mysqli</code>, this should do the trick:</p> <pre><code>&lt;?php $mysqlnd = function_exists('mysqli_fetch_all'); if ($mysqlnd) { echo 'mysqlnd enabled!'; } </code>...
1,886,185
Eclipse and Windows newlines
<p>I had to move my Eclipse workspace from Linux to Windows when my desktop crashed. A week later I copy it back to Linux, code happily, commit to CVS. And alas, windows newlines have polluted many files, so CVS diff dumps the entire file, even when I changed a line or two!</p> <p>I could cook up a script, but I am wo...
1,887,619
6
1
null
2009-12-11 06:27:40.79 UTC
53
2019-08-09 01:47:56.177 UTC
2017-08-16 13:18:28.843 UTC
null
2,147,927
null
205,586
null
1
191
eclipse|newline|delimiter
144,212
<p>As mentioned <a href="http://twigstechtips.blogspot.com/2008/12/eclipse-windowsunix-new-line-formatting.html" rel="noreferrer">here</a> and <a href="http://www.sics.se/node/2108" rel="noreferrer">here</a>:</p> <blockquote> <p>Set file encoding to <code>UTF-8</code> and line-endings for new files to Unix, so that ...
1,550,831
What is the profile of a SharePoint developer
<p>I have a development team specialized in ASP.NET. So the solutions we provide are web based, running on IIS and using MS SQL server. Everything within the intranet of the company. The team has this expertise, and they are excellent in C#, and .Net in general.</p> <p>The company is deploying SharePoint MOSS 2007. Th...
1,550,939
7
0
null
2009-10-11 14:35:49.46 UTC
9
2009-10-22 16:08:03.04 UTC
null
null
null
null
169,015
null
1
6
sharepoint
2,242
<p>I started in Sharepoint development over a year ago when I inherited a WSS 3.0 solution at my company. </p> <p>Personally I think it was a great step for me getting to know Sharepoint development a little, there are a lot of problems (e.g. security, load – balance, ghosting) that was good to see how was solved by t...
1,811,967
How to write automated unit tests for java annotation processor?
<p>I'm experimenting with java annotation processors. I'm able to write integration tests using the "JavaCompiler" (in fact I'm using "hickory" at the moment). I can run the compile process and analyse the output. The Problem: a single test runs for about half a second even without any code in my annotation processor. ...
1,813,801
7
0
null
2009-11-28 08:19:13.377 UTC
12
2021-04-24 03:22:43.81 UTC
2011-10-18 16:01:17.383 UTC
null
648,313
null
204,845
null
1
32
java|unit-testing|annotations|annotation-processing
9,935
<p>You're right mocking the annotation processing API (with a mock library like easymock) is painful. I tried this approach and it broke down pretty rapidly. You have to setup to many method call expectations. The tests become unmaintainable.</p> <p>A <strong>state-based test approach</strong> worked for me reasonably...
1,980,953
Is there a Java equivalent to C#'s 'yield' keyword?
<p>I know there is no direct equivalent in Java itself, but perhaps a third party?</p> <p>It is really convenient. Currently I'd like to implement an iterator that yields all nodes in a tree, which is about five lines of code with yield.</p>
17,167,174
7
1
null
2009-12-30 16:08:35.43 UTC
29
2022-06-07 17:49:34.983 UTC
2009-12-30 18:28:07.76 UTC
null
11,236
null
11,236
null
1
116
java|yield|yield-return
38,183
<p>The two options I know of is <a href="https://code.google.com/p/infomancers-collections/" rel="noreferrer">Aviad Ben Dov's infomancers-collections library from 2007</a> and <a href="http://svn.jimblackler.net/jimblackler/trunk/IdeaProjects/YieldAdapter/" rel="noreferrer">Jim Blackler's YieldAdapter library from 2008...
1,690,197
What does Google Closure Library offer over jQuery?
<p>Considering</p> <ul> <li>business background</li> <li>community support</li> <li>available extensions</li> <li>default set of features</li> <li>simplicity of use</li> <li>and reliability</li> </ul> <p>why do you prefer one over the another?</p>
1,690,494
8
4
null
2009-11-06 20:31:28.827 UTC
86
2012-09-26 08:21:50.523 UTC
2009-11-08 12:23:07.913 UTC
null
54,091
null
69,424
null
1
191
jquery|google-closure|google-closure-library
56,790
<p>I'll try to add my piece of information.</p> <h3>More than another JS lib</h3> <p>As I understand it, Google Closure is not only another JS library, but it is also a set of tools that will allow you to optimize your JS code. Working with jQuery gives you good tools and a lightweight library, but it does not minify...
2,012,610
Generating an action URL in JavaScript for ASP.NET MVC
<p>I'm trying to redirect to another page by calling an action in controller with a specific parameter. I'm trying to use this line:</p> <pre><code>window.open('&lt;%= Url.Action("Report", "Survey", new { id = ' + selectedRow + ' } ) %&gt;'); </code></pre> <p>But I couldn't make it work; it gives the following er...
2,013,403
9
1
null
2010-01-06 11:39:34.267 UTC
5
2015-07-29 10:13:29.983 UTC
2013-03-12 15:59:26.077 UTC
null
61,654
null
244,660
null
1
19
asp.net|javascript|asp.net-mvc
49,912
<p>Remember that everything between &lt;% and %> is interpreted as C# code, so what you're actually doing is trying to evaluate the following line of C#:</p> <pre><code>Url.Action("Report", "Survey", new { id = ' + selectedRow + ' } ) </code></pre> <p>C# thinks the single-quotes are surrounding a character literal, h...
1,728,303
How can I split and trim a string into parts all on one line?
<p>I want to split this line:</p> <pre><code>string line = "First Name ; string ; firstName"; </code></pre> <p>into an array of their trimmed versions:</p> <pre><code>"First Name" "string" "firstName" </code></pre> <p><strong>How can I do this all on one line?</strong> The following gives me an error "cannot conver...
1,728,318
9
1
null
2009-11-13 10:06:53.67 UTC
27
2021-11-22 22:05:29.193 UTC
2012-02-08 12:34:44.89 UTC
null
41,956
null
4,639
null
1
161
c#|.net|split|trim
114,783
<p>Try</p> <pre><code>List&lt;string&gt; parts = line.Split(';').Select(p =&gt; p.Trim()).ToList(); </code></pre> <p>FYI, the Foreach method takes an Action (takes T and returns void) for parameter, and your lambda return a string as string.Trim return a string</p> <p>Foreach extension method is meant to modify the ...
1,777,126
In java to remove an element in an array can you set it to null?
<p>I am trying to make a remove method that works on an array implementation of a list. Can I set the the duplicate element to null to remove it? Assuming that the list is in order.</p> <pre><code>ArrayList a = new ArrayList[]; public void removeduplicates(){ for(a[i].equals(a[i+1]){ a[i+1] = null; ...
1,777,134
9
8
null
2009-11-21 23:22:44.153 UTC
null
2011-06-14 20:23:25.303 UTC
2011-06-14 20:23:25.303 UTC
null
102,937
null
148,636
null
1
-1
java|null|list|arrays
38,517
<p>No you can't remove an element from an array, as in making it shorter. Java arrays are fixed-size. You need to use an <a href="http://doc.javanb.com/javasdk-docs-6-0-en/api/java/util/ArrayList.html" rel="noreferrer"><code>ArrayList</code></a> for that.</p> <p>If you set an element to null, the array will still have...