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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
48,558,681 | Add custom header to apollo client polling request | <p>I am using the <code>apollo-client</code> library to query data from my <code>Graphql</code> server. Some of the queries are sent to the server every 5 seconds through apollo polling ability.</p>
<p>Is there a generic way to add a custom header to all requests that are sent by my polling client?</p> | 48,578,567 | 3 | 1 | null | 2018-02-01 08:53:17.973 UTC | 12 | 2022-02-28 22:39:56.41 UTC | 2020-02-26 19:59:30.477 UTC | null | 319,969 | null | 7,360,870 | null | 1 | 28 | javascript|graphql|apollo|apollo-client|graphql-js | 42,538 | <h1>Two Solutions</h1>
<p>There are two ways to do that. One is <strong>quick and easy</strong> and will work for a specific query with some limitation, and the other is a <strong>general solution</strong> that is safer and can work for multiple queries.</p>
<h2>Quick and Easy Solution</h2>
<p><strong>Advantages</st... |
39,827,054 | Spring JPA repository transactionality | <p>1 quick question on Spring JPA repositories transactionality.
I have a service that is not marked as transactional and calls Spring JPA repository method</p>
<pre><code>userRegistrationRepository.deleteByEmail(email);
</code></pre>
<p>And it is defined as</p>
<pre><code>@Repository
public interface UserRegistrati... | 39,829,964 | 1 | 0 | null | 2016-10-03 08:07:53.44 UTC | 13 | 2019-08-27 23:27:05.27 UTC | null | null | null | null | 3,195,653 | null | 1 | 33 | java|jpa|spring-data|spring-transactions | 31,787 | <p>You are right. Only CRUD methods (<code>CrudRepository</code> methods) are by default marked as transactional.
If you are using custom query methods you should explicitly mark it with <code>@Transactional</code> annotation. </p>
<pre><code>@Repository
public interface UserRegistrationRepository extends JpaReposito... |
39,700,330 | Handling very large data with mysql | <p>Sorry for the long post!</p>
<p>I have a database containing ~30 tables (InnoDB engine). Only two of these tables, namely, "transaction" and "shift" are quite large (the first one have 1.5 million rows and shift has 23k rows). Now everything works fine and I don't have problem with the current database size. </p>
... | 39,714,657 | 3 | 0 | null | 2016-09-26 10:23:38.333 UTC | 40 | 2021-11-11 17:07:57.45 UTC | 2017-05-23 12:25:39.113 UTC | null | -1 | null | 2,312,801 | null | 1 | 56 | mysql|database|performance|indexing|partitioning | 75,077 | <ul>
<li><p>Can MySQL reasonably perform queries on billions of rows? -- MySQL can 'handle' billions of rows. "Reasonably" depends on the queries; let's see them.</p>
</li>
<li><p>Is InnoDB (MySQL 5.5.8) the right choice for multi-billion rows? -- 5.7 has some improvements, but 5.5 is pretty good, in spite o... |
33,504,798 | How to find the master URL for an existing spark cluster | <p>Currently I am running my program as</p>
<pre><code>val conf = new SparkConf()
.setAppName("Test Data Analysis")
.setMaster("local[*]")
.set("spark.executor.memory", "32g")
.set("spark.driver.memory", "32g")
.set("spark.driver.maxResultSize", "4g")
</code></pre>
<p>Even though I am running on a cluster o... | 36,227,237 | 4 | 0 | null | 2015-11-03 16:52:55.857 UTC | 6 | 2019-02-11 04:13:21.23 UTC | 2015-11-03 20:10:15.01 UTC | null | 337,134 | null | 337,134 | null | 1 | 31 | apache-spark | 58,886 | <p>I found that doing <code>--master yarn-cluster</code> works best. this makes sure that spark uses all the nodes of the hadoop cluster.</p> |
33,827,179 | Python decimal.InvalidOperation error | <p>i'm always getting this error when running something like this:</p>
<pre><code>from decimal import *
getcontext().prec =30
b=("2/3")
Decimal(b)
</code></pre>
<p>Error:</p>
<pre><code>Traceback (most recent call last):
File "Test.py", line 6, in <module>
Decimal(b)
decimal.InvalidOperation: [<clas... | 33,827,268 | 2 | 0 | null | 2015-11-20 12:50:37.08 UTC | 0 | 2019-07-16 13:40:03.603 UTC | 2015-11-20 12:57:30.143 UTC | null | 953,482 | null | 5,238,305 | null | 1 | 16 | python|python-3.x|math | 55,954 | <p><code>Decimal</code>'s initializer can't accept strings with a slash in them. Informally, the string has to look like a single number. <a href="https://docs.python.org/3/library/decimal.html?#decimal.Decimal" rel="noreferrer">This table</a> shows the proper format for string arguments. If you want to calculate 2/3, ... |
47,449,741 | Plotting multiple lines in python | <p>I am new in Python and I want to plot multiple lines in one graph like in the figure below. </p>
<p><a href="https://i.stack.imgur.com/PzfCi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PzfCi.png" alt="enter image description here"></a></p>
<p>I have tried write simple plotting code like this... | 47,450,185 | 2 | 0 | null | 2017-11-23 07:24:46.323 UTC | 2 | 2017-11-23 10:02:00.37 UTC | null | null | null | null | 3,699,370 | null | 1 | 2 | python|matplotlib|plot|plotly|linechart | 39,751 | <p>There are many options for line styles and marker in MPL. Have a look <a href="https://matplotlib.org/api/markers_api.html" rel="noreferrer">here</a>, <a href="https://matplotlib.org/1.3.1/examples/pylab_examples/line_styles.html" rel="noreferrer">here</a> and <a href="https://matplotlib.org/examples/lines_bars_and_... |
21,771,133 | Finding non-numeric rows in dataframe in pandas? | <p>I have a large dataframe in pandas that apart from the column used as index is supposed to have only numeric values:</p>
<pre><code>df = pd.DataFrame({'a': [1, 2, 3, 'bad', 5],
'b': [0.1, 0.2, 0.3, 0.4, 0.5],
'item': ['a', 'b', 'c', 'd', 'e']})
df = df.set_index('item')
</code>... | 21,772,078 | 7 | 0 | null | 2014-02-14 04:54:02.58 UTC | 25 | 2022-02-17 05:27:06.697 UTC | 2017-09-11 17:49:54.727 UTC | null | 2,137,255 | user248237 | null | null | 1 | 81 | python|pandas|dataframe | 147,715 | <p>You could use <a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.isreal.html" rel="noreferrer"><code>np.isreal</code></a> to check the type of each element (<a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.applymap.html" rel="noreferrer">applymap</a> applies a function ... |
27,420,023 | java.rmi.ConnectException: Connection refused to host: 127.0.0.1 | <p>I've tried to used RMI, here is server side. at first it worked without any exception, but now after three times whenever i try to run the below code, i will get some errors</p>
<p>The code is:</p>
<pre><code>import java.rmi.server.UnicastRemoteObject;
/**
* Created by elyas on 12/11/14 AD.
*/
public class Logi... | 27,440,761 | 4 | 0 | null | 2014-12-11 10:02:22.223 UTC | 1 | 2017-12-21 01:01:07.32 UTC | null | null | null | null | 3,881,354 | null | 1 | 4 | java|port|rmi|server | 39,622 | <p>The Answer was very simple, By default, the registry runs on port 1099. To start the registry on a different port, specify the port number on the command line. Do not forget to unset your CLASSPATH environment variable. for more information check this link: <a href="http://docs.oracle.com/javase/tutorial/rmi/running... |
42,733,986 | How to wait and fade an element out? | <p>I have an alert box to confirm that the user has successfully subscribed:</p>
<pre><code><div className="alert alert-success">
<strong>Success!</strong> Thank you for subscribing!
</div>
</code></pre>
<p>When a user sends an email, I'm changing the "subscribed" state to true.</p>
<... | 42,734,261 | 3 | 0 | null | 2017-03-11 10:19:51.023 UTC | 2 | 2022-09-15 15:55:23.69 UTC | 2022-09-15 15:55:23.69 UTC | null | 1,264,804 | null | 2,713,632 | null | 1 | 17 | reactjs | 46,492 | <p>May 2021 update: as tolga and Alexey Nikonov correctly noted in their answers, it’s possible to give away control over how long the alert is being shown (in the original question, 2 seconds) to the <code>transition-delay</code> property and a smart component state management based on the <a href="https://developer.m... |
21,030,086 | Using PowerShell, set the AD home directory for a user, given the display name | <p>I would like to set the home directory based on a csv file containing a list of usernames.</p>
<p>I imagine there is a combination of get-user, set-user, and foreach commands that give the correct updates.
Here is the code I am using but I'm unable to make the logical jump to piping this output to a Set-ADUser com... | 21,030,149 | 1 | 0 | null | 2014-01-09 20:07:22.023 UTC | 3 | 2018-07-26 15:29:24.943 UTC | 2014-01-09 20:14:17.13 UTC | null | 1,837,482 | null | 1,837,482 | null | 1 | 4 | powershell|active-directory | 41,848 | <p>You're looking for the <code>Set-ADUser</code> cmdlet. It has a <code>-HomeDirectory</code> parameter, which obviously allows you to set the user's home directory, and an <code>-Identity</code> parameter that specifies which user you are editing. It also has a <code>-HomeDrive</code> parameter that specifies the dri... |
31,748,671 | Pass Objects to AutoMapper Mapping | <p>I am working with AutoMapper and some of the values for the entity being mapped to are variables in my current method. I have tried to Google it but to no avail. Can I pass a set of KeyValue Pairs or an object or something to my mapping to have it use those values?</p>
<h3>Sample of Post Mapping Modification</h3>
... | 31,754,133 | 5 | 0 | null | 2015-07-31 14:29:57.19 UTC | 16 | 2020-07-11 09:42:09.38 UTC | 2015-07-31 14:57:51.96 UTC | null | 531,479 | null | 531,479 | null | 1 | 51 | c#|asp.net-mvc-4|automapper | 40,576 | <p>AutoMapper handles this key-value pair scenario out of the box.</p>
<pre><code>Mapper.CreateMap<Source, Dest>()
.ForMember(d => d.Foo, opt => opt.ResolveUsing(res => res.Context.Options.Items["Foo"]));
</code></pre>
<p>Then at runtime:</p>
<pre><code>Mapper.Map<Source, Dest>(src, opt =>... |
21,529,467 | How to Adjust y axis plot range in Matlab? | <p>I need to plot the following functions in matlab</p>
<pre><code>y1=sign(x)
y2=tanh(x)
y3=(x)/(x+1)
</code></pre>
<p>The x-range is -5,5 with 0.1 spacing
The y-plot range should be between -1.5 to 1.5.</p>
<p>Each plot should have a labeled x and y axis and a legend in the lower right corner.</p>
<p>The only thin... | 21,529,536 | 2 | 1 | null | 2014-02-03 14:08:01.56 UTC | 1 | 2019-06-03 14:05:58.13 UTC | 2016-10-23 14:21:00.803 UTC | null | 54,964 | null | 3,155,707 | null | 1 | 6 | matlab|plot | 48,304 | <p>Yes, use <a href="http://www.mathworks.co.uk/help/matlab/ref/axis.html" rel="noreferrer"><code>axis</code></a> after the <code>plot</code> command:</p>
<pre><code>axis([-5 5 -1.5 1.5])
</code></pre> |
42,323,247 | How to force axis values to scientific notation in ggplot | <p>I have the following code:</p>
<pre><code> library(ggplot2)
df <- data.frame(y=seq(1, 1e5, length.out=100), x=sample(100))
p <- ggplot(data = df, aes(x=x, y=y)) + geom_line() + geom_point()
p
</code></pre>
<p>Which produce this image:</p>
<p><a href="https://i.stack.imgur.com/oHh0R.jpg" rel="noreferrer"... | 42,323,301 | 1 | 2 | null | 2017-02-19 03:17:09.647 UTC | 6 | 2017-02-19 03:25:44.843 UTC | null | null | null | null | 67,405 | null | 1 | 23 | r|ggplot2 | 46,271 | <p>You can pass a <code>format</code> function with scientific notation turned on to <em>scale_y_continuous labels</em> parameter:</p>
<pre><code>p + scale_y_continuous(labels = function(x) format(x, scientific = TRUE))
</code></pre>
<p><a href="https://i.stack.imgur.com/s5mPB.png" rel="noreferrer"><img src="https://... |
33,323,707 | How do I reload a module after changing it? | <p>Python Console with Python 3.4.2 </p>
<p>I defined a function in a module which runs correctly in Python Console in PyCharm Community Edition 4.5.4:<br>
ReloadTest.py:</p>
<pre><code>def reloadtest(x):
print("Version A: {}".format(x))
</code></pre>
<p>Python Console:</p>
<pre><code>Python 3.4.2 (v3.4.2:ab2c0... | 33,405,315 | 4 | 1 | null | 2015-10-24 21:44:39.747 UTC | 11 | 2021-04-25 13:23:46.443 UTC | 2015-10-28 01:06:30.29 UTC | null | 2,719,588 | null | 2,719,588 | null | 1 | 33 | pycharm | 39,551 | <p>Get it to work!<br>
Instead of <code>from Module import function</code>, I should import the whole module <code>import Module</code>, then call the function by <code>Module.function()</code>. This is because</p>
<pre><code>from ReloadTest import reloadtest
</code></pre>
<p>and</p>
<pre><code>importlib.reload(Relo... |
9,417,356 | Bufferedimage resize | <p>I am trying to resized a bufferedimage. I am able to store it and show up on a jframe no problems but I can't seem to resize it. Any tips on how I can change this to make it work and show the image as a 200*200 file would be great </p>
<pre><code>private void profPic(){
String path = factory.getString("bottl... | 9,417,836 | 7 | 0 | null | 2012-02-23 16:47:30.507 UTC | 14 | 2021-04-09 12:58:43.707 UTC | 2018-04-04 07:15:06.903 UTC | null | 4,283,581 | null | 1,060,187 | null | 1 | 53 | java|bufferedimage | 114,875 | <p><em>Updated answer</em></p>
<p>I cannot recall why <a href="https://stackoverflow.com/revisions/9417836/1">my original answer</a> worked but having tested it in a separate environment, I agree, the original accepted answer doesn't work (why I said it did I cannot remember either). This, on the other hand, did work:... |
30,797,106 | what's ARM TCM memory | <p>what is TCM memory on ARM processors, is it a dedicated memory which resides next to the processor or just a region of RAM which is configured as TCM??.</p>
<p>if it's a dedicated memory, why can we configure it's location and size?.</p> | 30,800,318 | 1 | 1 | null | 2015-06-12 07:00:26 UTC | 9 | 2015-06-12 09:59:07.463 UTC | null | null | null | null | 4,838,002 | null | 1 | 28 | memory|arm | 26,518 | <p>TCM, Tightly-Coupled Memory is one (or multiple) small, dedicated memory region that as the name implies is very close to the CPU. The main benefit of it is, that the CPU can access the TCM every cycle. Contrary to the ordinary memory there is no cache involved which makes all memory accesses predictable.</p>
<p>Th... |
31,143,015 | Docker NLTK Download | <p>I am building a docker container using the following Dockerfile:</p>
<pre><code>FROM ubuntu:14.04
RUN apt-get update
RUN apt-get install -y python python-dev python-pip
ADD . /app
RUN apt-get install -y python-scipy
RUN pip install -r /arrc/requirements.txt
EXPOSE 5000
WORKDIR /app
CMD python app.py
</code>... | 31,467,809 | 5 | 2 | null | 2015-06-30 15:56:04.477 UTC | 6 | 2022-01-04 06:14:26.373 UTC | 2017-07-27 16:10:59.85 UTC | null | 610,569 | null | 4,793,408 | null | 1 | 39 | python|docker|nltk | 22,529 | <p>In your Dockerfile, try adding instead:</p>
<blockquote>
<p><code>RUN python -m nltk.downloader punkt</code></p>
</blockquote>
<p>This will run the command and install the requested files to <code>//nltk_data/</code></p>
<p>The problem is most likely related to using CMD vs. RUN in the Dockerfile. Documentation... |
47,168,477 | How to stream std::variant<...,...> | <p>My <code>std::variant</code> contains streamable types: </p>
<pre><code>std::variant<int, std::string> a, b;
a = 1;
b = "hi";
std::cout << a << b << std::endl;
</code></pre>
<p>Compiling with g++7 with -std=c++1z returns compilation time errors. </p>
<p>An excerpt:</p>
<pre><code>test.cpp... | 47,169,101 | 3 | 2 | null | 2017-11-07 22:29:18.3 UTC | 8 | 2019-12-25 19:37:30.677 UTC | 2017-11-07 23:39:03.883 UTC | null | 6,022,656 | null | 863,857 | null | 1 | 13 | c++|stream|c++17|variant | 4,348 | <p>This streams nested variants too.</p>
<pre><code>template<class T>
struct streamer {
const T& val;
};
template<class T> streamer(T) -> streamer<T>;
template<class T>
std::ostream& operator<<(std::ostream& os, streamer<T> s) {
os << s.val;
return ... |
10,499,789 | Session stickiness on Amazon Web Services | <p>I'm a bit confused about the use of the session stickiness on Amazon Web Services. When I deploy my java web application using Amazon Elastic Beanstalk, I can choose to enable the session stickiness and then specify a cookie expiration period.</p>
<p>My application uses cookies for the session (JSESSIONID) as well ... | 10,502,092 | 2 | 1 | null | 2012-05-08 13:40:52.173 UTC | 12 | 2014-03-18 09:26:55.33 UTC | null | null | null | null | 1,031,658 | null | 1 | 17 | amazon-ec2|amazon-web-services|amazon-elastic-beanstalk|amazon-elb | 9,614 | <blockquote>
<p>If I don't enable it, does it mean that I could be suddendly logged out because the load balancer took me to another server (not the server that authenticated me)?</p>
</blockquote>
<p>Yes</p>
<blockquote>
<p>If I enable the session stickiness, do I get logged out when the server that authenticate... |
31,993,704 | Storing ggplot objects in a list from within loop in R | <p>My problem is similar to <a href="https://stackoverflow.com/questions/1820590/problem-storing-plot-objects-in-a-list-in-r">this one</a>; when I generate plot objects (in this case histograms) in a loop, seems that all of them become overwritten by the most recent plot. </p>
<p>To debug, within the loop, I am printi... | 31,994,539 | 4 | 2 | null | 2015-08-13 16:29:50.1 UTC | 24 | 2021-04-09 14:56:17.913 UTC | 2017-05-23 12:34:41.94 UTC | null | -1 | null | 5,224,058 | null | 1 | 50 | r|plot|ggplot2 | 66,824 | <p>In addition to the other excellent answer, here’s a solution that uses “normal”-looking evaluation rather than <code>eval</code>. Since <code>for</code> loops have no separate variable scope (i.e. they are performed in the current environment) we need to use <code>local</code> to wrap the <code>for</code> block; in ... |
32,128,412 | Python: yield and yield assignment | <p>How does this code, involving assignment and the yield operator, work? The results are rather confounding.</p>
<pre><code>def test1(x):
for i in x:
_ = yield i
yield _
def test2(x):
for i in x:
_ = yield i
r1 = test1([1,2,3])
r2 = test2([1,2,3])
print list(r1)
print list(r2)
</... | 32,128,704 | 3 | 2 | null | 2015-08-20 21:07:02.283 UTC | 9 | 2015-08-20 22:14:59.733 UTC | 2015-08-20 22:12:37.723 UTC | null | 1,832,942 | null | 4,667,484 | null | 1 | 28 | python|yield|assignment-operator | 11,284 | <p>The assignment syntax ("yield expression") allows you to treat the generator as a rudimentary coroutine.</p>
<p>First proposed in <a href="https://www.python.org/dev/peps/pep-0342/" rel="noreferrer">PEP 342</a> and documented here: <a href="https://docs.python.org/2/reference/expressions.html#yield-expressions" rel... |
36,931,593 | Error when trying to run `pod trunk push [cocoapod].podspec` | <p>When trying to push an update to my cocoapod framework to the repo with <code>pod trunk push</code> as mentioned in the title, I get the following error:</p>
<blockquote>
<p>[!] Authentication token is invalid or unverified. Either verify it with the email that was sent or register a new session.</p>
</blockquote... | 36,931,594 | 2 | 1 | null | 2016-04-29 06:59:57.723 UTC | 7 | 2018-08-10 22:47:47.563 UTC | 2018-08-10 22:47:47.563 UTC | null | 4,056,516 | null | 4,056,516 | null | 1 | 60 | ios|objective-c|swift|frameworks|cocoapods | 8,139 | <ol>
<li><p>Run the following command in terminal:</p>
<p><code>pod trunk register yourEmail@example.com 'Your Name'</code></p></li>
<li><p>Click the link in the email that is sent to you.</p></li>
<li><p>Run your <code>pod trunk push</code> command in terminal again</p></li>
</ol> |
3,936,697 | HTML - Position an image in a new line | <p>I have a series of paragraphs. Each one ends with a illustration which clarifies the subject being explained in the paragraph.</p>
<p>I want the illustration to be on a new line and not display along with the text and I have found the following solutions, with it's own problems:</p>
<p>Put the illustration in a di... | 3,936,725 | 1 | 0 | null | 2010-10-14 19:13:15.173 UTC | null | 2017-11-27 07:52:01.437 UTC | 2012-07-22 05:31:23.59 UTC | null | 23,739 | null | 467,224 | null | 1 | 8 | html|css|positioning|image | 63,780 | <p>Ok, so this is my new solution. Basically, we just set the IMG element to be a block-level element. </p>
<pre><code>img { display:block; }
</code></pre>
<p>This solution does not introduce any new markup. (You just place the <code><img></code> element right after the text in the paragraph / list item.) <... |
3,632,024 | Why do Ruby's regular expressions use \A and \z instead of ^ and $? | <p>I'm not a Ruby programmer, but as I was reading through the extensive <a href="http://guides.rubyonrails.org/security.html#regular-expressions" rel="noreferrer">Ruby on Rails security guide</a>, I noticed this section:</p>
<blockquote>
<p>A common pitfall in Ruby’s regular expressions is to match the string’s beg... | 3,632,051 | 1 | 0 | null | 2010-09-02 23:27:56.017 UTC | 13 | 2015-06-04 12:38:49.537 UTC | 2015-06-04 12:38:49.537 UTC | null | 12,892 | null | 385,950 | null | 1 | 30 | ruby-on-rails|ruby|regex | 7,562 | <p>This isn't specific to Ruby; <code>\A</code> and <code>\Z</code> are not the same thing as <code>^</code> and <code>$</code>. <code>^</code> and <code>$</code> are the start and end of <strong>line</strong> anchors, whereas <code>\A</code> and <code>\Z</code> are the start and end of <strong>string</strong> anchors.... |
3,861,721 | Add ASP.NET Membership tables to my own existing database, or should I instead configure a separate ASP.NET membership database? | <p>I was reading through this post here <a href="http://www.misfitgeek.com/op-ed/adding-asp-net-membership-to-your-own-database" rel="noreferrer">MisfitGeek: Adding ASP.NET Membership to your OWN Database. </a></p>
<p>and thought to my self what the common practice is. What do developers using ASP.NET membership and a... | 3,861,834 | 1 | 0 | null | 2010-10-05 07:45:15.257 UTC | 16 | 2012-07-03 07:37:57.667 UTC | 2012-07-03 07:37:57.667 UTC | null | 109,702 | null | 77,121 | null | 1 | 31 | asp.net|database-design|asp.net-membership | 32,328 | <p>I personally just added the asp.net membership stuff to my own database. I then wrote a basic wrapper class around System.Web.Security.Membership class so that the code acts like its using its own membership stuff. Its pretty slick and not that hard to do. If you need assistance setting it up, here is what I did.... |
40,873,933 | error expected primary-expression before ';'token c++ | <p>am new in coding and am using c++ to create a program to find sum median maximum and minimum but i get the error expected primary-expression before ';' token in every place that has cout</p>
<pre><code>#include <iostream>
using namespace std;
int main()
{
int array[10],maximum,minimum,sum=0,median;
c... | 40,873,962 | 1 | 1 | null | 2016-11-29 19:11:27.707 UTC | null | 2016-11-29 19:22:58.667 UTC | null | null | null | null | 7,227,193 | null | 1 | 2 | c++ | 41,086 | <p>Remove the <code><<</code> before the <code>;</code> on every line that has it or replace <code><<;</code> with <code><<'\n';</code> for a new line.</p>
<pre><code>#include <iostream>
using namespace std;
int main()
{
int array[10], maximum = 0, minimum = 0, sum = 0, median = 0;
co... |
41,132,262 | How best to Count(*) with a CASE STATEMENT? | <p>The following SQL (on SQL Server) returns an error of: </p>
<blockquote>
<p>Incorrect syntax near '*'</p>
</blockquote>
<p>Is there something inherently wrong with using the following SELECT statement?:</p>
<pre><code>SELECT
COUNT(CASE WHEN <conditions> THEN * ELSE NULL END) as conditionalcountall
FROM TA... | 41,132,301 | 4 | 1 | null | 2016-12-13 23:21:28.59 UTC | 1 | 2021-01-21 16:40:00.43 UTC | 2016-12-13 23:23:01.157 UTC | null | 4,275,342 | null | 5,476,942 | null | 1 | 4 | sql|sql-server|case | 39,569 | <p>I tend to like sum()</p>
<pre><code>SELECT
SUM(CASE WHEN <conditions> THEN 1 ELSE 0 END) as conditionalcountall
FROM TABLE
</code></pre> |
28,374,000 | Spring - Programmatically generate a set of beans | <p>I have a Dropwizard application that needs to generate a dozen or so beans for each of the configs in a configuration list. Things like health checks, quartz schedulers, etc.</p>
<p>Something like this:</p>
<pre><code>@Component
class MyModule {
@Inject
private MyConfiguration configuration;
@Bean
... | 28,565,540 | 6 | 1 | null | 2015-02-06 20:13:56.073 UTC | 34 | 2022-05-16 09:21:01.873 UTC | 2015-02-12 21:49:52.01 UTC | null | 12,034 | null | 12,034 | null | 1 | 41 | java|spring|spring-mvc|dropwizard | 51,906 | <p>The "best" approach I could come up with was to wrap all of my Quartz configuration and schedulers in 1 uber bean and wire it all up manually, then refactor the code to work with the uber bean interface.</p>
<p>The uber bean creates all the objects that I need in its PostConstruct, and implements ApplicationContext... |
8,970,913 | Create a temp file with a specific extension using php | <p>How do I create a temporary file with a specified extension in php.
I came across <a href="http://php.net/manual/en/function.tempnam.php"><code>tempnam()</code></a> but using it the extension can't be specified.</p> | 8,971,248 | 8 | 1 | null | 2012-01-23 11:29:21.74 UTC | 3 | 2021-10-08 10:17:02.733 UTC | 2012-01-23 11:36:51.723 UTC | null | 1,063,333 | null | 632,447 | null | 1 | 28 | php|temporary-files | 27,628 | <p>This might simulate <code>mkstemp()</code> (see <a href="http://linux.die.net/man/3/mkstemp" rel="noreferrer">http://linux.die.net/man/3/mkstemp</a>) a bit, achieving what you want to do:</p>
<pre><code>function mkstemp( $template ) {
$attempts = 238328; // 62 x 62 x 62
$letters = "abcdefghijklmnopqrstuvwxyzAB... |
26,944,987 | Show Next/Previous item of an array | <p>I'm writing the first item of an array to the screen, and would like to create <code>Next/Previous</code> buttons for array, but I can't get it to work. I have tried several methods, but I can't find suitable solution. </p>
<p>Can anyone help? </p>
<p>This is the last one I have tried:</p>
<pre><code><div>
... | 26,945,342 | 3 | 3 | null | 2014-11-15 10:47:03.593 UTC | 5 | 2018-06-20 11:50:12.46 UTC | 2014-11-15 13:13:55.583 UTC | null | 2,306,173 | null | 1,444,175 | null | 1 | 9 | javascript|html|arrays | 41,279 | <p>Say you have an <em>Array</em> <code>var arr = ['foo', 'bar', 'baz'];</code>.<br>
If you want to dynamically choose items from this <em>Array</em>, you'll need a new variable. Let's call this <code>i</code> and give it a default value <code>var i = 0;</code> </p>
<p>So far, <code>arr[i]; // "foo" (i === 0)</code... |
19,402,207 | Java variable placed on stack or heap | <p>I don't have much idea on Java.</p>
<p>I was going through few links and found blog says "Java Primitives stored on stack", which I feel it depends on instance variable or local variable.</p>
<p>After going through several links my conclusion is,</p>
<hr>
<p>Class variables – primitives – are stored on heap as a... | 19,402,293 | 3 | 2 | null | 2013-10-16 11:28:26.81 UTC | 13 | 2020-08-20 23:25:34.62 UTC | null | null | null | null | 1,012,372 | null | 1 | 29 | java | 17,180 | <p>There are some optimizations in the JVM that may even use the Stack for Objects, this reduces the garbage collection effort.</p>
<p>Classes are stored on a special part of the heap, but that depends on the JVM you use. (Permgen f.e. in Hotspot <= 24).</p>
<p>In general you should not have to think about where t... |
502,763 | Prefuse Toolkit: dynamically adding nodes and edges | <p>Does anyone have experience with the prefuse graph toolkit? Is it possible to change an already displayed graph, ie. add/remove nodes and/or edges, and have the display correctly adapt? </p>
<p>For instance, prefuse comes with an example that visualizes a network of friends:</p>
<blockquote>
<p><a href="http://p... | 520,048 | 4 | 0 | null | 2009-02-02 10:21:39.547 UTC | 10 | 2017-03-28 20:03:27.31 UTC | 2017-03-28 20:03:27.31 UTC | null | 1,571,709 | Thomas | null | null | 1 | 4 | java|layout|graph-theory|prefuse | 6,336 | <p>As pointed out in my other post, the reason new nodes and edges are not visible in the original example is that the colors etc. for the nodes are not set correctly. One way to fix this is to explicitly call vis.run("color"); whenever a node or edge was added.</p>
<p>Alternatively, we can ensure that the color actio... |
934,479 | how to adjust "is a type but is used like a variable"? | <p>I'm trying to generate some code in a web service. But it's returning 2 errors:</p>
<p>1) List is a type but is used like a variable</p>
<p>2) No overload for method 'Customer' takes '3 arguments'</p>
<pre><code>[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.Basi... | 934,488 | 4 | 1 | null | 2009-06-01 11:41:50.2 UTC | 2 | 2015-05-04 17:59:36.557 UTC | 2015-05-04 17:59:36.557 UTC | null | 2,856,441 | null | 52,420 | null | 1 | 13 | c#|.net|asp.net|generics | 86,898 | <p>The problem is at the line</p>
<pre><code>List<Customer> li = List<Customer>();
</code></pre>
<p>you need to add "new"</p>
<pre><code>List<Customer> li = new List<Customer>();
</code></pre>
<p>Additionally for the next line should be:</p>
<pre><code>li.Add(new Customer{Name="yusuf", SurN... |
346,622 | Opinions on type-punning in C++? | <p>I'm curious about conventions for type-punning pointers/arrays in C++. Here's the use case I have at the moment:</p>
<blockquote>
Compute a simple 32-bit checksum over a binary blob of data by treating it as an array of 32-bit integers (we know its total length is a multiple of 4), and then summing up all values a... | 346,764 | 4 | 0 | null | 2008-12-06 19:13:29.767 UTC | 9 | 2020-06-02 02:03:49.113 UTC | 2010-02-10 06:20:21.587 UTC | Roger Pate | null | Tom | 40,620 | null | 1 | 23 | c++|casting|type-punning | 10,078 | <p>As far as the C++ standard is concerned, <a href="https://stackoverflow.com/questions/346622/opinions-on-type-punning-in-c#346675">litb</a>'s answer is completely correct and the most portable. Casting <code>const char *data</code> to a <code>const uint3_t *</code>, whether it be via a C-style cast, <code>static_ca... |
22,061,073 | How do i get images file name from a given folder | <p>I have got a task to display all images inside a folder using jquery.</p>
<p>For that i used the code </p>
<pre><code>var imageFolder = '../../Images/Avatar/';
var imgsrc = imageFolder +'';
</code></pre>
<p>I need to get the images file name inside that folder avatar. How can I get the file name. There are lot of... | 22,061,719 | 2 | 1 | null | 2014-02-27 06:49:15.66 UTC | 7 | 2017-07-04 09:02:46.1 UTC | 2014-02-27 06:57:55.297 UTC | null | 1,677,272 | null | 1,752,012 | null | 1 | 5 | javascript|jquery|html | 42,303 | <p>try this way </p>
<p>HTML CODE:</p>
<pre><code><div id='fileNames'> </div>
</code></pre>
<p><strong>JQUERY CODE:</strong></p>
<pre><code>var fileExt = {},
fileExt[0]=".png",
fileExt[1]=".jpg",
fileExt[2]=".gif";
$.ajax({
//This will retrieve the contents of the folder if the folder is... |
37,561,991 | What is dtype('O'), in pandas? | <p>I have a dataframe in pandas and I'm trying to figure out what the types of its values are. I am unsure what the type is of column <code>'Test'</code>. However, when I run <code>myFrame['Test'].dtype</code>, I get;</p>
<pre><code>dtype('O')
</code></pre>
<p>What does this mean?</p> | 37,562,101 | 4 | 2 | null | 2016-06-01 07:22:00.597 UTC | 36 | 2020-06-08 23:47:58.597 UTC | 2020-06-08 23:47:58.597 UTC | null | 202,229 | null | 1,613,983 | null | 1 | 168 | python|pandas|numpy|dataframe|types | 201,935 | <p>It means:</p>
<pre><code>'O' (Python) objects
</code></pre>
<p><a href="http://docs.scipy.org/doc/numpy-1.10.1/reference/arrays.dtypes.html" rel="noreferrer">Source</a>.</p>
<blockquote>
<p>The first character specifies the kind of data and the remaining characters specify the number of bytes per item, exce... |
30,565,571 | Redis - How to expire key daily | <p>I know that EXPIREAT in Redis is used to specify when a key will expire. My problem though is that it takes an absolute UNIX timestamp. I'm finding a hard time thinking about what I should set as an argument if I want the key to expire at the end of the day. </p>
<p>This is how I set my key:</p>
<blockquote>
<p>... | 30,565,736 | 3 | 1 | null | 2015-06-01 04:17:22.737 UTC | 8 | 2017-10-04 16:40:52.033 UTC | null | null | null | null | 3,138,528 | null | 1 | 31 | node.js|unix|redis|timestamp|sails.js | 56,934 | <p>If you want to expire it 24 hrs later</p>
<pre><code>client.expireat(key, parseInt((+new Date)/1000) + 86400);
</code></pre>
<p>Or if you want it to expire exactly at the end of today, you can use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setHours"><code>.setHou... |
51,654,757 | Laravel eloquent with Trashed on relationship | <p>I need to be able to get a Models Relationship including its soft deleted elements, but only for this 1 instance. I do not want to change the model so that every time I use the relationship it returns all the soft deleted records too.</p>
<p>How can I achieve this?</p>
<p><strong>User Model</strong></p>
<pre><cod... | 51,654,947 | 4 | 1 | null | 2018-08-02 13:21:17.023 UTC | 2 | 2021-10-27 08:59:01.66 UTC | null | null | null | null | 9,295,849 | null | 1 | 27 | php|laravel|laravel-5|eloquent | 49,661 | <p>You can use <code>withTrashed</code> method in different ways.</p>
<p>To associate the call with your relationship you can do as follows:</p>
<pre><code>public function roles() {
return $this->hasMany(Role::class)->withTrashed();
}
</code></pre>
<p>To use the same in the fly:</p>
<pre><code>$user->r... |
51,626,224 | How to configure services based on request in ASP.NET Core | <p>In ASP.NET Core we can register all dependencies during start up, which executed when application starts. Then registered dependencies will be injected in controller constructor.</p>
<pre><code>public class ReportController
{
private IReportFactory _reportFactory;
public ReportController(IReportFactory rep... | 51,626,373 | 3 | 2 | null | 2018-08-01 05:57:06.273 UTC | 9 | 2021-01-23 22:12:17.277 UTC | 2018-08-01 07:56:51.673 UTC | null | 455,493 | null | 10,147,020 | null | 1 | 15 | c#|asp.net-core|dependency-injection | 10,558 | <p>No, you can't. The <code>IServiceCollection</code> is populated during application startup and built before <code>Configure</code> method is called. After that (container being built), the registrations can't be changed anymore.</p>
<p>You can however implement an abstract factory, be it as factory method or as an ... |
46,745,365 | Artisan migrate could not find driver | <p>I am trying to install Laravel. I have installed <code>Xampp</code>, but when I try to setup my database using <code>php artisan migrate</code>I get the error:</p>
<blockquote>
<p><strong>[Illuminate\Database\QueryException] could not find driver (SQL: select * from information_schema.tables where table_schema ... | 47,929,207 | 20 | 3 | null | 2017-10-14 13:56:51.813 UTC | 25 | 2022-07-07 10:39:20.933 UTC | 2019-07-09 12:38:26.113 UTC | null | 7,051,937 | null | 1,901,521 | null | 1 | 69 | php|laravel | 214,076 | <p>In your php.ini configuration file simply uncomment the extension:</p>
<pre><code>;extension=php_pdo_mysql.dll
</code></pre>
<p><em>(You can find your <strong>php.ini</strong> file in the php folder where your stack server is installed.)</em></p>
<p>If you're on <strong>Windows</strong> make it: <code>extension=p... |
36,564,596 | How to limit the Maximum number of parallel tasks in c# | <p>I have a collection of 1000 input message to process. I'm looping the input collection and starting the new task for each message to get processed.</p>
<pre><code>//Assume this messages collection contains 1000 items
var messages = new List<string>();
foreach (var msg in messages)
{
Task.Factory.StartNew(... | 36,571,420 | 11 | 4 | null | 2016-04-12 05:50:26.31 UTC | 17 | 2021-09-15 12:12:53.18 UTC | 2016-04-16 16:40:59.453 UTC | null | 1,310,368 | null | 1,310,368 | null | 1 | 64 | c#|.net|asynchronous | 68,502 | <p>SemaphoreSlim is a very good solution in this case and I higly recommend OP to try this, but @Manoj's answer has flaw as mentioned in comments.semaphore should be waited before spawning the task like this.</p>
<p><strong>Updated Answer:</strong> As @Vasyl pointed out Semaphore may be disposed before completion of t... |
36,367,532 | How can I conditionally import an ES6 module? | <p>I need to do something like:</p>
<pre><code>if (condition) {
import something from 'something';
}
// ...
if (something) {
something.doStuff();
}
</code></pre>
<p>The above code does not compile; it throws <code>SyntaxError: ... 'import' and 'export' may only appear at the top level</code>.</p>
<p>I tried ... | 46,543,835 | 15 | 4 | null | 2016-04-01 23:44:59.197 UTC | 40 | 2022-08-26 20:08:49.933 UTC | 2016-04-01 23:45:48.557 UTC | user4227915 | null | null | 222,356 | null | 1 | 297 | javascript|module|ecmascript-6 | 203,731 | <p>We do have dynamic imports proposal now with ECMA. This is in stage 3. This is also available as <a href="https://babeljs.io/docs/plugins/syntax-dynamic-import/" rel="noreferrer">babel-preset</a>.</p>
<p>Following is way to do conditional rendering as per your case.</p>
<pre><code>if (condition) {
import('some... |
14,136,265 | Get Child Nodes from an XML File | <p>I have an XML File like below</p>
<pre><code><Attachment>
<FileName>Perimeter SRS.docx</FileName>
<FileSize>15572</FileSize>
<ActivityName>ActivityNamePerimeter SRS.docx</ActivityName>
<UserAlias>JameelM</UserAlias>
<DocumentTransferId>7123eb83-d... | 14,136,472 | 3 | 2 | null | 2013-01-03 09:41:38.007 UTC | 2 | 2018-03-27 15:54:09.423 UTC | 2018-03-27 15:53:28.66 UTC | null | 4,165,377 | null | 1,668,501 | null | 1 | 5 | c#|.net|xml | 46,203 | <blockquote>
<p>I need to get each child node value inside the Attachment node. </p>
</blockquote>
<p>Your question is very unclear, but it <em>looks</em> like it's as simple as:</p>
<pre><code>foreach (XmlNode node in doc.DocumentElement.ChildNodes)
{
}
</code></pre>
<p>After all, in the document you've shown us,... |
25,273,075 | Editing my vimrc file on a mac | <p>I'm using Mac OSX (10.9) and I'm trying to configure my vimrc file by adding "set number". I found my vimrc file in user/share/vim/ but I can't edit it because it's read-only. How can I fix this and read it?</p> | 25,273,147 | 1 | 2 | null | 2014-08-12 20:01:03.29 UTC | 18 | 2014-08-12 20:04:56.047 UTC | null | null | null | null | 3,521,929 | null | 1 | 43 | vim | 90,573 | <p>You should not overwrite the system vimrc for various reasons. One being that with a system upgrade it will be overwritten.</p>
<p>Instead you can create a new .vimrc file in your home directory. Open the terminal and enter:</p>
<pre><code> vim ~/.vimrc
</code></pre>
<p>There you can enter your various configurat... |
25,394,536 | UIImage on swift can't check for nil | <p>I have the following code on Swift</p>
<pre><code>var image = UIImage(contentsOfFile: filePath)
if image != nil {
return image
}
</code></pre>
<p>It used to work great, but now on Xcode Beta 6, this returns a warning</p>
<pre><code> 'UIImage' is not a subtype of 'NSString'
</code></pre>
... | 25,394,568 | 6 | 3 | null | 2014-08-19 23:23:19.45 UTC | 7 | 2021-07-06 08:04:56.787 UTC | null | null | null | null | 3,931,494 | null | 1 | 41 | ios|xcode|swift|uiimage | 57,990 | <p><strong>Update</strong></p>
<p>Swift now added the concept of failable initializers and UIImage is now one of them. The initializer returns an Optional so if the image cannot be created it will return nil.</p>
<hr>
<p>Variables by default cannot be <code>nil</code>. That is why you are getting an error when tryin... |
39,419,596 | Resources$NotFoundException: File res/drawable/abc_ic_ab_back_material.xml | <p>After solving a JDK zero value error, now I'm facing this one. I did a little research, but it seems I can't get to the point. Here is the log error: </p>
<pre><code>FATAL EXCEPTION: main
E/AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{.MainActivity}: android.content.res.Resour... | 39,419,701 | 18 | 1 | null | 2016-09-09 20:57:56.04 UTC | 16 | 2021-01-18 08:30:02.847 UTC | 2018-12-03 14:34:17.917 UTC | null | 6,398,434 | user6099735 | null | null | 1 | 56 | android|android-layout|android-studio|gradle|android-gradle-plugin | 82,761 | <p>IF you're using Gradle Plugin 2.0, you need to make changes in your <code>gradle</code>:</p>
<pre><code>// Gradle Plugin 2.0+
android {
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
}
</code></pre>
<p>If you are using Gradle 1.5 you’ll use instead of previus:</p>
<pre><code>... |
6,446,699 | How do you bind a CollectionContainer to a collection in a view model? | <p>I have a view model with a property that exposes a collection of things.
I have a ComboBox whose ItemsSource property is bound to this collection.
Now the user can select from the list.</p>
<p>I want to allow the user to clear the selection, so I want to add an item (that is Null) to ComboBox. It's pretty straightf... | 6,446,923 | 2 | 1 | null | 2011-06-22 21:18:16 UTC | 17 | 2016-08-02 19:52:42.783 UTC | 2014-05-12 13:45:25.603 UTC | null | 140,420 | null | 140,420 | null | 1 | 57 | wpf|vb.net|xaml|data-binding | 33,840 | <p>The <code>CompositeCollection</code> has no <code>DataContext</code>, the bindings in the <code>CollectionContainers</code> will not work if they bind directly to a property (which implicitly uses the <code>DataContext</code> as source).</p>
<p>You need to explicitly specify a source, i would suggest you name the c... |
7,276,936 | Start Debugger in Code | <p>I need to debug an application that is started from a one-click install. (VS 2010, Excel
VSTO with Office 7). Based on login credentials supplied to the one-click installer application, the user should see one of two splash pages. This all works fine on my machine, but when deployed, changing from the default to th... | 7,276,957 | 4 | 3 | null | 2011-09-01 21:45:01.52 UTC | 6 | 2022-03-26 08:20:53.32 UTC | null | null | null | null | 16,851 | null | 1 | 59 | c#|visual-studio-2010|debugging | 41,331 | <pre><code>System.Diagnostics.Debugger.Launch();
</code></pre> |
21,479,079 | How to JOIN three tables in Codeigniter | <p>I'm using codeigniter framework to develop one music cms. i have 3 tables in mysql database, Currently im working in "Album" Table and "Model, Controller". i want to SELECT "Album" Table 1 and JOIN "Album" -> "cat_id" with "Category" -> "cat_id", and fetch all categories records.</p>
<p>Then i want to JOIN "Album" ... | 21,479,191 | 6 | 2 | null | 2014-01-31 11:33:28.447 UTC | 4 | 2021-05-03 04:44:53.287 UTC | null | null | null | null | 1,218,948 | null | 1 | 20 | php|mysql|codeigniter|join | 119,628 | <p>Use this code in model</p>
<pre><code>public function funcname($id)
{
$this->db->select('*');
$this->db->from('Album a');
$this->db->join('Category b', 'b.cat_id=a.cat_id', 'left');
$this->db->join('Soundtrack c', 'c.album_id=a.album_id', 'left');
$this->db->where(... |
21,575,310 | Converting "normal" std::string to utf-8 | <p>Let's see if I can explain this without too many factual errors...</p>
<p>I'm writing a string class and I want it to use <code>utf-8</code> (stored in a std::string) as it's internal storage.
I want it to be able to take both "normal" <code>std::string</code> and <code>std::wstring</code> as input and output.</p>
... | 21,575,607 | 1 | 3 | null | 2014-02-05 10:59:36.693 UTC | 5 | 2014-02-05 11:11:50.89 UTC | 2017-05-23 12:00:29.203 UTC | null | -1 | null | 498,519 | null | 1 | 20 | c++|windows|visual-studio-2010|utf-8|localization | 43,395 | <p>If your "normal string" is encoded using the system's code page and you want to convert it to UTF-8 then this should work:</p>
<pre><code>std::string codepage_str;
int size = MultiByteToWideChar(CP_ACP, MB_COMPOSITE, codepage_str.c_str(),
codepage_str.length(), nullptr, 0);
std::wstri... |
1,507,780 | Searching for a sequence of Bytes in a Binary File with Java | <p>I have a sequence of bytes that I have to search for in a set of Binary files using Java.</p>
<p>Example: I'm searching for the byte sequence <code>DEADBEEF</code> (in hex) in a Binary file.
How would I go about doing this in Java? Is there a built-in method, like <code>String.contains()</code> for Binary files?</p... | 1,507,813 | 4 | 0 | null | 2009-10-02 04:55:51.753 UTC | 11 | 2018-12-09 20:46:40.233 UTC | null | null | null | null | 1,572 | null | 1 | 37 | java|search|byte|binaryfiles | 26,450 | <p>No, there is no built-in method to do that. But, directly copied from <a href="http://www.velocityreviews.com/forums/t129673-search-byte-for-pattern.html" rel="noreferrer">HERE</a> (with two fixes applied to the original code):</p>
<pre><code>/**
* Knuth-Morris-Pratt Algorithm for Pattern Matching
*/
class KMPMat... |
1,937,702 | Visual Studio: Run C++ project Post-Build Event even if project is up-to-date | <p>In Visual Studio (2008) is it possible to force the Post-Build Event for a C++ project to run even if the project is up-to-date?</p>
<p>Specifically, I have a project which builds a COM in-process server DLL. The project has a post-build step which runs "regsvr32.exe $(TargetPath)". This runs fine on a "Rebuild", b... | 1,938,940 | 4 | 0 | null | 2009-12-21 01:05:48.703 UTC | 10 | 2019-05-03 14:02:59.993 UTC | 2019-02-25 13:18:47.927 UTC | null | 6,451,573 | null | 200,783 | null | 1 | 51 | c++|visual-studio|post-build-event|regsvr32 | 24,034 | <p>You can use the <strong>Custom Build Step</strong> property page to set up a batch file to run. This runs if the File specified in the <strong>Outputs</strong> setting is not found, or is out-of-date. Simply specify some non-existent file there, and the custom build step will always run. It will run even if your pro... |
1,861,489 | Converting a date in MySQL from string field | <p>I'm using a system where the dates are stored as strings in the format <code>dd/mm/yyyy</code>. Is it possible to convert this to <code>yyyy-mm-dd</code> in a SELECT query (so that I can use <code>DATE_FORMAT</code> on it)? Does MySQL have a date parsing function?</p>
<p>Currently the only method I can think of is ... | 1,861,551 | 4 | 0 | null | 2009-12-07 17:26:20.013 UTC | 11 | 2021-04-05 05:44:36.513 UTC | null | null | null | null | 37,947 | null | 1 | 60 | mysql|date | 180,351 | <p>This:</p>
<pre><code>STR_TO_DATE(t.datestring, '%d/%m/%Y')
</code></pre>
<p>...will convert the string into a datetime datatype. To be sure that it comes out in the format you desire, use <a href="http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-format" rel="noreferrer">DATE_FORMA... |
49,550,011 | Font Awesome Icons in Offline | <p>Is there any way to use this in offline?</p>
<pre><code> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</code></pre>
<p>I copy the link and save as font-awesome.min.css but still it is not working in offline like this link href="css/font-aw... | 49,550,097 | 7 | 4 | null | 2018-03-29 07:10:17.243 UTC | 3 | 2022-08-23 21:16:08.03 UTC | 2018-03-29 09:14:00.637 UTC | null | 6,597,375 | null | 8,341,429 | null | 1 | 10 | css|html|font-awesome|cdn | 49,663 | <p>Press the "Download free" button and make sure that you have the webfonts too. There is a <code>web-fonts-with-css</code> folder in the downloaded zip. Copy the fonts in your project and modify the paths for the fonts in your CSS to point to the location of the webfonts. </p>
<p>If you open the CSS linked in your q... |
28,676,437 | Slack - Show fullname of user instead of username | <p>Is there a way that in slack, we can show fullname of a user in the channel user list, instead of just the username? Since we have multiple teams and not all the people are familiar with usernames that users pick from different teams, its really difficult to identify who is who unless one goes to their profile or ch... | 29,567,294 | 2 | 3 | null | 2015-02-23 14:51:13.757 UTC | 4 | 2016-08-15 09:10:13.777 UTC | 2015-02-23 15:25:38.097 UTC | null | 1,391,685 | null | 1,391,685 | null | 1 | 40 | slack-api | 42,093 | <p><strong>For the application side</strong></p>
<p>Yes there is. In the window for slack, at the bottom left by your username, there is an up arrow. Click on that and you will see a preferences option.</p>
<p><img src="https://i.stack.imgur.com/lHuKM.png" alt="Slack Preferences"></p>
<p>Once you are in Preference... |
7,434,371 | image.onload function with return | <p>I have a JS function where a value is computed and this value should be returned but I get everytime <code>undefined</code> but if I <code>console.log()</code> the result within this function it works. Could you help?</p>
<pre><code>function detect(URL) {
var image = new Image();
image.src = URL;
image.... | 7,434,559 | 5 | 3 | null | 2011-09-15 16:36:22.33 UTC | 8 | 2020-08-06 16:12:44.813 UTC | 2020-08-06 16:12:44.813 UTC | null | 4,370,109 | null | 242,751 | null | 1 | 22 | javascript|image|dom-events | 51,325 | <p>I get it myself:</p>
<p>I didn't know that I can assign a variable to that (for me looking already assigned) onload.</p>
<pre><code>function detect(URL) {
var image = new Image();
image.src = URL;
var x = image.onload = function() {
var result = [{ x: 45, y: 56 }]; // An example result
... |
7,682,322 | IBOutlet and viewDidUnload under ARC | <p>There is a similar question to this on SO <a href="https://stackoverflow.com/questions/7678469/should-iboutlets-be-strong-or-weak-under-arc">here</a>, however I just want to clarify something that wasn't fully explained there.</p>
<p>I understand that all delegates and outlets - in fact any reference to a "parent" ... | 7,682,785 | 5 | 2 | null | 2011-10-07 01:50:41.703 UTC | 16 | 2013-09-05 07:51:18.84 UTC | 2017-05-23 11:55:39.927 UTC | null | -1 | null | 429,427 | null | 1 | 36 | ios|weak-references|iboutlet|automatic-ref-counting | 7,103 | <p>Just doing a bit of research...</p>
<p>As I understand it, weak is similar to assign, in that they're both weak references.</p>
<p>However, assign does not create a zeroing reference. i.e. if the object in question is destroyed, and you access that property, you WILL get a <code>BAD_ACCESS_EXCEPTION</code>.</p>
<... |
7,539,282 | Order of calling constructors/destructors in inheritance | <p>A little question about creating objects. Say I have these two classes:</p>
<pre><code>struct A{
A(){cout << "A() C-tor" << endl;}
~A(){cout << "~A() D-tor" << endl;}
};
struct B : public A{
B(){cout << "B() C-tor" << endl;}
~B(){cout << "~B() D-tor" <&l... | 7,539,330 | 6 | 4 | null | 2011-09-24 13:20:34.47 UTC | 31 | 2018-02-16 02:12:03.977 UTC | 2013-12-07 16:08:48.857 UTC | null | 635,608 | null | 882,868 | null | 1 | 43 | c++|constructor|order-of-execution|call-hierarchy | 80,210 | <ul>
<li>Construction always starts with the base <code>class</code>. If there are multiple base <code>class</code>es then, construction starts with the left most base. (<strong>side note</strong>: If there is a <code>virtual</code> inheritance then it's given higher preference).</li>
<li>Then the member fields are con... |
7,109,667 | Change default location of vimrc | <p>In Vim, is it possible to change the default location of the user vimrc file, i.e., from $HOME/.vimrc to some other location ?</p> | 7,109,871 | 8 | 0 | null | 2011-08-18 15:05:23.187 UTC | 18 | 2019-05-28 12:08:29.003 UTC | null | null | null | null | 715,769 | null | 1 | 52 | vim | 43,371 | <p>You must start vim with the command <code>vim -u ./path/to/your/vimrcfile</code></p>
<p><code>vim -u NONE</code> is a good way to start Vim without any plugin or customisation.</p>
<p>See <code>:help starting.txt</code> for more information.</p> |
14,076,207 | Simulating a key press event in Python 2.7 | <p>What I want to do is to press any keyboard key from the Python script level on Windows. I have tried SendKeys but it works only on python 2.6. Other methods that I have tried including</p>
<pre><code>import win32com.client
win32com.client.Dispatch("WScript.Shell").SendKeys('String to be typed')
</code></pre>
<p>a... | 22,894,683 | 1 | 1 | null | 2012-12-28 21:45:20.513 UTC | 9 | 2017-02-16 23:56:04.457 UTC | null | null | null | null | 1,354,439 | null | 1 | 8 | python|api|events|keyboard|simulation | 25,602 | <p>I wrote this code more than 1 year ago so it is not perfect but it works:</p>
<pre><code>from win32api import keybd_event
import time
import random
Combs = {
'A': [
'SHIFT',
'a'],
'B': [
'SHIFT',
'b'],
'C': [
'SHIFT',
'c'],
'D': [
'SHIFT',
... |
14,102,655 | users own pch (clip) in r | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/2181902/how-to-use-an-image-as-a-point-in-ggplot">How to use an image as a point in ggplot?</a> </p>
</blockquote>
<p>Is it possible to have user defined pch (clip art or icon or other type of file) used as poi... | 14,103,504 | 2 | 1 | null | 2012-12-31 14:18:57.273 UTC | 9 | 2012-12-31 18:38:51.68 UTC | 2017-05-23 11:58:26.223 UTC | null | -1 | null | 927,589 | null | 1 | 11 | r|plot|ggplot2|pch | 1,533 | <p>Using <code>grid.raster</code></p>
<pre><code>library(png)
flower <- readPNG("flower.png")
pushViewport(plotViewport(margins=c(5,5,5,5)))
grid.rect(gp = gpar(fill=NA))
pushViewport(plotViewport(margins=c(5,5,5,5),
xscale=extendrange(mydt$x),
yscale=extendrange(... |
14,120,502 | How to download and write a file from Github using Requests | <p>Lets say there's a file that lives at the github repo:</p>
<p><a href="https://github.com/someguy/brilliant/blob/master/somefile.txt" rel="noreferrer">https://github.com/someguy/brilliant/blob/master/somefile.txt</a></p>
<p>I'm trying to use requests to request this file, write the content of it to disk in the cur... | 14,120,601 | 4 | 1 | null | 2013-01-02 10:34:19.33 UTC | 11 | 2022-01-08 13:14:40.51 UTC | null | null | null | null | 868,908 | null | 1 | 34 | python|github|python-requests | 57,957 | <p>The content of the file in question is <em>included</em> in the returned data. You are getting the full GitHub view of that file, not just the contents.</p>
<p>If you want to download <em>just</em> the file, you need to use the <code>Raw</code> link at the top of the page, which will be (for your example):</p>
<pr... |
13,858,062 | Reset autoincrement in Microsoft SQL Server 2008 R2 | <p>I created a primary key to be autoincrement.</p>
<ul>
<li>I added two rows: <code>ID=1, ID=2</code></li>
<li>I deleted these two rows.</li>
<li>I added a new row, but the new row's ID was: <code>ID=3</code></li>
</ul>
<p>How can I reset or restart the autoincrement to 1?</p> | 13,858,108 | 2 | 0 | null | 2012-12-13 10:40:42.533 UTC | 8 | 2014-11-25 07:40:27.58 UTC | 2012-12-13 14:35:46.337 UTC | null | 576,752 | null | 644,686 | null | 1 | 35 | sql-server-2008-r2|auto-increment|identity-column | 78,591 | <p>If you use the <a href="http://msdn.microsoft.com/en-us/library/ms176057.aspx"><code>DBCC CHECKIDENT</code></a> command:</p>
<pre><code> DBCC CHECKIDENT ("YourTableNameHere", RESEED, 1);
</code></pre>
<p>But <strong>use with CAUTION!</strong> - this will just reset the <code>IDENTITY</code> to 1 - so your next ins... |
13,870,206 | Apache not starting in MAMP (but MySQL working) in OSX | <p>I've had MAMP working for a few months and recently installed PostgreSQL. It recommended installing Apache as well, which I did to make sure PostgreSQL worked. I then uninstalled PostgreSQL and the apache build and tried to restart MAMP. It fired up the MySQL database (green light) but Apache didn't start. I uni... | 24,287,496 | 16 | 0 | null | 2012-12-13 23:13:55.677 UTC | 17 | 2018-05-08 10:55:32.347 UTC | null | null | null | null | 630,203 | null | 1 | 62 | macos|apache|mamp | 94,647 | <p>Stoping the Apache solved this issue for me, using the command-line: </p>
<pre><code>sudo apachectl stop
</code></pre> |
14,057,932 | javax.xml.bind.JAXBException: Class *** nor any of its super class is known to this context | <p>I'm trying to pass a object via REST web service. Following are my classes explains the functionality that I need using some example codes. </p>
<p><strong>Rest Web Service Class method</strong></p>
<pre><code>@POST
@Path("/find")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Produces({MediaType.APPLICATION_JS... | 14,073,899 | 11 | 2 | null | 2012-12-27 16:33:44.617 UTC | 8 | 2022-03-14 11:39:49.363 UTC | 2013-08-26 15:45:16.287 UTC | null | 814,702 | null | 793,635 | null | 1 | 64 | java|rest|jaxb|jax-rs | 191,983 | <p>JAX-RS implementations automatically support marshalling/unmarshalling of classes based on discoverable JAXB annotations, but because your payload is declared as <code>Object</code>, I think the created <code>JAXBContext</code> misses the <code>Department</code> class and when it's time to marshall it it doesn't kno... |
13,944,222 | Change SVN repository URL | <p>My current SVN structure:</p>
<pre><code>Path: .
URL: svn://someaddress.com.tr/project
Repository Root: svn://someaddress.com.tr
Repository UUID: -------------------------------------
Revision: 10297
Node Kind: directory
Schedule: normal
Last Changed Author: ----
Last Changed Rev: 9812
Last Changed Date: 2010-12-20... | 13,944,343 | 7 | 1 | null | 2012-12-19 01:22:32.783 UTC | 20 | 2022-07-05 08:05:39.74 UTC | 2016-12-05 16:06:00.927 UTC | null | 63,550 | null | 257,972 | null | 1 | 134 | svn|svn-repository | 191,897 | <p>Given that the Apache Subversion server will be moved to this new DNS alias: <code>sub.someaddress.com.tr</code>:</p>
<ul>
<li><p>With Subversion 1.7 or higher, use <a href="http://svnbook.red-bean.com/en/1.7/svn.ref.svn.c.relocate.html" rel="noreferrer"><code>svn relocate</code></a>. Relocate is used when the SVN s... |
28,870,932 | How to remove white border from blur background image | <p>How to remove the white blur border from the background image.</p>
<pre><code><div class="background-image"></div>
</code></pre>
<p>CSS, i tried adding margin:-10px but it doesn't work</p>
<pre><code>.background-image {
background: no-repeat center center fixed;
background-image: url('http://ww... | 28,884,241 | 10 | 2 | null | 2015-03-05 05:50:01.337 UTC | 10 | 2022-08-08 07:56:27.147 UTC | 2015-03-05 06:35:32.903 UTC | null | 2,754,197 | null | 2,754,197 | null | 1 | 25 | html|css|blur | 55,990 | <p>I have added overflow, padding and even margin, but still the problem not solved. So i tried to give the image tag between div. Problem solved.</p>
<pre><code><div class="background-image">
<img src="http://www.hdpaperz.com/wallpaper/original/windows-8-wallpapers-2560x1600-2311_1.jpg" width="100%" height="... |
9,227,407 | How to insert data into a PL/SQL table type rather than PL/SQL table? | <p>I have a table TDATAMAP which has around 10 million records, I want to fetch all the records into a PL/SQL table type variable, match it with some criteria and finally insert all the required records in a staging table. Please tell me if its possible to do it using PL/SQL table typle variable and BULK INSERT/COLLECT... | 9,227,515 | 2 | 1 | null | 2012-02-10 11:59:55.007 UTC | null | 2012-02-10 19:28:38.153 UTC | null | null | null | null | 273,006 | null | 1 | 3 | oracle|plsql | 38,521 | <p>You can, but you probably should not, load 10 million records into memory at once - as long as there is sufficient memory to hold that much. Normally BULK COLLECT is used with the LIMIT clause to process a finite number of rows at a time e.g. 1000.</p>
<p>From the <a href="http://docs.oracle.com/cd/B12037_01/appde... |
32,905,917 | How to return JSON data from spring Controller using @ResponseBody | <p><strong>Spring version 4.2.0, Hibernate 4.1.4</strong>
Here is my <code>Controller</code> function:</p>
<pre><code>@RequestMapping(value = "/mobile/getcomp", method = RequestMethod.GET)
@ResponseBody
public List<Company> listforCompanies() {
List<Company> listOfCompanies= new ArrayList<Com... | 32,906,060 | 8 | 4 | null | 2015-10-02 11:11:35.757 UTC | 15 | 2020-04-30 18:08:00.697 UTC | 2016-11-15 01:02:18.88 UTC | null | 442,945 | null | 1,766,277 | null | 1 | 60 | java|json|spring|spring-mvc|spring-4 | 121,266 | <p>Add the below dependency to your pom.xml:</p>
<pre class="lang-xml prettyprint-override"><code><dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.5.0</version>
</dependency>
</code></pre> |
45,853,956 | putty - server unexpectedly closed network connection on windows | <p>I'm getting this error when using Putty:</p>
<blockquote>
<p>server unexpectedly closed network connection</p>
</blockquote>
<p>I try to connect my EC2 ubuntu 14.04 LTS Instance using putty,
and also i generate pem key to ppk key then i upload ppk key in putty and try to connect my Instance.</p> | 45,854,334 | 1 | 5 | null | 2017-08-24 05:56:55.937 UTC | null | 2020-12-17 12:45:46.44 UTC | null | null | null | null | 6,021,205 | null | 1 | 2 | putty | 48,878 | <p>To create and save a new keep-alive connection, follow these steps:</p>
<ul>
<li>Open the PuTTY application, and go to the Options panel (labeled "Category") on the left of the window.</li>
<li>Select (click) the "Connection" item.</li>
<li>In the "Sending of null packets to keep the session active" area on the r... |
3,310,736 | input[type="submit"] - change background when clicked | <p>I have a simple <code><input type="submit" value="Search"></code> submit button.
In the CSS i have styled it with <code>input[type="submit"]</code> and <code>input[type="submit"]:hover</code> so it changes its background by default and when hovered. Is there a way to change its background when clicked?</p> | 3,310,780 | 2 | 1 | null | 2010-07-22 15:48:02.91 UTC | null | 2012-09-29 22:55:47.81 UTC | null | null | null | null | 399,299 | null | 1 | 4 | html|css|input|submit | 43,051 | <p>You should be able to use <code>input[type=submit]:active</code>, similar to how you'd style links.</p>
<p>Do note that this will not function properly in IE6 (not sure about 7 and 8)</p> |
444,966 | How to handle IPv6 Addresses in PHP? | <p>After searching around somewhat thoroughly, I noticed a slight lack of functions in PHP for handling <a href="http://en.wikipedia.org/wiki/IPv6" rel="nofollow noreferrer">IPv6</a>. For my own personal satisfaction I created a few functions to help the transition.</p>
<p>The <code>IPv6ToLong()</code> function is a te... | 455,689 | 5 | 2 | null | 2009-01-14 22:35:45.217 UTC | 20 | 2021-11-08 23:52:04.683 UTC | 2021-11-08 23:52:04.683 UTC | Milen A. Radev | 1,563,960 | sirlancelot | 51,021 | null | 1 | 32 | php|ip|ipv6 | 51,513 | <p>How about <a href="http://php.net/inet_ntop" rel="noreferrer"><code>inet_ntop()</code></a>? Then instead of chopping things into integers, you just use a <code>varbinary(16)</code> to store it.</p> |
186,800 | Is it possible to specify proxy credentials in your web.config? | <p>I need to configure a website to access a webservice on another machine, via a proxy. I can configure the website to use a proxy, but I can't find a way of specifying the credentials that the proxy requires, is that possible? Here is my current configuration:</p>
<pre><code><defaultProxy useDefaultCredentials=... | 194,414 | 5 | 0 | null | 2008-10-09 11:19:18.187 UTC | 38 | 2022-06-10 06:25:40.437 UTC | 2008-10-09 11:31:28.617 UTC | null | 5,793 | null | 5,793 | null | 1 | 63 | c#|web-services|proxy | 108,732 | <p>Yes, it is possible to specify your own credentials without modifying the current code. It requires a small piece of code from your part though.</p>
<p>Create an assembly called <em>SomeAssembly.dll</em> with this class :</p>
<pre><code>namespace SomeNameSpace
{
public class MyProxy : IWebProxy
{
p... |
147,969 | Is it idiomatic Ruby to add an assert( ) method to Ruby's Kernel class? | <p>I'm expanding my Ruby understanding by coding an equivalent of Kent Beck's xUnit in Ruby. Python (which Kent writes in) has an assert() method in the language which is used extensively. Ruby does not. I think it should be easy to add this but is Kernel the right place to put it?</p>
<p>BTW, <em>I know of the exi... | 1,261,375 | 5 | 1 | null | 2008-09-29 08:39:16.18 UTC | 10 | 2022-09-04 19:48:56.027 UTC | 2012-06-11 14:01:52.88 UTC | Andrew Harmel-Law | 785,541 | Andrew Harmel-Law | 2,455 | null | 1 | 86 | ruby|assert|xunit | 41,737 | <p>No it's not a best practice. The best analogy to assert() in Ruby is just raising</p>
<pre><code> raise "This is wrong" unless expr
</code></pre>
<p>and you can implement your own exceptions if you want to provide for more specific exception handling</p> |
991,904 | Why is there no GIL in the Java Virtual Machine? Why does Python need one so bad? | <p>I'm hoping someone can provide some insight as to what's fundamentally different about the Java Virtual Machine that allows it to implement threads nicely without the need for a Global Interpreter Lock (GIL), while Python necessitates such an evil.</p> | 991,917 | 5 | 0 | null | 2009-06-14 01:12:55.97 UTC | 51 | 2017-06-28 17:02:01.367 UTC | null | null | null | null | 62,029 | null | 1 | 187 | java|python|multithreading|jvm|gil | 19,467 | <p>Python (the language) doesn't need a GIL (which is why it can perfectly be implemented on JVM [Jython] and .NET [IronPython], and those implementations multithread freely). CPython (the popular implementation) has always used a GIL for ease of coding (esp. the coding of the garbage collection mechanisms) and of inte... |
559,611 | Password storage in source control | <p>We store all our application and db passwords in plain text in source control. We do this as our build/deploy process generates required configuration files and also does actual deploys that require these passwords (ie: running sql against a database requires you logon to the db using valid credentials). Has anyon... | 559,743 | 6 | 1 | null | 2009-02-18 02:21:52.553 UTC | 11 | 2009-02-18 03:37:39.737 UTC | null | null | null | Marcus Leon | 47,281 | null | 1 | 19 | password-protection|password-storage | 8,831 | <p>If your plan is to store all the code and configuration information to run a production system directly from version control, and without human intervention, you're screwed. Why? This is all just a violation of the old security axiom "never write your password down". Let's do a proof by negation.</p>
<p>First cu... |
196,876 | Is there a better way to get a named series of constants (enumeration) in Python? | <p>Just looking at ways of getting named constants in python.</p>
<pre><code>class constant_list:
(A_CONSTANT, B_CONSTANT, C_CONSTANT) = range(3)
</code></pre>
<p>Then of course you can refer to it like so: </p>
<pre><code>constant_list.A_CONSTANT
</code></pre>
<p>I suppose you could use a dictionary, using st... | 196,881 | 6 | 1 | null | 2008-10-13 06:43:47.23 UTC | 10 | 2009-11-20 01:47:25.83 UTC | null | null | null | Bernard | 61 | null | 1 | 21 | python | 4,729 | <p>For 2.3 or after:</p>
<pre><code>class Enumerate(object):
def __init__(self, names):
for number, name in enumerate(names.split()):
setattr(self, name, number)
</code></pre>
<p>To use:</p>
<pre><code> codes = Enumerate('FOO BAR BAZ')
</code></pre>
<p><code>codes.BAZ</code> will be 2 and so on. </p>
<... |
142,948 | How can I use functional programming in the real world? | <p>Functional languages are good because they avoid bugs by eliminating state, but also because they can be easily parallelized automatically for you, without you having to worry about the thread count. </p>
<p>As a Win32 developer though, can I use Haskell for some dlls of my application? And if I do, is there a real... | 143,009 | 6 | 3 | null | 2008-09-27 04:02:25.163 UTC | 51 | 2012-05-02 19:38:43.017 UTC | 2012-05-02 19:38:43.017 UTC | JasonBunting | 53,777 | Brian R. Bondy | 3,153 | null | 1 | 103 | haskell|f#|functional-programming | 19,511 | <p>It seems like the book Real World Haskell is just what you're looking for. You can read it free online:</p>
<p><a href="http://book.realworldhaskell.org/" rel="noreferrer">http://book.realworldhaskell.org/</a></p> |
42,489,918 | Async/Await inside Array#map() | <p>I'm getting compile time error with this code: </p>
<pre><code>const someFunction = async (myArray) => {
return myArray.map(myValue => {
return {
id: "my_id",
myValue: await service.getByValue(myValue);
}
});
};
</code></pre>
<p>Error message is: </p>
<blockq... | 42,497,383 | 6 | 4 | null | 2017-02-27 15:46:42.467 UTC | 17 | 2021-12-25 21:16:40.583 UTC | 2017-03-01 14:33:14.077 UTC | null | 218,196 | null | 921,193 | null | 1 | 78 | javascript|async-await|ecmascript-2017 | 68,845 | <p>You can't do this as you imagine, because you can't use <code>await</code> if it is not directly inside an <code>async</code> function.</p>
<p>The sensible thing to do here would be to make the function passed to <code>map</code> asynchronous. This means that <code>map</code> would return an array of promises. We c... |
30,821,188 | Python NLTK pos_tag not returning the correct part-of-speech tag | <p>Having this:</p>
<pre><code>text = word_tokenize("The quick brown fox jumps over the lazy dog")
</code></pre>
<p>And running:</p>
<pre><code>nltk.pos_tag(text)
</code></pre>
<p>I get:</p>
<pre><code>[('The', 'DT'), ('quick', 'NN'), ('brown', 'NN'), ('fox', 'NN'), ('jumps', 'NNS'), ('over', 'IN'), ('the', 'DT'),... | 30,823,202 | 3 | 4 | null | 2015-06-13 16:52:28.27 UTC | 25 | 2021-05-05 16:21:03.117 UTC | 2015-06-16 00:12:25.887 UTC | null | 1,118,542 | null | 4,996,173 | null | 1 | 36 | python|machine-learning|nlp|nltk|pos-tagger | 19,331 | <p><strong>In short</strong>:</p>
<blockquote>
<p>NLTK is not perfect. In fact, no model is perfect.</p>
</blockquote>
<p><strong>Note:</strong></p>
<p>As of NLTK version 3.1, default <code>pos_tag</code> function is no longer the <a href="https://stackoverflow.com/questions/31386224/what-created-maxent-treebank-p... |
39,311,872 | Is performance reduced when executing loops whose uop count is not a multiple of processor width? | <p>I'm wondering how loops of various sizes perform on recent x86 processors, as a function of number of uops.</p>
<p>Here's a quote from Peter Cordes who raised the issue of non-multiple-of-4 counts in <a href="https://stackoverflow.com/a/31027695/149138">another question</a>:</p>
<blockquote>
<p>I also found that... | 39,940,932 | 3 | 22 | null | 2016-09-03 22:28:22.093 UTC | 17 | 2020-05-16 09:28:01.187 UTC | 2017-08-30 04:23:47.24 UTC | null | 149,138 | null | 149,138 | null | 1 | 32 | performance|assembly|x86|cpu-architecture|micro-optimization | 4,461 | <p>I did some investigation with Linux <code>perf</code> to help answer this on my Skylake <a href="http://ark.intel.com/products/88967/Intel-Core-i7-6700HQ-Processor-6M-Cache-up-to-3_50-GHz" rel="noreferrer">i7-6700HQ</a> box, and Haswell results have been kindly provided by another user. The analysis below applies to... |
35,715,400 | Laravel 5.2 could not open laravel.log | <p>I know there are a lot of questions on this topic but my issues is really weird that's why I decided to post.
I have this error in <code>/var/logs/apache/error.log</code></p>
<pre><code> [Tue Mar 01 07:26:51.435312 2016] [:error] [pid 8837] [client 127.0.0.1:37843] PHP Fatal error: Uncaught exception 'UnexpectedV... | 35,716,067 | 6 | 5 | null | 2016-03-01 05:34:45.837 UTC | 10 | 2018-04-04 11:53:31.387 UTC | null | null | null | null | 2,588,339 | null | 1 | 14 | php|laravel|laravel-5|chmod | 21,068 | <p>I finally found a solution.. Seems like the problem had to do with PSR-4 and auto importing classes</p>
<p>So here's the solution for anyone else having this problem: </p>
<pre><code>php artisan clear-compiled
composer dump-autoload
php artisan optimize
php artisan cache:clear
</code></pre> |
21,119,617 | Does mmap or malloc allocate RAM? | <p>I know this is probably a stupid question but i've been looking for awhile and can't find a definitive answer. If I use <code>mmap</code> or <code>malloc</code> (in C, on a linux machine) does either one allocate space in RAM? For example, if I have 2GB of RAM and wanted to use all available RAM could I just use a <... | 21,119,698 | 2 | 5 | null | 2014-01-14 17:12:02.353 UTC | 9 | 2014-01-14 18:35:29.91 UTC | 2014-01-14 17:58:47.533 UTC | null | 1,488,719 | null | 1,488,719 | null | 1 | 13 | c|linux|memory|malloc|mmap | 11,127 | <p>This is very OS/machine dependent.</p>
<p>In most OSes neither allocates RAM. They both allocate VM space. They make a certain range of your processes virtual memory valid for use. RAM is normally allocated later by the OS on first write. Until then those allocations do not use RAM (aside from the page table that l... |
20,953,371 | ASP.NET Identity, require 'strong' passwords | <p>Perhaps my googlin' skills are not so great this morning, but I can't seem to find how to set up different password requirements (rather than min/max length) with a new asp.net mvc5 project using individual user accounts.</p>
<pre><code>[Required]
[StringLength(100, ErrorMessage = "The {0} must be at least {2} char... | 20,953,845 | 4 | 6 | null | 2014-01-06 15:33:56.77 UTC | 15 | 2016-12-18 14:52:56.42 UTC | null | null | null | null | 1,118,218 | null | 1 | 40 | c#|asp.net|asp.net-mvc|asp.net-identity | 25,062 | <p>You could use the <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.regularexpressionattribute%28v=vs.110%29.aspx" rel="nofollow noreferrer">RegularExpressionAttribute</a> together with the rules from this answer:</p>
<p><a href="https://stackoverflow.com/questions/5142103/regex... |
17,803,456 | An alternative for the deprecated __malloc_hook functionality of glibc | <p>I am writing a memory profiler for C and for that am intercepting calls to the <code>malloc</code>, <code>realloc</code> and <code>free</code> functions via malloc_hooks. Unfortunately, these are deprecated because of their poor behavior in multi threaded environments. I could not find a document describing the alte... | 17,850,402 | 3 | 2 | null | 2013-07-23 07:02:34.253 UTC | 14 | 2019-02-28 06:45:55.15 UTC | 2018-09-28 17:55:19.15 UTC | null | 1,971,003 | null | 885,605 | null | 1 | 37 | c|gcc|malloc|deprecated|glibc | 16,861 | <p>After trying some things, I finally managed to figure out how to do this.</p>
<p>First of all, in <code>glibc</code>, <code>malloc</code> is defined as a weak symbol, which means that it can be overwritten by the application or a shared library. Hence, <code>LD_PRELOAD</code> is not necessarily needed. Instead, I i... |
46,989,310 | commons-logging defines classes that conflict with classes now provided by Android after Android Studio Update | <p>I have updated Android Studio to version 3 and now seems unable to compile my project previously compiled without errors.</p>
<p>The error message is the follow</p>
<blockquote>
<p>Error:Error: commons-logging defines classes that conflict with
classes now provided by Android. Solutions include finding newer
... | 46,995,816 | 12 | 4 | null | 2017-10-28 11:41:19.81 UTC | 6 | 2022-03-23 16:06:59.267 UTC | 2017-10-28 11:57:00.943 UTC | null | 1,145,744 | null | 1,145,744 | null | 1 | 59 | android|android-studio|android-gradle-plugin|android-studio-3.0|android-gradle-3.0 | 24,329 | <p>Add to <code>build.gradle</code> located in app module </p>
<pre><code>configurations {
all {
exclude module: 'httpclient'
}
}
</code></pre> |
22,947,181 | Don't argparse read unicode from commandline? | <p>Running Python 2.7</p>
<p>When executing:</p>
<pre><code>$ python client.py get_emails -a "åäö"
</code></pre>
<p>I get:</p>
<pre><code>usage: client.py get_emails [-h] [-a AREA] [-t {rfc2822,plain}]
client.py get_emails: error: argument -a/--area: invalid unicode value: '\xc3\xa5\xc3\xa4\xc3\xb6'
</code></pre>
... | 22,947,334 | 2 | 2 | null | 2014-04-08 20:10:53.547 UTC | 8 | 2014-04-15 13:33:22.283 UTC | null | null | null | null | 934,836 | null | 1 | 13 | python|unicode|argparse | 9,365 | <p>You can try</p>
<pre><code>type=lambda s: unicode(s, 'utf8')
</code></pre>
<p>instead of</p>
<pre><code>type=unicode
</code></pre>
<p>Without encoding argument unicode() defaults to ascii.</p> |
23,431,595 | Task.Yield - real usages? | <p>I've been reading about <code>Task.Yield</code> , And as a Javascript developer I can tell that's it's job is <strike><em>exactly</em></strike> the same as <code>setTimeout(function (){...},0);</code> in terms of letting the main single thread deal with other stuff aka :</p>
<blockquote>
<p>"don't take all the p... | 23,441,833 | 6 | 3 | null | 2014-05-02 15:22:20.563 UTC | 14 | 2022-09-07 21:32:27.167 UTC | 2014-05-04 04:02:55.993 UTC | user149341 | null | null | 859,154 | null | 1 | 46 | c#|multithreading|async-await|.net-4.5|c#-5.0 | 27,414 | <p>When you see:</p>
<pre><code>await Task.Yield();
</code></pre>
<p>you can think about it this way:</p>
<pre><code>await Task.Factory.StartNew(
() => {},
CancellationToken.None,
TaskCreationOptions.None,
SynchronizationContext.Current != null?
TaskScheduler.FromCurrentSynchronizationCon... |
1,679,974 | Converting an FFT to a spectogram | <p>I have an audio file and I am iterating through the file and taking 512 samples at each step and then passing them through an FFT.</p>
<p>I have the data out as a block 514 floats long (Using IPP's ippsFFTFwd_RToCCS_32f_I) with real and imaginary components interleaved.</p>
<p>My problem is what do I do with these... | 1,680,905 | 5 | 2 | null | 2009-11-05 11:33:37.497 UTC | 9 | 2012-05-19 07:36:06.037 UTC | 2012-05-07 07:47:46.22 UTC | null | 20,984 | null | 131,140 | null | 1 | 12 | c++|fft|spectrogram|intel-ipp | 11,087 | <p>The usual thing to do to get all of an FFT visible is to take the logarithm of the magnitude. </p>
<p>So, the position of the output buffer tells you what frequency was detected. The magnitude (L2 norm) of the complex number tells you how strong the detected frequency was, and the phase (arctangent) gives you inf... |
1,426,239 | Can ML functors be fully encoded in .NET (C#/F#)? | <p>Can ML functors be practically expressed with .NET interfaces and generics? Is there an advanced ML functor use example that defies such encodings?</p>
<p><strong>Answers summary</strong>:</p>
<p>In the general case, the answer is NO. ML modules provide features (such as specification sharing via signatures [<a hr... | 1,448,352 | 5 | 0 | 2009-09-15 21:52:45.377 UTC | 2009-09-15 09:57:00.06 UTC | 12 | 2013-05-21 01:12:13.643 UTC | 2017-05-23 10:29:36.727 UTC | null | -1 | null | 386,685 | null | 1 | 18 | .net|f#|functor | 3,831 | <p>One of the key features of ML modules is sharing specifications. There's no mechanism in .NET that would be able to emulate them - the required machinery is just too different.</p>
<p>You can try to do it by turning the shared types into parameters, but this can't faithfully emulate the ability to define a signatur... |
1,749,314 | Is Solr available for .Net? | <p>I want to learn Solr. May I know some good tutorial/links for it?</p>
<p>Also, is Solr available for .NET?</p> | 1,749,759 | 5 | 2 | null | 2009-11-17 14:37:29.2 UTC | 12 | 2017-06-05 17:30:44.06 UTC | 2012-12-26 16:05:44.537 UTC | null | 1,250,033 | null | 55,717 | null | 1 | 35 | .net|lucene|solr | 26,358 | <p>If you mean running the Solr server on .Net instead of Java, then no, there is no port. I've been trying to run it with <a href="http://www.ikvm.net/" rel="noreferrer">IKVM</a> <a href="http://code.google.com/p/mausch/source/browse/trunk/SolrIKVM/" rel="noreferrer">here</a> but it's low-priority to me so I can't put... |
1,505,754 | C# Could not load file or assembly 'Microsoft.SharePoint.Library' | <p>I am developing on a 64bit version of Windows 7, running MOSS (SharePoint), this is my dev machine. </p>
<p>Now when I deploy my web service app to a test server Windows 2003 32bit (no Sharepoint installed) I get this error. </p>
<p>Could not load file or assembly 'Microsoft.SharePoint.Library, Version=12.0.0.0, C... | 1,505,965 | 6 | 5 | null | 2009-10-01 18:47:09.483 UTC | 2 | 2011-11-24 16:48:09.997 UTC | null | null | null | null | 41,543 | null | 1 | 5 | c#|sharepoint | 40,659 | <p>If you are using sharepoint dll's it will only work on a machine with sharepoint installed.</p>
<p>Even if you managed to hack it and get it to work, you would probably be breaking a license agreement.</p> |
2,129,593 | UITextField, automatically move to next after 1 character | <p>Scenario: I have 4 UITextFields that only accept 1 character. Easy.</p>
<p>Problem: After I enter the 1 character, I want the next TextField to become active automatically without having to press next (i.e. I'm using the UIKeyboardTypeNumberPad, and theres no NEXT button. (I KNOW I can actually create a next button... | 3,410,922 | 6 | 0 | null | 2010-01-25 00:45:24.52 UTC | 12 | 2020-02-24 23:36:30.35 UTC | 2014-02-12 00:03:23.673 UTC | null | 171,206 | null | 171,206 | null | 1 | 15 | delegates|keyboard|uitextfield | 15,861 | <p>I arrived at a solution by modifying some code I found here:
<a href="http://www.thepensiveprogrammer.com/2010/03/customizing-uitextfield-formatting-for.html" rel="noreferrer">http://www.thepensiveprogrammer.com/2010/03/customizing-uitextfield-formatting-for.html</a></p>
<p>First set the your view controller to be ... |
1,673,347 | LINQ: Determine if two sequences contains exactly the same elements | <p>I need to determine whether or not two sets contains exactly the same elements. The ordering does not matter.</p>
<p>For instance, these two arrays should be considered equal:</p>
<pre><code>IEnumerable<int> data = new []{3, 5, 6, 9};
IEnumerable<int> otherData = new []{6, 5, 9, 3}
</code></pre>
<p>On... | 1,673,388 | 7 | 3 | null | 2009-11-04 11:57:29.173 UTC | 15 | 2018-05-19 11:09:09.54 UTC | 2018-05-19 11:07:46.383 UTC | null | 63,550 | null | 13,627 | null | 1 | 72 | c#|.net|linq | 37,863 | <p>If you want to treat the arrays as "sets" and ignore order and duplicate items, you can use <a href="http://msdn.microsoft.com/en-us/library/bb346516.aspx" rel="noreferrer"><code>HashSet<T>.SetEquals</code> method</a>:</p>
<pre><code>var isEqual = new HashSet<int>(first).SetEquals(second);
</code></pre>... |
1,497,777 | Freemarker iterating over hashmap keys | <p>Freemarker has two collection datatypes, lists and hashmaps
Is there a way to iterate over hashmap keys just as we do with lists?</p>
<p>So if I have a var with data lets say:</p>
<pre><code>user : {
name : "user"
email : "looser@everything.com"
homepage : "http://nosuchpage.org"
}
</code></pre>
<p>I would ... | 1,497,802 | 7 | 0 | null | 2009-09-30 12:22:02.353 UTC | 14 | 2018-07-23 16:09:56.423 UTC | 2012-03-13 15:52:18.753 UTC | null | 8,418 | null | 165,697 | null | 1 | 93 | java|freemarker | 122,365 | <p><strong>Edit:</strong> Don't use this solution with FreeMarker 2.3.25 and up, especially not <code>.get(prop)</code>. See other answers.</p>
<p>You use the built-in <a href="http://freemarker.sourceforge.net/docs/ref_builtins_hash.html" rel="noreferrer">keys</a> function, e.g. this should work:</p>
<pre><code><... |
1,680,528 | How to avoid having class data shared among instances? | <p>What I want is this behavior:</p>
<pre><code>class a:
list = []
x = a()
y = a()
x.list.append(1)
y.list.append(2)
x.list.append(3)
y.list.append(4)
print(x.list) # prints [1, 3]
print(y.list) # prints [2, 4]
</code></pre>
<p>Of course, what really happens when I print is:</p>
<pre><code>print(x.list) # pri... | 1,680,555 | 7 | 1 | null | 2009-11-05 13:19:55.693 UTC | 38 | 2019-02-15 11:34:35.117 UTC | 2018-03-31 15:22:26.607 UTC | null | 2,301,450 | null | 150,564 | null | 1 | 175 | python|class | 34,172 | <p>You want this:</p>
<pre><code>class a:
def __init__(self):
self.list = []
</code></pre>
<p>Declaring the variables inside the class declaration makes them "class" members and not instance members. Declaring them inside the <code>__init__</code> method makes sure that a new instance of the members is cr... |
1,789,543 | How to find number of bytes taken by python variable | <p>Is there anyway i can know how much bytes taken by particular variable in python. E.g; lets say i have</p>
<pre><code>int = 12
print (type(int))
</code></pre>
<p>it will print</p>
<pre><code><class 'int'>
</code></pre>
<p>But i wanted to know how many bytes it has taken on memory? is it possible?</p> | 1,789,567 | 9 | 0 | null | 2009-11-24 11:41:47.077 UTC | 5 | 2021-12-07 20:51:20.56 UTC | 2009-11-24 18:24:38.747 UTC | null | 10,661 | null | 146,603 | null | 1 | 28 | python | 50,641 | <p>You can find the functionality you are looking for <a href="http://docs.python.org/library/sys.html#sys.getsizeof" rel="noreferrer">here</a> (in <code>sys.getsizeof</code> - Python 2.6 and up).</p>
<p>Also: don't shadow the <code>int</code> builtin!</p>
<pre><code>import sys
myint = 12
print(sys.getsizeof(myint))
</... |
1,525,444 | How to connect SQLite with Java? | <p>I am using one simple code to access the SQLite database from Java application .
My code is</p>
<pre><code> import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class ConnectSQLite
{
public static void main(String[] args)
{
... | 1,525,453 | 9 | 1 | null | 2009-10-06 13:02:55.467 UTC | 26 | 2017-03-31 06:28:10.677 UTC | 2012-04-15 06:28:02.527 UTC | null | 632,447 | null | 131,062 | null | 1 | 51 | java|sqlite|jdbc|classpath | 199,900 | <p>You need to have a SQLite JDBC driver in your classpath.</p>
<p>Taro L. Saito (xerial) forked the Zentus project and now maintains it under the name <a href="https://github.com/xerial/sqlite-jdbc" rel="noreferrer">sqlite-jdbc</a>. It bundles the native drivers for major platforms so you don't need to configure them... |
1,952,153 | What is the best way to find all combinations of items in an array? | <p>What is the best way to find all combinations of items in an array in c#?</p> | 1,952,242 | 10 | 4 | null | 2009-12-23 11:11:49.537 UTC | 34 | 2020-04-30 21:17:12.73 UTC | 2013-04-18 17:29:17.21 UTC | null | 815,724 | null | 13,911 | null | 1 | 54 | c#|algorithm | 75,523 | <p>It is O(n!)</p>
<pre><code>static List<List<int>> comb;
static bool[] used;
static void GetCombinationSample()
{
int[] arr = { 10, 50, 3, 1, 2 };
used = new bool[arr.Length];
used.Fill(false);
comb = new List<List<int>>();
List<int> c = new List<int>();
Ge... |
1,670,970 | How to cherry-pick multiple commits | <p>I have two branches. Commit <code>a</code> is the head of one, while the other has <code>b</code>, <code>c</code>, <code>d</code>, <code>e</code> and <code>f</code> on top of <code>a</code>. I want to move <code>c</code>, <code>d</code>, <code>e</code> and <code>f</code> to first branch without commit <code>b</code>... | 3,933,416 | 17 | 1 | null | 2009-11-04 00:07:03.587 UTC | 391 | 2022-08-04 15:08:17.153 UTC | 2012-09-28 19:02:45.27 UTC | null | 356,895 | null | 96,823 | null | 1 | 1,317 | git|git-rebase|cherry-pick | 808,961 | <p>Git 1.7.2 introduced the ability to cherry pick a range of commits. From the <a href="https://raw.github.com/git/git/master/Documentation/RelNotes/1.7.2.txt" rel="noreferrer">release notes</a>:</p>
<blockquote>
<p><code>git cherry-pick</code> learned to pick a range of commits
(e.g. <code>cherry-pick A..B</code> and... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.