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
31,156,101
Dynamo DB + In put Item Request how to pass null value?
<p>I have one field which i have declared as string in the model as show below:</p> <pre><code>App.Student= DS.Model.extend({ name: DS.attr('string'), address1: DS.attr('string'), address2: DS.attr('string'), city: DS.attr('string'), state: DS.attr('string'), postal: DS.attr('string'), country: DS.attr('string'), }); ...
31,265,563
7
0
null
2015-07-01 08:21:04.237 UTC
1
2020-07-03 22:58:37.917 UTC
null
null
null
null
3,454,221
null
1
11
amazon-dynamodb
38,108
<p>Finally i got this right, The way might be some what different but it work for me !!!</p> <p>Here is the code for the same.</p> <pre><code>AttributeUpdates: { Address2: { Action: "DELETE" }, } </code></pre> <...
58,236,175
What is a GitLab instance URL, and how can I get it?
<p>I have tried searching for it everywhere, but I can’t find anything.</p> <p>It would be really awesome if someone could define it straight out of the box.</p> <p>I don’t know what an instance of GitLab URL is. I’m asking if someone could clarify what it is, and where can I get it. I am currently trying to add it in ...
58,259,627
2
1
null
2019-10-04 12:10:34.317 UTC
3
2022-03-18 17:05:20.563 UTC
2021-08-17 09:49:28.72 UTC
null
11,435,798
null
11,435,798
null
1
34
gitlab
40,448
<p>The instance URL of any GitLab install is basically the link to the GitLab you're trying to connect to.</p> <p>For example, if your project is hosted on <code>gitlab.example.com/yourname/yourproject</code> then for the instance URL enter <code>https://gitlab.example.com</code>.</p> <p>Another example, if your projec...
47,336,704
Repeat rows in a pandas DataFrame based on column value
<p>I have the following df:</p> <pre><code>code . role . persons 123 . Janitor . 3 123 . Analyst . 2 321 . Vallet . 2 321 . Auditor . 5 </code></pre> <p>The first line means that I have 3 persons with the role Janitors. My problem is that I would need to have one line for each person. My df should look like t...
47,336,762
3
0
null
2017-11-16 18:25:27.047 UTC
9
2022-07-23 10:41:06.18 UTC
2019-02-06 22:22:19.703 UTC
null
4,909,087
null
5,606,352
null
1
30
python|pandas|dataframe|repeat
20,359
<p><code>reindex</code>+ <code>repeat</code></p> <pre><code>df.reindex(df.index.repeat(df.persons)) Out[951]: code . role ..1 persons 0 123 . Janitor . 3 0 123 . Janitor . 3 0 123 . Janitor . 3 1 123 . Analyst . 2 1 123 . Analyst . 2 2 321 ....
20,997,062
Specify encoding XmlSerializer
<p>I've a class correctly defined and after serialize it to XML I'm getting no encoding.</p> <p>How can I define encoding "ISO-8859-1"?</p> <p>Here's a sample code</p> <pre><code>var xml = new XmlSerializer(typeof(Transacao)); var file = new FileStream(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "transacao.x...
21,003,031
2
1
null
2014-01-08 13:27:57.99 UTC
2
2014-01-08 17:55:49.023 UTC
null
null
null
null
833,531
null
1
11
c#|xml|c#-4.0|export-to-xml
41,259
<p>The following should work:</p> <pre><code>var xml = new XmlSerializer(typeof(Transacao)); var fname = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "transacao.xml"); var appendMode = false; var encoding = Encoding.GetEncoding("ISO-8859-1"); using(StreamWriter sw = new StreamWriter(fname, appendMode, encodin...
36,764,791
In Tensorflow, how to use tf.gather() for the last dimension?
<p>I am trying to gather slices of a tensor in terms of the last dimension for partial connection between layers. Because the output tensor's shape is <code>[batch_size, h, w, depth]</code>, I want to select slices based on the last dimension, such as</p> <pre><code># L is intermediate tensor partL = L[:, :, :, [0,2,3...
36,777,781
8
0
null
2016-04-21 09:04:06.123 UTC
3
2017-11-20 16:58:06.967 UTC
2017-11-20 16:58:06.967 UTC
null
3,924,118
null
3,251,207
null
1
19
python|tensorflow|deep-learning
42,946
<p>There's a tracking bug to support this use-case here: <a href="https://github.com/tensorflow/tensorflow/issues/206" rel="noreferrer">https://github.com/tensorflow/tensorflow/issues/206</a></p> <p>For now you can:</p> <ol> <li><p>transpose your matrix so that dimension to gather is first (transpose is expensive)</...
28,128,400
Keep footer at the bottom of the page (with scrolling if needed)
<p>I'm trying to show a footer at the bottom of my pages. And if the page is longer then 1 screen I like the footer to only show after scrolling to the bottom. So I can't use 'position: fixed', because then it will always show.</p> <p>I'm trying to copy the following example: <a href="http://peterned.home.xs4all.nl/ex...
28,128,430
9
0
null
2015-01-24 17:49:18.067 UTC
2
2022-05-30 18:26:02.957 UTC
2015-01-24 19:22:45.63 UTC
null
3,881,236
null
3,881,236
null
1
20
html|css|footer
84,098
<p>I would suggest the "sticky footer" approach. See the following link:</p> <p><a href="http://css-tricks.com/snippets/css/sticky-footer/" rel="noreferrer">http://css-tricks.com/snippets/css/sticky-footer/</a></p>
8,794,886
Create a link with an anchor with Twig path function in Symfony 2
<p>I'm trying to create a link with an anchor like "www.example.com/services#anchor1" in my Twig template. So far I've been using the <strong>path</strong> function to create links <code>path('services')</code>. I have tried with <code>path('services#anchor1')</code> but obviously it doesn't work.</p> <p>It doesn't se...
8,794,949
3
0
null
2012-01-09 20:38:41.68 UTC
1
2017-06-14 08:02:20.743 UTC
null
null
null
null
701,243
null
1
34
symfony|twig
35,978
<p>Try <code>&lt;a href="{{ path('_welcome') }}#home"&gt;Home&lt;/a&gt;</code></p>
27,087,483
How to resolve "git pull,fatal: unable to access 'https://github.com...\': Empty reply from server"
<p>It's failed when I used Git command "git pull" to update my repository, messages as below: fatal: unable to access '...': Empty reply from server. </p> <p>And the I tried to use the GitHub App, but alert this: </p> <pre><code>Cloning into 'renren_mobile'... warning: templates not found /Applications/GitHub.app/Con...
27,352,176
18
1
null
2014-11-23 09:33:06.453 UTC
21
2021-05-25 04:43:44.93 UTC
2021-05-25 04:43:44.93 UTC
null
13,046,806
null
4,283,912
null
1
84
git|github|ssh-keys
374,530
<p>I resolved this problem. I think it happened maybe because of https but I am not very sure. You can Switch remote URLs from HTTPS to SSH.</p> <p>1.Pls refer to this link for details:<a href="https://help.github.com/articles/changing-a-remote-s-url/" rel="noreferrer">https://help.github.com/articles/changing-a-remot...
27,416,164
What is CoNLL data format?
<p>I am new to text mining. I am using a open source jar (Mate Parser) which gives me output in a CoNLL 2009 format after dependency parsing. I want to use the dependency parsing results for Information Extraction. But i am able to understand some of the output but not able to comprehend the CoNLL data format. Can any ...
27,425,613
2
1
null
2014-12-11 05:45:51.443 UTC
22
2022-02-23 16:49:57.69 UTC
null
null
null
null
3,505,968
null
1
64
nlp|text-parsing|text-mining|information-extraction
46,228
<p>There are many different <a href="http://ifarm.nl/signll/conll/" rel="nofollow noreferrer">CoNLL</a> formats since CoNLL is a different shared task each year. The format for CoNLL 2009 is described <a href="http://ufal.mff.cuni.cz/conll2009-st/task-description.html" rel="nofollow noreferrer">here</a>. Each line repr...
438,610
How do I write a query that outputs the row number as a column?
<p>How do I write a query that outputs the row number as a column? This is DB2 SQL on an iSeries.</p> <p>eg if I have</p> <p>table Beatles:</p> <pre><code>John Paul George Ringo </code></pre> <p>and I want to write a statement, without writing a procedure or view if possible, that gives me</p> <pre><code>1 John 2 ...
438,640
3
0
null
2009-01-13 10:53:56.74 UTC
2
2013-10-28 05:59:44.653 UTC
2009-01-13 11:05:32.49 UTC
nearly_lunchtime
23,447
nearly_lunchtime
23,447
null
1
14
sql|db2
62,271
<pre><code>SELECT ROW_NUMBER() OVER (ORDER BY beatle_name ASC) AS ROWID, * FROM beatles </code></pre>
1,182,315
Python: Multicore processing?
<p>I've been reading about Python's <a href="http://docs.python.org/library/multiprocessing.html" rel="noreferrer">multiprocessing module</a>. I still don't think I have a very good understanding of what it can do.</p> <p>Let's say I have a quadcore processor and I have a list with 1,000,000 integers and I want the s...
1,182,350
3
0
null
2009-07-25 15:31:35.79 UTC
19
2009-07-25 18:32:32.057 UTC
2009-07-25 15:41:57.753 UTC
null
33,006
null
41,718
null
1
29
python|multicore|multiprocessing
43,540
<p>Yes, it's possible to do this summation over several processes, very much like doing it with multiple threads:</p> <pre><code>from multiprocessing import Process, Queue def do_sum(q,l): q.put(sum(l)) def main(): my_list = range(1000000) q = Queue() p1 = Process(target=do_sum, args=(q,my_list[:50...
672,501
Is there an easy way to use InternalsVisibleToAttribute?
<p>I have a C# project and a test project with unit tests for the main project. I want to have testable <code>internal</code> methods and I want to test them without a magical Accessor object that you can have with Visual Studio test projects. I want to use <strong><code>InternalsVisibleToAttribute</code></strong> but ...
672,510
3
0
null
2009-03-23 07:48:55.287 UTC
6
2017-07-21 12:15:11.993 UTC
2009-03-23 20:58:33.297 UTC
marxidad
1,659
marxidad
1,659
null
1
33
c#|.net|visual-studio
14,730
<p>You don't have to use signed assemblies to use <code>InternalsVisibleTo</code>. If you don't use signed assemblies, you can just enter the full name of the assembly. </p> <p>So if you want to have access to <code>MyAssembly</code> in you test assembly (<code>MyAssembly.Test</code>) all you need in <code>AssemblyInf...
680,022
Is there a decent Vim regexp OR command? What is the best way to find mismatched if else's?
<p>I have some mismatching if and fi statements in a script. I would like to strip out everything but the if's else's and fi's. Just so I can see the structure. Why am working so HARD with such a powerful editor? I need a <strong>BIGFATOR</strong> operator for regexp or some epiphany that has eluded me... I don't c...
680,031
3
0
null
2009-03-25 02:30:31.727 UTC
16
2009-09-10 21:41:29.94 UTC
2009-04-03 22:03:59.973 UTC
Chad Birch
41,665
ojblass
66,519
null
1
45
regex|vim
25,006
<pre><code>:g/[ ^\t]if\|[ ^\t]fi/print </code></pre> <p><strong>BIGFATOROPERATOR</strong> is <code>\|</code>. It's called the <a href="http://devmanual.gentoo.org/tools-reference/sed/index.html" rel="noreferrer">alternation operator</a>. In PCRE, it's plain <code>|</code>. It's escaped in Vim/ex because <code>|</co...
6,899,392
Generic Hash function for all STL-containers
<p>I'm using an <code>std::unordered_map&lt;key,value&gt;</code> in my implementation. i will be using any of the STL containers as the key. I was wondering if it is possible to create a generic hash function for any container being used. </p> <p><a href="https://stackoverflow.com/questions/4850473/pretty-print-c-stl-...
6,899,457
1
3
null
2011-08-01 13:52:03.733 UTC
10
2014-07-24 09:51:31.31 UTC
2017-05-23 12:16:40.643 UTC
null
-1
null
419,074
null
1
14
c++|stl|hash|map|c++11
4,609
<p>We can get an answer by mimicking Boost and combining hashes.</p> <p><strong>Warning:</strong> Combining hashes, i.e. computing a hash of many things from many hashes of the things, is not a good idea generally, since the resulting hash function is not "good" in the statistical sense. A proper hash of many things ...
36,648,375
What are the differences between IMPORTED target and INTERFACE libraries?
<p>As I understand it <a href="https://cmake.org/cmake/help/v3.5/command/add_library.html?highlight=interface#interface-libraries" rel="noreferrer">INTERFACE</a> libraries are like <a href="https://msdn.microsoft.com/en-us/library/669zx6zc.aspx" rel="noreferrer">Visual Studio property sheets</a>, so very useful. We can...
36,649,194
2
2
null
2016-04-15 13:22:01.253 UTC
15
2018-10-22 07:10:49.423 UTC
2016-04-15 15:03:07.973 UTC
null
282,815
null
282,815
null
1
23
cmake
14,359
<p>When you create an imported target, you're telling CMake: I have this { static library | shared library | module library | executable } already built in this location on disk. I want to be able to treat it just like a target built by my own buildsystem, so take note that when I say <code>ImportedTargetName</code>, i...
34,913,590
Fillna in multiple columns in place in Python Pandas
<p>I have a pandas dataFrame of mixed types, some are strings and some are numbers. I would like to replace the NAN values in string columns by '.', and the NAN values in float columns by 0.</p> <p>Consider this small fictitious example:</p> <pre><code>df = pd.DataFrame({'Name':['Jack','Sue',pd.np.nan,'Bob','Alice','...
34,916,691
9
2
null
2016-01-21 01:00:25.927 UTC
22
2022-05-17 20:33:06.98 UTC
2016-01-21 01:38:24.95 UTC
null
2,838,606
null
5,818,752
null
1
54
python|pandas|dataframe
85,107
<p>You could use <a href="https://www.google.ru/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=1&amp;cad=rja&amp;uact=8&amp;ved=0ahUKEwjEkvbtobrKAhXJkSwKHVRRAxgQFggcMAA&amp;url=http%3A%2F%2Fpandas.pydata.org%2Fpandas-docs%2Fversion%2F0.17.1%2Fgenerated%2Fpandas.DataFrame.apply.html&amp;usg=AFQjCNEV-3rhym9xF...
20,520,614
tableau aggregate data based on dimension
<p>I am having a problem in Tableau, hopefully someone can help me and is very much appreciated!!</p> <p>A simplifiend example of a problem I can't fix in Tableau:</p> <pre><code>Payment Customer Amount 1 BMW 20000 2 VW 30000 3 BMW 1000 4 VW 5000 5 ...
20,549,727
2
0
null
2013-12-11 13:36:09.283 UTC
1
2014-03-06 17:24:04.173 UTC
2014-03-06 17:24:04.173 UTC
null
19,679
null
2,944,773
null
1
2
aggregate-functions|aggregate|tableau-api
40,130
<p>Sum() is one of Tableau's built-in aggregation functions, so there is no need to write a calculated field if that's all you're doing. Just drag the [Amount] field on to (say) the text shelf and select Sum() as the aggregation. Then put [Customer] on the row shelf.</p> <p>Sum() is efficient, and performed on the dat...
24,196,820
NSData from Byte array in Swift
<p>I'm trying to create an <code>NSData</code> <code>var</code> from an array of bytes.</p> <p>In Obj-C I might have done this: </p> <p><code>NSData *endMarker = [[NSData alloc] initWithBytes:{ 0xFF, 0xD9 }, length: 2]</code></p> <p>I can't figure out a working equivalent in Swift.</p>
24,196,962
6
0
null
2014-06-13 02:32:04.157 UTC
9
2022-05-26 22:22:49.083 UTC
null
null
null
null
8,597
null
1
38
ios|swift
61,682
<p><code>NSData</code> has an initializer that takes a <code>bytes</code> pointer: <code>init(bytes: UnsafeMutablePointer &lt;Void&gt;, length: Int)</code>. An <code>UnsafePointer</code> parameter can accept a variety of different things, including a simple Swift array, so you can use pretty much the same syntax as in ...
19,936,025
java JPanel How to fixed sizes
<p>I want to have a resizable panel, that always has the top green panel of a fixed depth. i.e. all changes in height should effect the yellow panel only.</p> <p>My code below is almost OK, except the green panel varies in size a little.</p> <p>How do I do this?</p> <pre><code> Panel.setLayout(new BoxLayo...
19,936,269
2
0
null
2013-11-12 17:34:15.993 UTC
null
2013-11-12 18:57:38.937 UTC
2013-11-12 17:43:25.413 UTC
null
418,556
null
439,497
null
1
12
java|swing|jpanel|layout-manager
46,468
<p>Your question didn't restrict the solution to a <code>BoxLayout</code>, so I am going to suggest a different layout manager.</p> <p>I would attack this with a <code>BorderLayout</code> and put the green panel in the PAGE_START location. Then put the yellow panel in the CENTER location without a <code>preferredSize...
5,753,256
popTOViewController
<p>I have a button named 'HOME'. In that button action I have the following code:</p> <pre><code>[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:1] animated:YES]; </code></pre> <p>When I click this button my app crashes.</p> <p>Changing the index from 1 to 2, t...
5,753,313
4
0
null
2011-04-22 07:32:05.95 UTC
15
2018-07-19 10:18:42.48 UTC
2016-01-29 19:31:00.837 UTC
null
4,486,699
null
699,655
null
1
30
ios|objective-c
30,747
<p>Try this.</p> <p>Where I have written SeeMyScoresViewController you should write your View Controller class on which you have to go.(eg. Class of Home)</p> <pre><code>NSArray *viewControllers = [[self navigationController] viewControllers]; for( int i=0;i&lt;[viewControllers count];i++){ id obj=[viewController...
34,873,209
Implementation of strcmp
<p>I tried to implement <a href="http://pubs.opengroup.org/onlinepubs/009695399/functions/strcmp.html" rel="nofollow noreferrer"><code>strcmp</code></a>:</p> <pre><code>int strCmp(char string1[], char string2[]) { int i = 0, flag = 0; while (flag == 0) { if (string1[i] &gt; string2[i]) { ...
34,874,063
8
1
null
2016-01-19 09:38:27.463 UTC
8
2021-11-14 06:00:30.21 UTC
2020-12-01 14:09:13.867 UTC
null
4,593,267
null
5,655,007
null
1
9
c|c-strings|strcmp
40,093
<p>You seem to want to avoid pointer arithmetics which is a pity since that makes the solution shorter, but your problem is just that you scan beyond the end of the strings. Adding an explicit break will work. Your program slightly modified:</p> <pre><code>int strCmp(char string1[], char string2[] ) { int i = 0; ...
34,458,985
Eloquent model returns 0 as primary key
<p>I have this migration:</p> <pre><code>Schema::create('provincias', function (Blueprint $table) { $table-&gt;string('codigo', 2); $table-&gt;string('nombre', 50); $table-&gt;timestamp('creado'); $table-&gt;primary('codigo'); }); </code></pre> <p>This is my model:</p> <pre><code>class Provincia exte...
34,459,024
2
1
null
2015-12-25 00:07:29.113 UTC
3
2019-05-20 10:51:33.52 UTC
null
null
null
null
1,922,561
null
1
30
laravel|eloquent
10,927
<p>You can try setting <code>public $incrementing = false;</code> on your model so eloquent doesn't expect your primary key to be an autoincrement primary key.</p>
2,017,865
SQL Server 2008 Open Master Key error upon physical server change over
<p>I copied a SQL Server database from one system to the next, identical setup, but completely different physical machine. I used Norton Ghost and recoverd files manually, for example, the entire SQL Server 2008 folder found in c:\Program Files after re-installing SQL Server 2008 Express. </p> <p>One of my databases h...
2,018,063
2
0
null
2010-01-07 02:37:39.513 UTC
13
2018-06-19 02:34:16.71 UTC
2010-01-07 06:08:24.003 UTC
null
13,302
null
113,329
null
1
25
sql|sql-server-2008|encryption|aes
29,749
<p>The database master key is encrypted using the server master key, which is specific to the machine where SQL Server is installed. When you move the database to another server, you lose the ability to automatically decrypt and open the database master key because the local server key will most likely be different. If...
1,374,098
With.Parameters.ConstructorArgument with ninject 2.0
<p>How to use this functionality in ninject 2.0?</p> <pre><code>MyType obj = kernel.Get&lt;MyType&gt;(With.Parameters.ConstructorArgument("foo","bar")); </code></pre> <p>The "With" isn't there :(</p>
1,375,734
2
0
null
2009-09-03 15:22:46.12 UTC
11
2011-10-30 19:04:21.567 UTC
2011-10-30 19:04:21.567 UTC
null
11,635
null
22,693
null
1
35
c#|ninject
13,159
<pre><code> [Fact] public void CtorArgTestResolveAtGet() { IKernel kernel = new StandardKernel(); kernel.Bind&lt;IWarrior&gt;().To&lt;Samurai&gt;(); var warrior = kernel .Get&lt;IWarrior&gt;( new ConstructorArgument( "weapon", new Sword() ) ); Assert.IsType&lt;Sword&gt;( w...
5,841,370
Can't get my EC2 Windows Server 2008 (Web stack) instance to receive publishings of my website
<p>I installed a fresh AMI for EC2 (<a href="http://aws.amazon.com/amis/Microsoft/5147732567196848" rel="nofollow noreferrer">http://aws.amazon.com/amis/Microsoft/5147732567196848</a>) and have installed Web deploy 2.1 on it.</p> <p>The web deploy 2.1 service is running for real as</p> <pre><code>netstat -an </code><...
6,242,793
5
3
null
2011-04-30 11:11:06.34 UTC
10
2017-11-20 23:59:03.603 UTC
2014-09-21 10:05:52.69 UTC
null
1,505,120
null
209
null
1
18
asp.net|iis|amazon-ec2|webdeploy
12,228
<p>I contact Microsoft directly about this problem and they had an immediate answer for me.</p> <p><strong>From MS guy:</strong></p> <p>It looks like your Web Management Service not contactable. I have seen this before when the certificate for the service is invalid. Can you run the attached script on your server?</p...
5,731,042
Split array into two parts without for loop in java
<p>I have an array of size 300000 and i want it to split it into 2 equal parts. Is there any method that can be used here to achieve this goal?</p> <p>Will it be faster than the for-loop operation or it will cause no effect on performance?</p>
5,731,124
5
0
null
2011-04-20 13:24:56.347 UTC
8
2017-10-06 13:14:20.793 UTC
null
null
null
null
461,537
null
1
42
java|arrays
143,321
<p>You can use <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/System.html#arraycopy-java.lang.Object-int-java.lang.Object-int-int-" rel="noreferrer"><code>System.arraycopy()</code></a>.</p> <pre><code>int[] source = new int[1000]; int[] part1 = new int[500]; int[] part2 = new int[500]; // ...
6,163,611
Compare two files
<p>I'm trying to write a function which compares the content of two files.</p> <p>I want it to return 1 if files are the same, and 0 if different.</p> <p><code>ch1</code> and <code>ch2</code> works as a buffer, and I used <code>fgets</code> to get the content of my files.</p> <p>I think there is something wrong with...
6,163,633
6
7
null
2011-05-28 18:28:36.093 UTC
8
2018-03-16 11:05:49.793 UTC
2018-03-16 11:05:49.793 UTC
null
4,393,935
null
595,535
null
1
14
c++
48,355
<p>Since you've allocated your arrays on the stack, they are filled with random values ... they aren't zeroed out.</p> <p>Secondly, <code>strcmp</code> will only compare to the first NULL value, which, if it's a binary file, won't necessarily be at the end of the file. Therefore you should really be using <code>memcm...
6,310,787
How to set value inside div in JS
<p>I have some code that looks like this:</p> <pre><code>document.getElementById("error").style.display = 'block'; </code></pre> <p>and when this happens I also want to display the error that is supposed to be shown which is stored in another JS variable. How can I add the value of that variable to the div which has...
6,310,813
6
1
null
2011-06-10 18:50:54.69 UTC
2
2011-06-10 18:54:22.657 UTC
null
null
null
null
731,255
null
1
19
javascript
65,019
<pre><code>var errorMsg = "&lt;p&gt;Example error message&lt;/p&gt;" document.getElementById("error").innerHTML = errorMsg </code></pre>
5,997,960
How to remove class from all elements jquery
<p>I am changing the class of an element with the following</p> <pre><code> $("#"+data.id).addClass("highlight") </code></pre> <p>Given the list below. </p> <pre><code> &lt;div id="menuItems"&gt; &lt;ul id="contentLeft" class="edgetoedge"&gt; &lt;li class="sep" "&gt;Shakes and Floats&lt;/li&gt; &lt;li id="29...
5,997,989
6
0
null
2011-05-13 21:28:15.543 UTC
9
2020-04-19 08:56:06.38 UTC
null
null
null
null
505,055
null
1
98
jquery
204,691
<p>You need to select the <code>li</code> tags contained within the <code>.edgetoedge</code> class. <code>.edgetoedge</code> only matches the one <code>ul</code> tag:</p> <pre><code>$(".edgetoedge li").removeClass("highlight"); </code></pre>
6,073,221
PHP remove special character from string
<p>I have problems with removing special characters. I want to remove all special characters except "( ) / . % - &amp;", because I'm setting that string as a title.</p> <p>I edited code from the original (look below):</p> <pre><code>preg_replace('/[^a-zA-Z0-9_ -%][().][\/]/s', '', $String); </code></pre> <p>But this...
6,073,257
8
2
null
2011-05-20 14:15:10.61 UTC
5
2019-07-24 10:50:19.703 UTC
2013-05-02 18:38:07.297 UTC
null
1,845,301
null
453,089
null
1
31
php|regex|string|preg-replace
175,168
<p>Your dot is matching all characters. Escape it (and the other special characters), like this:</p> <pre><code>preg_replace('/[^a-zA-Z0-9_ %\[\]\.\(\)%&amp;-]/s', '', $String); </code></pre>
6,057,781
wkhtmltopdf with full page background
<p>I am using wkhtmltopdf to generate a PDF file that is going to a printer and have some troubles with making the content fill up an entire page in the resulting PDF.</p> <p>In the CSS I've set the width and height to 2480 X 3508 pixels (a4 300 dpi) and when creating the PDF I use 0 for margins but still end up with ...
21,052,719
8
1
null
2011-05-19 11:16:45.7 UTC
19
2022-05-11 13:19:19.47 UTC
2013-08-30 17:11:34.087 UTC
null
127,880
null
760,937
null
1
38
wkhtmltopdf
61,544
<p>wkhtmltopdf v 0.11.0 rc2</p> <p><strong>What ended up working:</strong></p> <pre><code>wkhtmltopdf --margin-top 0 --margin-bottom 0 --margin-left 0 --margin-right 0 &lt;url&gt; &lt;output&gt; </code></pre> <p><strong>shortens to</strong> </p> <pre><code>wkhtmltopdf -T 0 -B 0 -L 0 -R 0 &lt;url&gt; &lt;output&gt; ...
5,994,026
Failed to install HelloAndroid.apk on device 'emulator-5554!
<p>Ive seen the questions posted about this issue. I understand it takes several minutes for the emulator to configure itself and launch. But if Im getting the specific error:</p> <pre><code>[2011-05-13 08:41:36 - HelloAndroid] ------------------------------ [2011-05-13 08:41:36 - HelloAndroid] Android Launch! [2011...
6,005,712
9
1
null
2011-05-13 15:14:44.463 UTC
3
2015-12-30 10:10:00.483 UTC
2011-05-13 15:25:34.797 UTC
null
571,433
null
452,889
null
1
16
android
96,753
<p>wait for the emulator to setup completely and then test your app. Also, I would leave you AVD open so you dont have to wait so long everytime you run your application.</p> <p>When it shows the red writing, don't close anything - leave it there and then press the run button again. Worked like a charm.</p>
6,102,125
Family Tree Algorithm
<p>I'm working on putting together a problem set for an intro-level CS course and came up with a question that, on the surface, seems very simple:</p> <blockquote> <p>You are given a list of people with the names of their parents, their birth dates, and their death dates. You are interested in finding out who, at s...
6,142,209
9
15
null
2011-05-23 19:43:30.203 UTC
27
2015-08-07 14:59:36.96 UTC
2015-08-07 14:59:36.96 UTC
null
5,640
null
501,557
null
1
46
algorithm|graph|tree|family-tree
15,771
<p>I thought of this this morning, then found that @Alexey Kukanov had similar thoughts. But mine is more fleshed out and has some more optimization, so I'll post it anyways.</p> <p>This algorithm is <code>O(n * (1 + generations))</code>, and will work for any dataset. For realistic data this is <code>O(n)</code>.</...
5,601,647
HTML5 Email input pattern attribute
<p>I’m trying to make a html5 form that contains one email input, one check box input, and one submit input. I'm trying to use the pattern attribute for the email input but I don't know what to place in this attribute. I do know that I'm supposed to use a regular expression that must match the JavaScript Pattern produc...
8,897,615
20
4
null
2011-04-08 23:07:03.533 UTC
37
2022-01-30 02:18:34.45 UTC
2020-12-24 20:42:16.927 UTC
null
4,442,606
null
633,498
null
1
78
html|html-email|email-validation|html-input
368,440
<p>This is a dual problem (as many in the world wide web world).</p> <p>You need to evaluate if the browser supports html5 (I use Modernizr to do it). In this case if you have a normal form the browser will do the job for you, but if you need ajax/json (as many of everyday case) you need to perform manual verification...
17,769,245
Terminating with uncaught exception of type NSException?
<p>My application crashes when clicking a button to go to segue into a new view. This comes up: </p> <pre><code>int main(int argc, char * argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } } </code></pre> <p>"return UIApplicationMain..." i...
17,770,531
1
3
null
2013-07-21 05:05:31.32 UTC
5
2014-01-12 19:48:37.957 UTC
2013-07-21 06:13:23.377 UTC
user529758
null
null
2,603,513
null
1
20
objective-c|nsexception
83,666
<p>To prevent the NSException crashes, you should click the cross (X) to remove the yellow triangles:</p> <p><img src="https://i.stack.imgur.com/ZgiB4.png" alt="enter image description here"> </p>
25,047,463
Group By and Sum using Underscore/Lodash
<p>I have JSON like this: </p> <pre><code>[ { platformId: 1, payout: 15, numOfPeople: 4 }, { platformId: 1, payout: 12, numOfPeople: 3 }, { platformId: 2, payout: 6, numOfPeople: 5 }, { platformId: 2, payout: 10, numOfPeople: 1 }, ] </code>...
25,047,658
6
2
null
2014-07-30 21:39:44.777 UTC
9
2022-03-17 18:39:57.237 UTC
2016-01-07 15:34:07.76 UTC
null
1,903,116
null
921,193
null
1
22
javascript|arrays|object|underscore.js|lodash
36,874
<p>You can do this without Underscore:</p> <pre><code>var result = data.reduce(function(acc, x) { var id = acc[x.platformId] if (id) { id.payout += x.payout id.numOfPeople += x.numOfPeople } else { acc[x.platformId] = x delete x.platformId } return acc },{}) </code></pre> <p>But why would yo...
979,555
iPhone drag/drop
<p>Trying to get some basic drag/drop functionality happening for an iPhone application.</p> <p>My current code for trying to do this is as follows:</p> <pre><code>- (void) touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event { UITouch *touch = [touches anyObject]; CGPoint location = [touch locationInView:...
980,124
1
2
null
2009-06-11 05:58:06.107 UTC
10
2015-08-15 01:24:25.417 UTC
null
null
null
null
116,994
null
1
16
iphone|objective-c|drag-and-drop
20,005
<p>The center property needs to be specified in the coordinate system of the superview, but you've asked the touch event for the location in terms of your subview. Instead ask for them based on the superview's coordinates, like this:</p> <pre><code>- (void) touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event { ...
19,399,477
Setting up a custom domain with Heroku and namecheap
<p>I've followed all the instructions on <a href="https://devcenter.heroku.com/articles/custom-domains" rel="nofollow noreferrer">https://devcenter.heroku.com/articles/custom-domains</a> to get my custom domain set up, and it still isn't working.</p> <p>On Heroku, I have the following domains:</p> <p><code>myapp.heroku...
25,925,332
9
0
null
2013-10-16 09:16:36.7 UTC
20
2022-07-05 07:19:03.417 UTC
2022-07-02 23:29:06.08 UTC
null
1,145,388
null
1,975,151
null
1
46
ruby-on-rails|heroku
20,016
<p>1) Go To Namecheap, and go to the domain you want to manage.</p> <p>2) On the left sidebar, click "All Record Hosts", NOT any of the other jazz other tutorials tell you. No DNS pointing changes are necessary. It's easier to use alias.</p> <p><img src="https://i.stack.imgur.com/pHKL1.png" alt="namecheap sidebar all...
32,617,811
Imputation of missing values for categories in pandas
<p>The question is how to fill NaNs with most frequent levels for category column in pandas dataframe?</p> <p>In R randomForest package there is <a href="http://lojze.lugos.si/~darja/software/r/library/randomForest/html/na.roughfix.html" rel="noreferrer">na.roughfix</a> option : <code>A completed data matrix or data ...
32,619,781
4
0
null
2015-09-16 20:11:17.957 UTC
17
2021-03-30 06:33:08.223 UTC
2021-03-30 06:33:08.223 UTC
null
2,884,859
null
1,268,964
null
1
43
python|pandas
81,240
<p>You can use <code>df = df.fillna(df['Label'].value_counts().index[0])</code> to fill NaNs with the most frequent value from one column. </p> <p>If you want to fill every column with its own most frequent value you can use </p> <p><code>df = df.apply(lambda x:x.fillna(x.value_counts().index[0]))</code></p> <p><str...
29,980,832
Request permissions again after user denies location services?
<p>I track the user's location and ask for permission when my load first loads using this:</p> <pre><code>locationManager.requestAlwaysAuthorization() locationManager.startUpdatingLocation() </code></pre> <p>If the user denies, but later changes their mind by enabling the configuration option in my app, how do I ask ...
29,980,902
6
0
null
2015-05-01 02:29:53.993 UTC
12
2021-07-22 10:26:52.017 UTC
null
null
null
null
235,334
null
1
43
ios|iphone|swift|ios8|core-location
39,377
<p>The OS will only ever prompt the user once. If they deny permission, that's it. What you <em>can</em> do is direct the user to the Settings for your app by passing <code>UIApplicationOpenSettingsURLString</code> to <code>UIApplication</code>'s <code>openURL:</code> method. From there, they can re-enable location ser...
49,798,549
Declarative pipeline when condition in post
<p>As far as declarative pipelines go in Jenkins, I'm having trouble with the <em>when</em> keyword.</p> <p>I keep getting the error <code>No such DSL method 'when' found among steps</code>. I'm sort of new to Jenkins 2 declarative pipelines and don't think I am mixing up scripted pipelines with declarative ones.</p>...
49,812,779
3
1
null
2018-04-12 13:58:15.063 UTC
7
2022-05-13 11:39:50.773 UTC
null
null
null
null
9,230,302
null
1
41
jenkins
43,760
<p>In the <a href="https://jenkins.io/doc/book/pipeline/syntax/#when" rel="nofollow noreferrer">documentation</a> of declarative pipelines, it's mentioned that you can't use <code>when</code> in the <code>post</code> block. <code>when</code> is allowed only inside a stage directive. So what you can do is test the condi...
49,555,189
How to create table in partition data in hive?
<pre><code>drwxr-xr-x - mgupta supergroup 0 2018-03-26 22:16 /kylin/retailer/qi_basket_brand_bucket_fact/_impala_insert_staging drwxr-xr-x - mgupta supergroup 0 2018-03-26 22:18 /kylin/retailer/qi_basket_brand_bucket_fact/product_hierarchy_type=CI [mgupta@sjc-dev-binn01 ~]$ hadoop fs -ls /kylin/re...
49,557,506
2
0
null
2018-03-29 11:44:13.787 UTC
1
2022-01-18 19:30:09.007 UTC
2019-09-03 07:26:09.353 UTC
null
1,000,551
null
6,363,023
null
1
1
hive|create-table|hive-partitions
39,570
<p>You may try the steps given below.</p> <p><strong>Approach 1</strong></p> <ol> <li><p>Identify the schema (column names and types, including the partitioned column)</p> </li> <li><p>Create a hive partitioned table (Make sure to add partition column &amp; delimiter information)</p> </li> <li><p>Load data into the par...
49,603,498
Convolution2D + LSTM versus ConvLSTM2D
<p>Are <code>1</code> and <code>2</code> the same?</p> <ol> <li>Use <code>Convolution2D</code> layers and <code>LSTM</code> layers </li> <li>Use <code>ConvLSTM2D</code></li> </ol> <p>If there is any difference, could you explain it for me?</p>
49,770,553
2
0
null
2018-04-01 23:14:53.4 UTC
9
2018-04-13 16:40:43.003 UTC
2018-04-13 16:40:43.003 UTC
null
7,224,320
null
4,088,201
null
1
25
python|tensorflow|keras
12,197
<p>They are not exactly the same, here is why:</p> <h3>1. Use <code>Convolution2D</code> layers and <code>LSTM</code> layers</h3> <p>As it is known, <code>Convolution2D</code> serves well for capturing image or spatial features, whilst <code>LSTM</code> are used to detect correlations over time. However, by stacking ...
22,252,956
Android Studio Gradle issue upgrading to version 0.5.0 - Gradle Migrating From 0.8 to 0.9 - Also Android Studio upgrade to 0.8.1
<p>After upgrade message states: </p> <pre><code>Failed to refresh Gradle project 'XXX' The project is using an unsupported version of the Android Gradle plug-in (0.8.3). Version 0.9.0 introduced incompatible changes in the build language. Please read the migration guide to learn how to update your project. </code></p...
22,252,957
8
0
null
2014-03-07 14:35:24.397 UTC
17
2016-04-09 06:31:53.647 UTC
2014-07-08 13:11:11.68 UTC
null
1,590,950
null
2,838,910
null
1
28
android|gradle|android-studio|android-gradle-plugin|build.gradle
30,725
<p>To fix it, open file called <code>build.gradle</code> in the project root, and change gradle version there to 0.9.+.</p> <pre><code>buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } </code></pre> <p>To be repeated for e...
22,181,944
Using utf-8 characters in a Jinja2 template
<p>I'm trying to use utf-8 characters when rendering a template with Jinja2. Here is how my template looks like:</p> <pre><code>&lt;!DOCTYPE HTML&gt; &lt;html manifest="" lang="en-US"&gt; &lt;head&gt; &lt;meta charset="UTF-8"&gt; &lt;title&gt;{{title}}&lt;/title&gt; ... </code></pre> <p>The title variable is ...
22,182,709
3
0
null
2014-03-04 20:10:17.737 UTC
7
2021-07-22 09:10:01.207 UTC
null
null
null
null
1,646,670
null
1
33
python|python-2.7|utf-8|character-encoding|jinja2
45,323
<p>TL;DR:</p> <ul> <li><a href="http://jinja.pocoo.org/docs/api/#unicode" rel="nofollow noreferrer">Pass Unicode</a> to <code>template.render()</code></li> <li>Encode the rendered unicode result to a bytestring before writing it to a file</li> </ul> <p>This had me puzzled for a while. Because you do</p> <pre><code>inde...
28,900,207
How do I add classes to items in Owl Carousel 2?
<p>My goal is to make a carousel that looks like this:</p> <p><img src="https://i.imgur.com/c4xTgH5.jpg" alt="Carousel"></p> <p>In case you don't know what you're looking at, there are 5 images/items but only the center one is displayed in its full size. The images next to the center one are smaller, and the outer on...
28,903,704
2
0
null
2015-03-06 13:50:31.367 UTC
10
2019-03-17 18:55:47.84 UTC
null
null
null
user4325086
null
null
1
10
jquery|carousel|owl-carousel|owl-carousel-2
32,634
<p>You can do it this way:</p> <pre><code>$(function(){ $('.loop').owlCarousel({ center: true, items:5, loop:true, margin:10 }); $('.loop').on('translate.owl.carousel', function(e){ idx = e.item.index; $('.owl-item.big').removeClass('big'); $('.owl-i...
29,319,361
How to see diff between working directory and staging index?
<p>We can see difference between <strong>repository and working directory</strong> with:</p> <pre><code>git diff </code></pre> <p>We can see difference between <strong>repository and staging index</strong> with:</p> <pre><code>git diff --staged </code></pre> <p>But how do we see difference between <strong>working d...
29,319,403
3
0
null
2015-03-28 16:09:23.153 UTC
15
2021-04-30 15:05:06.68 UTC
null
null
null
null
1,075,423
null
1
27
git|git-diff
15,485
<p>Actually, <code>git diff</code> is between index and working tree. It just so happens that until you have staged changes to the index (with <code>git add</code>) that its contents will be identical to the <code>HEAD</code> commit.</p> <p><code>git diff HEAD</code> is between repo and working tree.</p> <p>See <a hre...
29,080,026
How to reference header files in Bridging-Header.h after updating CocoaPods to 0.36.x and above?
<p>After updating to CocoaPods 0.36.x, I am unable to add imports into my Bridging-Header.h file. I get the "DBSphereView.h file not found".</p> <p>The file is indeed present in:</p> <pre><code>"Pods/DBSphereTagCloud/DBSphereView.h" "Headers/public/DBSphereTagCloud/DBSphereView.h" "Headers/private/DBSphereTagCloud/DB...
29,094,237
5
0
null
2015-03-16 14:58:27.91 UTC
11
2015-09-30 13:55:08.83 UTC
2015-07-07 07:30:33 UTC
null
4,145,420
null
1,544,047
null
1
47
ios|swift|cocoapods|ios-frameworks
28,031
<p>In your <code>Podfile</code>, you specified <code>use_frameworks!</code>. </p> <p>As a result, the Objective-C code you're including as a dependency (<code>DBSphereTagCloud</code>) is packaged as a framework, instead of a static library. Please see <a href="http://blog.cocoapods.org/CocoaPods-0.36/" rel="noreferrer...
21,606,987
How can I strip the whitespace from Pandas DataFrame headers?
<p>I am parsing data from an Excel file that has extra white space in some of the column headings.</p> <p>When I check the columns of the resulting dataframe, with <code>df.columns</code>, I see:</p> <pre><code>Index(['Year', 'Month ', 'Value']) ^ # Note the unwanted trailing s...
21,607,530
5
1
null
2014-02-06 15:26:25.683 UTC
30
2021-11-27 00:16:25.803 UTC
2020-02-11 00:29:31.293 UTC
null
202,229
null
73,371
null
1
123
python|pandas|whitespace
98,587
<p>You can give functions to the <code>rename</code> method. The <code>str.strip()</code> method should do what you want:</p> <pre><code>In [5]: df Out[5]: Year Month Value 0 1 2 3 [1 rows x 3 columns] In [6]: df.rename(columns=lambda x: x.strip()) Out[6]: Year Month Value 0 1 2 ...
21,887,315
cURL SSL connect error 35 with NSS error -5961
<p>I have a remote Windows 7 server that is accessible only via HTTPS on port 768. The server is using a signed certificate from a CA listed in the local CentOS server.</p> <p>Whenever I try to access the remote server via cURL using the following command, it errors out as follows:</p> <pre><code>[usr@serv certs]# cu...
22,145,195
5
1
null
2014-02-19 17:03:03.553 UTC
10
2020-01-29 22:07:06.873 UTC
2014-03-03 10:09:28.777 UTC
null
951,577
null
951,577
null
1
22
curl|ssl|windows-7|centos
100,388
<p><code>curl</code> with NSS read the Root CA certificates by default from <code>"/etc/pki/tls/certs/ca-bundle.crt"</code> in the PEM format.</p> <pre><code>* Initializing NSS with certpath: sql:/etc/pki/nssdb * CAfile: /etc/pki/tls/certs/ca-bundle.crt </code></pre> <p>You can specify another (your) CA certificate (...
33,376,486
Is there a way other than traits to add methods to a type I don't own?
<p>I'm trying to extend the <a href="http://docs.piston.rs/graphics/graphics/grid/struct.Grid.html" rel="noreferrer"><code>Grid</code></a> struct from the piston-2dgraphics library. There's no method for getting the location on the window of a particular cell, so I implemented a trait to calculate that for me. Then, I ...
33,378,549
2
1
null
2015-10-27 19:04:50.543 UTC
5
2018-07-14 13:47:53.823 UTC
2018-07-14 13:45:50.097 UTC
null
155,423
null
4,622,121
null
1
41
rust
8,782
<p>As of Rust 1.27, no, there is no other way. It's not possible to define inherent methods on a type defined in another crate. </p> <p>You can define your own trait with the methods you need, then implement that trait for an external type. This pattern is known as <em>extension traits</em>. The name of extension trai...
9,305,036
How do I obfuscate the ids of my records in rails?
<p>I'm trying to figure out how to obfuscate the ids of my records in rails.</p> <p>For example: a typical path might look like <a href="http://domain/records/1" rel="noreferrer">http://domain/records/1</a>, so it's pretty easy for people to deduce how much traffic the site is getting if they just create a new record....
9,305,230
6
0
null
2012-02-16 03:15:22.923 UTC
13
2020-08-18 08:00:28.417 UTC
null
null
null
null
686,567
null
1
16
ruby-on-rails|database|ruby-on-rails-3|data-binding|obfuscation
7,167
<p>You could use the built-in OpenSSL library to encrypt and decrypt your identifiers, that way you would only need to overwrite <code>to_param</code> on your models. You'll also need to use Base64 to convert the encrypted data into plain text. I would stick this in a module so it can be reused:</p> <pre><code>require...
30,765,157
Is it possible to opt your iPad app out of multitasking on iOS 9
<p>I have a large app that I will need some time to optimize for iOS9. </p> <p>Edit: What I am worried about is all the UI getting squeezed together when the app window size is reduced. So my question is, is there any way to force full screen for the app?</p>
30,768,183
4
1
null
2015-06-10 19:06:22.78 UTC
12
2019-10-22 16:22:46.61 UTC
2017-03-16 14:06:09.713 UTC
null
1,586,924
null
2,891,327
null
1
76
ios|xcode|ipad|ios9|multitasking
36,406
<p>You have to modify your project to support multitasking. According to <a href="https://developer.apple.com/videos/wwdc/2015/?id=205">WWDC 2015 video</a>, to adopt your app for multitasking, satisfy these requirements:</p> <ol> <li>Build your app with iOS 9 SDK</li> <li>Support all orientations</li> <li>Use Launch S...
34,368,385
Does an array object explicitly contain the indexes?
<p>Since day one of learning Java I've been told by various websites and many teachers that arrays are consecutive memory locations which can store the specified number of data all of the same type.</p> <p>Since an array is an object and object references are stored on the stack, and actual objects live in the heap, o...
34,373,672
9
1
null
2015-12-19 07:21:44.267 UTC
8
2016-06-30 14:29:36.513 UTC
2015-12-19 18:01:56.953 UTC
null
964,243
null
2,015,669
null
1
29
java|arrays
3,921
<blockquote> <p>Does an array object explicitly contain the indexes?</p> </blockquote> <p><strong>Short answer:</strong> No.</p> <p><strong>Longer answer:</strong> Typically not, but it theoretically could do.</p> <p><strong>Full answer:</strong></p> <p>Neither the Java Language Specification nor the Java Virtual...
34,303,371
Can we load Parquet file into Hive directly?
<p>I know we can load parquet file using Spark SQL and using Impala but wondering if we can do the same using Hive. I have been reading many articles but I am still confused. </p> <p>Simply put, I have a parquet file - say users.parquet. Now I am struck here on how to load/insert/import data from the users.parquet int...
34,344,654
4
1
null
2015-12-16 03:16:26.09 UTC
8
2017-11-10 12:33:09.263 UTC
2017-05-23 12:02:34.313 UTC
null
-1
null
2,305,003
null
1
25
hadoop|hive|apache-spark-sql|hiveql|parquet
66,764
<p>Get schema of the parquet file using parquet tools, for details check link <a href="http://kitesdk.org/docs/0.17.1/labs/4-using-parquet-tools-solution.html" rel="noreferrer">http://kitesdk.org/docs/0.17.1/labs/4-using-parquet-tools-solution.html</a></p> <p>and build table using the schema on the top of the file, fo...
10,263,956
Use datetime.strftime() on years before 1900? ("require year >= 1900")
<p>I used : <code>utctime = datetime.datetime(1601,1,1) + datetime.timedelta(microseconds = tup[5]) last_visit_time = "Last visit time:"+ utctime.strftime('%Y-%m-%d %H:%M:%S')</code></p> <p>But I have the time of 1601, so the error show: <code>ValueError: year=1601 is before 1900; the datetime strftime() methods requ...
10,264,070
4
1
null
2012-04-21 23:32:13.81 UTC
8
2016-02-24 16:43:05.77 UTC
2012-04-21 23:38:26.57 UTC
user166390
null
null
1,277,161
null
1
36
python|datetime|strftime
21,024
<p>You can do the following:</p> <pre><code>&gt;&gt;&gt; utctime.isoformat() '1601-01-01T00:00:00.000050' </code></pre> <p>Now if you want to have exactly the same format as above:</p> <pre><code>iso = utctime.isoformat() tokens = iso.strip().split("T") last_visit_time = "Last visit time: %s %s" % (tokens[0], tokens...
22,489,703
Trying to remove fragment from view gives me NullPointerException on mNextAnim
<p>I've got 3 fragments, one NavigationDrawer, one MapFragment, and one user-defined "MapInfoFragment". I want the "MapInfoFragment" to appear semi-transparent over top of the MapFragment on certain events and disappear on others. I don't really care if I completely remove the fragment and create a new one each time, o...
23,770,928
7
1
null
2014-03-18 19:57:24.313 UTC
13
2021-03-29 11:55:42.48 UTC
2016-03-01 02:49:32.43 UTC
null
1,321,236
null
1,321,236
null
1
46
android|android-fragments|android-studio
43,910
<p>I know you've solved this yourself, but I want to explain how this error happens, since it just happened to me.</p> <p>Basically you're calling <code>hide()</code>, <code>remove()</code>, etc., with a null value.</p> <p>The error isn't obvious, and the stack trace doesn't originate from your own sources when this ...
7,202,647
What are the best practices for implementing form in iOS
<p>I need to create several screens-forms that would be used for entering data and posting to the server. I have not done that kind of stuff yet, so I'm just wondering are there any best practices for doing that. Currently, I would just drop several text fields, radios and etc, do some manual input validation, do an as...
7,203,003
2
0
null
2011-08-26 09:26:00.827 UTC
13
2012-10-17 07:29:44.643 UTC
null
null
null
null
597,292
null
1
22
iphone|objective-c|ios|forms
12,490
<p>A few of my experiences from implementing forms:</p> <ul> <li><p>Place inputs and labels in the rows of a <code>UITableView</code> (grouped). It's the way Apple does it and the way most users are used to. But be wary with the reuse of cells, as this may cause your inputs to move around otherwise. In other words, ke...
7,117,200
Devise for Twitter, Cookie Overflow error?
<p>I am trying to integrate twitter into devise using this <a href="https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview" rel="noreferrer">guide</a>. I basically take all occurence of facebook and substitue it with twitter. However, when I sign in with twitter, I am getting the following error:</p> <pre><co...
7,117,278
2
0
null
2011-08-19 05:11:21.013 UTC
11
2011-08-19 08:54:38.643 UTC
null
null
null
null
140,330
null
1
27
ruby-on-rails|twitter|devise
9,437
<p>The problem is with <code>session["devise.facebook_data"] = env["omniauth.auth"]</code>. Twitter's response contains an <code>extra</code> section that is very large and does not fit in the session. One option is to store <code>env["omniauth.auth"].except("extra")</code> in the session instead.</p>
35,602,541
Create .pyi files automatically?
<p>How can I automatically create the boilerplate code of <a href="https://www.python.org/dev/peps/pep-0484/#stub-files" rel="noreferrer">pyi</a> files?</p> <p>I want to create a <a href="https://www.python.org/dev/peps/pep-0484/#stub-files" rel="noreferrer">pyi</a> file for type hinting as described in <a href="https...
35,706,456
2
2
null
2016-02-24 12:42:46.71 UTC
16
2020-01-11 13:40:15.957 UTC
2016-02-29 19:17:19.747 UTC
null
633,961
null
633,961
null
1
31
python|pycharm|type-hinting
19,589
<p>As far as I am concerned, there is no such direct tool in PyCharm. There are, however, 3rd party tools for this.</p> <hr> <h1><code>.pyi</code> generators</h1> <h2><a href="http://www.mypy-lang.org/" rel="noreferrer" title="MyPy-lang official website">MyPy</a></h2> <p>Yes, I guess anyone who wants to use compile...
18,227,540
Error: MapFragment cannot be cast to android.support.v4.app.Fragment
<p>First, I watched out here: <a href="https://stackoverflow.com/questions/13757730/start-fragmentactivity-from-activity">Start FragmentActivity from Activity</a> and now I have the following problem:</p> <p><strong>MapsActivity:</strong></p> <pre><code>public class MapsActivity extends FragmentActivity { private Go...
18,227,605
1
2
null
2013-08-14 09:11:13.883 UTC
6
2019-06-25 14:50:12.967 UTC
2017-05-23 11:54:50.48 UTC
null
-1
null
2,542,147
null
1
47
android|google-maps-android-api-2
35,300
<p>as you are extending <code>FragmentActivity</code> which indicates you are using Support library v4 compatible with lower version of android. Replace <code>MapFragment</code> with <code>SupportMapFragment</code> inside your xml file. <code>SupportMapFragment</code> is the one to use with the Android Support package....
2,206,397
Android: Intent.ACTION_SEND with EXTRA_STREAM doesn't attach any image when choosing Gmail app on htc Hero
<p>On the Emulator with a default mail-app all works fine. But I have no attach when I'am receiving a mail which I've sent from my Hero using a Gmail app. The default Mail app on the hero works fine. </p> <p>How can I make this code works with Gmail app on Hero?<br/> You can see the code below.</p> <pre><code> pri...
3,268,557
3
2
null
2010-02-05 10:04:47.563 UTC
7
2013-05-20 05:54:19.59 UTC
2010-02-05 14:06:57.34 UTC
null
227,016
null
227,016
null
1
12
android|email|attachment|android-intent|htc-hero
38,877
<p>For me the problem was solved with the following lines of code:</p> <pre><code>Bitmap screenshot = Bitmap.createBitmap(_rootView.getWidth(), _rootView.getHeight(), Bitmap.Config.RGB_565); _rootView.draw(new Canvas(screenshot)); String path = Images.Media.insertImage(getContentResolver(), screenshot, "title", null)...
8,974,328
MySQL Multiple Joins in one query?
<p>I have the following query:</p> <pre><code>SELECT dashboard_data.headline, dashboard_data.message, dashboard_messages.image_id FROM dashboard_data INNER JOIN dashboard_messages ON dashboard_message_id = dashboard_messages.id </code></pre> <p>So I am using an <code>INNER JOIN</code> and grabbing the <code>...
8,974,371
4
1
null
2012-01-23 15:46:12.81 UTC
37
2019-03-15 15:19:01.537 UTC
2012-01-23 15:52:37.193 UTC
null
68,998
null
799,653
null
1
141
mysql|sql|join
441,571
<p>You can simply add another join like this:</p> <pre><code>SELECT dashboard_data.headline, dashboard_data.message, dashboard_messages.image_id, images.filename FROM dashboard_data INNER JOIN dashboard_messages ON dashboard_message_id = dashboard_messages.id INNER JOIN images ON dashboard_me...
769,995
Debugging a release version of a DLL (with PDB file)
<p>If I have a DLL (that was built in release-mode) and the corresponding PDB file, is it possible to debug (step-into) classes/methods contained in that DLL?</p> <p>If so, what are the required steps/configuration (e.g. where to put the PDB file)?</p> <p><strong>Edit:</strong></p> <p>If have the PDB file in the sam...
777,033
4
0
null
2009-04-20 20:40:45.243 UTC
11
2010-04-14 00:34:37.57 UTC
2010-04-14 00:34:37.57 UTC
null
294,313
null
19,635
null
1
23
c#|visual-studio-2008|debugging|pdb-files
29,463
<p>I finally found what cause the problems debugging a DLL that was built in release configuration:</p> <p>First of all, it basically works as expected. Which means, if I have a DLL built in release-configuration plus the corresponding PDB file, then I can debug the classes/methods contained in that DLL.</p> <p>When ...
42,605,093
AWS Lambda RDS connection timeout
<p>I'm trying to write a Lambda function using Node.js which connects to my RDS database. The database is working and accessible from my Elastic Beanstalk environment. When I run the function, it returns a timeout error.</p> <p>Tried to increase the timeout up to 5 minutes with the exact same result.</p> <p>The concl...
42,619,071
10
3
null
2017-03-05 06:07:36.473 UTC
9
2022-07-08 10:40:05.477 UTC
2017-07-01 09:01:55.263 UTC
null
6,382,901
null
2,318,632
null
1
37
node.js|amazon-web-services|aws-lambda|rds
36,146
<p>I want to thank everyone who helped, the problem turned out to be different than I thought. The <code>callback</code> in the code doesn't work for some reason even though it's in AMAZON'S OWN DEFAULT SAMPLE.</p> <p>The working code looks like this:</p> <pre><code>'use strict'; console.log("Loading getContacts func...
29,803,093
Check which columns in DataFrame are Categorical
<p>I am new to Pandas... I want to a simple and generic way to find which columns are <code>categorical</code> in my <code>DataFrame</code>, when I don't manually specify each column type, unlike in <a href="https://stackoverflow.com/questions/26924904/check-if-dataframe-column-is-categorical">this SO question</a>. The...
29,803,290
22
1
null
2015-04-22 16:03:36.407 UTC
19
2022-07-27 15:45:09.15 UTC
2018-10-28 07:50:48.167 UTC
null
1,910,555
null
1,910,555
null
1
58
python|pandas
131,538
<p>You could use <code>df._get_numeric_data()</code> to get numeric columns and then find out categorical columns</p> <pre><code>In [66]: cols = df.columns In [67]: num_cols = df._get_numeric_data().columns In [68]: num_cols Out[68]: Index([u'0', u'1', u'2'], dtype='object') In [69]: list(set(cols) - set(num_cols))...
4,589,333
Git ignore locally deleted folder
<p>I have a Ruby on Rails application which crashes when <code>vendor/rails</code> is present but works fine if it is not. I need to keep this folder deleted in my local copy so that I can work, but I don't want this deletion to ever be committed. Someone put it there for a reason.</p> <p>So how do I delete this folde...
4,590,664
1
0
null
2011-01-03 23:23:13.977 UTC
24
2018-03-21 12:13:17.343 UTC
2017-05-23 10:30:09.167 UTC
null
-1
null
76,900
null
1
32
git|ignore
14,392
<pre><code> git ls-files <strong>--deleted</strong> -z | <a href="http://www.kernel.org/pub/software/scm/git/docs/git-update-index.html" rel="noreferrer">git update-index</a> <strong>--assume-unchanged</strong> -z --stdin</code></pre> <p>Note that because this is an index-based operation, you cannot set directories to...
39,469,264
Fatal error: Uncaught Error: Call to undefined function ereg_replace() PHP 7
<p>below code is giving me the fatal error in php 7</p> <pre><code> $jquery_click_hook = ereg_replace("[^A-Za-z0-9]", "", strtolower($value['name'])); </code></pre> <p>is there any way to make it compatible with php 7?</p>
39,469,320
2
1
null
2016-09-13 11:46:45.847 UTC
1
2016-09-13 11:58:41.68 UTC
2016-09-13 11:58:41.68 UTC
null
487,813
user5247236
null
null
1
10
php|php-7|ereg-replace
60,521
<p>Switch to <a href="http://php.net/preg_replace"><code>preg_replace</code><sup><em>Docs</em></sup></a> and update the expression to use preg syntax (PCRE) instead of ereg syntax (POSIX) <a href="http://php.net/reference.pcre.pattern.posix">where there are differences<sup><em>Docs</em></sup></a> (just as it says to do...
26,657,319
How do you set up encrypted mosquitto broker like a webpage which has https?
<p>I'm trying to setup a mosquitto broker which is encrypted using ssl/tls. I don't want to generate client certificates. I just want an encrypted connection. </p> <p>The man page only described the settings which are available, not which are needed and how they are used.</p> <p>Which settings are needed and how do y...
26,657,320
2
0
null
2014-10-30 15:39:11.223 UTC
11
2016-08-15 04:31:04.42 UTC
null
null
null
null
3,199,565
null
1
11
ssl|encryption|certificate|mqtt|mosquitto
28,913
<p>There is a small guide here, but it does not say much: <a href="http://mosquitto.org/man/mosquitto-tls-7.html" rel="noreferrer">http://mosquitto.org/man/mosquitto-tls-7.html</a></p> <p>You need to set these: certfile keyfile cafile</p> <p>They can be generated with the commands in the link above. But easier is to ...
6,702,856
Close a running application from DOS command line
<p>The start command can launch an application like notepad in a batch file like this:</p> <pre><code>start notepad start "my love.mp3" </code></pre> <p>But how do I close the running application from the command line? I found <code>taskkill</code> in my searches but I don't think that is the right command because it...
6,702,868
2
1
null
2011-07-15 04:59:33.21 UTC
0
2015-07-17 16:09:34.697 UTC
2011-07-15 18:43:13.943 UTC
null
57,611
null
834,032
null
1
11
command-line|batch-file|dos|kill-process|taskkill
96,436
<p>Taskkill is correct. But you must kill the process playing the file, not the file itself. Figuring out the registered handler for mp3 files from a command prompt will be a bit tricky.</p> <p>If you know it then you can kill that process.</p> <p>Here's a script that figures out the registered application for mp3 fi...
7,095,845
When run bundle get invalid byte sequence in US-ASCII
<p>I'm trying to deploy my Rails 3.0 app. I use rvm and ruby 1.9.2 (p 180 or p 290 - no difference) on the FreeBSD production server. When I run bundle command, I get this exception on every :git gem (it seems that exception is raised only when I use edge versions with :git option in Gemfile):</p> <pre><code>... Inst...
7,126,196
3
1
null
2011-08-17 15:56:31.523 UTC
13
2021-07-05 10:05:26.37 UTC
2011-08-17 16:28:40.44 UTC
null
590,345
null
590,345
null
1
23
ruby-on-rails-3|deployment|encoding|bundler
11,274
<pre><code>export LANG=en_US.UTF-8 export LC_ALL=en_US.UTF-8 </code></pre>
7,187,302
What is serialVersionUID in java, normally in exception class?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/285793/why-should-i-bother-about-serialversionuid">Why should I bother about serialVersionUID?</a> </p> </blockquote> <p>I am going through some exception handling code and i saw something named as serialVersio...
7,187,455
3
6
null
2011-08-25 08:33:27.093 UTC
5
2019-02-19 04:09:14.087 UTC
2017-05-23 11:47:07.663 UTC
null
-1
null
789,214
null
1
41
java|serialization|serialversionuid
39,069
<p><code>serialVersionUID</code> is a field to define the version of a particular class while <code>seriializing</code> &amp; <code>deseriializing</code>.. consider a scenario where you have a class <code>Employee</code> which has 3 fields which has been in production for some time (meaning there may exist many seriali...
7,407,242
How to cancel handler.postDelayed?
<p>What if I have <code>handler.postDelayed</code> thread already under execution and I need to cancel it?</p>
7,407,417
3
3
null
2011-09-13 19:19:38.073 UTC
10
2016-01-10 01:35:38.243 UTC
null
null
null
null
397,991
null
1
78
android
44,553
<p>I do this to cancel postDelays, per the Android: <a href="http://developer.android.com/reference/android/os/Handler.html#removeCallbacks%28java.lang.Runnable%29" rel="noreferrer">removeCallbacks</a> removes any pending posts of Runnable r that are in the message queue.</p> <pre><code>handler.removeCallbacks(runnabl...
7,646,657
Writing response body with BaseHTTPRequestHandler
<p>I'm playing a little with Python 3.2.2 and want to write a simple web server to access some data remotely. This data will be generated by Python so I don't want to use the SimpleHTTPRequestHandler as it's a file server, but a handler of my own.</p> <p>I copied some example from the internet but I'm stuck because <s...
7,647,695
4
3
null
2011-10-04 10:43:04.957 UTC
6
2020-04-14 00:45:28.93 UTC
2011-10-04 11:43:14.647 UTC
null
9,686
null
9,686
null
1
39
python|basehttprequesthandler
72,701
<p>In Python3 string is a different type than that in Python 2.x. Cast it into bytes using either </p> <pre><code>self.wfile.write(bytes("&lt;html&gt;&lt;head&gt;&lt;title&gt;Title goes here.&lt;/title&gt;&lt;/head&gt;/html&gt;","utf-8")) </code></pre> <p>or </p> <pre><code>self.wfile.write("&lt;html&gt;&lt;head&...
23,969,619
Plotting with seaborn using the matplotlib object-oriented interface
<p>I strongly prefer using <code>matplotlib</code> in OOP style:</p> <pre><code>f, axarr = plt.subplots(2, sharex=True) axarr[0].plot(...) axarr[1].plot(...) </code></pre> <p>This makes it easier to keep track of multiple figures and subplots.</p> <p>Question: How to use seaborn this way? Or, how to change <a href="...
23,973,562
1
1
null
2014-05-31 11:39:01.68 UTC
64
2021-02-16 16:47:42.72 UTC
2014-06-01 16:40:54.273 UTC
null
1,533,576
null
2,925,169
null
1
123
python|oop|matplotlib|seaborn
99,713
<p>It depends a bit on which seaborn function you are using.</p> <p>The plotting functions in seaborn are broadly divided into two classes</p> <ul> <li>&quot;Axes-level&quot; functions, including <code>regplot</code>, <code>boxplot</code>, <code>kdeplot</code>, and many others</li> <li>&quot;Figure-level&quot; function...
24,005,974
Cannot use mkdir in home directory: permission denied (Linux Lubuntu)
<p>I am trying to create a directory in my home directory on Linux using the mkdir command, but am getting a 'permission denied' error. I have recently installed Lubuntu on my laptop, and have the only user profile on the computer.</p> <p>Here's what happened on my command line:</p> <pre><code>jdub@Snowball:~$ cd /h...
24,006,189
3
1
null
2014-06-03 01:57:51.617 UTC
8
2020-07-13 23:25:20.433 UTC
null
null
null
null
3,701,355
null
1
25
linux|bash
230,883
<p>As @kirbyfan64sos notes in a comment, <strong><code>/home</code> is NOT your home directory</strong> (a.k.a. home folder):</p> <p>The fact that <code>/home</code> is an <em>absolute, literal</em> path that <em>has no user-specific component</em> provides a clue.</p> <p>While <code>/home</code> happens to be the <em>...
21,635,870
How to zoom out a div using animations?
<p>I have a DIV that is covering the whole page (height and width are 100%). I am trying to use CSS (and possibly JavaScript) to create a zoom out animation effect so the DIV is smaller (making everything inside the div - its children - smaller as well) to a specific point on the page (middle of the page) and to a spec...
21,636,147
2
3
null
2014-02-07 19:08:40.79 UTC
1
2018-09-05 18:51:45.78 UTC
2018-09-05 18:51:45.78 UTC
null
2,756,409
null
220,755
null
1
8
javascript|jquery|html|css
44,086
<p>I am using the universal selector to target everything inside of the parent container to have the css transitions applied to it.</p> <p>The next thing I did was changed the inside contents width to a <code>%</code> for ease of scaling.</p> <p>Here is the css:</p> <pre><code>#toBeZoomedOut * { -webkit-transitio...
2,015,451
Domain queries in CQRS
<p>We are trying out <a href="http://codebetter.com/blogs/gregyoung/archive/2009/08/13/command-query-separation.aspx" rel="noreferrer">CQRS</a>. We have a validation situation where a CustomerService (domain service) needs to know whether or not a Customer exists. Customers are unique by their email address. Our Custom...
2,017,029
4
0
null
2010-01-06 19:06:34.25 UTC
25
2017-11-08 10:20:51.023 UTC
null
null
null
null
32,855
null
1
26
domain-driven-design|cqrs
9,902
<p>Take a look at this blog post: <a href="http://web.archive.org/web/20120111165641/http://bjarte.com/post/224749430/set-based-validation-in-the-cqrs-architecture" rel="noreferrer">Set based validation in the CQRS Architecture</a>.</p> <p>It addresses this very issue. It's a complex issue to deal with in CQRS. What...
10,411,650
How to shutdown an Android mobile programmatically?
<p>Is it possible to shutdown the mobile programmatically. that is with out using su commands..</p>
10,411,681
7
2
null
2012-05-02 10:09:19.99 UTC
5
2022-08-25 14:22:52.207 UTC
2019-01-22 08:02:38.813 UTC
null
1,033,581
null
1,271,445
null
1
7
android
40,903
<p>You could possibly use the PowerManager to make it reboot (this does not guarantee that it'll reboot - OS may cancel it):</p> <p><a href="http://developer.android.com/reference/android/os/PowerManager.html#reboot(java.lang.String" rel="nofollow">http://developer.android.com/reference/android/os/PowerManager.html#re...
10,660,260
What are my options to check for viruses on a PHP upload?
<p>I am looking to see how I can go about checking if an uploaded file has a virus or not via PHP. What options exist, pros and cons of each, etc.</p>
10,660,335
2
2
null
2012-05-18 22:02:15.933 UTC
10
2022-04-06 15:15:29.073 UTC
2015-07-03 21:53:20.433 UTC
null
472,495
null
1,361,948
null
1
20
php|file-upload|antivirus|virus
33,146
<p><a href="http://clamav.net" rel="noreferrer">ClamAV</a> is a free anti virus commonly used on server applications.</p> <p><a href="http://sourceforge.net/projects/php-clamav/" rel="noreferrer">php-clamav</a> is an extension for binding ClamAV to PHP. You can check their <a href="http://php-clamav.sourceforge.net/" ...
10,860,745
php - working with dates like "every other week on tuesday"
<p>I have a web scheduling app that I'm currently rewriting and have some questions about how to work with recurring appointments (I know there is no shortage of "what's the best way to do this" when it comes to recurring appts).</p> <p>So I want to offer recurring appointments where the user can schedule an appointme...
10,861,039
3
3
null
2012-06-02 07:57:24.667 UTC
9
2012-06-02 09:32:43.283 UTC
2012-06-02 08:06:02.963 UTC
null
472,700
null
472,700
null
1
6
php|date|recurring-events
8,950
<p>Personally I'd look to work with <a href="http://www.php.net/manual/en/class.datetime.php" rel="noreferrer">DateTime</a> objects and use the <a href="http://www.php.net/manual/en/class.dateinterval.php" rel="noreferrer">DateInterval</a> class.</p> <p>In your above case, you need to work out the date of the first/ne...
26,057,995
Changing default welcome-page for spring-boot application deployed as a war
<p>I was trying to find a way to change the default welcome-page for a spring-boot application that is being deployed as a war in production but I can't find a way to do it without a web.xml file.</p> <p>According to the documentation we can do it using the EmbeddedServletContainerFactory with this code:</p> <pre><co...
29,054,676
4
1
null
2014-09-26 10:59:26.237 UTC
8
2019-02-14 19:30:32.37 UTC
null
null
null
null
2,785,655
null
1
22
spring|tomcat7|spring-boot
44,365
<p>It's not too hard to do... you just need to forward the default mapping... </p> <pre><code>@Configuration public class DefaultView extends WebMvcConfigurerAdapter{ @Override public void addViewControllers( ViewControllerRegistry registry ) { registry.addViewController( "/" ).setViewName( "forward:/...
7,059,299
How to properly convert an unsigned char array into an uint32_t
<p>So, I'm trying to convert an array of <code>unsigned char</code>s into an <code>uint32_t</code>, but keep getting different results each time:</p> <pre><code>unsigned char buffer[] = {0x80, 0x00, 0x00, 0x00};; uint32_t num = (uint32_t*)&amp;buffer; </code></pre> <p>Now, I keep getting this warning: </p> <blockquo...
7,059,314
6
1
null
2011-08-14 19:51:41.503 UTC
0
2020-07-29 17:26:46.577 UTC
null
null
null
null
2,133,758
null
1
13
c|casting
43,024
<p>Did you try this ?</p> <pre><code>num = (uint32_t)buffer[0] &lt;&lt; 24 | (uint32_t)buffer[1] &lt;&lt; 16 | (uint32_t)buffer[2] &lt;&lt; 8 | (uint32_t)buffer[3]; </code></pre> <p>This way you control endianness and whatnot.</p> <p>It's really not safe to cast a <code>char</code> pointer and int...
7,461,080
Fastest way to check if string contains only digits in C#
<p>I know a few ways of how to check if a string contains only digits:<br /> RegEx, <code>int.parse</code>, <code>tryparse</code>, looping, etc.</p> <p>Can anyone tell me what the <em>fastest</em> way to check is?</p> <p>I need only to <strong>CHECK</strong> the value, no need to actually parse it.</p> <p>By &quot;digi...
7,461,095
20
7
null
2011-09-18 11:10:50.24 UTC
29
2022-07-06 08:31:28.053 UTC
2021-12-21 15:09:51.367 UTC
null
11,047,824
null
846,351
null
1
224
c#|string|performance
286,653
<pre><code>bool IsDigitsOnly(string str) { foreach (char c in str) { if (c &lt; '0' || c &gt; '9') return false; } return true; } </code></pre> <p>Will probably be the fastest way to do it.</p>
14,116,569
Force Div below another and prevent overlap
<p>I have two Div elements. The first should be 100% height and width of the screen. I would like the second Div to be 100% width but variable height depending on the contents and to start inline (below the first). So the full screen is Div 1 and you have to scroll down to see Div 2. But everything I have tried they ov...
14,116,617
3
0
null
2013-01-02 03:31:38.377 UTC
1
2017-12-31 05:07:00.573 UTC
null
null
null
user759885
null
null
1
10
css|layout|html
50,639
<p>Becasue</p> <pre class="lang-css prettyprint-override"><code>position:absolute </code></pre> <p>makes the div non-occupy, which means other elements don't "see" them when aligning and positioning.</p> <p>Use this:</p> <pre class="lang-css prettyprint-override"><code>html,body { height:100%; } div.div2 { ...
13,892,638
Extracting the relationship between entities in Stanford CoreNLP
<p>I want to extract the complete relationship between two entities using Stanford CoreNLP (or maybe other tools).</p> <p>For example:</p> <blockquote> <p>Windows is <em>more popular than</em> Linux.</p> <p>This tool <em>requires</em> Java.</p> <p>Football is <em>the most popular game in</em> the World.</...
13,924,721
4
1
null
2012-12-15 13:30:52.62 UTC
9
2016-11-25 10:11:22.82 UTC
2012-12-15 13:36:21.337 UTC
null
905,902
null
1,240,492
null
1
13
nlp|stanford-nlp
8,047
<p>You are probably looking for dependency relations between nouns. Stanford Parser provides such output. Have a look <a href="http://nlp.stanford.edu/software/stanford-dependencies.shtml" rel="noreferrer">here</a>. You can combine what Pete said (i.e. the POS graph) with the dependency graph to identify what relations...
13,805,188
Switch button - disable swipe function
<p>I have a <code>switch</code> button (actually is a custom one) and I want to disable the swipe functionality for some reason; I want the user to be able to click it only. Is there a way to achieve this? Thanks.</p>
17,199,262
8
2
null
2012-12-10 16:39:30.08 UTC
4
2022-07-28 08:10:31.35 UTC
null
null
null
null
500,096
null
1
29
android
51,542
<p>You can setClickable(false) to your Switch, then listen for the onClick() event within the Switch's parent and toggle it programmatically. The switch will still appear to be enabled but the swipe animation won't happen.</p> <p>...</p> <p>[In onCreate()]</p> <pre><code>Switch switchInternet = (Switch) findViewById...
9,338,122
Action items from Viewpager initial fragment not being displayed
<p>In the application I am developing I am using a ViewPager with fragments and each fragment constructs its own menu independently of all of the other fragments in the ViewPager.</p> <p>The issue is that sometimes the fragments that are initialised by the ViewPager by default (i.e in it's initial state) are not havin...
12,048,173
8
1
null
2012-02-18 03:01:23.88 UTC
16
2020-12-29 23:50:50.22 UTC
null
null
null
null
181,358
null
1
32
android|android-fragments|android-actionbar|android-viewpager
14,268
<p><strong>You should read this (by xcolw...)</strong></p> <p>Through experimentation it seems like the root cause is invalidateOptionsMenu getting called more than one without a break on the main thread to process queued up jobs. A guess - this would matter if some critical part of menu creation was deferred via a po...
32,689,686
Overlapping CSS flexbox items in Safari
<p>What's the correct CSS to force Safari to not overlap flex items within a default flex container?</p> <p>Safari seems to give too much width to flex items with lots of content.</p> <p><strong>Safari:</strong> (v8.0.8 on Mac OS X 10.10.5 Yosemite)<br> <a href="https://i.stack.imgur.com/6oBeN.png"><img src="https://...
32,695,233
3
3
null
2015-09-21 07:34:10.28 UTC
10
2021-01-14 10:55:01.387 UTC
2016-05-26 21:56:05.19 UTC
null
1,553,812
null
1,553,812
null
1
47
html|css|safari|flexbox
18,841
<p>The element is shrinking. You need to set the <code>flex-shrink</code> property to <code>0</code> on the shrinking element.</p> <pre><code>main &gt;div:first-child { -webkit-flex: 0; flex-shrink: 0; } </code></pre>
19,682,818
Collections.sort() using comparator?
<pre><code>import java.util.*; public class C_2 { public static void main(String args[]) { String theStrings[] = { "x", "a", "b", "c", "d" }; List l = Arrays.asList(theStrings); Collections.sort(l); // line a Collections.sort(l, new ThisIsMyThing()); ...
19,683,102
3
3
null
2013-10-30 12:54:49.46 UTC
1
2014-12-16 14:08:09.33 UTC
2013-10-30 12:58:32.443 UTC
null
684,368
null
2,909,299
null
1
5
java|collections|comparator
44,122
<p><code>Collection.sort(l)</code> assumes that the contents of <code>l</code> are <code>Comparable</code>. <code>Collection.sort(1, Comparator)</code> uses a custom comparator to compare the contents of <code>l</code>, this is what you did. The very idea of sorting (including the <code>sort()</code> method) implies t...
34,007,632
How to remove a column in a numpy array?
<p>Imagine we have a 5x4 matrix. We need to remove only the first dimension. How can we do it with <strong>numpy</strong>? </p> <pre><code>array([[ 0., 1., 2., 3.], [ 4., 5., 6., 7.], [ 8., 9., 10., 11.], [ 12., 13., 14., 15.], [ 16., 17., 18., 19.]], dtype=float3...
34,008,274
3
3
null
2015-11-30 20:42:46.503 UTC
5
2015-12-01 18:54:00.547 UTC
2015-11-30 20:52:28.44 UTC
null
2,588,210
null
1,984,680
null
1
18
python|arrays|numpy
76,163
<p>If you want to remove a column from a 2D Numpy array you can specify the columns like this </p> <p>to keep all rows and to get rid of column 0 (or start at column 1 through the end)</p> <pre><code>a[:,1:] </code></pre> <p>another way you can specify the columns you want to keep ( and change the order if you wish...
24,797,857
Java - Filtering List Entries by Regex
<p>My code looks like this:</p> <pre><code>List&lt;String&gt; filterList(List&lt;String&gt; list, String regex) { List&lt;String&gt; result = new ArrayList&lt;String&gt;(); for (String entry : list) { if (entry.matches(regex)) { result.add(entry); } } return result; } </code></pre> <p>It returns...
31,888,916
3
2
null
2014-07-17 07:55:00.72 UTC
7
2019-01-14 10:58:58.137 UTC
null
null
null
null
919,578
null
1
19
java|regex|collections
44,266
<p>In addition to the answer from Konstantin: Java 8 added <code>Predicate</code> support to the <code>Pattern</code> class via <code>asPredicate</code>, which calls <code>Matcher.find()</code> internally:</p> <pre><code>Pattern pattern = Pattern.compile("..."); List&lt;String&gt; matching = list.stream() ...
44,911,251
How to create an RXjs RetryWhen with delay and limit on tries
<p>I am trying to make an API call (using angular4), which retries when it fails, using retryWhen. I want it to delay for 500 ms and retry again. This can be achieved with this code:</p> <pre><code>loadSomething(): Observable&lt;SomeInterface&gt; { return this.http.get(this.someEndpoint, commonHttpHeaders()) .re...
44,911,567
2
1
null
2017-07-04 17:12:28.483 UTC
13
2020-10-20 18:11:29.233 UTC
2018-06-10 10:01:55.963 UTC
null
3,100,587
null
2,044,706
null
1
31
angular|rxjs|observable
21,358
<p>You need to apply the limit to the retry signal, for instance if you only wanted 10 retries:</p> <pre class="lang-js prettyprint-override"><code>loadSomething(): Observable&lt;SomeInterface&gt; { return this.http.get(this.someEndpoint, commonHttpHeaders()) .retryWhen(errors =&gt; // Time shift the retr...
910,850
jquery assign onclick for li from a link
<p>I have a list of items</p> <pre><code>&lt;ul class="list"&gt; &lt;li&gt; &lt;a href="#Course1" class="launch" onclick="alert('event 1')"&gt;event 1&lt;/a&gt; &lt;/li&gt; &lt;li class="alt"&gt; &lt;a href="#Course2" class="launch" onclick="alert('event 2')"&gt;event 2&lt;/a&gt; &lt;/l...
913,875
5
0
null
2009-05-26 14:01:29.87 UTC
7
2009-05-27 04:56:44.06 UTC
null
null
null
null
53,365
null
1
5
jquery
40,702
<p>building on <a href="https://stackoverflow.com/users/72859/thomas-stock">@Thomas Stock's</a> <a href="https://stackoverflow.com/questions/910850/jquery-assign-onclick-for-li-from-a-link/910877#910877">answer</a> the following code prevents double execution on clicking on link instead of li. (got it from <a href="htt...
99,876
Selenium Critique
<p>I just wanted some opinions from people that have run Selenium (<a href="http://selenium.openqa.org" rel="nofollow noreferrer">http://selenium.openqa.org</a>) I have had a lot of experience with WaTiN and even wrote a recording suite for it. I had it producing some well-structured code but being only maintained by m...
99,965
5
0
null
2008-09-19 05:29:11.03 UTC
16
2019-09-03 07:12:25.723 UTC
2019-09-03 07:12:25.723 UTC
moocha
8,791,568
Adam Driscoll
13,688
null
1
16
unit-testing|selenium|automated-tests|ui-testing
3,675
<p>If you are using <a href="http://selenium-ide.openqa.org/" rel="nofollow noreferrer">Selenium IDE</a> to generate code, then you just get a list of every action that selenium will execute. To me, Selenium IDE is a good way to start or do a fast "try and see" test. But, when you think about maintainability and more r...
880,981
In a join table, what's the best workaround for Rails' absence of a composite key?
<pre><code>create_table :categories_posts, :id =&gt; false do |t| t.column :category_id, :integer, :null =&gt; false t.column :post_id, :integer, :null =&gt; false end </code></pre> <p>I have a join table (as above) with columns that refer to a corresponding <em>categories</em> table and a <em>posts</em> table. I ...
881,024
5
0
null
2009-05-19 04:30:25.203 UTC
18
2016-01-06 21:58:43.083 UTC
2009-05-19 04:36:25.67 UTC
null
101,050
null
101,050
null
1
32
ruby-on-rails|database|composite-key|junction-table
10,209
<p>Add a unique index that includes both columns. That will prevent you from inserting a record that contains a duplicate category_id/post_id pair.</p> <pre><code>add_index :categories_posts, [ :category_id, :post_id ], :unique =&gt; true, :name =&gt; 'by_category_and_post' </code></pre>
1,142,562
Loading a webpage through UIWebView with POST parameters
<p>Is it possible to load a page through UIWebView with POST parameters? I can probably just load an embedded form with the parameters and fill them in with javascript and force a submit, but is there a cleaner and faster way?</p> <p>Thanks!</p>
1,143,020
5
0
null
2009-07-17 10:47:26.66 UTC
23
2022-06-17 10:28:08.853 UTC
null
null
null
jurek epimetheus
null
null
1
57
iphone|http|uiwebview
42,030
<p>Create POST URLRequest and use it to fill webView</p> <pre><code>NSURL *url = [NSURL URLWithString: @"http://your_url.com"]; NSString *body = [NSString stringWithFormat: @"arg1=%@&amp;arg2=%@", @"val1",@"val2"]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc]initWithURL: url]; [request setHTTPMethod: @"...
220,250
In C# why can't a conditional operator implicitly cast to a nullable type
<p>I am curious as to why an implicit cast fails in...</p> <pre><code>int? someValue = SomeCondition ? ResultOfSomeCalc() : null; </code></pre> <p>and why I have to perform an explicit cast instead</p> <pre><code>int? someValue = SomeCondition ? ResultofSomeCalc() : (int?)null; </code></pre> <p>It seems to me that ...
220,268
6
4
null
2008-10-20 23:04:11.337 UTC
8
2015-04-14 10:13:17.14 UTC
2010-04-07 10:11:00.04 UTC
Marc Gravell
19,750
Tim J
10,387
null
1
32
c#|conditional-operator|nullable
14,020
<p>The relevant section of the C# 3.0 spec is 7.13, the conditional operator:</p> <p>The second and third operands of the ?: operator control the type of the conditional expression. Let X and Y be the types of the second and third operands. Then,</p> <p>If X and Y are the same type, then this is the type of the condi...
628,416
JAAS for human beings
<p>I am having a hard time understanding JAAS. It all seems more complicated than it should be (especially the Sun tutorials). I need a simple tutorial or example on how to implement security (authentication + authorization) in java application based on Struts + Spring + Hibernate with custom user repository. Can be im...
628,451
6
3
null
2009-03-09 23:27:00.08 UTC
50
2017-04-01 23:43:33.78 UTC
2009-03-09 23:59:46.18 UTC
matt b
4,249
Dan
68,473
null
1
86
java|security|spring|spring-security|jaas
32,427
<p>Here are some of the links I used to help understand JAAS:</p> <p><a href="http://www.owasp.org/index.php/JAAS_Tomcat_Login_Module" rel="nofollow noreferrer">http://www.owasp.org/index.php/JAAS_Tomcat_Login_Module</a></p> <p><a href="http://www.javaworld.com/jw-09-2002/jw-0913-jaas.html" rel="nofollow noreferrer">...
299,703
delegate keyword vs. lambda notation
<p>Once it is compiled, is there a difference between:</p> <pre><code>delegate { x = 0; } </code></pre> <p>and</p> <pre><code>() =&gt; { x = 0 } </code></pre> <p>?</p>
299,712
6
0
null
2008-11-18 18:38:08.537 UTC
87
2019-11-06 18:28:55.45 UTC
2011-10-07 12:18:45.357 UTC
Joel Coehoorn
41,956
MojoFilter
93
null
1
190
c#|.net|delegates|lambda|anonymous-methods
73,423
<p>Short answer : no.</p> <p>Longer answer that may not be relevant: </p> <ul> <li>If you assign the lambda to a delegate type (such as <code>Func</code> or <code>Action</code>) you'll get an anonymous delegate.</li> <li>If you assign the lambda to an Expression type, you'll get an expression tree instead of a anony...