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
9,376,384
Sort a list of tuples depending on two elements
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/3979872/python-how-to-sort-a-complex-list-on-two-different-keys">python: how to sort a complex list on two different keys</a> </p> </blockquote> <p>I've got a list of tuples. I want to sort them depending two e...
9,376,419
1
2
null
2012-02-21 11:01:21.263 UTC
13
2012-02-21 11:04:07.923 UTC
2017-05-23 12:02:24.833 UTC
null
-1
null
967,164
null
1
56
python|sorting|python-3.x|tuples
62,146
<pre><code>sorted(unsorted, key=lambda element: (element[1], element[2])) </code></pre> <p>I've assumed an order for the keys from the sample output.</p>
16,120,697
Kotlin: how to pass a function as parameter to another?
<p>Given function foo :</p> <pre><code>fun foo(m: String, bar: (m: String) -&gt; Unit) { bar(m) } </code></pre> <p>We can do:</p> <pre><code>foo("a message", { println("this is a message: $it") } ) //or foo("a message") { println("this is a message: $it") } </code></pre> <p>Now, lets say we have the following...
33,402,863
11
0
null
2013-04-20 13:04:06.723 UTC
29
2022-03-12 05:07:04.833 UTC
2017-06-15 17:08:41.263 UTC
null
1,530,549
null
393,786
null
1
274
kotlin
163,595
<p>Use <code>::</code> to signify a function reference, and then:</p> <pre><code>fun foo(msg: String, bar: (input: String) -&gt; Unit) { bar(msg) } // my function to pass into the other fun buz(input: String) { println(&quot;another message: $input&quot;) } // someone passing buz into foo fun something() { ...
16,396,297
Camera preview freezes after screen lock
<p>The custom camera app I've written stops giving the preview after the screen locks (by pushing lock butten or waiting for a couple of minutes). I don't get an exception, which makes it quite difficult to find the problem. </p> <p>Does the android screen lock (if that's the correct term) pauses/halts/... my App (act...
16,532,667
4
1
null
2013-05-06 10:01:27.407 UTC
10
2017-03-01 08:05:36.567 UTC
null
null
null
null
2,320,084
null
1
20
java|android|android-activity|camera
7,111
<p>I faced same problem and fixed it using following steps:</p> <ol> <li><p>I created my camera preview and added it to the container FrameLayout in onResume() of the parent activity. Something like:</p> <pre><code>public void onResume{ super.onResume(); mCamera = Camera.open(); if(null != mCamera){ ...
16,105,485
unsupported operand type(s) for *: 'float' and 'Decimal'
<p>I'm just playing around learning classes functions etc, So I decided to create a simple function what should give me tax amount.</p> <p>this is my code so far.</p> <pre><code>class VAT_calculator: """ A set of methods for VAT calculations. """ def __init__(self, amount=None): self.amount ...
16,105,582
2
1
null
2013-04-19 13:13:25.863 UTC
7
2018-03-20 05:18:01.86 UTC
2018-03-20 05:18:01.86 UTC
null
3,962,914
null
578,822
null
1
76
python|django
140,147
<p>It seems like <code>self.VAT</code> is of <code>decimal.Decimal</code> type and <code>self.amount</code> is a <code>float</code>, thing that you can't do.</p> <p>Try <code>decimal.Decimal(self.amount) * self.VAT</code> instead.</p>
28,947,607
ascii codec cant decode byte 0xe9
<p>I have done some research and seen solutions but none have worked for me.</p> <p><a href="https://stackoverflow.com/questions/9644099/python-ascii-codec-cant-decode-byte">Python - &#39;ascii&#39; codec can&#39;t decode byte</a> </p> <p>This didn't work for me. And I know the 0xe9 is the é character. But I still ca...
28,947,833
4
8
null
2015-03-09 16:55:36.733 UTC
null
2015-03-09 17:23:27.21 UTC
2017-05-23 10:31:00.813 UTC
null
-1
null
3,961,428
null
1
7
python|unicode|encoding|utf-8|decode
40,231
<p>You are trying to encode bytestrings:</p> <pre><code>&gt;&gt;&gt; '&lt;counter name="Entreé"&gt;'.encode('utf8') Traceback (most recent call last): File "&lt;stdin&gt;", line 1, in &lt;module&gt; UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 20: ordinal not in range(128) </code></pre> <p>P...
17,403,795
Populate state and city dropdowns based on country and state using jQuery
<p>I am trying to accomplish dropdowns using JSON. I want 3 dropdowns. First populate the country dropdown (eg: usa, uk etc.,). Now, when the user select USA then states dropdown needs to be populated by using jQuery .change(). Again when user select the state they need to be presented with cities dropdowns.</p> <p>Ho...
17,404,238
4
1
null
2013-07-01 11:48:32.357 UTC
3
2019-02-06 12:14:10.553 UTC
2018-10-17 09:41:38.917 UTC
null
87,015
null
1,395,787
null
1
6
javascript|jquery|json|ajax|html-select
66,816
<p>Exactly like others said, you have to handle the <code>onchange</code> event of country &amp; state select inputs &amp; apply your logic. I have fiddled here for getting states dynamically on selecting a country, you might be able to code the rest yourself - <a href="http://jsfiddle.net/YqLh8/" rel="nofollow norefer...
17,312,949
Delphi Error Dataset not in Insert or Edit Mode
<p>Objective:</p> <ol> <li>Click on the button on the TRxDBCombo to call a search box</li> <li>On Selecting the record from search box, the result is set as Field Value for the TComboEditBox and is posted in the TRxMemoryData Dataset</li> </ol> <p>The Error:</p> <p>Dataset not in Insert or Edit Mode appears the seco...
17,334,907
1
2
null
2013-06-26 06:25:34.33 UTC
null
2013-06-27 05:05:33.263 UTC
2013-06-26 13:12:24.76 UTC
null
1,744,164
null
964,576
null
1
6
delphi|delphi-7
42,870
<p>The error is coming because of the following line: <strong>TDBEditBox1.Field.Value := MResult;</strong> at this line your dataset is not in Insert or Edit mode. You can add following check to avoid this error:</p> <pre><code>if not (TDBEditBox1.DataSource.DataSet.State in [dsEdit, dsInsert]) then begin TDBEditBo...
17,329,924
How to get Java File absolute path from InputStream?
<p>I'm on Java 6 and I have a method that scans the runtime classpath for a file called <code>config.xml</code>. If found, I would like to read the contents of the file into a string:</p> <pre><code>InputStream istream = this.getClass().getClassLoader().getResourceAsStream("config.xml"); if(istream != null) { Syst...
17,330,561
2
2
null
2013-06-26 20:32:39.277 UTC
2
2013-06-26 21:14:04.607 UTC
null
null
null
user1768830
null
null
1
18
java|file-io|classpath|classloader|absolute-path
78,926
<p>From your given example, it is not clear what <code>fileName</code> refers to. You should just use the stream you got from <code>getResourceAsStream()</code>to read you file, something along</p> <pre><code>reader = new BufferedReader(new InputStreamReader(istream)); </code></pre> <p>And you should avoid to repeate...
17,660,469
Get field class in annotations processor
<p>I am writing my first Annotations processor and having trouble with something that seems trivial but I cannot find any information about it.</p> <p>I have a element annotated with my annotation</p> <pre><code>@MyAnnotation String property; </code></pre> <p>When I get this property as a element in my processor I c...
17,660,882
1
2
null
2013-07-15 17:43:31.077 UTC
14
2015-10-26 18:18:33.463 UTC
2013-07-15 17:49:07.617 UTC
null
771,578
null
662,994
null
1
19
java|annotations
13,325
<p>When running your annotation processor, you don't have access to the compiled classes. The point of annotation processing is that it happens pre-compile.</p> <p>Instead, you need to create an annotation processor that specifically handles your annotation type, then use the mirror API to access the field. For exampl...
12,042,303
Accessing variables in other Windows Form class
<p>I will appreciate if anyone can help me on this.</p> <p>I have a windows form app that has three forms: form1, form2, form3. form1 starts when the app is activated. on form1, there is a button that brings up form2, and hide form1. there is also one button that brings up form3 and hides form2 on form2.</p> <pre><co...
12,042,398
4
6
null
2012-08-20 17:35:47.347 UTC
2
2017-07-16 16:35:40.63 UTC
2017-07-16 16:35:40.63 UTC
null
107,625
null
1,401,920
null
1
3
c#|windows|forms
60,472
<p>So you have information in the parent form (form2) that you want to access in a method of the child form (form3).</p> <ol> <li>Create properties in <code>form3</code> for the information that it will need.</li> <li>When <code>form2</code> creates an instance of <code>form3</code> it should set those properties.</li...
22,321,769
Function.prototype.apply.bind usages?
<p>I perfectly know the <a href="https://stackoverflow.com/a/8843181/859154">usages</a> for : </p> <p><code>Function.prototype.bind.apply(f,arguments)</code></p> <blockquote> <blockquote> <p>Explanation - Use the original (if exists) <code>bind</code> method over <code>f</code> with <code>arguments</code> (wh...
22,322,147
1
2
null
2014-03-11 09:40:37.557 UTC
19
2014-03-11 09:55:04.413 UTC
2017-05-23 12:18:25.473 UTC
null
-1
null
859,154
null
1
15
javascript
2,772
<p>This is used to fix the first parameter of <code>.apply</code>.</p> <p>For example, when you get the max value from an array, you do:</p> <pre><code>var max_value = Math.max.apply(null, [1,2,3]); </code></pre> <p>But you want to get the first parameter fixed to <code>null</code>, so you could create an new functi...
21,632,243
How do I get asynchronous / event-driven LISTEN/NOTIFY support in Java using a Postgres database?
<p>From what I can tell, the JDBC drivers for LISTEN/NOTIFY in Java do NOT support true event-driven notifications. You have to poll the database every so often to see if there's a new notification.</p> <p>What options do I have in Java (possibly something other than JDBC?), if any, to get notifications asynchronousl...
23,352,527
3
6
null
2014-02-07 15:57:11.243 UTC
14
2022-04-06 04:15:13.113 UTC
null
null
null
null
3,241,719
null
1
44
java|postgresql
29,407
<p>Use the pgjdbc-ng driver.</p> <p><a href="http://impossibl.github.io/pgjdbc-ng/" rel="nofollow noreferrer">http://impossibl.github.io/pgjdbc-ng/</a></p> <p>It supports async notifications, without polling. I have used it successfully.</p> <p>See <a href="https://database-patterns.blogspot.com/2014/04/postgresql-nofi...
26,833,517
Error inflating class android.support.v7.widget.CardView
<p>I unexpectedly encountered the following error while trying to run my application:</p> <pre><code>Binary XML file line #8: Error inflating class android.support.v7.widget.CardView </code></pre> <p>Below is the log cat:</p> <pre><code>11-09 13:11:58.558: E/AndroidRuntime(12542): FATAL EXCEPTION: main 11-09 13:...
37,704,732
11
2
null
2014-11-09 21:26:35.123 UTC
6
2020-05-29 23:59:44.573 UTC
null
null
null
null
3,907,211
null
1
27
java|android|android-layout|android-activity
38,037
<p>I solved this by adding updated cardview and appcompat on the app/build.gradle</p> <pre><code>dependencies { ... compile 'com.android.support:appcompat-v7:23.4.0' compile 'com.android.support:cardview-v7:23.4.0' compile 'com.android.support:recyclerview-v7:23.4.0' } </code></pre> <p>Then re...
26,532,081
What is wrong with my Java solution to Codility MissingInteger?
<p>I am trying to solve the codility MissingInteger problem <a href="https://codility.com/c/intro/demoZKF8W2-4TC" rel="nofollow noreferrer">link</a>:</p> <blockquote> <p>Write a function:</p> <pre><code>class Solution { public int solution(int[] A); } </code></pre> <p>that, given a non-empty zero-indexed array...
26,532,194
5
4
null
2014-10-23 15:48:46.193 UTC
7
2019-11-12 13:20:53.613 UTC
2018-07-02 22:08:42.78 UTC
null
2,891,664
null
3,878,104
null
1
11
java
71,688
<blockquote> <p>returns the minimal positive integer that does not occur in A.</p> </blockquote> <p>So in an array with only one element, if that number is 1, you should return 2. If not, you should return 1.</p> <p>I think you're probably misunderstanding the requirements a little. Your code is creating keys in a ...
21,417,954
Espresso: Thread.sleep( )
<p>Espresso claims that there is no need for <code>Thread.sleep()</code> but my code doesn't work unless I include it. I am connecting to an IP and, while connecting, a progress dialog is shown. I need a <code>Thread.sleep()</code> call to wait for the dialog to dismiss. This is my test code where I use it:</p> <pre><c...
22,563,297
14
11
null
2014-01-28 22:06:54.69 UTC
40
2021-09-17 06:33:34.903 UTC
2020-10-23 08:46:46.23 UTC
null
1,071,320
null
1,642,079
null
1
124
android|testing|android-espresso
80,543
<p>On my mind correct approach will be:</p> <pre><code>/** Perform action of waiting for a specific view id. */ public static ViewAction waitId(final int viewId, final long millis) { return new ViewAction() { @Override public Matcher&lt;View&gt; getConstraints() { return isRoot(); ...
17,583,126
How to tell Gradle to use a different AndroidManifest from the command line?
<p>I have a multi-module project. From the root of my project (which contains multiple modules), I want to be able to call 'gradle build' and have it use a different AndroidManifest in one of my modules depending on some parameter I pass in. What's the best way to accomplish this? Should I use a gradle.properties file ...
17,604,654
2
0
null
2013-07-11 00:24:41.193 UTC
10
2021-12-06 13:28:54.553 UTC
null
null
null
null
760,105
null
1
20
android|command-line|android-manifest|gradle|command-line-arguments
21,589
<p>I solved this by using different build types.</p> <p>Here's my build.gradle:</p> <pre><code>buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.4.2' } } apply plugin: 'android' dependencies { compile project(':facebook-andro...
17,654,266
SOLR autoCommit vs autoSoftCommit
<p>I'm very confused about and . Here is what I understand</p> <ul> <li><p><strong>autoSoftCommit</strong> - after a autoSoftCommit, if the the SOLR server goes down, the autoSoftCommit documents will be lost. </p></li> <li><p><strong>autoCommit</strong> - does a hard commit to the disk and make sure all the autoSo...
17,666,569
3
0
null
2013-07-15 12:28:37.263 UTC
18
2019-09-22 22:48:22.743 UTC
2013-07-15 13:39:01.07 UTC
null
1,378,771
null
1,378,771
null
1
30
solr|solr4
28,914
<p>You have openSearcher=false for hard commits. Which means that even though the commit happened, the searcher has not been restarted and cannot see the changes. Try changing that setting and you will not need soft commit.</p> <p>SoftCommit does reopen the searcher. So if you have both sections, soft commit shows new...
18,656,808
How to optimize vlookup for high search count ? (alternatives to VLOOKUP)
<p>I am looking for alternatives to vlookup, with improved performance within the context of interest.</p> <p>The context is the following:</p> <ul> <li>I have a data set of {key;data} which is big (~ 100'000 records)</li> <li>I want to perform a lot of VLOOKUP operations on the dataset (typical use is to reorder the...
18,656,809
4
1
null
2013-09-06 11:31:30.057 UTC
16
2018-01-31 16:06:10.113 UTC
2018-07-09 18:41:45.953 UTC
null
-1
null
2,496,333
null
1
23
performance|excel|dictionary|vlookup|vba
44,893
<p>I considered the following alternatives:</p> <ul> <li>VLOOKUP array-formula</li> <li>MATCH / INDEX </li> <li>VBA (using a dictionary)</li> </ul> <p>The compared performance is:</p> <ul> <li>VLOOKUP simple formula : ~10 minutes</li> <li>VLOOKUP array-formula : ~10 minutes (1:1 performance index)</li> <li>MATC...
51,860,043
Javascript ES6 TypeError: Class constructor Client cannot be invoked without 'new'
<p>I have a class written in Javascript ES6. When I try to execute <code>nodemon</code> command I always see this error <code>TypeError: Class constructor Client cannot be invoked without 'new'</code></p> <p>The full error is mentioned below:</p> <pre><code>/Users/akshaysood/Blockchain/fabricSDK/dist/application/Tran...
51,860,850
8
7
null
2018-08-15 13:51:13.893 UTC
16
2022-08-01 14:11:08.863 UTC
2018-08-15 14:08:29.397 UTC
null
5,431,173
null
5,431,173
null
1
69
javascript|node.js|ecmascript-6
156,273
<p>The problem is that the class extends native ES6 class and is transpiled to ES5 with Babel. Transpiled classes cannot extend native classes, at least without additional measures.</p> <pre><code>class TranspiledFoo extends NativeBar { constructor() { super(); } } </code></pre> <p>results in something like</...
5,021,995
JsonResult parsing special chars as \u0027 (apostrophe)
<p>I am in the process of converting some of our web "services" to MVC3 from WCF Rest.</p> <p>Our old web services returned JSON from POCO's just fine using: <code>[WebGet(.... ResponseFormat=WebMessageFormat.Json]</code></p> <p>In my controller to return back a simple poco I'm using a JsonResult as the return type, ...
5,022,386
3
0
null
2011-02-16 20:56:33.487 UTC
4
2020-06-12 11:30:49.91 UTC
2011-02-16 21:30:41.023 UTC
null
179,482
null
338,140
null
1
7
asp.net-mvc|asp.net-mvc-3|json
43,149
<p>That shouldn't be any problem, as both representations are equivalent:</p> <pre><code>var a = {"CategoryId":8,"SomeId":6,"Name":"Richie\u0027s House"}; alert(a.Name); </code></pre> <p>alerts <code>Richie's House</code>.</p>
5,021,120
ffmpeg mp3 conversion failed
<p>using ffmpeg to convert from flv to mp3 gives the following result<pre><br> ] ffmpeg-0.6.1 >> ffmpeg -i name.flv name.mp3 FFmpeg version 0.6.1, Copyright (c) 2000-2010 the FFmpeg developers built on Feb 14 2011 12:33:38 with gcc 4.1.2 20080704 (Red Hat 4.1.2-48) configuration: libavutil 50.15. 1 / 50.15. 1 libavcode...
5,023,195
3
0
null
2011-02-16 19:25:26.27 UTC
10
2012-11-14 02:18:19.153 UTC
2011-02-16 19:40:34.103 UTC
null
444,757
null
444,757
null
1
32
ffmpeg|mp3|flv
43,852
<p>It looks like your FFMPEG wasn't compiled with libmp3lame. See this post:</p> <p><a href="https://superuser.com/questions/196857/how-to-install-libmp3lame-for-ffmpeg">https://superuser.com/questions/196857/how-to-install-libmp3lame-for-ffmpeg</a></p> <p>If you can't compile it on your own you'll have to search for...
9,280,716
How to Ignore Line Length PHP_CodeSniffer
<p>I have been using PHP_CodeSniffer with jenkins, my build.xml was configured for phpcs as below </p> <pre><code>&lt;target name="phpcs"&gt; &lt;exec executable="phpcs"&gt; &lt;arg line="--report=checkstyle --report-file=${basedir}/build/logs/checkstyle.xml --standard=Zend ${source}"/&gt; &lt;/exec&gt...
9,281,546
4
3
null
2012-02-14 16:45:06.91 UTC
7
2022-01-17 22:33:09.023 UTC
2013-01-04 22:40:55.15 UTC
null
367,456
null
531,466
null
1
46
php|jenkins|continuous-integration|pear|codesniffer
36,418
<p>You could create your own standard. The Zend one is quite simple (this is at <code>/usr/share/php/PHP/CodeSniffer/Standards/Zend/ruleset.xml</code> in my Debian install after installing it with PEAR). Create another one based on it, but ignore the line-length bit:</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;rule...
9,642,055
CSV Parsing Options with .NET
<p>I'm looking at my delimited-file (e.g. CSV, tab seperated, etc.) parsing options based on MS stack in general, and .net specifically. The only technology I'm excluding is SSIS, because I already know it will not meet my needs.</p> <p>So my options appear to be:</p> <ol> <li>Regex.Split</li> <li><a href="http://m...
9,642,224
3
4
null
2012-03-09 22:51:47.927 UTC
4
2018-07-27 10:38:24.577 UTC
2012-03-09 23:10:42.02 UTC
null
284,758
null
284,758
null
1
14
c#|.net|parsing
38,056
<p>Did you try searching for an already-existing .NET <a href="http://www.codeproject.com/search.aspx?q=.net+CSV+parser" rel="noreferrer">CSV parser</a>? <a href="http://www.codeproject.com/Articles/9258/A-Fast-CSV-Reader" rel="noreferrer">This one</a> claims to handle multi-line records significantly faster than OLEDB...
18,429,121
Inline Form nested within Horizontal Form in Bootstrap 3
<p>I want to build a form in Bootstrap 3 like this:</p> <p><img src="https://i.stack.imgur.com/gsVKH.png" alt=""></p> <p>My site (not the above link) just updates from Bootstrap 2.3.2 and the format is not correct anymore.</p> <p>I cannot find any doc about this type of form on <a href="http://getbootstrap.com" rel=...
18,429,555
6
0
null
2013-08-25 12:46:17.18 UTC
23
2020-05-04 14:31:39.587 UTC
2017-05-23 11:47:26.613 UTC
null
-1
null
1,421,239
null
1
74
html|css|forms|twitter-bootstrap|twitter-bootstrap-3
149,696
<p>I have created a <a href="http://jsfiddle.net/r7hgjjzv/"><strong>demo</strong></a> for you.</p> <p>Here is how your nested structure should be in Bootstrap 3:</p> <pre><code>&lt;div class="form-group"&gt; &lt;label for="birthday" class="col-xs-2 control-label"&gt;Birthday&lt;/label&gt; &lt;div class="col-x...
18,300,536
Get value of attribute in CSS
<p>I have this HTML code:</p> <pre><code>&lt;div data-width="70"&gt;&lt;/div&gt; </code></pre> <p>I want to set it's width in CSS equal to the value of data-width attribute, e.g. something like this:</p> <pre><code>div { width: [data-width]; } </code></pre> <p>I saw this was done somewhere, but I can't remember...
18,301,660
8
2
null
2013-08-18 15:15:00.353 UTC
5
2021-10-31 15:47:21.087 UTC
null
null
null
null
1,616,512
null
1
51
html|css
95,911
<p>You need <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/attr()" rel="noreferrer">the <code>attr</code> CSS function</a>:</p> <pre><code>div { width: attr(data-width); } </code></pre> <p>The problem is that (as of 2021) it's not supported even by some of the major browsers (in my case Chrome):</p> <p><...
20,357,223
easy way to unzip file with golang
<p>is there a easy way to unzip file with golang ?</p> <p>right now my code is:</p> <pre><code>func Unzip(src, dest string) error { r, err := zip.OpenReader(src) if err != nil { return err } defer r.Close() for _, f := range r.File { rc, err := f.Open() if err != nil { ...
24,792,688
8
2
null
2013-12-03 17:00:54.663 UTC
11
2021-05-21 20:53:00.957 UTC
2013-12-07 12:06:52.583 UTC
null
740,182
null
740,182
null
1
37
go|zip|unzip
40,528
<p>Slight rework of the OP's solution to create the containing directory <code>dest</code> if it doesn't exist, and to wrap the file extraction/writing in a closure to eliminate stacking of <code>defer .Close()</code> calls per <a href="https://stackoverflow.com/users/164234/nick-craig-wood">@Nick Craig-Wood</a>'s comm...
15,095,868
jquery.click() not working in iOS
<p>HTML:</p> <pre><code>&lt;div id="footer"&gt; &lt;a class="button1 selected" id="button1" href="#"&gt;&lt;div class="icon"&gt;&lt;/div&gt;&lt;div class="text"&gt;Option 1&lt;/div&gt;&lt;/a&gt; &lt;a class="button2" id="button2" href="#"&gt;&lt;div class="icon"&gt;&lt;/div&gt;&lt;div class="text"&gt;Option 2&...
15,096,054
6
3
null
2013-02-26 17:50:19.783 UTC
5
2021-12-23 07:08:07.72 UTC
2017-05-23 12:32:35.72 UTC
null
-1
null
718,645
null
1
24
jquery|ios
48,030
<p>Try to add a pointer cursor to the button and use .on to bind the click event.</p> <pre><code>$('#button1').css('cursor','pointer'); $(document).on('click', '#button1', function(event) { event.preventDefault(); alert('button1'); }); </code></pre>
15,449,034
Batch program to to check if process exists
<p>I want a batch program, which will check if the process <code>notepad.exe</code> exists.</p> <p><strong>if</strong> <code>notepad.exe</code> exists, it will end the process, </p> <p><strong>else</strong> the batch program will close itself.</p> <p>Here is what I've done:</p> <pre><code>@echo off tasklist /fi "im...
15,449,358
5
5
null
2013-03-16 12:04:48.457 UTC
13
2021-11-05 17:39:24.88 UTC
2016-07-15 10:20:59.073 UTC
null
2,306,173
null
2,176,930
null
1
34
windows|batch-file|command|cmd
149,056
<p><code>TASKLIST</code> does not set errorlevel.</p> <pre><code>echo off tasklist /fi "imagename eq notepad.exe" |find ":" &gt; nul if errorlevel 1 taskkill /f /im "notepad.exe" exit </code></pre> <p>should do the job, since ":" should appear in <code>TASKLIST</code> output only if the task is NOT found, hence <code...
15,120,745
Understanding Oracle's Java on Mac
<p>I've been using Java on OS X for many, many years and recently when Apple stopped including Java by default I let the OS go and install it for me (Apple's variety, of course).</p> <p>So now I'm using OS X 10.8 and I need to install Java 7 so I just got Oracle's Update 15 in DMG form and ran the installer. It updat...
15,133,344
3
1
null
2013-02-27 19:32:16.057 UTC
32
2017-08-15 09:12:13.27 UTC
2017-08-15 09:12:13.27 UTC
null
1,033,581
null
499,689
null
1
49
java|macos|oracle
18,054
<p>Oracle's JVM is only installed in one location. You've been misled!</p> <p>As you've noted, the Java commands in <code>/usr/bin</code> are symlinks to binaries in <code>/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands</code>. The binaries within that directory are stub applications that determi...
38,382,043
How to use CSS position sticky to keep a sidebar visible with Bootstrap 4
<p>I have a two columns layout like this:</p> <pre><code> &lt;div class="row"&gt; &lt;div class="col-xs-8 content"&gt; &lt;/div&gt; &lt;div class="col-xs-4"&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>If I set the <code>position:sticky</code> to the sidebar column, I get the sticky behaviour of t...
38,413,663
4
4
null
2016-07-14 18:50:22.077 UTC
5
2021-08-10 11:36:33.767 UTC
2018-03-05 13:50:48.84 UTC
null
171,456
null
1,165,509
null
1
18
css|twitter-bootstrap|css-position|bootstrap-4|twitter-bootstrap-4
42,773
<p>I solved enabling <code>flexbox</code>. After raising an issue in Bootstrap's <a href="https://github.com/twbs/bootstrap/issues/20307#issuecomment-233069019" rel="noreferrer">Github</a> repository I got an answer by a Bootstrap <a href="https://github.com/cvrebert" rel="noreferrer">member</a>:</p> <blockquote> <p...
28,285,813
Style jQuery autocomplete in a Bootstrap input field
<p>I have implemented a jQuery autocomplete function to a Bootstrap input. The jQuery autocomplete is working fine but I want to see the results as a combo and I guess it's now happening because I'm using BootStrap.</p> <p>This is the field that I'm assigning autocomplete:</p> <pre class="lang-html prettyprint-overri...
28,286,277
5
3
null
2015-02-02 20:05:46.213 UTC
27
2022-03-15 10:18:57.74 UTC
2015-08-06 03:48:26.927 UTC
null
1,366,033
null
1,253,667
null
1
41
jquery|twitter-bootstrap|jquery-autocomplete
146,859
<p>If you're using jQuery-UI, you <em>must</em> include the jQuery UI CSS package, otherwise the UI components don't know how to be styled. </p> <p>If you don't like the jQuery UI styles, then you'll have to recreate all the styles it would have otherwise applied.</p> <p>Here's an example and some possible fixes.</p...
8,122,431
How to create custom view controller container using storyboard in iOS 5
<p>In iOS5 using storyboard feature I want to create a custom container which will have 2 <code>ViewControllers</code> embedded in it. For Example, embed Table view controller as well as a view controller both in one <code>ViewController</code>.</p> <p>That is, one view controller will have 2 relationship:</p> <ol> <...
8,123,625
2
1
null
2011-11-14 13:40:06.963 UTC
11
2014-08-27 07:31:50.9 UTC
2014-08-27 07:31:50.9 UTC
null
3,623,301
null
977,868
null
1
23
ios5|storyboard
22,685
<p>,You should only have one view controller to control the scene. However, this viewController might have two other view controllers that control particular subviews on your scene. To do this you create properties in your scene viewController, in your case one for your tableViewController and one for your view. I like...
8,117,822
In bash, can you use a function call as a condition in an if statement?
<p>here's what i'm trying to achive:</p> <pre><code>function f1() { return 0 } function f2() { return 0 } if [[ f1 &amp;&amp; f2 ]]; then echo "success" else echo "fail" fi </code></pre>
8,117,867
2
0
null
2011-11-14 05:51:49.23 UTC
11
2011-11-14 06:05:05.983 UTC
null
null
null
null
3,966
null
1
47
bash
44,019
<p>You don't use <code>[[</code> (or <code>[</code>) when running a command and checking the result code.</p> <pre><code>if f1 &amp;&amp; f2 ; then echo "success" else echo "fail" fi </code></pre>
9,633,840
Spring autowired bean for @Aspect aspect is null
<p>I have the following spring configuration:</p> <pre><code>&lt;context:component-scan base-package="uk.co.mysite.googlecontactsync.aop"/&gt; &lt;bean name="simpleEmailSender" class="uk.co.mysite.util.email.simple.SimpleEmailSenderImplementation"/&gt; &lt;aop:aspectj-autoproxy/&gt; </code></pre> <p>Then I have an ...
9,658,819
10
7
null
2012-03-09 12:10:32.73 UTC
12
2021-03-08 09:29:20.197 UTC
2012-03-12 09:12:11.953 UTC
null
835,058
null
835,058
null
1
37
java|spring|aop|aspectj|spring-aop
34,390
<p>The aspect is a singleton object and is created outside the Spring container. A solution with XML configuration is to use Spring's factory method to retrieve the aspect.</p> <pre><code>&lt;bean id="syncLoggingAspect" class="uk.co.demo.SyncLoggingAspect" factory-method="aspectOf" /&gt; </code></pre> <p>With t...
9,549,866
PHP Regex to Remove http:// from string
<p>I have full URLs as strings, but I want to remove the http:// at the beginning of the string to display the URL nicely (ex: www.google.com instead of <a href="http://www.google.com">http://www.google.com</a>)</p> <p>Can someone help?</p>
9,549,893
8
7
null
2012-03-03 21:06:22.38 UTC
16
2019-06-05 10:02:19.31 UTC
null
null
null
null
538,143
null
1
50
php|regex
59,331
<pre><code>$str = 'http://www.google.com'; $str = preg_replace('#^https?://#', '', $str); echo $str; // www.google.com </code></pre> <p>That will work for both <code>http://</code> and <code>https://</code></p>
9,419,175
Are closures a violation of the functional programming paradigm?
<p>Functional programming "avoids state and mutable data". </p> <p>Closures hide state by binding their lexical environment and are thus closed over their free <strong>variables</strong>. </p> <p>How is Haskell purely-functional if it supports closures? Don't they break referential transparency?</p>
9,419,915
4
14
null
2012-02-23 18:43:24.36 UTC
10
2013-07-07 20:56:16.497 UTC
2012-04-28 12:40:41.027 UTC
user257111
null
null
255,528
null
1
27
haskell|functional-programming|closures
3,293
<p>In Haskell, closures have free variables in the same way that in math you can write <code>f x = x^2</code> - it doesn't mutate state.</p> <p>I would say that Haskell avoids <em>mutable</em> state.</p>
59,867,434
Every vue component returning Cannot read property 'parseComponent' of undefined
<p>So i've tried researching this but none of the solutions are working. I think it's specifically an issue with some of my vue dependencies, potentially <code>vue-loader</code>, but I'm not sure what specifically to do to fix it. I have tried: </p> <ul> <li>deleting <code>node_modules</code> and re-running <code>npm ...
62,102,017
7
9
null
2020-01-22 20:02:03.94 UTC
5
2022-09-07 04:07:39.41 UTC
2020-01-22 21:08:15.437 UTC
null
3,812,918
null
3,812,918
null
1
29
laravel|vue.js|npm
37,675
<p>I had exacly the same problem and just figured it out, I hope this helps someone. First I changed the vue template compiler to:</p> <blockquote> <p>"vue-template-compiler": "2.6.11"</p> </blockquote> <p>and the I also had to change the vue version to the latest realese, in my case:</p> <blockquote> <p>"vue": ...
8,382,536
Allow a custom Attribute only on specific type
<p>Is there a way to force the compiler to restrict the usage of a custom attribute to be used only on specific <strong>property</strong> types like int, short, string (all the primitive types)?<br> similar to the <a href="http://msdn.microsoft.com/en-us/library/system.attributeusageattribute%28v=vs.95%29.aspx">Attribu...
8,382,559
5
4
null
2011-12-05 08:13:57.52 UTC
1
2022-03-17 09:34:41.96 UTC
2013-05-29 15:25:15.097 UTC
null
773,113
null
601,179
null
1
47
c#|.net|compiler-construction|attributes
30,507
<p>No, you can't, basically. You can limit it to <code>struct</code> vs <code>class</code> vs <code>interface</code>, that is about it. Plus: you can't add attributes to types outside your code anyway (except for via <code>TypeDescriptor</code>, which isn't the same).</p>
5,031,675
Where does paging, sorting, etc go in repository pattern?
<p>Where do we put the logic for paging and sorting data in an asp.net repository pattern project?</p> <p>Should it go in the service layer or put it in the controller and have the controller directly call the repository? Controller -> Repository is shown <a href="http://highoncoding.com/Articles/566_JQuery_jqGrid_Exp...
5,036,023
5
1
null
2011-02-17 16:28:08.73 UTC
12
2011-02-17 23:28:41.63 UTC
2011-02-17 16:34:00.877 UTC
null
400,861
null
400,861
null
1
19
asp.net-mvc|asp.net-mvc-3|repository-pattern
16,391
<p>It should go in the Repository if your Repository returns materialized sequences (<code>ICollection&lt;T&gt;</code>, <code>List&lt;T&gt;</code>), etc.</p> <p>But if your returning <code>IQueryable&lt;T&gt;</code> (like i am), i hope you have a service layer mediating between your Controllers and Repository, which e...
5,285,857
When is using MySQL BLOB recommended?
<p>I'm coding an application that will be uploading and deleting many files, i usually just move the files to a folder in the server naming them with the row unique <code>id</code>. But as i understand MySQL also lets me store binary data (files) when would this be a better choice?.</p> <blockquote> <p>Please use so...
5,285,903
5
1
null
2011-03-12 22:14:29.39 UTC
6
2014-03-06 17:04:48.433 UTC
2017-05-23 12:16:51.87 UTC
null
-1
null
459,688
null
1
19
mysql|filesystems|blob
43,539
<p>Read:</p> <ul> <li><a href="https://stackoverflow.com/questions/4654004/mysql-binary-storage-using-blob-vs-os-file-system-large-files-large-quantities">MySQL Binary Storage using BLOB VS OS File System: large files, large quantities, large problems</a></li> <li><a href="https://stackoverflow.com/questions/815626/to...
5,512,023
Ruby on Rails 3 : "superclass mismatch for class ..."
<p>Platform: Mac OSX 10.6</p> <p>In my terminal, i start the Ruby console with "rails c"</p> <p>While following the Ruby on Rails 3 tutorial to build a class:</p> <pre><code>class Word &lt; String def palindrome? #check if a string is a palindrome self == self.reverse end end </code></pre> <p>i get the err...
5,512,173
5
0
null
2011-04-01 10:20:21.767 UTC
11
2020-05-09 19:31:24.883 UTC
2018-05-20 23:07:43.383 UTC
null
479,863
null
605,948
null
1
69
ruby-on-rails|ruby|ruby-on-rails-3
78,013
<p>You already have a <code>Word</code> class defined elsewhere. I tried within a Rails 3 app but was not able to replicate.</p> <p>If you have not created a second <code>Word</code> class yourself, it is likely one of your Gems or plugins already defines it.</p>
4,954,741
How to ping IP addresses using JavaScript
<p>I want to run a JavaScript code to ping 4 different IP addresses and then retrieve the packet loss and latency of these ping requests and display them on the page.</p> <p>How do I do this?</p>
4,954,789
8
2
null
2011-02-10 08:14:33.513 UTC
9
2021-08-04 02:29:24.657 UTC
2011-02-10 08:16:17.79 UTC
null
313,758
null
434,885
null
1
9
javascript|ping|latency
81,817
<p>You can't do this from JS. What you could do is this:</p> <pre><code> client --AJAX-- yourserver --ICMP ping-- targetservers </code></pre> <p>Make an AJAX request to your server, which will then ping the target servers for you, and return the result in the AJAX result. </p> <p>Possible caveats:</p> <ul> <li>this...
5,383,074
How is an "int" assigned to an object?
<p>How are we able to assign an integer to an object in .NET?</p> <p>Reference types are derived from System.Object and value types are from System.ValueType.</p> <p>So, how is it possible?</p>
5,383,104
9
0
null
2011-03-21 20:13:21.14 UTC
4
2016-05-20 12:37:18.133 UTC
2016-05-20 12:37:18.133 UTC
null
1,465,171
null
670,110
null
1
13
c#|.net|types
41,528
<p>If you look at <a href="http://msdn.microsoft.com/en-us/library/system.valuetype.aspx" rel="nofollow noreferrer"><code>System.ValueType</code></a>, it too derives from <code>System.Object</code></p> <p>Also see <a href="https://stackoverflow.com/questions/1682231/how-do-valuetypes-derive-from-object-referencetype-a...
5,166,842
sort dates in python array
<p>How to sort the below array of dates on python 2.4</p> <pre><code> timestamps = ['2011-06-2', '2011-08-05', '2011-02-04', '2010-1-14', '2010-12-13', '2010-1-12', '2010-2-11', '2010-2-07', '2010-12-02', '2011-11-30', '2010-11-26', '2010-11-23', '2010-11-22', '2010-11-16'] </code></pre>
5,166,911
9
1
null
2011-03-02 11:29:41.57 UTC
9
2020-02-26 17:43:35.997 UTC
null
null
null
null
277,603
null
1
27
python
104,374
<pre><code>sorted(timestamps, key=lambda d: map(int, d.split('-'))) </code></pre>
4,852,251
Is there a software-engineering methodology for functional programming?
<p>Software Engineering as it is taught today is entirely focused on object-oriented programming and the 'natural' object-oriented view of the world. There is a detailed methodology that describes how to transform a domain model into a class model with several steps and a lot of (UML) artifacts like use-case-diagrams o...
4,905,458
13
9
null
2011-01-31 14:50:30.083 UTC
152
2018-01-19 10:36:30.7 UTC
null
null
null
null
783,306
null
1
204
functional-programming|clojure|lisp|model-driven-development
23,116
<p>Thank God that the software-engineering people have not yet discovered functional programming. Here are some parallels:</p> <ul> <li><p>Many OO "design patterns" are captured as higher-order functions. For example, the Visitor pattern is known in the functional world as a "fold" (or if you are a pointy-headed the...
29,542,356
Xcode 6.3 Crashes when navigating from storyboard to other Swift 1.2 file
<p>I installed Xcode 6.3 which includes support for Swift 1.2. It turned up a ton of error messages, which are mostly casting issues. </p> <p>I navigated to the storyboard, and cannot go back to any other <code>.swift</code> without the whole thing crashing. I have force quit, restarted, and even re-installed, and I s...
29,543,801
8
12
null
2015-04-09 15:11:43.043 UTC
15
2017-02-06 14:41:50.767 UTC
2017-05-23 11:45:24.007 UTC
null
-1
null
106,611
null
1
80
ios|swift|xcode
5,768
<p>I gather from the apple developer forums that this is an <strong>@IBDesignable</strong> issue. Especially in projects that use custom fonts, additional xibs, etc. </p> <p>I have somehow fixed my issue by removing all <strong>@IBDesignable</strong> from swift UIView class definitions. You can open your project direc...
12,162,860
How can I render line faster than CGContextStrokePath?
<p>I'm plotting ~768 points for a graph using CGContextStrokePath. The problem is that every second I get a new data point, and thus redraw the graph. This is currently taking 50% CPU in what's already a busy App. </p> <p><img src="https://i.stack.imgur.com/YmrCr.png" alt="graph"></p> <p><img src="https://i.stack.i...
12,168,863
3
2
null
2012-08-28 15:43:49.15 UTC
9
2012-08-28 23:14:43.533 UTC
null
null
null
null
345,165
null
1
8
ios|performance|cgcontext
2,768
<p>Let's implement a graphing view that uses a bunch of tall, skinny layers to reduce the amount of redrawing needed. We'll slide the layers to the left as we add samples, so at any time, we probably have one layer hanging off the left edge of the view and one hanging off the right edge of the view:</p> <p><img src="...
12,609,527
Why isn't Try/Catch used more often in JavaScript?
<p>It seems like with other languages that support Try/Catch, developers make use of that feature more than they do in JavaScript. Is there a reason for this? Is the JS implementation of Try/Catch flawed?</p>
12,609,630
5
5
null
2012-09-26 20:05:21.883 UTC
7
2017-06-17 16:39:55.687 UTC
null
null
null
null
55,589
null
1
38
javascript
16,691
<p>Try taking a look at this article: <a href="http://dev.opera.com/articles/view/efficient-javascript/?page=2#trycatch" rel="noreferrer">http://dev.opera.com/articles/view/efficient-javascript/?page=2#trycatch</a></p> <p><em>From the above link:</em></p> <p>The try-catch-finally construct is fairly unique. Unlike ot...
12,594,070
dyld: Library not loaded different behavior for 6.0 simulator/6.0 device
<p>My app runs fine on the iPhone 6.0 Simulator in Xcode, but when I try to run it on my 6.0 device, I get the following fatal error:</p> <p>dyld: Library not loaded: /System/Library/Frameworks/AdSupport.framework/AdSupport Referenced from: /var/mobile/Applications/26329A7C-04B0-415A-B8EB-3C59CC1EC0B1/hammerhead.app...
12,812,450
3
1
null
2012-09-26 03:14:43.88 UTC
10
2014-10-06 13:59:56.517 UTC
2012-10-11 06:09:16.97 UTC
null
859,492
null
1,464,728
null
1
39
xcode|cocoa-touch|ios6|dyld|ios-frameworks
13,105
<p>If you're targeting iOS versions less than 6.0, you'll need to make AdSupport.framework, Social.framework, and Accounts.framework optionally-linked.</p> <p>Please have a look at the attached screenshot.</p> <p>Cheers!!!<img src="https://i.stack.imgur.com/VcHpb.png" alt="enter image description here"></p>
12,530,406
Is gcc 4.8 or earlier buggy about regular expressions?
<p>I am trying to use std::regex in a C++11 piece of code, but it appears that the support is a bit buggy. An example:</p> <pre><code>#include &lt;regex&gt; #include &lt;iostream&gt; int main (int argc, const char * argv[]) { std::regex r("st|mt|tr"); std::cerr &lt;&lt; "st|mt|tr" &lt;&lt; " matches st? " &lt...
12,665,408
3
15
null
2012-09-21 12:13:43.107 UTC
25
2017-07-10 18:32:30.903 UTC
2015-09-27 04:24:53.357 UTC
null
2,756,719
null
25,418
null
1
105
c++|regex|gcc|c++11|libstdc++
37,180
<p><strong><code>&lt;regex&gt;</code> was implemented and released in GCC 4.9.0.</strong></p> <p>In your (older) version of GCC, it is <a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53631" rel="noreferrer">not implemented</a>.</p> <p>That prototype <code>&lt;regex&gt;</code> code was added when all of GCC's C++...
12,163,433
Inserting a multiple records in a table with while loop
<p>I want to insert couple of hundred rows into a table that points to pk in other table. I have been trying to use while loops for inserting multiple records in the table. I am actually setting up my test data.</p> <p>This is what I am doing :</p> <pre><code>declare @count int; set @count = 4018; while @count &lt;=...
12,163,553
2
6
null
2012-08-28 16:17:10.72 UTC
1
2012-08-28 16:55:56.817 UTC
2012-08-28 16:23:20.097 UTC
null
1,630,846
null
1,630,846
null
1
-5
sql|sql-server|tsql
62,576
<p>Your current syntax problem is with the <code>@count = @count + 1;</code> which needs to be <code>set @count = @count + 1</code>.</p> <p>But...</p> <p>There is no need for a loop. You can simply do one big insert directly, like:</p> <pre><code>insert into your_table (fk_col, other_col1, other_col2) select pk_col,...
18,888,220
How to check whether java is installed on the computer
<p>I am trying to install java windows application on client machine.I want to check whether requried JRE is installed on the machine or not. I want to check it by java program not by cmd command</p>
18,888,250
12
4
null
2013-09-19 07:04:52.457 UTC
6
2019-05-29 17:02:05.663 UTC
2013-12-02 06:33:39.71 UTC
null
2,791,255
null
2,791,255
null
1
34
java|runtime
242,134
<p>if you are using windows or linux operating system then type in command prompt / terminal</p> <pre><code>java -version </code></pre> <p>If java is correctly installed then you will get something like this</p> <pre><code>java version "1.7.0_25" Java(TM) SE Runtime Environment (build 1.7.0_25-b15) Java HotSpot(TM) ...
19,025,841
How to update some data in a Listview without using notifyDataSetChanged()?
<p>I'm trying to create a <code>ListView</code> with a list of downloading tasks.</p> <p>The downloading tasks are managed in a <code>Service</code> (DownloadService). Everytime a chunk of data is received, the task sends the progress via a <code>Broadcast</code>, received by the <code>Fragment</code> containing the <...
19,090,832
3
5
null
2013-09-26 10:34:24.483 UTC
18
2013-10-04 18:21:55.23 UTC
2013-09-29 01:34:44.137 UTC
null
326,849
null
326,849
null
1
23
android|listview|notifydatasetchanged
19,947
<p>Of course, As <strong>pjco</strong> stated, do not update at that speed. I would recommend sending broadcasts at intervals. Better yet, have a container for the data such as progress and update every interval by polling.</p> <p>However, I think it is a good thing as well to update the listview at times without <cod...
18,761,404
How to scale images on a html5 canvas with better interpolation?
<p>First of all: what am I trying to do?</p> <p>I have an application to view images. It uses the canvas element to render the image. You can zoom in, you can zoom out, and you can drag it around. This part works perfectly right now.</p> <p>But let's say I have an image with a lot of text. It has a resolution of 1200...
18,765,964
1
6
null
2013-09-12 10:11:31.557 UTC
19
2019-02-03 02:24:02.797 UTC
2019-02-03 02:24:02.797 UTC
null
4,298,200
null
2,772,067
null
1
43
javascript|html|canvas|scaling|interpolation
52,140
<p>You need to "step down" several times. Instead of scaling from a very large image to a very small, you need to re-scale it to intermediary sizes.</p> <p>Consider an image you want to draw at 1/6 scale. You could do this:</p> <pre><code>var w = 1280; var h = 853; ctx.drawImage(img, 0, 0, w/6, h/6); </code></pre...
19,246,103
socket.error:[errno 99] cannot assign requested address and namespace in python
<p>My server software says <code>errno99: cannot assign requested address</code> while using an ip address other than <code>127.0.0.1</code> for binding.</p> <p>But if the IP address is <code>127.0.0.1</code> it works. Is it related to namespaces?</p> <p>I am executing my server and client codes in another python pro...
19,267,994
5
7
null
2013-10-08 11:07:45.34 UTC
26
2022-02-07 15:03:32.307 UTC
2013-10-09 09:03:50.177 UTC
null
929,999
null
2,833,462
null
1
68
python|sockets|namespaces|ip
349,309
<p>Stripping things down to basics this is what you would want to test with:</p> <pre><code>import socket server = socket.socket() server.bind((&quot;10.0.0.1&quot;, 6677)) server.listen(4) client_socket, client_address = server.accept() print(client_address, &quot;has connected&quot;) while True: recvieved_data...
24,060,498
org.hibernate.exception.SQLGrammarException: could not prepare statement
<p>I have created two entities and am trying to fill one with data after loading it, to show it as a drop down list.</p> <p>I got the error</p> <blockquote> <p>org.hibernate.exception.SQLGrammarException: could not prepare statement</p> </blockquote> <p>The <code>Group</code> entity that must be in the drop down l...
24,060,905
9
4
null
2014-06-05 12:40:26 UTC
null
2022-04-14 13:56:04.937 UTC
2018-08-29 23:11:54.773 UTC
null
9,238,547
null
3,706,420
null
1
11
java|hibernate|jpa
107,979
<p>The table name you used, <code>GROUP</code>, is a reserved keyword for h2 databases. Rename your table with a name like <code>ADMIN_GROUP</code>.</p> <p>Here's an extract from <a href="http://www.h2database.com/html/advanced.html#compatibility" rel="noreferrer">the h2 documentation</a>:</p> <blockquote> <p>Keywords ...
19,121,367
UITextViews in a UITableView link detection bug in iOS 7
<p>I have custom UITableViewCells that contain a UITextView. I have link detection in the UITextView turned on in Interface Builder. When I first load the table view, everything seems to be working, but as I scroll up and down the table view, the link detection gets messed up. Specifically, cells that just have regular...
19,128,056
13
10
null
2013-10-01 16:28:25.927 UTC
9
2015-12-12 14:58:43.217 UTC
2013-10-02 00:08:11.063 UTC
null
472,344
null
472,344
null
1
46
ios|uitableview|uitextview|ios7
14,682
<p>This appears to be a bug in iOS 7.0's <code>UITextView</code>s. A <a href="https://stackoverflow.com/a/18968687/774">similar question</a> has a workaround which seems to help: set the text view's text to <code>nil</code> before setting it to the new text string.</p>
8,973,529
Retrieve an object from entityframework without ONE field
<p>I'm using entity framework to connect with the database. I've one little problem:</p> <p>I've one table which have one varbinary(MAX) column(with filestream).</p> <p>I'm using SQL request to manage the "Data" part, but EF for the rest(metadata of the file).</p> <p>I've one code which has to get all files id, file...
8,975,420
9
9
null
2012-01-23 14:52:57.907 UTC
11
2021-07-13 01:31:25.84 UTC
2012-01-23 18:51:27.353 UTC
null
100,283
null
397,830
null
1
67
c#|.net|sql|entity-framework
59,350
<blockquote> <p>Is there a way to retrieve a List but without this column filled?</p> </blockquote> <p>Not without projection which you want to avoid. If the column is mapped it is natural part of your entity. Entity without this column is not complete - it is different data set = projection. </p> <blockquote> <...
8,798,707
Securing communication [Authenticity, Privacy & Integrity] with mobile app?
<p>An Android/Iphone app will be accessing application data from the server. [Django-Python]</p> <p>How can I secure the communication with the mobile app ?</p> <p><strong>Expectation</strong> : Secure enough for sensitive information like passwords, there shall be no direct way of decryption except brute-forcing.</...
8,803,983
3
15
null
2012-01-10 04:51:26.983 UTC
16
2014-01-17 03:09:32.557 UTC
2012-02-10 06:05:26.397 UTC
null
731,963
null
731,963
null
1
34
android|iphone|python|django|security
6,980
<p>You're working on bad information. SSL can absolutely authenticate the client, it's just not something that is done for the bulk of SSL as the protocol is (or, atleast was) typically used to protect e-commerce sites where authentication of the server was important but doing so with the client was not important and/o...
22,450,036
Refreshing OAuth token using Retrofit without modifying all calls
<p>We are using Retrofit in our Android app, to communicate with an OAuth2 secured server. Everything works great, we use the RequestInterceptor to include the access token with each call. However there will be times, when the access token will expire, and the token needs to be refreshed. When the token expires, the ne...
31,624,433
10
14
null
2014-03-17 08:52:00.873 UTC
138
2021-09-08 18:17:54.773 UTC
2014-03-17 10:19:18.17 UTC
null
1,395,437
null
1,395,437
null
1
203
android|oauth-2.0|retrofit
100,140
<p>Please do not use <code>Interceptors</code> to deal with authentication.</p> <p>Currently, the best approach to handle authentication is to use the new <a href="https://square.github.io/okhttp/3.x/okhttp/okhttp3/Authenticator.html" rel="noreferrer"><code>Authenticator</code></a> API, designed specifically for <a hre...
11,352,301
How to use DoEvents() without being "evil"?
<p>A simple <a href="http://www.google.com/search?q=doevents">search for <code>DoEvents</code></a> brings up lots of results that lead, basically, to:</p> <blockquote> <p><code>DoEvents</code> is evil. Don't use it. Use threading instead.</p> </blockquote> <p>The reasons generally cited are:</p> <ul> <li>Re-entran...
11,352,575
3
1
null
2012-07-05 20:45:29.643 UTC
17
2019-09-17 21:21:11.353 UTC
null
null
null
null
541,686
null
1
25
windows|winforms|winapi|visual-c++|doevents
9,659
<p>DoEvents() is <em>dangerous</em>. But I bet you do lots of dangerous things every day. Just yesterday I set off a few explosive devices (future readers: note the original post date relative to a certain American holiday). With care, we can sometimes account for the dangers. Of course, that means knowing and understa...
10,898,035
How to get node value / innerHTML with XPath?
<p>I have a XPath to select to a class I want: <code>//div[@class='myclass']</code>. But it returns me the whole div (with the <code>&lt;div class='myclass'&gt;</code> also, but I would like to return only the contents of this tag without the tag itself. How can I do it?</p>
10,899,531
4
0
null
2012-06-05 13:16:41.853 UTC
9
2020-06-05 01:38:42.413 UTC
2017-10-06 19:46:47.24 UTC
null
290,085
null
38,940
null
1
40
xml|parsing|xpath|html-parsing
89,301
<p>With xpath, the thing you will get returned is the last thing in the path that is not a condition. What that means? Well, conditions are the stuff between <code>[]</code>'s (but you already knew that) and yours reads like <em>pathElement[<strong>that has a 'class' attribute with value 'my class'</strong>]</em>. The ...
11,196,367
Processing single file from multiple processes
<p>I have a single big text file in which I want to process each line ( do some operations ) and store them in a database. Since a single simple program is taking too long, I want it to be done via multiple processes or threads. Each thread/process should read the DIFFERENT data(different lines) from that single file ...
11,196,615
3
1
null
2012-06-25 19:54:19.44 UTC
62
2018-11-27 02:31:35.897 UTC
2018-11-27 02:31:35.897 UTC
null
355,230
null
1,174,984
null
1
86
python|multithreading|multiprocessing
62,725
<p>What you are looking for is a Producer/Consumer pattern</p> <p><strong>Basic threading example</strong></p> <p>Here is a basic example using the <a href="http://docs.python.org/library/threading.html" rel="noreferrer">threading module</a> (instead of multiprocessing)</p> <pre><code>import threading import Queue i...
11,420,520
PHP variables in anonymous functions
<p>I was playing around with anonymous functions in PHP and realized that they don't seem to reach variables outside of them. Is there any way to get around this problem?</p> <p>Example:</p> <pre><code>$variable = "nothing"; functionName($someArgument, function() { $variable = "something"; }); echo $variable; //...
11,420,541
2
0
null
2012-07-10 19:30:07.78 UTC
26
2021-09-15 16:43:30.347 UTC
2019-10-01 16:56:13.457 UTC
null
1,255,289
null
1,228,540
null
1
144
php|function|variables|global-variables|anonymous
55,739
<p>Yes, <a href="http://php.net/closure" rel="noreferrer">use a closure</a>:</p> <pre><code>functionName($someArgument, function() use(&amp;$variable) { $variable = "something"; }); </code></pre> <p>Note that in order for you to be able to modify <code>$variable</code> and retrieve the modified value outside of the...
13,053,660
mysqli_query, mysqli_fetch_array and while loop
<p>I am new to PHP and I am trying to build a website using PHP. I have localhost for testing the result and I have phpmyadmin already installed on the website.</p> <p>What i am trying to do now, is to list the contents of my table "property" from database "portal" and fill a table with the results.</p> <p>I am using...
13,053,716
6
0
null
2012-10-24 16:38:11.17 UTC
null
2017-04-25 20:55:03.637 UTC
2012-10-24 16:43:20.703 UTC
null
206,403
null
1,771,795
null
1
6
php|mysql
58,562
<p>Replace your query with this. Make sure you have added this line before.</p> <pre><code>$db = mysql_select_db('portal'); $sqlCommand = "SELECT * FROM property"; </code></pre>
13,068,257
Multiprocessing scikit-learn
<p>I got linearsvc working against training set and test set using <code>load_file</code> method i am trying to get It working on Multiprocessor enviorment.</p> <p>How can i get multiprocessing work on <code>LinearSVC().fit()</code> <code>LinearSVC().predict()</code>? I am not really familiar with datatypes of scikit...
13,082,746
2
10
null
2012-10-25 12:10:03.3 UTC
10
2013-12-13 14:55:42.94 UTC
2012-10-26 14:49:32.787 UTC
null
200,044
null
200,044
null
1
10
python|multithreading|numpy|machine-learning|scikit-learn
11,552
<p>I think using SGDClassifier instead of LinearSVC for this kind of data would be a good idea, as it is much faster. For the vectorization, I suggest you look into the <a href="https://github.com/scikit-learn/scikit-learn/pull/909" rel="noreferrer">hash transformer PR</a>.</p> <p>For the multiprocessing: You can dist...
12,790,297
Hiding button using jQuery
<p>Can someone please tell me how I can hide this button after pressing it using jQuery?</p> <pre><code>&lt;input type="button" name="Comanda" value="Comanda" id="Comanda" data-clicked="unclicked" /&gt; </code></pre> <p>Or this one:</p> <pre><code>&lt;input type=submit name="Vizualizeaza" value="Vizualizeaza"&gt; <...
12,790,323
4
0
null
2012-10-08 22:21:14.287 UTC
2
2019-05-12 07:37:45.363 UTC
2019-05-12 07:37:45.363 UTC
null
6,296,561
null
1,725,664
null
1
20
javascript|jquery|button
152,395
<p>Try this:</p> <pre><code>$('input[name=Comanda]') .click( function () { $(this).hide(); } ); </code></pre> <p>For doing everything else you can use something like this one:</p> <pre><code>$('input[name=Comanda]') .click( function () { $(this).hide(); $(".ClassN...
13,044,814
How to register multiple models with the admin?
<p>If I want to register my models with the admin I have to do this like this:</p> <pre><code>#admin.py admin.site.register(models.About) </code></pre> <p>But with multiple models you <strong>can't</strong> do something like this:</p> <pre><code>models = (models.Project, models.Client, models.About) for m in models:...
13,044,950
8
1
null
2012-10-24 07:43:24.3 UTC
8
2021-10-11 14:03:29.623 UTC
null
null
null
null
1,105,929
null
1
31
django|django-admin
28,737
<p><code>admin.site.register</code> has this definition in the library: </p> <pre><code>def register(self, model_or_iterable, admin_class=None, **options): </code></pre> <p>so models to be registered can be a single model or iterable object so just use this:</p> <pre><code>myModels = [models.Project, models.Client, ...
16,610,612
Create HTTPS server with node js
<p>I want to create a https server for my localhost.<br/> Node JS documentation provides out of the box solution but I have some confusion with it. <strong>Example</strong></p> <pre><code>var https = require('https'); var fs = require('fs'); var options = { key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),...
16,613,647
3
0
null
2013-05-17 13:43:26.48 UTC
14
2019-05-10 21:56:20.38 UTC
null
null
null
null
1,101,083
null
1
21
node.js|https
14,309
<p>For development purposes you can create a self-certified certificate. Here's how to do it on a linux-based system:</p> <p>First, generate a private key</p> <pre><code>openssl genrsa 1024 &gt; key.pem </code></pre> <p>This will store a 1024 bit RSA key in the file key.pem</p> <p>Then, generate an SSL certificate ...
17,125,505
What makes a better constant in C, a macro or an enum?
<p>I am confused about when to use macros or enums. Both can be used as constants, but what is the difference between them and what is the advantage of either one? Is it somehow related to compiler level or not?</p>
17,125,538
7
1
null
2013-06-15 16:05:25.413 UTC
17
2022-02-04 17:05:25.463 UTC
2013-06-19 08:47:46.24 UTC
null
648,658
null
2,464,707
null
1
43
c|macros|enums
31,951
<p>In terms of readability, enumerations make better constants than macros, because related values are grouped together. In addition, <code>enum</code> defines a new type, so the readers of your program would have easier time figuring out what can be passed to the corresponding parameter.</p> <p>Compare</p> <pre><code>...
16,800,255
How do we do both left and right folds in Clojure?
<p>Reduce works fine but it is more like fold-left. Is there any other form of reduce that lets me fold to right ?</p>
41,775,034
2
0
null
2013-05-28 11:20:40.177 UTC
17
2017-01-21 02:02:44.53 UTC
null
null
null
Amogh Talpallikar
961,021
null
1
48
clojure
7,112
<p>Let's look at a possible definition of each:</p> <pre><code>(defn foldl [f val coll] (if (empty? coll) val (foldl f (f val (first coll)) (rest coll)))) (defn foldr [f val coll] (if (empty? coll) val (f (foldr f val (rest coll)) (first coll)))) </code></pre> <p>Notice that only <code>foldl</code> is in...
16,834,245
C# declare empty string array
<p>I need to declare an empty string array and i'm using this code</p> <pre><code>string[] arr = new String[0](); </code></pre> <p>But I get "method name expected" error.</p> <p>What's wrong?</p>
16,834,388
9
9
null
2013-05-30 10:52:01.303 UTC
15
2021-07-02 14:13:10.737 UTC
2018-05-17 21:26:44.303 UTC
null
2,840,103
null
2,336,575
null
1
192
c#|arrays|string
356,353
<p>Try this</p> <pre><code>string[] arr = new string[] {}; </code></pre>
25,607,216
Why should I prefer the "explicitly typed initializer" idiom over explicitly giving the type
<p>I've recently bought the new Effective modern C++ from Scott Meyers and reading through it now. But I have encountered one thing which totally bugs me.</p> <p>In item 5, Scott says that using <code>auto</code> is a great thing. It saves typing, gives you in most cases the correct type and it might be immune to type...
25,609,753
4
8
null
2014-09-01 13:45:21.677 UTC
6
2020-02-13 09:40:33.23 UTC
2020-02-13 09:40:33.23 UTC
null
12,409,240
null
2,489,745
null
1
44
c++|c++11|effective-c++
2,679
<p>Following the C++ Standard:</p> <blockquote> <h3><strong>§ 8.5 Initializers <code>[dcl.init]</code></strong></h3> <ol start="15"> <li><p>The initialization that occurs in the form</p> <pre><code>T x = a; </code></pre> <p>as well as in argument passing, function return, throwing an exception (15.1), h...
62,601,538
Passing a function in the useEffect dependency array causes infinite loop
<p>Why is an infinite loop created when I pass a function expression into the useEffect dependency array? The function expression does not alter the component state, it only references it.</p> <pre><code>// component has one prop called =&gt; sections const markup = (count) =&gt; { const stringCountCorrection = co...
62,601,621
2
1
null
2020-06-26 19:21:48.923 UTC
7
2022-06-22 16:54:31.087 UTC
2022-06-22 16:54:31.087 UTC
null
1,264,804
null
8,142,680
null
1
47
reactjs|react-hooks|use-effect|usecallback
49,383
<p>The issue is that upon each render cycle, <code>markup</code> is redefined. React uses shallow object comparison to determine if a value updated or not. Each render cycle <code>markup</code> has a different reference. You can use <code>useCallback</code> to memoize the function though so the reference is stable. Do ...
4,741,164
Javascript: Get div inside of div
<p>I have two divs nested like so:</p> <pre><code>&lt;div id="upper"&gt; &lt;div id="lower" name="moo"&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>How would I, using jQuery or JavaScript alone, can I get the name of that lower nested div?</p>
4,741,174
2
3
null
2011-01-19 21:46:22.7 UTC
3
2018-10-24 13:22:15.517 UTC
null
null
null
null
270,483
null
1
12
javascript|jquery
64,145
<pre><code>var nameValue = $('#lower').attr('name'); </code></pre> <p>But if you really want to use the outer <code>div</code> to select the inner one:</p> <pre><code>var nameValue = $('#upper &gt; div').attr('name'); </code></pre> <p>Or</p> <pre><code>var nameValue = $('#upper #lower').attr('name'); </code></pre> ...
4,340,349
Running unit tests from currently opened file in IntelliJ IDEA
<p>Is there any way to have IntelliJ run the current MyTest.java file I'm looking at? </p> <p>Thanks</p>
4,341,210
2
0
null
2010-12-02 21:52:59.13 UTC
2
2020-01-21 08:24:39.377 UTC
2020-01-21 08:24:39.377 UTC
null
814,702
null
12,503
null
1
29
java|unit-testing|intellij-idea
9,980
<p>Yeah, you can either:</p> <ol> <li>Right click on the file and go to <blockquote> <p>Run 'MyTest'</p> </blockquote></li> <li>Use the key binding: if the <em>caret</em> is in a method on that method will be run <ul> <li>on a Mac: it's <kbd>Control</kbd>+<kbd>Fn</kbd>+<kbd>Shift</kbd>+<kbd>F10</kbd></li> <li>else...
4,218,847
HtmlAgilityPack -- Does <form> close itself for some reason?
<p>I just wrote up this test to see if I was crazy...</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using HtmlAgilityPack; namespace HtmlAgilityPackFormBug { class Program { static void Main(string[] args) { var doc = new HtmlD...
4,219,060
2
6
null
2010-11-18 19:44:19.713 UTC
5
2013-05-08 21:50:57.22 UTC
2010-11-18 20:19:52.743 UTC
null
65,387
null
65,387
null
1
34
c#|html-agility-pack
5,255
<p>This is also reported in <a href="http://htmlagilitypack.codeplex.com/workitem/23074" rel="noreferrer">this workitem</a>. It contains a suggested workaround from DarthObiwan.</p> <blockquote> <p>You can change this without recompiling. The ElementFlags list is a static property on the HtmlNode class. It can be...
10,025,660
Override home and back button is case a boolean is true
<p>I was wondering if I can override the action of the back and home button is some cases. Normally these buttons should just react like they always do, but in a case some setting is true I want to override the buttons and let them call my own methods.</p> <p>I´m using these two methods to override these buttons:</p> ...
10,025,904
6
0
null
2012-04-05 09:02:49.883 UTC
20
2015-06-13 05:11:32.937 UTC
2012-11-24 12:49:21.67 UTC
null
739,270
null
1,062,575
null
1
10
android|button|overriding|back-button
22,565
<blockquote> <p>I was wondering if I can override the action of the back and home button is some cases.</p> </blockquote> <p>Yes you can do override <code>Home</code> button.</p> <p>I have developed an application which disable hard button, you can have a look. I have taken a <strong>toggle button</strong> which lo...
10,143,784
C can't compile - symbol(s) not found for architecture x86_64
<p>Having a serious problem with my C code, I just don't seem to be able to get it to compile and I really can't figure out why. </p> <p>I have tried researching online and can't find a solution to the problem, do you have any idea?</p> <p>Thanks for your time!</p> <pre><code>Undefined symbols for architecture x86_6...
10,144,099
3
4
null
2012-04-13 15:29:11.343 UTC
8
2012-10-06 05:16:54.52 UTC
null
null
null
null
193,376
null
1
18
c|compilation
42,309
<p>You can <em>compile</em>, but you cannot <em>link</em>.</p> <p><code>part1.o</code> is using the functions you defined in your last <code>.h</code> file and the implementations cannot be found. When you link your program, you need to make sure you're linking in the object file(s) (or libraries) that contain the im...
10,234,053
RPM spec file - Is it possible to dynamically populate a spec file variable
<p>I have a spec file. I need to %define a spec variable that gets its value from a one line file on the system.</p> <p>For example</p> <pre><code>%define path `cat /home/user/path_file` </code></pre> <p>and in path_file is one line</p> <pre><code>/var/www/html/hosts </code></pre> <p>This partially works. I say th...
10,236,104
1
0
null
2012-04-19 18:03:06.06 UTC
6
2019-04-19 17:49:15.173 UTC
2019-04-19 17:49:15.173 UTC
null
68,587
null
1,288,571
null
1
31
rpm|rpmbuild|rpm-spec
29,483
<p>You can define rpmbuild variables with <code>%(cmd)</code> at the top of the spec file. Notice the command is in parenthesis, not curly brackets. An example:</p> <pre><code>%define whoami %(whoami) </code></pre> <p>And elsewhere in the spec file, such as a script or the build/install sections, use the variable as ...
10,246,831
How to look at Bitmap objects in Visual Studio debugger?
<p>I am building a C# app that creates many bitmaps (System.Drawing.Image). Having the bitmaps seen in the debugger as pictures, would be of enormous help. The debugger has native support for XML files. Is there a way to see the pictures?</p>
10,246,871
6
3
null
2012-04-20 13:05:21.453 UTC
2
2019-04-16 09:18:42.827 UTC
null
null
null
null
112,091
null
1
32
c#|visual-studio-2010|debugging|c#-4.0|bitmap
17,380
<p>There is no debugger visualizer by default for Bitmap, so you might want to give this one a try: <a href="http://imagedebugvisualizer.codeplex.com/" rel="noreferrer">http://imagedebugvisualizer.codeplex.com/</a></p>
9,809,180
Why is JUnit 4 on Android not working?
<p>as the documentation of Android says, "Note that the Android testing API supports JUnit 3 code style, but not JUnit 4." (<a href="http://developer.android.com/guide/topics/testing/testing_android.html">Testing Fundamentals</a>). It should be clear that JUnit 4 cannot be used out of the box with Android.</p> <p>But ...
11,916,340
2
3
null
2012-03-21 16:51:16.403 UTC
14
2015-10-05 07:38:11.48 UTC
null
null
null
null
1,229,451
null
1
33
java|android|junit4|dalvik|junit3
14,936
<p><strong>Update 2015/10</strong></p> <p>It is now possible via the AndroidJUnitRunner, which is part of the <a href="http://developer.android.com/tools/testing-support-library/index.html" rel="noreferrer">Android Testing Support Library</a>. In short, you need to do the following in a Gradle-based project:</p> <ol>...
28,226,229
How to loop through dates using Bash?
<p>I have such bash script:</p> <pre><code>array=( '2015-01-01', '2015-01-02' ) for i in "${array[@]}" do python /home/user/executeJobs.py {i} &amp;&gt; /home/user/${i}.log done </code></pre> <p>Now I want to loop through a range of dates, e.g. 2015-01-01 until 2015-01-31.</p> <p>How to achieve in Bash?</p> <p...
28,226,339
10
17
null
2015-01-29 22:55:05.467 UTC
37
2022-09-20 23:00:11.877 UTC
2019-12-25 12:09:22.857 UTC
null
608,639
null
356,759
null
1
114
bash|loops|date
120,739
<p>Using GNU date:</p> <pre><code>d=2015-01-01 while [ &quot;$d&quot; != 2015-02-20 ]; do echo $d d=$(date -I -d &quot;$d + 1 day&quot;) # mac option for d decl (the +1d is equivalent to + 1 day) # d=$(date -j -v +1d -f &quot;%Y-%m-%d&quot; $d +%Y-%m-%d) done </code></pre> <p>Note that because this uses strin...
11,658,011
Cannot modify content of iframe, what is wrong?
<p>I am trying to modify content of an iframe but it does not work.</p> <p>This is my main.html</p> <pre><code>&lt;html&gt; &lt;head&gt;&lt;title&gt;Main page&lt;/title&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;h3&gt;Main pa...
11,658,546
3
7
null
2012-07-25 20:23:00.883 UTC
5
2019-08-26 14:42:57.687 UTC
2015-05-22 11:00:36.64 UTC
null
1,793,718
null
1,313,296
null
1
13
jquery|html
46,817
<p>Please don't forget the <code>cross-domain</code> policy, otherwise it won't work.</p> <p><strong>Live demo:</strong> <a href="http://jsfiddle.net/oscarj24/wTWjF/" rel="nofollow noreferrer">http://jsfiddle.net/oscarj24/wTWjF/</a></p> <p><em>(Just to know, I am not using a 404 page, take a look)</em></p> <p>Try th...
11,911,660
Redirect console.writeline from windows application to a string
<p>I have an external dll written in C# and I studied from the assemblies documentation that it writes its debug messages to the Console using <code>Console.WriteLine</code>.</p> <p>this DLL writes to console during my interaction with the UI of the Application, so i don't make DLL calls directly, but i would capture ...
11,911,734
5
0
null
2012-08-11 03:30:16.713 UTC
13
2021-01-20 10:43:20.75 UTC
2012-08-11 04:11:45.743 UTC
null
749,063
null
749,063
null
1
18
c#|.net|console
22,945
<p>As it seems like you want to catch the Console output in realtime, I figured out that you might create your own <code>TextWriter</code> implementation that fires an event whenever a <code>Write</code> or <code>WriteLine</code> happens on the <code>Console</code>.</p> <p>The writer looks like this:</p> <pre><code> ...
11,877,586
How to merge two arrays of object in PHP
<p>I have the following two arrays of objects:</p> <p><strong>First Array:</strong> <code>$array1</code></p> <pre><code>Array ( [0] =&gt; stdClass Object ( [id] =&gt; 100 [name] =&gt; Muhammad ) [1] =&gt; stdClass Object ( [id] =&gt; 102 ...
11,879,498
3
3
null
2012-08-09 06:03:52.24 UTC
6
2022-08-31 10:41:04.37 UTC
2012-08-09 06:52:55.477 UTC
null
462,732
null
462,732
null
1
22
php|arrays|sorting
43,284
<p>These 3 simple steps did the work:</p> <pre><code>//both arrays will be merged including duplicates $result = array_merge( $array1, $array2 ); //duplicate objects will be removed $result = array_map("unserialize", array_unique(array_map("serialize", $result))); //array is sorted on the bases of id sort( $result ); ...
12,043,875
ArgumentNullException - how to simplify?
<p>I've noticed this code crops up a lot in my constructors:</p> <pre><code>if (someParam == null) throw new ArgumentNullException("someParam"); if (someOtherParam == null) throw new ArgumentNullException("someOtherParam"); ... </code></pre> <p>I have a few constructors where several things are injected and must all ...
12,044,807
17
3
null
2012-08-20 19:28:52.35 UTC
9
2022-04-28 16:14:21.38 UTC
2012-08-20 21:05:52.61 UTC
null
436,376
null
436,376
null
1
23
c#|exception
18,848
<p>Upticks for most of you guys; your answers contributed to the solution I finally arrived at, which incorporated bits and pieces but ultimately is different from all of them.</p> <p>I created a couple of static methods that work on lambda expressions of a specific form (<strong>EDIT</strong> - small change; the meth...
11,873,959
flask-sqlalchemy - PostgreSQL - Define specific schema for table?
<p>I want to define a specific schema for a 'model' using flask-sqlalchemy. When you create a table object in sqlalchemy itself it has a parameter to pass for schema name. </p> <p>How do I do this in flask-sqlalchemy?</p>
11,875,775
3
0
null
2012-08-08 22:11:35.543 UTC
11
2020-08-03 00:44:53.61 UTC
2013-09-05 17:46:22.02 UTC
null
2,165,163
null
786,467
null
1
28
python|flask|flask-sqlalchemy
13,699
<p>When you define your model class use:</p> <pre><code>__table_args__ = {"schema":"schema_name"} </code></pre> <p>maybe it will save someone else some hunting.</p>
11,590,792
How can I find the parent tr of a td using jQuery?
<p>I have the following:</p> <pre><code> tdToPad = tds.filter('[id^="input_Title_"]') pad = 60; tdToPad.css('margin-left', pad); </code></pre> <p>What I would like to do is to remove any class that starts with "X-" and give the row that is contained by "tdToPad" a class of "X-" + pad. </p> <p>Something li...
11,590,807
2
0
null
2012-07-21 08:48:30.477 UTC
7
2014-01-16 15:03:14.503 UTC
null
null
null
null
1,422,604
null
1
30
jquery
94,062
<p>You can use <a href="http://api.jquery.com/closest/"><code>closest()</code></a> method:</p> <blockquote> <p>Get the first element that matches the selector, beginning at the current element and progressing up through the DOM tree.</p> </blockquote> <pre><code>tdToPad.closest('tr') .addClass('X-' + pad) </...
11,685,305
What is the syntax of the enhanced for loop in Java?
<p>I have been asked to use the enhanced <code>for</code> loop in my coding. </p> <p>I have only been taught how to use traditional <code>for</code> loops, and as such don't know about the differences between it and the enhanced <code>for</code> loop. </p> <p><strong>How does an enhanced <code>for</code> loop differ ...
11,685,345
3
5
null
2012-07-27 09:46:02.913 UTC
7
2021-01-02 00:01:56.84 UTC
2019-07-02 23:25:21.717 UTC
null
6,912,508
user1920811
null
null
1
39
java|foreach
120,289
<p>Enhanced for loop:</p> <pre><code>for (String element : array) { // rest of code handling current element } </code></pre> <p>Traditional for loop equivalent:</p> <pre><code>for (int i=0; i &lt; array.length; i++) { String element = array[i]; // rest of code handling current element } </code></pre> <p>...
11,773,369
Convert from Long to date format
<p>I want to convert Long value to String or Date in this format dd/mm/YYYY.</p> <p>I have this value in Long format: 1343805819061.</p> <p>It is possible to convert it to Date format?</p>
11,773,465
6
0
null
2012-08-02 08:04:44.363 UTC
7
2020-11-06 10:49:44.677 UTC
2018-04-06 08:12:48.147 UTC
null
3,681,880
null
1,112,535
null
1
43
android|date|long-integer
82,573
<p>You can use below line of code to do this. Here timeInMilliSecond is long value.</p> <pre><code> String dateString = new SimpleDateFormat("MM/dd/yyyy").format(new Date(TimeinMilliSeccond)); </code></pre> <p>Or you can use below code too also.</p> <pre><code> String longV = "1343805819061"; long millisecond = Lon...
3,505,674
Comparing SIFT features stored in a mysql database
<p>I'm currently extending an image library used to categorize images and i want to find duplicate images, transformed images, and images that contain or are contained in other images.<br> I have tested the SIFT implementation from OpenCV and it works very well but would be rather slow for multiple images. Too speed it...
3,524,693
4
1
null
2010-08-17 18:27:08.397 UTC
23
2011-12-20 19:23:14.99 UTC
null
null
null
null
423,083
null
1
18
c++|database|algorithm|computer-vision|sift
6,585
<p>So I basically did something very similar to this a few years ago. <strong>The algorithm you want to look into was proposed a few years ago by David Nister, the paper is: "Scalable Recognition with a Vocabulary Tree". They pretty much have an exact solution to your problem that can scale to millions of images.</st...
3,992,353
Javascript function to reload a page every X seconds?
<p>A couple of questions:</p> <ul> <li><p>I've never really used JS listeners other than <code>onclick</code> and <code>onkey</code> events, so I wondered if someone could help me with what I need in order to reload the page every X seconds?</p></li> <li><p>Secondly, the page contains bare minimum, literally just one ...
3,992,382
4
2
null
2010-10-21 22:01:32.37 UTC
4
2014-12-23 05:09:04.633 UTC
2012-05-09 12:12:14.363 UTC
null
1,223,744
null
477,945
null
1
20
javascript|html|syntax
50,092
<p>You don't need Javascript for this simple function. Add in the page header:</p> <pre><code>&lt;meta http-equiv="Refresh" content="300"&gt; </code></pre> <p>300 is the number of seconds in this example.</p>
3,302,177
Android - Activity Constructor vs onCreate
<p>I understand that Android <code>Activities</code> have specific lifecycles and that <code>onCreate</code> should be overridden and used for initialization, but what exactly happens in the constructor? Are there any cases when you could/should override the <code>Activity</code> constructor as well, or should you neve...
3,303,512
4
1
null
2010-07-21 17:44:30.253 UTC
22
2013-07-19 21:46:55.717 UTC
null
null
2,359,478
user370382
2,359,478
null
1
93
java|android|garbage-collection|android-activity|oncreate
53,895
<p>I can't think of any good reason to do anything in the constructor. You never construct an activity directly, so you can't use it to pass in parameters. Generally, just do things in onCreate.</p>
3,436,118
Is Java RegEx case-insensitive?
<p>In Java, when doing a replaceAll to look for a regex pattern like:</p> <pre><code>replaceAll("\\?i\\b(\\w+)\\b(\\s+\\1)+\\b", "$1"); </code></pre> <p>(to remove duplicate consecutive case-insensitive words, e.g. Test test), I'm not sure where I put the <code>?i</code>. I read that it is supposed to be at the beg...
3,436,130
5
1
null
2010-08-08 21:21:09.36 UTC
19
2019-05-19 22:31:48.573 UTC
2019-05-19 22:31:48.573 UTC
null
4,928,642
null
207,524
null
1
134
java|regex|case-sensitive
175,793
<p><a href="http://www.regexbuddy.com/" rel="noreferrer">RegexBuddy</a> is telling me if you want to include it at the beginning, this is the correct syntax:</p> <pre><code>"(?i)\\b(\\w+)\\b(\\s+\\1)+\\b" </code></pre>
3,795,923
Bottom button bar in android
<p>I am wondering how it's possible to create bottom bar buttons in android, </p> <p>I read something about this U.I. solution, are there any controls that can be used?</p>
3,795,949
6
0
null
2010-09-25 23:11:31.59 UTC
7
2021-01-30 18:03:10.793 UTC
2018-03-22 22:32:02.36 UTC
null
5,108,735
null
371,301
null
1
21
android
55,562
<p>You can do something like this inside a relative layout</p> <pre><code>&lt;LinearLayout android:id=&quot;@+id/footer&quot; android:layout_width=&quot;fill_parent&quot; android:layout_height=&quot;wrap_content&quot; android:orientation=&quot;horizontal&quot; android:layout_alignParentBottom=&qu...
3,234,977
Using jQuery how to get click coordinates on the target element
<p>I have the following event handler for my html element</p> <pre><code>jQuery("#seek-bar").click(function(e){ var x = e.pageX - e.target.offsetLeft; alert(x); }); </code></pre> <p>I need to find the position of the mouse on the #seek-bar at the time of clicking. I would have thought the above code shoul...
3,236,129
6
4
null
2010-07-13 07:26:04.317 UTC
40
2018-02-15 11:06:00.61 UTC
2010-07-13 07:32:20.027 UTC
null
294,089
null
294,089
null
1
117
javascript|jquery|html|css|jquery-ui
244,043
<p>Are you trying to get the position of mouse pointer <code>relative</code> to element ( or ) simply the mouse pointer location<br /><br /> Try this Demo : <a href="http://jsfiddle.net/AMsK9/" rel="noreferrer"><strong>http://jsfiddle.net/AMsK9/</strong></a></p> <hr> <h2>Edit :</h2> <p>1) <code>event.pageX</code>, ...
3,590,489
Visual Studio 2010 Intellisense slows down everything
<p>I have the issue with Visual Studio 2010, after a while, running exceptionally slowly and slowing everything else down with it. I'm meaning:</p> <ul> <li>Most other open windows become unresponsive</li> <li>Typing is delayed</li> <li>Build times increase 10-fold</li> <li>Saving takes forever</li> </ul> <p>I am sur...
3,852,810
8
6
null
2010-08-28 11:00:40.83 UTC
9
2021-02-13 13:17:46.517 UTC
null
null
null
null
407,879
null
1
13
visual-studio|visual-studio-2010|intellisense|performance|lag
19,686
<p>I had the same problem with my Windows XP machine. After a long search I found a solution so I'll post it back here since it was the first result I got on google.</p> <p>Install Windows Automation API update for Windows XP (KB971513).</p> <p><a href="https://www.catalog.update.microsoft.com/Search.aspx?q=KB971513" r...
3,228,984
A better way to validate URL in C# than try-catch?
<p>I'm building an application to retrieve an image from internet. Even though it works fine, it is slow (on wrong given URL) when using try-catch statements in the application. </p> <p>(1) Is this the best way to verify URL and handle wrong input - or should I use Regex (or some other method) instead?</p> <p>(2) Why...
3,228,997
10
2
null
2010-07-12 13:29:36.383 UTC
9
2019-11-13 19:35:59.557 UTC
2017-08-19 13:35:51.217 UTC
null
1,033,581
null
286,244
null
1
64
c#|image|url|try-catch
54,620
<p>Use <a href="http://msdn.microsoft.com/en-us/library/system.uri.trycreate.aspx" rel="noreferrer">Uri.TryCreate</a> to create a new Uri object only if your url string is a valid URL. If the string is not a valid URL, TryCreate returns false. </p> <pre><code>string myString = "http://someUrl"; Uri myUri; if (Uri.TryC...
3,835,028
Getting list of Facebook friends with latest API
<p>I'm using <a href="http://github.com/facebook/php-sdk/" rel="noreferrer">the most recent version of the Facebook SDK</a> (which lets to connect to something called the 'graph API' though I'm not sure). I've adapted Facebook's example code to let me connect to Facebook and that works... but I can't get a list of my f...
3,835,568
11
0
null
2010-09-30 21:38:36.157 UTC
17
2021-06-26 17:21:29.98 UTC
2014-04-12 09:57:24.12 UTC
null
1,045,444
null
284,698
null
1
25
php|facebook|facebook-php-sdk|facebook-apps|facebook-friends
112,233
<p>I think this is what you want:</p> <pre><code>$friends = $facebook-&gt;api('/me/friends'); </code></pre>