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
21,100,391
C++ Error: Expected a type specifier
<p>When I try to use a <code>LoggerStream</code> like this, I get 'expected a type specifier':</p> <p><code>const LoggerStream logger(L"Test Component");</code></p> <p>Here's where I'm trying to use the <code>LoggerStream</code>:</p> <pre><code>#include "Logger.h" #include "TestComponent.h" namespace ophRuntime { ...
21,101,550
4
3
null
2014-01-13 20:06:57.09 UTC
5
2014-01-13 21:28:56.11 UTC
2014-01-13 21:28:56.11 UTC
null
158,109
null
158,109
null
1
11
c++
66,457
<p>You can't construct class members like this:-</p> <pre><code> struct TestComponent::TestComponentImpl { private: LoggerStream logger(L"Test Component"); </code></pre> <p>Instead, use an initialization list in the constuctor, like this:</p> <pre><code>struct TestComponent::TestComponentImpl { Lo...
18,575,722
leaflet.js - Set marker on click, update position on drag
<p>for a small project I am working on, I need to be able to place a marker on a leaflet.js powered image-map and update the position of this marker, if it gets dragged. I use the following code to try this, but it fails. I get the error 'marker not defined'. I don't know why it's not working - maybe you guys could hel...
18,601,489
1
0
null
2013-09-02 14:40:27.003 UTC
9
2017-08-02 15:35:57.87 UTC
2017-08-02 15:35:57.87 UTC
null
1,033,581
null
2,323,597
null
1
15
javascript|jquery|maps|marker|leaflet
34,802
<p>In the code snippet above, marker is not defined at the time the event handler is added. Try the following where the dragend listener is added immediately following the creation of the Marker:</p> <pre><code>function onMapClick(e) { gib_uni(); marker = new L.marker(e.latlng, {id:uni, icon:redIcon, draggable...
18,726,419
How to open a magnific popup on page load?
<p>I'm using <a href="http://dimsemenov.com/plugins/magnific-popup/" rel="noreferrer">Magnific Popup</a> and I would like to have a video come up as soon as the page loads in a popup.</p> <p>I got the plugin to work fine, but I have no idea on how to get it to pop up as soon as the page loads, without clicking on the ...
18,726,588
2
0
null
2013-09-10 18:33:24.99 UTC
4
2017-07-04 11:19:39.203 UTC
2017-07-04 11:19:39.203 UTC
null
6,008,139
null
2,758,089
null
1
17
javascript|jquery|html|magnific-popup
45,315
<p>If you're using jQuery you could just listen for the window load event and then call the open method for your Magnific Popup like so:</p> <pre><code>(function($) { $(window).load(function () { // retrieved this line of code from http://dimsemenov.com/plugins/magnific-popup/documentation.html#api ...
1,587,028
Android - configure Spinner to use array
<p>I declare my Spinner in the following manner (it's very static so I have 2 string arrays in <code>array.xml</code> for titles and values)</p> <pre><code>&lt;Spinner android:id="@+id/searchCriteria" android:entries="@array/searchBy" android:entryValues="@array/searchByValues" /&gt; </code></pre> <p>I ex...
4,059,553
3
1
null
2009-10-19 04:55:04.453 UTC
31
2019-07-24 12:20:23.123 UTC
2019-07-24 12:20:23.123 UTC
null
1,000,551
null
135,946
null
1
49
android|arrays|spinner|android-spinner
81,543
<p>Rather than the dual array method, why not fill your ArrayAdapter programmatically with objects of a known type and use that. I've written a tutorial of a similar nature (link at the bottom) that does this. The basic premise is to create an array of Java objects, tell the spinner about the, and then use those obje...
8,447,384
How to order child collections of entities in EF
<p>I have the following query:</p> <pre><code>public IEnumerable&lt;Team&gt; GetAllTeamsWithMembers(int ownerUserId) { return _ctx.Teams .Include(x =&gt; x.TeamMembers) .Where(x =&gt; x.UserId == ownerUserId) .OrderBy(x =&gt; x.Name).ToList(); ...
8,447,471
4
1
null
2011-12-09 15:01:46.13 UTC
6
2021-02-12 17:27:10.817 UTC
null
null
null
null
306,098
null
1
34
linq|entity-framework
33,987
<p>You could load the data and sort in memory after loading it.</p> <pre><code>IEnumerable&lt;Team&gt; teams = _ctx.Teams .Include(x =&gt; x.TeamMembers) .Include(x =&gt; x.TeamMembers.Select(u =&gt; u.User)) .Where(x =&gt; x.UserId == ownerUserId) .OrderBy(x =&gt; x.Nam...
8,516,116
Change Layout(Master Page) of view in ASP.NET MVC without recreate it
<p>I'm using ASP.NET MVC 3 with Razor views. When you want to create a view you can choose a layout (master page) for your view, or leave it to choose Default (_Layout).</p> <p>I am interesting in to change this layout after create a view without recreate it, is there any where to store the layout information about th...
8,516,258
4
1
null
2011-12-15 06:45:19.94 UTC
11
2015-08-12 16:12:57.683 UTC
2012-02-14 05:53:43.407 UTC
null
867,232
null
1,020,476
null
1
50
c#|asp.net|.net|asp.net-mvc|asp.net-mvc-3
97,843
<p>In MVC3 you have <code>_ViewStart.cshtml</code> that stores all pages' Layout; you can change this element to change all pages' Layout or you can add new Layout element in top of target view pages in <code>@{}</code> block like the following to change the layout of the specific page:</p> <pre><code>@{ Layout = ...
27,107,072
Adding null values to arraylist
<p>Can I add <code>null</code> values to an <code>ArrayList</code> even if it has a generic type parameter?</p> <p>Eg.</p> <pre><code>ArrayList&lt;Item&gt; itemList = new ArrayList&lt;Item&gt;(); itemList.add(null); </code></pre> <p>If so, will</p> <pre><code>itemsList.size(); </code></pre> <p>return 1 or 0?</p> ...
27,107,189
3
3
null
2014-11-24 14:26:35.84 UTC
13
2021-06-25 13:36:16.61 UTC
2014-11-24 19:30:41.54 UTC
null
1,221,571
null
4,285,091
null
1
64
java|arraylist
194,713
<p>Yes, you can always use <code>null</code> instead of an object. Just be careful because some methods might throw error.</p> <p>It would be 1.</p> <p>Also <code>null</code>s would be factored in in the for loop, but you could use</p> <pre><code>for (Item i : itemList) { if (i != null) { //code here } }...
1,277,126
Plot Graphs in Java
<p>The Java Swing GUI that I'm developing needs to plot a 2D graph based on the x and y coordinates generated in the program.</p> <p>Is there a Swing component for that?</p> <p>Or is there any other open source package for the purpose?</p>
1,277,144
4
0
null
2009-08-14 10:22:46.94 UTC
6
2018-03-08 11:25:04.687 UTC
2018-03-08 11:25:04.687 UTC
null
6,770,384
null
155,658
null
1
18
java|user-interface|swing|graph|plot
66,249
<p>You should check out <a href="http://www.jfree.org/jfreechart/" rel="noreferrer">JFreeChart</a> which has Swing support. Here are some samples:</p> <p><a href="http://www.jfree.org/jfreechart/samples.html" rel="noreferrer">http://www.jfree.org/jfreechart/samples.html</a></p>
224,765
Splitting WPF interface across multiple Xaml files
<p>I am trying to create a user interface using XAML. However, the file is quickly becoming very large and difficult to work with. What is the best way for splitting it across several files.</p> <p>I would like to be able to set the content of an element such as a ComboBox to an element that is defined in a different ...
224,816
4
0
null
2008-10-22 07:38:55.337 UTC
8
2016-10-17 06:11:51.553 UTC
null
null
null
Dave Turvey
18,966
null
1
57
wpf|xaml
31,725
<p>You can split a large user interface by defining UserControls.</p> <p>Right-click on the solution tree, choose Add->New Item... then User Control. You can design this in the normal way.</p> <p>You can then reference your usercontrol in XAML using a namespace declaration. Let's say you want to include your UserCont...
56,833,469
Typescript error: TS7053 Element implicitly has an 'any' type
<p>this is part of my code:</p> <pre class="lang-js prettyprint-override"><code>const myObj: object = {} const propname = 'propname' myObj[propname] = 'string' </code></pre> <p>but I got error:</p> <pre class="lang-sh prettyprint-override"><code>ERROR in path/to/file.ts(4,1) TS7053: Element implicitly has an 'any' ...
56,833,507
6
1
null
2019-07-01 09:49:53.103 UTC
19
2022-07-14 14:20:37.453 UTC
null
null
null
null
1,842,159
null
1
125
typescript
79,482
<p>You have to define what kind of index type the object has. In your case it is a <code>string</code> based index.</p> <pre><code>const myObj: {[index: string]:any} = {} </code></pre>
56,718,552
Disable gesture to pull down form/page sheet modal presentation
<p>In iOS 13 modal presentations using the form and page sheet style can be dismissed with a pan down gesture. This is problematic in one of my form sheets because the user draws into this box which interferes with the gesture. It pulls the screen down instead of drawing a vertical line.</p> <p>How can you disable the...
57,635,168
16
2
null
2019-06-22 19:36:59.953 UTC
30
2022-07-22 14:05:59.517 UTC
null
null
null
null
1,795,356
null
1
110
ios|uigesturerecognizer|ios13
50,011
<p>In general, you shouldn't try to disable the swipe to dismiss functionality, as users expect all form/page sheets to behave the same across all apps. Instead, you may want to consider using a full-screen presentation style. If you do want to use a sheet that can't be dismissed via swipe, set <code>isModalInPresentat...
47,775,041
Disable autofill in Chrome 63
<p>I just updated my browser to Chrome Version 63.0.3239.84 (Official Build) (64-bit).</p> <p>I then proceeded to go on my website, where I have a input box with <code>autocomplete='off'</code>, yet I still get the following:</p> <p><a href="https://i.stack.imgur.com/PYASx.png" rel="noreferrer"><img src="https://i.st...
47,822,599
15
10
null
2017-12-12 14:30:37.96 UTC
9
2021-04-09 19:45:55.113 UTC
null
null
null
null
4,512,218
null
1
58
html|google-chrome
54,576
<p><strong>Update Apr 2021:</strong></p> <p>Chrome and Firefox support <code>autocomplete=&quot;off&quot;</code></p> <p>Safari continues to ignore <code>autocomplete=&quot;off&quot;</code> and as far as I know there's no good solution fore Safari except to obfuscate the field name.</p> <p><strong>Update Feb 2018:</stro...
21,955,088
7 equal columns in bootstrap
<p>I was wondering if anyone could explain how I can get 7 equal columns in bootstrap? I am trying to make a calendar. This code seems to do 5:</p> <pre><code>div class="row"&gt; &lt;div class="col-md-2 col-md-offset-1"&gt;&lt;/div&gt; &lt;div class="col-md-2"&gt;&lt;/div&gt; &lt;div class="col-md-2"&gt;&l...
21,955,398
18
1
null
2014-02-22 13:40:05.19 UTC
28
2022-09-23 12:01:03.853 UTC
2017-08-05 15:51:28.857 UTC
null
2,756,409
null
1,738,522
null
1
83
html|css|twitter-bootstrap|twitter-bootstrap-3
106,874
<p>Well, IMO you probably need to override the <code>width</code> of the columns by using CSS3 <code>@media</code> query.</p> <p>Here is my attempt to create a 7-col grid system:</p> <pre class="lang-html prettyprint-override"><code>&lt;div class="container"&gt; &lt;div class="row seven-cols"&gt; &lt;div class=...
48,125,093
Xampp localhost/dashboard
<p>I downloaded the recent version of xampp and I installed it and everything but when i type "localhost" in the browser it redirects me to localhost/dashboard is there a way to type localhost and see the directories and files like before?</p> <p>there was some versions of xampp where you just have to change the name ...
48,125,149
6
2
null
2018-01-06 07:06:16.14 UTC
3
2021-09-19 06:56:50.793 UTC
null
null
null
null
9,180,391
null
1
4
php|xampp|localhost|dashboard
170,137
<p>If you want to display directory than edit <code>htdocs/index.php</code> file</p> <p>Below code is display all directory in table</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;...
48,160,125
CMake was unable to find a build program corresponding to "Unix Makefiles"
<p>brand new to coding. I've installed CLion and I plan to start coding on C++. I've also installed Cygwin. I've researched for the last hour or so on how a compiler works and how to use it, but when I selected the compiler on Clion I get the errors</p> <p>"CMake Error: CMake was unable to find a build program corresp...
48,160,189
1
2
null
2018-01-09 01:00:22.93 UTC
6
2022-06-07 14:54:17.12 UTC
null
null
null
null
9,190,493
null
1
23
c++|cmake|clion
78,756
<p>At first glance it seems to me you are missing a compiler. Do you have a compiler installed (ex: g++) or Windows equivalent? You mentioned you are using Cygwin, if you are planning to use gcc/g++ etc. take a look at <a href="https://www.jetbrains.com/help/clion/quick-tutorial-on-configuring-clion-on-windows.html" re...
25,650,263
K means clustering for multidimensional data
<p>if the data set has 440 objects and 8 attributes (dataset been taken from UCI machine learning repository). Then how do we calculate centroids for such datasets. (wholesale customers data) <a href="https://archive.ics.uci.edu/ml/datasets/Wholesale+customers" rel="noreferrer">https://archive.ics.uci.edu/ml/datasets/W...
25,651,433
1
2
null
2014-09-03 17:24:35.543 UTC
12
2014-09-03 18:40:30.573 UTC
2014-09-03 18:00:39.113 UTC
null
2,067,773
null
2,067,773
null
1
9
machine-learning|cluster-analysis
32,835
<p>OK, first of all, in the dataset, 1 row corresponds to a <em>single</em> example in the data, you have 440 rows, which means the dataset consists of 440 examples. Each column contains the values for that specific feature (or attribute as you call it), e.g. column 1 in your dataset contains the values for the feature...
53,687,051
ping: google.com: Temporary failure in name resolution
<pre><code>ping: google.com: Temporary failure in name resolution </code></pre> <p>This problem is what's happing when trying to ping a domain instead of a IP, at this moment in the resolve.conf it has the 127.0.0.57 IP, tried adding this</p> <pre><code>nameserver 8.8.8.8 </code></pre> <p>and it fixed the problem on...
54,460,886
2
3
null
2018-12-08 21:13:54.497 UTC
30
2021-02-06 14:08:22.29 UTC
2021-02-06 14:08:22.29 UTC
null
4,657,412
null
5,183,270
null
1
75
ubuntu|dns|ubuntu-18.04
181,919
<p>I've faced the exactly same problem but I've fixed it with another approache.</p> <p>Using Ubuntu 18.04, first disable <code>systemd-resolved</code> service.</p> <p><code>sudo systemctl disable systemd-resolved.service</code></p> <p>Stop the service</p> <p><code>sudo systemctl stop systemd-resolved.service</code...
20,431,049
What is function User.findOrCreate doing and when is it called in passport?
<p>I can't find documentation on this function and therefor I can't make it work right. When is that function being called, what is it doing and what is it taking as first parameters? I'm trying to get access token from passport, but can't reach it anyhow.</p> <pre><code>passport.use(new FacebookStrategy({ clientI...
20,431,414
2
0
null
2013-12-06 18:28:44.563 UTC
28
2018-03-05 03:57:36.19 UTC
2015-01-06 15:52:34.117 UTC
null
1,266,650
null
2,102,437
null
1
53
node.js|passport.js
38,644
<p><code>User.findOrCreate</code> is a made-up function that represents whatever function you have to find a user by Facebook ID, or to create one if the user doesn't exist. I think your first problem is that your callback URL is just going to your root, so you probably are never getting to that function. </p> <p>Your...
32,579,133
Simplest non-trivial monad transformer example for "dummies", IO+Maybe
<p>Could someone give a super simple (few lines) monad transformer example, which is non-trivial (i.e. not using the Identity monad - that I understand).</p> <p>For example, how would someone create a monad that does IO and can handle failure (Maybe)? </p> <p>What would be the simplest example that would demonstrate ...
32,582,127
3
3
null
2015-09-15 06:28:38.343 UTC
32
2016-11-04 12:30:48.187 UTC
2015-09-15 07:29:30.267 UTC
null
908,515
null
1,198,559
null
1
54
haskell|monads|monad-transformers
8,340
<p>This is available <a href="http://lpaste.net/8735951286651846656">here</a> as a .lhs file.</p> <p>The <code>MaybeT</code> transformer will allow us to break out of a monad computation much like throwing an exception.</p> <p>I'll first quickly go over some preliminaries. Skip down to <strong>Adding Maybe powers to ...
4,577,191
Non-static method requires a target C#
<p>I have a win form app with a listbox displaying methods (by attribute). I am attempting to dynamically invoke methods in a thread, using reflection to get method info from the selected value of the the list box. However, when calling <em>Methodinfo.Invoke</em> I am getting this inner exception "Non-static method re...
4,577,220
1
0
null
2011-01-02 04:53:25.28 UTC
3
2014-04-14 13:31:15.257 UTC
2014-04-14 13:31:15.257 UTC
null
1,279,355
null
560,140
null
1
14
c#|multithreading|reflection
62,285
<p>You are trying to invoke non-static method without providing object instance reference, for which this method should be invoked. Since you are working with methods of <code>MainForm</code> class, you should provide object of <code>MainForm</code> type in the first parameter of <code>MethodInfo.Invoke(Object, Object[...
4,176,377
How to get the full path of the file from a file input
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/3489133/full-path-from-file-input-using-jquery">Full path from file input using jQuery</a> </p> </blockquote> <p>I have the following html element </p> <pre><code>&lt;input type="file" id="upload"&gt; </code><...
4,176,605
1
1
null
2010-11-14 05:58:48.197 UTC
3
2012-10-20 08:56:10.037 UTC
2017-05-23 10:30:55.877 UTC
null
-1
null
157,644
null
1
25
jquery|html
137,260
<p>You cannot do so - the browser will not allow this because of security concerns. Although there are workarounds, the fact is that you shouldn't count on this working. The following Stack Overflow questions are relevant here: </p> <ul> <li><a href="https://stackoverflow.com/questions/3489133/full-path-from-file-inpu...
25,020,129
cin.ignore(numeric_limits<streamsize>::max(), '\n')
<p>What does <code>cin.ignore(numeric_limits&lt;streamsize&gt;::max(), '\n')</code> mean in C++?</p> <p>Does it actually ignore the last input from the user? </p>
25,020,223
3
3
null
2014-07-29 16:18:42.85 UTC
30
2021-08-10 23:33:05.71 UTC
2021-08-10 23:33:05.71 UTC
null
12,299,000
null
3,888,498
null
1
44
c++|cin
56,252
<p>This line ignores the rest of the current line, up to <code>'\n'</code> or <code>EOF</code> - whichever comes first:</p> <ul> <li><code>'\n'</code> sets the delimiter, i.e. the character after which <code>cin</code> stops ignoring</li> <li><code>numeric_limits&lt;streamsize&gt;::max()</code> sets the maximum number...
39,826,711
How to navigate to error lines in Android Studio by shortcut?
<p>How can I navigate to the error lines in a java file? </p> <p>Isn't there any better way than scrolling to them?</p>
39,826,712
5
1
null
2016-10-03 07:46:23.28 UTC
9
2021-06-01 12:03:13.993 UTC
2018-10-19 10:22:48.87 UTC
null
6,325,722
null
6,769,908
null
1
86
android|android-studio
25,834
<p>I searched for it and found the answer.</p> <p>1- you can use <strong>F2</strong> and <strong>SHIFT+F2</strong> shortcut to navigate between errors in your document. if there is no error you will be navigated to the warnings.</p> <p>2- another way that most of us know is to click on the red areas on the scrollbar....
39,732,319
How to inject WCF service client in ASP.Net core?
<p>I have WCF service that I need to access from ASP.NET Core. I have installed <a href="https://visualstudiogallery.msdn.microsoft.com/c3b3666e-a928-4136-9346-22e30c949c08" rel="noreferrer">WCF Connected Preview</a> and created proxy successfully.</p> <p>It created interface &amp; client something like below</p> <pr...
39,732,412
1
2
null
2016-09-27 18:55:20.667 UTC
9
2018-12-16 15:42:56.06 UTC
2018-12-16 15:42:56.06 UTC
null
8,618,595
null
3,862,378
null
1
13
c#|asp.net-core|.net-core|coreclr
23,056
<p>Using the factory method overload seems suitable use case for it. </p> <pre class="lang-cs prettyprint-override"><code>services.AddScoped&lt;IDocumentIntegration&gt;(provider =&gt; { var client = new DocumentIntegrationClient(); // Use configuration object to read it from appconfig.json client.Client...
31,261,035
Select2 disable/enable specific option
<p>I have a list which is of type select2.</p> <pre><code>&lt;select id=&quot;list&quot; class=&quot;form-control select2 select2-hidden-accessible&quot; tabindex=&quot;-1&quot; aria-hidden=&quot;true&quot;&gt; &lt;optgroup label=&quot;Types&quot;&gt; &lt;option value=&quot;None&quot;&gt;None&lt;/option&gt; &lt;option ...
31,263,496
6
9
null
2015-07-07 06:10:52.65 UTC
3
2021-08-30 10:41:24.3 UTC
2020-08-05 05:04:42.233 UTC
null
4,596,556
null
4,596,556
null
1
24
jquery|select|jquery-select2
88,161
<p>Probably easiest way to achieve this, would be calling <code>.select2(…)</code> on the element again after changing the disabled attribute.</p> <p><a href="http://jsfiddle.net/xoxd2u15/" rel="noreferrer">http://jsfiddle.net/xoxd2u15/</a></p> <p>Since select2 <em>replaces</em> the original select field with custom ...
39,248,826
How to solve error converting data type varchar to numeric
<pre><code>SELECT A.SETMOD, B.DESCRP FROM PMS.PSBSTTBL A JOIN PMS.PR029TBL B ON A.SETMOD = B.PAYMOD </code></pre> <p><code>Paymod</code> is of datatype <code>VARCHAR</code>, <code>SETMOD</code> of type <code>decimal</code></p>
39,248,965
3
4
null
2016-08-31 11:48:08.627 UTC
null
2016-08-31 11:54:07.88 UTC
2016-08-31 11:50:25.66 UTC
null
13,302
null
5,762,475
null
1
-1
sql|sql-server|tsql
53,457
<p>Best thing is to convert the decimal to string and compare it with the string value.. make necessary adjustments on the decimal part.. :)</p> <pre><code>SELECT A.SETMOD, B.DESCRP FROM PMS.PSBSTTBL A JOIN PMS.PR029TBL B ON CONVERT(VARCHAR(50),A.SETMOD) = B.PAYMOD </code></pre>
70,022,194
Open .net framework 4.5 project in VS 2022. Is there any workaround?
<p>Is there anyway to open and work on <code>.net framework 4.5</code> project in <code>visual studio 2022</code>.</p> <p>May be problem is not with VS2022 but as <code>.net framework 4.5</code> developer pack is not available any more .. my project can not be changed target version .. Is there any workaround?</p> <p><...
70,109,092
7
3
null
2021-11-18 15:07:00.417 UTC
26
2022-08-02 12:50:15.687 UTC
2021-11-18 15:23:25.42 UTC
null
2,052,085
null
2,052,085
null
1
91
.net|visual-studio|windows-10|.net-framework-version
47,205
<ul> <li>Download <a href="https://www.nuget.org/packages/microsoft.netframework.referenceassemblies.net45" rel="noreferrer">Microsoft.NETFramework.ReferenceAssemblies.net45</a> from nuget.org</li> <li>Open the package as zip</li> <li>copy the files from <code>build\.NETFramework\v4.5\</code> to <code>C:\Program Files ...
26,818,091
Force browser to reload index.htm
<p>how can I force a browser to always load the newest version of index.htm when the page is loaded by entering the URL www.mydomain.com/index.htm or just www.mydomain.com in the browser's address field and pressing enter.</p> <p>I'm trying this in Chrome and the newest version of index.htm is apparently only loaded, ...
26,818,602
3
1
null
2014-11-08 14:26:17.993 UTC
18
2017-05-04 13:21:59.7 UTC
null
null
null
null
617,065
null
1
44
html|caching|reload
93,351
<p>OK, apparently no-cache was not enough. The following does the trick:</p> <pre><code> &lt;meta http-equiv="cache-control" content="no-cache, must-revalidate, post-check=0, pre-check=0" /&gt; &lt;meta http-equiv="cache-control" content="max-age=0" /&gt; &lt;meta http-equiv="expires" content="0" /&gt; &lt;meta...
19,868,838
Call to undefined method Illuminate\Database\Query\Builder::associate()
<p>Reference: <a href="https://stackoverflow.com/questions/16921511/how-can-i-update-an-existing-eloquent-relationship-in-laravel-4">How can I update an existing Eloquent relationship in Laravel 4?</a></p> <pre><code>$userinfo = \Userinfo::find($id); \User::find($id)-&gt;userinfo()-&gt;associate($userinfo)-&gt;save();...
19,993,027
4
0
null
2013-11-08 21:29:47.823 UTC
4
2017-06-17 12:20:45.727 UTC
2017-05-23 10:31:27.11 UTC
null
-1
null
204,406
null
1
24
php|laravel-4|eloquent
74,997
<p>associate() is a method of the belongsTo relationship, but it looks like from the above you are trying to call it via the hasOne relationship.</p> <p>I am just guessing as you have not provided your eloquent model class code so can't see how you have set the relationships exactly, but if you have:</p> <pre><code>c...
6,444,576
Python method name with double-underscore is overridden?
<p>Take a look at this. Note that class <code>B</code> overrides <code>A</code>'s <code>a()</code> method.</p> <pre><code>In [1]: class A(object): ...: def __init__(self): ...: self.a() ...: def a(self): ...: print "A.a()" ...: ...: In [2]: class B(A): ....
6,444,617
2
0
null
2011-06-22 18:18:46.55 UTC
6
2018-01-30 16:59:37.527 UTC
2014-05-12 16:00:48.58 UTC
null
100,297
null
300,781
null
1
30
python
23,887
<p>keywords with a pattern of __* are class private names.</p> <p><a href="http://docs.python.org/reference/lexical_analysis.html#reserved-classes-of-identifiers" rel="nofollow noreferrer">http://docs.python.org/reference/lexical_analysis.html#reserved-classes-of-identifiers</a></p> <p>Quoting:</p> <blockquote> <p...
6,635,417
How do I add Sublime Text 2 keybindings?
<p>I am looking to get the following assigned to Keybindings. I am able to make a snippet for this, yet would prefer to be able to <kbd>CTRL</kbd> + <kbd>></kbd> just like in Textmate.</p> <pre><code>&lt;%= %&gt; </code></pre> <p>What do I need to add and where do I need to add it, or where could I find out.</p>
6,635,457
2
0
null
2011-07-09 14:38:28.547 UTC
12
2013-04-14 03:36:34.163 UTC
2013-04-14 03:36:34.163 UTC
null
150,647
null
577,180
null
1
41
macos|sublimetext
13,827
<p>If you just want to literally insert those characters, you can set up your "User Key Bindings" like this:</p> <pre><code>[ { "keys": ["ctrl+."], "command": "insert", "args": {"characters": "&lt;%= %&gt;"} } ] </code></pre> <p>You can use the Default Key Bindings file as an example for possible key binding comm...
7,493,273
Remove trailing decimal point & zeroes with Regex
<p>Is this the proper REGEX to remove trailing decimal and zeroes from a string? I can't get it to work. What am I missing?</p> <ol> <li>78.000 -> 78</li> <li>78.008 -> 78.008</li> </ol> <p><code>str.replaceAll("^.0*$", "");</code></p>
7,493,292
3
0
null
2011-09-21 00:17:24.807 UTC
5
2011-09-21 00:55:05.297 UTC
null
null
null
null
783,284
null
1
15
java|regex|string
40,034
<p>You need to escape the <code>.</code>, as it is a special character in Regex that matches any character. You also have to remove the <code>^</code>, which anchors at the beginning of the number.</p> <pre><code>str.replaceAll("\\.0*$", ""); </code></pre> <p>You can use a lookbehind if you want to make sure there is...
7,232,405
Examples of XSS that I can use to test my page input?
<p>I have had issues with XSS. Specifically I had an individual inject JS alert showing that the my input had vulnerabilities. I have done research on XSS and found examples but for some reason I can't get them to work.</p> <p>Can I get example(s) of XSS that I can throw into my input and when I output it back to the ...
7,232,426
4
7
null
2011-08-29 15:42:32.57 UTC
8
2017-10-01 11:22:15.407 UTC
null
null
null
null
625,740
null
1
22
php|javascript|security|xss
57,739
<p>You can use this firefox addon:</p> <ul> <li><a href="https://addons.mozilla.org/en-US/firefox/addon/xss-me/" rel="noreferrer">XSS Me</a></li> </ul> <blockquote> <p>XSS-Me is the Exploit-Me tool used to test for reflected Cross-Site Scripting (XSS). It does NOT currently test for stored XSS.</p> <p>The tool works by...
8,153,800
How to set NumberFormat to Number with 0 decimal places
<p>The below VBA in MS Access is run to format my Excel sheet. However, it is formatting to Number with 2 decimal places. How do I specify that I want 0 decimal places?</p> <pre><code> wb.Sheets(1).Range("K:AD").Formula = wb.Sheets(1).Range("K:AD").Value wb.Sheets(1).Range("K:AD").NumberFormat =...
8,153,869
1
0
null
2011-11-16 15:05:08.873 UTC
3
2011-11-16 17:18:01.753 UTC
2018-07-09 19:34:03.733 UTC
null
-1
null
888,737
null
1
9
vba|excel|number-formatting
72,181
<pre><code> wb.Sheets(1).Range("K:AD").NumberFormat = "0" </code></pre>
1,818,729
Java foreach loop: for (Integer i : list) { ... }
<p>When I use JDK5 like below</p> <pre><code>ArrayList&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;(); for (Integer i : list) { //cannot check if already reached last item } </code></pre> <p>on the other hand if I just use an <code>Iterator</code></p> <pre><code>ArrayList&lt;Integer&gt; list...
1,818,742
4
0
null
2009-11-30 09:22:39.71 UTC
2
2013-11-07 16:31:20.01 UTC
2013-11-07 16:31:20.01 UTC
null
1,305,253
null
108,869
null
1
20
java|iterator|foreach
187,007
<p>One way to do that is to use a counter:</p> <pre><code>ArrayList&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;(); ... int size = list.size(); for (Integer i : list) { ... if (--size == 0) { // Last item. ... } } </code></pre> <p><em>Edit</em></p> <p>Anyway, as Tom Hawtin said, it...
2,172,614
Using jQuery .live with toggle event
<p>My code is working, but requiring me to click twice to active my chaining (once for the click event, and once for the toggle event.) What can I do to make it so I only have to click once so that the toggle will automatically occur?</p> <pre><code> //Show or Hide Comments $('#showHideComments').live('click', func...
2,172,622
4
0
null
2010-01-31 17:32:52 UTC
16
2013-12-06 12:35:24.98 UTC
2010-11-10 18:12:58.89 UTC
null
231,435
null
234,240
null
1
20
jquery
21,882
<p>You cannot use <code>live</code> and <code>toggle</code> together. What you can do, is simply make your own "toggle" of sorts:</p> <pre><code>$('#showHideComments').live('click', function() { if($("#addComment").is(':visible')){ $(".commentsSwitch").animate({"marginLeft": "-=53px"}, 500); $("#commen...
49,530,673
Build Flutter app in release mode for iOS
<p>I have Android Studio with Flutter plugin installed. Flutter SDK is also installed on my Mac through Android Studio and I know path to it.</p> <p>I want to run my app in release mode on real iOS device. Not only to hide "slow mode" banner that can be done using this code as I know</p> <pre><code>new MaterialApp( ...
49,532,265
7
5
null
2018-03-28 09:21:32.71 UTC
14
2021-07-14 11:34:04.573 UTC
2020-08-21 10:43:27.713 UTC
user10563627
null
null
1,218,405
null
1
35
android-studio|flutter|dart|build|release
70,728
<p><strong>Building steps</strong></p> <p>If you have problems using flutter command in terminal because it is not found - read <em>Configuring steps</em> below.</p> <p><strong>Step 1</strong></p> <p>Open terminal, run command</p> <pre><code>cd /Users/John/myFlutterApp/ </code></pre> <p>Run </p> <pre><code>flutte...
28,516,962
How WebSocket server handles multiple incoming connection requests?
<p>According to <a href="https://msdn.microsoft.com/en-us/hh969243.aspx" rel="noreferrer">here</a>:</p> <blockquote> <p>The HTTP Upgrade header requests that the server <strong><em>switch the application-layer protocol from HTTP to the WebSocket protocol</em></strong>.</p> <p>The client handshake established ...
28,518,466
4
3
null
2015-02-14 15:10:00.207 UTC
50
2020-06-04 10:05:02.957 UTC
2017-05-23 12:10:16.227 UTC
null
-1
null
264,052
null
1
81
http|websocket|spring-websocket
62,329
<p>Your question is great!</p> <p>I would like to try to answer it from the point of view involving the system calls <code>listen()</code> and <code>accept()</code>. Understanding the behavior of these two calls I think is quite insightful and sufficient to answer your question.</p> <h3>Spoiler: we can answer your qu...
36,421,930
ConnectivityManager.CONNECTIVITY_ACTION deprecated
<p>In Android N, it is mentioned on the official website that "Apps targeting Android N do not receive CONNECTIVITY_ACTION broadcasts". And it is also mentioned that <code>JobScheduler</code> can be used as an alternative. But the <code>JobScheduler</code> doesn't provide exactly the same behavior as <code>CONNECTIVITY...
36,447,866
15
7
null
2016-04-05 09:12:02.713 UTC
52
2022-09-06 08:59:19.077 UTC
2016-04-05 10:03:43.83 UTC
null
5,653,461
null
3,531,097
null
1
115
android
59,274
<p>What will be deprecated is the ability for a backgrounded application to receive network connection state changes.</p> <p>As <a href="https://stackoverflow.com/users/769265/david-wasser">David Wasser</a> said you can still get notified of connectivity changes if the app component is instantiated (not destroyed) and...
7,442,133
try / else with return in try block
<p>I came across a strange behavior in python. I could not find information about this in the python help or on SE so here it is:</p> <pre><code>def divide(x, y): print 'entering divide' try: return x/y except: print 'error' else: print 'no error' finally: print 'exi...
7,442,169
5
0
null
2011-09-16 08:40:39.967 UTC
16
2022-02-16 10:32:19.46 UTC
null
null
null
null
692,799
null
1
62
python|exception-handling
101,407
<p><a href="http://docs.python.org/reference/compound_stmts.html#the-try-statement" rel="noreferrer">http://docs.python.org/reference/compound_stmts.html#the-try-statement</a></p> <blockquote> <p>The optional else clause is executed if and when control flows off the end of the try clause.</p> <p>Currently, co...
7,676,951
How to put spacing between floating divs?
<p>i have a parent div, which can change its size, depending on the available space. Within that div, i have floating divs. Now, i would like to have spacing between these divs, but no space to the parent div (see drawing).</p> <p><img src="https://i.stack.imgur.com/SjiXb.gif" alt="enter image description here"></p> ...
7,685,713
6
0
null
2011-10-06 15:49:00.267 UTC
13
2020-05-04 00:05:55.277 UTC
2011-10-06 16:04:28.567 UTC
null
632,011
null
632,011
null
1
47
css|html
133,388
<p>I found a solution, which at least helps in my situation, it probably is not suitable for other situations:</p> <p>I give all my green child divs a complete margin:</p> <pre><code>margin: 10px; </code></pre> <p>And for the surrounding yellow parent div i set a negative margin:</p> <pre><code>margin: -10px; </cod...
7,637,022
Default value in an asp.net mvc view model
<p>I have this model:</p> <pre><code>public class SearchModel { [DefaultValue(true)] public bool IsMale { get; set; } [DefaultValue(true)] public bool IsFemale { get; set; } } </code></pre> <p>But based on my research and answers here, <code>DefaultValueAttribute</code> does not actually set a default...
7,637,050
6
0
null
2011-10-03 15:20:51.367 UTC
11
2020-07-27 22:41:01.077 UTC
null
null
null
null
400,861
null
1
74
asp.net-mvc|asp.net-mvc-3
152,518
<p>Set this in the constructor:</p> <pre><code>public class SearchModel { public bool IsMale { get; set; } public bool IsFemale { get; set; } public SearchModel() { IsMale = true; IsFemale = true; } } </code></pre> <p>Then pass it to the view in your GET action:</p> <pre><code>[...
7,203,668
How permission can be checked at runtime without throwing SecurityException?
<p>I design a function that may get/set a resource from SD and if not found from sd then take it from Asset and if possible write the asset back to SD<br/> This function may check by method invocation if SD is mounted and accessible...</p> <pre><code>boolean bSDisAvalaible = Environment.getExternalStorageState().equal...
7,203,752
11
0
null
2011-08-26 10:58:11.6 UTC
37
2019-08-16 12:07:16.12 UTC
2011-08-26 11:04:44.953 UTC
null
574,131
null
574,131
null
1
99
android|security|permissions|runtime
135,403
<p>You can use <code>Context.checkCallingorSelfPermission()</code> function for this. Here is an example:</p> <pre><code>private boolean checkWriteExternalPermission() { String permission = android.Manifest.permission.WRITE_EXTERNAL_STORAGE; int res = getContext().checkCallingOrSelfPermission(permission); ...
13,800,289
Configure Git clients, like GitHub for Windows, to not ask for authentication
<p>I have installed GitHub for Windows and also GitExtensions and have multiple versions of git.exe in my path. </p> <p><img src="https://i.stack.imgur.com/5fw28.png" alt="enter image description here"></p> <pre><code>C:\Users\Rajat\AppData\Local\GitHub\PortableGit_93e8418133eb85e81a81e5e19c272776524496c6\cmd\git.exe...
18,607,931
3
1
null
2012-12-10 11:43:18.787 UTC
19
2018-11-07 21:29:30.397 UTC
2013-09-04 16:47:54.663 UTC
null
9,314
null
459,384
null
1
21
git|github|github-for-windows
37,000
<p>For GitHub for Windows itself, <a href="https://stackoverflow.com/users/5728/paul-betts">Paul Betts</a> (<a href="https://github.com/paulcbetts" rel="noreferrer">GitHub staff</a>) gently reminds everyone that <strong>G4W already includes a credential helper</strong> (based on <strong>CryptProtect</strong> and I supp...
13,843,164
How do you store static data in your SQL Server Database Project in VS 2012
<p>I am trying to use the SQL Server Database Project to keep all our table, stored procedure, views etc scripts. I now want a way to be able to keep all our reference (static) data as well. When the tool or project is run it will install all the DB objects and the insert all the reference data.</p> <p>I found similar...
13,994,500
1
1
null
2012-12-12 15:34:16.037 UTC
15
2019-03-10 20:42:36.333 UTC
2019-03-10 20:42:36.333 UTC
null
1,127,428
null
62,544
null
1
23
database|version-control|visual-studio-2012|sql-server-2012
8,722
<p>You can use this approach:</p> <ul> <li>Put your reference data into XML files, one per table</li> <li>Add XML files with reference data to your database project</li> <li>Use a Post-Deployment script to extract the data from XML and merge it into your tables</li> </ul> <p>Here is a more detailed description of eac...
14,064,189
How to ignorecase when using string.text.contains?
<p>I am trying to figure out how to check if a string contains another while ignoring case using .text.contains.</p> <p>As it stands right now If I do this:</p> <pre><code> Dim myhousestring As String = "My house is cold" If txt.Text.Contains(myhousestring) Then Messagebox.Show("Found it") End If </code><...
14,064,213
9
0
null
2012-12-28 03:23:18.53 UTC
2
2020-10-10 13:37:12.537 UTC
2014-11-11 05:44:49.15 UTC
null
405,180
null
1,632,018
null
1
24
.net|vb.net|string
59,570
<p>According to <a href="http://msdn.microsoft.com/en-us/library/ms224424.aspx">Microsoft</a> you can do case-insensitive searches in strings with <code>IndexOf</code> instead of <code>Contains</code>. So when the result of the <code>IndexOf</code> method returns a value greater than <code>-1</code>, it means the seco...
14,332,320
Git no space left on device
<p>I did <strong>git pull --rebase</strong> and I got following error:</p> <pre><code> error: file write error (No space left on device) fatal: unable to write sha1 file fatal: unpack-objects failed </code></pre> <p>I have lot of space on my device. Don't know why it is showing this error. </p> <p>First time I go...
14,332,342
8
1
null
2013-01-15 06:35:41.64 UTC
4
2022-01-26 02:15:32.607 UTC
2020-05-23 02:35:55.61 UTC
null
541,136
null
1,133,674
null
1
25
git|git-rebase|git-pull
48,781
<p>You're out of drive space. Delete some <em>unused</em> files from anywhere on your machine. After you've done some housecleaning, you may think about running <code>git gc</code> to have git garbage collect your repository; if you've made lots of changes to git's objects recently - like can happen with a rebase - you...
14,235,362
Mac install and open mysql using terminal
<p>I downloaded the mysql dmg file and went through the wizard to run. Done. I have also started mysql server under system preferences.</p> <p>The purpose of me doing this is to work through the exercises of my SQL text book. The terminal commands are new to me but I think once I can actually get started, working throu...
14,235,558
12
0
null
2013-01-09 12:37:49.027 UTC
50
2022-09-12 12:20:39.597 UTC
2021-08-28 07:40:13.047 UTC
null
11,573,842
null
1,024,586
null
1
85
mysql|macos|installation|terminal
337,119
<p><em>(Updated for 2017)</em></p> <p>When you installed MySQL it generated a password for the root user. You can connect using</p> <pre><code>/usr/local/mysql/bin/mysql -u root -p </code></pre> <p>and type in the generated password.</p> <p>Previously, the <code>root</code> user in MySQL used to not have a passwor...
13,832,322
How to capture the screenshot of a specific element rather than entire page using Selenium Webdriver?
<p>Currently I'm trying to capture a screenshot using the Selenium WebDriver. But I can only obtain the whole page screen shot. However, what I wanted is just to capture a part of the page or perhaps just on specific element based on ID or any specific element locator. (For example, I wish to capture the picture with i...
13,834,607
23
2
null
2012-12-12 03:32:21.743 UTC
50
2021-11-02 14:36:05.23 UTC
2016-04-06 10:32:20.603 UTC
null
617,450
null
1,713,791
null
1
90
selenium|selenium-webdriver|screenshot
133,141
<p>We can get the element screenshot by cropping entire page screenshot as below:</p> <pre class="lang-java prettyprint-override"><code>driver.get("http://www.google.com"); WebElement ele = driver.findElement(By.id("hplogo")); // Get entire page screenshot File screenshot = ((TakesScreenshot)driver).getScreenshotAs(O...
28,965,847
How to export specific request to file using postman?
<p>I want to export one specific request from a Postman extension (Chromium) and send it to another developer so that they can import it. How I can do this?</p>
28,966,615
8
3
null
2015-03-10 14:05:29.547 UTC
14
2022-02-15 08:13:57.237 UTC
2022-02-04 20:08:43.657 UTC
null
3,739,391
null
2,992,726
null
1
212
rest|postman|webapi
205,189
<p>To do that you need to leverage the "Collections" feature of Postman. This link could help you: <a href="https://learning.getpostman.com/docs/postman/collections/creating_collections/" rel="noreferrer">https://learning.getpostman.com/docs/postman/collections/creating_collections/</a></p> <p>Here is the way to do it...
43,097,102
use RxSwift, driver and bind to
<p>I'm the first time to ask a question,I'm learning RxSwift, how to use bind to and driver, what's the difference between of driver and bind to.Anyone else learning RxSwift now.If you are learning RxSwift or Swift or OC,i hope we can be friends and learn from each other.</p>
43,140,373
2
1
null
2017-03-29 14:54:47.11 UTC
4
2018-10-09 19:45:39.897 UTC
null
null
null
null
5,813,637
null
1
28
rx-swift
29,057
<p>@iwillnot response is fine but I will try to improve it with an example:</p> <p>Imagine you have this code: </p> <pre><code>let intObservable = sequenceOf(1, 2, 3, 4, 5, 6) .observeOn(MainScheduler.sharedInstance) .catchErrorJustReturn(1) .map { $0 + 1 } .filter { $0 &lt; 5 } .shareReplay(1) </...
9,410,485
How do I use class helpers to access strict private members of a class?
<p>This is a follow-up question to: <a href="https://stackoverflow.com/questions/9400170/how-to-hide-a-protected-procedure-of-an-object">How to hide a protected procedure of an object?</a><br> <em>(I'm a bit fuzzy on the whole class helper concept)</em> </p> <p>Suppose I have an class like:</p> <pre><code>type TShy...
9,410,717
2
1
null
2012-02-23 09:42:41.263 UTC
8
2016-06-11 08:26:37.927 UTC
2017-05-23 12:09:56.23 UTC
null
-1
null
650,492
null
1
29
delphi|class-helpers
6,632
<p>Up to, and including Delphi 10.0 Seattle, you can use a class helper to access <code>strict protected</code> and <code>strict private</code> members, like this:</p> <pre><code>unit Shy; interface type TShy = class(TObject) strict private procedure TopSecret; private procedure DirtyLaundry; protect...
49,391,001
Why does the x86-64 / AMD64 System V ABI mandate a 16 byte stack alignment?
<p>I've read in different places that it is done for "performance reasons", but I still wonder what are the particular cases where performance get improved by this 16-byte alignment. Or, in any case, what were the reasons why this was chosen.</p> <p><strong>edit</strong>: I'm thinking I wrote the question in a mislead...
49,397,524
1
10
null
2018-03-20 17:48:44.4 UTC
10
2022-02-03 09:03:26.2 UTC
2022-02-03 08:13:23.743 UTC
null
224,132
null
309,366
null
1
19
assembly|x86-64|memory-alignment|stack-memory|abi
6,907
<p>Note that <strong>the current version of the i386 System V ABI used on Linux also requires 16-byte stack alignment</strong><sup>1</sup>. See <a href="https://sourceforge.net/p/fbc/bugs/659/" rel="nofollow noreferrer">https://sourceforge.net/p/fbc/bugs/659/</a> for some history, and my comment on <a href="https://gc...
32,931,716
ASP.NET Core Dependency Injection with Multiple Constructors
<p>I have a tag helper with multiple constructors in my ASP.NET Core application. This causes the following error at runtime when ASP.NET 5 tries to resolve the type:</p> <blockquote> <p>InvalidOperationException: Multiple constructors accepting all given argument types have been found in type 'MyNameSpace.MyTagHelp...
32,937,952
4
4
null
2015-10-04 08:54:00.753 UTC
8
2021-09-16 11:14:55.24 UTC
2019-06-05 09:36:36.957 UTC
null
1,212,017
null
1,212,017
null
1
66
asp.net|dependency-injection|asp.net-core|asp.net-core-mvc
59,087
<p>Illya is right: the built-in resolver doesn't support types exposing multiple constructors... but nothing prevents you from registering a delegate to support this scenario:</p> <pre><code>services.AddScoped&lt;IService&gt;(provider =&gt; { var dependency = provider.GetRequiredService&lt;IDependency&gt;(); ...
45,984,345
How to turn on/off wifi hotspot programmatically in Android 8.0 (Oreo)
<p>I know how to turn on/off wifi hot spot using reflection in android using below method.</p> <pre><code>private static boolean changeWifiHotspotState(Context context,boolean enable) { try { WifiManager manager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); Method meth...
45,996,578
3
3
null
2017-08-31 14:48:09.133 UTC
9
2019-09-19 07:51:00.15 UTC
2017-10-11 03:20:45.67 UTC
null
1,033,581
null
4,349,688
null
1
19
android|android-wifi|hotspot|android-8.0-oreo
28,561
<p>Finally I got the solution. Android 8.0, they provided public api to turn on/off hotspot. <a href="https://developer.android.com/reference/android/net/wifi/WifiManager.html#startLocalOnlyHotspot(android.net.wifi.WifiManager.LocalOnlyHotspotCallback,%20android.os.Handler)" rel="noreferrer">WifiManager</a></p> <p><st...
19,527,564
Mongo: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145
<p>When I try to run mongo in shell in ubuntu or open rockmongo I see this error: </p> <pre><code>couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145 </code></pre> <p>What's the reason? I tried to reinstall mongo but this didn't help. When I type <code>sudo apt-get purge mongodb-10gen</code> re...
19,527,974
6
3
null
2013-10-22 20:22:17.953 UTC
12
2016-09-15 09:13:55.287 UTC
2013-10-22 20:31:58.953 UTC
null
1,560,062
null
842,692
null
1
19
linux|mongodb|ubuntu
58,512
<p>I assume that you followed the steps, outlined <a href="http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/" rel="noreferrer">here</a>.</p> <p>Most probably you have a problem with mongo lock (or at least I had it once while installing on ubuntu). I solved it with the following commands:</p> <pre><c...
24,827,964
Browserify with twitter bootstrap
<p>There are many similar questions including answers here on stack overflow, but none of them have worked for me, so here I am asking you guys. I appreciate everyone's time.</p> <p>I recently started using gulp with browserify, and that works great. I then tried to use browserify for the front-end using: Backbone an...
24,834,257
4
2
null
2014-07-18 14:54:02.737 UTC
25
2017-11-18 03:58:32.63 UTC
null
null
null
null
1,250,629
null
1
37
javascript|twitter-bootstrap-3|browserify|browserify-shim
24,521
<p>You shouldn't need to shim jquery that way if you've installed it with npm. The following works for a project I've been writing:</p> <p>I've also learned that using npm for bootstrap is kind of a PITA. I've been using bower to install and maintain certain front-end components when they need to be shimmed like this....
24,836,526
Why C++11 in-class initializer cannot use parentheses?
<p>For example, I cannot write this:</p> <pre><code>class A { vector&lt;int&gt; v(12, 1); }; </code></pre> <p>I can only write this:</p> <pre><code>class A { vector&lt;int&gt; v1{ 12, 1 }; vector&lt;int&gt; v2 = vector&lt;int&gt;(12, 1); }; </code></pre> <p>What's the consideration for the differences i...
24,837,067
2
2
null
2014-07-19 03:44:44.293 UTC
16
2022-02-20 08:41:12.1 UTC
2014-08-03 17:23:07.123 UTC
null
2,581,872
null
1,941,113
null
1
36
c++|c++11
4,556
<p>One possible reason is that allowing parentheses would lead us back to the <a href="https://en.wikipedia.org/wiki/Most_vexing_parse">most vexing parse</a> in no time. Consider the two types below:</p> <pre><code>struct foo {}; struct bar { bar(foo const&amp;) {} }; </code></pre> <p>Now, you have a data member of...
1,115,940
Drawing Flame Fractals
<p>I am looking for information on how to draw flame fractals from googling around I could not find much, either pages explain how to use third party tools or way too complicated for me to grasp. Anyone know how/why they work? or point me in the direction of not overly complicated implementations?</p>
1,244,011
5
0
null
2009-07-12 12:20:42.47 UTC
9
2017-11-25 18:31:10.78 UTC
2017-11-25 18:31:10.78 UTC
null
4,099,593
null
89,904
null
1
11
fractals
6,314
<p>I have written a beamer presentation that covers the basics in flame fractals:</p> <p><a href="https://www.math.upenn.edu/~peal/files/Fractals[2009]Beamer[Eng]-PAXINUM.pdf" rel="nofollow noreferrer">https://www.math.upenn.edu/~peal/files/Fractals[2009]Beamer[Eng]-PAXINUM.pdf</a></p> <p>All images are done from my ...
1,318,108
CSS: limit element to 1 line
<p>I want to limit a element to display only 1 line of text, with the remainder hidden (overflow:hidden), without setting a specific height. Is this possible with just CSS? </p>
1,318,119
5
0
null
2009-08-23 08:57:01.877 UTC
9
2021-11-05 17:08:14.98 UTC
2012-12-24 10:06:00.73 UTC
null
745,188
null
118,547
null
1
57
css
64,499
<p>It is possible:</p> <pre><code>element (white-space: nowrap; overflow: scroll;) </code></pre> <p>Text parsed as HTML or XML is tokenized, which means all runs of whitespace are collapsed to a single space character. This means you will have a single line of text unless you specify something in addition to the ove...
308,019
jQuery slideUp().remove() doesn't seem to show the slideUp animation before remove occurs
<p>I have this line of JavaScript and the behavior I am seeing is that the <code>selectedLi</code> instantly disappears without "sliding up". This is not the behavior that I expected.</p> <p>What should I be doing so that the <code>selectedLi</code> slides up before it is removed?</p> <pre><code>selectedLi.slideUp("...
308,034
5
0
null
2008-11-21 06:11:07.607 UTC
16
2016-07-03 19:12:03.66 UTC
null
null
null
spoon16
3,957
null
1
99
javascript|jquery|animation
56,537
<p>Might be able to fix it by putting the call to remove in a callback arg to slideUp? </p> <p>e.g </p> <pre><code>selectedLi.slideUp("normal", function() { $(this).remove(); } ); </code></pre>
520,083
C# lambda - curry usecases
<p>I read <a href="http://jacobcarpenter.wordpress.com/2008/01/02/c-abuse-of-the-day-functional-library-implemented-with-lambdas/" rel="noreferrer">This article</a> and i found it interesting.</p> <p>To sum it up for those who don't want to read the entire post. The author implements a higher order function named Curr...
520,101
6
0
null
2009-02-06 12:16:14.567 UTC
11
2012-08-30 23:18:54.37 UTC
2009-02-06 13:05:32.783 UTC
AZ
35,128
AZ
35,128
null
1
12
c#|.net|lambda
6,560
<p>Its easier to first consider fn(x,y,z). This could by curried using fn(x,y) giving you a function that only takes one parameter, the z. Whatever needs to be done with x and y alone can be done and stored by a closure that the returned function holds on to.</p> <p>Now you call the returned function several times wi...
348,850
Code Coverage tools for PHP
<p>Is there any code coverage tool available for PHP? I wish to check the code coverage of my code and API's written in PHP, but have not been able to lay my hands on any code coverage tool for PHP, as it is more of a server side language and dynamic in nature.</p> <p>Does anyone know of a method by which code coverag...
348,856
6
0
null
2008-12-08 07:30:23.383 UTC
14
2015-09-07 14:25:44.77 UTC
null
null
null
gagneet
35,416
null
1
42
php|code-coverage
37,552
<p><a href="http://www.xdebug.org/" rel="noreferrer">xdebug</a> has <a href="http://www.xdebug.org/docs/code_coverage" rel="noreferrer">Code Coverage Analysis</a>.</p> <p>Check <a href="https://phpunit.de/manual/current/en/code-coverage-analysis.html" rel="noreferrer">this chapter</a> of the PHPUnit Manual</p>
18,150,396
Import a C++ .lib and .h file into a C# project?
<p>I have just started a C# project and want to import a C++ .lib and it's corresponding header (.h) file. </p> <p>I've read various posts that all mention .dll, rather than .lib, which is confusing me. </p> <p>The image below shows the .lib and .h file I'm referring to, all I've done is drag them into the project.</...
18,151,259
3
2
null
2013-08-09 15:32:19.317 UTC
3
2021-10-13 22:13:39.24 UTC
null
null
null
null
1,184,801
null
1
28
c#|c++|import|header|.lib
61,210
<p>What you could do, is creating a C++/CLI wrapper and expose the functionality of the lib you want to use via your wrapper. The created wrapper dll you can easily reference in your C# project. This of course takes a little bit of work to create the managed/unmanaged wrapper, but will pay off in the long run.</p> <p>...
33,339,057
Can I add dns name in aws security group
<p>I have to connect my dynamic IP(which changes every time) to the AWS EC2 machine.<br> For this I mapped my public IP to the domain name(xyz.com), now I am trying to add it to security group.<br> But AWS security group not allowing to add DNS names. Is it the right process to do it, if not please suggest me.</p>
33,345,604
6
3
null
2015-10-26 05:35:30.567 UTC
9
2020-10-12 20:49:28.493 UTC
null
null
null
null
2,799,199
null
1
22
amazon-web-services|amazon-ec2|aws-security-group
34,174
<p>Security Groups and ACLs are not able to resolve DNS hostnames. </p> <p>You can use the AWS CLI to script the update of your IP dynamic address:</p> <p>aws ec2 authorize-security-group-ingress --group-id --protocol tcp --port 22 --cidr /24</p> <p><a href="http://docs.aws.amazon.com/cli/latest/userguide/cli-ec2-s...
22,950,397
Jenkins MultiJob Plugin does not aggregate downstream test results
<p>I am using the jenkins multijob plugin to execute a number of parallel builds in the same build phase and i want to display the test results in the main multijob project so i select a post-build action step to 'Aggregate down stream test results' and select both options 'Automatically aggregate all downstream tests'...
24,128,712
1
2
null
2014-04-08 23:53:09.5 UTC
8
2014-06-09 21:05:06.6 UTC
null
null
null
null
390,116
null
1
9
jenkins|jenkins-plugins
11,227
<p>As a previous poster indicated, this is an open issue in the Jenkins JIRA and does not work. There is a workaround to achieve what your looking for. Your going to need the <a href="https://wiki.jenkins-ci.org/display/JENKINS/Copy+Artifact+Plugin" rel="noreferrer" title="Copy Artifact Plugin">Copy Artifact Plugin</...
1,712,101
PHP MVC Best Practices/"Rules" for Success
<p>I'm sure that someone already posted this question; however, I would like to get all kind of recommendations for MVC on PHP. I know there are many experts out there willing to share their knowledge with people who has doubts about their coding best practices.</p> <ul> <li>How should you organize your Controller?</l...
1,712,300
5
3
null
2009-11-10 23:58:22.423 UTC
9
2016-01-25 12:02:31.557 UTC
null
null
null
null
140,901
null
1
12
php|model-view-controller
12,760
<p>MVC is the most misunderstood design pattern. There is by definition one model. </p> <p>When an urban planner proposes a project, he designs one model for it. The separate entities that the model might be comprised of: buildings, streets, parks, are typically not represented by separate models: they are all face...
2,219,333
Nodejs in-memory storage
<p>How do I store data to be used for all the clients in my server? (like the messages of a chat)</p>
2,222,004
5
0
null
2010-02-08 03:08:40.13 UTC
3
2019-01-18 10:27:15.95 UTC
2019-01-18 10:27:15.95 UTC
null
567,854
user259427
null
null
1
25
storage|node.js
40,989
<p>The server that node.js allows you to build, is an application server, which means that state is preserved, between request, on the server side. The following snippet demonstrates this:</p> <pre><code>var sys = require('sys'), http = require('http'); var number = 0; http.createServer(function (req, res) { ...
1,987,507
How to deploy after a build with TeamCity?
<p>I'm setting up TeamCity as my build server. </p> <p>I have my project set up, it is updating correctly from subversion, and building ok.</p> <p>So what's next? </p> <p>Ideally, I'd like to have it auto deploy to a test server, with a manual deploy to a live/staging server.</p> <p>What's the best way to go about...
4,151,222
5
2
null
2009-12-31 23:44:25.457 UTC
45
2016-03-17 23:44:10.773 UTC
2011-04-02 16:05:55.34 UTC
null
55,164
null
55,164
null
1
76
c#|asp.net|deployment|teamcity
53,368
<p>This article explains how to call Microsoft's WebDeploy tool from TeamCity to deploy a web application to a remote web server. I've been using it to deploy to a test web server and run selenium tests on check-in.</p> <p><a href="http://www.agileatwork.com/automatic-deployment-from-teamcity-using-webdeploy/" rel="no...
1,849,693
Simple Suggestion / Recommendation Algorithm
<p>I am looking for a simple suggestion algorithm to implement in to my Web App. Much like Netflix, Amazon, etc... But simpler. I don't need teams of Phd's working to get a better suggestion metric. </p> <p>So say I have:</p> <ul> <li>User1 likes Object1.</li> <li>User2 likes Object1 and Object2.</li> </ul> <p>I wan...
1,849,715
6
0
null
2009-12-04 21:18:30.14 UTC
17
2015-12-10 00:13:39.403 UTC
2011-10-23 14:20:19.9 UTC
null
157,882
null
75,174
null
1
19
performance|algorithm|autosuggest
9,905
<p>There are many simple and not so simple examples of suggestion algorithms in the excellent <a href="https://rads.stackoverflow.com/amzn/click/com/0596529325" rel="noreferrer" rel="nofollow noreferrer">Programming Collective Intelligence</a></p> <p>The <a href="http://en.wikipedia.org/wiki/Pearson_product-moment_co...
1,834,826
It is a bad practice to use Sun's proprietary Java classes?
<p>The compiler display warnings if you use Sun's proprietary Java classes. I'm of the opinion that it's generally a bad idea to use these classes. I read this somewhere. However, aside from the warnings are there any fundamental reasons why you should not use them?</p>
1,834,836
7
5
null
2009-12-02 18:21:49.91 UTC
5
2012-06-05 09:28:47.577 UTC
2009-12-02 20:25:41.97 UTC
null
63,550
null
124,982
null
1
29
java|sun
17,616
<p>Because they are internal APIs: they are subject to change in a <strong>undocumented</strong> or <strong>unsupported</strong> way and they are bound to a specific JRE/JDK (<strong>Sun</strong> in your case), limiting portability of your programs.</p> <p>Try to avoid uses of such APIs, always prefer a public documen...
1,557,959
How can I find out where a Perl module is installed?
<p>How do get the path of a installed Perl module by name, e.g. <code>Time::HiRes</code>?</p> <p>I want this just because I have to run my perl script on different nodes of a SGE Grid Engine system. Sometimes, even run as other username.</p> <p>I can use CPAN.pm to install packages for myself, but it is not so easy t...
32,342,090
10
2
null
2009-10-13 02:39:24.503 UTC
16
2021-11-12 18:39:44.933 UTC
2009-10-13 07:27:40.927 UTC
null
159,695
null
159,695
null
1
60
perl|path|module|config
87,828
<p><strong>Note</strong>: This solution proposes use of a (self-authored) <em>utility</em> that you must <em>download</em>. While it offers what I believe to be helpful features, installing a third-party solution first is <em>not an option for everyone</em>.</p> <hr> <p>I've created <a href="https://github.com/mkleme...
2,161,337
Can we use any other TAG inside <ul> along with <li>?
<p>Can we use any other TAG in <code>&lt;ul&gt;</code> along with <code>&lt;li&gt;</code>?</p> <p>like</p> <pre><code>&lt;ul&gt; Some text here or &lt;p&gt;Some text here&lt;p&gt; etc &lt;li&gt;item 1&lt;/li&gt; Some text here or &lt;p&gt;Some text here&lt;p&gt; etc &lt;li&gt;item 1&lt;/li&gt; &lt;/ul&gt; </code></pr...
2,161,486
11
1
null
2010-01-29 10:43:06.217 UTC
2
2021-10-26 14:31:30.903 UTC
null
null
null
null
84,201
null
1
56
css|xhtml|accessibility|w3c
70,361
<p>For your code to be valid you can't put any tag inside a <code>&lt;ul&gt;</code> other than an <code>&lt;li&gt;</code>.</p> <p>You can however, put any block level element inside the <code>&lt;li&gt;</code>, like so:</p> <pre><code>&lt;ul&gt; &lt;li&gt; &lt;h2&gt;...&lt;/h2&gt; &lt;...
2,161,388
Calling a parent window function from an iframe
<p>I want to call a parent window JavaScript function from an iframe. </p> <pre><code>&lt;script&gt; function abc() { alert("sss"); } &lt;/script&gt; &lt;iframe id="myFrame"&gt; &lt;a onclick="abc();" href="#"&gt;Call Me&lt;/a&gt; &lt;/iframe&gt; </code></pre>
2,161,402
11
1
null
2010-01-29 10:53:42.223 UTC
91
2021-09-25 05:01:37.157 UTC
2015-06-25 18:49:06.32 UTC
null
2,842,458
null
261,751
null
1
313
javascript|iframe|onclick
484,146
<pre><code>&lt;a onclick="parent.abc();" href="#" &gt;Call Me &lt;/a&gt; </code></pre> <p>See <a href="https://developer.mozilla.org/en/DOM/window.parent" rel="noreferrer">window.parent</a></p> <p>Returns a reference to the parent of the current window or subframe.</p> <p>If a window does not have a parent, its pare...
2,024,566
How to access outer class from an inner class?
<p>I have a situation like so...</p> <pre><code>class Outer(object): def some_method(self): # do something class Inner(object): def __init__(self): self.Outer.some_method() # &lt;-- this is the line in question </code></pre> <p>How can I access the <code>Outer</code> class's m...
2,024,583
13
3
null
2010-01-07 23:49:05.7 UTC
34
2022-07-29 22:19:14.097 UTC
2020-03-04 18:25:20.473 UTC
null
355,230
null
111,375
null
1
160
python|scope|nested|inner-classes
131,913
<p>The methods of a nested class cannot directly access the instance attributes of the outer class. </p> <p>Note that it is not necessarily the case that an instance of the outer class exists even when you have created an instance of the inner class.</p> <p>In fact, it is often recommended against using nested classe...
1,873,873
Why does ReSharper want to use 'var' for everything?
<p>I've just started using ReSharper with Visual Studio (after the many recommendations on SO). To try it out I opened up a recent ASP.NET MVC project. One of the first and most frequent things I've noticed it suggesting is to change most/all my explicit declarations to <code>var</code> instead. For example:</p> <pre>...
1,873,885
23
2
null
2009-12-09 13:24:22.483 UTC
32
2020-07-15 01:19:16.78 UTC
2013-01-29 19:46:46.167 UTC
null
825,637
null
58,244
null
1
228
c#|.net|visual-studio|resharper|var
56,650
<p>One reason is improved readability. Which is better?</p> <pre><code>Dictionary&lt;int, MyLongNamedObject&gt; dictionary = new Dictionary&lt;int, MyLongNamedObject&gt;(); </code></pre> <p>or</p> <pre><code>var dictionary = new Dictionary&lt;int, MyLongNamedObject&gt;(); </code></pre>
2,208,480
jQuery UI DatePicker to show month year only
<p>I am using jQuery date picker to display the calendar all over my app. I want to know if I can use it to display the month and year (May 2010) and not the calendar?</p>
2,209,104
29
4
null
2010-02-05 16:02:43.143 UTC
107
2022-04-21 03:13:41.44 UTC
2018-03-10 06:25:12.617 UTC
null
3,345,644
null
244,138
null
1
388
javascript|jquery|date|jquery-ui|jquery-ui-datepicker
690,104
<p>Here's a hack (updated with entire .html file):</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt; &lt;head&gt; &lt;script src="http://ajax.google...
33,754,445
Margin/padding in last Child in RecyclerView
<p>I'm trying to add Padding/Margin Bottom in the last row and Padding/Margin Top in the first row. I can not do it in the item xml as it would affect all of my Children.</p> <p>I have headers and children in my RecyclerView Adapter so I can not use the</p> <pre><code> android:padding=&quot;4dp&quot; android:clipT...
53,691,028
10
3
null
2015-11-17 10:20:54.32 UTC
22
2021-08-04 13:55:34.52 UTC
2021-01-10 15:51:56.247 UTC
null
2,246,798
null
4,738,178
null
1
163
android|android-recyclerview|padding
81,329
<p>I use this in kotlin to give bottom margin to last item <strong>only</strong></p> <pre><code>override fun onBindViewHolder(holder: RecyclerView.ViewHolder(view), position: Int) { if (position == itemsList.lastIndex){ val params = holder.itemView.layoutParams as FrameLayout.LayoutParams params.bot...
6,510,673
in Screen, how do I send a command to all virtual terminal windows within a single screen session?
<p>I know how to create multiple windows within a single screen session, at startup:</p> <p>But once I have them up and running, is there a way I can have my input be sent to all open windows, not just the one currently in focus?</p>
6,514,516
3
0
null
2011-06-28 17:32:38.563 UTC
19
2015-02-23 11:08:28.913 UTC
2011-11-09 20:24:22.507 UTC
null
496,830
null
39,529
null
1
24
linux|gnu-screen
22,145
<p>I found a good tutorial here to do this:</p> <p><a href="http://blog.cone.be/2009/11/24/gnu-screen-nethack-different-screen-windows-sending-commands-to-all-screen-windows/" rel="noreferrer">http://blog.cone.be/2009/11/24/gnu-screen-nethack-different-screen-windows-sending-commands-to-all-screen-windows/</a></p> <p>F...
6,950,230
How to Calculate Jump Target Address and Branch Target Address?
<p>I am new to <strong>Assembly language</strong>. I was reading about <strong>MIPS</strong> architecture and I am stuck with <strong>Jump Target Address</strong> and <strong>Branch Target Address</strong> and <strong>how to calculate each</strong> of them.</p>
9,795,721
4
0
null
2011-08-05 00:40:47.273 UTC
35
2020-05-12 20:33:24.02 UTC
2018-02-05 07:26:11.84 UTC
null
224,132
user379888
null
null
1
36
assembly|mips|machine-code
122,668
<p>(In the diagrams and text below, <code>PC</code> is the address of the branch instruction itself. <code>PC+4</code> is the end of the branch instruction itself, and the start of the branch delay slot. Except in the absolute jump diagram.)</p> <h1><strong>1. Branch Address Calculation</strong></h1> <p>In MIPS bra...
18,371,090
ActionBarCompat & Transparency
<p>I would like to make the ActionBar in the support library fully transparent, however, it seems that changing the background drawable won't suffice since the backgrounds stack. If you put a semi-transparent background you end up with the default background behind it.</p> <p>Does anyone know a way to remove that back...
18,374,205
2
4
null
2013-08-22 03:12:51.223 UTC
9
2014-01-19 14:27:33.053 UTC
null
null
null
null
2,442,389
null
1
11
android|android-actionbar-compat
5,194
<p>Ok, I found the solution messing around with the SDK. It seems that it is pretty simple, you need to do 3 things:</p> <ul> <li>Create a background drawable as shown on my question.</li> <li><p>Create an ActionBar style like so:</p> <pre><code>&lt;!-- Application theme. --&gt; &lt;style name="AppTheme" parent="Them...
40,049,648
How to add icon to my repository?
<p>I have found that Gitlab and SourceTree support icons for every repositories which make them more specific and easy to find at one glance.</p> <p>How is this possible?</p>
40,049,649
2
3
null
2016-10-14 18:16:24.6 UTC
3
2019-12-04 08:34:29.063 UTC
null
null
null
null
2,359,762
null
1
45
git|user-interface|gitlab|atlassian-sourcetree|sourcetree
25,720
<p>We as a developer sometimes need a change to make our tools look different.</p> <p>You can add a small(I prefer 96px x 96px) <code>logo.png</code> image file to the root of your repository.</p> <p><a href="https://i.stack.imgur.com/7D7sF.png" rel="noreferrer"><img src="https://i.stack.imgur.com/7D7sF.png" alt="rep...
63,782,544
React open mailto E-Mail client onClick with body from textarea
<p>This sounds like it must have been asked before but I could only find how to do this in react native but <strong>I could not find how it's done in normal react for web</strong>. Preferably <em>not</em> with an a tag or Link tag that needs to be styled.</p> <p>Here some code to illustrate what I want to do:</p> <pre>...
63,819,003
4
4
null
2020-09-07 18:23:36.44 UTC
5
2022-07-19 18:48:42.767 UTC
null
null
null
null
828,184
null
1
15
reactjs|mailto
38,276
<p>I ended up creating a component similar to what @GitGitBoom suggested in the comments.</p> <p>Here for future Seekers:</p> <pre><code>import React from &quot;react&quot;; import { Link } from &quot;react-router-dom&quot;; const ButtonMailto = ({ mailto, label }) =&gt; { return ( &lt;Link to=...
5,073,698
Rails 3 Nested Forms
<p>I have a Person model and an Address Model:</p> <pre><code>class Person &lt; ActiveRecord::Base has_one :address accepts_nested_attributes_for :address end class Address &lt; ActiveRecord::Base belongs_to :person end </code></pre> <p>In my people controller I have <code>@person.build_address</code> in my n...
5,075,219
2
2
null
2011-02-22 03:28:17.783 UTC
9
2013-02-26 18:10:02.25 UTC
2011-02-22 03:37:25.353 UTC
null
95,272
null
95,272
null
1
10
ruby-on-rails|ruby-on-rails-3
20,621
<p>You need to have <code>accepts_nested_attributes_for :address</code> on your <code>Person</code> model for this to work nicely. In your <code>create</code> action you can then do this:</p> <pre><code>def create @person = Person.new(params[:person]) ... end </code></pre> <p>Then Rails will take care of the rest...
5,329,529
I want HTML link to .ics file to open in calendar app when clicked, currently opens file as plain text. Suggestions?
<p>I am linking to an <code>.ics</code> file exported from Apple iCal in an HTML web page.</p> <pre><code>&lt;a href="calendar.ics"&gt; </code></pre> <p>This link will open the <code>calendar.ics</code> file as plain text in my browser (Chrome). I want automatic opening in Outlook or iCal or other calendar apps. What...
19,367,636
2
5
null
2011-03-16 17:51:41.617 UTC
14
2021-01-25 17:08:48.717 UTC
2014-04-04 13:23:41.927 UTC
null
241,211
null
224,187
null
1
27
html|hyperlink|calendar|icalendar
82,771
<p>If your site is built on Linux like mine you can simply add a line to your htaccess file to make it open as a download instead of a text page.</p> <p>add this to your htaccess file:</p> <pre><code>AddType text/calendar .ics </code></pre>
16,557,637
How to change active link color in bootstrap css?
<p>I am using joomla 3 and bootstrap.min.js I am creating menu and giving special class in order to change hover, active, visited links and style of the menu. I could not find how to change active link color of menu. Suppose I have 2 menu. Home and Contact. When I am in Home it is red, I want to change this color. I c...
16,558,751
9
6
null
2013-05-15 05:38:48.553 UTC
4
2020-01-12 09:12:36.527 UTC
2013-05-15 06:32:53.47 UTC
null
1,168,751
null
1,168,751
null
1
11
css|twitter-bootstrap
102,850
<p>Finally with experiments I found how to capture it.</p> <pre><code>#top-menu .current a { color: orange !important; } </code></pre> <p>Thank you everyone for your time and help. Much appreciated!</p>
16,288,169
HTTP requests trace
<p>Are there any tools to trace the exact HTTP requests sent by a program?</p> <p>I have an application which works as a client to a website and facilitates certain tasks (particularly it's a bot which makes automatic offers in a social lending webstite, based on some predefined criteria), and I'm interested in monito...
16,288,465
2
1
null
2013-04-29 21:01:40.31 UTC
5
2020-11-27 10:08:38.417 UTC
2014-05-26 02:14:04.663 UTC
null
897,794
null
2,333,665
null
1
12
http|monitoring|trace|http-request
45,157
<p>Some popular protocol/network sniffers are:</p> <ul> <li><a href="http://www.wireshark.org" rel="noreferrer">Wireshark</a> (previous the famous Ethereal)</li> <li><a href="http://www.nirsoft.net/utils/smsniff.html" rel="noreferrer">Nirsoft SmartSniff</a> (using <a href="http://www.winpcap.org/" rel="noreferrer">Win...
645,208
java.rmi.NoSuchObjectException: no such object in table
<p>I am writing a very simple RMI server, and I am seeing intermittent <code>java.rmi.NoSuchObjectExceptions</code> in the unit tests. </p> <p>I have a string of remote method calls on the same object, and while the first few go through, the later ones will sometimes fail. I am not doing anything to unregister the ser...
854,097
7
0
null
2009-03-14 02:24:12.073 UTC
17
2018-12-21 09:01:20.66 UTC
2009-12-11 14:48:09.367 UTC
null
13,940
Thilo
14,955
null
1
28
java|exception|rmi
69,059
<p><strong>Keep a strong reference to the object that implements the <code>java.rmi.Remote</code> interface so that it remains <a href="http://java.sun.com/docs/books/jls/third_edition/html/execution.html#12.6.1" rel="noreferrer">reachable</a>, i.e. ineligible for garbage collection.</strong></p> <p>Below is a short p...
686,905
Labeling file upload button
<p>How can I internationalize the button text of the file picker? For example, what this code presents to the user:</p> <pre><code> &lt;input type="file" .../&gt; </code></pre>
35,767,488
7
1
null
2009-03-26 18:03:54.77 UTC
10
2019-09-30 07:06:52.35 UTC
2010-03-12 20:48:56.753 UTC
Roger Pate
null
mkoryak
26,188
null
1
54
html|internationalization|dialog
144,398
<p>Pure CSS solution:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>.inputfile { /* visibility: hidden etc. wont work */ width: 0.1px; height: 0.1px; opacity: 0; ...
798,655
Embedding an external executable inside a C# program
<p>How do I embed an external executable inside my C# Windows Forms application?</p> <p>Edit: I need to embed it because it's an external free console application (made in C++) from which I read the output values to use in my program. It would be nice and more professional to have it embedded.</p> <p>Second reason is...
799,015
8
2
null
2009-04-28 15:55:55.533 UTC
25
2016-04-25 13:52:48.677 UTC
2010-07-26 23:03:20.94 UTC
null
63,550
null
92,735
null
1
40
c#|windows|embed|executable
85,402
<p>Here is some sample code that would roughly accomplish this, minus error checking of any sort. Also, please make sure that the license of the program to be embedded allows this sort of use.</p> <pre><code>// extracts [resource] into the the file specified by [path] void ExtractResource( string resource, string path...
395,291
Display stocks data from Google Finance or Yahoo! Finance
<p>Can I use the <a href="http://code.google.com/apis/finance/" rel="noreferrer">Google Finance API</a> to get stock data?</p> <p>If there is a Flash or Javascript viewer for such stocks data it would be good.<br> I found some chart components that could be used for the same:</p> <ul> <li><a href="http://www.amcharts...
395,631
9
0
null
2008-12-27 19:01:31.197 UTC
18
2012-12-08 20:15:56.067 UTC
2011-01-25 07:52:54.577 UTC
Jeremy Rudd
41,021
Jeremy Rudd
41,021
null
1
14
flash|charts|stocks|google-finance-api
26,924
<p><a href="http://finance.yahoo.com/q/hp" rel="noreferrer">Yahoo! Finance</a> gives you real-time stock quotes. Data is returned as a CSV.</p> <p>See this NASDAQ page at <a href="http://finance.yahoo.com/q?s=" rel="noreferrer">http://finance.yahoo.com/q?s=</a>^IXIC</p> <ol> <li><p>Click the Download Data button to a...
765,419
Javascript word-count for any given DOM element
<p>I'm wondering if there's a way to count the words inside a div for example. Say we have a div like so:</p> <pre><code>&lt;div id="content"&gt; hello how are you? &lt;/div&gt; </code></pre> <p>Then have the JS function return an integer of 4.</p> <p>Is this possible? I have done this with form elements but can't s...
765,427
9
0
null
2009-04-19 13:35:01.607 UTC
11
2021-01-14 00:53:37.58 UTC
null
null
null
null
71,809
null
1
19
javascript
20,278
<p>If you know that the DIV is <em>only</em> going to have text in it, you can <a href="http://en.wikipedia.org/wiki/KISS_principle" rel="noreferrer">KISS</a>:</p> <pre><code>var count = document.getElementById('content').innerHTML.split(' ').length; </code></pre> <p>If the div can have HTML tags in it, you're going ...
922,695
removing provisioning profile from xcode
<p>How can I remove a previously installed development provisioning profile from xcode? </p>
922,830
9
0
null
2009-05-28 19:16:37.643 UTC
17
2018-11-04 02:22:18.567 UTC
null
null
null
null
97,405
null
1
50
iphone
57,646
<p>It sounds like you'd want to remove it from your iPhone. I'm not in front of my Mac at the moment but I believe that within XCode there is an Organizer (Look under the view menu option, make sure your iPhone is plugged in) you can open up where you can access your provisioning profile to remove or replace it. I'll ...
844,536
Advantages of stateless programming?
<p>I've recently been learning about functional programming (specifically Haskell, but I've gone through tutorials on Lisp and Erlang as well). While I found the concepts very enlightening, I still don't see the practical side of the "no side effects" concept. What are the practical advantages of it? I'm trying to thi...
844,548
9
0
null
2009-05-10 02:09:53.223 UTC
84
2021-06-29 18:25:24.91 UTC
2012-05-27 21:10:32.347 UTC
null
104,184
null
104,184
null
1
149
functional-programming|state|immutability
65,300
<p>Read <a href="http://www.defmacro.org/ramblings/fp.html" rel="noreferrer">Functional Programming in a Nutshell</a>.</p> <p>There are lots of advantages to stateless programming, not least of which is <em>dramatically</em> multithreaded and concurrent code. To put it bluntly, mutable state is enemy of multithreaded ...
592,322
PHP expects T_PAAMAYIM_NEKUDOTAYIM?
<p>Does anyone have a <code>T_PAAMAYIM_NEKUDOTAYIM</code>?</p>
592,326
11
2
null
2009-02-26 20:34:52.957 UTC
78
2022-04-11 23:17:38.713 UTC
2022-04-11 23:17:38.713 UTC
null
1,946,501
Peter Turner
1,765
null
1
625
php|runtime-error|syntax-error|error-code
177,531
<p>It’s the double colon operator <a href="http://php.net/manual/en/language.oop5.paamayim-nekudotayim.php" rel="noreferrer"><code>::</code></a> (see <a href="http://docs.php.net/manual/en/tokens.php" rel="noreferrer">list of parser tokens</a>).</p>
186,918
C# - How to change HTML elements attributes
<p>My master page contains a list as shown here. What I'd like to do though, is add the "class=active" attribute to the list li thats currently active but I have no idea how to do this. I know that the code goes in the aspx page's page_load event, but no idea how to access the li I need to add the attribute. Please enl...
187,023
12
0
null
2008-10-09 11:56:36.677 UTC
5
2019-10-08 10:22:37.59 UTC
2015-02-01 16:58:21.673 UTC
Longhorn213
3,204,551
Sir Psycho
17,211
null
1
18
c#|html|asp.net
85,047
<p>In order to access these controls from the server-side, you need to make them runat="server"</p> <pre><code>&lt;ul id="nav" runat="server"&gt; &lt;li class="forcePadding"&gt;&lt;img src="css/site-style-images/menu_corner_right.jpg" /&gt;&lt;/li&gt; &lt;li id="screenshots"&gt;&lt;a href="screensho...
128,618
File-size format provider
<p>Is there any easy way to create a class that uses <strong>IFormatProvider</strong> that writes out a user-friendly file-size?</p> <pre><code>public static string GetFileSizeString(string filePath) { FileInfo info = new FileInfo(@"c:\windows\notepad.exe"); long size = info.Length; string sizeString = siz...
128,683
12
2
null
2008-09-24 17:44:34.957 UTC
27
2021-10-11 02:47:47.647 UTC
2016-09-20 13:17:37.023 UTC
Seb Nilsson
107,625
Seb Nilsson
2,429
null
1
72
c#|formatting|filesize
47,689
<p>I use this one, I get it from the web</p> <pre><code>public class FileSizeFormatProvider : IFormatProvider, ICustomFormatter { public object GetFormat(Type formatType) { if (formatType == typeof(ICustomFormatter)) return this; return null; } private const string fileSizeFormat = "fs...
190,344
WPF Blurry fonts issue- Solutions
<p>Problem is described and demonstrated on the following links:</p> <ul> <li><a href="https://web.archive.org/web/20081123055336/http://paulstovell.com/blog/wpf-why-is-my-text-so-blurry" rel="noreferrer">Paul Stovell WPF: Blurry Text Rendering </a></li> <li><a href="http://www.gamedev.net/community/forums/topic.asp...
190,521
12
4
null
2008-10-10 06:50:27.183 UTC
86
2022-07-15 19:39:54 UTC
2019-04-11 06:47:36.6 UTC
Robert Vuković
438,025
Vule
438,025
null
1
156
wpf|fonts
66,426
<h3>Technical background</h3> <p>There is a in-depth article about WPF Text rendering from one of the WPF Text Program Managers on windowsclient.net: <a href="http://windowsclient.net/wpf/white-papers/wpftextclarity.aspx" rel="noreferrer">Text Clarity in WPF</a>.</p> <p>The problem boils down to WPF needing a linearl...
158,716
How do you efficiently generate a list of K non-repeating integers between 0 and an upper bound N
<p>The question gives all necessary data: what is an efficient algorithm to generate a sequence of <em>K</em> non-repeating integers within a given interval <em>[0,N-1]</em>. The trivial algorithm (generating random numbers and, before adding them to the sequence, looking them up to see if they were already there) is v...
158,847
13
4
null
2008-10-01 17:21:30.637 UTC
14
2022-06-20 17:17:07.493 UTC
2017-05-23 11:47:16.903 UTC
null
-1
tucuxi
15,472
null
1
28
arrays|algorithm|random|permutation
19,731
<p>The <a href="https://docs.python.org/2/library/random.html#random.sample" rel="nofollow noreferrer">random module</a> from Python library makes it extremely easy and effective:</p> <pre><code>from random import sample print sample(xrange(N), K) </code></pre> <p><code>sample</code> function returns a list of K uniq...
363,425
How to wrap long lines without spaces in HTML?
<p>If a user types in a long line without any spaces or white space, it will break formating by going wider than the current element. Something like:</p> <blockquote> <p>HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA.............................................................................................................
363,521
14
3
null
2008-12-12 17:03:49.393 UTC
13
2017-06-22 23:00:28.323 UTC
2011-11-09 09:41:49.483 UTC
Chris Bartow
53,114
Chris Bartow
497
null
1
69
php|html|css|word-wrap
83,957
<p>I haven't personally used it, but <a href="http://code.google.com/p/hyphenator/" rel="nofollow noreferrer">Hyphenator</a> looks promising.</p> <p>Also see related (possibly duplicate) questions:</p> <ul> <li><a href="https://stackoverflow.com/questions/322929/word-wrap-in-css-js">word wrap in css / js</a></li> <li...