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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5,268,041 | Xcode 4 Instruments doesn't show source lines | <p>I've just started playing with Xcode 4, and found that, no matter how I setup debugging symbols in the project, Instruments refuses to display source lines for stack trace items that correspond to my code. In only shows hex offsets and identifies my executable as the owning module. Turning on "Source Location" draws... | 8,702,682 | 8 | 0 | null | 2011-03-11 01:34:02.667 UTC | 15 | 2017-05-18 20:46:02.15 UTC | 2011-03-11 01:49:50.55 UTC | null | 9,990 | null | 9,990 | null | 1 | 28 | xcode|debug-symbols|xcode-instruments | 18,784 | <p>The other answers are good long-term fixes. If you'd rather not wait for Spotlight to rebuild its index and just need to get symbols for one Instruments session, you can ask Instruments to symbolicate the current session.</p>
<ol>
<li>Choose File → Re-Symbolicate Document…
<img src="https://i.stack.imgur.com/hkvDL.... |
5,588,855 | Standard alternative to GCC's ##__VA_ARGS__ trick? | <p>There is a <a href="https://stackoverflow.com/questions/4054085/gcc-appending-to-va-args">well-known</a> <a href="http://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html" rel="noreferrer">problem</a> with empty args for variadic macros in C99.</p>
<p>example:</p>
<pre><code>#define FOO(...) printf(__VA_ARGS__... | 5,589,364 | 12 | 7 | null | 2011-04-07 23:39:28.717 UTC | 73 | 2022-02-26 21:33:11.227 UTC | 2017-05-23 11:47:15.357 UTC | null | -1 | null | 567,650 | null | 1 | 163 | c|c99|c-preprocessor|variadic-macros | 91,891 | <p>It is possible to avoid the use of GCC's <code>,##__VA_ARGS__</code> extension if you are willing to accept some hardcoded upper limit on the number of arguments you can pass to your variadic macro, as described in <a href="https://stackoverflow.com/a/11172679/388520">Richard Hansen's answer to this question</a>. If... |
5,330,277 | What are examples of TCP and UDP in real life? | <p>I know the difference between the two on a technical level.</p>
<p>But in real life, can anyone provide examples (the more the better) of applications (uses) of TCP and UDP to demonstrate the difference?</p> | 5,330,367 | 17 | 0 | null | 2011-03-16 18:52:19.98 UTC | 42 | 2019-11-28 06:59:50.87 UTC | 2014-03-10 11:29:45.91 UTC | null | 87,861 | null | 594,026 | null | 1 | 85 | tcp|udp | 310,698 | <p>UDP: Anything where you don't care too much if you get all data always</p>
<ul>
<li>Tunneling/VPN (lost packets are ok - the tunneled protocol takes care of it)</li>
<li>Media streaming (lost frames are ok)</li>
<li>Games that don't care if you get <em>every</em> update</li>
<li>Local broadcast mechanisms (same app... |
12,118,866 | How do I create an F# Type Provider that can be used from C#? | <p>If I use the F# Type Providers from the assembly FSharp.Data.TypeProviders 4.3.0.0, I am able to create types in a very simple F# library. I am then able to use those types without any dependency on the assembly FSharp.Data.TypeProviders. That is pretty sweet! Here is an example:</p>
<p>I created an F# library proj... | 12,118,966 | 1 | 0 | null | 2012-08-25 03:14:47.853 UTC | 9 | 2012-08-25 20:46:26.107 UTC | 2017-05-23 12:26:15.053 UTC | null | -1 | null | 23,059 | null | 1 | 28 | f#|type-providers | 4,293 | <p>The reason why standard type providers (for OData, LINQ to SQL and WSDL) work with C# is that they generate real .NET types behind the cover. This is called <strong>generative type provider</strong>. In fact, they simply call the code generation tool that would be called if you were using these technologies from C# ... |
12,091,971 | How to start and end transaction in mysqli? | <p>As far as I understood transaction starts once we call <code>$mysqli->autocommit(FALSE);</code> statement and ends after calling <code>$mysqli->commit();</code> command like in the example below.</p>
<pre><code><?php
//Start transaction
$mysqli->autocommit(FALSE);
$mysqli->query('UPDATE `table` SET... | 12,092,151 | 5 | 0 | null | 2012-08-23 12:48:55.743 UTC | 23 | 2021-11-29 15:45:18.773 UTC | 2018-03-25 17:50:04.32 UTC | null | 3,536,236 | null | 282,887 | null | 1 | 44 | php|transactions|mysqli | 61,943 | <p><strong>Update Novembre 2020</strong>: <a href="https://stackoverflow.com/users/1839439/dharman">@Dharman</a> gave a better answer with more details about transactions in mysqli, just check it instead: <a href="https://stackoverflow.com/a/63764001/569101">https://stackoverflow.com/a/63764001/569101</a> </p>
<hr />
<... |
12,483,720 | adb - How to reinstall an app, without retaining the data? | <pre><code>adb install foo.apk
</code></pre>
<p>When using this command, if the apk exists, I should get the error *Failure [INSTALL_FAILED_ALREADY_EXISTS]*</p>
<pre><code> adb install -r myapp-release.apk
</code></pre>
<p>In this case,the existing apk will be replaced, by retaining old data
according to the docs, <... | 17,341,882 | 5 | 1 | null | 2012-09-18 19:31:37.687 UTC | 15 | 2018-11-02 07:00:14.027 UTC | 2012-09-18 19:38:45.643 UTC | null | 1,137,788 | null | 1,137,788 | null | 1 | 50 | android|apk|adb|command-prompt | 68,221 | <p>Before the installation <strong>clean the data</strong> like this:</p>
<pre><code>adb shell pm clear com.package.foo
</code></pre>
<p>then you can install normally using:</p>
<pre><code>adb install foo.apk
</code></pre>
<p>or just run through your IDE</p> |
12,100,634 | Changing default syntax based on filename | <p>In Sublime Text 2, I've seen ways of basing the syntax off of the extension. But what about a filename with no extension? For example, I often have a file called "Vagrantfile" which is in ruby, yet Sublime Text 2 always wants to start off in plain text. Is there a way to have it default to "ruby" for a file if it is... | 12,240,279 | 2 | 0 | null | 2012-08-23 22:02:07.737 UTC | 11 | 2014-07-01 05:46:16.263 UTC | null | null | null | null | 299,216 | null | 1 | 50 | sublimetext2 | 5,268 | <p>With Sublime Text 2.0.1, build 2217, look in the lower right of the window, where it says "Plain Text" for the Vagrantfile that is open. </p>
<p><img src="https://i.stack.imgur.com/T3wT3.png" alt="enter image description here"></p>
<p>Click that and in the menu that opens, at the top, there will be an "Open all wi... |
19,065,666 | How to include system dependencies in war built using maven | <p>I've searched on internet for quite some time and I'm unable to figure out how to configure the maven-war plugin or something alike so that the system dependencies are included in the built-war (WEB-INF/lib folder)</p>
<p>I use the maven dependency plugin in case of a jar-build as : </p>
<pre><code><plugin>
... | 19,066,828 | 7 | 4 | null | 2013-09-28 10:00:10.73 UTC | 14 | 2019-06-05 14:50:21.183 UTC | 2016-03-04 11:33:02.193 UTC | null | 694,325 | null | 566,092 | null | 1 | 43 | java|eclipse|maven | 68,339 | <p>Let me try to summarise the options I tried : </p>
<pre><code><packagingIncludes>${java.home}/lib/jfxrt.jar</packagingIncludes>
</code></pre>
<p>This doesn't work! Also, only having the jar name, excludes everything else, so if you are willing to try then try </p>
<pre><code><packagingIncludes>$... |
18,937,651 | PHP session IDs -- how are they generated? | <p>When I call <code>session_start()</code> or <code>session_regenerate_id()</code>, PHP generates what appears to be a random string for the session ID. What I want to know is, is it just a random sequence of characters, or is it like the <code>uniqid()</code> function?</p>
<p>Because if it's just random characters, ... | 18,937,956 | 2 | 6 | null | 2013-09-21 21:08:57.45 UTC | 11 | 2015-08-26 01:53:06.25 UTC | null | null | null | null | 546,657 | null | 1 | 21 | php|session|cookies|uniqueidentifier | 35,658 | <p>If you want to know how PHP generates a session ID by default check out the source code on <a href="https://github.com/php/php-src/blob/d9bfe06194ae8f760cb43a3e7120d0503f327398/ext/session/session.c#L284">Github</a>. <strong>It is certainly not random</strong> and is based on a hash (default: md5) of these ingredien... |
22,542,882 | SQL Error: ORA-01861: literal does not match format string 01861 | <p>I am trying to insert data into an existing table and keep receiving an error.</p>
<pre><code>INSERT INTO Patient
(
PatientNo,
PatientFirstName,
PatientLastName,
PatientStreetAddress,
PatientTown,
PatientCounty,
PatientPostcode,
DOB,
Gender,
PatientHomeTelephoneNumber,
PatientMobileTelephone... | 22,543,299 | 7 | 4 | null | 2014-03-20 19:11:31.623 UTC | 13 | 2020-12-17 14:16:17.837 UTC | 2014-03-20 19:16:28.57 UTC | null | 22,225 | null | 3,443,561 | null | 1 | 92 | sql|oracle|sql-insert | 538,110 | <p>Try replacing the string literal for date <code>'1989-12-09'</code> with <code>TO_DATE('1989-12-09','YYYY-MM-DD')</code></p> |
8,506,753 | AutoReconnect exception "master has changed" | <p>Having some trouble understanding the right approach here.</p>
<p>I have a connection to a mongodb replica set with three members (standard master-slave-slave). Everything is working fine with the connection when the master remains consistent.</p>
<pre><code>pymongo.Connection(['host1:27017','host2:27018','host3:... | 12,968,755 | 1 | 6 | null | 2011-12-14 15:07:58.56 UTC | 1 | 2012-10-19 06:42:18.68 UTC | 2012-06-18 12:48:01.063 UTC | null | 1,288 | null | 215,608 | null | 1 | 38 | mongodb|pymongo | 2,102 | <p>The behavior you describe is a bug. The best possible course of action is to make sure there is a bug logged for it and link to it from your question. Since the question is almost a year old, I am expecting the bug to be closed (check jira.mongodb.org/browse/SERVER-4405 to see if it applies).</p>
<p>If you upgrade ... |
20,694,062 | Can a TCP c# client receive and send continuously/consecutively without sleep? | <p>This is to a degree a "basics of TCP" question, yet at the same time I have yet to find a convincing answer elsewhere and believe i have a ok/good understanding of the basics of TCP. I am not sure if the combination of questions (or the one questions and while i'm at it the request for confirmation of a couple of po... | 20,698,153 | 1 | 5 | null | 2013-12-20 00:05:18.01 UTC | 36 | 2017-03-29 19:39:24.61 UTC | 2014-12-17 13:32:48.2 UTC | null | 1,480,391 | null | 459,109 | null | 1 | 39 | c#|sockets|asynchronous|tcp | 51,934 | <p>There's nothing wrong necessarily with grouping questions together, but it does make answering the question more challenging... :)</p>
<p>The MSDN article you linked shows how to do a one-and-done TCP communication, that is, one send and one receive. You'll also notice it uses the <a href="http://msdn.microsoft.c... |
26,403,334 | How to pass API keys in environment variables to Ember CLI using process.env? | <p>How do I pass environment variables from bashrc to Ember CLI. I imagine a situation where you need stripe api keys or pusher api-keys and you have them in your environment variables in bashrc. How do you pass the api-keys to Ember CLI. </p>
<p>I tried using Node.js <code>process.env</code> in both the <code>brocfil... | 26,425,078 | 4 | 5 | null | 2014-10-16 11:31:47.58 UTC | 10 | 2017-08-14 02:28:22.31 UTC | 2015-12-03 03:48:46.567 UTC | null | 117,259 | null | 529,289 | null | 1 | 26 | ember.js|ember-cli|ember-router | 20,445 | <p>I finally resolved this issue. I was faced with two options. Option 1 was to use XHR to fetch the api-keys from an end-point on the server. Option 2 is get the api-key directly from environment variables using Nodejs process.env. I prefer option 2 because it saves me from doing XHR request.</p>
<p>You can get opti... |
43,542,373 | Angular2 add class to body tag | <p>How can I add a <strong>class</strong> to the <strong>body</strong> tag without making the <strong>body</strong> as the app selector and using host binding?</p>
<p>I tried the using the Renderer but it changes the whole body </p>
<p><a href="https://stackoverflow.com/questions/34430666/angular-2-x-bind-class-on-bo... | 43,552,385 | 2 | 10 | null | 2017-04-21 12:09:49.097 UTC | 33 | 2022-04-05 07:28:40.293 UTC | 2018-03-27 12:25:15.457 UTC | null | 2,172,547 | null | 1,543,885 | null | 1 | 123 | angular | 94,248 | <p>I would love to comment. But due to missing reputation I write an answer.
Well I know two possibilities to solve this issue.</p>
<ol>
<li>Inject the Global Document. Well it might not be the best practice as I don't know if nativescript etc supports that. But it is at least better than use pure JS.</li>
</ol>
<pre c... |
11,058,811 | wget not working | <p>On Ubuntu, I am trying to download a file (from a script) using wget.
Buildling a program to download this file everyday and load to a hadoop cluster.</p>
<p>however, the wget fails, with the following message.</p>
<pre><code>wget http://www.nseindia.com/content/historical/EQUITIES/2012/JUN/cm15JUN2012bhav.csv.zip... | 11,058,856 | 5 | 2 | null | 2012-06-15 22:11:44.44 UTC | 5 | 2014-07-19 05:41:09.313 UTC | null | null | null | null | 459,222 | null | 1 | 13 | ubuntu | 51,547 | <p>The site blocks wget because wget uses an uncommon user-agent by default. To use a different user-agent in wget, try:</p>
<pre><code>wget -U Mozilla/5.0 http://www.nseindia.com/content/historical/EQUITIES/2012/JUN/cm15JUN2012bhav.csv.zip
</code></pre> |
11,162,740 | where I can find the little red dot image used in google map? | <p>I am looking for the red dots showing <a href="https://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=restaurant,%20dallas,%20tx&sll=37.0625,-95.677068&sspn=47.617464,93.076172&ie=UTF8&hq=restaurant,&hnear=Dallas,%20Texas&z=13" rel="noreferrer">here</a>
I can find find p... | 11,162,887 | 5 | 3 | null | 2012-06-22 19:18:45.667 UTC | 18 | 2017-09-18 16:56:11.267 UTC | 2014-04-18 17:52:39.143 UTC | null | 3,476,320 | null | 884,871 | null | 1 | 18 | google-maps|marker | 32,959 | <p>Are you just trying to copy out the style of the markers?</p>
<p>If you are using Chrome just press F12 for developer tools, go to resources, then choose Frames->Maps->Images.</p>
<p>All of the images are shown there along with their locations.</p>
<p><a href="https://maps.gstatic.com/mapfiles/markers2/red_marker... |
10,935,026 | How to clear interval and set it again? | <p>This is what i am trying to accomplish: when the last slide is reached fadeOut last slide and then fadeIn first slide, and then clearInterval <b><i>(everything works with this part)</i></b>. Now my problem is that i want to setInterval <b>again</b> if it doesn't exists but I don't know how to make it happen:( <br/>I... | 10,935,062 | 5 | 2 | null | 2012-06-07 15:33:59.713 UTC | 5 | 2022-02-27 08:28:23.71 UTC | 2016-01-10 10:53:31.69 UTC | null | 1,479,535 | null | 1,053,949 | null | 1 | 19 | javascript|jquery | 38,007 | <p>After clear an interval you need to start it again with <code>setInterval()</code>.</p>
<p>It would be better to make function for your <code>setInterval()</code></p>
<pre><code>var intervalID = null;
function intervalManager(flag, animate, time) {
if(flag)
intervalID = setInterval(animate, time);
els... |
11,018,076 | Splitting delimited values in a SQL column into multiple rows | <p>I would really like some advice here, to give some background info I am working with inserting Message Tracking logs from Exchange 2007 into SQL. As we have millions upon millions of rows per day I am using a Bulk Insert statement to insert the data into a SQL table.</p>
<p>In fact I actually Bulk Insert into a tem... | 11,018,339 | 4 | 1 | null | 2012-06-13 15:17:15.903 UTC | 10 | 2021-08-31 23:21:55.16 UTC | 2012-06-18 22:39:37.633 UTC | null | 61,305 | null | 1,257,600 | null | 1 | 27 | sql|sql-server|sql-server-2008|tsql|sql-server-2005 | 100,754 | <h2>If you are on SQL Server 2016+</h2>
<p>You can use the new <code>STRING_SPLIT</code> function, which I've blogged about <a href="https://sqlperformance.com/2016/03/sql-server-2016/string-split" rel="noreferrer">here</a>, and Brent Ozar has blogged about <a href="https://www.brentozar.com/archive/2016/03/splitting-s... |
11,005,279 | How do I unit test code which calls the Jersey Client API? | <p>I wrote code which calls the Jersey client API which in turn calls a web service which is out of my control. I do not want my unit test to call the actual web service.</p>
<p>What is the best approach for writing a unit test for code which calls the Jersey client API? Should I use the Jersey server API to write a J... | 11,005,771 | 3 | 3 | null | 2012-06-12 21:39:57.387 UTC | 5 | 2018-10-25 12:55:49.617 UTC | 2012-06-12 22:10:20.26 UTC | null | 364,029 | null | 364,029 | null | 1 | 28 | java|unit-testing|junit|jersey|jax-rs | 19,052 | <p>Try to use Mockito or Easymock for mocking service calls. You need to mock only these methods which are actually used - no need to mock every method. You can creat mock object for WebResource class, then mock accept method call.</p>
<p>In @BeforeClass/@Before JUnit test method write something like (Mockito example)... |
11,115,899 | Failed to install due to Timeout in Emulator | <p>When attempting to install an .apk from Eclipse, whether to an android emulator or to a physical device (via USB), I get a "Failed to install *.apk on device '*': timeout" error.
The .apk is not found on the emulator nor physcial device (Samsung Galaxy S2, rooted).</p>
<p>If I avoid eclipse, and just use the comman... | 14,785,531 | 13 | 15 | null | 2012-06-20 08:47:11.21 UTC | 6 | 2019-04-01 10:31:37.793 UTC | 2017-05-23 10:31:29.493 UTC | null | -1 | null | 872,154 | null | 1 | 32 | android|android-emulator|timeout | 23,585 | <p>I've solved the problem, many months later, by upgrading to a completely new environment. Specifically, a new machine with a fresh install of Windows 8. I've also avoided installing the Comodo suite (I don't know that this was causing the problem).</p>
<p>So while this is not a direct solution to the problem (it's ... |
11,443,669 | How to interpret "Connection: keep-alive, close"? | <p>From what I understand, a HTTP connection could either be <code>keep-alive</code> or <code>close</code>.</p>
<p>I sent a HTTP request to a server:</p>
<pre><code>GET /page1/ HTTP/1.1
Host: server.com
Connection: keep-alive
</code></pre>
<p>And it responded with:</p>
<pre><code>HTTP/1.1 200 OK
Connection: keep-al... | 22,143,279 | 4 | 3 | null | 2012-07-12 00:53:13.933 UTC | 9 | 2022-04-29 11:08:37.877 UTC | 2015-03-08 23:51:57.637 UTC | null | 632,951 | null | 632,951 | null | 1 | 40 | http|standards | 64,952 | <p><strong>TL; DR: Chrome interprets this response header as <code>keep-alive</code> and maintain a peristent connection while Firefox closes each connection.</strong></p>
<p>I stumbled over this question as I tried to optimize the page loading time for my website.</p>
<p>In the referenced RFC I didn't find anything ... |
11,191,764 | Renaming a file in NERDTREE | <p>Is it possible to rename a file in NERDTree? I know about the m menu but there is no rename option. </p> | 11,191,847 | 2 | 0 | null | 2012-06-25 14:56:25.123 UTC | 5 | 2022-03-30 18:34:04.877 UTC | 2013-04-02 22:10:58.467 UTC | null | 897,221 | null | 897,221 | null | 1 | 50 | vim|rename|nerdtree | 12,420 | <p>Use <code>Move</code>, <code>(m)ove the current node</code> in the m menu to rename.</p> |
13,022,677 | Save state of activity when orientation changes android | <p>I have an aacplayer app and I want to save the state of my activity when orientation changes from portrait to landscape. The TextViews do not appear to be empty, I tried to freeze my textview using this:</p>
<pre><code>android:freezesText="true"
</code></pre>
<p>my manifest:</p>
<pre><code>android:configChanges="... | 55,601,860 | 4 | 3 | null | 2012-10-23 02:20:00.39 UTC | 11 | 2020-04-27 13:17:49.367 UTC | 2016-05-23 21:40:30.917 UTC | null | 2,291,915 | null | 626,611 | null | 1 | 21 | android | 51,588 | <p>I use in <strong>KOTLIN</strong> static var / val : </p>
<pre><code>class MyFragment : Fragment()
{
//all my code
//access to static vars -> MyStaticClass.hello
}
class MyStaticClass
{
companion object {
var hello: String = "Static text"
var number_static: Int = 0
}
}
</code><... |
12,875,203 | Is there a better way of getting parent node of XPath query result? | <p>Having markup like this:</p>
<pre><code><div class="foo">
<div><span class="a1"></span><a href="...">...</a></div>
<div><span class="a2"></span><a href="...">...</a></div>
<div><span class="a1"></span>some text&... | 12,875,226 | 2 | 0 | null | 2012-10-13 17:32:45.253 UTC | 3 | 2018-11-12 23:26:26.967 UTC | 2018-11-12 23:26:26.967 UTC | null | 1,235,698 | null | 1,235,698 | null | 1 | 25 | xml|dom|xpath | 38,171 | <p>The nice thing about xpath queries is that you can essentially treat them like a file system path, so simply having</p>
<pre><code>//div[contains(@class,'foo')]/div/span[contains(@class,'a1')]/..
^^
</code></pre>
<p>will find all your .a1 nodes that are... |
12,644,075 | How to set python variables to true or false? | <p>I want to set a variable in Python to true or false. But the words <code>true</code> and <code>false</code> are interpreted as undefined variables:</p>
<pre><code>#!/usr/bin/python
a = true;
b = true;
if a == b:
print("same");
</code></pre>
<p>The error I get:</p>
<pre><code>a = true
NameError: glob... | 12,644,128 | 4 | 0 | null | 2012-09-28 16:42:08.993 UTC | 8 | 2020-07-13 19:57:15.03 UTC | 2014-02-25 01:14:10.297 UTC | null | 3,063,884 | null | 1,050,619 | null | 1 | 44 | python-2.7|boolean|constants | 267,601 | <p>First to answer your question, you set a variable to true or false by assigning <a href="http://docs.python.org/2/library/constants.html#True"><code>True</code></a> or <a href="http://docs.python.org/2/library/constants.html#False"><code>False</code></a> to it:</p>
<pre><code>myFirstVar = True
myOtherVar = False
</... |
12,909,905 | Saving image to file | <p>I am working on a basic drawing application. I want the user to be able to save the contents of the image.</p>
<p><img src="https://i.stack.imgur.com/M20lJ.png" alt="enter image description here"></p>
<p>I thought I should use </p>
<pre><code>System.Drawing.Drawing2D.GraphicsState img = drawRegion.CreateGraphics(... | 12,910,029 | 4 | 1 | null | 2012-10-16 07:50:58.79 UTC | 8 | 2022-03-28 20:10:27.757 UTC | 2015-03-17 12:23:46.48 UTC | null | 119,775 | null | 1,673,776 | null | 1 | 46 | c#|winforms|image|gdi+|save | 234,790 | <p>You could try to save the image using this approach</p>
<pre><code>SaveFileDialog dialog=new SaveFileDialog();
if (dialog.ShowDialog()==DialogResult.OK)
{
int width = Convert.ToInt32(drawImage.Width);
int height = Convert.ToInt32(drawImage.Height);
using(Bitmap bmp = new Bitmap(width, height))
{
... |
12,650,261 | Git says local branch is behind remote branch, but it's not | <p>Scenario: </p>
<ol>
<li>I make a new branch<br></li>
<li>hack on it<br></li>
<li>commit it<br></li>
<li>push it<br></li>
<li>hack on it some more<br></li>
<li>commit again<br></li>
<li>try to push again<br></li>
</ol>
<p>Git responds:</p>
<blockquote>
<p>Updates were rejected because the tip of your current br... | 12,651,399 | 4 | 1 | null | 2012-09-29 05:41:29.857 UTC | 31 | 2017-08-14 10:43:32.233 UTC | 2013-08-25 21:37:37.397 UTC | null | 9,314 | null | 1,325,172 | null | 1 | 87 | git|git-push | 174,180 | <p>You probably did some history rewriting? Your local branch diverged from the one on the server. Run this command to get a better understanding of what happened:</p>
<pre><code>gitk HEAD @{u}
</code></pre>
<p>I would strongly recommend you try to understand where this error is coming from. To fix it, simply run:</p... |
17,087,446 | How to calculate perspective transform for OpenCV from rotation angles? | <p>I want to calculate perspective transform (a matrix for warpPerspective function) starting from angles of rotation and distance to the object.</p>
<p>How to do that?</p>
<p>I found the code somewhere on OE. Sample program is below:</p>
<pre><code>#include <opencv2/objdetect/objdetect.hpp>
#include <openc... | 20,089,412 | 3 | 5 | null | 2013-06-13 12:45:27.223 UTC | 18 | 2021-07-09 18:03:08.193 UTC | 2013-06-13 14:35:39.15 UTC | null | 1,171,620 | null | 1,171,620 | null | 1 | 22 | c++|math|opencv|transformation|perspectivecamera | 24,336 | <p>I have had the luxury of time to think out both math and code. I did this a year or two ago. I even typeset this in beautiful LaTeX.</p>
<p>I intentionally designed my solution so that no matter what rotation angles are provided, the entire input image is contained, centered, within the output frame, which is other... |
16,782,498 | Looping Animation of text color change using CSS3 | <p>I have text that I want to animate. Not on hover, for example but continually changing slowly from white to red and then back to white again.</p>
<p>Here is my CSS code so far:</p>
<pre><code>#countText{
color: #eeeeee;
font-family: "League Gothic", Impact, sans-serif;
line-height: 0.9em;
letter-sp... | 16,782,559 | 3 | 3 | null | 2013-05-28 01:18:49.22 UTC | 7 | 2022-04-18 08:55:08.1 UTC | 2017-01-25 02:32:41.057 UTC | null | 315,024 | null | 2,055,611 | null | 1 | 32 | css|transition|css-animations | 119,742 | <p>Use <code>keyframes</code> and <code>animation</code> property</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>p {
animation: color-change 1s infinite;
}
@keyframes col... |
16,937,459 | Whats the difference between UInt8 and uint8_t | <p>What is the differnce between <code>UInt8</code> and <code>uint8_t</code>, or <code>UInt16</code> and <code>unit16_t</code>?</p>
<p>What does the <code>_t</code> imply?</p> | 16,937,843 | 3 | 2 | null | 2013-06-05 10:24:42.193 UTC | 10 | 2017-05-29 15:27:31.007 UTC | 2017-05-29 15:27:31.007 UTC | null | 1,267,663 | null | 1,845,029 | null | 1 | 67 | c++|objective-c|c | 85,101 | <p>In C99 the available basic integer types (the ones without _t) were deemed insufficient, because their actual sizes may vary across different systems. </p>
<p>So, the C99 standard includes definitions of several new integer types to enhance the portability of programs. The new types are especially useful in embedde... |
16,699,877 | Rails optional belongs_to | <p>I'm writing a Rails frontend for inventory management. I want users to be able to register products, so I have:</p>
<pre><code>class User < ActiveRecord::Base
has_many :products
# <snip>
end
</code></pre>
<p>and</p>
<pre><code>class Product < ActiveRecord::Base
belongs_to :user
# <snip>
... | 16,700,016 | 3 | 1 | null | 2013-05-22 19:14:46.15 UTC | 7 | 2019-05-05 19:41:48.003 UTC | 2013-05-22 19:23:09.357 UTC | null | 220,529 | null | 220,529 | null | 1 | 77 | ruby-on-rails|ruby|activerecord | 59,414 | <p>Do you have a validation that requires user be present? If so, remove that.</p> |
16,607,003 | qmake: could not find a Qt installation of '' | <p>I have a software in ubuntu that requires me to run qmake to generate the Makefile.</p>
<p>However, running qmake gives back this error,</p>
<pre><code>qmake: could not find a Qt installation of ''
</code></pre>
<p>I have installed what I thought to be the required packages using,</p>
<pre><code>sudo apt-get in... | 18,814,086 | 11 | 3 | null | 2013-05-17 10:38:53.77 UTC | 18 | 2022-09-10 20:48:24.89 UTC | 2016-09-16 20:42:01.88 UTC | null | 1,248,073 | null | 1,248,073 | null | 1 | 158 | qt|ubuntu|qmake | 252,186 | <p><code>sudo apt-get install qt5-default</code> works for me.</p>
<pre><code>$ aptitude show qt5-default</pre></code>
<p>tells that</p>
<blockquote>
<p>This package sets Qt 5 to be the default Qt version to be used when using
development binaries like qmake. It provides a default configuration for
qtchooser, but does ... |
10,154,476 | ActionBarCompat - how to use it | <p>I'm trying to use ActionBarCompat on my own project.
I've already opened the sample project (http://developer.android.com/resources/samples/ActionBarCompat/index.html), But I don't know how to implement it on my own.</p>
<p>I can't find any tutorial of some kind.
Should I make this project as a library?
Can someone... | 10,317,516 | 2 | 2 | null | 2012-04-14 14:47:09.743 UTC | 8 | 2013-07-28 00:44:09.447 UTC | 2012-12-29 12:23:00.817 UTC | null | 165,674 | null | 1,263,997 | null | 1 | 11 | android|android-actionbar|android-actionbar-compat | 21,991 | <p>As for implementation, just stick to the sample code provided under the <code>MainActivity.java</code> class. You can find it <a href="http://developer.android.com/resources/samples/ActionBarCompat/src/com/example/android/actionbarcompat/MainActivity.html" rel="noreferrer">here</a> or under <code><your local andr... |
9,904,080 | How to get time and date from datetime stamp in PHP? | <p>I have one string like <code>8/29/2011 11:16:12 AM</code>. I want to save in variable like <code>$dat = '8/29/2011'</code> and <code>$tme = '11:16:12 AM'</code></p>
<p>How to achieve that? Can you give me example?</p> | 9,904,146 | 7 | 0 | null | 2012-03-28 08:51:33.477 UTC | 5 | 2020-07-22 12:34:04.817 UTC | 2020-07-22 12:34:04.817 UTC | null | 4,217,744 | null | 1,153,176 | null | 1 | 42 | php|date | 105,211 | <p>E.g.</p>
<pre><code><?php
$s = '8/29/2011 11:16:12 AM';
$dt = new DateTime($s);
$date = $dt->format('m/d/Y');
$time = $dt->format('H:i:s');
echo $date, ' | ', $time;
</code></pre>
<p>see <a href="http://docs.php.net/class.datetime">http://docs.php.net/class.datetime</a></p>
<hr>
<p>edit: To keep the A... |
9,869,870 | How to get a single column's values into an array | <p>Right now I'm doing something like this to select a single column of data:</p>
<pre><code>points = Post.find_by_sql("select point from posts")
</code></pre>
<p>Then passing them to a method, I'd like my method to remain agnostic, and now have to call hash.point from within my method. How can I quickly convert this... | 9,872,725 | 4 | 0 | null | 2012-03-26 09:43:09.61 UTC | 25 | 2018-03-23 16:19:46.257 UTC | null | null | null | null | 1,697,802 | null | 1 | 84 | ruby-on-rails|ruby|ruby-on-rails-3 | 79,267 | <p>In Rails 3.2 there is a <a href="http://apidock.com/rails/ActiveRecord/Calculations/pluck" rel="noreferrer">pluck method</a> for this</p>
<p>Just like this:</p>
<pre><code>Person.pluck(:id) # SELECT people.id FROM people
Person.pluck(:role).uniq # unique roles from array of people
Person.distinct.pluck(:role) # SE... |
9,978,400 | Git: auto pull from repository? | <p>Is there any way to set up git such that it listens for updates from a remote repo and will pull whenever something changes? The use case is I want to deploy a web app using git (so I get version control of the deployed application) but want to put the "central" git repo on Github rather than on the web server (Gith... | 9,978,442 | 6 | 0 | null | 2012-04-02 14:38:11.163 UTC | 15 | 2022-08-12 14:36:01.523 UTC | null | null | null | null | 871,202 | null | 1 | 107 | git|deployment | 105,184 | <p>Git has "hooks", actions that can be executed after other actions. What you seem to be looking for is "post-receive hook". In the github admin, you can set up a post-receive url that will be hit (with a payload containing data about what was just pushed) everytime somebody pushes to your repo.</p>
<p>For what it's ... |
9,695,902 | How to break out of nested loops? | <p>If I use a <code>break</code> statement, it will only break inner loop and I need to use some flag to break the outer loop. But if there are many nested loops, the code will not look good.</p>
<p>Is there any other way to break all of the loops? (Please don't use <code>goto stmt</code>.)</p>
<pre><code>for (int i = ... | 9,695,931 | 15 | 3 | null | 2012-03-14 04:23:27.543 UTC | 44 | 2022-07-11 07:03:26.03 UTC | 2022-07-11 07:03:26.03 UTC | null | 1,564,946 | null | 966,379 | null | 1 | 127 | c|nested-loops|break | 255,334 | <p>Use:</p>
<pre><code>if (condition) {
i = j = 1000;
break;
}
</code></pre> |
8,225,934 | Exposing a C++ class instance to a python embedded interpreter | <p>I am looking for a simple way to expose a C++ class instance to a python embedded interpreter.</p>
<ul>
<li>I have a C++ library. This library is wrapped (using swig for the moment) and I am able to use it from the python interpreter</li>
<li>I have a C++ main program which instanciates a Foo class from my library a... | 8,226,377 | 3 | 0 | null | 2011-11-22 11:19:51.41 UTC | 9 | 2022-05-04 04:18:21.58 UTC | 2022-05-04 04:18:21.58 UTC | null | 1,536,976 | null | 1,044,695 | null | 1 | 21 | c++|python|boost|swig|boost-python | 7,194 | <p><a href="http://www.boost.org/doc/libs/release/libs/python/doc/" rel="noreferrer">Boost python</a> Allows you to expose c++ classes to python in a very tightly integrated way - you can even wrap them so that you can derive python classes from your c++ ones, and have virtual methods resolved to the python overrides.<... |
8,200,853 | How can I know if the request to the servlet was executed using HTTP or HTTPS? | <p>I wrote a servlet in Java and I would like to know if the request to that servlet was executed using HTTP or HTTPS.</p>
<p>I thought I can use <code>request.getProtocol()</code> but it returns HTTP/1.1 on both methods.</p>
<p>Any ideas?</p> | 8,208,910 | 3 | 0 | null | 2011-11-20 10:15:55.08 UTC | 23 | 2015-04-27 17:33:43.91 UTC | 2015-04-27 17:33:43.91 UTC | null | 3,885,376 | null | 80,932 | null | 1 | 73 | java|servlets|ssl|https|http-protocols | 53,152 | <p><em><strong>HttpSerlvetRequest.isSecure()</em></strong> is the answer. The ServletContainer is responsible for returning true in the following cases:</p>
<ul>
<li>If the ServletContainer can itself accept requests on https.</li>
<li>If there is a LoadBalancer in front of ServletContainer. And , the LoadBlancer has ... |
11,691,456 | SSIS with variable excel connection manager | <p>I am trying to do automatic package execution with a WMI Event Watcher Task within SSIS. The functionality I want is automatic package execution when excel files are dropped into a certain folder. However, these excel files will be the connection managers for populating a database.</p>
<p>Currently SSIS will not al... | 11,722,371 | 2 | 0 | null | 2012-07-27 15:57:20.323 UTC | null | 2017-07-13 10:29:58.317 UTC | 2017-07-13 10:29:58.317 UTC | null | 1,000,551 | null | 1,104,823 | null | 1 | 7 | excel|variables|ssis|connection | 46,263 | <p>You can use a variable for the connection string of you excel source: </p>
<ol>
<li>Click on your Connection manager of your excel source</li>
<li>In properties window, add an expression(1) ConnectionString(2) and assign a variable(3)</li>
</ol>
<p><img src="https://i.stack.imgur.com/N3wBl.jpg" alt="enter image de... |
11,550,797 | Playing youtube video in Android app | <p>In my Android app I'd like the user to tap an image once, have a youtube video play automatically and when the video is done the user is immediately returned to the app. <strong>What's the best way to do this in Android?</strong></p>
<p>I tried using intents. This works in that the video comes up on what I think is... | 11,551,203 | 1 | 0 | null | 2012-07-18 21:41:51.013 UTC | 9 | 2013-08-08 21:12:11.193 UTC | null | null | null | null | 879,664 | null | 1 | 8 | android|android-intent|youtube|android-mediaplayer | 22,241 | <p><strong>Update:</strong> Everything below is still correct, but the <a href="https://developers.google.com/youtube/android/player/" rel="nofollow noreferrer">official YouTube API for Android</a> is now available.</p>
<p>By far, the easiest way to play a YouTube video on Android is to simply fire an Intent to launch... |
11,863,503 | Whitespaces in java | <p>What are kinds of whitespaces in Java?
I need to check in my code if the text contains any whitespaces.</p>
<p>My code is:</p>
<pre><code>if (text.contains(" ") || text.contains("\t") || text.contains("\r")
|| text.contains("\n"))
{
//code goes here
}
</code></pre>
<p>I already know about <code... | 11,863,572 | 8 | 2 | null | 2012-08-08 11:26:01.8 UTC | 5 | 2016-12-01 11:10:51.25 UTC | 2015-12-26 13:53:52.853 UTC | null | 3,824,919 | null | 1,488,740 | null | 1 | 17 | java|whitespace | 143,410 | <pre><code>boolean containsWhitespace = false;
for (int i = 0; i < text.length() && !containsWhitespace; i++) {
if (Character.isWhitespace(text.charAt(i)) {
containsWhitespace = true;
}
}
return containsWhitespace;
</code></pre>
<p>or, using Guava,</p>
<pre><code>boolean containsWhitespace ... |
11,915,255 | Why are super columns in Cassandra no longer favoured? | <p>I have read in the latest release that super columns are not desirable due to "performance issues", but no where is this explained.</p>
<p>Then I read articles such as <a href="http://pkghosh.wordpress.com/2011/03/02/cassandra-secondary-index-patterns/">this one</a> that give wonderful indexing patterns using super... | 11,918,557 | 1 | 1 | null | 2012-08-11 13:51:44.013 UTC | 12 | 2017-11-08 18:38:10.053 UTC | 2012-08-11 14:07:13.903 UTC | null | 401,584 | null | 401,584 | null | 1 | 30 | cassandra|indexing|database-indexes|super-columns | 19,450 | <p>Super columns suffer from a number of problems, not least of which is that it is necessary for Cassandra to deserialze all of the sub-columns of a super column when querying (even if the result will only return a small subset). As a result, there is a practical limit to the number of sub-columns per super column th... |
11,773,115 | Parallel for loop in openmp | <p>I'm trying to parallelize a very simple for-loop, but this is my first attempt at using openMP in a long time. I'm getting baffled by the run times. Here is my code:</p>
<pre><code>#include <vector>
#include <algorithm>
using namespace std;
int main ()
{
int n=400000, m=1000;
double x=0,y=... | 11,773,714 | 4 | 0 | null | 2012-08-02 07:46:17.473 UTC | 15 | 2021-04-06 22:05:17.723 UTC | 2021-04-06 22:05:17.723 UTC | null | 1,366,871 | null | 296,827 | null | 1 | 34 | c++|multithreading|performance|parallel-processing|openmp | 82,063 | <p>You should make use of the OpenMP <code>reduction</code> clause for <code>x</code> and <code>y</code>:</p>
<pre><code>#pragma omp parallel for reduction(+:x,y)
for (int j=0; j<n; j++) {
double r=0.0;
for (int i=0; i < m; i++){
double rand_g1 = cos(i/double(m));
double rand_g2 = sin(i... |
11,734,861 | When can outer braces be omitted in an initializer list? | <p>I've got error C2078 in VC2010 when compiling the code below.</p>
<pre><code>struct A
{
int foo;
double bar;
};
std::array<A, 2> a1 =
// error C2078: too many initializers
{
{0, 0.1},
{2, 3.4}
};
// OK
std::array<double, 2> a2 = {0.1, 2.3};
</code></pre>
<p>I found out that the... | 11,735,045 | 1 | 12 | null | 2012-07-31 07:06:01.537 UTC | 19 | 2017-04-14 05:07:37.27 UTC | 2012-07-31 08:31:54.883 UTC | null | 396,571 | null | 1,345,960 | null | 1 | 53 | c++|c++11|visual-c++-2010 | 8,812 | <p>The extra braces are needed because <code>std::array</code> is an aggregate and POD, unlike other containers in the standard library. <code>std::array</code> doesn't have a user-defined constructor. Its first data member is an array of size <code>N</code> (which you pass as a template argument), and this member is d... |
3,553,875 | Load an EXE file and run it from memory | <p>I'm trying to run an executable from memory such as outlined in <a href="http://www.codeproject.com/KB/cs/LoadExeIntoAssembly.aspx" rel="noreferrer">this</a> article. I can run any .net/managed exes quite easily. But I cannot run executables such as <code>notepad.exe</code> or <code>calc.exe</code>. How can I get it... | 3,553,911 | 4 | 1 | null | 2010-08-24 06:01:00.967 UTC | 19 | 2018-12-07 16:34:01.3 UTC | 2015-06-18 10:12:49.36 UTC | null | 3,970,411 | null | 191,793 | null | 1 | 28 | c#|.net | 40,336 | <p>In the case of running .NET executables from memory, the libraries and CLR itself are doing a lot of heavy lifting for you. For native executables like notepad.exe and calc.exe, you'll have to do a lot of manual work to get it to happen. Basically, you have to act like the Windows loader.</p>
<p>There's probably ... |
3,953,391 | Why does (int)(object)10m throw "Specified cast is not valid" exception? | <p>Why this explicit cast does throw <code>Specified cast is not valid.</code> exception ?</p>
<pre><code>decimal d = 10m;
object o = d;
int x = (int)o;
</code></pre>
<p>But this works:</p>
<pre><code>int x = (int)(decimal)o;
</code></pre> | 3,953,684 | 4 | 2 | null | 2010-10-17 13:30:22.81 UTC | 6 | 2018-10-19 09:04:22.133 UTC | 2012-10-09 17:11:14.567 UTC | null | 322,355 | null | 322,355 | null | 1 | 48 | c#|casting | 25,994 | <p>A boxed value can only be unboxed to a variable of the exact same type. This seemingly odd restriction is a very important speed optimization that made .NET 1.x feasible before generics were available. You can read more about it in <a href="https://stackoverflow.com/questions/1583050/performance-surprise-with-as-a... |
3,492,904 | MySQL Select all columns from one table and some from another table | <p>How do you select all the columns from one table and just some columns from another table using JOIN? In MySQL.</p> | 3,492,919 | 4 | 0 | null | 2010-08-16 12:04:03.617 UTC | 67 | 2019-06-01 07:49:02.71 UTC | 2015-12-07 10:34:36.08 UTC | null | 895,245 | null | 198,836 | null | 1 | 364 | select|mysql|join | 328,207 | <p>Just use the table name:</p>
<pre><code>SELECT myTable.*, otherTable.foo, otherTable.bar...
</code></pre>
<p>That would select all columns from <code>myTable</code> and columns <code>foo</code> and <code>bar</code> from <code>otherTable</code>.</p> |
3,936,844 | finding the start day (Monday) of the current week | <p>Looking for a SQL query/queries that would determine the start day (Monday) of the current week.</p>
<p>Example:
If today is -> then the start of the week is</p>
<pre><code>Sat Oct 09, 2010 -> Start of the week is Monday Oct 04, 2010
Sun Oct 10, 2010 -> Start of the week is Monday Oct 04, 2010
Mon Oct 11, 2... | 3,936,891 | 5 | 2 | null | 2010-10-14 19:33:24.1 UTC | 1 | 2021-02-02 22:35:38.847 UTC | 2016-04-16 15:14:50.873 UTC | null | 578,411 | null | 173,850 | null | 1 | 20 | sql-server|tsql | 41,848 | <p>Try using <a href="http://msdn.microsoft.com/en-us/library/ms181598.aspx" rel="noreferrer"><code>DATEFIRST</code></a> to explicitly set the day of week to be regarded as the 'first'.</p>
<pre><code>set DATEFIRST 1 --Monday
select DATEADD(DD, 1 - DATEPART(DW, @pInputDate), @pInputDate)
</code></pre>
<p>This will r... |
3,547,587 | How to choose a Java-COM bridge? | <p>I have to create an application which automates Outlook and Word and I want to use Java for that task. (The only allowed alternative would be VB6, so...)</p>
<p>After a quick Google survey I found several libraries, but I'm not sure which one to use:</p>
<ul>
<li><a href="http://j-interop.org/" rel="noreferrer">J-... | 3,555,169 | 5 | 2 | null | 2010-08-23 12:41:56.057 UTC | 13 | 2015-08-12 16:22:14.717 UTC | 2015-08-12 16:22:14.717 UTC | null | 23,368 | null | 23,368 | null | 1 | 25 | java|com | 18,928 | <p>We use Jacob in production environment and it works out pretty well. Nevertheless the projects seems to be not very active.</p>
<p>Speaking of which: Activity seems to be an advantage for J-Interop. We tried the project as well and it seems to work out pretty good with even better logging messages. I think we might... |
3,415,683 | Do I need to escape backslashes in PHP? | <p>Do I need to escape backslash in PHP?</p>
<pre><code>echo 'Application\Models\User'; # Prints "Application\Models\User"
echo 'Application\\Models\\User'; # Same output
echo 'Application\Model\'User'; # Gives "Application\Model'User"
</code></pre>
<p>So it's an escape character. Shouldn't I need t... | 3,415,731 | 6 | 0 | null | 2010-08-05 14:26:35.62 UTC | 2 | 2021-01-14 07:23:42.89 UTC | 2021-01-11 08:35:22.937 UTC | null | 63,550 | null | 292,291 | null | 1 | 18 | php|string|escaping | 57,618 | <p>In <a href="http://php.net/language.types.string" rel="noreferrer">single quoted strings</a> only the escape sequences <code>\\</code> and <code>\'</code> are recognized; any other occurrence of <code>\</code> is interpreted as a plain character.</p>
<p>So since <code>\M</code> and <code>\U</code> are no valid esca... |
3,347,847 | On Ruby on Rails, how do we print debug info inside of a controller? | <p>In PHP, CGI, or in RoR's View, we can easily print out debug information. How about in the Controller, how can we just say, <code>print "hello world"</code> (to the webpage output) and return to continue with the view, or stop the controller right there?</p> | 3,347,983 | 6 | 0 | null | 2010-07-27 20:49:40.433 UTC | 16 | 2021-09-23 04:27:04.933 UTC | 2010-07-27 23:10:06.38 UTC | null | 325,418 | null | 325,418 | null | 1 | 39 | ruby-on-rails|debugging | 61,532 | <p>In the controller you can:</p>
<pre><code>render :text => @some_object.inspect
</code></pre>
<p>But your view won't be rendered.</p>
<p>You could also:</p>
<pre><code>Rails.logger.debug("My object: #{@some_object.inspect}")
</code></pre>
<p>and run tail on log/development.log to see the output.</p>
<p>In th... |
3,997,454 | Help me understand linear separability in a binary SVM | <p>I'm cross-posting this from <a href="https://math.stackexchange.com/questions/7499/help-me-understand-linearly-separability-in-a-binary-svm">math.stackexchange.com</a> because I'm not getting any feedback and it's a time-sensitive question for me.</p>
<hr>
<p>My question pertains to linear separability with hyperp... | 3,997,704 | 7 | 3 | null | 2010-10-22 13:52:16.127 UTC | 9 | 2013-02-19 22:24:41.94 UTC | 2017-04-13 12:19:15.857 UTC | null | -1 | null | 198,927 | null | 1 | 5 | algorithm|machine-learning|classification|svm|libsvm | 5,205 | <p>As mokus explained, support vector machines use a <em>kernel function</em> to implicitly map data into a feature space where they are linearly separable:</p>
<p><img src="https://i.stack.imgur.com/7FyLd.jpg" alt="SVM mapping one feature space into another"></p>
<p>Different kernel functions are used for various ki... |
3,304,463 | How do I modify the PATH environment variable when running an Inno Setup Installer? | <p>Inno Setup lets you set environment variables via the [Registry] sections (by setting registry key which correspond to environment variable)</p>
<p>However, sometimes you don't just wanna set an environment variable. Often, you wanna modify it. For example: upon installation, one may want to add/remove a directory ... | 3,431,379 | 7 | 0 | null | 2010-07-21 22:42:08.713 UTC | 30 | 2021-01-27 20:58:56.18 UTC | 2016-01-12 08:56:03.41 UTC | null | 4,029,189 | null | 192,945 | null | 1 | 71 | environment-variables|inno-setup | 50,831 | <p>The path in the registry key you gave is a value of type <code>REG_EXPAND_SZ</code>. As the Inno Setup documentation for the <strong>[Registry]</strong> section states there is a way to append elements to those:</p>
<blockquote>
<p>On a <code>string</code>, <code>expandsz</code>, or <code>multisz</code> type valu... |
3,678,255 | centering a CGRect in a view | <p>I have an image displaying in a CGRect. how do I center the rect in the view?</p>
<p>here's my code:</p>
<pre><code>UIImage * image = [UIImage imageNamed:place.image];
CGRect rect = CGRectMake(10.0f, 90.0f, image.size.width, image.size.height);
UIImageView * imageView = [[UIImageView alloc] initWithFrame:rect];
[... | 3,678,285 | 8 | 0 | null | 2010-09-09 15:53:13.317 UTC | 11 | 2019-05-08 07:32:19.937 UTC | 2010-09-09 15:53:45.063 UTC | null | 224,671 | null | 388,458 | null | 1 | 23 | iphone|objective-c|uiimage | 34,127 | <p>UIView's <code>center</code> is a property, not a method. </p>
<p>You need to calculate the actual location you want to put it in. You can do this by setting the frame of the view, or by setting its center, which is simpler in your case.</p>
<p>You don't say what view you then go make <code>imageView</code> a subv... |
3,561,234 | Where can I start with programmable Hardware? | <p>I've had a desire to learn at least a tiny bit about programming hardware for quite some time now and thought I'd ask here to get some starting points. I am a reasonably accomplished programmer with Delphi and Objective-c experience but have never even listened to a device port / interupt (I dont even know the term... | 3,561,268 | 9 | 0 | null | 2010-08-24 21:37:13.517 UTC | 10 | 2010-09-12 19:08:54.453 UTC | 2010-09-03 15:08:24.683 UTC | null | 28,574 | null | 6,244 | null | 1 | 19 | c++|c|embedded|hardware|usb | 7,539 | <p>I like the <a href="http://www.arduino.cc/" rel="noreferrer">Arduino</a>, easy to use, open source and a great community!</p>
<p>Good to get started with, and uses a subset of C/C++.</p>
<p>Also, has alot of addon hardware available, like GPS, Bluetooth, Wifi etc</p>
<p>My experiences with Arduino have been nothi... |
3,790,191 | php error: Class 'Imagick' not found | <p>I am getting the error "Class 'Imagick' not found". Somehow I need to make this library accessible to php. I am using Php 5.2.6 on Fedora 8. my php_info has no mention of ImageMagick.</p>
<p>I have tried: yum install ImageMagick and restarted apache, which didn't work.</p>
<p>I also added extension=imagick.ext to... | 3,794,896 | 10 | 3 | null | 2010-09-24 19:12:19.05 UTC | 8 | 2022-08-14 19:11:41.983 UTC | null | null | null | null | 400,648 | null | 1 | 56 | php | 124,218 | <p>From: <a href="http://news.ycombinator.com/item?id=1726074" rel="noreferrer">http://news.ycombinator.com/item?id=1726074</a></p>
<p>For RHEL-based i386 distributions:</p>
<pre><code>yum install ImageMagick.i386
yum install ImageMagick-devel.i386
pecl install imagick
echo "extension=imagick.so" > /etc/php.d/imag... |
7,699,200 | What is the difference between OpenID and SAML? | <p>What is the difference between OpenID and SAML?</p> | 7,699,311 | 4 | 0 | null | 2011-10-08 19:21:01.457 UTC | 64 | 2021-06-30 09:54:31.097 UTC | 2012-07-18 07:54:07.3 UTC | null | 812,149 | null | 311,764 | null | 1 | 173 | openid|saml | 83,504 | <h2>Original OpenID 2.0 vs SAML</h2>
<p>They are two different protocols of authentication and they differ at the technical level.</p>
<p>From a distance, differences start when users initiate the authentication. With OpenID, a user login is usually an HTTP address of the resource which is responsible for the authentic... |
7,715,594 | How to reset cursor to the beginning of the same line in Python | <p>Most of questions related to this topics here in SO is as follows:</p>
<blockquote>
<p>How to print some information on the same line without introducing a
new line</p>
</blockquote>
<p><a href="https://stackoverflow.com/questions/3249524">Q1</a> <a href="https://stackoverflow.com/questions/493386">Q2</a>.</p>... | 7,715,670 | 6 | 2 | null | 2011-10-10 16:06:40.333 UTC | 10 | 2019-12-02 18:09:36.357 UTC | 2017-05-23 12:02:45.493 UTC | null | -1 | null | 391,104 | null | 1 | 39 | python | 60,666 | <pre><code>import sys, time
for i in xrange(0, 101, 10):
print '\r>> You have finished %d%%' % i,
sys.stdout.flush()
time.sleep(2)
print
</code></pre>
<p>The <code>\r</code> is the carriage return. You need the comma at the end of the <code>print</code> statement to avoid automatic newline. Finally <code>... |
8,157,636 | Can Json.NET serialize / deserialize to / from a stream? | <p>I have heard that Json.NET is faster than DataContractJsonSerializer, and wanted to give it a try... </p>
<p>But I couldn't find any methods on JsonConvert that take a stream rather than a string. </p>
<p>For deserializing a file containing JSON on WinPhone, for example, I use the following code to read the file ... | 8,158,220 | 6 | 0 | null | 2011-11-16 19:41:33.79 UTC | 27 | 2022-07-19 07:34:06.063 UTC | 2018-12-28 16:35:30.66 UTC | null | 142,162 | null | 1,022,922 | null | 1 | 183 | .net|serialization|json.net | 230,099 | <p><strong>UPDATE:</strong> This no longer works in the current version, see <a href="https://stackoverflow.com/a/17788118/973292">below</a> for correct answer (<strong>no need to vote down, this is correct on older versions</strong>).</p>
<p>Use the <code>JsonTextReader</code> class with a <code>StreamReader</code> o... |
8,177,695 | How to wait for a process to terminate to execute another process in batch file | <p>How to wait for a process to terminate before executing another process in a batch file? Let's say I have a process <code>notepad.exe</code> that I need to kill before executing <code>wordpad.exe</code>. Then, when <code>wordpad.exe</code> is terminated, I need to launch <code>notepad.exe</code> again. How do I do ... | 8,185,270 | 8 | 4 | null | 2011-11-18 04:15:22.607 UTC | 12 | 2019-10-01 07:17:07.493 UTC | 2017-05-29 18:52:36.643 UTC | null | 6,395,052 | null | 261,842 | null | 1 | 56 | windows|batch-file | 189,775 | <p>Try something like this...</p>
<pre><code>@ECHO OFF
PSKILL NOTEPAD
START "" "C:\Program Files\Windows NT\Accessories\wordpad.exe"
:LOOP
PSLIST wordpad >nul 2>&1
IF ERRORLEVEL 1 (
GOTO CONTINUE
) ELSE (
ECHO Wordpad is still running
TIMEOUT /T 5
GOTO LOOP
)
:CONTINUE
NOTEPAD
</code></pre>
<p>I... |
8,108,980 | Java using enum with switch statement | <p>I've looked at various Q&As on SO similar to this question but haven't found a solution.</p>
<p>What I have is an enum which represents different ways to view a TV Guide...</p>
<p>In the NDroid <code>Application</code> class</p>
<pre><code>static enum guideView {
GUIDE_VIEW_SEVEN_DAY,
GUIDE_VIEW_NOW_S... | 8,109,098 | 8 | 6 | null | 2011-11-13 01:46:09.77 UTC | 20 | 2018-01-22 21:59:23.407 UTC | 2011-11-13 02:08:17.527 UTC | null | 488,241 | null | 488,241 | null | 1 | 123 | java|enums|switch-statement | 346,349 | <p>The part you're missing is converting from the integer to the type-safe enum. Java will not do it automatically. There's a couple of ways you can go about this:</p>
<ol>
<li>Use a list of static final ints rather than a type-safe enum and switch on the int value you receive (this is the pre-Java 5 approach)</li>
... |
4,141,643 | How do I set expiration on CSS, JS and Images? | <p>I have recently analysed my website with pagespeed addon on firebug. It suggested me to set expiration on CSS, JS and image files.</p>
<p>I am wondering, how do I do this?</p> | 4,141,740 | 5 | 2 | null | 2010-11-10 05:57:19.7 UTC | 19 | 2020-12-28 01:20:49.563 UTC | 2020-12-28 01:20:49.563 UTC | null | 1,783,163 | null | 178,301 | null | 1 | 41 | html|apache|caching | 80,562 | <p>This is the one I use to fix the exact same thing when I ran the PageSpeed Addon:</p>
<pre><code><FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>
</code></pre>
<p>This goes into your .htaccess file.</p>
<p>Read up on this page for more inform... |
4,556,184 | Vim: Move window left/right? | <p>In Vim, is it possible to “move” a window to the left or right? Eg, similar to <code><c-w> r</code> or <code><c-w> x</code>, but left/right instead of up/down?</p>
<p>For example, if I've got this layout:</p>
<pre><code>+---+---+---+
| | +---+
| A +---+---+
| | | |
+---+---+---+
</code></pre>... | 4,571,319 | 5 | 0 | null | 2010-12-29 17:16:42.553 UTC | 129 | 2020-01-28 19:14:41.42 UTC | 2010-12-29 17:29:34.7 UTC | null | 71,522 | null | 71,522 | null | 1 | 253 | vim | 109,989 | <p><kbd><kbd>Ctrl</kbd> <kbd>w</kbd></kbd> gives you the "windows command mode", allowing the following modifiers:</p>
<ul>
<li><p><kbd><kbd>Ctrl</kbd> <kbd>w</kbd></kbd> + <kbd>R</kbd> - To rotate windows up/left.</p></li>
<li><p><kbd><kbd>Ctrl</kbd> <kbd>w</kbd></kbd> + <kbd>r</kbd> - To rotate windows down/right.</... |
4,307,770 | Regular Expressions for file name matching | <p>In Bash, how does one match a regular expression with multiple criteria against a file name?
For example, I'd like to match against all the files with .txt or .log endings.</p>
<p>I know how to match one type of criteria:</p>
<pre><code>for file in *.log
do
echo "${file}"
done
</code></pre>
<p>What's the ... | 4,307,812 | 6 | 0 | null | 2010-11-29 20:25:59.45 UTC | 6 | 2010-11-30 06:12:15.437 UTC | null | null | null | null | 385,897 | null | 1 | 15 | regex|bash | 44,987 | <p>Do it the same way you'd invoke <code>ls</code>. You can specify multiple wildcards one after the other:</p>
<pre><code>for file in *.log *.txt
</code></pre> |
4,574,176 | Heroku push rejected, failed to install gems via Bundler | <p>I am struggling to push my code to Heroku. And after searching on Google and Stack Overflow questions, I have not been able to find the solution. Here is What I get when I try "git push heroku master" :</p>
<pre><code>Heroku receiving push
-----> Rails app detected
-----> Detected Rails is not set to serve st... | 4,576,816 | 13 | 0 | null | 2011-01-01 13:24:11.25 UTC | 15 | 2022-04-04 12:05:59.133 UTC | null | null | null | null | 307,708 | null | 1 | 64 | ruby-on-rails|rubygems|heroku|ruby-on-rails-3|bundler | 42,814 | <p>I don't think it's a Rails version problem, nor is it specific to Heroku. (I hit the same problem today, when running <code>bundle install</code> on my local development machine, with Rails 3.0.3.)</p>
<p>Running <code>bundle update</code> locally, as Andrew suggested, fixes the issue.</p>
<p><strong><em>Edit</em>... |
4,161,022 | How to track untracked content? | <p>See below the solid line for my original question.</p>
<p>I have a folder in my local directory that is untracked. When I run <code>git status</code>, I get:</p>
<pre><code>Changed but not updated:
modified: vendor/plugins/open_flash_chart_2 (modified content, untracked content)
</code></pre>
<p>When I type <co... | 4,162,672 | 15 | 13 | null | 2010-11-12 02:04:54.853 UTC | 99 | 2022-04-25 06:01:36.983 UTC | 2018-01-12 19:00:34.1 UTC | null | 55,075 | null | 341,583 | null | 1 | 165 | git|git-submodules | 162,420 | <p>You have added <code>vendor/plugins/open_flash_chart_2</code> as “gitlink” entry, but never defined it as a submodule. Effectively you are using the internal feature that <em>git submodule</em> uses (gitlink entries) but you are not using the submodule feature itself.</p>
<p>You probably did something like this:</... |
4,621,255 | How do I run a Python program in the Command Prompt in Windows 7? | <p>I'm trying to figure out how to run Python programs with the Command Prompt on Windows 7. (I should have figured this out by now...)</p>
<p>When I typed "python" into the command prompt, I got the following error:</p>
<blockquote>
<p>'python' is not recognized as an internal or external command,
operable p... | 4,621,277 | 24 | 0 | null | 2011-01-06 23:51:41.15 UTC | 68 | 2022-06-01 22:13:53.787 UTC | 2020-06-20 09:12:55.06 UTC | null | -1 | null | 566,233 | null | 1 | 166 | python|windows-7 | 877,731 | <p>You need to add <code>C:\Python27</code> to your system PATH variable, not a new variable named "python".</p>
<p>Find the system PATH environment variable, and append to it a <code>;</code> (which is the delimiter) and the path to the directory containing python.exe (e.g. <code>C:\Python27</code>). See below for ex... |
14,842,268 | How to create static binary which runs on every distro? | <p>Some linux apps like supertuxkart or regnum online have static binaries, which after downloading just work without needing to install any shared library. On every distro. How can I make such an app?</p> | 14,842,328 | 1 | 0 | null | 2013-02-12 21:34:44.433 UTC | 5 | 2021-04-15 13:56:31.27 UTC | null | null | null | null | 1,873,947 | null | 1 | 24 | linux|gcc|g++|packaging | 41,708 | <p>Ensure that all your resources are contained in the executable and link the executable statically:</p>
<pre><code>gcc -o foo main.o -static -lbaz -lbar
</code></pre>
<p>However, this also has drawbacks. Look up dynamic linking.</p> |
14,468,733 | Why I'm getting unexpected EOF for my cron job? | <p>I am receiving an error with my Cron job. The error I keep getting is: </p>
<pre><code>/bin/sh: -c: line 0: unexpected EOF while looking for matching `''
/bin/sh: -c: line 1: syntax error: unexpected end of file
</code></pre>
<p>Here is my code:</p>
<pre><code>mysqldump -u database_user -p']T%zw51' database > ... | 14,468,892 | 1 | 0 | null | 2013-01-22 21:54:40.493 UTC | 3 | 2015-03-26 16:35:12.497 UTC | 2015-03-26 16:35:12.497 UTC | null | 55,075 | null | 317,740 | null | 1 | 30 | shell|cron | 9,464 | <p>You may need to escape the <code>%</code> with a <code>\</code>.
<code>%</code> is a special character to the crontab, which gets translated to a newline, so your code was probably becoming </p>
<pre><code> -p']T
zw51'
</code></pre>
<p>Try:</p>
<pre><code> -p']T\%zw51'
</code></pre> |
14,698,350 | x86_64 ASM - maximum bytes for an instruction? | <p>What is the maximum number of bytes a complete instruction would require in x64 asm code?</p>
<p>Something like a jump to address might occupy up to 9 bytes I suppose: <strong>FF 00 00 00 00 11 12 3F 1F</strong> but I don't know if that's the maximum number of bytes a x64 instruction can use</p> | 14,698,559 | 3 | 3 | null | 2013-02-05 00:47:05.807 UTC | 8 | 2017-09-01 14:17:00.623 UTC | null | null | null | null | 1,494,037 | null | 1 | 36 | c|assembly|x86|64-bit|x86-64 | 25,021 | <p>The x86 instruction set (16, 32 or 64 bit, all variants/modes) guarantees / requires that instructions are at most 15 bytes. Anything beyond that will give an "invalid opcode". You can't achieve that without using redundant prefixes (e.g. multiple 0x66 or 0x67 prefixes, for example).</p>
<p>The only instruction tha... |
14,859,312 | Last element in django template list variable | <p>I would like to know how to filter out the last element of a list variable from the context object.</p>
<pre><code>{% for d in data %}
{{ d }},
{% endfor %}
</code></pre>
<p>I don't want to have the <code>,</code> after the last element. Thank you.</p>
<p><strong>NOTE</strong>: This is just a hypothetical exa... | 14,860,220 | 3 | 1 | null | 2013-02-13 17:25:01.25 UTC | 3 | 2016-04-30 17:11:19.353 UTC | null | null | null | null | 1,684,058 | null | 1 | 38 | django | 20,848 | <p>Do you mean -</p>
<pre><code>{% for d in data %}
{% if forloop.last %}
{{ d }}
{% else %}
{{ d }},
{% endif %}
{% endfor %}
</code></pre>
<p>have a look at the <a href="https://docs.djangoproject.com/en/1.9/ref/templates/builtins/#for" rel="noreferrer">django docs</a> on template for lo... |
14,840,247 | spannable on android for textView | <pre><code>Tweet o = tweets.get(position);
TextView tt = (TextView) v.findViewById(R.id.toptext);
//TextView bt = (TextView) v.findViewById(R.id.bottomtext);
EditText bt =(EditText)findViewById(R.id.bottomtext);
bt.setText(o.author);
Spannable spn = (Spannable) bt.getText();
spn.setSpan(new StyleSpan(android... | 14,840,432 | 3 | 3 | null | 2013-02-12 19:28:38.247 UTC | 9 | 2020-06-12 18:25:52.373 UTC | 2013-03-09 10:42:53.373 UTC | null | 569,101 | null | 2,046,224 | null | 1 | 40 | java|android|twitter|spannable | 57,185 | <blockquote>
<p>I want to make the font bold and ıtalic with spannable</p>
</blockquote>
<p>for this u will need to make <code>o.content</code> text as <code>SpannableString</code> then set it to TextView as :</p>
<pre><code>SpannableString spannablecontent=new SpannableString(o.content.toString());
spannableconten... |
14,660,037 | Django Forms: pass parameter to form | <p>How do I pass a parameter to my form?</p>
<pre><code>someView()..
form = StylesForm(data_dict) # I also want to pass in site_id here.
class StylesForm(forms.Form):
# I want access to site_id here
</code></pre> | 14,660,051 | 3 | 0 | null | 2013-02-02 08:22:10.843 UTC | 12 | 2020-11-25 13:18:23.623 UTC | 2020-11-25 13:18:23.623 UTC | null | 5,660,517 | null | 984,003 | null | 1 | 50 | django|django-forms | 65,010 | <p>You should define the __init__ method of your form, like that:</p>
<pre><code>class StylesForm(forms.Form):
def __init__(self,*args,**kwargs):
self.site_id = kwargs.pop('site_id')
super(StylesForm,self).__init__(*args,**kwargs)
</code></pre>
<p>of course you cannot access self.site_id until the... |
14,551,194 | How are parameters sent in an HTTP POST request? | <p>In an HTTP <strong>GET</strong> request, parameters are sent as a <strong><em>query string</em></strong>:</p>
<pre>http://example.com/page<b><i>?parameter=value&also=another</i></b></pre>
<p>In an HTTP <strong>POST</strong> request, the parameters are not sent along with the URI.</p>
<p><strong><em>Where are the ... | 14,551,320 | 10 | 1 | null | 2013-01-27 19:19:07.627 UTC | 552 | 2022-07-01 17:12:53.12 UTC | 2016-12-17 10:21:39.113 UTC | null | 3,618,581 | null | 124,119 | null | 1 | 1,678 | http|post|parameters|request|uri | 2,552,540 | <p>The values are sent in the request body, in the format that the content type specifies.</p>
<p>Usually the content type is <code>application/x-www-form-urlencoded</code>, so the request body uses the same format as the query string:</p>
<pre><code>parameter=value&also=another
</code></pre>
<p>When you use a f... |
45,659,986 | Django: Implementing a Form within a generic DetailView | <p>After working through several google search result pages, I am still desperately stuck at the same problem. I am trying to implement a comment field underneath a blog post. I am thankful for any hints and advice! </p>
<p>I am working on a Blog in Django which is set up with a first, generic ListView to display brie... | 45,661,979 | 4 | 0 | null | 2017-08-13 11:46:40.127 UTC | 8 | 2022-06-16 01:17:32.3 UTC | null | null | null | user8457857 | null | null | 1 | 13 | django|forms|comments|blogs|detailview | 11,875 | <p>Use <a href="https://docs.djangoproject.com/en/1.11/topics/class-based-views/mixins/#using-formmixin-with-detailview" rel="nofollow noreferrer"><code>FormMixin</code></a> if you want combine <code>DetailView</code> and a form:</p>
<pre><code>from django.shortcuts import render, get_object_or_404, redirect
from djang... |
2,621,395 | More efficient way of updating UI from Service than intents? | <p>I currently have a Service in Android that is a sample VOIP client so it listens out for SIP messages and if it recieves one it starts up an Activity screen with UI components.</p>
<p>Then the following SIP messages determine what the Activity is to display on the screen.
For example if its an incoming call it will... | 2,622,473 | 2 | 0 | null | 2010-04-12 10:46:58.323 UTC | 38 | 2015-06-15 21:21:14.75 UTC | 2010-04-12 11:03:32.01 UTC | null | 243,999 | null | 243,999 | null | 1 | 41 | android|user-interface|service|performance|android-intent | 22,890 | <p><strong>UPDATE 2015:</strong></p>
<p>This question/answer still gets a little bit of activity, but it is over 5 yrs old and things have changed quite a bit. 5 years ago, the answer below was how I would have handled it. Later I wrote a very lightweight dependency injection solution that I was using for a while (w... |
39,482,131 | Is it possible to use `impl Trait` as a function's return type in a trait definition? | <p>Is it at all possible to define functions inside of traits as having <code>impl Trait</code> return types? I want to create a trait that can be implemented by multiple structs so that the <code>new()</code> functions of all of them returns an object that they can all be used in the same way without having to write ... | 39,482,164 | 4 | 0 | null | 2016-09-14 03:38:25.693 UTC | 8 | 2020-02-11 14:44:23.723 UTC | 2019-11-06 17:02:22.773 UTC | null | 155,423 | null | 3,833,068 | null | 1 | 67 | rust|traits | 22,128 | <p>If you only need to return the specific type for which the trait is currently being implemented, you may be looking for <code>Self</code>.</p>
<pre><code>trait A {
fn new() -> Self;
}
</code></pre>
<p>For example, this will compile:</p>
<pre><code>trait A {
fn new() -> Self;
}
struct Person;
impl ... |
31,370,333 | custom django-user object has no attribute 'has_module_perms' | <p>My custom user model for login via email:</p>
<pre><code>class MyUser(AbstractBaseUser):
id = models.AutoField(primary_key=True) # AutoField?
is_superuser = models.IntegerField(default=False)
username = models.CharField(unique=True,max_length=30)
first_name = models.CharField(max_length=30, default... | 31,370,510 | 3 | 0 | null | 2015-07-12 17:05:19.83 UTC | 5 | 2022-04-17 21:44:22.563 UTC | null | null | null | null | 395,028 | null | 1 | 28 | django|django-authentication|django-users | 20,333 | <p>Your User implementation is not providing the mandatory methods to be used with the Admin module.</p>
<p>See <a href="https://docs.djangoproject.com/en/4.0/topics/auth/customizing/#custom-users-and-django-contrib-admin" rel="nofollow noreferrer">https://docs.djangoproject.com/en/4.0/topics/auth/customizing/#custom-u... |
40,382,319 | How to programmatically close ng-bootstrap modal? | <p>I've got a modal:</p>
<pre><code><template #warningModal let-c="close" let-d="dismiss">
<div class="modal-header">
<button type="button" class="close" aria-label="Close" (click)="d('Cross click')">
<span aria-hidden="true">&times;</span>
</button>
<h4 c... | 40,382,909 | 10 | 1 | null | 2016-11-02 14:22:27.837 UTC | 12 | 2022-06-09 15:47:05.613 UTC | 2018-11-02 12:41:08.94 UTC | null | 1,033,581 | null | 1,226,755 | null | 1 | 48 | angular|ng-bootstrap | 95,343 | <p>If you are using <a href="https://ng-bootstrap.github.io/" rel="noreferrer">https://ng-bootstrap.github.io/</a> (as indicated in your question) things are extremely simple - you can just open a modal and either close it from a template (as in your code) <em>or</em> programmatically (by calling <code>close()</code> m... |
48,641,295 | Async Computed in Components - VueJS? | <p>I'm finding a solution to async computed method in Components:</p>
<p>Currently, my component is:</p>
<pre><code><div class="msg_content">
{{messages}}
</div>
<script>
export default {
computed: {
messages: {
get () {
return api.get(`/users/${this.value.username}/message/`... | 48,643,055 | 3 | 0 | null | 2018-02-06 10:54:23.32 UTC | 4 | 2022-07-15 19:45:54.863 UTC | 2020-05-27 14:36:23.373 UTC | null | 7,095,029 | null | 7,155,095 | null | 1 | 46 | javascript|vue.js|vuejs2|vue-component | 91,232 | <p>Computed properties are basically functions that cache their results so that they don't have to be calculated every time they are needed. They updated automatically <strong>based on the reactive values they use</strong>.</p>
<p>Your computed does not use any reactive items, so there's no point in its being a compute... |
33,834,049 | What is the difference between the initial and unset values? | <p>A simple example:</p>
<p><strong>HTML</strong></p>
<pre><code><p style="color:red!important">
this text is red
<em>
this text is in the initial color (e.g. black)
</em>
this is red again
</p>
</code></pre>
<p><strong>CSS</strong></p>
<pre><code>em {
color:ini... | 33,834,282 | 3 | 0 | null | 2015-11-20 18:54:32.96 UTC | 21 | 2022-09-16 11:29:58.933 UTC | 2020-04-15 10:59:55.803 UTC | null | 515,189 | null | 1,673,376 | null | 1 | 115 | css | 65,313 | <p>According to <a href="http://caniuse.com/#feat=css-unset-value" rel="noreferrer">your link</a>:</p>
<blockquote>
<p><code>unset</code> is a CSS value that's the same as "inherit" if a property is inherited or "initial" if a property is not inherited</p>
</blockquote>
<p>Here is an example:</p>
<p><div class="sn... |
31,915,957 | move_uploaded_file failed to open stream: Permission denied - Mac | <p>While i am trying to move_uploaded_file in php with following code :</p>
<pre><code>if(is_uploaded_file($_FILES['fileupload2']['tmp_name'])){
move_uploaded_file($_FILES['fileupload2']['tmp_name'], "images/".$_FILES['fileupload2']['name']);
}
</code></pre>
<p>I've got this error saying:</p>
<pre><cod... | 31,919,367 | 8 | 0 | null | 2015-08-10 09:24:21.52 UTC | 2 | 2021-09-28 13:27:31.42 UTC | 2015-08-10 09:29:25.743 UTC | null | 3,989,689 | null | 3,989,689 | null | 1 | 17 | php|apache|file-upload|upload|xampp | 54,556 | <p>My solution was to give the permission for the images folder and the php file, by going to the file > Right click > Get info > and then change all the permissions to <code>read&write</code> as the following picture.</p>
<p><a href="https://i.stack.imgur.com/HvsMQ.png" rel="noreferrer"><img src="https://i.stack.... |
31,924,980 | Filling entity links in custom @RepositoryRestController methods | <p>I am using Spring-data-rest to provide read APIs over some JPA entities.
For writes I need to issue Command objects rather than directly write to the DB, so I added a custom controller using <code>@RepositoryRestController</code> and various command handling methods:</p>
<pre><code>@RequestMapping(method = RequestM... | 31,927,590 | 1 | 0 | null | 2015-08-10 16:47:08.503 UTC | 8 | 2015-08-28 10:40:09.697 UTC | null | null | null | null | 1,938,607 | null | 1 | 10 | java|spring|jpa|spring-data-rest|spring-hateoas | 3,125 | <p>This has recently been <a href="https://stackoverflow.com/a/31782016/3790806">answered</a> (see point 3.) by <a href="https://stackoverflow.com/users/18122/oliver-gierke">Oliver Gierke</a> himself (the question used quite different keywords though, so I won't flag this as duplicate).</p>
<p>The example for a single... |
44,448,411 | Default value for each type in typescript | <p>Where can I find the default value of each type in typescript? For example, where is mentioned the default value for <code>number</code> type is <code>null</code> or <code>0.</code>? Or about the <code>string</code>?</p>
<p>The default value means the value of a variable that is defined, but not assigned. Like <code... | 44,448,478 | 2 | 0 | null | 2017-06-09 02:37:23.52 UTC | 3 | 2021-02-17 18:40:32.253 UTC | 2021-02-17 18:40:32.253 UTC | null | 3,768,871 | null | 3,768,871 | null | 1 | 19 | typescript | 51,002 | <p>The default value of every type is <code>undefined</code></p>
<p>From: <a href="https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/undefined" rel="noreferrer">MDN - 'undefined'</a></p>
<blockquote>
<p>A variable that has not been assigned a value is of type undefined. </p>
</blockquote... |
67,405,791 | Gradle tasks are not showing in the gradle tool window in Android Studio 4.2 | <p>I just updated Android Studio to version 4.2. I was surprised to not see the Gradle tasks in my project.</p>
<p>In the previous version, 4.1.3, I could see the tasks as shown here:</p>
<p><a href="https://i.stack.imgur.com/7fhMP.png" rel="noreferrer"><img src="https://i.stack.imgur.com/7fhMP.png" alt="working in ver... | 67,406,955 | 6 | 0 | null | 2021-05-05 17:07:28.16 UTC | 40 | 2022-06-28 16:50:32.55 UTC | 2021-05-16 15:41:48.847 UTC | null | 4,424,400 | null | 4,424,400 | null | 1 | 242 | android-studio|gradle|android-studio-4.2 | 71,274 | <p>OK, I found why I got this behaviour in android studio 4.2.</p>
<p>It is intended behaviour. I found the answer in this post: <a href="https://issuetracker.google.com/issues/185420705" rel="noreferrer">https://issuetracker.google.com/issues/185420705</a>.</p>
<blockquote>
<p>Gradle task list is large and slow to pop... |
2,806,586 | Reading file data during form's clean method | <p>So, I'm working on implementing the answer to <a href="https://stackoverflow.com/questions/2798670/processing-file-uploads-before-object-is-saved">my previous question</a>.</p>
<p>Here's my model:</p>
<pre><code>class Talk(models.Model):
title = models.CharField(max_length=200)
mp3 = models.Fil... | 2,806,655 | 1 | 0 | null | 2010-05-10 21:30:13.79 UTC | 11 | 2010-05-14 07:52:57.18 UTC | 2017-05-23 10:31:31.273 UTC | null | -1 | null | 20,972 | null | 1 | 16 | django|django-file-upload|mutagen | 12,009 | <p>You could try to change your <a href="http://docs.djangoproject.com/en/dev/topics/http/file-uploads/#upload-handlers" rel="noreferrer">FILE_UPLOAD_HANDLERS</a> in such a way so Django always uses temporay file handler:</p>
<p><code>FILE_UPLOAD_HANDLERS</code> default:</p>
<pre><code>("django.core.files.uploadhandl... |
2,435,253 | A concise, clear list of what is new in JPA2? | <p>Does anybody know of a good list of what is new in JPA 2? Not what is new with Hibernate/TopLink in the version that supports JPA 2 but what is new in the actual spec.</p> | 2,440,516 | 1 | 0 | null | 2010-03-12 19:28:54.903 UTC | 6 | 2010-06-30 10:32:13.967 UTC | 2010-05-06 09:31:41.87 UTC | null | 70,604 | null | 97,901 | null | 1 | 29 | java|orm|jpa|jakarta-ee|jpa-2.0 | 5,751 | <p>The link mentioned in the accepted answer doesn't say anything about the second level cache so I decided to post a quick list to summarize "What's new in JPA 2.0 (JSR-317)":</p>
<ul>
<li><strong>Standard properties</strong> for <code>persistence.xml</code> - E.g. <code>javax.persistence.jdbc.driver</code>, etc inst... |
3,194,875 | PHP DOM replace element with a new element | <p>I have a DOM object with loaded HTML markup. I'm trying to replace all embed tags that look like this:</p>
<pre><code><embed allowfullscreen="true" height="200" src="path/to/video/1.flv" width="320"></embed>
</code></pre>
<p>With a tag like this:</p>
<pre><code><a
href="path/to/video/1.flv"
style... | 3,195,048 | 1 | 3 | null | 2010-07-07 13:03:25.91 UTC | 6 | 2012-07-10 14:26:08.79 UTC | 2012-07-10 14:26:08.79 UTC | null | 367,456 | null | 95,944 | null | 1 | 30 | php|dom | 32,212 | <p>It's easy to find elements from a DOM using <code>getElementsByTagName</code>. Indeed you wouldn't want to go near regular expressions for this.</p>
<p>If the DOM you are talking about is a PHP <code>DOMDocument</code>, you'd do something like:</p>
<pre><code>$embeds= $document->getElementsByTagName('embed');
f... |
21,363,302 | RabbitMQ - Message order of delivery | <p>I need to choose a new Queue broker for my new project. </p>
<p>This time I need a scalable queue that supports pub/sub, and keeping message ordering is a must. </p>
<p>I read Alexis comment: He writes:</p>
<blockquote>
<p>"Indeed, we think RabbitMQ provides stronger ordering than Kafka"</p>
</blockquote>
<p... | 21,363,518 | 4 | 0 | null | 2014-01-26 12:26:50.833 UTC | 28 | 2018-09-12 14:18:15.543 UTC | 2015-12-03 09:50:22.427 UTC | null | 2,928,018 | null | 450,602 | null | 1 | 84 | queue|rabbitmq|message-queue | 67,889 | <p>Well, let's take a closer look at the scenario you are describing above. I think it's important to paste <a href="https://www.rabbitmq.com/semantics.html" rel="noreferrer">the documentation</a> immediately prior to the snippet in your question to provide context:</p>
<blockquote>
<p>Section 4.7 of the AMQP 0-9-1 ... |
37,331,571 | how to setup ssh keys for jenkins to publish via ssh | <p>Jenkins requires a certificate to use the <em>ssh</em> publication and <em>ssh</em> commands. It can be configured under <code>"manage jenkins" -> "Configure System"-> "publish over ssh"</code>.</p>
<p>The question is: How does one create the certificates?</p>
<p>I have two ubuntu servers, one running Jenkin... | 37,332,975 | 4 | 0 | null | 2016-05-19 18:40:51.3 UTC | 22 | 2022-09-15 05:45:43.567 UTC | 2018-07-05 14:49:56.983 UTC | null | 2,884,309 | null | 1,072,187 | null | 1 | 37 | jenkins|ssh | 195,649 | <p>You will need to create a public/private key as the Jenkins user on your Jenkins server, then copy the public key to the user you want to do the deployment with on your target server.</p>
<p>Step 1, generate public and private key on build server as user <code>jenkins</code></p>
<pre><code>build1:~ jenkins$ whoami... |
46,641,224 | What is `<<` and `&` in yaml mean? | <p>When I review the <code>cryptogen</code>(<em>a fabric command</em>) config file . I saw there symbol.</p>
<pre><code>Profiles:
SampleInsecureSolo:
Orderer:
<<: *OrdererDefaults ## what is the `<<`
Organizations:
- *ExampleCom ## what is the `*`
... | 46,644,785 | 1 | 0 | null | 2017-10-09 07:48:03.59 UTC | 6 | 2020-04-10 14:25:46.227 UTC | 2017-10-09 08:47:57.587 UTC | null | 1,000,551 | null | 1,634,827 | null | 1 | 35 | yaml|hyperledger-fabric | 20,023 | <p>Well, those are elements of the YAML file format, which is used here to provide a configuration file for <code>configtxgen</code>. The "&" sign mean anchor and "*" reference to the anchor, this is basically used to avoid duplication, for example:</p>
<pre><code>person: &person
name: "John Doe"
employee... |
38,552,803 | How to convert a bool to a string in Go? | <p>I am trying to convert a <code>bool</code> called <code>isExist</code> to a <code>string</code> (<code>true</code> or <code>false</code>) by using <code>string(isExist)</code> but it does not work. What is the idiomatic way to do this in Go?</p> | 38,552,924 | 4 | 1 | null | 2016-07-24 13:56:32.633 UTC | 8 | 2021-07-19 11:48:30.243 UTC | null | null | null | null | 2,828,227 | null | 1 | 148 | go|type-conversion | 125,615 | <p>use the strconv package</p>
<p><a href="https://golang.org/pkg/strconv/#FormatBool">docs</a></p>
<p><code>strconv.FormatBool(v)</code></p>
<blockquote>
<p>func FormatBool(b bool) string FormatBool returns "true" or "false"<br>
according to the value of b</p>
</blockquote> |
24,748,303 | Selecting child view at index using Espresso | <p>With Espresso when using a custom widget view with child image views, which Matcher type can I use to select the nth child?
Example:</p>
<pre><code>+--------->NumberSlider{id=2131296844, res-name=number_slider, visibility=VISIBLE, width=700, height=95, has-focus=false, has-focusable=false, has-window-focus=true,... | 30,073,528 | 4 | 0 | null | 2014-07-15 00:44:49.013 UTC | 13 | 2020-08-17 17:43:49.87 UTC | 2014-07-29 21:45:40.727 UTC | null | 1,675,568 | null | 2,840,267 | null | 1 | 39 | android|android-espresso | 29,264 | <pre><code> public static Matcher<View> nthChildOf(final Matcher<View> parentMatcher, final int childPosition) {
return new TypeSafeMatcher<View>() {
@Override
public void describeTo(Description description) {
description.appendText("with "+childPosition+" child view of type pa... |
37,700,730 | How do I configure a Jenkins Pipeline to be triggered by polling SubVersion? | <p>We have been using Jenkins for Continuous Integration for some time.
A typical build job specifies the SVN repository and credentials in the "Source Code Management" section, then in the "Build Triggers" section we enable "Poll SCM" with a polling schedule of every 10 minutes (H/10 * * * *).
We have updated to the l... | 37,742,811 | 6 | 0 | null | 2016-06-08 11:04:37.8 UTC | 7 | 2019-09-12 11:48:40.037 UTC | 2017-05-26 13:38:10.35 UTC | null | 1,000,551 | null | 947,017 | null | 1 | 22 | svn|jenkins|triggers|jenkins-pipeline | 59,399 | <p>The solution that I have found to work is:</p>
<ol>
<li>Move the pipeline script into a file (the default is JenkinsFile) and store this in the root of my project in SubVersion.</li>
<li>Set my pipeline job definition source to "Pipeline script from SCM", enter the details of where to find my project in SubVersion ... |
71,706,064 | React 18: Hydration failed because the initial UI does not match what was rendered on the server | <p>I'm trying to get SSR working in my app but I get the error:</p>
<blockquote>
<p>Hydration failed because the initial UI does not match what was
rendered on the server.</p>
</blockquote>
<p>Live demo code is <a href="https://stackblitz.com/edit/react-j94bwy" rel="noreferrer">here</a></p>
<p>Live demo of problem is <... | 71,870,995 | 31 | 0 | null | 2022-04-01 11:17:03.643 UTC | 15 | 2022-09-12 23:02:27.553 UTC | 2022-04-01 14:14:27.387 UTC | null | 1,249,664 | null | 1,249,664 | null | 1 | 74 | reactjs | 75,321 | <p>I have been experiencing the same problem lately with <strong>NextJS</strong> and i am not sure if my observations are applicable to other libraries. I had been wrapping my components with an improper tag that is, <strong>NextJS</strong> is not comfortable having a <strong>p</strong> tag wrapping your <strong>divs</... |
25,747,146 | How to properly rebase in SourceTree? | <p>SourceTree 1.6.4.0 on Windows 7.</p>
<p>Let's say the following is my starting point: </p>
<p><img src="https://i.stack.imgur.com/dZNR5.jpg" alt="enter image description here"></p>
<pre><code> C <- master
/
- A - B <- topic
</code></pre>
<p>I want to rebase <strong>topic</strong> onto <strong>master</stro... | 25,747,616 | 3 | 0 | null | 2014-09-09 14:25:53.013 UTC | 9 | 2018-06-03 16:03:20.333 UTC | 2014-09-17 10:28:27.477 UTC | null | 1,224,069 | null | 3,858,446 | null | 1 | 42 | git|rebase|atlassian-sourcetree | 41,782 | <h1>Update: SourceTree 1.9.1</h1>
<p>You can enable force push in Tools/Options/Git/Enable Force Push. After it is enabled you can check "Force Push" check box in the "Push" dialog.</p>
<h1>Original answer</h1>
<p>You have to do a force push, because topic branch is already published and you are rew... |
25,550,643 | customAnimation when calling popBackStack on a FragmentManager | <p>In my activity, with the touch of a button, I replace the current fragment with a new fragment using a custom animation, like in this example.</p>
<pre><code>@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle presses on the action bar items
switch (item.getItemId()) {
case R.i... | 25,571,345 | 1 | 0 | null | 2014-08-28 13:56:35.077 UTC | 7 | 2014-08-29 15:21:55.03 UTC | null | null | null | null | 580,041 | null | 1 | 36 | android|android-fragments|android-animation | 16,951 | <p>After further reading of the documentation, I found that using <a href="http://developer.android.com/reference/android/app/FragmentTransaction.html#setCustomAnimations(int,%20int,%20int,%20int)" rel="noreferrer">this</a> signature of <code>setCustomAnimation</code> allowed the animation to be played when pressing th... |
43,422,488 | Relationship between the dotnet cli and the new vs2017 msbuild | <p>With the move from <code>project.json</code> to the new <code>csproj</code> format introduced with VS2017, I'm struggling to understand the difference between the <code>dotnet</code> cli and the new <code>msbuild</code> and when to use one over the other.</p>
<p>1) To build a new <code>csproj</code> netstandard lib... | 43,455,110 | 1 | 0 | null | 2017-04-15 05:17:13.383 UTC | 35 | 2021-08-07 00:40:36.29 UTC | 2020-03-13 15:42:36.237 UTC | null | 201,303 | null | 386,287 | null | 1 | 107 | visual-studio|msbuild|visual-studio-2017|csproj|dotnet-cli | 20,763 | <h2>Questions</h2>
<blockquote>
<ol>
<li>To build a new csproj netstandard library from the command line, should I be calling the dotnet cli (for example dotnet restore dotnet build) or use msbuild (for example msbuild ExampleNetstandard.sln).</li>
</ol>
</blockquote>
<p>Both do fine as currently <code>dotnet</code> is... |
356,483 | Python regex findall numbers and dots | <p>I'm using re.findall() to extract some version numbers from an HTML file:</p>
<pre><code>>>> import re
>>> text = "<table><td><a href=\"url\">Test0.2.1.zip</a></td><td>Test0.2.1</td></table> Test0.2.1"
>>> re.findall("Test([\.0-9]*)", text)
... | 356,494 | 1 | 0 | null | 2008-12-10 15:33:09.6 UTC | 4 | 2020-06-11 09:58:45.413 UTC | null | null | null | Ashy | 32,933 | null | 1 | 11 | python|regex|findall | 38,391 | <pre><code>re.findall(r"Test([0-9.]*[0-9]+)", text)
</code></pre>
<p>or, a bit shorter:</p>
<pre><code>re.findall(r"Test([\d.]*\d+)", text)
</code></pre>
<p>By the way - you do not need to escape the dot in a character class. Inside <code>[]</code> the <code>.</code> has no special meaning, it just matches a literal... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.