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,149,276 | How to convert "camelCase" to "Camel Case"? | <p>I’ve been trying to get a JavaScript regex command to turn something like <code>"thisString"</code> into <code>"This String"</code> but the closest I’ve gotten is replacing a letter, resulting in something like <code>"Thi String"</code> or <code>"This tring"</code>. Any ideas?</p>
<p>To clarify I can handle the sim... | 4,149,393 | 12 | 3 | null | 2010-11-10 21:30:59.047 UTC | 38 | 2022-04-29 17:48:07.923 UTC | 2019-08-15 17:10:10.833 UTC | null | 4,642,212 | null | 453,211 | null | 1 | 202 | javascript|regex | 88,881 | <pre><code>"thisStringIsGood"
// insert a space before all caps
.replace(/([A-Z])/g, ' $1')
// uppercase the first character
.replace(/^./, function(str){ return str.toUpperCase(); })
</code></pre>
<p>displays </p>
<pre><code>This String Is Good
</code></pre>
<p><div class="snippet" data-lang="js" da... |
4,444,477 | How to tell if a string contains a certain character in JavaScript? | <p>I have a page with a textbox where a user is supposed to enter a 24 character (letters and numbers, case insensitive) registration code. I used <code>maxlength</code> to limit the user to entering 24 characters.</p>
<p>The registration codes are typically given as groups of characters separated by dashes, but I wo... | 4,444,497 | 21 | 4 | null | 2010-12-14 21:35:13.307 UTC | 61 | 2022-03-06 05:35:12.5 UTC | 2017-12-26 11:26:56.493 UTC | null | 680,421 | null | 238,260 | null | 1 | 413 | javascript|string | 951,303 | <p>To find "hello" in <code>your_string</code></p>
<pre><code>if (your_string.indexOf('hello') > -1)
{
alert("hello found inside your_string");
}
</code></pre>
<p>For the alpha numeric you can use a regular expression:</p>
<p><a href="http://www.regular-expressions.info/javascript.html" rel="noreferrer">http://... |
4,224,606 | How to check whether a script is running under Node.js? | <p>I have a script I am requiring from a Node.js script, which I want to keep JavaScript engine independent.</p>
<p>For example, I want to do <code>exports.x = y;</code> only if it’s running under Node.js. How can I perform this test?</p>
<hr>
<p>When posting this question, I didn’t know the Node.js modules feature ... | 5,197,219 | 22 | 8 | null | 2010-11-19 11:41:39.187 UTC | 41 | 2022-08-01 13:56:06.24 UTC | 2019-09-16 18:31:44.207 UTC | null | 4,642,212 | null | 299,920 | null | 1 | 178 | javascript|node.js|commonjs | 107,589 | <p><strong>By looking for CommonJS support</strong>, this is how the <a href="http://underscorejs.org/" rel="noreferrer">Underscore.js</a> library does it:</p>
<p>Edit: to your updated question:</p>
<pre><code>(function () {
// Establish the root object, `window` in the browser, or `global` on the server.
va... |
4,210,042 | How do I exclude a directory when using `find`? | <p>How do I exclude a specific directory when searching for <code>*.js</code> files using <code>find</code>?</p>
<pre><code>find . -name '*.js'
</code></pre> | 4,210,072 | 46 | 0 | null | 2010-11-17 22:57:02.213 UTC | 535 | 2022-09-23 23:38:27.287 UTC | 2022-07-10 23:00:39.287 UTC | null | 365,102 | null | 143,269 | null | 1 | 1,896 | linux|shell|find | 1,484,910 | <p>Use the <code>-prune</code> primary. For example, if you want to exclude <code>./misc</code>:</p>
<pre><code>find . -path ./misc -prune -o -name '*.txt' -print
</code></pre>
<p>To exclude multiple directories, OR them between parentheses.</p>
<pre><code>find . -type d \( -path ./dir1 -o -path ./dir2 -o -path ./dir3 ... |
14,483,083 | How to get notifications when the headphones are plugged in/out? Mac | <p>I'd like to get notified when headphones are plugged in or out in the headphone jack.<br>
I've searched around for this on stackoverflow but I can't seem to find what I'm looking for for the Mac, I can only find for iOS.<br>
So, do you have any ideas on how to perform this? What I want to do with this is: when headp... | 14,490,863 | 2 | 6 | null | 2013-01-23 15:22:37.753 UTC | 10 | 2020-10-29 18:58:08.203 UTC | 2013-01-23 22:50:57.873 UTC | null | 474,896 | null | 848,311 | null | 1 | 14 | objective-c|macos|cocoa|core-audio|headphones | 6,550 | <p>You can observe changes using the <code>CoreAudio</code> framework. </p>
<p>Both headphones and the speakers are data sources on the same audio output device (of type built-in). One of both will be on the audio device based on headphones being plugged in or not. </p>
<p>To get notifications you listen to changes o... |
14,920,459 | Placing ViewPager as a row in ListView | <p>I try to use ViewPager as a row ins ListView but a get a bizarre behaviuor - Only the first row works, but when I scroll the list it disappears. When I scroll an empty row, suddenly the row above is being viewed.
It seems like Android creates a single pager and use it for all rows.</p>
<p>This is what I see when I... | 15,071,212 | 4 | 2 | null | 2013-02-17 11:11:32.653 UTC | 12 | 2017-10-03 04:06:18.677 UTC | 2017-10-03 04:06:18.677 UTC | null | 1,402,846 | null | 475,472 | null | 1 | 16 | android|android-layout|listview|android-fragments|android-widget | 11,564 | <p>Whenever you need to dynamically add pagers, you need to set an ID for each pager using <code>ViewPager.setId()</code>.</p> |
14,737,773 | Replacing occurrences of a number in multiple columns of data frame with another value in R | <p><strong>ETA:</strong> the point of the below, by the way, is to not have to iterate through my entire set of column vectors, just in case that was a proposed solution (just do what is known to work once at a time).</p>
<hr>
<p>There's plenty of examples of replacing values in a <em>single</em> vector of a data fra... | 14,737,832 | 4 | 0 | null | 2013-02-06 20:05:51.933 UTC | 9 | 2016-11-11 16:33:16.337 UTC | 2017-05-23 12:10:38.383 UTC | null | -1 | null | 495,990 | null | 1 | 27 | r|replace|indexing | 53,692 | <p>you want to search through the whole data frame for any value that matches the value you're trying to replace. the same way you can run a logical test like replacing all missing values with 10..</p>
<pre><code>data[ is.na( data ) ] <- 10
</code></pre>
<p>you can also replace all 4s with 10s.</p>
<pre><code>da... |
14,670,394 | Does Firebase allow an app to start in offline mode? | <p>I'm thinking of using firebase to write a mobile app using PhoneGap and the HTML5 Application Cache.</p>
<p>Lets suppose each user has a list of TODO items. If the app is started when the phone is offline, will it be able to load data from the previous session and sync when a connection is established? If so I'm wo... | 14,670,601 | 3 | 0 | null | 2013-02-03 07:32:20.64 UTC | 16 | 2020-07-15 00:04:22.167 UTC | null | null | null | null | 94,078 | null | 1 | 32 | offline|offline-caching|offlineapps|firebase | 15,919 | <p>The short answer is: not yet.</p>
<p>Once an app has connected to Firebase, the client will cache data locally and be able to access data where there is an outstanding "on" callback even after a network connection is lost. However, this data is not persisted to disk, the "offline mode" will only work while the app ... |
14,643,836 | Dynamic class in Angular.js | <p>I want to dynamically add a css class to an <code><li></code> element I am looping over.
The loop is like this:</p>
<pre><code><li ng-repeat="todo in todos" ng-class="{{todo.priority}}">
<a href="#/todos/{{todo.id}}">{{todo.title}}</a>
<p>{{todo.description}}</p>
</li>
... | 14,644,299 | 4 | 0 | null | 2013-02-01 10:05:57.5 UTC | 12 | 2020-06-18 17:21:42.667 UTC | null | null | null | null | 1,267,056 | null | 1 | 54 | class|dynamic|angularjs | 85,692 | <p>You can simply assign a function as an expression and return proper class from there.
<strong>Edit: there is also better solution for dynamic classes. Please see note below.</strong></p>
<p>Snippet from view:</p>
<p><code><div ng-class="appliedClass(myObj)">...</div></code></p>
<p>and in the controlle... |
14,714,877 | Mismatch Detected for 'RuntimeLibrary' | <p>I downloaded and extracted Crypto++ in C:\cryptopp. I used Visual Studio Express 2012 to build all the projects inside (as instructed in readme), and everything was built successfully. Then I made a test project in some other folder and added cryptolib as a dependency. After that, I added the include path so I can e... | 18,635,749 | 4 | 3 | null | 2013-02-05 19:00:39.19 UTC | 43 | 2019-12-03 11:26:03.61 UTC | 2015-10-24 01:58:21.83 UTC | null | 608,639 | null | 2,007,674 | null | 1 | 148 | c++|hash|compilation|sha256|crypto++ | 144,803 | <p>(This is already answered in comments, but since it lacks an actual <em>answer</em>, I'm writing this.)</p>
<p>This problem arises in newer versions of Visual C++ (the older versions usually just silently linked the program and it would crash and burn at run time.) It means that some of the libraries you are linkin... |
3,036,397 | How to reset IIS (or otherwise clear cache) when restarting a web application? | <p>I'm working on an ASP.NET app that keeps a lot of data cached. This data remains cached when I restart the app, so I have to reset IIS if I want to rerun the code that gets the data, otherwise it's just taken from the cache. Is there a way that I can automate this?</p> | 3,036,498 | 2 | 1 | null | 2010-06-14 10:14:49.413 UTC | 3 | 2010-06-14 10:32:21.477 UTC | null | null | null | null | 181,771 | null | 1 | 5 | asp.net|visual-studio-2008|iis|caching | 45,034 | <p>Running <code>iisreset</code> from an elevated (on Vista/Win7/Win2008) command prompt will restart IIS and all hosted applications. This is very quick if you keep the command prompt open: up arrow and enter to repeat last command.</p> |
33,905,687 | Error: File path too long on windows, keep below 240 characters | <p>So, I made some changes to my build.gradle(app) file and android studio gives me this error (open the image in new tab for better viewing):
<a href="https://i.stack.imgur.com/ZYlIc.jpg"><img src="https://i.stack.imgur.com/ZYlIc.jpg" alt="Error description from Logcat"></a></p>
<p>My build.gradle(app) file (this is ... | 33,911,791 | 14 | 1 | null | 2015-11-24 23:17:05.073 UTC | 27 | 2020-12-29 13:08:13.86 UTC | 2016-01-28 01:07:17.147 UTC | null | 5,039,732 | null | 5,039,732 | null | 1 | 69 | android|android-gradle-plugin|google-play-services | 67,606 | <p>I just ran into the same issue. I don't know a fix for your exact problem, but I found a work around; I see your project has a deep file path hierarchy. Why not just move your project up from a lower level? </p>
<p>Ex: <code>C:\Projects\YourProject</code></p>
<p>That fixed the problem for me.</p> |
53,631,992 | AWS Cloudformation: Conditionally create properties of resources | <p>I know that it is possible via the use of <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/conditions-section-structure.html" rel="noreferrer">Conditions</a> to conditionally (what else?) create resources.</p>
<p>I am trying to find a way though to conditionally create properties of resources... | 55,273,157 | 2 | 1 | null | 2018-12-05 12:08:59.37 UTC | 9 | 2019-03-21 03:03:37.14 UTC | null | null | null | null | 2,409,793 | null | 1 | 33 | amazon-web-services|amazon-cloudformation | 20,558 | <p>This might be a little late, but I recently had a same question.</p>
<p>From <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-conditions.html#w2ab1c21c24c21c39b8c10" rel="noreferrer">AWS docs</a>, you can use <strong>Fn::If</strong> to set properties accordingly.<... |
38,585,848 | Programmatically removes files/folder resides in docker container | <p>I am currently exploring on how we can remove the file/folder resides inside docker container programmatically . I know we can copy files from container to host using docker cp. However, I am looking for something like docker mv or docker rm which allows me to move or remove files/folders inside docker.</p>
<p>The ... | 38,591,846 | 3 | 0 | null | 2016-07-26 09:20:21.857 UTC | 4 | 2016-07-26 13:53:58.807 UTC | 2016-07-26 09:27:24.487 UTC | null | 2,056,961 | null | 2,056,961 | null | 1 | 33 | docker | 67,398 | <p>You can use below command to remove the files from program running on host</p>
<pre><code>docker exec <container> rm -rf <YourFile>
</code></pre>
<p>However if old files exist because the container were never removed, then general practice is to remove the container once the all test suite execution is... |
31,338,117 | CQRS - is it allowed to call the read side from the write side? | <p>I started with reading about CQRS and I'm little confused.</p>
<p>Is it allowed to call the read side within the write side for getting additional informations?</p>
<p><a href="http://cqrs.nu/Faq/command-handlers">http://cqrs.nu/Faq/command-handlers</a> here they say it is not allowed, but in the cqrs journey code... | 31,339,148 | 4 | 0 | null | 2015-07-10 10:07:29.147 UTC | 13 | 2021-08-10 11:39:02.77 UTC | null | null | null | null | 5,049,599 | null | 1 | 28 | cqrs | 7,173 | <p>CQRS Journey should not be seen as a manual. This is just a story of some team fighting their way to CQRS and having all limitations of using only Microsoft stack. Per se you should not use your read model in the command handlers or domain logic. But you can query your read model from the client to fetch the data yo... |
54,057,011 | Google Colab session timeout | <p>In the <a href="https://research.google.com/colaboratory/faq.html" rel="noreferrer">FAQs</a> it is mentioned that</p>
<blockquote>
<p>Virtual machines are recycled when idle for a while, and have a maximum lifetime enforced by the system.</p>
</blockquote>
<p>Are the maximum lifetime and idle times fixed or variable... | 54,059,837 | 4 | 0 | null | 2019-01-05 22:48:10.753 UTC | 19 | 2021-09-22 10:46:42.683 UTC | 2021-03-29 13:36:45.843 UTC | null | 4,685,471 | null | 2,821,756 | null | 1 | 40 | google-colaboratory | 66,394 | <p>It's 90 minutes if you close the browser. 12 hours if you keep the browser open. Additionally, if you close your browser with a code cell is running, if that same cell has not finished, when you reopen the browser it will still be running (the current executing cell keeps running even after browser is closed)</p> |
40,527,124 | Single Sign On (SSO) using JWT | <p>I have read several articles about sso but could not find an answer in my mind.
I have a scenario like below:</p>
<p><strong>Scenario:</strong></p>
<ul>
<li>My company wants to have sso mechanism using jwt.</li>
<li>Company has 2 different domains like <strong>abc.com</strong> as <strong>abc</strong> and <strong>x... | 40,555,970 | 1 | 0 | null | 2016-11-10 12:01:54.123 UTC | 10 | 2016-11-11 20:47:57.197 UTC | null | null | null | null | 2,711,669 | null | 1 | 22 | cross-domain|single-sign-on|jwt | 16,613 | <p>You can store the JWT authentication token in a cookie / localStorage of a intermediate domain connected to the home page using an iframe</p>
<p><a href="https://i.stack.imgur.com/ZkbOU.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ZkbOU.png" alt="cross domain sso" /></a></p>
<p>Scenario</p>
<blockquote>... |
33,660,794 | Import Oracle .dmp file using SQL Developer | <p>I want to import a <code>.dmp</code> file exported from another database, and I was wondering if anyone have experience on using GUI import option for <code>.dmp</code> file from SQL Developer? I have searched a lot of documents, but I couldn't find any detail. I can use SYS or SYSTEM user to import.</p> | 33,661,813 | 2 | 0 | null | 2015-11-11 22:09:19.84 UTC | 4 | 2019-10-15 09:05:28.613 UTC | 2019-06-20 14:20:25.117 UTC | null | 2,311,867 | null | 1,850,923 | null | 1 | 13 | oracle|oracle-sqldeveloper | 70,731 | <p>what was this another database? was it oracle database?
if yes
the dmp file can be file exported by </p>
<ol>
<li>DataPump <a href="http://docs.oracle.com/cd/B19306_01/server.102/b14215/dp_export.htm" rel="noreferrer">expdp</a> util and you need import it by using <a href="http://docs.oracle.com/cd/B19306_01/serv... |
27,457,326 | Compressing a folder with many duplicated files | <p>I have a pretty big folder (~10GB) that contains many duplicated files throughout it's directory tree. Many of these files are duplicated up 10 times. The duplicated files don't reside side by side, but within different sub-directories.</p>
<p>How can I compress the folder to a make it small enough?</p>
<p>I tried... | 52,771,612 | 6 | 0 | null | 2014-12-13 09:18:45.503 UTC | 11 | 2021-06-11 11:38:12.65 UTC | null | null | null | null | 972,014 | null | 1 | 20 | compression|tar|rar|winrar|winzip | 12,881 | <p>Best options in your case is 7-zip.
Here is the options:</p>
<pre><code>7za a -r -t7z -m0=lzma2 -mx=9 -mfb=273 -md=29 -ms=8g -mmt=off -mmtf=off -mqs=on -bt -bb3 archife_file_name.7z /path/to/files
</code></pre>
<p><code>a</code> - add files to archive</p>
<p><code>-r</code> - Recurse subdirectories</p>
<p><code>-t7z... |
59,317,249 | ValueError: matmul: Input operand 1 has a mismatch in its core dimension 0, with gufunc signature (n?,k),(k,m?)->(n?,m?) (size 1 is different from 3) | <p>I have written code using matmul, but I am getting the following error: </p>
<pre><code> "ValueError: matmul: Input operand 1 has a mismatch in its core dimension 0, with gufunc signature (n?,k),(k,m?)->(n?,m?) (size 1 is different from 3)"
</code></pre>
<p>Code:</p>
<pre><code> R = [[0.40348195], [0.3865... | 59,317,314 | 2 | 0 | null | 2019-12-13 06:29:33.733 UTC | 1 | 2022-03-25 09:37:57.957 UTC | 2019-12-13 06:30:28.667 UTC | null | 10,239,789 | null | 8,998,072 | null | 1 | 13 | python|python-3.x|numpy | 102,502 | <p>You are transposing a Matrix with 3 rows and 1 column to a Matrix with 3 columns and 1 row.
Then you are multiplying it with a similar Matrix (also 3 columns 1 row) which is incorrect mathematically. So you can either remove the transpose function or define your R Matrix as 1 row 3 columns and then transpose it. Che... |
34,865,348 | vuejs set a radio button checked if statement is true | <p>I am trying to make a radio button checked using vuejs v-for only if my if-statement is true. Is there a way to use vuejs' v-if/v-else for this type of problem? </p>
<p>in php and html I can achieve this by doing the following:</p>
<pre class="lang-html prettyprint-override"><code><input type="radio" <? if(p... | 34,865,436 | 5 | 0 | null | 2016-01-18 22:35:54.14 UTC | 11 | 2021-07-01 15:45:26.867 UTC | 2019-12-19 15:43:40.213 UTC | null | 693,349 | null | 5,807,584 | null | 1 | 55 | vue.js | 138,054 | <p>You could bind the <code>checked</code> attribute like this:</p>
<pre class="lang-html prettyprint-override"><code><div v-for="portal in portals">
<input type="radio"
id="{{portal.id}}"
name="portalSelect"
v-bind:value="{id: portal.id, name: portal.name}"
v-model="newP... |
35,256,008 | AutoMapper Migrating from static API | <p><a href="https://github.com/AutoMapper/AutoMapper/wiki/Migrating-from-static-API" rel="noreferrer">https://github.com/AutoMapper/AutoMapper/wiki/Migrating-from-static-API</a></p>
<p>this change breaks my system.</p>
<p>Before update, I use:</p>
<p>===> Startup.cs</p>
<pre><code>public class Startup
{
public ... | 35,256,077 | 4 | 0 | null | 2016-02-07 16:29:36.023 UTC | 10 | 2019-10-29 02:39:24.69 UTC | null | null | null | null | 5,891,846 | null | 1 | 29 | c#|asp.net|automapper | 28,989 | <p>Instead of:</p>
<pre><code>Mapper.CreateMap<AbcEditViewModel, Abc>();
</code></pre>
<p>The new syntax is:</p>
<pre><code>var config = new MapperConfiguration(cfg => {
cfg.CreateMap<AbcEditViewModel, Abc>();
});
</code></pre>
<p>Then:</p>
<pre><code>IMapper mapper = config.CreateMapper();
var so... |
50,122,867 | Gradle build fails: Unable to find method 'org.gradle.api.tasks.testing.Test.getTestClassesDirs()Lorg/gradle/api/file/FileCollection;' | <p>When i am trying to compile a imported <a href="https://github.com/iammert/AndroidArchitecture.git" rel="noreferrer">project</a> from github, my gradle build always fails with the following exeption.</p>
<pre><code>Unable to find method 'org.gradle.api.tasks.testing.Test.getTestClassesDirs()Lorg/gradle/api/file/Fil... | 50,151,053 | 11 | 0 | null | 2018-05-01 19:49:14.37 UTC | 9 | 2021-12-01 10:54:48.453 UTC | null | null | null | null | 5,131,883 | null | 1 | 65 | android|gradle | 129,442 | <p>I had to change the distributionUrl in the <code>gradle-wrapper.properties</code> to <code>distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip</code> to get the build running again. This seems to be a similar problem <a href="https://stackoverflow.com/questions/37655814/gradle-sync-failed-u... |
32,084,607 | Android Studio - Appcompat build fail values-v23/styles_bases.xml | <p>I'll start from what I want to achieve: building the googlecast-manager example provided here: <a href="https://github.com/googlecast/GameManagerSamples" rel="noreferrer">https://github.com/googlecast/GameManagerSamples</a>
I followed instructions here: <a href="https://developers.google.com/cast/docs/android_sender... | 32,138,927 | 13 | 0 | null | 2015-08-19 00:21:48.623 UTC | 5 | 2017-02-16 09:38:23.73 UTC | 2016-06-28 08:38:28.21 UTC | null | 693,387 | null | 3,556,705 | null | 1 | 29 | android|android-studio|intellij-idea|android-appcompat | 78,682 | <p>I also encountered the same problem and now have fixed it. What you just have to do is </p>
<ol>
<li><strong>Inside your Android Studio</strong>
<ol>
<li>press <kbd>Shift</kbd> button two times, a search box will appear type <strong>build.gradle</strong></li>
<li>choose <strong>build.gradle module:app</strong> ... |
39,392,853 | Is there a type for "Class" in Typescript? And does "any" include it? | <p>In Java, you can give a <a href="https://stackoverflow.com/a/4873003/2725515">class to a method</a> as a parameter using the type "Class". I didn't find anything similar in the typescript docs - is it possible to hand a class to a method? And if so, does the type "any" include such class-types?</p>
<p>Background: I... | 39,393,087 | 7 | 0 | null | 2016-09-08 13:54:22.517 UTC | 20 | 2021-12-17 17:34:18.513 UTC | 2017-05-23 12:32:29.923 UTC | null | -1 | null | 2,725,515 | null | 1 | 86 | angular|typescript | 99,171 | <p>The equivalent for what you're asking in typescript is the type <code>{ new(): Class }</code>, for example:</p>
<pre><code>class A {}
function create(ctor: { new(): A }): A {
return new ctor();
}
let a = create(A); // a is instanceof A
</code></pre>
<p>(<a href="https://www.typescriptlang.org/play/#src=class... |
37,576,620 | Laravel Eloquent With() With() | <p>How do I go about using multiple Eloquent With()'s?</p>
<p>PortalPlaylistElement Model</p>
<pre><code>class PortalPlaylistElement extends Model
{
public $primaryKey = 'code';
public $incrementing = false;
public $timestamps = false;
public function AirtimePlaylists()
{
return $this->... | 37,576,704 | 3 | 0 | null | 2016-06-01 18:52:03.777 UTC | 2 | 2020-01-06 11:29:20.227 UTC | null | null | null | null | 1,079,477 | null | 1 | 12 | laravel|eloquent | 61,956 | <p>You need <a href="https://laravel.com/docs/5.2/eloquent-relationships#eager-loading" rel="noreferrer">Nested Eager Looading</a> </p>
<pre><code>PortalPlaylistElement::with('AirtimePlaylists.AirtimePlaylistContents')->get();
</code></pre> |
37,249,439 | Chartjs v2.0: stacked bar chart | <p>I need to get a chart like this:</p>
<p><a href="https://i.stack.imgur.com/hEOeY.png" rel="noreferrer"><img src="https://i.stack.imgur.com/hEOeY.png" alt="Example Chart"></a></p>
<p>I find <a href="http://fiddle.jshell.net/leighking2/b233c2f0/" rel="noreferrer">this example</a> but it uses old version of <code>Cha... | 37,251,245 | 3 | 0 | null | 2016-05-16 08:14:21.187 UTC | 6 | 2020-08-20 15:04:32.917 UTC | 2017-12-13 06:59:51.493 UTC | null | 5,159,481 | null | 1,827,284 | null | 1 | 36 | chart.js | 63,805 | <p>With v2.1.x, you can achieve this using the <code>stacked</code> option</p>
<pre><code>...
options: {
scales:{
xAxes: [{
stacked: true
}],
yAxes: [{
stacked: true
}]
}
}
...
</code></pre>
<hr>
<p><strong>Stack Snippet</strong></p>
<p><div class="snippet... |
31,577,096 | ConcurrentHashMap, which concurrent features improved in JDK8 | <p>Can any concurrent expert explain in ConcurrentHashMap, which concurrent features improved comparing with which in previous JDKs</p> | 31,581,438 | 2 | 0 | null | 2015-07-23 02:17:14.983 UTC | 9 | 2017-09-07 03:34:02.637 UTC | null | null | null | null | 1,223,304 | null | 1 | 12 | concurrency|java-8|concurrenthashmap | 2,719 | <p>Well, the <code>ConcurrentHashMap</code> has been entirely rewritten. Before Java 8, each <code>ConcurrentHashMap</code> had a “concurrency level” which was fixed at construction time. For compatibility reasons, there is still a <a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentHashMa... |
35,748,734 | DJANGO - local variable 'form' referenced before assignment | <p>I'm trying to make a form get information from the user and use this information to send a email. Here's my code:</p>
<pre><code>#forms.py
from django import forms
class ContactForm(forms.Form):
nome = forms.CharField(required=True)
email = forms.EmailField(required=True)
msg = forms.CharField(
... | 35,748,798 | 4 | 0 | null | 2016-03-02 13:35:01.273 UTC | 6 | 2022-01-23 09:45:17.423 UTC | 2016-03-02 14:17:38.62 UTC | null | 1,762,988 | null | 5,255,892 | null | 1 | 10 | python|django|forms|django-forms | 39,456 | <p>You define the <code>form</code> variable in this <code>if request.method == 'POST':</code> block.
If you access the <code>view</code> with a GET request <code>form</code> gets not defined.
You should change the view to something like this:</p>
<pre><code>def contato(request):
form_class = ContactForm
# i... |
51,222,559 | Formik & yup form validation not working as expected with VirtualizedSelect | <p>I created a form with formik in order to have form validations.
I have used the components Formik, Form, Field form formik and configured them:</p>
<pre><code> import { Formik, Form, Field } from "formik";
import { object, string } from "yup";
import isEmpty from "lodash/isEmpty";
import FormikSelect... | 51,233,885 | 2 | 0 | null | 2018-07-07 11:05:07.12 UTC | null | 2022-02-15 15:17:31.63 UTC | 2018-07-08 13:41:08.093 UTC | null | 6,261,230 | null | 6,261,230 | null | 1 | 22 | javascript|reactjs|react-select|formik | 51,525 | <p>It looks like the field is expecting the string to be required based on your <code>validationSchema</code>.</p>
<p>The error helped point me in the right direction. Here's the docs for Yup <code>.nullable()</code>: <a href="https://github.com/jquense/yup#mixednullableisnullable-boolean--true-schema" rel="noreferre... |
21,384,067 | Unable to load dll file - exception 0x8007007E | <p>I'm working with National Instruments Measurement Studio in C#, and I've come across a bit of a problem in deploying my application to a particular computer (running Windows 7). I've tried asking on the National Instruments forums, but haven't got any solutions yet - could anyone here give me some tips?</p>
<p>Esse... | 21,384,313 | 2 | 0 | null | 2014-01-27 14:59:14.693 UTC | 1 | 2019-04-09 07:45:10.597 UTC | 2018-12-21 10:40:45.017 UTC | null | 1,033,581 | null | 2,823,789 | null | 1 | 3 | c#|.net|dll | 51,070 | <p>I suspect that even though the <em>setup</em> is for X86, the project itself is <em>AnyCPU</em> and thus runs as a 64bit process on 64bit systems and as a 32bit process on 32bit systems. As you said your DLL is in the Program Files (x86) folder I assume it is 32bit only, so you should compile your application expli... |
45,213,279 | How to avoid using relative path imports (/../../../redux/action/action1) in create-react-app | <p>I've been using create-react-app package for creating a react website. I was using relative paths throughout my app for importing components, resources, redux etc. eg, <code>import action from '../../../redux/action</code></p>
<p>I have tried using <a href="https://www.npmjs.com/package/module-alias" rel="noreferre... | 45,214,138 | 9 | 1 | null | 2017-07-20 11:22:49.33 UTC | 24 | 2022-03-05 11:27:37.39 UTC | 2020-02-10 22:29:44.403 UTC | null | 203,371 | null | 2,622,795 | null | 1 | 98 | reactjs|import|create-react-app|relative-path|absolute-path | 62,287 | <p>Create a file called <code>.env</code> in the project root and write there:</p>
<pre><code>NODE_PATH=src
</code></pre>
<p>Then restart the development server. You should be able to import anything inside <code>src</code> without relative paths.</p>
<p>Note I would not recommend calling your folder <code>src/redux... |
7,433,412 | With FireMonkey and its cross-platforms, where should I store my application data? | <p>Usually, with Windows, I save my application's data in the user folder (<strong>%appdata%</strong>).</p>
<p>For that, I use the function <code>ExpandEnvironmentStrings</code> which is linked to Windows to get the folder I need, and I store inside a subfolder my <em>inifile</em>.</p>
<p>Is there any best practice t... | 7,433,598 | 1 | 5 | null | 2011-09-15 15:28:53.197 UTC | 10 | 2016-01-16 19:12:20.083 UTC | 2016-01-16 19:12:20.083 UTC | null | 4,370,109 | null | 596,852 | null | 1 | 23 | delphi|directory|delphi-xe2|firemonkey | 3,367 | <p>Haven't tried XE2 but probably you could use <a href="http://docwiki.embarcadero.com/VCL/en/SysUtils.GetHomePath" rel="noreferrer">SysUtils.GetHomePath</a>. Also check <code>IOUtils</code> where you can find useful records (<a href="http://docwiki.embarcadero.com/VCL/en/IOUtils.TFile" rel="noreferrer">TFile</a>, <a ... |
7,278,409 | HTML5 drag and drop to move a div anywhere on the screen? | <p>The title is pretty self explanatory.</p>
<p>All the demos I've found consist in dropping a div to a certain location. E.G a trashcan. I need to make a draggable div that can be dropped anywhere on the screen.</p>
<p>Is it possible to do this with HTML5? if not how should I do it?</p> | 7,290,395 | 1 | 2 | null | 2011-09-02 01:30:29.477 UTC | 16 | 2020-07-02 12:49:03.133 UTC | 2011-09-02 01:35:58.973 UTC | null | 535,967 | null | 535,967 | null | 1 | 27 | html|drag-and-drop | 66,457 | <p>It's quite straightforward really:</p>
<ol>
<li>In the <code>dragstart</code> event calculate the offset between where the user clicked on the draggable element and the top left corner</li>
<li>Make sure the <code>dragover</code> event is applied to the entire document so the element can be dropped anywhere</li>
<l... |
22,835,289 | How to get tkinter canvas to dynamically resize to window width? | <p>I need to get a canvas in tkinter to set its width to the width of the window, and then dynamically re-size the canvas when the user makes the window smaller/bigger. </p>
<p>Is there any way of doing this (easily)?</p> | 22,837,522 | 4 | 0 | null | 2014-04-03 10:50:26.29 UTC | 20 | 2021-11-05 19:05:59.367 UTC | 2017-03-15 01:04:08.557 UTC | null | 3,924,118 | null | 3,334,697 | null | 1 | 46 | python|canvas|python-3.x|tkinter|autoresize | 125,071 | <p>I thought I would add in some extra code to expand on <a href="https://stackoverflow.com/a/22835732/3357935">@fredtantini's answer</a>, as it doesn't deal with how to update the shape of widgets drawn on the <code>Canvas</code>.</p>
<p>To do this you need to use the <code>scale</code> method and tag all of the widg... |
22,739,920 | Where to start with creating Minecraft client mods | <p>I've looked all over the net and YouTube and for some reason this is some top secret information or something but I'm trying to find out where to get started on making a Minecraft client mod, preferably something that can be put into a pack like feed the beast or technicpack for simplicity for users but either way i... | 22,752,339 | 1 | 0 | null | 2014-03-30 03:29:04.543 UTC | 19 | 2018-08-26 18:02:29.55 UTC | 2014-09-14 15:01:52.377 UTC | null | 3,622,940 | null | 3,200,040 | null | 1 | 22 | java|eclipse|minecraft|minecraft-forge | 24,011 | <h1>Choosing a modding method</h1>
<p>When creating minecraft client mods my research has found that different methods of creating mods. of the choices listed here, they have different perks:</p>
<ul>
<li><strong>Source modding</strong>: Confusing to install mods, difficult to develop for, highest probability of breaki... |
41,870,968 | Dumping numpy array into an excel file | <p>I am trying to dump numpy array into an excel file using savetxt method, but I am getting this weird error on the console:</p>
<pre><code>.18e,%.18e,%.18e,%.18e,%.18e,%.18e,%.18e,%.18e,%.18e,%.18e,%.18e,%.18e,%.18e,%.18e,%.18e,%.18e,%.18e,%.18e,%.18e,%.18e,%.18e,%.18e,%.18e,%.18e,%.18e,%.18e,%.18e,%.18e,%.18e,%.18e... | 41,875,701 | 2 | 0 | null | 2017-01-26 10:03:59.957 UTC | 2 | 2018-05-24 10:29:40.68 UTC | null | null | null | null | 4,730,816 | null | 1 | 13 | python|arrays|excel|numpy | 76,251 | <p>you could use pandas, its really easy friendly to use.</p>
<pre><code>import pandas as pd
## convert your array into a dataframe
df = pd.DataFrame (array)
## save to xlsx file
filepath = 'my_excel_file.xlsx'
df.to_excel(filepath, index=False)
</code></pre>
<p>hope it helps!</p> |
2,670,871 | MySQL Group Results by day using timestamp | <p>I need to take the following query and pull the total order counts and sum of the orders grouped by day. I'm storing everything using timestamps.</p>
<pre><code>SELECT
COUNT(id) as order_count,
SUM(price + shipping_price) as order_sum,
DAY(FROM_UNIXTIME(created)) as day
FROM `order`
WHERE '.implode(' A... | 2,670,906 | 3 | 1 | null | 2010-04-19 21:03:27.797 UTC | 8 | 2018-01-15 14:08:28.453 UTC | 2010-04-20 14:01:36.98 UTC | null | 197,606 | null | 197,606 | null | 1 | 33 | mysql|timestamp | 41,874 | <p>Are you just forgetting to add <code>GROUP BY ...</code> at the end?</p>
<pre><code>SELECT
COUNT(id) as order_count,
SUM(price + shipping_price) as order_sum,
DAY(FROM_UNIXTIME(created)) as order_day
FROM `order`
WHERE '.implode(' AND ', $where).'
GROUP BY order_day
</code></pre>
<h2>NOTE:</h2>
<p>You... |
3,145,700 | Javascript inheritance - instanceof not working? | <p>I'm writing a simple platform game using javascript and html5. I'm using javascript in an OO manner. To get inheritance working i'm using the following;</p>
<pre><code>// http://www.sitepoint.com/blogs/2006/01/17/javascript-inheritance/
function copyPrototype(descendant, parent) {
var sConstructor = parent.to... | 25,168,207 | 4 | 0 | null | 2010-06-30 00:17:12.33 UTC | 10 | 2014-08-07 13:20:14.86 UTC | 2013-11-20 11:47:55.703 UTC | null | 192,305 | null | 192,305 | null | 1 | 16 | javascript|oop|inheritance|instanceof | 16,966 | <p>These days you shouldn't need .prototype = new Thing(), I think I'm late to the party but you can just use Object.create on the prototype of the parent and then override the methods you're interested in overriding. An example:</p>
<pre><code>var IDataSource = function(){
throw new Error("Not implemented, interf... |
2,612,152 | drawRect not being called in my subclass of UIImageView | <p>I have subclassed UIImageView and tried to override drawRect so I could draw on top of the image using Quartz 2D. I know this is a dumb newbie question, but I'm not seeing what I did wrong. Here's the interface:</p>
<pre><code>#import <UIKit/UIKit.h>
@interface UIImageViewCustom : UIImageView {
}
- (void)... | 2,612,185 | 4 | 2 | null | 2010-04-10 03:40:28.42 UTC | 11 | 2014-12-11 07:11:38.583 UTC | 2010-04-10 18:16:58.903 UTC | null | 30,461 | null | 3,279 | null | 1 | 42 | iphone|objective-c|cocoa-touch|uikit | 24,956 | <p>It'll only get called if the view is visible, and dirty. Maybe the problem is in the code that creates the view, or in your Nib, if that's how you're creating it?</p>
<p>You'll also sometimes see breakpoints failing to get set properly if you're trying to debug a "Release" build.</p>
<hr>
<p>I somehow missed the ... |
3,016,974 | How to get text in QlineEdit when QpushButton is pressed in a string? | <p>I am trying to implement a function. My code is given below.</p>
<p>I want to get the text in lineedit with objectname 'host' in a string say 'shost' when the user clicks the pushbutton with name 'connect'. How can I do this? I tried and failed. How do I implement this function?</p>
<pre><code>import sys
from PyQt... | 3,018,000 | 4 | 0 | null | 2010-06-10 17:42:23.02 UTC | 12 | 2021-10-23 12:52:53.603 UTC | 2020-08-26 07:31:57.267 UTC | null | 2,119,941 | null | 363,661 | null | 1 | 51 | python|pyqt5|pyqt4|qlineedit | 211,272 | <p>My first suggestion is to use Qt Designer to create your GUIs. Typing them out yourself sucks, takes more time, and you will definitely make more mistakes than Qt Designer.</p>
<p>Here are some <a href="https://web.archive.org/web/20130704101140/http://www.diotavelli.net/PyQtWiki/Tutorials" rel="noreferrer">PyQt tu... |
29,298,346 | XMPP SASL SCRAM-SHA1 Authentication | <p>Recently, I was able to get MD5 authentication working for XMPP streams in Swift IOS following the instructions on the following two websites (I used the CC-MD5 function of Apple's CommonCrypto C library for the actual hashing):</p>
<p><a href="http://wiki.xmpp.org/web/SASLandDIGEST-MD5" rel="nofollow noreferrer">ht... | 29,299,946 | 1 | 1 | null | 2015-03-27 10:21:58.917 UTC | 12 | 2016-10-26 12:27:02.333 UTC | 2021-10-07 07:59:29.08 UTC | null | -1 | null | 4,577,867 | null | 1 | 14 | authentication|xmpp|sasl|sasl-scram | 15,360 | <h2>SCRAM-SHA-1</h2>
<p>The basic overview of how this mechanism works is:</p>
<ul>
<li>The client sends the username it wants to authenticate as.</li>
<li>The server sends back the salt for that user and the number of iterations (either by generating them or looking them up in its database for the given username).</li... |
46,530,960 | NetBeans 8.2 does not open on Mac OS | <p>I am trying to start NetBeans 8.2 on a Macbook Pro and it's not working.</p>
<p>It shows the splash screen, then after a while it shuts down without starting anything.</p>
<p>Running from the command-line I can see this error:</p>
<pre><code>Oct 02, 2017 7:40:28 PM org.netbeans.ProxyURLStreamHandlerFactory regist... | 46,556,172 | 5 | 0 | null | 2017-10-02 17:52:37.32 UTC | 7 | 2020-01-23 23:52:58.903 UTC | null | null | null | null | 1,007,991 | null | 1 | 10 | netbeans | 40,613 | <p>Yes, NetBeans 8.2 does use JDK 1.8, and specifically does not support JDK 1.9. </p>
<p>It's unclear from the OP which version of Java is desired to run with NetBeans, but the version of NetBeans to use is governed by the version of Java to be used:</p>
<p>[1] For Java 8, use Netbeans 8.2. Note that <strong>Java 9... |
37,248,580 | How to group data in Angular 2? | <p>How can I group data in Angular 2 with TypeScript. I am aware that this is done using "group by" filter in Angular 1.X, but not getting how to group data in Angular 2. I have this array:</p>
<pre><code>import {Employee} from './employee';
export var employees: Employee[];
employees = [
... | 37,250,267 | 4 | 0 | null | 2016-05-16 07:14:47.287 UTC | 8 | 2020-07-26 05:04:25.8 UTC | 2017-12-01 08:59:51.877 UTC | null | 3,885,376 | null | 1,546,629 | null | 1 | 29 | angular|typescript1.7 | 29,591 | <p>I would create <a href="https://angular.io/docs/ts/latest/guide/pipes.html#custom-pipes" rel="noreferrer">a custom pipe</a> to do that as described below:</p>
<pre class="lang-typescript prettyprint-override"><code>@Pipe({name: 'groupBy'})
export class GroupByPipe implements PipeTransform {
transform(value: Array... |
318,160 | What is the difference between the KeyCode and KeyData properties on the .NET WinForms key event argument objects? | <p>The two key event argument classes <code>KeyEventArgs</code> and <code>PreviewKeyDownEventArgs</code> each have two properties, <code>KeyCode</code> and <code>KeyData</code>, which are both of the enumeration type Keys.</p>
<p>What is the difference between these two properties? Do the values in them ever differ fr... | 318,177 | 2 | 0 | null | 2008-11-25 17:17:28.803 UTC | 10 | 2015-05-20 06:50:34.713 UTC | 2015-05-13 10:02:58.067 UTC | null | 2,130,976 | Turbulent Intellect | 2,729 | null | 1 | 50 | .net|winforms|events|event-handling | 8,425 | <p><code>KeyCode</code> is an enumeration that represents all the possible keys on the keyboard. <code>KeyData</code> is the <code>KeyCode</code> combined with the modifiers (Ctrl, Alt and/or Shift).</p>
<p>Use <code>KeyCode</code> when you don't care about the modifiers, <code>KeyData</code> when you do. </p> |
787,436 | How to set width to 100% in WPF | <p>Is there any way how to tell component in <strong>WPF</strong> to take 100% of available space? </p>
<p>Like </p>
<pre><code>width: 100%;
</code></pre>
<p>in CSS </p>
<p>I've got this XAML, and I don't know how to force Grid to take 100% width.</p>
<pre><code><ListBox Name="lstConnections">
<List... | 787,463 | 2 | 3 | null | 2009-04-24 20:20:11.94 UTC | 16 | 2021-01-19 12:20:45.177 UTC | 2016-05-02 10:03:07.313 UTC | null | 5,035,500 | null | 72,583 | null | 1 | 71 | wpf|width|autosize | 143,855 | <p>It is the container of the <code>Grid</code> that is imposing on its width. In this case, that's a <code>ListBoxItem</code>, which is left-aligned by default. You can set it to stretch as follows:</p>
<pre><code><ListBox>
<!-- other XAML omitted, you just need to add the following bit -->
<Li... |
2,822,525 | How can I convert Perl one-liners into complete scripts? | <p>I find a lot of Perl one-liners online. Sometimes I want to convert these one-liners into a script, because otherwise I'll forget the syntax of the one-liner.</p>
<p>For example, I'm using the following command (from <a href="http://support.nagios.com/knowledgebase/faqs/index.php?option=com_content&view=article... | 2,822,721 | 6 | 2 | null | 2010-05-12 20:30:21.637 UTC | 10 | 2010-05-16 00:11:30.393 UTC | 2010-05-16 00:11:30.393 UTC | null | 2,766,176 | null | 110,223 | null | 1 | 18 | perl|command-line | 3,927 | <p>You can convert any Perl one-liner into a full script by passing it through the <code>B::Deparse</code> compiler backend that generates Perl source code:</p>
<pre><code>perl -MO=Deparse -pe 's/(\d+)/localtime($1)/e'
</code></pre>
<p>outputs:</p>
<pre><code>LINE: while (defined($_ = <ARGV>)) {
s/(\d+)/lo... |
2,998,503 | How do I change Process Template on an existing Team Project in TFS 2010? | <p>How do I change process template to MSF for Agile on an already existing team project in TFS 2010?</p>
<p>We have upgraded our TFS 2008 to 2010, and now I would also like to change the process template to MSF for Agile (currently CMMI).
We haven't used the workitem functionality much so if some information gets los... | 2,999,219 | 6 | 0 | null | 2010-06-08 14:57:27.107 UTC | 10 | 2014-01-06 11:51:35.463 UTC | 2014-01-06 11:51:35.463 UTC | null | 759,866 | null | 207,831 | null | 1 | 28 | tfs-process-template | 34,130 | <p>Once you've created a Team Project, you unfortunately can't just upload a new process template. As Robaticus says, you'll have to download the XML for the template and modify it, then re-upload it. The power tool lets you create NEW templates for NEW team projects, but it won't modify an existing one. </p>
<p>In... |
2,596,714 | Why does Python print unicode characters when the default encoding is ASCII? | <p>From the Python 2.6 shell:</p>
<pre><code>>>> import sys
>>> print sys.getdefaultencoding()
ascii
>>> print u'\xe9'
é
>>>
</code></pre>
<p>I expected to have either some gibberish or an Error after the print statement, since the "é" character isn't part of ASCII and I haven't s... | 21,968,640 | 6 | 7 | null | 2010-04-08 00:03:08.577 UTC | 97 | 2018-08-02 21:44:03.643 UTC | 2018-08-02 21:44:03.643 UTC | null | 56,974 | null | 56,974 | null | 1 | 142 | python|unicode|encoding|ascii|python-2.x | 83,794 | <p>Thanks to bits and pieces from various replies, I think we can stitch up an explanation. </p>
<p>By trying to print an unicode string, u'\xe9', Python implicitly try to encode that string using the encoding scheme currently stored in sys.stdout.encoding. Python actually picks up this setting from the environment it... |
2,659,952 | Maximum length of HTTP GET request | <p>What's the maximum length of an HTTP <a href="https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods" rel="noreferrer">GET</a> request?</p>
<p>Is there a response error defined that the server can/should return if it receives a GET request that exceeds this length?</p>
<p>This is in the context ... | 2,659,995 | 7 | 4 | null | 2010-04-17 20:32:25.23 UTC | 110 | 2021-02-26 12:19:52.937 UTC | 2020-01-22 23:34:52.007 UTC | null | 63,550 | null | 116 | null | 1 | 560 | web-services|http | 616,765 | <p>The limit is dependent on both the server and the client used (and if applicable, also the proxy the server or the client is using).</p>
<p>Most web servers have a limit of 8192 bytes (8 KB), which is usually configurable somewhere in the server configuration. As to the client side matter, the HTTP 1.1 specification... |
3,174,392 | Is it Pythonic to use bools as ints? | <p><code>False</code> is equivalent to <code>0</code> and <code>True</code> is equivalent <code>1</code> so it's possible to do something like this:</p>
<pre><code>def bool_to_str(value):
"""value should be a bool"""
return ['No', 'Yes'][value]
bool_to_str(True)
</code></pre>
<p>Notice how value is <code>boo... | 3,175,293 | 7 | 1 | null | 2010-07-04 10:43:12.597 UTC | 16 | 2016-12-23 10:43:10.903 UTC | 2010-07-04 13:51:47.11 UTC | null | 5,883 | null | 5,883 | null | 1 | 71 | boolean|python | 10,284 | <p>I'll be the odd voice out (since all answers are decrying the use of the fact that <code>False == 0</code> and <code>True == 1</code>, as the language guarantees) as I claim that the use of this fact to simplify your code is perfectly fine.</p>
<p>Historically, logical true/false operations tended to simply use <co... |
2,992,376 | How to set upload_max_filesize in .htaccess? | <p>I have try to put these 2 lines</p>
<pre><code>php_value post_max_size 30M
php_value upload_max_filesize 30M
</code></pre>
<p>In my root <code>.htaccess</code> file but that brings me "internal server error" message.</p>
<p>php5 is running on the server</p>
<p>I don't have access to php.ini so I think <cod... | 2,992,438 | 7 | 1 | null | 2010-06-07 19:14:54.913 UTC | 25 | 2022-06-03 05:27:49.607 UTC | 2022-06-03 05:27:49.607 UTC | null | 19,123,103 | null | 220,839 | null | 1 | 100 | php|.htaccess | 353,840 | <p><code>php_value upload_max_filesize 30M</code> is correct.</p>
<p>You will have to contact your hosters -- some don't allow you to change values in php.ini</p> |
3,083,798 | How to disable mouse right click on a web page? | <p>I want to disable mouse right click on an HTML page.
I have a page where user has to enter the details.
I don't want the user to see the menu thats get displayed with the mouse right click. Rather I want to display a custom menu. I know there are some plugins available to do that. But my requirement does not need an... | 3,083,820 | 10 | 9 | null | 2010-06-21 10:20:32.63 UTC | 7 | 2018-10-28 09:03:19.293 UTC | 2011-01-24 08:45:12.97 UTC | null | 351,754 | null | 351,754 | null | 1 | 22 | javascript|html|mouse|right-click | 109,221 | <p>It's unprofessional, anyway this will work with javascript enabled:</p>
<pre><code>document.oncontextmenu = document.body.oncontextmenu = function() {return false;}
</code></pre>
<p>You may also want to show a message to the user before returning false.</p>
<p>However I have to say that this should not be done ge... |
33,847,477 | Querying a Global Secondary Index in dynamodb Local | <p>I am creating a table and GSI in DynamoDB, using these parameters, as per the documentation: </p>
<p><code>configId</code> is the primary key of the table, and I am using the <code>publisherId</code> as the primary key for the GSI. (I've removed some unnecessary configuration parameters for brevity)</p>
<pre><code... | 36,810,004 | 5 | 1 | null | 2015-11-21 19:11:29.513 UTC | 9 | 2021-06-13 22:14:17.923 UTC | 2018-09-05 19:13:27.703 UTC | null | 271,697 | null | 1,709,123 | null | 1 | 38 | node.js|amazon-dynamodb|aws-sdk | 43,872 | <p>Try to change <code>ExpressionAttributeValues</code> from this</p>
<pre><code>{
TableName: 'Configs',
IndexName: 'publisher_index',
KeyConditionExpression: 'publisherId = :pub_id',
ExpressionAttributeValues: { ':pub_id': { S: '700' } }
}
</code></pre>
<p>to</p>
<pre><code>{
TableName: 'Configs',
IndexName: ... |
45,397,433 | How to Uninstall Laravel? | <p>I am facing fatal errors regarding Artisan. I think I couldn't install laravel complete due to slow internet. Now I want to remove Laravel from root and want to have fresh installation.
Can anyone help me?</p> | 45,397,723 | 3 | 1 | null | 2017-07-30 07:30:22.437 UTC | 6 | 2020-08-04 08:57:48.397 UTC | null | null | null | null | 4,291,982 | null | 1 | 17 | laravel | 84,993 | <p>if you have installed it globally you can simply remove it by <code>composer global remove laravel/installer</code> </p>
<p>If you have installed it via composer project you simply remove the directory.</p> |
10,443,829 | How to create a before delete trigger in SQL Server? | <p>I want to create a before delete trigger. When I delete a record from a table that record has to be inserted into a history table. How can I do this in SQL Server?</p> | 10,443,862 | 4 | 0 | null | 2012-05-04 06:31:33.603 UTC | 2 | 2022-01-31 08:44:27.687 UTC | 2015-08-22 09:11:32.963 UTC | user756519 | 4,370,109 | null | 1,374,263 | null | 1 | 29 | sql-server|triggers | 86,563 | <p>In this situation, you're probably better off doing a regular "after" trigger. This is the most common approach to this type of situation. </p>
<p>Something like </p>
<pre><code>CREATE TRIGGER TRG_AUD_DEL
ON yourTable
FOR DELETE
AS
INSERT INTO my_audit_table (col1, col2, ...)
SELECT col1, col2...
F... |
10,733,121 | BroadcastReceiver when wifi or 3g network state changed | <p>I have an app which updates the database whenever the phone is connected to WiFi. I have implemented a <code>Service</code> and <code>BroadcastReceiver</code> which will run the <code>Service</code> (it will tell me what network is in use), but the problem is I don't know what to add in the <code>manifest</code> fil... | 10,733,191 | 5 | 0 | null | 2012-05-24 07:35:46.193 UTC | 16 | 2018-07-30 14:04:43.633 UTC | 2018-04-01 01:11:55.46 UTC | null | 6,618,622 | null | 1,129,530 | null | 1 | 34 | android|android-service | 57,098 | <p>You need </p>
<pre><code><intent-filter>
<action android:name="android.net.wifi.WIFI_STATE_CHANGED"/>
<action android:name="android.net.wifi.STATE_CHANGE"/>
</intent-filter>
</code></pre>
<p>In your <code>receiver</code> tag. </p>
<p>Or if you want more control over it, before registering ... |
5,793,751 | What are the technical differences between the Thread Safe and Non Thread safe PHP Windows Installation Packages? | <p>I'm currently about to install PHP for an Apache/Windows-based development environment, but it seems I'm about to fall at the first hurdle: Choosing the right package to install.</p>
<p><a href="http://windows.php.net/download/" rel="noreferrer">PHP is available in no less than <em>four</em> flavours</a>:</p>
<ul>... | 5,797,523 | 2 | 1 | null | 2011-04-26 17:00:05.463 UTC | 22 | 2013-11-05 19:57:26.183 UTC | 2013-11-05 19:53:02.85 UTC | null | 275,567 | null | 199,700 | null | 1 | 39 | php|windows|apache | 20,205 | <p>After a lot of research, I've managed to find my own answers to this question.</p>
<p>In its most basic form, the answer is: <em><strong>What version of PHP you should install comes down what webserver you are running.</strong></em></p>
<p>Here's a deeper explanation of the terms used in picking a version of PHP bas... |
5,631,010 | How to create a temporary table in SSIS control flow task and then use it in data flow task? | <p>I have a control flow where I create a temp database and table in a with a T-SQL Command. When I add a dataflow I would like to query the table but I can't because the table doesn't exist to grab information from. When I try I get errors about logging in because the database doesn't exist (yet). I have delay validat... | 6,160,015 | 2 | 1 | null | 2011-04-12 06:03:03.167 UTC | 21 | 2017-09-11 20:01:54.333 UTC | 2011-05-28 05:45:44.987 UTC | user756519 | null | null | 281,781 | null | 1 | 46 | ssis | 159,018 | <h2>Solution:</h2>
<p>Set the property <strong><code>RetainSameConnection</code></strong> on the <em><code>Connection Manager</code></em> to <strong><code>True</code></strong> so that temporary table created in one Control Flow task can be retained in another task.</p>
<p>Here is a sample SSIS package written in <em><c... |
21,838,205 | android sqlite CREATE TABLE IF NOT EXISTS | <p>Having a little problem with creating new tables. When I use the CREATE TABLE command my new tables form as they should, but when I exit the activity the app crashes and I get a TABLE ALREADY EXISTS in the logcat. If I use CREATE TABLE IF NOT EXISTS the new table isn't formed but just adds my new rows of data to a p... | 21,838,388 | 2 | 0 | null | 2014-02-17 19:58:18.687 UTC | 3 | 2017-08-13 08:53:01.033 UTC | 2016-09-08 09:35:15.51 UTC | null | 6,617,272 | null | 1,936,916 | null | 1 | 17 | android|sql|sqlite|create-table | 48,332 | <p>That's how it's supposed to work. <code>CREATE TABLE</code> will throw an exception if the table already exists. <code>CREATE TABLE IF NOT EXISTS</code> will create the table if it doesn't exist, or ignore the command if it does. If you want it to delete the old table, use <code>DELETE TABLE IF EXISTS</code> befo... |
35,504,605 | Calling a class method from the constructor | <p>I'm getting an error when calling a class method from its constructor. Is it possible to call a method from the constructor? I tried calling the base class method from the constructor of a derived class but I am still getting an error.</p>
<pre><code>'use strict';
class Base {
constructor() {
this.val ... | 35,504,660 | 2 | 1 | null | 2016-02-19 11:49:24.303 UTC | 7 | 2020-02-12 14:14:38.61 UTC | 2017-11-20 02:24:23.61 UTC | null | 660,828 | null | 571,156 | null | 1 | 34 | javascript|ecmascript-6 | 37,423 | <p>You're calling the <em>function</em> <code>init()</code>, not the <em>method</em> <code>init</code> of either <code>Base</code> or the current object. No such function exists in the current scope or any parent scopes. You need to refer to your object:</p>
<pre><code>this.init();
</code></pre> |
43,344,819 | Reading response headers with Fetch API | <p>I'm in a Google Chrome extension with permissions for <code>"*://*/*"</code> and I'm trying to make the switch from XMLHttpRequest to the <a href="https://developers.google.com/web/updates/2015/03/introduction-to-fetch" rel="noreferrer">Fetch API</a>.</p>
<p>The extension stores user-input login data that used to b... | 44,816,592 | 9 | 0 | null | 2017-04-11 11:37:21.953 UTC | 25 | 2022-06-02 08:20:17.73 UTC | null | null | null | null | 902,773 | null | 1 | 121 | javascript|google-chrome-extension | 115,126 | <p>There is a restriction to access response headers when you are using Fetch API over CORS. Due to this restriction, you can access only following standard headers:</p>
<ul>
<li><code>Cache-Control</code></li>
<li><code>Content-Language</code></li>
<li><code>Content-Type</code></li>
<li><code>Expires</code></li>
<li>... |
71,591,971 | How can I fix the "zsh: command not found: python" error? (macOS Monterey 12.3, Python 3.10, Atom IDE, and atom-python-run 0.9.7) | <p>Since I got the <a href="https://en.wikipedia.org/wiki/MacOS_Monterey" rel="noreferrer">macOS v12.3</a> (Monterey) update (not sure it's related though), I have been getting this error when I try to run my Python code in the terminal:</p>
<p><img src="https://i.stack.imgur.com/DJho7.png" alt="Python not found error"... | 71,621,142 | 12 | 1 | null | 2022-03-23 18:02:02.23 UTC | 24 | 2022-09-19 22:43:36.193 UTC | 2022-06-26 21:06:46.24 UTC | null | 63,550 | null | 18,559,642 | null | 1 | 76 | python|macos|terminal|atom-editor|macos-monterey | 113,221 | <p>OK, after a couple of days trying, this is what has worked for me:</p>
<ol>
<li>I reinstalled Monterey (not sure it was essential, but I just figured I had messed with terminal and <code>$PATH</code> too much).</li>
<li>I installed <code>python</code> via <code>brew</code> rather than from the official website.
It w... |
54,050,320 | Error: `data` must be a data frame, or other object coercible by `fortify()`, not an S3 object with class Date | <p>I tried to create a stacked bar plot in R, but unfortunately I have several problems. R gives me the following error:</p>
<blockquote>
<p>Error: <code>data</code> must be a data frame, or other object coercible by
<code>fortify()</code>, not an S3 object with class Date</p>
</blockquote>
<p>I searched for a wh... | 54,050,582 | 1 | 8 | null | 2019-01-05 08:29:34.19 UTC | 3 | 2019-01-05 14:02:05.54 UTC | 2019-01-05 14:02:05.54 UTC | null | 10,323,798 | null | 10,756,799 | null | 1 | 15 | r|ggplot2 | 72,077 | <p>Try this:
Workflow is as follows:</p>
<pre><code> library(tidyverse)
library(lubridate)
#`df` is `CPOD_Time` saved as `df<-as.data.frame(CPOD_Time)`
df<-as.data.frame(CPOD_Time)
</code></pre>
<p>Then the plot:</p>
<pre><code>df %>%
rename(Time=time,Number=number,Date=date) %>%
... |
26,773,932 | Global variable is undefined at the module level | <p>(There are many similar and more generic questions, been trying the solutions from them after reading through them, can't get them working so asking here as a more situation-specific version of what I'm seeing)</p>
<p>I think I am really miss-understanding how Python does OOP due to my more C#/C++ background. So h... | 26,775,843 | 1 | 0 | null | 2014-11-06 07:28:18.033 UTC | 5 | 2018-09-24 22:37:25.333 UTC | 2018-09-24 22:37:25.333 UTC | null | 6,862,601 | null | 2,076,617 | null | 1 | 12 | python|module|scope|global-variables | 82,284 | <p>Before I start, note that the PyCharm warnings are not actual Python errors: if you ran your code, you would probably get more useful feedback (remember static analysis of a dynamic language like Python can only get you so far, many things can't be resolved until you actually run the code).</p>
<p>Firstly, it's rea... |
271,238 | How do I detect when a removable disk is inserted using C#? | <p>I'm just concerned about Windows, so there's no need to go into esoterica about Mono compatibility or anything like that.</p>
<p>I should also add that the app that I'm writing is WPF, and I'd prefer to avoid taking a dependency on <code>System.Windows.Forms</code> if at all possible.</p> | 271,251 | 3 | 2 | null | 2008-11-07 04:24:05.117 UTC | 9 | 2014-08-14 15:35:21.88 UTC | 2014-08-14 15:35:21.88 UTC | David Mitchell | 655,973 | David Mitchell | 26,628 | null | 1 | 16 | c#|wpf|windows | 17,326 | <p>Give this a shot...</p>
<pre><code>using System;
using System.Collections.Generic;
using System.Text;
using System.Management;
namespace WMITestConsolApplication
{
class Program
{
static void Main(string[] args)
{
AddInsertUSBHandler();
AddRemoveUSBHandler();
... |
614,728 | Best practice for rate limiting users of a REST API? | <p>I am putting together a REST API and as I'm unsure how it will scale or what the demand for it will be, I'd like to be able to rate limit uses of it as well as to be able to temporarily refuse requests when the box is over capacity or if there is some kind of slashdotted scenario.</p>
<p>I'd also like to be able to... | 614,786 | 3 | 0 | null | 2009-03-05 13:22:27.617 UTC | 19 | 2014-05-31 21:33:13.293 UTC | null | null | null | frankodwyer | 42,404 | null | 1 | 30 | ruby-on-rails|rest|scaling|capacity | 10,650 | <p>This is all done with outer webserver, which listens to the world (i recommend nginx or lighttpd).</p>
<p>Regarding rate limits, nginx is able to limit, i.e. 50 req/minute per each IP, all over get 503 page, which you can customize.</p>
<p>Regarding expected temporary down, in rails world this is done via special ... |
1,107,996 | Creating an NSDictionary | <p>In the following code, the first log statement shows a decimal as expected, but the second logs NULL. What am I doing wrong?</p>
<pre><code>NSDictionary *entry = [[NSDictionary alloc] initWithObjectsAndKeys:
@"x", [NSNumber numberWithDouble:acceleration.x],
@"y", [NSNumber numberWithDouble:acceleration.y],
@"... | 1,108,015 | 3 | 1 | null | 2009-07-10 06:28:37.737 UTC | 3 | 2015-06-03 10:43:36.343 UTC | null | null | null | null | 108,512 | null | 1 | 37 | iphone|cocoa-touch | 65,769 | <p>You are exchanging the order in which you insert objects and key: you need to insert first the object, then the key as shown in the following example.</p>
<pre><code>NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:@"value1", @"key1", @"value2", @"key2", nil];
</code></pre> |
39,610,294 | Import two exported classes with the same name | <p>In typescript, using Angular 2, I need to import two classes with the same name, but lying in different paths.</p>
<p>The project is quite too big that I find it hard to change the exported class names.</p>
<p>Is there any way to alias the imported classes,</p>
<pre><code>import {Class1} from '../location1/class1... | 39,610,348 | 1 | 0 | null | 2016-09-21 07:38:56.767 UTC | 7 | 2019-07-21 15:33:46.267 UTC | null | null | null | null | 4,294,275 | null | 1 | 187 | angular|typescript|ionic2 | 76,198 | <p>You can use <code>as</code> like this:</p>
<pre class="lang-js prettyprint-override"><code>import {Class1} from '../location1/class1'
import {Class1 as Alias} from '../location2/class1'
</code></pre>
<p>You can find more about the ES6 import statement <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScr... |
21,961,839 | Simulation background-size: cover in canvas | <p>I'm drawing images on a canvas like this:</p>
<pre class="lang-js prettyprint-override"><code>ctx.drawImage(data[i].image, data[i].pos.x, data[i].pos.y, data[i].pos.w, data[i].pos.h);
</code></pre>
<p>The picture is getting stretched and I don't want this. How can I simulate the CSS property?</p>
<pre class="lang-cs... | 21,961,894 | 6 | 0 | null | 2014-02-22 23:04:52.053 UTC | 22 | 2022-06-12 11:24:39.163 UTC | 2020-10-04 08:48:45.17 UTC | null | 9,449,426 | null | 2,183,827 | null | 1 | 52 | javascript|css|html|canvas | 53,900 | <p>It's a bit more complicated to get a cover functionality, though here is one solution for this:</p>
<p><strong>Updated 2016-04-03</strong> to address special cases. Also see @Yousef's comment below.</p>
<pre><code>/**
* By Ken Fyrstenberg Nilsen
*
* drawImageProp(context, image [, x, y, width, height [,offsetX, o... |
6,699,330 | How to save photo with EXIF(GPS) AND orientation on iPhone? | <p>I'm using <a href="http://developer.apple.com/library/ios/documentation/AssetsLibrary/Reference/ALAssetsLibrary_Class/Reference/Reference.html#//apple_ref/occ/instm/ALAssetsLibrary/writeImageToSavedPhotosAlbum:metadata:completionBlock:" rel="noreferrer">writeImageToSavedPhotosAlbum:metadata:completionBlock:</a> to s... | 6,699,649 | 1 | 0 | null | 2011-07-14 20:08:55.173 UTC | 9 | 2011-07-14 20:41:44.083 UTC | null | null | null | null | 845,273 | null | 1 | 13 | iphone|gps|orientation|exif | 6,671 | <p>You need to map the UIImageOrientation values to the corresponding EXIF orientation values when setting <code>kCGImagePropertyOrientation</code>. That mapping is:</p>
<pre><code>UIImageOrientationUp: 1
UIImageOrientationDown: 3
UIImageOrientationLeft: 8
UIImageOrientationRight: ... |
20,864,406 | Remove package and module name from sphinx function | <p>it's any way to remove the package and or module name from sphinx doc?</p>
<p>Example: if exist a function called waa inside the module foo.bar, the rst code</p>
<pre><code>.. automodule:: foo.bar
:members:
</code></pre>
<p>will generate</p>
<pre><code>foo.bar.waa()
</code></pre>
<p>and i want to output</p>... | 23,686,917 | 2 | 0 | null | 2013-12-31 23:59:42.57 UTC | 3 | 2022-06-17 11:07:51.477 UTC | 2014-01-01 00:18:13.117 UTC | null | 65,548 | null | 2,489,206 | null | 1 | 31 | python-sphinx | 7,147 | <p>You can change <code>add_module_names</code> to <code>False</code> in the file <code>conf.py</code>:</p>
<pre><code># If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
add_module_names = False
</code></pre>
<p>Then <code>foo.bar.my_function()</code> will d... |
24,201,120 | MongoDB - The argument to $size must be an Array, but was of type: EOO / missing | <p>Trying to create a MongoDB data source with <a href="http://www.iccube.com" rel="noreferrer">icCube</a>. The idea is to return the size of an array as a new field. Something like :</p>
<pre><code>$project:
{
"people": 1,
"Count myFieldArray" : {$size : "$myFieldArray" }
}
</code></pre>
<p>But I'm getting for s... | 24,201,302 | 3 | 0 | null | 2014-06-13 08:41:21.367 UTC | 11 | 2019-08-23 08:07:22.497 UTC | 2019-04-02 05:57:28.397 UTC | null | 2,313,887 | null | 763,790 | null | 1 | 75 | mongodb|mongodb-query|aggregation-framework|iccube | 29,580 | <p>You can use the <a href="http://docs.mongodb.org/manual/reference/operator/aggregation/ifNull/"><strong><code>$ifNull</code></strong></a> operator here. It seems the field is either not an array or not present by the given error:</p>
<pre class="lang-js prettyprint-override"><code>{ "$project": {
"people": 1,... |
24,062,989 | clang fails replacing a statement if it contains a macro | <p>I'm using clang to try and parse (with the C++ API) some C++ files and make all the case - break pairs use a specific style.</p>
<p><strong>Example</strong>:</p>
<pre><code>**Original**
switch(...)
{
case 1:
{
<code>
}break;
case 2:
{
<code>
break;
}
}
**After rep... | 24,223,347 | 2 | 0 | null | 2014-06-05 14:33:10.487 UTC | 9 | 2015-08-20 12:23:11.323 UTC | 2014-06-05 17:52:41.9 UTC | null | 1,233,963 | null | 1,233,963 | null | 1 | 23 | c++|clang|clang++ | 3,474 | <p>Your problem is caused by the design of <a href="http://clang.llvm.org/doxygen/classclang_1_1SourceLocation.html">SourceLocation</a>.</p>
<p>An article follows:</p>
<hr>
<h1>Macro expansion with clang's SourceLocation</h1>
<p><a href="http://clang.llvm.org/doxygen/classclang_1_1SourceLocation.html"><code>SourceL... |
5,953,759 | Using a class' __new__ method as a Factory: __init__ gets called twice | <p>I encountered a strange bug in python where using the <code>__new__</code> method of a class as a factory would lead to the <code>__init__</code> method of the instantiated class to be called twice.</p>
<p>The idea was originally to use the <code>__new__</code> method of the mother class to return a specific instan... | 5,953,974 | 3 | 0 | null | 2011-05-10 17:11:00.177 UTC | 13 | 2016-08-02 09:05:16.847 UTC | null | null | null | null | 287,297 | null | 1 | 41 | python|design-patterns|inheritance|class-design | 17,593 | <p>When you construct an object Python calls its <code>__new__</code> method to create the object then calls <code>__init__</code> on the object that is returned. When you create the object from inside <code>__new__</code> by calling <code>Triangle()</code> that will result in further calls to <code>__new__</code> and ... |
6,065,609 | document.getElementById(...).setAttribute('style',... not working in Internet Explorer | <p>document.getElementById(...).setAttribute('style',... is not working in Internet Explorer 7.0. How can I make this work in Internet Explorer?</p>
<pre><code><!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript">
var myarray=new Array(3);
for (i=0; i <1000; i++)... | 6,065,647 | 4 | 3 | null | 2011-05-19 22:37:26.893 UTC | 3 | 2013-12-30 10:28:05.88 UTC | null | null | null | null | 647,405 | null | 1 | 6 | javascript | 96,062 | <p>Using <code>setAttribute</code> is unreliable if you want the change to be reflected in the document. Use <a href="http://msdn.microsoft.com/en-us/library/ms536498%28v=VS.85%29.aspx"><code>Element.style</code></a> instead:</p>
<pre><code>var el = document.getElementById('id' + id);
el.style.fontWeight = 'bold';
el... |
1,778,221 | Understanding ASP.NET Eval() and Bind() | <p>Can anyone show me some absolutely minimal ASP.NET code to understand <code>Eval()</code> and <code>Bind()</code>?</p>
<p>It is best if you provide me with two separate code-snippets or may be web-links.</p> | 1,778,236 | 2 | 0 | null | 2009-11-22 08:57:12.69 UTC | 29 | 2017-11-21 06:16:01.573 UTC | 2011-12-19 17:46:07.43 UTC | null | 681,785 | null | 159,072 | null | 1 | 61 | asp.net|eval|bind | 149,401 | <p>For read-only controls they are the same. For 2 way databinding, using a datasource in which you want to update, insert, etc with declarative databinding, you'll need to use <code>Bind</code>.</p>
<p>Imagine for example a GridView with a <code>ItemTemplate</code> and <code>EditItemTemplate</code>. If you use <code>... |
29,665,534 | Type a String using java.awt.Robot | <p>I already know how to use <code>java.awt.Robot</code> to type a single character using <code>keyPress</code>, as seen below. How can I simply enter a <strong>whole</strong> pre-defined <code>String</code> value <strong>at once</strong> into a textbox? </p>
<pre><code>robot.keyPress(KeyEvent.VK_1);
robot.keyPress(... | 29,665,705 | 7 | 0 | null | 2015-04-16 04:47:13.163 UTC | 3 | 2018-11-13 15:06:49.747 UTC | 2015-04-16 05:05:35.433 UTC | null | 2,891,664 | user1196937 | null | null | 1 | 32 | java|swing|awtrobot | 36,549 | <p>Common solution is to use the clipboard:</p>
<pre><code>String text = "Hello World";
StringSelection stringSelection = new StringSelection(text);
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(stringSelection, stringSelection);
Robot robot = new Robot();
robot.keyPres... |
50,452,359 | Navigation Architecture Component - Activities | <p>I've been following the docs from <a href="https://developer.android.com/topic/libraries/architecture/navigation/navigation-implementing" rel="noreferrer">Navigation Architecture Component</a> to understand how this new navigation system works. </p>
<p>To go/back from one screen to another you need a component whic... | 53,432,167 | 3 | 2 | null | 2018-05-21 15:47:10.133 UTC | 13 | 2020-04-22 01:04:29.03 UTC | 2018-11-22 13:34:53.137 UTC | null | 1,525,990 | null | 1,525,990 | null | 1 | 53 | android|android-architecture-navigation | 40,070 | <p>I managed to navigate from one activity to another without hosting a Fragment by using <code>ActivityNavigator</code>.</p>
<pre><code>ActivityNavigator(this)
.createDestination()
.setIntent(Intent(this, SecondActivity::class.java))
.navigate(null, null)
</... |
5,804,844 | Implementing Depth First Search into C# using List and Stack | <p>I want to create a depth first search which I have been somewhat successful in.</p>
<p>Here is my code so far (Except my constructor, note the Vertex and Edge classes only contain properties, nothing important to post here):</p>
<pre><code>private Stack<Vertex> workerStack = new Stack<Vertex>();
privat... | 5,806,795 | 6 | 0 | null | 2011-04-27 13:25:37.51 UTC | 20 | 2019-09-20 19:26:49.54 UTC | 2019-09-20 19:26:49.54 UTC | null | 2,756,409 | null | 668,521 | null | 1 | 32 | c#|search|vertex|depth|edges | 49,112 | <blockquote>
<p>It seems mine is turned around and is beginning from right to left. Do you know what causes it? </p>
</blockquote>
<p>As others have noted, you are pushing the nodes-to-visit-next on the stack in order from left to right. That means they get popped off right-to-left, since a stack reverses the order.... |
6,141,710 | Running rsync in background | <p>I use this to run rsync in background</p>
<pre><code>rsync -avh /home/abc/abac /backups/ddd &
</code></pre>
<p>When i do that i see line saying 1 process stopped. </p>
<p>Now does that mean my process is still running ot it is stopped</p> | 6,141,758 | 7 | 2 | null | 2011-05-26 16:15:00.46 UTC | 4 | 2018-08-23 21:27:54.247 UTC | null | null | null | null | 767,244 | null | 1 | 11 | linux|background|rsync | 83,743 | <p>It is probably trying to read from the terminal (to ask you for a password, perhaps). When a background process tries to read from the terminal, it gets stopped.</p>
<p>You can make the error go away by redirecting stdin from /dev/null:</p>
<pre><code>rsync -avh /home/abc/abac /backups/ddd < /dev/null &
</... |
6,138,042 | Javascript selecbox.options to array? | <p>From what I understand a <code>option</code> elements that popuate <code>select</code> elements in HTML are an array.<br>
So basically what i want to do is return an array string that is separated by commas.</p>
<p>Tried to do <code>selecbox.options.join(',');</code>, but got an error that its not supported; anyone... | 6,138,067 | 8 | 1 | null | 2011-05-26 11:53:47.91 UTC | 6 | 2022-06-04 10:04:02.737 UTC | 2017-04-05 16:59:05.98 UTC | null | 401,672 | null | 572,771 | null | 1 | 31 | javascript|html|html-select | 45,640 | <p>It is not an array. It is an HTMLCollection. It is "array-like"</p>
<p>In 2022, a week before EOL of Internet Explorer 11, the simplest vanilla JavaScript solution is using <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax" rel="nofollow noreferrer">spread</... |
5,903,323 | Can't get value of input type="file"? | <p>I have a <code><input type="file" id="uploadPicture" value="123"></code></p>
<p>When I'm using: <code>alert($("#uploadPicture").val());</code></p>
<p>It alerts an empty dialog.</p> | 5,903,347 | 8 | 2 | null | 2011-05-05 19:51:06.367 UTC | 12 | 2021-04-24 21:56:00.7 UTC | 2017-04-16 04:15:00.293 UTC | null | 1,033,581 | null | 717,559 | null | 1 | 61 | javascript|jquery|file|input | 286,605 | <p>You can read it, but you can't <strong>set</strong> it. <code>value="123"</code> will be ignored, so it won't have a value until you click on it and pick a file.</p>
<p>Even then, the value will likely be mangled with something like <code>c:\fakepath\</code> to keep the details of the user's filesystem private.</p> |
38,976,582 | Reading text-file until EOF using fgets in C | <p>what is the correct way to read a text file until EOF using fgets in C? Now I have this (simplified):</p>
<pre><code>char line[100 + 1];
while (fgets(line, sizeof(line), tsin) != NULL) { // tsin is FILE* input
... //doing stuff with line
}
</code></pre>
<p>Specifically I'm wondering if there should be something... | 38,976,686 | 3 | 3 | null | 2016-08-16 13:42:40.35 UTC | 6 | 2017-02-10 16:38:07.853 UTC | null | null | null | null | 6,544,207 | null | 1 | 9 | c|while-loop|fgets | 51,722 | <p>According to the <a href="http://www.cplusplus.com/reference/cstdio/fgets/" rel="noreferrer">reference</a></p>
<blockquote>
<p><strong>On success, the function returns str</strong>.
If the end-of-file is encountered while attempting to read a character, the eof indicator is
set (feof). <strong>If this happens... |
829,952 | How do I host WPF content in MFC Applications? | <p>I'm going to answer my own question here because I spent a few hours piecing this together and wanted to share what I found in the hope that I will save someone else the digging.</p>
<p>There is an <a href="http://msdn.microsoft.com/en-us/library/ms744829.aspx" rel="noreferrer">MSDN Walkthrough</a> that gets you mo... | 829,955 | 1 | 0 | null | 2009-05-06 14:43:20.243 UTC | 14 | 2009-05-06 14:50:10.943 UTC | 2009-05-06 14:50:10.943 UTC | null | 2,284 | null | 2,284 | null | 1 | 18 | wpf|mfc|wpf-controls | 11,484 | <p><strong>Step 1: Configure the MFC application to compile with CLR support</strong></p>
<p>The best way to achieve interoperability between native C++ and managed .NET code is to compile the application as managed C++ rather than native C++. This is done by going to the Configuration Properties of the project. Under... |
48,757,816 | Catch all exceptions in django rest framework | <p>I guess this is more of a code quality question but it does involve handling unhandled exceptions is Django rest framework.</p>
<p>Deleting a protected record just return <code><h1>500 internal server error<h1></code>
So I added the example custom exception handler. The first line returns a response tha... | 56,349,560 | 2 | 0 | null | 2018-02-13 00:40:55.83 UTC | 10 | 2019-05-28 20:21:09.193 UTC | 2019-04-03 13:39:15.827 UTC | null | 4,610,896 | null | 4,610,896 | null | 1 | 8 | django|exception|django-rest-framework | 8,883 | <p>This seems to be the thing I was looking for...</p>
<p><a href="https://gist.github.com/twidi/9d55486c36b6a51bdcb05ce3a763e79f" rel="noreferrer">https://gist.github.com/twidi/9d55486c36b6a51bdcb05ce3a763e79f</a></p>
<p>Basically convert the django exception into a drf exception with the same details.</p>
<pre><co... |
42,582,633 | How to show index creation time with _cat/indices API in Elasticsearch | <p>I am using Elasticsearch 5.2, and cannot see <code>index creation time</code> with <code>http://localhost:9200/_cat/indices?v</code>.</p>
<p>Just wonder what options will show <code>index creation time</code> for each of the indices. </p> | 42,583,024 | 1 | 0 | null | 2017-03-03 15:23:40.047 UTC | 14 | 2020-05-03 14:47:58.51 UTC | null | null | null | null | 1,914,002 | null | 1 | 52 | elasticsearch | 43,275 | <p>Have a look at the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/cat.html" rel="noreferrer">cat API</a> : you can get the list of available parameters via <code>http://localhost:9200/_cat/indices?help</code></p>
<p>To get the creation date of your indexes, you would use <code>creation.dat... |
20,040,745 | Call to a member function getClientOriginalName() on a non-object | <p>I'm trying to make an image uploader, but it always give me this error</p>
<pre><code>Call to a member function getClientOriginalName() on a non-object
</code></pre>
<p>here is my code controller code</p>
<pre><code>public function uploadImageProcess(){
$destinatonPath = '';
$filename = '';
$file = ... | 20,045,366 | 6 | 0 | null | 2013-11-18 05:30:49.44 UTC | 2 | 2020-03-31 07:03:05.953 UTC | null | null | null | null | 3,003,423 | null | 1 | 9 | php|object|upload|laravel|laravel-4 | 52,490 | <p>You miss <code>enctype</code> attribute in your form markup.</p>
<p>Either do this</p>
<pre><code><form role="form" action="{{URL::to('user/poster/upload_process')}}" method="post" enctype="multipart/form-data">
...
</form>
</code></pre>
<p>or this...</p>
<pre><code>{{ Form::open(array('url' => 'u... |
35,055,088 | Get current value when change select option - Angular2 | <p>I'm writing an angular2 component and am facing this problem.</p>
<p><strong>Description:</strong> I want to push an option value in select selector to its handler when the <code>(change)</code> event is triggered.</p>
<p>Such as the below template:</p>
<pre><code><select (change)="onItemChange(<!--someth... | 35,055,235 | 7 | 0 | null | 2016-01-28 07:18:17.57 UTC | 11 | 2021-07-21 07:54:09.553 UTC | 2021-02-02 15:26:16.653 UTC | user10747134 | 31,532 | null | 4,407,950 | null | 1 | 50 | html|angular | 179,843 | <p>There is a way to get the value from different options. check this <a href="http://plnkr.co/edit/tD3UeHLVK9nKYoDJa68d?p=preview" rel="noreferrer">plunker</a></p>
<p>component.html</p>
<pre><code><select class="form-control" #t (change)="callType(t.value)">
<option *ngFor="#type of... |
61,154,795 | Revert IntelliJ IDEA font to pre-2020.1 default font | <p>I upgraded to IntelliJ 2020.1, which uses the new JetBrains Mono font by default. However, I would like to switch back to using the previous default, but I don't remember the name. What was the name of the default font on pre-2020.1 versions of IntelliJ IDEA?</p> | 61,154,796 | 2 | 0 | null | 2020-04-11 09:46:57.757 UTC | 4 | 2021-10-05 11:58:48.733 UTC | 2020-04-13 16:42:43.773 UTC | null | 1,225,617 | null | 1,225,617 | null | 1 | 47 | intellij-idea|fonts|default | 8,197 | <p>There is an <a href="https://intellij-support.jetbrains.com/hc/en-us/community/posts/360007965440-How-to-put-the-editor-appearance-back-to-the-previous-version-?page=1#community_comment_360001564299" rel="noreferrer">official comment</a> on the IntelliJ support site, stating the pre-2020.1 defaults per operating sys... |
42,728,140 | Is it possible to export * as foo in typescript | <p>I can:</p>
<pre><code>import * as foo from './foo'
</code></pre>
<p>But can't seem to export the same:</p>
<pre><code>export * as foo from './foo'
</code></pre>
<p>This doesn't seem to work either...:</p>
<pre><code>import * as fooImport from './foo';
export const foo = fooImport;
</code></pre>
<p>Any ideas?</... | 42,731,800 | 2 | 0 | null | 2017-03-10 21:38:56.153 UTC | 1 | 2020-10-20 03:11:50.15 UTC | 2017-03-11 15:57:51.63 UTC | null | 516,433 | null | 516,433 | null | 1 | 52 | typescript|module|export | 29,323 | <h1>TypeScript 3.8 or Later</h1>
<p>See <a href="https://stackoverflow.com/a/59712387/1108891">https://stackoverflow.com/a/59712387/1108891</a> for details.</p>
<h1>Before TypeScript 3.7 or Earlier</h1>
<blockquote>
<p>Is it possible to export * as foo in typescript</p>
</blockquote>
<p>Nope. You can, however, use a tw... |
21,709,305 | How to directly execute SQL query in C#? | <p>Ok, I have an old batch file that does exactly what I need. However, with out new administration we can't run the batch file anymore so I need to start up with C#.</p>
<p>I'm using Visual Studio C# and already have the forms set up for the application I need to build. (I'm learning as I go)</p>
<p>Here is what I ... | 21,709,663 | 3 | 1 | null | 2014-02-11 17:50:22.943 UTC | 21 | 2019-01-18 14:59:18.777 UTC | 2019-01-18 14:59:18.777 UTC | null | 542,251 | null | 3,191,919 | null | 1 | 83 | c#|.net|sql-server|batch-file | 374,826 | <p>To execute your command directly from within C#, you would use the <a href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand%28v=vs.110%29.aspx">SqlCommand</a> class.</p>
<p>Quick sample code using paramaterized SQL (to avoid injection attacks) might look like this:</p>
<pre><code>string qu... |
42,335,754 | Python Asynchronous Comprehensions - how do they work? | <p>I'm having trouble understanding the use of asynchronous comprehensions introduced in Python 3.6. As a disclaimer, I don't have a lot of experience dealing with asynchronous code in general in Python.</p>
<p>The example given in the <a href="https://docs.python.org/3/whatsnew/3.6.html" rel="noreferrer">what's new f... | 42,415,821 | 2 | 1 | null | 2017-02-20 02:56:44.487 UTC | 9 | 2017-02-23 12:29:52.427 UTC | null | null | null | null | 4,497,519 | null | 1 | 35 | python|asynchronous|list-comprehension|python-3.6 | 13,963 | <p>You are basically asking how an <code>async for</code> loop works over a regular loop. That you can now use such a loop in a list comprehension doesn't make any difference here; that's just an optimisation that avoids repeated <code>list.append()</code> calls, exactly like a normal list comprehension does.</p>
<p>A... |
51,203,570 | Is it well-defined to hold a misaligned pointer, as long as you don't ever dereference it? | <p>I have some C code that parses packed/unpadded binary data that comes in from the network.</p>
<p>This code was/is working fine under Intel/x86, but when I compiled it under ARM it would often crash. </p>
<p>The culprit, as you might have guessed, was unaligned pointers -- in particular, the parsing code would do... | 51,203,895 | 4 | 2 | null | 2018-07-06 05:31:33.87 UTC | 4 | 2019-08-05 00:29:33.613 UTC | null | null | null | null | 131,930 | null | 1 | 38 | c|pointers|alignment|language-lawyer | 2,706 | <p>No, the new code still has undefined behaviour. <a href="http://port70.net/~nsz/c/c11/n1570.html#6.3.2.3p7" rel="nofollow noreferrer">C11 6.3.2.3p7</a>:</p>
<blockquote>
<ol start="7">
<li>A pointer to an object type may be converted to a pointer to a different object type. If the resulting pointer is not corre... |
9,364,807 | JavaScript - Reference Browser Window by name? | <p>When you create a new browser window, you pass it a name like this:</p>
<pre><code>myWindow = window.open('http://www.google.com', "googleWindow");
</code></pre>
<p>Later you can access the window from the variable you saved it as:</p>
<pre><code>myWindow.close();
</code></pre>
<p>Is it possible to access and ma... | 9,364,899 | 5 | 0 | null | 2012-02-20 16:40:56.957 UTC | 5 | 2018-02-09 20:50:12.97 UTC | 2012-02-20 16:45:57.613 UTC | null | 172,350 | null | 172,350 | null | 1 | 9 | javascript | 42,519 | <p>No. Without a reference to the window, you can't find it again, by name or otherwise. There is no collection of windows.</p>
<p><strong>UPDATE:</strong> Here's how you could do it yourself:</p>
<pre><code>var windows = {};
function openWindow(url, name, features) {
windows[name] = window.open(url, name, featur... |
9,162,926 | iOS property declaration clarification | <p>This is a two part question in hopes that I can <em>understand</em> more about the topic.</p>
<p><strong>1)</strong> It seems to me that you have two <em>popular</em> options for declaring a property for a <em>class</em> in <code>objective c</code>. One is to add the property to the header's class body eg.</p>
<pr... | 9,163,058 | 5 | 0 | null | 2012-02-06 15:54:40.903 UTC | 31 | 2016-04-19 01:37:54.943 UTC | 2012-08-30 11:22:22.18 UTC | null | 74,118 | null | 332,578 | null | 1 | 22 | ios|class|properties | 16,678 | <p>Here are the only property modifiers that Xcode recognizes:</p>
<ul>
<li><code>nonatomic</code> (does not enforce thread safety on the property, mainly for use when only one thread shall be used throughout a program)</li>
<li><code>atomic</code> (enforces thread safety on the property, mainly for use when multiple ... |
22,803,607 | How do I debug CMakeLists.txt files? | <p>Is there a possibility to debug <code>CMakeLists.txt</code> files (at least listing of variables) except for the <a href="http://www.cmake.org/cmake/help/v2.8.12/cmake.html#command:message" rel="noreferrer">message</a> statement?</p> | 22,803,821 | 5 | 1 | null | 2014-04-02 06:51:55.92 UTC | 31 | 2020-01-30 17:28:28.277 UTC | 2019-02-16 15:57:57.153 UTC | null | 63,550 | null | 2,838,364 | null | 1 | 102 | cmake | 75,334 | <p>There is no interactive debugger for CMake, however there are also the flags <code>-Wdev</code>, <code>--debug-output</code> and <code>--trace</code> which might help. Also remember to check the log files <code>CMakeFiles\CMakeOutput.log</code> and <code>CMakeFiles\CMakeError.log</code> which mainly collect outputs ... |
22,781,788 | How could I pass a dynamic set of arguments to Go's command exec.Command? | <p>I came across a question on here relating to arguments being passed to Go's <code>exec.Command</code> function, and I was wondering if there was a way do pass these arguments dynamically? Here's some sample code from sed question:</p>
<pre><code>package main
import "os/exec"
func main() {
app := "echo"
//... | 22,781,927 | 3 | 1 | null | 2014-04-01 09:30:05.933 UTC | 4 | 2021-10-21 02:20:03.643 UTC | null | null | null | null | 1,898,062 | null | 1 | 32 | go|command|exec | 34,192 | <p>Like this:</p>
<pre><code>args := []string{"what", "ever", "you", "like"}
cmd := exec.Command(app, args...)
</code></pre>
<p>Have a look at the language and tutorial on golang.org.</p> |
7,455,893 | change the position of image on click | <pre><code> <html>
<head>
<script type="text/javascript">
function changepic()
{
document.getElementById("demo").style.top=2000;
}
</script>
</head>
<body>
<h1>My First Web Page</h1>
<div id="demo">
<img src="./omna.jpg" sty... | 7,455,921 | 2 | 0 | null | 2011-09-17 15:37:22.02 UTC | 1 | 2020-06-25 14:31:37.143 UTC | null | null | null | null | 834,032 | null | 1 | 4 | javascript|html | 57,477 | <p>You're trying to set the <code>top</code> of an element with the id <code>demo</code>, which is a <code><div></code>. I assume that div doesn't have <code>position:absolute</code> set on it so won't move anywhere, and I guess you want the <code><img></code> to move and and not the <code><div></code... |
21,105,315 | Git: Move head one commit ahead | <p>I did a <code>git reset HEAD~1</code> to go back one commit. I did this a number of times.</p>
<p>I now want to go back to where <code>HEAD</code> was originally but am not sure how to move my <code>HEAD</code> forward. </p>
<p>Does anyone know what command I need to use?</p>
<p>1-2-3-4-5-6</p>
<p>Originally I w... | 21,105,355 | 1 | 2 | null | 2014-01-14 02:59:28.417 UTC | 10 | 2014-09-24 05:46:38.35 UTC | 2014-09-24 05:46:38.35 UTC | null | 31,671 | null | 2,020,869 | null | 1 | 37 | git | 31,218 | <p>use <code>git reflog</code> to see SHA-1 of last operations and then do <code>git reset --hard <sha1></code>.</p>
<p>Git keeps objects (and their SHA-1 respectively) even they go "out of scope" until next <code>git gc</code> invocation. So if you think, you've lost something in the project history, use <code>... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.