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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4,809,729 | Cancel split window in Vim | <p>I have split my windows horizontally. Now how can I return to normal mode, i.e. no split window just one window without cancelling all of my open windows. I have 5 and do not want to "quit", just want to get out of split window. </p> | 4,809,736 | 11 | 1 | null | 2011-01-26 20:34:01.72 UTC | 57 | 2021-10-27 17:44:14.483 UTC | 2015-02-24 21:41:20.67 UTC | null | 520,162 | null | 591,297 | null | 1 | 274 | vim|split|window | 138,309 | <p>Press <kbd>Control</kbd>+<kbd>w</kbd>, then hit <kbd>q</kbd> to close each window at a time.</p>
<p><strong>Update</strong>: Also consider eckes answer which may be more useful to you, involving <code>:on</code> (read below) if you don't want to do it one window at a time.</p> |
4,797,286 | Are braces necessary in one-line statements in JavaScript? | <p>I once heard that leaving the curly braces in one-line statements could be harmful in JavaScript. I don't remember the reasoning anymore and a Google search did not help much. </p>
<p>Is there anything that makes it a good idea to surround all statements within curly braces in JavaScript?</p>
<p>I am asking, becau... | 4,797,293 | 21 | 5 | null | 2011-01-25 18:17:14.467 UTC | 23 | 2020-12-08 07:00:11.897 UTC | 2019-03-13 22:07:26.767 UTC | null | 1,243,247 | null | 283,055 | null | 1 | 204 | javascript | 124,942 | <h2>No</h2>
<p>But they are recommended. If you ever expand the statement you will need them.</p>
<p>This is perfectly valid</p>
<pre><code>if (cond)
alert("Condition met!")
else
alert("Condition not met!")
</code></pre>
<p>However it is highly recommended that you always use braces because if you (or some... |
14,853,643 | Fill Select2 dropdown box from database in MVC 4 | <p>I need help writing the jquery/ajax to fill a <a href="http://ivaynberg.github.io/select2/index.html">Select2</a> dropdown box.</p>
<p><em>For those who don't know what <a href="http://ivaynberg.github.io/select2/index.html">Select2</a> is, it is a javascript extension to provide Twitter Bootstrap looks and search ... | 14,876,502 | 3 | 2 | null | 2013-02-13 12:31:11.673 UTC | 7 | 2013-05-10 11:06:26.383 UTC | 2013-05-10 11:06:26.383 UTC | null | 1,197,659 | null | 1,197,659 | null | 1 | 9 | asp.net-mvc|jquery|jquery-select2 | 40,044 | <p>Solved! Finally.</p>
<p>The full jquery is below, what was needed were two functions to format the returned results from the controller. This is because the dropbox needs some html markup to be wrapped around the results in order to be able to display them.</p>
<p>Also contractID was needed as an attribute in the ... |
14,612,460 | how to remove the css overflow:hidden of jquery dialog | <p>I want to add a search input and overlap it on title bar of a jQuery dialog but my problems are:</p>
<ul>
<li>I can't remove the css overflow property of this specific jQuery dialog</li>
<li>The Title bar is always at the top of my input search box.</li>
</ul>
<p>I've also tried this:</p>
<pre><code> $('div#viewV... | 14,612,504 | 3 | 0 | null | 2013-01-30 19:50:47.14 UTC | 2 | 2018-12-19 12:58:45.537 UTC | 2013-01-30 19:57:24.36 UTC | null | 1,926,958 | null | 1,926,958 | null | 1 | 11 | jquery|html|css | 43,299 | <p>Just override it in your CSS:</p>
<pre><code>#viewVoters {
overflow: auto !important; /* or 'visible' whatever */
}
</code></pre> |
14,735,753 | How to configure Microsoft JWT with symmetric key? | <p>I'm trying to configure my ASP.NET app to accept a JSON Web Token (JWT) that is signed with a symmetric key. The STS isn't capable of using certificates for this, so we're using their symmetric key support.</p>
<p>On my end, I'm using <a href="http://blogs.msdn.com/b/vbertocci/archive/2012/11/20/introducing-the-dev... | 14,837,906 | 5 | 0 | null | 2013-02-06 18:00:52.38 UTC | 9 | 2019-12-23 16:03:36.14 UTC | 2019-12-23 16:03:36.14 UTC | null | 133 | null | 56,778 | null | 1 | 17 | .net|wif|jwt | 27,877 | <h2>Update 2014/02/13:</h2>
<p>As @leastprivilege points out below, this is a whole lot easier with the RTM version of the JWT. I strongly suggest that you ignore this and go with the example he provides at <a href="http://leastprivilege.com/2013/07/16/identityserver-using-ws-federation-with-jwt-tokens-and-symmetric-s... |
6,211,274 | Encryption of contents in compiled iOS app ( IPA ) | <p>As IPA structure is just a zipped file containing compiled codes & media contents like images & audio, how can I protect the contents from being extracted and stolen by others? Is there any encryption I can add into the IPA?</p> | 6,211,290 | 1 | 0 | null | 2011-06-02 06:38:03.31 UTC | 10 | 2019-11-22 01:51:25.777 UTC | 2014-02-13 00:36:11.557 UTC | user244343 | null | null | 188,331 | null | 1 | 10 | ios|encryption|ipa | 12,113 | <p>This answer mentions that the application is already encrypted by the time it gets onto your users' devices: <a href="https://stackoverflow.com/questions/5784169/does-apple-modify-ios-application-executables-on-apps-submitted-to-the-app-store/5784332#5784332">Does Apple modify iOS application executables on apps sub... |
5,733,220 | How do I add the MinGW bin directory to my system path? | <p>I am using Windows XP. I am trying to add a new library to <a href="https://en.wikipedia.org/wiki/Dev-C%2B%2B" rel="noreferrer">Dev-C++</a>. For that, I need to install MinGW and then I have been instructed to add the <code>bin</code> directory of MinGW to my system path. But, I don’t know how to do it. Please guide... | 5,733,462 | 1 | 0 | null | 2011-04-20 15:58:30.473 UTC | 8 | 2017-01-07 21:24:40.907 UTC | 2017-01-07 21:22:06.02 UTC | null | 63,550 | null | 603,976 | null | 1 | 22 | c++|windows | 125,787 | <p>To change the path on Windows XP, follow <a href="http://www.computerhope.com/issues/ch000549.htm" rel="noreferrer">these instructions</a>, and then add the directory where you install MinGW plus <code>bin</code>. Example: if you install MinGW in C:\ then you have to add <code>C:\mingw\bin</code> to your path</... |
53,996,410 | compare two dates in Angular 6 | <p>I am new to angular 6 ,Here I need to compare to date inputs and find the greatest one.</p>
<pre><code>input 1 : 2018-12-29T00:00:00
input 2 : Mon Dec 31 2018 00:00:00 GMT+0530 (India Standard Time)
</code></pre>
<p>Here I received the <strong>input 1</strong> from mssql database and the <strong>input 2</strong> f... | 53,996,476 | 5 | 2 | null | 2019-01-01 14:50:46.407 UTC | 1 | 2022-02-16 13:54:08.697 UTC | null | null | null | null | 9,956,391 | null | 1 | 17 | angular|typescript|angular6 | 68,461 | <p>you can use getTime</p>
<pre><code>if (input1Date.getTime() < input2Date.getTime())
</code></pre>
<p>Note that if your dates are in string format, you first need to parse them to Date</p> |
3,108,270 | How to write a project Analysis or project brief? | <p>We are a small (15 ppl) webdevelopment/design company with around 8 fulltime LAMP developers. In order to reduce the amount of errors we make and to prevent our budgets overtaking our estimates i've introduced some sort of technical analysis of our projects before development kicks off. This is a no brainer for an a... | 3,131,992 | 2 | 0 | null | 2010-06-24 08:22:44.497 UTC | 13 | 2015-09-28 08:20:57 UTC | 2010-06-24 08:30:43.45 UTC | null | 187,018 | null | 187,018 | null | 1 | 12 | project-management|analysis | 44,654 | <p>Unfortunately most project scope documents are commercially protected so they can't be published, however I'm happy to pile down my experience of what makes a good one and I've included the sort of things I'd hope to see.</p>
<p>The main thing to remember is what you're trying to achieve - you're trying to get a co... |
3,044,545 | get contact info from android contact picker | <p>I'm trying to call the contact picker, get the persons name, phone and e-mail into strings and send them to another activity using an intent. So far this works:</p>
<pre><code>Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
startActivityForResult(intent, 1);
// ...
@Over... | 3,044,835 | 2 | 0 | null | 2010-06-15 11:05:51.843 UTC | 32 | 2016-08-16 20:32:07.473 UTC | 2013-04-08 18:46:43.957 UTC | null | 1,401,895 | null | 364,727 | null | 1 | 37 | android|contacts|contactscontract|google-contacts-api | 43,732 | <p><strong>Phone Numbers</strong></p>
<p>Phone numbers are stored in their own table and need to be queried separately. To query the phone number table use the URI stored in the SDK variable ContactsContract.CommonDataKinds.Phone.CONTENT_URI. Use a WHERE conditional to get the phone numbers for the specified contact. ... |
39,616,015 | SAP HANA create table / insert into new table from select | <p>How to create a new table and insert content of another table?</p> | 39,616,016 | 3 | 0 | null | 2016-09-21 12:01:03.747 UTC | null | 2020-05-01 11:44:19.717 UTC | null | null | null | null | 993,494 | null | 1 | 1 | sql|create-table|hana | 44,649 | <pre><code>create column table my_new_table as
(select * from my_existing_table)
</code></pre> |
38,761,021 | does Any == Object | <p>The following code in kotlin:</p>
<pre><code>Any().javaClass
</code></pre>
<p>Has value of <code>java.lang.Object</code>. Does that mean <code>Any</code> and <code>Object</code> are the same class? What are their relations?</p> | 38,761,552 | 5 | 1 | null | 2016-08-04 07:27:55.45 UTC | 3 | 2021-05-22 02:08:19.033 UTC | null | null | null | null | 411,965 | null | 1 | 56 | kotlin | 18,208 | <p>No.</p>
<p>From the <a href="https://kotlinlang.org/docs/reference/classes.html" rel="noreferrer">Kotlin docs</a>
(Emphasis mine)</p>
<blockquote>
<p>All classes in Kotlin have a common superclass <code>Any</code>, that is a default
super for a class with no supertypes declared:</p>
<p><code>class Exampl... |
2,579,290 | Looping through recordset with VBA | <p>I am trying to assign salespeople (rsSalespeople) to customers (rsCustomers) in a round-robin fashion in the following manner:</p>
<ol>
<li>Navigate to first Customer, assign the first SalesPerson to the Customer.</li>
<li>Move to Next Customer. If rsSalesPersons is not at EOF, move to Next SalesPerson; if rsSalesP... | 2,579,481 | 1 | 2 | null | 2010-04-05 15:44:07.223 UTC | 3 | 2010-04-05 17:55:07.217 UTC | 2010-04-05 16:23:04.383 UTC | null | 146,694 | null | 146,694 | null | 1 | 3 | sql|ms-access|vba|loops|recordset | 66,623 | <p>rsSalespeople.EOF doesn't indicate when you are on the last row, it indicates when you are PAST the last row. </p>
<p>So when your conditional hits the last salesperson EOF is false so it does a movenext (making EOF true) then the next pass through the loop is operating on the "EOF row" of rsSalespeople which you c... |
29,323,982 | Error: Cannot find module '../lib/cli' | <p>I'm completely new to javascript development and I'm getting the following error as I work my way through the backbone_blueprints book. Here is the error I get:</p>
<pre><code>> simple-blog@0.1.0 start /Users/noahc/Projects/backbone_blueprints/blog
> nodemon server.js
module.js:340
throw err;
... | 29,324,225 | 13 | 0 | null | 2015-03-28 23:46:13.987 UTC | 14 | 2021-10-14 14:28:31.227 UTC | null | null | null | null | 417,449 | null | 1 | 76 | javascript|npm | 78,424 | <p>I found the fix. I had to install nodemon globally doing this: <code>npm install nodemon -g</code></p> |
31,873,098 | Is it always bad to use Thread.Sleep()? | <p>I created an extension method for the the class <code>Random</code> which executes an <code>Action</code> (void delegate) at random times:</p>
<pre><code>public static class RandomExtension
{
private static bool _isAlive;
private static Task _executer;
public static void ExecuteRandomAsync(this Random ... | 31,873,159 | 5 | 0 | null | 2015-08-07 08:32:06.027 UTC | 3 | 2015-08-10 07:58:01.96 UTC | 2015-08-10 06:41:06.913 UTC | null | 5,193,057 | null | 5,193,057 | null | 1 | 35 | c#|multithreading|sleep | 6,202 | <p>Is using <code>Thread.Sleep</code> bad? Generally not, if you really want to suspend the <em>thread</em>. But in this case you don't want to suspend the <em>thread</em>, you want to suspend the <em>task</em>.</p>
<p>So in this case, you should use:</p>
<pre><code>await Task.Delay(minDuration);
</code></pre>
<p>Th... |
44,404,349 | PyQt showing video stream from opencv | <p>Try to link PyQt and Opencv video feed, can't understand how to apply while loop for continuously streaming video. It just take a still picture.Please can anyone help to solve the problem.</p>
<ul>
<li><p>PtQt=5</p></li>
<li><p>Python=3.6.1</p></li>
</ul>
<hr>
<pre><code>class App(QWidget):
def __init__(self... | 44,404,713 | 3 | 0 | null | 2017-06-07 05:39:40.113 UTC | 16 | 2020-03-08 01:06:44.14 UTC | 2018-03-23 00:07:43.863 UTC | null | 6,622,587 | null | 7,205,164 | null | 1 | 23 | python|opencv|pyqt|pyqt5|qpixmap | 58,917 | <p>The problem is that the function that obtains the image is executed only once and not updating the label.<br>
The correct way is to place it inside a loop, but it will result in blocking the main window. This blocking of main window can be solved by using the <code>QThread</code> class and send through a signal <cod... |
28,127,259 | Update the constant property of a constraint programmatically in Swift? | <p>I want to animate an object, so I declare a constraint and add it to the view. I then update the <code>constant</code> property of the constraint inside an <code>UIView</code> animation. Why doesn't this code move the object?</p>
<pre><code>UIView.animateWithDuration(1, animations: {
myConstraint.constant = 0 ... | 28,127,322 | 1 | 0 | null | 2015-01-24 15:54:50.557 UTC | 6 | 2020-04-28 13:12:52.817 UTC | 2017-04-08 07:47:25.543 UTC | null | 1,135,714 | null | 1,135,714 | null | 1 | 38 | ios|swift|nslayoutconstraint | 51,461 | <p>In order to declare an animation, you cannot re-define the constraint and call <code>updateConstraints</code>. You are supposed to change the <code>constant</code> of your constraint and follow the format below:</p>
<pre class="lang-swift prettyprint-override"><code>self.view.layoutIfNeeded()
UIView.animate(withDur... |
27,411,826 | Detect if checkbox is checked or unchecked in Angular.js ng-change event | <p>I want to detect if a checkbox has been checked or unchecked when a click is happening on the checkbox. </p>
<p>This is what I have: </p>
<pre><code><input type="checkbox" ng-model="answers[item.questID]" ng-change="stateChanged()" />
</code></pre>
<p>And then in the controller I have:</p>
<pre><code>$scop... | 27,411,893 | 2 | 0 | null | 2014-12-10 22:12:27.5 UTC | 11 | 2020-06-06 16:35:25.993 UTC | 2020-06-06 16:35:25.993 UTC | null | 472,495 | null | 362,479 | null | 1 | 45 | javascript|jquery|angularjs|checkbox|angularjs-scope | 125,254 | <p>You could just use the bound <code>ng-model</code> (<code>answers[item.questID]</code>) value itself in your ng-change method to detect if it has been checked or not.</p>
<p>Example:-</p>
<pre><code><input type="checkbox" ng-model="answers[item.questID]"
ng-change="stateChanged(item.questID)" /> <!-... |
39,249,043 | Firebase Auth get additional user info (age, gender) | <p>I am using Firebase Authentication for my Android app. Users have the ability to login with multiple providers (Google, Facebook, Twitter).</p>
<p>After a successful login, is there a way to get the user gender/birth date from these providers using the Firebase api?</p> | 39,281,270 | 4 | 0 | null | 2016-08-31 11:58:16.327 UTC | 9 | 2018-08-04 17:47:03.533 UTC | 2016-09-01 08:08:01.91 UTC | null | 1,039,278 | null | 1,039,278 | null | 1 | 16 | android|firebase-authentication | 19,800 | <p>Unfortunately, Firebase doesn't have any built-in functionality to get the user's gender/birthdate upon successful login. You would have to retrieve these data from each of the providers yourself. </p>
<p>Here is how you might get the user's gender from Google using <a href="https://developers.google.com/people/" r... |
3,198,947 | can I override z-index inheritance from parent element? | <p>Is there any way to override z-index inheritance from parent elements when using absolute position. I want 2222 div to be on top of 0000 div:</p>
<pre><code><div style="background-color:green; z-index:10; position:relative">
OOOO
</div>
<div style="background-color:yellow; z-index:5; position:r... | 3,199,134 | 1 | 0 | null | 2010-07-07 21:23:41.733 UTC | 5 | 2012-11-25 22:11:37.543 UTC | 2012-11-25 22:11:37.543 UTC | null | 7,382 | null | 385,959 | null | 1 | 34 | css|position|z-index | 28,629 | <p>I believe z-index is relative to the nearest positioned element. So, if you had two divs inside the "1111" div, they could be z-index'd relative to each other, but since 2222 is a child of 1111, it cannot be z-indexed relative to 0000, and will always be above 1111.</p> |
2,570,679 | Serialization with Qt | <p>I am programming a GUI with Qt library. In my GUI I have a huge std::map.</p>
<p>"MyType" is a class that has different kinds of fields.</p>
<p>I want to serialize the std::map. How can I do that? Does Qt provides us with neccesary features?</p> | 2,571,212 | 1 | 0 | null | 2010-04-03 08:37:25.367 UTC | 23 | 2017-01-08 12:35:40.977 UTC | 2013-03-27 12:29:10.057 UTC | null | 163,394 | null | 163,394 | null | 1 | 53 | c++|qt|serialization|qt4 | 42,324 | <p>QDataStream handles a variety of C++ and Qt data types. The complete list is available at <a href="http://doc.qt.io/qt-4.8/datastreamformat.html" rel="noreferrer">http://doc.qt.io/qt-4.8/datastreamformat.html</a>. We can also add support for our own custom types by overloading the << and >> operators. Here's t... |
38,559,755 | How to get current available GPUs in tensorflow? | <p>I have a plan to use distributed TensorFlow, and I saw TensorFlow can use GPUs for training and testing. In a cluster environment, each machine could have 0 or 1 or more GPUs, and I want to run my TensorFlow graph into GPUs on as many machines as possible.</p>
<p>I found that when running <code>tf.Session()</code> ... | 38,580,201 | 14 | 1 | null | 2016-07-25 04:30:38.39 UTC | 63 | 2022-04-03 20:48:48.993 UTC | 2016-07-26 02:37:25.15 UTC | null | 3,574,081 | null | 2,728,425 | null | 1 | 223 | python|gpu|tensorflow | 361,910 | <p>There is an undocumented method called <a href="https://github.com/tensorflow/tensorflow/blob/d42facc3cc9611f0c9722c81551a7404a0bd3f6b/tensorflow/python/client/device_lib.py#L27" rel="noreferrer"><code>device_lib.list_local_devices()</code></a> that enables you to list the devices available in the local process. (<s... |
41,883,573 | Melt using patterns when variable names contain string information - avoid coercion to numeric | <p>I am using the <code>patterns()</code> argument in <code>data.table::melt()</code> to melt data that has columns that have several easily-defined patterns. It is working, but I'm not seeing how I can create a character index variable instead of the default numeric breakdown.</p>
<p>For example, in data set 'A', the ... | 41,884,029 | 1 | 0 | null | 2017-01-26 21:48:28.563 UTC | 8 | 2021-07-09 10:36:18.843 UTC | 2021-07-09 10:36:18.843 UTC | null | 1,851,712 | null | 3,311,915 | null | 1 | 10 | r|data.table|melt | 803 | <p>From <code>data.table 1.14.1</code> (in development; <a href="https://github.com/Rdatatable/data.table/wiki/Installation#v1141-in-development--" rel="nofollow noreferrer">installation</a>), the new function <code>measure</code> makes it much easier to melt data with concatenated variable names to a desired format (s... |
49,442,165 | How do you add borderRadius to ImageBackground? | <p>The React Native <code>ImageBackground</code> component is supposed to accept the same prop signature as <code>Image</code>. However, it doesn't seem to accept <code>borderRadius</code>.</p>
<p>This has no affect.</p>
<pre><code><ImageBackground
style={{height: 100, width: 100, borderRadius: 6}}
source={{ u... | 49,442,166 | 3 | 0 | null | 2018-03-23 04:02:30.773 UTC | 3 | 2021-07-07 13:24:29.52 UTC | null | null | null | null | 25,197 | null | 1 | 61 | react-native | 34,485 | <p><sup><em>This took some digging so posting Q&A for others to find.</em></sup></p>
<p><code>ImageBackground</code> is basically a <code><View></code> wrapping an <code><Image></code>.<br />
The <code>style</code> prop only passes height and width to the <code><Image></code>.</p>
<p>To pass other... |
49,346,733 | How to downgrade vscode | <p>I am experiencing a problem with debugging in vscode just after the last update. There's something going on (<a href="https://github.com/Microsoft/vscode/issues/45657" rel="noreferrer">https://github.com/Microsoft/vscode/issues/45657</a>)</p>
<p>I'd like to check the previous version to see if my case is a problem ... | 49,347,158 | 3 | 1 | null | 2018-03-18 10:16:18.663 UTC | 23 | 2021-11-03 06:58:35.33 UTC | null | null | null | null | 430,531 | null | 1 | 136 | visual-studio-code|downgrade | 108,854 | <p>Previous versions of Visual Studio Code can be downloaded here:</p>
<p><a href="https://code.visualstudio.com/updates/" rel="noreferrer">https://code.visualstudio.com/updates/</a></p>
<p><strong>Pick the version you want from the list on the left</strong>, and then click on the download link for your OS as shown h... |
45,123,559 | Printing return value in function | <p>The <code>print(result)</code> in my <code>total</code> function isn't printing my result.</p>
<p>Shouldn't the <code>sums</code> function return the result value to the function that called it?</p>
<p>This is my code:</p>
<pre><code>def main():
#Get the user's age and user's best friend's age.
firstAge = i... | 45,123,596 | 2 | 1 | null | 2017-07-15 23:12:50.02 UTC | 3 | 2019-12-17 02:31:11.223 UTC | 2017-07-15 23:25:54.133 UTC | null | 5,393,381 | null | 8,304,707 | null | 1 | 5 | python|function|return | 62,504 | <p>It does return the result, but you do not assign it to anything. Thus, the result variable is not defined when you try to print it and raises an error.</p>
<p>Adjust your total function and assign the value that sums returns to a variable, in this case <code>response</code> for more clarity on the difference to the... |
22,504,566 | Renaming files using node.js | <p>I am quite new in using JS, so I will try to be as specific as I can :)</p>
<ul>
<li><p>I have a folder with 260 .png files with different country names: <code>Afghanistan.png</code>, <code>Albania.png</code>, <code>Algeria.png</code>, etc.</p></li>
<li><p>I have a .json file with a piece of code with all the ISO c... | 22,504,722 | 4 | 0 | null | 2014-03-19 11:35:09.733 UTC | 14 | 2019-05-14 12:57:05.937 UTC | 2014-03-19 11:57:27.38 UTC | null | 1,545,777 | null | 3,437,302 | null | 1 | 125 | javascript|node.js|rename | 153,329 | <p>You'll need to use <code>fs</code> for that: <a href="http://nodejs.org/api/fs.html" rel="noreferrer">http://nodejs.org/api/fs.html</a></p>
<p>And in particular the <code>fs.rename()</code> function:</p>
<pre><code>var fs = require('fs');
fs.rename('/path/to/Afghanistan.png', '/path/to/AF.png', function(err) {
... |
41,744,096 | Efficient way to update multiple fields of Django model object | <p>I'm trying to update user in Django database. </p>
<p>Fetched data is as follows :</p>
<pre><code>fetched_data = {
'id': 1,
'first_name': 'John',
'last_name': 'Doe',
'phone': '+32 12',
'mobile_phone': '+32 13',
'email': 'myemail@hotmail.com',
'username': 'myusername'
}
</code></p... | 41,744,338 | 5 | 0 | null | 2017-01-19 14:22:04.4 UTC | 7 | 2020-12-01 07:22:06.707 UTC | 2017-01-19 14:37:14.507 UTC | null | 2,063,361 | null | 3,895,259 | null | 1 | 42 | python|django | 41,643 | <p>You can update a row in the database without fetching and deserializing it; <a href="https://docs.djangoproject.com/en/1.10/ref/models/querysets/#update" rel="noreferrer"><code>update()</code></a> can do it. E.g.:</p>
<pre><code>User.objects.filter(id=data['id']).update(email=data['email'], phone=data['phone'])
</c... |
24,700,184 | How do I force a vertical scrollbar to appear? | <p>My site has both very short and longer pages. Since I center it in the viewport with <code>margin: 0 auto</code>, it jumps around a few pixels when switching from a page that has a scrollbar to one that hasn't and the other way around.</p>
<p>Is there a way to force the vertical scrollbar to always appear, so my si... | 24,700,199 | 2 | 0 | null | 2014-07-11 14:32:02.83 UTC | 11 | 2014-07-11 14:37:32.74 UTC | null | null | null | null | 1,012,942 | null | 1 | 83 | css|margin | 117,151 | <p>Give your <code>body</code> tag an <code>overflow: scroll;</code></p>
<pre><code>body {
overflow: scroll;
}
</code></pre>
<p>or if you only want a vertical scrollbar use <code>overflow-y</code></p>
<pre><code>body {
overflow-y: scroll;
}
</code></pre> |
46,159,097 | Adding headers to postForObject() method of RestTemplate in spring | <p>I am calling web service using below method.</p>
<pre><code>ResponseBean responseBean = getRestTemplate()
.postForObject(url, customerBean, ResponseBean.class);
</code></pre>
<p>Now my requirement got changed. I want to send 2 headers with the request.
How should I do it?</p>
<p>Customer bean is a class where... | 46,159,273 | 2 | 0 | null | 2017-09-11 15:19:40.62 UTC | 7 | 2019-04-26 10:22:59.143 UTC | 2018-01-31 07:05:31.133 UTC | null | 6,075,912 | null | 6,075,912 | null | 1 | 23 | spring|rest|web-services|restful-authentication | 53,674 | <p>You can use <code>HttpEntity<T></code> for your purpose. For example:</p>
<pre><code>CustomerBean customerBean = new CustomerBean();
// ...
HttpHeaders headers = new HttpHeaders();
headers.set("headername", "headervalue");
HttpEntity<CustomerBean> request = new HttpEntity<>(customerBean, h... |
2,933,266 | GWT vs. Cappuccino | <p>I'm in the planning stage of a web application and I'm trying to choose between GWT and Cappuccino. I have an idea of which one I think is better, but my partner is sold on the other choice. I was hoping to get some feedback on pros and cons for each from people who have used one or the other or both. Thanks in a... | 2,937,786 | 3 | 2 | null | 2010-05-29 00:31:59.75 UTC | 12 | 2012-10-29 17:23:50.11 UTC | null | null | null | null | 185,964 | null | 1 | 11 | gwt|cappuccino | 4,590 | <p><strong>Toolkit v/s Framework</strong></p>
<p>GWT is a <a href="http://en.wikipedia.org/wiki/Programming_tool" rel="nofollow noreferrer">toolkit</a>. Its strength lies in the tools it provides to create an application. It doesn't provide a framework though. Developers usually build a small framework over GWT to sui... |
3,119,108 | Return custom 403 error page with nginx | <p>Im trying to display the error page in /temp/www/error403.html whenever a 403 error occurs.</p>
<p>This should be whenever a user tries to access the site via https (ssl) and it's IP is in the blovkips.conf file, but at the moment it still shows nginx's default error page.
I have the same code for my other server (... | 3,154,509 | 4 | 0 | null | 2010-06-25 15:09:04.527 UTC | 4 | 2019-07-30 15:09:05.683 UTC | 2010-07-01 11:41:27.987 UTC | null | 138,541 | null | 138,541 | null | 1 | 14 | webserver|nginx|http-status-code-403|custom-error-pages | 57,063 | <p>I did heaps of googling before coming here but did some more just now, within 5 minutes I had my answer :P</p>
<p>Seems I'm not the only person to have this issue:</p>
<pre><code>error_page 403 /e403.html;
location = /e403.html {
root html;
allow all;
}
</code></pre>
<p><a href="http://www.cyberciti.biz/f... |
2,537,620 | Immutable type and property in C# | <p>What is meant by immutable type and immutable property in C# ? can you give simple example?</p> | 2,537,631 | 4 | 0 | null | 2010-03-29 11:56:54.86 UTC | 6 | 2021-05-27 07:39:39.137 UTC | 2012-05-13 10:07:16.717 UTC | null | 512,251 | null | 304,173 | null | 1 | 32 | c#|types|immutability | 19,963 | <p>An immutable type is a type of which its properties can only be set at initialization. Once an object is created, nothing can be changed anymore. An immutable property is simply a read-only property.</p>
<p>In the following example, <code>ImmutableType</code> is an immutable type with one property <code>Test</code>... |
2,641,236 | Make regular expression case insensitive in ASP.NET RegularExpressionValidator | <p>Given this regular expression: <code>"^[0-9]*\s*(lbs|kg|kgs)$"</code> how do I make it case insensitive? I am trying to use this in a .net regular expression validator, so I need to specify case insensitivity in the pattern.</p>
<p><strong>I can not use the RegexOptions programatically because I am specifying the... | 3,063,373 | 4 | 2 | null | 2010-04-14 21:37:13.71 UTC | 6 | 2022-06-08 20:27:59.193 UTC | 2013-02-24 00:20:50.313 UTC | null | 292,060 | null | 9,266 | null | 1 | 44 | .net|regex|validation | 31,282 | <p>I found out.</p>
<p>Case sensitive: <code>^[0-9]\s(lbs|kg|kgs)$</code></p>
<p>Case insensitive: <code>(?i:^[0-9]\s(lbs|kg|kgs)$)</code></p>
<p>I believe that this is specific to the .NET implementation of regular expressions. So if you use this in the RegularExpressionValidator you have to turn off client side v... |
74,113 | Access the camera with iOS | <p>It seems obvious that some people have been able to figure out how to access the iPhone camera through the SDK (Spore Origins, for example). How can this be done?</p> | 74,255 | 2 | 0 | null | 2008-09-16 16:15:04.483 UTC | 31 | 2019-01-10 05:38:00.31 UTC | 2019-01-10 05:25:12.903 UTC | null | 1,033,581 | Jason Francis | 5,338 | null | 1 | 35 | ios|iphone|camera | 59,909 | <p>You need to use the <code>UIImagePickerController</code> class, basically:</p>
<pre><code>UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = pickerDelegate
picker.sourceType = UIImagePickerControllerSourceTypeCamera
</code></pre>
<p>The <code>pickerDelegate</code> object ab... |
3,079,098 | The C# using statement, SQL, and SqlConnection | <p>Is this possible using a using statement C# SQL?</p>
<pre><code>private static void CreateCommand(string queryString,
string connectionString)
{
using (SqlConnection connection = new SqlConnection(
connectionString))
{
SqlCommand command = new SqlCommand(queryString, connection);
... | 3,079,141 | 5 | 0 | null | 2010-06-20 11:43:14.69 UTC | 3 | 2016-07-01 11:19:24.293 UTC | 2010-08-29 13:20:52.017 UTC | null | 63,550 | null | 287,745 | null | 1 | 12 | c#|sql|using-statement | 44,244 | <p>It's possible to do so in C# (I also see that code is exactly shown in MSDN <a href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.executenonquery.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.executenonquery.aspx</a>). However, if you nee... |
2,935,295 | What is the best way of determining a loop invariant? | <p>When using formal aspects to create some code is there a generic method of determining a loop invariant or will it be completely different depending on the problem?</p> | 3,414,198 | 5 | 0 | null | 2010-05-29 13:46:44.897 UTC | 10 | 2013-10-03 17:11:41.4 UTC | 2013-10-03 17:11:41.4 UTC | null | 96,780 | null | 330,373 | null | 1 | 16 | loops|invariants|formal-methods|loop-invariant | 30,490 | <p>It has already been pointed out that one same loop can have several invariants, and that Calculability is against you. It doesn't mean that you cannot try.</p>
<p>You are, in fact, looking for an <strong>inductive invariant</strong>: the word invariant may also be used for a property that is true at each iteration ... |
3,043,654 | Why use TagBuilder instead of StringBuilder? | <p>what's the difference in using tag builder and string builder to create a table in a htmlhelper class, or using the HtmlTable?</p>
<p>aren't they generating the same thing??</p> | 3,043,797 | 6 | 0 | null | 2010-06-15 08:35:56.39 UTC | 9 | 2015-01-25 08:53:59.393 UTC | null | null | null | null | 181,771 | null | 1 | 42 | c#|asp.net-mvc|extension-methods|stringbuilder|tagbuilder | 23,305 | <p><code>TagBuilder</code> is a class that specially designed for creating html tags and their content. You are right saying that result will be anyway a string and of course you still can use <code>StringBuilder</code> and the result will be the same, but you can do things easier with <code>TagBuilder</code>. Lets say... |
2,635,108 | Running another ruby script from a ruby script | <p>In ruby, is it possible to specify to call another ruby script using the same ruby interpreter as the original script is being run by?</p>
<p>For example, if a.rb runs b.rb a couple of times, is it possible to replace</p>
<pre><code>system("ruby", "b.rb", "foo", "bar")
</code></pre>
<p>with something like</p>
<p... | 2,636,767 | 7 | 0 | null | 2010-04-14 05:38:14.813 UTC | 12 | 2016-11-08 19:14:51.983 UTC | 2010-04-14 05:54:57.973 UTC | null | 38,765 | null | 38,765 | null | 1 | 38 | ruby | 48,384 | <p><a href="http://Avdi.Org/devblog/" rel="noreferrer">Avdi Grimm</a> wrote a series of articles on the <a href="http://devver.wordpress.com/" rel="noreferrer">Devver blog</a> about different ways to start Ruby subprocesses last summer:</p>
<ul>
<li><a href="http://devver.wordpress.com/blog/2009/06/a-dozen-or-so-ways-t... |
2,626,262 | Am I crazy? (How) should I create a jQuery content editor? | <p>Ok, so I created a CMS mainly aimed at Primary Schools. It's getting fairly popular in New Zealand but the one thing I hate with a passion is the largely bad quality of in browser WYSIWYG editors. I've been using KTML (made by InterAKT which was purchased by Adobe a few years ago). In my opinion this editor does a l... | 55,110,591 | 8 | 10 | null | 2010-04-13 00:21:39.103 UTC | 13 | 2019-03-11 21:21:05.563 UTC | 2010-06-28 03:17:18.813 UTC | null | 129,798 | null | 129,798 | null | 1 | 32 | jquery|editor|wysiwyg | 4,118 | <p>All these years later, I'm glad I didn't make my own! People have figured out that one can use <code>contenteditable</code> as an IO device to accept input then keep the actual HTML clean outside of the <code>contenteditable</code>. Two projects that I use that utilise this method are:</p>
<ul>
<li><a href="https:/... |
2,856,407 | How to get access to raw resources that I put in res folder? | <p>In J2ME, I've do this like that:
<code>getClass().getResourceAsStream("/raw_resources.dat");</code></p>
<p>But in android, I always get null on this, why?</p> | 2,859,721 | 8 | 2 | null | 2010-05-18 10:40:42.89 UTC | 18 | 2020-12-20 00:26:39.32 UTC | 2020-12-20 00:26:39.32 UTC | null | 1,783,163 | null | 309,955 | null | 1 | 58 | android|java-me|resources|inputstream|android-resources | 128,884 | <pre><code>InputStream raw = context.getAssets().open("filename.ext");
Reader is = new BufferedReader(new InputStreamReader(raw, "UTF8"));
</code></pre> |
2,668,909 | How to find the real user home directory using python? | <p>I see that if we change the <code>HOME</code> (linux) or <code>USERPROFILE</code> (windows) environmental variable and run a python script, it returns the new value as the user home when I try</p>
<pre><code>os.environ['HOME']
os.exp
</code></pre>
<p>Is there any way to find the real user home directory without rely... | 2,668,952 | 9 | 3 | null | 2010-04-19 15:59:03 UTC | 13 | 2022-01-24 07:58:38.753 UTC | 2022-01-24 07:58:38.753 UTC | null | 4,720,018 | null | 231,295 | null | 1 | 87 | python|linux|windows|directory|home-directory | 46,834 | <p>I think <a href="http://docs.python.org/library/os.path.html#os.path.expanduser" rel="noreferrer"><code>os.path.expanduser(path)</code></a> could be helpful.</p>
<blockquote>
<p>On Unix and Windows, return the argument with an initial component of <code>~</code> or <code>~user</code> replaced by that user‘s home di... |
2,604,869 | Finding the Eclipse Version Number | <p>I have posted how to find it in Eclipse Gallileo, but if anyone has information on older versions feel free to post it below.</p> | 2,605,648 | 11 | 1 | null | 2010-04-09 03:02:48.497 UTC | 18 | 2021-10-07 07:31:08.86 UTC | 2010-04-09 03:15:28.8 UTC | null | 165,495 | null | 165,495 | null | 1 | 117 | eclipse|version | 109,242 | <p>(Update September 2012):</p>
<p><a href="https://stackoverflow.com/users/1132117/mrt">MRT</a> points out <a href="https://stackoverflow.com/questions/2604869/finding-the-eclipse-version-number/2605648#comment16777920_2605648">in the comments</a> that "<a href="https://stackoverflow.com/questions/2313660/eclipse-ver... |
2,781,357 | File being used by another process after using File.Create() | <p>I'm trying to detect if a file exists at runtime, if not, create it. However I'm getting this error when I try to write to it: </p>
<blockquote>
<p>The process cannot access the file 'myfile.ext' because it is being used by another process.</p>
</blockquote>
<pre><code>string filePath = string.Format(@"{0}\M{1}.... | 2,781,509 | 11 | 0 | null | 2010-05-06 13:15:50.02 UTC | 15 | 2022-07-03 17:45:19.33 UTC | 2014-06-17 07:19:32.23 UTC | null | 505,893 | null | 329,746 | null | 1 | 134 | c#|file-io | 197,082 | <p>The <code>File.Create</code> method creates the file and opens a <code>FileStream</code> on the file. So your file is already open. You don't really need the file.Create method at all:</p>
<pre><code>string filePath = @"c:\somefilename.txt";
using (StreamWriter sw = new StreamWriter(filePath, true))
{
//write... |
2,882,551 | Can knowing C actually hurt the code you write in higher level languages? | <p>The question seems settled, beaten to death even. Smart people have said <a href="http://www.joelonsoftware.com/articles/fog0000000319.html" rel="nofollow noreferrer">smart things</a> on the subject. To be a really good programmer, <a href="https://stackoverflow.com/questions/296/should-i-learn-c">you need to know C... | 2,882,742 | 19 | 7 | 2010-05-21 13:52:52.833 UTC | 2010-05-21 13:44:19.593 UTC | 9 | 2010-05-27 22:58:04.97 UTC | 2017-05-23 12:09:50.057 UTC | null | -1 | null | 127,007 | null | 1 | 35 | c|language-agnostic|optimization|premature-optimization | 2,041 | <p>Neither knowing C nor knowing the lower-level details of implementation hurt you -- in themselves. What can and will hurt you is if you consistently think and work in terms of the low-level details, even when it's inappropriate.</p>
<p>The old saying was that "real programmers can write FORTRAN in <em>any</em> lang... |
2,816,715 | Branch from a previous commit using Git | <p>If I have <code>N</code> commits, how do I branch from the <code>N-3</code> commit?</p> | 2,816,728 | 21 | 0 | null | 2010-05-12 07:21:55.753 UTC | 450 | 2022-07-25 02:40:56.297 UTC | 2022-07-25 02:37:30.557 UTC | null | 365,102 | null | 86,112 | null | 1 | 2,365 | git|branch|git-branch | 997,872 | <p>Create the branch using a commit hash:</p>
<pre><code>git branch branch_name <commit-hash>
</code></pre>
<p>Or by using a symbolic reference:</p>
<pre><code>git branch branch_name HEAD~3
</code></pre>
<p>To checkout the branch while creating it, use:</p>
<pre><code>git checkout -b branch_name <commit-hash o... |
25,119,193 | Matplotlib pyplot axes formatter | <p>I have an image: </p>
<p><img src="https://i.stack.imgur.com/6Xuwb.png" alt="enter image description here"></p>
<p>Here in the y-axis I would like to get <code>5x10^-5 4x10^-5</code> and so on instead of <code>0.00005 0.00004</code>. </p>
<p>What I have tried so far is: </p>
<pre><code>fig = plt.figure()
ax = fi... | 25,119,872 | 1 | 0 | null | 2014-08-04 12:55:23.27 UTC | 1 | 2014-08-04 13:30:12.543 UTC | null | null | null | null | 3,397,243 | null | 1 | 12 | python|matplotlib|axes|ticker | 45,279 | <p>You can use <a href="http://matplotlib.org/api/ticker_api.html#matplotlib.ticker.FuncFormatter" rel="noreferrer"><code>matplotlib.ticker.FuncFormatter</code></a> to choose the format of your ticks with a function as shown in the example code below. Effectively all the function is doing is converting the input (a flo... |
23,654,168 | How to query the default include paths of clang++? | <p>How can I query the default include path of clang/clang++? I am trying to use a custom built clang compiler (the one that supports OpenMP), but it doesn't seem to find the STL libraries: </p>
<pre><code>/usr/local/bin/clang++ hello.cpp
hello.cpp:1:10: fatal error: 'iostream' file not found
#include <iostream>... | 23,658,940 | 2 | 0 | null | 2014-05-14 12:01:18.41 UTC | 1 | 2021-07-31 19:51:09.493 UTC | null | null | null | null | 2,202,787 | null | 1 | 31 | c++|clang | 28,043 | <p>You are looking for option <code>-v</code>. Compiling with <code>clang++ -c file.cc -v</code> will print among other things:</p>
<pre><code>#include "..." search starts here:
#include <...> search starts here:
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9
</code></pre>
<p>etc.</p> |
40,161,516 | How do you programmatically update query params in react-router? | <p>I can't seem to find how to update query params with react-router without using <code><Link/></code>. <code>hashHistory.push(url)</code> doesn't seem to register query params, and it doesn't seem like you can pass a query object or anything as a second argument.</p>
<p>How do you change the url from <code>/sh... | 40,161,954 | 16 | 1 | null | 2016-10-20 18:06:09.1 UTC | 30 | 2022-08-02 10:47:42.117 UTC | 2018-09-12 00:03:43.39 UTC | null | 6,368,697 | null | 3,745,986 | null | 1 | 220 | reactjs|react-router | 333,865 | <p>Within the <code>push</code> method of <code>hashHistory</code>, you can specify your query parameters. For instance, </p>
<pre><code>history.push({
pathname: '/dresses',
search: '?color=blue'
})
</code></pre>
<p>or</p>
<pre><code>history.push('/dresses?color=blue')
</code></pre>
<p>You can check out this <a... |
10,402,197 | How to create the linked server for SQL Server 2008 where we have the database from 2000 and 2005 | <p>Currently I am working on SQL Server 2000,2005 & 2008, my requirement is like,
the database available in SQL Server 2000 & 2005 will be available in 2008 using a linked server.</p>
<p>Let's say I have a database in SQL Server 2000 called <code>LIVE_2000</code> and in SQL Server 2005 it's called <code>LIVE_2... | 10,402,764 | 1 | 0 | null | 2012-05-01 18:17:52.743 UTC | 12 | 2022-04-18 15:26:20.913 UTC | 2012-05-01 21:18:19.453 UTC | null | 13,302 | null | 1,004,164 | null | 1 | 10 | sql-server|sql-server-2008|sql-server-2005|sql-server-2000 | 71,645 | <p>There are a <a href="http://www.c-sharpcorner.com/uploadfile/suthish_nair/linked-servers-in-sql-server-2008/" rel="noreferrer">few different ways</a> that you can create a linked server in SQL Server you can use the GUI in SQL Server Management Studio or via a script.</p>
<p>Using the <a href="http://msdn.microsoft... |
10,330,342 | Threejs: assign different colors to each vertex in a geometry | <p>I want to do picking via IdMapping in Three.js</p>
<p>Because of performance issues I only have one huge geometry, computed like this:</p>
<pre><code>for (var i = 0; i < numberOfVertices; i += 9) {
p1 = new THREE.Vector3(graphData.triangles.vertices[i+0], graphData.triangles.vertices[i+1], graphData.triangle... | 10,332,518 | 3 | 0 | null | 2012-04-26 09:05:57.597 UTC | 7 | 2015-08-07 22:35:29.99 UTC | 2012-09-27 21:13:07.753 UTC | null | 344,480 | null | 1,152,174 | null | 1 | 21 | javascript|webgl|three.js|picking | 38,700 | <p>It has to be geometry.vertexColors instead of geometry.colors (push a colour per vertex).</p>
<p>And the material:</p>
<pre><code>material = new THREE.MeshBasicMaterial({ vertexColors: THREE.VertexColors });
</code></pre> |
10,569,165 | How to map "jj" to Esc in emacs Evil mode | <p>Recently I tried Emacs and found Evil helpful to keep my vim custom. I'm used to typing "jj" to return normal mode from insert mode like many Vimers do but don't know how to make it in Evil mode.</p>
<p>I map it like this but seems not correct:</p>
<pre><code>(define-key evil-insert-state-map (kbd "jj") 'evil-norm... | 13,543,550 | 8 | 0 | null | 2012-05-13 03:40:03.377 UTC | 12 | 2022-04-15 06:45:27.793 UTC | null | null | null | null | 962,163 | null | 1 | 49 | emacs|evil-mode | 18,233 | <p>This works for me. It requires the <a href="http://emacswiki.org/emacs/KeyChord">KeyChord</a> library:</p>
<pre class="lang-el prettyprint-override"><code>;;Exit insert mode by pressing j and then j quickly
(setq key-chord-two-keys-delay 0.5)
(key-chord-define evil-insert-state-map "jj" 'evil-normal-state)
(key-cho... |
6,136,588 | Image Cropping using Python | <p>I am new to Python coding and I am writing a program in which I will be cropping an entered image and then saving it in a location. Now, I am being able to do this using a combination of PIL and pygame. But the problem is that, when I am selecting the image from the open pygame window, the selection area is totally ... | 6,140,013 | 2 | 0 | null | 2011-05-26 09:44:24.523 UTC | 9 | 2013-07-04 11:55:54.127 UTC | 2013-07-04 11:55:54.127 UTC | null | 569,101 | null | 754,398 | null | 1 | 9 | python|image-processing|python-imaging-library|crop | 15,187 | <p>I took a quick look and fixed a few other problems along the way. Essentially my changes do this:</p>
<ul>
<li>Draw the bounding box on a temporary image, set its alpha transparency, and then blit this over top of the main image.</li>
<li>Avoid extraneous drawing cycles (when the mouse isn't moving, no sense in dra... |
31,414,263 | Python using open (w+) FileNotFoundError | <p>I get a <code>FileNotFoundError</code> when trying to write to a file.
This is my code:</p>
<pre><code>def save_txt_individual_tracks(track, folder, i):
f = open(folder+str(i)+'.txt','w+')
for line in track:
l=str(line[0])+','+str(line[1])+','+str(line[2])+'\n'
f.write(l)
f.close(... | 31,414,405 | 1 | 2 | null | 2015-07-14 18:15:48.283 UTC | 3 | 2022-07-08 11:59:41.013 UTC | 2022-07-08 11:59:11.563 UTC | null | 4,298,200 | null | 5,106,470 | null | 1 | 21 | python | 44,318 | <p>You are getting the error because the directory - <code>E:/phoneTracks/TA92903URN7ff/</code> does not exist.</p>
<p>Example to show this error -</p>
<pre><code>In [57]: open('blah/abcd.txt','w+')
---------------------------------------------------------------------------
FileNotFoundError Tra... |
23,018,985 | Python cProfile results: two numbers for ncalls | <p>I just recently began profiling a server application that I've been working on, trying to find out where some excess processor time is being spent and looking for ways to make things smoother.</p>
<p>Overall, I think I've got a good hang of using cProfile and pstats, but I don't understand how some of functions lis... | 23,019,605 | 1 | 0 | null | 2014-04-11 17:28:50.437 UTC | 4 | 2020-08-07 19:41:48.467 UTC | null | null | null | null | 2,030,232 | null | 1 | 30 | python|cprofile | 5,530 | <p>The smaller number is the number of 'primitive' or non-recursive calls. The larger number is the total number of invocations, including recursive calls. Since deepcopy is implemented recursively, it means that you called deepcopy directly 1724 times, but that it ended up calling itself ~383k times to copy sub-obje... |
47,220,595 | Why the 6 in relu6? | <p>I've hacked a deep feed forward NN from scratch in R, and it seems more stable with "hard sigmoid" activations - max(0,min(1,x)) - than ReLU. Trying to port it to TensorFlow, and noticed that they don't have this activation function built in, only relu6, which uses an upper cutoff at 6. Is there a reason for this?
... | 47,220,765 | 3 | 0 | null | 2017-11-10 10:25:06.283 UTC | 11 | 2020-10-02 16:45:17.037 UTC | null | null | null | null | 8,918,908 | null | 1 | 66 | tensorflow | 33,711 | <p>From <a href="https://www.reddit.com/r/MachineLearning/comments/3s65x8/tensorflow_relu6_minmaxfeatures_0_6/" rel="noreferrer">this reddit thread</a>:</p>
<blockquote>
<p>This is useful in making the networks ready for fixed-point inference.
If you unbound the upper limit, you lose too many bits to the Q part
... |
21,524,642 | Splitting string with pipe character ("|") | <p>I'm not able to split values from this string: </p>
<p><code>"Food 1 | Service 3 | Atmosphere 3 | Value for money 1 "</code></p>
<p>Here's my current code:</p>
<pre><code>String rat_values = "Food 1 | Service 3 | Atmosphere 3 | Value for money 1 ";
String[] value_split = rat_values.split("|");
</code></pre>
<h3>... | 21,524,670 | 5 | 0 | null | 2014-02-03 10:19:02.73 UTC | 42 | 2016-04-27 16:32:02.033 UTC | 2014-02-03 10:22:13.143 UTC | null | 474,189 | null | 1,872,067 | null | 1 | 293 | java|regex | 281,785 | <p><code>|</code> is a metacharacter in regex. You'd need to escape it:</p>
<pre><code>String[] value_split = rat_values.split("\\|");
</code></pre> |
36,880,321 | Why redis can not set maximum open file | <pre>
1167:M 26 Apr 13:00:34.666 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
1167:M 26 Apr 13:00:34.667 # Redis can't set maximum open files to 10032 because of OS error: Operation not permitted.
1167:M 26 Apr 13:00:34.667 # Current maximum open files is 4096. maxclients has been ... | 36,880,362 | 3 | 0 | null | 2016-04-27 04:28:05.387 UTC | 10 | 2018-07-17 20:32:33.187 UTC | 2018-07-17 20:32:33.187 UTC | null | 3,309,030 | null | 3,686,582 | null | 1 | 23 | redis | 40,942 | <p>Redis will never change the maximum open files.</p>
<p>This is a OS configuration and it can be configured on a per user basis also. The error is descriptive and tells you: "increase 'ulimit -n'"</p>
<p>You can refer to this blog post on how to increase the maximum open files descriptors:
<a href="http://www.cyber... |
30,085,063 | Take a screenshot of RecyclerView in FULL length | <p>I want to get a "full page" screenshot of the activity. The view contains a RecyclerView with many items.</p>
<p>I can take a screenshot of the current view with this function:</p>
<pre><code>public Bitmap getScreenBitmap() {
View v= findViewById(R.id.container).getRootView();
v.setDrawingCacheEnabled(true... | 31,017,673 | 5 | 1 | null | 2015-05-06 18:43:45.527 UTC | 13 | 2020-09-22 18:02:11.85 UTC | null | null | null | null | 416,319 | null | 1 | 11 | java|android | 10,329 | <p>Inspired from Yoav's answer. This code works for recyclerview item types and probably regardless of it's size. </p>
<p>It was tested with a recyclerview having linearlayout manager and three item types. Yet to check it with other layout managers.</p>
<pre><code>public Bitmap getScreenshotFromRecyclerView(RecyclerV... |
28,348,879 | Only variable references should be returned by reference - Codeigniter | <p>After the server PHP upgrade I am getting the following error with PHP Version 5.6.2 on Apache 2.0</p>
<pre><code>A PHP Error was encountered
Severity: Notice
Message: Only variable references should be returned by reference
Filename: core/Common.php
Line Number: 257
</code></pre>
<p>How can I fix this?</p> | 28,348,880 | 3 | 0 | null | 2015-02-05 16:17:51.02 UTC | 44 | 2019-11-16 04:57:13.007 UTC | 2015-06-04 10:31:49.743 UTC | null | 1,263,783 | null | 1,263,783 | null | 1 | 179 | php|apache|codeigniter|apache2|codeigniter-2 | 307,395 | <p>Edit filename: core/Common.php, line number: 257</p>
<p>Before</p>
<pre><code>return $_config[0] =& $config;
</code></pre>
<p>After</p>
<pre><code>$_config[0] =& $config;
return $_config[0];
</code></pre>
<h1>Update</h1>
<p>Added by NikiC</p>
<p>In PHP assignment expressions always return the assign... |
8,763,046 | Facebook page automatic "like" URL (for QR Code) | <p>I was wondering if one could construct a URL for automatically liking a Facebook page.
Then this URL could be converted to a QR Code so people can automatically "like" your page by reading it with their smartphone. </p>
<p>I have been searching a lot, but all I could find so far are commercial services like <a hre... | 8,765,572 | 6 | 0 | null | 2012-01-06 19:06:35.047 UTC | 9 | 2013-10-04 09:14:40.577 UTC | 2012-01-30 18:36:57.363 UTC | null | 815,724 | null | 155,003 | null | 1 | 9 | facebook|url|qr-code|smartphone | 114,608 | <p>I'm not an attorney, but clicking the like button without the express permission of a facebook user might be a violation of facebook policy. You should have your corporate attorney check out the facebook policy.</p>
<p>You should encode the url to a page with a like button, so when scanned by the phone, it opens u... |
8,567,058 | FormStartPosition.CenterParent does not work | <p>In the following code, only the second method works for me (.NET 4.0). <code>FormStartPosition.CenterParent</code> does not center the child form over its parent.
Why?</p>
<p>Source: <a href="https://stackoverflow.com/questions/8566582/how-to-center-parent-a-non-modal-form-c/8566602#comment10620304_8566602">this S... | 8,567,083 | 14 | 0 | null | 2011-12-19 20:22:51.597 UTC | 4 | 2021-11-29 23:09:30.127 UTC | 2017-05-23 12:08:47.433 UTC | null | -1 | null | 600,135 | null | 1 | 38 | c#|winforms|forms|parent-child|centering | 33,005 | <p>This is because you are not telling <code>f2</code> who its <code>Parent</code> is.</p>
<p>If this is an MDI application, then <code>f2</code> should have its <code>MdiParent</code> set to <code>f1</code>.</p>
<pre><code>Form f2 = new Form() { Width = 400, Height = 300 };
f2.StartPosition = FormStartPosition.Cente... |
8,867,350 | How to set a program's command line arguments for GHCi? | <p>Suppose some Haskell file is executed with</p>
<pre><code>runghc Queens.hs gecode_compile
</code></pre>
<p>Now, this fails, and I want to debug it with <code>ghci</code>. How do I pass the option <code>gecode_compile</code> into the program, so <code>getArgs</code> will read it correctly?</p>
<p>Thanks!!</p> | 8,867,385 | 3 | 0 | null | 2012-01-15 03:33:23.22 UTC | 11 | 2017-05-20 17:49:40.493 UTC | 2017-05-20 17:49:40.493 UTC | null | 1,663,462 | null | 81,636 | null | 1 | 44 | haskell|ghci | 10,298 | <p>You can also set the command line arguments in ghci</p>
<pre><code>ghci> :set args foo bar
ghci> main
</code></pre>
<p>or</p>
<pre><code>ghci> :main foo bar
</code></pre> |
61,079,125 | MatToolbar throws error when using it with Angular 9 | <p>Angular version 9.2.0</p>
<p>When I import the <code>MatToolbarModule</code> in a module and use it in the html template, then I get the following error message:</p>
<blockquote>
<p>This likely means that the library (@angular/material/toolbar) which declares MatToolbarModule has not been processed correctly by ... | 62,066,224 | 13 | 0 | null | 2020-04-07 11:34:24.773 UTC | 4 | 2022-03-05 17:43:22.817 UTC | null | null | null | null | 10,114,038 | null | 1 | 62 | angular|angular-material | 81,624 | <p>Add below specific configuration in <code>package.json</code> and <code>npm install</code>.</p>
<pre><code>{
"scripts": {
"postinstall": "ngcc"
}
}
</code></pre>
<p><strong>Reference</strong>: <a href="https://angular.io/guide/ivy#speeding-up-ngcc-compilation" rel="noreferrer">h... |
48,290,976 | Login with ASP Identity fails every time with "Not Allowed" (even when 'email' and 'username' have the same value)) | <p>Registering a user works fine, as it logs in via this line:</p>
<pre><code>await _signInManager.SignInAsync(user, isPersistent: model.RememberMe);
</code></pre>
<p>But if I want to log in with the same user again does not work (the Task Result always returned "Not Allowed").</p>
<pre><code>var result = await _sig... | 48,292,037 | 3 | 0 | null | 2018-01-16 22:38:54.253 UTC | 8 | 2020-06-23 10:07:44.167 UTC | null | null | null | null | 1,819,747 | null | 1 | 30 | c#|asp.net|asp.net-mvc|asp.net-core|.net-core | 12,241 | <p>Ok, I figured it out. I looked at the source code here - <a href="https://github.com/aspnet/Identity/blob/dev/src/Identity/SignInManager.cs" rel="noreferrer">https://github.com/aspnet/Identity/blob/dev/src/Identity/SignInManager.cs</a>.</p>
<p>NotAllowed is only set here:</p>
<pre><code> protected virtual a... |
47,580,247 | Optional environment variables in Spring app | <p>In my Spring Boot app's <code>application.properties</code> I have this definition:</p>
<pre><code>someProp=${SOME_ENV_VARIABLE}
</code></pre>
<p>But this is an optional value only set in certain environments, I use it like this</p>
<pre><code>@Value("${someProp:#{null}}")
private String someProp;
</code></pre>
... | 47,581,132 | 3 | 2 | null | 2017-11-30 18:26:21.477 UTC | 7 | 2021-12-24 11:41:49.467 UTC | null | null | null | null | 961,721 | null | 1 | 41 | spring|spring-boot|environment-variables | 35,144 | <p>Provide a default value in the <code>application.properties</code></p>
<pre><code>someProp=${SOME_ENV_VARIABLE:#{null}}
</code></pre>
<p>When used like <code>@Value("${someProp})</code>, this will correctly evaluate to <code>null</code>. First, if <code>SOME_ENV_VARIABLE</code> is not found when <code>application.... |
43,555,378 | ts An async function or method in ES5/ES3 requires the 'Promise' constructor | <p>Hello I'm Using async/await in my TypeScript Project, But I Get this log:</p>
<p><em>[ts] An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your <code>--lib</code> option.</em></p>
<p>How Can I Solve Tha... | 43,555,510 | 13 | 0 | null | 2017-04-22 04:53:31.813 UTC | 13 | 2022-06-01 11:11:56.603 UTC | null | null | null | null | 7,428,622 | null | 1 | 137 | typescript|async-await | 99,003 | <p>As the error message says, add <code>lib: es2015</code> to your tsconfig.json</p>
<pre><code>// tsconfig.json
{
"compilerOptions": {
"lib": [ "es2015" ]
}
}
</code></pre>
<p>UPDATE: if this doesn't work for you, try this:</p>
<p>JetBrains IDE such as WebStorm, use its own implementation by default. Make s... |
22,358,831 | iOS 7.1 UitableviewCell content overlaps with ones below | <p>So I have code, which is sucessfully working on iOS 7.0 but not in 7.1. I have a simple tableview, with code:</p>
<pre><code>- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 10;
... | 22,359,028 | 7 | 0 | null | 2014-03-12 17:07:05.357 UTC | 12 | 2019-11-10 15:23:03.647 UTC | 2014-05-16 15:19:50.383 UTC | null | 2,424,762 | null | 3,396,994 | null | 1 | 31 | ios|uitableview|uilabel|autolayout|ios7.1 | 30,824 | <p>The issue has to do with the height of your cell. It isn't going to dynamically adjust that for you.</p>
<p>You'll probably notice that as you scroll and the view above goes out of view the overlapping text will disappear with it.</p>
<p>If you are wanting your text to clip at a certain height, then you need to se... |
41,679,324 | How do I pass parent state to its child components? | <p>I am new in React ES6 and I think I am modifying the state in a wrong way. My code is like this when I set state on parent component:</p>
<pre><code>class App extends React.Component {
constuctor(props) {
super(props);
this.state = {name:"helloworld"};
}
render() {
return(
<ChildComponent par... | 41,679,634 | 2 | 1 | null | 2017-01-16 15:04:52.877 UTC | 8 | 2020-06-12 13:34:06.433 UTC | 2020-06-12 13:34:06.433 UTC | null | 1,264,804 | null | 5,288,560 | null | 1 | 21 | reactjs|ecmascript-6 | 39,418 | <p>If you wanna pass the state {name:"helloworld"} do it like that:</p>
<pre><code>class App extends React.Component {
constuctor(props) {
super(props);
this.state = {name:"helloworld"};
}
render() {
return(
<ChildComponent {...this.state} />
);
}
}
</code></pre>
<p>and in the child com... |
42,017,587 | how to use php explode in laravel? | <pre><code> $user = $this->user;
$user->name = $request['name'];
$user->email = $request['email'];
$user->password = $request['password'];
$user->save();
$name = explode(' ' ,$user->name);
$profile= $user->userdetail()->create([
'... | 42,017,605 | 3 | 2 | null | 2017-02-03 05:48:23.167 UTC | 5 | 2018-08-29 05:03:15.54 UTC | null | null | null | null | 6,813,433 | null | 1 | 10 | laravel | 43,965 | <p><a href="http://php.net/manual/en/function.explode.php" rel="noreferrer"><code>explode()</code></a> returns an array of strings, so you can access elements by using keys:</p>
<pre><code>$profile = $user->userdetail()->create([
'user_id' => $request->input('id'),
'first_name' ... |
36,562,549 | What to do when autofilter in VBA returns no data? | <p>I am trying to filter a range of values and based on my criteria, at times I might have no data that fits my criteria. In that case, I do not want to copy any data from the filtered data. If there is filtered data, then I would like to copy it.</p>
<p>Here is my code:</p>
<pre><code>With Workbooks(KGRReport).Works... | 36,563,207 | 5 | 2 | null | 2016-04-12 02:23:22.383 UTC | 1 | 2018-08-10 11:51:57.18 UTC | 2017-05-23 12:15:51.85 UTC | null | -1 | null | 1,152,000 | null | 1 | 6 | excel|vba|autofilter | 44,069 | <p>Try error handling like so:</p>
<pre><code>Dim myRange As Range
On Error Resume Next
Set myRange = Range("your range here").SpecialCells(xlVisible)
On Error GoTo 0
If myRange Is Nothing Then
MsgBox "no cells"
Else
'do stuff
End If
</code></pre> |
34,956,899 | Does Spring @RequestBody support the GET method? | <p>I am trying to carry JSON data in an HTTP GET request message, but my Spring MVC server can't seem to retrieve the JSON data from the GET request body.</p> | 34,956,992 | 2 | 1 | null | 2016-01-22 22:20:59.163 UTC | 3 | 2021-08-08 00:46:46.133 UTC | 2016-01-22 23:26:53.263 UTC | null | 5,759,943 | null | 5,828,414 | null | 1 | 29 | spring-mvc|get | 39,622 | <p>HTTP's <code>GET</code> method does not include a request body as part of the spec. Spring MVC respects the HTTP specs. Specifically, servers are allowed to discard the body. The request URI should contain everything needed to formulate the response.</p>
<p>If you need a request body, change the request type to POS... |
24,005,678 | What is the equivalent of an Objective-C id in Swift? | <p>I'm trying to use an @IBAction to tie up a button click event to a Swift method. In Objective-C the parameter type of the IBAction is id. What is the equivalent of id in Swift?</p> | 24,005,679 | 2 | 0 | null | 2014-06-03 01:14:43.513 UTC | 9 | 2019-01-03 08:07:48.54 UTC | 2019-01-03 08:07:48.54 UTC | null | 100,297 | null | 196,964 | null | 1 | 62 | objective-c|swift | 23,421 | <h1>Swift 3</h1>
<p><code>Any</code>, if you know the sender is never <code>nil</code>.</p>
<pre><code>@IBAction func buttonClicked(sender : Any) {
println("Button was clicked", sender)
}
</code></pre>
<p><code>Any?</code>, if the sender could be <code>nil</code>.</p>
<pre><code>@IBAction func buttonClicked(sen... |
24,137,212 | "initialize" class method for classes in Swift? | <p>I'm looking for behavior similar to Objective-C's <code>+(void)initialize</code> class method, in that the method is called once when the class is initialized, and never again thereafter.</p>
<p>A simple <code>class init () {}</code> in a <code>class</code> closure would be really sleek! And obviously when we get t... | 24,137,213 | 6 | 0 | null | 2014-06-10 09:16:42.513 UTC | 19 | 2019-05-29 10:57:33.153 UTC | null | null | null | null | 2,228,559 | null | 1 | 77 | ios|swift | 66,785 | <p>If you have an Objective-C class, it's easiest to just override <code>+initialize</code>. However, make sure <strong>subclasses</strong> of your class also override <code>+initialize</code> or else your class's <code>+initialize</code> may get called more than once! If you want, you can use <code>dispatch_once()</co... |
35,974,249 | Using WireMock with SOAP Web Services in Java | <p>I am totally new to <a href="http://wiremock.org/index.html" rel="noreferrer">WireMock</a>.</p>
<p>Until now, I have been using mock responses using SOAPUI. My use case is simple:</p>
<p>Just firing SOAP XML requests to different endpoints (<a href="http://localhost:9001/endpoint1" rel="noreferrer">http://localhos... | 35,975,602 | 3 | 1 | null | 2016-03-13 18:46:12.24 UTC | 9 | 2022-05-02 20:51:31.057 UTC | null | null | null | null | 673,910 | null | 1 | 14 | java|web-services|soap|mocking|wiremock | 48,083 | <p>I'm WireMock's creator.</p>
<p>I've used WireMock to mock a collection of SOAP interfaces on a client project quite recently, so I can attest that it's possible. As for whether it's better or worse than SOAP UI, I'd say there are some definite upsides, but with some tradeoffs. A major benefit is the relative ease o... |
41,511,034 | How to rename AWS S3 Bucket | <p>After all the tough work of migration etc, I just realised that I need to serve the content using CNAME (e.g media.abc.com). The bucket name needs to start with media.abc.com/S3/amazon.com to ensure it works perfectly.</p>
<p>I just realised that S3 doesn't allow direct rename from the console.</p>
<p>Is there any w... | 41,515,547 | 3 | 0 | null | 2017-01-06 17:30:54.61 UTC | 41 | 2022-05-31 19:12:04.397 UTC | 2022-02-16 06:33:35.307 UTC | null | 992,887 | null | 1,026,780 | null | 1 | 207 | amazon-web-services|amazon-s3|cname | 126,686 | <p>I think only way is to create a new bucket with correct name and then copy all your objects from old bucket to new bucket. You can do it using Aws CLI.</p> |
6,159,186 | How do I write text over a picture in Android and save it? | <p>How can I write text on an image and then save it in Android?</p>
<p>Basically I want to let user write something on the images which my camera app will click for them. I can write and show it to them using the onDraw method on the preview of the camera. But after the user has clicked the picture I want to write th... | 6,159,192 | 4 | 0 | null | 2011-05-28 01:51:31.057 UTC | 18 | 2016-09-19 13:52:23.12 UTC | 2011-11-21 18:38:35.397 UTC | null | 300,977 | null | 418,366 | null | 1 | 26 | android | 39,363 | <p>You have to implement a canvas that allows the user to draw on it and then set the background of that canvas to that particular image. This is just a guess but its somewhere there abouts.</p> |
6,104,774 | How many table partitions is too many in Postgres? | <p>I'm partitioning a very large table that contains temporal data, and considering to what granularity I should make the partitions. The Postgres <a href="http://www.postgresql.org/docs/8.3/interactive/ddl-partitioning.html" rel="noreferrer">partition documentation</a> claims that "large numbers of partitions are lik... | 6,131,446 | 4 | 1 | null | 2011-05-24 01:10:22.313 UTC | 6 | 2011-05-25 21:54:03.117 UTC | null | null | null | null | 51,025 | null | 1 | 30 | performance|postgresql|partitioning | 18,067 | <p>The query planner has to do a linear search of the constraint information for every partition of tables used in the query, to figure out which are actually involved--the ones that can have rows needed for the data requested. The number of query plans the planner considers grows exponentially as you join more tables... |
52,535,985 | Couldn't connect to server 127.0.0.1:27017 connection attempt failed MongoDB | <p>I am working on Ubuntu OS 16.04. I am starting mongodb using commands::
<code>sudo service mongod start</code> and then
<code>mongo</code> </p>
<p>It generated this error for me::</p>
<pre><code>MongoDB shell version v4.0.1
connecting to: mongodb://127.0.0.1:27017
2018-09-27T16:50:41.345+0530 E QUERY [js] Error... | 52,536,473 | 9 | 2 | null | 2018-09-27 11:30:47.033 UTC | 8 | 2021-04-08 02:54:19.463 UTC | 2019-06-29 05:38:22.863 UTC | null | 6,487,762 | null | 6,487,762 | null | 1 | 15 | mongodb | 45,526 | <p>mongod --repair worked for me ,</p>
<pre><code>sudo mongod --repair
sudo mongod
</code></pre>
<p>Then open a different tab/terminal:</p>
<pre><code>mongo
</code></pre>
<p>After this your local setup will work properly</p> |
34,612,790 | How to assign rawValue of enum to variable with ObjectMapper? | <p>Hello I am using <a href="https://github.com/Hearst-DD/ObjectMapper">Object Mapper</a> with Alamofire in Swift and I am trying to map enum raw value to real Enum. </p>
<p>Here is my enum and also the code I am trying to use in function <em>mapping</em>. Can you please help me what to pass as argument to EnumTransfo... | 34,614,880 | 2 | 1 | null | 2016-01-05 13:23:32.207 UTC | 7 | 2018-10-17 15:37:02.977 UTC | 2016-01-05 14:28:07.62 UTC | null | 2,303,865 | null | 1,692,555 | null | 1 | 31 | swift|alamofire|objectmapper | 10,400 | <p>You don't have to pass an argument at all. All you have to do is to specify enum type as generic argument and ObjectMapper will take care for all enum initialization procedures.</p>
<pre><code> typeEnum <- (map["type"],EnumTransform<LevelType>())
</code></pre> |
5,611,448 | Tab to select autocomplete item in eclipse? | <p>I can't find either the term <strong>autocomplete</strong> or <strong>intellisense</strong> in Preferences->General->Keys in Eclipse 3.6.2.</p>
<p>I don't want to press enter to select an autocomplete item when I write code. Can I configure Eclipse to accept an autocomplete item with the <em>tab button</em>?</p> | 55,544,094 | 5 | 9 | null | 2011-04-10 11:28:42.617 UTC | 5 | 2019-04-05 22:24:45.89 UTC | 2011-04-11 09:15:40.047 UTC | null | 480,986 | null | 480,986 | null | 1 | 36 | eclipse|configuration|autocomplete|intellisense|preferences | 33,466 | <p>Just got it, go to Window>Preferences>General->Keys and look for "Word completion" as said before. Then near the bottom is "Binding" and to the right of it, a box with an arrow, clicking there you can select "Tab" to use Tabulator for autocomplete.</p> |
6,096,492 | Node.js and Express session handling - Back button problem | <p>I have a restricted area '/dashboard' in my Express application. I use a very small function to limit the access: </p>
<pre><code>app.get('/dashboard', loadUser, function(req, res){
res.render('dashboard', {
username: req.session.username
});
});
function loadUser(req, res, next){
if (req.session.auth) {... | 6,505,456 | 6 | 0 | null | 2011-05-23 11:23:08.357 UTC | 14 | 2022-05-30 14:46:48.43 UTC | null | null | null | null | 591,939 | null | 1 | 19 | session|node.js|express | 23,934 | <p>Josh's answer sadly didn't work for me.
But after some searching I found this
question: <a href="https://stackoverflow.com/questions/23094/whats-the-best-way-to-deal-with-cache-and-the-browser-back-button">What's the best way to deal with cache and the browser back button?</a></p>
<p>and adopted the answer the... |
5,990,240 | redirect all .html extensions to .php | <p>I want to update all the pages on a website to use include for the footer and header. So I have to change a lot of .html pages to .php.</p>
<p>So i'm looking for a way to redirect all pages that end with .html to the same url but ending in .php.</p> | 5,990,276 | 6 | 0 | null | 2011-05-13 09:59:38.783 UTC | 6 | 2019-05-04 14:11:52.707 UTC | null | null | null | null | 196,361 | null | 1 | 23 | .htaccess | 50,066 | <pre><code>RewriteEngine On
RewriteRule ^(.*)\.html$ $1.php [L]
</code></pre>
<p>If you want it to be done as a redirect instead of just a rewrite modify the <code>[L]</code> to <code>[L,R]</code></p> |
5,876,332 | How can I differentiate an object literal from other Javascript objects? | <p><strong>Update</strong>: I'm rephrasing this question, because the important point to me is identifying the object literal:</p>
<p>How can I tell the difference between an object literal and any other Javascript object (e.g. a DOM node, a Date object, etc.)? How can I write this function:</p>
<pre><code>function ... | 5,878,101 | 6 | 4 | null | 2011-05-03 22:11:39.387 UTC | 8 | 2022-05-02 23:32:31.5 UTC | 2022-05-02 23:32:31.5 UTC | null | 8,910,547 | null | 151,221 | null | 1 | 35 | javascript|types|comparison|object-literal | 21,894 | <blockquote>
<p>How can I tell the difference between an object literal and any other Javascript object (e.g. a DOM node, a Date object, etc.)?</p>
</blockquote>
<p>The short answer is you can't.</p>
<p>An <em>object literal</em> is something like:</p>
<pre><code>var objLiteral = {foo: 'foo', bar: 'bar'};
</code><... |
6,059,894 | How Draw rectangle in WPF? | <p>I need draw rectangle in canvas.
I know how to draw. But I did not get to do so would draw on a 360-degree</p>
<p>Example. blue, lilac, green they are one and the same rectangle, I changed the color for example
Red point is start position rectangle.</p>
<p><img src="https://i.stack.imgur.com/z2pmh.jpg" alt="enter ... | 6,060,658 | 7 | 4 | null | 2011-05-19 14:02:10.68 UTC | 5 | 2021-01-18 08:47:18.417 UTC | 2011-05-19 14:41:21.837 UTC | null | 450,466 | null | 450,466 | null | 1 | 19 | c#|wpf | 72,988 | <p>Unless you need a rotated rectangle I wouldn't bother using transforms. Just set Left and Top to the minimum x and y and width to max-x and height maxy-y.</p>
<pre class="lang-xml prettyprint-override"><code><Canvas x:Name="canvas" MouseDown="Canvas_MouseDown" MouseMove="Canvas_MouseMove" MouseUp="Canvas_MouseUp... |
5,995,433 | Removing console window for Glut/FreeGlut/GLFW? | <p>Under Visual C++, I have played around with Glut/FreeGlut/GLFW. It seems that everyone of these projects adds a CMD window by default. I tried removing it going under:</p>
<blockquote>
<p>Properties->C/C++->Preprocessor->Preprocessor
Definitions</p>
</blockquote>
<p>From here, I remove the _CONSOLE and replace... | 5,995,512 | 8 | 0 | null | 2011-05-13 17:10:51.067 UTC | 9 | 2017-10-17 19:06:05.963 UTC | 2011-05-13 18:21:18.663 UTC | null | 422,382 | null | 422,382 | null | 1 | 14 | c++|configuration|glut|freeglut|glfw | 16,380 | <p>Non-console Windows applications use the <code>WinMain()</code> entry point convention. Your Glut examples probably use the standard C <code>main()</code> convention.</p>
<p>If you want a quick fix just for the demo app, the WinAPI function <code>FreeConsole()</code> might help.</p>
<p>MSDN: <a href="http://msdn.m... |
5,598,743 | Finding element's position relative to the document | <p>What's the easiest way to determine an elements position relative to the document/body/browser window? </p>
<p>Right now I'm using <code>.offsetLeft/offsetTop</code>, but this method only gives you the position relative to the parent element, so you need to determine how many parents to the body element, to know th... | 5,598,797 | 9 | 0 | null | 2011-04-08 17:37:11.63 UTC | 35 | 2018-09-10 21:27:44.547 UTC | 2018-03-21 12:17:53.66 UTC | null | 555,121 | null | 449,132 | null | 1 | 150 | javascript|dom | 169,180 | <p>You can traverse the <code>offsetParent</code> up to the top level of the DOM.</p>
<pre><code>function getOffsetLeft( elem )
{
var offsetLeft = 0;
do {
if ( !isNaN( elem.offsetLeft ) )
{
offsetLeft += elem.offsetLeft;
}
} while( elem = elem.offsetParent );
return offsetLe... |
5,612,336 | TOGAF 9: difference between enterprise continuum and architecture repository | <p>I am trying to understand the core concepts of TOGAF 9.</p>
<p>No matter how often I read the explanation in the TOGAF manual, I don't understand the differences and the relationship between the Enterprise Continuum and the Architecture Repository.</p>
<hr />
<p>Some quotes from the documentation:</p>
<p><em>Enterpr... | 5,946,740 | 10 | 0 | null | 2011-04-10 14:16:28.72 UTC | 11 | 2020-07-09 11:34:35.3 UTC | 2020-06-20 09:12:55.06 UTC | null | -1 | null | 271,509 | null | 1 | 14 | architecture|togaf | 19,675 | <p>The architecture repository is the content - all your designs, policies, frameworks etc.</p>
<p>The continuum is the means by which you classify them. It's not just where something is in terms of foundation->organisation. It covers everything, so as per above you will have classifications of 3rd party frameworks,... |
17,883,088 | Sending mail using Outlook where the Send method fails | <p>I use this code to send email from Excel:</p>
<pre><code>Sub Mail_workbook_Outlook_1()
'Working in Excel 2000-2013
'This example send the last saved version of the Activeworkbook
'For Tips see: http://www.rondebruin.nl/win/winmail/Outlook/tips.htm
Dim OutApp As Object
Dim OutMail As Object
Set OutApp =... | 18,549,400 | 2 | 17 | null | 2013-07-26 13:48:57.84 UTC | 5 | 2020-06-23 08:13:30.053 UTC | 2020-06-23 08:13:30.053 UTC | null | 100,297 | null | 900,271 | null | 1 | 5 | excel|vba|email|outlook | 56,844 | <p>Change <code>.Send</code> to <code>.Display</code> and put <code>SendKeys "^{ENTER}"</code> before the <code>With OutMail</code> line.</p> |
19,753,910 | Behaviour of imeOptions, imeActionId and imeActionLabel | <p>I'm quite new to Android native development, and I'm trying to figure out how to customize the IME action buttons. I've looked at the Google documentation, but I can find very few information about the expected behaviour.</p>
<p>From the <a href="http://developer.android.com/guide/topics/ui/controls/text.html">offi... | 22,935,932 | 4 | 0 | null | 2013-11-03 14:15:46.863 UTC | 7 | 2017-03-08 21:59:04.613 UTC | null | null | null | null | 2,141,516 | null | 1 | 47 | android|android-input-method | 46,881 | <p>It's actually up to the input method app, not the Android framework itself, to decide what to do with the values you set.</p>
<p>The Android framework just passes the values you set through to the input method, which can then choose what buttons to show on the keyboard or an "extracted" <code>EditText</code> in ful... |
38,428,196 | How can I get the last/end offset of a kafka topic partition? | <p>I'm writing a <code>kafka</code> consumer using Java. I want to keep the real time of the message, so if there are too many messages waiting for consuming, such as 1000 or more, I should abandon the unconsumed messages and start consuming from the last offset.</p>
<p>For this problem, I try to compare the last comm... | 38,448,775 | 6 | 0 | null | 2016-07-18 03:31:54.81 UTC | 12 | 2020-07-09 20:13:01.21 UTC | 2020-06-19 18:48:17.373 UTC | null | 3,107,798 | null | 6,601,575 | null | 1 | 42 | java|apache-kafka|kafka-consumer-api | 99,103 | <p>The new consumer is also complicated.</p>
<p><code>//assign the topic
consumer.assign();</code></p>
<p><code>//seek to end of the topic
consumer.seekToEnd();</code></p>
<p><code>//the position is the latest offset
consumer.position();</code></p> |
26,553,578 | Using pop for removing element from 2D array | <p>In the below random array:</p>
<pre><code>a = [[1,2,3,4],
[6,7,8,9]]
</code></pre>
<p>Could you please tell me how to remove element at a specific position. For example, how would I remove <code>a[1][3]</code>?</p>
<p>I understand <code>list.pop</code> is used for only list type DS here.</p> | 26,553,609 | 4 | 0 | null | 2014-10-24 17:57:43.247 UTC | null | 2020-05-18 06:15:51.193 UTC | 2014-10-24 18:01:20.847 UTC | user2555451 | null | null | 3,970,193 | null | 1 | 5 | python|list | 38,953 | <p>Simple, just pop on the list item.</p>
<pre><code>>>> a = [[1,2,3,4], [6,7,8,9]]
>>> a[1].pop(3)
>>> a
[[1, 2, 3, 4], [6, 7, 8]]
</code></pre> |
27,861,720 | How to set default php.ini to be used, OSX Yosemite | <p>I set up a new environment using OSX Yosemite.</p>
<p>I'm using the built-in PHP.</p>
<p>I'd like to change some config in php.ini such as date.timezone but none of the modifications are working despite restarting the apache server (sudo apachectl restart).</p>
<p>phpinfo() is giving a different path than php --ini ... | 28,515,549 | 4 | 0 | null | 2015-01-09 13:31:58.773 UTC | 9 | 2020-05-10 06:12:06.307 UTC | 2020-06-20 09:12:55.06 UTC | null | -1 | null | 3,204,919 | null | 1 | 17 | php|macos|apache | 46,498 | <p>move the configuration file to the right spot and update the timezone.</p>
<pre><code>$ sudo cp /etc/php.ini.default /etc/php.ini
</code></pre>
<p>Open the config file /etc/php.ini, find the line that sets your timezone and update it correspondingly.</p>
<pre><code>date.timezone = Europe/Berlin
</code></pre>
<p>... |
43,014,993 | Don't know how to build task 'start' when run 'cap production deploy' for capistrano 3.8.0 with Rails | <p>I tried to deploy my rails site using capistrano.
So when i ran</p>
<pre><code>cap production deploy
</code></pre>
<p>This is what i got </p>
<pre><code>(Backtrace restricted to imported tasks)
cap aborted!
Don't know how to build task 'start' (see --tasks)
Tasks: TOP => production
</code></pre>
<p>This is m... | 43,021,458 | 3 | 0 | null | 2017-03-25 09:59:41.55 UTC | 11 | 2021-05-18 17:07:23.68 UTC | null | null | null | null | 3,403,614 | null | 1 | 36 | ruby-on-rails|capistrano | 16,772 | <p>Add <code>install_plugin Capistrano::Puma</code> into your <strong>Capfile</strong> after <code>require 'capistrano/puma'</code>.</p>
<p><code>capistrano3-puma</code> moved to 3.0 a few days ago. This line is required for loading default puma tasks in this version.</p>
<p>See <a href="https://github.com/seuros/cap... |
25,297,489 | Accept HTTP Request in R shiny application | <p>I have a shiny app that I have made that needs to get its data from another server, i.e. the other server when the shiny app is opened sends a request to the shiny app to open the app and feed it the data that it needs.</p>
<p>To simulate this I can send the following to the R shiny app when I open the app in firef... | 25,297,636 | 4 | 1 | null | 2014-08-13 22:50:37.257 UTC | 25 | 2021-10-16 06:08:22.073 UTC | null | null | null | null | 3,814,836 | null | 1 | 24 | r|shiny|shiny-server | 15,396 | <p>You can receive GET requests using <code>session$clientData</code>. An example run the following </p>
<pre><code>library(shiny)
runApp(list(
ui = bootstrapPage(
textOutput('text')
),
server = function(input, output, session) {
output$text <- renderText({
query <- parseQueryString(session$c... |
25,145,609 | How to return a Json object from a C# method | <p>I am trying to fix an ASP.NET WebAPI method where a Json response is required. However it's returning a string instead.</p>
<p>Initially it was returing XML format, but I've added this line to the mvc code in App_Start\WebApiConfig.cs in order to return Json by default. </p>
<pre><code>config.Formatters.Remove(con... | 25,146,052 | 5 | 2 | null | 2014-08-05 18:12:14.21 UTC | 7 | 2022-09-14 09:27:46.707 UTC | 2019-08-31 22:01:45.333 UTC | null | 7,911,776 | null | 1,472,806 | null | 1 | 25 | c#|asp.net-web-api|json.net | 126,223 | <p><code>resp</code> is already a JSON string, but it is not valid JSON (the keys are not wrapped in quotes (<code>"</code>). If it is returned to angular, the JavaScript JSON.parse() method is unable to deserialize it. However, you can use JSON.NET in deserialize it to a JObject and serialize it again into valid JSON ... |
27,501,819 | How to add a client side pkcs12 certificate to Postman Chrome, W7 ? | <p>I try to test a 'strange' GET request where I have to provide a BASIC authentication and a client side certificate. </p>
<p>I try to check it with Postman Chrome but I did not understand how to link the certificate from chrome personal certificate to my request. </p>
<p>I saw this discussion : <a href="https://git... | 29,830,140 | 2 | 1 | null | 2014-12-16 09:53:30.18 UTC | 7 | 2019-09-03 16:42:45.96 UTC | null | null | null | null | 1,959,005 | null | 1 | 14 | java|android|google-chrome|ssl|postman | 45,818 | <p>I was having a similar issue and just got it working. My private key and cert were stored in a .pem file, so I first needed to put them in to a format that Windows would use. I did that with the following command:</p>
<pre><code>openssl pkcs12 -inkey mycertandkey.pem -in mycert.crt -export -out mycertandkey.pfx
</c... |
21,733,856 | python: Is there a downside to using faulthandler? | <p>Python 3.3 includes a module named <code>faulthandler</code> that displays helpful traceback information if a segfault occurs. (For Python versions prior to 3.3, the module can be <a href="https://pypi.python.org/pypi/faulthandler/">obtained from PyPI</a>.)</p>
<p>The module is not enabled by default. It is enabl... | 29,246,977 | 1 | 1 | null | 2014-02-12 16:34:11.763 UTC | 7 | 2020-07-02 11:50:16.49 UTC | 2020-07-02 11:50:16.49 UTC | null | 6,573,902 | null | 162,094 | null | 1 | 31 | python|python-3.x|python-3.3|traceback|faulthandler | 7,906 | <blockquote>
<p>This feature is very useful. Is there any particular reason it isn't
enabled by default? Does it have any negative effects on performance?</p>
</blockquote>
<p>The reason is that faulthandler remembers the file descriptor of stderr, usually fd 2. The problem is that fd 2 may become something else, ... |
51,489,904 | Angular 6, should I put secret environment variables in environment.ts file? | <p>There are two sub-questions:</p>
<ol>
<li><p>Should I put secret environment variables in the <code>environment.ts</code> file?</p>
</li>
<li><p>The <code>process</code> variable shim is gone. If I use it, <code>tsc</code> will throw an error: <code>Cannot find name 'process'</code>.</p>
</li>
</ol>
<p>Here is my th... | 51,490,031 | 1 | 2 | null | 2018-07-24 03:07:24.207 UTC | 9 | 2020-12-21 08:07:01.427 UTC | 2020-12-21 08:07:01.427 UTC | null | 6,463,558 | null | 6,463,558 | null | 1 | 30 | angular|angular-cli|angular6|angular-cli-v6 | 23,403 | <p><strong>TL; DR</strong></p>
<p>You should not treat <code>environment.ts</code> as something similar to <code>process.env</code>. </p>
<p>The name is similar but the behaviour is absolutely not. All the settings from <code>environment.ts</code> will directly go to your code. That's why it is not secure to put secr... |
32,806,287 | How to call a model function inside the controller in Laravel 5 | <p>I have been facing a problem of not able to use the model inside the controller in the new laravel framework version 5. i created the model using the artisan command
<strong>"php artisan make:model Authentication"</strong> and it created the model successfully inside the app folder, after that i have created a smal... | 32,806,828 | 8 | 1 | null | 2015-09-27 09:08:11.943 UTC | 3 | 2020-02-22 08:33:28.43 UTC | null | null | null | null | 4,188,858 | null | 1 | 15 | php|laravel-5 | 106,553 | <p>A quick and dirty way to run that function and see the output would be to edit <code>app\Http\routes.php</code> and add:</p>
<pre><code>use App\Authentication;
Route::get('authentication/test', function(){
$auth = new Authentication();
return $auth->test();
});
</code></pre>
<p>Then visit your site and... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.