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
2,619,562
Joining multiple fields in text files on Unix
<p>How can I do it?</p> <p><em>File1</em> looks like this:</p> <pre><code>foo 1 scaf 3 bar 2 scaf 3.3 </code></pre> <p><em>File2</em> looks like this:</p> <pre><code>foo 1 scaf 4.5 foo 1 boo 2.3 bar 2 scaf 1.00 </code></pre> <p>What I want to do is to find lines that co-occur in <em>File1</em> and <em>File2</em> ...
2,619,621
11
1
null
2010-04-12 02:30:00.173 UTC
11
2021-02-06 21:50:33.29 UTC
2016-07-08 06:55:02.06 UTC
null
6,136,214
null
67,405
null
1
14
linux|bash|unix|join
35,358
<p>you can try this</p> <pre><code>awk '{ o1=$1;o2=$2;o3=$3 $1=$2=$3="";gsub(" +","") _[o1 FS o2 FS o3]=_[o1 FS o2 FS o3] FS $0 } END{ for(i in _) print i,_[i] }' file1 file2 </code></pre> <p>output</p> <pre><code>$ ./shell.sh foo 1 scaf 3 4.5 bar 2 scaf 3.3 1.00 foo 1 boo 2.3 </code></pre> <p>If you want to ...
2,969,561
How to parse mathematical expressions involving parentheses
<p>This isn't a school assignment or anything, but I realize it's a mostly academic question. But, what I've been struggling to do is parse 'math' text and come up with an answer.</p> <p>For Example - I can figure out how to parse '5 + 5' or '3 * 5' - but I fail when I try to correctly chain operations together.</p> ...
2,969,583
13
10
null
2010-06-03 20:34:38.807 UTC
11
2021-06-06 17:17:26.317 UTC
2010-06-03 21:03:12.653 UTC
null
8,027
null
73,381
null
1
18
.net|math|parsing
26,506
<p>Ages ago when working on a simple graphing app, I used <a href="http://en.wikipedia.org/wiki/Shunting-yard_algorithm" rel="noreferrer">this algorithm</a> (which is reasonably easy to understand and works great for simple math expressions like these) to first turn the expression into <a href="http://en.wikipedia.org/...
2,943,222
Find objects between two dates MongoDB
<p>I've been playing around storing tweets inside mongodb, each object looks like this:</p> <pre><code>{ "_id" : ObjectId("4c02c58de500fe1be1000005"), "contributors" : null, "text" : "Hello world", "user" : { "following" : null, "followers_count" : 5, "utc_offset" : null, "location" : "", "profile_...
2,943,685
17
4
null
2010-05-31 11:34:43.757 UTC
120
2022-08-31 06:30:37.71 UTC
2015-08-11 07:20:56.743 UTC
null
2,476,755
null
45,350
null
1
530
mongodb|datetime|twitter|mongodb-query
938,279
<p><strike><a href="http://cookbook.mongodb.org/patterns/date_range/" rel="noreferrer">Querying for a Date Range (Specific Month or Day)</a></strike> in the <strike><a href="http://cookbook.mongodb.org/" rel="noreferrer">MongoDB Cookbook</a></strike> has a very good explanation on the matter, but below is something I t...
3,211,595
Renaming files in a folder to sequential numbers
<p>I want to rename the files in a directory to sequential numbers. Based on creation date of the files.</p> <p>For Example <code>sadf.jpg</code> to <code>0001.jpg</code>, <code>wrjr3.jpg</code> to <code>0002.jpg</code> and so on, the number of leading zeroes depending on the total amount of files (no need for extra z...
3,211,670
28
4
null
2010-07-09 10:06:06.463 UTC
169
2022-08-04 22:55:00.327 UTC
2016-01-05 15:46:10.6 UTC
null
1,843,331
null
259,316
null
1
309
bash|rename|batch-rename
310,820
<p>Try to use a loop, <code>let</code>, and <code>printf</code> for the padding:</p> <pre><code>a=1 for i in *.jpg; do new=$(printf &quot;%04d.jpg&quot; &quot;$a&quot;) #04 pad to length of 4 mv -i -- &quot;$i&quot; &quot;$new&quot; let a=a+1 done </code></pre> <p>using the <code>-i</code> flag prevents automatic...
40,583,721
print() to console log with color
<p>The code is:</p> <pre><code>let redColor = "\u{001B}[0;31m" var message = "Some Message" print(redColor + message) //This doesn't work print("\(redColor)\(message)") //This also doesn't work </code></pre> <p>and the output would look like this:</p> <pre><code>[0;31mSome Message </code></pre> <p>I've also read t...
41,740,104
7
9
null
2016-11-14 07:23:56.273 UTC
8
2022-02-26 09:52:21.66 UTC
2020-10-02 14:17:12.713 UTC
null
5,623,035
null
5,928,180
null
1
40
swift|xcode|debugging|logging|colors
18,119
<p>Nowadays, Xcode debugging console doesn't support coloring.</p>
25,388,214
How do I change navigationBar font in Swift?
<p>This is what I have tried so far, but receiving an error (I have correctly implemented CaviarDreams to the project):</p> <pre><code>self.navigationController.navigationBar.titleTextAttributes = NSFontAttributeName[UIFont .fontWithName(CaviarDreams.ttf, size: 20)] </code></pre> <p>Error says: <code>Use of unresolved ...
25,388,549
9
0
null
2014-08-19 16:12:21.94 UTC
13
2021-01-06 23:56:07.85 UTC
2021-01-06 23:56:07.85 UTC
null
1,783,163
null
2,514,271
null
1
34
swift|uinavigationbar|navigationbar
43,926
<p>Try this:</p> <pre><code>self.navigationController.navigationBar.titleTextAttributes = [ NSFontAttributeName: UIFont(name: "CaviarDreams", size: 20)!] </code></pre> <p><strong>Edit:</strong> Now, UIFont must be unwrapped to be able to be used here.</p> <p><strong>Swift 5</strong> (+ safe handling of optional <cod...
25,163,433
Can you execute an Applescript script from a Swift Application
<p>I have a simple AppleScript that sends an email. How can I call it from within a Swift application?</p> <p>(I wasn't able to find the answer via Google.)</p>
25,235,047
7
0
null
2014-08-06 14:45:19.75 UTC
18
2022-08-26 04:26:52.127 UTC
2015-10-13 14:21:32.667 UTC
null
168,594
null
110,701
null
1
30
swift|applescript
23,738
<p>Tested: one can do something like this (arbitrary script path added):</p> <pre><code>import Foundation let task = Process() task.launchPath = &quot;/usr/bin/osascript&quot; task.arguments = [&quot;~/Desktop/testscript.scpt&quot;] task.launch() </code></pre>
42,189,301
Axios (in React-native) not calling server in localhost
<p>I'm building a really easy api and react-native application. The server works well (tested with PostMan) but the application doesn't call the server. It blocks when axios has to send the post request (see below).</p> <p>I'm desperate :-( Loosing too mush time in it. Please, if you can help me...</p> <p>Here is my...
42,189,984
13
1
null
2017-02-12 15:16:43.85 UTC
12
2022-07-27 01:25:23.107 UTC
null
null
null
null
6,090,589
null
1
32
node.js|react-native|axios
83,222
<p>The solution came from a different source, but I post it here to help others looking for the same issue. Basically I used Android AVD (emulator) to build the application. But the emulator is in fact another machine, and that's why it couldn't call the localhost.</p> <p>To solve the probleme, I had to send the reque...
10,713,155
Knockout, CKEditor & Single Page App
<p>I have a situation involving KnockoutJS &amp; CKEditor.</p> <p>Basically we've got part of our site that is 'single page' app style, currently it just involves 2 pages but will likely expand over time, currently it's just a 'listings' page and a 'manage' page for the items in the list.</p> <p>The manage page itsel...
10,925,902
7
0
null
2012-05-23 03:44:18.83 UTC
9
2015-05-26 12:54:23.42 UTC
null
null
null
null
1,021,316
null
1
16
asp.net-mvc|knockout.js|ckeditor|singlepage
7,190
<p>For anyone interested I sorted it:</p> <p>All it was was a basic order of execution, I just needed to set the value to the textarea html before it got initialised.</p> <p>Note this uses a jquery adaptor extension to do the .ckeditor() on the element.</p> <p>There is probably also a better way to do the 'blur' par...
10,852,652
Difference between dataType jsonp and JSON
<p>I download Jquery UI autoload, looking to remote-jsonp.html. This is ajax function but i open console.. I can't see any request in my console...</p> <p>What is difference between dataType;"jsonp" and dataType;"JSON"</p> <pre><code>$( "#city" ).autocomplete({ source: function( request, response ) { ...
10,852,664
2
0
null
2012-06-01 14:57:32.943 UTC
8
2014-02-12 12:57:04.617 UTC
2014-02-12 12:57:04.617 UTC
null
3,012,290
null
612,854
null
1
19
javascript|jquery|ajax|jquery-ui
48,052
<p><code>dataType: jsonp</code> for cross-domain request, that means request to different domain and <code>dataType: json</code> for same domain-same origin request.</p> <blockquote> <p>Loads in a JSON block using JSONP. Adds an extra "?callback=?" to the end of your URL to specify the callback. Disables caching b...
33,443,146
Remove image from cache in Glide library
<p>I am using Glide in one of my projects to show image from file.</p> <p>Below is my code how I am showing the image:</p> <pre><code>Glide.with(DemoActivity.this) .load(Uri.parse("file://" + imagePath)) .into(mImage); </code></pre> <p>The image at this location(<code>imagePath</code>) keeps on changing. B...
33,451,376
18
0
null
2015-10-30 19:00:16.037 UTC
34
2021-06-23 09:43:35.99 UTC
2015-10-31 09:49:17.987 UTC
null
2,837,959
null
1,150,434
null
1
93
android|caching|android-glide
103,551
<p>This is how I solved this problem.</p> <p><strong>Method 1: When the URL changes whenever image changes</strong></p> <pre><code>Glide.with(DemoActivity.this) .load(Uri.parse("file://" + imagePath)) .diskCacheStrategy(DiskCacheStrategy.NONE) .skipMemoryCache(true) .into(mImage); </code></pre> <p>di...
23,421,507
Get service status from remote server using powershell
<p>How to get the service status for a remote computer that needs a user name and password to log in?</p> <p>I am trying to find a solution using the following code:</p> <p><code>$serviceStatus = get-service -ComputerName $machineName -Name $service</code></p> <p>The default syntax for the <code>get-service</code> c...
23,421,592
4
0
null
2014-05-02 05:41:53.343 UTC
5
2020-07-08 16:54:34.267 UTC
null
null
null
null
1,631,315
null
1
11
powershell|service|remote-server
83,825
<p>As far as I know, Get-Service <a href="http://connect.microsoft.com/PowerShell/feedback/details/567007/get-service-cmdlets-needs-a-credential-parameter" rel="noreferrer">doesn't accept a credential parameter</a>. However, you can do it through <a href="http://technet.microsoft.com/en-us/library/ee176860.aspx" rel="n...
18,956,611
Why does my programmatically created screenshot look so bad on iOS 7?
<p>I am trying to implement sharing app with facebook. I used this code to take the screenshot:</p> <pre><code>CGSize imageSize = CGSizeMake(self.view.bounds.size.width, self.view.bounds.size.height); UIGraphicsBeginImageContext(imageSize); [self.view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *view...
18,956,842
5
0
null
2013-09-23 10:08:20.087 UTC
22
2016-04-01 19:32:33.657 UTC
2017-05-23 11:53:12.433 UTC
null
-1
null
1,868,679
null
1
29
ios|objective-c|iphone|xcode|screenshot
38,562
<p>New <a href="https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instm/UIView/snapshotViewAfterScreenUpdates:" rel="noreferrer">API</a> has been added since iOS 7, that should provide efficient way of getting snapshot</p> <ul> <li><p><code>snapshotVi...
19,068,862
How to overplot a line on a scatter plot in python?
<p>I have two vectors of data and I've put them into <code>pyplot.scatter()</code>. Now I'd like to over plot a linear fit to these data. How would I do this? I've tried using <code>scikitlearn</code> and <code>np.polyfit()</code>.</p>
19,069,001
8
0
null
2013-09-28 16:05:10.46 UTC
38
2022-04-03 07:46:17.387 UTC
2022-04-03 07:45:56.187 UTC
null
13,138,364
null
1,849,997
null
1
77
python|numpy|matplotlib|linear-regression|scatter-plot
212,959
<pre><code>import numpy as np from numpy.polynomial.polynomial import polyfit import matplotlib.pyplot as plt # Sample data x = np.arange(10) y = 5 * x + 10 # Fit with polyfit b, m = polyfit(x, y, 1) plt.plot(x, y, '.') plt.plot(x, b + m * x, '-') plt.show() </code></pre> <p><img src="https://i.stack.imgur.com/rnWm...
36,862,564
Changing the background color of Tab Bar
<p>I am trying to get desired color rendered in the background of Tab Bar however I am facing problems. These are the things that I tried :-</p> <ol> <li><p>Changing the background color of tab bar object from storyboard. The color rendered is always lighter than the desired color.</p></li> <li><p>Programmatically c...
36,862,601
6
0
null
2016-04-26 10:41:37.99 UTC
13
2021-10-26 10:51:07.273 UTC
null
null
null
null
5,856,164
null
1
63
ios|swift|uitabbarcontroller|uitabbar
90,596
<p>To change background colour of UITabBar</p> <pre><code>TabBarController* Tcontroller =(TabBarController*)self.window.rootViewController; Tcontroller.tabBar.barTintColor=[UIColor yourcolour]; </code></pre> <p><strong>Swift 3</strong></p> <p>Based on the code above, you can get it by doing this</p> <pre><code>let ...
62,846,123
Getting Error from webpack-cli: "TypeError: merge is not a function" in webpack config
<p>I'm using webpack-merge to combine two webpack.config files together but I keep getting the error &quot;TypeError: merge is not a function when I run the command &quot;webpack --config ./config/webpack.config.prod.js&quot;</p> <p>Has anybody else run across this issue?</p> <p>webpack.config.prod.js</p> <pre><code>co...
62,846,324
2
0
null
2020-07-11 06:55:38.793 UTC
9
2021-03-13 09:12:26.21 UTC
null
null
null
null
3,448,008
null
1
48
reactjs|webpack|webpack-4|webpack-cli|webpack-merge
27,981
<p>You are importing <code>merge</code> incorrectly. Try it like this:</p> <pre class="lang-js prettyprint-override"><code>const { merge } = require('webpack-merge'); </code></pre> <p><strong>UPD:</strong> Based on the <a href="https://github.com/survivejs/webpack-merge/blob/50bf401c7f2d205721e8cfa9a03ea47cf80058ec/CHA...
28,332,103
Problems installing laravel with composer
<p><strong>Problem:</strong> I'm wanting to explore laravel 5, and failing miserably at installing it. I'm using this guide: <a href="http://laravel.com/docs/5.0">http://laravel.com/docs/5.0</a> and need someone to help me understand the instructions.</p> <p><strong>Background and What I've Tried</strong></p> <p>I'm ...
28,332,285
3
0
null
2015-02-04 21:47:20.61 UTC
6
2016-01-05 17:23:17.753 UTC
2015-02-04 21:53:41.34 UTC
null
1,163,740
null
1,163,740
null
1
10
php|laravel|composer-php|laravel-5
43,932
<p>Laravel is a PHP framework (makes writing PHP applications easy)</p> <p>Composer is a PHP package and dependency manager. (makes installing and updating third party code libraries easy)</p> <p>When you run</p> <pre><code>$ composer global require "laravel/installer=~1.1" </code></pre> <p>You're using composer to...
8,901,488
Android: Java, C or C++?
<p>I wrote some simple apps in Android using Java.<br/> But later I found this: </p> <blockquote> <p>It provides headers and libraries that allow you to build activities, handle user input, use hardware sensors, access application resources, and more, when programming in C or C++. (<a href="http://developer.andr...
8,901,522
6
0
null
2012-01-17 20:43:33.357 UTC
8
2020-11-25 09:48:09.75 UTC
null
null
null
null
982,865
null
1
32
java|android|c++|c
26,435
<p>The article you link to has good information. It also links to <a href="http://developer.android.com/sdk/ndk/overview.html" rel="noreferrer">http://developer.android.com/sdk/ndk/overview.html</a> which says: </p> <blockquote> <p>The NDK will not benefit most applications. As a developer, you need to balance its...
57,332,430
adding width to drawer in flutter
<p>I want to be able to add width to this drawer because it takes up too much of the screen when open and I want to lessen the width a bit, is this possible and how would I do this?</p> <p>here is my scaffold</p> <pre><code>Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar( title: ne...
57,333,040
4
0
null
2019-08-02 19:28:21.617 UTC
3
2022-02-13 16:57:27.6 UTC
null
null
null
null
11,388,321
null
1
31
flutter
31,182
<p>Wrap the Drawer widget inside a Container widget and pass the width parameter to the Container.</p> <pre><code>drawer: Container( width: 50, child: Drawer( child: ListView( padding: EdgeInsets.zero, children: &lt;Widget&gt;[ UserAccountsDrawerHeader( ...
57,553,973
Where should I place my Vaadin 10+ static files?
<p>In Vaadin 10-14, where should I place my static files, such as CSS, JavaScript, and Polymer templates? How about static files such as images?</p> <p>Also, how do I import these files in Vaadin? Is there a difference between Vaadin 14 with npm and Vaadin 10-13 with bower?</p>
57,553,974
3
1
null
2019-08-19 09:31:20.063 UTC
9
2021-06-02 18:39:44.047 UTC
null
null
null
null
3,358,029
null
1
19
spring|polymer|vaadin|stylesheet|vaadin-flow
7,963
<p>All paths are relative to the project root, e.g. where the <code>pom.xml</code> file is located in a Maven project.</p> <p>JavaScript imported using <code>@JsModule</code> uses <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode" rel="noreferrer">strict mode</a>. Among other thing...
48,316,365
React fragment shorthand failing to compile
<p>The project in question is using React-16.2.0 which has the capability to use Fragments and the Fragment shorthand.</p> <p><a href="https://reactjs.org/blog/2017/11/28/react-v16.2.0-fragment-support.html" rel="noreferrer">https://reactjs.org/blog/2017/11/28/react-v16.2.0-fragment-support.html</a></p> <p>While the ...
48,803,293
3
1
null
2018-01-18 07:59:57.973 UTC
7
2021-11-27 23:46:53.463 UTC
null
null
null
null
4,182,529
null
1
45
javascript|reactjs|create-react-app
24,151
<p>I think this is a reason:</p> <p><a href="https://reactjs.org/blog/2017/11/28/react-v16.2.0-fragment-support.html#support-for-fragment-syntax" rel="noreferrer">https://reactjs.org/blog/2017/11/28/react-v16.2.0-fragment-support.html#support-for-fragment-syntax</a></p> <p><strong><a href="https://i.stack.imgur.com/b...
30,284,237
What is the purpose of "uber mode" in hadoop?
<p>Hi I am a big data newbie. I searched all over the internet to find what exactly uber mode is. The more I searched the more I got confused. Can anybody please help me by answering my questions?</p> <ul> <li>What does uber mode do? </li> <li>Does it works differently in mapred 1.x and 2.x?</li> <li>And where can I f...
31,250,087
4
0
null
2015-05-17 06:58:04.25 UTC
16
2017-02-23 06:14:51.67 UTC
2015-11-03 15:25:58.11 UTC
null
861,423
null
2,120,416
null
1
30
hadoop|mapreduce
29,614
<p><strong>What is UBER mode in Hadoop2?</strong> </p> <p>Normally mappers and reducers will run by ResourceManager (RM), RM will create separate container for mapper and reducer. Uber configuration, will allow to run mapper and reducers in the same process as the ApplicationMaster (AM). </p> <p><strong>Uber jobs :...
848,794
Sending email in Java using Apache Commons email libs
<p>I am using Apache Commons Email library to send emails, but I am not able to send them via GMail SMTP server.<br> Can anyone provide sample code which works with GMail SMTP server and others?</p> <p>I am using the following code which does not work:</p> <pre><code>String[] recipients = {"receiver@gmail.com"}; Sim...
848,814
3
0
null
2009-05-11 16:02:57.673 UTC
14
2015-10-01 15:41:47.683 UTC
2012-05-18 13:14:11.987 UTC
null
21,234
null
93,796
null
1
12
java|email|smtp|gmail|apache-commons-email
32,322
<p>Sending emails to the GMail SMTP server requires authentication and SSL. The username and password is pretty straight forward. Make sure you have the following properties set to enable authentication and SSL and it should work.</p> <pre><code>mail.smtp.auth=true mail.smtp.starttls.enable=true </code></pre> <p>To t...
980,337
How to know if the code is inside TransactionScope?
<p>What is the best way to know if the code block is inside TransactionScope?<br> Is Transaction.Current a realiable way to do it or there are any subtleties?<br> Is it possible to access internal ContextData.CurrentData.CurrentScope (in System.Transactions) with reflection? If yes, how?</p>
1,079,879
3
0
null
2009-06-11 10:14:26.007 UTC
7
2020-09-09 14:33:06.027 UTC
2016-04-03 05:54:48.21 UTC
null
41,956
null
94,990
null
1
33
c#|.net|transactionscope
13,006
<p>Here is more reliable way (as I said, Transaction.Current can be set manually and it doesn't always mean we are really in TransactionScope). It's also possible to get this information with reflection, but emiting IL works 100 times faster than reflection.</p> <pre><code>private Func&lt;TransactionScope&gt; _getCurr...
1,005,206
Does SQLite lock the database file on reads?
<p>I'm investigating SQLite as a storage engine, and am curious to know whether SQLite locks the database file on reads.</p> <p>I am concerned about read performance as my planned project will have few writes, but many reads. If the database does lock, are there measures that can be taken (such as memory caching) to ...
1,005,218
3
0
null
2009-06-17 05:08:25.793 UTC
13
2020-01-14 00:11:02.883 UTC
null
null
null
null
64,053
null
1
49
sqlite
41,395
<p>From its <a href="http://en.wikipedia.org/wiki/SQLite" rel="noreferrer">Wikipedia page</a>:</p> <blockquote> <p>Several computer processes or threads may access the same database without problems. Several read accesses can be satisfied in parallel.</p> </blockquote> <p>More precisely, from its <a href="http://ww...
683,339
How do I find the absolute position of an element using jQuery?
<p>Is there a way of finding the absolute position of an element, i.e. relative to the start of the window, using jQuery?</p>
683,564
3
1
null
2009-03-25 20:36:52.21 UTC
66
2022-06-28 10:17:46.257 UTC
2009-03-26 01:30:01.223 UTC
null
45,433
akshat
29,653
null
1
425
javascript|jquery
383,883
<p><a href="http://docs.jquery.com/CSS/offset" rel="noreferrer"><code>.offset()</code></a> will return the offset position of an element as a simple object, eg:</p> <pre><code>var position = $(element).offset(); // position = { left: 42, top: 567 } </code></pre> <p>You can use this return value to position other elem...
39,580,063
Remove the first N items that match a condition in a Python list
<p>If I have a function <code>matchCondition(x)</code>, how can I remove the first <code>n</code> items in a Python list that match that condition?</p> <p>One solution is to iterate over each item, mark it for deletion (e.g., by setting it to <code>None</code>), and then filter the list with a comprehension. This requ...
39,580,621
7
0
null
2016-09-19 18:46:05.587 UTC
13
2019-04-27 15:29:55.987 UTC
2016-09-20 14:49:29.863 UTC
null
400,617
null
939,259
null
1
59
python|list|list-comprehension
8,167
<p>One way using <a href="https://docs.python.org/3/library/itertools.html#itertools.filterfalse"><code>itertools.filterfalse</code></a> and <a href="https://docs.python.org/3/library/itertools.html#itertools.count"><code>itertools.count</code></a>:</p> <pre><code>from itertools import count, filterfalse data = [1, 1...
39,828,043
Gradle error: Write access is allowed from event dispatch thread only in Android Studio
<p>After updating Android Studio to version 2.2 (on Windows 10) and somehow next morning I received such error when gradle built on any project: </p> <blockquote> <p>Write access is allowed from event dispatch thread only</p> </blockquote> <p>Despite that gradlew -build command worked and completed successfully. I...
39,828,044
5
1
null
2016-10-03 09:10:11.537 UTC
21
2019-07-03 04:05:30.46 UTC
2019-07-03 04:04:44.86 UTC
null
107,625
null
3,379,437
null
1
122
android|android-studio|gradle|android-gradle-plugin|gradlew
61,216
<p>So the problem was concluded in that Android Studio conflicted with my installed JDK version, so it was resolved when I checked JDK location (File → Project Structure → SDK Location), ticked 'Use embedded JDK' checkbox and set JDK location to 'path to Android Studio'\Android Studio\jre</p>
6,434,088
What specific use cases call for BOSH over WebSockets and long-polling?
<p><a href="http://xmpp.org/extensions/xep-0124.html" rel="noreferrer">BOSH</a> is...</p> <blockquote> <p>a transport protocol that emulates the semantics of a long-lived, bidirectional TCP connection between two entities (such as a client and a server) by efficiently using multiple synchronous HTTP request/response...
6,442,488
1
0
null
2011-06-22 01:59:14.4 UTC
34
2017-04-25 14:33:19.903 UTC
2017-04-25 14:33:19.903 UTC
null
1,028,230
null
102,704
null
1
43
http|comet|websocket
17,519
<p><strong>First let me address WebSockets readiness</strong>:</p> <p>WebSockets implementation of the <a href="https://datatracker.ietf.org/doc/html/draft-hixie-thewebsocketprotocol-76" rel="nofollow noreferrer">Hixie-76</a> protocol are shipped and enabled by default in Chrome, Safari and iOS (iPhone and iPad). The H...
24,430,121
How to use font awesome in a fxml project (javafx)
<p>I want to use font font awesome in my project but I have no idea how to use font awesome in my project.</p> <p>I had found some example but they can't be use in fxml.</p> <p><a href="https://bitbucket.org/Jerady/fontawesomefx" rel="noreferrer">font awesome javafx</a> </p> <p>I need help how to use it in my projec...
24,433,222
6
0
null
2014-06-26 12:07:37.54 UTC
2
2019-05-17 14:07:40.307 UTC
2018-10-18 18:33:26.633 UTC
null
2,503,722
null
3,749,316
null
1
14
java|javafx|javafx-2|javafx-8|fxml
49,818
<p>I think this is what you need <a href="http://fxexperience.com/controlsfx/features/" rel="nofollow noreferrer">ControlFX</a> that include font awesome support. see the <a href="https://controlsfx.bitbucket.io/" rel="nofollow noreferrer">javadoc</a> for more info (But I tested it one day and it works fine)</p>
5,965,007
How can I set a fixed height for my entire webpage?
<p>I thought this was a simple fix:</p> <pre><code>body { height: 1054px; } html { height: 1054px; } </code></pre> <p>Wouldn't this set the max height of the page to <code>1054px</code>? I have also tried these workarounds but they didn't work with what I wanted:</p> <pre><code>html { overflow: hidden; }...
5,965,074
3
3
null
2011-05-11 13:25:28.367 UTC
3
2012-09-08 22:00:20.907 UTC
2011-05-11 13:32:29.66 UTC
null
20,578
null
650,489
null
1
6
html|css
88,572
<p><code>width</code> and <code>height</code> do set absolute widths and heights of an element respectively. <code>max-width</code>, <code>max-height</code>, <code>min-width</code> and <code>min-height</code> are seperate properties.</p> <p>Example of a page with 1054px square content and a full background:</p> <pre>...
5,747,401
How to replace value in list at same collection location
<p>How do I replace a value in a collection list at the same location?</p> <pre><code>0 = cat 1 = dog 2 = bird </code></pre> <p>replace <code>2</code> with <code>snail</code>?</p>
5,747,420
3
1
null
2011-04-21 17:08:23.23 UTC
3
2019-01-16 12:19:36.703 UTC
2013-05-24 06:47:54.54 UTC
null
1,049,308
null
230,434
null
1
39
c#
80,829
<p>Do you mean:</p> <pre><code>yourCollection[2] = "Snail"; </code></pre>
5,993,621
Fastest way to search a list in python
<p>When you do something like <code>"test" in a</code> where <code>a</code> is a list does python do a sequential search on the list or does it create a hash table representation to optimize the lookup? In the application I need this for I'll be doing a lot of lookups on the list so would it be best to do something lik...
5,993,659
4
0
null
2011-05-13 14:45:38.74 UTC
11
2016-09-14 12:32:16.823 UTC
null
null
null
null
38
null
1
39
python|list|search|find|set
62,423
<blockquote> <p>Also note that the list of values I'll have won't have duplicate data and I don't actually care about the order it's in; I just need to be able to check for the existence of a value.</p> </blockquote> <p>Don't use a list, use a <a href="http://docs.python.org/library/stdtypes.html#set-types-set-froze...
5,922,287
Rails 3: yield/content_for with some default value?
<p>Is there any way to detect if <code>#content_for</code> was actually applied to a <code>yield</code> scope in Rails?</p> <p>A classic example being something like:</p> <pre><code>&lt;title&gt;&lt;%= yield :page_title %&gt;&lt;/title&gt; </code></pre> <p>If a template doesn't set that with</p> <pre><code>&lt;% co...
5,922,305
4
0
null
2011-05-07 16:06:28.243 UTC
12
2014-10-20 11:19:18.113 UTC
null
null
null
null
322,122
null
1
64
ruby-on-rails|ruby|yield
17,517
<p>You can use <code>content_for?</code> to check if there is content with a specific name:</p> <pre><code>&lt;% if content_for?(:page_title) %&gt; &lt;%= yield(:page_title) %&gt; &lt;% else %&gt; &lt;%= default_page_title %&gt; &lt;% end %&gt; </code></pre> <p>or</p> <pre><code>&lt;%= content_for?(:page_title) ...
32,163,517
Run javascript code in Webview
<p>I have a webview i am using in android and I'm trying to trigger javascript on a button click. I'm trying to use the code below to change the color of the class to red. But I cant seem to get it working</p> <pre><code>final WebView wb=(WebView)findViewById(R.id.webView2); wb.loadUrl("javascript:" + ...
32,163,655
2
1
null
2015-08-23 05:33:41.67 UTC
12
2020-01-05 19:26:41.02 UTC
null
null
null
null
2,423,476
null
1
20
javascript|android|webview
26,254
<p>From kitkat onwards use evaluateJavascript method instead loadUrl to call the javascript functions like below</p> <pre><code> if (android.os.Build.VERSION.SDK_INT &gt;= android.os.Build.VERSION_CODES.KITKAT) { webView.evaluateJavascript("var FunctionOne = function () {" + " try{document.getE...
5,617,175
ArrayList replace element if exists at a given index?
<p>How to replace element if exists in an ArrayList at a given index?</p>
9,700,356
5
0
null
2011-04-11 05:39:54.787 UTC
7
2020-07-12 21:01:30.17 UTC
2018-03-14 12:39:11.4 UTC
null
1,000,551
null
689,853
null
1
85
java|arraylist
89,150
<pre><code> arrayList.set(index i,String replaceElement); </code></pre>
5,813,077
iPhone/iOS JSON parsing tutorial
<p>As a learning experience, I want to make an iPhone application that calls a webserver/webservice, retrieves a JSON response, and uses that response to populate the rows of a <code>UITableView</code> (assuming it converts the JSON into an <code>NSArray</code> first).</p> <p>Anyone know of anything that might be usef...
5,813,223
6
0
null
2011-04-28 02:54:24.97 UTC
81
2016-12-20 06:20:45.203 UTC
2016-12-20 06:20:45.203 UTC
null
4,078,527
null
480,807
null
1
103
iphone|objective-c|ios|json|uitableview
137,155
<p>You will love this <a href="https://github.com/stig/json-framework/">framework</a>.</p> <p>And you will love this <a href="http://ditchnet.org/httpclient/">tool</a>.</p> <p>For learning about JSON you might like this <a href="http://json.org/">resource</a>.</p> <p>And you'll probably love this <a href="http://blo...
9,969,833
Programmatically determine via ifdef if a label is defined within a Translation Unit
<p>I have the following bit of code, I expect that given cstdio is included that the first line will be printed, however the second line is printed. </p> <p>What am I doing wrong? is it possible to know if labels such as printf or strncmp or memcpy have been defined in the current translation unit at compile time?</p>...
9,969,890
3
6
null
2012-04-02 01:12:00.92 UTC
8
2012-04-02 01:47:37.907 UTC
2012-04-02 01:47:37.907 UTC
null
755,004
null
755,004
null
1
2
c++|label|conditional-compilation
366
<p><code>#ifdef</code> only applies to preprocessor macros, defined with <code>#define</code>, not to symbols like function names and variables. You can imagine the preprocessor as an actual separate preliminary step, like running your code through a perl script, that occurs before the "real" compiler gets a crack at ...
1,320,931
How to correctly use ABPersonViewController with ABPeoplePickerNavigationController to view Contact information?
<p>Update 9/2/10: This code no longer works as of the iOS 4 update--it fails with an internal assertion. There is now a great Address Book API example available in the iPhone SDK Reference Library called "QuickContacts."</p> <p>The example code is available here; it will help you solve this problem: <a href="http://de...
1,356,215
1
0
null
2009-08-24 07:34:49.757 UTC
9
2012-05-16 05:14:57.353 UTC
2012-04-20 07:00:15.007 UTC
null
579,628
null
153,081
null
1
19
iphone|ios|addressbook
31,333
<p>Just a heads-up to anyone who runs into this problem themselves: I was able to product the correct behavior by instantiating the ABPersonViewController in its delegate's <strong>viewDidLoad()</strong> method as below:</p> <p>As before, here's my <strong>ABPeoplePickerNavigationController delegate's</strong> method:...
1,270,001
Visual Studio 2008 Output - Hide dll loads and unloads
<p>Visual Studio automatically displays dll loads/unloads in its output panel, like so:</p> <pre><code>'DialogAppDEBUG.exe': Unloaded 'C:\WINDOWS\system32\wbem\fastprox.dll' 'DialogAppDEBUG.exe': Unloaded 'C:\WINDOWS\system32\ntdsapi.dll' 'DialogAppDEBUG.exe': Unloaded 'C:\WINDOWS\system32\wldap32.dll' 'DialogAppDEBUG...
1,682,418
1
1
null
2009-08-13 04:17:00.34 UTC
2
2009-11-05 18:00:00.907 UTC
null
null
null
null
136,785
null
1
28
visual-studio-2008|panel
3,794
<p>Asked the same thing today, and the answer was as simple as:</p> <blockquote> <p>Right click in the Output window when you're running your program and uncheck all of the messages you don't want to see (like Thread Exit messages).</p> </blockquote> <p>In your case, uncheck "Module Load messages"</p>
19,365,758
How do I store a value from a SELECT statement in a variable in a MySQL Stored Procedure?
<p>This may be a super easy question to answer, but I am unsure how to do this correctly.</p> <p>Here is my query within the procedure:</p> <pre><code>SELECT COUNT(barcode) AS count FROM movieitems; </code></pre> <p>How do I store the return value of this statement (for example, the value in <code>count</code> is <c...
19,365,810
2
0
null
2013-10-14 17:25:56.073 UTC
6
2013-10-14 17:30:40.073 UTC
null
null
null
null
546,509
null
1
29
mysql|sql|stored-procedures
84,020
<p>In a stored procedure do this:</p> <pre><code>SELECT COUNT(barcode) AS count into @myVar FROM movieitems; </code></pre>
41,126,943
Wireshark - you don't have permission to capture on that device mac
<p>I installed Wireshark and during the installation it showed an error but the installation itself completed. When I ran the program and tried to capture packets on my network, it showed this error:</p> <p><img src="https://i.stack.imgur.com/IWFlY.png" alt="You don't have permission to capture on that device" /></p> <...
42,368,892
9
0
null
2016-12-13 17:18:45.497 UTC
28
2021-12-23 07:43:23.017 UTC
2020-06-20 09:12:55.06 UTC
null
-1
null
7,263,962
null
1
46
macos|permissions|wireshark
83,014
<p>According to User: <a href="https://ask.wireshark.org/questions/578/mac-os-cant-detect-any-interface" rel="noreferrer">gmale's answer on ask.wireshark.org</a>, he solved his problem in this way and I'm sure that it could solve yours as well. It says:</p> <p>1- <strong>Open Terminal</strong></p> <p>To see your exac...
19,242,747
JavaFX Editable ComboBox : Showing toString on item selection
<p>I have a <code>ComboBox&lt;Person&gt;</code>, of type <code>Person</code>, in which I have added few object of <code>Person</code> class.</p> <p>I have used <code>setCellFactory(Callback)</code> method to show <code>Person</code> name in <code>ComboBox</code> drop down</p> <pre><code>combobox.setCellFactory( new...
20,470,223
2
0
null
2013-10-08 08:30:02.197 UTC
9
2021-02-11 06:58:55.677 UTC
2021-02-11 06:58:55.677 UTC
null
2,164,365
null
1,795,947
null
1
12
combobox|javafx-2|javafx|javafx-8
18,974
<p>Here is an answer to my own question which I found best after many efforts and corrections.</p> <pre><code>mainComboBox.setButtonCell( new ListCell&lt;Object&gt;() { @Override protected void updateItem(Object t, boolean bln) { super.updateItem(t, bln); if (bln) { ...
19,167,901
File not shown in git diff after a git add. How do I know it will be committed?
<p>I had an untracked file which was not appearing in a git diff and when I added it to the 'changes to be committed' area, it still doesn't show up in the git diff. I shows up with a <code>git status -v</code> when I do a diff against HEAD.</p> <p>I'm still very new to git, so could anyone please tell me if the file ...
19,168,261
5
0
null
2013-10-03 19:44:13.633 UTC
3
2018-07-31 15:28:26.8 UTC
2016-09-19 21:33:58.227 UTC
null
2,301,450
null
1,732,772
null
1
41
git|file|commit|git-commit|git-diff
32,330
<p>If you'd like to see the <em>staged</em> changes in a diff, you can still use <code>git diff</code>, you just need to pass the <code>--staged</code> flag:</p> <pre class="lang-sh prettyprint-override"><code>david@pav:~/dummy_repo$ echo "Hello, world" &gt; hello.txt david@pav:~/dummy_repo$ git status # On branch mas...
26,538,421
How do I play sound on button click in android studio?
<p>I would like that when the button is pressed the sound file starts to play.I have already created the raw folder and put the .wav file there. The problem is that i don't know how to do this thing. I checked similar questions here but they don't seem to fix my problem. What should i do? Thank you in advance.</p> <p>...
26,538,468
1
0
null
2014-10-23 22:16:24.727 UTC
2
2020-12-20 00:18:20.263 UTC
2020-12-20 00:18:20.263 UTC
null
1,783,163
null
4,135,362
null
1
2
android|button|android-studio
76,064
<pre><code> Log.v(TAG, "Initializing sounds..."); final MediaPlayer mp = MediaPlayer.create(this, R.raw.sound); Button play_button = (Button)this.findViewById(R.id.button); play_button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { ...
26,787,628
How do I specify relative paths in CMAKE?
<p>I want to specify a path that is relative to the current directory within CMake and have not been able to find a solution.</p> <p>My project lies in a path something like:</p> <pre><code>C:/Projects/ProjectA/CMakeLists.txt </code></pre> <p>and I want to specify the name of the relative path of the following director...
26,787,695
1
0
null
2014-11-06 19:16:29.263 UTC
1
2022-03-21 16:02:50.793 UTC
2022-03-21 16:00:39.843 UTC
null
212,378
null
1,620,721
null
1
24
cmake
38,456
<p>The is almost exactly the same, except that you have allow for CMake to run in another location for &quot;out-of-tree&quot; builds. You do this by specifying the path relative to <code>${CMAKE_CURRENT_SOURCE_DIR}</code>, which is the directory containing the current CMakeLists.txt file.</p> <pre><code>${CMAKE_CURRE...
36,215,244
Disable entire form elements with respect to a state. React
<p>I am disabling the inputs using the <code>isFetching</code> prop, but this is getting reduntant as I have to keep this in every input field. Is there a way to disable the entire form? Like a <code>disable</code> property in <code>&lt;form&gt;</code> tag or something?</p> <pre><code>&lt;form&gt; &lt;input type="t...
36,216,001
3
0
null
2016-03-25 06:39:34.677 UTC
5
2017-09-18 22:30:27.213 UTC
2017-04-23 13:02:58.84 UTC
null
4,205,470
null
3,783,888
null
1
29
javascript|html|forms|reactjs
36,760
<p>I think this should solve your problem <a href="https://stackoverflow.com/a/17186342/3298693">https://stackoverflow.com/a/17186342/3298693</a>.</p> <p>You should insert your form inside an element <code>&lt;fieldset disabled="disabled"&gt;</code>. This will make the whole form disabled.</p>
42,467,663
How to Async/await in List.forEach() in Dart
<p>I'm writing some kind of bot (command line application) and I'm having trouble with async execution when I'm using the &quot;forEach&quot; method. Here is a simplified code of what I'm trying to do :</p> <pre><code>main() async { print(&quot;main start&quot;); await asyncOne(); print(&quot;main end&quot;); } ...
42,467,822
6
1
null
2017-02-26 11:02:45.19 UTC
13
2022-05-10 22:31:06.087 UTC
2021-04-14 05:07:56.423 UTC
user10563627
null
null
7,091,129
null
1
96
flutter|dart|asynchronous|foreach
28,067
<p>I don't think it's possible to achieve what you want with the <code>forEach</code> method. However it will work with a <code>for</code> loop. Example;</p> <pre><code>asyncOne() async { print("asyncOne start"); for (num number in [1, 2, 3]) await asyncTwo(number); print("asyncOne end"); } </code></pre>
51,444,059
How to iterate over two dataloaders simultaneously using pytorch?
<p>I am trying to implement a Siamese network that takes in two images. I load these images and create two separate dataloaders.</p> <p>In my loop I want to go through both dataloaders simultaneously so that I can train the network on both images.</p> <pre><code>for i, data in enumerate(zip(dataloaders1, dataloaders2...
51,444,290
5
2
null
2018-07-20 13:50:42.443 UTC
8
2021-12-09 07:07:02.86 UTC
null
null
null
null
7,560,762
null
1
13
python|machine-learning|zip|conv-neural-network|pytorch
27,493
<p>I see you are struggling to make a right dataloder function. I would do:</p> <pre><code>class Siamese(Dataset): def __init__(self, transform=None): #init data here def __len__(self): return #length of the data def __getitem__(self, idx): #get images and labels here ...
32,656,837
Changing the drawable size inside a button
<p>I want to create a <code>Button</code> like this:</p> <p><a href="https://i.stack.imgur.com/yynI2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yynI2.png" alt="Button Example" /></a></p> <p><strong>Here is my code:</strong></p> <pre><code>&lt;Button android:layout_width=&quot;80dp&quot; android:...
32,657,198
9
2
null
2015-09-18 16:27:49.203 UTC
2
2022-05-19 00:32:23.09 UTC
2022-01-03 08:18:42.103 UTC
null
4,742,830
null
4,742,830
null
1
14
android|android-layout|android-drawable|android-button|android-image
54,656
<h1>Solution 1:</h1> <p>Adding a drawable to a button has very limited functions. You can't change the drawable size, so the best way to fix it is to add a button with an image view beside it in a linear layout like this:</p> <pre><code>&lt;LinearLayout android:layout_width="wrap_content" android:layout_heigh...
32,838,760
How to resolve relative paths in python?
<p>I have Directory structure like this</p> <pre><code>projectfolder/fold1/fold2/fold3/script.py </code></pre> <p>now I'm giving script.py a path as commandline argument of a file which is there in </p> <pre><code>fold1/fold_temp/myfile.txt </code></pre> <p>So basically I want to be able to give path in this way </...
32,839,385
4
2
null
2015-09-29 08:01:04.72 UTC
8
2021-09-02 16:50:36.153 UTC
2017-05-23 11:54:05.047 UTC
null
-1
null
5,246,524
null
1
30
python|path
54,410
<pre><code>import os dir = os.path.dirname(__file__) path = raw_input() if os.path.isabs(path): print "input path is absolute" else: path = os.path.join(dir, path) print "absolute path is %s" % path </code></pre> <p>Use os.path.isabs to judge if input path is absolute or relative, if it is relative, then u...
9,487,077
How to view the log of all commands?
<p>I'm trying to view all commands that I've entered into the unix environment in my Git Bash.</p> <p>So I'm not trying to view the list of possible commands for Git Hub. Neither am I trying to view the logs for pushes and pulls.</p> <p>I just want to view what I entered in the command line. This is because I recentl...
9,487,703
3
0
null
2012-02-28 17:47:50.733 UTC
3
2016-06-16 19:51:32.673 UTC
2013-04-30 04:32:14.373 UTC
null
635,608
null
1,110,767
null
1
14
unix|logging|github|git-bash
62,128
<p>You can do this with <code>cat $HISTFILE</code>.</p> <p>Bash by default stores the last 500 commands in a history file, most likely called ~/.bash_history. This file is in the variable $HISTFILE (and the size is in $HISTFILESIZE). You can get the path to the history file with <code>echo $HISTFILE</code>.</p>
9,061,800
How do I autocrop a UIImage?
<p>I have a UIImage which contains a shape; the rest is transparent. I'd like to get another UIImage by cropping out as much of the transparent part as possible, still retaining all of the non-transparent pixels - similar to the autocrop function in GIMP. How would I go about doing this?</p>
13,922,413
6
0
null
2012-01-30 09:33:01.32 UTC
16
2021-06-28 20:15:26.703 UTC
2012-01-31 09:50:15.123 UTC
null
30,461
null
15,371
null
1
15
ios|cocoa-touch|uikit|uiimage|core-graphics
6,565
<p>This approach may be a little more invasive than what you were hoping for, but it gets the job done. What I'm doing is creating a bitmap context for the UIImage, obtaining a pointer to the raw image data, then sifting through it looking for non-transparent pixels. My method returns a CGRect which I use to create a n...
9,459,030
Django when to use teardown method
<p>According to the docs:</p> <blockquote> <p>A TestCase, on the other hand, does not truncate tables and reload initial data at the beginning of a test. Instead, it encloses the test code in a database transaction that is rolled back at the end of the test. It also prevents the code under test from issuing an...
9,459,139
3
0
null
2012-02-27 01:34:52.637 UTC
4
2013-07-22 00:00:52.157 UTC
2012-02-27 10:36:02.08 UTC
null
99,876
null
131,238
null
1
30
django
25,095
<p>For the purposes of the database, <code>tearDown</code> is pretty pointless, because each test is run in a transaction. However, not everything in a test involves the database. You might test file creation/reading, spin off processes, open network connections, etc. These types of things usually require you to "close...
31,105,846
How to send a pdf file from Node/Express app to the browser
<p>In my Node/Express app I have the following code, which suppose to read a PDF document from a file, and send it to the browser:</p> <pre><code>var file = fs.createReadStream('./public/modules/datacollectors/output.pdf', 'binary'); var stat = fs.statSync('./public/modules/datacollectors/output.pdf'); res.setHeader('...
31,106,110
6
1
null
2015-06-28 23:26:13.76 UTC
13
2022-03-08 11:53:25.993 UTC
2015-06-29 00:34:08.527 UTC
null
1,266,650
null
518,012
null
1
43
node.js|express
115,805
<p>You have to pipe from Readable Stream to Writable stream not the other way around:</p> <pre><code>var file = fs.createReadStream('./public/modules/datacollectors/output.pdf'); var stat = fs.statSync('./public/modules/datacollectors/output.pdf'); res.setHeader('Content-Length', stat.size); res.setHeader('Content-Typ...
34,204,447
git rebase --continue no changes
<p>I have two branches with two features: <code>banch_1</code> and <code>branch_2</code>. <code>branch_2</code> uses feature from <code>branch_1</code>. I've made changes in the <code>branch_1</code> and want to rebase <code>branch_2</code> on <code>branch_1</code> to get changes from <code>branch_1</code> into <code>b...
34,205,948
1
2
null
2015-12-10 14:30:48.943 UTC
4
2018-05-15 09:59:03.857 UTC
2015-12-10 14:33:49.123 UTC
null
1,401,900
null
1,858,864
null
1
50
git|git-rebase
19,577
<p>If I understand correctly, when you're getting the merge conflict, you're accepting all the changes from <code>branch_1</code>, meaning that that particular commit from <code>branch_2</code> is irrelevant - any changes in that commit are identical to the incoming changes from <code>branch_1</code>.</p> <p>When git ...
22,627,473
hive check comma separated String contains a string
<p>I have a column in hive table <code>list_ids</code> which is a list of ids stored as comma separated string.</p> <p>how can I write a query for this column to check if it stores a particular id </p> <p>Example:</p> <pre><code> list_ids = "abc,cde,efg" </code></pre> <p>I want to something like </p> <pre><code> s...
22,820,346
3
0
null
2014-03-25 07:00:38.577 UTC
7
2018-05-04 17:30:15.367 UTC
2014-03-25 07:05:28.86 UTC
null
1,120,015
null
2,978,621
null
1
21
string|hive
53,750
<p>Use Hive standard functions <code>split</code> and <code>array_contains</code></p> <p><code>split(string str, string pat)</code> returns <code>array&lt;string&gt;</code> by splitting str around pat (regular expression)</p> <p><code>array_contains(array&lt;T&gt;, value)</code> returns <code>true</code> if array con...
22,799,300
How to unpack a Series of tuples in Pandas?
<p>Sometimes I end up with a series of tuples/lists when using Pandas. This is common when, for example, doing a group-by and passing a function that has multiple return values:</p> <pre><code>import numpy as np from scipy import stats df = pd.DataFrame(dict(x=np.random.randn(100), y=np.repeat(l...
36,816,769
5
1
null
2014-04-02 00:14:32.223 UTC
12
2022-02-26 05:58:31.367 UTC
null
null
null
null
1,533,576
null
1
44
python|pandas
34,761
<p>maybe this is most strightforward (most pythonic i guess):</p> <pre><code>out.apply(pd.Series) </code></pre> <p>if you would want to rename the columns to something more meaningful, than:</p> <pre><code>out.columns=['Kstats','Pvalue'] </code></pre> <p>if you do not want the default name for the index:</p> <pre>...
7,519,467
Line plot with arrows in matplotlib
<p>I have a line graph that I want to plot using arrows instead of lines. That is, the line between successive pairs of points should be an arrow going from the first point to the second point.</p> <p>I know of the <code>arrow</code> function, but that only seems to do individual arrows. Before I work out a way to try...
7,543,518
2
0
null
2011-09-22 18:13:29.193 UTC
11
2011-09-25 03:48:38.417 UTC
null
null
null
null
1,912
null
1
35
python|plot|matplotlib
28,290
<p>You can do this with <a href="http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.quiver" rel="noreferrer">quiver</a>, but it's a little tricky to get the keyword arguments right.</p> <pre><code>import numpy as np import matplotlib.pyplot as plt x = np.linspace(0, 2*np.pi, 10) y = np.sin(x) pl...
7,122,325
SocketException: Permission Denied?
<p>My LogCat reads:</p> <pre><code>08-19 09:29:01.964: WARN/System.err(311): java.net.SocketException: Permission denied 08-19 09:29:02.204: WARN/System.err(311): at org.apache.harmony.luni.platform.OSNetworkSystem.createStreamSocketImpl(Native Method) 08-19 09:29:02.214: WARN/System.err(311): at org.apache.ha...
7,122,367
2
1
null
2011-08-19 13:31:19.653 UTC
4
2016-07-19 14:56:39.483 UTC
2011-08-23 02:22:18.507 UTC
null
834,063
null
834,063
null
1
50
android|url|inputstream|permission-denied|socketexception
51,423
<p>Add Internet permission to your manifest:</p> <pre><code>&lt;uses-permission android:name="android.permission.INTERNET"/&gt; </code></pre>
32,062,051
How to make 'submit' button disabled?
<p>How to disable the "Submit" button until the form is valid? </p> <p>Does angular2 have an equivalent to ng-disabled that can be used on the Submit button? (ng-disabled doesn't work for me.)</p>
32,082,365
8
1
null
2015-08-18 01:09:33.247 UTC
16
2019-09-06 04:39:34.687 UTC
2019-09-06 04:38:16.147 UTC
null
5,468,463
null
865,955
null
1
172
forms|angular
286,682
<p>As seen in this Angular <a href="https://github.com/angular/angular/blob/57496926cad0d840092c7623079883983ca07d53/modules/examples/src/model_driven_forms/index.ts" rel="noreferrer">example</a>, there is a way to disable a button until the whole form is valid:</p> <pre><code>&lt;button type="submit" [disabled]="!ngF...
19,067,632
Difference between LET and SETQ?
<p>I'm programming on Ubuntu using GCL. From the documentation on Common Lisp from various sources, I understand that <code>let</code> creates <em>local</em> variables, and <code>setq</code> sets the values of <em>existing</em> variables. In cases below, I need to create two variables and sum their values.</p> <h3>Usi...
19,067,897
4
1
null
2013-09-28 13:44:04.43 UTC
8
2020-06-12 14:39:34.633 UTC
2020-06-20 09:12:55.06 UTC
null
-1
null
2,826,354
null
1
32
lisp|common-lisp
16,208
<p><code>setq</code> <em>assigns</em> a value to a variable, whereas <code>let</code> introduces new variables/bindings. E.g., look what happens in </p> <pre><code>(let ((x 3)) (print x) ; a (let ((x 89)) (print x) ; b (setq x 73) (print x)) ; c (print x)) ; d 3 ; a 89 ; b 73 ; ...
18,933,321
Can I safely delete contents of Xcode Derived data folder?
<p>I am running low on disk space and checked through a third party utility that among other things that ~/Library/Developer/Xcode/DerivedData directory is taking about 22GB of disk space.</p> <p>I searched stackoverflow and found this post </p> <p><a href="https://stackoverflow.com/questions/7279141/what-can-i-safel...
18,933,382
12
1
null
2013-09-21 13:46:21.453 UTC
96
2022-06-15 02:58:22.56 UTC
2017-05-23 12:02:51.417 UTC
null
-1
null
1,058,419
null
1
336
ios|xcode
258,753
<p>Yes, you can delete all files from <code>DerivedData</code> sub-folder <code>(Not DerivedData Folder)</code> directly. </p> <p>That will not affect your project work. Contents of <code>DerivedData</code> folder is generated during the build time and you can delete them if you want. It's not an issue.</p> <p>The co...
37,959,751
How to use Font Awesome icon in android application?
<p>I want to use Font Awesome's icon set in my android application. I have some <code>TextView</code> to set those icons. I don't want to use any png image. My Textview is like this -></p> <pre><code>&lt;TextView android:id="@+id/userLogin" android:text="Login Now" android:clickable="true" android:onCl...
37,959,881
11
2
null
2016-06-22 06:01:46.247 UTC
10
2022-07-01 14:54:58.413 UTC
null
null
null
user6355963
null
null
1
23
android|textview
45,757
<p>You can follow this <a href="https://stackoverflow.com/questions/15210548/how-to-use-a-icons-and-symbols-from-font-awesome-on-native-android-application">answer</a>.</p> <p>First Download the fontawesome.ttf from <a href="http://fontawesome.io/" rel="noreferrer">here</a>. And put the file in <strong>asset/fontawesom...
36,715,776
Upload pdf file using Laravel 5
<p>I'm using Laravel 5.2 and I want to make a form which can upload a pdf file with it. I want to add that file on folder "files" in "public" folder. <br> <br>here is my view:</p> <pre><code>&lt;div class="form-group"&gt; &lt;label for="upload_file" class="control-label col-sm-3"&gt;Upload File&lt;/label&gt; ...
36,715,965
6
1
null
2016-04-19 10:31:44.003 UTC
1
2020-02-03 06:02:36.463 UTC
null
null
null
null
2,330,708
null
1
6
php|laravel|http|file-upload|laravel-5
50,406
<p>First you should add <code>enctype="multipart/form-data"</code> to your <code>&lt;form&gt;</code> tag. Then in your controller handle the file upload as follow:</p> <pre><code>class FileController extends Controller { // ... public function upload(Request $request) { $uniqueFileName = uniqid() ...
37,087,325
How to convert string to unicode(UTF-8) string in Swift?
<p>How to convert string to unicode(UTF-8) string in Swift?</p> <p>In Objective I could write smth like that:</p> <pre><code>NSString *str = [[NSString alloc] initWithUTF8String:[strToDecode cStringUsingEncoding:NSUTF8StringEncoding]]; </code></pre> <p>how to do smth similar in Swift?</p>
37,087,408
3
2
null
2016-05-07 10:24:43.25 UTC
3
2021-06-29 10:10:18.897 UTC
null
null
null
null
4,702,826
null
1
17
ios|swift|unicode|utf-8|utf-16
77,186
<p>Use this code,</p> <pre><code>let str = String(UTF8String: strToDecode.cStringUsingEncoding(NSUTF8StringEncoding)) </code></pre> <p>hope its helpful</p>
21,266,948
Use git to manage home directory
<p>I'd like to create <strong>one single git repo</strong> in my Linux $HOME directory. In this repo - obviously - I could add everything under version control, but this wouldn't make any sense. I'd like to only add the files and folders that are relevant to me, like <em>.vimrc</em>, <em>.vim</em>, <em>.bashrc</em>, et...
21,267,097
5
2
null
2014-01-21 19:07:58.29 UTC
23
2021-10-08 23:28:40.48 UTC
2014-01-21 19:12:19.397 UTC
null
68,587
null
3,046,043
null
1
50
git
20,355
<p><strong>.gitignore</strong></p> <pre><code># Ignore everything * # But not these files... !*.vimrc !*.vim !*.bashrc !.gitignore # etc... </code></pre> <p>My home directory is also on <a href="https://github.com/vanniktech/config-home" rel="nofollow noreferrer">GitHub</a>.</p>
21,344,842
if 'a' or 'b' in L, where L is a list (Python)
<p>I am having trouble with the following logic:</p> <p>Lets say I have a list <code>L = ['a', 'b', 'c']</code></p> <hr> <p>Both items are in the list...</p> <pre><code>if ('a' or 'b') in L: print 'it\'s there!' else: print 'No sorry' </code></pre> <p>prints <code>It's there!</code></p> <hr> <p>Only the ...
21,344,886
4
2
null
2014-01-25 00:16:56.45 UTC
5
2022-08-15 09:09:27.167 UTC
null
null
null
null
2,224,777
null
1
19
python
47,866
<p>Let's break down the expression:</p> <p><code>('e' or 'a')</code> will first check if <code>'e'</code> is True. If it is, the expression will return <code>'e'</code>. If not, it will return <code>'a'</code>.</p> <p>Since all non-empty strings returns <code>True</code>, this expression will always return <code>'e'<...
28,187,786
Monit daemon - error connecting to the monit daemon
<p>I installed monit and tried to check the status using below command.</p> <pre><code>monit status </code></pre> <p>But end up with below error.</p> <pre><code>monit: error connecting to the monit daemon </code></pre> <p>How can I fix this?</p>
28,187,787
2
1
null
2015-01-28 08:36:17.887 UTC
9
2017-05-01 07:29:54.307 UTC
null
null
null
null
1,263,783
null
1
46
linux|ubuntu|debian|monitoring|monit
19,301
<p>edit vim <code>/etc/monit/monitrc</code>, starting from line 118 and uncomment below lines</p> <pre><code> set httpd port 2812 use address localhost # only accept connection from localhost allow localhost # allow localhost to connect to the server and allow admin:monit </code></pre> <p><code>su...
1,365,649
How to handle string encoding in java?
<p>I was really discouraged by java's string encoding. There are many auto conversions in it. and I can't found the regular. Anyone have good idea? for example: In a jsp page, it has such link</p> <pre><code>http://localhost:8080/helloworld/hello?world=凹ㄉ </code></pre> <p>And then we need to process it, so we do this...
1,365,686
3
0
null
2009-09-02 03:01:28.84 UTC
2
2020-05-25 08:24:53.187 UTC
2010-09-27 14:16:35.007 UTC
null
139,010
null
140,899
null
1
2
java|string|character-encoding
43,059
<p>That is not how you convert between character sets. What you need to be worrying about is this part:</p> <pre><code> request.getParameter("world").toString().getBytes("ISO-8859-1") </code></pre> <p>Once you have it as a string, it is stored internally as 16 bit unicode. Getting it as bytes and then telling java to...
2,166,039
Java: how to get a File from an escaped URL?
<p>I'm receiving an URL that locates a local file (the fact that I receive an URL is not in my control). The URL is escaped validly as defined in RFC2396. How can I transform this to a Java File object?</p> <p>Funnily enough, the URL getFile() method returns a String, not a File.</p> <p>I've created a directory cal...
2,166,059
3
1
null
2010-01-29 23:39:36.52 UTC
4
2015-04-03 16:41:55.37 UTC
2010-01-29 23:49:58.82 UTC
null
257,356
null
257,356
null
1
46
java|file|url|escaping
54,708
<pre><code>URLDecoder.decode(url);//deprecated URLDecoder.decode(url, "UTF-8"); //use this instead </code></pre> <p>See related question <a href="https://stackoverflow.com/questions/623861/how-do-you-unescape-urls-in-java">How do you unescape URLs in Java?</a></p>
1,745,105
Postgres dump of only parts of tables for a dev snapshot
<p>On production our database is a few hundred gigabytes in size. For development and testing, we need to create snapshots of this database that are functionally equivalent, but which are only 10 or 20 gigs in size. </p> <p>The challenge is that the data for our business entities are scattered across many tables. We w...
1,746,215
3
0
null
2009-11-16 21:54:33.76 UTC
25
2016-09-18 20:17:59.013 UTC
null
null
null
null
212,420
null
1
110
postgresql
44,065
<p>On your larger tables you can use the COPY command to pull out subsets...</p> <pre><code>COPY (SELECT * FROM mytable WHERE ...) TO '/tmp/myfile.tsv' COPY mytable FROM 'myfile.tsv' </code></pre> <p><a href="http://www.postgresql.org/docs/8.4/interactive/sql-copy.html" rel="noreferrer">https://www.postgresql.org/do...
8,929,738
SQLAlchemy declarative: defining triggers and indexes (Postgres 9)
<p>Is there a way in the SQLAlchemy class of a table to define/create triggers and indexes for that table?</p> <p>For instance if i had a basic table like ...</p> <pre><code>class Customer(DeclarativeBase): __tablename__ = 'customers' customer_id = Column(Integer, primary_key=True,autoincrement=True) cust...
8,931,084
1
1
null
2012-01-19 16:35:37.153 UTC
10
2012-08-22 04:45:44.38 UTC
2012-08-22 04:45:44.38 UTC
null
157,176
null
761,029
null
1
29
postgresql|sqlalchemy|turbogears
10,837
<p><strong>Indicies</strong> are straight-forward to create. For single-column with <code>index=True</code> parameter like below:</p> <pre><code>customer_code = Column(Unicode(15),unique=True,index=True) </code></pre> <p>But if you want more control over the name and options, use the explicit <a href="http://www.sqla...
19,607,448
Execute statement by shortcut in MySQLWorkbench
<p>How can I execute any statement in MySQLWorkbench using shortcut? Now I have to press button (yellow lightning). Of course I have read this in the documentation: <a href="https://dev.mysql.com/doc/workbench/en/wb-keys.html#wb-shortcuts-query-menu" rel="nofollow noreferrer">Table 14.6 - query menu</a> (Table 14.6 - q...
19,608,015
7
1
null
2013-10-26 13:44:54.113 UTC
11
2021-11-18 21:40:44.157 UTC
2021-11-12 08:30:38.707 UTC
null
10,158,227
null
2,213,654
null
1
56
mysql|mysql-workbench
58,783
<p><code>Return</code> = <code>Enter</code> key. So <code>Ctrl + Enter</code> key should execute.</p>
24,959
Debugging asp.net with firefox and visual studio.net - very slow compared to IE
<p>Debugging asp.net websites/web projects in visual studio.net 2005 with Firefox is loads slower than using IE.</p> <p>I've read something somewhere that there is a way of fixing this but i can't for the life of me find it again.</p> <p>Does anyone know what i'm on about and can point me in the right direction plea...
24,982
4
0
null
2008-08-24 10:28:10.373 UTC
13
2010-03-21 03:39:37.207 UTC
2009-03-23 09:20:03.197 UTC
moocha
14,444
john
2,041
null
1
18
debugging|firefox|visual-studio-2005
10,046
<p>bingo. found the <a href="http://dotnetslackers.com/ASP_NET/re-122146_Speeding_Up_FireFox_When_Using_the_ASP_NET_Development_Server_from_Localhost.aspx" rel="noreferrer">article</a> i read before. </p> <p>i just changed my network.dns.ipv4OnlyDomains property in about:config to localhost. restarted firefox and now ...
923,283
What is the minimal setup required to deploy a .NET application with Oracle client 11?
<p>What is the minimal setup required to be able to deploy a .NET application that talks to an Oracle database?</p>
923,413
4
1
null
2009-05-28 21:23:47.047 UTC
31
2015-11-06 07:19:40.99 UTC
null
null
null
null
549
null
1
37
oracle|odp.net
29,781
<p>Josh-</p> <p>Thank you very much for taking the time to answer. Your instructions helped a whole lot, and are very close to what I have found on my own.</p> <p>Interestingly enough, I found it can be slimmed a little more.</p> <p>For those in my situation who</p> <ol> <li>Do not want their users to have to insta...
195,625
What is the time complexity of popping elements from list in Python?
<p>I wonder what is the time complexity of pop method of list objects in Python (in CPython particulary). Also does the value of N for list.pop(N) affects the complexity? </p>
195,647
4
0
null
2008-10-12 15:58:59.077 UTC
17
2022-06-19 22:50:06.147 UTC
2022-06-19 22:50:06.147 UTC
Haldun
224,132
Haldun
21,000
null
1
69
python|list|performance
69,705
<p><code>Pop()</code> for the last element ought to be O(1) since you only need to return the element referred to by the last element in the array and update the index of the last element. I would expect <code>pop()</code> for an arbitrary element to be O(N) and require on average N/2 operations since you would need t...
22,261,048
Using glyphicon as background image in CSS: rails 4 + bootstrap 3
<p>I'm using bootstrap's collapse.js to expand and collapse some input groups in a rails app. I'm using JS to determine if the group is expanded or not and have created CSS classes to add a "+" or "-" to show whether it's open or closed:</p> <p>Open: <img src="https://i.stack.imgur.com/rJxVb.png" alt="enter image des...
22,261,963
2
1
null
2014-03-07 21:30:58.763 UTC
1
2017-03-28 07:27:17.823 UTC
2014-03-07 23:53:35.67 UTC
null
2,977,778
null
2,977,778
null
1
16
html|css|ruby-on-rails|twitter-bootstrap|glyphicons
49,630
<p>Here, try this <strong><a href="http://www.bootply.com/119952" rel="noreferrer">Bootply</a></strong>. Would this suffice? </p> <pre><code>&lt;div id="lol"&gt;&lt;/div&gt; </code></pre> <hr> <pre><code>#lol{ height:40px; border:1px solid #555; width:50%; margin:30px; } #lol:before{ content:"\2b"; f...
14,037,016
In Java, should I use ArrayList<Long> or long[] ?
<p>I am writing a program which accepts 400 numbers of type <code>long</code> and will modify some of them depending on conditions at runtime and I want to know whether to use <code>ArrayList&lt;Long&gt;</code> or <code>long[]</code>. </p> <p>Which will be faster to use? I am thinking of using <code>long[]</code> beca...
14,037,041
6
6
null
2012-12-26 06:54:07.76 UTC
1
2017-10-03 08:42:43.14 UTC
2012-12-26 07:24:26.757 UTC
null
254,477
null
513,340
null
1
3
java|arrays|performance|arraylist
54,811
<p>When the size is fixed, <code>long[]</code> is faster, but it allows a less maintainable API, because it does not implement the <code>List</code> interface.</p> <p>Note a <code>long[]</code> is faster for 2 reasons:</p> <ol> <li>Uses primitive <code>long</code>s and not box object <code>Long</code>s (also enables ...
14,141,307
Change link href via jQuery
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/179713/how-to-change-the-href-for-a-hyperlink-using-jquery">How to change the href for a hyperlink using jQuery</a> </p> </blockquote> <p>I'm using Drupal and system generate my title. </p> <p>E.G.</p> <pre><...
14,141,341
3
1
null
2013-01-03 14:57:02.97 UTC
null
2013-01-03 15:01:04.893 UTC
2017-05-23 12:25:51.337 UTC
null
-1
null
1,485,921
null
1
5
javascript|jquery
52,821
<pre><code>$("#quicktabs-tab-galeri-1").attr("href", new_href); </code></pre> <p>That should do the trick for you.</p>
34,538,879
Unicode in Github markdown
<p>I just made a failed attempt to put unicode in Github markdown (in a README.md file) in my project.</p> <p>I tried this:</p> <pre><code>(U+262E) </code></pre> <p>but it was not interpreted as unicode. Is there a way to put unicode characters in Github markdown?</p>
36,616,878
7
4
null
2015-12-30 23:30:39.76 UTC
10
2021-11-14 23:16:10.393 UTC
2017-07-28 17:38:55.27 UTC
null
1,223,975
null
1,223,975
null
1
60
github|unicode|markdown|github-flavored-markdown
45,599
<p>I believe the correct answer is to use unicode characters of the following (decimal) form </p> <pre><code>&amp;#9658; &amp;#767; &amp;#2400; </code></pre> <p>the above become:</p> <p>&#9658; &#767; &#2400;</p> <p>Try it for yourself on Github and see. You have to paste the raw character strings, not the unicode ...
25,205,750
Quickly square a double
<p>I am looking for the fastest way to square a double (<code>double d</code>). So far I came up with two approaches:</p> <pre><code>1. d*d 2. Math.pow(d, 2) </code></pre> <p>To test the performance I set up three test cases, in each I generate random numbers using the same seed for the three cases and just calculate...
25,205,921
3
3
null
2014-08-08 14:25:09.36 UTC
2
2020-04-27 12:47:51.267 UTC
2020-04-27 12:47:51.267 UTC
null
183,704
null
253,387
null
1
25
java|performance|math|multiplication
50,659
<p>The fastest way to square a number is to multiply it by itself.</p> <blockquote> <p>Why is <code>Math.pow</code> so slow?</p> </blockquote> <p>It's really not, but it is performing <a href="http://en.wikipedia.org/wiki/Exponentiation" rel="noreferrer">exponentiation</a> instead of simple multiplication.</p> <bl...
61,835,971
ES7, ES8, ES9, ES10, ES11 Browser support
<p>Regarding compatibility between ECMAScript specification and actual implementation;</p> <p>It is fairly easy to check out the data about <a href="https://caniuse.com/#search=ECMAScript%206" rel="noreferrer">browser support for ECMAScript2015 (ES6)</a>, but I found it pretty difficult to have an equivalently clear ta...
61,836,170
2
1
null
2020-05-16 11:23:41.2 UTC
7
2022-04-27 03:18:26.297 UTC
2022-04-26 09:26:13.797 UTC
null
1,614,677
null
4,628,597
null
1
49
javascript|ecmascript-2016|ecmascript-2017
27,327
<p>Browser vendors don't implement specific <em>versions</em>, but specific <em>features</em>. Almost every modern browser is still missing features from ES2017-ES2020. Hence there is not and won't be a table where you can see an ES version to browser version mapping.</p> <p>But that is not a problem because you as a d...
6,525,916
Dynamically Display String text on Android Screen
<p>I have an array of classes that contain two strings for each class. I'm trying to display these two strings (they're sentences) on the screen when a button is clicked at two different locations (middle of the screen, and the other sentence right above that).</p> <p>The problem is that I only know how to get text o...
6,526,075
2
0
null
2011-06-29 19:10:47.85 UTC
2
2012-03-26 04:55:20.763 UTC
2011-06-29 19:12:55.087 UTC
null
21,234
null
819,486
null
1
8
android
68,811
<p>To add a view dynamically. Use the addView function.</p> <pre><code>public MyActivity extends Activity { private TextView myText = null; @Override public onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.id.mylayout); LinearLayout lView = (LinearLayout...
55,283,725
unit test mocha Visual Studio Code describe is not defined
<p>If i run in the console the test runs fine</p> <pre><code> mocha --require ts-node/register tests/**/*.spec.ts </code></pre> <p>Note: I installed mocha and mocha -g</p> <p>I want to run unit test from Visual Studio Code</p> <p>launcgh.js file</p> <pre><code> "version": "0.2.0", "co...
55,883,516
3
2
null
2019-03-21 15:17:22.29 UTC
5
2020-12-08 00:19:57.98 UTC
null
null
null
null
5,708,097
null
1
37
typescript|unit-testing|visual-studio-code|mocha.js
11,410
<p>Finally!!! After a long search and reading some tutorials and comments I found the solution: the problem was with the config.</p> <p>Open the test config file and delete the following lines:</p> <pre><code> &quot;-u&quot;, &lt;&lt;&lt;&lt; delete this line &quot;tdd&quot;, &lt;&lt;&lt;&lt; del...
7,157,129
What is the mimeType attribute in <data> used for?
<p>I really can’t get the meaning of mimeType. I know that it exists so that the <code>getType</code> method in <code>ContentProvider</code> knows what to match with it. But I’m still not sure what it means or how it’s used.</p>
7,159,778
3
1
null
2011-08-23 06:33:56.26 UTC
38
2019-05-18 21:07:40.723 UTC
2018-12-11 17:19:13.617 UTC
null
7,379,765
null
674,199
null
1
48
android|mime-types
37,742
<p>Any <code>ContentProvider</code> usually defines the type of data it handles (e.g. <a href="http://developer.android.com/resources/samples/NotePad/src/com/example/android/notepad/NotePadProvider.html" rel="noreferrer">NotePadProvider</a> handles a <code>Notes</code> data type defined in an inner class of <a href="h...
7,838,910
faces-redirect and the back button cause other links to work incorrectly
<p>I have a question surrounding faces navigation. </p> <p>So I have a page that takes a request parameter to load a specific user. This page displays a list of commandLink that, when clicked, redirect to another page using implicit navigation. The user is loaded by calling a method in a "preRenderView".</p> <p>Th...
7,840,789
1
0
null
2011-10-20 16:09:58.887 UTC
8
2013-04-11 12:58:11.44 UTC
2013-04-11 12:58:11.44 UTC
null
1,065,197
null
534,184
null
1
6
jsf|redirect|jsf-2
3,212
<p>Basically, you need to tell the browser to not cache the dynamically generated JSF pages while having view state saving method set to (default) <code>server</code>. The view state is tracked by a <code>&lt;input type="hidden" name="javax.faces.ViewState"&gt;</code> field in the form of the generated JSF page with th...
2,277,770
Setting a button's text to have some bold characters in WPF
<p>I'd like to know if it is possible to define as the text of a <code>Button</code> in WPF, something like: a <strong>b</strong> c</p> <p>I've tried setting <a href="http://img651.imageshack.us/img651/1838/ctldhrzhy41gbrcch4dpjz4.png" rel="noreferrer">alt text http://img651.imageshack.us/img651/1838/ctldhrzhy41gbrcch...
2,277,811
4
0
null
2010-02-17 01:40:16.153 UTC
3
2019-12-15 16:52:06.507 UTC
2011-09-23 19:03:48.317 UTC
null
305,637
null
130,758
null
1
16
c#|.net|wpf|button|styles
50,406
<p>Use a <code>TextBlock</code> to hold the formatted text:</p> <pre><code>&lt;Button&gt; &lt;TextBlock&gt;Hey &lt;Bold&gt;you&lt;/Bold&gt;!!!&lt;/TextBlock&gt; &lt;/Button&gt; </code></pre> <p>Per your comment, if you want to be explicit about the fact that this sets the <code>Content</code> property, you can use ...
1,474,135
Django Admin: Ordering of ForeignKey and ManyToManyField relations referencing User
<p>I have an application that makes use of Django's <code>UserProfile</code> to extend the built-in Django <code>User</code> model. Looks a bit like:</p> <pre><code>class UserProfile(models.Model): user = models.ForeignKey(User, unique=True) # Local Stuff image_url_s = models.CharField(max_length=128, bla...
1,474,175
4
0
null
2009-09-24 21:01:23.547 UTC
10
2014-05-14 08:52:46.48 UTC
null
null
null
null
178,711
null
1
23
python|django|sorting|admin|user-profile
22,269
<p>One way would be to define a custom form to use for your Team model in the admin, and override the <code>manager</code> field to use a queryset with the correct ordering:</p> <pre><code>from django import forms class TeamForm(forms.ModelForm): manager = forms.ModelChoiceField(queryset=User.objects.order_by('us...
2,284,703
Emacs: how to disable 'file changed on disk' checking?
<p>How to disable Emacs from checking the buffer file was changed outside the editor?</p>
2,284,921
4
0
null
2010-02-17 21:57:05.927 UTC
10
2016-11-26 03:52:40.157 UTC
null
null
null
null
137,122
null
1
24
emacs
9,503
<p>Emacs is really trying to help you here. Read the info page on <a href="http://www.gnu.org/software/emacs/manual/html_node/emacs/Interlocking.html" rel="noreferrer">Protection against Simultaneous Editing</a>.</p> <p>But, if you still want to avoid that message/prompt, you can redefine the function that is doing t...
1,763,071
Negate characters in Regular Expression
<p>How would I write a regular expression that matches the following criteria?</p> <ul> <li>No numbers</li> <li>No special characters</li> <li>No spaces</li> </ul> <p>in a string</p>
1,763,582
4
3
null
2009-11-19 12:48:49.847 UTC
3
2017-06-28 21:52:01.99 UTC
2017-06-28 21:52:01.99 UTC
null
6,943,394
null
192,923
null
1
62
regex|regex-negation
107,113
<p>The caret inside of a character class [^ ] is the negation operator common to most regular expression implementations (Perl, .NET, Ruby, Javascript, etc). So I'd do it like this:</p> <pre><code>[^\W\s\d] </code></pre> <ul> <li>^ - Matches anything NOT in the character class</li> <li>\W - matches non-word characte...
1,385,871
how to remove key+value from hash in javascript
<p>Given</p> <pre><code>var myHash = new Array(); myHash['key1'] = { Name: 'Object 1' }; myHash['key2'] = { Name: 'Object 2' }; myHash['key3'] = { Name: 'Object 3' }; </code></pre> <p>How do I remove <code>key2</code>, and <code>object 2</code> from the hash, so that it ends up in a state as if I did:</p> <pre><code...
1,385,889
4
2
null
2009-09-06 15:04:10.457 UTC
6
2018-05-30 18:05:40.963 UTC
2018-05-30 18:05:40.963 UTC
null
11,732,320
null
28,543
null
1
84
javascript|arrays
111,505
<p>You're looking for <a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Operators/Special_Operators/delete_Operator" rel="noreferrer"><code>delete</code></a>:</p> <pre><code>delete myhash['key2'] </code></pre> <p>See the <a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide" rel="n...
1,715,681
Scala 2.8 breakOut
<p>In Scala <strong>2.8</strong>, there is an object in <code>scala.collection.package.scala</code>:</p> <pre><code>def breakOut[From, T, To](implicit b : CanBuildFrom[Nothing, T, To]) = new CanBuildFrom[From, T, To] { def apply(from: From) = b.apply() ; def apply() = b.apply() } </code></pre> <p>I have ...
1,716,558
4
2
null
2009-11-11 14:53:23.257 UTC
168
2017-04-30 14:26:24.553 UTC
2015-05-08 21:50:41.59 UTC
null
699,224
null
16,853
null
1
230
scala|scala-2.8|scala-collections
37,610
<p>The answer is found on the definition of <code>map</code>:</p> <pre><code>def map[B, That](f : (A) =&gt; B)(implicit bf : CanBuildFrom[Repr, B, That]) : That </code></pre> <p>Note that it has two parameters. The first is your function and the second is an implicit. If you do not provide that implicit, Scala will ...
36,612,596
Tuple to parameter pack
<p>This below code from user Faheem Mitha, is based on user Johannes Schaub - litb's answer in this <a href="https://stackoverflow.com/a/9288547/1655492">SO</a>. This code perfectly does what I seek, which is conversion of a <code>tuple</code> into parameter pack, but I don't understand this code well enough and theref...
36,612,797
2
5
null
2016-04-14 02:06:04.927 UTC
11
2019-02-10 19:12:14.353 UTC
2017-05-23 12:02:31.27 UTC
null
-1
null
1,655,492
null
1
19
c++|templates|c++11|variadic-templates
16,366
<p>Let's look at what happens here:</p> <pre><code>template&lt;int N, int ...S&gt; struct gens : gens&lt;N - 1, N - 1, S...&gt; { }; template&lt;int ...S&gt; struct gens&lt;0, S...&gt;{ typedef seq&lt;S...&gt; type; }; </code></pre> <p>The first one is a generic template, the second one is a specialization that appl...
7,294,176
How to create global functions in Objective-C
<p>I'm developing an iphone app and I need to have some functions to use globally in my classes.</p> <p>But how can I do this?</p> <p>I just tried to create <code>functions.h</code> likes this</p> <pre><code>#include &lt;Foundation/Foundation.h&gt; - (void)printTest; </code></pre> <p>and in the <code>functions.m</...
7,294,359
5
0
null
2011-09-03 16:00:55.577 UTC
13
2021-09-07 20:34:03.773 UTC
null
null
null
null
719,127
null
1
35
iphone|objective-c
30,939
<p>First note that Objective-C language is a superset of C language (meaning there is absolutely nothing wrong with mixing them).</p> <p>There are two approaches.</p> <h2>#1 Real global function:</h2> <p>Declare a global C-style function, which can have ObjC logic (in definetion instead of just C-style logic).</p> <p>H...
7,240,916
Android: Under what circumstances would a Dialog appearing cause onPause() to be called?
<p>A snippet from the Android <a href="http://developer.android.com/guide/topics/fundamentals/activities.html#Lifecycle" rel="noreferrer">Activities</a> document(scroll down to the "<strong>foreground lifetime</strong>" line) says :</p> <blockquote> <p>An activity can frequently transition in and out of the foregrou...
7,384,782
7
0
null
2011-08-30 09:06:47.133 UTC
35
2018-07-05 20:44:30.963 UTC
2011-09-06 11:11:53.257 UTC
null
570,930
null
570,930
null
1
81
android|dialog|lifecycle|android-lifecycle|onpause
29,559
<p><code>onPause()</code> is called when your activity is no longer at the top of the activity stack. A Dialog by itself is not an Activity, so will not replace the current Activity at the top of the stack, so will not cause anything to pause.</p> <p>A dialog (lower-case) does not need to be implemented by a Dialog c...
13,928,689
How to setup a maven project in Intellij IDEA 12
<p>I have problem importing a maven project which was created by Netbeans into the IDEA 12. The dependency artifacts writen in the pom doesn't work. It told me that "cannot resolve symbol 'springframework'" on "import org.springframework.xxx;". When I runs it, it says that org.springframework.xxx doesn't exist. Here is...
13,930,041
4
5
null
2012-12-18 08:03:17.603 UTC
5
2015-04-10 12:58:48.153 UTC
2015-04-10 12:58:48.153 UTC
null
617,450
null
1,122,665
null
1
8
java|maven|intellij-idea
42,203
<p>If the project runs on the command line (<code>mvn clean install</code>) the chance is like 100% it will work in IntelliJ 12 too :-)</p> <p>After File -> Project Import -> From external Maven Model you should see the modules.</p> <p>What I would check in the IntelliJ settings is the location of the maven home dire...
14,198,942
Webapp file organization convention (development structure)
<p>For the webapps I'm developing, I usually use the following files organization, since I think it respects the convention:</p> <pre class="lang-none prettyprint-override"><code>src |-- main |-- resources | |-- *.properties | |-- *.xml | |-- spring | |-- applicationContext.xml (main ap...
14,200,520
2
0
null
2013-01-07 15:31:14.1 UTC
12
2018-10-13 19:43:55.17 UTC
2013-08-16 21:32:48.513 UTC
null
814,702
null
1,225,328
null
1
17
java|spring|jakarta-ee|web-applications|file-organization
29,761
<p>You can create the Java Web project is some popular IDE, like Eclipse, NetBeans, IntelliJ IDEA, to see the typical Java Web application structure.</p> <p>And there is a difference between the <strong>development structure and packaging structure</strong>.<br> While developing an app you can pretty much use whatever...
14,190,045
How do I convert datetime.timedelta to minutes, hours in Python?
<p>I get a start_date like this:</p> <pre><code>from django.utils.timezone import utc import datetime start_date = datetime.datetime.utcnow().replace(tzinfo=utc) end_date = datetime.datetime.utcnow().replace(tzinfo=utc) duration = end_date - start_date </code></pre> <p>I get output like this:</p> <pre><code>datetim...
14,190,143
10
2
null
2013-01-07 04:48:07.177 UTC
27
2021-06-14 20:14:07.247 UTC
2018-10-29 23:17:30.293 UTC
null
63,550
null
1,881,957
null
1
80
python|django
206,471
<p>There's no built-in formatter for <code>timedelta</code> objects, but it's pretty easy to do it yourself:</p> <pre><code>days, seconds = duration.days, duration.seconds hours = days * 24 + seconds // 3600 minutes = (seconds % 3600) // 60 seconds = seconds % 60 </code></pre> <p>Or, equivalently, if you're in Python...
13,856,266
Class broken error with Joda Time using Scala
<p>I'm adding the Joda Time repository to SBT with</p> <pre><code>libraryDependencies ++= Seq( "joda-time" % "joda-time" % "2.1" ) </code></pre> <p>Then I merrily use it like this:</p> <pre><code> val ymd = org.joda.time.format.DateTimeFormat.forPattern("yyyyMMdd") ymd.parseDateTime("20121212")...
13,856,382
2
0
null
2012-12-13 09:00:43.637 UTC
9
2016-12-29 10:41:49.11 UTC
null
null
null
null
828,757
null
1
92
scala|sbt|jodatime
21,570
<p>Add this dependency: </p> <blockquote> <p>"org.joda" % "joda-convert" % "1.8.1"</p> </blockquote> <p>It's an optional dependency of joda-time. I had to add it in my own project for the scala compiler to accept working with the joda-time jar.</p> <p>Your issue seems to be the same.</p> <p>Version is as at time ...