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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3,531,867 | Auto select file in Solution Explorer from its open tab | <p>Normally, many files in <a href="http://en.wikipedia.org/wiki/Microsoft_Visual_Studio#Visual_Studio_2010" rel="noreferrer">Visual Studio 2010</a> are opened in many tabs, while massively working on a project. Many times, I find myself right-clicking on a tab title and searching for <code>Show/Select/Scroll... | 8,473,574 | 13 | 1 | null | 2010-08-20 14:35:07.193 UTC | 56 | 2021-05-25 13:07:25.96 UTC | 2019-07-18 20:25:06.737 UTC | null | 3,345,644 | null | 225,680 | null | 1 | 284 | visual-studio|visual-studio-2010 | 131,584 | <p>Another option is to bind 'View.TrackActivityInSolutionExplorer' to a keyboard short-cut, which is the same as 'Tools-->Options-->Projects and Solutions-->Track Active Item in Solution Explorer'</p>
<p>If you activate the short-cut twice the file is selected in the solution explorer, and the tracking is disabled ag... |
8,213,657 | Is Twitter's Bootstrap mobile friendly like Skeleton? | <p>Skeleton is made to scale to also fit mobile browsers, following the principles of <a href="http://www.abookapart.com/products/responsive-web-design" rel="noreferrer">responsive web design</a>. Does Bootstrap offer the same?</p> | 8,213,727 | 4 | 1 | null | 2011-11-21 14:46:36.933 UTC | 9 | 2013-09-30 14:21:42.723 UTC | 2012-09-09 21:24:43.153 UTC | null | 1,092,711 | null | 567,589 | null | 1 | 34 | css|twitter-bootstrap|responsive-design|skeleton-css-boilerplate | 20,876 | <p>Not yet - <a href="http://groups.google.com/group/twitter-bootstrap/browse_thread/thread/6db57d09f654a326?pli=1" rel="nofollow">http://groups.google.com/group/twitter-bootstrap/browse_thread/thread/6db57d09f654a326?pli=1</a></p>
<p>But it will be, at some point. <a href="https://github.com/twitter/bootstrap/wiki/Ro... |
7,971,315 | How to force exit application in C#? | <p>I have a multi threaded C# application and it has reader writer lock,but it gives a timeout exception on some computers(not being able to acquire a lock in time) and I need to forcefully close all threads.
how do I do it without getting any extra exceptions?</p> | 7,971,353 | 5 | 2 | null | 2011-11-01 18:45:58.033 UTC | 6 | 2021-12-28 13:49:16.073 UTC | 2016-12-06 13:33:53.09 UTC | null | 1,905,073 | null | 871,082 | null | 1 | 26 | c#|multithreading | 43,440 | <p><a href="http://msdn.microsoft.com/en-us/library/ms131100.aspx" rel="noreferrer">Environment.FailFast</a> might be what you're looking for, but take care about the side-effects: no finalizers, finally blocks or anything else is run. It really does terminate the process <strong>NOW</strong>.</p> |
4,404,539 | WPF: Alternating colors on a ItemsControl? | <p>How do I get alternating colors on a ItemsControl? I have AlternationCount set to 2, but the ItemsControl.AlternationIndex property always returns 0.</p>
<pre><code> <ItemsControl ItemsSource="{Binding}" AlternationCount="2">
<ItemsControl.Resources>
<Style x:Key="F... | 4,405,657 | 3 | 1 | null | 2010-12-10 00:23:55.22 UTC | 3 | 2016-01-07 15:21:45.143 UTC | 2011-08-16 15:56:16.357 UTC | null | 305,637 | null | 5,274 | null | 1 | 41 | wpf|styles|itemscontrol | 23,956 | <p>Check here <a href="http://www.codeproject.com/Articles/35886/WPF-ItemsControl-with-alternating-items-and-hover-.aspx" rel="noreferrer">http://www.codeproject.com/Articles/35886/WPF-ItemsControl-with-alternating-items-and-hover-.aspx</a></p>
<p>You have to change your code like this to get it working</p>
<pre><cod... |
4,335,570 | Accessing Hibernate Session from EJB using EntityManager | <p>Is it possible to obtain the Hibernate Session object from the EntityManager? I want to access some hibernate specific API...</p>
<p>I already tried something like:</p>
<pre><code>org.hibernate.Session hSession =
( (EntityManagerImpl) em.getDelegate() ).getSession();
</code></pre>
<p>but as soon as I invoke a ... | 4,335,718 | 4 | 0 | null | 2010-12-02 13:35:35.837 UTC | 9 | 2012-02-29 19:05:39.35 UTC | 2011-01-22 09:36:25.907 UTC | null | 203,907 | null | 350,722 | null | 1 | 18 | java|hibernate|jpa|jakarta-ee|glassfish-3 | 21,135 | <p><a href="https://stackoverflow.com/questions/4335570/accessing-hibernate-session-from-ejb-using-entitymanager/4335608#4335608">Bozho</a> and <a href="https://stackoverflow.com/questions/4335570/accessing-hibernate-session-from-ejb-using-entitymanager/4335600#4335600">partenon</a> are correct, but:</p>
<p>In JPA 2, ... |
4,827,544 | java.lang.OutOfMemoryError: PermGen space | <p>i'm getting the following error
"http-9000-5" java.lang.OutOfMemoryError: PermGen space</p>
<p>org.apache.catalina.core.ApplicationDispatcher invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.OutOfMemoryError: PermGen space.</p>
<p>My application using axis2.I increased the heap size 1024m... | 18,443,635 | 5 | 1 | null | 2011-01-28 11:10:16.937 UTC | 5 | 2014-05-08 09:57:18.817 UTC | 2011-01-28 11:15:53.713 UTC | null | 260,990 | null | 538,678 | null | 1 | 12 | java|tomcat6|permgen | 57,099 | <p>If you're using Tomcat as a Server of Eclipse, go to Server view, then double click on Tomcat, then "Open Launch Configuration", go to Arguments tab, and after setting -Dcatalina.base="" put this</p>
<pre><code>-Xms256m -Xmx512m -XX:MaxPermSize=512m -XX:PermSize=128m
</code></pre> |
4,687,235 | jQuery $.get or $.post to catch page load error (eg. 404) | <p>How do you catch Server Error or 404 page not found, when you use $.get or $.post ?</p>
<p>For example:</p>
<pre><code>$.post("/myhandler", { value: 1 }, function(data) {
alert(data);
});
</code></pre>
<p>That will do absolutely nothing if there is a Server Error loading "/myhandler", or if it is not found.</p>... | 4,687,279 | 5 | 0 | null | 2011-01-14 01:39:21.877 UTC | 6 | 2015-10-27 05:32:30.533 UTC | null | null | null | null | 36,036 | null | 1 | 19 | jquery|post|get | 40,114 | <p>use <code>error</code> handler on <a href="http://api.jquery.com/jQuery.ajax/" rel="noreferrer"><code>$.ajax()</code></a> </p>
<pre><code>$.ajax({
url: "/myhandler",
data: {value: 1},
type: 'post',
error: function(XMLHttpRequest, textStatus, errorThrown){
alert('status:' + XMLHttpRequest.st... |
4,278,601 | What of Eclipse project .metadata can I safely ignore in Git/Mercurial? | <p>We have the code for an Eclipse RCP application in an Eclipse workspace containing multiple Java projects. We are using Mercurial with a simple .hgignore just *.class (but the same issue would pertain to Git).</p>
<p>Even a small change to the code can result in many of the files in .metadata getting changed. </p>
... | 4,278,711 | 5 | 2 | null | 2010-11-25 15:27:55.953 UTC | 21 | 2013-04-10 09:27:23.143 UTC | 2013-04-10 09:27:23.143 UTC | null | 651,104 | null | 459,675 | null | 1 | 42 | java|eclipse|git|mercurial|rcp | 48,203 | <p>The files i'm personally aware of are:</p>
<ul>
<li>version.ini (not very exciting)</li>
<li>.plugins/org.eclipse.jdt.core/variablesAndContainers.dat (classpath variables)</li>
<li>.plugins/org.eclipse.core.resources/.projects/*/.location (projects in the workspace)</li>
</ul>
<p>Somewhere, i have an Eclipse works... |
4,201,239 | In HTML5, is the localStorage object isolated per page/domain? | <p>Is the HTML5 localStorage object isolated per page/domain? I am wondering because of how I would name localStorage keys. Do I need a separate prefix? Or can I name them whatever I want?</p> | 4,201,249 | 5 | 2 | null | 2010-11-17 03:33:57.003 UTC | 29 | 2019-10-23 11:07:37.42 UTC | null | null | null | null | 423,325 | null | 1 | 214 | javascript|html|local-storage | 91,045 | <p>It's per domain and port (the same segregation rules as the <a href="http://en.wikipedia.org/wiki/Same-origin_policy#Origin_determination_rules" rel="noreferrer">same origin policy</a>), to make it per-page you'd have to use a key based on the <code>location</code>, or some other approach. </p>
<p>You don't <em>nee... |
4,471,041 | How to retrieve records for last 30 minutes in MS SQL? | <p>I want to retrieve records for last 30 minutes in a table. How to do that? Below is my query..</p>
<pre><code>select * from
[Janus999DB].[dbo].[tblCustomerPlay]
where DatePlayed < CURRENT_TIMESTAMP
and DatePlayed >
(CURRENT_TIMESTAMP-30)
</code></pre> | 4,471,066 | 6 | 0 | null | 2010-12-17 13:50:14.583 UTC | 6 | 2021-12-01 18:22:59.07 UTC | 2010-12-17 13:54:52.887 UTC | null | 397,952 | null | 144,250 | null | 1 | 57 | sql|sql-server|tsql | 150,064 | <p>Change this <code>(CURRENT_TIMESTAMP-30)</code></p>
<p>To This: <code>DateADD(mi, -30, Current_TimeStamp)</code></p>
<p>To get the current date use GetDate().</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms186819.aspx" rel="noreferrer">MSDN Link to DateAdd Function</a><br>
<a href="http://msdn.microso... |
4,840,102 | Why don't my south migrations work? | <p>First, I create my database.</p>
<pre><code>create database mydb;
</code></pre>
<p>I add "south" to installed Apps. Then, I go to this tutorial: <a href="http://south.aeracode.org/docs/tutorial/part1.html" rel="noreferrer">http://south.aeracode.org/docs/tutorial/part1.html</a></p>
<p>The tutorial tells me to do... | 4,840,262 | 6 | 3 | null | 2011-01-29 23:23:13.147 UTC | 97 | 2013-10-25 13:50:23.087 UTC | 2013-07-28 23:00:05.643 UTC | null | 1,451,443 | null | 179,736 | null | 1 | 78 | python|django|migration|django-south | 48,648 | <p>South allows you to create migrations when you first start out with a new app and the tables haven't been added to the database yet, as well as creating migrations for legacy apps that already have tables in the database. The key is to know when to do what. </p>
<p>Your first mistake was when you deleted your migra... |
14,859,058 | Why does the Segment.io loader script push method names/args onto a queue which seemingly gets overwritten? | <p>I've been dissecting the following code snippet, which is used to asynchronously load the <a href="https://segment.io" rel="noreferrer">Segment.io</a> analytics wrapper script:</p>
<pre><code>// Create a queue, but don't obliterate an existing one!
var analytics = analytics || [];
// Define a method that will asyn... | 14,965,470 | 1 | 0 | null | 2013-02-13 17:11:52.767 UTC | 8 | 2015-05-26 14:44:46.847 UTC | 2015-05-26 14:44:46.847 UTC | null | 884,123 | null | 43,140 | null | 1 | 10 | javascript|asynchronous|segment-io | 4,356 | <p>Ian here, co-founder at Segment.io—I didn't actually write that code, Calvin did, but I can fill you in on what it's doing.</p>
<p>You're right, the <code>methodFactory</code> is stubbing out the methods so that they are available before the script loads, which means people can call <code>analytics.track</code> wit... |
14,920,806 | Is it possible to onclick="history.clear();" | <p>I'm going to implement <strong>logout</strong> button in my PhoneGap application, which will return the user into authentication page (with cleared fields). For the button I'm using anchor with onclick event:</p>
<pre><code><script type="text/javascript">
function doLogout() {
var backlen = history.length... | 14,921,004 | 4 | 0 | null | 2013-02-17 11:55:36.453 UTC | 3 | 2018-10-22 15:49:19.783 UTC | 2013-02-17 12:41:08.553 UTC | null | 239,567 | null | 1,130,672 | null | 1 | 12 | javascript|cordova|logout | 67,360 | <p>The call to <code>history.go</code> will be ignored, because you are going back one more step than there are items in the history. The <code>length</code> property has the number of items including the current one, so if there are for example four items in the history, you can only go back three steps.</p>
<p>To go... |
14,711,796 | Publish local Git repository to Team Foundation Service | <p>About a week ago Git support was added to Visual Studio 2012 and Team Foundation Service. I've been playing around with it a bit and wanted to publish a local repository to my team project. It's described in step 2 on the Team Foundation Service <a href="http://tfs.visualstudio.com/en-us/learn/code/publish-new-team-... | 14,740,846 | 12 | 3 | null | 2013-02-05 16:08:00.527 UTC | 10 | 2017-02-11 04:14:36.29 UTC | 2013-02-05 21:27:01.733 UTC | null | 522,735 | null | 95,503 | null | 1 | 20 | visual-studio|git|tfs|azure-devops | 18,093 | <p>I was having the same problem. I don't know why.</p>
<p>However, after a bit of playing around, I managed to get the following
working. Disclaimer: can't guarantee this is actually the correct way
to do it. It may bork things further. And whether it does the same as what the missing 'Publish' menu item is su... |
14,848,924 | How to define typedef of function pointer which has template arguments | <p>I would like to make typedef for function pointer which has stl container as argument and this container has unknown type. Something like this:</p>
<pre><code>typedef void (* TouchCallBack)(GLRenderer*, const MotionEvent&, std::vector<T >);
</code></pre>
<p>it's possible? (especially in c++ 03) </p> | 14,848,966 | 1 | 3 | null | 2013-02-13 08:01:33.847 UTC | 12 | 2013-02-13 08:03:58.16 UTC | null | null | null | null | 284,720 | null | 1 | 22 | c++|templates|function-pointers|typedef | 16,624 | <p>I don't know of any C++03 solution exactly like that, and it's not built into the language, but in C++11, this is possible with <code>using</code> aliases:</p>
<pre><code>template<typename T>
using TouchCallBack = void (*)(GLRenderer*, const MotionEvent&, std::vector<T >);
</code></pre>
<p>One work... |
14,483,473 | Is there any JavaScript libraries for graph operations and algorithms? | <p>What I need is a JavaScript implementation of <a href="http://en.wikipedia.org/wiki/Graph_%28mathematics%29">pure mathematical graphs</a>. To be clear I DON'T mean graph visualization libraries like <a href="http://sigmajs.org/">sigma.js</a> or <a href="http://bl.ocks.org/4062045">d3.js</a>.</p>
<p>The library I'm ... | 34,881,445 | 7 | 1 | null | 2013-01-23 15:41:58.713 UTC | 8 | 2022-02-17 16:38:24.063 UTC | null | null | null | null | 638,546 | null | 1 | 30 | javascript|math|graph|graph-algorithm | 13,269 | <p>Now there is a library: <a href="https://github.com/cpettitt/graphlib" rel="noreferrer">graphlib</a></p>
<blockquote>
<p>Graphlib is a JavaScript library that provides data structures for undirected and directed multi-graphs along with algorithms that can be used with them.</p>
</blockquote>
<p>Implements:</p>
... |
14,473,321 | Generating random, unique values C# | <p>I've searched for a while and been struggling to find this, I'm trying to generate several random, unique numbers is C#. I'm using <code>System.Random</code>, and I'm using a <code>DateTime.Now.Ticks</code> seed:</p>
<pre><code>public Random a = new Random(DateTime.Now.Ticks.GetHashCode());
private void NewNumber()... | 14,473,371 | 17 | 5 | null | 2013-01-23 05:54:42.09 UTC | 11 | 2021-12-07 22:21:20.647 UTC | 2019-02-21 14:15:54.01 UTC | null | 3,917,754 | null | 2,002,690 | null | 1 | 38 | c#|.net|random|unique | 123,310 | <blockquote>
<p>I'm calling NewNumber() regularly, but the problem is I often get
repeated numbers.</p>
</blockquote>
<p><code>Random.Next</code> doesn't guarantee the number to be unique. Also your range is from 0 to 10 and chances are you will get duplicate values. May be you can setup a list of <code>int</code> and ... |
14,865,965 | jQuery find() method not working in AngularJS directive | <p>I am having trouble with angularjs directives finding child DOM elements with the injected angular element.</p>
<p>For example I have a directive like so:</p>
<pre class="lang-js prettyprint-override"><code>myApp.directive('test', function () {
return {
restrict: "A",
link: function (scope, elm... | 14,866,067 | 7 | 0 | null | 2013-02-14 00:43:45.247 UTC | 10 | 2016-02-03 19:17:01.963 UTC | 2016-02-03 19:17:01.963 UTC | null | 1,264,804 | null | 764,797 | null | 1 | 45 | javascript|angularjs|angularjs-directive | 132,100 | <p>From the <a href="http://docs.angularjs.org/api/angular.element">docs on <code>angular.element</code></a>:</p>
<blockquote>
<p><code>find()</code> - Limited to lookups by tag name</p>
</blockquote>
<p>So if you're not using jQuery with Angular, but relying upon its jqlite implementation, you can't do <code>elm.f... |
14,910,667 | How to use if statements in LESS | <p>I'm looking for some kind of if-statement to control the <code>background-color</code> of different <code>div</code> elements.</p>
<p>I have tried the below, but it doesn't compile</p>
<pre><code>@debug: true;
header {
background-color: (yellow) when (@debug = true);
#title {
background-color: (orange) ... | 14,916,419 | 4 | 1 | null | 2013-02-16 13:10:33.367 UTC | 22 | 2021-01-28 10:40:49.373 UTC | 2021-01-28 10:40:49.373 UTC | null | 10,698,741 | null | 433,685 | null | 1 | 68 | less | 111,290 | <p>LESS has <a href="http://lesscss.org/features/#css-guards-feature">guard expressions</a> for mixins, not individual attributes.</p>
<p>So you'd create a mixin like this:</p>
<pre><code>.debug(@debug) when (@debug = true) {
header {
background-color: yellow;
#title {
background-color: oran... |
14,404,704 | How do I replace a git submodule with another repo? | <p>How do I replace a git submodule with a different git repo?</p>
<p>Specifically, I have a submodule:</p>
<ul>
<li>located at <code>./ExternalFrameworks/TestFramework</code> that points to a git repo <code>git@github.com:userA/TestFramework.git</code> </li>
<li>I'd like it to now point to <code>git@github.com:userB... | 14,405,542 | 6 | 1 | null | 2013-01-18 17:52:39.323 UTC | 37 | 2022-06-13 04:15:59.263 UTC | 2017-05-23 12:02:13.08 UTC | null | -1 | null | 1,192,740 | null | 1 | 110 | git|git-submodules | 48,067 | <p>If the location (URL) of the submodule has changed, then you can simply:</p>
<ol>
<li>Modify the <code>.gitmodules</code> file in the repo root to use the new URL.</li>
<li>Delete the submodule folder in the repo <code>rm -rf .git/modules/<submodule></code>.</li>
<li>Delete the submodule folder in the working ... |
14,869,311 | Start/Stop and Restart Jenkins service on Windows | <p>I have downloaded "jenkins-1.501.zip" from <a href="http://jenkins-ci.org/content/thank-you-downloading-windows-installer">http://jenkins-ci.org/content/thank-you-downloading-windows-installer</a> . </p>
<p>I have extracted zip file and installed Jenkins on Windows 7 successfully. Jenkins runs at <code>http://local... | 14,869,398 | 9 | 0 | null | 2013-02-14 06:51:39.05 UTC | 37 | 2022-07-11 15:53:07.35 UTC | 2013-03-07 09:05:18.307 UTC | null | 617,450 | user2027659 | null | null | 1 | 118 | windows|command-line|console|jenkins|command-prompt | 411,198 | <p>Open Console/Command line --> Go to your Jenkins installation directory. Execute the following commands respectively:</p>
<p><strong>to stop:</strong><br>
<code>jenkins.exe stop</code></p>
<p><strong>to start:</strong><br>
<code>jenkins.exe start</code></p>
<p><strong>to restart:</strong><br>
<code>jenkins.exe re... |
2,930,315 | changing iframe source with jquery | <p>I've been trying this for a bit now and have looked at other answers to similar questions on SO, but when I am trying to change the src attribute of an iframe, it updates it for the whole window. Here is the following code I am using that works correctly (no jquery):</p>
<pre><code><html>
<head>
<sty... | 2,930,516 | 2 | 1 | null | 2010-05-28 15:34:19.963 UTC | 17 | 2021-02-08 23:26:33.49 UTC | 2017-05-23 12:10:35.467 UTC | null | -1 | null | 147,373 | null | 1 | 60 | jquery | 238,994 | <p>Should work.</p>
<p>Here's a working example:</p>
<p><a href="http://jsfiddle.net/rhpNc/" rel="noreferrer">http://jsfiddle.net/rhpNc/</a></p>
<p>Excerpt:</p>
<pre class="lang-js prettyprint-override"><code>function loadIframe(iframeName, url) {
var $iframe = $('#' + iframeName);
if ($iframe.length) {
... |
3,160,347 | Java: How initialize an array in Java in one line? | <pre><code>int[] array1 = {1, 2, 3, 4, 5, 6, ,7, 8}; - working
array1 = {1, 1, 1, 1, 2, 5, ,7, 8}; - NOT working
</code></pre>
<p>The first line is working, but second line is not working.</p>
<p>How can I make the initialization from the second line in one single line of code? </p> | 3,160,356 | 2 | 0 | null | 2010-07-01 17:50:39.09 UTC | 6 | 2017-01-11 13:25:47.637 UTC | null | null | null | null | 381,361 | null | 1 | 69 | java|arrays | 91,042 | <pre><code>array = new int[] {1, 1, 2, 3, 5, 8};
</code></pre>
<p>Source: <a href="http://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html" rel="noreferrer">Oracle JavaDocs - Arrays</a></p> |
41,052,598 | ReactJS Array.push function not working in setState | <p>I'm making a primitive quiz app with 3 questions so far, all true or false. In my <code>handleContinue</code> method there is a call to push the users input from a radio form into the <code>userAnswers</code> array. It works fine for the first run of <code>handleContinue</code>, after that it throws an error: <code>... | 41,052,943 | 6 | 0 | null | 2016-12-09 03:26:49.77 UTC | 0 | 2021-08-10 14:06:23.11 UTC | null | null | null | null | 6,351,303 | null | 1 | 10 | javascript|arrays|reactjs|state | 47,220 | <p><a href="https://facebook.github.io/react/docs/state-and-lifecycle.html#do-not-modify-state-directly" rel="noreferrer">Do not modify state directly!</a> In general, try to <a href="https://facebook.github.io/react/docs/optimizing-performance.html#the-power-of-not-mutating-data" rel="noreferrer">avoid mutation</a>.</... |
1,869,785 | Putting a div on a new line (problem caused by floating <ul> elements) | <p>So I have a 3 unordered lists like so:</p>
<pre><code> <ul class="menu">
<li class="heading">Title (Click To Download)</li>
<li><a title="Download sample.mp3" href="http://example.com/sample.mp3">Sample Song</a></li>
</ul>
</code></pre>
<p>With the following css sty... | 1,869,814 | 1 | 0 | null | 2009-12-08 20:58:18.693 UTC | 2 | 2009-12-08 21:02:02.393 UTC | null | null | null | null | 148,766 | null | 1 | 30 | html|css|internet-explorer|firefox | 55,342 | <pre><code>.pleasedontfloat {
clear:both;
}
</code></pre> |
53,853,815 | How to fix 'Cannot use namespace as a type ts(2709)' in typescript? | <p>I'm loading a third-party library called <code>sorted-array</code> and using it like this:</p>
<pre><code>import SortedArray from 'sorted-array';
export class Selector {
private mySortedArray!: SortedArray;
constructor() {
this.mySortedArray = new SortedArray();
}
}
</code></pre>
<p>However, I get this... | 53,855,886 | 4 | 0 | null | 2018-12-19 14:56:08.807 UTC | 3 | 2022-06-25 02:20:05.323 UTC | null | null | null | null | 355,567 | null | 1 | 22 | typescript | 39,701 | <p>You need to export it inside module declaration:</p>
<pre class="lang-js prettyprint-override"><code>declare module 'sorted-array' {
class SortedArray {
constructor(arr: number[]);
search(element: any): number;
}
export = SortedArray;
}
</code></pre> |
40,570,164 | How to customize the message "Changes you made may not be saved." for window.onbeforeunload? | <p>I am testing in Google Chrome.</p>
<p>I did some search and found that someone is using:</p>
<pre><code>window.onbeforeunload = function() {
if (hook) {
return "Did you save your stuff?"
}
}
</code></pre>
<p>But when I use it, I still got the "Changes you made may not be saved." message. How can I... | 40,570,214 | 2 | 1 | null | 2016-11-13 03:09:31.42 UTC | 4 | 2020-12-12 20:34:42.723 UTC | 2017-10-18 20:44:10.08 UTC | null | 206,730 | null | 1,661,640 | null | 1 | 28 | javascript|google-chrome | 29,541 | <p>You can't, the ability to do this was removed in Chrome 51. It is widely considered a security issue, and most vendors have removed support.</p>
<blockquote>
<h2><a href="https://www.chromestatus.com/feature/5349061406228480">Custom messages in onbeforeunload dialogs (removed)</a>:</h2>
<p>A window’s onbefor... |
33,844,290 | How to get Telegram channel users list with Telegram Bot API | <p>Anybody give a starter on how may I get information about users from my telegram bot. Imagine my bot in an admin user in my channel and I want to get my channel user list or to be noticed when a new user joins. How can I do that.
Telegram's documents are so unorganized.
So far I have looked at these:</p>
<ul>
<li><... | 44,552,356 | 6 | 0 | null | 2015-11-21 14:08:10.3 UTC | 9 | 2020-10-01 20:01:10.127 UTC | 2018-11-23 00:39:29.97 UTC | null | 147,057 | null | 2,674,938 | null | 1 | 26 | telegram|telegram-bot | 127,753 | <p>In order to get user list, you need to use telegram API. </p>
<p>Telegram API is fairly complicated. There are some clients which can get the job done much faster. </p>
<p>For python, there is <a href="https://github.com/LonamiWebs/Telethon" rel="noreferrer">Telethon</a>, and the method to get channel users is:</p... |
50,303,454 | How to use the new Material Design Icon themes: Outlined, Rounded, Two-Tone and Sharp? | <p>Google has revamped its <a href="https://material.io/tools/icons/?style=baseline" rel="noreferrer">Material Design Icons</a> with 4 new preset themes:</p>
<p><strong>Outlined, Rounded, Two-Tone and Sharp</strong>, in addition to the regular <strong>Filled/Baseline</strong> theme:</p>
<hr />
<p><em>But, unfortunately... | 51,415,409 | 15 | 0 | null | 2018-05-12 06:20:22.993 UTC | 87 | 2022-05-27 19:14:12.083 UTC | 2020-08-31 09:14:15.437 UTC | null | 5,740,428 | null | 7,364,168 | null | 1 | 261 | icons|material-design|google-material-icons | 193,345 | <h2>Update (31/03/2019) : All icon themes work via Google Web Fonts now.</h2>
<p>As pointed out by Edric, it's just a matter of adding the google web fonts link in your document's head now, like so:</p>
<pre class="lang-html prettyprint-override"><code><link href="https://fonts.googleapis.com/css?family=Materia... |
43,023,107 | How to connect Google Cloud SQL from Cloud Functions? | <p>I am trying to use <a href="https://firebase.google.com/docs/functions/" rel="noreferrer">Cloud Functions for Firebase</a> to build an API that talks with a Google Cloud SQL (PostgreSQL) instance.</p>
<p>I am using HTTP(S) trigger.</p>
<p>When I white-list my desktop's IP address, I can connect to the Cloud SQL wi... | 43,257,853 | 7 | 0 | null | 2017-03-25 23:23:35.09 UTC | 20 | 2021-08-23 14:42:20.213 UTC | 2017-03-26 04:06:59.033 UTC | null | 807,126 | null | 400,836 | null | 1 | 38 | javascript|firebase|google-cloud-platform|google-cloud-sql|google-cloud-functions | 29,230 | <p><strong>New Answer</strong>:</p>
<p>See other answers, it's now officially supported. <a href="https://cloud.google.com/functions/docs/sql" rel="nofollow noreferrer">https://cloud.google.com/functions/docs/sql</a></p>
<p><strong>Old Answer</strong>:</p>
<p>It's not currently possible. It is however a feature requ... |
28,969,455 | How to properly instantiate os.FileMode | <p>I have seen countless examples and tutorials that show how to create a file and all of them "cheat" by just setting the permission bits of the file. I would like to know / find out how to properly instantiate os.FileMode to provide to a writer during creation / updating of a file.</p>
<p>A crude example is this be... | 28,969,523 | 3 | 0 | null | 2015-03-10 16:47:09.613 UTC | 10 | 2022-08-18 21:54:10.647 UTC | 2020-05-08 15:48:56.99 UTC | null | 13,860 | null | 1,198,639 | null | 1 | 35 | go|int|file-permissions | 36,130 | <p><code>FileMode</code> is just a uint32. <a href="http://golang.org/pkg/os/#FileMode" rel="noreferrer">http://golang.org/pkg/os/#FileMode</a></p>
<p>Setting via constants isn't "cheating", you use it like other numeric values. If you're not using a constant, you can use a conversion on valid numeric values:</p>
<pr... |
36,321,899 | Mongorestore to a different database | <p>In MongoDB, is it possible to dump a database and restore the content to a different database? For example like this:</p>
<pre><code>mongodump --db db1 --out dumpdir
mongorestore --db db2 --dir dumpdir
</code></pre>
<p>But it doesn't work. Here's the error message:</p>
<blockquote>
<p>building a list of collections ... | 36,322,080 | 5 | 0 | null | 2016-03-31 00:00:55 UTC | 12 | 2022-02-25 17:48:05.213 UTC | 2020-06-20 09:12:55.06 UTC | null | -1 | null | 418,966 | null | 1 | 83 | mongodb|mongorestore | 55,931 | <p>You need to actually point at the <a href="https://docs.mongodb.org/manual/reference/program/mongorestore/#restore-a-collection" rel="noreferrer">"database name" container</a> directory "within" the output directory from the previous dump:</p>
<pre><code>mongorestore -d db2 dumpdir/db1
</code></pre>
<p>And usually... |
64,296,359 | How can I install pip for Python2.7 in Ubuntu 20.04 | <p>Is there any way that I can install "pip" for "Python2.7" ?
I could install python2.7 by</p>
<pre><code>sudo apt install python2-minimal
</code></pre>
<p>I tried installing pip for this.</p>
<pre><code>sudo apt install python-pip / python2-pip / python2.7-pip
</code></pre>
<p>but none worked. Can... | 64,297,311 | 2 | 0 | null | 2020-10-10 17:33:36.077 UTC | 10 | 2022-08-13 02:00:13.207 UTC | 2020-12-03 11:41:28.13 UTC | null | 1,000,551 | null | 4,472,576 | null | 1 | 21 | python|python-2.7|pip|ubuntu-20.04 | 44,625 | <p>Pip for Python 2 is not included in the Ubuntu 20.04 repositories.</p>
<p>Try <a href="https://linuxize.com/post/how-to-install-pip-on-ubuntu-20.04/" rel="noreferrer">this guide</a> which suggests to fetch a Python 2.7 compatible <code>get_pip.py</code> and use that to bootstrap <code>pip</code>.</p>
<pre><code>curl... |
26,414,880 | Create drop down list in input-box | <p>I'm creating a task list for our team, and to enter new tasks i've created input-boxes.
There are only 5 departments that should be entered in the "department question"
Te prevent people from entering a wrong department name, i would like to use that input-box a drop down list. </p>
<p>I've searched the net, but c... | 26,416,093 | 2 | 0 | null | 2014-10-16 22:21:28.017 UTC | null | 2021-03-06 14:01:58.62 UTC | 2014-10-16 22:46:58.997 UTC | null | 2,165,759 | null | 3,939,900 | null | 1 | 0 | excel|vba | 42,811 | <p>I have created a form in excel in stead of using input box.
For the selection of department i created a combo-box with the correct departments:</p>
<pre><code>Private Sub Newaction_Click()
Sheets("DO NOT DELETE").Rows("30:30").Copy
Rows("14:14").Select
Range("C14").Activate
Selection.Insert Shift:=... |
28,027,236 | Blade: escaping text and allowing new lines | <p>I have a user-input text displayed on one of the pages. I want to allow new lines, though. How do I display the text, so it is <strong>escaped</strong> AND <strong>allows new lines</strong>?</p>
<p>I used <code>nl2br()</code> and Blade's tripple brackets <code>{{{$text}}}</code>, however, obviously, the tripple bra... | 28,027,358 | 3 | 0 | null | 2015-01-19 14:47:13.51 UTC | 13 | 2020-02-26 20:20:38.873 UTC | null | null | null | null | 2,890,610 | null | 1 | 58 | php|laravel|escaping|laravel-blade | 52,258 | <p>You can do the escaping first, using <code>e()</code> and then apply <code>nl2br()</code>:</p>
<pre><code>{{ nl2br(e($text)) }}
</code></pre>
<p><code>e()</code> is the function Blade uses when compiling triple brackets</p> |
26,941,529 | Swift: testing against optional value in switch case | <p>In Swift, how can I write a case in a switch statement that tests the value being switched against the contents of an <em>optional</em>, skipping over the case if the optional contains <code>nil</code>?</p>
<p>Here's how I imagine this might look:</p>
<pre><code>let someValue = 5
let someOptional: Int? = nil
swit... | 26,941,591 | 4 | 0 | null | 2014-11-15 01:30:44.623 UTC | 14 | 2022-06-08 09:48:28.1 UTC | 2017-11-17 17:37:03.177 UTC | null | 5,175,709 | null | 2,680,007 | null | 1 | 112 | swift|enums|switch-statement|option-type | 48,724 | <p>Optional is just a <code>enum</code> like this:</p>
<pre><code>enum Optional<T> : Reflectable, NilLiteralConvertible {
case none
case some(T)
// ...
}
</code></pre>
<p>So you can match them as usual <a href="https://developer.apple.com/library/ios/documentation/swift/conceptual/Swift_Programming_L... |
2,505,435 | Good jQuery pagination plugin to use with JSON data | <p>I am looking for a good jQuery pagination plugin to use in my aspx page.</p>
<p>I have the following parameters.
<code>currentpage, pagesize, TotalRecords, NumberofPages</code>. I would like my plugin to do the same as Stack Overflow paging.</p>
<p><strong>EDIT:</strong>
It should paginate through JSON data.</p>
... | 2,546,799 | 1 | 2 | null | 2010-03-24 05:00:05.917 UTC | 10 | 2019-07-05 16:04:02.907 UTC | 2019-07-05 16:04:02.907 UTC | null | 4,751,173 | null | 207,556 | null | 1 | 9 | jquery|plugins|pagination | 23,606 | <p>Duplicate question, duplicate anwser...</p>
<p>You can use the jQuery Pagination plugin:</p>
<p><a href="http://d-scribe.de/webtools/jquery-pagination/demo/demo_options.htm" rel="noreferrer">http://d-scribe.de/webtools/jquery-pagination/demo/demo_options.htm</a></p>
<p>(Download it <a href="http://plugins.jquery.... |
3,054,612 | How to vectorize R strsplit? | <p>When creating functions that use <code>strsplit</code>, vector inputs do not behave as desired, and <code>sapply</code> needs to be used. This is due to the list output that <code>strsplit</code> produces. Is there a way to vectorize the process - that is, the function produces the correct element in the list for ea... | 3,054,644 | 1 | 0 | null | 2010-06-16 15:14:31.757 UTC | 9 | 2015-05-18 02:00:59.043 UTC | 2015-05-18 02:00:59.043 UTC | null | 202,229 | null | 269,476 | null | 1 | 15 | r|vectorization|strsplit | 14,186 | <p>In general, you should try to use a vectorized function to begin with. Using <code>strsplit</code> will frequently require some kind of iteration afterwards (which will be slower), so try to avoid it if possible. In your example, you should use <code>nchar</code> instead:</p>
<pre><code>> nchar(words)
[1] 1 5 ... |
6,238,232 | How to clear the entire console window? | <p>I am making a console window RPG, yet I'm having problems clearing the entire console window. Is there a way for me to clear the entire console window with one command?</p> | 6,238,239 | 1 | 0 | null | 2011-06-04 17:18:16.19 UTC | 6 | 2020-07-04 13:16:47.563 UTC | 2020-07-04 13:16:47.563 UTC | null | 8,422,953 | null | 784,125 | null | 1 | 36 | c#|console|window | 57,137 | <p>You can use the <a href="http://msdn.microsoft.com/en-us/library/system.console.clear.aspx">Clear()</a> method:</p>
<pre><code>Console.Clear();
</code></pre> |
44,805,984 | Golang interface to struct | <p>I have a function that has a parameter with the type interface{}, something like:</p>
<pre><code>func LoadTemplate(templateData interface{}) {
</code></pre>
<p>In my case, templateData is a struct, but each time it has a different structure. I used the type "interface{}" because it allows me to send all kind of da... | 44,813,472 | 4 | 1 | null | 2017-06-28 14:53:44.763 UTC | 6 | 2019-05-05 12:22:23.043 UTC | 2017-06-29 09:25:15.477 UTC | null | 6,375,113 | null | 1,564,840 | null | 1 | 9 | go|struct|interface | 64,271 | <p>Adrian is correct. To take it a step further, you can only do anything with interfaces if you know the type that implements that interface. The empty interface, <code>interface{}</code> isn't really an "anything" value like is commonly misunderstood; it is just an interface that is immediately satisfied by all types... |
48,429,390 | Firebase deploy errors starting with non-zero exit code (space in project path) | <p>I was having issues with firebase deploy command recently. After firebase deploy command all others were being deployed except firebase (storage, database etc) So I decided to reinstall firebase to fix this situation but after reinstall my problem got bigger. Now none of them are deployed with the following error:</... | 48,430,314 | 17 | 0 | null | 2018-01-24 18:33:43.487 UTC | 8 | 2022-09-16 04:11:08.653 UTC | 2018-06-24 03:29:30.76 UTC | null | 7,379,765 | null | 4,688,845 | null | 1 | 34 | node.js|firebase|google-cloud-functions|firebase-cli | 41,553 | <p>The error stems from the fact that you have a space somewhere in the path of your project ("Google Drive"):</p>
<pre><code>C:\Users\faruk\Google Drive\Android\firebase\1\$RESOURCE_DIR\package.json
</code></pre>
<p>Unfortunately, this is confusing the npm command line, and it's taking that as two arguments separate... |
21,122,842 | What's the difference between synchronous and asynchronous calls in Objective-C, versus multi-threading? | <p>For the longest time I thought asynchronous was synonymous to running something on a background thread, while synchronous meant on the main thread (blocking UI updates and interactions). I understand that not running on the main thread for expensive actions is because it doesn't allow UI actions to occur as the main... | 21,123,301 | 6 | 0 | null | 2014-01-14 20:01:01.237 UTC | 44 | 2018-07-16 06:26:15.407 UTC | null | null | null | null | 998,117 | null | 1 | 58 | ios|objective-c|multithreading|asynchronous|grand-central-dispatch | 82,589 | <p>When you invoke something synchronously, it means that the thread that initiated that operation will wait for the task to finish before continuing. Asynchronous means that it will not wait.</p>
<p>Having said that, when people suggest that you perform some slow or expensive process asynchronously, they are implicit... |
49,475,177 | Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified | <p>I have created a basic spring boot application from <strong>SPRING INITIALIZR</strong> with the Web, MongoDB and JPA dependencies. </p>
<p>When I try to run the spring boot application I am getting the following exception:</p>
<pre><code>Error starting ApplicationContext. To display the conditions report re-run yo... | 49,475,397 | 13 | 0 | null | 2018-03-25 11:14:36.067 UTC | 15 | 2022-03-29 06:07:01.503 UTC | 2018-04-11 13:03:42.843 UTC | null | 7,855,784 | null | 7,855,784 | null | 1 | 50 | java|spring|mongodb|spring-boot|spring-data-jpa | 149,227 | <p>Since you have added both mongodb and data-jpa dependencies in your pom.xml file, it was creating a dependency conflict like below</p>
<pre><code><dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<depen... |
34,763,090 | Bootstrap 4 with remote Modal | <p>I can't make the Modal work in the remote mode with the new Twitter Bootstrap release : Bootstrap 4 alpha. It works perfectly fine with Bootstrap 3. With bootstrap 4 I am getting the popup window, but the model body is not getting loaded. There is no remote call being made to <code>myRemoteURL.do</code> to load the ... | 34,763,263 | 6 | 0 | null | 2016-01-13 09:40:16.7 UTC | 11 | 2020-12-16 00:02:52.593 UTC | 2018-02-22 18:13:10.58 UTC | null | 171,456 | null | 2,032,823 | null | 1 | 40 | jquery|css|twitter-bootstrap|bootstrap-4 | 60,156 | <p>Found the problem: <a href="https://getbootstrap.com/docs/3.4/javascript/#modals-options" rel="noreferrer">They have removed the remote option in bootstrap 4</a></p>
<blockquote>
<p><strong>remote</strong> : This option is deprecated since v3.3.0 and will be removed in v4. We recommend instead using client-side t... |
54,892,546 | Unit Testing Jest in Reactjs Component state | <p>Hello :) I'm starting to learn <strong>Unit Testing</strong> using <strong>JEST & Enzyme</strong></p>
<p>on my version (already done) of "Color Guessing Game" using with <strong>Reactjs</strong>,
but when I started to test my Square Component I can't even test my color state value and my color state when click... | 54,892,856 | 1 | 0 | null | 2019-02-26 19:15:16.95 UTC | 1 | 2022-07-30 07:31:24.037 UTC | 2019-02-26 21:59:13.247 UTC | null | 2,071,697 | null | 10,327,790 | null | 1 | 9 | reactjs|unit-testing|jestjs|enzyme | 44,538 | <p>Well, you're not so far from the solution. :)</p>
<p>The only issue is that between the parentheses in the expression <code>wrapper.state()</code>, you don't pass any argument - that's why you receive the whole object instead of a single value. That being said, you should do the following in this case:</p>
<pre><c... |
67,185,817 | Package.resolved file is corrupted or malformed | <p>I have a build error saying that all my SPM packages are missing. I decided to remove and re-add each package to the project, but each attempt at adding a package gives me the following error:</p>
<blockquote>
<p>Package.resolved file is corrupted or malformed; fix or delete the file to continue</p>
</blockquote>
<p... | 69,389,411 | 9 | 0 | null | 2021-04-20 20:20:01.587 UTC | 11 | 2022-08-20 13:56:19.413 UTC | 2022-07-12 18:16:41.597 UTC | null | 1,265,393 | null | 1,102,687 | null | 1 | 65 | xcode|swift-package-manager | 31,692 | <p>I tried the solution suggested by Maxwell above but it didn't resolve the problem for me.</p>
<p>The error appeared with Xcode 12 but upgrading to Xcode 13 didn't fix it either.</p>
<p>Instead, I decided to take Xcode at its word and delete the Package.resolved file. But where is it? I did this:</p>
<ol>
<li><p>In F... |
39,390,160 | pandas.factorize on an entire data frame | <p><a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.factorize.html" rel="noreferrer"><code>pandas.factorize</code></a> encodes input values as an enumerated type or categorical variable. </p>
<p>But how can I easily and efficiently convert many columns of a data frame? What about the reverse mappi... | 39,390,208 | 3 | 0 | null | 2016-09-08 11:50:52.33 UTC | 25 | 2018-02-26 11:26:41.483 UTC | null | null | null | null | 626,537 | null | 1 | 24 | python|pandas|dataframe|machine-learning | 28,617 | <p>You can use <code>apply</code> if you need to <code>factorize</code> each column separately:</p>
<pre><code>df = pd.DataFrame({'A':['type1','type2','type2'],
'B':['type1','type2','type3'],
'C':['type1','type3','type3']})
print (df)
A B C
0 type1 type1 type1... |
3,216,440 | Probabilistic Generation of Semantic Networks | <p>I've studied some simple semantic network implementations and basic techniques for parsing natural language. However, I haven't seen many projects that try and bridge the gap between the two.</p>
<p>For example, consider the dialog:</p>
<pre><code>"the man has a hat"
"he has a coat"
"what does he have?" => "a h... | 3,218,352 | 3 | 0 | null | 2010-07-09 20:47:16.163 UTC | 10 | 2010-07-10 08:24:55.823 UTC | null | null | null | null | 247,542 | null | 1 | 10 | machine-learning|data-mining|nlp | 745 | <p>There is quite a lot of history behind this kind of task. Your best start is probably by looking at <a href="http://en.wikipedia.org/wiki/Question_answering" rel="nofollow noreferrer">Question Answering</a>. </p>
<p>The general advice I always give is that if you have some highly restricted domain where you know ab... |
3,119,280 | Assistance need to get Spring MVC project going with IntelliJ IDEA | <p>So I downloaded a trial of idea ultimate, and I want to get spring mvc going with tomcat.</p>
<p>So I setup a new project, configured it to use sun jdk.</p>
<p>I chose a spring application, and it created and downloaded the following:</p>
<p><a href="https://i.stack.imgur.com/Vfk3D.png" rel="nofollow noreferrer">... | 3,120,301 | 3 | 0 | null | 2010-06-25 15:29:06.793 UTC | 11 | 2019-07-31 07:58:21.85 UTC | 2019-07-31 07:58:21.85 UTC | null | 4,751,173 | null | 39,677 | null | 1 | 12 | java|spring|spring-mvc|intellij-idea | 17,467 | <p>I find that the best way to start a new IDEA project is to use the Maven. This allows you to easily build your project without launching the IDE, automatically maintaining all libraries for you.</p>
<p>"Create project from scratch", then select "Maven module" in the next screen. Click on "Create from archetype" and... |
2,686,320 | How to put a newline into a column header in an xtable in R | <p>I have a dataframe that I am putting into a <a href="http://www.stat.uni-muenchen.de/~leisch/Sweave/" rel="noreferrer">sweave</a> document using xtable, however one of my column names is quite long, and I would like to break it over two lines to save space</p>
<pre><code>calqc_table<-structure(list(RUNID = c(1L,... | 2,687,142 | 3 | 2 | null | 2010-04-21 20:28:58.367 UTC | 11 | 2022-08-10 13:35:15.493 UTC | 2010-04-23 15:35:16.14 UTC | null | 135,870 | null | 74,658 | null | 1 | 19 | r|latex|tex|sweave|xtable | 7,822 | <p>The best way I have found to do this is to indicate the table column as a "fixed width" column so that the text inside it wraps. With the <code>xtable</code> package, this can be done with:</p>
<pre><code>align( calqc_xtable ) <- c( 'l', 'p{1.5in}', rep('c',5) )
</code></pre>
<p><code>xtable</code> demands tha... |
2,484,806 | Accessing Textboxes in Repeater Control | <p>All the ways I can think to do this seem very hackish. What is the right way to do this, or at least most common?</p>
<p>I am retrieving a set of images from a LINQ-to-SQL query and databinding it and some other data to a repeater. I need to add a textbox to each item in the repeater that will let the user change... | 2,484,837 | 3 | 1 | null | 2010-03-20 21:16:18.377 UTC | 6 | 2012-12-13 23:19:08.957 UTC | 2010-03-20 22:57:34.487 UTC | null | 452,047 | null | 452,047 | null | 1 | 25 | c#|asp.net|textbox|repeater | 47,000 | <p>Have you tried something like following on the button click:-</p>
<pre><code>foreach (RepeaterItem item in Repeater1.Items)
{
TextBox txtName= (TextBox)item.FindControl("txtName");
if(txtName!=null)
{
//do something with txtName.Text
}
Image img= (Image)item.FindControl("Img");
... |
2,647,786 | Landscape Mode ONLY for iPhone or iPad | <p>I want to create an application that doesn't use Portrait mode.</p>
<p>I am not sure if I need to edit the plist or have code in addition to the plist</p> | 2,647,807 | 4 | 0 | null | 2010-04-15 17:59:54.643 UTC | 14 | 2015-12-03 08:20:49.067 UTC | 2010-04-15 19:48:12.52 UTC | null | 30,461 | null | 317,785 | null | 1 | 37 | iphone|objective-c|cocoa-touch|uikit|ipad | 38,850 | <p><a href="http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ApplicationEnvironment/ApplicationEnvironment.html" rel="noreferrer">Code found here</a></p>
<blockquote>
<p>Launching in Landscape Mode</p>
<p>Applications in iPhone OS normally
launch in portrait m... |
2,527,845 | How to do calendar operations in Java GWT? How to add days to a Date? | <p>Since GWT does not provide the GregorianCalendar class, how to do calendar operations on the client?</p>
<p>I have a Date <code>a</code> and I want the Date, which is <code>n</code> days after <code>a</code>.</p>
<p>Examples:</p>
<pre><code>a (2000-01-01) + n (1) -> 2000-01-02
a (2000-01-01) + n (31) -> 200... | 5,384,777 | 4 | 0 | null | 2010-03-27 01:55:16.073 UTC | 7 | 2012-06-25 14:26:31.893 UTC | null | null | null | null | 176,336 | null | 1 | 49 | java|gwt | 38,643 | <p>Updated answer for GWT 2.1</p>
<pre><code>final Date dueDate = new Date();
CalendarUtil.addDaysToDate(dueDate, 21);
</code></pre>
<p>Edit: the fully qualified name of this class is <a href="http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/google/gwt/user/datepicker/client/CalendarUtil.html" rel="nor... |
2,597,098 | Get the last N rows in the database in order? | <p>Let's say I have the following database table:</p>
<pre><code> record_id | record_date | record_value
-----------+-------------+--------------
1 | 2010-05-01 | 195.00
2 | 2010-07-01 | 185.00
3 | 2010-09-01 | 175.00
4 | 2010-05-01 | 189.00
5 | ... | 2,597,100 | 4 | 0 | null | 2010-04-08 02:04:02.293 UTC | 8 | 2022-07-11 07:01:37.313 UTC | null | null | null | null | 1,497,409 | null | 1 | 69 | postgresql | 100,919 | <p>Why don't you just order the opposite way?</p>
<pre><code>SELECT *
FROM mytable
ORDER BY record_date
DESC LIMIT 5;
</code></pre>
<p>If you don't want to flip back correctly in the application, you can nest a query and flip them twice:</p>
<pre><code>SELECT *
FROM (SELECT *
FROM mytable
O... |
36,546,860 | Require nodejs "child_process" with TypeScript, SystemJS and Electron | <p>I'm working on a simple nodejs <a href="http://electron.atom.io/" rel="noreferrer">electron</a> (formerly known as atom shell) project.
I'm writing it using angular 2, using the project the same project setup as they recommend in the documentation for typescript:</p>
<p>tsc:</p>
<pre><code>{
"compilerOptions": {... | 36,549,645 | 3 | 0 | null | 2016-04-11 11:02:22.253 UTC | 2 | 2020-10-04 15:56:57.47 UTC | 2016-04-14 09:56:55.82 UTC | null | 2,436,109 | null | 1,245,668 | null | 1 | 22 | node.js|typescript|require|electron|systemjs | 38,814 | <p><em>Ok, after some research <a href="https://github.com/systemjs/systemjs/blob/8703bf0f93c20a6e6a7ad976a5a49a0c4cedc2ec/lib/core.js#L138" rel="noreferrer">#L138</a> I have found the solution</em></p>
<p>You can use <code>import</code> as before</p>
<pre><code>import * as child from 'child_process';
var foo: child... |
51,197,940 | 'File name differs from already included file name only in casing' on relative path with same casing | <blockquote>
<p>Error TS1149: File name 'C:/Project/frontend/scripts/State.ts' differs from already included file name '../frontend/scripts/State.ts' only in casing.</p>
</blockquote>
<p>I've triple checked the casing in our references and the actual files have the correct casing as well. As far as I can tell, this ... | 51,213,274 | 19 | 1 | null | 2018-07-05 18:40:09.15 UTC | 9 | 2022-08-11 02:53:48.78 UTC | null | null | null | null | 1,982,313 | null | 1 | 130 | javascript|windows|typescript|compiler-errors | 100,402 | <p>The answer was that we were using tisfy 1.0.1, when <code>forceConsistentCasingInFileNames</code> wasn't supported until 4.0.0. Updating fixed the issue.</p> |
1,249,205 | How to get the request context in a freemaker template in spring | <p>How to get the request context path in <code>freemarker</code> template when using with <code>spring</code>?</p>
<p>My view resolver is like this</p>
<pre><code> <bean id="freeMarkerViewResolver" class="learn.common.web.view.FreemarkerViewResolver">
<property name="order" value="1" />
... | 1,249,213 | 2 | 0 | null | 2009-08-08 15:57:46.027 UTC | 4 | 2018-02-28 07:12:21.27 UTC | 2018-02-28 07:12:21.27 UTC | null | 184,792 | null | 114,251 | null | 1 | 29 | spring|spring-mvc|freemarker | 19,320 | <p>In your view resolver you can add the following property</p>
<pre><code><property name="requestContextAttribute" value="rc"/>
</code></pre>
<p>Then in your freemarker template you can get the request context patch like </p>
<pre><code>${rc.getContextPath()}
</code></pre> |
986,183 | Mocking The RouteData Class in System.Web.Routing for MVC applications | <p>I'm trying to test some application logic that is dependent on the Values property in ControllerContext.RouteData. </p>
<p>So far I have</p>
<pre><code>// Arrange
var httpContextMock = new Mock<HttpContextBase>(MockBehavior.Loose);
var controllerMock = new Mock<ControllerBase>(MockBehavior.Loose);
va... | 986,276 | 2 | 0 | null | 2009-06-12 11:30:03.133 UTC | 8 | 2009-06-12 12:23:03.117 UTC | null | null | null | null | 5,170 | null | 1 | 35 | c#|asp.net-mvc|moq | 16,933 | <p>RouteData also has a <a href="http://msdn.microsoft.com/en-us/library/cc680271.aspx" rel="noreferrer">constructor that takes no arguments</a>. Simply create one and add the values to it that you want. No need to mock it when you can create one.</p>
<pre><code> var routeData = new RouteData();
routeData.Values.Ad... |
2,902,640 | Android: Get the screen resolution / pixels as integer values | <p>this is a really simple question on which I've found no answer :/
How can I quickly access the screen resolution (width, height) as integer values?</p>
<p>I've tried this one, but it always shows zero on my emulator:</p>
<pre><code>DisplayMetrics dm = new DisplayMetrics();
int width = dm.widthPixels / 2;
</code></... | 2,902,701 | 5 | 2 | null | 2010-05-25 07:03:26.09 UTC | 9 | 2015-10-29 07:14:01.023 UTC | null | null | null | null | 317,301 | null | 1 | 11 | android|resolution | 54,497 | <p>The easiest way will be to implement <a href="http://developer.android.com/reference/android/view/View.html#onSizeChanged%28int,%20int,%20int,%20int%29" rel="nofollow noreferrer">onSizeChanged</a>. You are probably getting a value of 0 because the view hasn't initialized yet. You can't call the above code in the Vi... |
2,517,245 | Why, really, deleting an incomplete type is undefined behaviour? | <p>Consider this classic example used to explain what <em>not</em> to do with forward declarations:</p>
<pre><code>//in Handle.h file
class Body;
class Handle
{
public:
Handle();
~Handle() {delete impl_;}
//....
private:
Body *impl_;
};
//---------------------------------------
//in Handle... | 2,517,455 | 6 | 0 | null | 2010-03-25 16:13:49.49 UTC | 8 | 2014-08-12 09:22:15.57 UTC | 2014-08-12 09:22:15.57 UTC | null | 2,246,344 | null | 41,789 | null | 1 | 29 | c++|memory-management|destructor|forward-declaration|delete-operator | 10,832 | <p>To combine several answers and add my own, without a class definition the calling code doesn't know:</p>
<ul>
<li>whether the class has a declared destructor, or if the default destructor is to be used, and if so whether the default destructor is trivial,</li>
<li>whether the destructor is accessible to the calling... |
3,115,537 | Java compilation errors limited to 100 | <p>I have a Java file,which when I compiled, I will be able to see only first 100 errors on console after that java compiler(javac) exits. How will I be able to see all the compilation errors on console?
Thanks in advance- opensid </p> | 3,115,546 | 8 | 6 | null | 2010-06-25 04:27:33.86 UTC | 8 | 2017-05-30 22:37:27.407 UTC | 2010-06-25 13:53:29.087 UTC | null | 21,234 | null | 327,765 | null | 1 | 39 | java|javac | 15,015 | <p>Generally the compiler will give up after 100 errors. Most of the errors after this point will likely be caused by one of the first errors. If you must have more errors check out the javac options <code>-Xmaxerrs</code> and <code>-Xmaxwarns</code></p> |
2,648,074 | How to convert "0" and "1" to false and true | <p>I have a method which is connecting to a database via Odbc. The stored procedure which I'm
calling has a return value which from the database side is a 'Char'. Right now I'm grabbing
that return value as a string and using it in a simple if statement. I really don't like the idea
of comparing a string like this whe... | 2,648,080 | 9 | 0 | null | 2010-04-15 18:44:17.873 UTC | 6 | 2019-01-07 17:21:05.93 UTC | 2014-06-10 20:56:11.97 UTC | null | 121,363 | null | 121,363 | null | 1 | 99 | c#|.net|asp.net|odbc|boolean-logic | 219,204 | <p>How about:</p>
<pre><code>return (returnValue == "1");
</code></pre>
<p>or as suggested below:</p>
<pre><code>return (returnValue != "0");
</code></pre>
<p>The correct one will depend on what you are looking for as a success result. </p> |
3,034,054 | When to use Spring Integration vs. Camel? | <p>As a seasoned Spring user I was assuming that Spring Integration would make the most sense in a recent project requiring some (JMS) messaging capabilities (<a href="https://stackoverflow.com/questions/3012802/how-to-leverage-spring-integration-in-a-real-world-jms-distributed-architecture">more details</a>). After so... | 3,034,150 | 11 | 1 | null | 2010-06-13 21:45:42.783 UTC | 64 | 2020-06-12 09:40:14.703 UTC | 2017-05-23 10:31:34.033 UTC | null | -1 | null | 267,001 | null | 1 | 163 | java|jms|messaging|apache-camel|spring-integration | 94,961 | <p>We choose Camel over Spring-Integration because the fluent API is really nice. We actually use it in Spring projects and use Spring to configure part of it. The programming API's are clear and there is a large set of sensible components. </p>
<p>We did a small scale shootout and basically at that time for our requi... |
3,043,978 | How to check if a process id (PID) exists | <p>In a bash script, I want to do the following (in pseudo-code):</p>
<pre><code>if [ a process exists with $PID ]; then
kill $PID
fi
</code></pre>
<p>What's the appropriate expression for the conditional statement?</p> | 3,044,045 | 11 | 2 | null | 2010-06-15 09:30:26.743 UTC | 62 | 2022-07-04 17:35:48.383 UTC | 2018-04-21 03:52:38.12 UTC | null | 6,862,601 | null | 183,579 | null | 1 | 233 | bash|process|pid | 350,897 | <p>To check for the existence of a process, use</p>
<pre><code>kill -0 $pid
</code></pre>
<p>But just as <a href="https://stackoverflow.com/a/3043991/4575793">@unwind said</a>, if you want it to terminate in any case, then just</p>
<pre><code>kill $pid
</code></pre>
<p>Otherwise you will have a race condition, where th... |
3,068,843 | Permission to view, but not to change! - Django | <p>is it possible to give users the permission to view, but not to change or delete.</p>
<p>currently in the only permissions I see are "add", "change" and "delete"... but there is no "read/view" in there.</p>
<p>I really need this as some users will only be able to consult the admin panel, in order to see what has b... | 5,364,408 | 12 | 2 | null | 2010-06-18 10:30:39.027 UTC | 12 | 2021-03-25 15:53:15.997 UTC | 2016-05-11 22:30:26.6 UTC | null | 895,245 | null | 208,827 | null | 1 | 27 | python|django|django-admin | 26,326 | <p><strong>Update</strong>: Since Django 2.1 <a href="https://docs.djangoproject.com/en/2.1/releases/2.1/#model-view-permission" rel="nofollow noreferrer">this is now built-in</a>.</p>
<p>In admin.py</p>
<pre><code># Main reusable Admin class for only viewing
class ViewAdmin(admin.ModelAdmin):
"""
Custom mad... |
23,727,255 | Multiple checkMark when row selected in UITableView IOS | <p>I have a <code>UITableView</code> that displays checkmarks when a row is selected. The problem is that When i select a row in <code>didSelectRowAtIndexPath</code> and add a checkmark on the selected row it adds an additional checkmark. Here's my code </p>
<p>Any help would be very much appreciated.</p>
<pre><code>... | 23,727,615 | 2 | 0 | null | 2014-05-18 21:53:59.767 UTC | 11 | 2015-08-10 09:22:17.133 UTC | 2014-05-18 22:15:55.39 UTC | null | 235,700 | null | 3,476,711 | null | 1 | 15 | ios|objective-c|uitableview|didselectrowatindexpath | 24,317 | <p><code>[self.tableView cellForRowAtIndexPath:indexPath]</code> call in the <code>didSelectRowAtIndexPath</code> will not return the exact cell. It can be same cell, new cell or reused cell. If it is a reused cell at its accessory view has a checkmark, you will end up having two cells with checkmark.</p>
<p>Its bette... |
45,696,685 | Search input with an icon Bootstrap | <p>No clue how I can do this, since BS 4 doesn't support glyphicons. Do I set it up as a background or do I apply different positioning to a font-awesome icon? </p>
<p>This is my code so far:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code"... | 45,696,757 | 6 | 0 | null | 2017-08-15 15:57:42.497 UTC | 25 | 2021-05-21 14:54:46.243 UTC | 2021-04-30 11:45:53.5 UTC | null | 171,456 | null | 6,753,772 | null | 1 | 54 | css|twitter-bootstrap|bootstrap-4|font-awesome | 200,939 | <p><strong>Bootstrap 5 Beta - (update 2021)</strong></p>
<pre><code> <div class="input-group">
<input class="form-control border-end-0 border rounded-pill" type="text" value="search" id="example-search-input">
<span class="... |
10,375,858 | How to "slice" an std_logic_vector in VHDL? | <p>I'm developing a little thing in VHDL and am quite new to it. I'm having trouble figuring out how to slice a bigger std_logic_vector into a smaller one. </p>
<p>For instance I have 3 signals:</p>
<pre><code>signal allparts: std_logic_vector(15 downto 0);
signal firstpart: std_logic_vector(7 downto 0);
signal secon... | 10,376,420 | 1 | 0 | null | 2012-04-29 20:48:12.33 UTC | 3 | 2012-04-29 22:05:56.54 UTC | null | null | null | null | 69,742 | null | 1 | 24 | syntax|vhdl | 54,829 | <p>You can directly assign them:</p>
<pre><code>firstpart <= allparts(15 downto 8);
secondpart <= allparts(7 downto 0);
</code></pre>
<p>...or if firstpart and secondpart are simply alternate ways to refer to part of the allparts signal, you may want to use an alias:</p>
<pre><code>alias firstpart is allparts(... |
10,501,358 | Objective C - getting line number or full stack trace from debugger error? | <p>Is it possible to get a line number for the source code (or anything that helps debug where the problem is) from the debugger, that shows where the problem is originating?</p>
<p>I am getting an error:</p>
<pre><code>-[NSCFArray objectAtIndex:]: index (-1 (or possibly larger)) beyond bounds (9)
</code></pre>
<p>w... | 10,501,532 | 2 | 0 | null | 2012-05-08 15:09:16.277 UTC | 20 | 2014-08-28 14:20:43.027 UTC | 2013-04-11 10:40:07.297 UTC | null | 49,658 | null | 1,214,040 | null | 1 | 25 | objective-c|xcode|cocoa | 20,965 | <p>When the debugger stops, go to the "Debug Navigator" and make sure the slider on the bottom is all the way to the right.</p>
<p>Scan your eye down from the point at which the exception is thrown and you should eventually come to your own code. Click on the appropriate method/function name and the code will be opene... |
23,047,978 | How is arctan implemented? | <p>Many implementation of the library goes deep down to FPATAN instuction for all arc-functions. How is FPATAN implemented? Assuming that we have 1 bit sign, M bits mantissa and N bits exponent, what is the algorithm to get the arctangent of this number? There should be such algorithm, since the FPU does it.</p> | 23,048,159 | 3 | 0 | null | 2014-04-13 20:20:52.587 UTC | 8 | 2022-09-10 23:27:35.22 UTC | 2019-10-12 06:33:24.867 UTC | null | 527,702 | null | 1,058,670 | null | 1 | 19 | algorithm|floating-point|trigonometry|bit|processor | 19,569 | <p>Trigonometric functions do have pretty ugly implementations that are hacky and do lots of bit fiddling. I think it will be pretty hard to find someone here that is able to explain an algorithm that is actually used.</p>
<p>Here is an atan2 implementation: <a href="https://sourceware.org/git/?p=glibc.git;a=blob;f=sy... |
41,053,280 | How to write mock for structs in Go | <p>I want to write a unit test for the <code>Transport</code> function which will require mocking <code>CarFactory</code> and <code>Car</code> structs. See the following code:</p>
<pre><code>package main
type Car struct {
Name string
}
func (h Car) Run() { ... }
type CarFactory struct {}
func (e CarFactory) Ma... | 41,054,865 | 2 | 0 | null | 2016-12-09 04:45:55.897 UTC | 7 | 2020-09-17 19:42:37.407 UTC | 2020-01-04 16:28:35.083 UTC | null | 1,013,701 | null | 2,646,539 | null | 1 | 28 | unit-testing|go|mocking | 37,364 | <p>It takes more code to mock a struct in Go than other OOP languages that support full late binding.</p>
<p>This code must remain untouched since its taken from a 3rd party:</p>
<pre><code>type Car struct {
Name string
}
func (c Car) Run() {
fmt.Println("Real car " + c.Name + " is running"... |
32,410,299 | How to copy file from a Vagrant machine to localhost | <p>I want to copy a local file from a Vagrant machine to my <code>localhost</code>, but I am getting an error message:</p>
<blockquote>
<p>ssh: connect to host <code>127.0.0.1</code> port <code>22</code>: Connection refused.</p>
</blockquote>
<pre><code>[user@localhost ceil]$ scp -p 2222 vagrant@127.0.0.1:/home/vag... | 32,410,420 | 7 | 0 | null | 2015-09-05 06:43:52.577 UTC | 16 | 2020-08-06 20:14:50.147 UTC | 2020-01-14 14:32:18.313 UTC | null | 806,202 | null | 4,884,941 | null | 1 | 42 | linux|vagrant|scp | 41,913 | <p>You should read the manual page for <code>scp</code>. The correct syntax is:</p>
<pre><code>scp -P 2222 vagrant@127.0.0.1:/home/vagrant/devstack/local.conf .
</code></pre>
<p>The uppercase <kbd>P</kbd> is for "port". Lowercase is used to preserve modification times.</p> |
34,410,707 | Enabling remote access to Keycloak | <p>I'm using the Keycloak authorization server in order to manage my application permissions. However, I've found out the standalone server can be accessed locally only.</p>
<p><code>http://localhost:8080/auth</code> works, but not it does <code>http://myhostname:8080/auth</code>. This issue doesn't permit accessing t... | 34,410,749 | 4 | 0 | null | 2015-12-22 07:38:35.53 UTC | 10 | 2021-10-13 15:57:47.723 UTC | null | null | null | null | 1,199,132 | null | 1 | 43 | keycloak | 40,943 | <p>The standalone Keycloak server runs on the top of a JBoss Wildfly instance and this server doesn't allow accessing it externally by default, for security reasons (it should be only for the administration console, but seems to affect every url in case of Keycloak). It has to be booted with the <code>-b=0.0.0.0</code>... |
33,031,596 | PostgreSQL DELETE FROM (SELECT * FROM table FETCH FIRST 10 ROWS ONLY) | <p>How do I delete only a few rows in postgreSQL?
I want to fetch 10 rows to delete in a subquery.</p>
<p>My table</p>
<p><a href="https://i.stack.imgur.com/u1alL.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/u1alL.jpg" alt="enter image description here"></a></p> | 33,031,643 | 2 | 0 | null | 2015-10-09 06:45:01.143 UTC | 4 | 2015-10-09 07:20:41.43 UTC | 2015-10-09 07:20:41.43 UTC | null | 3,682,599 | null | 4,389,509 | null | 1 | 19 | postgresql|subquery|sql-delete | 48,793 | <p>You need to use a where condition as per your requirement like this:</p>
<pre><code>delete from mytable where id in(1,2,3,4,5,6,7,8,9,10)
</code></pre>
<p>or</p>
<pre><code>delete from mytable where id in(select id from mytable where someconditon)
</code></pre>
<p>or you can try like this if you want to delete t... |
32,795,712 | Clean Architecture: How to reflect the data layer's changes in the UI | <p>I'm trying to make a design based on the <a href="https://blog.8thlight.com/uncle-bob/2012/08/13/the-clean-architecture.html" rel="noreferrer">Uncle Bob's Clean Architecture</a> in Android. </p>
<p><strong>The problem:</strong></p>
<p>I'd like to solve is how to make the changes generated in one repository to be r... | 32,822,506 | 2 | 0 | null | 2015-09-26 09:37:31.137 UTC | 8 | 2019-01-22 13:56:08.45 UTC | 2019-01-22 13:56:08.45 UTC | null | 9,298,517 | null | 853,836 | null | 1 | 25 | java|android|architecture|coding-style | 3,814 | <h3>Publish / Subscribe</h3>
<p>Typically, for n:m communication (n senders may send a message to m receivers, while all senders and receivers do not know each other) you'll use a <a href="https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern">publish/subscribe pattern</a>.
There are lots of libraries implem... |
20,921,862 | Android Studio, Gradle, OpenCV and NDK | <p>I am trying to test OpenCV Android, on Android Studio, I am confused about how to include the NDK.</p>
<p>What I want to do is run the samples which come with OpenCV. Of the 6 samples provided I managed to run 4 successfully. The exceptions were face-detection and native-activity. </p>
<p>I suspect the reason is I... | 20,926,595 | 1 | 1 | null | 2014-01-04 13:52:36.803 UTC | 9 | 2014-01-05 19:36:42.983 UTC | 2017-05-23 12:17:38.603 UTC | null | -1 | null | 1,463,518 | null | 1 | 11 | android|opencv|android-ndk|gradle|android-studio | 8,895 | <p>If you have libraries that you build with the ndk and want to put them in a gradle-enabled android project (using version 0.7.+ of the plugin), you can just put them in</p>
<pre><code>src/main/jniLibs/<abi>/libfoo.so
</code></pre>
<p>for example:</p>
<pre><code>src/main/jniLibs/armeabi-v7a/libfoo.so
src/mai... |
21,591,536 | Resize and crop image and keeping aspect ratio NodeJS & gm | <p>I've been trying to create some thumbnails using the <code>gm</code> package from NodeJS, but I'm out of lucky. I need to resize images bigger than 600x600 (could be any width/height, starting from the given one) but when I pass the size to gm, it creates an image that doesn't have the same size I requested. </p>
<... | 21,591,725 | 5 | 0 | null | 2014-02-06 00:20:50.047 UTC | 13 | 2019-01-09 02:18:19.147 UTC | null | null | null | null | 3,277,539 | null | 1 | 29 | node.js|graphicsmagick | 39,305 | <p>Try with <code>imagemagick</code> package for NodeJS: <a href="https://github.com/yourdeveloper/node-imagemagick" rel="nofollow noreferrer">https://github.com/yourdeveloper/node-imagemagick</a></p>
<pre><code>im.crop({
srcPath: process.argv[2],
dstPath: 'cropped.' + process.argv[2].split('.').pop(),
wid... |
46,933,722 | How to get a list of all Jenkins nodes assigned with label including master node? | <p>I'm creating a Jenkins pipeline job and I need to run a job on all nodes labelled with a certain label.</p>
<p>Therefore I'm trying to get a list of node names assigned with a certain label. (With a node I can get the labels with <code>getAssignedLabels()</code>)</p>
<p>The <code>nodes</code>-list in <code>jenkins.m... | 49,625,621 | 10 | 0 | null | 2017-10-25 13:26:49.593 UTC | 2 | 2022-05-10 10:03:39.957 UTC | 2022-01-28 10:15:35.48 UTC | null | 1,795,027 | null | 880,584 | null | 1 | 24 | jenkins|jenkins-pipeline|jenkins-groovy | 39,146 | <p>This is the way I'm doing it right now. I haven't found anything else:</p>
<pre><code>@NonCPS
def hostNames(label) {
def nodes = []
jenkins.model.Jenkins.get().computers.each { c ->
if (c.node.labelString.contains(label)) {
nodes.add(c.node.selfLabel.name)
}
}
return nodes
}
</code></pre>
<p... |
51,849,600 | antd - ant design table with pagination control supporting a widget to choose rows per page? | <p>Does the Ant Design Table controller take a Pagination component, instead of a plain object of properties. I need to add a switcher, to switch between rows per page.</p>
<p>Currently it is implemented in the Pagination component.</p> | 53,327,888 | 2 | 0 | null | 2018-08-14 20:51:22.937 UTC | 2 | 2020-09-21 16:12:23.863 UTC | 2019-12-12 19:57:22.253 UTC | null | 4,816,922 | null | 2,588,622 | null | 1 | 17 | javascript|reactjs|antd | 40,358 | <p>If what you need is only the ability to select the number of rows per page, then the following code should work for you:</p>
<pre><code><Table
dataSource={...}
pagination={{ defaultPageSize: 10, showSizeChanger: true, pageSizeOptions: ['10', '20', '30']}}
>
</code></pre>
<p>Basically wrapping the <a hr... |
27,292,918 | Swift KVO - Observing enum properties | <p>I'm assembling a class which has several states, as defined by an enum, and a read-only property "state" which returns the instance's current state. I was hoping to use KVO techniques to observe changes in state but this doesn't seem possible:</p>
<p><code>dynamic var state:ItemState // Generates compile-time err... | 27,293,599 | 2 | 1 | null | 2014-12-04 11:29:49.41 UTC | 8 | 2015-08-11 16:33:48.203 UTC | null | null | null | null | 2,215,831 | null | 1 | 8 | swift|enums|key-value-observing | 7,705 | <p>I came across the same problem a while ago.
In the end I used an enum for the state and added an additional 'raw' property which is set by a property observer on the main state property.</p>
<p>You can KVO the 'raw' property but then reference the real enum property when it changes.</p>
<p>It's obviously a bit of ... |
27,003,907 | How do I connect to the server socket using the ip address and port number? (client is running on a different machine than server) | <p>Client program</p>
<pre><code>public class client implements Runnable {
protected static String server_IP = "141.117.57.42";
private static final int server_Port = 5555 ;
protected static String client_IP ;
public static void main(String[] args) throws IOException{
final String host = "localho... | 27,004,094 | 2 | 2 | null | 2014-11-18 20:59:51.363 UTC | 3 | 2020-12-23 00:53:16.313 UTC | 2020-12-23 00:53:16.313 UTC | null | 1,783,163 | null | 4,250,127 | null | 1 | 3 | java|sockets|serversocket | 63,025 | <p>To connect in your code you use:</p>
<pre><code>Socket socket = new Socket(server_IP,server_Port);
</code></pre>
<p>So you could use:</p>
<pre><code>Socket socket = new Socket("192.168.1.4", 5555);
</code></pre>
<p>It looks like you have this in your code so I'm not sure what problem you're having.</p>
<p>Don't... |
30,713,121 | Disable Swipe for position in RecyclerView using ItemTouchHelper.SimpleCallback | <p>I am using recyclerview 22.2.0 and the helper class ItemTouchHelper.SimpleCallback to enable <em>swipe-to-dismiss</em> option to my list. But as I have a type of header on it, I need to disable the swipe behavior for the first position of the adapter. As <strong>RecyclerView.Adapter</strong> doesn't have a <strong>i... | 30,713,364 | 7 | 0 | null | 2015-06-08 15:22:43.103 UTC | 24 | 2020-05-18 08:37:35.453 UTC | null | null | null | null | 1,267,425 | null | 1 | 113 | android|android-recyclerview | 49,357 | <p>After playing a bit, I managed that <strong>SimpleCallback</strong> has a method called <strong>getSwipeDirs()</strong>. As I have a specific ViewHolder for the <em>not swipable</em> position, I can make use of <strong>instanceof</strong> to avoid the swipe. If that's not your case, you can perform this control usin... |
308,258 | Vim Keyword Completion | <p>How do I tell the Vim editor about my include files path so that it can auto complete the function names when I press <kbd>CTRL</kbd>+<kbd>N</kbd>?</p>
<p>For example, I have a C program like below:</p>
<pre><code>#include<stdio.h>
int main()
{
sca // here I press control+N, it does not complete to scanf... | 308,274 | 3 | 0 | null | 2008-11-21 09:28:49.33 UTC | 12 | 2017-05-01 06:50:03.043 UTC | 2017-05-01 06:50:03.043 UTC | Rob Wells | 530,168 | chappar | 39,615 | null | 1 | 12 | c|vim | 5,325 | <p>In your <code>.vimrc</code>, add the paths to your <code>.vimrc</code>:</p>
<pre><code>set path+=/usr/include/**
set path+=/my_include_dir/include
set path+=/my_include_dir/srclib/apr/**
set path+=/my_other_include_dir/srclib/apr-util/**
** means all sub-directories.
* means all contained directories
. means all... |
359,331 | Access x86 COM from x64 .NET | <p>I have an x64 server which, since my libraries are compiled to AnyCPU, run under x64. We are needing to access a COM component which is registered under x86. I don't know enough about COM and my google searches are leading me nowhere.</p>
<p>Question: Can I use a symbolic registry link from x64 back to x86 for th... | 359,389 | 3 | 0 | null | 2008-12-11 13:25:43.15 UTC | 30 | 2022-05-29 08:49:31.12 UTC | 2022-05-29 08:49:31.12 UTC | Craig Wilson | 224,132 | Craig Wilson | 25,333 | null | 1 | 27 | .net|com|x86-64|interop|32bit-64bit | 24,382 | <p>If a component is running x64-native, it can't load a 32-bit COM server in-process, because it's the wrong sort of process. There are a couple of solutions possible:</p>
<ol>
<li><p>If you can, build a 64-bit version of the COM code (which would of course register itself in the 64-bit registry). This is the cleanes... |
1,318,224 | MySQL Fire Trigger for both Insert and Update | <p>Is it possible to fire a mysql trigger for both the insert and update events of a table?</p>
<p>I know I can do the following</p>
<pre><code>CREATE TRIGGER my_trigger
AFTER INSERT ON `table`
FOR EACH ROW
BEGIN
.....
END //
CREATE TRIGGER my_trigger
AFTER UPDATE ON `table`
FOR EACH ROW
BEGIN
.....
... | 1,318,231 | 3 | 0 | null | 2009-08-23 10:17:15.383 UTC | 16 | 2014-08-30 18:47:12.567 UTC | null | null | null | null | 161,529 | null | 1 | 132 | mysql|triggers | 120,162 | <p>You have to create two triggers, but you can move the common code into a procedure and have them both call the procedure.</p> |
539,302 | Significance of bool IsReusable in http handler interface | <p>When writing a http handler/module, there is an interface member to implement called - <a href="https://docs.microsoft.com/en-us/dotnet/api/system.web.ihttphandler.isreusable" rel="noreferrer">bool IsReusable</a>.</p>
<p>What is the significance of this member? If I set it to false (or true), what does this mean fo... | 539,321 | 3 | 1 | null | 2009-02-11 23:14:16.873 UTC | 23 | 2018-09-18 09:38:24.563 UTC | 2018-09-18 09:38:24.563 UTC | null | 5,407,188 | GSS | 32,484 | null | 1 | 133 | asp.net|httphandler|ihttphandler | 24,729 | <p>The normal entry point for a handler is the ProcessRequest method. However you may have code in the class constructor which puts together some instance values which are expensive to build.</p>
<p>If you specify Reusable to be true the application can cache the instance and reuse it in another request by simply cal... |
22,081,209 | Find the root of the git repository where the file lives | <p>When working in Python (e.g. running a script), how can I find the path of the root of the git repository where the script lives?</p>
<p>So far I know I can get the current path with:</p>
<pre><code>path_to_containing_folder = os.path.dirname(os.path.realpath(__file__))
</code></pre>
<p>How can I then find out wh... | 41,920,796 | 8 | 0 | null | 2014-02-27 21:47:41.933 UTC | 12 | 2021-05-13 08:23:34.277 UTC | null | null | null | null | 283,296 | null | 1 | 39 | python|git | 37,544 | <p>Use the GitPython module <a href="http://gitpython.readthedocs.io/en/stable/" rel="noreferrer">http://gitpython.readthedocs.io/en/stable/</a>.</p>
<pre><code>pip install gitpython
</code></pre>
<p>Assume you have a local Git repo at <code>/path/to/.git</code>. The below example receives <code>/path/to/your/file</c... |
35,029,277 | How to modify environment variables passed to custom CMake target? | <p>Perhaps I am missing something obvious, but I can't seem to figure out how to explicitly set environment variables that can be seen by processes launched through <a href="https://cmake.org/cmake/help/v3.0/command/add_custom_target.html"><code>add_custom_target()</code></a>.</p>
<p>I tried the following:</p>
<pre><... | 35,042,808 | 3 | 1 | null | 2016-01-27 05:05:56.017 UTC | 7 | 2020-08-26 14:43:07.637 UTC | null | null | null | null | 193,619 | null | 1 | 50 | cmake|environment-variables | 37,057 | <p>A portable way of setting environment variables for a custom target is to use CMake's command-line tool mode command <code>env</code>:</p>
<blockquote>
<pre><code>env [--unset=NAME]... [NAME=VALUE]... COMMAND [ARG]...
</code></pre>
<p>Run command in a modified environment.</p>
</blockquote>
<p>E.g.:</p>
<pre><code>a... |
20,173,101 | Copy the content of a div into another div | <p>I have two divs on my website. They both share the same css properties, but one of them holds 24 other divs. I want all of these 24 divs to be copied into the other div.
This is how it looks like:</p>
<pre><code><div id="mydiv1">
<div id="div1">
</div>
</div id="div2>
</di... | 20,173,115 | 5 | 0 | null | 2013-11-24 09:37:29.823 UTC | 7 | 2022-07-16 17:26:51.517 UTC | 2018-04-23 19:36:46.71 UTC | null | 2,934,005 | null | 2,934,005 | null | 1 | 16 | javascript|html | 73,885 | <p>Firstly we are assigning divs into variables (optional)</p>
<pre><code>var firstDivContent = document.getElementById('mydiv1');
var secondDivContent = document.getElementById('mydiv2');
</code></pre>
<p>Now just assign mydiv1's content to mydiv2.</p>
<pre><code>secondDivContent.innerHTML = firstDivContent.innerHT... |
20,030,716 | Change default primary key in Eloquent | <p>Can I change Eloquent model primary key. </p>
<p>I want to set primary key for example <code>admin_id</code> instead of 'id'?</p>
<p>I know I can change table name for model like </p>
<pre><code>protected $table = "admin";
</code></pre>
<p>Is there something similar for primary key?</p> | 20,030,835 | 6 | 0 | null | 2013-11-17 12:35:41.347 UTC | 13 | 2021-02-14 14:04:19.297 UTC | null | null | null | null | 1,291,189 | null | 1 | 103 | laravel-4|eloquent | 114,594 | <p>Yes </p>
<pre><code>class User extends Eloquent {
protected $primaryKey = 'admin_id';
}
</code></pre> |
6,233,610 | PHP Code Deployment Tips | <p>In the past, I have been developing in a very amateurish fashion, meaning I had a local machine where I developed and tested code and a production machine to which I copied the code when I was done. Recently I modified this slightly to where I developed locally, checked the code into SVN and then updated the product... | 6,233,936 | 3 | 4 | null | 2011-06-03 23:30:00.787 UTC | 12 | 2011-08-25 06:41:55.23 UTC | 2011-08-25 06:41:55.23 UTC | null | 282,601 | null | 783,488 | null | 1 | 25 | php|svn|deployment|build-process | 2,049 | <p>I would suggest making your testing deployment strategy a production-ready install-script -- since you're going to need one of those anyway eventually.</p>
<p>A few tips that may seem obvious to some, but are worth pointing out:</p>
<ul>
<li>Your config file saved in your VCS should be a template, and should be na... |
5,615,916 | jQuery: count array elements by value | <p>I have an array of elements assembled by:</p>
<pre><code>timeArray = [];
$('.time_select').each(function(i, selected) {
timeArray[i] = $(selected).val();
});
</code></pre>
<p>where <code>.time_select</code> is a class on a group of different HTML select tags.</p>
<p>What I'd like to do is count the number of ti... | 5,615,959 | 4 | 0 | null | 2011-04-11 01:17:43.893 UTC | 1 | 2011-04-11 03:52:05.137 UTC | 2011-04-11 01:44:08.437 UTC | null | 405,143 | null | 346,977 | null | 1 | 3 | jquery|arrays | 38,516 | <pre><code>timeArray = [];
occurs = {};
$('.time_select').each(function(i, selected) {
timeArray[i] = $(selected).val();
if (occurs[timeArray[i]] != null ) { occurs[timeArray[i]]++; }
else {occurs[timeArray[i]] = 1; }
});
</code></pre> |
6,263,009 | Backbone.js REST URL with ASP.NET MVC 3 | <p>I have been looking into <a href="http://documentcloud.github.com/backbone/">Backbone.js</a> lately and i am now trying to hook it up with my server-side asp.net mvc 3.</p>
<p>This is when i discovered a issue. ASP.NET listens to different Actions, Ex: <code>POST /Users/Create</code> and not just <code>POST /users/... | 6,273,280 | 4 | 3 | null | 2011-06-07 09:09:00.233 UTC | 15 | 2012-05-24 14:50:53.707 UTC | null | null | null | null | 526,696 | null | 1 | 13 | asp.net-mvc-3|rest|backbone.js | 7,000 | <p>The answer is not to override Backbone.sync. You rarely would want to do this. Instead, you need only take advantage of the model's url property where you can assign a function which returns the url you want. For instance, </p>
<pre><code>Forum = Backbone.Model.extend({
url: function() {
return this.isNew... |
5,640,721 | Visual Studio Key Strokes: Swapping lines | <p>Is there a keystroke in visual studio similar to Eclipse's <kbd>Alt</kbd> + <kbd>↑</kbd>/<kbd>↓</kbd>?</p>
<p>For example:</p>
<pre><code>int x = 0; // Cursor is anywhere on this line.
int y = 1;
</code></pre>
<p>and <kbd>Alt</kbd> + <kbd>Down</kbd> were pressed, then:</p>
<pre><code>int y = 1;
int x =... | 5,641,152 | 4 | 0 | null | 2011-04-12 19:46:54.36 UTC | 3 | 2019-07-15 07:04:10.427 UTC | 2011-09-16 09:26:48.717 UTC | null | 321,366 | null | 391,618 | null | 1 | 47 | visual-studio|keyboard-shortcuts|shortcut | 23,917 | <p>VS 2013 and later:</p>
<p><kbd>Alt</kbd> + <kbd>↑</kbd> (<code>Edit.MoveSelectedLinesUp</code>)</p>
<p><kbd>Alt</kbd> + <kbd>↓</kbd> (<code>Edit.MoveSelectedLinesDown</code>)</p>
<hr>
<p>VS 2012:</p>
<p><kbd>Shift</kbd>+<kbd>Alt</kbd>+ <kbd>T</kbd>
(<code>Edit.LineTranspose</code>) </p>
<p>but this only swaps... |
1,819,341 | How to read XML file from web using powershell | <p>When I connect to my HP ILO using the URL, <a href="http://ilo-ip/xmldata?item=All" rel="noreferrer">http://ilo-ip/xmldata?item=All</a> it is returning a XML file in below format.</p>
<pre><code> <?xml version="1.0" ?>
- <RIMP>
- <HSI>
<SPN>ProLiant DL385 G1</SPN>
<SBSN>A... | 1,819,936 | 2 | 0 | null | 2009-11-30 11:49:31.84 UTC | 2 | 2018-11-06 20:21:26.937 UTC | null | null | null | null | 209,355 | null | 1 | 8 | xml|powershell | 40,158 | <p>PowerShell uses the .Net framework XmlDocument so you could call the load method to load the xml into an XmlDocument object like this:</p>
<pre><code>#Option 1
$doc = New-Object System.Xml.XmlDocument
$doc.Load("http://ilo-ip/xmldata?item=All")
#Option 2
[xml]$doc = (New-Object System.Net.WebClient).DownloadSt... |
1,617,857 | SoapFault exception: [HTTP] Unsupported Media Type when accessing Java web-service from PHP | <p>I'm trying to connect to a Java web-service using the <code>Zend_Soap_Client</code> from the Zend Framework v1.9.0:</p>
<pre><code><?php
include( 'Zend/Loader/Autoloader.php');
$autoloader = Zend_Loader_Autoloader::getInstance();
$client = new Zend_Soap_Client('https://webservice.com/webservice-war/webservice?ws... | 1,624,442 | 2 | 0 | null | 2009-10-24 12:17:09.387 UTC | 2 | 2015-06-11 09:48:48.433 UTC | null | null | null | null | 76,799 | null | 1 | 9 | java|php|zend-framework|soap|web-services | 64,864 | <p>According to <a href="http://www.w3.org/TR/soap12-part2/#tabreqstatereqtrans" rel="noreferrer">this listing</a>, the exception indicates that the server hosting the web-service is not happy with your requests encoding:</p>
<blockquote>
<p>Indicates that the peer HTTP server
does not support the Content-type use... |
1,417,727 | Can someone please explain what these ApacheBench results mean? | <p>i'm trying to figure out how to use ApacheBench and benchmark my website. I installed the default site project (it's ASP.NET MVC but please don't put stop reading if u're not a .NET person).</p>
<p>I didn't change anything. Add new project. Set confuration to RELEASE. Run without Debug. (so it's in LIVE mode). Yes,... | 1,417,745 | 2 | 0 | null | 2009-09-13 13:19:26.673 UTC | 11 | 2009-09-13 23:18:46.237 UTC | null | null | null | null | 30,674 | null | 1 | 16 | performance|benchmarking|apachebench | 13,705 | <blockquote>
<p>what is the reason for adding more
concurrent? As in, if i have 1000 hits
on 1 concurrent, how does that differ
to 500 on 2 concurrent? Is it to test
if there's any code that blocks other
requests?</p>
</blockquote>
<p>It's a bit about that, yes : your application is probably doing things w... |
2,139,274 | Grabbing the output sent to Console.Out from within a unit test? | <p>I am building a unit test in C# with NUnit, and I'd like to test that the main program actually outputs the right output depending on the command line arguments.</p>
<p>Is there a way from an NUnit test method that calls <code>Program.Main(...)</code> to grab everything written to <a href="https://docs.microsoft.co... | 2,139,303 | 2 | 3 | null | 2010-01-26 12:19:09.213 UTC | 13 | 2020-05-18 08:14:08.663 UTC | 2020-05-18 08:11:22.15 UTC | null | 1,364,007 | null | 267 | null | 1 | 57 | c#|unit-testing|console|nunit | 22,622 | <p>You can redirect <a href="https://docs.microsoft.com/en-us/dotnet/api/system.console.in" rel="noreferrer"><code>Console.In</code></a>, <a href="https://docs.microsoft.com/en-us/dotnet/api/system.console.out" rel="noreferrer"><code>Console.Out</code></a> and <a href="https://docs.microsoft.com/en-us/dotnet/api/system... |
6,194,041 | Scrapy image download how to use custom filename | <p>For my <a href="http://doc.scrapy.org/index.html" rel="noreferrer">scrapy</a> project I'm currently using the <a href="http://doc.scrapy.org/topics/images.html#scrapy.contrib.pipeline.images.ImagesPipeline" rel="noreferrer">ImagesPipeline</a>. The downloaded images are <a href="http://doc.scrapy.org/topics/images.ht... | 6,196,180 | 6 | 0 | null | 2011-05-31 21:57:05.043 UTC | 15 | 2021-02-23 12:05:27.323 UTC | 2014-02-21 16:28:03.61 UTC | null | 1,797,098 | null | 773,694 | null | 1 | 14 | python|scrapy | 14,077 | <p>This was the way I solved the problem in Scrapy 0.10 .
Check the method persist_image of FSImagesStoreChangeableDirectory. The filename of the downloaded image is key</p>
<pre><code>class FSImagesStoreChangeableDirectory(FSImagesStore):
def persist_image(self, key, image, buf, info,append_path):
absol... |
5,959,788 | Google Maps API V3 : How show the direction from a point A to point B (Blue line)? | <p>I have latitude and longitude for 2 points on database, I want my Google Map to display a route from point A to point B...</p>
<p>Just like we see <a href="https://www.google.com/maps/dir/Pushpanjali,+Pitampura,+New+Delhi,+Delhi,+India/Rithala+Metro+Station,+Rithala+Rd,+Sector+12,+Rohini,+New+Delhi,+Delhi,+India/@2... | 5,962,203 | 6 | 0 | null | 2011-05-11 05:45:09.59 UTC | 27 | 2022-04-16 09:03:41.407 UTC | 2022-04-16 09:03:41.407 UTC | null | 2,314,737 | null | 731,963 | null | 1 | 73 | javascript|google-maps|google-maps-api-3 | 206,034 | <p>Use <a href="http://code.google.com/apis/maps/documentation/javascript/services.html#Directions" rel="noreferrer">directions service</a> of Google Maps API v3. It's basically the same as directions API, but nicely packed in Google Maps API which also provides convenient way to easily render the route on the map. </p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.