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
30,574,322
MemberData tests show up as one test instead of many
<p>When you use <code>[Theory]</code> together with <code>[InlineData]</code> it will create a test for each item of inline data that is provided. However, if you use <code>[MemberData]</code> it will just show up as one test.</p> <p>Is there a way to make <code>[MemberData]</code> tests show up as multiple tests?</p>
32,218,948
5
4
null
2015-06-01 13:05:53.267 UTC
9
2020-09-16 21:20:25.407 UTC
2017-09-14 15:26:02.007 UTC
null
247,702
null
2,838,509
null
1
49
c#|xunit.net|data-driven-tests|xunit2
19,286
<p>I spent a lot of time trying to figure this one out in my project. <a href="https://github.com/xunit/xunit/issues/429" rel="noreferrer">This related Github discussion</a> from @NPadrutt himself helped a lot, but it was still confusing.</p> <p>The tl;dr is this: <code>[MemberInfo]</code> will report a single group t...
18,616,414
Read line-by-line file and split values
<p>I need to read a txt file composed as follow:</p> <pre><code> AA=1000,AA=320009#999999 AA=1011,AA=320303#111111 </code></pre> <p>for each readed line I need to split it by "#" to get at the first turn </p> <pre><code> $test[0] = AA=1000,AA=320009 and $test[1]=999999 </code></pre> <p>and at the second...
18,616,767
3
0
null
2013-09-04 14:20:58.463 UTC
null
2021-10-28 08:20:48.147 UTC
null
null
null
null
1,157,530
null
1
5
powershell|powershell-2.0
56,368
<pre><code># Basically, Get-Content will return you an array of strings such as below: # $tests = Get-Content "c:\myfile\path\mytests.txt" $tests = @( "AA=1000,AA=320009#999999", "AA=1011,AA=320303#111111" ) $tests | %{ $test = $_ -split '#'; Write-Host $test[0]; Write-Host $test[1] } </code></pre> <p>The li...
5,063,878
How to cleanly deal with global variables?
<p>I have a number of aspx pages (50+). I need to declare a number(5-7) of global variables in each of these pages. Variables in one page independent of the other pages even though some might be same.</p> <p>Currently I am declaring at the page top and outside of any function.</p> <p>Should I approach this different...
5,064,235
3
3
null
2011-02-21 08:47:50.787 UTC
13
2020-05-28 04:00:46.793 UTC
2014-09-03 23:36:40.247 UTC
null
2,864,740
null
182,305
null
1
40
javascript|global-variables
23,993
<p>It is best practice to not clutter the global scope. Especially since other frameworks or drop-in scripts can pollute or overwrite your vars.</p> <p>Create a namespace for yourself</p> <p><a href="https://www.geeksforgeeks.org/javascript-namespace/" rel="nofollow noreferrer">https://www.geeksforgeeks.org/javascrip...
5,276,915
Do common JavaScript implementations use string interning?
<p>Do common JavaScript engines, such as V8 and WebKit's JavaScriptCore, use <a href="http://en.wikipedia.org/wiki/String_interning" rel="noreferrer">string interning</a> for JavaScript strings? Or do they actually keep multiple instances of identical strings in memory?</p>
5,276,975
3
0
null
2011-03-11 18:34:15.77 UTC
7
2021-05-21 00:55:58.853 UTC
null
null
null
null
100,335
null
1
46
javascript|programming-languages|webkit|v8|string-interning
9,147
<p>Yes. In general any literal string, identifier, or other constant string in JS source is interned. However implementation details (exactly what is interned for instance) varies, as well as when the interning occurs.</p> <p>Note that a string value is not the same as a String Object though, String Objects are not ...
5,461,796
How to Convert a Float String to Number?
<p>A1 is formatted as text and contains a decimal number I would like to programmatically convert to a number.</p> <p>The "convert to number" function N() only works with whole numbers apparently.</p> <p>Trying a trick like =A1+0 seems to similarly only work with whole numbers.</p>
5,461,887
4
1
null
2011-03-28 16:04:50.517 UTC
1
2019-04-03 14:19:51.61 UTC
null
null
null
null
304,410
null
1
5
excel
41,650
<p>Use the function</p> <pre><code>value(A1) </code></pre> <p>to convert a string to a number.</p>
9,252,712
Twitter Bootstrap: What is the correct way to use the `.btn` class within a navbar?
<p>I'm using a navbar for the standard nav stuff and i'd like to include a button for Sign in and Sign up.</p> <p>The I'm using an <code>a</code> tag with the <code>btn btn-large btn-success</code> classes and by default it appears the navbar does not accommodate the use of nested <code>btn</code>s.</p> <p>The result...
9,253,556
6
4
null
2012-02-12 21:12:38.543 UTC
21
2013-07-13 22:46:35.627 UTC
2012-02-13 04:23:06.62 UTC
null
365,858
null
365,858
null
1
61
css|navigation|twitter-bootstrap|css-frameworks
48,180
<p>The navbar accommodates buttons without a problem - I have buttons in the navbar without any problems, and I was able to add them to the <a href="http://twitter.github.com/bootstrap/components.html#navbar" rel="noreferrer">static navbar example on the Bootstrap page</a>:</p> <p><img src="https://i.stack.imgur.com/5...
18,292,578
What does Git (master|REBASE 1/1) mean? How do I get rid of it?
<p>I'm kind of a <a href="/questions/tagged/git" class="post-tag" title="show questions tagged &#39;git&#39;" rel="tag">git</a> beginner and I was attempting to roll back to a previous commit. But I accidentally just rolled back the commit (I was using the Windows GUI). Anyway, after some weird pushing, merging, and ot...
18,292,656
5
0
null
2013-08-17 19:31:37.15 UTC
7
2020-11-18 07:36:53.723 UTC
2020-11-18 07:36:53.723 UTC
null
2,265,151
null
1,542,306
null
1
34
git|version-control|git-branch|rebase
39,357
<p>You are stuck in the middle of a rebase. </p> <p>If you have merged/solved conflicts for all the paths:<br> use <code>git add .</code> to commit resolved items.<br> use <code>git rebase --continue</code> to complete the process. </p> <p>Or use <code>git rebase --abort</code> to exit the rebase process without an...
18,445,825
how to know status of currently running jobs
<p>I need to know if a given Job is currently running on Ms SQL 2008 server. So as to not to invoke same job again that may lead to concurrency issues.</p>
18,446,365
9
1
null
2013-08-26 13:52:31.723 UTC
11
2019-02-14 07:01:29.15 UTC
2018-02-09 05:53:53.717 UTC
null
2,067,941
null
225,394
null
1
73
sql-server|sql-server-2008|tsql|sql-agent
284,341
<p>It looks like you can use <code>msdb.dbo.sysjobactivity</code>, checking for a record with a non-null start_execution_date and a null stop_execution_date, meaning the job was started, but has not yet completed.</p> <p>This would give you currently running jobs:</p> <pre><code>SELECT sj.name , sja.* FROM msdb.db...
19,986,089
__init__() got an unexpected keyword argument 'user'
<p>i am using Django to create a user and an object when the user is created. But there is an error</p> <p><code>__init__() got an unexpected keyword argument 'user'</code></p> <p>when calling the <code>register()</code> function in view.py. The function is:</p> <pre><code>def register(request): '''signup view...
19,986,188
4
2
null
2013-11-14 18:59:59.197 UTC
8
2020-11-23 20:21:42.117 UTC
2013-11-14 19:12:06.99 UTC
null
1,572,562
null
2,284,861
null
1
40
python|django|django-models|django-forms|django-views
154,428
<p>You can't do</p> <pre><code>LivingRoom.objects.create(user=instance) </code></pre> <p>because you have an <code>__init__</code> method that does NOT take <code>user</code> as argument.</p> <p>You need something like</p> <pre><code>#signal function: if a user is created, add control livingroom to the user def cre...
15,186,520
scala - Any vs underscore in generics
<p>What is the different between the following Generics definitions in Scala:</p> <pre><code>class Foo[T &lt;: List[_]] </code></pre> <p>and </p> <pre><code>class Bar[T &lt;: List[Any]] </code></pre> <p>My gut tells me they are about the same but that the latter is more explicit. I am finding cases where the former...
15,204,140
2
1
null
2013-03-03 14:07:32.683 UTC
42
2019-02-22 20:27:52.493 UTC
2019-02-22 20:27:52.493 UTC
null
2,707,792
null
1,906,491
null
1
81
scala|generics|covariance|any|existential-type
17,002
<p>OK, I figured I should have my take on it, instead of just posting comments. Sorry, this is going to be long, if you want the TL;DR skip to the end.</p> <p>As Randall Schulz said, here <code>_</code> is a shorthand for an existential type. Namely,</p> <pre><code>class Foo[T &lt;: List[_]] </code></pre> <p>is a sh...
15,405,916
Correct way to load a Nib for a UIView subclass
<p>I am aware this question has been asked before but the answers are contradicting and I am confused, so please don't flame me.</p> <p>I want to have a reusable <code>UIView</code> subclass throughout my app. I want to describe the interface using a nib file.</p> <p>Now let's say it's a loading indicator view with a...
15,406,012
6
3
null
2013-03-14 09:51:23.14 UTC
24
2017-04-10 07:57:46.45 UTC
2017-03-16 16:49:28.847 UTC
null
1,032,372
null
1,050,447
null
1
100
iphone|ios|objective-c|uiview|xib
104,528
<pre><code>MyViewClass *myViewObject = [[[NSBundle mainBundle] loadNibNamed:@"MyViewClassNib" owner:self options:nil] objectAtIndex:0] </code></pre> <p>I'm using this to initialise the reusable custom views I have.</p> <hr> <p>Note that you can use <strong>"firstObject"</strong> at the end there, it's a little clean...
15,208,711
Mongoose subdocuments vs nested schema
<p>I'm curious as to the pros and cons of using subdocuments vs a deeper layer in my main schema:</p> <pre><code>var subDoc = new Schema({ name: String }); var mainDoc = new Schema({ names: [subDoc] }); </code></pre> <p>or </p> <pre><code>var mainDoc = new Schema({ names: [{ name: String }] }); </code></...
16,493,881
6
4
null
2013-03-04 18:43:00.807 UTC
32
2019-11-06 15:28:21.58 UTC
2016-01-28 22:29:39.013 UTC
null
23,501
null
856,498
null
1
147
javascript|node.js|mongodb|mongoose
118,903
<p>According to <a href="http://mongoosejs.com/docs/subdocs.html#altsyntax" rel="noreferrer">the docs</a>, it's exactly the same. However, using a Schema would add an <code>_id</code> field as well (as long as you don't have that disabled), and presumably uses some more resources for tracking subdocs.</p> <blockquote>...
28,114,352
java.lang.IllegalArgumentException: Illegal character in scheme at index 0: localhost
<p>I'am developping an android app that receive an data from server (localhost - mssql and nodejs), save data and then display it</p> <p>after receiving the server response I get this error</p> <p>I follow the instructions below <a href="http://spring.io/guides/gs/consuming-rest-android/" rel="noreferrer">enter link ...
33,211,847
6
2
null
2015-01-23 16:29:19.233 UTC
2
2022-08-18 01:36:45.097 UTC
2015-01-23 16:33:18.073 UTC
null
2,711,488
null
3,468,921
null
1
16
java|localhost|spring-android
48,121
<p>you should remove space from url and define scheme <code>http</code> or <code>https</code></p>
45,142,080
Why can't constructors be explicitly called while destructors can?
<p>In the following C++ code, I am allowed to explicitly call the destructor but not the constructor. Why is that? Wouldn't be explicit ctor call more <strong>expressive</strong> and <strong>unified</strong> with the dtor case?</p> <pre><code>class X { }; int main() { X* x = (X*)::operator new(sizeof(X)); new (x)...
45,142,200
3
12
null
2017-07-17 10:40:51.417 UTC
4
2017-09-14 21:17:27.073 UTC
2017-09-14 21:17:27.073 UTC
null
963,864
null
580,083
null
1
28
c++|constructor|destructor|placement-new|explicit-destructor-call
4,151
<p>Because before the constructor is started, there is no object of type <code>X</code> at that address. As such, dereferencing <code>x</code> as an <code>X</code> type or accessing members/methods of it would be Undefined Behavior.</p> <p>So the major difference between <code>x-&gt;X();</code> (hypothetical syntax) a...
7,882,074
How do you set one array's values to another array's values in Java?
<p>Lets say you had two arrays:</p> <pre><code> int[] a = {2, 3, 4}; int[] b = {4, 5, 6}; </code></pre> <p>How would you set array a to array b and keep them different different objects? Like I thought of doing this:</p> <pre><code> a = b; </code></pre> <p>But that doesn't work since it just makes "a" re...
7,882,095
2
1
null
2011-10-24 21:15:08.847 UTC
7
2017-10-26 12:57:38.833 UTC
2015-11-03 04:56:31.32 UTC
null
597,657
null
906,497
null
1
8
java|arrays
91,429
<p>You may want to use <code>clone</code>:</p> <pre><code>a = b.clone(); </code></pre> <p>or use <code>arraycopy(Object source, int sourcePosition, Object destination, int destinationPosition, int numberOfElements)</code></p> <pre><code>System.arraycopy(b, 0, a, 0, b.length()); </code></pre>
7,842,393
Create a div with bottom half one color and top half another color
<p>I have a which I am going to make into a button. The top half should be #ffd41a and the bottom half should be #fac915. Here is a link to the button at present. <a href="http://jsfiddle.net/WnwNW/">http://jsfiddle.net/WnwNW/</a></p> <p>The problem that I'm facing is how should I deal with two background colors. Is ...
7,842,446
2
0
null
2011-10-20 21:19:34.503 UTC
2
2022-03-05 23:37:46.793 UTC
null
null
null
null
155,726
null
1
16
html|css
44,426
<p>CSS3 provides a way to do this</p> <pre><code>background-image: linear-gradient(to bottom, #FFD51A 50%, #FAC815 50%); background-image: -o-linear-gradient(bottom, #FFD51A 50%, #FAC815 50%); background-image: -moz-linear-gradient(bottom, #FFD51A 50%, #FAC815 50%); background-image: -webkit-linear-gradient(bottom, #FF...
8,352,708
How to check if file already exists in the folder
<p>I am trying to copy some files to folder. I am using the following statement to check if the source fie exists</p> <pre> If My.Computer.FileSystem.FileExists(fileToCopy) Then</pre> <p>But I donot know how to check if file exists in the folder before copying. Please advise.</p> <p>Thanks and best regards, Furqan<...
8,353,425
2
2
null
2011-12-02 06:48:16.487 UTC
3
2019-12-27 08:41:58.677 UTC
null
null
null
null
415,037
null
1
18
vb.net
160,420
<pre><code>Dim SourcePath As String = "c:\SomeFolder\SomeFileYouWantToCopy.txt" 'This is just an example string and could be anything, it maps to fileToCopy in your code. Dim SaveDirectory As string = "c:\DestinationFolder" Dim Filename As String = System.IO.Path.GetFileName(SourcePath) 'get the filename of the origin...
8,314,827
How can I specialize a template member function for std::vector<T>
<p>I need to define a get method in two different ways. One for simple types T. And once for std::vector.</p> <pre><code>template&lt;typename T&gt; const T&amp; Parameters::get(const std::string&amp; key) { Map::iterator i = params_.find(key); ... return boost::lexical_cast&lt;T&gt;(boost::get&lt;std::stri...
8,315,197
2
1
null
2011-11-29 17:12:17.34 UTC
5
2014-02-02 15:20:40.807 UTC
2011-11-29 17:15:52.413 UTC
null
248,123
null
992,460
null
1
28
c++|templates
9,113
<p><strong>Don't specialize function template.</strong> </p> <ul> <li><a href="http://www.gotw.ca/publications/mill17.htm">Why Not Specialize Function Templates?</a></li> <li><a href="http://www.gotw.ca/gotw/049.htm">Template Specialization and Overloading</a></li> </ul> <p><strong>Instead, use overload.</strong> </p...
8,120,466
Missalignment with inline-block (other elements pushed down)
<p>I'm trying to align small boxes in a row. These boxes have something like 2 elements in each. In some cases, the first element is so "much" text, that it splits into 2 lines. If this happens, all other blocks in this special line are shown below.</p> <p>Long story short, here is the example: <a href="http://jsfiddl...
8,120,546
2
1
null
2011-11-14 10:48:38.287 UTC
9
2016-12-24 07:20:50.81 UTC
2016-12-24 07:17:26.477 UTC
null
2,142,994
null
490,647
null
1
41
html|css|row|offset
32,592
<p><a href="http://jsfiddle.net/PMRQ5/1/" rel="noreferrer">http://jsfiddle.net/PMRQ5/1/</a></p> <p>Add <code>vertical-align: top</code> or <code>vertical-align: bottom</code> to the box, depends on what you want.</p>
5,079,525
MVC ViewModels and Entity Framework queries
<p>I am new to both MVC and Entity Framework and I have a question about the right/preferred way to do this.</p> <p>I have sort of been following the Nerd Dinner MVC application for how I am writing this application. I have a page that has data from a few different places. It shows details that come from a few differe...
5,079,784
5
1
null
2011-02-22 14:41:36.263 UTC
13
2013-06-07 14:00:07.997 UTC
2012-06-29 05:40:38.263 UTC
null
503,969
null
143,919
null
1
19
c#|asp.net-mvc|entity-framework|repository-pattern|viewmodel
10,967
<p>You are correct a repository should not return a view model. As changes to your view will cause you to change your data layer.</p> <p>Your repository should be an <a href="https://stackoverflow.com/questions/1958621/whats-an-aggregate-root">aggregate root</a>. If your property1, property2, Foo, Bar are related in...
5,218,927
z-index not working with fixed positioning
<p>I have a <code>div</code> with default positioning (i.e. <code>position:static</code>) and a <code>div</code> with a <code>fixed</code> position.</p> <p>If I set the z-indexes of the elements, it seems impossible to make the fixed element go behind the static element.</p> <p><div class="snippet" data-lang="js" data-...
42,076,701
9
0
null
2011-03-07 11:09:36.48 UTC
82
2022-05-20 04:17:39.22 UTC
2020-07-29 23:54:49.413 UTC
null
214,143
null
43,965
null
1
486
css|z-index
592,495
<p>This question can be solved in a number of ways, but really, knowing the stacking rules allows you to find the best answer that works for you.</p> <h1>Solutions</h1> <p>The <code>&lt;html&gt;</code> element is your only stacking context, so just follow the stacking rules inside a stacking context and you will see ...
5,387,371
How to convert minutes to Hours and minutes (hh:mm) in java
<p>I need to convert minutes to hours and minutes in java. For example 260 minutes should be 4:20. can anyone help me how to do convert it.</p>
5,387,398
14
2
null
2011-03-22 05:51:37.517 UTC
23
2021-07-19 17:19:34.967 UTC
2021-07-19 17:19:34.967 UTC
null
642,706
null
2,405,181
null
1
86
java
186,648
<p>If your time is in a variable called <code>t</code></p> <pre><code>int hours = t / 60; //since both are ints, you get an int int minutes = t % 60; System.out.printf(&quot;%d:%02d&quot;, hours, minutes); </code></pre> <p>It couldn't get easier</p> <p><strong>Addendum from 2021:</strong></p> <p>Please notice that this...
16,987,692
can I write a loop for css
<p>I have a scenario where I am getting ID generated like this </p> <pre><code>&lt;div class="containerLength"&gt; &lt;div id="new-1"&gt;&lt;/div&gt; &lt;div id="new-2"&gt;&lt;/div&gt; &lt;div id="new-3"&gt;&lt;/div&gt; &lt;div id="new-4"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>and so on</p> <p>is there a way ...
16,987,767
5
9
null
2013-06-07 15:25:05.807 UTC
4
2013-06-07 15:42:02.793 UTC
null
null
null
null
1,315,393
null
1
12
css
46,701
<p>You can't do loops with pure CSS, however, if you're using something like SASS or LESS then you can do both like:</p> <p><strong>SASS</strong>:</p> <pre><code>@for $i from 1 through 4 .#{$class-slug}-#{$i} width: 60px + $i </code></pre> <p><strong>LESS</strong>:</p> <p><a href="https://stackoverflow.com/qu...
41,660,150
How to print the value of variable in java
<pre><code>System.out.printf("The Sum is %d%n" , sum); </code></pre> <p>and the error is The method printf(String, Object[]) in the type PrintStream is not applicable for the arguments (String, int)</p> <pre><code>System.out.printf("The sum is " + sum); </code></pre> <p>Works but What if i need to print</p> <block...
41,660,305
3
3
null
2017-01-15 10:34:38.467 UTC
2
2018-09-20 08:56:56.993 UTC
2017-01-15 10:36:45.727 UTC
null
335,858
null
6,932,421
null
1
4
java
124,533
<p>If <code>System.out.printf</code> is giving you this error:</p> <pre><code> The method printf(String, Object[]) in the type PrintStream is not applicable for the arguments (String, int) </code></pre> <p>Then you must configure your project for the proper Java version.</p> <p>Methods with variable arguments were i...
41,627,631
Exclude/overwrite npm-provided typings
<p>I've got an npm package with badly written, out of date typings. I've written my own typings and now I'm wondering if I can somehow exclude the original typings from the npm package. It's not a simple extension of interfaces, the originals are basically garbage at this point.</p> <p>Using the exclude list in tsconf...
41,641,001
2
3
null
2017-01-13 04:56:28.867 UTC
10
2018-06-18 10:04:14.167 UTC
null
null
null
null
727,944
null
1
35
typescript|typescript-typings
10,946
<p>You can get the desired behavior with the paths option in the tsConfig It could look something like this:</p> <pre><code>{ "compilerOptions": { ... "paths": { "*": [ "src/*", "declarations/*" ] } }, ... } </code></pre> <p>Wi...
12,463,091
iOS background Location not sending http request
<p>My app needs to track the users location in the background but it is failing to send a 'get' request. The http request gets sent immediately when the app comes to the foreground. I am using RestKit for all my network requests and I followed <a href="http://www.mindsizzlers.com/2011/07/ios-background-location/" rel="...
12,558,104
3
3
null
2012-09-17 16:05:43.67 UTC
12
2012-09-25 17:04:06.417 UTC
2017-05-23 12:32:42.543 UTC
null
-1
null
976,975
null
1
12
iphone|ios|ios5|nsurlconnection|restkit
5,405
<p>Re-creating original suggestion as an answer</p> <blockquote> <p>Have your try replacing your restKit calls with a stock synchronous NSURLConnection? – dklt Sep 20 </p> </blockquote>
12,072,500
Apache CXF - None of the policy alternatives can be satisfied
<p>I'm trying to create client of 3rd party WS. My app is running on JBoss AS 6 (with its Apache CXF 2.3.1 stack). I generated client code by wsconsume (wsdl2java). When I tried to connect to WS a got exception:</p> <pre><code>No assertion builder for type http://schemas.microsoft.com/ws/06/2004/policy/http}BasicAuthe...
12,090,592
3
0
null
2012-08-22 11:52:40.857 UTC
9
2016-09-29 09:54:05.127 UTC
null
null
null
null
1,616,779
null
1
14
java|cxf
33,884
<p>The problem gone when I used this code:</p> <pre><code>import org.apache.cxf.endpoint.Client; import org.apache.cxf.frontend.ClientProxy; import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; import org.apache.cxf.transport.http.HTTPConduit; ... JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); //factory...
12,131,789
How to disable subtitles decoding in ffmpeg
<p>I'm trying to convert some video file containing <em>video</em>, <em>audio</em> and <em>subtitles</em> streams into another format using <strong>FFMpeg</strong>. However, ffmpeg complains about the <em>subtitles</em> format - it cannot decode the stream. Since I don't need this subtitles stream, I'd like to know how...
12,175,153
3
1
null
2012-08-26 16:27:01.89 UTC
10
2020-06-16 21:18:35.89 UTC
null
null
null
null
1,091,054
null
1
35
video|stream|ffmpeg|video-encoding|subtitle
50,464
<p>I've finally found an answer.</p> <p>There is such option as <code>-sn</code> which disables subtitles decoding from input stream. Also there are analogous options for audio and video decoding: <code>-an</code> and <code>-vn</code> respectively.</p> <p>It also turned out that there is another way to achieve this. ...
12,422,473
@Nullable input in Google Guava Function interface triggers FindBugs warning
<p>The <code>com.google.common.base.Function</code> interface (from <a href="http://code.google.com/p/guava-libraries/wiki/Release13">Google Guava</a>) defines <code>apply</code> as:</p> <p><code>@Nullable T apply(@Nullable F input);</code> </p> <p>The method has the following javadoc note:</p> <p><code>@throws Null...
12,422,809
3
2
null
2012-09-14 10:13:14.293 UTC
9
2017-07-28 09:39:54.843 UTC
2012-09-14 10:31:39.12 UTC
null
954,570
null
954,570
null
1
35
java|guava|findbugs
15,498
<p>Your implementation is wrong ;)</p> <p>Basically docs says (I'll paraphrase and emphasise):</p> <blockquote> <p><code>@throws NullPointerException</code> if <code>input</code> is null and <strong>the concrete function implementation</strong> does not accept null arguments</p> </blockquote> <p>By implementing ...
12,334,316
Give the Python Terminal a Persistent History
<p>Is there a way to tell the interactive Python shell to preserve its history of executed commands between sessions?</p> <p>While a session is running, after commands have been executed, I can arrow up and access said commands, I'm just wondering if there is some way for a certain number of these commands to be saved...
12,334,344
3
1
null
2012-09-08 20:43:36.357 UTC
7
2018-07-17 08:22:42.173 UTC
2012-09-08 20:44:26.337 UTC
null
707,111
null
1,378,292
null
1
37
python|linux|python-2.7
11,399
<p>Sure you can, with a small startup script. From <a href="http://docs.python.org/tutorial/interactive.html" rel="noreferrer">Interactive Input Editing and History Substitution</a> in the python tutorial:</p> <pre><code># Add auto-completion and a stored history file of commands to your Python # interactive interpret...
12,378,271
What does an object look like in memory?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/422830/structure-of-a-c-object-in-memory-vs-a-struct">Structure of a C++ Object in Memory Vs a Struct</a><br> <a href="https://stackoverflow.com/questions/1632600/memory-layout-c-objects">memory layout c++ object...
12,378,370
5
5
null
2012-09-11 21:36:22.637 UTC
38
2021-06-07 13:17:32.2 UTC
2017-05-23 12:10:15.51 UTC
null
-1
null
308,843
null
1
49
c++
42,934
<p>Static class members are treated almost exactly like global variables / functions. Because they are not tied to an instance, there is nothing to discuss regarding memory layout.</p> <p>Class member <em>variables</em> are duplicated for each instance as you can imagine, as each instance can have its own unique value...
12,539,006
Tooltips for mobile browsers
<p>I currently set the <code>title</code> attribute of some HTML if I want to provide more information:</p> <pre><code>&lt;p&gt;An &lt;span class="more_info" title="also called an underscore"&gt;underline&lt;/span&gt; character is used here&lt;/p&gt; </code></pre> <p>Then in CSS:</p> <pre><code>.more_info { border...
12,538,532
11
8
null
2012-09-21 19:52:02.833 UTC
27
2021-07-02 09:28:46.037 UTC
null
null
null
at.
326,389
null
1
77
mobile|mobile-website|tooltip|html
102,524
<p>You can fake the title tooltip behavior with Javascript. When you click/tab on an element with a <code>title</code> attribute, a child element with the title text will be appended. Click again and it gets removed.</p> <p>Javascript (done with jQuery):</p> <pre><code>$("span[title]").click(function () { var $titl...
3,676,004
Java API for encrypting / decrypting pdf files
<p>I need to encrypt and decrypt pdf files. Is there a free or low cost Java API that does that ? Basically I need to hide files from normal users. Any other suggestion on achieving that programatically ?</p> <p>Thanks, Deep</p>
3,676,337
3
1
null
2010-09-09 11:17:44.96 UTC
9
2017-12-13 06:00:07.997 UTC
null
null
null
null
306,631
null
1
9
java|pdf|encryption
23,100
<p>Using <a href="http://itextpdf.com/" rel="noreferrer">iText</a>:</p> <pre><code> // Assuming you provide the following yourself: File inputFile; File outputFile; String userPassword; String ownerPassword; // A bit-field containing file permissions. int permissions = PDFWriter.ALLOW_PRINTING | PDFWrite...
3,363,767
How do you virus scan a file being uploaded to your java webapp as it streams?
<p>Basically, I want to virus scan files as they are uploaded (before writing them to disk) to a web app. </p> <p>In particular, I'd like to integrate with "McAfee VirusScan Enterprise" (latest version).</p> <p>From a design and maintenance perspective, would it perhaps be better to scan certain paths at the firewall...
3,363,900
3
3
null
2010-07-29 14:50:03.023 UTC
19
2013-03-14 19:22:12.297 UTC
2017-05-23 11:33:13.693 UTC
null
-1
null
39,489
null
1
29
java|web-applications|antivirus|mcafee|antivirus-integration
43,179
<p>Check out Clamv ( <a href="http://www.clamav.net/" rel="noreferrer">http://www.clamav.net/</a> ) It is a open source anti-virus, and you can scan a stream. So you do not need to save the file for scanning it.</p> <p><a href="http://linux.die.net/man/1/clamscan" rel="noreferrer">http://linux.die.net/man/1/clamscan</...
3,638,953
Do TCP connections get moved to another port after they are opened?
<p>If a TCP socket server listens on port 28081 for incoming connections and then accepts a connection and start receiving data. Is the port that data is coming into still 28081 or does the port get changed.</p> <p>for example what port does the incoming data come to in the pseudo code below? Is it still 28081 or do...
3,639,017
3
1
null
2010-09-03 19:28:56.587 UTC
18
2012-09-19 16:26:27.497 UTC
2010-09-04 03:30:54.21 UTC
null
134,633
null
234,789
null
1
32
c|sockets|networking|tcp
19,896
<p>A TCP connection is uniquely identified by two <code>(IP address, TCP port)</code> tuples (one for each endpoint). So by definition, one can't <em>move</em> a port or IP address of a connection but just open a different one. </p> <p>If the server binds to port 28081 all accepted connections will have this port on t...
19,239,743
Create multiple tables using single .sql script file
<p>I have created multiple table in oracle xe 11g database and i have saved the script for each table in different .sql file. But i need to create all tables at once using single .sql file. I tried to run below script but it is creating only once table at once.</p> <pre><code>CREATE TABLE ACCOUNT_DETAILS_TB ( CUSTO...
19,239,848
2
8
null
2013-10-08 05:27:02.077 UTC
null
2013-10-08 09:23:39.587 UTC
2013-10-08 09:23:39.587 UTC
null
1,568,755
null
1,568,755
null
1
11
sql|database|oracle|oracle11g|oracle-sqldeveloper
93,642
<p>You need to separate the create table scripts with <code>/</code> or end the command with <code>;</code>, Try like this,</p> <pre><code>CREATE TABLE ACCOUNT_DETAILS_TB ( CUSTOMER_ID VARCHAR2(20) NOT NULL , ACCOUNT_ID VARCHAR2(20) NOT NULL ) / CREATE TABLE ADDRESS_DETAILS_TB ( ACCOUNT_ID VARCHAR2(20) NOT NULL , ADDR...
8,425,195
Vertically aligning my div within the body
<p>Is there a CSS way to vertically align my div within the body element?</p> <p>The thing is my div will have a different height each time, so its not constant.</p> <p>These are the things I've tried but they dont work:</p> <pre><code>body { vertical-align: middle; } #mainContent { vertical-align: middle; } /...
8,440,862
5
7
null
2011-12-08 01:54:29.2 UTC
11
2018-04-29 21:51:49.647 UTC
null
null
null
null
972,202
null
1
4
javascript|html|css
23,242
<p>Honestly, my opinion is often that if you're doing vertical alignment you should still be using a table. I know it's often frowned upon, but it is still the simplest and cleanest way to vertically center something. </p> <p>HTML</p> <pre><code>&lt;table&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt...
22,056,153
Designing UICollectionView cells in nib with Interface Builder (without storyboard)
<p>I am trying to design a custom <code>UICollectionViewCell</code> prototype (in Xcode 5.0.2), however Interface Builder doesn't let me add a cell to my <code>UICollectionView</code> while designing a nib. I can set the number of items (cells) and Interface Builder creates and displays cells perfectly if I'm using sto...
25,143,037
1
5
null
2014-02-26 23:53:32.583 UTC
3
2014-08-05 20:58:40.017 UTC
2017-05-23 12:17:26.303 UTC
null
-1
null
811,405
null
1
29
xcode|interface-builder|uicollectionview|nib|uicollectionviewcell
14,373
<p>The simple answer is no, this cannot be done. Think of a storyboard as a collection of XIBs. A XIB simply defines the facets of a particular view so that it can be constructed at runtime.</p> <p>Regarding collection views and their storyboard implementations, it's important to understand that a storyboard allows fo...
11,117,511
There was an exception running the extensions specified in the config file. Maximum request length exceeded
<p>I have a report part which deployed perfectly every time I made any changes until today.</p> <p>The report has around 20 links, and an image on it.</p> <p>I have added a table to it today, clicked deploy and it gave me the following error:</p> <pre><code>Error 1 There was an exception running the extensions s...
11,117,735
3
0
null
2012-06-20 10:22:11.323 UTC
1
2021-11-24 14:50:11.547 UTC
null
null
null
null
1,025,915
null
1
13
sql-server|sql-server-2008|reporting-services|bids
41,618
<p>I faced this problem recently. There is a property called <code>maxRequestLength</code> which needs to be increased in the machine and <code>web.config</code> file which is in the following location.</p> <pre><code>C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer </code></pre...
11,168,916
weak or strong for IBOutlet and other
<p>I have switched my project to ARC, and I don't understand if I have to use <code>strong</code> or <code>weak</code> for IBOutlets. Xcode do this: in interface builder, if a create a <code>UILabel</code> for example and I connect it with assistant editor to my <code>ViewController</code>, it create this:</p> <pre><c...
11,170,327
2
0
null
2012-06-23 10:55:01.87 UTC
33
2015-01-22 05:22:04.987 UTC
2015-01-22 05:22:04.987 UTC
null
1,400,768
null
678,833
null
1
31
ios|ios5|automatic-ref-counting|weak-references|strong-references
22,899
<p><strong>A rule of thumb</strong></p> <p><em>When a parent has a reference to a child object, you should use a <code>strong</code> reference. When a child has a reference to its parent object, you should use a <code>weak</code> reference or a <code>unsafe_unretained</code> one (if the former is not available). A ty...
10,953,070
How to debug "Vagrant cannot forward the specified ports on this VM" message
<p>I'm trying to start a Vagrant instance and getting the following message:</p> <pre><code>Vagrant cannot forward the specified ports on this VM, since they would collide with another VirtualBox virtual machine's forwarded ports! The forwarded port to 4567 is already in use on the host machine. To fix this, modify y...
11,037,995
15
2
null
2012-06-08 17:01:56.977 UTC
8
2021-10-19 15:24:44.067 UTC
null
null
null
null
329,700
null
1
50
vagrant
58,588
<p>As message says, the port collides with the host box. I would simply change the port to some other value on the host machine. So if I am getting error for</p> <pre><code>config.vm.forward_port 80, 1234 </code></pre> <p>then I would change it to </p> <pre><code>config.vm.forward_port 80, 5656 </code></pre> <p>As ...
11,029,294
Android: How to programmatically access the device serial number shown in the AVD manager (API Version 8)
<p>How do I programmatically access the value shown in the image below ?</p> <p><img src="https://i.stack.imgur.com/J7vWU.png" alt="enter image description here"></p>
11,029,386
6
1
null
2012-06-14 08:25:29.523 UTC
17
2022-06-03 10:11:21.617 UTC
2013-10-22 19:22:03.14 UTC
null
58,074
null
604,383
null
1
61
android|serial-number
131,925
<p>This is the hardware serial number. To access it on</p> <ul> <li><p><strong>Android Q</strong> (>= SDK 29) <code>android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE</code> is required. Only system apps can require this permission. If the calling package is the device or profile owner then the <code>READ_PHONE_...
10,936,059
How to convert items in array to a comma separated string in PHP?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/2435216/how-to-create-comma-separated-list-from-array-in-php">How to create comma separated list from array in PHP?</a> </p> </blockquote> <p>Given this array:</p> <pre><code>$tags = array('tag1','tag2','tag3'...
10,936,075
4
2
null
2012-06-07 16:37:16.747 UTC
3
2012-06-07 16:57:44.197 UTC
2017-05-23 11:55:07.183 UTC
null
-1
null
1,385,112
null
1
67
php|arrays
113,549
<p>Use <a href="http://php.net/implode" rel="noreferrer">implode</a>:</p> <pre><code> $tags = implode(', ', array('tag1','tag2','tag3','tag4')); </code></pre>
11,270,753
Underscores or camelCase in PostgreSQL identifiers, when the programming language uses camelCase?
<p>This has been bothering me for a while, and I can't arrive at a solution that feels <i>right</i>...</p> <p>Given an OO language in which the usual naming convention for object properties is camelCased, and an example object like this:</p> <pre><code>{ id: 667, firstName: "Vladimir", lastName: "Horowitz...
11,271,763
3
2
null
2012-06-30 01:27:29.913 UTC
10
2020-04-17 18:04:57.867 UTC
2012-06-30 02:06:08.85 UTC
null
169,603
null
169,603
null
1
73
oop|postgresql|database-design|naming-conventions|camelcasing
39,671
<p>Given that PostgreSQL uses case-insensitive identifiers with underscores, should you change all your identifiers in your application to do the same? Clearly not. So why do you think the reverse is a reasonable choice?</p> <p>The convention in PostgreSQL has come about through a mix of standards compliance and long-...
11,278,387
Is it possible to download an old APK for my app from Google Play?
<p>Over the last few months, I've published several revisions to my app. Unfortunately, I didn't keep copies of all the old APKs, and now I'd like to test upgrade from the old versions to my new version. Is there any way to download Google's copy of my old versions? The Google Play developer console shows my old APKs, ...
11,278,480
9
1
null
2012-06-30 23:17:10.48 UTC
13
2022-02-20 17:47:51.757 UTC
null
null
null
null
342,647
null
1
117
android|google-play
83,801
<p><strong>THE ANSWER IS OUTDATED. NOW THIS IS POSSIBLE, CHECK <a href="https://stackoverflow.com/a/40037886/944070">@tesla's</a> AND <a href="https://stackoverflow.com/a/40759979/944070">@olleh's</a> ANSWERS.</strong></p> <p><strong>FOR THE NEW 2020 GOOGLE PLAY CONSOLE, SEE ANSWER FROM <a href="https://stackoverflow.c...
10,944,621
Dynamically updating plot in matplotlib
<p>I am making an application in Python which collects data from a serial port and plots a graph of the collected data against arrival time. The time of arrival for the data is uncertain. I want the plot to be updated when data is received. I searched on how to do this and found two methods:</p> <ol> <li>Clear the plo...
10,944,967
4
1
null
2012-06-08 07:22:07.973 UTC
72
2020-02-03 08:41:43.287 UTC
2012-06-08 09:05:34.117 UTC
null
885,443
null
1,418,822
null
1
140
python|matplotlib|tkinter
278,280
<blockquote> <p><em>Is there a way in which I can update the plot just by adding more point[s] to it...</em></p> </blockquote> <p>There are a number of ways of animating data in matplotlib, depending on the version you have. Have you seen the <a href="http://www.scipy.org/Cookbook/Matplotlib/Animations">matplotlib c...
12,929,848
how make float to integer in awk
<p>I have a variable in my awk code . after some arithmatic operation on this variable and printing (<code>print $1,$2,variable</code>) the result is made like below:</p> <p><strong>my result</strong></p> <pre><code>Bama 2 5 Bama 2 5.001 Bama 2 5.002 Bama 2 5.003 Bama 2 5.004 Bama ...
12,929,974
2
1
null
2012-10-17 08:10:09.347 UTC
3
2020-08-16 16:35:57.457 UTC
2012-10-17 08:21:31.327 UTC
user647772
null
null
1,728,917
null
1
25
awk
45,258
<p>Truncate it using the <code>int</code> function:</p> <pre><code>print $1, $2, int( variable ); </code></pre>
37,382,889
Can't get AWS Lambda function to log (text output) to CloudWatch
<p>I'm trying to set up a Lambda function that will process a file when it's uploaded to an S3 bucket. I need a way to see the output of <code>console.log</code> when I upload a file, but I can't figure out how to link my Lambda function to CloudWatch.</p> <p>I figured about by looking at the <code>context</code> obje...
37,383,297
16
7
null
2016-05-23 04:56:09.243 UTC
14
2021-12-03 12:42:32.79 UTC
null
null
null
null
5,228,806
null
1
99
amazon-web-services|aws-lambda|amazon-cloudwatch
77,937
<p>For the lambda function to create log stream and publish logs to cloudwatch, the lambda execution role needs to have the following permissions.</p> <pre class="lang-html prettyprint-override"><code>{ "Statement": [ { "Action": [ "logs:CreateLogGroup", "logs:C...
16,649,943
CSS to set A4 paper size
<p>I need simulate an A4 paper in web and allow to print this page as it is show on browser (Chrome, specifically). I set the element size to 21cm x 29.7cm, but when I send to print (or print preview) it clip my page.</p> <p>See this <a href="https://jsfiddle.net/2wk6Q/1/" rel="noreferrer"><strong>Live example</strong>...
16,650,459
3
3
null
2013-05-20 12:51:20.603 UTC
163
2021-04-14 15:19:43.88 UTC
2021-04-03 09:21:38.61 UTC
null
9,193,372
null
755,393
null
1
283
css|printing|print-preview
632,344
<p>I looked into this a bit more and the actual problem seems to be with assigning <code>initial</code> to page <code>width</code> under the <code>print</code> media rule. It seems like in Chrome <code>width: initial</code> on the <code>.page</code> element results in <em><strong>scaling</strong></em> of the page conte...
16,936,250
SharePoint 2013 add javascript after whole page load
<p>Disclaimer: I have no experience with SharePoint2013.</p> <p>I have problem - I must include/fire some javascript functions after the whole page has been loaded. I tried listening to DOMDocumentReady and window.load events, but sharepoint render the rest of page after those events.</p> <p>My question is: what I sh...
17,326,405
5
6
null
2013-06-05 09:27:25.95 UTC
18
2017-03-02 07:37:39.537 UTC
null
null
null
null
1,812,679
null
1
29
javascript|sharepoint-2013
100,438
<p>You are right, MANY things happen on page after $(document).ready(). 2013 does provide a few options. </p> <p>1) Script on Demand: (load a js file then execute my code.)</p> <pre><code>function stuffThatRequiresSP_JS(){ //your code } </code></pre> <p><code>SP.SOD.executeFunc("sp.js")</code></p> <p>2) Delay u...
17,080,494
Using grunt server, how can I redirect all requests to root url?
<p>I am building my first <a href="http://angularjs.org/" rel="noreferrer">Angular.js</a> application and I'm using <a href="http://yeoman.io/" rel="noreferrer">Yeoman</a>. </p> <p>Yeoman uses Grunt to allow you to run a node.js connect server with the command 'grunt server'.</p> <p>I'm running my angular application...
20,553,608
5
0
null
2013-06-13 06:22:42.993 UTC
22
2016-01-05 19:46:16.747 UTC
2017-05-23 11:54:17.563 UTC
null
-1
null
1,826,354
null
1
46
node.js|angularjs|gruntjs|yeoman|angularjs-routing
30,294
<p>First, using your command line, navigate to your directory with your gruntfile.</p> <p>Type this in the CLI: </p> <pre><code>npm install --save-dev connect-modrewrite </code></pre> <p>At the top of your grunt file put this:</p> <pre><code>var modRewrite = require('connect-modrewrite'); </code></pre> <p>Now the ...
17,073,688
How to use argparse subparsers correctly?
<p>I've been searching through a lot of the subparser examples on here and in general but can't seem to figure this seemingly simple thing out.</p> <p>I have two var types of which one has constraints so thought subparser was the way to go. e.g. -t allows for either &quot;A&quot; or &quot;B&quot;. If the user passes &q...
17,074,215
1
0
null
2013-06-12 19:28:27.06 UTC
12
2021-03-15 03:36:16.71 UTC
2021-03-15 03:36:16.71 UTC
null
1,214,800
null
1,571,144
null
1
72
python|argparse
95,054
<p>Subparsers are invoked based on the value of the first <em>positional</em> argument, so your call would look like</p> <pre><code>python test01.py A a1 -v 61 </code></pre> <p>The "A" triggers the appropriate subparser, which would be defined to allow a positional argument and the <code>-v</code> option.</p> <p>Bec...
25,677,035
How to create a range of dates in R
<p>From two integers <code>(1, 5)</code> one can create a range in the following way</p> <pre><code>1:5 </code></pre> <blockquote> <p>[1] 1 2 3 4 5</p> </blockquote> <p>How can you make a range of dates if you are give two dates <code>("2014-09-04 JST", "2014-09-11 JST")</code></p> <p>The output must be </p> <bl...
25,677,051
5
5
null
2014-09-05 00:40:52.87 UTC
8
2022-04-21 09:41:17.89 UTC
null
null
null
null
835,724
null
1
24
r|date
35,483
<p>Does this help?</p> <pre><code>seq(as.Date("2014/09/04"), by = "day", length.out = 5) # [1] "2014-09-04" "2014-09-05" "2014-09-06" "2014-09-07" "2014-09-08" </code></pre> <p><strong>edit: adding in something about timezones</strong></p> <p>this works for my current timezone</p> <pre><code>seq(c(ISOdate(2014,4,9)...
60,902,001
Why have i++; i--; right after each other?
<p>I was looking at the source code for <a href="https://en.wikipedia.org/wiki/Nmap" rel="noreferrer">nmap</a> that was released in 1997 and I noticed this section of code that looks a little odd to me:</p> <pre><code>int i=0, j=0,start,end; char *expr = strdup(origexpr); ports = safe_malloc(65536 * sizeof(short)); i+...
60,902,078
4
13
null
2020-03-28 13:51:55.027 UTC
8
2020-07-13 10:19:32.337 UTC
2020-04-03 12:58:48.64 UTC
null
2,102,457
null
12,134,095
null
1
166
c|nmap
11,301
<p>This was a bug. These lines together result in <code>i</code> being unchanged, so they shouldn't have been there.</p> <p>The linked article that introduced nmap was published on September 1 1997. If you look at the SVN repository for nmap at <a href="https://svn.nmap.org/nmap" rel="noreferrer">https://svn.nmap.or...
4,812,891
fork() and pipes() in c
<p>What is <code>fork</code> and what is <code>pipe</code>? Any scenarios explaining why their use is necessary will be appreciated. What are the differences between <code>fork</code> and <code>pipe</code> in C? Can we use them in C++?</p> <p>I need to know this is because I want to implement a program in C++ which c...
4,812,963
2
2
null
2011-01-27 04:57:59.227 UTC
18
2017-04-26 00:05:04.113 UTC
2017-04-26 00:05:04.113 UTC
null
556,595
null
590,198
null
1
35
c++|c
96,087
<p>A pipe is a mechanism for interprocess communication. Data written to the pipe by one process can be read by another process. The primitive for creating a pipe is the <code>pipe</code> function. This creates both the reading and writing ends of the pipe. It is not very useful for a single process to use a pipe to ta...
4,054,511
What exactly does the T-SQL "LineNo" reserved word do?
<p>I was writing a query against a table today on a SQL Server 2000 box, and while writing the query in Query Analyzer, to my surprise I noticed the word <code>LineNo</code> was converted to blue text. </p> <p>It appears to be a <a href="http://msdn.microsoft.com/en-us/library/aa238507(SQL.80).aspx" rel="noreferrer">...
4,054,590
2
0
null
2010-10-29 17:50:20.957 UTC
4
2018-07-17 15:37:05.583 UTC
2012-06-19 11:58:29.407 UTC
null
92,837
null
334,849
null
1
39
sql-server|tsql|sql-server-2000|reserved-words
7,813
<p>OK, this is completely undocumented, and I had to figure it out via trial and error, but it sets the line number for error reporting. For example:</p> <pre><code>LINENO 25 SELECT * FROM NON_EXISTENT_TABLE </code></pre> <p>The above will give you an error message, indicating an error at line 27 (instead of 3, if y...
4,412,848
XML Node to String in Java
<p>I came across this piece of Java function to convert an XML node to a Java String representation:</p> <pre><code>private String nodeToString(Node node) { StringWriter sw = new StringWriter(); try { Transformer t = TransformerFactory.newInstance().newTransformer(); t.setOutputProperty(OutputKe...
4,413,325
2
0
null
2010-12-10 20:07:54.393 UTC
6
2021-07-09 12:34:58.857 UTC
2021-07-09 12:34:58.857 UTC
null
8,764,150
null
203,175
null
1
41
java|xml
87,897
<p>You have an XML respesentation in a DOM tree.<br> For example you have opened an XML file and you have passed it in the DOM parser.<br> As a result a DOM tree in memory with your XML is created.<br> Now you can only access the XML info via traversal of the DOM tree.<br> If you need though, a String representation of...
4,212,877
When and how to use Tornado? When is it useless?
<p>Ok, Tornado is non-blocking and quite fast and it can handle a lot of standing requests easily.</p> <p>But I guess it's not a silver bullet and if we just blindly run Django-based or any other site with Tornado it won't give any performance boost.</p> <p>I couldn't find comprehensive explanation of this, so I'm as...
4,213,777
2
0
null
2010-11-18 08:29:04.31 UTC
35
2020-04-12 08:12:04.143 UTC
2010-11-18 08:47:57.583 UTC
null
240,424
null
411,934
null
1
87
python|asynchronous|nonblocking|tornado
29,460
<blockquote> <p>There is a server and a webframework. When should we use framework and when can we replace it with other one?</p> </blockquote> <p>This distinction is a bit blurry. If you are only serving static pages, you would use one of the fast servers like lighthttpd. Otherwise, most servers provide a varying c...
4,105,956
Regex - Does not contain certain Characters
<p>I need a regex to match if anywhere in a sentence there is NOT either &lt; or >.</p> <p>If either &lt; or > are in the string then it must return false.</p> <p>I had a partial success with this but only if my &lt; > are at the beginning or end:</p> <pre><code>(?!&lt;|&gt;).*$ </code></pre> <p>I am using .Net if ...
4,105,987
2
0
null
2010-11-05 12:50:04.383 UTC
42
2019-06-20 20:16:05.15 UTC
2019-06-20 20:16:05.15 UTC
null
16,287
null
105,254
null
1
376
regex|regex-negation
598,587
<pre><code>^[^&lt;&gt;]+$ </code></pre> <p>The caret in the character class (<code>[^</code>) means match anything but, so this means, beginning of string, then one or more of anything except <code>&lt;</code> and <code>&gt;</code>, then the end of the string.</p>
10,011,508
TextBox maximum amount of characters (it's not MaxLength)
<p>I'm using a <code>System.Windows.Forms.TextBox</code>. According to the docs, the <code>MaxLength</code> property controls the amount of characters enter a user can type or paste into the TextBox (i.e. more than that can be added programmatically by using e.g. the <code>AppendText</code> function or the <code>Text</...
10,013,009
3
3
null
2012-04-04 12:52:23.783 UTC
4
2017-08-19 09:54:19.773 UTC
2012-04-04 13:07:27.41 UTC
null
1,094,268
null
1,094,268
null
1
8
c#|.net|winforms
57,277
<ol> <li>Sure. Override / shadow <code>AppendText</code> and <code>Text</code> in a derived class. See code below.</li> <li>The backing field for the <code>Text</code> property is a plain old string (private field <code>System.Windows.Forms.Control::text</code>). So the maximum length is the max length of a string, whi...
9,880,841
Using list preference in Android
<p>I have a text to speech application where the user can select a language and also select a male or female voice. The problem is that for each language there are different strings used to called the male and female voice but in my preference I only have two options (male and female).</p> <pre><code>&lt;string-array ...
9,881,253
3
0
null
2012-03-26 22:31:41.427 UTC
9
2016-04-16 10:35:49.307 UTC
2012-03-26 22:48:17.61 UTC
null
645,270
null
647,423
null
1
31
android|preferences|text-to-speech|listpreference
78,184
<p>Ok, you can accomplish this with two <code>ListPreference</code>s and an <code>OnPreferenceChangeListener</code> for each. First the XML:</p> <pre><code>&lt;ListPreference android:key="language_preference" android:title="Language" android:entries="@array/Language" android:entryValues="@array/langua...
28,357,754
TypeError: range() integer end argument expected, got float?
<p>I know this has been asked before, but the answers did not help me :/</p> <p>I created a function that runs a for loop over the squared max of the inputs, and by all accounts my code is correct...and yet it still asks for float inputs.</p> <pre><code>def spiral(X, Y): x = y = 0 dx = 0 dy = 0 count = 0 for i in r...
28,357,822
1
7
null
2015-02-06 02:47:35.453 UTC
1
2019-09-19 11:21:06.76 UTC
null
null
null
null
3,470,746
null
1
9
python|floating-point
45,697
<p>Like others said in the comment, the problem is mainly because of the float value in range function. Because range function won't accept float type as an argument.</p> <pre><code>for i in range(max(int(X), int(Y))**2): </code></pre>
9,719,570
Generate random password string with requirements in javascript
<p>I want to generate a random string that has to have 5 letters from a-z and 3 numbers. </p> <p>How can I do this with JavaScript?</p> <p>I've got the following script, but it doesn't meet my requirements.</p> <pre><code> var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; v...
9,719,815
26
5
null
2012-03-15 12:21:02.213 UTC
52
2022-07-09 18:19:17.893 UTC
2021-02-15 15:24:38.78 UTC
null
12,340,179
null
1,193,449
null
1
133
javascript|random
195,414
<p>Forcing a fixed number of characters is a <strong>bad</strong> idea. It doesn't improve the quality of the password. Worse, it reduces the number of possible passwords, so that hacking by bruteforcing becomes easier.</p> <p>To generate a random word consisting of alphanumeric characters, use:</p> <pre><code>var ra...
9,985,559
Organizing a multiple-file Go project
<p>Note: this question is related to <a href="https://stackoverflow.com/questions/2182469/to-use-package-properly-how-to-arrange-directory-file-name-unit-test-file">this one</a>, but two years is a very long time in Go history.</p> <p>What is the standard way to organize a Go project during development ?</p> <p>My pr...
9,985,600
7
3
null
2012-04-03 00:20:13.693 UTC
72
2019-04-28 03:03:15.587 UTC
2017-11-10 08:48:49.503 UTC
null
3,218,674
null
820,664
null
1
252
go
152,871
<p>I would recommend reviewing this page on <a href="http://golang.org/doc/code.html" rel="noreferrer">How to Write Go Code</a></p> <p>It documents both how to structure your project in a <code>go build</code> friendly way, and also how to write tests. Tests do not need to be a cmd using the <code>main</code> package....
7,908,954
Google books API searching by ISBN
<p>I am trying to figure out how to search for a book by ISBN using the Google Books API. I need to write a program that searches for an ISBN then prints out the title, author, and edition. I tried using <code>List volumesList = books.volumes.list("");</code> but that did not allow me to search by ISBN and I did not se...
7,909,402
3
0
null
2011-10-26 21:09:31.95 UTC
16
2020-07-03 00:43:19.703 UTC
2020-07-03 00:43:19.703 UTC
null
11,407,695
null
968,117
null
1
32
java|isbn|google-books-api
54,970
<p>Are you using the <a href="http://code.google.com/apis/books/docs/gdata/developers_guide_java.html">deprecated data API</a>?</p> <p>With <a href="http://code.google.com/apis/books/docs/v1/using.html">Books API v1</a> (from Labs) you could use the query</p> <pre><code>https://www.googleapis.com/books/v1/volumes?q=i...
11,894,194
How to install ruby-oci8?
<p>I'm trying to install ruby-oci8 on OS X.</p> <p>I've tried installing both with and without <code>sudo</code>.</p> <p>Error Message without <code>sudo</code>:</p> <pre><code>gem install ruby-oci8 ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions into the /Library/Ruby...
21,443,313
12
2
null
2012-08-10 01:17:08.747 UTC
10
2021-06-30 05:22:00.167 UTC
2016-05-22 15:56:22.143 UTC
null
4,717,992
null
849,019
null
1
23
ruby|macos|oracle
22,368
<p>Slightly updated version of install of ruby-oci8 for 10.9/10.10/10.11OSX Mavericks/Yosemite/El Capitan - step-by-step:</p> <ol> <li>Go here: <a href="http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html">http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html</a></li> <li><strong>Download t...
12,001,502
How to easily reorder TabControl?
<p>I have a <code>TabControl</code> which I have designed in the VS2005 designer that has about 7 tabs.</p> <p>How can I easily switch the order of the tabs around?</p> <p>I put one tab at the end in a rush, but now I want it somewhere in the middle.</p>
12,001,571
3
0
null
2012-08-17 07:22:57.8 UTC
2
2021-04-03 09:36:28.323 UTC
2012-08-17 07:29:04.82 UTC
null
327,528
null
327,528
null
1
34
c#|winforms|visual-studio-2005|tabcontrol
36,847
<p>In the properties of the tab control there's a TabPages collection. You should be able to shuffle them around in there. Just click the ellipses next to TabPages and a dialog will appear allowing you to move each one up or down in the order.</p>
11,469,122
Run unit tests in IntelliJ IDEA from multiple modules together
<p>How can I run all tests from two or more IDEA modules at once? </p> <p>I'm using many modules and it is important to run all of the unit tests often and when I choose more than one folder to run, there's no 'run' option on the context menu any more.</p>
17,678,240
7
0
null
2012-07-13 10:57:12.013 UTC
27
2021-12-15 05:22:52.01 UTC
null
null
null
null
990,074
null
1
104
testing|intellij-idea
49,947
<p><strong>Best way way:</strong> (edit after 3 years)</p> <p>There is even a better way to achieve this. From the <a href="https://www.jetbrains.com/help/idea/run-debug-configuration-junit.html#configTab" rel="noreferrer">JetBrains JUnit Run Configuration docs</a>:</p> <ol> <li><p>Select menu &quot;Run&quot; → &quot;E...
11,939,166
How to override trait function and call it from the overridden function?
<p>Scenario:</p> <pre><code>trait A { function calc($v) { return $v+1; } } class MyClass { use A; function calc($v) { $v++; return A::calc($v); } } print (new MyClass())-&gt;calc(2); // should print 4 </code></pre> <p>This code doesn't work, and I cannot find a way to ca...
11,939,306
6
0
null
2012-08-13 17:19:28.17 UTC
65
2022-08-20 14:40:57.107 UTC
2022-08-10 17:59:24.907 UTC
null
7,319,250
null
635,786
null
1
444
php|traits
133,013
<p>Your last one was almost there:</p> <pre><code>trait A { function calc($v) { return $v+1; } } class MyClass { use A { calc as protected traitcalc; } function calc($v) { $v++; return $this-&gt;traitcalc($v); } } </code></pre> <p>The trait is not a class. You...
20,107,593
ASP.Net - It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level
<p>Getting this error on an intranet application we have running in our development environment, and I'm not sure where to go/look for a solution. The application used to work fine, however it is run on a shared server with another team of developers and we're having trouble tracking down the error (no updates were mad...
20,107,906
7
6
null
2013-11-20 21:39:43.777 UTC
null
2020-12-16 15:18:28.08 UTC
null
null
null
null
1,489,378
null
1
5
asp.net|iis|iis-6|windows-server-2003
51,559
<p>Bring up project properties page in Visual Studio. Right-click on project node in Solution Explorer and click properties. Look for the Web tab and click the button to create a virtual directory.</p>
3,613,074
MySQLi count(*) always returns 1
<p>I'm trying to count the number of rows in a table and thought that this was the correct way to do that:</p> <pre><code>$result = $db-&gt;query("SELECT COUNT(*) FROM `table`;"); $count = $result-&gt;num_rows; </code></pre> <p>But counts always returns <code>(int)1</code>. If I use the same query in phpMyAdmin I get...
3,613,087
4
0
null
2010-08-31 20:43:20.7 UTC
14
2021-02-01 18:18:24.847 UTC
null
null
null
null
230,422
null
1
45
php|mysql|mysqli
114,848
<p>You have to fetch that one record, it will contain the result of Count()</p> <pre><code>$result = $db-&gt;query("SELECT COUNT(*) FROM `table`"); $row = $result-&gt;fetch_row(); echo '#: ', $row[0]; </code></pre>
3,793,818
What is a good IDE for working with shell-scripting in a Windows environment?
<p>I have already learned shell-scripting in Linux environment.</p> <p>However, now I am unable to install Linux on my PC, but I need to practice shell-scripting.</p> <p>Currently, I have Windows XP installed on my PC. Is there any known IDE which can help me practice shell-scripting programs in windows environment?<...
3,805,108
5
6
null
2010-09-25 12:34:51.687 UTC
14
2016-01-05 13:57:05.827 UTC
2016-01-05 13:57:05.827 UTC
null
5,299,236
null
459,638
null
1
25
linux|bash|ide|windows-xp
59,447
<p>I found a cool <strong>Online</strong> IDE, which will perhaps help me to write simple bash scripts.</p> <p>Here it is: <a href="http://ideone.com" rel="noreferrer">Ideone.com</a></p>
3,737,077
WPF TextBox won't fill in StackPanel
<p>I have a <code>TextBox</code> control within a <code>StackPanel</code> whose <code>Orientation</code> is set to <code>Horizontal</code>, but can't get the TextBox to fill the remaining StackPanel space.</p> <p>XAML:</p> <pre><code>&lt;Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.micros...
3,737,120
6
0
null
2010-09-17 16:16:07.06 UTC
11
2022-07-11 10:28:30.637 UTC
null
null
null
null
172,387
null
1
105
.net|wpf
81,337
<p>I've had the same problem with <code>StackPanel</code>, and the behavior is &quot;by design&quot;. <code>StackPanel</code> is meant for &quot;stacking&quot; things even outside the visible region, so it won't allow you to fill remaining space in the stacking dimension.</p> <p>You can use a <code>DockPanel</code> wi...
3,780,543
How to pass an array into a PHP SoapClient call
<p>Using PHP and SoapClient.</p> <p>I need to pass the following XML into a soap request - i.e. multiple <code>&lt;stay&gt;</code>'s within <code>&lt;stays&gt;</code>.</p> <pre><code>&lt;reservation&gt; &lt;stays&gt; &lt;stay&gt; &lt;start_date&gt;2011-01-01&lt;/start_date&gt; &lt;...
15,981,533
7
6
null
2010-09-23 16:33:36.34 UTC
5
2021-12-02 10:37:27.807 UTC
2017-07-14 11:12:01.077 UTC
null
378,955
null
378,955
null
1
17
php|soap-client
39,463
<p>'stay' has to be defined just once. This should be the right answer:</p> <pre><code>$xml = array('reservation' =&gt; array( 'stays' =&gt; array( 'stay' =&gt; array( array( 'start_date' =&gt; '2011-01-01', 'end_date' =&gt; 2011-01-15 ...
3,888,517
Get iPhone Status Bar Height
<p>I need to resize some elements in relation to the height of the iPhone's Status Bar. I know that the status bar is usually 20 points high but this isn't the case when it's in tethering mode. It gets doubled to 40. What is the proper way to determine it's height? I've tried </p> <pre><code>[[UIApplication sharedAppl...
7,038,870
7
3
null
2010-10-08 07:33:33.677 UTC
17
2019-07-08 08:26:09.457 UTC
2019-07-08 08:26:09.457 UTC
null
1,306,012
null
435,471
null
1
62
iphone|statusbar
63,668
<p>The statusBarFrame returns the frame in screen coordinates. I believe the correct way to get what this corresponds to in view coordinates is to do the following:</p> <pre><code>- (CGRect)statusBarFrameViewRect:(UIView*)view { CGRect statusBarFrame = [[UIApplication sharedApplication] statusBarFrame]; CGRe...
3,419,847
What is a lookup table?
<p>I just gave a database diagram for a DB I created to our head database person, and she put a bunch of notes on it suggesting that I rename certain tables so it is clear they are lookup tables (add &quot;lu&quot; to the beginning of the table name).</p> <p>My problem is that these don't fit the definition of what I c...
3,419,868
8
0
null
2010-08-05 23:01:55.597 UTC
12
2021-07-28 07:13:54.777 UTC
2021-02-13 01:54:29.953 UTC
null
12,344,822
null
226,897
null
1
49
database|database-design|terminology
101,099
<p>What you have there is called a <a href="http://en.wikipedia.org/wiki/Junction_table" rel="noreferrer">junction table</a>. It is also known as:</p> <ul> <li>cross-reference table</li> <li>bridge table</li> <li>join table</li> <li>map table</li> <li>intersection table</li> <li>linking table</li> <li>link table</li> ...
3,963,100
How do you do a ‘Pause’ with PowerShell 2.0?
<p>OK, I'm losing it. PowerShell is annoying me. I'd like a pause dialog to appear, and it won't.</p> <pre><code>PS W:\&gt;&gt;&gt; $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") Exception calling "ReadKey" with "1" argument(s): "The method or operation is not implemented." At line:1 char:23 + $host.UI.RawUI.ReadKey ...
7,167,691
9
3
null
2010-10-18 20:27:37.467 UTC
33
2022-01-13 06:15:17.687 UTC
2014-12-27 14:53:33.653 UTC
null
63,550
null
455,822
null
1
129
powershell
241,180
<pre><code>cmd /c pause | out-null </code></pre> <p>(It is not the PowerShell way, but it's so much more elegant.)</p> <p>Save trees. Use one-liners.</p>
3,229,459
Algorithm to cover maximal number of points with one circle of given radius
<p>Let's imagine we have a plane with some points on it. We also have a circle of given radius.</p> <p>I need an algorithm that determines such position of the circle that it covers maximal possible number of points. Of course, there are many such positions, so the algorithm should return one of them.<br> Precision is...
3,229,582
10
3
null
2010-07-12 14:44:12.86 UTC
14
2019-10-25 11:12:36.11 UTC
2012-02-12 17:11:01.327 UTC
null
241,039
null
241,039
null
1
44
c++|algorithm|geometry|points
12,258
<p>Edited to better wording, as suggested :</p> <p>Basic observations :</p> <ul> <li>I assume the radius is one, since it doesn't change anything.</li> <li>given any two points, there exists at most two unit circles on which they lie.</li> <li>given a solution circle to your problem, you can move it until it contains...
3,953,645
Ternary operator (?:) in Bash
<p>Is there a way to do something like this</p> <pre><code>int a = (b == 5) ? c : d; </code></pre> <p>using Bash?</p>
3,953,666
23
3
null
2010-10-17 14:38:52.12 UTC
114
2022-09-15 12:11:07.307 UTC
2018-09-01 19:10:19.75 UTC
user166390
6,862,601
null
201,065
null
1
660
bash|syntax|conditional-operator
361,758
<p>ternary operator <code>? :</code> is just short form of <code>if/else</code></p> <pre><code>case "$b" in 5) a=$c ;; *) a=$d ;; esac </code></pre> <p>Or</p> <pre><code> [[ $b = 5 ]] &amp;&amp; a="$c" || a="$d" </code></pre>
3,302,476
Mysql 1050 Error "Table already exists" when in fact, it does not
<p>I'm adding this table:</p> <pre><code>CREATE TABLE contenttype ( contenttypeid INT UNSIGNED NOT NULL AUTO_INCREMENT, class VARBINARY(50) NOT NULL, packageid INT UNSIGNED NOT NULL, canplace ENUM('0','1') NOT NULL DEFAULT '0', cansearch ENUM('0','1') NOT NULL DEFAULT '0', ...
3,302,837
26
7
null
2010-07-21 18:22:21.58 UTC
35
2022-01-18 23:33:10.973 UTC
2011-03-28 01:59:28.753 UTC
null
135,152
null
175,250
null
1
86
mysql|sql|mysql-error-1146|mysql-error-1050
325,144
<p>Sounds like you have <a href="http://en.wikipedia.org/wiki/Schr%C3%B6dinger&#39;s_cat" rel="noreferrer">Schroedinger's table</a>... </p> <p>Seriously now, you probably have a broken table. Try:</p> <ul> <li><code>DROP TABLE IF EXISTS contenttype</code></li> <li><code>REPAIR TABLE contenttype</code></li> <li>If you...
3,601,515
How to check if a variable is set in Bash
<p>How do I know if a variable is set in Bash?</p> <p>For example, how do I check if the user gave the first parameter to a function?</p> <pre><code>function a { # if $1 is set ? } </code></pre>
13,864,829
37
12
null
2010-08-30 14:54:38.197 UTC
705
2022-09-04 21:17:16.753 UTC
2022-03-01 17:18:19.13 UTC
null
63,550
null
260,127
null
1
2,184
bash|shell|variables
1,956,415
<h2>(Usually) The right way</h2> <pre><code>if [ -z ${var+x} ]; then echo &quot;var is unset&quot;; else echo &quot;var is set to '$var'&quot;; fi </code></pre> <p>where <code>${var+x}</code> is a <a href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02" rel="noreferrer">parameter ...
8,349,817
Ruby gem for finding timezone of location
<p>I have a location (city, state), date, and time and I want to convert it to utc, but need to first find the timezone of the location. I've done a little research and everything seems to point to either earthtools or geonames but both webservices appear to be latitude and longitude only. Is there a service or gem or ...
8,350,225
5
1
null
2011-12-01 23:24:49.423 UTC
11
2019-10-22 11:44:17.213 UTC
null
null
null
null
1,076,471
null
1
28
ruby|web-services|timezone|gem|location
13,299
<p>You can easily get a latitude and longitude using the <a href="http://code.google.com/apis/maps/documentation/geocoding" rel="noreferrer">google maps geocoding API</a>. There are ruby implementations for the API like <a href="http://geokit.rubyforge.org" rel="noreferrer">GeoKit</a>. Once you have that you can use th...
7,734,202
Boolean.parseBoolean("1") = false...?
<p>sorry to be a pain... I have: <code>HashMap&lt;String, String&gt; o</code></p> <pre><code>o.get('uses_votes'); // "1" </code></pre> <p>Yet...</p> <pre><code>Boolean.parseBoolean(o.get('uses_votes')); // "false" </code></pre> <p>I'm guessing that <code>....parseBoolean</code> doesn't accept the standard <code>0 =...
7,734,219
11
0
null
2011-10-12 01:02:55.07 UTC
7
2019-07-12 16:39:19.86 UTC
null
null
null
null
414,972
null
1
85
java
135,089
<p>It accepts only a string value of <code>"true"</code> to represent boolean <code>true</code>. Best what you can do is</p> <pre><code>boolean uses_votes = "1".equals(o.get("uses_votes")); </code></pre> <p>Or if the <code>Map</code> actually represents an "entitiy", I think a <a href="https://stackoverflow.com/tags/...
8,050,854
How to find maximum avg
<p>I am trying to display the maximum average salary; however, I can't seem to get it to work.</p> <p>I can get a list of the average salaries to display with:</p> <pre><code>select worker_id, avg(salary) from workers group by worker_id; </code></pre> <p>However, when I try to display a list of the maximum average s...
8,050,885
15
2
null
2011-11-08 13:07:17.87 UTC
4
2020-10-12 13:55:19.707 UTC
null
null
null
null
1,035,270
null
1
19
sql|oracle
108,616
<p>Columns resulting from aggregate functions (e.g. avg) usually get arbitrary names. Just use an alias for it, and select on that:</p> <pre><code>select max(avg_salary) from (select worker_id, avg(salary) AS avg_salary from workers group by worker_id) As maxSalary; </code></pre>
8,204,680
Java regex email
<p>First of all, I know that using regex for email is not recommended but I gotta test this out.</p> <p>I have this regex:</p> <pre><code>\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b </code></pre> <p>In Java, I did this:</p> <pre><code>Pattern p = Pattern.compile("\\b[A-Z0-9._%-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\\b"); Matche...
8,204,716
22
3
null
2011-11-20 20:58:21.13 UTC
52
2021-12-01 12:55:20.957 UTC
2014-03-28 21:56:53.863 UTC
null
801,807
null
801,807
null
1
149
java|regex|email
366,414
<p>FWIW, here is the Java code we use to validate email addresses. The Regexp's are very similar:</p> <pre><code>public static final Pattern VALID_EMAIL_ADDRESS_REGEX = Pattern.compile("^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$", Pattern.CASE_INSENSITIVE); public static boolean validate(String emailStr) { ...
4,780,586
How to get friends likes via Facebook API
<p>Is this possible to get all my friends likes?? Now, I'm getting this by 2 steps:</p> <ol> <li>Getting all my friends list</li> <li>By iterating those list I'm getting all individuals Likes,</li> </ol> <p>but it seems very big process, anybody have idea to improve the performance for this task?</p>
5,323,807
3
0
null
2011-01-24 09:48:42.463 UTC
12
2015-06-04 23:43:12.64 UTC
null
null
null
null
444,521
null
1
13
facebook|facebook-graph-api|facebook-fql
19,447
<p>At last I found it after 2 weeks looking at Facebook API documentation</p> <pre class="lang-js prettyprint-override"><code>FB.api("/likes?ids=533856945,841978743") FB.api("me/friends",{ fields:'id', limit:10 },function(res){ var l='' $.each(res.data,function(idx,val){ l=l+val.id+(idx&lt;res.data.lengt...
4,584,882
How to change focus color of EditText in Android
<p>How can I change the focus color (orange) on an <code>EditText</code> box?</p> <p>The focus color is a small rim around the entire control and is bright orange when the control has focus. How can I change the color of that focus to a different color?</p>
4,585,750
3
0
null
2011-01-03 13:36:26.447 UTC
20
2019-09-12 11:58:01.79 UTC
2019-09-12 11:58:01.79 UTC
null
452,775
null
429,501
null
1
40
android|android-edittext|android-styles
76,640
<p>You'll have to create/modify your own NinePatch image to replace the default one, and use that as the background of your EditText. If you look in your SDK folder, under your platform, then res/drawable, you should find the NinePatch image for the EditText focus state. If that's all you want to change, you can just p...
4,701,928
Disable Lock Screen
<p>I am looking for a way to replace the stock lock screen (with an app, not a rom). What is the best way to do it, for a start to disable the lock screen on as much devices as possible? Thanks!</p>
6,095,866
4
1
null
2011-01-15 20:21:11.943 UTC
12
2016-02-03 13:11:51.783 UTC
null
null
null
null
246,206
null
1
23
android
36,825
<pre><code>KeyguardManager keyguardManager = (KeyguardManager)getSystemService(Activity.KEYGUARD_SERVICE); KeyguardLock lock = keyguardManager.newKeyguardLock(KEYGUARD_SERVICE); lock.disableKeyguard(); </code></pre> <p>in androidmanifest:</p> <pre><code>&lt;uses-permission android:name="android.permission.DISABLE_KEY...
4,398,136
Use PowerShell for Visual Studio Command Prompt
<p>In a serious intiative to migrate all my command line operations to PowerShell, I would like to avoid using the old fashioned command console for anything. However, the Visual Studio Command prompt has various environment variables and path settings not found in the default command prompt. How could I create a 'Vi...
4,398,325
6
1
null
2010-12-09 12:22:43.677 UTC
13
2021-10-04 12:39:41.56 UTC
null
null
null
null
8,741
null
1
21
windows|visual-studio|windows-7|powershell
9,750
<p>You can use for example <a href="https://stackoverflow.com/questions/4384814/how-to-call-batch-script-from-powershell/4385011#4385011">this script</a> to import Visual Studio command prompt environment, see the examples in the script documentation comments, e.g. for Visual Studio 2010:</p> <pre><code>Invoke-Environ...
4,240,050
Python: sort function breaks in the presence of nan
<p><code>sorted([2, float('nan'), 1])</code> returns <code>[2, nan, 1]</code></p> <p>(At least on Activestate Python 3.1 implementation.)</p> <p>I understand <code>nan</code> is a weird object, so I wouldn't be surprised if it shows up in random places in the sort result. But it also messes up the sort for the non-na...
7,165,183
8
5
null
2010-11-21 20:05:54.62 UTC
7
2021-11-18 08:09:06.917 UTC
2017-05-23 12:09:56.23 UTC
null
-1
null
336,527
null
1
47
python|math|sorting|nan
12,382
<p>The previous answers are useful, but perhaps not clear regarding the root of the problem.</p> <p>In any language, sort applies a given ordering, defined by a comparison function or in some other way, over the domain of the input values. For example, less-than, a.k.a. <code>operator &lt;,</code> could be used throu...
4,053,918
How to portably write std::wstring to file?
<p>I have a <code>wstring</code> declared as such:</p> <pre><code>// random wstring std::wstring str = L"abcàdëefŸg€hhhhhhhµa"; </code></pre> <p><strike>The literal would be UTF-8 encoded, because my source file is.</strike></p> <p>[EDIT: According to Mark Ransom this is not necessarily the case, the compiler will d...
4,054,138
9
5
null
2010-10-29 16:31:49.427 UTC
6
2019-02-08 18:19:15.917 UTC
2013-08-25 14:44:51.58 UTC
null
1,237,747
user1481860
null
null
1
23
c++|file|unicode|wstring|wofstream
39,639
<p>Why not write the file as a binary. Just use ofstream with the std::ios::binary setting. The editor should be able to interpret it then. Don't forget the Unicode flag 0xFEFF at the beginning. You might be better of writing with a library, try one of these:</p> <p><a href="http://www.codeproject.com/KB/files/EZUTF....
4,337,942
Using enum vs Boolean?
<p>This may initially seem generic, but in fact, I am actually making the decision on which I need to use.</p> <p>What I am currently working on involves Employment Applications, those in which will need to be marked at some point <b>Active</b> or <b>Inactive</b>. When an application is submitted, it will default to <...
4,338,016
11
1
null
2010-12-02 17:31:59.797 UTC
2
2022-09-22 23:23:30.283 UTC
null
null
null
null
180,253
null
1
27
java|hibernate|postgresql
39,841
<p>It totally depends on your requirement/specification. If you only want to record the status as active or inactive, the best way is to use <code>boolean</code>.</p> <p>But if in the future, you will have a status such as, </p> <ul> <li>ACTIVE</li> <li>INACTIVE</li> <li>SUSPENDED</li> <li>BLOCKED</li> </ul> <p>Enum...
14,863,536
Iterate through Python dictionary by Keys in sorted order
<p>I have a dictionary in Python that looks like this:</p> <pre><code>D = {1:'a', 5:'b', 2:'a', 7:'a'} </code></pre> <p>The values of the keys are mostly irrelevant. Is there are way to iterate through the dictionary by keys in numerical order? The keys are all integers.</p> <p>Instead of saying</p> <pre><code>for ...
14,863,575
4
0
null
2013-02-13 21:31:53.61 UTC
4
2019-01-31 16:52:02.2 UTC
2019-01-31 16:52:02.2 UTC
null
10,607,772
null
1,760,431
null
1
35
python|loops|sorting|dictionary
47,119
<p>You can use this:</p> <pre><code>for key in sorted(D.iterkeys()): .. code .. </code></pre> <p>In Python 3.x, use <code>D.keys()</code> (which is the same as <code>D.iterkeys()</code> in Python 2.x).</p>
14,897,608
Cancel a AngularJS $timeout on routeChange
<p>On a specific page in my application I think of doing a server-call to update information on a set interval. I stumbled upon a problem though. I want to cancel my $timeout when a user navigates away from the page in question so that the application doesn't try to work with stuff that isn't there anymore.</p> <p>Any...
18,059,591
1
0
null
2013-02-15 15:11:32.867 UTC
3
2015-07-28 19:55:08.157 UTC
null
null
null
null
384,868
null
1
37
javascript|timeout|angularjs
32,305
<p>Use <code>$timeout.cancel</code> like this:</p> <pre><code>yourTimer = $timeout(function() { /* ... */ }, 5000); $timeout.cancel(yourTimer); </code></pre> <p><a href="http://docs.angularjs.org/api/ng.%24timeout">Reference</a></p>
9,748,524
jQuery: Get each checked radio button and append its datasrc value
<p>I am having a problem when trying to use each() twice.</p> <p>I have a list of radio checked buttons of which each has a datasrc of a website.</p> <p>Example:</p> <pre><code>&lt;input type="radio" checked datasrc="www.john.com" id="John"&gt;John&lt;br/&gt; &lt;input type="radio" checked datasrc="www.maria.com" id...
9,748,594
4
0
null
2012-03-17 08:40:39.233 UTC
2
2012-03-17 21:45:18.843 UTC
null
null
null
null
701,363
null
1
1
jquery|append|each
42,100
<p>It's because you're nesting a for loop inside each so the results of the for loop run as many times as the each loop...You don't need the for loop though, a simple array and and <code>each()</code> will work:</p> <p><strong>Edit:</strong> Made it a function so you can use it at any time.</p> <pre><code>var getUrls...
2,591,897
Which font and size does apple use for the navigation bar title?
<p>I made an totally custom navigation bar and would like to use the exact same font and size like apple does for the title of their navigation bar. It looks like some kind of fat printed arial, but not sure if that's right. Does anyone know?</p>
2,592,022
4
0
null
2010-04-07 11:16:20.263 UTC
5
2021-11-24 13:17:11.523 UTC
2010-04-07 11:36:55.263 UTC
null
74,118
null
268,733
null
1
28
iphone|cocoa-touch|user-interface
23,272
<p>Definitely not Arial. It's Helvetica. You can probably get the same font using </p> <pre><code>UIFont *navFont = [UIFont boldSystemFontOfSize:18]; </code></pre> <p>Change the size to find out what Apple is using (and write it below in a comment if you find the best one).</p> <p>All the navigation bar text has a w...
3,130,541
Access Query string parameters with no values in ASP.NET
<p>I am trying to set up a page that has two behaviors. I'm separating them by URL: One behavior is accessed via <code>/some-controller/some-action</code>, the other is via <code>/some-controller/some-action?customize</code>. </p> <p>It doesn't look like the Request.QueryString object contains anything, though, when I...
3,130,553
4
0
null
2010-06-28 06:47:49.16 UTC
7
2016-10-26 00:01:14.733 UTC
2016-10-26 00:01:14.733 UTC
null
2,864,740
null
176,645
null
1
30
c#|asp.net|query-string
27,814
<p>ASP.NET does not support determining the presence of query string parameters without values since <code>Request.QueryString["customize"]</code> and <code>Request.QueryString["foo"]</code> are both <code>null</code>. You'll either have to parse it yourself or specify a value e.g. <code>?customize=1</code></p>
27,616,778
Case insensitive argparse choices
<p>Is it possible to check <a href="https://docs.python.org/3/library/argparse.html#choices">argparse choices</a> in case-insensitive manner?</p> <pre><code>import argparse choices = ["win64", "win32"] parser = argparse.ArgumentParser() parser.add_argument("-p", choices=choices) print(parser.parse_args(["-p", "Win32"]...
27,616,814
4
0
null
2014-12-23 08:39:09.773 UTC
5
2022-03-29 19:17:48.433 UTC
null
null
null
null
2,838,364
null
1
87
python|argparse|case-insensitive
27,917
<p>Transform the argument into lowercase by using</p> <pre><code>type = str.lower </code></pre> <p>for the <code>-p</code> switch. </p> <p>This solution was pointed out by <a href="https://stackoverflow.com/users/1126841/chepner">chepner</a> in a <a href="https://stackoverflow.com/questions/27616778/case-insensitive...
29,876,904
How do I take code from Codepen, and use it locally?
<p>How do I take the code from codepen, and use it locally in my text-editor?</p> <p><a href="http://codepen.io/mfields/pen/BhILt">http://codepen.io/mfields/pen/BhILt</a></p> <p>I am trying to have a play with this creation locally, but when I open it in chrome, I get a blank white page with nothing going on.</p> <p...
29,877,026
5
0
null
2015-04-26 11:14:51.133 UTC
9
2016-09-28 11:33:08.76 UTC
null
null
null
null
4,141,578
null
1
20
javascript|css|html|html5-canvas
41,557
<p>Joe Fitter is right, but I think is better to <a href="https://blog.codepen.io/documentation/features/exporting-pens/" rel="noreferrer">export your pen</a> (use the export to export.zip option for using your pen locally). This will give you a working version of your pen without having to copy and paste the CSS, Java...
35,132,687
How to access externally to consul UI
<p>How can I access to consul UI externally?</p> <p>I want to access consul UI writing </p> <p><code>&lt;ANY_MASTER_OR_SLAVE_NODE_IP&gt;:8500</code></p> <p>I have try doing a ssh tunnel to acces: ssh -N -f -L 8500:localhost:8500 root@172.16.8.194</p> <p>Then if I access <a href="http://localhost:8500">http://localh...
35,276,638
6
0
null
2016-02-01 14:11:29.043 UTC
12
2019-07-14 14:53:11.757 UTC
2016-02-16 17:06:16.84 UTC
null
5,621,509
null
5,621,509
null
1
32
consul
25,158
<p>Add</p> <pre><code>{ "client_addr": "0.0.0.0" } </code></pre> <p>to your configuration or add the option <code>-client 0.0.0.0</code> to the command line of consul to make your Web UI accessible from the outside (<a href="https://www.consul.io/docs/agent/options.html">see the docs for more information</a>).</p> ...