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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
936,684 | Getting the class name from a static method in Java | <p>How can one get the name of the class from a static method in that class. For example</p>
<pre><code>public class MyClass {
public static String getClassName() {
String name = ????; // what goes here so the string "MyClass" is returned
return name;
}
}
</code></pre>
<p>To put it in context,... | 936,696 | 15 | 1 | null | 2009-06-01 20:42:16.66 UTC | 62 | 2022-08-19 13:54:27.897 UTC | null | null | null | null | 3,898 | null | 1 | 282 | java|static | 208,918 | <p>In order to support refactoring correctly (rename class), then you should use either:</p>
<pre><code> MyClass.class.getName(); // full name with package
</code></pre>
<p>or (thanks to <a href="https://stackoverflow.com/questions/936684/getting-the-class-name-from-a-static-method-in-java/936715#936715">@James Van H... |
215,026 | The located assembly's manifest definition does not match the assembly reference | <p>I am trying to run some unit tests in a C# Windows Forms application (Visual Studio 2005), and I get the following error:</p>
<blockquote>
<p>System.IO.FileLoadException: Could not load file or assembly 'Utility, Version=1.2.0.200, Culture=neutral, PublicKeyToken=764d581291d764f7' or one of its dependencies. The loc... | 215,054 | 60 | 1 | null | 2008-10-18 13:16:26.373 UTC | 97 | 2022-09-07 11:00:17.5 UTC | 2020-06-20 09:12:55.06 UTC | Adam Bellaire | -1 | akantro | 4,653 | null | 1 | 863 | c#|reference|compiler-errors|dependencies|version | 1,213,297 | <p>The .NET Assembly loader:</p>
<ul>
<li>is unable to find 1.2.0.203</li>
<li>but did find a 1.2.0.200</li>
</ul>
<p>This assembly does not match what was requested and therefore you get this error.</p>
<p>In simple words, it can't find the assembly that was referenced. Make sure it can find the right assembly by putt... |
6,416,418 | include php script inside HTML | <p>I am a newbie and have never used PHP before. I want to execute PHP script from an HTML file on Linux. What do I need to do?</p>
<p>This is the content of my HTML file:</p>
<pre><code><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
... | 6,416,457 | 5 | 1 | null | 2011-06-20 19:32:58.757 UTC | 5 | 2018-07-04 06:12:05.987 UTC | null | null | null | null | 801,807 | null | 1 | 3 | php|html|linux | 52,665 | <p>What output do you receive? Does it just show the PHP code?</p>
<p>I assume that's the case.</p>
<p>For a test, change the extension on the file to <code>.php</code> and run it again. Does it work now?</p>
<p>If so, you will need to associate PHP with <code>.html</code> and <code>.htm</code> files on your server.... |
6,599,436 | As of 2011: Netbeans 7 or Eclipse Indigo for C++? | <p>This is basically a duplicate of:
<a href="https://stackoverflow.com/questions/308450/netbeans-or-eclipse-for-c">Netbeans or Eclipse for C++?</a></p>
<p>But, that question as 3+ years old, and a lot has changed since then.</p>
<p>I have a large code base with a custom (but Makefile based) build system. The areas ... | 6,612,097 | 5 | 7 | null | 2011-07-06 15:58:06.863 UTC | 10 | 2011-12-25 22:46:10.68 UTC | 2017-05-23 10:33:19.14 UTC | null | -1 | null | 489,549 | null | 1 | 20 | c++|eclipse|netbeans|ide|eclipse-cdt | 7,236 | <p>I cannot comment on Netbeans, but I can offer you information on Eclipse. I work with C++ on UNIX systems, and I have started to use Eclipse when exploring large code bases that I know little about. I don't use it to build, but it would be easy to integrate our build system with it as one only needs commands.</p>
... |
6,752,714 | If input value is blank, assign a value of "empty" with Javascript | <p>So I have an input field, if it's blank, I want its value to be the words "empty", but if there is any value inputted, I want the value to be the inputted value. I want to use javascript for this, any idea how this can be done?</p>
<p><strong>UPDATE:</strong> Sorry, I don't think I explained it too well. I don't me... | 6,752,767 | 6 | 1 | null | 2011-07-19 19:09:02.03 UTC | 8 | 2021-02-23 22:07:30.53 UTC | 2013-09-08 08:59:25.447 UTC | null | 2,256,325 | null | 841,414 | null | 1 | 16 | javascript|forms|input | 148,967 | <p>If you're using pure JS you can simply do it like:</p>
<pre><code>var input = document.getElementById('myInput');
if(input.value.length == 0)
input.value = "Empty";
</code></pre>
<p>Here's a demo: <a href="http://jsfiddle.net/nYtm8/">http://jsfiddle.net/nYtm8/</a></p> |
6,433,492 | preg_match() vs strpos() for match finding? | <p>For <strong>single value check</strong>, which of both is preferred and why?</p>
<pre><code>$string == 'The quick brown fox jumps over the lazy dog';
if(strpos($string, 'fox') !== false){
// do the routine
}
# versus
if(preg_match('/fox/i', $string)){
// do the routine
}
</code></pre> | 6,433,513 | 6 | 2 | null | 2011-06-22 00:17:42.943 UTC | 6 | 2021-11-16 16:03:37.757 UTC | 2011-06-24 08:50:31.64 UTC | user456814 | null | null | 393,406 | null | 1 | 35 | php | 43,541 | <p>I would prefer the <code>strpos</code> over <code>preg_match</code>, because regexes are generally more expensive to execute.</p>
<p>According to the official php docs for <a href="http://php.net/manual/function.preg-match.php"><code>preg_match</code></a>:</p>
<blockquote>
<p>Do not use <code>preg_match()</code>... |
6,682,451 | Animate scroll to ID on page load | <p>Im tring to animate the scroll to a particular ID on page load. I have done lots of research and came across this:</p>
<pre><code>$("html, body").animate({ scrollTop: $('#title1').height() }, 1000);
</code></pre>
<p>but this seems to start from the ID and animate to the top of the page?</p>
<p>The HTML (which is ... | 6,682,515 | 6 | 1 | null | 2011-07-13 16:42:18.647 UTC | 50 | 2021-03-04 16:09:55.593 UTC | 2016-11-02 17:35:10.66 UTC | null | 322,020 | null | 275,119 | null | 1 | 131 | jquery|scroll|jquery-animate | 331,787 | <p>You are only scrolling the height of your element. <a href="http://api.jquery.com/offset/">offset()</a> returns the coordinates of an element relative to the document, and <code>top</code> param will give you the element's distance in pixels along the y-axis:</p>
<pre><code>$("html, body").animate({ scrollTop: $('#... |
6,871,201 | Plot two histograms on single chart with matplotlib | <p>I created a histogram plot using data from a file and no problem. Now I wanted to superpose data from another file in the same histogram, so I do something like this</p>
<pre><code>n,bins,patchs = ax.hist(mydata1,100)
n,bins,patchs = ax.hist(mydata2,100)
</code></pre>
<p>but the problem is that for each interval, ... | 6,873,956 | 13 | 0 | null | 2011-07-29 09:37:08.633 UTC | 94 | 2021-08-24 03:14:29.527 UTC | 2020-02-22 03:25:53.337 UTC | null | 12,526,884 | null | 171,546 | null | 1 | 328 | python|matplotlib|plot|histogram | 556,125 | <p>Here you have a working example:</p>
<pre><code>import random
import numpy
from matplotlib import pyplot
x = [random.gauss(3,1) for _ in range(400)]
y = [random.gauss(4,2) for _ in range(400)]
bins = numpy.linspace(-10, 10, 100)
pyplot.hist(x, bins, alpha=0.5, label='x')
pyplot.hist(y, bins, alpha=0.5, label='y'... |
41,668,813 | How to add and remove new layers in keras after loading weights? | <p>I am trying to do a transfer learning; for that purpose I want to remove the last two layers of the neural network and add another two layers. This is an example code which also output the same error.</p>
<pre><code>from keras.models import Sequential
from keras.layers import Input,Flatten
from keras.layers.convolu... | 41,670,915 | 4 | 1 | null | 2017-01-16 02:56:46.877 UTC | 31 | 2021-12-06 19:49:54.383 UTC | 2017-01-20 06:38:52.913 UTC | null | 996,366 | null | 996,366 | null | 1 | 75 | python|theano|keras|keras-layer | 96,689 | <p>You can take the <code>output</code> of the last model and create a new model. The lower layers remains the same.</p>
<pre><code>model.summary()
model.layers.pop()
model.layers.pop()
model.summary()
x = MaxPooling2D()(model.layers[-1].output)
o = Activation('sigmoid', name='loss')(x)
model2 = Model(input=in_img, ... |
15,783,694 | How to remove Subscription from product list in developer console and what will be its effect on the old subscribed users? | <p>I want to remove the existing subscription product from product list. </p>
<p>How would I be able to perform so as I didn't found any option on my developer console to delete the subscriptions ?</p>
<p>Also if in any way possible it is allowed, then will it have any effect on the existing users who have purchased ... | 19,169,695 | 2 | 0 | null | 2013-04-03 09:32:36.9 UTC | 9 | 2022-06-27 17:29:10.537 UTC | null | null | null | null | 1,518,273 | null | 1 | 34 | android|in-app-billing|subscription|android-billing | 23,202 | <p>Unfortunately, It's not possible to remove a subscription product from the product list of the developer console. You can just remove the subscription product from the product list offered in your app to prevent users from seeing or purchasing it.</p> |
15,611,374 | Customize UITableView header section | <p>I want to customize <code>UITableView</code> header for each section. So far, I've implemented</p>
<pre><code>-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
</code></pre>
<p>this <code>UITabelViewDelegate</code> method. What I want to do is to get current header for each sect... | 15,611,529 | 24 | 4 | null | 2013-03-25 09:23:16.833 UTC | 50 | 2021-06-02 15:54:46.36 UTC | 2020-12-14 16:36:25.26 UTC | null | 1,265,393 | null | 1,248,444 | null | 1 | 147 | ios|objective-c|swift|uitableview | 270,105 | <p>You can try this:</p>
<pre><code> -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 18)];
/* Create custom view to display section header... */
UILabel *label = [[UILabel all... |
50,237,516 | Proper fix for Java 10 complaining about illegal reflection access by jaxb-impl 2.3.0? | <p>We are looking at upgrading some legacy code to Java 10. As JAXB is not visible by default (EDIT: and the proper long term solution is <em>not</em> to circumvent the symptom using various JVM flags, but fix it properly) I have added this snippet to my pom.xml:</p>
<pre><code> <!-- https://mvnrepository.com/a... | 50,251,510 | 4 | 5 | null | 2018-05-08 15:42:24.163 UTC | 17 | 2022-07-17 03:32:08.83 UTC | 2018-05-09 09:29:30.417 UTC | null | 53,897 | null | 53,897 | null | 1 | 49 | java|maven|jaxb|java-10 | 36,986 | <p>jaxb-ri runtime uses <code>ClassLoader#defineClass / Unsafe#defineClass</code> to do some bytecode modification in runtime to optimize performance. <code>ClassLoader#defineClass</code> is tried first which causes the warning.</p>
<p>This legacy optimization is removed completely in jaxb-ri master (after 2.3.0, not ... |
10,668,948 | System.ComponentModel.DataAnnotations.compare vs System.Web.Mvc.Compare | <p>MVC 4 Beta project fails to compile after upgrading to .Net 4.5.</p>
<p>This happens due to conflict between
<code>System.ComponentModel.DataAnnotations.CompareAttribute</code> and <code>System.Web.Mvc.CompareAttribute</code></p>
<p><a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannota... | 11,961,402 | 6 | 3 | null | 2012-05-19 21:21:37.457 UTC | 10 | 2015-11-02 16:30:00.91 UTC | 2015-11-02 16:12:21.773 UTC | null | 4,390,133 | null | 739,558 | null | 1 | 52 | asp.net-mvc-4 | 21,495 | <p>So, looking at the MSDN documentation and doing a literal comparison of the two classes, I noticed both classes are derived from System.ComponentModel.DataAnnotations.ValidationAttribute. In fact, the classes are almost exactly the same. The only notable difference is that the MVC version also implements IClientVali... |
10,659,875 | In PHP, is there a function that returns an array made up of the value of a key from an array of associative arrays? | <p>I'm sure this question has been asked before, my apologies for not finding it first.</p>
<p>The original array:</p>
<pre><code>[0] => Array
(
[categoryId] => 1
[eventId] => 2
[eventName] => 3
[vendorName] => 4
)
[1] => Array
(
[categoryId] =>... | 10,660,002 | 8 | 5 | null | 2012-05-18 21:17:16.087 UTC | 9 | 2016-10-26 15:05:25.467 UTC | 2014-01-24 03:31:05.473 UTC | null | 128,346 | null | 975,132 | null | 1 | 27 | php|arrays|associative-array|array-reduce|pluck | 16,956 | <p>So, the cool thing about <a href="http://c2.com/cgi/wiki?HigherOrderFunction" rel="nofollow noreferrer">higher-order</a> <a href="http://docs.python.org/library/itertools.html" rel="nofollow noreferrer">collection/iterator functions</a> such as <a href="http://api.prototypejs.org/language/Enumerable/prototype/pluck/... |
25,031,557 | Rotate mp4 videos without re-encoding | <p>I'm looking for a way to rotate videos shot with my Nexus 4 on my Debian Wheezy sytem. The videos are shot in portrait mode and I would like to rotate them to landscape mode. Preferably the rotation is command-line driven.</p>
<p>I have found several previous questions which are hinting at a good solution but I can... | 27,768,317 | 5 | 4 | null | 2014-07-30 07:56:36.767 UTC | 52 | 2021-11-12 10:53:29.353 UTC | 2018-12-28 05:51:52.837 UTC | null | 9,170,457 | null | 1,982,870 | null | 1 | 99 | ffmpeg|rotation|debian|video-encoding|avconv | 90,714 | <p>If you just want to change the metadata such that mediaplayers that consider the flag play the file rotated, try something like:</p>
<pre><code>ffmpeg -i input.mp4 -c copy -metadata:s:v:0 rotate=90 output.mp4
</code></pre>
<p>as found <a href="https://stackoverflow.com/a/15336581">elsewhere on stackoverflow</a>.</... |
25,003,961 | Find array index if given value | <p>I want to retrieve the index in the array where the value is stored. I know the value of the item at that point in the array. I'm thinking it's similar to the findIndex function in c#.
For example, array[2] = {4, 7, 8}. I know the value is 7, how do I get the value of the index, 1, if I know it is at array[1]?</p> | 25,004,042 | 3 | 5 | null | 2014-07-28 20:41:06.867 UTC | 4 | 2020-09-26 11:06:39.227 UTC | 2020-09-26 11:06:39.227 UTC | null | 2,877,241 | null | 1,798,299 | null | 1 | 9 | arrays|c|algorithm|search|indexing | 69,493 | <p>For example you can define the corresponding function the following way</p>
<pre><code>size_t FindIndex( const int a[], size_t size, int value )
{
size_t index = 0;
while ( index < size && a[index] != value ) ++index;
return ( index == size ? -1 : index );
}
</code></pre>
<p>Also instead o... |
35,437,313 | Read a .csv file in c# efficiently? | <p>I'm reading huge csv files (about 350K lines by file) using this way:</p>
<pre><code>StreamReader readFile = new StreamReader(fi);
string line;
string[] row;
readFile.ReadLine();
while ((line = readFile.ReadLine()) != null)
{
row = line.Split(';');
x=row[1];
y=row[2];
... | 35,437,460 | 2 | 7 | null | 2016-02-16 16:03:36.163 UTC | null | 2016-02-16 17:25:26.4 UTC | 2016-02-16 17:25:26.4 UTC | null | 4,987,132 | null | 4,987,132 | null | 1 | 3 | c#|csv|streamreader | 65,541 | <p><strong>Method 1</strong></p>
<p>By using LINQ: </p>
<pre><code>var Lines = File.ReadLines("FilePath").Select(a => a.Split(';'));
var CSV = from line in Lines
select (line.Split(',')).ToArray();
</code></pre>
<p><strong>Method 2</strong></p>
<p>As <a href="https://stackoverflow.com/a/1050149... |
13,748,970 | Server is unwilling to process the request - Active Directory - Add User via C# | <p>I used the example in <a href="http://www.codeproject.com/Articles/18102/Howto-Almost-Everything-In-Active-Directory-via-C#36" rel="noreferrer">this page</a> to add a user to an Active Directory group, but I get an exception with the message "Server is unwilling to process the request" when executing</p>
<p><code>d... | 31,832,601 | 6 | 2 | null | 2012-12-06 17:17:22.47 UTC | 1 | 2020-02-18 12:30:10.123 UTC | 2015-08-05 12:30:15.257 UTC | null | 1,448,536 | null | 1,448,536 | null | 1 | 13 | active-directory|active-directory-group | 51,309 | <p>This question took me a lot of time to solve. First of all, the error message looks like a joke. Second, there is nothing more, just that message.</p>
<p>Anyway, I managed to fix it by:</p>
<ol>
<li><p>Making sure that <code>userDn</code> contains the whole path (e.g., <code>"LDAP://server-address/CN=" + userDn + ... |
13,561,238 | App Rejected on 17.2 clause. Asking for email ID | <p>My app is a sync solution (imagine dropbox).
The user needs to sign in to access the app's features, and if he does not have any account already created, he can sign up.</p>
<p>The sign up asks for email id verification, and this email id is also used if the user has forgotten his password to send him one.</p>
<p>bu... | 13,599,173 | 8 | 0 | null | 2012-11-26 08:39:09.013 UTC | 9 | 2016-01-20 02:35:44.353 UTC | 2020-06-20 09:12:55.06 UTC | null | -1 | null | 1,554,632 | null | 1 | 24 | iphone|ios|in-app-purchase|privacy | 26,857 | <p>Asked App Store Review people for clarification on their rejection.
They accepted it. and the app got approved :D
Its on Appstore now :)</p> |
13,478,372 | jQuery: append() vs appendTo() | <p>I am testing jQuery's <code>.append()</code> vs <code>.appendTo()</code> methods using following code:</p>
<pre><code>$('div/>', {
id : id,
text : $(this).text()
}).appendTo('div[type|="item"]#'+id);
$('div[type|="item"]#'+id).append($(this).text());
</code></pre>
<p>Note that the selectors are iden... | 13,478,425 | 10 | 3 | null | 2012-11-20 17:08:45.197 UTC | 3 | 2020-08-18 01:15:12.923 UTC | 2018-09-21 17:27:49.267 UTC | null | 814,702 | null | 1,189,757 | null | 1 | 32 | jquery|jquery-selectors|jquery-append | 61,684 | <p>To answer the question, you don't have an element to <code>appendTo</code> anything, as you're missing characters (in your case it's an <strong><em>opening angle bracket</em></strong> <code><</code>).</p>
<p>This</p>
<pre><code>$('div/>',{});
</code></pre>
<p>needs to be</p>
<pre><code>$('<div/>',{})... |
13,510,849 | Linq where clause compare only date value without time value | <pre><code>var _My_ResetSet_Array = _DB
.tbl_MyTable
.Where(x => x.Active == true
&& x.DateTimeValueColumn <= DateTime.Now)
.Select(x => x);
</code></pre>
<p>Upper query is working correct.<br>
But I want to check only date value only.<br>
But upper query check date + time value.<... | 19,935,487 | 10 | 0 | null | 2012-11-22 10:38:25.883 UTC | 11 | 2020-02-06 15:43:21.49 UTC | 2012-11-23 17:41:07.517 UTC | null | 314,488 | null | 900,284 | null | 1 | 63 | c#|entity-framework|datetime|linq-to-entities|compare | 140,621 | <p>There is also <code>EntityFunctions.TruncateTime</code> or <strong><code>DbFunctions.TruncateTime</code></strong> in EF 6.0</p> |
20,683,732 | MySQL column count doesn't match value count at row 1 | <p>I'm trying to insert data into a MySQL table using PHP, but getting the error </p>
<blockquote>
<p>Column count doesn't match value count at row 1</p>
</blockquote>
<pre><code>mysql_query("INSERT INTO file (id, filename, extention, filelink, filesize, filepass) VALUES('{$random}', '{$filename}', '{$extension}', ... | 20,683,763 | 2 | 3 | null | 2013-12-19 14:03:21.373 UTC | 2 | 2015-08-03 06:47:21.213 UTC | 2013-12-26 16:22:43.937 UTC | null | 693,207 | null | 2,251,733 | null | 1 | 8 | php|mysql | 50,974 | <pre><code>mysql_query("INSERT INTO file (id, filename, extention, filelink, filesize, filepass) VALUES('{$random}', '{$filename}', '{$extension}', '{$filelink}', '{$filesize}' '{$filepass}') ") or die(mysql_error());
</code></pre>
<p>You should add the missing comma after {$filesize}:</p>
<pre><code>mysql_query("INS... |
3,912,303 | Boolean.hashCode() | <p>The <code>hashCode()</code> method of class Boolean is implemented like this:</p>
<pre><code>public int hashCode() {
return value ? 1231 : 1237;
}
</code></pre>
<p>Why does it use 1231 and 1237? Why not something else?</p> | 3,912,325 | 2 | 1 | null | 2010-10-12 07:02:29.88 UTC | 27 | 2019-09-09 12:24:52.107 UTC | 2019-09-09 12:24:52.107 UTC | null | 5,091,346 | null | 471,011 | null | 1 | 130 | java|boolean|hashcode | 17,261 | <p>1231 and 1237 are just two (sufficiently large) <strong>arbitrary prime numbers</strong>. Any other two large prime numbers would do fine.</p>
<p><strong>Why primes?</strong><br/>
Suppose for a second that we picked composite numbers (non-primes), say 1000 and 2000. When inserting booleans into a hash table, <em>tr... |
3,505,662 | Change attributes of a group of files in MS-DOS | <p>The MS-DOS command <code>attrib</code> changes the attributes of a single file. How can I use it to change the attributes of a group of files?</p> | 3,505,710 | 3 | 2 | null | 2010-08-17 18:25:08.987 UTC | null | 2014-02-02 08:26:43.587 UTC | 2010-11-05 17:09:09.797 UTC | null | 393,280 | null | 327,104 | null | 1 | 2 | command-line|batch-file|dos | 42,435 | <p>This is the info you need</p>
<pre>
Displays or changes file attributes.
ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [drive:][path][filename]
[/S [/D]]
+ Sets an attribute.
- Clears an attribute.
R Read-only file attribute.
A Archive file attribute.
S System file attribute.
H Hi... |
9,138,959 | parsing json dictionary in javascript to iterate through keys | <p>I have the below json data coming from web service which is nothing but a dictionary serialized into json, now on client side i need to parse this back to iterate through the keys of this json dictionary using javascript or jquery</p>
<pre><code>{
"AboutToExpire": {
"Display": true,
"Message": "Sever... | 9,139,126 | 4 | 2 | null | 2012-02-04 06:40:46.41 UTC | 1 | 2020-12-21 17:03:46.907 UTC | 2014-12-15 19:00:07.487 UTC | null | 1,474,939 | null | 1,188,985 | null | 1 | 11 | jquery|json | 55,168 | <pre><code>var s = '{"AboutToExpire":{"Display":true,"Message":"Several of your subscriptions are about to expire. \u003ca id=\"lnkShowExpiringSubs\" href=\"#\"\u003eView subscriptions\u003c/a\u003e"},"Expired":{"Display":true,"Message":"Your McAfee WaveSecure - Tablet Edition subscription has expired and you’ve been w... |
9,348,264 | Does tkinter have a table widget? | <p>I'm learning Python, and I would like to use it to create a simple GUI application, and since <code>Tkinter</code> is already built-in (and very simple to use) I would like to use it to build my application.</p>
<p>I would like to make an app that will display a table that contains some data that I've loaded from m... | 9,348,306 | 10 | 2 | null | 2012-02-19 09:59:15.003 UTC | 19 | 2021-12-06 03:40:41.417 UTC | 2017-08-21 10:40:12.57 UTC | null | 4,528,269 | null | 342,235 | null | 1 | 60 | python|tkinter | 191,988 | <p>Tkinter doesn't have a built-in table widget. The closest you can use is a <code>Listbox</code> or a <code>Treeview</code> of the tkinter's sub package <a href="https://docs.python.org/3/library/tkinter.ttk.html" rel="noreferrer"><code>ttk</code></a>.</p>
<p>However, you can use <a href="https://github.com/dossan/t... |
29,763,620 | How to select all columns except one in pandas? | <p>I have a dataframe that look like this:</p>
<pre><code>import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.rand(4,4), columns=list('abcd'))
df
a b c d
0 0.418762 0.042369 0.869203 0.972314
1 0.991058 0.510228 0.594784 0.534366
2 0.407472 0.259811 0.396664 0.89... | 29,763,653 | 11 | 3 | null | 2015-04-21 05:24:59.34 UTC | 109 | 2022-06-04 15:13:14.35 UTC | 2022-06-04 15:13:14.35 UTC | null | 4,518,341 | null | 4,744,765 | null | 1 | 504 | python|pandas | 655,446 | <p>When the columns are not a MultiIndex, <code>df.columns</code> is just an array of column names so you can do:</p>
<pre><code>df.loc[:, df.columns != 'b']
a c d
0 0.561196 0.013768 0.772827
1 0.882641 0.615396 0.075381
2 0.368824 0.651378 0.397203
3 0.788730 0.568099 0.869127
... |
28,918,519 | Does securing a REST application with a JWT and Basic authentication make sense? | <p>I have a Spring REST application which at first was secured with Basic authentication.</p>
<p>Then I added a login controller that creates a JWT JSON Web Token which is used in subsequent requests.</p>
<p>Could I move the following code out of the login controller and into the security filter? Then I would not nee... | 28,953,341 | 2 | 9 | null | 2015-03-07 18:35:12.257 UTC | 42 | 2021-07-28 17:57:14.993 UTC | 2015-10-22 12:46:09.05 UTC | null | 413,180 | null | 958,373 | null | 1 | 48 | spring-security|basic-authentication|jwt | 29,816 | <p>Assuming 100% TLS for all communication - both during and at all times after login - authenticating with username/password via basic authentication and receiving a JWT in exchange is a valid use case. This is <em>almost</em> exactly how one of OAuth 2's flows ('password grant') works.</p>
<p>The idea is that the en... |
15,431,801 | How to delete multiple rows without a loop in Excel VBA | <p>Frequently we are asked how to delete rows based on criteria in one or more columns, and can we use a SpecialCells trick for this?</p> | 15,431,802 | 3 | 0 | null | 2013-03-15 11:55:06.49 UTC | 3 | 2019-03-19 15:43:40.553 UTC | 2018-07-09 18:41:45.953 UTC | null | -1 | null | 2,107,722 | null | 1 | 3 | excel|vba | 40,631 | <p>First, let me say categorically that <strong>there is nothing wrong with loops</strong> - they certainly have their place!</p>
<p>Recently we were presented with the below situation:</p>
<pre><code>400000 | Smith, John| 2.4 | 5.66| =C1+D1
400001 | Q, Suzy | 4.6 | 5.47| =C2+D2
400002 | Schmoe, Joe|... |
17,297,764 | JQuery event handler when select element is loaded | <p>Is there an event handler to use in JQuery when a DOM <strong>select</strong> element has finished loading?
This is what I want to achieve. It is working with other events except 'load'. </p>
<p>This piece of code is loaded in the head.</p>
<pre><code>$(document).on('load', 'select', function(){
var currentSel... | 17,298,020 | 7 | 6 | null | 2013-06-25 12:47:10.873 UTC | 3 | 2022-07-17 07:45:51.597 UTC | 2022-07-17 07:45:51.597 UTC | null | 4,370,109 | null | 1,743,457 | null | 1 | 5 | javascript|jquery|dom|jquery-events | 43,994 | <p>I think we're all confused. But a quick break down of your options.<br /><sub>
After an update made to the Question, it looks like the answer you might seek is my last example. Please consider all other information as well though, as it might help you determine a better process for your "End Goal".</sub></p>
<p>Fir... |
58,215,104 | What's the net::ERR_HTTP2_PROTOCOL_ERROR about? | <p>I'm currently working on a website, which triggers a <code>net::ERR_HTTP2_PROTOCOL_ERROR 200</code> error on Google Chrome. I'm not sure exactly what can provoke this error, I just noticed it pops out only when accessing the website in HTTPS. I can't be 100% sure it is related, but it looks like it prevents JavaScri... | 58,238,847 | 33 | 11 | null | 2019-10-03 08:23:48.727 UTC | 32 | 2022-08-27 17:04:41.01 UTC | 2021-04-22 06:11:29.473 UTC | null | 9,431,571 | null | 12,158,041 | null | 1 | 167 | php|wordpress|google-chrome|curl|http2 | 450,827 | <p>I didn't figure out what exactly was happening, but I found a solution.</p>
<p>The <strong>CDN feature of OVH</strong> was the culprit. I had it installed on my host service but disabled for my domain because I didn't need it.</p>
<p>Somehow, when I enable it, everything works.</p>
<p>I think it forces Apache to ... |
26,752,481 | remove git submodule but keep files | <p>I have a git submodule that I would like to become part of my main project (since I have a lot of project specific code that will go into the submodule). </p>
<p>So I'd like to remove the git references to the submodule and add the files to my main git repository.</p>
<p>But how ?</p> | 26,752,628 | 3 | 2 | null | 2014-11-05 08:20:00.887 UTC | 22 | 2021-09-18 16:33:32.187 UTC | 2015-06-07 20:20:01.787 UTC | null | 6,309 | null | 2,663,538 | null | 1 | 62 | git | 24,543 | <p>You must remove the <a href="https://stackoverflow.com/a/16581096/6309">gitlink entry</a> in your index:</p>
<pre><code>mv subfolder subfolder_tmp
git submodule deinit subfolder
git rm --cached subfolder
mv subfolder_tmp subfolder
git add subfolder
</code></pre>
<p>Replace <code>subfolder</code> with the name of t... |
17,287,542 | How to set JAVA_HOME path on Ubuntu? | <p>How can I setup <code>JAVA_HOME</code> path without having to set it each time I restart my machine?</p>
<p>I've used the following ways when trying to set JAVA_HOME on my Ubuntu machine:</p>
<p>1) From terminal I've executed the following command:</p>
<pre><code>export JAVA_HOME=/usr/lib/jvm/jdk1.7.0
</code></pr... | 17,287,562 | 2 | 3 | null | 2013-06-25 01:01:21.24 UTC | 12 | 2019-07-02 17:41:59.247 UTC | 2019-07-02 17:41:59.247 UTC | null | 608,639 | null | 1,574,486 | null | 1 | 57 | java|linux|ubuntu|java-home | 216,150 | <p>I normally set paths in </p>
<pre><code>~/.bashrc
</code></pre>
<p>However for Java, I followed instructions at
<a href="https://askubuntu.com/questions/55848/how-do-i-install-oracle-java-jdk-7">https://askubuntu.com/questions/55848/how-do-i-install-oracle-java-jdk-7</a></p>
<p>and it was sufficient for me.</p>
... |
30,649,994 | Can I catch an error from async without using await? | <p>Can errors from a non-awaited async call be caught, sent to an original encapsulating try/catch, or raise an uncaught exception?</p>
<p>Here's an example of what I mean:</p>
<pre><code>async function fn1() {
console.log('executing fn1');
}
async function fn2() {
console.log('executing fn2');
throw new... | 30,650,609 | 2 | 4 | null | 2015-06-04 17:05:39.703 UTC | 4 | 2019-09-28 11:04:37.237 UTC | 2015-07-10 15:47:55.423 UTC | null | 100,297 | null | 2,012,235 | null | 1 | 34 | javascript|async-await|promise|ecmascript-2016 | 16,210 | <p>Dealing with unhandled rejected native promises (and async/await uses native promises) is a feature supported now in V8. It's used in the latest Chrome to output debugging information when a rejected promise is unhandled; try the following at <a href="https://babeljs.io/repl/" rel="nofollow noreferrer">the Babel REP... |
18,396,501 | How to get/set current page URL (which works across space-time-browsers-versions) | <p>I want to get/set URL of the current page upon certain event.</p>
<p>It seems there are more than one approach for doing it as mentioned in questions/answers below.</p>
<p>Using Jquery</p>
<pre><code>Get URL - $(location).attr('href');
Set URL - $(location).attr('href',url);
</code></pre>
<p>Using JavaScript</p>... | 18,396,584 | 2 | 1 | null | 2013-08-23 06:43:43.797 UTC | 1 | 2014-09-26 12:53:06.84 UTC | 2017-05-23 12:25:19.71 UTC | null | -1 | null | 2,201,455 | null | 1 | 33 | javascript|jquery|dom | 97,274 | <p>I don't see any need to use jQuery for this. The following will work perfectly fine in all browsers:</p>
<pre><code>window.location.href = "http://stackoverflow.com";
</code></pre>
<p>Or even more simply:</p>
<pre><code>location.href = "http://stackoverflow.com";
</code></pre> |
18,393,448 | how to create and call a custom function in jQuery | <p>I need to create a simple function in jQuery which will call within other few functions</p>
<pre><code>$(document).ready(function() {
function reload_cart() {
alert('reload cart called');
}
});
$(document).ready(function() {
reload_cart(); //i need to call from here.
});
$(document).ready(function() {
$... | 18,393,488 | 3 | 0 | null | 2013-08-23 01:54:17.767 UTC | 3 | 2019-03-18 09:52:15.39 UTC | 2013-08-23 02:00:13.66 UTC | null | 1,380,918 | null | 1,911,703 | null | 1 | 19 | jquery|function | 104,290 | <p><code>reload_cart</code> is local to your first <code>$(document).ready()</code> callback. You can't call it from an outside scope.</p>
<p>You should merge your functions together:</p>
<pre><code>$(document).ready(function() {
function reload_cart() {
alert('reload cart called');
}
reload_cart... |
23,093,327 | Is it possible to declare default argument in Java in String? | <p>Is it possible to use default argument in the method with String. The code is shown below:</p>
<pre><code>public void test(String name="exampleText") {
}
</code></pre>
<p>The code above generate error. Is it possible to correct it?</p> | 23,093,356 | 2 | 4 | null | 2014-04-15 20:00:54.32 UTC | 4 | 2017-11-23 17:48:49.01 UTC | 2014-04-15 20:03:51.78 UTC | null | 2,864,740 | null | 3,455,638 | null | 1 | 32 | java|methods|default-value | 84,004 | <p>No, the way you would normally do this is overload the method like so:</p>
<pre><code>public void test()
{
test("exampleText");
}
public void test(String name)
{
}
</code></pre> |
5,085,533 | Is a C++ preprocessor identical to a C preprocessor? | <p>I am wondering how different the preprocessors for C++ and <strong>C</strong> are.</p>
<p>The reason for the question is <a href="https://stackoverflow.com/questions/5085392/what-is-the-value-of-an-undefined-constant-used-in-if-c">this question</a> on a preprocessor-specific question where the paragraph of the stan... | 5,085,588 | 3 | 4 | null | 2011-02-23 00:00:07.303 UTC | 6 | 2016-03-10 06:22:57.073 UTC | 2017-05-23 11:54:25.38 UTC | null | -1 | null | 180,275 | null | 1 | 28 | c++|c|standards|c-preprocessor | 3,278 | <p>The C++03 preprocessor is (at least intended to be) similar to the C preprocessor before C99. Although the wording and paragraph numbers are slightly different, the only technical differences I'm aware of between the two are that the C++ preprocessor handles digraphs and universal character names, which are not pres... |
5,543,651 | Computing Standard Deviation in a stream | <p>Using Python, assume I'm running through a known quantity of items <code>I</code>, and have the ability to time how long it takes to process each one <code>t</code>, as well as a running total of time spent processing <code>T</code> and the number of items processed so far <code>c</code>. I'm currently calculating t... | 5,543,818 | 3 | 2 | null | 2011-04-04 20:00:06.453 UTC | 21 | 2017-07-12 11:34:19.42 UTC | null | null | null | null | 185,657 | null | 1 | 40 | python|math | 20,179 | <p>I use <a href="https://stackoverflow.com/questions/895929/how-do-i-determine-the-standard-deviation-stddev-of-a-set-of-values">Welford's Method</a>, which gives more accurate results. This link points to <a href="http://www.johndcook.com/standard_deviation.html" rel="noreferrer">John D. Cook's overview</a>. Here's a... |
25,438,560 | Disable Laravel's built-in error handling methods | <p>Is there anyway to disable the Laravel error handler all together?</p>
<p>I want to simply display <strong>standard PHP errors</strong>, <strong>not</strong> the <code>Whoops, looks like something went wrong</code> errors.</p> | 25,496,104 | 7 | 3 | null | 2014-08-22 02:03:02.03 UTC | 11 | 2021-11-29 16:09:42.587 UTC | 2021-11-29 16:09:42.587 UTC | null | 1,255,289 | null | 268,074 | null | 1 | 30 | php|laravel|error-handling | 28,187 | <p>Not without majorly violating the principles of the framework (which I'll tell you how to do below, if you're still interested). </p>
<p>There's a few things that make this difficult to accomplish. It's easy enough to unset the default error and exception handlers</p>
<pre><code>set_error_handler(null);
set_excep... |
9,072,844 | How can I check if a string contains ANY letters from the alphabet? | <p>What is best pure Python implementation to check if a string contains ANY letters from the alphabet?</p>
<pre><code>string_1 = "(555).555-5555"
string_2 = "(555) 555 - 5555 ext. 5555
</code></pre>
<p>Where <code>string_1</code> would return <code>False</code> for having no letters of the alphabet in it and <code>s... | 9,072,937 | 7 | 4 | null | 2012-01-31 00:29:55.87 UTC | 35 | 2020-03-30 11:06:50.32 UTC | 2017-09-19 15:22:20.313 UTC | null | 754,991 | null | 1,030,126 | null | 1 | 113 | python|string | 269,297 | <p>Regex should be a fast approach:</p>
<pre><code>re.search('[a-zA-Z]', the_string)
</code></pre> |
18,487,406 | How do I tell Gradle to use specific JDK version? | <p>I can't figure out to get this working.</p>
<p>Scenario:</p>
<ul>
<li>I have an application built with gradle</li>
<li>The application uses JavaFX</li>
</ul>
<p>What I want</p>
<ul>
<li>Use a variable (defined per developer machine) which points to an installation of a JDK which will be used for building the who... | 21,212,790 | 23 | 8 | null | 2013-08-28 12:05:50.31 UTC | 124 | 2022-08-10 07:49:37.997 UTC | 2017-08-23 22:27:31.753 UTC | null | 3,885,376 | null | 367,277 | null | 1 | 468 | java|gradle|build.gradle | 585,021 | <p>Two ways</p>
<ol>
<li>In <code>gradle.properties</code> in the <code>.gradle</code> directory in your <code>HOME_DIRECTORY</code> set <code>org.gradle.java.home=/path_to_jdk_directory</code></li>
</ol>
<p>or:</p>
<ol start="2">
<li><p>In your <code>build.gradle</code></p>
<pre><code> compileJava.options.fork = true
... |
14,927,980 | How to make a transparent JFrame but keep everything else the same? | <p>I want to make the <code>JFrame</code> transparent, but the image on top of it to be non-transparent. This is what I have now: </p>
<p><img src="https://i.stack.imgur.com/V9In2.jpg" alt="enter image description here"></p>
<p>Does anyone know a way to make only the <code>JFrame</code> transparent?</p>
<p>Here's my... | 14,928,212 | 1 | 1 | null | 2013-02-18 00:53:12.07 UTC | 10 | 2017-12-04 18:53:49.98 UTC | 2014-07-04 04:34:05.123 UTC | null | 418,556 | null | 1,196,747 | null | 1 | 14 | java|swing|jframe|transparency|translucency | 16,251 | <p>Basically, you need to make a transparent window and a translucent content pane. This will mean anything added to the content pane will continue to be rendered without additional alphering...</p>
<p><img src="https://i.stack.imgur.com/CsG0T.png" alt="enter image description here"></p>
<pre><code>public class Tran... |
15,082,316 | how to set active class to nav menu from twitter bootstrap | <p>I'm new to the <strong>twitter bootstrap</strong>. Using there <strong>navigation menus</strong> . I'm trying to set active class to selected menu.
my menu is - </p>
<pre><code><div class="nav-collapse">
<ul class="nav">
<li id="home" class="active"><a href="~/Home/Index">Home</a&g... | 15,082,879 | 13 | 4 | null | 2013-02-26 05:53:44.437 UTC | 13 | 2019-10-22 03:57:29.113 UTC | 2018-01-06 00:24:21.56 UTC | null | 2,666,042 | null | 709,397 | null | 1 | 30 | javascript|jquery|css|twitter-bootstrap|menu | 110,019 | <p>it is a workaround. try </p>
<pre><code><div class="nav-collapse">
<ul class="nav">
<li id="home" class="active"><a href="~/Home/Index">Home</a></li>
<li><a href="#">Project</a></li>
<li><a href="#">Customer</a></li>
... |
15,287,678 | Warning: attempt to present ViewController whose view is not in the window hierarchy | <p>In one of my apps, I'm calling a viewController from the <code>application didReceiveLocalNotification</code> method. The page loads successfully, but it shows a warning as :</p>
<pre><code> Warning: Attempt to present <blankPageViewController: 0x1fda5190> on
<ViewController: 0x1fd85330> whose view is... | 15,360,428 | 9 | 2 | null | 2013-03-08 05:59:34.44 UTC | 16 | 2016-06-03 07:35:21.95 UTC | 2014-07-25 19:32:13.97 UTC | null | 2,144,085 | null | 1,968,887 | null | 1 | 31 | ios|objective-c|xcode|uiviewcontroller | 50,206 | <p>Finally I solved that issue with the following code.</p>
<pre><code>-(void) application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.blankviewController = [[blankPageVi... |
43,495,549 | Cannot install Support repository and sync project in Android Studio | <p>I am trying to use the support libraries of version 25.2.0
so I will be able to use the <a href="https://android-arsenal.com/details/1/5383" rel="noreferrer">CameraKit</a> library.</p>
<p>I have got the newest build tools downloaded: </p>
<p><a href="https://i.stack.imgur.com/uNsOl.png" rel="noreferrer"><img src=... | 43,495,905 | 4 | 6 | null | 2017-04-19 12:18:42.95 UTC | 12 | 2020-03-07 21:58:01.577 UTC | 2018-05-28 16:27:19.313 UTC | null | 2,308,683 | null | 4,125,633 | null | 1 | 40 | android|android-studio|gradle|android-support-library|build-tools | 61,260 | <p>Try using the latest support library versions:</p>
<pre><code>compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.google.android.gms:play-services-vision:10.2.1'
compile 'com.android.volley:volley:1.0.0'
// Third ... |
28,221,271 | How to write a test for Elasticsearch custom plugin? | <p>I create custom <strong>Elasticsearch</strong> plugin. Now I want to write a test for this plugin.
My expectations were - that I could run embedded <strong>Elasticsearch</strong> instance, set up it properly and then do some testing (index some documents, then query for it)</p>
<p>Problem is that I couldn't set up ... | 29,945,160 | 1 | 2 | null | 2015-01-29 17:49:13.54 UTC | 8 | 2015-10-13 03:59:16.613 UTC | 2015-04-29 10:37:24.27 UTC | null | 2,663,985 | null | 2,663,985 | null | 1 | 26 | java|elasticsearch | 3,526 | <p>To write tests for you plugin you can use <a href="https://github.com/codelibs/elasticsearch-cluster-runner">Elasticsearch Cluster Runner</a>.
For reference check how <a href="https://github.com/codelibs/elasticsearch-minhash">MinHash Plugin</a> wrote test. </p>
<p><strong>UPDATE:</strong></p>
<p>I've changed <co... |
8,672,472 | Is there a built-in binary-search In Ruby? | <p>I am looking for a built-in Ruby method that has the same functionality as <code>index</code> but uses a binary search algorithm, and thus requires a pre-sorted array.</p>
<p>I know I could write my own implementation, but according to "<a href="https://stackoverflow.com/questions/7436155/rubyindex-method-vs-binary... | 8,672,512 | 3 | 4 | null | 2011-12-29 19:28:47.087 UTC | 4 | 2018-05-07 13:28:21.64 UTC | 2017-05-23 11:45:52.017 UTC | null | -1 | null | 438,615 | null | 1 | 39 | ruby|binary-search | 24,858 | <p>Ruby 2.0 introduced <a href="http://ruby-doc.org/core/Array.html#method-i-bsearch"><code>Array#bsearch</code></a> and <a href="http://ruby-doc.org/core/Range.html#method-i-bsearch"><code>Range#bsearch</code></a>.</p>
<p>For Ruby 1.9, you should look into the <a href="http://rubygems.org/gems/bsearch"><code>bsearch<... |
8,773,721 | How to send a string over a socket in C# | <p>I am testing this locally, so the IP to connect to can be <code>localhost or 127.0.0.1</code></p>
<p>After sending it, it receives a string back. That would also be handy.</p> | 8,777,012 | 2 | 5 | null | 2012-01-07 22:41:41.32 UTC | 6 | 2021-01-13 13:03:46.073 UTC | 2013-01-22 05:22:27.78 UTC | null | 1,410,342 | null | 1,122,834 | null | 1 | 10 | c#|string|sockets | 54,636 | <pre><code>Socket soc = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
System.Net.IPAddress ipAdd = System.Net.IPAddress.Parse(server);
System.Net.IPEndPoint remoteEP = new IPEndPoint(ipAdd, 3456);
soc.Connect(remoteEP);
</code></pre>
<p>For connecting to it.
To send something:</p>
<pre>... |
5,455,866 | error: invalid type argument of ‘unary *’ (have ‘int’) | <p>I have a C Program:</p>
<pre><code>#include <stdio.h>
int main(){
int b = 10; //assign the integer 10 to variable 'b'
int *a; //declare a pointer to an integer 'a'
a=(int *)&b; //Get the memory location of variable 'b' cast it
//to a... | 5,455,962 | 4 | 0 | null | 2011-03-28 07:30:02.08 UTC | 9 | 2019-02-05 16:37:36.007 UTC | 2013-09-30 19:23:02.033 UTC | null | 445,131 | null | 679,815 | null | 1 | 30 | c|pointers | 147,977 | <p>Since <code>c</code> is holding the address of an integer pointer, its type should be <code>int**</code>:</p>
<pre><code>int **c;
c = &a;
</code></pre>
<p>The entire program becomes:</p>
<pre><code>#include <stdio.h>
int main(){
int b=10;... |
4,902,198 | PIL how to scale text size in relation to the size of the image | <p>I'm trying to dynamically scale text to be placed on images of varying but known dimensions. The text will be applied as a watermark. Is there any way to scale the text in relation to the image dimensions? I don't require that the text take up the whole surface area, just to be visible enough so its easily identif... | 4,902,713 | 4 | 0 | null | 2011-02-04 19:41:36.457 UTC | 14 | 2021-02-07 18:08:45.857 UTC | 2011-02-04 23:49:45.21 UTC | null | 31,676 | null | 506,892 | null | 1 | 58 | python|fonts|image-manipulation|python-imaging-library|scaling | 91,943 | <p>You could just increment the font size until you find a fit. <code>font.getsize()</code> is the function that tells you how large the rendered text is.</p>
<pre><code>from PIL import ImageFont, ImageDraw, Image
image = Image.open('hsvwheel.png')
draw = ImageDraw.Draw(image)
txt = "Hello World"
fontsize =... |
5,472,162 | How to read HTML as XML? | <p>I want to extract a couple of links from an html page downloaded from the internet, I think that using linq to XML would be a good solution for my case.<br>
My problem is that I can't create an XmlDocument from the HTML, using Load(string url) didn't work so I downloaded the html to a string using:</p>
<pre><code>p... | 5,472,221 | 5 | 2 | null | 2011-03-29 12:03:00.083 UTC | 1 | 2017-11-23 17:31:27.23 UTC | null | null | null | null | 365,408 | null | 1 | 18 | c#|html|xml|html-parsing | 64,715 | <p>HTML simply isn’t the same as XML (unless the HTML actually happens to be conforming XHTML or HTML5 in XML mode). The best way is to use a <a href="http://html-agility-pack.net/?z=codeplex" rel="nofollow noreferrer">HTML parser</a> to read the HTML. Afterwards you may transform it to Linq to XML – or process it dire... |
5,254,732 | Difference between map and collect in Ruby? | <p>I have Googled this and got patchy / contradictory opinions - is there actually any difference between doing a <code>map</code> and doing a <code>collect</code> on an array in Ruby/Rails? </p>
<p>The <a href="http://www.ruby-doc.org/core/classes/Array.html#M000248" rel="noreferrer">docs</a> don't seem to suggest an... | 5,254,764 | 6 | 3 | null | 2011-03-10 02:19:40.16 UTC | 71 | 2020-10-28 23:11:14.357 UTC | 2013-11-13 18:49:01.373 UTC | null | 1,017,941 | null | 341,583 | null | 1 | 454 | ruby|arrays|map|collect | 128,213 | <p>There's no difference, in fact <code>map</code> is implemented in C as <code>rb_ary_collect</code> and <code>enum_collect</code> (eg. there is a difference between <code>map</code> on an array and on any other enum, but no difference between <code>map</code> and <code>collect</code>).</p>
<hr>
<p><strong>Why do bo... |
5,584,586 | Find the division remainder of a number | <p>How could I go about finding the division remainder of a number in Python?</p>
<p>For example:<br>
If the number is 26 and divided number is 7, then the division remainder is 5.<br>
(since 7+7+7=21 and 26-21=5.)</p> | 5,584,604 | 13 | 1 | null | 2011-04-07 16:44:16.82 UTC | 14 | 2022-05-25 14:29:29.703 UTC | 2022-05-25 14:29:29.703 UTC | null | 967,621 | null | 465,137 | null | 1 | 208 | python|modulo|integer-division | 706,027 | <p>you are looking for the modulo operator:</p>
<pre><code>a % b
</code></pre>
<p>for example:</p>
<pre><code>>>> 26 % 7
5
</code></pre>
<p>Of course, maybe they wanted you to implement it yourself, which wouldn't be too difficult either.</p> |
16,786,813 | input onclick new tab | <pre><code><form name="test">
<select name="choose" style="width:300px;">
<option selected="">Select option</option>
<option value="http://url.com">Test</option>
</select>
<input onclick="location=document.test.choose.options[document.test.choose.selectedIndex].value;" value... | 16,786,881 | 4 | 3 | null | 2013-05-28 07:59:36.473 UTC | 3 | 2019-01-25 12:08:48.327 UTC | 2013-05-28 12:02:05.087 UTC | null | 2,361,412 | null | 2,361,412 | null | 1 | 7 | html|onclick | 53,813 | <p>try window.open</p>
<pre><code>window.open('http://www.google.com');
</code></pre>
<h2>update</h2>
<p>live demo - <a href="http://jsfiddle.net/im4aLL/tzp4H/">http://jsfiddle.net/im4aLL/tzp4H/</a></p> |
17,071,297 | Background image using HTML5 to fit the page | <p>I want to make one image the full background of a website! I know it sounds pretty simple, but it just got me crazy, it doesn't fit the page, this the last try I reached with!</p>
<p>CSS :</p>
<pre><code>body {
background:url('images/bg_img1.jpg') #A98436 no-repeat left top;
-webkit-background-size: cover;
-moz-ba... | 17,072,366 | 4 | 13 | null | 2013-06-12 17:07:42.007 UTC | 5 | 2020-01-28 22:49:56.723 UTC | 2013-06-12 20:48:54.7 UTC | null | 539,075 | null | 539,075 | null | 1 | 9 | html|css|twitter-bootstrap|background-image | 95,156 | <p>EDIT: I created a <a href="http://jsfiddle.net/a59Mg/" rel="noreferrer">DEMO</a> with some unnecessary things removed. This has the benefit of not windowing your background picture. The <a href="http://jsfiddle.net/a59Mg/" rel="noreferrer">DEMO</a> works but was not as extensively tested as the quoted code below.</... |
29,379,425 | Where to report issues of OpenJDK when you're not a OpenJDK developer? | <p>First I thought it's strange that there's no link to a bug tracker on the <a href="http://openjdk.java.net/" rel="noreferrer">OpenJDK project page</a>, then I found <a href="https://bugs.openjdk.java.net/" rel="noreferrer">bugs.openjdk.java.net</a>, but it's only for accredited project members. How do people outside... | 38,789,513 | 2 | 6 | null | 2015-03-31 22:06:53.06 UTC | 11 | 2021-09-24 19:14:06.493 UTC | 2017-03-14 20:25:23.31 UTC | null | 1,797,006 | null | 1,797,006 | null | 1 | 56 | openjdk|issue-tracking | 3,356 | <p>Go to <a href="http://bugs.java.com" rel="nofollow noreferrer">http://bugs.java.com</a> or jump straight to the report page: <a href="http://bugreport.java.com/" rel="nofollow noreferrer">http://bugreport.java.com/</a></p>
<p>My interpretation of their <a href="https://bugs.java.com/bugdatabase/faq.do" rel="nofol... |
29,579,811 | Changing number of columns with GridLayoutManager and RecyclerView | <p>Inside my fragment I'm setting my GridLayout in the following way:
<code>mRecycler.setLayoutManager(new GridLayoutManager(rootView.getContext(), 2));</code></p>
<p>So, I just want to change that <code>2</code> for a <code>4</code> when the user rotates the phone/tablet. I've read about <code>onConfigurationChanged<... | 29,582,477 | 9 | 10 | null | 2015-04-11 15:49:38.327 UTC | 20 | 2022-02-20 18:17:31.593 UTC | null | null | null | null | 4,201,917 | null | 1 | 67 | android|android-orientation|android-gridlayout|android-recyclerview | 67,194 | <p>Try handling this inside your onCreateView method instead since it will be called each time there's an orientation change:</p>
<pre><code>if(getActivity().getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT){
mRecycler.setLayoutManager(new GridLayoutManager(mContext, 2));
}
else... |
12,383,044 | Complexity for towers of Hanoi? | <p>I was recently solving Towers of Hanoi problem. I used a "Divide and Conquer" Strategy to solve this problem. I divided the main problem into three smaller sub problems and thus following recurrence was generated.</p>
<blockquote>
<p>T(n)=2T(n-1)+1</p>
</blockquote>
<p>Solving this leads to</p>
<blockquote>
<... | 12,383,299 | 5 | 4 | null | 2012-09-12 07:21:03.95 UTC | 4 | 2018-02-21 14:39:04.297 UTC | null | null | null | user1581106 | null | null | 1 | 13 | algorithm|complexity-theory | 78,932 | <p>It depends what you mean by "solved". The Tower of Hanoi problem with 3 pegs and <code>n</code> disks takes <code>2**n - 1</code> moves to solve, so if you want to enumerate the moves, you obviously can't do better than <code>O(2**n)</code> since enumerating <code>k</code> things is <code>O(k)</code>. </p>
<p>On th... |
12,305,021 | Efficient way to normalize a Scipy Sparse Matrix | <p>I'd like to write a function that normalizes the rows of a large sparse matrix (such that they sum to one).</p>
<pre><code>from pylab import *
import scipy.sparse as sp
def normalize(W):
z = W.sum(0)
z[z < 1e-6] = 1e-6
return W / z[None,:]
w = (rand(10,10)<0.1)*rand(10,10)
w = sp.csr_matrix(w)
w... | 12,396,922 | 5 | 3 | null | 2012-09-06 17:06:03.517 UTC | 7 | 2019-12-16 23:18:46.53 UTC | 2017-05-23 12:02:29.63 UTC | null | -1 | null | 1,652,672 | null | 1 | 32 | python|numpy|scipy|sparse-matrix | 24,605 | <p>This has been implemented in <a href="http://scikit-learn.org/dev/modules/generated/sklearn.preprocessing.normalize.html#sklearn.preprocessing.normalize">scikit-learn sklearn.preprocessing.normalize</a>.</p>
<pre><code>from sklearn.preprocessing import normalize
w_normalized = normalize(w, norm='l1', axis=1)
</code... |
12,112,844 | How to detect support for the HTML5 "download" attribute? | <p>One of the new features implemented in HTML5 is the <code>download</code> attribute for anchor tags. The benefit of this attribute is that it gives users the means to download content created within a client application, such as an image (converted from a canvas, for instance).</p>
<p>Currently, support for this fe... | 12,112,905 | 2 | 1 | null | 2012-08-24 16:00:00.997 UTC | 7 | 2017-10-20 10:12:32.777 UTC | 2017-06-07 16:56:11.853 UTC | null | 2,788,872 | null | 918,592 | null | 1 | 45 | javascript|html | 20,423 | <p>Use the <a href="https://github.com/Modernizr/Modernizr/blob/master/feature-detects/a/download.js" rel="noreferrer">Modernizr</a> approach: create the element, and check if the attribute is defined:</p>
<pre><code>var a = document.createElement('a');
if (typeof a.download != "undefined") {
alert('has support');... |
12,369,957 | Dealing with an ArrayStoreException | <pre><code>Object[] o = "a;b;c".split(";");
o[0] = 42;
</code></pre>
<p>throws</p>
<pre><code>java.lang.ArrayStoreException: java.lang.Integer
</code></pre>
<p>while</p>
<pre><code>String[] s = "a;b;c".split(";");
Object[] o = new Object[s.length];
for (int i = 0; i < s.length; i++) {
o[i] = s[i];
}
o[0] = 4... | 12,370,259 | 4 | 2 | null | 2012-09-11 12:40:24.787 UTC | 22 | 2022-02-09 14:22:12.04 UTC | null | null | null | null | 1,225,328 | null | 1 | 55 | java|arrays|casting|type-conversion | 76,442 | <p>In Java an array is also an <em>object</em>.</p>
<p>You can put an object of a <em>subtype</em> into a variable of a <em>supertype</em>. For example you can put a <code>String</code> object into an <code>Object</code> variable.</p>
<p>Unfortunately, the array definition in Java is somehow broken. <code>String[]</c... |
12,145,357 | What is a stream in C++? | <p>I have been hearing about streams, more specifically file streams.</p>
<p>So what are they?</p>
<p>Is it something that has a location in the memory?</p>
<p>Is it something that contains data?</p>
<p>Is it just a connection between a file and an object?</p> | 12,145,419 | 4 | 1 | null | 2012-08-27 15:58:01.013 UTC | 18 | 2021-01-02 04:43:13.873 UTC | 2021-01-02 04:43:13.873 UTC | null | 63,550 | null | 1,356,331 | null | 1 | 59 | c++|stream|filestream|fstream | 37,052 | <p>The term stream is an abstraction of a construct that allows you to send or receive an unknown number of bytes. The metaphor is a stream of water. You take the data as it comes, or send it as needed. Contrast this to an array, for example, which has a fixed, known length.</p>
<p>Examples where streams are used incl... |
24,263,291 | Define a Makefile variable using a ENV variable or a default value | <p>I am trying to do a simple thing:</p>
<pre><code>TMPDIR ?= /tmp
test:
@echo $(TMPDIR)
</code></pre>
<p>This works if I run:</p>
<pre><code>$ make test
/tmp
</code></pre>
<p>It also works if I run:</p>
<pre><code>$ make test -e TMPDIR=~/tmp
/home/user/tmp
</code></pre>
<p>What can I do to also have it work... | 24,264,930 | 4 | 6 | null | 2014-06-17 12:02:30.89 UTC | 14 | 2022-01-15 01:29:05.557 UTC | 2014-06-18 07:29:28.433 UTC | null | 186,202 | null | 186,202 | null | 1 | 121 | bash|shell|makefile|environment-variables | 89,893 | <p>To follow up on my comments above, here's an example:</p>
<pre><code>T ?= foo
all:
: '$(T)'
</code></pre>
<p>Now if I run the Makefile in various ways, it behaves as we expect (I get <code>foo</code> only if I don't set <code>T</code> either on the command line or environment):</p>
<pre><code>$ make
: 'fo... |
3,822,546 | Using Html.RenderPartial() in ascx files | <p>I'm trying to use Html.RenderPartial in acsx file
and I'm getting an error:</p>
<blockquote>
<p>Compiler Error Message: CS1973: 'System.Web.Mvc.HtmlHelper'
has no applicable method named 'RenderPartial' but appears to have an
extension method by that name. Extension methods cannot be dynamically
dispatched.... | 3,822,588 | 3 | 0 | null | 2010-09-29 14:25:48.293 UTC | 3 | 2015-07-02 14:56:25.887 UTC | 2015-07-02 14:56:25.887 UTC | null | 1,664,443 | null | 418,251 | null | 1 | 24 | asp.net-mvc|partial-views|renderpartial | 54,354 | <p>The compiler cannot choose the correct method because your Model is <code>dynamic</code>. Change the call to:</p>
<pre><code><% Html.RenderPartial("ProjectName", (int)(Model.Id)); %>
</code></pre>
<p>Or any other datatype Id is.</p> |
3,405,055 | Java DOM - Inserting an element, after another | <p>Given the following XML file:</p>
<pre><code><?xml version="1.0" encoding="UTF-8"?>
<process
name="TestSVG2"
xmlns="http://www.example.org"
targetNamespace="http://www.example.org"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<sequence>
<receive name="Receive1" createI... | 3,405,173 | 4 | 0 | null | 2010-08-04 11:31:49.24 UTC | 4 | 2014-09-01 08:20:54.553 UTC | null | null | null | null | 211,701 | null | 1 | 13 | java|xml|dom | 55,176 | <p>Ok, Aaron Digulla beat me regarding speed. Had to figure it out myself as well.
I didnt use <code>cnl.item(i+1)</code> but <code>nextSibling()</code>:</p>
<pre><code>Element newElement = doc.createElement(stepType); // Element to be inserted
newElement.setAttribute("name", stepName);
elem.getParentNode().insertBef... |
22,603,847 | How to extract Month from date in R | <p>I am using the <code>lubridate</code> package and applying the <code>month</code> function to extract month from date. I ran the str command on date field and I got </p>
<pre><code>Factor w/ 9498 levels "01/01/1979","01/01/1980",..: 5305 1 1 1 1 1 1 1 1 1 ...
> v1$Date<-month(v1$Date)
Error in as.POSIXlt.cha... | 22,604,060 | 5 | 5 | null | 2014-03-24 07:58:53.013 UTC | 10 | 2021-12-15 05:06:23.57 UTC | 2014-03-24 14:03:39.337 UTC | null | 1,900,149 | null | 3,264,912 | null | 1 | 55 | r|lubridate | 301,540 | <p><code>?month</code> states:</p>
<blockquote>
<p>Date-time must be a POSIXct, POSIXlt, Date, Period, chron, yearmon,
yearqtr, zoo, zooreg, timeDate, xts, its, ti, jul, timeSeries, and fts
objects.</p>
</blockquote>
<p>Your object is a factor, not even a character vector (presumably because of <code>stringsAsF... |
20,420,890 | Getting errors stray ‘\342’ and ‘\200’ and ‘\214’ | <p>I'm trying to write a program for a simple game, but I am getting errors, stray ‘\342’ and ‘\200’ and ‘\214’, using g++ and gedit in <a href="https://en.wikipedia.org/wiki/Ubuntu_version_history#Ubuntu_13.10_.28Saucy_Salamander.29" rel="nofollow noreferrer">Ubuntu 13.10</a> (Saucy Salamander).</p>
<p>The code is:</p... | 20,421,130 | 4 | 4 | null | 2013-12-06 09:54:23.75 UTC | 3 | 2021-03-06 22:00:21.107 UTC | 2021-03-06 22:00:21.107 UTC | null | 63,550 | null | 3,073,850 | null | 1 | 6 | c++|ubuntu|g++ | 74,040 | <p>You are using a <a href="http://www.fileformat.info/info/unicode/char/200c/index.htm" rel="nofollow noreferrer">Zero Width Non Joiner</a> character after the <code>>></code> in your code. This is a Unicode character that is encoded in UTF-8 as three characters with values <code>0x2e</code>, <code>0x80</code>, ... |
20,580,968 | Xcode error : Distill failed for unknown reasons | <p>Does anybody know why this error happens on Xcode 5?</p>
<p><img src="https://i.stack.imgur.com/uBCcr.png" alt="error" /></p>
<p><strong>Answer</strong></p>
<p>I had this problem when I accidentally renamed a .psd as a .png. Converting the image to an actual png instead of a Photoshop file fixed it for me.</p> | 20,581,066 | 18 | 6 | null | 2013-12-14 07:51:40.463 UTC | 3 | 2021-09-09 02:53:48.103 UTC | 2021-03-16 14:13:17.827 UTC | null | 865,175 | null | 1,282,896 | null | 1 | 51 | ios|iphone|xcode|ios7|xcode5 | 24,973 | <p>You might have migrated from a normal project to use an image.catalog. So you can definitely try to copy the bundle resource like launch images. It is so because migrating to an asset catalog for icons and launch images apparently doesn't always add itself to the target automatically. </p>
<p>You can find more on t... |
20,739,941 | Export JSON to CSV or Excel with UTF-8 (e.g. Greek) encoding using JavaScript | <p>I am trying to export and download a <em>JSON</em> object to <em>CSV</em> file and I have problem with Greek characters. My code works; it is not perfect, but it works. </p>
<p>The problem is that Greek characters looks like junk. </p>
<p>Here is my existing code:</p>
<pre><code>function downloadJsonToCsv(jsonObj... | 20,965,911 | 2 | 7 | null | 2013-12-23 08:48:52.623 UTC | 6 | 2018-01-18 21:20:58.653 UTC | 2014-01-18 21:26:39.807 UTC | null | 503,900 | null | 2,455,661 | null | 1 | 17 | javascript|csv|character-encoding|export-to-excel|export-to-csv | 38,182 | <p><strong>Export to CSV</strong> </p>
<p>Exporting to CSV with non-ASCII characters requires prepending the file with the <a href="https://en.wikipedia.org/wiki/Byte_order_mark" rel="noreferrer">Byte Order Mark</a> aka BOM. In your code change</p>
<p><code>var str = "";</code></p>
<p>to:</p>
<p><code>var str = "\u... |
26,124,914 | How to test React PropTypes through Jest? | <p>I'm writing Jest tests for my React code and hoping to make use of/test the PropType checks. I am quite new to the Javascript universe. I'm using npm to install <code>react-0.11.2</code> and have a simple:</p>
<pre><code>var React = require('react/addons');
</code></pre>
<p>In my tests. My test looks quite similar... | 31,835,256 | 7 | 4 | null | 2014-09-30 15:45:33.06 UTC | 8 | 2022-03-17 09:25:03.62 UTC | 2016-11-14 23:59:58.89 UTC | null | 5,921 | null | 98,555 | null | 1 | 35 | reactjs|jestjs|reactjs-testutils|react-proptypes | 29,321 | <p>The underlying problem is <a href="https://stackoverflow.com/questions/7246884/detecting-console-log-calls">How to test <code>console.log</code>?</a></p>
<p>The short answer is that you should replace the <code>console.{method}</code> for the duration of the test. The common approach is to use <a href="http://sinon... |
11,317,278 | Python IOError: File not open for writing and global name 'w' is not defined | <p>I'm trying to write a little procedure that write (append would be even better) a line in a file with Python, like this: </p>
<pre><code>def getNewNum(nlist):
newNum = ''
for i in nlist:
newNum += i+' '
return newNum
def writeDoc(st):
openfile = open("numbers.txt", w)
openfile.write(st... | 11,317,288 | 2 | 1 | null | 2012-07-03 18:50:54.863 UTC | 0 | 2015-04-19 08:18:56.81 UTC | 2015-04-19 08:18:56.81 UTC | null | 319,204 | null | 955,883 | null | 1 | 10 | python|io|syntax-error | 42,993 | <p>The problem is in the <a href="http://docs.python.org/library/functions.html?highlight=open#open">open()</a> call in <code>writeDoc()</code> that file mode specification is not correct. </p>
<pre><code>openfile = open("numbers.txt", w)
^
</code></pre>
<p>The <code>w</code> needs to h... |
11,412,467 | dismissModalViewController with transition: left to right | <p>I was using a nice method to dismiss my modal view controller:</p>
<pre><code>[self dismissModalViewControllerWithTransition:2];
</code></pre>
<p>which makes a slide transition from left to right, like a navigation controller does to pop a view.</p>
<p>As this method is a non-public method, apple will not accept ... | 11,414,021 | 3 | 0 | null | 2012-07-10 11:34:06.603 UTC | 11 | 2017-10-04 07:33:52.443 UTC | null | null | null | null | 363,131 | null | 1 | 17 | iphone|animation|uiviewanimationtransition|catransition | 10,373 | <p>I have accepted the answer from Safecase, but I would like to publish my final solution here:</p>
<p>1) To present a modal view controller with a from right to left transition I have written following method:</p>
<pre><code>-(void) presentModalView:(UIViewController *)controller {
CATransition *transition = [C... |
10,960,998 | How different async programming is from Threads? | <p>I've been reading some <code>async</code> articles here: <a href="http://www.asp.net/web-forms/tutorials/aspnet-45/using-asynchronous-methods-in-aspnet-45" rel="noreferrer">http://www.asp.net/web-forms/tutorials/aspnet-45/using-asynchronous-methods-in-aspnet-45</a> and the author says :</p>
<blockquote>
<p>When y... | 10,969,951 | 3 | 0 | null | 2012-06-09 12:27:49.48 UTC | 20 | 2014-11-10 16:16:00.97 UTC | null | null | null | null | 44,852 | null | 1 | 33 | c#|asp.net|.net|asynchronous | 8,273 | <p>Threads are not necessary for asynchronous programming.</p>
<p>"Asynchronous" means that the API doesn't block the <em>calling</em> thread. It does <em>not</em> mean that there is another thread that <em>is</em> blocking.</p>
<p>First, consider your UI example, this time using actual asynchronous APIs:</p>
<ol>
<... |
11,116,399 | crt1.o: In function `_start': - undefined reference to `main' in Linux | <p>I am porting an application from Solaris to Linux</p>
<p>The object files which are linked do not have a main() defined. But compilation and linking is done properly in Solaris and executable is generated. In Linux I get this error </p>
<pre><code> /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/crt1.o... | 11,117,836 | 7 | 3 | null | 2012-06-20 09:19:00.68 UTC | 18 | 2022-07-29 09:34:51.41 UTC | 2012-06-20 09:24:42.02 UTC | null | 1,397,853 | null | 1,397,853 | null | 1 | 51 | linux|program-entry-point|undefined-reference | 121,925 | <p>Try adding <code>-nostartfiles</code> to your linker options, i.e.</p>
<pre><code>$(LINK) -nostartfiles -g ...
</code></pre>
<p>From the <a href="http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html" rel="noreferrer">gcc documentation</a>:</p>
<pre><code>-nostartfiles
Do not use the standard system startup fil... |
10,971,149 | The following sections have been defined but have not been rendered for the layout page "~/Views/Shared/_Layout.cshtml": "Scripts" | <p>I'm new to ASP MVC and utilizing the Intro to ASP MVC 4 Beta tutorial <a href="http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/intro-to-aspnet-mvc-4" rel="noreferrer">http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/intro-to-aspnet-mvc-4</a></p>
<p>I'm encountering an ... | 10,971,246 | 19 | 4 | null | 2012-06-10 18:17:28.897 UTC | 30 | 2021-11-05 12:53:07.263 UTC | null | null | null | null | 613,888 | null | 1 | 119 | asp.net|asp.net-mvc | 150,200 | <p>It means that you have defined a section in your master Layout.cshtml, but you have not included anything for that section in your View.</p>
<p>If your _Layout.cshtml has something like this:</p>
<pre><code>@RenderSection("scripts")
</code></pre>
<p>Then all Views that use that Layout <strong>must</strong> includ... |
13,028,604 | sending a javascript object through websockets with faye | <p>Hi all I'm trying to send a javascript object through websockets:</p>
<p>the faye-websockets documentation says:</p>
<p><strong>send(message)</strong> <em>accepts either a String or a Buffer and sends a text or binary message over the connection to the other peer.</em></p>
<p>server side I'm using node and faye.<... | 13,034,191 | 3 | 2 | null | 2012-10-23 10:39:21.38 UTC | 18 | 2018-01-09 12:29:56.187 UTC | 2015-03-12 16:29:02.133 UTC | null | 149,841 | null | 280,235 | null | 1 | 43 | node.js|serialization|websocket|javascript-objects|faye | 79,181 | <p>WebSockets support sending and receiving: strings, typed arrays (ArrayBuffer) and Blobs. Javascript objects must be serialized to one of the above types before sending.</p>
<p>To send an object as a string you can use the builtin JSON support:</p>
<pre><code>ws.send(JSON.stringify(object));
</code></pre>
<p>To se... |
12,669,805 | When to use InvalidOperationException or NotSupportedException? | <p>I am implementing a custom collection implementation that can either be readonly or non-readonly; that is, all the methods that change the collection call a function that is the moral equivalent of:</p>
<pre><code>private void ThrowIfReadOnly() {
if (this.isReadOnly)
throw new SomeException("Cannot modif... | 12,669,807 | 1 | 0 | null | 2012-10-01 08:28:48.237 UTC | 7 | 2016-03-09 06:24:16.71 UTC | 2013-05-06 10:45:07.037 UTC | null | 57,428 | null | 113,158 | null | 1 | 52 | c#|.net|exception|invalidoperationexception|notsupportedexception | 20,503 | <p>The MSDN only has one bit of guidance on this precise topic, on <a href="http://msdn.microsoft.com/en-us/library/system.notsupportedexception.aspx" rel="noreferrer"><code>NotSupportedException</code></a>:</p>
<blockquote>
<p>For scenarios where it is sometimes possible for the object to perform the requested oper... |
13,224,553 | How to convert a huge list-of-vector to a matrix more efficiently? | <p>I have a list of length 130,000 where each element is a character vector of length 110. I would like to convert this list to a matrix with dimension 1,430,000*10. How can I do it more efficiently?\
My code is :</p>
<pre><code>output=NULL
for(i in 1:length(z)) {
output=rbind(output,
matrix(z[[i]],ncol... | 13,224,720 | 5 | 5 | null | 2012-11-05 00:40:34.23 UTC | 22 | 2019-02-26 20:41:07.573 UTC | 2019-02-26 20:41:07.573 UTC | null | 190,277 | null | 1,787,675 | null | 1 | 68 | r|list|matrix|performance | 154,103 | <p>This should be equivalent to your current code, only a lot faster:</p>
<pre><code>output <- matrix(unlist(z), ncol = 10, byrow = TRUE)
</code></pre> |
12,960,574 | pandas read_csv index_col=None not working with delimiters at the end of each line | <p>I am going through the 'Python for Data Analysis' book and having trouble in the 'Example: 2012 Federal Election Commision Database' section reading the data to a DataFrame. The trouble is that one of the columns of data is always being set as the index column, even when the index_col argument is set to None. </p>
... | 12,961,158 | 3 | 3 | null | 2012-10-18 17:44:44.1 UTC | 12 | 2021-11-07 11:25:39.153 UTC | 2018-08-14 00:22:36.963 UTC | null | 202,229 | null | 1,757,088 | null | 1 | 72 | python|pandas | 204,998 | <h2>Quick Answer</h2>
<p>Use <code>index_col=False</code> instead of <code>index_col=None</code> when you have delimiters at the end of each line to turn off index column inference and discard the last column.</p>
<h2>More Detail</h2>
<p>After looking at the data, there is a comma at the end of each line. And this quo... |
12,937,470 | Twitter Bootstrap: Center Text on Progress Bar | <p>I've been using Twitter's bootstrap and I would like the text on the progress bar to be centered on the on bar regardless of value.</p>
<p>The below link is what I have now. I would like all text to be aligned with the bottom most bar.</p>
<p>Screenshot:</p>
<p><img src="https://i.imgur.com/gaE4U.png" alt="progr... | 17,326,764 | 2 | 0 | null | 2012-10-17 15:08:51.637 UTC | 18 | 2021-12-14 17:04:32.487 UTC | 2016-10-17 10:40:58.187 UTC | null | 5,676,192 | user830186 | null | null | 1 | 78 | css|twitter-bootstrap|progress-bar|centering | 90,370 | <p><strong>Bootstrap 5:</strong> (Same as v4x)</p>
<pre><code><div class="progress position-relative">
<div class="progress-bar" role="progressbar" style="width: 60%" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100"></div&g... |
13,134,983 | List<String> to ArrayList<String> conversion issue | <p>I have a following method...which actually takes the list of sentences and splits each sentence into words. Here is it:</p>
<pre><code>public List<String> getWords(List<String> strSentences){
allWords = new ArrayList<String>();
Iterator<String> itrTemp = strSentences.iterator();
while... | 13,135,054 | 8 | 0 | null | 2012-10-30 08:12:21.243 UTC | 14 | 2022-05-02 06:21:45.97 UTC | 2022-05-02 06:21:45.97 UTC | null | 18,467,494 | null | 1,780,520 | null | 1 | 104 | java|list|arraylist | 253,611 | <p>First of all, why is the map a <code>HashMap<String, ArrayList<String>></code> and not a <code>HashMap<String, List<String>></code>? Is there some reason why the value must be a specific implementation of interface <code>List</code> (<code>ArrayList</code> in this case)?</p>
<p><code>Arrays.... |
30,362,546 | How to use 2 or more databases with spring? | <p>I have an application that runs Spring MVC.</p>
<p>I need it to access 2 different databases in my app (one is a PostgreSQL and the other one is a MySQL database).</p>
<p>How do I configure this using just annotations or application.properties file?</p>
<p>Regards.</p> | 30,408,034 | 4 | 5 | null | 2015-05-21 00:24:26.82 UTC | 38 | 2020-04-15 15:10:28.39 UTC | 2015-05-22 22:27:07.31 UTC | null | 88,211 | null | 88,211 | null | 1 | 69 | spring|spring-boot|multiple-databases | 94,188 | <p>Here is the example code for having <code>multiple Database/datasource</code> on <code>Spring-Boot</code> I hope it helps! </p>
<p><strong>application.properties</strong></p>
<pre><code>spring.ds_items.driverClassName=org.postgresql.Driver
spring.ds_items.url=jdbc:postgresql://srv0/test
spring.ds_items.username=... |
37,445,838 | Returning values in Elixir? | <p>I've recently decided to learn Elixir. Coming from a C++/Java/JavaScript background I've been having a lot of trouble grasping the basics. This might sound stupid but how would return statements work in Elixir? I've looked around and it seems as though it's just the last line of a function i.e.</p>
<pre><code>def H... | 37,446,794 | 2 | 6 | null | 2016-05-25 19:17:29.26 UTC | 2 | 2016-05-25 20:15:03.72 UTC | null | null | null | null | 3,072,896 | null | 1 | 28 | function|elixir | 26,742 | <p>Elixir has no 'break out' keyword that would be equivalent to the 'return' keyword in other languages.</p>
<p>Typically what you would do is re-structure your code so the last statement executed is the return value.</p>
<p>Below is an idiomatic way in elixir to perform the equivalent of your code test, assuming yo... |
16,937,207 | Android - How to Set a semi-transparent layout? | <p>I'm new to android application. <img src="https://i.stack.imgur.com/94X8c.png" alt="enter image description here"></p>
<p>In this picture,there is a bottom layout with some options like play,delete etc.., and has its transparency to show its background.</p>
<p>How to I get like that ?</p> | 16,937,268 | 5 | 4 | null | 2013-06-05 10:12:07.123 UTC | 12 | 2019-05-23 01:04:06.237 UTC | null | null | null | null | 2,409,495 | null | 1 | 19 | java|android | 45,756 | <p>use <code>android:background ="#88676767"</code> change the first <em>88</em> to your selection of opacity</p>
<p>In reply to your comment:</p>
<pre><code>ImageView iv = (ImageView) findViewById(your_imageId);
iv.setColorFilter(Color.argb(150, 155, 155, 155), Mode.SRC_ATOP);
</code></pre>
<p><strong>Third o... |
16,891,530 | Publish one web project from solution with msbuild | <p>I'm trying to deploy one of the web projects in my solution to a server. I am using msbuild on TeamCity like so:</p>
<pre><code>msbuild MySolution.sln /t:WebSite:Rebuild /p:DeployOnBuild=True /p:PublishProfile=Prod ...
</code></pre>
<p>However, when I run it, msbuild still tries to build my <code>WebService</code>... | 16,903,952 | 3 | 0 | null | 2013-06-03 07:01:02.11 UTC | 17 | 2020-09-08 06:37:33.2 UTC | 2013-06-03 08:13:17.53 UTC | null | 264,675 | null | 264,675 | null | 1 | 46 | c#|msbuild|teamcity|webdeploy | 34,974 | <p>I blogged about this at <a href="http://sedodream.com/2013/03/06/HowToPublishOneWebProjectFromASolution.aspx" rel="noreferrer">http://sedodream.com/2013/03/06/HowToPublishOneWebProjectFromASolution.aspx</a> a few months back. I've copied the details here as well, see below.</p>
<hr>
<p>Today on twitter <a href="ht... |
63,110,475 | PhpStorm Debugger extension is not detected while using with PHPUnit | <p>I am using PHPUnit through PhpStorm with a remote interpreter from docker.
The Container is run through <code>docker-compose</code></p>
<p>PHPUnit works. Xdebug works through the browser. In <code>docker-php-ext-xdebug.ini</code>, I have all the mandatory options, and I can see in the <code>CLI Interpreter Config</c... | 63,117,292 | 4 | 5 | null | 2020-07-27 07:20:46.623 UTC | 1 | 2022-07-07 20:36:09.057 UTC | 2020-07-27 13:41:17.68 UTC | null | 1,361,124 | null | 1,361,124 | null | 1 | 32 | php|docker|phpunit|phpstorm|xdebug | 18,417 | <p>Your Xdebug settings look fine to me. It shows expected values for PHPUnit and it works for a web page debug.</p>
<p>This has to be the IDE settings / some IDE misconfiguration. In particular, <strong>make sure that you have selected the default PHP Interpreter.</strong> Even though you have specified one in your Ru... |
9,683,516 | How do I get swipe-to-delete working when tableView's allowsMultipleSelectionDuringEditing property is YES? | <p>In iOS 5, if I set <code>allowsMultipleSelectionDuringEditing</code> to YES on a UITableView then swipe-to-delete no longer works. The built-in Mail app supports both swipe-to-delete and multiple selections in edit mode, and I'd like to do likewise. How do I achieve this?</p> | 9,683,541 | 1 | 0 | null | 2012-03-13 11:55:20.007 UTC | 9 | 2013-07-08 10:44:19.38 UTC | 2012-10-10 22:38:38.19 UTC | null | 263,871 | null | 263,871 | null | 1 | 27 | ios|uitableview | 3,149 | <p>The trick is to set <code>allowsMultipleSelectionDuringEditing</code> to YES on entering edit mode and set it back to NO on exiting edit mode. This way, both swipe-to-delete and multiple selections in edit mode work.</p>
<p>If you've subclassed <code>UITableViewController</code> (which you probably have), then you ... |
9,884,033 | Ruby on Rails: Switch from test_unit to rspec | <p>I'm going through a tutorial that has suggested using <code>rspec</code>, but I have already gone through a lot of default rails installation. I really don't want to have to redo the installation at all. Anyway, when I run</p>
<pre><code>$ rails g integration_test named
</code></pre>
<p>I get</p>
<pre><code> i... | 9,884,102 | 9 | 0 | null | 2012-03-27 05:53:27.93 UTC | 24 | 2018-11-09 22:26:25.09 UTC | null | null | null | null | 454,533 | null | 1 | 82 | ruby-on-rails|rspec|gem|testunit | 31,056 | <p>In your <code>config/application.rb</code> file :</p>
<pre><code>config.generators do |g|
g.test_framework :rspec
end
</code></pre>
<p>Now when you run your generators (example <code>rails generate scaffold post</code>), you get rspec test files. Remember to restart your server. For more information on generator... |
10,007,094 | java.lang.IllegalStateException: The specified child already has a parent | <p>I am using fragments, when I instantiate a fragment the first time it it. but the second time I got this exception. I couldn't find the line where I got the error?</p>
<pre><code> 04-04 08:51:54.320: E/AndroidRuntime(29713): FATAL EXCEPTION: main
04-04 08:51:54.320: E/AndroidRuntime(29713): java.lang.IllegalSta... | 10,010,792 | 12 | 4 | null | 2012-04-04 08:00:30.143 UTC | 26 | 2022-03-23 13:51:13.483 UTC | 2016-04-26 14:04:01.423 UTC | null | 5,400,454 | null | 833,219 | null | 1 | 99 | android|android-layout|android-fragments | 110,544 | <p>When you override <code>OnCreateView</code> in your <code>RouteSearchFragment</code> class, do you have the </p>
<pre><code>if(view != null) {
return view;
}
</code></pre>
<p>code segment?</p>
<p>If so, removing the return statement should solve your problem.</p>
<p>You can keep the code and return the view... |
7,956,865 | Python Subprocess Grep | <p>I am trying to use the grep command in a python script using the subprocess module.</p>
<p>Here's what I have:</p>
<pre><code>userid = 'foo12'
p = subprocess.Popen(['grep', "%s *.log"%userid], stdout=subprocess.PIPE)
</code></pre>
<p>And it returns nothing.
I am not entirely sure what I am doing wrong so can some... | 7,957,083 | 3 | 0 | null | 2011-10-31 16:52:50.613 UTC | 2 | 2019-05-17 16:26:11.33 UTC | 2019-05-17 16:26:11.33 UTC | null | 5,736,236 | null | 1,248,984 | null | 1 | 14 | python|grep|subprocess|popen | 37,997 | <p>I think you're running up against two problems:</p>
<ol>
<li><p>This call:</p>
<pre><code>p = subprocess.Popen(['grep', "%s *.log"%userid]...
</code></pre>
<p>will not work as expected without <code>shell=True</code> because the list of arguments are being passed directly to <code>os.execvp</code>, which requires... |
11,925,228 | How to pass multiple values of a variable through a URL | <p>I've an application that I'm building, and I'm stuck at a certain point.</p>
<p>I'm trying to pass a variable that has multiple values. So my URL will look like:</p>
<pre><code>localhost/report.php?variable=value1, value2, value3
</code></pre>
<p>Problem is I'm not sure how I can do this. The variables are to be ... | 11,938,999 | 6 | 6 | null | 2012-08-12 19:31:04.65 UTC | 2 | 2012-08-13 17:07:51.183 UTC | 2012-08-12 19:39:29.403 UTC | null | 395,729 | null | 395,729 | null | 1 | 8 | php|url|urlvariables | 86,620 | <p>As noted at <a href="https://stackoverflow.com/a/2407401/1265817">https://stackoverflow.com/a/2407401/1265817</a>, you can use this method.</p>
<p>If you want PHP to treat $_GET['select2'] as an array of options just add square brackets to the name of the select element like this: <code><select name="select2[]" ... |
12,026,555 | How to do a UNION on a single table? | <p>I need to display the name and surname and address and DOB for all customers who reside in 'Peters' or 'Crows' avenue only.</p>
<p>This is fine I did it like so:</p>
<pre><code>SELECT Customers.FirstName, Customers.Surname,
Customers.CustomerAddress, Customers.DOB
FROM Customers
WHERE
( Customers.Customer... | 12,026,615 | 3 | 2 | null | 2012-08-19 12:42:01.937 UTC | 1 | 2020-01-22 20:57:19.383 UTC | 2012-09-23 09:44:55.27 UTC | null | 635,608 | null | 1,133,011 | null | 1 | 12 | sql|sql-server-2008|union | 45,189 | <pre><code> SELECT Customers.FirstName, Customers.Surname, Customers.DOB, Customers.CustomerAddress
FROM Customers
WHERE Customers.CustomerAddress LIKE '%'+ 'Main' + '%'
UNION
SELECT Customers.FirstName, Customers.Surname, Customers.DOB, Customers.CustomerAddress
FROM Customers
WHERE Customers.CustomerAddress... |
11,622,539 | How do I use tabHost for Android | <p>I have looked at posts on Stack Overflow and at tutorials on other websites, and I cannot understand how to use <code>TabHost</code>. Can someone please explain it to me and maybe send me a link to a tutorial?</p> | 11,627,734 | 2 | 2 | null | 2012-07-24 00:35:55.49 UTC | 15 | 2017-05-13 04:21:34.693 UTC | 2016-12-05 01:46:39.33 UTC | null | 3,681,880 | null | 1,527,377 | null | 1 | 18 | java|android|xml|android-tabhost | 49,274 | <p><img src="https://i.stack.imgur.com/Gg96o.png" alt="Concept TabHost"></p>
<p><img src="https://i.stack.imgur.com/s6QYI.png" alt="enter image description here"></p>
<ol>
<li><p>In ManiActivity extends TabActivity</p>
<pre><code>public class MainActivity extends TabActivity {
@Override
public void onCreate(Bundle ... |
20,343,014 | adb doesn't show nexus 5 device | <pre><code>Android Studio 0.3.6
Fedora 18 3.11.7-100.fc18.x86_64
Nexus 5 Kitkat
</code></pre>
<p>Hello,</p>
<p>I have been using my <code>Samsung Galaxy Tab 3 7.0</code> running <code>Android 4.1.2</code> everything works fine with <code>adb</code>.</p>
<p>However, I have just bought a new Nexus 5 device, and when I... | 21,551,646 | 22 | 5 | null | 2013-12-03 04:40:40.783 UTC | 18 | 2021-08-02 21:49:16.733 UTC | 2013-12-03 16:35:53.127 UTC | null | 136,445 | null | 70,942 | null | 1 | 82 | android|linux|adb | 124,092 | <p>I had a similar problem with my Nexus 4(Android version 4.4.2), it wasn't listed in adb devices.</p>
<p>Make sure USB debugging is enabled from device, and do the following on your PC:</p>
<ol>
<li><p>Update Android SDK (<strong>Google USB Driver</strong>)</p></li>
<li><p>From PC Control Panel, System -> Device ma... |
3,861,493 | How to pass userInfo in NSNotification? | <p>I am trying to send some data using NSNotification but get stuck. Here is my code:</p>
<pre><code>// Posting Notification
NSDictionary *orientationData;
if(iFromInterfaceOrientation == UIInterfaceOrientationLandscapeRight) {
orientationData = [NSDictionary dictionaryWithObject:@"Right"
... | 3,861,543 | 4 | 0 | null | 2010-10-05 07:07:22.103 UTC | 11 | 2016-04-06 10:11:48.413 UTC | 2010-10-05 07:23:02.843 UTC | null | 24,587 | null | 418,029 | null | 1 | 50 | iphone|cocoa|cocoa-touch | 54,085 | <p>You get an NSNotification object passed to your function. This includes the name, object and user info that you provided to the NSNotificationCenter.</p>
<pre><code>- (void)orientationChanged:(NSNotification *)notification
{
NSDictionary *dict = [notification userInfo];
}
</code></pre> |
3,868,140 | Using a DISTINCT clause to filter data but still pull other fields that are not DISTINCT | <p>I am trying to write a query in Postgresql that pulls a set of ordered data and filters it by a distinct field. I also need to pull several other fields from the same table row, but they need to be left out of the distinct evaluation. example: </p>
<pre><code> SELECT DISTINCT(user_id) user_id,
created_... | 3,868,242 | 5 | 4 | null | 2010-10-05 22:07:14.743 UTC | 3 | 2015-09-04 13:48:39.03 UTC | 2015-09-04 12:58:42.537 UTC | null | 5,053,499 | null | 467,359 | null | 1 | 14 | sql|ruby-on-rails|postgresql|distinct | 39,361 | <p>As you've discovered, standard SQL treats <code>DISTINCT</code> as applying to the whole select-list, not just one column or a few columns. The reason for this is that it's ambiguous what value to put in the columns you exclude from the <code>DISTINCT</code>. For the same reason, standard SQL doesn't allow you to ... |
3,222,856 | DataGridTextColumn.IsReadOnly seems to be faulty | <p>If I create a binding to the <code>IsReadOnly</code> property of the <code>DataGridTextColumn</code>, it does not actualize. If I set it through markup, it works.</p>
<pre class="lang-xml prettyprint-override"><code><DataGridTextColumn IsReadOnly="{Binding IsReferenceInactive}"/> <!-- NOP -->
... | 18,657,986 | 6 | 1 | null | 2010-07-11 11:22:51.543 UTC | 5 | 2022-06-03 13:41:43.923 UTC | 2022-06-03 13:41:43.923 UTC | null | 340,628 | null | 340,628 | null | 1 | 29 | .net|wpf|datagrid | 13,628 | <p>Same as codekaizen but simpler:</p>
<pre><code><DataGridTextColumn>
<DataGridTextColumn.CellStyle>
<Style>
<Setter Property="UIElement.IsEnabled" Value="{Binding IsEditable}" />
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
</code></pre> |
3,386,889 | Difference between creating new object and dependency injection | <p>What is the difference between creating a new object and dependency injection? Please explain in detail.</p> | 3,386,918 | 6 | 0 | null | 2010-08-02 10:31:40.18 UTC | 15 | 2020-04-12 12:33:13.627 UTC | 2010-08-02 10:33:44.81 UTC | null | 57,095 | null | 381,737 | null | 1 | 29 | java|object|dependency-injection | 35,235 | <p>Well,
creating a new object is as explicit as it can get - you create a new instance of the desired class.</p>
<p>Dependency injections is a mechanism that provides you with references where you need them.
Imagine a class that represents a connection pool to your database - you usually only have one instance of tha... |
3,763,846 | What is an in-place constructor in C++? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/222557/cs-placement-new">C++'s “placement new”</a> </p>
</blockquote>
<p>What is an in-place constructor in C++?</p>
<p>e.g. <code>Datatype *x = new(y) Datatype();</code></p> | 3,763,887 | 6 | 1 | null | 2010-09-21 19:44:05.933 UTC | 9 | 2020-06-15 22:40:48.503 UTC | 2020-06-15 22:40:48.503 UTC | null | 1,783,163 | null | 249,560 | null | 1 | 30 | c++|constructor|placement-new|in-place | 43,428 | <p>This is called the placement new operator. It allows you to supply the memory the data will be allocated in without having the <code>new</code> operator allocate it. For example:</p>
<pre><code>Foo * f = new Foo();
</code></pre>
<p>The above will allocate memory for you.</p>
<pre><code>void * fm = malloc(sizeof(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.