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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
35,240,716 | Webpack import returns undefined, depending on the order of imports | <p>I'm using webpack + babel. I have three modules looking like this:</p>
<pre class="lang-js prettyprint-override"><code>// A.js
// some other imports here
console.log('A');
export default 'some-const';
// B.js
import someConst from './A';
console.log('B', someConst);
export default 'something-else';
// main.js
... | 35,240,717 | 3 | 0 | null | 2016-02-06 11:57:50.037 UTC | 27 | 2022-06-22 06:30:30.64 UTC | 2016-02-22 06:23:48.95 UTC | null | 785,065 | null | 242,684 | null | 1 | 90 | javascript|webpack|babeljs | 33,035 | <p>After almost a full workday of narrowing down the issue (AKA hair-pulling), I've finally came to realize that I have a circular dependency.</p>
<p>Where it says <code>// some other imports here</code>, <code>A</code> imports another module <code>C</code>, which, in turn, imports <code>B</code>. <code>A</code> gets ... |
34,967,868 | How to use data-binding in Dialog? | <p>I am having trouble in implementing databinding in a Dialog. Is it possible?</p>
<p>Below is my xml.</p>
<p>
</p>
<pre><code><data>
<variable
name="olaBooking"
type="com.example.myapp.viewmodels.ViewModel" />
</data>
<LinearLayout
android:layout_width="match_parent"
... | 36,651,310 | 8 | 0 | null | 2016-01-23 19:33:41.943 UTC | 16 | 2022-06-21 00:43:12.217 UTC | 2016-01-25 08:15:14.71 UTC | null | 2,214,748 | null | 2,214,748 | null | 1 | 82 | android|mvvm|data-binding|android-databinding | 61,231 | <p>It is possible to use databinding in a Dialog, first to get the binding working on your Dialog you should inflate it first and pass it to the setContentView like this.</p>
<pre><code>DialogOlaBookingConfirmedBinding binding = DataBindingUtil.inflate(LayoutInflater.from(getContext()), R.layout. dialog_ola_booking_co... |
32,109,822 | Why is `throw` invalid in an ES6 arrow function? | <p>I'm just looking for a reason as to <em>why</em> this is invalid:</p>
<pre><code>() => throw 42;
</code></pre>
<p>I know I can get around it via:</p>
<pre><code>() => {throw 42};
</code></pre> | 32,109,863 | 3 | 0 | null | 2015-08-20 04:56:43.103 UTC | 3 | 2022-04-13 11:58:42.18 UTC | 2022-04-13 11:58:42.18 UTC | null | 1,839,439 | user578895 | null | null | 1 | 39 | javascript|ecmascript-6|arrow-functions | 5,673 | <p>If you don't use a block (<code>{}</code>) as body of an <a href="http://www.ecma-international.org/ecma-262/6.0/index.html#sec-arrow-function-definitions">arrow function</a>, the body must be an <a href="http://www.ecma-international.org/ecma-262/6.0/index.html#sec-ecmascript-language-expressions"><strong>expressio... |
27,337,819 | WPF ToggleButton XAML styling | <p>So I have two toggle buttons that I am trying to combine - sort of. So the first button toggles the images based on whether it IsChecked is true or false, but this button has a border around it that I can't get rid of.</p>
<p>The second toggle button doesn't have a border and doesn't blink when clicked, but it als... | 27,338,029 | 2 | 0 | null | 2014-12-06 23:36:41.637 UTC | null | 2020-01-31 15:39:40.387 UTC | 2014-12-07 01:15:32.48 UTC | null | 979,580 | null | 3,232,211 | null | 1 | 3 | wpf|xaml|togglebutton|wpf-style | 42,289 | <p>Try to use slightly modified XAML pertinent to your first ToggleButton:</p>
<pre><code><ToggleButton x:Name="changeButBorderedBlinky"
Margin="0,12,194,0"
Width="82" Height="82"
Background="Transparent"
Padding="-1"
Focusable="false"
... |
40,398,779 | dompdf : image not found or type unknown | <p>Here is my code,
I mostly tried all the methods for displaying image on PDF but still didnt work.
Could you please help me for this.
I also set DOMPDF_ENABLE_REMOTE to true and still results is same.</p>
<pre><code>require_once("dompdf/autoload.inc.php");
//require('WriteHTML.php');
$html = '<body>
<div i... | 40,399,209 | 8 | 1 | null | 2016-11-03 10:09:19.473 UTC | null | 2022-01-12 16:01:48.263 UTC | 2016-11-03 14:02:23.973 UTC | null | 7,109,093 | null | 7,109,093 | null | 1 | 5 | php|html|twitter-bootstrap|dompdf | 45,240 | <p>You should be using the full URL instead of a direct path. Especially when it is not a static image: dompdf will open that php script directly, so it won't be executed as if it's a PHP script.</p>
<p>If the full URL doesn't work, you can also show what the result of header.php is. Some good things to keep in mind a... |
50,942,544 | Emit event from content in slot to parent | <p>I'm trying to build a flexible carousel control that allows inner content elements to force changing a slide, aswell as the carousel controls itself to change slides</p>
<p>A sample structure in my page looks like</p>
<pre><code><my-carousel>
<div class="slide">
<button @click="$emit('next')"&... | 50,943,093 | 10 | 0 | null | 2018-06-20 07:25:16.207 UTC | 5 | 2022-07-23 22:10:12.753 UTC | 2019-08-06 13:40:08.327 UTC | null | 266,069 | null | 2,940,794 | null | 1 | 40 | vue.js|vuejs2|vue-component | 38,482 | <p>Slots are compiled against the parent component scope, therefore events you emit from the slot will only be received by the component the template belongs to.</p>
<p>If you want interaction between the carousel and slides, you can use a <a href="https://v2.vuejs.org/v2/guide/components-slots.html#Scoped-Slots" rel="... |
20,906,503 | What is the extension of a Android Studio project file? | <p>What is the Android Studio equivalent of Solution file in (.sln) file in Visual Studio ? I created a project in Android studio and closed it. Now I am not sure which file should I open to reload it into Android studio. </p> | 20,906,543 | 10 | 0 | null | 2014-01-03 15:02:12.68 UTC | 2 | 2020-06-29 08:57:42.133 UTC | 2019-06-14 19:32:43.02 UTC | null | 6,296,561 | null | 1,347,674 | null | 1 | 28 | android-studio | 33,040 | <p>Use the <code>import project</code> function on the <code>build.gradle</code> file in your project root (not the folder itself!) to open the project again in Android Studio.</p> |
41,743,720 | crontab run every 15 minutes between certain hours | <p>Is this correct scheduled to run between 07:00 and 19:00 at every 15 minutes?</p>
<pre><code>*/15 07-19 * * * /path/script
</code></pre> | 41,743,794 | 2 | 0 | null | 2017-01-19 14:05:06.333 UTC | 13 | 2019-12-23 13:40:35.027 UTC | 2017-01-19 14:06:54.54 UTC | null | 1,983,854 | null | 5,588,639 | null | 1 | 60 | linux|cron|crontab|schedule | 84,748 | <p>Your command is fine!</p>
<p>To run from 7.00 until 19.45, every 15 minutes just use <code>*/15</code> as follows:</p>
<pre><code>*/15 07-19 * * * /path/script
^^^^ ^^^^^
</code></pre>
<p>That is, the content <code>*/15</code> in the minutes column will do something every 15 minutes, while th... |
35,365,545 | Calculating cumulative returns with pandas dataframe | <p>I have this dataframe</p>
<pre><code>Poloniex_DOGE_BTC Poloniex_XMR_BTC Daily_rets perc_ret
172 0.006085 -0.000839 0.003309 0
173 0.006229 0.002111 0.005135 0
174 0.000000 -0.001651 0.004203 0
175 0.000000 0.007743 0.005313 0
176 0.000000 -0.001013 -0.003466 0
177 0.00... | 35,365,884 | 3 | 0 | null | 2016-02-12 14:52:13.803 UTC | 9 | 2022-03-29 06:39:19.793 UTC | 2016-02-12 15:11:39.833 UTC | null | 2,901,002 | null | 4,019,780 | null | 1 | 18 | python|pandas|cumsum | 40,271 | <p>If performance is important, use <a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.cumprod.html" rel="nofollow noreferrer"><code>numpy.cumprod</code></a>:</p>
<pre><code>np.cumprod(1 + df['Daily_rets'].values) - 1
</code></pre>
<p><strong>Timings</strong>:</p>
<pre><code>#7k rows
df = pd.concat(... |
56,637,973 | How to fix selenium "DevToolsActivePort file doesn't exist" exception in Python | <p>When I use both arguments <code>--headless</code> and <code>user-data-dir</code>. Selenium raise <code>selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist</code> exception. If only 1 of them is used, then everything works as needs. </p>
<p>I tried to swap arg... | 56,638,103 | 1 | 0 | null | 2019-06-17 19:47:18.51 UTC | 13 | 2021-02-04 10:30:57.15 UTC | 2019-06-26 11:13:40.16 UTC | null | 8,224,362 | null | 8,224,362 | null | 1 | 31 | python|selenium|selenium-chromedriver | 64,634 | <p>I solve it by adding an argument <code>--remote-debugging-port=<port></code></p>
<pre class="lang-py prettyprint-override"><code>chromeOptions = webdriver.ChromeOptions()
chromeOptions.add_experimental_option("prefs", {"profile.managed_default_content_settings.images": 2})
chromeOptions.a... |
42,886,931 | TypeError: next is not a function | <p>I'm running a Node.js-server and trying to test this Rest API that I made with Express. It's linked up to MongoDB using Mongoose.</p>
<p>I'm testing the individual routes using Postman and I get an error when trying to send a PUT-request to this route:</p>
<pre><code>// PUT /meetings/:id
// Route for editing a spe... | 42,886,968 | 2 | 0 | null | 2017-03-19 13:05:24.433 UTC | null | 2017-03-19 13:21:59.72 UTC | null | null | null | null | 4,612,744 | null | 1 | 7 | javascript|node.js|mongodb|express|mongoose | 38,581 | <p>So I figured it out. It was a much smaller error than I thought. I had the parameters to the callback-function in my router.param-method in the wrong sequence. The next-keyword should be where id was. This code fixed the problem:</p>
<pre><code>router.param("id", function(req, res, next, id) {
Meeting.findById(id... |
49,582,971 | Encoded password does not look like BCrypt | <p>I am using Spring Boot, Spring Security, OAuth2 and JWT to authenticate my application, but I keep getting this nasty error and I don't have any idea what is wrong. My <code>CustomDetailsService</code> class:</p>
<pre><code>@Service
public class CustomDetailsService implements UserDetailsService {
private stat... | 52,420,168 | 26 | 1 | null | 2018-03-31 00:11:54.12 UTC | 8 | 2022-06-19 09:59:23.68 UTC | 2019-04-27 15:40:09.867 UTC | null | 1,797,006 | null | 4,137,085 | null | 1 | 44 | java|spring|spring-boot|spring-data-jpa | 87,188 | <p>BCryptPasswordEncoder shows this warning when it fails to match a raw password with an encoded password. </p>
<p>The hashed password might be “$2b” or “$2y” now. </p>
<p>And there is a bug in Spring Security that has a regex always looking for “$2a”. Put a debug point at the <code>matches()</code> function in the... |
38,511,743 | "Adding missing grouping variables" message in dplyr in R | <p>I have a portion of my script that was running fine before, but recently has been producing an odd statement after which many of my other functions do not work properly. I am trying to select the 8th and 23rd positions in a ranked list of values for each site to find the 25th and 75th percentile values for each day ... | 38,512,421 | 4 | 9 | null | 2016-07-21 18:25:23.763 UTC | 9 | 2022-05-14 16:01:44.303 UTC | 2016-07-21 18:55:07.213 UTC | null | 6,495,544 | null | 6,495,544 | null | 1 | 54 | r|dplyr | 54,343 | <p>For consistency sake the grouping variables should be always present when defined earlier and thus are added when <code>select(value)</code> is executed. <code>ungroup</code> should resolve it:</p>
<pre><code>qu25 <- mydata %>%
group_by(month, day, station_number) %>%
arrange(desc(value)) %>%
sl... |
7,343,915 | SubView slide in animation, iphone | <p>I have a UIview Containing two UIButtons. </p>
<pre><code>-(void)ViewDidLoad
{
geopointView = [[UIView alloc] initWithFrame:CGRectMake(0, 350, 120, 80)];
geopointView.backgroundColor = [UIColor greenColor];
UIButton *showGeoPointButton = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain];
... | 7,343,940 | 1 | 0 | null | 2011-09-08 06:20:40.223 UTC | 13 | 2013-10-17 23:37:25.473 UTC | 2013-05-13 16:31:34.937 UTC | null | 915,497 | null | 915,497 | null | 1 | 15 | iphone|ios|uiviewanimation | 31,128 | <p>You need to add the subview with a frame value that is where you want the animation to begin from (off-screen?) then change the frame value inside your animation block. The frame will change over the duration, causing the appearance of movement. The view must already be a subview - I don't believe adding a subview i... |
22,756,092 | What does it mean by cold cache and warm cache concept? | <p>I read a paper and it used terms <strong>cold cache</strong> and <strong>warm cache</strong>. I googled about this terms but I didn't find something useful (only a thread <a href="https://web.archive.org/web/20150420002300/http://help.lockergnome.com/linux/Cold-cache-warm-cache--ftopict414393.html" rel="noreferrer">... | 22,756,972 | 5 | 0 | null | 2014-03-31 07:45:45.377 UTC | 18 | 2019-12-30 06:22:12.217 UTC | 2019-01-17 15:35:56.61 UTC | null | 1,462,770 | null | 1,462,770 | null | 1 | 69 | caching|linux-kernel|filesystems|ext2 | 44,264 | <p><strong>TL;DR</strong> There is an analogy with a cold engine and warm engine of the car. Cold cache - doesn't have any values and can't give you any speedup because, well, it's empty. Warm cache has some values and can give you that speedup.</p>
<p>A cache is a structure that holds some values (inodes, memory page... |
39,171,678 | "instanceof" equivalent in Golang | <p>I have these structs:</p>
<pre><code>type Event interface {
Accept(EventVisitor)
}
type Like struct {
}
func (l *Like) Accept(visitor EventVisitor) {
visitor.visitLike(l)
}
</code></pre>
<p>How can I test that <code>event</code> is a <code>Like</code> instance?</p>
<pre><code>func TestEventCreation(t *test... | 39,171,734 | 4 | 0 | null | 2016-08-26 17:24:03.817 UTC | 5 | 2022-05-11 07:54:41.617 UTC | 2022-02-19 15:50:51.05 UTC | null | 6,367,716 | null | 3,026,283 | null | 1 | 37 | go | 26,280 | <p>You could just do a type assertion and see if it fails:</p>
<pre><code>event, err := New(0)
if err != nil {
t.Error(err)
}
_, ok := event.(Like)
if !ok {
t.Error("Assertion error")
}
</code></pre> |
50,186,125 | How do I parse a yaml string with python? | <p>I see an API and many examples on how to parse a yaml file but what about a string?</p> | 50,186,126 | 2 | 4 | null | 2018-05-05 05:40:46.927 UTC | 5 | 2020-01-04 05:47:50.283 UTC | null | null | null | null | 718,488 | null | 1 | 43 | python|python-3.x|yaml|python-2.x | 43,253 | <p>Here is the best way I have seen so far demonstrated with an example:</p>
<pre><code>import yaml
dct = yaml.safe_load('''
name: John
age: 30
automobiles:
- brand: Honda
type: Odyssey
year: 2018
- brand: Toyota
type: Sienna
year: 2015
''')
assert dct['name'] == 'John'
assert dct['age'] == 30
assert len(dct[... |
22,009,582 | ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use | <p>While I am trying to insert a row to my table, I'm getting the following errors:</p>
<pre><code>ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near ''filename')
VALUES ('san', 'ss', 1, 1, 1, 1, 2, 1, 1, 'sment', ... | 22,009,889 | 12 | 0 | null | 2014-02-25 09:18:30.813 UTC | 9 | 2022-05-09 06:14:32.627 UTC | 2014-02-25 09:23:21.77 UTC | null | 2,134,785 | null | 2,106,393 | null | 1 | 38 | mysql | 327,971 | <p>There are two different types of quotation marks in MySQL. You need to use ` for column names and ' for strings. Since you have used ' for the filename column the query parser got confused. Either remove the quotation marks around all column names, or change 'filename' to `filename`. Then it should work.</p> |
2,679,022 | Sort a matrix with another matrix | <p>Suppose I have a matrix <code>A</code> and I sort the rows of this matrix. How do I replicate the same ordering on a matrix <code>B</code> (same size of course)?</p>
<p>E.g.</p>
<pre><code>A = rand(3,4);
[val ind] = sort(A,2);
B = rand(3,4);
%// Reorder the elements of B according to the reordering of A
</code></pre... | 2,679,517 | 3 | 1 | null | 2010-04-20 22:04:34.527 UTC | 9 | 2016-06-27 07:40:02.733 UTC | 2020-06-20 09:12:55.06 UTC | null | -1 | null | 71,131 | null | 1 | 22 | matlab|bsxfun | 11,273 | <p>A somewhat clearer way to do this is to use a loop</p>
<pre><code>A = rand(3,4);
B = rand(3,4);
[sortedA,ind] = sort(A,2);
for r = 1:size(A,1)
B(r,:) = B(r,ind(r,:));
end
</code></pre>
<p>Interestingly, the loop version is faster for small (<12 rows) and large (>~700 rows) square arrays (r2010a, OS X). The ... |
2,529,770 | How to use libraries compiled with MingW in MSVC? | <p>I have compiled several libraries with MingW/MSYS... the generated static libraries are always .a files.
When I try to link the library with a MSVC project, Visual Studio throws 'unresolved external symbols' ... It means that the .a static library is incompatible with MS C++ Linker. I presume it has to be converted ... | 2,529,997 | 4 | 3 | null | 2010-03-27 15:11:58.56 UTC | 14 | 2020-07-14 13:38:46.62 UTC | 2010-03-27 16:31:14.343 UTC | anon | null | null | 214,914 | null | 1 | 22 | c++|mingw|visual-c++|compatibility|static-libraries | 26,636 | <p>Based on this error you put in a comment:</p>
<blockquote>
<p>error LNK2019: unresolved external
symbol "int __cdecl
openssl_call(struct ssl_State
*,int,int,int)" (?openssl_call@@YAHPAUssl_State@@HHH@Z)
referenced in function _main MyAPP.obj
all other 4 errors are same only with
other functions names<... |
2,941,681 | How to make "int" parse blank strings? | <p>I have a parsing system for fixed-length text records based on a layout table:</p>
<pre><code>parse_table = [\
('name', type, length),
....
('numeric_field', int, 10), # int example
('textc_field', str, 100), # string example
...
]
</code></pre>
<p>The idea is that given a table for a message t... | 2,941,975 | 4 | 4 | null | 2010-05-31 06:10:48.737 UTC | 5 | 2018-05-28 02:23:56.027 UTC | null | null | null | null | 23,643 | null | 1 | 31 | python | 38,374 | <p>Use a factory function instead of int or a subclass of int:</p>
<pre><code>def mk_int(s):
s = s.strip()
return int(s) if s else 0
</code></pre> |
2,950,505 | untar filename.tr.gz to directory "filename" | <p>I would like to untar an archive e.g. "tar123.tar.gz" to directory /myunzip/tar123/" using a shell command.</p>
<p>tar -xf tar123.tar.gz will decompress the files but in the same directory as where I'm working in. </p>
<p>If the filename would be "tar233.tar.gz" I want it to be decompressed to /myunzip/tar233.tar.... | 2,950,578 | 4 | 0 | null | 2010-06-01 14:16:49.483 UTC | 5 | 2019-04-29 09:04:42.087 UTC | null | null | null | null | 229,656 | null | 1 | 37 | shell|tar | 39,392 | <p>With Bash and GNU tar:</p>
<pre><code>file=tar123.tar.gz
dir=/myunzip/${file%.tar.gz}
mkdir -p $dir
tar -C $dir -xzf $file
</code></pre> |
29,331,499 | When should we use .then with Protractor Promise? | <p>I've got many instability with Protractor, and I'm sure there is something I don't understand.
Sometimes I need use the .then() when clicking on a button before continuing, sometimes it don't have any impact and I should not use .then() or the test failed.</p>
<p>I wonder when should I use the .then() callback when... | 29,332,659 | 2 | 0 | null | 2015-03-29 16:11:52.527 UTC | 12 | 2021-02-09 02:09:28.307 UTC | null | null | null | null | 1,616,656 | null | 1 | 37 | promise|protractor | 34,475 | <p>The answer of this question can be found in this post : <a href="http://spin.atomicobject.com/2014/12/17/asynchronous-testing-protractor-angular/">http://spin.atomicobject.com/2014/12/17/asynchronous-testing-protractor-angular/</a></p>
<p>That is :</p>
<ol>
<li>Protractor enqueue all driver commands in the Control... |
31,700,691 | Convert commas decimal separators to dots within a Dataframe | <p>I am importing a CSV file like the one below, using <code>pandas.read_csv</code>:</p>
<pre><code>df = pd.read_csv(Input, delimiter=";")
</code></pre>
<p>Example of CSV file:</p>
<pre><code>10;01.02.2015 16:58;01.02.2015 16:58;-0.59;0.1;-4.39;NotApplicable;0.79;0.2
11;01.02.2015 16:58;01.02.2015 16:58;-0.57;0.2;-2... | 31,700,780 | 5 | 0 | null | 2015-07-29 12:40:31.513 UTC | 12 | 2022-01-17 22:01:20.093 UTC | 2020-03-17 11:29:35.61 UTC | null | 202,229 | null | 5,168,024 | null | 1 | 75 | python|pandas|csv|delimiter|separator | 135,837 | <p><code>pandas.read_csv</code> has a <code>decimal</code> parameter for this: <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_csv.html">doc</a></p>
<p>I.e. try with:</p>
<pre><code>df = pd.read_csv(Input, delimiter=";", decimal=",")
</code></pre> |
28,646,572 | Faster XML Jackson: Remove double quotes | <p>I have the following json:</p>
<pre><code>{"test":"example"}
</code></pre>
<p>I use the following code from Faster XML Jackson.</p>
<pre><code>JsonParser jp = factory.createParser("{\"test\":\"example\"}");
json = mapper.readTree(jp);
System.out.println(json.get("test").toString());
</code></pre>
<p>It outputs:<... | 28,646,734 | 3 | 0 | null | 2015-02-21 13:53:42.433 UTC | 4 | 2021-10-16 18:14:54.193 UTC | null | null | null | null | 1,137,669 | null | 1 | 51 | java|json|jackson | 30,613 | <p>Well, what you obtain when you <code>.get("test")</code> is a <code>JsonNode</code> and it happens to be a <code>TextNode</code>; when you <code>.toString()</code> it, it will return the string representation of that <code>TextNode</code>, which is why you obtain that result.</p>
<p>What you want is to:</p>
<pre><... |
36,539,650 | Display activity indicator inside UIButton | <p>I would like to change the content of a UIButton to an ActivityIndicator after it is pressed.</p>
<p>I know buttons have an imageView and a titleLabel, but I don't know how to put an activity indicator in any of them.</p>
<p>This is how I create activity indicators:</p>
<pre><code>let aiView = UIActivityIndicator... | 36,539,725 | 11 | 0 | null | 2016-04-11 04:02:07.693 UTC | 12 | 2021-07-09 07:22:35.65 UTC | 2016-04-11 06:20:19.62 UTC | null | 2,227,743 | null | 3,808,402 | null | 1 | 32 | ios|swift|uibutton | 27,586 | <pre><code>import UIKit
class LoadingButton: UIButton {
private var originalButtonText: String?
var activityIndicator: UIActivityIndicatorView!
func showLoading() {
originalButtonText = self.titleLabel?.text
self.setTitle("", for: .normal)
if (activityIndicator == nil) {
activityInd... |
49,313,485 | How to reset Visual Studio Code key bindings? | <p>I have been experimenting with my vs-code key bindings.</p>
<p>I would like to reset the key-bindings to the original settings.</p>
<p>How do I do that?</p>
<p>I am on Linux Mint 18.</p>
<p>I tried removing all the records from the keybindings.json </p> | 49,313,555 | 13 | 0 | null | 2018-03-16 04:58:23.683 UTC | 8 | 2022-08-19 00:38:11.337 UTC | 2019-04-23 17:43:06.47 UTC | null | 229,044 | null | 317,027 | null | 1 | 70 | visual-studio-code|vscode-settings | 82,833 | <p>Try this documentation page about key binding in VSCode:
<a href="https://code.visualstudio.com/docs/getstarted/keybindings" rel="nofollow noreferrer">https://code.visualstudio.com/docs/getstarted/keybindings</a></p>
<p>Open a directory that contains user settings (<a href="https://code.visualstudio.com/docs/getsta... |
778,085 | How to name a thread in Linux? | <p>I have a multithreaded Linux application written in C/C++. I have <a href="https://stackoverflow.com/questions/149932/naming-conventions-for-threads">chosen names for my threads</a>. To aid debugging, I would like these names to be visible in GDB, "top", etc. Is this possible, and if so how?</p>
<p>(The... | 778,124 | 2 | 2 | null | 2009-04-22 16:21:02.463 UTC | 24 | 2020-10-15 15:59:35.723 UTC | 2020-10-15 15:59:35.723 UTC | null | 420,385 | null | 37,386 | null | 1 | 43 | c++|c|linux|multithreading | 28,584 | <p>Posix Threads?</p>
<p>This evidently won't compile, but it will give you an idea of where to go hunting. I'm not even sure its the right <code>PR_</code> command, but i think it is. It's been a while...</p>
<pre><code> #include <sys/prctl.h>
prctl(PR_SET_NAME,"<null> terminated string",0,0,0)
</code... |
2,361,499 | How to always remove WWW from a url with mod_rewrite? | <p>I'm using the following to try and remove WWW from the url:</p>
<pre><code>RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteRule (.*) http://example.com$1 [R=301]
</code></pre>
<p>But for some reason it doesn't work. Any suggestions?</p> | 2,361,618 | 5 | 0 | null | 2010-03-02 07:28:26.88 UTC | 11 | 2014-11-20 16:59:22.657 UTC | null | null | null | null | 82,985 | null | 1 | 20 | apache|mod-rewrite | 27,719 | <p>Here’s a more generalized solution:</p>
<pre><code>RewriteCond %{HTTP_HOST} ^www\.(.+) [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301]
</code></pre> |
2,968,408 | How do i program a simple IRC bot in python? | <p>I need help writing a basic IRC bot that just connects to a channel.. is anyone able to explain me this? I have managed to get it to connect to the IRC server but i am unable to join a channel and log on. The code i have thus far is:</p>
<pre><code>import sockethost = 'irc.freenode.org'
port = 6667
join_sock = sock... | 2,968,416 | 5 | 3 | null | 2010-06-03 17:39:08.43 UTC | 20 | 2017-03-05 11:11:25.507 UTC | null | null | null | null | 357,766 | null | 1 | 22 | python|sockets|irc|connect|bots | 70,977 | <p>It'd probably be easiest to base it on twisted's implementation of the IRC protocol. Take a look at : <a href="http://github.com/brosner/bosnobot" rel="noreferrer">http://github.com/brosner/bosnobot</a> for inspiration.</p> |
2,464,959 | What's the u prefix in a Python string? | <p>Like in:</p>
<pre><code>u'Hello'
</code></pre>
<p>My guess is that it indicates "Unicode", is that correct?</p>
<p>If so, since when has it been available?</p> | 2,464,968 | 5 | 0 | null | 2010-03-17 18:43:20.663 UTC | 48 | 2021-10-19 16:51:30.45 UTC | 2021-10-19 16:51:30.45 UTC | null | 20,654 | null | 20,654 | null | 1 | 305 | python|syntax | 285,475 | <p>You're right, see <em><a href="http://docs.python.org/2/tutorial/introduction.html#unicode-strings" rel="noreferrer">3.1.3. Unicode Strings</a></em>.</p>
<p>It's been the syntax since Python 2.0. </p>
<p>Python 3 made them redundant, as the default string type is Unicode. Versions 3.0 through 3.2 removed them, but... |
2,978,405 | Writing an app to stream video to iPhone | <p>I'm interested in creating an iPhone app that can stream video from a central server, YouTube style. I was wondering if anyone has ever tried to do this before, what is the path of least resistant, existing APIs, etc? I really know nothing about how this is generally done. Would I be working with sockets? Just looki... | 3,222,822 | 6 | 0 | null | 2010-06-04 23:30:56.513 UTC | 21 | 2018-03-06 06:44:26.897 UTC | null | null | null | null | 137,060 | null | 1 | 23 | iphone|objective-c|video|video-streaming | 28,587 | <p>If you have the streaming server up and ready, it is quite easy to implement a video controller that pops up youtube-style.</p>
<pre><code>NSString *videoURLString = @"http://path-to-iphone-compliant-video-stream";
NSURL *videoURL = [NSURL URLWithString:videoURLString];
MPMoviePlayerController moviePlayer = [[MPMov... |
2,954,911 | How to detect tab key pressing in C#? | <p>I want to detect when tab key is pressed in a textBox and focus the next textbox in the panel.</p>
<p>I have tried out keyPressed method and keyDown method. But when I run the program and debug those methods are not calling when the tab key is pressed.
Here is my code.</p>
<pre><code>private void textBoxName_KeyDo... | 3,933,222 | 7 | 2 | null | 2010-06-02 03:58:20.18 UTC | null | 2015-06-02 02:36:02.76 UTC | 2012-04-30 08:21:07.493 UTC | null | 1,016,716 | null | 342,325 | null | 1 | 4 | c#|tabs|key|keypress | 40,609 | <p>go to the properties of text box and assign correct order of tabindex</p> |
2,958,813 | How to replicate PS multiply layer mode | <p>Does anybody know of a good way to replicate Photoshop's multiply layer mode using either an image or CSS?</p>
<p>I'm working on a project that has thumbnails that get a color overlay when you hover over them, but the designer used a layer set to multiply and I can't figure out how to produce it on the web.</p>
<p... | 21,011,502 | 8 | 10 | null | 2010-06-02 14:48:25.267 UTC | 11 | 2015-06-30 10:45:06.77 UTC | null | null | null | null | 1,824,709 | null | 1 | 51 | css|image|overlay|photoshop|rgba | 51,333 | <p>There are new CSS properties being introduced to do just this thing, they are <code>blend-mode</code> and <code>background-blend-mode</code>.</p>
<p>Currently, you won't be able to use them in any sort of production environment, as they are very very new, and currently only supported by Chrome Canary (experimental ... |
3,086,068 | How do I check whether a jQuery element is in the DOM? | <p>Let's say that I define an element</p>
<pre><code>$foo = $('#foo');
</code></pre>
<p>and then I call</p>
<pre><code>$foo.remove()
</code></pre>
<p>from some event. My question is, how do I check whether $foo has been removed from the DOM or not? I've found that <code>$foo.is(':hidden')</code> works, but that wou... | 3,086,084 | 11 | 0 | null | 2010-06-21 15:40:07.243 UTC | 21 | 2018-05-24 07:22:45.413 UTC | null | null | null | null | 66,226 | null | 1 | 156 | jquery | 60,073 | <p>Like this:</p>
<pre><code>if (!jQuery.contains(document, $foo[0])) {
//Element is detached
}
</code></pre>
<p>This will still work if one of the element's parents was removed (in which case the element itself will still have a parent).</p> |
2,446,812 | CSS Equivalent of the "if" statement | <p>Is there any way to use conditional statements in CSS?</p> | 2,446,829 | 14 | 3 | null | 2010-03-15 11:48:25.86 UTC | 7 | 2022-06-24 15:04:52.473 UTC | 2015-09-24 22:37:40.133 UTC | null | 1,207,687 | null | 479,291 | null | 1 | 45 | css | 192,078 | <p>No. But can you give an example what you have in mind? What <em>condition</em> do you want to check?</p>
<p>Maybe <a href="http://sass-lang.com/" rel="noreferrer">Sass</a> or <a href="http://compass-style.org/" rel="noreferrer">Compass</a> are interesting for you.</p>
<p>Quote from Sass:</p>
<blockquote>
<p>Sas... |
2,865,865 | Are there equivalents to Ruby's method_missing in other languages? | <p>In Ruby, objects have a handy method called <code>method_missing</code> which allows one to handle method calls for methods that have not even been (explicitly) defined:</p>
<blockquote>
<p>Invoked by Ruby when obj is sent a message it cannot handle. symbol is the symbol for the method called, and args are any ar... | 2,866,007 | 15 | 0 | 2010-05-19 13:26:30.313 UTC | 2010-05-19 13:26:30.313 UTC | 10 | 2017-09-02 20:57:05.147 UTC | null | null | null | null | 101,258 | null | 1 | 22 | programming-languages|language-features|method-missing | 3,613 | <p>Some use cases of <code>method_missing</code> can be implemented in Python using <code>__getattr__</code> e.g.</p>
<pre><code>class Roman(object):
def roman_to_int(self, roman):
# implementation here
def __getattr__(self, name):
return self.roman_to_int(name)
</code></pre>
<p>Then you can do:</p>
<pr... |
2,604,435 | Fatal error: Call to undefined function mcrypt_encrypt() | <p><strong>NOTE:</strong> The libraries MCrypt support depend on have not been updated in years and MCrypt should no longer be considered a viable or secure method of encrypting data. What's more, MCrypt has been deprecated in PHP 5, and removed entirely in PHP 7. If you have any code that runs MCrypt you should refa... | 2,604,474 | 19 | 4 | null | 2010-04-09 00:49:39.42 UTC | 12 | 2020-04-27 10:38:44.813 UTC | 2017-08-31 07:10:07.687 UTC | null | 477,127 | null | 52,745 | null | 1 | 69 | php|mcrypt | 230,537 | <p>What had worked for me with PHP version 5.2.8, was to open up <code>php.ini</code> and allow the <code>php_mcrypt.dll</code> extension by removing the <code>;</code>, i.e. changing:</p>
<p><code>;extension=php_mcrypt.dll</code> to <code>extension=php_mcrypt.dll</code></p> |
40,622,430 | `std::list<>::sort()` - why the sudden switch to top-down strategy? | <p>I remember that since the beginning of times the most popular approach to implementing <code>std::list<>::sort()</code> was the classic Merge Sort algorithm implemented in <a href="https://en.wikipedia.org/wiki/Merge_sort#Bottom-up_implementation_using_lists" rel="noreferrer">bottom-up fashion</a> (see also <a... | 40,629,882 | 2 | 20 | null | 2016-11-16 01:06:06.95 UTC | 6 | 2022-09-18 23:06:09.893 UTC | 2017-05-23 11:53:41.45 UTC | null | -1 | null | 187,690 | null | 1 | 50 | c++|algorithm|list|sorting|mergesort | 2,082 | <p>Note this answer has been updated to address all of the issues mentioned in the comments below and after the question, by making the same change from an array of lists to an array of iterators, while retaining the faster bottom up merge sort algorithm, and eliminating the small chance of stack overflow due to recurs... |
10,404,027 | Can't compile example from google protocol buffers | <p>I grep for other topics, but they dont help me =(.
On my working server, i have no sudo privilegies, so i install PB with</p>
<blockquote>
<p>./configure --prefix=/home/username/local</p>
</blockquote>
<p>Then i create source files with "person" example and succesfully compile it with protoc.</p>
<p>I have no p... | 10,404,243 | 3 | 0 | null | 2012-05-01 20:40:13.823 UTC | 4 | 2020-02-01 09:21:40.18 UTC | null | null | null | null | 1,368,572 | null | 1 | 12 | c++|linux|compiler-errors|g++|protocol-buffers | 40,147 | <p>Put the library at the end:</p>
<blockquote>
<p>g++ -I /home/username/local/include -L /home/username/local/lib main.cpp person.pb.cc -lprotobuf -pthread</p>
</blockquote>
<p>From <a href="http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html" rel="noreferrer">GCC Link Options</a>:</p>
<pre>
-llibrary
-l library
... |
10,832,422 | TestNG: More than one @DataProvider for one @Test | <p>I'm using <code>TestNG</code> for <code>Eclipse</code>.</p>
<p>Is it possible to give two data providers step by step to the <strong>same</strong> test-function?</p>
<p>I could put both providers in one, but that is not what I want.</p>
<p>I need (not like in this example) to generate independently data.</p>
<pre><c... | 10,839,095 | 4 | 0 | null | 2012-05-31 11:09:17.38 UTC | 9 | 2021-03-26 16:12:53.163 UTC | 2021-03-26 16:12:53.163 UTC | null | 7,804,477 | null | 789,111 | null | 1 | 28 | java|testing|automated-tests|testng|dataprovider | 40,874 | <p>No, but nothing stops you from merging these two data providers into one and specifying that one as your data provider:</p>
<pre><code>public Object[][] dp1() {
return new Object[][] {
new Object[] { "a", "b" },
new Object[] { "c", "d" },
};
}
public Object[][] dp2() {
return new Object[][] {
... |
10,761,551 | How do I get the current Url from within a FilterAttribute? | <p>I am writing an Authorize filter attribute adn I'm having trouble figuring out how to get the current url as a string so I can pass it as a parameter to the LogOn action. The goal is that if a user successfully logs on, they will be redirected to the page they were originally trying to access.</p>
<pre><code>public... | 10,761,606 | 4 | 0 | null | 2012-05-25 21:25:42.287 UTC | 6 | 2018-05-04 14:38:48.693 UTC | 2013-05-04 08:56:06.92 UTC | null | 114,029 | null | 336,384 | null | 1 | 50 | asp.net-mvc|url|authorization|action-filter|actionfilterattribute | 31,777 | <p>Try:</p>
<pre><code>var url = filterContext.HttpContext.Request.Url;
</code></pre> |
5,940,756 | Draw a table in vertical display instead of horizontal display | <p>Can Someone tell me by which command I can draw a table in vertical display in LaTex.</p>
<p>Thanks.. </p> | 5,941,019 | 2 | 4 | null | 2011-05-09 18:12:02.567 UTC | 3 | 2020-03-09 06:09:43.98 UTC | null | null | null | null | 616,141 | null | 1 | 18 | latex | 66,342 | <p>I think you want the <code>lscape</code> package, can be usefully used for this purpose as follows:</p>
<pre>
\begin{landscape}
\begin{table}
\centering
\begin{tabular}{....}
.......
\end{tabular}
\end{table}
\end{landscape}
</pre>
<hr>
<p>EDIT 2nd solution:
Another possibility is to use the <code>sideways</code>... |
58,600,728 | What is the difference between TEST, TEST_F and TEST_P? | <p>I have researched a lot about gtest/gmock but none of them gave me the right answer. I new to C++ so any help would be really appreciated.</p> | 58,680,861 | 1 | 0 | null | 2019-10-29 02:29:14.003 UTC | 11 | 2021-09-26 06:18:26.23 UTC | 2021-03-19 02:23:53.817 UTC | null | 1,076,113 | null | 11,503,182 | null | 1 | 44 | googletest|googlemock | 51,154 | <p>All documentation is covered in the <a href="https://github.com/google/googletest" rel="noreferrer">official github repo</a>. The <a href="https://github.com/google/googletest/blob/master/docs/primer.md" rel="noreferrer">primer documentation</a> also covers a lot of information regarding the test macros. You could u... |
21,319,602 | find file with wild card matching | <p>In node.js, can I list files with wild card matching like </p>
<pre><code>fs.readdirSync('C:/tmp/*.csv')?
</code></pre>
<p>I did not find the information on wild card matching from the <a href="http://nodejs.org/docs/v0.3.1/api/fs.html#fs.readFileSync" rel="noreferrer">fs documention</a>.</p> | 21,320,251 | 6 | 1 | null | 2014-01-23 21:22:57.88 UTC | 12 | 2021-11-17 11:25:14.203 UTC | 2018-10-17 09:03:55.137 UTC | null | 863,110 | null | 305,669 | null | 1 | 100 | node.js | 90,973 | <p>This is <em>not</em> covered by Node core. You can check out <a href="https://npmjs.org/package/glob" rel="noreferrer">this module</a> for what you are after.</p>
<h3>Setup</h3>
<pre class="lang-sh prettyprint-override"><code>npm i glob
</code></pre>
<h3>Usage</h3>
<pre><code>var glob = require("glob")
//... |
21,058,742 | Difference between WSGI utilities and Web Servers | <p>I am new to Python and i am not able to understand the server concepts in Python.</p>
<p>First of all what is <strong>WSGI</strong> and what are <strong>Wsgiref</strong> and <strong>Werkzeug</strong> and how are they different from CherryPy WSGI Server, Gunicorn, Tornado (HTTP Server via wsgi.WSGIContainer), Twiste... | 21,058,882 | 1 | 1 | null | 2014-01-11 05:06:34.84 UTC | 14 | 2014-01-11 05:34:32.74 UTC | 2014-01-11 05:26:58.277 UTC | null | 2,255,305 | null | 1,112,163 | null | 1 | 18 | python|wsgi | 4,021 | <p>WSGI is just a set a rules to help unify and standardize how Python applications communicate with web servers. It defines both how applications should send responses and how servers should communicate with applications and pass along the environment and other details about the request. Any application that needs to... |
21,038,706 | PersistenceUnit vs PersistenceContext | <p>In few project I have been successfully using </p>
<pre><code>@PersistenceUnit(unitName = "MiddlewareJPA")
EntityManagerFactory emf;
...
EntityManager entityManager = emf.createEntityManager();
</code></pre>
<p>to obtain <code>EntityManager</code> for Database connection, but some days ago I was trying to move my ... | 21,039,700 | 3 | 2 | null | 2014-01-10 07:45:27.987 UTC | 20 | 2019-09-14 12:09:38.46 UTC | 2015-03-11 21:07:27.697 UTC | null | 814,702 | null | 2,377,971 | null | 1 | 55 | java|jakarta-ee|jpa|persistence|entitymanager | 33,555 | <p>I don't know how it works exactly in the Java EE, but in Spring, when you specify <code>@PersistenceContext</code> annotation, it injects <code>EntityManager</code>. Where does it get <code>EntityManager</code>? It is wrong to create one <code>EntityManager</code> for the whole application lifetime by calling <code>... |
21,751,868 | Delete a database in phpMyAdmin | <p>By mistake, I have created a duplicate database in the phpMyAdmin page of cPanel. I want to delete this database, but I am not able to find any delete button in the UI.</p>
<p>How to delete a database in phpMyAdmin?</p> | 21,752,208 | 17 | 0 | null | 2014-02-13 10:42:31.707 UTC | 15 | 2022-06-26 23:33:22.587 UTC | null | null | null | null | 3,065,082 | null | 1 | 118 | phpmyadmin | 470,763 | <p>After successful login to cPanel, near to the <code>phpMyAdmin</code> icon there is another icon <code>MySQL Databases</code>; click on that.</p>
<p><img src="https://i.stack.imgur.com/mqYOT.png" alt="enter image description here"></p>
<p>That brings you to the database listing page.</p>
<p>In the action column y... |
29,870,337 | How to take google maps snapshot without actually displaying the map | <p>I want to be able to take a screenshot of a certain location in google maps without actually loading the google map onto the screen, If there is a way google map can take the screenshot in the background that would be great.</p> | 29,871,009 | 1 | 2 | null | 2015-04-25 20:24:10.223 UTC | 8 | 2015-04-25 21:36:17.447 UTC | null | null | null | null | 4,739,608 | null | 1 | 13 | android|google-maps|android-googleapiclient | 11,966 | <p>There is <a href="https://developers.google.com/maps/documentation/android/lite" rel="noreferrer">Lite Mode</a>:</p>
<blockquote>
<p><strong>The Google Maps Android API can serve a static image as a 'lite mode' map.</strong> </p>
<p>A lite mode map is a bitmap image of a map at a specified location and zoom ... |
8,369,334 | Using Html.ActionLink with RouteValues | <p>I have the following Html:</p>
<pre><code><%: Html.ActionLink(item.ProductName, "Details", "Product", new { item.ProductId }, null)%>
</code></pre>
<p>This is being rendered as:</p>
<pre><code><a href="/Product/Details?ProductId=1">My Product Name</a>
</code></pre>
<p>However, when I click on t... | 8,369,355 | 2 | 0 | null | 2011-12-03 17:05:03.583 UTC | 2 | 2011-12-03 17:40:23.337 UTC | 2011-12-03 17:21:50.567 UTC | null | 601,179 | null | 632,450 | null | 1 | 11 | asp.net-mvc|asp.net-mvc-3|model-view-controller|asp.net-mvc-routing | 41,563 | <p>Change the action parameter to be int ProductId.</p>
<pre><code>public ActionResult Details(int productId)
{
return View("");
}
</code></pre>
<p>your controller have to get an "id" parameter because you declared it as <strong>not</strong> nullable int so when you send productId it still doesn't match the funct... |
8,484,181 | How to enable a disabled text field? | <p>I wanna know how do I enable a disabled form text field on submit. Also I wanna make sure if user goes back to form or click reset field will show again as disabled.</p>
<p>I tried to use </p>
<pre><code>document.pizza.field07.disabled = false ;
</code></pre>
<p>It does disables the field, by clicking reset or hi... | 8,484,196 | 5 | 0 | null | 2011-12-13 04:05:27.66 UTC | 4 | 2020-07-28 11:05:55.14 UTC | null | null | null | null | 1,094,741 | null | 1 | 16 | javascript|html|forms|validation|onsubmit | 86,425 | <p>To access this element in a more standard way, use <a href="https://developer.mozilla.org/en/DOM/document.getElementById">document.getElementById</a> with <a href="https://developer.mozilla.org/en/DOM/element.setAttribute">setAttribute</a></p>
<pre><code>document.getElementById("field07").setAttribute("disabled", f... |
8,592,056 | What does IB mean in IBAction, IBOutlet, etc..? | <p>I am very new to iPhone development. I often encounter <code>IBAction</code>, <code>IBOutlet</code> and so on when reading Objective-C and Swift code. What does <code>IB</code> stand for?</p> | 8,592,079 | 3 | 0 | null | 2011-12-21 15:15:53.367 UTC | 11 | 2018-10-29 17:51:54.99 UTC | 2018-10-29 17:51:54.99 UTC | null | 9,763,253 | null | 969,645 | null | 1 | 42 | iphone|xcode | 13,361 | <p>"Interface Builder".</p>
<p>Before Xcode 4, the interface files (XIBs and NIBs) were edited in a separate program called Interface Builder, hence the prefix.</p>
<p><code>IBAction</code> is defined to <code>void</code>, and <code>IBOutlet</code> to nothing. They are just clues to Interface Builder when parsing fil... |
8,592,289 | ARC - The meaning of __unsafe_unretained? | <p>Just want to make sure that I got it right:</p>
<ol>
<li>Do I need to <code>__unsafe_unretain</code> objects that I don't own?</li>
<li>If an object is <code>__unsafe_unretained</code> Do I need to use <code>assign</code> in the <code>@property</code>? Does that mean that the object is not retained, and just refers... | 8,593,731 | 4 | 0 | null | 2011-12-21 15:32:55.31 UTC | 64 | 2013-01-25 09:15:12.65 UTC | 2012-08-09 16:17:08.317 UTC | null | 766,441 | null | 358,480 | null | 1 | 82 | objective-c|ios|macos|xcode4|automatic-ref-counting | 42,879 | <p>The LLVM Compiler 3.0 introduces four new ownership qualifiers: <code>__strong</code>, <code>__autoreleasing</code>, <code>__unsafe_unretained</code>, and <code>__weak</code>. The first three are available even outside ARC, as per <a href="http://clang.llvm.org/docs/AutomaticReferenceCounting.html" rel="noreferrer"... |
8,846,173 | How to remove the first and last character of a string? | <p>I have worked in a SOAP message to get the LoginToken from a Webservice, and store that LoginToken as a String. U used <code>System.out.println(LoginToken);</code> to print the value. This prints <code>[wdsd34svdf]</code>, but I want only <code>wdsd34svdf</code>. How can I remove these square brackets at the start a... | 8,846,218 | 12 | 0 | null | 2012-01-13 05:05:15.863 UTC | 12 | 2022-06-15 10:55:57.04 UTC | 2021-12-23 16:52:09.093 UTC | null | 2,756,409 | null | 1,142,914 | null | 1 | 100 | java|string | 235,408 | <p>You need to find the index of <code>[</code> and <code>]</code> then <code>substring</code>. (Here <code>[</code> is always at start and <code>]</code> is at end):</p>
<pre><code>String loginToken = "[wdsd34svdf]";
System.out.println( loginToken.substring( 1, loginToken.length() - 1 ) );
</code></pre> |
27,104,521 | How to add a scrollview edge color effect in Android Lollipop? | <p>In my app I change the overscroll glow effect color like this:</p>
<pre><code>int glowDrawableId = contexto.getResources().getIdentifier("overscroll_glow", "drawable", "android");
Drawable androidGlow = contexto.getResources().getDrawable(glowDrawableId);
assert androidGlow != null;
androidGlow.setColorFilter(getRe... | 27,115,812 | 6 | 1 | null | 2014-11-24 12:07:42.68 UTC | 13 | 2019-09-25 22:07:41.487 UTC | 2019-09-25 22:07:41.487 UTC | null | 2,756,409 | null | 3,065,901 | null | 1 | 18 | android|scrollview|android-5.0-lollipop | 17,497 | <p>You can specify <code>android:colorEdgeEffect</code> in your theme to change the overscroll glow color within your entire app. By default, this inherits the primary color value set by <code>android:colorPrimary</code>.</p>
<p>res/values/themes.xml:</p>
<pre><code><style name="MyAppTheme" parent="...">
..... |
557,052 | Exceptions in PHP - Try/Catch or set_exception_handler? | <p>I'm developing some lower end code in my system that uses multiple child classes of the php exception class. Essentially I have the exceptions broken up to a few categories. What I'm wanting to do is two things. </p>
<ol>
<li>I need all exceptions that are fired in the application to be handled in a single place... | 557,109 | 3 | 1 | null | 2009-02-17 14:27:55.063 UTC | 16 | 2015-12-02 15:58:27.15 UTC | 2012-12-23 21:31:53.623 UTC | null | 168,868 | Syntax | 62,551 | null | 1 | 18 | php|exception | 12,698 | <ol>
<li>Run your web requests through a <a href="https://stackoverflow.com/questions/20277102/proper-separation-difference-between-index-php-and-front-controller/20299496#20299496">Front Controller script</a></li>
<li><p>call <a href="http://www.php.net/set_error_handler" rel="nofollow noreferrer"><code>set_exception_... |
834,395 | Python ASCII Graph Drawing | <p>I'm looking for a library to draw ASCII graphs (for use in a console) with Python. The graph is quite simple: it's only a flow chart for pipelines.</p>
<p>I saw NetworkX and igraph, but didn't see a way to output to ascii.</p>
<p>Do you have experience in this?</p>
<p>Thanks a lot!</p>
<p>Patrick</p>
<p>EDIT 1:... | 834,578 | 3 | 0 | null | 2009-05-07 12:33:34.307 UTC | 8 | 2009-12-31 00:47:32.937 UTC | 2009-05-07 14:05:58.127 UTC | null | 94,404 | null | 94,404 | null | 1 | 29 | python|graph|ascii | 18,573 | <p>When you say 'simple network graph in ascii', do you mean something like this?</p>
<pre><code>.===. .===. .===. .===.
| a |---| b |---| c |---| d |
'===' '===' '---' '==='
</code></pre>
<p>I suspect there are probably better ways to display whatever information it is that you have than to try and draw ... |
493,886 | SQL Server Automated Backups | <p>What are the recommendations of software products for creating automated backups of SQL Server 2008 databases?</p>
<p>The backup should happen without taking the database offline/detatching.</p> | 493,903 | 3 | 1 | null | 2009-01-29 23:03:47.917 UTC | 25 | 2018-01-16 14:51:27.263 UTC | null | null | null | blu | 54,612 | null | 1 | 30 | database|sql-server-2008|backup | 47,168 | <p>I would recommend just creating a maintenance plan in SQL Server to handle the backups, it can be configured to backup to a specified location at specified times, without taking the databases offline, and will handle your incremental backup cleanup. </p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms189715.... |
542,895 | How to read .rej files, i.e | <p>I'm having trouble applying a patch to my source tree, and it's not the usual <code>-p</code> stripping problem. <code>patch</code> is able to find the file to patch.</p>
<p>Specifically, my question is how to read / interpret the <code>.rej</code> files <code>patch</code> creates when it fails on a few hunks. Most... | 543,045 | 3 | 0 | null | 2009-02-12 19:38:51.627 UTC | 11 | 2016-11-28 01:25:03.38 UTC | 2011-08-17 13:11:13.987 UTC | null | 341,106 | Rudy | null | null | 1 | 30 | diff|patch | 29,040 | <p>A simple example:</p>
<pre><code>$ echo -e "line 1\nline 2\nline 3" > a
$ sed -e 's/2/b/' <a >b
$ sed -e 's/2/c/' <a >c
$ diff a b > ab.diff
$ patch c < ab.diff
$ cat c.rej
***************
*** 2
- line 2
--- 2 -----
+ line b
</code></pre>
<p>As you can see: The old file contains line 2 and the... |
1,162,529 | JavaScript replace/regex | <p>Given this function:</p>
<pre><code>function Repeater(template) {
var repeater = {
markup: template,
replace: function(pattern, value) {
this.markup = this.markup.replace(pattern, value);
}
};
return repeater;
};
</code></pre>
<p>How do I make <code>this.markup... | 1,162,538 | 3 | 0 | null | 2009-07-22 00:56:48.587 UTC | 27 | 2013-06-30 15:58:59.757 UTC | 2013-06-30 15:58:59.757 UTC | null | 2,287,470 | null | 11,574 | null | 1 | 139 | javascript|regex|replace | 393,638 | <p>You need to double escape any RegExp characters (once for the slash in the string and once for the regexp):</p>
<pre><code> "$TESTONE $TESTONE".replace( new RegExp("\\$TESTONE","gm"),"foo")
</code></pre>
<p>Otherwise, it looks for the end of the line and 'TESTONE' (which it never finds).</p>
<p>Personally, I'm n... |
1,052,148 | Group by & count function in sqlalchemy | <p>I want a "group by and count" command in sqlalchemy. How can I do this?</p> | 4,086,229 | 3 | 1 | null | 2009-06-27 05:10:43.257 UTC | 37 | 2022-06-24 07:11:18.46 UTC | 2019-07-15 17:31:22.467 UTC | null | 2,681,632 | null | 309,111 | null | 1 | 163 | python|group-by|count|sqlalchemy | 171,043 | <p>The <a href="http://www.sqlalchemy.org/docs/orm/tutorial.html#counting" rel="noreferrer">documentation on counting</a> says that for <code>group_by</code> queries it is better to use <code>func.count()</code>:</p>
<pre><code>from sqlalchemy import func
session.query(Table.column,
func.count(Table.column)).group_... |
6,468,896 | Why is orig_eax provided in addition to eax? | <p>Why is the <code>orig_eax</code> member included in <code>sys/user.h</code>'s <code>struct user_regs_struct</code>?</p> | 6,469,069 | 1 | 0 | null | 2011-06-24 14:02:57.033 UTC | 11 | 2011-06-28 01:06:38.423 UTC | 2011-06-24 18:48:59.747 UTC | null | 36,723 | null | 149,482 | null | 1 | 20 | c|linux|linux-kernel|cpu-registers | 7,964 | <p>Because it was in <code>struct pt_regs</code>, which is .... <a href="http://tomoyo.sourceforge.jp/cgi-bin/lxr/source/arch/x86/include/asm/user_32.h#L77">http://tomoyo.sourceforge.jp/cgi-bin/lxr/source/arch/x86/include/asm/user_32.h#L77</a></p>
<pre><code> 73 * is still the layout used by user mode (the new
74 *... |
28,850,809 | Disable deprecated warning in Symfony 2(.7) | <p>Since my <code>Symfony 2</code> update to <code>2.7</code>. I get a lot of deprecated erors in <code>PHPUnit</code> and <code>console</code> (message is clear by now). </p>
<pre><code>ProjectX\ApiBundle\Tests\Controller\SectionsControllerTest::testPostDebug()
The twig.form.resources configuration key is deprecated ... | 28,865,489 | 5 | 1 | null | 2015-03-04 09:28:32.02 UTC | 7 | 2016-06-14 13:28:58.827 UTC | 2015-03-04 09:41:49.913 UTC | null | 2,270,041 | null | 897,360 | null | 1 | 32 | php|symfony|symfony-2.7 | 32,866 | <p>I have the same problem and solved it similar to the below link. Symfony declares to report all errors and overrides what you put in php.ini by design (otherwise it couldn't catch & display nice stack traces for you). </p>
<p>So, you'll need to <strong>override Symfony2's built-in error reporting by creating an... |
20,660,989 | Max double slice sum | <p>Recently, I tried to solve the Max Double Slice Sum problem in codility which is a variant of max slice problem. My Solution was to look for a slice that has maximum value when its minimum value is taken out. So I implemented max slice, but on the current slice took out the minimum number.</p>
<p>My score was 61 of... | 20,661,624 | 18 | 0 | null | 2013-12-18 14:37:02.843 UTC | 10 | 2022-06-23 16:36:23.573 UTC | 2017-11-26 11:58:32.923 UTC | null | 2,333,458 | null | 2,486,546 | null | 1 | 19 | java|algorithm | 20,141 | <p>If I have understood the problem correctly, you want to calculate the maximum sum subarray with one element missing.</p>
<p>Your algorithm shall not work for the following case:</p>
<pre><code> 1 1 0 10 -100 10 0
</code></pre>
<p>In the above case, your algorithm shall identify <code>1, 1, 0, 10</code> as the max... |
56,196,973 | Invalid value 'armeabi' in $(AndroidSupportedAbis). This ABI is no longer supported. Xamarin.Forms - VS2019 | <p>I have a Mobile App built with Xamarin.Forms<br>
when I am trying to upgrade my project from VS2017 to VS2019</p>
<p>I get this error in <strong>Android Project</strong></p>
<blockquote>
<p>Invalid value 'armeabi' in $(AndroidSupportedAbis). This ABI is no longer supported. Please update your project properties ... | 56,197,862 | 3 | 1 | null | 2019-05-18 07:43:44.85 UTC | 3 | 2020-06-20 06:51:05.977 UTC | null | null | null | null | 4,977,870 | null | 1 | 30 | xamarin|xamarin.forms|xamarin.android|build-error|visual-studio-2019 | 22,364 | <p><code>armeabi</code> is deprecated and your Android project should target <code>armeabi-v7a</code> and <code>arm64-v8a</code> at a minimum in your release builds destined for the Play Store.</p>
<p>You can directly edit your <code>.csproj</code> and remove the <code>armeabi</code> from within the <code>AndroidSuppo... |
5,964,661 | detach one process from visual studio debugger | <p>My question is somewhat similar to this
<a href="https://stackoverflow.com/questions/2671503/how-to-stop-debugging-or-detach-process-without-stopping-the-process">"How to stop debugging (or detach process) without stopping the process?"</a></p>
<p>but i want to detach from one process.</p>
<p>for instance, I have ... | 5,964,765 | 4 | 0 | null | 2011-05-11 13:00:09.697 UTC | 7 | 2021-09-28 13:37:46.21 UTC | 2017-05-23 11:55:07.73 UTC | null | -1 | null | 339,995 | null | 1 | 62 | visual-studio|debugging | 18,554 | <p>In the Processes window (Debug -> Windows -> Processes), right-click on the name of the process you want to detach, and on the shortcut menu, click Detach Process.</p> |
64,005,844 | Is it possible to delete a pull-request on BitBucket? | <p>I cannot find an option to delete a PR on BitBucket.
Am I overlooking something or it's really not possible?</p> | 64,006,136 | 5 | 2 | null | 2020-09-22 08:26:51.587 UTC | 1 | 2021-12-01 13:54:00.623 UTC | null | null | null | null | 1,941,537 | null | 1 | 26 | bitbucket | 45,163 | <p>As per the link <a href="https://stackoverflow.com/users/3001761/jonrsharpe">jonrsharpe</a> mentioned, to the right of the merge button there are 3 dots. Under that menu you should have a delete option if you have permission to delete.</p>
<p>This is available only for BitBucket Server, not on BitBucket.org.
In BitB... |
29,442,993 | Which are the available domain operators in Openerp / Odoo? | <p>I know few operator in openerp domain. I dont get the details of available domains and their explanation. Particularly for these negation domains. Can anyone tell me the detail list?</p> | 29,443,027 | 2 | 0 | null | 2015-04-04 05:14:15.823 UTC | 36 | 2017-11-07 10:38:02.26 UTC | 2017-11-07 10:38:02.26 UTC | null | 4,891,717 | null | 4,748,376 | null | 1 | 37 | openerp|operators|odoo-8 | 59,270 | <p>This gives a overview:</p>
<p>List of <strong>Domain</strong> operators: <code>!</code> (Not), <code>|</code> (Or), <code>&</code> (And)</p>
<p>List of <strong>Term</strong> operators: <code>'=', '!=', '<=', '<', '>', '>=', '=?', '=like', '=ilike', 'like', 'not like', 'ilike', 'not ilike', 'in', 'n... |
50,485,988 | Is there a way to keep fragment alive when using BottomNavigationView with new NavController? | <p>I'm trying to use the new navigation component. I use a BottomNavigationView with the navController : <code>NavigationUI.setupWithNavController(bottomNavigation, navController)</code></p>
<p>But when I'm switching fragments, they are each time destroy/create even if they were previously used.</p>
<p>Is there a way t... | 51,684,125 | 10 | 1 | null | 2018-05-23 10:28:01.027 UTC | 66 | 2022-07-07 07:38:19.457 UTC | 2021-01-25 17:59:33.673 UTC | null | 6,138,892 | null | 9,833,782 | null | 1 | 134 | android|navigation|bottomnavigationview | 44,756 | <p>Try this.</p>
<h3>Navigator</h3>
<p>Create custom navigator.</p>
<pre class="lang-kotlin prettyprint-override"><code>@Navigator.Name("custom_fragment") // Use as custom tag at navigation.xml
class CustomNavigator(
private val context: Context,
private val manager: FragmentManager,
private val contain... |
6,014,702 | How do I detect "shift+enter" and generate a new line in Textarea? | <p>Currently, if the person presses <kbd>enter</kbd> inside the text area, the form will submit.<br>
Good, I want that.</p>
<p>But when they type <kbd>shift</kbd> + <kbd>enter</kbd>, I want the textarea to move to the next line: <code>\n</code> </p>
<p>How can I do that in <code>JQuery</code> or plain JavaScript as s... | 6,014,917 | 19 | 6 | null | 2011-05-16 08:19:13.487 UTC | 32 | 2022-04-28 04:05:15.693 UTC | 2011-05-16 08:49:36.78 UTC | null | 447,356 | null | 179,736 | null | 1 | 173 | javascript|jquery|html|css | 143,967 | <h1>Better use simpler solution:</h1>
<p>Tim's solution below is better I suggest using that:
<a href="https://stackoverflow.com/a/6015906/4031815">https://stackoverflow.com/a/6015906/4031815</a></p>
<hr>
<h1>My solution</h1>
<p>I think you can do something like this.. </p>
<p><strong>EDIT :</strong> Changed the... |
46,305,459 | Sequelize model references vs associations | <p>Just starting to use Sequelize and I've setup a bunch of models and seeds, but I can't figure out references vs associations. I don't see the use case for references if they even do what I think they do, but I couldn't find a good explanation in the docs.</p>
<p>Is this redundant having references and associations... | 49,140,096 | 1 | 1 | null | 2017-09-19 16:27:03.94 UTC | 12 | 2020-12-03 09:06:02.003 UTC | 2020-12-03 09:06:02.003 UTC | null | 6,463,558 | null | 1,148,107 | null | 1 | 28 | node.js|sequelize.js | 19,573 | <p>Using <code>references</code> you create a reference to another table, without adding any constraints, or associations. Which means that is just a way of <strong>signaling</strong> the database that this table has a reference to another.</p>
<p>Creating an <code>association</code> will add a foreign key constraint ... |
44,239,822 | urllib.request.urlopen(url) with Authentication | <p>I've been playing with beautiful soup and parsing web pages for a few days. I have been using a line of code which has been my saviour in all the scripts that I write. The line of code is : </p>
<pre><code>r = requests.get('some_url', auth=('my_username', 'my_password')).
</code></pre>
<p>BUT ...</p>
<p>I want to... | 44,239,906 | 4 | 0 | null | 2017-05-29 10:07:37.62 UTC | 6 | 2022-05-26 17:06:47.337 UTC | null | null | null | user7800892 | null | null | 1 | 35 | python|python-3.x|url|beautifulsoup|request | 76,462 | <p>Have a look at the <a href="https://docs.python.org/3.1/howto/urllib2.html#id6" rel="noreferrer">HOWTO Fetch Internet Resources Using The urllib Package</a> from the official docs:</p>
<pre><code># create a password manager
password_mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm()
# Add the username and pass... |
43,971,138 | Python - Plotting colored grid based on values | <p>I have been searching here and on the net. I found somehow close questions/answers to what I want, but still couldn't reach to what I'm looking for.</p>
<p>I have an array of for example, 100 values. The values are in the range from 0 to 100.
I want to plot this array as a grid, filling the squares according to the... | 43,971,236 | 2 | 0 | null | 2017-05-15 03:19:41.747 UTC | 9 | 2017-11-10 21:47:52.967 UTC | 2017-05-23 11:47:24.667 UTC | null | -1 | null | 6,203,203 | null | 1 | 20 | python|matplotlib|plot|colors|grid | 57,822 | <p>You can create a <a href="https://matplotlib.org/devdocs/api/_as_gen/matplotlib.colors.ListedColormap.html" rel="noreferrer">ListedColormap</a> for your custom colors and color <a href="http://matplotlib.org/devdocs/api/_as_gen/matplotlib.colors.BoundaryNorm.html" rel="noreferrer">BoundaryNorms</a> to threshold the ... |
19,643,234 | Fill region between two loess-smoothed lines in R with ggplot | <p>I'd like to know how to fill the area between to loess-smoothed lines in ggplot.</p>
<p>The following data frame is used for the pictures:</p>
<pre><code> x y ymin ymax grp ydiff
1 1 3.285614 3.285614 10.14177 min 6.8561586
2 1 10.141773 3.285614 10.14177 max 6.8561586
3 2 5.06187... | 19,644,663 | 2 | 0 | null | 2013-10-28 19:15:47.807 UTC | 8 | 2021-07-19 06:05:32.783 UTC | 2013-10-28 19:27:26.647 UTC | null | 2,094,622 | null | 2,094,622 | null | 1 | 22 | r|ggplot2|fill|smoothing|loess | 11,285 | <p>A possible solution where the loess smoothed data is grabbed from the plot object and used for the <code>geom_ribbon</code>:</p>
<pre><code># create plot object with loess regression lines
g1 <- ggplot(df) +
stat_smooth(aes(x = x, y = ymin, colour = "min"), method = "loess", se = FALSE) +
stat_smooth(aes(x ... |
41,111,227 | How can a Slack bot detect a direct message vs a message in a channel? | <p>TL;DR: Via the Slack APIs, how can I differentiate between a message in a channel vs a direct message?</p>
<p>I have a working Slack bot using the RTM API, let's call it Edi. And it works great as long as all commands start with "@edi"; e.g. "@edi help". It currently responses to any channel it's a member of and ... | 42,013,042 | 4 | 0 | null | 2016-12-12 23:11:24.66 UTC | 5 | 2019-01-23 20:30:08.793 UTC | null | null | null | null | 1,521,963 | null | 1 | 28 | slack-api | 13,089 | <p>I talked to James at Slack and he gave me a simply way to determine if a message is a DM or not; if a channel ID begins with a:</p>
<ul>
<li>C, it's a public channel</li>
<li>D, it's a DM with the user</li>
<li>G, it's either a private channel or multi-person DM</li>
</ul>
<p>However, these values aren't set in st... |
33,382,925 | What is the difference between data-sly-use, data-sly-resource, data-sly-include, and data-sly-template? | <p>What is the difference between: <code>data-sly-use</code>, <code>data-sly-resource</code>, <code>data-sly-include</code>, and <code>data-sly-template</code>? I am reading the doc on <code>Sightly</code> <code>AEM</code> and I am super confused.</p>
<p>As far as I can see:</p>
<ul>
<li><code>data-sly-use</code> is ... | 33,395,263 | 2 | 0 | null | 2015-10-28 04:29:00.6 UTC | 8 | 2019-01-23 09:08:56.377 UTC | 2016-10-05 22:58:21.557 UTC | null | 1,314,132 | null | 1,887,791 | null | 1 | 19 | aem|sightly | 39,453 | <p>As you already said: </p>
<ul>
<li><em>data-sly-use</em> "is used to add js/java". You declare component-beans with this statement for instance. </li>
<li><em>data-sly-resource</em> you can override a resource-type for a included file.</li>
<li><em>data-sly-include</em> includes other html files as the name suggest... |
31,140,590 | How to line left justify label and entry boxes in Tkinter grid | <p>I'm still pretty new to Tkinter and Classes, but I am trying to left justify labels and entry boxes each within their own column of a Tkinter grid. I am using <code>Justify=LEFT</code>, but it seems to have no impact as the labels look centered and the entry boxes start where the label ends.</p>
<pre><code>from Tki... | 31,142,512 | 2 | 0 | null | 2015-06-30 14:07:42.583 UTC | 1 | 2019-07-25 16:13:31.017 UTC | null | null | null | null | 2,242,044 | null | 1 | 9 | python|python-2.7|tkinter | 41,791 | <p>I think your problem lies in the fact that each time you create a new instance of <code>LabeledFrame</code>, you are placing both the <code>Entry</code> & <code>Label</code> within the same <code>Frame</code>. </p>
<p>The <code>grid</code> settings for this <code>Frame</code> are separate from any other <code>F... |
18,952,479 | How to exclude multiple SLF4J bindings to LOG4J | <p>I am getting the error </p>
<pre><code>SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/george/.gradle/caches/artifacts-26/filestore/org.apache.logging.log4j/log4j-slf4j-impl/2.0-beta8/jar/15984318e95b9b0394e979e413a4a14f322401c1/log4j-slf4j-impl-2.0-beta8.jar!/org/slf... | 19,417,373 | 3 | 0 | null | 2013-09-23 05:48:13.957 UTC | 5 | 2017-04-13 03:21:26.907 UTC | null | null | null | null | 986,820 | null | 1 | 22 | java|logging|gradle|slf4j|log4j2 | 44,374 | <p>The solution is to add the following in the build.gradle.</p>
<pre><code>configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.name == 'log4j') {
details.useTarget "org.slf4j:log4j-over-slf4j:1.7.5"
}
}
</code></pre>
<p... |
24,130,004 | Adding http headers to window.location.href in Angular app | <p>I have a angular app that I needed to redirect outside to a non angular html page, so I thought I could just use the <code>$window.location.href</code>to redirect the angular app to my external site. This actually works fine, however, I have a nodejs/express backend that checks for auth token before serving up any c... | 26,373,493 | 2 | 0 | null | 2014-06-09 22:22:29.053 UTC | 7 | 2020-05-05 18:15:32.04 UTC | 2016-03-13 17:34:48.733 UTC | null | 22,514 | null | 2,697,567 | null | 1 | 30 | angularjs|http|oauth-2.0|http-headers|window.location | 52,500 | <p>When you use <code>$window.location.href</code> the browser is making the HTTP request and not your JavaScript code. Therefore, you cannot add a custom header like <code>Authorization</code> with your token value.</p>
<p>You could add a cookie via JavaScript and put your auth token there. The cookies will automat... |
43,701,748 | React pseudo selector inline styling | <p>What do you think are good ways to handle styling pseudo selectors with React inline styling? What are the gains and drawbacks?</p>
<p>Say you have a styles.js file for each React component. You style your component with that styles file. But then you want to do a hover effect on a button (or whatever). </p>
<p>On... | 43,707,118 | 2 | 0 | null | 2017-04-30 00:29:12.323 UTC | 8 | 2019-05-10 03:55:37.16 UTC | null | null | null | null | 6,636,554 | null | 1 | 40 | css|reactjs | 69,638 | <p>My advice to anyone wanting to do inline styling with React is to use <a href="https://github.com/FormidableLabs/radium" rel="noreferrer">Radium</a> as well.</p>
<p>It supports <a href="https://github.com/FormidableLabs/radium/tree/master/docs/guides#browser-states" rel="noreferrer"><code>:hover</code>, <code>:focu... |
27,792,508 | Ruby backslash to continue string on a new line? | <p>I'm reviewing a line of Ruby code in a pull request. I'm not sure if this is a bug or a feature that I haven't seen before:</p>
<pre><code>puts "A string of Ruby that"\
"continues on the next line"
</code></pre>
<p>Is the backslash a valid character to concatenate these strings? Or is this a bug?</p> | 27,792,546 | 3 | 1 | null | 2015-01-06 05:19:18.417 UTC | 3 | 2020-01-28 08:43:14.693 UTC | null | null | null | null | 48,523 | null | 1 | 36 | ruby | 21,301 | <p>That is valid code. </p>
<p>The backslash is a line continuation. Your code has two quoted runs of text; the runs appear like two strings, but are really just one string because Ruby concatenates whitespace-separated runs.</p>
<p>Example of three quoted runs of text that are really just one string:</p>
<pre><code... |
27,594,541 | Export a list into a CSV or TXT file in R | <p>I understand that we cannot export a table if one of its elements is a list. I got a list in R and I want to export it into a CSV or TXT file. Here is the error message that I get when I execute this <code>write.table</code> command :</p>
<pre><code>write.table(mylist,"test.txt",sep=";")
Error i... | 27,594,769 | 8 | 1 | null | 2014-12-21 22:41:42.607 UTC | 21 | 2022-01-16 09:57:31.387 UTC | 2022-01-16 09:57:31.387 UTC | null | 792,066 | null | 4,383,566 | null | 1 | 58 | r | 150,417 | <p>So essentially you have a list of lists, with mylist being the name of the main list and the first element being <code>$f10010_1</code> which is printed out (and which contains 4 more lists).</p>
<p>I think the easiest way to do this is to use <code>lapply</code> with the addition of <code>dataframe</code> (assumin... |
27,647,749 | How to test ActionMailer deliver_later with rspec | <p>trying to upgrade to Rails 4.2, using delayed_job_active_record. I've not set the delayed_job backend for test environment as thought that way jobs would execute straight away.</p>
<p>I'm trying to test the new 'deliver_later' method with RSpec, but I'm not sure how.</p>
<p>Old controller code:</p>
<pre><code>Servic... | 27,653,104 | 13 | 1 | null | 2014-12-25 13:45:12.653 UTC | 13 | 2021-05-13 19:47:07.837 UTC | 2021-05-13 19:47:07.837 UTC | null | 74,089 | null | 1,007,594 | null | 1 | 85 | ruby-on-rails|rspec|actionmailer|delayed-job|rails-activejob | 38,907 | <p>If I understand you correctly, you could do:</p>
<pre><code>message_delivery = instance_double(ActionMailer::MessageDelivery)
expect(ServiceMailer).to receive(:new_user).with(@user).and_return(message_delivery)
allow(message_delivery).to receive(:deliver_later)
</code></pre>
<p>The key thing is that you need to so... |
32,618,216 | Override S3 endpoint using Boto3 configuration file | <h3>OVERVIEW:</h3>
<p>I'm trying to override certain variables in <code>boto3</code> using the configuration file (<code>~/aws/confg</code>).
In my use case I want to use <code>fakes3</code> service and send S3 requests to the localhost.</p>
<h3>EXAMPLE:</h3>
<p>In <code>boto</code> (not <code>boto3</code>), I can crea... | 41,327,767 | 6 | 1 | null | 2015-09-16 20:36:48.917 UTC | 20 | 2021-11-30 00:38:36.14 UTC | 2021-11-30 00:38:36.14 UTC | null | 33,264 | null | 1,516,286 | null | 1 | 44 | python|amazon-web-services|boto|boto3|botocore | 58,459 | <p>You cannot set host in config file, however you can override it from your code with boto3.</p>
<pre><code>import boto3
session = boto3.session.Session()
s3_client = session.client(
service_name='s3',
aws_access_key_id='aaa',
aws_secret_access_key='bbb',
endpoint_url='http://localhost',
)
</code></... |
9,129,802 | Exception from HRESULT: 0x80131040 | <pre><code>Warning 1 D:\MyPath\SomeAscx.cs: ASP.NET runtime error:
Could not load file or assembly 'HtmlAgilityPack,
Version=1.4.0.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a'
or one of its dependencies. The located assembly's manifest definition
does not m... | 9,129,917 | 2 | 0 | null | 2012-02-03 14:01:09.61 UTC | 2 | 2015-03-07 14:46:58.43 UTC | null | null | null | null | 199,640 | null | 1 | 9 | c#|asp.net|visual-studio-2010|exception | 48,254 | <p>Even if you removed direct references, something else might still require that dll.</p>
<p>I'd suggest:</p>
<ol>
<li>Recycle your IIS application pool (or run IISRESET from the command prompt to reset the entire web server)</li>
<li>turn on <a href="http://msdn.microsoft.com/en-us/library/e74a18c4%28v=VS.100%29.as... |
9,032,655 | Check if a string within a list contains a specific string with Linq | <p>I have a <code>List<string></code> that has some items like this:</p>
<pre><code>{"Pre Mdd LH", "Post Mdd LH", "Pre Mdd LL", "Post Mdd LL"}
</code></pre>
<p>Now I want to perform a condition that checks if an item in the list contains a specific string. something like:</p>
<p><code>IF list contains an item ... | 9,032,686 | 5 | 0 | null | 2012-01-27 11:31:03.247 UTC | 4 | 2018-12-04 20:17:57.463 UTC | null | null | null | null | 658,031 | null | 1 | 23 | c#|linq | 128,209 | <p>I think you want <a href="http://msdn.microsoft.com/en-us/library/bb534972.aspx" rel="noreferrer"><code>Any</code></a>:</p>
<pre><code>if (myList.Any(str => str.Contains("Mdd LH")))
</code></pre>
<p>It's well worth becoming familiar with the <a href="http://msdn.microsoft.com/en-us/library/bb394939.aspx" rel="n... |
9,185,630 | Find out the 'line' (row) number of the cursor in a textarea | <p>I would like to find out and keep track of the 'line number' (rows) of the cursor in a textarea. (The 'bigger picture' is to parse the text on the line every time a new line is created/modified/selected, if of course the text was not pasted in. This saves parsing the whole text un-necessarily at set intervals.)</p>
... | 9,185,820 | 3 | 0 | null | 2012-02-07 23:24:16.037 UTC | 9 | 2020-05-07 13:17:14.747 UTC | 2013-12-08 21:29:41.397 UTC | null | 759,866 | null | 510,238 | null | 1 | 30 | javascript|textarea | 32,439 | <p>You would want to use <code>selectionStart</code> to do this.</p>
<pre><code><textarea onkeyup="getLineNumber(this, document.getElementById('lineNo'));" onmouseup="this.onkeyup();"></textarea>
<div id="lineNo"></div>
<script>
function getLineNumber(textarea, indicator) {
... |
9,467,093 | How to add a tooltip to a cell in a jtable? | <p>I have a table where each row represents a picture. In the column Path I store its absolute path. The string being kinda long, I would like that when I hover the mouse over the specific cell, a tooltip should pop-up next to the mouse containing the information from the cell.</p> | 9,467,372 | 3 | 0 | null | 2012-02-27 14:56:07.947 UTC | 5 | 2018-05-09 20:31:01.437 UTC | 2012-02-27 15:08:57.217 UTC | null | 418,556 | null | 1,065,207 | null | 1 | 30 | java|swing|jtable|tooltip|listener | 41,384 | <p>I assume you didn't write a custom <code>CellRenderer</code> for the path but just use the <code>DefaultTableCellRenderer</code>. You should subclass the <code>DefaultTableCellRenderer</code> and set the tooltip in the <code>getTableCellRendererComponent</code>. Then set the renderer for the column.</p>
<pre><code>... |
10,413,350 | Date Conversion from String to sql Date in Java giving different output? | <p>I have a string form of Date. I have to change it to Sql Date. so for that i have used the following code. </p>
<pre><code>String startDate="01-02-2013";
SimpleDateFormat sdf1 = new SimpleDateFormat("dd-mm-yyyy");
java.util.Date date = sdf1.parse(startDate);
java.sql.Date sqlStartDate = new java.sql.Date(date.getTi... | 10,413,391 | 5 | 1 | null | 2012-05-02 12:03:40.757 UTC | 5 | 2018-07-23 14:44:19.497 UTC | 2014-01-21 07:33:29.03 UTC | null | 1,506,203 | null | 1,324,419 | null | 1 | 30 | java|date|type-conversion | 131,125 | <p><code>mm</code> is <em>minutes</em>. You want <code>MM</code> for <em>months</em>:</p>
<pre><code>SimpleDateFormat sdf1 = new SimpleDateFormat("dd-MM-yyyy");
</code></pre>
<p>Don't feel bad - this exact mistake comes up a lot.</p> |
10,419,747 | TaskCompletionSource - Trying to understand threadless async work | <p>I'm trying to understand the purpose of <code>TaskCompletionSource</code> and its relation to async/threadless work. I think I have the general idea but I want to make sure my understanding is correct. </p>
<p>I first started looking into the Task Parallel Library (TPL) to figure out if there was a good way to crea... | 10,420,085 | 2 | 1 | null | 2012-05-02 18:40:04.227 UTC | 25 | 2020-04-09 06:52:42.553 UTC | 2017-01-28 17:19:48.437 UTC | null | 1,438,397 | null | 127,954 | null | 1 | 36 | asynchronous|task-parallel-library | 21,278 | <p><code>TaskCompletionSource</code> is used to create <code>Task</code> objects that don't execute code.</p>
<p>They're used quite a bit by Microsoft's new async APIs - any time there's I/O-based asynchronous operations (or other non-CPU-based asynchronous operations, like a timeout). Also, any <code>async Task</code... |
22,922,155 | PostgreSQL/JDBC and TIMESTAMP vs. TIMESTAMPTZ | <p>I've been going through a lot of pain dealing with Timestamps lately with JPA. I have found that a lot of my issues have been cleared up by using TIMESTAMPTZ for my fields instead of TIMESTAMP. My server is in UTC while my JVM is in PST. It seems almost impossible with JPA to normalize on UTC values in the database ... | 22,922,391 | 4 | 1 | null | 2014-04-07 20:14:19.663 UTC | 11 | 2021-08-03 20:29:05.71 UTC | null | null | null | null | 1,888,440 | null | 1 | 28 | postgresql|jpa|jdbc | 17,601 | <p>You could use it to represent what Joda-Time and the new Java 8 time APIs call a <code>LocalDateTime</code>. A <code>LocalDateTime</code> doesn't represent a precise point on the timeline. It's just a set of fields, from year to nanoseconds. It is "a description of the date, as used for birthdays, combined with the ... |
22,989,339 | multiple worker/web processes on a single heroku app | <p>Is there some way to configure multiple worker and/or web processes to run in the single Heroku app container? Or does this have to be broken up into multiple Heroku apps?</p>
<p>For example:</p>
<pre><code>worker: node capture.js
worker: node process.js
worker: node purge.js
web: node api.js
web: node web.js
</co... | 22,991,644 | 1 | 1 | null | 2014-04-10 13:22:39.33 UTC | 14 | 2014-04-10 17:19:51.813 UTC | null | null | null | null | 877,151 | null | 1 | 44 | node.js|heroku|multiple-instances|worker | 22,569 | <p>All processes must have unique names. <strike>Additionally, the names <code>web</code> and <code>worker</code> are insignificant and carry no special meaning.</strike> The only process that carries a significant name is the <code>web</code> process, as stated in the Heroku docs:</p>
<blockquote>
<p>The web proces... |
31,296,545 | Correct handling of NSJSONSerialization (try catch) in Swift (2.0)? | <p>arowmy init works fine in Swift < 2 but in Swift 2 I get a error message from Xcode <code>Call can throw, but it is not marked with 'try' and the error is not handled</code> at <code>let anyObj = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers) as! [String:AnyObject]</... | 31,296,955 | 3 | 4 | null | 2015-07-08 15:03:16.623 UTC | 7 | 2017-07-06 16:02:45.18 UTC | 2017-06-29 17:11:27.207 UTC | null | 1,033,581 | null | 982,011 | null | 1 | 30 | ios|swift | 31,541 | <p>The <code>jsonObject</code> can <code>throw</code> errors, so put it within <code>do</code> block, use <code>try</code>, and <code>catch</code> any errors thrown. In Swift 3:</p>
<pre><code>do {
let anyObj = try JSONSerialization.jsonObject(with: data) as! [String: Any]
let label = anyObj["label"] as! Stri... |
36,876,770 | CSS - What is best to use for this case (px, %, vw, wh or em)? | <p>I am using Ionic 2 for the development of an app and I need to preview the app in different sizes.</p>
<p>Currently, I am using <code>vw</code> in all the sizes including <code>font-size</code>, <code>padding</code> and so on, but when resizing the font it sometimes becomes a bit small and even sometimes the text i... | 36,876,937 | 3 | 2 | null | 2016-04-26 22:15:36.96 UTC | 12 | 2020-06-17 07:17:34.727 UTC | 2020-06-17 07:17:34.727 UTC | null | 12,860,895 | null | 6,101,493 | null | 1 | 19 | html|css|ionic2 | 41,682 | <p>Note that I only mentioned the ones you asked about.</p>
<p>Here you can see the full list of CSS measurement units: <a href="http://www.w3schools.com/cssref/css_units.asp" rel="noreferrer">CSS Units in W3Schools</a></p>
<p>Rather than telling you which one is the "right one", I would rather want you to understand... |
3,815,447 | Does rake db:schema:dump recreate schema.rb from migrations or the database itself? | <p>Does</p>
<pre><code>rake db:schema:dump
</code></pre>
<p>recreate <code>schema.rb</code> from migrations or the database itself?</p> | 3,815,807 | 1 | 0 | null | 2010-09-28 17:30:12.327 UTC | 16 | 2020-03-19 14:32:28.68 UTC | 2014-10-28 21:21:18.367 UTC | null | 2,202,702 | null | 341,878 | null | 1 | 68 | ruby-on-rails|schema|migration|rake | 52,287 | <p>The answer is simple: from the database.</p>
<p>By the way - when you <a href="https://github.com/rails/rails/blob/master/activerecord/lib/active_record/railties/databases.rake" rel="noreferrer">take a look into the source code of db:* tasks</a> you can see that migration tasks calls schema:dump after the run</p>
... |
21,203,402 | CSS not loading in Spring Boot | <p>I am new to spring frame work and spring boot.I am trying to add the static html file with CSS,javascript,js. the file structure is</p>
<p><img src="https://i.stack.imgur.com/bNei4.png" alt="PROJECT STRUCTURE"></p>
<p>and my html file head looks like this </p>
<pre><code><html xmlns:th="http://www.thymeleaf.o... | 22,951,140 | 8 | 2 | null | 2014-01-18 11:22:51.437 UTC | 13 | 2021-04-13 03:41:22.647 UTC | null | null | null | null | 2,018,328 | null | 1 | 29 | spring|spring-mvc|spring-boot | 87,444 | <p>You need to put your css in <code>/resources/static/css</code>. This change fixed the problem for me. Here is my current directory structure.</p>
<pre><code>src
main
java
controller
WebAppMain.java
resources
views
index.html
static
css
index.css
... |
1,754,315 | How to create custom exceptions in Java? | <p>How do we create custom exceptions in Java?</p> | 1,754,473 | 3 | 3 | null | 2009-11-18 07:59:37.657 UTC | 35 | 2016-09-10 18:07:14.117 UTC | 2016-09-10 18:07:14.117 UTC | null | 4,922,375 | null | 96,180 | null | 1 | 153 | java|exception | 271,065 | <p>To define a <strong>checked</strong> exception you create a subclass (or hierarchy of subclasses) of <a href="http://java.sun.com/javase/7/docs/api/java/lang/Exception.html" rel="noreferrer"><code>java.lang.Exception</code></a>. For example:</p>
<pre><code>public class FooException extends Exception {
public Foo... |
19,606,275 | IPython: How to wipe IPython's history selectively & securely? | <p>I have been learning how to use the <code>paramiko</code> package only to discover that all I stored passwords in plain text in IPython's <code>%hist</code>. Not so good.</p>
<p>I therefore need to get rid of particular parts of what is stored in <code>%hist</code>. Saying that, I do not want to wipe the <em>whole ... | 19,606,820 | 6 | 1 | null | 2013-10-26 11:43:03.783 UTC | 8 | 2019-12-02 17:40:17.127 UTC | null | null | null | null | 1,186,019 | null | 1 | 40 | ipython|ipython-notebook | 18,260 | <p>History is store on <code>$(ipython locate)/profile_default/history.sqlite</code> by default.
You can remove the file, and or do any operation you want on it (secure erase, etc..).
It's an sqlite file so you can load it with any sqlite program and do query on it.</p>
<p>Check in <code>$(ipython locate)/profile_de... |
87,892 | What is the status of POSIX asynchronous I/O (AIO)? | <p>There are pages scattered around the web that describe POSIX AIO facilities in varying amounts of detail. None of them are terribly recent. It's not clear what, exactly, they're describing. For example, the "official" (?) <a href="http://lse.sourceforge.net/io/aio.html" rel="noreferrer">web site for Linux kernel ... | 88,607 | 4 | 0 | null | 2008-09-17 21:32:25.49 UTC | 57 | 2018-05-03 19:51:18.14 UTC | 2018-05-03 19:51:18.14 UTC | null | 13,564 | Glyph | 13,564 | null | 1 | 99 | linux|asynchronous|posix|bsd|aio | 26,264 | <p>Network I/O is not a priority for AIO because everyone writing POSIX network servers uses an event based, non-blocking approach. The old-style Java "billions of blocking threads" approach sucks horribly.</p>
<p>Disk write I/O is already buffered and disk read I/O can be prefetched into buffer using functions like ... |
22,155,882 | PHP CURL Download File | <p>im trying to download a file from a url,
when I use the browser the download dialog works but when I use this code the new file on my server stay empty.</p>
<pre><code>$ch = curl_init();
$source = "https://myapps.gia.edu/ReportCheckPortal/downloadReport.do?reportNo=$row['certNo']&weight=$row['carat']";
curl_set... | 22,165,451 | 4 | 1 | null | 2014-03-03 19:46:05.487 UTC | 2 | 2021-03-25 01:10:09.58 UTC | 2014-08-14 04:40:28.72 UTC | null | 14,966 | null | 3,376,311 | null | 1 | 17 | php|file|curl|download | 80,469 | <p>I solved this problem using this:</p>
<pre><code>curl_setopt($ch, CURLOPT_SSLVERSION,3);
</code></pre>
<p>This is the final code:</p>
<pre><code>$source = "https://myapps.gia.edu/ReportCheckPortal/downloadReport.do?reportNo=1152872617&weight=1.35";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $source);
cu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.