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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
16,213,255 | How to read cell values from existing excel file | <p>I want to read the each cell value in excel file, But i am not able to get the cell values even after trying different examples in NET. I am not getting result with the following code, can any one get back on this. I am using .net framework 2.0</p>
<pre><code>string filePath = "F:/BulkTest.xlsx";
Microsoft.Office.I... | 16,213,877 | 3 | 7 | null | 2013-04-25 11:14:10.27 UTC | 3 | 2016-11-22 05:15:24.82 UTC | 2014-04-07 13:33:52.123 UTC | null | 1,300,224 | user2252365 | null | null | 1 | 2 | c#|excel | 58,579 | <blockquote>
<p>Till now i am trying to take cell values directly to variables, now i will try to take cell values to an array using Range. Thanks!!!! – Teja Varma 13 mins ago</p>
</blockquote>
<p>No. I didn't even mean that :) As I mentioned in the comment that you can store the entire range in an array. That doesn... |
51,873,516 | Requires Babel "7.0.0-0" but was loaded with "6.26.3" | <p>Keep getting this error no matter what I tried installing (babel wise) as I follow other similar reports. this is the stack trace:</p>
<blockquote>
<pre><code>error: bundling failed: Error: Requires Babel "^7.0.0-0", but was
loaded with "6.26.3". If you are sure you have a compatible version of
@babel/core, it is l... | 51,901,251 | 15 | 1 | null | 2018-08-16 09:14:08.533 UTC | 14 | 2022-06-10 08:34:13.787 UTC | 2018-08-17 20:50:51.977 UTC | null | 785,065 | null | 9,628,544 | null | 1 | 74 | reactjs|react-native|babeljs | 54,509 | <p>Looks like you need to install <code>babel-core</code> as the docs suggest:
<a href="https://jestjs.io/docs/en/getting-started#using-babel" rel="noreferrer">https://jestjs.io/docs/en/getting-started#using-babel</a></p>
<p><code>yarn add --dev babel-jest babel-core@^7.0.0-bridge.0 @babel/core regenerator-runtime</co... |
29,461,831 | libsass bindings not found when using node-sass in nodejs | <p>I want to use the <code>node-sass</code> module in my <code>node.js v0.12</code> application to benefit from the performance of <code>libsass</code>.<br>
I executed <code>npm i node-sass</code> to install the module, no errors so far.<br></p>
<p>Now the mess starts:<br>
If I just open the <code>REPL</code> in a ter... | 29,624,362 | 13 | 2 | null | 2015-04-05 20:23:41.08 UTC | 38 | 2021-01-28 14:13:49.077 UTC | null | null | null | null | 1,223,253 | null | 1 | 77 | node.js|ubuntu|npm|libsass|node-sass | 73,376 | <p>You’ve probably tried to reinstall node-sass while using </p>
<pre><code>npm install node-sass
</code></pre>
<p>or</p>
<pre><code>npm uninstall node-sass
npm install node-sass
</code></pre>
<p>But node-sass is a C version of Sass. You have to use <a href="https://docs.npmjs.com/cli/rebuild">npm rebuild</a>:</p>
... |
32,334,312 | Subtracting n days from date in Python | <p>I want to subtract n days from a file's timestamp, but it doesn't seem to be working. I have read <a href="https://stackoverflow.com/questions/6871016/adding-5-days-to-date-in-python">this post</a>, and I think I'm close.</p>
<p>This is an excerpt from my code:</p>
<pre><code>import os, time
from datetime import d... | 32,334,496 | 2 | 3 | null | 2015-09-01 14:30:57.517 UTC | 1 | 2018-03-26 04:04:01.9 UTC | 2017-05-23 11:54:30.703 UTC | null | -1 | null | 3,343,907 | null | 1 | 9 | python|python-2.7|datetime|timedelta | 48,070 | <p>When you use <a href="https://docs.python.org/2/library/time.html#time.strftime" rel="noreferrer"><code>time.strftime()</code></a> you are actually converting a <a href="https://docs.python.org/2/library/time.html#time.struct_time" rel="noreferrer"><code>struct_time</code></a> to a string.</p>
<p>so <code>filedate<... |
54,809,410 | Unresolved reference ActivityTestRule for AndroidX | <p>I'm trying to test my UI via instrumentation test, with androidX espresso library.
In my grade I have:</p>
<pre class="lang-kotlin prettyprint-override"><code>apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: "kotlin-kapt"
android {
... | 54,810,885 | 2 | 5 | null | 2019-02-21 14:28:24.073 UTC | 5 | 2020-11-06 06:17:57.423 UTC | 2019-02-21 14:37:42.827 UTC | null | 6,275,174 | null | 6,275,174 | null | 1 | 30 | android|testing|kotlin|android-espresso|androidx | 19,461 | <p>I found out from <a href="https://developer.android.com/training/testing/set-up-project" rel="noreferrer">this</a> documentation page that class ActivityTestRule stays under <strong>androidx.test.rule</strong> in AndroidX. In order to import the package, I simply added: </p>
<pre><code> androidTestImplementation '... |
26,576,260 | Can I use the work-stealing behaviour of ForkJoinPool to avoid a thread starvation deadlock? | <p>A <em>thread starvation deadlock</em> occurs in a normal thread pool if all the threads in the pool are waiting for queued tasks in the same pool to complete. <code>ForkJoinPool</code> avoids this problem by stealing work from other threads from inside the <code>join()</code> call, rather than simply waiting. For ... | 26,617,505 | 3 | 2 | null | 2014-10-26 18:11:12.047 UTC | 20 | 2019-11-26 09:35:37.537 UTC | null | null | null | null | 502,399 | null | 1 | 18 | java|multithreading|concurrency|java.util.concurrent|fork-join | 9,272 | <p>You are almost answering your own question. The solution is the statement that "<code>ForkJoinPool</code> avoids this problem by stealing work from other threads from inside the <code>join()</code> call". Whenever the threads are blocked for some other reason except <code>ForkJoinPool.join()</code>, this work steali... |
20,122,583 | Website in wordpress redirects to old URL after migration | <p>I had never done migrating a site on wordpress, I'll put step by step how I did, need to put the site on a new domain that are on the same server, so only the migrated files, the database is equal.</p>
<p>I copied all the files from the old wordpress to the new site folder,
I had the following result on the new si... | 20,122,853 | 9 | 2 | null | 2013-11-21 13:41:50.403 UTC | 9 | 2022-05-07 17:36:55.58 UTC | null | null | null | null | 2,729,508 | null | 1 | 38 | php|wordpress|.htaccess | 89,113 | <p>You need to make a change to your database.
In the database table wp_options (or whatever your database prefix is), you need to change two lines. </p>
<p>One should be <code>option_id</code> 1, <code>option_name</code> siteurl. Change the <code>option_value</code> from the old url to the new url.</p>
<p>Similarly ... |
6,403,055 | Object destruction in C++ | <p>When exactly are objects destroyed in C++, and what does that mean? Do I have to destroy them manually, since there is no Garbage Collector? How do exceptions come into play?</p>
<p><sub><i>
(Note: This is meant to be an entry to <a href="https://stackoverflow.com/questions/tagged/c++-faq">Stack Overflow's C++ FAQ</... | 6,403,057 | 2 | 19 | null | 2011-06-19 14:43:19.833 UTC | 51 | 2021-08-10 15:25:10.08 UTC | 2021-08-10 15:25:10.08 UTC | null | 438,992 | null | 252,000 | null | 1 | 78 | c++|exception|destructor|c++-faq|object-lifetime | 37,931 | <p>In the following text, I will distinguish between <em>scoped objects</em>, whose time of destruction is statically determined by their enclosing scope (functions, blocks, classes, expressions), and <em>dynamic objects</em>, whose exact time of destruction is generally not known until runtime.</p>
<p>While the destr... |
1,488,162 | jQuery: Refresh div after another jquery action? | <p>How do I refresh element (div, class whatever) after another jquery action?</p>
<p>I have this action which is deleting a record from database and I need to refresh div which is fetching some other data from database as well...</p>
<p>Well here's code:</p>
<pre><code>$(function() {
$(".delete").click(function... | 1,488,200 | 4 | 2 | null | 2009-09-28 16:59:43.76 UTC | 2 | 2009-09-28 17:39:25.377 UTC | 2009-09-28 17:39:25.377 UTC | null | 53,162 | null | 124,962 | null | 1 | 5 | jquery|refresh | 43,624 | <p>During an AJAX call you can use the success function to run commands after a successful call. You already have a function in your code so its a simple matter of updating that function. The second div that you will like to update can be loaded with AJAX too.</p>
<pre><code> $.ajax({
//other options
success:funct... |
1,563,961 | How to find top n% of records in a column of a dataframe using R | <p>I have a dataset showing the exchange rate of the Australian Dollar versus the US dollar once a day over a period of about 20 years. I have the data in a data frame, with the first column being the date, and the second column being the exchange rate. Here's a sample from the data:</p>
<pre><code>>data
... | 1,563,978 | 4 | 0 | null | 2009-10-14 02:28:40.603 UTC | 12 | 2020-03-20 14:06:03.123 UTC | 2015-01-03 21:47:32.33 UTC | null | 4,015,623 | null | 129,475 | null | 1 | 27 | r|dataframe | 35,709 | <p>For the top 5%:</p>
<pre><code>n <- 5
data[data$V2 > quantile(data$V2,prob=1-n/100),]
</code></pre> |
1,604,815 | How to use group by with union in T-SQL | <p>How can I using group by with union in T-SQL? I want to group by the first column of a result of union, I wrote the following SQL but it doesn't work. I just don't know how to reference the specified column (in this case is 1) of the union result.</p>
<pre><code>SELECT *
FROM ( SELECT a.id ,
... | 1,604,881 | 4 | 0 | null | 2009-10-22 03:08:27.147 UTC | 3 | 2021-06-14 23:58:36.103 UTC | 2021-06-14 23:58:36.103 UTC | null | 1,127,428 | null | 170,931 | null | 1 | 32 | sql|sql-server|tsql|group-by|union | 166,139 | <blockquote>
<p>GROUP BY 1</p>
</blockquote>
<p>I've never known GROUP BY to support using ordinals, only ORDER BY. Either way, only MySQL supports GROUP BY's not including all columns without aggregate functions performed on them. Ordinals aren't recommended practice either because if they're based on the order o... |
1,439,513 | Creating a sequential list of letters with R | <p>I would like to be able to create a sequence of letters in R (to assist in importing data from a SPSS file)</p>
<p>It's quite easy to create a sequence of numbers, for example:</p>
<pre><code>seq(1,1000)
[1] 1 2 3 4 5 6 ... 1000
paste("something_",1:12,sep="")
[1] something1 something2 ... something12
</code></pr... | 1,439,843 | 4 | 0 | null | 2009-09-17 15:15:26.193 UTC | 9 | 2020-03-21 15:52:49.787 UTC | null | null | null | null | 170,352 | null | 1 | 48 | r|alphabet | 107,109 | <p>This is what you're looking for:</p>
<pre><code>> paste("This_", letters, sep="")
> [1] "This_a" "This_b" "This_c" "This_d" "This_e" "This_f" "This_g" "This_h"
[9] "This_i" "This_j" "This_k" "This_l" "This_m" "This_n" "This_o" "This_p"
[17] "This_q" "This_r" "This_s" "This_t" "This_u" "This_v" "This_w" "... |
10,270,452 | JQuery change not firing until blur | <p>I use change(handler) to listen to change events to a textarea, but I only receive an event when the textarea loses focus, but I want to receive an event as soon as the value changes.</p>
<pre><code>$("#text_object").change(listener);
function listener(dom){
alert("I'm not getting here before the textarea loses foc... | 10,270,535 | 7 | 2 | null | 2012-04-22 17:47:23.317 UTC | 1 | 2021-02-25 17:32:13.78 UTC | null | null | null | null | 821,562 | null | 1 | 39 | jquery | 23,949 | <p>Unfortunately the browser only recognises a change when the field blurs, so you might want to try attaching a keyup listener. Not the most elegant solution, unfortunately.</p>
<p>Details at <a href="http://api.jquery.com/keyup/" rel="noreferrer">http://api.jquery.com/keyup/</a>.</p> |
28,806,092 | How to find integer array size in java | <p>below is my code which is throwing error:</p>
<pre><code>Cannot invoke size() on the array type int[]
</code></pre>
<p>Code:</p>
<pre><code>public class Example{
int[] array={1,99,10000,84849,111,212,314,21,442,455,244,554,22,22,211};
public void Printrange(){
for (int i=0;i<array.size();i++){
if(arra... | 28,806,119 | 7 | 2 | null | 2015-03-02 09:14:28.853 UTC | 6 | 2018-11-08 22:06:27.623 UTC | 2015-03-02 09:15:10.873 UTC | user1907906 | null | null | 4,576,964 | null | 1 | 16 | java|arrays|printing|size|range | 139,453 | <p>The length of an array is available as</p>
<pre><code>int l = array.length;
</code></pre>
<p>The size of a <code>List</code> is availabe as </p>
<pre><code>int s = list.size();
</code></pre> |
36,285,155 | Pandas: Get Dummies | <p>I have the following dataframe:</p>
<pre><code> amount catcode cid cycle date di feccandid type
0 1000 E1600 N00029285 2014 2014-05-15 D H8TX22107 24K
1 5000 G4600 N00026722 2014 2013-10-22 D H4TX28046 24K
2 4 C2100 N00030676 2014 2014-03-26 ... | 36,285,489 | 5 | 6 | null | 2016-03-29 13:05:36.237 UTC | 12 | 2022-09-23 21:03:17.243 UTC | 2018-03-02 22:24:58.3 UTC | null | 5,411,817 | null | 5,211,377 | null | 1 | 52 | python|pandas|dummy-variable | 126,162 | <p>You can try :</p>
<pre><code>df = pd.get_dummies(df, columns=['type'])
</code></pre> |
7,331,923 | How to use division in JavaScript | <p>I want to divide a number in JavaScript and it would return a decimal value.</p>
<p>For example: <code>737/1070</code> - I want JavaScript to return <code>0.68</code>; however it keeps rounding it off and return it as <code>0</code>.</p>
<p>How do I set it to return me either two decimals place or the full results... | 7,331,939 | 6 | 2 | null | 2011-09-07 09:53:53.11 UTC | 3 | 2021-07-18 13:22:46.527 UTC | 2019-01-27 10:03:34.363 UTC | null | 4,298,200 | null | 502,963 | null | 1 | 67 | javascript|division | 96,772 | <p>Make one of those numbers a float.</p>
<pre><code>737/parseFloat(1070)
</code></pre>
<p>or a bit faster:</p>
<pre><code>737*1.0/1070
</code></pre>
<p>convert to 2 decimal places</p>
<pre><code>Math.round(737 * 100.0 / 1070) / 100
</code></pre> |
7,259,142 | How to list all properties of a PowerShell WMI object | <p>When I look at the <a href="http://msdn.microsoft.com/en-us/library/aa394102%28v=VS.85%29.aspx" rel="noreferrer">Win32_ComputerSystem class</a>, it shows loads of properties like <code>Status</code>, <code>PowerManagementCapabilities</code>, etc. However, when in PowerShell I do the below I only get back a couple:</... | 7,259,178 | 6 | 0 | null | 2011-08-31 15:10:18.227 UTC | 30 | 2022-09-18 00:15:02.103 UTC | 2022-09-16 05:57:30.09 UTC | null | 25,702 | null | 461,030 | null | 1 | 140 | powershell|wmi|get-wmiobject | 279,090 | <p>Try this:</p>
<pre><code>Get-WmiObject -Class "Win32_computersystem" | Format-List *
Get-WmiObject -Class "Win32_computersystem" | Format-List -Property *
</code></pre>
<p>For certain objects, PowerShell provides a set of formatting instructions that can affect either the table or list formats. These are usually m... |
7,203,251 | javascript/html autocomplete textbox | <p>I am developing a web page which has a requirement of many autocomplete textboxes. As I am new to javascript, it is very tough for me to make my own autocomplete textbox. So I have searched many examples from the internet, but they only work for a single textbox. This means I cannot use the same js file to make anot... | 7,203,302 | 8 | 0 | null | 2011-08-26 10:17:14.457 UTC | 6 | 2021-09-18 23:00:06.897 UTC | 2014-06-25 21:32:26.54 UTC | null | -1 | null | 821,144 | null | 1 | 25 | javascript|html | 86,104 | <p>Use JQuery with the AutoSuggest plugin.</p>
<p><a href="http://docs.jquery.com/Plugins/autocomplete" rel="noreferrer">http://docs.jquery.com/Plugins/autocomplete</a></p>
<p>Include the JS libraries (see the documentation above), then do this in HTML:</p>
<pre><code><input type="text" class="autocomplete" name=... |
13,884,293 | Using a html select box with razor | <p>I have a html selector, and I want to use the selected value for my "model => model.type" in my form. Is there a way to set the value in my <code>@Html.EditorFor(model => model.type)</code> to the value of the selector?</p>
<pre><code>@using (Html.BeginForm()) {
@Html.ValidationSummary(true)
<fieldset>
... | 13,886,378 | 5 | 3 | null | 2012-12-14 18:25:56.117 UTC | 2 | 2018-08-01 05:29:44.507 UTC | 2012-12-14 18:40:19.85 UTC | null | 727,208 | null | 1,505,482 | null | 1 | 12 | asp.net-mvc|razor | 54,042 | <p>You can try with this options:</p>
<p>Model:</p>
<pre><code>public string Type { get; set; }
public IEnumerable<SelectListItem> TypeList
{
get
{
return new List<SelectListItem>
{
new SelectListItem { Text = "Football", Value = "Football"},
new SelectList... |
14,062,932 | libraries to CAPTURE panorama in iOS 6 | <p>There are a lot of ways and libraries to show panorama picture in iOS, Although there is a panorama feature in the built-in camera there is no way to use it within an app.</p>
<p>Is there any library I can use to capture a panorama image?</p>
<p>Thanks!</p> | 14,064,788 | 1 | 0 | null | 2012-12-28 00:03:29.527 UTC | 24 | 2014-06-04 20:59:07.427 UTC | null | null | null | null | 1,071,887 | null | 1 | 13 | iphone|ios|ios6|panoramas | 9,826 | <p><a href="http://www.cs.bath.ac.uk/brown/autostitch/autostitch.html#licensing" rel="nofollow noreferrer">These people</a> might sell you a license for a c++ library. Their code goes into the brilliant Autostich app available in the App Store. </p>
<p>Autostitch is based on SIFT image feature detection. SIFT and many... |
14,228,151 | Datepicker plugin for birth date textbox | <p>I've found a very easy to use datepicker called jquery datepicker. But the problem is when I want to use it for birth date. For example: my birth year is 1986 and the current year is 2013, then I need to click left arrow many times to decrease the months until I find 1986. It will be more troublesome if my birth yea... | 14,228,178 | 3 | 0 | null | 2013-01-09 04:11:29.243 UTC | 2 | 2017-07-26 08:07:52.78 UTC | 2013-01-18 13:25:19.8 UTC | null | 1,437,962 | null | 1,799,794 | null | 1 | 14 | jquery|jquery-plugins|datepicker | 48,099 | <p><strong>In short:</strong> you may do that bythe Restricting Datepicker section in the <a href="http://jqueryui.com/datepicker/#dropdown-month-year">demo page</a>.</p>
<p>If you look down the <a href="http://jqueryui.com/datepicker/#dropdown-month-year">demo page</a> a bit, you'll see a "Restricting Datepicker" se... |
13,857,331 | SQL Server 2008 thousands separator for a column | <p>I have a column called <code>TotalArea</code> and its format is <code>numeric (12,2)</code>.</p>
<p>I want it to display the numbers with a thousand separator so when I </p>
<pre><code>select TotalArea from table
</code></pre>
<p>to show me a format like <code>1,234.00</code>.</p>
<p>How could I do that? Thanks!... | 13,857,441 | 4 | 1 | null | 2012-12-13 10:01:24.017 UTC | 5 | 2020-05-04 12:37:51.42 UTC | 2012-12-13 10:17:15.857 UTC | null | 13,302 | null | 1,820,705 | null | 1 | 35 | sql|sql-server|database|sql-server-2008|tsql | 96,983 | <p>Try this way:</p>
<pre><code>SELECT REPLACE(CONVERT(VARCHAR, CONVERT(MONEY, TotalArea), 1), '.00', '')
FROM table
</code></pre>
<p>or</p>
<pre><code>SELECT CAST(CONVERT(VARCHAR, CAST(123456 AS MONEY), 1) AS VARCHAR)
FROM table
</code></pre> |
14,245,769 | Check all Checkboxes in Page via Developer Tools | <p>I have a loop that creates 20 <strong><em>check-boxes</em></strong> in the same page (it creates different forms). I want via <strong><em>chrome developer tools</em></strong> to run a JavaScript without the use of any library that <strong><em>CHECK</em></strong> all <em>check-boxes</em> at the same time.</p>
<h2>Th... | 14,245,862 | 9 | 1 | null | 2013-01-09 20:22:25.29 UTC | 21 | 2022-04-24 23:17:12.153 UTC | 2013-08-08 19:52:33.137 UTC | null | 1,699,961 | null | 1,699,961 | null | 1 | 55 | javascript|google-chrome|checkbox|google-chrome-devtools | 52,039 | <pre><code>(function() {
var aa= document.getElementsByTagName("input");
for (var i =0; i < aa.length; i++){
if (aa[i].type == 'checkbox')
aa[i].checked = true;
}
})()
</code></pre>
<p>With up to date browsers can use <a href="https://developer.mozilla.org/en-US/docs/Web/API/Document... |
14,158,868 | Python: skip comment lines marked with # in csv.DictReader | <p>Processing CSV files with <a href="http://docs.python.org/2/library/csv.html#csv.DictReader" rel="noreferrer">csv.DictReader</a> is great - but I have CSV files with comment lines (indicated by a hash at the start of a line), for example:</p>
<pre class="lang-none prettyprint-override"><code># step size=1.61853
val0... | 14,158,869 | 4 | 0 | null | 2013-01-04 14:20:30.043 UTC | 18 | 2021-11-04 05:28:15.317 UTC | 2021-11-04 05:28:15.317 UTC | null | 10,794,031 | null | 1,563,927 | null | 1 | 86 | python|csv|comments | 33,407 | <p>Actually this works nicely with <code>filter</code>:</p>
<pre><code>import csv
fp = open('samples.csv')
rdr = csv.DictReader(filter(lambda row: row[0]!='#', fp))
for row in rdr:
print(row)
fp.close()
</code></pre> |
43,177,074 | How to fix this violation of this 'react/no-unescaped-entitie' of eslint rule? | <p>This is my code:</p>
<pre><code>const func = () => {
return (
<div >
you're free
</div>
)}
</code></pre>
<p>Somehow eslint flags the line "you're free" with error <code>error HTML entities must be escaped react/no-unescaped-entities</code></p>
<p>However from what I can see j... | 45,898,131 | 6 | 1 | null | 2017-04-03 05:29:15.553 UTC | 9 | 2022-04-26 08:29:01.153 UTC | 2017-04-07 09:20:30.653 UTC | null | 58,129 | null | 58,129 | null | 1 | 74 | reactjs|eslint|eslint-config-airbnb | 65,526 | <p>Recommended solution is to use <code>&apos;</code>, <code>&lsquo;</code> or <code>&rsquo;</code> instead of wrapping it as a variable. So like this:</p>
<pre><code>const func = () => {
return (
<div >
you&apos;re free
</div>
)}
</code></pre>
<p>For search-ability... |
43,351,596 | Activating Anaconda Environment in VsCode | <p>I have Anaconda working on my system and VsCode working, but how do I get VsCode to activate a specific environment when running my python script?</p> | 43,352,598 | 15 | 1 | null | 2017-04-11 16:33:50.373 UTC | 37 | 2021-12-18 16:51:51.393 UTC | null | null | null | null | 30,889 | null | 1 | 94 | python|visual-studio-code|anaconda | 185,341 | <p>If Anaconda is your default Python install then it just works if you install the <a href="https://marketplace.visualstudio.com/items?itemName=ms-python.python" rel="noreferrer">Microsoft Python extension</a>.</p>
<p>The following should work regardless of Python editor or if you need to point to a specific install:... |
19,334,542 | Why can I type alias functions and use them without casting? | <p>In Go, if you define a new type e.g.:</p>
<pre><code>type MyInt int
</code></pre>
<p>You can't then pass a <code>MyInt</code> to a function expecting an int, or vice versa:</p>
<pre><code>func test(i MyInt) {
//do something with i
}
func main() {
anInt := 0
test(anInt) //doesn't work, int is not of t... | 19,334,952 | 4 | 3 | null | 2013-10-12 13:07:47.11 UTC | 55 | 2022-09-20 16:15:16.61 UTC | 2016-08-02 05:28:13.587 UTC | user6169399 | null | null | 1,339,698 | null | 1 | 117 | types|casting|go | 56,482 | <p>Turns out, this is a misunderstanding that I had about how Go dealt with types, which can be resolved by reading the relevant part of the spec:</p>
<p><a href="http://golang.org/ref/spec#Type_identity">http://golang.org/ref/spec#Type_identity</a></p>
<p>The relevant distinction that I was unaware of was that of <s... |
19,645,527 | Trying to get PyCharm to work, keep getting "No Python interpreter selected" | <p>I'm trying to learn Python and decided to use PyCharm. When I try to start a new project I get a dialog that says "No Python interpreter selected". It has a drop down to select a interpreter, but the drop down is empty.</p> | 19,676,884 | 12 | 3 | null | 2013-10-28 21:36:35.777 UTC | 13 | 2021-09-18 10:20:23.42 UTC | 2014-03-27 15:22:06.957 UTC | null | 258,523 | null | 564,653 | null | 1 | 65 | python|pycharm | 251,837 | <p>Your problem probably is that you haven't <em>installed</em> python. Meaning that, if you are using Windows, you have not downloaded the installer for Windows, that you can find on the official Python website.</p>
<p>In case you have, chances are that PyCharm cannot find your Python installation because its not in ... |
34,275,076 | use locale (ltr/rtl) for gravity in TextView | <p>I have a simple TextView which should have <code>android:gravity="left"</code> for ltr system locales and <code>android:gravity="right"</code> for rtl system locales.</p>
<p>The obvious choice would be: <code>android:gravity="start"</code> but then e.g. english text will always be left-aligned and hebrew right-alig... | 34,298,259 | 5 | 5 | null | 2015-12-14 19:28:51.673 UTC | 14 | 2022-06-11 02:23:26.197 UTC | 2015-12-15 07:47:49.323 UTC | null | 3,755,928 | null | 3,755,928 | null | 1 | 32 | android|layout|right-to-left | 15,989 | <p>I'm using this solution now, I would prefer a simple xml solution, but this seems minimal so far:</p>
<pre><code>if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN_MR1) {
if (DynamicLanguage.getLayoutDirection(getContext()) == View.LAYOUT_DIRECTION_RTL) {
this.textView.setGravity(Gravity.RIGHT);
} else {
... |
274,308 | How does geographic lookup by IP work? | <p>Is which IPs are assigned to which ISPs public information? How do geo IP services obtain this information and maintain this information?</p>
<p>How can I personally figure out where a certain IP belongs without using one of these services?</p> | 277,537 | 5 | 1 | null | 2008-11-08 03:35:25.873 UTC | 17 | 2017-02-10 15:58:53.507 UTC | 2010-05-01 21:24:14.437 UTC | null | 164,901 | Brian R. Bondy | 3,153 | null | 1 | 28 | dns|ip|ip-geolocation | 18,502 | <p>For what it's worth, I worked at a senior level in the ISP industry for more than a decade so I have quite some experience with this.</p>
<p>Large IP ranges are allocated as needed by <a href="http://www.iana.org/" rel="noreferrer">IANA</a> to each of the <a href="http://en.wikipedia.org/wiki/Regional_Internet_Regi... |
261,815 | Upper limit for autoincrement primary key in SQL Server | <p>What is the upper limit for an autoincrement primary key in SQL Server?
What happens when an SQL Server autoincrement primary key reaches its upper limit?</p> | 261,868 | 5 | 0 | null | 2008-11-04 13:02:51.047 UTC | 10 | 2011-04-21 18:18:04.213 UTC | null | null | null | Dema | 407,003 | null | 1 | 36 | sql|sql-server|auto-increment | 29,451 | <p>Joel's answer is correct, it is the upper limit of whatever datatype you use.</p>
<p>Here's an example of two of them:</p>
<ul>
<li>int: 2^31-1 (2,147,483,647) </li>
<li>bigint: 2^63-1 (9,223,372,036,854,775,807)</li>
</ul>
<p>I have actually hit the limit at a job I worked at. The actual error is:</p>
<pre>
... |
309,496 | Initializing an Array of Structs in C# | <p>How can I initialize a const / static array of structs as clearly as possible?</p>
<pre><code>class SomeClass
{
struct MyStruct
{
public string label;
public int id;
};
const MyStruct[] MyArray = {
{"a", 1}
{"b", 5}
{"q", 29}
};
};
</code></pre> | 309,528 | 5 | 0 | null | 2008-11-21 17:09:14.267 UTC | 25 | 2019-05-03 15:23:19.243 UTC | 2017-02-23 17:52:47.003 UTC | null | 4,066 | Adam Tegen | 4,066 | null | 1 | 54 | c#|arrays|struct | 149,075 | <p>Firstly, do you <em>really</em> have to have a mutable struct? They're almost always a bad idea. Likewise public fields. There are some very occasional contexts in which they're reasonable (usually both parts together, as with <code>ValueTuple</code>) but they're pretty rare in my experience.</p>
<p>Other than that... |
605,519 | Does Git-Svn Store Svn Passwords? | <p>I'm using git-svn with a couple of work projects and I've noticed that for just about every action I take, I get prompted for my Svn password. For some actions, I get prompted multiple times (presumably b/c there are several actions going on behind the scenes). For example, when cloning a repository, I'm prompted 5 ... | 760,406 | 6 | 0 | null | 2009-03-03 08:15:46.653 UTC | 11 | 2019-04-16 12:06:19.59 UTC | null | null | null | Rob Wilkerson | 1,665 | null | 1 | 31 | svn|git-svn | 15,470 | <p>I ended up having to delete the auth directory all together and allow Subversion to rebuild it for me. Nothing else seemed to work. For anyone who doesn't know, the auth directory is in ~/.subversion (Mac/Linux).</p> |
704,616 | Something wrong with Emacs shell | <p>I use Ubuntu8.10 and emacs-snapshot. Running shell-mode on emacs and input "ls" shows escape codes:</p>
<p><a href="http://lh3.ggpht.com/_os_zrveP8Ns/SdMmohKNjmI/AAAAAAAADB4/VlKpr5H_7ZA/s512/screen.png">screenshot http://lh3.ggpht.com/_os_zrveP8Ns/SdMmohKNjmI/AAAAAAAADB4/VlKpr5H_7ZA/s512/screen.png</a></p>
<p>How ... | 704,811 | 6 | 1 | null | 2009-04-01 08:39:11.397 UTC | 10 | 2011-09-04 01:23:10.747 UTC | 2011-09-04 01:23:10.747 UTC | Roger Pate | 133 | linjunhalida | 73,048 | null | 1 | 31 | emacs | 9,896 | <p>You can use <a href="http://www.emacswiki.org/emacs/AnsiTerm" rel="noreferrer">AnsiTerm</a> which does support colors or you can enable <a href="http://www.emacswiki.org/emacs/AnsiColor" rel="noreferrer">AnsiColor</a> for the normal shell:</p>
<pre><code>(autoload 'ansi-color-for-comint-mode-on "ansi-color" nil t)
... |
32,594,710 | Generate all combinations of mathematical expressions that add to target (Java homework/interview) | <p>I've tried to solve the problem below for a coding challenge but could not finish it in 1 hour. I have an idea on how the algorithm works but I'm not quite sure how to best implement it. I have my code and problem below.</p>
<blockquote>
<p>The first 12 digits of pi are 314159265358.
We can make these digits i... | 32,597,870 | 3 | 6 | null | 2015-09-15 20:06:56.72 UTC | 12 | 2016-03-28 18:42:56.953 UTC | 2016-02-23 17:31:08.527 UTC | null | 1,269,037 | null | 2,476,537 | null | 1 | 16 | java|algorithm|math|expression | 7,546 | <p>I don't think it's necessary to build a tree, you should be able to calculate as you go -- you just need to delay additions and subtractions slightly in order to be able take the precedence into account correctly:</p>
<pre><code>static void check(double sum, double previous, String digits, double target, String exp... |
43,925,337 | Matplotlib returning a plot object | <p>I have a function that wraps <code>pyplot.plt</code> so I can quickly create graphs with oft-used defaults:</p>
<pre><code>def plot_signal(time, signal, title='', xlab='', ylab='',
line_width=1, alpha=1, color='k',
subplots=False, show_grid=True, fig_size=(10, 5)):
# Skipping a ... | 43,926,055 | 3 | 2 | null | 2017-05-11 20:52:56.47 UTC | 17 | 2022-04-04 05:23:44.74 UTC | 2017-05-23 11:47:12.323 UTC | null | -1 | null | 2,605,604 | null | 1 | 48 | python|matplotlib|plot | 89,197 | <p>I think the error is pretty self-explanatory. There is no such thing as <code>pyplot.plt</code>, or similar. <code>plt</code> is the quasi-standard abbreviated form of <code>pyplot</code> when being imported, i.e., <code>import matplotlib.pyplot as plt</code>.</p>
<p>Concerning the problem, the first approach, <code... |
17,760,299 | Android FragmentTransaction Custom Animation (Unknown Animator Name: Translate) | <p>I'm trying to get a custom animation to work with my fragment.</p>
<p>I've followed the online tutorials but I've been getting the below error:</p>
<p><strong>java.lang.RuntimeException: Unknown animator name: translate</strong></p>
<p>The XML for the animation is below:</p>
<pre><code><?xml version="1.0" enc... | 19,769,903 | 3 | 1 | null | 2013-07-20 08:25:02.277 UTC | 19 | 2019-02-17 21:37:03.92 UTC | 2019-02-17 21:37:03.92 UTC | null | 4,505,446 | null | 2,021,478 | null | 1 | 71 | android|android-fragments|android-animation | 55,380 | <p>It will not work, you should use object animator </p>
<p>animator/slide_in_left.xml</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<objectAnimator
xmlns:android="http://schemas.android.com/apk/res/android"
... |
54,600,273 | .NET Core 3.0: Razor views don't automatically recompile on change | <p>According to <a href="https://docs.microsoft.com/en-us/aspnet/core/mvc/views/view-compilation?view=aspnetcore-3.0" rel="nofollow noreferrer">the documentation</a>, Razor views should, by default, recompile on change on local environments for ASP.NET Core 3.0.</p>
<p>However, my project doesn't do this locally. If I ... | 54,876,499 | 9 | 5 | null | 2019-02-08 21:11:42.94 UTC | 23 | 2022-06-06 11:16:38.287 UTC | 2022-06-06 11:16:38.287 UTC | null | 6,296,561 | null | 3,164,096 | null | 1 | 123 | c#|asp.net-core|razor-pages|asp.net-core-3.0 | 48,134 | <p>OK it looks like it's not supported yet :(</p>
<blockquote>
<p>Runtime compilation removed As a consequence of cleaning up the
ASP.NET Core shared framework to not depend on Roslyn, support for
runtime compilation of pages and views has also been removed in this
preview release. Instead compilation of pages... |
33,092,891 | makefile "no such file or directory" | <p>I am trying to compile a C++ program using make. After reading quite a few tutorials, I have come upon the following make file.</p>
<p>It reads source files from src directory, puts objects in the build directory, and puts the exe in the bin directory.</p>
<p>When I try running the following makefile, I get the su... | 33,092,967 | 1 | 3 | null | 2015-10-13 01:55:15.403 UTC | 1 | 2015-10-14 01:22:18.903 UTC | 2015-10-14 01:22:18.903 UTC | null | 3,321,579 | null | 3,321,579 | null | 1 | 2 | makefile|gnu-make | 61,764 | <p>Unless all of your directories (i.e., BIN_DIR, SRC_DIR) are in the root directory (/) then that is why you're getting the error. You either want to remove the initial slash or you can use an environment variable prefix like <code>SRC_DIR = $(MY_PROJECT_BASE_DIRECTORY)/src</code>.</p> |
46,771,315 | Angular: Cannot Get / | <p>I am trying to open, build and run someone else's Angular 4 project but I am not able to view the project when I run it my way. I don't see what is going wrong or what I should do now. I already had everything in place to use NPM and NodeJS</p>
<p>The steps I took were:</p>
<ul>
<li>Open up the project</li>
<li>np... | 46,810,936 | 26 | 10 | null | 2017-10-16 13:16:31.443 UTC | 9 | 2022-04-28 08:54:03.557 UTC | 2018-12-07 08:01:58.18 UTC | null | 3,181,492 | null | 3,181,492 | null | 1 | 85 | javascript|node.js|angular|typescript | 172,581 | <p>The problem was that I ran the commands within the folder <code>/project/src/app</code>. Navigating back to the project folder so to <code>/project</code> and running <code>ng serve</code> from there solved my problem.</p> |
2,128,755 | use event.target to get the class value? | <p>i have a DOM element with class='tag'.</p>
<p>i want to check if the class value is tag and alert a message if it's true.</p>
<p>i wrote:</p>
<pre><code> $("#thread").each(function(event) {
if(event.target.class == 'tag') alert('yes');
});
</code></pre>
<p>but it didn't work. you can get the id wi... | 2,128,761 | 5 | 0 | null | 2010-01-24 20:49:06.837 UTC | 7 | 2013-02-16 16:50:02.83 UTC | 2012-06-18 19:27:56.213 UTC | null | 114,029 | null | 206,446 | null | 1 | 12 | jquery | 51,692 | <p>At first, the <code>event</code> argument work only for event handlers, and you are using the <code>$.each</code> method.</p>
<p>I don't really think that you want/need to use the <code>$.each</code> method, since you are using an <code>#id</code> selector, and id's should be unique.</p>
<p>To check if an element ... |
2,263,681 | c++ compile error: ISO C++ forbids comparison between pointer and integer | <p>I am trying an example from Bjarne Stroustrup's C++ book, third edition. While implementing a rather simple function, I get the following compile time error:</p>
<pre><code>error: ISO C++ forbids comparison between pointer and integer
</code></pre>
<p>What could be causing this? Here is the code. The error is in t... | 2,263,700 | 5 | 2 | null | 2010-02-15 02:05:53.047 UTC | 12 | 2021-10-26 05:19:54.697 UTC | 2010-03-09 00:51:12.733 UTC | null | 253,197 | null | 253,197 | null | 1 | 41 | c++|compiler-errors | 169,821 | <p>You have two ways to fix this. The preferred way is to use:</p>
<pre><code>string answer;
</code></pre>
<p>(instead of <code>char</code>). The other possible way to fix it is:</p>
<pre><code>if (answer == 'y') ...
</code></pre>
<p>(note single quotes instead of double, representing a <code>char</code> constant).... |
2,135,096 | What is the best architecture for tracking field changes on objects? | <p>We have a web application that is built on top of a SQL database. Several different types of objects can have comments added to them, and some of these objects need field-level tracking, similar to how field changes are tracked on most issue-tracking systems (such as status, assignment, priority). We'd like to show... | 2,135,193 | 7 | 0 | null | 2010-01-25 19:45:29.677 UTC | 10 | 2012-07-15 21:38:06.423 UTC | 2010-02-24 22:54:03.373 UTC | null | 16,398 | null | 143,295 | null | 1 | 26 | sql|architecture|scalability|change-tracking | 8,000 | <p>There are several options available to you for this. You could have audit tables which basically mirror the base tables but also include a change date/time, change type and user. These can be updated through a trigger. This solution is typically better for behind the scenes auditing (IMO) though, rather than to solv... |
1,842,370 | UIWebView didFinishLoading fires multiple times | <p>I have some code that needs to run after the a <code>UIWebView</code> finishes loading a document. For that I've set the <code>UIWebView</code>'s delegate to my controller, and implemented the <code>webViewDidFinishLoading</code> method.</p>
<p>This gets called multiple times, depending on the type of page to load... | 1,855,267 | 9 | 1 | null | 2009-12-03 19:38:55.583 UTC | 17 | 2016-06-07 22:30:02.457 UTC | 2013-03-28 17:32:15.847 UTC | null | 1,371,070 | null | 3,381 | null | 1 | 54 | iphone|ios|objective-c|xcode|uiwebview | 38,981 | <p>It could be enlightening (if you haven't gone this far yet) to NSLog a trace of load starts and finishes.</p>
<pre><code> - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
NSLog(@"Loading: %@", [request URL]);
... |
1,672,655 | How to open windows explorer on selected resource in Eclipse | <p>I was looking for a small plugin for Eclipse that would allow to open windows explorer on currently selected resource from Package Explorer tree.</p>
<p>I know that Aptana Studio provides this functionality via context menu on the resource, but it has tons of other stuff that I am not interested to. </p>
<p>Are th... | 1,673,081 | 11 | 1 | null | 2009-11-04 09:35:57.447 UTC | 36 | 2019-08-21 08:23:35.933 UTC | 2009-11-04 09:51:31.153 UTC | null | 42,512 | null | 42,512 | null | 1 | 93 | eclipse|eclipse-plugin | 43,004 | <p>I use this plugin, it seems ok</p>
<p>New Eclipse Update Link
<a href="https://fabioz.github.com/startexplorer/update/" rel="noreferrer">https://fabioz.github.com/startexplorer/update/</a></p>
<p>Old link for reference </p>
<ul>
<li><p><a href="http://sourceforge.net/projects/startexplorer/" rel="noreferrer">http... |
2,330,197 | How to disable mouse scroll wheel scaling with Google Maps API | <p>I am using Google Maps API (v3) to draw a few maps on a page. One thing I'd like to do is disable zooming when you scroll the mouse wheel over the map, but I'm unsure how.</p>
<p>I have disabled the scaleControl (i.e. removed the scaling UI element), but this doesn't prevent scroll wheel scaling.</p>
<p>Here is pa... | 2,330,272 | 14 | 2 | null | 2010-02-24 22:39:35.047 UTC | 109 | 2017-10-10 15:24:21.627 UTC | 2016-12-14 17:11:04.887 UTC | null | 63,550 | null | 151,409 | null | 1 | 570 | jquery|google-maps|google-maps-api-3|jquery-plugins | 552,487 | <p>In version 3 of the Maps API you can simply set the <code>scrollwheel</code> option to false within the <a href="http://code.google.com/apis/maps/documentation/v3/reference.html#MapOptions" rel="noreferrer">MapOptions</a> properties:</p>
<pre><code>options = $.extend({
scrollwheel: false,
navigationControl:... |
2,155,453 | jQuery Toggle Text? | <p>How to toggle HTML text of an anchor tag using jQuery? I want an anchor that when clicked the text alternates between <code>Show Background</code> & <code>Show Text</code> as well as fading in & out another div. This was my best guess:</p>
<pre><code>$(function() {
$("#show-background").click(f... | 2,155,582 | 20 | 2 | null | 2010-01-28 15:07:15.04 UTC | 33 | 2020-07-13 07:14:32.233 UTC | 2020-07-13 07:14:32.233 UTC | null | 12,825,713 | null | 246,285 | null | 1 | 82 | jquery|toggle | 180,360 | <p>Sorry the problem is me! the was out of sync but this was because I have the HTML text the wrong way around. On the first click I want the div to fade out and the text to say "Show Text".</p>
<p>Will check more thoroughly next time before I ask!</p>
<p>My code is now:</p>
<pre><code>$(function() {
$("#show-back... |
8,538,343 | How to get element by class name | <p>I want to know if there is a way to <code>getElementByClassName("classname").innerHTML</code> function or something to the equivalent of <code>getElementById("ClassName").innerHTML</code>.</p> | 8,538,395 | 4 | 2 | null | 2011-12-16 18:13:03.633 UTC | 2 | 2014-12-19 11:43:26.413 UTC | 2014-04-14 00:01:23.267 UTC | null | 1,484,957 | null | 1,098,699 | null | 1 | 12 | javascript|html|css|dom | 71,997 | <p>You are missing an <code>s</code> in your function name. <code>getElementsByTagName</code> returns a collection of elements, of elements, which you need to iterate over:</p>
<pre><code>var elements = document.getElementsByClassName("classname");
for (var i = 0; i < elements.length; i++) {
elements[i].innerH... |
8,367,646 | redefinition of typedef | <p><i>I am possibly doing this incorrectly and this is much a question about why it works in one compiler and not the other.</i></p>
<p>I have a large C application, and I am trying to follow the style of not including header files from within other header files. Instead, using forward declarations; thus I am trying t... | 8,367,810 | 7 | 2 | null | 2011-12-03 12:29:53.917 UTC | 9 | 2022-03-27 15:32:56.89 UTC | 2011-12-03 12:51:36.897 UTC | null | 758,811 | null | 758,811 | null | 1 | 26 | c|gcc|typedef | 46,839 | <p>I was surprised by this because I'm fairly sure that redeclaring the same typedef in the same scope is legal in C++, but apparently it is not legal in C prior to the 2011 standard.</p>
<p>First, typedef names have no linkage:</p>
<p>ISO/IEC 9899:1999 + TC3 6.2.2/6 (Linkages of identifiers):</p>
<blockquote>
<p>The f... |
8,430,022 | what is the Java equivalent of sscanf for parsing values from a string using a known pattern? | <p>So I come from a C background (originally originally, though I haven't used that language for almost 5 years) and I'm trying to parse some values from a string in Java. In C I would use sscanf. In Java people have told me "use Scanner, or StringTokenizer", but I can't see how to use them to achieve my purpose.</p>
... | 8,430,204 | 8 | 2 | null | 2011-12-08 11:10:01.007 UTC | 8 | 2019-12-25 06:29:47.14 UTC | 2011-12-08 11:49:14.983 UTC | null | 201,601 | null | 191,761 | null | 1 | 39 | java|scanf | 80,202 | <p>The problem is Java hasn't out parameters (or passing by reference) as C or C#.</p>
<p>But there is a better way (and more solid). Use regular expressions:</p>
<pre><code>Pattern p = Pattern.compile("(\\d+)-(\\p{Alpha}+)-(\\d+) (\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)")
Matcher m = p.matcher("17-MAR-11 15.52.25.000000000... |
46,547,540 | Meaning of a double star (**) in a file path | <p>I was reading <a href="https://stackoverflow.com/a/32604767/2275800">here on Stack Overflow</a> about ** in a path, as in this example:</p>
<pre><code>src/js/**/*.js
</code></pre>
<p>I would like to ask if " ** " means "any nested directory" please?!</p> | 46,547,653 | 2 | 3 | null | 2017-10-03 14:54:21.167 UTC | 14 | 2021-10-17 12:50:33.903 UTC | 2020-07-25 00:31:32.177 UTC | null | 2,275,800 | null | 2,275,800 | null | 1 | 48 | javascript|path | 29,248 | <p>The double star in this case means <em>all folders within the current folder</em>, with the current folder being <code>src/js</code></p>
<p>So in full, <em>find all files with a .js extension, in all subfolders of src/js</em></p> |
17,895,013 | Renaming column header in DataGridView Control using vb.net | <p>I tried out the following code but the columns still inherit the table's field names</p>
<pre><code> DataGridView1.DataSource = ds.Tables("student_attendance_table")
With DataGridView1
.RowHeadersVisible = False
.Columns(0).Name = "Register No."
.Columns(1).Name = "Date"
.Colum... | 17,895,063 | 4 | 0 | null | 2013-07-27 06:36:08.323 UTC | 1 | 2017-08-28 10:11:39.667 UTC | null | null | null | null | 2,602,377 | null | 1 | 3 | vb.net|datagridview | 54,172 | <p>To change the column header use the <code>.HeaderCell.Value = "Display Value"</code></p>
<pre><code>DataGridView1.DataSource = ds.Tables("student_attendance_table")
With DataGridView1
.RowHeadersVisible = False
.Columns(0).HeaderCell.Value = "Register No."
.Columns(1).HeaderCell.Value = ... |
6,666,382 | Can I use __syncthreads() after having dropped threads? | <p>Is it safe to use <code>__syncthreads()</code> in a block where I have purposefully dropped threads using <code>return</code>?</p>
<p>The documentation states that <code>__syncthreads()</code> <em>must be called by every thread in the block</em> or else it will lead to a deadlock, but in practice I have never exper... | 6,667,067 | 3 | 0 | null | 2011-07-12 15:04:12.497 UTC | 19 | 2022-06-07 20:27:14.02 UTC | 2015-05-27 11:45:10.333 UTC | null | 703,016 | null | 703,016 | null | 1 | 42 | synchronization|cuda | 8,380 | <p>The answer to the short question is "No". Warp level branch divergence around a <code>__syncthreads()</code> instruction will cause a deadlock and result in a kernel hang. Your code example is not guaranteed to be safe or correct. The correct way to implement the code would be like this:</p>
<pre><code>__global__ v... |
6,333,814 | How does the paste image from clipboard functionality work in Gmail and Google Chrome 12+? | <p>I noticed a <a href="http://gmailblog.blogspot.com/2011/06/pasting-images-into-messages-just-got.html" rel="noreferrer">blog post from Google</a> that mentions the ability to paste images directly from the clipboard into a Gmail message if you're using the latest version of Chrome. I tried this with my version of C... | 6,338,207 | 3 | 1 | null | 2011-06-13 17:18:37.443 UTC | 143 | 2021-04-05 18:32:50.35 UTC | 2011-06-13 18:18:02.677 UTC | null | 19,750 | null | 113,225 | null | 1 | 167 | javascript|html|google-chrome|webkit | 99,316 | <p>I spent some time experimenting with this. It seems to sort of follow the new <a href="http://dev.w3.org/2006/webapi/clipops/" rel="noreferrer">Clipboard API spec</a>. You can define a "paste" event handler and look at event.clipboardData.items, and call getAsFile() on them to get a Blob. Once you have ... |
6,969,604 | Recursion down DOM tree | <p>This is code from Crockford's JavaScript: The Good Parts.</p>
<pre><code>var results = [];
var walkDOM = function (node,func) {
func(node); //What does this do?
node = node.firstChild;
while(node) {
walkDOM(node,func);
node = node.nextSibling;
... | 6,969,630 | 4 | 6 | null | 2011-08-06 23:11:16.56 UTC | 12 | 2020-03-04 13:14:52.317 UTC | 2015-02-20 02:03:49.4 UTC | null | 359,284 | null | 858,962 | null | 1 | 3 | javascript|dom|recursion | 16,928 | <p>Looks to me like the <code>func</code> is used for doing something to every node in the tree.</p>
<p>For example, if I wanted to alert the tag name for every node in the entire tree:</p>
<pre><code>walkDOM(document.body, function(node) {
alert(node.tagName);
});
</code></pre>
<p>In your example function: </p>... |
6,471,019 | Can/Should I inherit from an STL iterator? | <p>Can/Should i inherit from STL iterator to implement my own iterator class? If no, why not?</p> | 22,211,034 | 4 | 3 | null | 2011-06-24 16:45:06.807 UTC | 12 | 2020-11-10 14:50:35.887 UTC | 2020-11-10 14:50:35.887 UTC | null | 895,245 | null | 593,177 | null | 1 | 33 | c++|stl|iterator | 13,649 | <h3>Short answer</h3>
<p>Many consider that the class <code>std::iterator</code> does not offer much compared to regular type aliases, and even obfuscates them a bit by not explicitly providing the names and relying on the order of the template parameters instead. It is deprecated in C++17 and is likely to be gone in ... |
35,109,307 | mkdir() works while inside internal flash storage, but not SD card? | <p>I am currently building a file management app that allows the user to browse the file system of their device. The user starts off in the root directory <code>/</code> of their device, but can browse to any location they want such as the internal flash storage or SD card.</p>
<p>One of the critical requirements of t... | 35,175,460 | 4 | 7 | null | 2016-01-31 01:28:07.223 UTC | 10 | 2017-01-31 05:51:21.84 UTC | 2016-07-21 19:27:53.87 UTC | null | 5,622,632 | null | 4,590,317 | null | 1 | 32 | android|file-permissions | 3,756 | <p>First, you should note that <code>file.mkdir()</code> and <code>file.mkdirs()</code> returns <code>false</code> if the directory already existed. If you want to know whether the directory exists on return, either use <code>(file.mkdir() || file.isDirectory())</code> or simply ignore the return value and call <code>f... |
5,547,393 | BULK INSERT with variable file name | <p>i am trying to bulk insert into Db using sql server 2005</p>
<p>Below is the code. </p>
<pre><code>declare @path varchar(500)
set @path = 'E:\Support\test.csv';
Create table #mytable( name varchar(max), class varchar(max), roll varchar(max) )
BULK INSERT #mytable FROM @path <-- Error line
WITH ( FIELDTERMIN... | 5,547,437 | 2 | 1 | null | 2011-04-05 05:00:24.513 UTC | 5 | 2013-12-05 11:36:18.187 UTC | 2012-11-30 20:25:05.423 UTC | null | 105,264 | null | 405,818 | null | 1 | 34 | sql|sql-server | 51,551 | <p>Try to use Dynamic SQL:</p>
<pre><code>declare @sql varchar(max)
set @sql = 'BULK INSERT #mytable FROM ''' + @path + ''' WITH ...
exec (@sql)
</code></pre> |
16,299,727 | C: scanf to array | <p>I'm absolutely new to C, and right now I am trying master the basics and have a problem reading data from scanf straight into an array.</p>
<p>Right now the code looks like this:</p>
<pre><code>int main()
{
int array[11];
printf("Write down your ID number!\n");
scanf("%d", array);
if (array[0]=1)
... | 16,299,747 | 4 | 4 | null | 2013-04-30 12:18:03.123 UTC | 6 | 2019-02-22 15:36:44.48 UTC | 2013-04-30 12:19:22.97 UTC | null | 192,702 | null | 2,335,726 | null | 1 | 3 | c | 201,945 | <p><code>if (array[0]=1)</code> should be <code>if (array[0]==1)</code>.</p>
<p>The same with <code>else if (array[0]=2)</code>.</p>
<p>Note that the expression of the assignment returns the <strong>assigned value</strong>, in this case <code>if (array[0]=1)</code> will be <strong>always true</strong>, that's why the... |
719,788 | Property vs. instance variable | <p>I'm trying to understand how strategies some folks use to distinguish instance vars vs. properties. A common pattern is the following:</p>
<pre><code>@interface MyClass : NSObject {
NSString *_myVar;
}
@property (nonatomic, retain) NSString *myVar;
@end
@implementation MyClass
@synthesize myVar = _myVar;
</co... | 719,816 | 7 | 0 | null | 2009-04-05 22:06:03.553 UTC | 26 | 2013-08-20 15:46:39.04 UTC | null | null | null | anon | null | null | 1 | 32 | iphone|objective-c|cocoa|cocoa-touch | 14,330 | <p>Properties are just setters and getters for <code>ivars</code> and should (almost) always be used instead of direct access.</p>
<pre><code>@interface APerson : NSObject {
// NSString *_name; // necessary for legacy runtime
}
@property(readwrite) NSString *name;
@end
@implementation APerson
@synthe... |
1,339,394 | Passing NSInteger variable to NSMutableDictionary or NSMutableArray | <p>Why does this not work:</p>
<pre><code>NSInteger temp = 20;
[userSettingsFromFile setObject:temp forKey:@"aTemp"];
</code></pre>
<p>but this does:</p>
<pre><code>[userSettingsFromFile setObject:@"someObject" forKey:@"aTemp"];
</code></pre>
<p>How can I use the <code>NSInteger</code> variable?</p> | 1,339,407 | 7 | 2 | null | 2009-08-27 07:24:04.267 UTC | 7 | 2017-01-11 00:28:21.097 UTC | 2013-06-01 11:50:14.347 UTC | null | 1,571,232 | null | 40,106 | null | 1 | 41 | objective-c|iphone | 36,763 | <p><code>NSInteger</code> isn't an object -- it's simply typecast to <code>int</code> on 32-bit or <code>long</code> on 64-bit. Since <code>NSDictionary</code> can only store objects, you need to wrap the integer into an object before you can store it. Try this:</p>
<pre><code>NSInteger temp = 20;
[userSettingsFromFil... |
1,086,054 | How to convert int[] to byte[] | <p>I have an array of integers which represent a RGB image and would like to convert it to a byte array and save it to a file.</p>
<p>What's the best way to convert an array of integers to the array of bytes in Java?</p> | 1,086,092 | 7 | 1 | null | 2009-07-06 08:47:45.587 UTC | 15 | 2021-03-25 09:01:29.993 UTC | 2014-12-12 13:54:21.783 UTC | null | 1,536,976 | null | 22,996 | null | 1 | 65 | java|arrays|type-conversion | 88,973 | <p>As <a href="https://stackoverflow.com/a/1086067/1536976">Brian</a> says, you need to work out how what sort of conversion you need.</p>
<p>Do you want to save it as a "normal" image file (jpg, png etc)?</p>
<p>If so, you should probably use the <a href="http://docs.oracle.com/javase/7/docs/technotes/guides/imageio... |
229,851 | Overcoming "It is being used by another person or program." | <p>Is there a way to unlock Windows files without downloading a utility?</p>
<p>I have a few files on my Windows XP C: drive that are very old and very useless. When I try to delete these files I get the following message:</p>
<pre>
Cannot delete FILENAME.zip: It is being used by another person or program
Close any... | 229,894 | 8 | 5 | null | 2008-10-23 14:08:54.003 UTC | 1 | 2021-05-25 00:45:49.247 UTC | 2008-10-23 18:45:43.993 UTC | Adrian Dunston | 8,344 | Adrian Dunston | 8,344 | null | 1 | 25 | windows|permissions|locking | 52,672 | <p>I've successfully used Process Explorer to find out which process has the file open. It saves a reboot that may not fix the problem anyway.</p>
<p>In process explorer: Find > Handle or DLL... then search for the name of the folder/file, then double click one of the search results. It'll select a handle in the mai... |
702,301 | How to determine the IP address of a Solaris system | <p>What command do I want to issue when I want to know the IP address of the Solaris machine I'm logged onto?</p> | 702,533 | 8 | 1 | null | 2009-03-31 18:02:13.03 UTC | 7 | 2018-12-27 20:49:19.71 UTC | 2018-04-26 01:11:24.607 UTC | null | 85,248 | monocongo | 85,248 | null | 1 | 35 | unix|networking|ip-address|solaris|ip | 197,754 | <p>If you're a normal user (i.e., not 'root') <strong><code>ifconfig</code></strong> isn't in your path, but it's the command you want.</p>
<p>More specifically: <strong><code>/usr/sbin/ifconfig -a</code></strong></p> |
1,113,819 | Arrays, heap and stack and value types | <pre><code>int[] myIntegers;
myIntegers = new int[100];
</code></pre>
<p>In the above code, is new int[100] generating the array on the heap? From what I've read on CLR via c#, the answer is yes. But what I can't understand, is what happens to the actual int's inside the array. As they are value types, I'd guess they'... | 1,114,152 | 8 | 0 | null | 2009-07-11 14:30:11.58 UTC | 121 | 2021-06-30 14:15:12.95 UTC | 2021-06-30 14:15:12.95 UTC | null | 5,459,839 | null | 130,758 | null | 1 | 151 | c#|arrays|memory|heap-memory|stack-memory | 61,756 | <p>Your array is allocated on the heap, and the ints are not boxed.</p>
<p>The source of your confusion is likely because people have said that reference types are allocated on the heap, and value types are allocated on the stack. This is not an entirely accurate representation.</p>
<p>All local variables and parame... |
771,453 | Copy map values to vector in STL | <p>Working my way through Effective STL at the moment. Item 5 suggests that it's usually preferable to use range member functions to their single element counterparts. I currently wish to copy all the values in a map (i.e. - I don't need the keys) to a vector.</p>
<p>What is the cleanest way to do this?</p> | 771,463 | 13 | 1 | null | 2009-04-21 07:30:42.763 UTC | 32 | 2022-01-12 16:41:38.227 UTC | null | null | null | null | 11,515 | null | 1 | 97 | c++|stl|containers | 146,203 | <p>You can't easily use a range here because the iterator you get from a map refers to a std::pair, where the iterators you would use to insert into a vector refers to an object of the type stored in the vector, which is (if you are discarding the key) not a pair.</p>
<p>I really don't think it gets much cleaner than t... |
775,726 | What's the fuss about Haskell? | <p>I know a few programmers who keep talking about Haskell when they are among themselves, and here on SO everyone seems to love that language. Being good at Haskell seems somewhat like the hallmark of a genius programmer.</p>
<p>Can someone give a few Haskell examples that show why it is so elegant / superior?</p> | 775,759 | 17 | 0 | 2009-04-22 11:12:01.503 UTC | 2009-04-22 04:45:47.05 UTC | 63 | 2020-01-04 19:01:45.26 UTC | 2012-05-01 10:05:19.037 UTC | null | 1,140,748 | null | 60,628 | null | 1 | 111 | haskell|functional-programming | 39,153 | <p>The way it was pitched to me, and what I think is true after having worked on learning on Haskell for a month now, is the fact that functional programming twists your brain in interesting ways: it forces you to think about familiar problems in different ways: instead of loops, think in maps and folds and filters, et... |
985,384 | Delete duplicate records from a SQL table without a primary key | <p>I have the below table with the below records in it</p>
<pre><code>create table employee
(
EmpId number,
EmpName varchar2(10),
EmpSSN varchar2(11)
);
insert into employee values(1, 'Jack', '555-55-5555');
insert into employee values (2, 'Joe', '555-56-5555');
insert into employee values (3, 'Fred', '555-57-5555... | 985,426 | 20 | 4 | null | 2009-06-12 07:12:06.95 UTC | 24 | 2022-03-08 09:26:13.953 UTC | 2010-07-16 07:47:57.16 UTC | null | 41,956 | null | 40,521 | null | 1 | 58 | sql|sql-server-2005|tsql|duplicate-removal | 123,193 | <p>Add a Primary Key (code below)</p>
<p>Run the correct delete (code below)</p>
<p>Consider WHY you woudln't want to keep that primary key.</p>
<hr />
<p>Assuming MSSQL or compatible:</p>
<pre><code>ALTER TABLE Employee ADD EmployeeID int identity(1,1) PRIMARY KEY;
WHILE EXISTS (SELECT COUNT(*) FROM Employee GRO... |
6,405,083 | Is it possible to boot the Linux kernel without creating an initrd image? | <p>As I understand, initrd is a small image that is loadable in the RAM. It is used to boot a complete kernel with all the loadable modules. As part of the process, we need the vmlinuz kernel image which is a renamed version of bzImage. </p>
<p>Is it possible to boot the kernel without creating the initrd image? </p> | 6,405,171 | 5 | 3 | null | 2011-06-19 20:57:58.037 UTC | 9 | 2020-08-02 20:14:19.507 UTC | 2018-02-16 10:17:51.577 UTC | null | 895,245 | null | 350,129 | null | 1 | 20 | linux|boot|initrd | 25,731 | <p>initrd/initramfs is optional and not a requirement. bzImage is the pure kernel image and can be booted directly by the bootloader. However it might be neccesary to execute some tasks (loading filesystem modules, drivers for disk access, mounting the root file system from some exchangeable media without fixed name/pa... |
6,433,900 | Syncing HTML5 <video> with <audio> playback | <p>I am having track from one source, mute, and I'd like to play background music over it using element. The tracks contain some time critical elements.</p>
<p>What would be the options to sync these two different media players in HTML5 / Javascript? would give the master clock as it audio playback is very time sen... | 11,285,638 | 6 | 1 | null | 2011-06-22 01:26:31.01 UTC | 16 | 2021-09-18 15:22:48.123 UTC | null | null | null | null | 315,168 | null | 1 | 22 | javascript|html|video|audio | 19,094 | <p>Mikko Ohtamaa provided a solution in a comment, which I actually think is the best option here - it doesn't require a framework, and it doesn't require you to edit your video files.</p>
<p>Essentially, just grab the current time from the video element when it is "unmuted", and apply that time to the audio element. ... |
6,587,879 | How to elegantly check the existence of an object/instance/variable and simultaneously assign it to variable if it exists in python? | <p>I am using SQLAlchemy to populate a database and often I need to check if a orm object exists in a database before processing. This may be an unconventional question, but I found myself encountering this pattern often:</p>
<pre><code>my_object = session.query(SomeObject).filter(some_fiter).first()
if my_object: # M... | 16,003,360 | 9 | 2 | null | 2011-07-05 19:33:12.587 UTC | 23 | 2020-02-25 18:09:45.853 UTC | 2016-06-01 17:56:28.647 UTC | null | 2,665,591 | null | 641,514 | null | 1 | 78 | python|sqlalchemy | 70,173 | <p>You want to execute a Exist query to be efficient</p>
<pre><code>(ret, ), = Session.query(exists().where(SomeObject.field==value))
</code></pre>
<p>Mike Bayer explain it in his blog post:<br>
<a href="http://techspot.zzzeek.org/2008/09/09/selecting-booleans/" rel="noreferrer">http://techspot.zzzeek.org/2008/09/09/... |
6,880,232 | Disable / Check for Mock Location (prevent gps spoofing) | <p>Looking to find the best way to prevent / detect GPS spoofing on Android. Any suggestions on how this is accomplished, and what can be done to stop it? I am guessing the user has to turn on mock locations to spoof GPS, if this is done, then they can spoof GPS? </p>
<p>I guess I would need to just detect if Mock Loc... | 16,776,891 | 10 | 2 | null | 2011-07-30 00:14:59.34 UTC | 70 | 2021-10-09 13:02:17.933 UTC | null | null | null | null | 393,258 | null | 1 | 99 | android|gps|spoof | 177,070 | <p>I have done some investigation and sharing my results here,this may be useful for others.</p>
<p>First, we can check whether MockSetting option is turned ON</p>
<pre><code>public static boolean isMockSettingsON(Context context) {
// returns true if mock location enabled, false if not enabled.
if (Settings.Se... |
6,316,540 | How to make layout with View fill the remaining space? | <p>I'm designing my application UI. I need a layout looks like this:</p>
<p><img src="https://i.stack.imgur.com/t5Ulu.png" alt="Example of desired layout"></p>
<p>(< and > are Buttons). The problem is, I don't know how to make sure the TextView will fill the remaining space, with two buttons have fixed size.</p>
... | 25,781,167 | 12 | 2 | null | 2011-06-11 14:45:56.43 UTC | 40 | 2021-10-22 05:30:34.423 UTC | 2015-12-30 00:00:40.937 UTC | null | 3,063,884 | null | 653,457 | null | 1 | 211 | android|layout|android-layout | 186,703 | <p>Answer from woodshy worked for me, and it is simpler than the answer by Ungureanu Liviu since it does not use <code>RelativeLayout</code>.
I am giving my layout for clarity:</p>
<pre><code><LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation... |
38,069,719 | Setting custom header using HttpURLConnection | <p>I am simply making a <code>GET</code> request to a Rest API using <code>HttpURLConnection</code>.</p>
<p>I need to add some custom headers but I am getting <code>null</code> while trying to retrieve their values.</p>
<p><strong>Code:</strong></p>
<pre><code>URL url;
try {
url = new URL("http://www.example.com... | 38,070,019 | 2 | 1 | null | 2016-06-28 07:27:44.543 UTC | 5 | 2018-04-10 08:05:09.723 UTC | 2018-04-10 08:05:09.723 UTC | null | 1,009,479 | null | 4,362,001 | null | 1 | 12 | java|rest|http-headers|httpurlconnection|urlconnection | 46,989 | <p>The <code>conn.getHeaderField("CustomHeader")</code> returns the <em>response</em> header not the request one.</p>
<p>To return the request header use: <code>conn.getRequestProperty("CustomHeader")</code></p> |
50,637,666 | Where do I find a list of all mat-icons -- Angular | <p>I started using <code><mat-icon></code> of angular-material and I wonder if there is any collection of the names of all the included icons. Past a few months, I used this already and I think, back then, I found a homepage where a bunch of them were listed. But this site is not findable anymore. </p>
<p>Is the... | 50,640,595 | 3 | 6 | null | 2018-06-01 06:51:46.983 UTC | 10 | 2022-09-24 14:58:26.437 UTC | 2021-02-03 14:09:43.39 UTC | null | 8,458,652 | null | 9,739,585 | null | 1 | 121 | icons|material-design|angular-material | 256,367 | <p><strong>Edit:</strong></p>
<p>As the icons listed on the website are slightly outdated, here's the correct resources:</p>
<ul>
<li><a href="https://jossef.github.io/material-design-icons-iconfont/" rel="nofollow noreferrer">Material Design Icons DX - (forked version)</a></li>
</ul>
<hr />
<p>The old Material.io link... |
50,688,998 | Using ApolloClient with node.js. "fetch is not found globally and no fetcher passed" | <p>I am attempting to use an Apollo Client on a node.js server to interface with another GraphQL API using the following code:</p>
<pre><code>import fetch from 'node-fetch'
import { createHttpLink } from 'apollo-link-http'
import ApolloClient from 'apollo-boost'
import { API_URL } from '...'
const client = new Apoll... | 50,689,652 | 6 | 1 | null | 2018-06-04 21:25:51.203 UTC | 4 | 2020-06-21 16:47:24.317 UTC | 2018-06-04 21:40:05.96 UTC | null | 1,291,473 | null | 1,291,473 | null | 1 | 38 | node.js|polyfills|apollo-client | 31,432 | <p>It turns out that the <code>ApolloClient</code> provided by the <code>apollo-boost</code> library does not accept a <code>link</code> option. Switching to use the vanilla <code>apollo-client</code> allows you to specify your fetching mechanism.</p>
<p>Although <code>apollo-boost</code> and <code>apollo-client</code... |
10,792,163 | change <audio> src with javascript | <p>I have multiple audio files that I want to stream based on the user selects. How do I do that? This is what I have so far and it doesn't seem to work. </p>
<p>*UPDATE: Made a few changes and now its claiming that <code>audio.load();</code> is not a function. Can anyone tell me why that is? The Code is updated to re... | 10,792,564 | 7 | 4 | null | 2012-05-29 01:33:41.843 UTC | 13 | 2021-08-16 05:48:26.85 UTC | 2012-05-29 03:12:27.413 UTC | null | 283,863 | null | 1,284,810 | null | 1 | 63 | javascript|html|html5-audio | 136,765 | <p>Try this snippet</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>list.onclick = function(e) {
e.preventDefault();
var elm = e.target;
var audio = document.getElement... |
33,938,206 | Check if method exists in the same class | <p>So, <code>method_exists()</code> requires an object to see if a method exists. But I want to know if a method exists from within the same class.</p>
<p>I have a method that process some info and can receive an action, that runs a method to further process that info. I want to check if the method exists before calli... | 33,938,381 | 4 | 10 | null | 2015-11-26 12:01:46.94 UTC | 2 | 2017-04-21 02:23:24.3 UTC | null | null | null | null | 4,611,298 | null | 1 | 32 | php|class|methods|exists | 40,797 | <p>You can do something like this:</p>
<pre><code>class A{
public function foo(){
echo "foo";
}
public function bar(){
if(method_exists($this, 'foo')){
echo "method exists";
}else{
echo "method does not exist";
}
}
}
$obj = new A;
$obj->bar()... |
41,105,586 | Android - Firebase - TaskSnapshot - Method should only be accessed within private scope? | <p>Everything was working great... until I came back to work from a 3 month break and updated my Firebase from 9.8 to 10.0.1</p>
<p>Now all of my calls to <code>TaskSnapshot</code> are giving me an error.</p>
<p>Here is the example code that worked fine before:</p>
<pre><code>OnSuccessListener<UploadTask.TaskSnap... | 42,616,488 | 4 | 8 | null | 2016-12-12 16:47:14.083 UTC | 14 | 2022-03-03 11:59:45.147 UTC | 2016-12-12 18:20:44.617 UTC | null | 209,103 | null | 2,254,886 | null | 1 | 47 | android|firebase|firebase-storage | 14,838 | <p>The problem seems to be caused by an overzealous Lint check. Try something like this:</p>
<pre><code>@SuppressWarnings("VisibleForTests") Uri downloadUrl = taskSnapshot.getDownloadUrl();
</code></pre>
<p>This trick worked for me. If the problem's related to <a href="https://code.google.com/p/android/issues/detail?... |
22,874,155 | Video tag to fill 100% div regardless of ratios | <p>I am tying to have a video tag to fill 100% of a div:</p>
<p>a) it doesn't need to keep the ratios(otherwise we need to use the overflow:none);</p>
<p>b) fill a div, not the whole background;</p>
<p>c) it would be a plus to be responsible. Now it is as long as you re-size window diagonally. Keeping height and re-... | 22,874,277 | 4 | 2 | null | 2014-04-04 22:36:55.647 UTC | 7 | 2021-09-20 14:31:43.867 UTC | 2018-08-11 18:18:32.393 UTC | null | 2,060,451 | null | 2,060,451 | null | 1 | 22 | html|css|responsive-design | 63,673 | <p>You can use a solution like <a href="http://jsfiddle.net/aloisdg/FCPW2/2/" rel="nofollow noreferrer">this one</a>. Ratio dont change, but you may lose the right part of the video.</p>
<pre><code>video#bgvid {
position: absolute;
z-index: 0;
background: url(mel.jpg) no-repeat;
background-size: 100% 10... |
13,531,576 | Oracle: export a table with blobs to an .sql file that can be imported again | <p>I have a table "Images" with two fields:</p>
<ul>
<li>Name VARCHAR2</li>
<li>Data BLOB</li>
</ul>
<p>I would like to export that table to a .sql file which I could import on another system. I tried to do so using the "Database unload" assistant of Oracle SQL Developer. However the generated file does just have the... | 13,532,301 | 5 | 1 | null | 2012-11-23 15:03:00.63 UTC | 4 | 2020-05-19 14:24:10.123 UTC | null | null | null | null | 685,428 | null | 1 | 14 | oracle|export|blob|oracle-sqldeveloper | 50,048 | <p>I don't think this is possible with SQL Developer (but then I don't use it very often).</p>
<p>The SQL client I am using - <a href="http://www.sql-workbench.eu" rel="nofollow noreferrer">SQL Workbench/J</a> - can do this. </p>
<p>There are several ways to export this data. </p>
<h3>Generate a proprietary script</... |
13,666,346 | from sys import argv - what is the function of "script" | <p>I am reading "Learn Python the Hard Way" and was confused by the "script" part of the second line.</p>
<pre><code>from sys import argv
script, filename = argv
</code></pre>
<p>From what I understand, the second line says: <code>script</code> and <code>filename</code> comprise <code>argv</code>.
I tried running my ... | 13,666,377 | 4 | 2 | null | 2012-12-02 04:15:33.85 UTC | 6 | 2017-08-27 20:34:32.577 UTC | 2012-12-02 04:26:16.907 UTC | null | 374,866 | null | 1,869,775 | null | 1 | 15 | python|argv | 44,407 | <p>Generally, the first argument to a command-line executable is the script name, and the rest are the expected arguments.</p>
<p>Here, <code>argv</code> is a list that is expected to contain two values: the script name and an argument. Using Python's unpacking notation, you can write</p>
<pre><code>script = argv[0]
... |
13,786,083 | Create two threads, one display odd & other even numbers | <p>I'm trying to create two threads, one thread display even integers from 0 to 10, one thread display odd integers from 1 to 11. Is the following code suitable for designing this program?</p>
<pre><code>public class Mythread {
public static void main(String[] args) {
Runnable r = new Runnable1();
... | 13,786,175 | 21 | 3 | null | 2012-12-09 09:07:45.767 UTC | 10 | 2021-07-03 16:26:47.56 UTC | 2012-12-09 09:10:02.537 UTC | null | 418,556 | null | 1,679,519 | null | 1 | 22 | java|multithreading | 127,730 | <p>I would just change a few details (no need to use the modulo operator here...):</p>
<pre><code>public class Mythread {
public static void main(String[] args) {
Runnable r = new Runnable1();
Thread t = new Thread(r);
Runnable r2 = new Runnable2();
Thread t2 = new Thread(r2);
... |
13,235,317 | Using a XML File (log4j2.xml) to configure Log4j 2 | <p>I want to use the new Log4J 2 - Java Logging Framework. Everything work fine, but I tried since a hour to load a custom configuration file to configure the logging (like log level).</p>
<p>This is my log4j2.xml:</p>
<pre><code><?xml version="1.0" encoding="UTF-8"?>
<configuration status="OFF">
<a... | 13,235,751 | 7 | 1 | null | 2012-11-05 15:34:53.233 UTC | 10 | 2019-04-05 20:50:54.71 UTC | 2013-06-06 17:56:02.487 UTC | null | 542,517 | null | 3,597,614 | null | 1 | 27 | java|eclipse|log4j | 57,345 | <p><strong>Important:</strong> make sure the name of the configuration file is <code>log4j2.xml</code> (note the <code>2</code> before the period) as opposed to <code>log4j.xml</code></p>
<p>My guess is nothing's happening because nothing is logged using the error level. You may want to try adding another logger like ... |
13,661,788 | How to set minimum DatePicker date to current date | <p>I want to set the minimum date the user can choose in a DatePicker to the current date. I've tried this:</p>
<pre><code>DatePicker datePicker = (DatePicker) findViewById(R.id.event_date);
datePicker.setMinDate(System.currentTimeMillis());
</code></pre>
<p>That gives me the following exception:</p>
<pre><code>12-0... | 13,661,947 | 11 | 0 | null | 2012-12-01 17:26:33.68 UTC | 14 | 2022-03-21 18:15:16.307 UTC | null | null | null | null | 803,801 | null | 1 | 60 | android|android-datepicker | 88,907 | <p>The error says you cannot set the minimum date to <em>exactly</em> now. Try subtracting a second:</p>
<pre><code>datePicker.setMinDate(System.currentTimeMillis() - 1000);
</code></pre>
<hr>
<p>From the source code the minimum date must be before, not equal to, the current date:</p>
<pre><code>if (date.before(mMi... |
20,821,465 | How do you create a UIImageView programmatically in Xcode | <p>I just want to make an UIImageView programmatically that displays a 20by20 dot at point (50,50).(The image of the dot is called draw.png). For some reason nothing shows up on the screen.</p>
<p>Heres my code:</p>
<pre><code>- (void)viewDidLoad
{
UIImageView *dot =[[UIImageView alloc] initWithFrame:CGRectMake(50,5... | 20,844,677 | 6 | 3 | null | 2013-12-29 02:11:44.613 UTC | 4 | 2018-04-02 12:13:38.13 UTC | 2013-12-30 17:43:37.003 UTC | null | 3,143,098 | null | 3,143,098 | null | 1 | 16 | xcode|uiimageview | 58,496 | <p>First, make sure draw.png exists in your project and that you are referencing it exactly (so if it's draw.PNG you should put <code>@"draw.PNG"</code>). Also, call <code>[super viewDidLoad]</code> before everything.</p>
<pre><code>- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loadi... |
24,152,925 | Using JQuery to set CSS Keyframe | <p>I'm trying to determine the height of a <code>div</code> which is dynamic depending on the size of the text. I was trying to set this dynamically within the CSS as my original question <a href="https://stackoverflow.com/questions/24150538/defining-a-height-in-css-for-animation-keyframe-within-itself?noredirect=1#com... | 24,152,989 | 2 | 2 | null | 2014-06-11 00:29:50.793 UTC | 5 | 2017-03-01 15:04:08.773 UTC | 2017-05-23 12:17:08.46 UTC | null | -1 | null | 1,742,006 | null | 1 | 13 | javascript|jquery|css | 43,979 | <p>The SyntaxError is being caused by your semicolon-delimited javascript objects here:</p>
<pre><code>'0%': {top:$("#test").innerHeight()*-1; left:0px},
'50%': {top:100%; left:0px},
'100%': {top:$("#test").innerHeight()*-1; left:0px}
</code></pre>
<p>Replace your semicolons with commas inside the objects:</p>
<... |
3,763,735 | Rails Mailer: sending emails to a local file | <p>Is there any way to send emails in rails 3 to a local file or so, instead of using an SMTP server? I'd like to test the email's contents without using any kind of SMTP, ideally only in DEV environment.</p>
<p>The best would be a local SMTP or something that allowed me to inspect emails, check email addresses, etc.<... | 3,763,802 | 2 | 0 | null | 2010-09-21 19:28:00.5 UTC | 11 | 2014-01-15 15:57:34.203 UTC | null | null | null | null | 22,992 | null | 1 | 16 | ruby-on-rails|email | 8,853 | <p>You can use the :test system delivery</p>
<pre><code>ActionMailer::Base.delivery_method = :test
</code></pre>
<p>There are also a :file delivery_method</p>
<pre><code>ActionMailer::Base.delivery_method = :file
</code></pre>
<p>You can define where put all email with file_settings</p>
<pre><code>ActionMailer::Ba... |
3,243,743 | Eclipse: Files opened by multiple searches using same editor tab | <p>When using the "file search" function in eclipse to find a bit of text in a ".java" file, I may get a list of several search results. Let's say I double click on the file "A.java" which then opens A.java in a new editor tab. If I then use the "file search" function again to find some other bit of text and this tim... | 3,243,806 | 2 | 1 | null | 2010-07-14 06:06:49.183 UTC | 21 | 2013-11-12 22:43:36.867 UTC | 2013-11-12 22:43:36.867 UTC | null | 30,563 | null | 30,563 | null | 1 | 133 | eclipse|search | 24,887 | <p>Disable the option</p>
<p>Preferences > General > Search > Reuse editors to show matches</p> |
9,074,556 | Why use object.prototype.constructor in OOP javascript? | <p>I've recently started reading up on OOP javascript and one thing that authors seem to skip over is when an object A has been declared and suddenly I see "A.prototype.constructor =A;
For example, </p>
<pre><code>var A = function(){}; // This is the constructor of "A"
A.prototype.constructor = A;
A.prototype.value =... | 9,074,696 | 5 | 2 | null | 2012-01-31 04:50:33.163 UTC | 17 | 2015-07-02 05:13:54.403 UTC | 2015-03-29 19:44:15.157 UTC | null | 104,085 | null | 672,178 | null | 1 | 22 | javascript|oop | 8,500 | <p>If A inherit B using <code>A.prototype = new B();</code>, you need to reset the constructor property for the class A using <code>A.prototype.constructor=A;</code>, otherwise instances of A would have a constructor of B.</p>
<p>In your case, <code>A.prototype.constructor === A</code> will return true, so <code>A.pr... |
29,803,045 | How to clear an angularJS array | <pre><code> $scope.itemarray = ['A', 'B', 'C'];
</code></pre>
<p>this will clear the array but the ui wont be updated.</p>
<pre><code>$scope.itemarray = [];
</code></pre>
<p>this works fine! why?</p>
<pre><code> $scope.itemarray.length = 0;
</code></pre> | 29,803,364 | 1 | 3 | null | 2015-04-22 16:02:14.76 UTC | 5 | 2019-06-18 09:21:02.89 UTC | 2019-06-18 09:21:02.89 UTC | null | 4,154,643 | null | 1,164,901 | null | 1 | 60 | javascript|angularjs | 90,991 | <p><code>$scope.itemarray.length = 0;</code> << this is correct. Length is read-write property.</p>
<p><code>$scope.itemarray = [];</code> << this creates new empty array. If you have bindings to old itemarray, they may be lost. (Html binding like <code>ng-if="itemarray[0]"</code> wont be lost)</p> |
29,661,574 | Normalize numpy array columns in python | <p>I have a numpy array where each cell of a specific row represents a value for a feature. I store all of them in an 100*4 matrix.</p>
<pre><code>A B C
1000 10 0.5
765 5 0.35
800 7 0.09
</code></pre>
<p>Any idea how I can normalize rows of this numpy.array where each value is between 0 and 1?</p>
... | 29,661,707 | 2 | 3 | null | 2015-04-15 21:51:13.89 UTC | 16 | 2017-05-30 08:45:20.1 UTC | 2015-04-15 21:58:59.967 UTC | null | 2,827,771 | null | 2,827,771 | null | 1 | 61 | python|numpy|normalize | 132,297 | <p>If I understand correctly, what you want to do is divide by the maximum value in each column. You can do this easily using <a href="http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html" rel="noreferrer">broadcasting</a>.</p>
<p>Starting with your example array:</p>
<pre><code>import numpy as np
x = np.ar... |
16,150,152 | Secure FTP using Windows batch script | <p>I currently have batch scripts on different servers that transfer a csv file to an FTP server at a different location. My script looks similar to this:</p>
<pre><code>echo user ftp_user> ftpcmd.dat
echo password>> ftpcmd.dat
echo put c:\directory\%1-export-%date%.csv>> ftpcmd.dat
echo quit>> ft... | 16,151,814 | 3 | 0 | null | 2013-04-22 14:53:22.233 UTC | 9 | 2022-09-07 16:48:52 UTC | 2016-10-19 05:42:00.363 UTC | null | 850,848 | null | 862,132 | null | 1 | 20 | windows|batch-file|ftp|sftp | 143,390 | <p>First, make sure you understand, if you need to use <a href="https://en.wikipedia.org/wiki/FTPS" rel="nofollow noreferrer">Secure FTP</a> (=FTPS, as per your text) or <a href="https://en.wikipedia.org/wiki/SSH_File_Transfer_Protocol" rel="nofollow noreferrer">SFTP</a> (as per tag you have used).</p>
<p>Neither is su... |
16,144,455 | Mocha tests with extra options or parameters | <p>I am writing test cases for my Node.js application using Mocha. The test cases need an API key as an extra input option or parameter. The API key is private, so I don't want to include it directly in the test files as everyone then can see it on GitHub. I know there are some options available for Mocha at:</p>
<p><... | 16,145,019 | 10 | 0 | null | 2013-04-22 10:08:11.22 UTC | 16 | 2020-07-31 08:10:25.917 UTC | 2015-06-30 16:00:13.317 UTC | null | 1,480,391 | null | 1,472,418 | null | 1 | 94 | node.js|mocha.js | 89,708 | <p>I don't think Mocha itself supports passing extra parameters to your tests, but you could use environment variables:</p>
<pre><code>env KEY=YOUR_KEY mocha test/*.js # assumes some sort of Unix-type OS.
</code></pre>
<p>And read them in your test files:</p>
<pre><code>var key = process.env.KEY;
</code></pre> |
29,092,193 | NodeJS Count how many objects in array? | <p>How would I count how many objects there are inside an array?</p>
<p>The array looking like:</p>
<pre><code>[ {id: 1}, {id: 2}, ...]
</code></pre>
<p>I assume I could use count() if it was PHP, but what about NodeJS/Javascript?</p>
<p>Edit: </p>
<p><img src="https://i.stack.imgur.com/G9TxO.png" alt="asd"></p>
... | 29,092,219 | 3 | 6 | null | 2015-03-17 05:53:33.06 UTC | 1 | 2015-06-24 07:01:18.357 UTC | 2015-06-24 07:01:18.357 UTC | null | 463,059 | null | 2,805,114 | null | 1 | 11 | javascript|node.js | 51,622 | <p>Use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/length" rel="noreferrer"><code>.length</code></a></p>
<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var data = [{... |
29,219,688 | Present modal view controller in half size parent controller | <p>I am trying to present modal view controller on other viewcontroller sized to half parent view controller. But it always present in full screen view.</p>
<p>I have created freeform sized View controller in my storyboard with fixed frame size. 320 X 250.</p>
<pre><code>var storyboard = UIStoryboard(name: "Main", bu... | 29,220,983 | 10 | 7 | null | 2015-03-23 20:25:35.247 UTC | 34 | 2021-10-03 12:46:02.963 UTC | 2017-09-25 00:49:48.357 UTC | null | 2,114,482 | null | 2,263,359 | null | 1 | 53 | ios|swift|uiviewcontroller|presentmodalviewcontroller | 81,556 | <p>You can use a <code>UIPresentationController</code> to achieve this.</p>
<p>For this you let the presenting <code>ViewController</code> implement the <code>UIViewControllerTransitioningDelegate</code> and return your <code>PresentationController</code> for the half sized presentation:</p>
<pre class="lang-swift pret... |
29,299,206 | PHPUnit - 'No tests executed' when using configuration file | <h1>The Problem</h1>
<p>To improve my quality of code, I've decided to try to learn how to test my code using Unit Testing instead of my mediocre-at-best testing solutions.</p>
<p>I decided to install PHPUnit using composer for a personal library that allows me to achieve common database functions. At first I didn't ... | 42,260,682 | 28 | 8 | null | 2015-03-27 11:03:49.997 UTC | 12 | 2022-04-13 12:15:06.823 UTC | 2016-01-15 18:14:09.41 UTC | null | 2,678,454 | user4165455 | null | null | 1 | 107 | php|unit-testing|phpunit | 68,915 | <p>For what it's worth (being late), I ran into this recently while I was making a new Laravel 5.1 project for a simple website. I tried to debug it and was confused when I tried:</p>
<pre><code>php artisan make:test homeTest
</code></pre>
<p>(which has a default test that just asserts true is true)</p>
<p>and saw t... |
28,918,861 | Is there a pre-defined built-in function to convert a number to its binary format in C++? | <pre><code>Integer.toString(n,8) // decimal to octal
Integer.toString(n,2) // decimal to binary
Integer.toString(n,16) //decimal to Hex
</code></pre>
<p>We have these functions in java ... do we have such built-in functions in c++</p> | 28,919,045 | 4 | 12 | null | 2015-03-07 19:09:34.56 UTC | 5 | 2021-04-22 04:06:39.48 UTC | 2015-03-07 23:01:38.29 UTC | null | 10,559 | null | 2,749,191 | null | 1 | 11 | c++ | 41,905 | <p>You can use <code>std::bitset</code> to convert a number to its binary format.</p>
<p>Use the following code snippet: </p>
<pre><code> std::string binary = std::bitset<8>(n).to_string();
</code></pre> |
17,154,317 | how to pass data in an hidden field from one jsp page to another? | <p>I have some data in an hidden field on a jsp page</p>
<pre><code><input type=hidden id="thisField" name="inputName">
</code></pre>
<p>how to access or pass this field onsubmit to another page?</p> | 17,155,121 | 2 | 0 | null | 2013-06-17 18:30:24.347 UTC | 2 | 2015-12-16 19:54:37.417 UTC | null | null | null | null | 2,415,379 | null | 1 | 5 | jsp|hidden-field | 117,288 | <p>To pass the value you must included the hidden value <code>value="hiddenValue"</code> in the <code><input></code> statement like so:</p>
<pre><code><input type="hidden" id="thisField" name="inputName" value="hiddenValue">
</code></pre>
<p>Then you recuperate the hidden form value in the same way that y... |
21,733,228 | Can RaspberryPi with BLE Dongle detect iBeacons? | <p>I bought a developer kit from <code>Radius Networks</code> that includes a <code>ioGear GBU521 BLE 4.0 dongle</code> and a <code>Raspberry Pi</code>. I also bought one of their <code>RadBeacon iBeacons</code>. They both work as advertised, but I was kind of surprised by what I got.</p>
<p>I had assumed that the <... | 21,790,504 | 3 | 5 | null | 2014-02-12 16:07:34.357 UTC | 49 | 2015-04-30 13:00:06.627 UTC | 2014-03-20 03:19:10.573 UTC | null | 2,888,581 | null | 1,153,660 | null | 1 | 39 | raspberry-pi|ibeacon | 59,153 | <p>Yes! You can use your Raspberry Pi to scan for iBeacons. We've put together a script below that does this, you can also do it yourself with these steps:</p>
<ol>
<li><p>Start a background process that does a bluetooth LE scan:</p>
<pre><code>sudo hcitool lescan --duplicates &
</code></pre>
<p>With the <code>... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.