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
17,146,497
Type of "this" in c++?
<pre><code>struct Foo { void f() { // (*) } }; </code></pre> <p>What is the type of "this" in the line marked with (*) ?</p> <p>Is it <strong>const Foo*</strong> or <strong>Foo*</strong> ?</p>
17,146,540
4
4
null
2013-06-17 11:33:20.123 UTC
9
2018-08-24 12:52:21.863 UTC
null
null
null
null
978,461
null
1
32
c++
2,822
<p>n3376 9.3.2/1</p> <p><Blockquote><P> In the body of a non-static (9.3) member function, <strong>the keyword this is a prvalue expression</strong> whose value is the address of the object for which the function is called.</p> <p><strong>The type of this in a member function of a class X is X*</strong>. If the membe...
17,274,130
Bootstrap Tooltip - Hide when another tooltip is click
<p>I hope someone can help.</p> <p>I'm trying to hide the tooltip when another tooltip icon is clicked. It works but when I decide to click the last tooltip again it 'flashes' the tooltip.</p> <pre><code>var Hastooltip = $('.hastooltip'); HasTooltip.on('click', function(e) { e.preventDefault(); HasTooltip.t...
17,281,854
10
4
null
2013-06-24 11:14:47.227 UTC
3
2022-09-22 18:21:06.29 UTC
2013-06-24 17:20:14.673 UTC
null
422,353
null
1,381,806
null
1
36
javascript|jquery|twitter-bootstrap|tooltip
67,090
<p>You need to check if the tooltip is showing and toggle its visibility manually. This is one way of doing it.</p> <pre><code>$(function() { var HasTooltip = $('.hastooltip'); HasTooltip.on('click', function(e) { e.preventDefault(); var isShowing = $(this).data('isShowing'); HasTooltip.removeData('is...
17,301,972
Projecting into KeyValuePair via EF / Linq
<p>I'm trying to load a list of KeyValuePairs from an EF / Linq query like this: </p> <pre><code>return (from o in context.myTable select new KeyValuePair&lt;int, string&gt;(o.columnA, o.columnB)).ToList(); </code></pre> <p>My problem is that this results in the error </p> <blockquote> <p>"Only parameterless con...
17,302,070
3
1
null
2013-06-25 15:53:33.343 UTC
4
2018-09-11 13:45:48.847 UTC
2018-09-11 13:45:48.847 UTC
null
5,947,043
null
543,538
null
1
42
c#|linq|entity-framework|projection|keyvaluepair
41,378
<p>Select only columnA and columnB from your table, and move further processing in memory:</p> <pre><code>return context.myTable .Select(o =&gt; new { o.columnA, o.columnB }) // only two fields .AsEnumerable() // to clients memory .Select(o =&gt; new KeyValuePair&lt;int, strin...
30,692,537
CoordinatorLayout ignores margins for views with anchor
<p>Given I'm using a layout like this:</p> <pre><code>&lt;android.support.design.widget.CoordinatorLayout android:id="@+id/main_content" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_...
30,694,035
7
2
null
2015-06-07 10:36:56.493 UTC
5
2022-03-13 19:58:08.12 UTC
null
null
null
null
375,209
null
1
30
android|android-support-library|androiddesignsupport
22,930
<p>As there might be <a href="https://code.google.com/p/android/issues/list?can=2&amp;q=CoordinatorLayout&amp;colspec=ID%20Type%20Status%20Owner%20Summary%20Stars&amp;cells=tiles" rel="nofollow">bugs</a> in the design-support-lib concerning the <code>CoordinatorLayout</code> &amp; margins, I wrote a <code>FrameLayout</...
18,679,020
Border around tr element doesn't show?
<p>It seems like Chrome/Firefox do not render borders on <code>tr</code>, but it renders the border if the selector is <code>table tr td</code>.</p> <p>How can I set a border on a tr ?</p> <p>My attempt, which doesn't work:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="fal...
18,679,047
3
1
null
2013-09-07 23:45:50.39 UTC
31
2022-09-19 13:31:33.26 UTC
2022-09-19 13:31:33.26 UTC
null
1,993,501
null
1,993,501
null
1
166
html|css|html-table
131,024
<p>Add this to the stylesheet:</p> <pre><code>table { border-collapse: collapse; } </code></pre> <p><a href="http://jsfiddle.net/ZKjAX/" rel="noreferrer">JSFiddle</a>.</p> <p>The reason why it behaves this way is actually described pretty well in <a href="http://www.w3.org/TR/CSS2/tables.html#borders" rel="norefer...
18,580,397
How to remove a key from a RethinkDB document?
<p>I'm trying to remove a key from a RethinkDB document. My approaches (which didn't work):</p> <pre><code>r.db('db').table('user').replace(function(row){delete row["key"]; return row}) </code></pre> <p>Other approach:</p> <pre><code>r.db('db').table('user').update({key: null}) </code></pre> <p>This one just sets...
18,580,552
3
0
null
2013-09-02 20:31:42.213 UTC
5
2017-12-29 23:59:54.347 UTC
2017-04-24 14:15:49.147 UTC
null
265,261
null
297,094
null
1
46
rethinkdb|rethinkdb-python
15,826
<p>Here's the relevant example from the documentation on RethinkDB's website: <a href="http://rethinkdb.com/docs/cookbook/python/#removing-a-field-from-a-document" rel="noreferrer">http://rethinkdb.com/docs/cookbook/python/#removing-a-field-from-a-document</a></p> <p>To remove a field from all documents in a table, yo...
26,074,784
How to make a view with rounded corners?
<p>I am trying to make a view in android with rounded edges. The solution I found so far is to define a shape with rounded corners and use it as the background of that view.</p> <p>Here is what I did, define a drawable as given below:</p> <p> </p> <pre><code>&lt;padding android:top="2dp" android:bottom="2dp"/&gt...
26,201,117
21
4
null
2014-09-27 12:41:53.347 UTC
39
2022-06-24 16:32:51.467 UTC
2020-02-28 07:35:06.31 UTC
null
6,138,892
null
623,401
null
1
116
android|android-layout|view|android-view|android-shape
155,995
<p>Another approach is to make a custom layout class like the one below. This layout first draws its contents to an offscreen bitmap, masks the offscreen bitmap with a rounded rect and then draws the offscreen bitmap on the actual canvas.</p> <p>I tried it and it seems to work (at least for my simple testcase). It wil...
5,365,566
Parse string to float number C#
<p>I have float number in string. there is one problem. Number uses "." not "," as decimal point.</p> <p>This code is not working:</p> <pre><code>MyNumber = float.Parse("123.5"); </code></pre> <p>I know that I can use string replace function to "repair" this string before Parsing.</p> <pre><code>MyNumber = float.Pa...
5,365,939
3
0
null
2011-03-19 23:14:16.91 UTC
1
2013-07-06 15:03:50.117 UTC
2012-06-04 15:26:48.853 UTC
null
44,390
null
465,408
null
1
12
c#|.net|string|parsing|floating-point
44,980
<p>To add to Steven's question, rather than argue differently, the important thing is <em>why</em> the decimal separator is <code>.</code>.</p> <p>If it's because the source is in a computer-readable format where the period decimal separator is specified as part of the document specification, then I'd go precisely as ...
18,643,457
How do I add a class to an @Html.ActionLink?
<p>I have two <code>@Html.ActionLink's</code> that I want to make look like buttons. I'm able to make this happen with <code>CSS</code> but only if I use the #ID of the actionlink to apply the <code>CSS</code>. I want to assign a class to the action links but when I do using the code below I get an error saying I have...
18,643,539
5
3
null
2013-09-05 18:29:46.763 UTC
8
2020-04-16 05:38:48.477 UTC
2014-10-15 09:05:25.45 UTC
null
542,251
null
1,018,705
null
1
26
css|asp.net-mvc|razor
89,004
<p>You have to use the <code>@</code> character, since class is a keyword in C#. Here's a link to the MSDN documentation: <a href="http://msdn.microsoft.com/en-us/library/dd492124(v=vs.108).aspx">http://msdn.microsoft.com/en-us/library/dd492124(v=vs.108).aspx</a></p> <pre><code>@Html.ActionLink("Link Text", "ActionNam...
18,548,156
How to copy the conditional formatting without copying the rules from a Conditional Formatted cell?
<p>I have a row of data with conditional formatting in it.</p> <p>I need to copy this row to another row. This new row must be identical (values, formats), but static, i.e. without the rules. If I copy and paste the row and clear the rules, the formatting from the CF rule vanishes.</p> <p>Is it possible?</p>
26,157,745
8
5
null
2013-08-31 12:31:36.403 UTC
5
2021-04-05 09:36:59.553 UTC
2016-12-21 22:21:46.39 UTC
null
2,359,271
null
1,845,356
null
1
29
excel
77,084
<p>Just discovered an easy way: <strong>Copy the table to MS Word and copy it back to excel :D</strong></p> <hr> <p>It worked perfectly for me.</p>
18,444,194
Cutting the videos based on start and end time using ffmpeg
<p>I tried to cut the video using the start and end time of the video by using the following command</p> <pre><code>ffmpeg -ss 00:00:03 -t 00:00:08 -i movie.mp4 -acodec copy -vcodec copy -async 1 cut.mp4 </code></pre> <p>By using the above command i want to cut the video from <code>00:00:03</code> to <code>00:00:08</co...
18,449,609
13
7
null
2013-08-26 12:34:19.137 UTC
355
2022-06-21 21:03:18.29 UTC
2021-12-07 03:54:07.367 UTC
null
162,698
null
788,891
null
1
852
video|ffmpeg|video-editing
789,198
<p>You probably do not have a keyframe at the 3 second mark. Because non-keyframes encode differences from other frames, they require all of the data starting with the previous keyframe.</p> <p>With the mp4 container it is possible to cut at a non-keyframe without re-encoding using an edit list. In other words, if t...
15,339,143
Eclipse Run button doesn't work when Android xml file is selected
<p>I have Eclipse Juno SR1 and Android SDK Tools 21.1, SDK Platform-tools 16.0.2 (latest) on Mac.</p> <p>When I have some XML file selected and hit Run button, nothing happens. I have to select some Java File or project in the Package Explorer. Then it runs. It's quite annoying when I edit XML files. It was working in...
15,339,199
1
0
null
2013-03-11 12:55:44.507 UTC
2
2013-03-11 13:03:36.923 UTC
null
null
null
null
560,358
null
1
37
android|eclipse|android-xml|android-sdk-tools
6,520
<p>I think its due to some recent changes in <strong>ADT 21.1.0</strong>. Anyhow, to resolve this, you may configure the following in Eclipse:</p> <blockquote> <p><kbd>Window</kbd> -> <kbd>Preferences</kbd> -> <kbd>Run/Debug</kbd> -> <kbd>Launching</kbd> -> (under Launch Operations) <strong>Always launch the pre...
15,111,408
How does sklearn.svm.svc's function predict_proba() work internally?
<p>I am using <a href="http://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html" rel="noreferrer">sklearn.svm.svc</a> from <a href="http://scikit-learn.org/stable/" rel="noreferrer">scikit-learn</a> to do binary classification. I am using its predict_proba() function to get probability estimates. Can any...
15,112,563
2
0
null
2013-02-27 11:50:57.28 UTC
34
2014-02-07 01:09:35.147 UTC
2013-02-27 12:21:08.757 UTC
null
1,067,887
null
2,115,183
null
1
46
python|svm|scikit-learn
37,931
<p>Scikit-learn uses LibSVM internally, and this in turn uses <a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.41.1639" rel="noreferrer">Platt scaling</a>, as detailed in <a href="http://www.csie.ntu.edu.tw/~cjlin/papers/plattprob.pdf" rel="noreferrer">this note by the LibSVM authors</a>, to calibrate t...
28,307,237
Spring Could not Resolve placeholder
<p>I'm fairly new to spring so excuse me if this is a dumb question. When I try to launch a program I get the following error: <code>java.lang.IllegalArgumentException: Could not resolve placeholder 'appclient' in string value [${appclient}]</code>. The error is thrown when the following code is executed:</p> <pre><co...
28,307,313
9
3
null
2015-02-03 19:34:01.153 UTC
11
2022-05-24 21:57:04.773 UTC
null
null
null
null
1,272,809
null
1
35
java|spring
206,300
<p>You are not reading the properties file correctly. The propertySource should pass the parameter as: <code>file:appclient.properties</code> or <code>classpath:appclient.properties</code>. Change the annotation to:</p> <pre><code>@PropertySource(value={"classpath:appclient.properties"}) </code></pre> <p>However I do...
9,575,652
OpenCV using k-means to posterize an image
<p>I want to posterize an image with k-means and OpenCV in C++ interface (cv namespace) and I get weird results. I need it for reduce some noise. This is my code:</p> <pre><code>#include &quot;cv.h&quot; #include &quot;highgui.h&quot; using namespace cv; int main() { Mat imageBGR, imageHSV, planeH, planeS, planeV...
9,608,527
3
9
null
2012-03-05 23:22:38.96 UTC
11
2022-05-06 10:21:48.367 UTC
2020-06-20 09:12:55.06 UTC
null
-1
null
433,685
null
1
18
c++|image-processing|opencv|k-means|noise-reduction
34,320
<p>I am no expert in OpenCV so I will give a general advice that relates to your question K-means takes list of vectors which is essentially a matrix:</p> <pre><code>[x0, y0, r0, g0, b0] [x1, y1, r1, g1, b1] [x2, y2, r2, g2, b2] . . . </code></pre> <p>You are giving it an image which is not going to work. You first h...
8,777,359
error: subscripted value is neither array nor pointer nor vector in C
<pre><code>the_project.c:73:22: error: subscripted value is neither array nor pointer nor vector </code></pre> <p>it gives the error above and the line 73 is the following.</p> <pre><code>customer_table[my_id][3] = worker_no; </code></pre> <p>I declared the array global as follows</p> <pre><code>int *customer_tabl...
8,777,392
2
3
null
2012-01-08 12:07:59.05 UTC
1
2012-01-08 12:27:52.85 UTC
2012-01-08 12:27:52.85 UTC
null
1,023,815
null
1,002,790
null
1
2
c|arrays|pointers
43,455
<p>You're declaring a <code>pointer-to-int</code>. So <code>cutomer_table[x]</code> is an int, not a pointer. If you need a two-dimensional, dynamically allocated array, you'll need a:</p> <pre><code>int **customer_table; </code></pre> <p>and you'll need to be very careful with the allocation.</p> <p>(See e.g. <a hr...
5,078,752
Magento ->addCategoryFilter - filtering product collection by root category
<p>Concerning the use of the <strong>->addCategoryFilter</strong> on a product collection. Why is it not possible to filter by the root category? I have 2 stores, both with different root categories. I want to show a list of best-selling products on my homepage. But I can't filter the products by the root category, onl...
8,480,433
5
1
null
2011-02-22 13:29:03.257 UTC
2
2014-06-24 18:43:39.82 UTC
2011-03-21 16:25:57.527 UTC
null
161,056
null
161,056
null
1
6
magento
67,464
<p>OK, I think this works, haven't tested too much but seems to have done the trick. You need to first get your stores root category id, then join some fields so you have access to the products "category_id", then filter using that:</p> <pre><code>$_rootcatID = Mage::app()-&gt;getStore()-&gt;getRootCategoryId(); $_te...
4,844,498
Rails 3 Finding day of week
<p>I'm trying to make my own calendar because i cant seem to get any help with event calendar so what im trying to do is Display the day of the week ie.. January 1 2011 is a Saturday is there an easy command to get that day or do i need something else </p>
4,844,526
6
0
null
2011-01-30 17:58:19.52 UTC
8
2021-10-04 09:45:29.42 UTC
null
null
null
null
570,483
null
1
72
ruby-on-rails-3
53,754
<p>Can't you use <a href="http://www.ruby-doc.org/core/classes/Time.html#M000369" rel="noreferrer">time.wday</a>, 0 = sunday and so on</p>
5,009,096
Files showing as modified directly after a Git clone
<p>I'm having an issue with a repository at the moment, and though my Git-fu is usually good, I can't seem to solve this issue.</p> <p>When I clone this repository, then <code>cd</code> into the repository, <code>git status</code> shows several files as changed. Note: I haven't opened the repository in any editor or a...
5,022,417
19
0
null
2011-02-15 20:24:49.883 UTC
73
2021-04-22 14:33:35.797 UTC
2019-04-23 20:06:15.703 UTC
null
63,550
null
261,393
null
1
254
git|git-clone
110,603
<p>I got it. All the other developers are on Ubuntu (I think) and thus have case-sensitive file systems. I, however, do not (as I'm on a Mac). Indeed, all the files had lowercase twins when I took a look at them using <code>git ls-tree HEAD &lt;path&gt;</code>.</p> <p>I'll get one of them to sort it out.</p>
29,625,912
Draw custom line between two elements in TableLayout Android
<p>I have an activity with events organised in a timeline. But it looks ugly. </p> <p><img src="https://i.stack.imgur.com/SOsdI.png" alt="enter image description here"></p> <p>I want to design a more beautiful timeline like this one. <img src="https://i.stack.imgur.com/IJCaV.png" alt="enter image description here"></...
29,627,491
2
9
null
2015-04-14 11:14:00.833 UTC
9
2016-09-19 01:30:20.1 UTC
2015-04-14 11:37:48.05 UTC
null
4,506,376
null
4,506,376
null
1
4
android|timeline
7,557
<p>You may have to create your own <strong>custom adapter</strong> but I am using array adapter for your reference. Also giving item layout for list view, hope you will manage your <strong>code</strong> accordingly.</p> <p><img src="https://i.stack.imgur.com/mCBrO.png" alt="list-items"></p> <p><strong>items.xml</stro...
12,343,187
Should I run Tomcat by itself or Apache + Tomcat?
<p>I was wondering if it would be okay to run Tomcat as both the web server and container? On the other hand, it seems that the right way to go about scaling your webapp is to use Apache HTTP listening on port 80 and connecting that to Tomcat listening on another port? Are both ways acceptable? What is being used nowda...
12,343,443
2
0
null
2012-09-09 21:35:01.567 UTC
9
2012-09-09 22:16:28.303 UTC
null
null
null
null
560,204
null
1
11
apache|tomcat
7,658
<p>Placing an Apache (or any other webserver) in front of your application server(s) (Tomcat) is a good thing for a number of reasons.</p> <p>First consideration is about static resources and caching. </p> <p>Tomcat will probably serve also a lot of static content, or even on dynamic content it will send some caching...
12,350,413
Google maps auto-fit (auto center & autozoom) doesn't work
<p>I have a problem with a map on which I've used the <code>fitBounds</code> map methods, which should give the proper zoom and center the map giving it a latlon array. here's the code:</p> <pre><code>&lt;script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"&gt; &lt;/script&gt; ...
12,351,178
1
2
null
2012-09-10 11:09:08.453 UTC
6
2016-02-04 04:37:00.543 UTC
2016-02-04 04:37:00.543 UTC
null
2,405,040
null
998,967
null
1
19
javascript|google-maps|google-maps-api-3|google-maps-markers
40,906
<p>I've updated your fiddle here: <a href="http://jsfiddle.net/KwayW/1/" rel="noreferrer">http://jsfiddle.net/KwayW/1/</a></p> <p>It works now as expected.</p> <p>Here's the full code (save this as test.html and open in browser):</p> <pre><code>&lt;style&gt;#map_canvas { width:500px; height: 400px; }&lt;/style&gt; &...
12,152,519
Removing XML Nodes using XSLT
<p>I have the following XML:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;Rowsets&gt; &lt;Rowset&gt; &lt;Columns&gt; &lt;Column Description="FirstName" MaxRange="1" MinRange="0" Name="FirstName" SQLDataType="12" SourceColumn="FirstName"/&gt; &lt;Column Description="LastName" MaxR...
12,152,983
1
0
null
2012-08-28 03:51:23.963 UTC
2
2016-04-12 13:25:55.803 UTC
2016-04-12 13:25:55.803 UTC
null
105,672
null
1,481,396
null
1
22
xml|xslt
40,615
<pre><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; &lt;xsl:output method="xml" indent="yes"/&gt; &lt;xsl:strip-space elements="*" /&gt; &lt;xsl:template match="@*|node()"&gt; &lt;xsl:copy&gt; &lt;xsl:apply-templates select="@*|node()"/&gt; &lt;/xsl:copy&gt; &lt;/xsl:te...
12,236,533
Migrating from ASP.NET Membership to SimpleMembership in MVC4 RTM
<p>The new MVC4 RTM internet application templates use the SimpleMembership providers as descibed here <a href="http://weblogs.asp.net/jgalloway/archive/2012/08/29/simplemembership-membership-providers-universal-providers-and-the-new-asp-net-4-5-web-forms-and-asp-net-mvc-4-templates.aspx/">SimpleMembership</a></p> <p>...
13,446,014
3
2
null
2012-09-02 13:56:26.73 UTC
16
2015-09-24 04:47:07.91 UTC
null
null
null
null
409,176
null
1
27
asp.net|asp.net-mvc|asp.net-mvc-3|asp.net-membership|asp.net-mvc-4
11,189
<p>I'd like to surface Paul's comment in case anyone misses it and suggest his solution is the best I've seen. </p> <p><a href="http://pretzelsteelersfan.blogspot.com/2012/11/migrating-legacy-apps-to-new.html">http://pretzelsteelersfan.blogspot.com/2012/11/migrating-legacy-apps-to-new.html</a></p> <p>Thanks Paul</p>
12,145,772
Do nullable columns occupy additional space in PostgreSQL?
<p>I have a table with 7 columns and 5 of them will be null. I will have a null columns on <code>int</code>, <code>text</code>, <code>date</code>, <code>boolean</code>, and <code>money</code> data types. This table will contain millions of rows with many many nulls. I am afraid that the null values will occupy space.</...
12,147,130
3
0
null
2012-08-27 16:23:06.137 UTC
9
2020-08-21 01:54:54.817 UTC
2014-12-15 01:52:04.94 UTC
null
939,860
null
184,773
null
1
29
postgresql|database-design|indexing|null
9,055
<p>Basically, <code>NULL</code> values occupy <strong>1 bit</strong> in the NULL bitmap. But it's not that simple.</p> <p>The <strong>null bitmap</strong> (per row) is only allocated if at least one column in that row holds a <code>NULL</code> value. This can lead to a seemingly paradoxic effect in tables with 9 or mor...
12,594,541
NPM global install "cannot find module"
<p>I wrote a module which I published to npm a moment ago (https://npmjs.org/package/wisp)</p> <p>So it installs fine from the command line:</p> <p><code>$ npm i -g wisp</code></p> <p>However, when I run it from the command line, I keep getting an error that optimist isn't installed:</p> <pre><code>$ wisp Error: C...
14,515,868
19
8
null
2012-09-26 04:25:59 UTC
65
2021-12-29 01:26:58.093 UTC
2012-09-26 07:44:51.65 UTC
null
1,258,398
null
1,258,398
null
1
237
node.js|npm
342,927
<p>For anyone else running into this, I had this problem due to my <code>npm</code> installing into a location that's not on my <code>NODE_PATH</code>.</p> <pre><code>[root@uberneek ~]# which npm /opt/bin/npm [root@uberneek ~]# which node /opt/bin/node [root@uberneek ~]# echo $NODE_PATH </code></pre> <p>My NODE_PATH ...
3,623,754
What are the different techniques for memoization in Java?
<p>I know of this one <a href="http://onjava.com/pub/a/onjava/2003/08/20/memoization.html" rel="noreferrer">http://onjava.com/pub/a/onjava/2003/08/20/memoization.html</a> but is there anything else?</p>
3,624,099
3
1
null
2010-09-02 04:08:27.16 UTC
17
2017-06-26 10:25:52.073 UTC
2012-06-13 12:32:11.493 UTC
null
1,135,954
null
437,552
null
1
24
java|memoization
20,355
<p>Memoization is also easy with plain simple typesafe Java.</p> <p>You can do it from scratch with the following reusable classes.</p> <p>I use these as caches whose lifespan are the request on a webapp.</p> <p>Of course use the Guava <code>MapMaker</code> if you need an eviction strategy or more features like sync...
3,486,055
Android find GPS location once, show loading dialog
<p>I am writing an app that requires the user's current location (lastknownlocation won't be very helpful) and displays a list of all the closest "items" to them taken from the database.</p> <p>I have got the finding of the closest items working well but only using a hardcoded latitude and longitude location for the t...
3,486,245
3
1
null
2010-08-15 03:15:30.61 UTC
17
2011-09-15 05:24:33.31 UTC
2011-09-07 15:03:59.817 UTC
null
387,317
null
387,317
null
1
26
android|gps|progressdialog|locationlistener
43,849
<p>Use an <strong>AsyncTask</strong> and use <strong>both network_provider as well as gps_provider</strong>, which means two listeners. gps takes longer to get a fix, maybe sometimes a minute and only works outdoors, while network gets a location pretty fast.</p> <p>A good code example is here: <a href="https://stacko...
3,465,377
what's the use of string.Clone()?
<p>there are 2 examples of code: # 1</p> <pre><code> string str1 = "hello"; string str2 = str1; //reference to the same string str1 = "bye"; //new string created </code></pre> <p>and # 2</p> <pre><code>string str3 = "hello"; string str4 = (string)str3.Clone();//reference to the same string str3 = "bye";//new str...
3,465,401
3
0
null
2010-08-12 06:59:49.937 UTC
2
2020-10-23 17:10:17.083 UTC
2010-08-13 07:57:24.963 UTC
null
352,898
null
352,898
null
1
32
c#|.net|string|.net-2.0
20,219
<p>This is useful since string implements <em>ICloneable</em>, so you can create a copy of clones for a collection of <em>ICloneable</em> items. This is boring when the collection is of strings only, but it's useful when the collection contains multiple types that implement <em>ICloneable</em>.</p> <p>As for copying a...
8,953,424
How to get the username in C/C++ in Linux?
<p>How can I get the actual &quot;username&quot; without using the environment (<code>getenv</code>, ...) in a program? Environment is C/C++ with Linux.</p>
8,953,466
6
13
null
2012-01-21 13:39:59.58 UTC
10
2021-07-05 14:01:52.537 UTC
2021-02-23 13:54:02.823 UTC
null
5,779,732
null
1,162,308
null
1
43
c++|c|linux|posix
105,554
<p>The function <strong><code>getlogin_r()</code></strong> defined in <code>unistd.h</code> returns the username. See <code>man getlogin_r</code> for more information.</p> <p>Its signature is:</p> <pre><code>int getlogin_r(char *buf, size_t bufsize); </code></pre> <p>Needless to say, this function can just as easily...
20,671,303
Bootstrap 3 changing div order on small screens only
<p>Doing my 1st responsive design and is something like this possible in Bootstrap 3. Change this <a href="https://i.stack.imgur.com/lABXp.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lABXp.jpg" alt=""></a></p> <p>To</p> <p><a href="https://i.stack.imgur.com/nm3ra.jpg" rel="nofollow noreferrer">...
20,672,273
6
4
null
2013-12-19 00:25:12.093 UTC
11
2020-06-23 07:54:31.913 UTC
2019-02-02 14:47:35.713 UTC
null
10,607,772
null
589,961
null
1
22
css|twitter-bootstrap|sorting|mobile
73,772
<h1>DEMO: <a href="http://jsbin.com/uZiKAha/1" rel="noreferrer">http://jsbin.com/uZiKAha/1</a></h1> <h3>DEMO w/edit: <a href="http://jsbin.com/uZiKAha/1/edit" rel="noreferrer">http://jsbin.com/uZiKAha/1/edit</a></h3> <p>Yes, this can be done without JS using BS3 nesting and pushing/pulling and all the floats clear:</p>...
26,101,774
How to trim off Image in CSS?
<p>Ok, here is the problem, my app allow users to insert any image. It is up to them insert very big or very long image. But when I rentder image I want the <code>width="50px"</code> and <code>height="100px"</code>.</p> <p>ok if I do</p> <pre><code>.myImage{ width:50px; height:100px; } </code></pre> <p>then th...
26,102,029
5
5
null
2014-09-29 14:03:52.203 UTC
1
2014-09-29 14:21:07.677 UTC
null
null
null
null
2,336,037
null
1
8
html|css
44,013
<p>1) Trim image with <code>&lt;div&gt;</code> and <code>overflow:hidden</code>:</p> <pre><code> div.trim { max-height:100px; max-width: 50px; overflow: hidden; } &lt;div class="trim"&gt;&lt;img src="veryBigImage.png"/&gt;&lt;/div&gt; </code></pre> <p>2) Use <code>max-width: 50px;</code> and <code>m...
48,187,362
How to iterate using ngFor loop Map containing key as string and values as map iteration
<p>I am new to angular 5 and trying to iterate the map containing another map in typescript. How to iterate below this kind of map in angular below is code for component:</p> <pre><code>import { Component, OnInit} from '@angular/core'; @Component({ selector: 'app-map', templateUrl: './map.component.html', sty...
48,187,637
6
6
null
2018-01-10 12:19:48.87 UTC
20
2022-07-01 08:58:08.19 UTC
2020-05-24 13:46:44.48 UTC
null
2,349,407
null
8,744,067
null
1
160
javascript|angular|typescript|angular-cli
172,948
<p><strong>For Angular 6.1+</strong> , you can use default pipe <strong><a href="https://angular.io/api/common/KeyValuePipe" rel="noreferrer"><code>keyvalue</code></a></strong> ( <a href="https://stackoverflow.com/a/52532564/2349407"><strong>Do review and upvote also</strong></a> ) :</p> <pre><code>&lt;ul&gt; &lt;...
12,822,420
iOS: How to use MPMoviePlayerController
<p>I've created a blank project (iOS) and put this in my viewDidLoad:</p> <pre><code>NSString *moviePath = [[NSBundle mainBundle] pathForResource:@"Movie" ofType:@"m4v"]; MPMoviePlayerViewController *playerController = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:moviePath]]; [self pr...
12,950,958
4
2
null
2012-10-10 14:59:15.123 UTC
13
2017-07-30 00:22:10.007 UTC
null
null
null
null
1,147,286
null
1
30
objective-c|ios|video|mpmovieplayercontroller|avfoundation
70,163
<p>Turns out all we have to do is this:</p> <pre><code>NSURL *movieURL = [NSURL URLWithString:@"http://example.com/somefile.mp4"]; movieController = [[MPMoviePlayerViewController alloc] initWithContentURL:movieURL]; [self presentMoviePlayerViewControllerAnimated:movieController]; [movieController.moviePlayer play]; </...
12,700,145
Format telephone and credit card numbers in AngularJS
<p><strong>Question one (formatting telephone number):</strong></p> <p>I'm having to format a telephone number in AngularJS but there is no filter for it. Is there a way to use filter or currency to format 10 digits to <code>(555) 555-5255</code>? and still preserve the data type of the field as integer?</p> <p><stro...
12,728,924
17
2
null
2012-10-02 23:59:40.16 UTC
33
2017-08-31 06:20:50.197 UTC
2015-04-25 14:51:12.013 UTC
null
3,621,464
null
1,607,197
null
1
69
angularjs|number-formatting
135,891
<p>Also, if you need to format telephone number on output only, you can use a custom filter like this one:</p> <pre><code>angular.module('ng').filter('tel', function () { return function (tel) { if (!tel) { return ''; } var value = tel.toString().trim().replace(/^\+/, ''); if (value.match...
12,715,340
Using Directives Sorted in Wrong Order
<p>I'm using the Power Commands extension with Visual Studio 2012. I have the option checked to remove and sort usings on save. The problem is that the System.Xxx directives are being sorted last, and that's causing a style analysis error:</p> <blockquote> <p>SA1208: System using directives must be placed before all...
12,715,422
1
3
null
2012-10-03 19:20:24.603 UTC
11
2016-01-20 18:32:31.347 UTC
2016-01-20 18:32:31.347 UTC
null
2,642,204
null
279,516
null
1
71
c#|visual-studio-2012|powercommands
16,940
<p>Goto the "Quick Launch" (Ctrl+Q) and type "using" and press <code>Enter</code>.</p> <p>Then change the following setting:</p> <p><img src="https://i.stack.imgur.com/twb5T.png" alt="Using Sorting option"></p> <p>It's an annoying default setting, I have no idea why Microsoft chose that, it goes against all previous...
13,051,428
How to display images in Markdown files on Github?
<p>I want to display some images in a Markdown file on Github. I found it works this way:</p> <pre><code>![Figure 1-1](https://raw.github.com/username/repo/master/images/figure 1-1.png "Figure 1-1") </code></pre> <p>But i need to collaborate with others so i don't want the username and repo name hard coded .</p> <p>...
13,063,862
2
0
null
2012-10-24 14:35:15.21 UTC
31
2021-03-14 08:01:31.297 UTC
2019-11-19 10:16:37.987 UTC
null
1,536,976
null
802,585
null
1
93
github|markdown
77,868
<p>I found the answer myself.</p> <p>Just simply append <strong>?raw=true</strong> to the image url will make the trick:</p> <pre><code>![](images/table 1-1.png?raw=true) </code></pre>
30,325,042
How to compare two JSON strings when the order of entries keep changing
<p>I have a string like - <code>{"state":1,"cmd":1}</code> , I need to compare this with generated output but in the generated output the order keeps changing i.e. sometimes its <code>{"state":1,"cmd":1}</code> other times its <code>{"cmd":1,"state":1}</code>. </p> <p>Currently I was using <code>equals()</code> method...
30,325,551
4
11
null
2015-05-19 12:00:52.673 UTC
4
2015-05-19 13:22:39.98 UTC
2015-05-19 13:22:39.98 UTC
null
67,579
null
4,688,819
null
1
16
java|string|equals|json
68,518
<p><a href="http://jackson.codehaus.org">Jackson Json parser</a> has a nice feature that it can parse a Json String into a Map. You can then query the entries or simply ask on equality: </p> <pre><code>import com.fasterxml.jackson.databind.ObjectMapper; import java.util.*; public class Test { public static void...
17,119,116
How many ways can you insert a series of values into a BST to form a specific tree?
<p><a href="https://stackoverflow.com/q/17118761">This earlier question</a> asked how many ways there were to insert the values 1 - 7 into a binary search tree that would result in the following tree:</p> <pre><code> 4 / \ 2 6 / \ / \ 1 3 5 7 </code></pre> <p>(The answer is 80, by the ...
17,119,117
2
0
null
2013-06-15 00:35:20.263 UTC
16
2016-06-13 20:43:13.55 UTC
2017-05-23 10:30:44.547 UTC
null
-1
null
501,557
null
1
22
algorithm|math|data-structures|permutation|binary-search-tree
12,367
<p>We can solve this using a clever recursive algorithm.</p> <p>As our base case, if you are given an empty tree, there is exactly one way to build that tree - don't insert any values.</p> <p>For the recursive case, let's suppose that you have a BST that looks like this:</p> <pre><code> v /...
20,469,816
Jquery, Remove class when width screen is 1050px
<p>This is the JS code i'm using:</p> <pre><code>$("document").ready(function($){ var nav = $('#menu2'); $(window).scroll(function () { if ($(this).scrollTop() &gt; 90) { nav.addClass("f-nav"); } else { nav.removeClass("f-nav"); } }); </code></pre> <p>But i can't seem to get this into my ...
20,470,584
5
8
null
2013-12-09 11:45:21.68 UTC
1
2013-12-09 13:08:40.08 UTC
2013-12-09 11:48:58.873 UTC
null
2,254,448
null
3,082,607
null
1
7
javascript|jquery|css
42,093
<p>To change <code>html</code> to <code>#menu2</code>, just replace one with the other. jQuery is pretty simple in this respect </p> <pre class="lang-js prettyprint-override"><code>if ($(window).width() &lt; 514) { $('#menu2').addClass('f-nav'); } else { $('#menu2').removeClass('f-nav'); } </code></pre> <p><a...
25,893,840
How to avoid "unable to read memory"
<p>I have a struct:</p> <pre><code>struct a { a(){}; a(int one,int two): a(one),b(two){}; int a; int b; int c; } a * b; cout &lt;&lt; b-&gt;c; </code></pre> <p>And sometimes when i want to read (for ex.) <code>c</code> and in debbuger this value is called </p> <blockquote> <p>'unable to read memory...
25,894,046
1
7
null
2014-09-17 14:51:19.32 UTC
1
2020-08-13 09:15:11.47 UTC
2014-09-17 14:58:27.39 UTC
null
3,888,427
null
3,888,427
null
1
7
c++
49,262
<p>You haven't initialised the pointer to point to anything, so it's invalid. You can't, in general, test whether a pointer points to a valid object. It's up to you to make sure it does; for example:</p> <pre><code>a obj(1,2); // an object a * b = &amp;obj; // a pointer, pointing to obj; cout &lt;&lt; b-&gt;a; //...
4,753,845
Build Qt Tests with CMake
<p>Can anyone give me an example of some QT test code and a CMakeLists.txt that build with Cmake and ran with CTest. I can't seem to find any!</p> <p>-Kurtis</p>
4,757,074
2
0
null
2011-01-20 23:26:04.813 UTC
8
2014-05-09 08:54:46.047 UTC
null
null
null
null
527,288
null
1
28
qt|cmake|ctest|qttest
14,819
<p>An example taken from <a href="https://github.com/KDAB/Charm" rel="noreferrer">Charm</a> (Tests/CMakeLists.txt):</p> <pre><code>SET( TestApplication_SRCS TestApplication.cpp ) SET( TEST_LIBRARIES CharmCore ${QT_QTTEST_LIBRARY} ${QT_LIBRARIES} ) SET( SqLiteStorageTests_SRCS SqLiteStorageTests.cpp ) QT4_AUTOMOC( ${S...
26,757,452
Laravel Eloquent: Accessing properties and Dynamic Table Names
<p>I am using the Laravel Framework and this question is directly related to using Eloquent within Laravel.</p> <p>I am trying to make an Eloquent model that can be used across the multiple different tables. The reason for this is that I have multiple tables that are essentially identical but vary from year to year, b...
26,883,036
4
4
null
2014-11-05 12:40:52.06 UTC
23
2019-09-10 20:06:34.46 UTC
null
null
null
null
255,940
null
1
16
php|laravel|laravel-4|eloquent
17,257
<p>I assume you know how to navigate the Laravel API / codebase since you will need it to fully understand this answer...</p> <p><em>Disclaimer</em>: Even though I tested some cases I can't guarantee It always works. If you run into a problem, let me know and I'll try my best to help you.</p> <p>I see you have multip...
26,625,614
Select query with offset limit is too much slow
<p>I have read from internet resources that a query will be slow when the offset increases. But in my case I think its too much slow. I am using <code>postgres 9.3</code></p> <p>Here is the query (<code>id</code> is primary key):</p> <pre><code>select * from test_table offset 3900000 limit 100; </code></pre> <p>It r...
27,169,302
9
10
null
2014-10-29 08:22:07.007 UTC
22
2022-04-10 20:18:46.037 UTC
2014-11-25 08:20:28.87 UTC
null
2,953,344
null
2,953,344
null
1
31
postgresql|postgresql-9.1
27,108
<p>It's slow because it needs to locate the top <code>offset</code> rows and scan the next 100. No amounts of optimization will change that when you're dealing with huge offsets.</p> <p>This is because your query literally <em>instruct</em> the DB engine to visit lots of rows by using <code>offset 3900000</code> -- th...
41,302,241
Modal dialog with fixed header and footer and scrollable content
<p>I'm trying to create a modal dialog that has an fixed header and footer and that the content (in this case list of users) inside the modal dialog is scrollable...</p> <p>My best attempt so far gave me the result on the image:</p> <p><a href="https://i.stack.imgur.com/cJzqe.jpg" rel="noreferrer"><img src="https://i...
41,302,490
5
7
null
2016-12-23 13:18:39.15 UTC
3
2021-04-05 00:06:03.613 UTC
null
null
null
null
7,068,325
null
1
13
html|css|material-design|materialize
48,013
<p>You can try <code>max-height</code> using <code>calc()</code> function, like:</p> <pre><code>.modal-content { height: auto !important; max-height: calc(100vh - 340px) !important; } </code></pre> <p>Have a look at the snippet below (<em>use full screen</em>):</p> <p><div class="snippet" data-lang="js" data-hid...
10,045,446
Efficient implementation of immutable (double) LinkedList
<p>Having read this question <a href="https://stackoverflow.com/questions/9009627/immutable-or-not-immutable">Immutable or not immutable?</a> and reading answers to my previous questions on immutability, I am still a bit puzzled about efficient implementation of simple LinkedList that is immutable. In terms of array th...
10,045,677
3
0
null
2012-04-06 15:15:54.35 UTC
10
2018-04-01 21:44:24.52 UTC
2017-05-23 12:01:54.447 UTC
null
-1
null
1,094,640
null
1
10
data-structures|linked-list|immutability
11,046
<blockquote> <p>Supposedly we have a general class of Node and class LinkedList based on the above allowing the user to add, remove etc. Now, how would we ensure immutability? </p> </blockquote> <p>You ensure immutability by making every field of the object readonly, and ensuring that every object referred to by one...
10,008,949
Is it possible to get an address from coordinates using google maps?
<p>I'm just curious. Maybe for a future project. I want to know if it's possible to retrieve an address from a giving coordinate via the Google API. </p>
10,009,027
3
0
null
2012-04-04 10:02:44.97 UTC
9
2019-05-28 08:11:48.557 UTC
2013-12-07 07:14:12.21 UTC
null
881,229
null
186,964
null
1
23
google-maps|google-maps-api-3
51,016
<p>yes. Just use Google Geocoding and Places API <a href="https://developers.google.com/maps/documentation/geocoding/" rel="noreferrer">https://developers.google.com/maps/documentation/geocoding/</a> and <a href="https://developers.google.com/maps/documentation/places/" rel="noreferrer">https://developers.google.com/ma...
10,046,741
Searching full name or first or last name in MySQL database with first and last name in separate columns
<p>I'm working with an existing database that has first name and last name seperated in the database. I need to create a function that will take one search input and return results. say my database has a structure like....</p> <pre><code>nameFirst nameLast Joe Smith Joe Jones Joe Brown </code></pre> ...
10,046,839
3
3
null
2012-04-06 17:10:30.897 UTC
7
2022-02-03 12:42:51.997 UTC
null
null
null
null
1,283,726
null
1
25
php|mysql
38,908
<pre><code>SELECT * FROM table WHERE CONCAT( nameFirst, ' ', nameLast ) LIKE '%Joe%' </code></pre> <p>Be sure to sanitize any user submitted parameters such as "Joe"</p>
9,652,949
What is the exact location of MySQL database tables in XAMPP folder?
<p>I have a MySQL database and I want to know the exact location where this data actually stored in the XAMPP folder, I went to this file location to try to get the information:</p> <pre><code>xampp -&gt; mysql -&gt; data -&gt; </code></pre> <p>Here I found a separate folder for each of my databases and within these ...
9,653,025
10
0
null
2012-03-11 06:27:57.243 UTC
10
2021-11-18 14:50:03.15 UTC
2017-06-22 09:14:18.963 UTC
null
6,375,113
null
1,196,718
null
1
40
mysql|database|data-migration
219,689
<p>I think the matter is your tables engine. I guess you are using InnoDB for your table. So you can not copy files easily to make a copy.<br> Take a look at these links:<br> <a href="http://dev.mysql.com/doc/refman/5.0/en/innodb-backup.html">http://dev.mysql.com/doc/refman/5.0/en/innodb-backup.html</a><br> <a href="ht...
10,179,121
SQL Sub queries in check constraint
<p>Can I make SQL sub queries in Check constraint ?</p> <p>I've a <code>post</code> table with columns <code>id, owner</code><br /> I've another table <code>action</code> with columns <code>user_id, post_id</code><br /> Table <code>user</code> with columns <code>id</code></p> <p><code>post_id -&gt; post.id</code> and...
10,179,366
1
2
null
2012-04-16 17:55:32.617 UTC
6
2019-03-20 12:39:25.617 UTC
null
null
null
null
1,234,019
null
1
56
postgresql|foreign-key-relationship|plpgsql|check-constraints
32,645
<p>It is not supported to look beyond the current row in a CHECK constraint.</p> <p><a href="http://www.postgresql.org/docs/9.1/interactive/sql-createtable.html">http://www.postgresql.org/docs/9.1/interactive/sql-createtable.html</a> says:</p> <blockquote> <p>A check constraint specified as a column constraint shou...
9,956,766
Convert string to decimal number in ruby
<p>I need to work with decimals. In my program, the user need to put a number with decimals to convert that number.</p> <p>The problem is: If I try to convert the argument into a number I get a integer without decimals.</p> <pre><code># ARGV[0] is: 44.33 size = ARGV[0] puts size.to_i # size is: 44 # :( </code></pre...
9,956,784
4
0
null
2012-03-31 14:32:24.473 UTC
7
2018-07-24 08:50:14.737 UTC
2013-07-09 16:48:36.13 UTC
null
1,013,719
null
1,248,295
null
1
65
ruby|numbers|decimal
91,766
<p>You call <code>to_i</code>, you get integer.</p> <p>Try calling <code>to_f</code>, you should get a float.</p> <p>For more string conversion methods, <a href="http://ruby-doc.org/core-1.9.3/String.html#method-i-to_c" rel="noreferrer">look here</a>.</p>
10,238,769
How can I make the Android emulator show the soft keyboard?
<p>I'm debugging an issue with the soft keyboard display not displaying when it should. However, I don't have a device handy for testing. The problem is that <strong>the emulator <em>never</em> shows the soft keyboard</strong>.</p> <p>Some skins have a keyboard constantly displayed on the right, some don't, but none...
18,627,515
9
2
null
2012-04-20 00:37:36.16 UTC
12
2021-08-29 14:10:16.45 UTC
2014-10-29 16:20:09.32 UTC
null
85,950
null
85,950
null
1
103
android|android-emulator
120,531
<p>I found out how to do this on <strong>the Android emulator itself</strong> (Menu, &quot;Settings&quot; App - not the settings of the emulator outside). All you need to do is:</p> <p>open settings app -&gt; Language &amp; Input -&gt; Go to the &quot;Keyboard &amp; Input Methods -&gt; click Default</p> <p>This will br...
9,686,538
Align labels in form next to input
<p>I have very basic and known scenario of form where I need to align labels next to inputs correctly. However I don't know how to do it.</p> <p>My goal would be that labels are aligned next to inputs to the right side. Here is picture example of desired result.</p> <p><img src="https://i.stack.imgur.com/0vfJu.png" a...
9,686,575
8
0
null
2012-03-13 14:57:02.197 UTC
39
2020-10-09 18:50:42.59 UTC
2016-01-07 21:06:02.74 UTC
null
3,853,934
null
440,611
null
1
160
html|css|alignment
418,645
<blockquote> <p><strong>WARNING: OUTDATED ANSWER</strong></p> <p>Nowadays you should definitely avoid using fixed widths. You could use flexbox or CSS grid to come up with a responsive solution. See the other answers.</p> </blockquote> <hr /> <p>One possible solution:</p> <ul> <li>Give the labels <code>display: inline-...
8,129,040
proguard Missing type parameter
<p>i try obfuscate my code of android app with <code>ProGuard</code>. But after this my app give exception at running: </p> <pre><code>11-15 01:46:26.818: W/System.err(21810): java.lang.RuntimeException: Missing type parameter. 11-15 01:46:26.828: W/System.err(21810): at da.&lt;init&gt;(Unknown Source) 11-15 01:46...
8,181,232
3
1
null
2011-11-14 22:21:54.407 UTC
13
2022-06-06 16:21:16.677 UTC
2011-12-16 04:42:01.797 UTC
null
210,916
null
968,927
null
1
32
android|proguard
16,034
<p>answer is: use this proguard.cfg</p> <pre><code>##---------------Begin: proguard configuration common for all Android apps ---------- -optimizationpasses 5 -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -dontskipnonpubliclibraryclassmembers -dontpreverify -verbose -dump class_files.txt -printseeds se...
7,807,360
How to Get Pixel Color in Android
<p>I'm using Intent to call and show an image from Gallery, and now I made it enable to get me the coordinates of the image in a TextView using these:</p> <pre><code>final TextView textView = (TextView)findViewById(R.id.textView); final TextView textViewCol = (TextView)findViewById(R.id.textViewColor); targetImage.se...
7,807,442
3
0
null
2011-10-18 12:41:14.643 UTC
23
2018-08-07 12:50:16.053 UTC
2018-08-07 12:50:16.053 UTC
null
4,286,992
null
989,062
null
1
60
android|pixel
102,523
<p>You can get the pixel from the view like this:</p> <pre><code>ImageView imageView = ((ImageView)v); Bitmap bitmap = ((BitmapDrawable)imageView.getDrawable()).getBitmap(); int pixel = bitmap.getPixel(x,y); </code></pre> <p>Now you can get each channel with:</p> <pre><code>int redValue = Color.red(pixel); int blueV...
11,462,901
cluster presentation dendrogram alternative in r
<p>I know dendrograms are quite popular. However if there are quite large number of observations and classes it hard to follow. However sometime I feel that there should be better way to present the same thing. I got an idea but do not know how to implement it. </p> <p>Consider the following dendrogram.</p> <pre><cod...
11,466,725
1
4
null
2012-07-13 01:22:18.087 UTC
9
2013-11-03 17:50:01.9 UTC
2013-11-03 17:50:01.9 UTC
null
508,666
null
1,502,364
null
1
7
r|hierarchical-clustering|dendrogram|phylogeny
3,343
<p>You are describing a fairly typical way of going about cluster analysis:</p> <ul> <li>Use a clustering algorithm (in this case hierarchical clustering)</li> <li>Decide on the number of clusters</li> <li>Project the data in a two-dimensional plane using some form or principal component analysis</li> </ul> <p>The co...
11,523,888
HTML: HTML5 Placeholder attribute in password field issue- shows normal text?
<p>I am making a Login form, in which there are two fields- </p> <p>simplified:</p> <pre><code>&lt;input type="text"&gt; &lt;input type="password" placeholder="1234567" &gt; </code></pre> <p><strike>In my tests (FF, Chrome) the placeholer shows grey text. How can I have the placeholder text in password 'dots' ?</str...
11,524,221
3
8
null
2012-07-17 13:48:01.48 UTC
3
2020-04-01 21:47:22.03 UTC
2012-07-17 14:05:29.053 UTC
null
1,458,383
null
1,458,383
null
1
10
javascript|html|passwords|placeholder
47,932
<p>Try using the password dot code in the placeholder like so:</p> <pre><code>placeholder="&amp;#9679;&amp;#9679;&amp;#9679;&amp;#9679;&amp;#9679;" </code></pre> <p>For support in IE please refer to other threads such as <a href="https://stackoverflow.com/questions/6052544/showing-placeholder-text-for-password-field...
12,043,913
Python and Powers Math
<p>I've been learning Python but I'm a little confused. Online instructors tell me to use the operator ** as opposed to ^ when I'm trying to raise to a certain number. Example:</p> <pre><code>print 8^3 </code></pre> <p>Gives an output of 11. But what I'm look for (I'm told) is more akin to: print 8**3 which gives the...
12,043,968
3
3
null
2012-08-20 19:31:45.493 UTC
5
2020-06-30 15:10:03.073 UTC
null
null
null
null
1,527,653
null
1
43
python|math|multiplication|exponent
97,656
<p>Operator <code>^</code> is a <a href="http://wiki.python.org/moin/BitwiseOperators" rel="noreferrer"><em>bitwise operator</em></a>, which does <strong>bitwise exclusive or</strong>.</p> <p><a href="http://docs.python.org/reference/expressions.html#the-power-operator" rel="noreferrer">The power operator</a> is <code>...
11,779,679
Setting Android Theme background color
<p>I'm trying to modify the default background theme color, which should be easy but surprisingly I can't get it working. Please note that I want the change to be across the entire app, not just for a single activity. Here is my code: </p> <p>styles.xml</p> <pre><code>&lt;resources&gt; &lt;color name="white_opaq...
11,781,005
3
3
null
2012-08-02 14:32:41.883 UTC
12
2020-01-22 08:13:49.283 UTC
2020-01-22 08:13:49.283 UTC
null
11,348,074
null
948,781
null
1
125
android|android-theme
186,358
<p>Okay turned out that I made a really silly mistake. The device I am using for testing is running Android 4.0.4, API level 15.</p> <p>The styles.xml file that I was editing is in the default values folder. I edited the styles.xml in values-v14 folder and it works all fine now. </p>
3,919,850
Conversion from 'myItem*' to non-scalar type 'myItem' requested
<p>I have this C++ code:</p> <pre><code>#include &lt;iostream&gt; using namespace std; struct MyItem { int value; MyItem* nextItem; }; int main() { MyItem item = new MyItem; return 0; } </code></pre> <p>And I get the error:</p> <pre><code>error: conversion from `MyItem*' to non-scalar type `MyItem' requ...
3,919,855
4
0
null
2010-10-12 23:38:44.457 UTC
5
2021-01-01 06:50:02.733 UTC
2014-11-22 18:06:50.303 UTC
null
635,608
null
351,980
null
1
31
c++|new-operator
105,260
<p>Try:</p> <pre><code>MyItem * item = new MyItem; </code></pre> <p>But do not forget to delete it after usage:</p> <pre><code>delete item; </code></pre>
3,426,360
Azure SQL Database Web vs Business Edition
<p>Is there any difference between the Web Edition and Business Edition of Azure SQL Database other than the maximum supported database sizes? I'm assuming the naming has some significance but all of the information I find simply talks about the max db size. I want to know if there are any other differences such as SLA...
3,521,506
4
1
null
2010-08-06 17:49:26.327 UTC
15
2015-06-29 14:52:37.74 UTC
2015-06-29 14:52:37.74 UTC
null
4,102,957
null
43,406
null
1
63
azure|azure-sql-database
18,310
<p>The two editions are identical except for capacity. Both offer the same replication and SLA.</p> <p><strong>EDIT April 3, 2014 - Updated to reflect SQL Database size limit now at 500GB</strong></p> <p><strong>EDIT June 17, 2013: Since I originally posted this answer, a few things have changed with pricing (but the...
3,483,318
Performing regex queries with PyMongo
<p>I am trying to perform a regex query using PyMongo against a MongoDB server. The document structure is as follows</p> <pre><code>{ &quot;files&quot;: [ &quot;File 1&quot;, &quot;File 2&quot;, &quot;File 3&quot;, &quot;File 4&quot; ], &quot;rootFolder&quot;: &quot;/Location/Of/Files&quot; } </co...
3,483,399
4
0
null
2010-08-14 12:42:24.147 UTC
43
2021-03-18 19:05:47.427 UTC
2021-03-18 19:05:47.427 UTC
null
3,964,927
null
42,069
null
1
145
mongodb|pymongo
89,167
<p>Turns out regex searches are done a little differently in pymongo but is just as easy. </p> <p>Regex is done as follows :</p> <pre><code>db.collectionname.find({'files':{'$regex':'^File'}}) </code></pre> <p>This will match all documents that have a files property that has a item within that starts with File</p>
3,527,621
how to pause and resume a surfaceView thread
<p>I have a surfaceView setup and running, but when I resume it I get an error that the thread has already been started. What's the proper way to handle when the app goes to the background and then back to the foreground? I've tinkered around and managed to get the app to come back without crashing... but the surfaceVi...
3,596,395
7
0
null
2010-08-20 01:41:27.67 UTC
23
2018-06-18 15:37:49.81 UTC
2018-06-18 15:37:49.81 UTC
null
11,732,320
null
385,051
null
1
15
android|multithreading|surfaceview
41,342
<p>The easy solution is to simply kill and restart the thread. Create methods resume() - creates thread object and starts it - and pause() - kills thread (see Lunarlander example) - in your SurfaceView class and call these from surfaceCreated and surfaceDestroyed to start and stop the thread.</p> <p>Now in the Activit...
3,402,295
HTML table with horizontal scrolling (first column fixed)
<p>I have been trying to think of a way to make a table with a fixed first column (and the rest of the table with a horizontal overflow) I saw a post which had a similar question. but the fixed column bit did not seem to be resolved. Help?</p>
3,416,518
7
2
null
2010-08-04 03:06:02.457 UTC
35
2022-06-03 16:28:56.687 UTC
2013-12-10 18:20:59.16 UTC
null
1,708,520
null
380,213
null
1
75
html|overflow|html-table|fixed
227,122
<p>I have a similar table styled like so:</p> <pre><code>&lt;table style="width:100%; table-layout:fixed"&gt; &lt;tr&gt; &lt;td style="width: 150px"&gt;Hello, World!&lt;/td&gt; &lt;td&gt; &lt;div&gt; &lt;pre style="margin:0; overflow:scroll"&gt;My preformatted content&lt...
3,426,498
Online Internet Explorer Simulators
<p>(Tried to find simular questions / duplicates, failed)</p> <p>I develop on a mac. I love my mac. I develop using Chrome, Firefox, and Safari. I love them all for different reasons.</p> <p>But I have to develop for Internet Explorer users as well. </p> <p>I know, I am not unique here.</p> <p>I enjoy using the web...
3,426,579
12
2
null
2010-08-06 18:07:36.263 UTC
22
2021-08-26 22:41:15.093 UTC
null
null
null
null
190,902
null
1
74
internet-explorer|internet-explorer-8|internet-explorer-6|internet-explorer-7|cross-browser
219,036
<p>You could try <a href="http://getfirebug.com/firebuglite" rel="noreferrer">Firebug Lite</a></p> <p>It's a pure JavaScript-implementation of Firebug that runs directly in any browser (at least in all major ones: IE6+, Firefox, Opera, Safari and Chrome)</p> <p>You'll still need the VM to actually run IE, but at leas...
7,862,316
iOS5 NSURLConnection methods deprecated
<p>I'm trying to write an iOS app that makes asynchronous requests to get data over the network. It seems like a lot of people recommend using NSURLConnection for this, and frequently mention the delegate method connection:didReceiveData:.</p> <p>Unfortunately, I cannot for the life of me find out where this delegate ...
7,862,856
4
1
null
2011-10-22 20:18:11.237 UTC
13
2018-03-20 07:30:39.233 UTC
null
null
null
null
996,334
null
1
66
ios|ios5
18,862
<p>Fishing around the header files tells me that the methods were moved from an informal protocol (which is a deprecated Obj-C pattern) into a formal delegate protocol called <code>NSURLConnectionDataDelegate</code> that's in <code>NSURLConnection.h</code>, but doesn't have a public documentation. </p> <p>The rest of ...
8,004,765
CSS \9 in width property
<p>What is the meaning of this? I am guessing it is a browser hack, but I have not been able to find what exactly it does.</p> <pre><code>width: 500px\9; </code></pre> <p>What is the significance of <code>\9</code>?</p>
8,004,962
4
5
null
2011-11-04 04:06:03.307 UTC
43
2020-05-06 08:36:12.967 UTC
2016-01-06 12:30:38.48 UTC
null
1,660,032
null
507,737
null
1
218
css|width|css-hack
80,015
<p><code>\9</code> is a "CSS hack" specific to Internet Explorer 7, 8, &amp; 9.</p> <p>This simply means that the one specific line of CSS ending with a <code>\9;</code> in place of the <code>;</code> is only valid in IE 7, 8, &amp; 9.</p> <p>In your example,</p> <p><code>width: 500px\9;</code> means that a width of...
7,850,125
Convert "this" pointer to string
<p>In a system where registered objects must have unique names, I want to use/include the object's <code>this</code> pointer in the name. I want the simplest way to create <code>???</code> where:</p> <p><code>std::string name = ???(this);</code></p>
7,850,160
5
12
null
2011-10-21 13:31:10.853 UTC
10
2011-10-21 14:44:38.393 UTC
null
null
null
null
197,229
null
1
23
c++|pointers|stl
53,697
<p>You could use string representation of the address:</p> <pre><code>#include &lt;sstream&gt; //for std::stringstream #include &lt;string&gt; //for std::string const void * address = static_cast&lt;const void*&gt;(this); std::stringstream ss; ss &lt;&lt; address; std::string name = ss.str(); </code></pre>
4,541,190
How to close a thread from within?
<p>For every client connecting to my server I spawn a new thread, like this:</p> <pre><code># Create a new client c = Client(self.server.accept(), globQueue[globQueueIndex], globQueueIndex, serverQueue ) # Start it c.start() # And thread it self.threads.append(c) </code></pre> <p>Now, I know I can close <em>all</em...
4,541,213
4
1
null
2010-12-27 19:20:38.46 UTC
18
2019-03-27 15:08:13.83 UTC
2017-01-10 20:53:45.807 UTC
null
355,230
null
233,428
null
1
60
python|multithreading
193,400
<p>When you start a thread, it begins executing a function you give it (if you're extending <code>threading.Thread</code>, the function will be <code>run()</code>). To end the thread, just return from that function.</p> <p>According to <a href="https://docs.python.org/3/library/threading.html" rel="noreferrer">this</a...
4,340,040
HTML5 Canvas Vector Graphics?
<p>Please tell me what libraries for drawing and handling of vector graphics within HTML5 Canvas do you know?</p> <p>Thank you!!!</p>
4,413,041
5
1
null
2010-12-02 21:19:59.623 UTC
35
2022-03-10 07:54:35.043 UTC
null
null
null
null
352,555
null
1
47
html|canvas|vector-graphics
54,610
<p>There are a few options. I haven't used either of these libraries, but from what I can tell Cake seems generally more impressive, and imported, while also being three times as large. There is also the Burst Engine, currently an extension of processing.js, which is even smaller. I'm sure there are several more out th...
4,159,950
How do I delete a remote branch in Git?
<p>I created a branch <code>notmaster</code> to commit as well as push some changes. When I was finished with that branch, I merged the changes back into <code>master</code>, pushed them out, and then deleted the local <code>notmaster</code>.</p> <pre><code>$ git branch -a * master remotes/origin/master remotes/or...
4,159,972
6
1
null
2010-11-11 22:35:04.147 UTC
18
2017-12-06 07:19:57.38 UTC
2017-05-23 12:26:05.15 UTC
null
-1
null
478,288
null
1
93
git
22,296
<p><code>git push origin :notmaster</code>, which basically means "push nothing to the notmaster remote".</p>
4,639,372
Export to csv in jQuery
<p>I am dynamically generating a div which is like :</p> <pre><code>&lt;div id='PrintDiv'&gt; &lt;table id="mainTable"&gt; &lt;tr&gt; &lt;td&gt; Col1 &lt;/td&gt; &lt;td&gt; Col2 &lt;/td&gt; ...
7,588,465
8
5
null
2011-01-09 13:31:41.54 UTC
40
2020-09-06 00:03:15.237 UTC
2014-08-07 18:16:54.367 UTC
null
237,838
null
368,472
null
1
46
javascript|asp.net|jquery|csv
130,124
<p>You can do that in the client side only, in browser that accept <a href="http://en.wikipedia.org/wiki/Data_URI" rel="nofollow noreferrer">Data URIs</a>:</p> <pre><code>data:application/csv;charset=utf-8,content_encoded_as_url </code></pre> <p>In your example the Data URI must be:</p> <pre><code>data:application/csv;...
4,614,671
PHP session is not working
<p>I am working with wamp2.0 - PHP 5.3, apache 2.2.11 but my sessions are not storing data.</p> <p>I have a page that accepts a parameter, which (simplified version) I wanna store in a session, so when I come to</p> <pre><code>http://www.example.com/home.php?sessid=db_session_id </code></pre> <p>The script looks lik...
14,274,023
9
9
null
2011-01-06 11:59:57.25 UTC
0
2017-09-23 20:35:21.897 UTC
2012-12-18 11:33:36.487 UTC
null
367,456
null
513,768
null
1
6
php|session|iframe|wamp
45,786
<p>A frame can access the session only if it's relative to the same domain. For example:</p> <pre><code>&lt;? $_SESSION["foo"]="foo"; ?&gt;&lt;html&gt; &lt;body&gt; &lt;iframe src ="test.php" width="200" height="200"&gt;&lt;/iframe&gt; &lt;/body&gt; &lt;/html&gt; &lt;? print_r($_SESSION); ?&gt; </code></p...
14,465,297
Connected Component Labeling - Implementation
<p>I have asked a similar question some days ago, but I have yet to find an efficient way of solving my problem. I'm developing a simple console game, and I have a 2D array like this:</p> <pre><code>1,0,0,0,1 1,1,0,1,1 0,1,0,0,1 1,1,1,1,0 0,0,0,1,0 </code></pre> <p>I am trying to find all the areas that consist of ne...
14,466,081
5
2
null
2013-01-22 18:14:37.457 UTC
17
2019-09-14 11:39:12.47 UTC
2019-09-14 11:39:12.47 UTC
null
195,787
user1981497
null
null
1
26
algorithm|image-processing|multidimensional-array|area|neighbours
30,266
<p>I'll first give you the code and then explain it a bit:</p> <pre class="lang-cpp prettyprint-override"><code>// direction vectors const int dx[] = {+1, 0, -1, 0}; const int dy[] = {0, +1, 0, -1}; // matrix dimensions int row_count; int col_count; // the input matrix int m[MAX][MAX]; // the labels, 0 means unlabe...
14,422,340
MANIFEST.in, package_data, and data_files clarification?
<p>I am trying to create a Python package, and I have a directory structure like this:</p> <pre><code>mypkg/ ├── __init__.py ├── module1 │   ├── x.py │   ├── y.py │   └── z.txt └── module2 ├── a.py └── b.py </code></pre> <p>Then I added all the files in <code>MANIFEST.in</code> and when I check the created ar...
14,427,680
2
2
null
2013-01-20 06:45:04.583 UTC
4
2017-11-15 13:07:22.753 UTC
2017-11-15 13:07:22.753 UTC
null
219,519
null
1,979,362
null
1
32
python|setuptools|distutils
8,013
<p>Update: It got fixed when I started using setuptools instead of distutils.core. I think it was some problem with distutils not agreeing with manifest while setuptools worked without any changes in the code. I recommend using setuptools in the future. Using the link <a href="http://peak.telecommunity.com/DevCenter/se...
14,370,972
How to attach a process in gdb
<p>I have a simple C program that forks a process and then runs an executable. </p> <p>I want to attach the child process to gdb. </p> <p>I run the main program in a console and open another console to find the pid of the child process, then I start gdb with the following command:</p> <pre><code>gdb attach 12271 </c...
14,371,557
3
2
null
2013-01-17 01:47:36.36 UTC
6
2020-10-28 15:49:00.767 UTC
2018-01-27 21:32:28.337 UTC
null
320,594
null
1,029,808
null
1
79
unix|gdb
134,725
<p>Try one of these:</p> <pre><code>gdb -p 12271 gdb /path/to/exe 12271 gdb /path/to/exe (gdb) attach 12271 </code></pre>
14,517,546
How can a C++ header file include implementation?
<p>Ok, not a C/C++ expert by any means, but I thought the point of a header file was to declare the functions, then the C/CPP file was to define the implementation.</p> <p>However, reviewing some C++ code tonight, I found this in a class's header file...</p> <pre><code>public: UInt32 GetNumberChannels() const { r...
14,517,957
7
11
null
2013-01-25 07:50:04.703 UTC
39
2019-08-08 07:32:57.39 UTC
2018-02-04 00:51:54.45 UTC
null
168,179
null
168,179
null
1
111
c++|header-files
120,972
<blockquote> <p>Ok, not a C/C++ expert by any means, but I thought the point of a header file was to declare the functions, then the C/CPP file was to define the implementation.</p> </blockquote> <p>The true purpose of a header file is to share code amongst multiple source files. It is <strong>commonly</strong> use...
14,893,399
Rebase feature branch onto another feature branch
<p>I have two (private) feature branches that I'm working on.</p> <pre><code>a -- b -- c &lt;-- Master \ \ \ d -- e &lt;-- Branch1 \ f -- g &lt;-- Branch2 </code></pre> <p>After working on these branches a little while I've discovered that I n...
14,893,561
4
5
null
2013-02-15 11:09:24.41 UTC
102
2021-06-17 11:00:27.183 UTC
2018-08-21 14:10:20.31 UTC
null
582,821
null
537,542
null
1
406
git|git-rebase|feature-branch
299,866
<ol> <li><p>Switch to Branch2</p> <pre><code>git checkout Branch2 </code></pre></li> <li><p>Apply the current (Branch2) changes on top of the Branch1 changes, staying in Branch2:</p> <pre><code>git rebase Branch1 </code></pre></li> </ol> <p>Which would leave you with the desired result in Branch2: </p> <pre><code>...
2,757,911
How to decode the url in php where url is encoded with encodeURIComponent()
<p>How to decode the url in php where url is encoded with encodeURIComponent()? </p> <p>I have tried the urldecode() but then also..i don't the url which i have encoded...</p> <p>I have to do this in php..</p>
2,757,939
2
0
null
2010-05-03 12:19:48.133 UTC
9
2018-10-25 00:03:21.517 UTC
null
null
null
null
310,921
null
1
21
php|javascript|urlencode|urldecode
33,513
<p>You should use <code>rawurldecode()</code>.<br> See the <a href="http://www.php.net/manual/en/function.rawurldecode.php" rel="noreferrer">Manual</a></p>
2,903,481
Using scala.util.control.Exception
<p>Does anybody have good examples of using <a href="http://www.scala-lang.org/api/2.12.0/scala/util/control/Exception$.html" rel="nofollow noreferrer"><code>scala.util.control.Exception</code> version 2.12.0</a> (<a href="http://www.scala-lang.org/api/2.8.0/scala/util/control/Exception$.html" rel="nofollow noreferrer"...
2,903,826
2
0
null
2010-05-25 09:37:34.673 UTC
9
2017-03-03 11:47:25.57 UTC
2017-03-03 11:47:25.57 UTC
null
3,165,552
null
9,204
null
1
31
scala|scala-2.8
5,389
<p>Indeed - I also find it pretty confusing! Here's a problem where I have some property which may be a parseable date:</p> <pre><code>def parse(s: String) : Date = new SimpleDateFormat("yyyy-MM-dd").parse(s) def parseDate = parse(System.getProperty("foo.bar")) type PE = ParseException import scala.util.control.Excep...
2,265,089
Android game loop, how to control speed and frame rate
<p>I've written a game for Android, and I've tested it on the Dev Phone 1. It works perfectly, the speed is just right. However, I'm sure phone CPU's are getting faster. They may already be faster than the dev phone.</p> <p>How do I make sure that my game runs at the exact same speed no matter what the device or ho...
2,265,447
1
1
null
2010-02-15 09:56:46.51 UTC
11
2010-02-15 11:06:48.65 UTC
null
null
null
null
179,518
null
1
19
android|cpu-speed
18,004
<p>If you are targeting certain frame rate, the basic idea is that you should have a timer or thread that executes your game's tick method at desired intervals. With timers the implementation is pretty trivial: just schedule a timer to execute at regular intervals. When using threads you have to put the thread to sleep...
53,747,772
Is it possible to make a parameterized scripted pipeline in Jenkins by listing the parameters in actual script, not in job config
<p>In a <a href="https://jenkins.io/doc/book/pipeline/#pipeline-syntax-overview" rel="noreferrer">declarative pipeline</a>, I can specify the parameter that the pipeline expects right in the pipeline script like so:</p> <pre><code>pipeline { parameters([ string(name: 'DEPLOY_ENV', defaultValue: 'TESTING' ) ]...
53,750,165
4
0
null
2018-12-12 16:52:51.53 UTC
4
2022-03-30 09:51:51.737 UTC
2018-12-13 17:58:24.39 UTC
null
366,749
null
738,807
null
1
27
jenkins|jenkins-pipeline
42,918
<p>I found a solution by experimentation so want to share it:</p> <pre><code>properties( [ parameters([ string(defaultValue: '/data', name: 'Directory'), string(defaultValue: 'Dev', name: 'DEPLOY_ENV') ]) ] ) node { // params.DEPLOY_ENV ... } </code></pre>
40,522,634
Can I pass parameters in computed properties in Vue.Js
<p>is this possible to pass parameter in computed properties in Vue.Js. I can see when having getters/setter using computed, they can take a parameter and assign it to a variable. like here from <a href="https://v2.vuejs.org/v2/guide/computed.html" rel="noreferrer">documentation</a>:</p> <pre class="lang-vue prettyprin...
40,539,522
10
1
null
2016-11-10 08:06:34.323 UTC
49
2022-08-17 13:58:03.93 UTC
2022-07-13 22:47:35.917 UTC
null
6,277,151
null
1,610,034
null
1
317
javascript|vue.js|vuejs2
313,618
<p>Most probably you want to use a method</p> <pre><code>&lt;span&gt;{{ fullName('Hi') }}&lt;/span&gt; methods: { fullName(salut) { return `${salut} ${this.firstName} ${this.lastName}` } } </code></pre> <hr /> <h2>Longer explanation</h2> <p>Technically you can use a computed property with a parameter like th...
48,828,478
How do you use Keras LeakyReLU in Python?
<p>I am trying to produce a CNN using Keras, and wrote the following code:</p> <pre><code>batch_size = 64 epochs = 20 num_classes = 5 cnn_model = Sequential() cnn_model.add(Conv2D(32, kernel_size=(3, 3), activation='linear', input_shape=(380, 380, 1), padding='same')) cnn_model.add(Activation('re...
48,828,561
3
0
null
2018-02-16 14:02:47.503 UTC
3
2022-07-07 13:11:35.607 UTC
2021-02-26 19:54:53.013 UTC
null
4,685,471
null
9,340,209
null
1
42
python|machine-learning|keras|neural-network
71,016
<p>All advanced activations in Keras, including <code>LeakyReLU</code>, are available as <a href="https://keras.io/layers/advanced-activations/" rel="noreferrer">layers</a>, and not as activations; therefore, you should use it as such:</p> <pre><code>from keras.layers import LeakyReLU # instead of cnn_model.add(Activ...
27,743,339
Strange behaviour of images in RecyclerView
<p>I am using android.support.v7.widget.RecyclerView to show simple items containing text and in some cases also images. Basically I followed the tutorial from here <a href="https://developer.android.com/training/material/lists-cards.html" rel="noreferrer">https://developer.android.com/training/material/lists-cards.htm...
27,743,634
3
0
null
2015-01-02 13:58:25.467 UTC
16
2018-03-08 13:15:28.8 UTC
2018-03-08 13:15:28.8 UTC
null
6,618,622
null
3,647,974
null
1
34
android|imageview|arrays|android-recyclerview|android-cardview
38,970
<p>I think you need to add an <code>else</code> clause to your <code>if ( object.has("image") )</code> statement in the <code>onBindViewHolder(ViewHolder holder, int position)</code> method, setting the image to null:</p> <pre><code>holder.image.setImageDrawable(null); </code></pre> <p>I think <a href="https://develo...
50,536,292
Difference between antMatcher and mvcMatcher
<p>What is difference of <code>HttpSecurity</code>'s <code>antMatcher()</code> and <code>mvcMatcher()</code> functions?</p> <p>Could anyone explain when to use them ?</p>
57,373,627
3
0
null
2018-05-25 20:16:21.08 UTC
13
2021-02-16 23:23:27.313 UTC
2019-08-06 09:53:00.193 UTC
null
4,390,212
null
9,172,501
null
1
53
spring|spring-security
23,156
<p>As this methods' signatures clearly say is also stated in the <a href="https://docs.spring.io/spring-security/site/docs/current/api/org/springframework/security/config/annotation/web/builders/HttpSecurity.html" rel="noreferrer">official documentation</a> -</p> <blockquote> <p><code>antMatcher(String antPattern)</cod...
34,524,390
Regex to match a variable in Batch scripting
<pre><code>@echo off SET /p var=Enter: echo %var% | findstr /r "^[a-z]{2,3}$"&gt;nul 2&gt;&amp;1 if errorlevel 1 (echo does not contain) else (echo contains) pause </code></pre> <p>I'm trying to valid a input which should contain 2 or 3 letters. But I tried all the possible answer, it only runs <code>if error level ...
34,525,752
4
0
null
2015-12-30 06:49:00.44 UTC
2
2020-04-18 05:05:32.66 UTC
2015-12-30 06:59:23.093 UTC
null
4,158,862
null
3,666,807
null
1
19
regex|batch-file
56,331
<p><code>findstr</code> has no full REGEX Support. Especially no <code>{Count}</code>. You have to use a workaround:</p> <pre><code>echo %var%|findstr /r "^[a-z][a-z]$ ^[a-z][a-z][a-z]$" </code></pre> <p>which searches for <code>^[a-z][a-z]$</code> OR <code>^[a-z][a-z][a-z]$</code></p> <p>(Note: there is no space be...
34,878,848
Control bar border (color) thickness with ggplot2 stroke
<p>Is it possible to use the stroke argument introduced with <code>ggplot2 2.0</code> to adjust the thickness of borders around bars? If not, is there a way to control bar-border thickness along the lines of point-border thickness? <a href="https://stackoverflow.com/questions/19506630/control-point-border-thickness-i...
34,884,392
1
0
null
2016-01-19 14:04:15.41 UTC
6
2020-02-22 03:42:29.817 UTC
2017-05-23 11:47:13.79 UTC
null
-1
null
2,583,119
null
1
18
r|ggplot2|geom-bar
42,083
<p>well as I suggested by the OP, I will just recopy my comment as an answer.</p> <p>you just need to set <code>size</code> in your <code>geom_bar()</code> expression:</p> <pre><code>geom_bar(stat = "identity", aes(fill = "transparent", size = ifelse(factor2 == "A", 2, 1)), size=2) </code></pre>
29,148,274
Define the selected option with the old input in Laravel / Blade
<p>I have this code:</p> <pre><code>&lt;select required="required" class="form-control" name="title"&gt; &lt;option&gt;&lt;/option&gt; @foreach ($titles as $key =&gt; $val) @if (stristr($key, 'isGroup')) &lt;optgroup label="{{ $val }}"&gt; @else &lt;option value="{{ $key }}"...
29,148,393
22
0
null
2015-03-19 15:11:14.15 UTC
14
2022-07-26 15:56:09.683 UTC
2015-03-19 15:21:37.417 UTC
null
4,124,475
null
4,124,475
null
1
61
laravel|laravel-4|laravel-blade
173,617
<p>The solution is to compare <code>Input::old()</code> with the <code>$key</code>variable using <a href="https://laravel.com/docs/8.x/blade#if-statements" rel="noreferrer">Blade Directives - If Statements</a>.</p> <pre><code>@if (Input::old('title') == $key) &lt;option value=&quot;{{ $key }}&quot; selected&gt;{{ $...
36,429,732
How make lodash _.replace all occurrence in a string?
<p>How to replace each occurrence of a string pattern in a string by another string? </p> <pre><code>var text = "azertyazerty"; _.replace(text,"az","qu") </code></pre> <p>return <code>quertyazerty</code></p>
36,429,733
4
0
null
2016-04-05 14:48:01.547 UTC
6
2020-06-04 00:36:00.873 UTC
2019-01-30 03:50:03.227 UTC
null
1,033,581
null
2,733,216
null
1
40
javascript|string|lodash
68,114
<p>you have to use the RegExp with global option offered by lodash.</p> <p>so just use </p> <pre><code>var text = "azertyazerty"; _.replace(text,new RegExp("az","g"),"qu") </code></pre> <p>to return <code>quertyquerty</code></p>
65,003,024
Replicating claims as headers is deprecated and will removed from v4.0 - Laravel Passport Problem in lcobucci/jwt package
<p>I'm using <code>laravel/passport:7.5.1</code> package in my laravel project and recently faced with this exception. Any Idea? I temperory downgrade the <code>lcobucci/jwt:3.4.0</code> package to <code>lcobucci/jwt:3.3.3</code></p> <pre><code>Replicating claims as headers is deprecated and will removed from v4.0. Pl...
65,005,348
3
1
null
2020-11-25 10:43:13.367 UTC
6
2021-04-12 01:39:08.547 UTC
2020-11-25 11:04:31.843 UTC
null
2,696,125
null
2,696,125
null
1
52
php|laravel|laravel-passport|thephpleague
33,575
<p>I'm deeply sorry for causing confusion or issues. Please check <a href="https://github.com/lcobucci/jwt/issues/550#issuecomment-733557709" rel="noreferrer">https://github.com/lcobucci/jwt/issues/550#issuecomment-733557709</a> for my full explanation on why this approach was taken and why it isn't considered a BC-bre...
26,357,340
ASP.MVC HandleError attribute doesn't work
<p>I know it's a common issue but I've crawled many discussions with no result.</p> <p>I'm trying to handle errors with the HandleError ASP.MVC attrbiute. I'm using MVC 4.</p> <p>My Error page is places in Views/Shared/Error.cshtml and looks like that:</p> <pre><code>Test error page &lt;hgroup class="title"&gt; ...
26,359,455
5
0
null
2014-10-14 09:34:17.147 UTC
9
2017-06-13 00:33:21.523 UTC
2014-10-14 13:39:12.88 UTC
null
3,775,079
null
3,775,079
null
1
9
c#|.net|asp.net-mvc|asp.net-mvc-4
17,194
<p>Over the years I have struggled to implement "handling custom errors" in ASP.NET MVC smoothly.</p> <p>I have had successfully used Elmah before however was overwhelmed with the numerous cases that needs to be handled and tested differently (i.e. local vs IIS).</p> <p>Recently in one of my project which is now live...
26,369,834
Stored procedure error PLS-00201: identifier 'UTL_HTTP' must be declared
<p>I am trying to create a stored procedure that request some XML data from a service. I have found several examples on-line and all of them point to using this UTL_HTTP package. However, every time I tried to compile my store procedure with that I get the error:</p> <pre><code>PLS-00201: identifier 'UTL_HTTP' must be...
26,370,666
1
0
null
2014-10-14 20:36:41.58 UTC
3
2014-10-14 21:29:16.323 UTC
null
null
null
null
892,060
null
1
9
oracle|stored-procedures
43,074
<p>As you already figured out yourself, this seems to be a permission problem. Your user does somehow not have access to the UTL_HTTP package. Make sure your user has the EXECUTE permission on the package:</p> <pre><code>GRANT EXECUTE ON SYS.UTL_HTTP TO my_user; </code></pre> <p>Note that you might have to do this as...
27,964,611
How to set onclick listener for a button in a fragment in android
<p>My app contains a form as shown in the following image:</p> <p><img src="https://i.stack.imgur.com/O366nl.png" alt="register screenshot"></p> <p>When I click on menu options button, the drawer opens as shown in the following image: <img src="https://i.stack.imgur.com/aDUt0l.png" alt="select screenshot"></p> <p>I ...
27,964,693
3
0
null
2015-01-15 13:33:02.983 UTC
4
2020-01-16 13:26:11.64 UTC
2017-04-02 21:44:33.257 UTC
null
1,644,131
null
3,948,601
null
1
9
android|android-fragments|onclick|drawer
62,230
<p>Since the button is a part of the fragment's layout, set the listener there:</p> <pre><code>@Override public View onCreateView(LayoutInflater inflater,ViewGroup container, Bundle args) { View view = inflater.inflate(R.layout.registerblood, container, false); String menu = getArguments().getString("Menu"); ...
40,772,997
How to convert List<V> into Map<K, List<V>>, with Java 8 streams and custom List and Map suppliers?
<p>It's easy to convert <code>List&lt;V&gt;</code> into <code>Map&lt;K, List&lt;V&gt;&gt;</code>. For example:</p> <pre><code>public Map&lt;Integer, List&lt;String&gt;&gt; getMap(List&lt;String&gt; strings) { return strings.stream() .collect(Collectors.groupingBy(String::length)); } </code></pre>...
40,773,235
3
2
null
2016-11-23 19:49:20.003 UTC
16
2019-10-16 03:59:34.44 UTC
2016-11-23 21:09:02.343 UTC
null
1,743,880
null
3,411,681
null
1
39
java|java-stream|collectors
49,221
<p>You could have the following:</p> <pre><code>public Map&lt;Integer, List&lt;String&gt;&gt; getMap(List&lt;String&gt; strings) { return strings.stream().collect( Collectors.groupingBy(String::length, HashMap::new, Collectors.toCollection(ArrayList::new)) ); } </code></pre> <p>The collector <a href="ht...
46,622,291
Mapping Firebase Auth users to Firestore Documents
<p>I'm trying to use <strong>Firebase</strong>'s <code>Firestore</code> database to handle <code>User</code>s in my Android app. </p> <p>Initially I want to use the <strong>id</strong> returned from the <code>Auth</code> package (a string), and set that as the id for the <code>users</code> <code>Collection</code> in t...
46,876,181
1
0
null
2017-10-07 16:06:41.353 UTC
13
2018-05-25 14:21:44.013 UTC
2017-10-09 05:26:13.123 UTC
null
153,407
null
4,443,226
null
1
31
firebase|firebase-authentication|user-management|google-cloud-firestore
18,235
<p>I am not sure how to do this in android, but with JS I am doing the following:</p> <pre><code>firebase.firestore().collection('users').doc(currentUser.uid).set(currentUser) </code></pre> <p><code>currentUser</code> is the user object that the authentication function returns (I use <code>signInWithCredential</code>...
46,438,557
How to extract the file jre-9/lib/modules?
<p>In <code>JRE-9/lib</code> directory (at least on Windows), there is a new file called <code>modules</code> whose size is about 107 MB. Is it possible to extract that file or maybe list java modules within it?</p> <p>I can see that a new tool called <code>jmod</code> is available at <code>jdk-9/bin/jmod.exe</code>, ...
46,441,042
6
0
null
2017-09-27 02:28:16.103 UTC
11
2021-05-25 10:51:28.15 UTC
2017-09-27 05:26:59.187 UTC
null
1,746,118
null
597,657
null
1
27
java|java-9|java-module|jdk-tools|jmod
8,288
<p>The <code>modules</code> file is a container file. It's internal to the JDK and the format is not documented (it may change at any time). For troubleshooting purposes, the <code>jimage</code> tool in the bin directory can be used to list or extract the contents.</p>
37,342,997
Render multiple components in React Router
<p>I'm used to application layouts with multiple yield areas, i.e. for content area and for top bar title. I'd like to achieve something similar in React Router. For example:</p> <pre><code>&lt;Router&gt; &lt;Route path="/" component = { AppLayout }&gt; &lt;Route path="list" component = { ListView } ...
37,343,236
11
0
null
2016-05-20 09:28:24.837 UTC
5
2022-09-15 18:49:26.673 UTC
null
null
null
null
876,409
null
1
15
javascript|meteor|react-router|reactjs
39,760
<p>To passe multiple component you can do like this :</p> <pre><code>&lt;Route path="groups" components={{main: Groups, sidebar: GroupsSidebar}} /&gt; &lt;Route path="users" components={{main: Users, sidebar: UsersSidebar}}&gt; </code></pre> <p>See the doc here : <a href="https://github.com/ReactTraining/react-route...
32,167,640
Visual Studio 2015 diagnostics tool does not support current debugging configuration
<p>After using VS2015 snapshot and profiling tools, I can't seem to get the diagnostics tools to work again. Every project, even new ones just say the following </p> <blockquote> <p>The Diagnostic Tools window does not support the current debugging configuration.</p> </blockquote> <p><a href="https://i.stack.imgu...
32,182,718
6
0
null
2015-08-23 14:20:18.19 UTC
3
2019-12-30 23:39:56.84 UTC
2019-10-03 20:03:04.527 UTC
null
44,729
null
760,986
null
1
61
c#|visual-studio|debugging|visual-studio-2015|visual-studio-debugging
28,438
<p>So I resolved my issue. The Diagnostic Tools window currently does not support:</p> <ul> <li>Windows Store projects that are using JavaScript </li> <li>Windows Store projects that are running on a Windows Phone </li> <li>Debugging with Use Managed or Native Compatibility Mode</li> </ul> <p>In my case I had 'Use Ma...
5,700,558
How can I bind nested ViewModels from View to Controller in MVC3?
<p>I am developing an ASP.NET MVC 3 application in C# and I use Razor. I am now dealing with a problem concerning the binding of objects through ViewModels passed/received to/from the View by the Controller. Let's make it clear. I have the following ViewModels:</p> <pre><code>public class ContainerViewModel { publi...
5,700,800
1
0
null
2011-04-18 08:54:55.037 UTC
17
2012-02-20 13:45:45.817 UTC
2012-02-20 13:45:45.817 UTC
null
675,082
null
675,082
null
1
25
c#|asp.net-mvc-3|binding|viewmodel
9,796
<p>Don't write loops in a view. Use editor templates:</p> <pre><code>&lt;strong&gt;@Model.ContainerName&lt;/strong&gt; @using (Html.BeginForm()) { &lt;fieldset&gt; @Html.EditorFor(x =&gt; x.ItemData) &lt;input type="submit" value="Save" /&gt; &lt;/fieldset&gt; } </code></pre> <p>and inside th...