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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
783,974 | How to implement SOLID principles into an existing project | <p>I apologize for the subjectiveness of this question, but I am a little stuck and I would appreciate some guidance and advice from anyone who's had to deal with this issue before:</p>
<p>I have (what's become) a very large RESTful API project written in C# 2.0 and some of my classes have become monstrous. My main A... | 784,035 | 5 | 0 | null | 2009-04-23 23:28:09.733 UTC | 20 | 2021-12-11 15:31:27.037 UTC | 2013-04-21 13:01:57.057 UTC | null | 682,095 | null | 11,194 | null | 1 | 22 | c#|design-patterns|solid-principles | 5,745 | <p><strong>Single Responsibility Principle</strong> - A class should have only one reason to change. If you have a monolithic class, then it probably has more than one reason to change. Simply define your one reason to change, and be as granular <em>as reasonable</em>. I would suggest to start "large". Refact... |
885,156 | What's wrong with var x = new Array(); | <p>In JSLint, it warns that</p>
<pre><code>var x = new Array();
</code></pre>
<p>(That's not a real variable name) should be</p>
<pre><code>var result = [];
</code></pre>
<p>What is wrong with the 1st syntax? What's the reasoning behind the suggestion?</p> | 885,196 | 5 | 1 | null | 2009-05-19 21:38:29.077 UTC | 8 | 2013-01-21 20:25:35.723 UTC | 2009-05-19 22:29:32.797 UTC | null | 21,574 | null | 21,574 | null | 1 | 41 | javascript|jslint | 19,444 | <p><a href="https://stackoverflow.com/questions/383402/is-javascript-s-new-keyword-considered-harmful">Crockford doesn't like <code>new</code></a>. Therefore, <a href="http://www.jslint.com/lint.html#new" rel="nofollow noreferrer">JSLint expects you to avoid it</a> when possible. And creating a new array object is poss... |
313,778 | generate dependencies for a makefile for a project in C/C++ | <p>I have a project that has a makefile with broken dependencies. Is there any best known way to generate a list of dependencies for the project that I can use in the makefile, other than examining each source file by hand or with a hand written perl script?</p> | 313,787 | 5 | 0 | null | 2008-11-24 09:49:58.677 UTC | 24 | 2019-02-23 03:41:02 UTC | null | null | null | Nathan Fellman | 1,084 | null | 1 | 42 | c++|c|makefile|dependencies | 56,610 | <p><a href="https://make.mad-scientist.net/papers/advanced-auto-dependency-generation/#combine" rel="noreferrer">GNU make</a>'s documentation provides a good solution.</p>
<p>Absolutely. <code>g++ -MM <your file></code> will generate a GMake compatible list of dependencies. I use something like this:</p>
<pre><... |
1,003,613 | How to make a div 100% of page (not screen) height? | <p>I'm trying to use CSS to create a 'greyed out' effect on my page while a loading box is displayed in the foreground while the application is working. I've done this by creating a 100% height/width, translucent black div which has its visibility toggled on/off via javascript. I thought this would be simple enough; ho... | 1,003,652 | 5 | 1 | null | 2009-06-16 19:56:54.113 UTC | 11 | 2016-03-23 09:48:29.987 UTC | null | null | null | null | 69,285 | null | 1 | 57 | html|css | 78,279 | <p>If you change <code>position: absolute</code> to <code>position: fixed</code> it will work in all browsers except IE6. This fixes the div to the viewport, so it doesn't move out of view when scrolling.</p>
<p>You can use <code>$(document).height()</code> in jQuery to make it work in IE6 too. E.g.</p>
<pre><code>$(... |
165,650 | How to add a Tooltip to a "td" with jquery? | <p>I need to add a tooltip/alt to a "td" element inside of my tables with jquery.</p>
<p>Can someone help me out?</p>
<p>I tried:</p>
<pre><code>var tTip ="Hello world";
$(this).attr("onmouseover", tip(tTip));
</code></pre>
<p>where I have verified that I am using the "td" as "this".</p>
<p>**Edit:**I am able to c... | 165,668 | 6 | 0 | null | 2008-10-03 04:00:48.593 UTC | 1 | 2016-02-21 15:03:34.203 UTC | 2016-02-21 15:03:34.203 UTC | Scott | 1,479,535 | Scott | 7,644 | null | 1 | 8 | jquery|html | 50,041 | <p>you might want to have a look at <a href="http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/" rel="noreferrer">http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/</a></p> |
631,695 | Why am I getting a Hibernate LazyInitializationException in this Spring MVC web application when the data displays correctly? | <p>I am attempting to create a web application using Spring MVC, with Hibernate as its ORM layer. However, due to my inexperience with both frameworks I'm struggling.</p>
<p>The following code will properly display all the records I am looking for but still throw a stack trace into my logs. I'm having trouble finding ... | 632,455 | 6 | 4 | null | 2009-03-10 18:39:42.803 UTC | 6 | 2015-01-16 12:41:47.67 UTC | 2017-05-23 12:14:46.883 UTC | nemo | -1 | nemo | 20,774 | null | 1 | 11 | java|hibernate|spring|web-applications|netbeans | 51,397 | <p>I am just guessing but from the stack trace it seems that toString is being called on SearchRule. Does SearchRule have any child objects that may not have been loaded? If SearchRule.toString was trying to get the value for an uninitialised child object that could result in the LazyInitializationException.</p> |
1,246,749 | sql server express connection string | <p>Is there a difference between sql server connection string and the express vesion?!</p> | 1,246,763 | 6 | 0 | null | 2009-08-07 20:06:06.703 UTC | 3 | 2012-01-02 07:04:04.103 UTC | 2009-08-07 20:09:52.093 UTC | null | 23,199 | null | 108,963 | null | 1 | 14 | sql-server|asp.net-3.5 | 47,906 | <p>By default (though I don't recommend it<sup>1</sup>), Sql Express is installed as a <a href="http://msdn.microsoft.com/en-us/library/ms165614(SQL.90).aspx" rel="noreferrer">named instance</a>. That means you must connect like <code>Server=servername.com\SQLEXPRESS</code> as opposed to just <code>Server=servername.co... |
926,594 | Installing a plain plugin jar in Eclipse 3.5 | <p>Since Eclipse 3.5 there seems to be no option to have drop a plugin jar ( not a feature ) in the Eclipse base directory and have it picked up at next startup.</p>
<p>Is there any possiblity to have plain plugins jars installed in Eclipse 3.5?</p> | 926,949 | 6 | 0 | null | 2009-05-29 15:27:27.187 UTC | 14 | 2020-05-20 10:30:14.64 UTC | null | null | null | null | 112,671 | null | 1 | 57 | eclipse | 114,867 | <p>Since the advent of p2, you should be using the <a href="http://wiki.eclipse.org/Equinox_p2_Getting_Started#Dropins" rel="noreferrer">dropins directory</a> instead.</p>
<blockquote>
<p>To be completely clear create "plugins" under "/dropins"
and make sure to restart eclipse with the "-clean" option.</p>
</block... |
444,251 | How to store a list in a db column | <p>I would like to store an object <strong>FOO</strong> in a database.
Lets say FOO contains three integers and a list of "<em>Fruits</em>".</p>
<p>The list can have any length, the only thing I know is that the all the fruits allowed are stored in another table.</p>
<p>Can I store the fruit list in a column? </p> | 444,268 | 6 | 0 | null | 2009-01-14 19:04:50.117 UTC | 32 | 2014-02-19 20:35:11.24 UTC | null | null | null | Stumproot | 17,413 | null | 1 | 68 | sql|database | 39,436 | <p>In a normalized relational database, such a situation is unacceptable. You should have a junction table that stores one row for each distinct ID of the FOO object and the ID of the Fruit. Existence of such a row means the fruit is in that list for the FOO.</p>
<pre><code>CREATE TABLE FOO (
id int primary key not... |
274,149 | Repeat table headers in print mode | <p>Is it possible in CSS using a property inside an @page to say that table headers (th) should be repeated on every page if the table spreads over multiple pages?</p> | 274,161 | 6 | 0 | null | 2008-11-08 01:12:35.757 UTC | 30 | 2021-08-20 17:40:28.54 UTC | 2016-09-14 17:34:43.457 UTC | Alessandro Vernet | 4,370,109 | Alessandro Vernet | 5,295 | null | 1 | 128 | css|css-tables | 181,596 | <p>This is what the <a href="http://htmlhelp.com/reference/html40/tables/thead.html" rel="noreferrer">THEAD</a> element is for. Official docs <a href="http://www.w3.org/TR/html4/struct/tables.html#edef-THEAD" rel="noreferrer">here</a>.</p> |
68,982,181 | Issue: Audit usage of navigator.userAgent, navigator.appVersion, and navigator.platform | <p>I started a new project in vue.js. I added navbar. At one point, I noticed issue in the console:</p>
<pre><code>Audit usage of navigator.userAgent, navigator.appVersion, and navigator.platform
</code></pre>
<p><a href="https://i.stack.imgur.com/82nIq.png" rel="noreferrer"><img src="https://i.stack.imgur.com/82nIq.pn... | 70,084,891 | 2 | 3 | null | 2021-08-30 09:58:34.133 UTC | 3 | 2022-02-09 00:16:29.463 UTC | 2021-09-14 08:33:20.183 UTC | null | 14,748,677 | null | 14,748,677 | null | 1 | 12 | css|vue.js|console|extend | 60,667 | <p>The reason one sees the message is well explained in the description of the very same message (audit).</p>
<p>The real question is who/what is the source of it. There is a hint to the file <code>extended-css.js</code>.</p>
<p>Here is an example with another file (as I do not have the <code>extended-css.js</code>):
<... |
30,821,356 | "Multiple definition", "first defined here" errors | <p>I have 3 projects: <em>Server</em>, <em>Client</em> and <em>Commons</em>. Making header & source pairs in <em>Commons</em> doesn't cause any problems and I can access the functions freely from both <em>Server</em> and <em>Client</em>.</p>
<p>However, for some reason making additional source/header files within ... | 30,821,844 | 5 | 2 | null | 2015-06-13 17:10:45.867 UTC | 7 | 2020-06-08 18:32:19.667 UTC | null | null | null | null | 2,903,567 | null | 1 | 47 | c|eclipse|include|definition|multiple-definition-error | 189,627 | <p>The problem here is that you are including <code>commands.c</code> in <code>commands.h</code> before the function prototype. Therefore, the C pre-processor inserts the content of <code>commands.c</code> into <code>commands.h</code> before the function prototype. <code>commands.c</code> contains the function definiti... |
31,189,123 | docker-machine behind corporate proxy | <p>I am trying to use docker-machine to create an instance on a private cloud (Openstack) that is behind a corporate http proxy. </p>
<p>Is it possible to tell docker-machine to use the proxy or do I need to have a glance image that is already pre-configure with the http_proxy env variable?</p> | 39,734,908 | 5 | 2 | null | 2015-07-02 15:47:35.053 UTC | 20 | 2019-07-24 20:42:12.3 UTC | 2019-06-11 17:02:51.293 UTC | null | 474,034 | null | 3,612,251 | null | 1 | 32 | docker|docker-machine | 26,066 | <p>As previously mentioned, you can edit the file at</p>
<pre><code>$HOME\.docker\machine\machines\default\config.json
</code></pre>
<p>and set the HTTP_PROXY, HTTPS_PROXY and NO_PROXY variables (or delete them):</p>
<pre><code> "HostOptions": {
"Driver": "",
...
"EngineOptions": {
... |
13,491,852 | set column width using jQuery | <p>I have html table with format </p>
<pre><code><div id="divOutputWindow">
<table>
<tbody>
<tr>
<td>/* Set Width 10 Px */ </td>
<td>/* Set Width 20 Px */ </td>
</tr>
<tr>
/* Same for all tr */
</tr>
</tbody>
</table>
</div>
</code></p... | 13,493,279 | 7 | 0 | null | 2012-11-21 11:03:16.417 UTC | null | 2012-11-21 12:41:59.19 UTC | null | null | null | null | 1,169,180 | null | 1 | 4 | jquery | 49,035 | <ul>
<li>Loop trough each <code><td></code> inner your <code>#divOutputWindow</code>.</li>
<li>Use <code>.each();</code> for that, in the loop you can acces the current
DOM-object by <code>$(this)</code>.</li>
<li>Define a minimum and a stepsize, use <code>$(this).index();</code> for counting.</li>
<li>Then use t... |
37,771,434 | mac - pip install pymssql error | <p>I use Mac (OS X 10.11.5). I want to install module <code>pymssql</code> for python.
In <code>Terminal.app</code>, I input <code>sudo -H pip install pymssql</code>, <code>pip install pymssql</code>, <code>sudo pip install pymssql</code> . But error occur.</p>
<blockquote>
<p>The directory <code>/Users/janghyunsoo/Lib... | 38,002,724 | 7 | 2 | null | 2016-06-12 06:38:34.283 UTC | 11 | 2022-09-15 18:39:42.073 UTC | 2020-06-20 09:12:55.06 UTC | null | -1 | null | 6,455,358 | null | 1 | 33 | python|macos|python-2.7|pymssql | 24,560 | <p>I was able to work around this by reverting to an older version of FreeTDS through Homebrew before running the pip install.</p>
<pre><code>brew unlink freetds; brew install homebrew/versions/freetds091
</code></pre>
<p>The solution was found by andrewmwhite at:
<a href="https://github.com/pymssql/pymssql/issues/43... |
21,260,602 | How to reject a promise from inside then function | <p>This is probably a silly question, but mid promise chain, how do you reject a promise from inside one of the then functions? For example:</p>
<pre><code>someActionThatReturnsAPromise()
.then(function(resource) {
return modifyResource(resource)
})
.then(function(modifiedResource) {
if (!... | 21,262,065 | 1 | 3 | null | 2014-01-21 14:16:02.897 UTC | 13 | 2014-01-21 15:17:32.48 UTC | null | null | null | null | 656,677 | null | 1 | 97 | javascript|promise | 54,527 | <blockquote>
<p>Am I just supposed to add <code>return Promise.reject(validationError);</code>?</p>
</blockquote>
<p>Yes. However, <a href="https://stackoverflow.com/questions/10843297/throwing-an-error-in-jquerys-deferred-object">it's that complicated</a> only in jQuery, with a <a href="http://promisesaplus.com/">P... |
17,729,853 | Replace value for a selected cell in pandas DataFrame without using index | <p>this is a rather similar question to <a href="https://stackoverflow.com/questions/13842088/set-value-for-particular-cell-in-pandas-dataframe" title="Set value for particular cell in pandas DataFrame">this question</a> but with one key difference: I'm selecting the data I want to change not by its index but by some c... | 17,729,985 | 3 | 0 | null | 2013-07-18 17:08:17.71 UTC | 33 | 2021-10-23 06:42:08.417 UTC | 2019-06-11 21:41:35.477 UTC | null | 2,662,901 | null | 2,071,807 | null | 1 | 58 | python|pandas|dataframe | 110,804 | <p>Many ways to do that </p>
<h3>1</h3>
<pre><code>In [7]: d.sales[d.sales==24] = 100
In [8]: d
Out[8]:
day flavour sales year
0 sat strawberry 10 2008
1 sun strawberry 12 2008
2 sat banana 22 2008
3 sun banana 23 2008
4 sat strawberry 11 2009
5 sun strawberry ... |
17,748,993 | Jenkins: build one job after another with some delay | <p>I have 2 jobs in Jenkins: QA and Dev.
In Dev job I checked "Build after other projects are built" option and set project name = QA so that QA job will be built after Dev job is built.
But in my particular situation I need that QA job started building in 5 mins after Dev job is built. How can I do it? maybe I can a... | 17,750,344 | 4 | 2 | null | 2013-07-19 14:43:54.933 UTC | 6 | 2019-11-25 07:16:08.373 UTC | 2013-07-19 15:03:52.303 UTC | null | 2,205,225 | null | 2,205,225 | null | 1 | 31 | jenkins | 46,857 | <p>There is a <a href="http://jenkins-ci.org/content/quiet-period-feature">"Quiet Period"</a> option in the Advanced Project Options available. You can enter a value of 300 (its in seconds) to delay the start of the job by 5 mins.</p> |
23,445,936 | Numpy random choice of tuples | <p>I'm having trouble to create an array of random choices, where a choice is a tuple. </p>
<p>I get the error: <code>a must be 1-dimensional</code></p>
<p>Here is an example:</p>
<pre><code>choices = ((0,0,0),(255,255,255))
numpy.random.choice(choices,4)
</code></pre>
<p>Is there any other way to do this?</p>
<p>... | 23,446,047 | 3 | 2 | null | 2014-05-03 14:49:54.56 UTC | 1 | 2019-03-05 13:13:20.477 UTC | 2014-05-03 15:07:56.197 UTC | null | 2,096,752 | null | 673,760 | null | 1 | 34 | python|numpy|random | 18,862 | <p>Use <code>choice</code> to choose the 1dim <em>indices</em> into the array, then index it.</p>
<p>In the example you provided, only the <strong>number</strong> of possible choices affects the nature of the choice, not the actual values (0, 255). Choosing indices is the 1dim problem <code>choice</code> knows how to ... |
23,279,208 | Calculate d from n, e, p, q in RSA? | <p>Not sure if this is the correct place to ask a cryptography question, but here goes.</p>
<p>I am trying to work out "d" in RSA, I have worked out p, q, e, n and ø(n);</p>
<pre><code>p = 79, q = 113, e = 2621
n = pq ø(n) = (p-1)(q-1)
n = 79 x 113 = 8927 ø(n) = 78 x 112 = 8736
e = 2621
d = ?... | 23,281,286 | 3 | 3 | null | 2014-04-24 20:33:27.197 UTC | 2 | 2022-06-08 21:34:37.33 UTC | 2019-09-24 00:28:56.34 UTC | null | 608,639 | null | 3,423,572 | null | 1 | 16 | encryption|cryptography|rsa|public-key-encryption | 40,746 | <p>You are looking for the modular inverse of <em>e</em> (mod <em>n</em>), which can be computed using the extended Euclidean algorithm:</p>
<pre><code>function inverse(x, m)
a, b, u := 0, m, 1
while x > 0
q := b // x # integer division
x, a, b, u := b % x, u, x, a - q * u
if b == 1 retu... |
1,400,198 | Is there a way to restrict access to an ASMX Webservice, i.e. the asmx page and its WSDL? | <p>I have a C# .net webservice that I need to restrict access to. I already require my consumers to use a username and password to call the service. But, is there a way to restrict access to the actual asmx page and the WSDL? I would need to restrict access to the webservice by username/password and IP address. If ... | 1,621,108 | 6 | 0 | null | 2009-09-09 14:48:07.477 UTC | 16 | 2016-07-07 14:40:06.743 UTC | 2009-10-21 20:34:58.71 UTC | null | 76,337 | null | 47,191 | null | 1 | 16 | web-services|security|iis|asmx | 25,170 | <p>Well, since it's ASMX you have the entire ASP.NET runtime stack at your disposal.</p>
<h2>Step #1 - managing the resource through .config</h2>
<p>Apply a <code><location></code> tag for the resources you want secured. Assuming it's a single ASMX file you can simply do the following in your web.config:</p>
<... |
2,102,251 | trapping a MySql warning | <p>In my python script I would like to trap a "Data truncated for column 'xxx'" warning durnig my query using MySql.</p>
<p>I saw some posts suggesting the code below, but it doesn' work.</p>
<p>Do you know if some specific module must be imported or if some option/flag should be called before using this code?</p>
<... | 2,102,315 | 7 | 0 | null | 2010-01-20 14:59:39.597 UTC | 16 | 2016-03-28 21:24:04.397 UTC | null | null | null | null | 245,416 | null | 1 | 37 | python|mysql | 23,765 | <p>Warnings are just that: warnings. They get reported to (usually) stderr, but nothing else is done. You can't catch them like exceptions because they aren't being raised.</p>
<p>You can, however, configure what to <em>do</em> with warnings, and turn them off or turn them into exceptions, using the <code>warnings</co... |
1,578,169 | How can I read XMP data from a JPG with PHP? | <p>PHP has built in support for reading EXIF and IPTC metadata, but I can't find any way to read XMP?</p> | 1,578,326 | 9 | 0 | null | 2009-10-16 13:50:40.66 UTC | 16 | 2021-08-23 10:37:33.54 UTC | 2009-10-16 14:04:49.023 UTC | null | 18,333 | null | 18,333 | null | 1 | 15 | php|metadata|jpeg|xmp | 28,029 | <p>XMP data is literally embedded into the image file so can extract it with PHP's string-functions from the image file itself.</p>
<p>The following demonstrates this procedure (I'm using <a href="http://php.net/manual/book.simplexml.php" rel="noreferrer">SimpleXML</a> but every other XML API or even simple and clever... |
1,503,100 | Get latitude/longitude from address | <p>How can I get latitude and longitude from a full address (street, city, etc.) input by the user, using the iPhone SDK 3.x?</p> | 3,005,652 | 9 | 0 | null | 2009-10-01 10:19:30.01 UTC | 23 | 2019-06-04 16:06:07.22 UTC | 2011-10-22 21:24:14.033 UTC | null | 603,977 | null | 182,416 | null | 1 | 17 | ios|maps|geocoding | 35,555 | <p>Here's an updated, more compact, version of unforgiven's code, which uses the latest v3 API:</p>
<pre><code>- (CLLocationCoordinate2D) geoCodeUsingAddress:(NSString *)address
{
double latitude = 0, longitude = 0;
NSString *esc_addr = [address stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];... |
1,899,772 | Most robust method for showing Icon next to text | <p>There are different ways to show graphics in a page next to text.
I need to include a graphic/icon that indicates a new tab will be opened.</p>
<p>I know it's possible to do using at least these different methods:</p>
<ul>
<li>Unicode character from default fonts</li>
<li>Unicode character from CSS loaded fonts</li>... | 1,899,886 | 17 | 2 | null | 2009-12-14 09:00:36.73 UTC | 25 | 2022-01-26 00:12:46.29 UTC | 2022-01-26 00:12:46.29 UTC | null | 86,375 | null | 156,446 | null | 1 | 106 | svg|unicode|png|href | 79,758 | <p>There's no such a thing as an established standard icon.</p>
<p>For example, the icon you chose is similar to the one used in wikipedia to mark links pointing to external websites (not belonging to wikipedia). You may however use it across your websites, and thus establish a convention within your own pages. Just m... |
33,822,121 | React-Native run-android command issue | <p>When starting android project with React-Native it is giving this error:</p>
<blockquote>
<p>React-Native Command run-android unrecognized.Did you mean to run this inside a react-native project?</p>
</blockquote> | 35,648,026 | 11 | 4 | null | 2015-11-20 08:31:22.087 UTC | 5 | 2022-04-07 11:50:52.47 UTC | 2015-11-20 09:37:29 UTC | null | 909,742 | null | 5,582,285 | null | 1 | 11 | android|react-native | 54,071 | <p>You can try to do <code>npm install</code> before <code>react-native run-android</code></p> |
46,272,309 | Upload multiple images to firebase storage | <p>i build a chat application using firebase and i want to send multiple image to firebase storage.</p>
<p>using this library</p>
<p>compile 'com.github.darsh2:MultipleImageSelect:3474549'</p>
<p>At the top</p>
<pre><code>private StorageReference storageRef;
private FirebaseApp app;
private FirebaseStorage storage;... | 46,292,224 | 4 | 4 | null | 2017-09-18 05:44:44.877 UTC | 10 | 2022-07-21 11:31:51.067 UTC | 2019-02-08 04:57:03.677 UTC | null | 7,772,630 | null | 7,772,630 | null | 1 | 5 | android|firebase|firebase-storage | 24,500 | <p>It is working fine.</p>
<pre><code> if (requestCode == Constants.REQUEST_CODE && resultCode == RESULT_OK) {
ArrayList<Image> images = data.getParcelableArrayListExtra(Constants.INTENT_EXTRA_IMAGES);
Uri[] uri=new Uri[images.size()];
for (int i =0 ; i < images.size(); i++) {
... |
18,021,082 | Could not connect to the database Network error IOException: Connection refused: connect | <p>I am running a SQL Server Express 10.50.4000.0 on my machine.
I have enabled on the TCP/IP and made sure the port is set to 1433.
I have added an exception in my firewall for 1433.
The server service is running.
I have tried localhost and the computer name and both give the same error.
When i try localhost\SQLEXPRE... | 18,025,689 | 5 | 6 | null | 2013-08-02 15:44:20.697 UTC | 1 | 2021-12-16 12:44:37.71 UTC | 2013-08-02 16:47:18.763 UTC | null | 2,646,440 | null | 2,646,440 | null | 1 | 7 | java|sql-server | 67,700 | <p>Your connection string needs to be in this format. Found here: <a href="http://msdn.microsoft.com/en-us/library/ms378428(v=sql.110).aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/ms378428(v=sql.110).aspx</a></p>
<pre><code>jdbc:jtds:sqlserver://<yourDBServerIPAddress>\SQLEXPRESS:1433;database... |
17,785,592 | Difference between JSON.stringify and JSON.parse | <p>I have been confused over when to use these two parsing methods.</p>
<p>After I echo my json_encoded data and retrieve it back via ajax, I often run into confusion about when I should use <strong>JSON.stringify</strong> and <strong>JSON.parse</strong>.</p>
<p>I get <code>[object,object]</code> in my <em>console.lo... | 17,785,623 | 18 | 1 | null | 2013-07-22 10:47:48.023 UTC | 200 | 2022-06-09 04:57:03.563 UTC | 2016-01-04 21:02:27.967 UTC | null | 403,404 | null | 2,463,734 | null | 1 | 482 | javascript|json | 507,219 | <p><code>JSON.stringify</code> turns a JavaScript object into JSON text and stores that JSON text in a string, eg:</p>
<pre><code>var my_object = { key_1: "some text", key_2: true, key_3: 5 };
var object_as_string = JSON.stringify(my_object);
// "{"key_1":"some text","key_2":true,"key_3":5}"
typeof(object_as_str... |
17,975,120 | Access Denied for User 'root'@'localhost' (using password: YES) - No Privileges? | <p>I am continuously receiving this error.</p>
<p>I am using mySQL Workbench and from what I am finding is that root's schema privileges are null. There are no privileges at all.</p>
<p>I am having troubles across platforms that my server is used for and this has been all of a sudden issue.</p>
<p><strong>root@127.0... | 17,976,151 | 26 | 8 | null | 2013-07-31 15:54:05.287 UTC | 64 | 2022-07-20 06:04:16.06 UTC | 2019-07-23 09:40:57.04 UTC | null | 306,028 | null | 2,585,340 | null | 1 | 194 | mysql|root|mysql-workbench|workbench | 1,181,434 | <p>Use <a href="http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html" rel="noreferrer">the instructions for resetting the root password</a> - but instead of resetting the root password, we'll going to forcefully INSERT a record into the mysql.user table </p>
<p>In the init file, use this instead</p>
<pre... |
6,584,100 | How do I get a TextBox to fill a resizable column? | <p>I'm trying to get a TextBox to fill the available space in a resizable column. The TextBox is part of a user control:</p>
<pre><code><UserControl x:Class="TextBoxLayout.FieldControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&g... | 6,584,370 | 3 | 1 | null | 2011-07-05 14:13:35.743 UTC | 5 | 2018-11-26 11:22:36.54 UTC | null | null | null | null | 181,622 | null | 1 | 22 | wpf|textbox|stretch|splitter | 48,921 | <p>Use HorizontalAlignment="Stretch" instead of "Left" for FieldControl. Remove MaxWidth if required. Use TextAlignment to align text.</p> |
35,895,730 | Spring boot devtools - Static content reloading does not work in IntelliJ | <p>When building my first Spring Boot app, I discovered that I need to restart my app every time I make a change to a Javascript file in /resources/static/some-file.js</p>
<p>This is very time consuming.</p>
<p>When I move the files to the /webapps/ folder, it works as expected, but the files are not packaged in a JA... | 35,895,848 | 7 | 5 | null | 2016-03-09 15:25:41.017 UTC | 24 | 2022-01-09 11:07:48.003 UTC | 2016-03-09 16:30:43.763 UTC | null | 672,859 | null | 495,815 | null | 1 | 30 | java|spring|intellij-idea|spring-boot | 27,536 | <p>You need to turn on a couple of features in IntelliJ to make this work.</p>
<p>First, there's a project specific setting which you would need to apply on any project you want to use devtools in. Go to Preferences > Compiler and enable "Make project automatically."</p>
<p>The next setting is an IDEA registry setti... |
23,693,562 | How to copy all of the files from one directory to another in a bash script | <p>I want to copy all of the files from a subdirectory into another directory without copying the original folder. In a terminal I would just do this:</p>
<pre><code>cp -r dir1/* dir2
</code></pre>
<p>and then dir2 will contain all of the files from dir1 without containing dir1 itself. I am trying to replicate this... | 23,693,721 | 2 | 3 | null | 2014-05-16 06:00:29.75 UTC | null | 2014-05-16 17:36:49.847 UTC | null | null | null | null | 3,361,761 | null | 1 | 13 | linux|bash | 61,052 | <p>Expanding on devnull's comment:</p>
<ul>
<li><p>Quotes of <em>any kind</em> around a wildcard, like <code>*</code>, will prevent the shell from expanding the wildcard. Thus, you should only write <code>"/*"</code> if you want a slash followed by a literal star.</p></li>
<li><p>An unquoted variable will be subject ... |
23,598,748 | Error while creating bean: Instantiation of bean failed; nested exception is java.lang.ExceptionInInitializerError | <p>I am facing the following error when I try to create bean using Application Context for the circle class! Circle class implements the <code>Shape</code> interface which contains a method <code>draw()</code>.</p>
<p><strong>Configuration:</strong></p>
<p>I am learning spring and have setup a Java Project in eclipse... | 23,634,282 | 1 | 3 | null | 2014-05-11 22:45:34.077 UTC | 2 | 2014-05-13 18:18:02.69 UTC | 2014-05-13 18:18:02.69 UTC | null | 3,626,602 | null | 3,626,602 | null | 1 | 3 | java|spring | 53,204 | <p>The problem occurs because </p>
<pre><code>PropertyEditorRegistrySupport.class.getClassLoader()
</code></pre>
<p>is <code>null</code>. According to JavaDoc, this happens if the class <code>PropertyEditorRegistrySupport</code> has been loaded by the bootstrap class loader instead of the system class loader:</p>
<b... |
15,520,404 | How to call a powershell function within the script from Start-Job? | <p>I saw <a href="https://stackoverflow.com/questions/7162090/how-do-i-start-a-job-of-a-function-i-just-defined">this question</a> and <a href="https://stackoverflow.com/questions/12293701/function-not-recognized-in-start-job">this question</a> but couldn't find solution to my problem.</p>
<p>So here is the situation:... | 15,520,715 | 3 | 0 | null | 2013-03-20 10:02:09.18 UTC | 1 | 2019-07-12 17:06:19.58 UTC | 2017-05-23 11:54:24.817 UTC | null | -1 | null | 1,095,246 | null | 1 | 11 | powershell|start-job | 70,917 | <p>Background jobs are run in a seperate process, so the jobs you create with <code>Start-Job</code> can not interact with functions unless you include them in the <code>$scriptblock</code>.</p>
<p>Even if you included the function in the <code>$scripblock</code>, <code>Write-Host</code> would not output it's content ... |
19,013,725 | Linux Mint - adding environment variables permanently | <p>I was trying to modify the ~/.profile file to add a line to the PATH variable. I added this line:</p>
<pre><code>PATH=$PATH:/home/paul/avatar-gf-1.0-ea/glassfish4/bin/
</code></pre>
<p>at the end. I restarted the terminal, but it still did not identify commands in that directory. Does anyone know what I am doing w... | 19,013,849 | 5 | 2 | null | 2013-09-25 19:38:13.063 UTC | 6 | 2020-06-04 18:20:37.063 UTC | null | null | null | null | 7,385,447 | null | 1 | 16 | linux|bash|environment-variables|linux-mint | 50,646 | <p>Try this in the ~/.pam_environment in your home folder. If it does not exist then create it:</p>
<pre><code>PATH DEFAULT=${PATH}:/home/paul/avatar-gf-1.0-ea/glassfish4/bin/
</code></pre>
<p>You will need to log in and out.</p> |
40,303,182 | Why don't C++ compilers optimize this conditional boolean assignment as an unconditional assignment? | <p>Consider the following function:</p>
<pre><code>void func(bool& flag)
{
if(!flag) flag=true;
}
</code></pre>
<p>It seems to me that if flag has a valid boolean value, this would be equivalent to unconditional setting it to <code>true</code>, like this:</p>
<pre><code>void func(bool& flag)
{
flag=t... | 40,303,296 | 3 | 3 | null | 2016-10-28 10:29:20.427 UTC | 17 | 2016-10-28 22:20:29.493 UTC | 2016-10-28 22:20:29.493 UTC | null | 1,157,100 | null | 673,852 | null | 1 | 117 | c++|optimization | 7,846 | <p>This may negatively impact the performance of the program due to <a href="https://en.wikipedia.org/wiki/Cache_coherence" rel="nofollow noreferrer">cache coherence</a> considerations. Writing to <code>flag</code> each time <code>func()</code> is called would dirty the containing cache line. This will happen regardles... |
34,365,369 | GoogleService failed to initialize | <p>I am using google Maps in my android application. I have created the key and added necessary permissions in manifest file. But soon I start the application I get this message in debugger:</p>
<blockquote>
<p>GoogleService failed to initialize, status: 10, Missing an expected
resource: 'R.string.google_app_id' f... | 34,388,626 | 11 | 6 | null | 2015-12-18 23:18:18.69 UTC | 36 | 2018-10-05 19:11:05.157 UTC | 2016-01-07 14:40:43.21 UTC | null | 445,131 | null | 623,401 | null | 1 | 113 | android|google-maps|android-mapview|android-maps-v2 | 100,820 | <p>You need to place the configuration file (<code>google-services.json</code>) generated by <a href="https://developers.google.com/mobile/add?platform=android" rel="noreferrer">developer.google.com</a>, as mentioned in the 2nd step of the official docs <a href="https://developers.google.com/identity/sign-in/android/st... |
51,403,071 | Create jre from OpenJDK Windows | <p>We are switching from Oracle JDK/JRE to OpenJDK. Now I found only the JDK but I want to have a JRE as well from OpenJDK. This is for installing our application on the clients without the need of having the full JDK.</p>
<p>Is there a way to create a JRE package from the OpenJDK for Windows X64?</p> | 56,807,371 | 12 | 5 | null | 2018-07-18 13:18:16.99 UTC | 11 | 2022-06-09 06:11:39.6 UTC | 2018-07-18 13:39:42.357 UTC | null | 5,156,999 | null | 2,448,399 | null | 1 | 40 | java | 42,780 | <p>Inspired by the article <a href="https://medium.com/azulsystems/using-jlink-to-build-java-runtimes-for-non-modular-applications-9568c5e70ef4" rel="noreferrer">Using jlink to Build Java Runtimes for non-Modular Applications</a> I used the commands:</p>
<ol>
<li><code>java --list-modules</code> to get a list of all o... |
5,576,901 | sqlplus spooling: How to get rid of first, empty line? | <p>I'm doing the following spooling statement:</p>
<pre><code>SET VERIFY OFF
SET FEEDBACK OFF
SET HEADING OFF
SET TRIMSPOOL ON
SET TERM OFF
SPOOL &pathRelations
START scripts/relations.sql &parent
SPOOL OFF
SET TERM ON
</code></pre>
<p>The <code>scripts/relations.sql</code> file contains a simple <code>select... | 7,719,778 | 2 | 0 | null | 2011-04-07 06:27:36.553 UTC | 4 | 2019-12-26 05:28:22.737 UTC | null | null | null | user321068 | null | null | 1 | 23 | sql|sqlplus|spool|fixed-length-file | 46,091 | <p><code>SET NEWPAGE NONE</code> is the correct answer.</p>
<p><code>SET NEWPAGE 0</code> will cause a page feed, which is not what the OP wants.</p> |
113,427 | How to clear the scrollback in the screen command? | <p>I use the <code>screen</code> command for command-line multitasking in Linux and I set my scrollback buffer length to a very large value. Is there a key combination to clear the buffer for a certain tab when I don't want it sitting there anymore?</p> | 113,473 | 7 | 1 | null | 2008-09-22 06:18:09.163 UTC | 10 | 2022-05-06 11:53:25.137 UTC | 2011-11-09 20:27:13.583 UTC | Harley | 496,830 | Liu Chang | null | null | 1 | 35 | linux|command-line|gnu-screen | 30,763 | <p><a href="http://osdir.com/ml/gnu.screen.user/2006-01/msg00029.html" rel="noreferrer">This thread</a> has the following suggestion:</p>
<blockquote>
<p>In the window whose scrollback you want to delete, set the scrollback to zero, then
return it to its normal value (in your
case, 15000).</p>
<p>If you wan... |
1,038,435 | SQL conditional SELECT | <p>I would like to create a stored procedure with parameters that indicate which fields should be selected.</p>
<p>E.g. I would like to pass two parameters "selectField1" and "selectField2" each as bools.</p>
<p>Then I want something like</p>
<pre><code>SELECT
if (selectField1 = true) Field1 ELSE do not select Fiel... | 1,038,505 | 7 | 0 | null | 2009-06-24 13:41:53.607 UTC | 16 | 2013-05-13 20:58:52.917 UTC | 2009-06-24 13:44:11.59 UTC | null | 122,428 | null | 115,391 | null | 1 | 37 | sql|select|conditional | 149,355 | <p>Sounds like they want the ability to return only allowed fields, which means the number of fields returned also has to be dynamic. This will work with 2 variables. Anything more than that will be getting confusing. </p>
<pre><code>IF (selectField1 = true AND selectField2 = true)
BEGIN
SELECT Field1, Field2
FR... |
383,977 | Viewing more than 10,000 files on a FTP file server? | <p>I've queued up over 10,000 files to be uploaded to a UNIX based FTP server using a freeware (Windows based) FTP client which as far as i can see has finished without error.</p>
<p>Now, when i view the remote directory (using the Windows software) the output is truncated to 10,000 filenames. This ever occurs when i ... | 383,989 | 8 | 2 | null | 2008-12-21 01:26:14.42 UTC | 4 | 2012-09-28 19:49:21.487 UTC | null | null | null | Gary Willoughby | 13,227 | null | 1 | 16 | file|ftp|limit | 42,012 | <p>Please provide more information like specific OS and version. Also please list the names and versions of the ftp clients that you are using when you experience the problem.</p>
<p>A lot of files in a single directory can cause many programs to have problems. I would recommend reducing the number of files in a fol... |
479,923 | Is C# a single dispatch or multiple dispatch language? | <p>I'm trying to understand what single and multiple dispatch are, exactly.</p>
<p>I just read this:<br>
<a href="http://en.wikipedia.org/wiki/Multiple_dispatch" rel="noreferrer">http://en.wikipedia.org/wiki/Multiple_dispatch</a></p>
<p>And from that definition is seems to me that C# and VB.Net are multiple-dispatch,... | 483,649 | 8 | 0 | null | 2009-01-26 14:17:39.843 UTC | 11 | 2020-01-19 08:30:39.623 UTC | 2013-08-18 14:10:28.22 UTC | Dan Dyer | 221,800 | Daniel Magliola | 3,314 | null | 1 | 30 | c#|programming-languages|multiple-dispatch|single-dispatch | 10,701 | <p>OK, I understood the subtle difference where function overloading is different from multiple-dispatch.</p>
<p>Basically, the difference is whether which method to call is chosen at run-time or compile-time. Now, I know everybody's said this, but without a clear example this sounds VERY obvious, given that C# is sta... |
428,634 | Advantages of Cache vs Session | <p>What is the difference between storing a datatable in Session vs Cache? What are the advantages and disadvantages?</p>
<p>So, if it is a simple search page which returns result in a datatable and binds it to a gridview. If user 'a' searches and user 'b' searches, is it better to store it in Session since each user ... | 428,684 | 8 | 4 | null | 2009-01-09 16:06:11.837 UTC | 22 | 2019-10-22 07:55:21.797 UTC | 2015-08-30 17:57:19.307 UTC | Martin Clarke | 1,996,435 | Xaisoft | 33,690 | null | 1 | 72 | c#|asp.net|session|caching|viewstate | 79,581 | <p>One important difference is, that items in the cache can expire (will be removed from cache) after a specified amount of time. Items put into a session will stay there, until the session ends.</p>
<p>ASP.NET can also remove items from cache when the amount of available memory gets small.</p>
<p>Another difference:... |
1,184,997 | Enabling tabs in xcode? Or lessening the pain of not having them? | <p>I am currently using xcode and I find it's lack of tabs quite disturbing.</p>
<p>I currently use command-shift-d to search through all the files, or ctrl-1 to open the history of files that were recently opened.</p>
<p>It works but I find it less effective than just tabbing through the few files i am currently wor... | 5,257,206 | 8 | 2 | null | 2009-07-26 16:49:02.557 UTC | 11 | 2017-01-23 08:51:44.537 UTC | null | null | null | null | 2,011 | null | 1 | 76 | objective-c|xcode|macos|ide | 38,865 | <p>XCode 4 now supports tabs. You can enable by selecting "View / Show Tab Bar" menu.</p> |
292,965 | What is a UUID? | <p>Well, what is one?</p> | 292,989 | 8 | 5 | null | 2008-11-15 19:43:27.53 UTC | 22 | 2020-06-03 18:24:58.667 UTC | 2009-08-12 18:30:08.437 UTC | chakrit | 1,431 | doctor smith | null | null | 1 | 94 | uuid|glossary|acronym | 53,392 | <p>It's an identification number that will uniquely identify something. The idea being that id number will be <em>universally</em> unique. Thus, no two things should have the same uuid. In fact, if you were to generate 10 trillion uuids, there would be something along the lines of a .00000006 chance of two uuids bei... |
588,040 | window.onload vs document.onload | <p>Which is more widely supported: <code>window.onload</code> or <code>document.onload</code>?</p> | 588,048 | 9 | 2 | null | 2009-02-25 21:45:11.487 UTC | 271 | 2021-11-07 21:49:38.013 UTC | 2020-05-11 08:59:59.06 UTC | null | 860,099 | Chris Ballance | 1,551 | null | 1 | 846 | javascript|event-handling|dom-events | 2,300,885 | <h2>When do they fire?</h2>
<p><a href="https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers.onload" rel="noreferrer"><code>window.onload</code></a></p>
<ul>
<li>By default, it is fired when the entire page loads, <strong>including</strong> its content (images, CSS, scripts, etc.).</li>
</ul>
<p>In s... |
337,739 | How to log something in Rails in an independent log file? | <p>In rails I want to log some information in a different log file and not the standard development.log or production.log. I want to do this logging from a model class.</p> | 337,971 | 9 | 0 | null | 2008-12-03 16:24:12.327 UTC | 56 | 2017-05-25 03:00:43.117 UTC | null | null | null | akshat | 29,653 | null | 1 | 165 | ruby-on-rails|logging | 84,504 | <p>You can create a Logger object yourself from inside any model. Just pass the file name to the constructor and use the object like the usual Rails <code>logger</code>:</p>
<pre><code>class User < ActiveRecord::Base
def my_logger
@@my_logger ||= Logger.new("#{Rails.root}/log/my.log")
end
def before_save... |
137,043 | Can emacs re-indent a big blob of HTML for me? | <p>When editing HTML in emacs, is there a way to automatically pretty-format a blob of markup, changing something like this:</p>
<pre><code> <table>
<tr>
<td>blah</td></tr></table>
</code></pre>
<p>...into this:</p>
<pre><code><table>
<tr>
<td>
blah
&l... | 144,938 | 10 | 1 | null | 2008-09-26 00:10:55.923 UTC | 33 | 2016-09-11 21:22:58.187 UTC | 2008-09-26 02:27:06.487 UTC | raldi | 7,598 | raldi | 7,598 | null | 1 | 72 | html|emacs | 32,174 | <p>By default, when you visit a <code>.html</code> file in Emacs (22 or 23), it will put you in <code>html-mode</code>. That is probably not what you want. You probably want <code>nxml-mode</code>, which is seriously fancy. <code>nxml-mode</code> seems to only come with Emacs 23, although you can download it for earl... |
605,920 | Reasons for why a WinForms label does not want to be transparent? | <p>Why can't I set the BackColor of a Label to Transparent? I have done it before, but now it just don't want to...</p>
<p>I created a new UserControl, added a progressbar and a label to it. When I set the BackColor of the label to transparent it is still gray =/ Why is this?</p>
<p>What I wanted was to have the labe... | 605,944 | 11 | 2 | null | 2009-03-03 10:46:54.683 UTC | 9 | 2021-01-12 19:37:34.97 UTC | 2009-10-05 17:32:47.573 UTC | null | 76,337 | Svish | 39,321 | null | 1 | 29 | c#|winforms|transparency | 31,131 | <p>WinForms doesn't really support transparent controls, but you can make a transparent control yourself. <a href="https://stackoverflow.com/questions/373913/setting-the-parent-of-a-usercontrol-prevents-it-from-being-transparent/373961#373961">See my answer here</a>.</p>
<p>In your case you should probably subclass th... |
833,227 | What's the easiest way to get a user's full name on a Linux/POSIX system? | <p>I could grep through /etc/passwd but that seems onerous. 'finger' isn't installed and I'd like to avoid that dependency. This is for a program so it would be nice if there was some command that let you just access user info.</p> | 833,256 | 11 | 0 | null | 2009-05-07 06:55:27.287 UTC | 11 | 2021-10-05 06:50:48.947 UTC | 2011-11-18 16:52:57.62 UTC | null | 70,157 | null | 83,898 | null | 1 | 43 | database|linux|shell|posix|user-accounts | 60,167 | <p>You don't specify a programming language, so I'll assume you want to use the shell; here's <strong>an answer for Posix shells</strong>.</p>
<p>Two steps to this: get the appropriate record, then get the field you want from that record.</p>
<p>First, getting the account record is done by <strong>querying the <code>... |
261,455 | Using backticks around field names | <p>After reading a couple of answers and comments on some SQL questions here, and also hearing that a friend of mine works at a place which has a policy which bans them, I'm wondering if there's anything wrong with using backticks around field names in MySQL.</p>
<p>That is:</p>
<pre><code>SELECT `id`, `name`, `anoth... | 261,476 | 11 | 4 | null | 2008-11-04 10:30:20.077 UTC | 48 | 2019-01-24 17:17:48.073 UTC | 2017-01-06 14:02:14.013 UTC | null | 2,360,798 | nickf | 9,021 | null | 1 | 181 | mysql|backticks | 104,038 | <p>Using backticks permits you to use alternative characters. In query writing it's not such a problem, but if one assumes you can just use backticks, I would assume it lets you get away with ridiculous stuff like</p>
<pre><code>SELECT `id`, `my name`, `another field` , `field,with,comma`
</code></pre>
<p>Which does... |
651,702 | String.Replace(char, char) method in C# | <p>How do I replace <code>\n</code> with empty space?</p>
<p>I get an empty literal error if I do this:</p>
<pre><code>string temp = mystring.Replace('\n', '');
</code></pre> | 651,723 | 12 | 2 | null | 2009-03-16 18:56:49.433 UTC | null | 2015-12-01 16:04:38.01 UTC | 2015-11-25 15:34:07.237 UTC | null | 63,550 | gnomixa | 57,997 | null | 1 | 72 | c#|string | 133,134 | <p><code>String.Replace('\n', '')</code> doesn't work because <code>''</code> is not a valid character literal.</p>
<p>If you use the String.Replace(string, string) override, it should work.</p>
<pre><code>string temp = mystring.Replace("\n", "");
</code></pre> |
234,365 | Is TCHAR still relevant? | <p>I'm new to Windows programming and after reading the Petzold book I wonder: </p>
<p>is it still good practice to use the <code>TCHAR</code> type and the <code>_T()</code> function to declare strings or if I should just use the <code>wchar_t</code> and <code>L""</code> strings in new code?</p>
<p>I will target only... | 234,505 | 12 | 0 | null | 2008-10-24 16:55:50.77 UTC | 25 | 2020-05-07 21:18:23.413 UTC | 2010-03-07 13:37:26.933 UTC | null | 63,550 | Fábio | 9,458 | null | 1 | 88 | c++|c|windows|unicode|wchar-t | 42,798 | <p>I would still use the TCHAR syntax if I was doing a new project today. There's not much practical difference between using it and the WCHAR syntax, and I prefer code which is explicit in what the character type is. Since most API functions and helper objects take/use TCHAR types (e.g.: CString), it just makes sense ... |
203,844 | jQuery Validation plugin: disable validation for specified submit buttons | <p>I have a form with multiple fields that I'm validating (some with methods added for custom validation) with Jörn Zaeffere's excellent jQuery Validation plugin. How do you circumvent validation with specified submit controls (in other words, fire validation with some submit inputs, but do not fire validation with oth... | 203,989 | 12 | 1 | null | 2008-10-15 06:14:55.76 UTC | 45 | 2020-07-21 08:58:50.017 UTC | 2016-05-03 22:57:34.587 UTC | ovalsquare | 594,235 | ovalsquare | 9,344 | null | 1 | 171 | jquery|jquery-validate | 181,623 | <p>You can add a CSS class of <code>cancel</code> to a submit button to suppress the validation</p>
<p>e.g</p>
<pre><code><input class="cancel" type="submit" value="Save" />
</code></pre>
<p>See the jQuery Validator documentation of this feature here: <a href="https://jqueryvalidation.org/reference#link-skippi... |
1,007,481 | How to replace whitespaces with underscore? | <p>I want to replace whitespace with underscore in a string to create nice URLs. So that for example:</p>
<pre><code>"This should be connected"
</code></pre>
<p>Should become</p>
<pre><code>"This_should_be_connected"
</code></pre>
<p>I am using Python with Django. Can this be solved using regular ... | 1,007,499 | 14 | 1 | null | 2009-06-17 14:41:36.94 UTC | 54 | 2021-11-28 09:07:40.967 UTC | 2021-11-28 09:07:40.967 UTC | null | 6,045,800 | null | 74,660 | null | 1 | 285 | python|string | 452,700 | <p>You don't need regular expressions. Python has a built-in string method that does what you need:</p>
<pre><code>mystring.replace(" ", "_")
</code></pre> |
3,452 | SQL Client for Mac OS X that works with MS SQL Server | <p>How can I connect to a remote SQL server using Mac OS X? I don't really need a GUI, but it would be nice to have for the color coding and resultset grid. I'd rather not have to use a VM.</p>
<p>Is there a SQL client for Mac OS X that works with MS SQL Server?</p> | 34,153 | 25 | 11 | 2011-01-21 07:02:48.517 UTC | 2008-08-06 14:25:17.457 UTC | 194 | 2018-11-05 11:44:52.22 UTC | 2016-11-29 16:16:09.797 UTC | Nigel Campbell | 1,676,152 | null | 437 | null | 1 | 481 | sql-server|macos | 688,744 | <p>Let's work together on a canonical answer.</p>
<h3>Native Apps</h3>
<ul>
<li><a href="http://www.macsqlclient.com/" rel="noreferrer">SQLPro for MSSQL</a></li>
<li><a href="http://www.navicat.com/products/navicat-for-sqlserver" rel="noreferrer">Navicat</a></li>
<li><a href="http://www.valentina-db.com/en/valentina-... |
886,955 | How do I break out of nested loops in Java? | <p>I've got a nested loop construct like this:</p>
<pre><code>for (Type type : types) {
for (Type t : types2) {
if (some condition) {
// Do something and break...
break; // Breaks out of the inner loop
}
}
}
</code></pre>
<p>Now how can I break out of both loops? I've... | 886,979 | 36 | 0 | null | 2009-05-20 09:07:43.643 UTC | 436 | 2021-12-06 06:35:30.897 UTC | 2021-12-06 06:35:30.897 UTC | null | 6,444,297 | null | 15,108 | null | 1 | 2,004 | java|loops|nested-loops | 1,331,657 | <p>Like other answerers, I'd definitely <em>prefer</em> to put the loops in a different method, at which point you can just return to stop iterating completely. This answer just shows how the requirements in the question can be met.</p>
<p>You can use <code>break</code> with a label for the outer loop. For example:</p... |
450,799 | Shell command to sum integers, one per line? | <p>I am looking for a command that will accept (as input) multiple lines of text, each line containing a single integer, and output the sum of these integers.</p>
<p>As a bit of background, I have a log file which includes timing measurements. Through grepping for the relevant lines and a bit of <code>sed</code> refor... | 450,821 | 45 | 2 | 2013-10-02 18:41:50.33 UTC | 2009-01-16 15:42:03.5 UTC | 286 | 2022-06-23 23:21:44.51 UTC | 2019-11-25 07:57:38.937 UTC | J.F. Sebastian | 4,021,802 | dtsazza | 45,664 | null | 1 | 1,025 | shell | 684,625 | <p>Bit of awk should do it? </p>
<pre><code>awk '{s+=$1} END {print s}' mydatafile
</code></pre>
<p>Note: some versions of awk have some odd behaviours if you are going to be adding anything exceeding 2^31 (2147483647). See comments for more background. One suggestion is to use <code>printf</code> rather than <code>p... |
7,007,032 | What is the difference between static, internal and public constructors? | <p>What is the difference between static, internal and public constructors? Why do we need to create all of them together?</p>
<pre><code> static xyz()
{
}
public xyz()
{
}
internal xyz()
{
}
</code></pre> | 7,007,072 | 5 | 1 | null | 2011-08-10 07:06:57.957 UTC | 2 | 2018-12-07 16:28:19.653 UTC | 2011-08-10 07:15:54.823 UTC | null | 64,976 | null | 865,053 | null | 1 | 28 | c#|static|constructor|access-modifiers | 28,726 | <p>The <code>static</code> constructor will be called the first time an object of the type is instantiated or a static method is called. And will only run once</p>
<p>The <code>public</code> constructor is accessible to all other types</p>
<p>The <code>internal</code> constructor is only accessible to types in the sa... |
6,751,463 | Iterate over lines in a file in parallel (Scala)? | <p>I know about the parallel collections in Scala. They are handy! However, I would like to iterate over the lines of a file that is too large for memory in parallel. I could create threads and set up a lock over a Scanner, for example, but it would be great if I could run code such as:</p>
<pre><code>Source.fromFi... | 6,753,544 | 5 | 4 | null | 2011-07-19 17:34:06.44 UTC | 16 | 2017-06-09 10:36:48.27 UTC | null | null | null | null | 568,393 | null | 1 | 35 | scala|concurrency|parallel-processing | 8,444 | <p>You could use grouping to easily slice the iterator into chunks you can load into memory and then process in parallel.</p>
<pre><code>val chunkSize = 128 * 1024
val iterator = Source.fromFile(path).getLines.grouped(chunkSize)
iterator.foreach { lines =>
lines.par.foreach { line => process(line) }
}
</cod... |
6,715,095 | How to SUM and SUBTRACT using SQL? | <p>I am using MySQL and I have two tables:</p>
<p><code>master_table</code></p>
<ul>
<li>ORDERNO </li>
<li>ITEM</li>
<li>QTY</li>
</ul>
<p><code>stock_bal</code> </p>
<ul>
<li>ITEM </li>
<li>BAL_QTY</li>
</ul>
<p>Master table has duplicate <code>ORDERNO</code> and <code>ITEM</code> values. I have get total <code>Q... | 6,715,121 | 6 | 0 | null | 2011-07-16 03:23:56.997 UTC | 10 | 2020-01-16 17:21:31.07 UTC | 2012-10-22 14:37:21.733 UTC | null | 489,560 | null | 847,415 | null | 1 | 42 | mysql|sql|aggregate-functions | 498,115 | <p>I think this is what you're looking for. <code>NEW_BAL</code> is the sum of <code>QTY</code>s subtracted from the balance:</p>
<pre><code>SELECT master_table.ORDERNO,
master_table.ITEM,
SUM(master_table.QTY),
stock_bal.BAL_QTY,
(stock_bal.BAL_QTY - SUM(master_table.QTY)) AS NEW... |
6,825,713 | HTML5: W3C vs WHATWG. Which gives the most authoritative spec? | <p>I'm in halfway trough an html parser and found html5 defined <strong>explicitly</strong> the rules of thumb for parsing <em>ill formed html</em>. <em>(And I used to infer them from DTDs, sigh)</em></p>
<p>I love that fact, but I know well that html5 isn't finalized yet (also I wonder if it ever will) and that it is... | 6,826,506 | 6 | 3 | null | 2011-07-26 05:38:48.223 UTC | 19 | 2022-05-04 16:12:50.337 UTC | 2014-10-30 01:46:24.45 UTC | null | 169,922 | null | 169,922 | null | 1 | 68 | html|html-parsing|w3c | 14,974 | <p>It depends on who you ask. Really. The politics of this are ugly. And to make matters worse, the specifications aren't fully stable yet. I would have thought that the two specifications would be largely the same in their parsing sections since <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/intr... |
6,697,147 | JSON - Iterate through JSONArray | <p>I have a JSON file with some arrays in it. I want to iterate through the file arrays and get their elements and their values.</p>
<p><strong>This is how my file looks like:</strong></p>
<pre><code>{
"JObjects": {
"JArray1": [
{
"A": "a",
&qu... | 6,697,385 | 6 | 2 | null | 2011-07-14 17:01:29.943 UTC | 27 | 2021-09-06 13:19:20.817 UTC | 2021-08-12 16:59:08.333 UTC | null | 12,363,493 | null | 776,679 | null | 1 | 79 | java|json | 370,205 | <p>Change</p>
<pre><code>JSONObject objects = getArray.getJSONArray(i);
</code></pre>
<p>to</p>
<pre><code>JSONObject objects = getArray.getJSONObject(i);
</code></pre>
<p>or to</p>
<pre><code>JSONObject objects = getArray.optJSONObject(i);
</code></pre>
<p>depending on which JSON-to/from-Java library you're usin... |
42,203,169 | How to implement XUnit descriptive Assert message? | <p><strong>Context</strong></p>
<p>in XUnit github I found this: <a href="https://github.com/xunit/xunit/issues/350" rel="noreferrer">Add Assert.Equal(expected, actual, message) overload #350</a> <em>(so a developer ask for a non existing overload see below)</em></p>
<p>Quote from the answer:</p>
<blockquote>
<p>W... | 42,204,780 | 4 | 7 | null | 2017-02-13 11:39:19.387 UTC | 7 | 2022-09-17 11:15:59.493 UTC | 2017-02-13 13:12:42.48 UTC | null | 5,233,410 | null | 1,157,814 | null | 1 | 56 | c#|unit-testing|xunit|assertions|xunit2 | 37,373 | <p>Use the suggestions provided at the link. Like <a href="http://www.fluentassertions.com/" rel="noreferrer">fluent assertions</a> or create your own assertion that wraps the <code>Assert.True or Assert.False</code> which were left with their message overloads.
It was mentioned further down </p>
<p><a href="https://... |
38,202,039 | JSON properties now lower case on swap from ASP .Net Core 1.0.0-rc2-final to 1.0.0 | <p>I've just swapped our project from ASP .Net Core 1.0.0-rc2-final to 1.0.0. Our website and client have stopped working because of the capitalization of JSON properties. For example, this line of JavaScript now fails </p>
<pre><code>for (var i = 0; i < collection.Items.length; i++){
</code></pre>
<p>because the ... | 38,202,543 | 8 | 2 | null | 2016-07-05 11:15:00.3 UTC | 14 | 2020-12-03 09:36:22.643 UTC | 2020-01-14 20:26:37.703 UTC | null | 70,345 | null | 575,530 | null | 1 | 124 | c#|asp.net-core|asp.net-core-1.0 | 63,779 | <p>MVC now serializes JSON with camel case names by default</p>
<p>Use this code to avoid camel case names by default</p>
<pre><code> services.AddMvc()
.AddJsonOptions(options => options.SerializerSettings.ContractResolver = new DefaultContractResolver());
</code></pre>
<p>Source:
<a href="https://github... |
15,932,492 | iPad - Parsing an extremely huge json - File (between 50 and 100 mb) | <p>I'm trying to parse an extremely big json-File on an iPad. The filesize will vary between 50 and 100 mb (there is an initial file and there will be one new full set of data every month, which will be downloaded, parsed and saved into coredata)</p>
<p>I'm building this app for a company as an Enterprise solution - t... | 15,932,917 | 2 | 7 | null | 2013-04-10 17:26:34.213 UTC | 10 | 2014-12-08 21:00:50.053 UTC | null | null | null | null | 2,139,309 | null | 1 | 16 | ios|json|ipad|core-data|bigdata | 9,406 | <p>1) Write your data to a file, then use NSData's <strong>dataWithContentsOfFile:options:error:</strong> and specify the <strong>NSDataReadingMappedAlways</strong> and <strong>NSDataReadingUncached</strong> flags. This will tell the system to use mmap() to reduce the memory footprint, and not to burden the file system... |
15,926,005 | How make JUnit print assertion results | <p>How can I get the results of my JUnit assertions to be printed [to standard output]?</p>
<p>I have some tests like this:</p>
<pre><code>@Test
public void test01()
{
Position p = getPositionAt('a', 1);
assertNotNull("a1 exists", p);
assertNotNull("figure exists a1", p.getFigure());
... | 15,926,172 | 4 | 4 | null | 2013-04-10 12:35:05.663 UTC | 9 | 2020-06-29 00:31:03.337 UTC | 2020-06-29 00:18:58.49 UTC | null | 1,357,094 | null | 1,763,888 | null | 1 | 35 | java|testing|junit|junit4 | 85,363 | <p>First, you have two issues not one. When an assertion fails, an <code>AssertionError</code> exception is thrown. This prevents any assertion past this point from being checked. To address this you need to use an <a href="http://junit-team.github.io/junit/javadoc/latest/org/junit/rules/ErrorCollector.html" rel="nofol... |
15,953,895 | Splitting Declaration and Assignment = Good Practice? | <p>Being an avid user of NetBeans, I keep getting suggestions to split my variable declarations and assignments when I introduce a new variable. As a super quick example off the top of my head, let's take this Java line:</p>
<pre><code>String someInput = JOptionPane.showInputDialog(null, "- Enter something: ");
</cod... | 15,953,960 | 6 | 12 | null | 2013-04-11 16:18:09.323 UTC | 7 | 2014-11-23 20:03:55.387 UTC | null | null | null | null | 2,128,915 | null | 1 | 36 | java|variables|variable-assignment|declaration | 21,084 | <p>There's no reason to split the declaration and the assignment if you're just going to have them on consecutive lines. I'd only split them if the assignment were conditional, or if it needed to go in a separate code block (like a try/catch, or if the assignment goes in a constructor, etc.).</p> |
15,767,685 | Understanding Heroku server status 143 | <p>I'm wondering about Heroku server status and can't find any documentation about this topic.</p>
<p>Example: </p>
<pre><code>Process exited with status 143
</code></pre>
<p>Can anyone explain this example? And where would I find resources for future reference?</p> | 15,773,335 | 7 | 0 | null | 2013-04-02 15:11:01.093 UTC | 14 | 2022-08-12 06:56:11.29 UTC | 2015-07-03 16:39:51.59 UTC | null | 949,598 | null | 2,213,842 | null | 1 | 106 | heroku|deployment|server-side | 78,718 | <p>Exit code 143 means that your process was terminated by a SIGTERM. This is generally sent when you do any commands that require your dynos to restart (config:set, restart, scale down...). </p> |
10,366,374 | What is the 'pythonic' equivalent to the 'fold' function from functional programming? | <p>What is the most idiomatic way to achieve something like the following, in Haskell:</p>
<pre><code>foldl (+) 0 [1,2,3,4,5]
--> 15
</code></pre>
<p>Or its equivalent in Ruby:</p>
<pre><code>[1,2,3,4,5].inject(0) {|m,x| m + x}
#> 15
</code></pre>
<p>Obviously, Python provides the <code>reduce</code> function... | 10,366,417 | 8 | 6 | null | 2012-04-28 18:30:48.82 UTC | 22 | 2019-09-21 00:30:14.223 UTC | 2012-04-28 18:44:17.063 UTC | null | 1,219,006 | null | 413,744 | null | 1 | 164 | python|list|functional-programming|reduce|fold | 130,245 | <p>The Pythonic way of summing an array is using <a href="https://docs.python.org/3/library/functions.html#sum" rel="noreferrer"><code>sum</code></a>. For other purposes, you can sometimes use some combination of <a href="https://docs.python.org/3/library/functools.html#functools.reduce" rel="noreferrer"><code>reduce</... |
33,446,347 | No module named 'pymysql' | <p>I'm trying to use PyMySQL on Ubuntu.</p>
<p>I've installed <code>pymysql</code> using both <code>pip</code> and <code>pip3</code> but every time I use <code>import pymysql</code>, it returns <code>ImportError: No module named 'pymysql'</code></p>
<p>I'm using Ubuntu 15.10 64-bit and Python 3.5.</p>
<p>The same .p... | 33,446,502 | 20 | 7 | null | 2015-10-30 23:34:19.49 UTC | 7 | 2022-09-19 02:45:07.36 UTC | 2015-10-31 00:42:15.713 UTC | null | 530,873 | null | 4,621,575 | null | 1 | 69 | python|python-3.x|ubuntu|pymysql | 210,243 | <p>Sort of already answered this in the comments, but just so this question has an answer, the problem was resolved through running:</p>
<pre><code>sudo apt-get install python3-pymysql
</code></pre> |
40,794,471 | ffmpeg throwing "Output file #0 does not contain any stream" when trying to make a slideshow out of images | <p>Im trying to create video streaming using phantomjs that create screenshots from a url then it will pipe the frames to ffmpeg so he can use it to stream the video to an rtmp url .
here is what i tried so far :</p>
<pre><code>phantomjs runner.js | ffmpeg -f image2pipe -vcodec png -c:a copy -c:v libx264 -f flv rtmp... | 40,801,706 | 1 | 8 | null | 2016-11-24 21:05:10.58 UTC | 3 | 2020-07-27 04:24:36.227 UTC | 2016-11-25 09:20:26.767 UTC | null | 187,606 | null | 2,233,585 | null | 1 | 28 | ffmpeg|phantomjs|video-streaming|rtmp | 79,061 | <p>Your present command doesn't specify any input, so use</p>
<pre><code>phantomjs runner.js | ffmpeg -f image2pipe -i pipe:.png -c:a copy -c:v libx264 -f flv rtmp://localhost/mystream
</code></pre>
<p>There's no audio input, so setting an audio codec is pointless. If your output needs an audio stream, use</p>
<pre... |
22,741,183 | Sqoop: Could not load mysql driver exception | <p>I Installed Sqoop in my local machine. Following are the config information.</p>
<p>Bash.bashrc:</p>
<pre><code>export HADOOP_HOME=/home/hduser/hadoop
export HBASE_HOME=/home/hduser/hbase
export HIVE_HOME=/home/hduser/hive
export HCAT_HOME=/home/hduser/hive/hcatalog
export SQOOP_HOME=/home/hduser/sqoop
export PAT... | 22,753,480 | 7 | 2 | null | 2014-03-30 06:53:47 UTC | 1 | 2019-03-28 12:07:15.33 UTC | 2014-03-30 07:03:29.093 UTC | null | 13,302 | null | 2,404,193 | null | 1 | 5 | mysql|hadoop|hive|sqoop | 38,809 | <p>You need database driver in 'SQOOP' classpath check <a href="http://sqoop.apache.org/docs/1.4.0-incubating/SqoopUserGuide.html#id1763114" rel="noreferrer">this</a>
It has wonderful explanation about the 'SQOOP'</p>
<p>SQOOP has other options like</p>
<blockquote>
<p>Ex: --driver com.microsoft.jdbc.sqlserver.SQLS... |
22,591,499 | What are the differences between abstract classes and interfaces in Java 8? | <p>In Java there used to be a subtle but important difference between abstract classes and interfaces: <a href="https://stackoverflow.com/questions/1913098/what-is-the-difference-between-an-interface-and-abstract-class">default implementations</a>. Abstract classes could have them, interfaces could not. Java 8 though i... | 22,591,531 | 5 | 3 | null | 2014-03-23 13:25:18.667 UTC | 24 | 2016-11-20 02:45:59.91 UTC | 2017-05-23 12:26:10.503 UTC | null | -1 | null | 1,305,516 | null | 1 | 67 | java|interface|abstract-class|java-8|diamond-problem | 19,644 | <p>Interfaces cannot have state associated with them.</p>
<p>Abstract classes can have state associated with them.</p>
<p>Furthermore, default methods in interfaces need not be implemented. So in this way, it will not break already existing code, as while the interface does receive an update, the implementing class d... |
13,649,872 | Can I make an svg image button? | <p>Is there any way of making a POST request when an svg image is clicked?</p>
<p>My best attempt so far looks like:</p>
<pre><code><form action="/test-button" method="POST">
<input name="Submit" type="submit" value="Submit" />
<svg >
<rect width="100" height="100" >
</svg&g... | 13,650,140 | 6 | 0 | null | 2012-11-30 17:14:16.873 UTC | 7 | 2022-01-05 04:06:50.283 UTC | null | null | null | null | 254,837 | null | 1 | 22 | html|post|button|svg | 45,328 | <p>Warning: This is a little hacky, but as far as I know it's 100% legit, and doesn't need javascript.</p>
<p>Since the <code>label</code> element can also be used to control it's associated input, you could try something like this:</p>
<pre><code><form action="/test-button" method="POST">
<label>
&l... |
13,382,609 | In SQL Server can you find the first number in a string? | <p>I have a varchar(50) sql server column with data like this:</p>
<pre><code>RawData
----------------------------
Washington 40 New Orleans 32
Detroit 27 St. Louis 23
</code></pre>
<p>I'm trying to parse out the data so I have something like this:</p>
<pre><code>WinningTeam WinningTeamScore LosingTeam L... | 13,382,874 | 5 | 2 | null | 2012-11-14 16:11:59.61 UTC | 3 | 2014-11-18 22:46:50.153 UTC | null | null | null | null | 110,701 | null | 1 | 25 | sql-server|string | 106,394 | <p>You can use the PATINDEX function instead of CHARINDEX, <a href="http://msdn.microsoft.com/library/ms188395.aspx">here</a> lies the documentation ;)</p> |
13,538,772 | How to replace space with comma using sed? | <p>I would like to replace the empty space between each and every field with comma delimiter.Could someone let me know how can I do this.I tried the below command but it doesn't work.thanks.</p>
<pre><code>My command:
:%s//,/
53 51097 310780 1
56 260 1925 1
68 51282 278770 1
77 46903 281485 1
82 475 2600 1
84 433 33... | 13,538,795 | 8 | 2 | null | 2012-11-24 06:03:40.107 UTC | 5 | 2019-05-21 19:27:40.437 UTC | 2014-06-24 05:59:58.943 UTC | null | 1,734,130 | null | 1,049,893 | null | 1 | 32 | regex|unix|vim|replace|sed | 152,892 | <p>If you are talking about <code>sed</code>, this works:</p>
<pre><code>sed -e "s/ /,/g" < a.txt
</code></pre>
<p>In <code>vim</code>, use same regex to replace:</p>
<pre><code>s/ /,/g
</code></pre> |
13,595,610 | Gradle nested multi-projects with project compile dependencies | <p>I have an identical problem to this <a href="https://stackoverflow.com/questions/9013597/gradle-multi-module-project-setup">Gradle Multi-Module Project Setup</a> but I have to use project compile dependencies to build and cannot use the library(jar) dependencies solution that was given as a solution in the above que... | 13,598,904 | 1 | 1 | null | 2012-11-28 00:14:47.763 UTC | 6 | 2018-03-22 18:18:19.153 UTC | 2017-05-23 12:17:40.393 UTC | null | -1 | null | 1,017,642 | null | 1 | 35 | build|dependencies|gradle|multi-project | 43,531 | <p>A build can only have a single <code>settings.gradle</code> file. Assuming <code>settings.gradle</code> is in the root directory and includes projects like so:</p>
<pre><code>include "P1:PP1"
</code></pre>
<p>You can add a compile dependency like so:</p>
<pre><code>dependencies {
compile(project(":P1:PP1"))
}... |
13,576,161 | convert openCV image into PIL Image in Python (for use with Zbar library) | <p>I'm trying to use the Zbar library's QR code detection methods on images I extract with OpenCV's camera methods. Normally the QR code detection methods work with images (jpg, png, etc.) on my computer, but I guess the captured frames of OpenCV are different.<br>
Is there a way of making the captured frame into a PIL... | 18,158,998 | 4 | 0 | null | 2012-11-27 01:39:55.483 UTC | 5 | 2019-04-04 17:46:51.59 UTC | null | null | null | null | 1,730,215 | null | 1 | 36 | python|opencv|python-imaging-library|zbar | 51,190 | <p>With the python CV2, you can also do this:</p>
<pre><code>import Image, cv2
cap = cv2.VideoCapture(0) # says we capture an image from a webcam
_,cv2_im = cap.read()
cv2_im = cv2.cvtColor(cv2_im,cv2.COLOR_BGR2RGB)
pil_im = Image.fromarray(cv2_im)
pil_im.show()
</code></pre> |
39,622,173 | Can't run "ssh -X" on MacOS Sierra | <p>I just upgraded to MacOS Sierra, and I realized that I can't seem to run the "ssh -X" command in the Terminal anymore. It used to launch xterm windows, but now it's like I didn't even put the -X option anymore. It was working absolutely fine right before I updated. Other than going from OS X Yosemite to MacOS Sierra... | 39,835,138 | 11 | 5 | null | 2016-09-21 16:44:09.317 UTC | 21 | 2022-04-05 02:11:26.003 UTC | 2016-09-21 18:02:03.953 UTC | null | 5,035,553 | null | 5,035,553 | null | 1 | 42 | ssh|terminal|xterm|macos-sierra | 96,079 | <p>I didn't need to reinstall XQuartz, but, based on Matt Widjaja's answer, I came up with a refinement.</p>
<ul>
<li><code>sudo vi /etc/ssh/ssh_config</code> (This is ssh client config, not sshd_config)
<ul>
<li>Under the <code>Host *</code> entry add (or add where appropriate per-host)
<ul>
<li><strong><code>XAuth... |
24,374,867 | Label and Text differences in JavaFX | <p>What is the difference between javafx.scene.text.Text and javafx.scene.control.Label?</p>
<p>The documentation says: </p>
<ul>
<li>Label is a non-editable text control. </li>
<li>The Text class defines a node that displays a text.</li>
</ul>
<p>But the Label class has a method "setText" and "textProperty", ther... | 24,389,619 | 3 | 2 | null | 2014-06-23 20:35:11.037 UTC | 9 | 2018-07-27 23:15:37.933 UTC | null | null | null | null | 2,452,287 | null | 1 | 64 | java|javafx|fxml | 33,671 | <p>As Harry Blargle pointed out, "non-editable" means "not editable by the user." So both Label and Text are non-editable.</p>
<p>Label and Text have different CSS properties. <a href="http://docs.oracle.com/javase/8/javafx/api/javafx/scene/doc-files/cssref.html#label">Label inherits from Labeled, Control, and Regio... |
3,814,126 | Display AlertDialog as system overlay window from Service | <p>I have issue with displaying AlertDialog from Service. I am able to display custom layout window using Toast or using WindowManager(TYPE_SYSTEM_ALERT or TYPE_SYSTEM_OVERLAY). But, I do not want to use custom layout, I prefer to use nice AlertDialog GUI directly.</p>
<p>Scenario:</p>
<ul>
<li>Running Service. No ac... | 3,912,748 | 2 | 1 | null | 2010-09-28 15:04:14.68 UTC | 13 | 2014-09-22 23:36:24.75 UTC | 2011-09-27 10:26:43.547 UTC | null | 760,489 | null | 423,823 | null | 1 | 15 | android | 17,600 | <p>Solution that matches described scenario has been found.</p>
<ul>
<li><p>New Activity has been created and started from Service. However, it is activity with translucent background. Such activity does not have line <code>super.setContentView()</code> in <code>onCreate()</code>. More important, to ensure transparenc... |
3,698,718 | What are Google Test, Death Tests | <p>I saw the documentation of that feature is seem pretty major since it's in Google Test overview features and detailed in:<br />
<a href="https://github.com/google/googletest/blob/master/docs/advanced.md#death-tests" rel="nofollow noreferrer">https://github.com/google/googletest/blob/master/docs/advanced.md#death-tes... | 3,698,752 | 2 | 0 | null | 2010-09-13 08:07:37.58 UTC | 4 | 2021-01-29 09:56:40.293 UTC | 2021-01-29 09:56:40.293 UTC | null | 5,970,163 | null | 167,897 | null | 1 | 32 | c++|testing|googletest | 34,676 | <p>The assertion is there to confirm that a function would bring about program termination if it were executed in the current process (the details explains that the death test is invoked from a subprocess which allows the tests to continue despite the death). This is useful because some code may guarantee program term... |
9,166,400 | Convert RGBA PNG to RGB with PIL | <p>I'm using PIL to convert a transparent PNG image uploaded with Django to a JPG file. The output looks broken.</p>
<h3>Source file</h3>
<p><img src="https://i.stack.imgur.com/I2uNe.png" alt="transparent source file"></p>
<h3>Code</h3>
<pre><code>Image.open(object.logo.path).save('/tmp/output.jpg', 'JPEG')
</code>... | 9,459,208 | 7 | 2 | null | 2012-02-06 19:58:12.33 UTC | 60 | 2022-05-28 06:09:27.29 UTC | 2012-02-27 22:32:23.443 UTC | null | 284,318 | null | 284,318 | null | 1 | 132 | python|png|jpeg|python-imaging-library|rgba | 185,270 | <p>Here's a version that's much simpler - not sure how performant it is. Heavily based on some django snippet I found while building <code>RGBA -> JPG + BG</code> support for sorl thumbnails. </p>
<pre><code>from PIL import Image
png = Image.open(object.logo.path)
png.load() # required for png.split()
background ... |
29,555,839 | how to calculate Bubble sort Time Complexity | <p>I was trying to understand the Data Structure and different algorithm, then i got confused to measure the Bubble sort time complexity.</p>
<pre><code>for (c = 0; c < ( n - 1 ); c++) {
for (d = 0; d < n - c - 1; d++) {
if (array[d] > array[d+1]) /* For descending order use < */
{
swap ... | 29,556,003 | 7 | 2 | null | 2015-04-10 07:37:29.173 UTC | 8 | 2020-11-17 10:23:06.22 UTC | null | null | null | null | 1,558,312 | null | 1 | 10 | algorithm|sorting | 82,887 | <p>Let's go through the cases for Big O for Bubble Sort</p>
<p>Case 1) O(n) (Best case)
This time complexity can occur if the array is already sorted, and that means that no swap occurred and only 1 iteration of n elements</p>
<p>Case 2) O(n^2) (Worst case)
The worst case is if the array is already sorted but in desc... |
17,258,778 | How to generate a string variable out of a labeled numeric variable (Stata)? | <p>I have a variable <code>state</code> that takes integer values from 11 to 99. It is labeled. </p>
<p>How can I create a string variable <code>stateString</code> that would have string values without all those numeric values?</p>
<p><code>gen stateString = tostring(state)</code></p>
<p>doesn't do the trick. </p> | 17,259,745 | 2 | 0 | null | 2013-06-23 08:03:13.54 UTC | 2 | 2021-03-11 12:10:17.683 UTC | 2013-06-23 10:19:26.32 UTC | null | 1,820,446 | null | 2,088,905 | null | 1 | 5 | string|label|stata | 46,273 | <p><code>tostring</code> isn't a function; it's a command, and in Stata the two are quite distinct. Nothing but guesswork leads to the syntax you tried.</p>
<pre><code>tostring state, gen(stateString)
</code></pre>
<p>should work. But <code>tostring</code> is just a wrapper for the function <code>string()</code> and</... |
24,767,184 | TcpClient - An existing connection was forcibly closed by the remote host | <p><strong>The Info</strong></p>
<p>I have been developing a web http server in c# and decided to add a remote console feature. The console can be used from any location and uses a TcpListener (web server) and a TcpClient (remote console) to send commands and functions through.</p>
<p><strong>The Code</strong></p>
<... | 24,767,583 | 3 | 5 | null | 2014-07-15 20:05:06.923 UTC | 2 | 2019-07-19 11:50:31.747 UTC | null | null | null | null | 3,125,916 | null | 1 | 5 | c#|tcpclient|tcplistener | 52,245 | <p>It seems that your client closes the connection after one message.</p>
<pre><code>responseData = System.Text.Encoding.ASCII.GetString(data, 0, bytes);
client.Close();
return responseData; //returns what server writes
</code></pre>
<p>If you want to persist the connection you should have a loop on the client simila... |
24,562,716 | How to retry HTTP requests with OkHttp/Retrofit? | <p>I am using Retrofit/OkHttp (1.6) in my Android project. </p>
<p>I don't find any request retry mechanism built-in to either of them. On searching more, I read OkHttp seems to have silent-retries. I don't see that happening on any of my connections (HTTP or HTTPS). How to configure retries with okclient ? </p>
<p>F... | 31,733,634 | 15 | 5 | null | 2014-07-03 20:23:05.083 UTC | 40 | 2022-07-28 13:17:09.137 UTC | null | null | null | null | 430,720 | null | 1 | 93 | android|retrofit|okhttp | 106,034 | <p><strong>For Retrofit 2.x;</strong></p>
<p>You can use <a href="https://square.github.io/retrofit/2.x/retrofit/retrofit2/Call.html#clone" rel="nofollow noreferrer">Call.clone()</a> method to clone request and execute it.</p>
<p><strong>For Retrofit 1.x;</strong></p>
<p>You can use <a href="https://github.com/square/o... |
22,310,007 | Differences between Git-scm, msysGit & Git for Windows | <p>What is the difference between <code>git-scm</code> (downloaded from <a href="http://git-scm.com" rel="noreferrer">git-scm.com</a>) and msysGit (hosted on <a href="https://code.google.com/p/msysgit/downloads/list" rel="noreferrer">Google Code</a>, <a href="https://github.com/msysgit/msysgit/" rel="noreferrer">Github... | 22,310,210 | 1 | 3 | null | 2014-03-10 19:56:34.783 UTC | 25 | 2016-01-11 10:43:39.613 UTC | 2016-01-11 10:36:04.153 UTC | null | 216,074 | null | 2,057,814 | null | 1 | 81 | windows|git|msysgit|git-bash | 32,574 | <p>The website <a href="http://git-scm.com">git-scm.com</a> is the official website for Git, the version control software. There is no “Git-SCM”, that’s just the URL of the <em>source control management (SCM)</em> software—the name is just <strong>Git</strong>. Originally written for Linux, the original Git software is... |
26,773,729 | Check if combobox value is empty | <p>I have created a ComboBox with three values. I wanted that a message box opens when no item is selected so I tried this:</p>
<pre><code>if (comboBox1.SelectedItem == null)
{
MessageBox.Show("Please select a value");
return;
}
</code></pre>
<p>That works fine but only if I click into the field in the combob... | 26,773,792 | 7 | 2 | null | 2014-11-06 07:15:03.94 UTC | 3 | 2020-12-16 12:14:44.823 UTC | 2014-11-06 07:16:20.573 UTC | null | 447,156 | null | 4,197,368 | null | 1 | 10 | c#|winforms|combobox | 78,318 | <p><code>if (string.IsNullOrEmpty(comboBox1.Text))</code> or <code>if (comboBox1.SelectedIndex == -1)</code></p> |
17,352,104 | Multiple JS event handlers on single element | <p>I am working with an existing web app, in the app there are a variety of submit buttons on different forms, some using regular http post, some defining an onClick function, and some binding a js event handler to the button using a class on the element.</p>
<p>What I want to do, is bind another event handler to thes... | 17,352,923 | 3 | 6 | null | 2013-06-27 19:56:58.89 UTC | 22 | 2019-05-23 09:30:51.963 UTC | 2019-05-23 09:30:51.963 UTC | null | 4,370,109 | null | 258,813 | null | 1 | 34 | javascript|jquery|dom-events|jquery-events | 83,342 | <p>In JS, you don't <em>really</em> have control over what order the event handlers are called, but with careful delegation and well-placed listeners, it is possible.</p>
<p>Delegation is one of the most powerful features of the event model. As you may or may not know: in JS, an event is handed to the top of the dom, ... |
17,509,846 | Python super() arguments: why not super(obj)? | <p>I am trying to understand when and how to use super() in Python correctly (either 2.7.x or 3.x)</p>
<p>on <code>>>> help(super)</code> the interpreter tells me how to call it:</p>
<pre><code>class super(object)
| super(type) -> unbound super object
| super(type, obj) -> bound super object; requi... | 17,509,938 | 2 | 1 | null | 2013-07-07 06:36:15.14 UTC | 12 | 2017-04-03 11:39:07.097 UTC | null | null | null | null | 1,621,769 | null | 1 | 44 | python|inheritance|super | 15,409 | <p>The two-argument form is only needed in Python 2. The reason is that <code>self.__class__</code> always refers to the "leaf" class in the inheritance tree -- that is, the most specific class of the object -- but when you call <code>super</code> you need to tell it which implementation is currently being invoked, so... |
37,133,191 | Is there a difference between lambdas declared with and without async | <p>Is there a difference between lambdas <code>() => DoSomethingAsync()</code> and <code>async () => await DoSomethingAsync()</code> when both are typed as <code>Func<Task></code>? Which one should we prefer and when?</p>
<p>Here is a simple console app</p>
<pre><code>using System;
using System.Threading.... | 37,133,814 | 3 | 2 | null | 2016-05-10 08:34:49.14 UTC | 3 | 2016-05-10 14:10:46.137 UTC | 2016-05-10 08:56:11.947 UTC | null | 5,599 | null | 5,599 | null | 1 | 30 | c#|asynchronous|lambda|async-await | 1,507 | <blockquote>
<p>Is there a difference between lambdas declared with and without async</p>
</blockquote>
<p>Yes, there's a difference. One is an async lambda and the other is just a task-returning lambda.</p>
<p>An async lambda is compiled into a state machine while the other doesn't so an async lambda has different... |
18,456,498 | How can I change the size of an iframe from inside? | <p>I am developing with jquery and I stumbled with the next problem: I added an IFrame inside the main page and I want to re size them from inside. I tried some ideas but without success.</p>
<p>Here is my code:</p>
<p>index.html</p>
<pre><code><html>
<head>
<title>Index</title>
... | 18,456,714 | 3 | 0 | null | 2013-08-27 03:37:57.767 UTC | 9 | 2021-01-23 18:18:53.84 UTC | 2021-01-23 18:18:53.84 UTC | null | 1,783,163 | null | 2,708,544 | null | 1 | 30 | html|iframe | 53,097 | <p>When you create an <code>IFRAME</code> the browser automatically adds a <code>'window'</code> object for the IFRAME inside the <code>'window'</code> object of main page.</p>
<p>You need to change the size of the <code>IFRAME</code> instead of the size of the document.</p>
<p>Try this code:</p>
<p>For <code>JavaSc... |
31,732,169 | Error inflating class android.webkit.WebView happens sporadically in production | <p>my application is on Google Play and it runs fine on most of devices (thousands of users). But in rare cases (fraction of percent of daily active users) I get <code>Error inflating class android.webkit.WebView</code> when I inflate layout for my fragment in <code>onCreateView</code> method.
Full stack trace is follo... | 31,732,953 | 5 | 5 | null | 2015-07-30 19:12:02.83 UTC | 8 | 2020-06-21 19:14:34.333 UTC | null | null | null | null | 1,325,048 | null | 1 | 42 | android|webview | 20,842 | <p>If you see these reports from devices running Android Lollipop, please ignore them. This likely happens whenever something launches an activity that uses WebView while the WebView package is in the middle of being updated by Play Store (which can only happen on Lollipop currently). During updates, packages are treat... |
4,969,133 | Database design - articles, blog posts, photos, stories | <p>I'm designing a database for a web site that will have at least 4 different object types represented (articles, blog posts, photos, stories), each of which have different enough data requirements to warrant their own tables. We want users to be able to post comments for any of these types. The data requirements for ... | 4,970,646 | 3 | 0 | null | 2011-02-11 12:45:06.93 UTC | 28 | 2020-07-26 19:40:39.083 UTC | 2013-04-04 10:22:47.05 UTC | null | 558,486 | null | 613,004 | null | 1 | 30 | database-design | 12,413 | <p>Here's one way to implement supertype/subtype tables for your app.</p>
<p>First, the supertype table. It contains all the columns common to all subtypes.</p>
<pre><code>CREATE TABLE publications (
pub_id INTEGER NOT NULL PRIMARY KEY,
pub_type CHAR(1) CHECK (pub_type IN ('A', 'B', 'P', 'S')),
pub_url VARCHAR(... |
9,410,611 | Default value of textbox | <p>How to set value of textbox? </p>
<p>I have this 1 textbox, and i want to set the default value is 0 so that when user not entering anythng my calculation still can.</p> | 9,410,666 | 5 | 3 | null | 2012-02-23 09:51:00.863 UTC | null | 2017-01-30 10:01:43.943 UTC | 2012-02-23 10:40:20.87 UTC | null | 159,270 | null | 1,227,357 | null | 1 | 6 | asp.net|textbox | 51,328 | <p>This can either be done in the markup (.aspx) like:</p>
<pre><code><asp:TextBox id="txt" runat="server" Text="0" />
</code></pre>
<p>Or in the code-behind (.aspx.cs):</p>
<pre><code>txt.Text = 0;
</code></pre>
<p>Or if you're using VB.NET:</p>
<pre><code>txt.Text = 0
</code></pre>
<hr>
<p>However, if yo... |
9,351,423 | How do I reduce MySQL's overhead as displayed in phpMyAdmin? | <p>In my MySQL database I see these statistics:</p>
<pre><code>Type Usage
Data 16,384 Bytes
Index 32,768 Bytes
Overhead 405,0 MB
Effective -424,624,128 Bytes
Total 49,152 Bytes
</code></pre>
<p>When I try the commands <code>check table</code>, <code>ALTER TABLE 'mytable' ENGINE = I... | 9,738,414 | 2 | 4 | null | 2012-02-19 17:32:00.43 UTC | 9 | 2016-06-17 07:20:02.207 UTC | 2014-03-28 02:46:34.217 UTC | null | 74,585 | null | 675,383 | null | 1 | 10 | mysql|phpmyadmin | 14,326 | <p>Overhead in PHPMyAdmin is calculated by 'Data_free' column returned by SHOW TABLE STATUS.
It is actually explained in MySQL documentation:
<a href="http://dev.mysql.com/doc/refman/5.1/en/show-table-status.html" rel="nofollow noreferrer">http://dev.mysql.com/doc/refman/5.1/en/show-table-status.html</a></p>
<p>Data_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.