id
int64
4
73.8M
title
stringlengths
10
150
body
stringlengths
17
50.8k
accepted_answer_id
int64
7
73.8M
answer_count
int64
1
182
comment_count
int64
0
89
community_owned_date
stringlengths
23
27
creation_date
stringlengths
23
27
favorite_count
int64
0
11.6k
last_activity_date
stringlengths
23
27
last_edit_date
stringlengths
23
27
last_editor_display_name
stringlengths
2
29
last_editor_user_id
int64
-1
20M
owner_display_name
stringlengths
1
29
owner_user_id
int64
1
20M
parent_id
null
post_type_id
int64
1
1
score
int64
-146
26.6k
tags
stringlengths
1
125
view_count
int64
122
11.6M
answer_body
stringlengths
19
51k
2,226,227
Embedded C++ : to use exceptions or not?
<p>I realize this may be subjective, so will ask a concrete question, but first, background: </p> <p>I have always been an embedded software engineer, but usually at Layer 3 or 2 of the OSI stack. I am not really a hardware guy. I have generally always done telecoms products, usually hand/cell-phones, which generally...
2,226,262
5
9
null
2010-02-09 01:46:56.687 UTC
18
2022-07-30 16:09:17.313 UTC
2010-02-09 01:50:33.97 UTC
null
59,111
null
192,910
null
1
48
c++|exception|exception-handling|embedded
17,414
<p>In terms of performance, my understanding is that exceptions actually reduce the size and increase the performance of the <em>normal</em> execution paths of code, but make the exceptional/error paths more expensive. (often a <em>lot</em> more expensive). </p> <p>So if your only concern is performance, I would say d...
1,641,580
What is data oriented design?
<p>I was reading <a href="http://gamesfromwithin.com/data-oriented-design" rel="noreferrer">this article</a>, and this guy goes on talking about how everyone can greatly benefit from mixing in data oriented design with OOP. He doesn't show any code samples, however.</p> <p>I googled this and couldn't find any real inf...
2,021,868
6
3
null
2009-10-29 04:13:33.353 UTC
133
2022-08-22 20:16:00.36 UTC
2017-02-03 00:14:30.53 UTC
null
792,066
null
49,018
null
1
208
data-oriented-design
94,869
<p>First of all, don't confuse this with data-driven design.</p> <p>My understanding of Data-Oriented Design is that it is about organizing your data for efficient processing. Especially with respect to cache misses etc. Data-Driven Design on the other hand is about letting data control a lot of the behavior of your pr...
1,420,724
cobertura on maven multi module project
<p>I have a Maven project with 4 modules - 3 of them contain code and some tests (testing equals and hashcode of the classes) whereas the 4th module is for testing the 3 other modules.</p> <p>Now I want to run the cobertura code coverage tool to get an overview which classes are well tested and which are not. I did so...
18,282,605
7
0
null
2009-09-14 10:21:54.143 UTC
5
2019-05-30 12:45:22.493 UTC
2012-05-31 09:53:12.87 UTC
null
65,542
null
65,542
null
1
30
maven-2|cobertura
19,792
<p>As of version 2.6, there is an aggregate option that can be set to true in the parent pom:</p> <pre><code>&lt;reporting&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt; &lt;artifactId&gt;cobertura-maven-plugin&lt;/artifactId&gt; &lt;version&gt;2.6&lt;/version&gt; ...
1,543,481
How to convert String object to Date object?
<p>How can I convert a String object to a Date object?</p> <p>I think I need to do something like this:</p> <pre><code>Date d=(some conversion ) "String " </code></pre> <p>Any help would be greatly appreciated.</p>
1,543,487
8
0
null
2009-10-09 12:28:27.737 UTC
2
2017-05-22 12:17:27.897 UTC
2011-11-08 05:41:54.867 UTC
user166390
null
null
96,180
null
1
10
java|date
38,576
<pre><code> SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy"); Date date = dateFormat.parse("1.1.2001"); </code></pre> <p>For details refer to: <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html" rel="nofollow noreferrer">SimpleDateFormat documentation</a></p>
2,227,702
PHP mailer error
<p>I tried to use php mailer but errors as follows.</p> <pre><code>SMTP -&gt; FROM SERVER: SMTP -&gt; FROM SERVER: SMTP -&gt; ERROR: EHLO not accepted from server: SMTP -&gt; FROM SERVER: SMTP -&gt; ERROR: HELO not accepted from server: SMTP -&gt; ERROR: AUTH not accepted from server: SMTP -&gt; NOTICE: EOF caught whi...
2,228,063
9
1
null
2010-02-09 08:32:21.67 UTC
3
2015-11-06 06:36:36.133 UTC
2013-04-20 05:37:34.987 UTC
null
166,476
null
166,476
null
1
10
php|phpmailer
58,283
<p>Some servers (especially shared hosting) will block you from using SSL with SMTP, I had the same problem once.</p> <p>Either change host if you can, try using the default PHP mail() function or send through another mail server that does not require SSL e.g. port 25 not 465.</p> <p>Something like <a href="http://ww...
2,007,357
How to set DOM element as first child?
<p>I have an element E and I'm appending some elements to it. All of a sudden, I find out that the next element to append should be the first child of E. What's the trick, how to do it? Method unshift doesn't work because E is an object, not array.</p> <p>Long way would be to iterate through E's children and to move'em...
2,007,473
9
1
null
2010-01-05 16:19:40.37 UTC
49
2022-06-17 04:17:03.923 UTC
2022-06-17 04:17:03.923 UTC
null
1,402,846
null
83,910
null
1
356
javascript|jquery|arrays|dom|element
298,474
<pre><code>var eElement; // some E DOM instance var newFirstElement; //element which should be first in E eElement.insertBefore(newFirstElement, eElement.firstChild); </code></pre>
1,602,451
C++ valarray vs. vector
<p>I like vectors a lot. They're nifty and fast. But I know this thing called a valarray exists. Why would I use a valarray instead of a vector? I know valarrays have some syntactic sugar, but other than that, when are they useful?</p>
1,602,594
9
3
null
2009-10-21 17:53:31.017 UTC
57
2022-04-02 16:22:05.83 UTC
2016-07-22 19:21:39.55 UTC
null
2,411,320
null
72,631
null
1
180
c++|stl|stdvector|c++-standard-library|valarray
62,888
<p>Valarrays (value arrays) are intended to bring some of the speed of Fortran to C++. You wouldn't make a valarray of pointers so the compiler can make assumptions about the code and optimise it better. (The main reason that Fortran is so fast is that there is no pointer type so there can be no pointer aliasing.)</p> ...
1,903,453
What disadvantages are there to the <button> tag?
<p>I started using a diagnostic css stylesheet, e.g. <a href="http://snipplr.com/view/6770/css-diagnostics--highlight-deprecated-html-with-css--more/" rel="nofollow noreferrer">http://snipplr.com/view/6770/css-diagnostics--highlight-deprecated-html-with-css--more/</a></p> <p>One of the suggested rules highlights input...
2,205,598
11
7
null
2009-12-14 20:59:07.383 UTC
15
2019-01-17 03:25:07.75 UTC
2018-12-30 03:22:55.527 UTC
null
69,993
null
69,993
null
1
64
css|button|tags|internet-explorer-7|diagnostics
33,516
<p>Answering from an ASP.NET perspective.</p> <p>I was excited when I found <a href="https://stackoverflow.com/questions/187482/how-can-i-use-the-button-tag-with-asp-net">this question</a> and some code for a ModernButton control, which, in the end, is a <code>&lt;button&gt;</code> control.</p> <p>So I started adding...
1,861,294
How to Calculate Execution Time of a Code Snippet in C++
<p>I have to compute execution time of a C++ code snippet in seconds. It must be working either on Windows or Unix machines.</p> <p>I use code the following code to do this. (import before)</p> <pre><code>clock_t startTime = clock(); // some code here // to compute its execution duration in runtime cout &lt;&lt; dou...
1,861,337
18
7
null
2009-12-07 16:56:07.237 UTC
62
2021-03-09 20:37:39.58 UTC
2014-08-03 13:09:59.433 UTC
null
1,009,479
null
54,929
null
1
127
c++|benchmarking
175,753
<p>You can use this function I wrote. You call <code>GetTimeMs64()</code>, and it returns the number of milliseconds elapsed since the unix epoch using the system clock - the just like <code>time(NULL)</code>, except in milliseconds.</p> <p>It works on both windows and linux; it is thread safe.</p> <p>Note that the g...
17,833,674
Sass ampersand, select immmediate parent?
<p>Is there a way in Sass to use the ampersand to select the immediate parent, rather than the parent selector of the entire group? For example:</p> <pre><code>.wrapper{ background-color: $colour_nav_bg; h1{ color: $colour_inactive; .active &amp;{ color: red; } } } </cod...
17,842,684
6
3
null
2013-07-24 12:11:11.643 UTC
6
2021-01-16 07:07:49.65 UTC
2013-07-24 13:47:37.477 UTC
null
1,026,353
null
963,903
null
1
39
sass
22,788
<p>As of this writing, there is no Sass selector for the direct parent instead of the root parent of an element. There is <code>&amp;</code> which (as you know) selects the root parent. There are also <code>%</code> <a href="http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#placeholder_selectors_" rel="norefe...
6,642,599
How to add new button to order view in Magento admin panel?
<p>How to add custom button to order view page near "Back" and "Edit"?</p>
25,565,340
4
0
null
2011-07-10 17:21:13.647 UTC
9
2014-08-29 09:22:12.907 UTC
null
null
null
null
748,779
null
1
24
magento|button|admin
30,818
<p>Instead of core hacks or rewrites, just use an observer to add the button to the order:</p> <pre><code>&lt;adminhtml&gt; &lt;events&gt; &lt;adminhtml_widget_container_html_before&gt; &lt;observers&gt; &lt;your_module&gt; &lt;class&gt;your_module/observer&l...
11,172,956
How do I know if a specific twitter user is online or not?
<p>How do I know if a specific twitter user is currently online by writing programs? Is there any API or data field in the web page showing this information? Both browsing Twitter webpage and using Twitter app are considered "online".</p>
11,173,464
4
0
null
2012-06-23 21:01:59.57 UTC
1
2020-02-21 19:15:26.217 UTC
2012-06-23 21:11:39.627 UTC
null
1,042,359
null
1,042,359
null
1
2
twitter
72,253
<p>Although this information is not readily available, you can do a work around. Make use of Twitter's Streaming API: <a href="https://dev.twitter.com/docs/streaming-apis/streams/public" rel="nofollow">https://dev.twitter.com/docs/streaming-apis/streams/public</a> (have a read through this document).</p> <p>You'll mos...
23,603,735
attempting to reference a deleted function
<p>I'm trying to learn about the fstream class and I'm having some trouble. I created a couple of txt files, one with a joke and the other with a punchline (joke.txt) and (punchline.txt) just for the sake of reading in and displaying content. I ask the user for the file name and if found it should open it up, clear the...
23,603,847
1
3
null
2014-05-12 07:55:27.443 UTC
2
2019-07-14 10:01:58.2 UTC
2018-02-21 20:37:10.757 UTC
null
2,881,149
null
2,881,149
null
1
21
c++|string|function|fstream|ifstream
87,122
<p>You do call a deleted function, being the copy constructor of the class <code>std::ifstream</code>.</p> <p>If you take a look <a href="http://www.cplusplus.com/reference/fstream/ifstream/ifstream/">at the reference</a> you notice, that the copy constructor is not allowed.</p> <p>so instead of using:</p> <pre><cod...
18,338,908
Determining proxy server/port
<p>I apologize if this is a simplistic question, I am not familiar with this kind of thing.</p> <p>I am trying to determine my proxy server ip and port number in order to use a google calendar syncing program. I downloaded the proxy.pac file using google chrome. The last line reads:</p> <pre><code>return "PROXY proxy...
21,248,806
2
1
null
2013-08-20 15:20:53.667 UTC
1
2017-03-28 06:02:24.673 UTC
null
null
null
null
2,700,426
null
1
2
proxy|pac
38,209
<p>Are you using the Windows operating system? </p> <p>You can press <kbd>Win</kbd>+<kbd>R</kbd>, input "cmd" in the run box, you will get the "command Prompt", then input the following command and press <kbd>Enter</kbd>.</p> <p>command 1</p> <pre><code>ipconfig /all | find /i "Dns Suffix" </code></pre> <p>it will...
15,812,191
Set JFrame to center of Screen in NetBeans
<p>I am developing a java swing desktop application with NetBeans and I want to set the JFrame to the centre of the screen.</p> <p>from the net I understand that I can use </p> <pre><code>setLocationRelativeTo(null); </code></pre> <p>to set the frame to the centre But i am unable to insert the code into the NetBea...
15,812,361
9
2
null
2013-04-04 13:09:55.607 UTC
2
2018-08-01 18:52:59.87 UTC
2018-08-01 18:52:59.87 UTC
null
9,991,599
null
2,213,170
null
1
9
java|swing|jframe|netbeans-7
80,662
<p>Is <code>setVisible()</code> on generated code? Strange. Anyway, you can right click the <code>JFrame</code> in <code>Navigator</code> and select <code>Properties</code>. Go to <code>Code</code> and select it to do nothing. Then manually insert you code after <code>initComponents()</code> in the <code>JFrame</code> ...
19,284,012
Python SQLAlchemy Query: AttributeError: 'Connection' object has no attribute 'contextual_connect'
<p>I am trying to follow this <a href="http://docs.sqlalchemy.org/en/rel_0_8/orm/tutorial.html" rel="noreferrer">tutorial</a> from <code>SQLAlchemy</code> on how to create entries in and query a MYSQL database in python. When I try and query the database for the first time following along in their <a href="http://docs....
19,284,123
2
2
null
2013-10-09 22:36:49.38 UTC
1
2019-03-11 12:37:56.54 UTC
2013-10-09 23:35:45.263 UTC
null
2,327,821
null
2,327,821
null
1
12
python|mysql|database|orm|sqlalchemy
38,811
<p>You must bind the session to a SQLAlchemy engine, not directly to a MySQLDb connection object.</p> <pre><code>engine = create_engine("mysql://user:password@host/dbname") Session.configure(bind=engine) </code></pre> <p>(You can remove your <code>db1</code> variable.)</p> <p>From the tutorial:</p> <blockquote> <...
40,167,038
Using Realm in React Native app with Redux
<p>I am about to undertake the development of a React Native app and am thoroughly convinced of the benefits of managing the app's state using Redux, however I'd like to make the app's data available whilst offline by using Realm for persistent storage. What I'm wondering is how Redux will play with Realm?</p> <p>The ...
42,073,959
1
4
null
2016-10-21 01:38:19.28 UTC
3
2017-02-06 17:49:17.773 UTC
null
null
null
null
2,987,737
null
1
29
sqlite|react-native|redux|realm|asyncstorage
7,528
<p>The redux store is good when you have only react components dealing with the data. The store is a good way to maintain your application's state. For example, you do not need Realm to store the current login status or flags indicating whether the user has skipped login. The redux store wins the game here.</p> <p>On ...
27,474,764
Changing fontsize in python subplots
<p>I have made a phase plot of a bistable stable, with the nulclines on the main graph and have added a subplot with the trajectories overlaying it. However, no matter what I try, I cannot seem to get the x and y labels to increase in font size to 20.</p> <p>Any help would be greatly appreciated.</p> <p>Although ther...
27,475,301
2
2
null
2014-12-14 22:16:29.403 UTC
4
2014-12-14 23:34:03.517 UTC
2014-12-14 23:25:25.643 UTC
null
95,852
null
4,132,451
null
1
15
python|matplotlib|font-size|subplot
76,993
<p>Here are the changes I made to the last bit of your code:</p> <pre><code>fig = plt.figure(figsize=(6,6)) # 6x6 image ax = plt.gca() #SubplotZero(fig,111,) #Plot arrows over figure #fig.add_subplot(ax) # Plot arrows over figure # Plot both nulcines on same graph plt.axis((0,1,0,1)) ax.set_title('v = 1',fon...
51,159,010
How do I upgrade "keras" from 1.2.0 to 2.0.0?
<p>I am running an image classifier but it keeps producing the error </p> <blockquote> <p>Keras loaded from keras Python module v1.2.0, however version 2.0.0 is required. Please update the keras Python package. Error in py_call_impl(callable, dots$args, dots$keywords) : TypeError: <strong>init</strong>() got ...
51,159,501
5
6
null
2018-07-03 16:10:39.17 UTC
0
2020-09-06 11:44:18.66 UTC
2018-07-03 16:24:22.053 UTC
null
10,027,843
null
10,027,843
null
1
3
python|r|keras
42,222
<p>Try to uninstall the keras first:</p> <pre><code>pip uninstall keras </code></pre> <p>then install it :</p> <pre><code>pip install keras==version_number </code></pre>
4,985,917
cocos2d-iOS - Gesture recognisers
<p>Has anyone managed to get the gesture recognition working in cocos-2d?</p> <p>I have read a post here that claimed to have achieved it, here: <a href="http://www.cocos2d-iphone.org/forum/topic/8929" rel="noreferrer">http://www.cocos2d-iphone.org/forum/topic/8929</a></p> <p>I patched from the git hub here: <a href=...
5,019,536
2
0
null
2011-02-13 18:13:06.61 UTC
12
2012-03-15 09:15:20.223 UTC
null
null
null
null
296,446
null
1
9
iphone|cocos2d-iphone
14,788
<p>You need to attach the gesture recognizer to something "up the chain". Don't attach them to the individual nodes; attach them to the UIView (i.e., [[CCDirector sharedDirector] openGLView]).</p> <p>Here's what I did:</p> <pre><code>- (UIPanGestureRecognizer *)watchForPan:(SEL)selector number:(int)tapsRequired { ...
5,292,184
Merging multiple branches with git
<p>I have 2 local branches called "develop" and "master"; they are similar. On my company's server there's one "main" repo (production) and several branches that were made by other developers:</p> <pre> $ git branch -a * develop master remotes/origin/HEAD -> origin/master remotes/origin/some-test remotes/origi...
5,292,267
2
0
null
2011-03-13 20:33:11.523 UTC
17
2018-10-03 02:04:40.563 UTC
2018-10-03 02:04:40.563 UTC
null
9,598,095
null
598,717
null
1
30
git|merge|rebase
55,698
<ol> <li><code>git checkout master</code></li> <li><code>git pull origin feature1 feature2</code></li> <li><code>git checkout develop</code></li> <li><code>git pull . master</code> (or maybe <code>git rebase ./master</code>)</li> </ol> <p>The first command changes your current branch to <code>master</code>.</p> <p>Th...
1,088,752
How to programmatically discover mapped network drives on system and their server names?
<p>I'm trying to find out how to programmatically (I'm using C#) determine the name (or i.p.) of servers to which my workstation has current maps. In other words, at some point in Windows Explorer I mapped a network drive to a drive letter (or used "net use w: " to map it). I know how to get the network drives on the...
1,088,905
7
1
null
2009-07-06 19:14:03.78 UTC
16
2015-10-21 10:38:50.157 UTC
null
null
null
null
16,964
null
1
28
c#|.net|windows
51,974
<p>Have you tried to use WMI to do it?</p> <pre><code>using System; using System.Management; using System.Windows.Forms; public static void Main() { try { var searcher = new ManagementObjectSearcher( "root\\CIMV2", "SELECT * FROM Win32_MappedLogicalDisk"); foreach (M...
244,183
How to display a loading screen while site content loads
<p>I'm working on a site which contains a whole bunch of mp3s and images, and I'd like to display a loading gif while all the content loads. </p> <p>I have no idea how to achieve this, but I do have the animated gif I want to use. </p> <p>Any suggestions?</p>
244,190
7
0
null
2008-10-28 17:52:25.167 UTC
34
2017-04-14 15:27:29.497 UTC
2014-04-25 14:06:45.63 UTC
null
1,366,033
null
27,171
null
1
31
javascript|html|css|loading|pageload
175,507
<p>Typically sites that do this by loading content via ajax and listening to the <code>readystatechanged</code> event to update the DOM with a loading GIF or the content.</p> <p>How are you currently loading your content?</p> <p>The code would be similar to this:</p> <pre class="lang-js prettyprint-override"><code>f...
475,804
SVG Word Wrap - Show stopper?
<p>For fun I am trying to see how far I can get at implementing an SVG browser client for a RIA I'm messing around with in my spare time.</p> <p>But have hit what appears to be a HUGE stumbling block. There is no word wrap!!</p> <p>Does anyone know of any work around (I'm thinking some kind of JavaScript or special t...
475,813
8
0
null
2009-01-24 09:44:36.287 UTC
12
2022-02-26 20:54:50.097 UTC
2011-07-14 07:31:58.22 UTC
null
213,269
ChrisInCambo
37,196
null
1
24
svg|word-wrap
35,328
<p>Per this <a href="http://apike.ca/prog_svg_text.html" rel="noreferrer">document</a>, it appears that <b>tspan</b> can give the illusion of word wrap:</p> <blockquote> <p>The tspan tag is identical to the text tag but can be nested inside text tags and inside itself. Coupled with the 'dy' attribute this allows the...
647,074
How to make Linux C++ GUI apps
<p>What is the easiest way to make Linux C++ GUI apps? I'm using GNOME and ubuntu 8.10.</p>
647,075
8
0
null
2009-03-15 01:27:29.263 UTC
13
2011-02-09 15:25:54.423 UTC
2010-02-16 00:35:50.89 UTC
null
56,555
Lucas Aardvark
56,555
null
1
24
c++|user-interface|ubuntu|gnome
54,445
<p>I personally prefer QT as I prefer working with the signal/slots mechanism and just find it easy to develop applications quickly with it. Some of your other options would be wxWidgets and GTK+.</p>
942,251
In C/C++ why does the do while(expression); need a semi colon?
<p>My guess is it just made parsing easier, but I can't see exactly why.</p> <p>So what does this have ...</p> <pre><code>do { some stuff } while(test); more stuff </code></pre> <p>that's better than ...</p> <pre><code>do { some stuff } while(test) more stuff </code></pre>
942,261
8
0
null
2009-06-02 22:31:17.47 UTC
9
2014-06-09 18:42:37.347 UTC
null
null
null
null
53,120
null
1
34
c++|c|language-design
13,155
<p>Because you're ending the statement. A statement ends either with a block (delimited by curly braces), or with a semicolon. "do this while this" is a single statement, and can't end with a block (because it ends with the "while"), so it needs a semicolon just like any other statement.</p>
531,621
How to make a simple hyperlink in XAML?
<p>All I want to do is make a little hyperlink in XAML. I've tried everything. I give up.</p> <p>What is the syntax for this?</p> <pre><code>&lt;StackPanel Width="70" HorizontalAlignment="Center"&gt; &lt;Hyperlink Click="buttonClose_Click" Cursor="Hand" Foreground="#555" Width="31" Margin="0 0 0 15" ...
536,559
8
3
null
2009-02-10 09:22:02.43 UTC
13
2018-10-15 00:42:29.703 UTC
2009-02-10 09:28:13.867 UTC
Edward Tanguay
4,639
Edward Tanguay
4,639
null
1
58
wpf|xaml|hyperlink
89,943
<p>You can use a Button with a custom control template, the code below is a limited hyperlink style button (for example it only support textual hyperlinks) but maybe it'll point you in the right direction.</p> <pre><code>&lt;Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http:/...
1,094,269
What's the purpose of git-mv?
<p>From what I understand, Git doesn't really need to track <em>file</em> rename/move/copy operations, so what's the real purpose of <a href="https://git-scm.com/docs/git-mv" rel="noreferrer"><code>git mv</code></a>? The man page isn't specially descriptive...</p> <p>Is it obsolete? Is it an internal command, not meant...
1,094,392
8
0
null
2009-07-07 19:22:06.633 UTC
70
2021-08-08 05:37:44.007 UTC
2021-01-16 09:23:47.557 UTC
null
1,108,305
null
21,239
null
1
373
git|git-mv
160,607
<pre><code>git mv oldname newname </code></pre> <p>is just shorthand for:</p> <pre><code>mv oldname newname git add newname git rm oldname </code></pre> <p>i.e. it updates the index for both old and new paths automatically.</p>
37,030
How to best implement software updates on windows?
<p>I want to implement an "automatic update" system for a windows application. Right now I'm semi-manually creating an <a href="http://connectedflow.com/appcasting/" rel="noreferrer">"appcast"</a> which my program checks, and notifies the user that a new version is available. (I'm using <a href="http://nsis.sourcefo...
37,035
9
0
null
2008-08-31 18:57:29.05 UTC
24
2013-03-04 06:38:45.843 UTC
null
null
null
dF
3,002
null
1
23
windows|installation
7,885
<p>There is no solution quite as smooth as Sparkle (that I know of).</p> <p>If you need an easy means of deployment and updating applications, <a href="http://en.wikipedia.org/wiki/ClickOnce" rel="noreferrer">ClickOnce</a> is an option. Unfortunately, it's inflexible (e.g., no per-machine installation instead of per-u...
1,151,658
Python hashable dicts
<p>As an exercise, and mostly for my own amusement, I'm implementing a backtracking packrat parser. The inspiration for this is i'd like to have a better idea about how hygenic macros would work in an algol-like language (as apposed to the syntax free lisp dialects you normally find them in). Because of this, differe...
1,151,705
9
2
2009-07-21 00:08:46.513 UTC
2009-07-20 04:04:30.27 UTC
51
2015-04-16 12:37:02.353 UTC
2015-04-13 10:47:03.087 UTC
null
336,527
null
65,696
null
1
115
python
82,569
<p>Here is the easy way to make a hashable dictionary. Just remember not to mutate them after embedding in another dictionary for obvious reasons.</p> <pre><code>class hashabledict(dict): def __hash__(self): return hash(tuple(sorted(self.items()))) </code></pre>
154,185
What is object marshalling?
<p>I have heard this concept used frequently, but I don't have a really good grasp of what it is.</p>
154,201
10
1
null
2008-09-30 17:49:10.907 UTC
18
2021-02-19 11:23:56.45 UTC
2013-01-08 14:47:16.297 UTC
Rich B
527,702
Brian G
3,208
null
1
64
marshalling|terminology|glossary
32,941
<p>Converting an object in memory into a format that can be written to disk, or sent over the wire, etc. </p> <p><a href="http://en.wikipedia.org/wiki/Marshalling_(computer_science)" rel="noreferrer">Wikipedia's description</a>.</p>
779,016
Is it possible to specify a starting number for an ordered list?
<p>I have a ordered list where I would like the initial number to be 6. I found that this was <a href="http://www.w3schools.com/TAGS/tag_ol.asp" rel="noreferrer">supported</a> (now deprecated) in HTML 4.01. In this specification they say that you can specify the starting integer by using CSS. (instead of the <code>star...
779,052
10
1
null
2009-04-22 20:19:52.717 UTC
13
2022-02-16 21:34:50.167 UTC
2015-06-30 10:08:51.88 UTC
null
502,381
null
72,113
null
1
134
html|css|html-lists
111,566
<p>If you need the functionality to start an ordered list (OL) at a specific point, you'll have to specify your doctype as HTML 5; which is:</p> <pre><code>&lt;!doctype html&gt; </code></pre> <p>With that doctype, it is valid to set a <code>start</code> attribute on an ordered list. Such as:</p> <p><div class="snipp...
227,545
How can I get "Copy to Output Directory" to work with Unit Tests?
<p>When I build a unit test project before the tests are executed the test output is copied to a TestResults folder and then the tests are executed. The issue I'm having is that not all the files in the Debug/bin directory are copied to the TestResults project.</p> <p>How can I get a file that is copied to the Debug/...
227,713
11
0
null
2008-10-22 21:06:27.767 UTC
29
2018-10-27 19:38:14.503 UTC
2015-09-30 08:55:58.067 UTC
spoon16
411,718
spoon16
3,957
null
1
128
c#|.net|visual-studio-2008|unit-testing|mstest
73,886
<p>The standard way to do this is by specifying the <a href="http://msdn.microsoft.com/en-us/library/ms182473.aspx" rel="noreferrer" title="MSDN: Team System Test Deployment">deployment items</a> in the <em><code>.testrunconfig</code></em> file, which can be accessed via the <em>Edit Test Run Configurations</em> item i...
722,980
Is there a better Windows command-line shell?
<p>CMD.EXE is posing lots of problems for me. I have Cygwin installed and use bash regularly, and I also have the mingwin bash shell that comes with mSysGit, but sometimes I really do need to run things from the Windows shell.</p> <p>Is there a replacement for the Windows shell that:</p> <ul> <li>has a persistent co...
723,181
12
3
null
2009-04-06 20:06:11.977 UTC
15
2013-05-23 04:17:20.937 UTC
2017-05-23 12:33:18.493 UTC
null
-1
null
18,103
null
1
33
windows|shell|cmd
30,722
<p>I've always liked 4NT (haven't used it for a while now).</p> <p>It's an enhanced command interpreter for windows, and it's mostly backwards compatible (meaning you can run normal windows batchfiles). The only reason not to use it is that it doesn't ship with Windows like the default command.exe does.</p> <p>Compared...
517,355
String formatting in Python
<p>I want to do something like <code>String.Format("[{0}, {1}, {2}]", 1, 2, 3)</code> which returns:</p> <pre><code>[1, 2, 3] </code></pre> <p>How do I do this in Python?</p>
517,471
14
1
null
2009-02-05 18:53:29.103 UTC
11
2022-06-27 17:28:52.837 UTC
2022-06-27 17:15:39.127 UTC
Niyaz
8,172,439
Joan Venge
51,816
null
1
42
python|python-3.x|string|formatting|python-2.x
100,456
<p>The previous answers have used % formatting, which is being phased out in Python 3.0+. Assuming you're using Python 2.6+, a more future-proof formatting system is described here:</p> <p><a href="http://docs.python.org/library/string.html#formatstrings" rel="noreferrer">http://docs.python.org/library/string.html#fo...
472,000
Usage of __slots__?
<p>What is the purpose of <a href="https://docs.python.org/3/reference/datamodel.html#slots" rel="noreferrer"><code>__slots__</code></a> in Python — especially with respect to when I would want to use it, and when not?</p>
28,059,785
14
0
null
2009-01-23 05:37:23.087 UTC
513
2022-09-11 06:46:47.553 UTC
2019-05-02 11:23:24.527 UTC
Roger Pate
2,956,066
Jeb
31,830
null
1
1,104
python|oop|python-internals|slots
320,070
<blockquote> <h1>In Python, what is the purpose of <code>__slots__</code> and what are the cases one should avoid this?</h1> </blockquote> <h2>TLDR:</h2> <p>The special attribute <a href="https://docs.python.org/3/reference/datamodel.html#slots" rel="noreferrer"><code>__slots__</code></a> allows you to explicitly state...
360,643
Is it a bad practice to have multiple classes in the same file?
<p>I used to have one class for one file. For example <em>car.cs</em> has the class <em>car</em>. But as I program more classes, I would like to add them to the same file. For example <em>car.cs</em> has the class <em>car</em> and the <em>door</em> class, etc.</p> <p>My question is good for Java, C#, PHP or any other ...
360,656
15
0
null
2008-12-11 19:50:37.303 UTC
13
2018-02-03 23:16:24.55 UTC
2018-02-03 23:16:24.55 UTC
mdb
4,389,437
Pokus
21,386
null
1
89
file|class|oop|language-agnostic
54,064
<p>I think you should try to keep your code to 1 class per file.</p> <p>I suggest this because it will be easier to find your class later. Also, it will work better with your source control system (if a file changes, then you know that a particular class has changed). </p> <p>The only time I think it's correct to use...
1,309,728
Best way to do a PHP switch with multiple values per case?
<p>How would you do this PHP switch statement?</p> <p>Also note that these are much smaller versions, the 1 I need to create will have a lot more values added to it.</p> <p>Version 1: </p> <pre><code>switch ($p) { case 'home': case '': $current_home = 'current'; break; case 'users.onlin...
1,309,872
16
3
null
2009-08-21 01:52:38.023 UTC
24
2021-09-08 19:29:23.957 UTC
2012-02-06 15:39:07.25 UTC
null
143,030
null
143,030
null
1
76
php|switch-statement
213,479
<p>For any situation where you have an unknown string and you need to figure out which of a bunch of <em>other</em> strings it matches up to, the only solution which doesn't get slower as you add more items is to use an array, but have all the possible strings as keys. So your switch can be replaced with the following:...
424,800
What is the best way to get the minimum or maximum value from an Array of numbers?
<p>Let's say I have an Array of numbers: <code>[2,3,3,4,2,2,5,6,7,2]</code></p> <p>What is the best way to find the minimum or maximum value in that Array?</p> <p>Right now, to get the maximum, I am looping through the Array, and resetting a variable to the value if it is greater than the existing value:</p> <pre><c...
426,538
17
3
null
2009-01-08 15:57:19.57 UTC
20
2018-10-24 16:27:47.257 UTC
2012-11-24 08:39:07.193 UTC
Aryabhatta
184,572
Eric Belair
31,298
null
1
41
algorithm|actionscript-3|apache-flex|actionscript|complexity-theory
163,553
<p>The theoretical answers from everyone else are all neat, but let's be pragmatic. ActionScript provides the tools you need so that you don't even have to write a loop in this case!</p> <p>First, note that <code>Math.min()</code> and <code>Math.max()</code> can take any number of arguments. Also, it's important to un...
191,364
Quick unix command to display specific lines in the middle of a file?
<p>Trying to debug an issue with a server and my only log file is a 20GB log file (with no timestamps even! Why do people use <code>System.out.println()</code> as logging? In production?!)</p> <p>Using grep, I've found an area of the file that I'd like to take a look at, line 347340107.</p> <p>Other than doing someth...
191,385
19
2
null
2008-10-10 13:51:18.32 UTC
88
2022-05-30 10:02:24.833 UTC
2016-04-27 09:11:46.14 UTC
matt b
7,028
matt b
4,249
null
1
240
linux|bash|unix|text
420,919
<p>with GNU-grep you could just say </p> <pre>grep --context=10 ...</pre>
215,548
What's the hardest or most misunderstood aspect of LINQ?
<p>Background: Over the next month, I'll be giving three talks about or at least including <code>LINQ</code> in the context of <code>C#</code>. I'd like to know which topics are worth giving a fair amount of attention to, based on what people may find hard to understand, or what they may have a mistaken impression of. ...
215,562
42
11
2009-06-04 12:12:37.373 UTC
2008-10-18 20:47:40.003 UTC
261
2011-08-04 08:50:01.047 UTC
2009-06-27 13:50:26.3 UTC
John Sheehan
16,853
Jon Skeet
22,656
null
1
282
c#|linq|c#-3.0
50,490
<p>Delayed execution</p>
6,424,301
Using a SELECT statement within a WHERE clause
<pre><code>SELECT * FROM ScoresTable WHERE Score = (SELECT MAX(Score) FROM ScoresTable AS st WHERE st.Date = ScoresTable.Date) </code></pre> <p>Is there a name to describe using a SELECT statement within a WHERE clause? Is this good/bad practice?</p> <p>Would this be a better alternative?</p> <pre><code>SELECT Sc...
6,424,322
7
5
null
2011-06-21 11:09:12.063 UTC
3
2016-03-02 03:42:51.213 UTC
2011-06-21 12:51:15.937 UTC
null
808,261
null
808,261
null
1
14
sql|select|where-clause
118,025
<p>It's called correlated subquery. It has it's uses.</p>
6,687,580
Header changes as you scroll down (jQuery)
<p>TechCrunch recently redesigned their site and they have a sweet header that minifies into a thinner version of their branding as you scroll down.</p> <p>You can see what I mean here: <a href="http://techcrunch.com/" rel="noreferrer">http://techcrunch.com/</a></p> <p>How would I go about creating something like thi...
6,687,664
7
0
null
2011-07-14 01:41:53.18 UTC
16
2014-09-12 14:42:15.513 UTC
null
null
null
null
843,750
null
1
20
jquery
40,798
<p>It's not too hard, it's just a simple <a href="http://api.jquery.com/scroll/"><code>.scroll()</code></a> event. <strike>I can't seem to do it in fiddle because of the way the panels are positioned</strike> <strong>Check EDIT!</strong>. But basically what you have is have a <code>div</code> on the top that is <cod...
41,370,560
In Javadocs, how should I write plural forms of singular Objects in <code> tags?
<p>I have a class named <code>Identity</code>. In my javadoc comments I am referencing it as a plural. I can think of two solutions: change the reference to <code>&lt;code&gt;Identities&lt;/code&gt;</code> or <code>&lt;code&gt;Identity&lt;/code&gt;</code>s. Neither of these feel correct, and I'm wondering if there's a ...
41,370,725
5
1
null
2016-12-28 22:24:00.087 UTC
6
2020-06-10 09:27:06.267 UTC
2016-12-29 00:55:23.247 UTC
null
2,518,200
null
4,756,763
null
1
41
java|javadoc|grammar
2,724
<p>Use a "...(s)" style plural label, with a <a href="http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#link" rel="noreferrer"><code>{@link}</code></a> to the class:</p> <pre><code>/** * Returns an {@link IdentityBank} of {@link Identity Identity(s)} with the given sex. */ </code></pre> <p...
15,884,309
PostgreSQL Full Text Search and Trigram Confusion
<p>I'm a little bit confused with the whole concept of PostgreSQL, full text search and Trigram. In my full text search queries, I'm using tsvectors, like so:</p> <pre><code>SELECT * FROM articles WHERE search_vector @@ plainto_tsquery('english', 'cat, bat, rat'); </code></pre> <p>The problem is, this method doesn't ...
15,884,833
1
0
null
2013-04-08 16:30:33.377 UTC
12
2013-04-08 18:55:14.71 UTC
2013-04-08 18:55:14.71 UTC
null
939,860
null
456,850
null
1
46
postgresql|full-text-search|pattern-matching
9,142
<p>They serve very different purposes. </p> <ul> <li>Full Text Search is used to return documents that match a search query of stemmed words.</li> <li>Trigrams give you a method for comparing two strings and determining how similar they look.</li> </ul> <p>Consider the following examples:</p> <pre><code>SELECT 'cat'...
35,402,862
This certificate has an invalid issuer : Keychain marks all certificates as "Invalid Issuer"
<p>Keychain shows all the certificates as Invalid in my keychain suddenly, as it working before 2 days and i also check in Developer portal and it shows valid there. It marks each and every certificate in Keychain as <strong>"This certificate has invalid issuer"</strong> . As message suggesting that it must be problem ...
35,403,096
1
5
null
2016-02-15 06:32:21.94 UTC
15
2016-08-10 20:05:03 UTC
2016-02-15 17:56:26.463 UTC
null
3,045,336
null
3,045,336
null
1
70
ios|xcode|certificate|ssl-certificate|keychain
47,350
<p>In Keychain access, -> View -> Show Expired Certificates, then in your login keychain click on expired certificate and delete it. I also had the same expired certificate in my System keychain, so I deleted it from there too.</p> <p>-> After deleting the expired cert from the login and System keychains,download ce...
22,856,635
How do I make a div link open in a new tab Javascript onClick="window.location
<p>I created a range of social media buttons which when the mouse hovers it switches to a different image (giving it a highlight effect). The images work as I want them to, however, I can't seem to figure out how to load the page into a new tab/screen. I need to implement the equivalent of . </p> <p>Assuming I have to...
22,856,728
2
3
null
2014-04-04 07:45:43.167 UTC
2
2019-08-21 07:44:48.027 UTC
null
null
null
null
3,249,472
null
1
14
javascript|html|css
47,560
<p><code>onclick="window.open('http://google.pl', '_blank');"</code></p>
13,503,840
What is the code to exit/ stop VBscript from running in the event of a condition not being met?
<p>I have looked on Google and the answer is not there! </p> <p>First things first. WScript.Quit DOES NOT WORK! I have no idea what "WScript" is but it clearly has nothing to do with client side scripting for a web page. I have seen this "WScript" thing somewhere before and it just produces errors (maybe obsolete or s...
13,631,660
5
3
null
2012-11-21 23:40:14.79 UTC
2
2020-07-17 10:06:48.273 UTC
2012-11-22 21:04:16.4 UTC
null
1,778,482
null
1,778,482
null
1
8
vbscript
78,354
<p>You can use something like this:</p> <pre><code>Sub MyFunc ---------- My Code ---------- End Sub Function Main On Error Resume Next MyFunc If Err.Number &lt;&gt; 0 Exit Function End Function </code></pre> <p>It'll stop executing the code, the point it finds an exception or throws an error.</p>
13,617,843
"unary operator expected" error in Bash if condition
<p>This script is getting an error:</p> <pre><code>elif [ $operation = &quot;man&quot; ]; then if [ $aug1 = &quot;add&quot; ]; then # &lt;- Line 75 echo &quot;Man Page for: add&quot; echo &quot;&quot; echo &quot;Syntax: add [number 1] [number 2]&quot; echo &quot;&quot; echo &quot;Descrip...
13,618,376
6
3
null
2012-11-29 02:22:47.243 UTC
69
2022-07-05 23:33:57.647 UTC
2021-05-14 16:52:43.633 UTC
null
3,474,146
null
1,832,837
null
1
314
bash|shell
523,486
<p>If you know you're always going to use Bash, it's much easier to always use the double bracket conditional compound command <code>[[ ... ]]</code>, instead of the POSIX-compatible single bracket version <code>[ ... ]</code>. Inside a <code>[[ ... ]]</code> compound, word-splitting and pathname expansion are not appl...
13,242,414
Passing A List Of Objects Into An MVC Controller Method Using jQuery Ajax
<p>I'm trying to pass an array of objects into an MVC controller method using jQuery's ajax() function. When I get into the PassThing() C# controller method, the argument "things" is null. I've tried this using a type of List for the argument, but that doesn't work either. What am I doing wrong?</p> <pre><code>&lt;scr...
13,255,459
16
4
null
2012-11-06 00:01:08.24 UTC
50
2022-06-28 11:00:05.743 UTC
2012-11-06 00:56:25.127 UTC
null
727,208
null
705,132
null
1
129
c#|asp.net-mvc|jquery
354,600
<p>Using NickW's suggestion, I was able to get this working using <code>things = JSON.stringify({ 'things': things });</code> Here is the complete code.</p> <pre><code>$(document).ready(function () { var things = [ { id: 1, color: 'yellow' }, { id: 2, color: 'blue' }, { id: 3, color: 'red' ...
51,656,838
__attribute__((weak)) and static libraries
<p>I wanted to introduce a weak symbol into my code, however, I am unable to comprehend its behavior when *.a files are used. </p> <p>This is my minimal example:</p> <p><i>file a.h:</i></p> <pre><code>void foo() __attribute__((weak)); </code></pre> <p><i>file a.c:</i></p> <pre><code>#include "a.h" #include &lt;std...
51,970,423
2
5
null
2018-08-02 15:04:30.633 UTC
15
2020-02-14 07:41:26.29 UTC
2018-08-17 09:59:12.853 UTC
null
9,702,768
null
9,702,768
null
1
22
c++|g++
28,764
<p>To explain what's going on here, let's talk first about your original source files, with</p> <p><strong>a.h (1)</strong>:</p> <pre><code>void foo() __attribute__((weak)); </code></pre> <p>and:</p> <p><strong>a.c (1)</strong>:</p> <pre><code>#include "a.h" #include &lt;stdio.h&gt; void foo() { printf("%s\n", __...
23,974,639
Bootstrap 3 modal responsive
<p>I have a modal but it's not resizing on smaller screens ( tablets, etc ). Is there a way to make it responsive ? Couldn't find any information on bootstrap docs. Thanks</p> <p>I update my html code: ( its inside a django for loop )</p> <pre><code> &lt;div class="modal fade " id="{{ p.id }}" tabindex="-1" role="...
30,873,219
6
4
null
2014-05-31 21:27:20.613 UTC
3
2021-04-19 16:20:14.333 UTC
2020-02-25 13:02:56.01 UTC
null
1,438,038
null
1,579,883
null
1
25
html|css|twitter-bootstrap-3
104,986
<p>I had the same issue I have resolved by adding a media query for @screen-xs-min in less version under Modals.less</p> <pre><code>@media (max-width: @screen-xs-min) { .modal-xs { width: @modal-sm; } } </code></pre>
3,491,721
LINQ to Entities - Where IN clause in query
<blockquote> <p><strong>Possible Duplicates:</strong><br> <a href="https://stackoverflow.com/questions/857973/linq-to-entities-sql-in-clause">Linq to Entities - Sql &ldquo;IN&rdquo; clause</a><br> <a href="https://stackoverflow.com/questions/2973755/how-to-implement-sql-in-in-entity-framework-4-0">How to implemen...
3,491,736
2
0
null
2010-08-16 08:49:08.31 UTC
4
2010-08-16 08:52:47.75 UTC
2017-05-23 10:30:46.267 UTC
null
-1
null
97,010
null
1
18
c#|sql|entity-framework
57,543
<p>Use <code>Contains</code>:</p> <pre><code>int[] ids = { 1, 2, 3, 4, 5}; var query = db.myTable.Where(item =&gt; ids.Contains(item.ID)); </code></pre> <p>or in query syntax:</p> <pre><code>int[] ids = { 1, 2, 3, 4, 5}; var query = from item in db.myTable where ids.Contains(item.ID) select...
3,689,925
struct sockaddr_un vs. sockaddr
<p>How is <code>struct sockaddr</code> different from <code>struct sockaddr_un</code> ?</p> <p>I know that we use these structures in client-server modules, for binding the socket to the socket address. And we use a cast operator for it to accept struct <code>sockaddr_un</code>.</p> <p>I want to know how different/si...
3,689,966
2
0
null
2010-09-11 05:32:48.307 UTC
8
2018-12-19 09:48:14.727 UTC
2018-12-19 09:48:14.727 UTC
null
72,882
null
425,094
null
1
38
c|linux|sockets|struct|client-server
36,647
<p>"struct sockaddr" is a generic definition. It's used by any socket function that requires an address.</p> <p>"struct sockaddr_un" (a "Unix sockets" address) is a specific kind of address family.</p> <p>The more commonly seen "struct sockaddr_in" (an "Internet socket" address) is another specific kind of address f...
3,549,713
Controller helper_method
<p>I was wondering why someone should use helper_method inside a controller to create a helper method, instead of creating the "normal" way, which is inside the helper file. What the pros and cons of that?</p>
3,549,739
2
0
null
2010-08-23 16:43:48.75 UTC
13
2013-07-31 13:33:33.2 UTC
null
null
null
null
370,927
null
1
44
ruby-on-rails|ruby-on-rails-3
23,350
<p><code>helper_method</code> is useful when the functionality is something that's used between both the controller and the view. A good example is something like <code>current_user</code>.</p> <p>If the method deals more with controller logic and not formatting then it belongs in the controller. Something like <code>...
9,182,428
Force Internet Explorer 9 to use IE 9 Mode
<p>I'm using the HTML5 doctype with X-UA-Compatible meta tag near the top:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;!--[if lt IE 7]&gt; &lt;html lang="en-us" class="ie6"&gt; &lt;![endif]--&gt; &lt;!--[if IE 7]&gt; &lt;html lang="en-us" class="ie7"&gt; &lt;![endif]--&gt; &lt;!--[if IE 8]&gt; &lt;html lang="en-us"...
9,182,704
7
2
null
2012-02-07 19:18:07.53 UTC
10
2014-12-15 13:44:26.343 UTC
null
null
null
null
188,740
null
1
19
internet-explorer|internet-explorer-9|cross-browser|doctype
54,279
<p>It turns out that the solution is to set X-UA-Compatible in the HTTP header and not in the HTML:</p> <pre><code> X-UA-Compatible: IE=edge,chrome=1 </code></pre> <p>This will force Internet Explorer to use the latest rendering engine, even if "Display all websites in Compatibility View" is turned on.</p>
9,055,015
Difference between accessing cell elements using curly braces and parentheses
<p>What is the difference between accessing elements in a cell array using parentheses <code>()</code> and curly braces <code>{}</code>?</p> <p>For example, I tried to use <code>cell{4} = []</code> and <code>cell(4) = []</code>. In the first case it sets the 4<sup>th</sup> element to <code>[]</code>, but in the secon...
9,055,336
2
2
null
2012-01-29 17:12:19.3 UTC
16
2018-05-22 09:38:02.19 UTC
2018-05-22 09:38:02.19 UTC
null
3,924,118
null
729,294
null
1
29
matlab|cell-array
25,766
<p>Think of cell array as a regular homogenic array, whose elements are all <code>cell</code>s. Parentheses (<code>()</code>) simply access the <code>cell</code> wrapper object, while accessing elements using curly bracers (<code>{}</code>) gives the actual object contained within the cell.</p> <p>For example, </p> <...
29,424,944
RecyclerView itemClickListener in Kotlin
<p>I'm writing my first app in Kotlin after 3 years of experience with Android. Just confused as to how to utilize itemClickListener with a RecyclerView in Kotlin.</p> <p>I have tried the trait (edit: now interface) approach, very Java-like</p> <pre><code>public class MainActivity : ActionBarActivity() { protected...
29,428,715
24
3
null
2015-04-03 01:19:33.037 UTC
22
2022-09-09 11:03:57.807 UTC
2018-02-06 16:23:36.527 UTC
null
507,142
null
507,142
null
1
85
android|android-recyclerview|kotlin
152,797
<p>I have a little bit different approach. You can create an extension for your ViewHolder</p> <pre><code>fun &lt;T : RecyclerView.ViewHolder&gt; T.listen(event: (position: Int, type: Int) -&gt; Unit): T { itemView.setOnClickListener { event.invoke(getAdapterPosition(), getItemViewType()) } return ...
16,440,661
Declaration is incompatible with type
<p>header file:</p> <pre><code>#ifndef H_bankAccount; #define H_bankAccount; class bankAccount { public: string getAcctOwnersName() const; int getAcctNum() const; double getBalance() const; virtual void print() const; void setAcctOwnersName(string); void setAcctNum(int); void setBalance(...
16,440,705
3
2
null
2013-05-08 12:26:45.09 UTC
2
2022-03-22 17:16:44.36 UTC
null
null
null
null
2,362,280
null
1
15
c++|string|types
61,798
<p>You need to </p> <pre><code>#include &lt;string&gt; </code></pre> <p>in your <code>bankAccount</code> header file, and refer to the strings as <code>std::string</code>.</p> <pre><code>#ifndef H_bankAccount; #define H_bankAccount; #include &lt;string&gt; class bankAccount { public: std::string getAcctOwnersN...
16,552,710
How do you get the start and end addresses of a custom ELF section?
<p>I'm working in C on Linux. I've seen the usage of of the gcc <a href="http://gcc.gnu.org/onlinedocs/gcc/Variable-Attributes.html" rel="noreferrer"><code>__section__</code> attribute</a> (especially in the Linux kernel) to collect data (usually function pointers) into custom ELF sections. How is the "stuff" that gets...
16,552,711
5
2
null
2013-05-14 20:57:00.44 UTC
12
2022-03-30 10:40:17.227 UTC
2019-03-09 03:53:21.693 UTC
null
608,639
null
209,050
null
1
23
c|gcc|elf
18,866
<p>As long as the section name results in a valid C variable name, <code>gcc</code> (<code>ld</code>, rather) generates two magic variables: <code>__start_SECTION</code> and <code>__stop_SECTION</code>. Those can be used to retrieve the start and end addresses of a section, like so:</p> <pre><code>/** * Assuming you'v...
16,377,432
benefit of using angular js on top of asp.net mvc
<p>Is there much point to using angular js on top of asp.net mvc since they're kind of both doing the same thing? What are the advantages to using angular over asp.net mvc + jquery? What kind of scenario would you pick angular in? If you do pick angular in a microsoft environment, what would you run on the server si...
16,381,080
3
5
null
2013-05-04 18:11:30.913 UTC
10
2013-09-12 06:41:33.367 UTC
null
null
null
null
155,909
null
1
46
asp.net-mvc|angularjs
15,766
<p>On my site <a href="http://www.reviewstoshare.com">http://www.reviewstoshare.com</a>, I am using AngularJS along with ASP.NET MVC. <strong>The main reason I did not go all the way with AngularJS was that SEO is not easily achieved with AngularJS.</strong> Keep in mind that my site was already built using ASP.MVC + ...
16,205,778
What are Maven goals and phases and what is their difference?
<p>What is the difference/relation between Maven goals and phases? How they are related to each other?</p>
16,205,812
8
2
null
2013-04-25 03:16:23.603 UTC
181
2020-10-12 07:37:05.06 UTC
2016-08-31 19:13:06.83 UTC
null
1,743,880
null
1,031,863
null
1
373
maven
299,293
<p>Goals are executed in phases which help determine the order goals get executed in. The best understanding of this is to look at the <a href="http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Built-in_Lifecycle_Bindings" rel="noreferrer">default Maven lifecycle bindings</a> which shows w...
24,880,430
Azure Blob Storage vs. File Service
<p>Please correct my wrongs. From my reading on the topic so far, it appears to me that both, Azure Blob Storage and File Service offer the ability to store file(s) and folder(s) (I understand that blobs can store any binary object, but any serialized binary stream is just a file at the end of the day) in a hierarchica...
24,880,544
3
7
null
2014-07-22 06:36:21.917 UTC
34
2017-09-28 00:31:34.66 UTC
null
null
null
null
303,685
null
1
157
azure|azure-storage|azure-blob-storage
71,742
<p>A few items for your question:</p> <ol> <li>You can't mount Azure Blob Storage as a native share on a virtual machine.</li> <li>Azure Blob Storage isn't hierarchical beyond containers. You can add files that have / or \ characters in them that are interpreted as folders by many apps that read blob storage.</li> <l...
22,317,951
Export html table data to Excel using JavaScript / JQuery is not working properly in chrome browser
<p>I have a HTML table in velocity template. I want to export the html table data to excel using either java script or jquery, comatibale with all browser. I am using below script </p> <pre><code>&lt;script type="text/javascript"&gt; function ExportToExcel(mytblId){ var htmltable= document.getElementById('my-t...
24,081,343
16
2
null
2014-03-11 06:22:13.867 UTC
78
2022-08-02 05:09:53.363 UTC
2019-05-16 06:31:23.24 UTC
null
3,980,621
null
2,085,703
null
1
121
javascript|jquery|html|excel|google-chrome
685,645
<p>Excel export script works on IE7+, Firefox and Chrome.</p> <pre><code>function fnExcelReport() { var tab_text="&lt;table border='2px'&gt;&lt;tr bgcolor='#87AFC6'&gt;"; var textRange; var j=0; tab = document.getElementById('headerTable'); // id of table for(j = 0 ; j &lt; tab.rows.length ; j++) ...
26,852,922
Inspect webkit-input-placeholder with developer tools
<p>It's possible to style a text input's placeholder with the following:</p> <pre class="lang-css prettyprint-override"><code>-webkit-input-placeholder { color: red; } </code></pre> <p>I am looking at a website online and I would like to use the same placeholder color as they do. Is it possible to figure out what c...
26,853,319
2
3
null
2014-11-10 21:01:16.953 UTC
51
2022-01-07 18:22:01.46 UTC
2022-01-07 18:22:01.46 UTC
null
1,526,037
null
633,438
null
1
321
html|css
77,087
<p>I figured it out.</p> <p>The trick is to enable 'Show user agent shadow DOM' in the Settings panel of Chrome Developer Tools:</p> <p><img src="https://i.imgur.com/bVq5voX.png" alt="enter image description here" /></p> <p>To get to settings, click the Gear icon at the top right of your Dev Tools panel, then make sure...
19,485,004
Android app Key Hash doesn't match any stored key hashes
<p>I have an application on production on Play Store which uses a login with the Facebook SDK. When I debug the application from Eclipse there is no problem, but when its on production it gives me the following error after Facebook asks me for the permissions. I have added on my app page on developers.facebook.com the ...
19,499,368
14
4
null
2013-10-21 01:39:55.477 UTC
15
2021-10-05 07:22:54.503 UTC
2017-04-16 04:29:34.303 UTC
null
1,033,581
null
799,979
null
1
33
android|facebook-android-sdk
53,059
<p>Facebook some how replaces +,- and / with _</p> <p>So just try replacing _ with +, - and / and add that hash-key.</p> <p>Hopefully it should work.</p>
21,506,195
Prevent overlapping elements in CSS
<p>This question has been asked before, however each situation is unique. I have a screenshot of a website that has a login box (registration box) with a sticky note on the side to tell the users what information to enter. </p> <p>Screenshot below:</p> <p><img src="https://i.stack.imgur.com/1AQgO.png" alt="enter imag...
21,506,858
3
13
null
2014-02-02 02:04:43.643 UTC
null
2014-02-02 04:00:00.967 UTC
2014-02-02 02:43:18.273 UTC
null
1,614,936
null
1,614,936
null
1
2
html|css
57,071
<p>Try this <a href="http://jsfiddle.net/ab5KN/" rel="nofollow">http://jsfiddle.net/ab5KN/</a></p> <p>HTML:</p> <pre><code>&lt;body&gt; &lt;div class="img"&gt; &lt;img src="http://rye-high.ca/images/logo.png" /&gt; &lt;/div&gt; &lt;div class="sticky"&gt; &lt;p&gt; &lt;strong&gt;Please Note&lt;/strong&gt; ...
17,567,176
How to call a function inside $(document).ready
<p>Im trying to debug my web app that uses <code>jQuery.</code></p> <p>In firebug im calling functions inside the $(document).ready..</p> <pre><code> function val() { console.log('validated outside doc.ready'); } $(document).ready(function() { console.log('document ready...'); function validate() { consol...
17,567,235
4
2
null
2013-07-10 09:33:59.453 UTC
5
2021-10-15 01:02:49.167 UTC
null
null
null
null
692,228
null
1
35
jquery|debugging|firebug
106,707
<p>You are not calling a function like that, you just <strong>define</strong> the function.</p> <p>The correct approach is to define the function outside <code>document.ready</code> and call it inside:</p> <pre><code>// We define the function function validate(){ console.log('validated!'); } $(document).ready(func...
17,490,716
Lifetimes in Rust
<p>Occasionally I've found myself wanting to write functions that can be called in either of two ways:</p> <pre><code>// With a string literal: let lines = read_file_lines("data.txt"); // With a string pointer: let file_name = ~"data.txt"; let lines = read_file_lines(file_name); </code></pre> <p>My first guess was t...
17,493,553
1
1
null
2013-07-05 14:00:43.117 UTC
15
2016-09-08 14:22:12.917 UTC
2016-09-08 14:22:12.917 UTC
null
1,870,153
null
259,747
null
1
68
rust|lifetime
13,424
<p><em>Update 2015-05-16</em>: the code in the original question applied to an old version of Rust, but the concepts remain the same. This answer has been updated to use modern Rust syntax/libraries. (Essentially changing <code>~[]</code> to <code>Vec</code> and <code>~str</code> to <code>String</code> and adjusting th...
17,493,738
What is a TypeScript Map file?
<p>I have seen <code>.map</code> files for TypeScript. What I want to know is what these files are for. Do they contain references to other files referenced in the .ts file?</p>
17,493,808
3
0
null
2013-07-05 17:00:55.073 UTC
7
2020-07-28 11:57:36.8 UTC
2013-12-27 15:33:12.497 UTC
null
913,707
null
991,788
null
1
104
typescript
45,166
<p>.map files are source map files that let tools map between the emitted JavaScript code and the TypeScript source files that created it. Many debuggers (e.g. Visual Studio or Chrome's dev tools) can consume these files so you can debug the TypeScript file instead of the JavaScript file.</p> <p>This is the same sourc...
26,063,877
Python multiprocessing module: join processes with timeout
<p>I'm doing an optimization of parameters of a complex simulation. I'm using the multiprocessing module for enhancing the performance of the optimization algorithm. The basics of multiprocessing I learned at <a href="http://pymotw.com/2/multiprocessing/basics.html" rel="nofollow noreferrer">http://pymotw.com/2/multipr...
26,064,238
3
2
null
2014-09-26 16:12:20.963 UTC
6
2021-09-14 15:07:21.293 UTC
2021-09-14 15:05:58.15 UTC
null
6,630,397
null
4,083,929
null
1
16
python|timeout|python-multiprocessing
38,301
<p>You can do this by creating a loop that will wait for some timeout amount of seconds, frequently checking to see if all processes are finished. If they don't all finish in the allotted amount of time, then terminate all of the processes:</p> <pre class="lang-py prettyprint-override"><code>TIMEOUT = 5 start = time....
5,054,057
PHP include in a cron job
<p>I'm trying to setup a PHP file as a cron job, where that PHP file includes other PHP files.</p> <p>The file itself is located at /var/www/vhosts/domain.com/httpdocs/app/protected/classes/cron/runner.php</p> <p>The include file is at /var/www/vhosts/domain.com/httpdocs/app/protected/config.php</p> <p>How do I inc...
5,054,064
4
1
null
2011-02-19 22:51:55.17 UTC
9
2017-07-01 09:50:59.553 UTC
null
null
null
null
471,628
null
1
7
php|cron
11,611
<p>Your cron should change the working directory before running PHP:</p> <pre><code>cd /var/www/vhosts/domain.com/httpdocs/app/protected/classes/cron/ &amp;&amp; /usr/bin/php -q runner.php </code></pre> <p>Note that if the directory does not exist, PHP will not run runner.php.</p>
43,274,925
Development server of create-react-app does not auto refresh
<p>I am following a <a href="https://egghead.io/courses/react-fundamentals" rel="noreferrer">tutorial</a> on React using create-react-app. The application is created by <a href="https://github.com/facebookincubator/create-react-app" rel="noreferrer">create-react-app</a> v1.3.0</p> <pre><code>create-react-app my-app <...
43,281,575
32
3
null
2017-04-07 09:47:25.723 UTC
37
2022-09-15 08:03:55.973 UTC
null
null
null
null
3,625,171
null
1
127
javascript|reactjs|create-react-app
164,199
<p>Have you seen the “Troubleshooting” section of the User Guide?<br /> It describes <a href="https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#npm-start-doesnt-detect-changes" rel="noreferrer">a few common causes of this problem</a>:</p> <blockquote> <p>When yo...
9,363,827
Building GPL C program with CUDA module
<p>I am attempting to modify a GPL program written in C. My goal is to replace one method with a CUDA implementation, which means I need to compile with nvcc instead of gcc. I need help building the project - not implementing it (You don't need to know anything about CUDA C to help, I don't think).</p> <p>This is my f...
9,369,408
1
4
null
2012-02-20 15:39:24.227 UTC
9
2018-10-24 21:55:00.57 UTC
null
null
null
null
124,593
null
1
12
cuda|makefile|nvcc
7,296
<p>You don't need to compile everything with nvcc. Your guess that you can just compile your CUDA code with NVCC and leave everything else (except linking) is correct. Here's the approach I would use to start. </p> <ol> <li><p>Add a 1 new header (e.g. myCudaImplementation.h) and 1 new source file (with .cu extensio...
9,575,122
Can I assume that calling realloc with a smaller size will free the remainder?
<p>Let’s consider this very short snippet of code:</p> <pre><code>#include &lt;stdlib.h&gt; int main() { char* a = malloc(20000); char* b = realloc(a, 5); free(b); return 0; } </code></pre> <p>After reading the man page for realloc, I was not entirely sure that the second line would cause the 19995 ...
9,575,348
5
4
null
2012-03-05 22:36:53.14 UTC
9
2014-03-21 00:50:39.103 UTC
2012-03-05 22:46:27.44 UTC
null
748,175
null
748,175
null
1
35
c|malloc|free|realloc
29,383
<p>Yes, guaranteed by the C Standard if the new object can be allocated.</p> <blockquote> <p>(C99, 7.20.3.4p2) "The realloc function deallocates the old object pointed to by ptr and returns a pointer to a new object that has the size specified by size."</p> </blockquote>
9,073,148
glibc detected free(): invalid next size (fast)
<p>This code generates random numbers and then produces a histogram based on input to the functions regarding the intervals. "bins" represents the histogram intervals and "bin_counts" holds the number of random numbers in a given interval.</p> <p>I've reviewed several of the posts dealing with similiar issues and I un...
9,073,290
1
5
null
2012-01-31 01:08:32.57 UTC
null
2012-01-31 01:28:01.13 UTC
null
null
null
null
1,179,234
null
1
5
c|linux|free|glibc
39,613
<pre><code>bins =(double*)malloc(nbins * sizeof(double)); bin_counts =(int*)malloc((nbins-1) * sizeof(int)); //create bins from intervals for(j=0; j&lt;=(nbins); j++) { bins[j] = m + (j*interval); } //generate "bin_counts[]" with all 0's for(y=0; y&lt;=(nbins-1); y++) { bin_counts[y] = 0; } </code></pre> ...
18,605,563
href must not reload
<p>I am testing the following link:</p> <pre><code>&lt;a href="#"&gt;Link&lt;/a&gt; </code></pre> <p>But, as expected, it reloads my current page. How can I prevent it from reloading the page, but maintaining the <em>-a-</em> tag assigned to it?</p> <p>Thanks ;)</p>
18,605,588
5
1
null
2013-09-04 04:46:00.98 UTC
8
2021-12-24 13:23:48.48 UTC
null
null
null
null
2,714,670
null
1
46
html|hyperlink
100,255
<p>If you don't want it to behave like a link, then don't use a link tag. Doing so hurt accessibility of a page, and you don't want that. There are other ways of browsing a website than a browser (think about the screen readers), which relies on the semantics of the page elements. Use a <code>span</code> if you simply ...
27,582,757
Catch duplicate entry Exception
<p>How can i catch this Exception : </p> <pre><code>com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '22-85' for key 'ID_CONTACT' </code></pre>
27,583,544
9
5
null
2014-12-20 17:48:03.713 UTC
9
2021-04-04 11:33:13.273 UTC
2018-04-05 10:05:52.89 UTC
null
3,128,926
null
1,383,538
null
1
35
java|mysql|hibernate|jpa|sqlexception
115,975
<p>I use spring so we resolve it by <code>org.springframework.dao.DataIntegrityViolationException</code></p> <pre><code>try { ao_history_repository.save(new AoHistory(..)); } catch (DataIntegrityViolationException e) { System.out.println("history already exist"); } </code></pre> <p>But as <a href="https://sta...
15,047,775
Do Hask or Agda have equalisers?
<p>I was somewhat undecided as to whether this was a math.SE question or an SO one, but I suspect that mathematicians in general are fairly unlikely to know or care much about this category in particular, whereas Haskell programmers might well do.</p> <p>So, we know that <strong>Hask</strong> has products, more or les...
15,136,620
2
3
null
2013-02-24 01:44:19 UTC
13
2013-02-28 14:26:40.697 UTC
null
null
null
null
812,053
null
1
36
haskell|agda|category-theory
1,615
<p><strong>tl;dr the proposed candidate is not quite an equaliser, but its irrelevant counterpart is</strong></p> <p>The candidate for an equaliser in Agda looks good. So let's just try it. We'll need some basic kit. Here are my refusenik ASCII dependent pair type and homogeneous intensional equality.</p> <pre><code>...
38,270,661
Displaying a YouTube video with iframe full width of page
<p>I've put a video in my site using an <code>iframe</code> from YouTube, while the <code>iframe</code> is full width (<code>100%</code>) the video is very small (height) within the frame. How do I make it fit the width of the container? </p> <p>Code: </p> <pre><code>&lt;iframe width="100%" height="100%" src="https:/...
38,270,745
3
5
null
2016-07-08 15:42:11.313 UTC
10
2021-04-23 02:13:22.743 UTC
2017-07-05 00:24:44.973 UTC
null
5,526,060
null
2,953,989
null
1
45
html|css|iframe|youtube
91,494
<p>To make a You Tube Video full width and preserve the height (and keep it responsive) you can use the following setup.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>.vide...
8,217,742
One to Many MySQL
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/8216865/mysql-relationships">MySQL Relationships</a> </p> </blockquote> <p>I am trying to create a one to many relationship in MySQL with foreign keys.</p> <p>Two tables, <code>user</code> and <code>location</...
8,217,964
2
3
null
2011-11-21 19:57:58.577 UTC
4
2020-12-11 11:02:32.87 UTC
2017-05-23 12:09:33.837 UTC
null
-1
null
801,858
null
1
19
mysql|database-design|foreign-keys|foreign-key-relationship
86,713
<p>MySQL does not know, nor does it need to know if a relationship is 1-1, or 1-many.<br /> No SQL supports many-many relationships, all require a intermediate table which splits a many-many relationship into 2 separate 1-many.</p> <p>The difference is in the logic that controls the relationships, which is in the code ...
23,594,266
r package KernSmooth copyright
<p>I am new to R. Was able to install a package called KernSmooth using R console. Is there a place where I can figure out the copyright info for KernSmooth? Below is what I did. </p> <pre><code>&gt; install.packages("KernSmooth") --- Please select a CRAN mirror for use in this session --- trying URL 'http://mir...
25,799,293
4
12
null
2014-05-11 15:10:52.213 UTC
3
2018-06-26 19:54:48.547 UTC
2016-05-22 07:33:49.353 UTC
null
4,533,771
null
3,621,202
null
1
15
r
70,979
<p>If you just want to view the copyright, after you install the package, do a library() call</p> <pre><code>&gt; library(KernSmooth) KernSmooth 2.23 loaded Copyright M. P. Wand 1997-2009 </code></pre> <p><a href="https://youtu.be/xzvGA2zKLDc" rel="noreferrer">video explanation</a> (if needed)</p>
5,046,100
Prevent access to files in a certain folder
<p>I have a folder with a lot of <code>.php</code> files. I would like to deny access to them (using <code>.htaccess</code>). I know an option is to move this folder outside <code>public_html</code>, but this is not possible in this situation.</p> <p>Is is possible to block access to a whole folder?</p>
5,046,130
4
0
null
2011-02-18 20:17:45.957 UTC
2
2019-12-03 19:48:34.637 UTC
2016-04-12 22:36:49.683 UTC
null
5,299,236
null
618,622
null
1
26
apache|.htaccess
60,065
<p>Add this to the <code>.htaccess</code> file:</p> <pre><code>order deny,allow deny from all </code></pre>
5,465,245
Create a nullable column using SQL Server SELECT INTO?
<p>When I create a temp table using a <code>select into</code> in SQL Server, is there a way to specify that a column should be nullable? I have a multi-step process where I'm making a temp table by selecting a lot of columns (which is why I'm not doing a <code>create table #tmp (...)</code>). After I make that temp ...
5,465,288
5
0
null
2011-03-28 21:23:49.697 UTC
4
2020-06-15 15:01:16.57 UTC
null
null
null
null
83,144
null
1
36
sql-server|tsql
67,251
<p>Nullability is inherited from the source column.</p> <p>You can lose or gain nullability with an expression:</p> <p>Example (constant literals appear to be problematic - need a good NOOP function which can return NULL):</p> <pre><code>CREATE TABLE SO5465245_IN ( a INT NOT NULL ,b INT NULL ) ; GO ...
5,404,342
ASP.NET XML Parsing Error: no element found Line Number 1, Column 1 Error
<p>Hey I found a weird temperamental page which randomly gives me the following error</p> <pre>XML Parsing Error: no element found Location: http://kj2011/site_2011/nonprofit-database/overview.aspx Line Number 1, Column 1:</pre> <p>This page was fine for like 2 weeks but as of yesterday I randomly get the above error...
5,553,459
12
1
null
2011-03-23 11:13:01.623 UTC
2
2020-07-14 08:51:24.247 UTC
2011-03-29 15:47:33.08 UTC
null
102,112
null
215,541
null
1
11
asp.net|xml
50,358
<p>This was an issue with an external DLL, which created a page called view.aspx in the same folder which caused an issue with our overview.aspx. We just renamed the page and the issue went away.</p>
5,129,624
Convert JS date time to MySQL datetime
<p>Does anyone know how to convert JS dateTime to MySQL datetime? Also is there a way to add a specific number of minutes to JS datetime and then pass it to MySQL datetime?</p>
11,150,727
23
0
null
2011-02-26 20:44:53.363 UTC
59
2022-09-10 10:04:10.227 UTC
null
null
null
null
382,906
null
1
173
javascript|mysql
290,104
<pre class="lang-js prettyprint-override"><code>var date; date = new Date(); date = date.getUTCFullYear() + '-' + ('00' + (date.getUTCMonth()+1)).slice(-2) + '-' + ('00' + date.getUTCDate()).slice(-2) + ' ' + ('00' + date.getUTCHours()).slice(-2) + ':' + ('00' + date.getUTCMinutes()).slice(-2) + ':' +...
16,683,944
AndroidAnnotations Nothing Generated, Empty Activity
<p>I am trying to create a project using AndroidAnnotations in Android Studio. When I build and run the project, everything seems to compile fine, yet I get nothing but a blank activity for the app. In addition, it does not appear that anything is generated by AndroidAnnotations. </p> <p>I have added <code>androidanno...
16,802,216
6
1
null
2013-05-22 05:16:03.787 UTC
21
2014-01-31 23:07:41.217 UTC
2013-05-24 06:13:08.077 UTC
null
1,277,679
null
1,277,679
null
1
10
android|gradle|android-studio|android-annotations
12,986
<p>This is similar to robotoaster's response, but it works in 0.4.1 and it places the generated java source files in a new directory (consistent with the other generated source folders), which allows Android Studio to see the source and stop complaining. It also works with more annotation processors. Just add your anno...
29,699,451
Appending element into an array of strings in C
<p>I have an array of strings with a given size, without using any memory allocation, how do I append something into it?</p> <p>Say I run the code, its waiting for something you want to enter, you enter <code>"bond"</code>, how do I append this into an array ? A[10] ? </p>
29,699,688
5
5
null
2015-04-17 12:37:33.86 UTC
4
2022-02-20 17:44:51.74 UTC
2022-02-20 17:44:51.74 UTC
null
2,877,241
null
3,928,326
null
1
9
c|append|c-strings|strcpy|strcat
61,657
<p>If the array declared like</p> <pre><code>char A[10]; </code></pre> <p>then you can assign string "bond" to it the following way</p> <pre><code>#include &lt;string.h&gt; //... strcpy( A, "bond" ); </code></pre> <p>If you want to append the array with some other string then you can write</p> <pre><code>#includ...
12,470,156
AutoMapper Custom Type Converter not working
<p>I am using <a href="https://github.com/TroyGoode/PagedList">Troy Goode's PagedList</a> to provide paging information in my WebApi. His package returns an IPagedList that implements IEnumerable but also contains custom properties such as IsLastPage, PageNumber, PageCount, etc.</p> <p>When you try to return this cla...
12,538,611
1
0
null
2012-09-18 03:54:32.117 UTC
8
2012-09-21 21:47:43.537 UTC
2012-09-20 13:28:44.227 UTC
null
332,022
null
332,022
null
1
9
automapper|automapper-2
2,842
<p>After pulling my hair out, I finally figured this one out. There isn't anything at all wrong with the code. It turned out to be a threading issue where the configured mappings were getting cleared out. The code above is the proper way to do what I wanted. I am leaving this here so that I can point another questi...
12,345,292
How do enable a .Net web-API to accept g-ziped posts
<p>I have a fairly bog standard .net MVC 4 Web API application. </p> <pre><code> public class LogsController : ApiController { public HttpResponseMessage PostLog(List&lt;LogDto&gt; logs) { if (logs != null &amp;&amp; logs.Any()) { var goodLogs = new List&lt;Log&gt;(); v...
14,990,735
4
1
null
2012-09-10 04:18:32.5 UTC
9
2017-03-31 01:47:23.103 UTC
2013-02-20 22:12:09.95 UTC
null
123,378
null
507,669
null
1
16
c#|asp.net-web-api
13,435
<p>I had the same requirement to POST gzipped data to a .NET web api controller. I came up with this solution:</p> <pre><code>public class GZipToJsonHandler : DelegatingHandler { protected override Task&lt;HttpResponseMessage&gt; SendAsync(HttpRequestMessage request, ...
12,586,132
Java Regex matching between curly braces
<p>I need to parse a log file and get the times and associated function call string This is stored in the log file as so: {"time" : "2012-09-24T03:08:50", "message" : "Call() started"}</p> <p>There will be multiple logged time function calls in between other string characters, so hence I am hoping to use regex to go t...
12,586,201
5
0
null
2012-09-25 15:25:02.03 UTC
7
2016-03-02 06:57:21.397 UTC
null
null
null
null
1,224,079
null
1
19
java|regex
58,827
<p>you need to escape '{' &amp; '}' with a '\'</p> <p>so: <code>"{(.*?)}"</code> becomes: <code>"\\{(.*?)\\}"</code></p> <p>where you have to escape the '\' with another '\' first</p> <p>see: <a href="http://www.regular-expressions.info/reference.html" rel="noreferrer">http://www.regular-expressions.info/reference.h...
12,427,449
ElasticSearch -- boosting relevance based on field value
<p>Need to find a way in ElasticSearch to boost the relevance of a document based on a particular value of a field. Specifically, there is a special field in all my documents where the higher the field value is, the more relevant the doc that contains it should be, regardless of the search.</p> <p>Consider the follow...
12,430,664
4
1
null
2012-09-14 15:20:42.87 UTC
27
2019-09-19 13:39:27.05 UTC
2012-09-14 15:25:48.997 UTC
null
84,131
null
943,184
null
1
67
search|elasticsearch
48,267
<p>You can either boost at index time or query time. I usually prefer query time boosting even though it makes queries a little bit slower, otherwise I'd need to reindex every time I want to change my boosting factors, which usally need fine-tuning and need to be pretty flexible.</p> <p>There are different ways to app...
12,453,160
Remove empty lines in text using Visual Studio or VS Code
<p>How to remove empty lines in Visual Studio?</p>
12,453,161
13
3
null
2012-09-17 04:32:48.307 UTC
77
2022-04-09 17:29:05.267 UTC
2022-02-18 14:23:33.77 UTC
null
510,558
null
510,558
null
1
170
regex|visual-studio|visual-studio-2010|visual-studio-code|line
120,278
<p>It's very useful especially if you want to arrange or compare codes, thanks to the people who answer this question, I've got the answer from <a href="http://wblo.gs/VGx" rel="noreferrer">here</a> and would like to share it with Stackoverflow:</p> <p><strong>Visual Studio</strong> (Visual Studio Code) has the ability...
19,151,940
git remove trailing whitespace in new files before commit
<p>I know removing trailing whitespace can be done with a pre-commit hook. I am interested in doing it manually. I read the question here:<br> <a href="https://stackoverflow.com/questions/591923/make-git-automatically-remove-trailing-whitespace-before-committing">Make git automatically remove trailing whitespace before...
19,156,679
4
4
null
2013-10-03 06:05:42.193 UTC
10
2014-03-06 00:14:15.917 UTC
2017-05-23 12:03:05.607 UTC
null
-1
null
4,704,515
null
1
16
git|whitespace|removing-whitespace
22,796
<p>To manually clean up whitespace from your last 3 commits, you can do this:</p> <p><code>git rebase --whitespace=fix HEAD~3</code></p> <p>When I work on a topic branch, I track the upstream branch (usually by creating it like this)</p> <p><code>git checkout -b topic -t</code></p> <p>Which allows me to drop the la...
3,548,635
Python + JSON, what happened to None?
<p>Dumping and loading a dict with <a href="https://docs.python.org/3/library/constants.html#None" rel="noreferrer"><code>None</code></a> as key, results in a <a href="https://docs.python.org/3.7/tutorial/datastructures.html#dictionaries" rel="noreferrer">dictionary</a> with <code>'null'</code> as the key.</p> <p>Valu...
3,548,740
3
1
null
2010-08-23 14:44:32.357 UTC
7
2019-09-16 08:15:05.583 UTC
2018-07-25 06:40:47.743 UTC
user8554766
null
null
294,585
null
1
30
python|json|dictionary
88,173
<p>JSON objects are maps of <em>strings</em> to values. If you try to use another type of key, they'll get converted to strings.</p> <pre><code>&gt;&gt;&gt; json.loads(json.dumps({123: None})) {'123': None} &gt;&gt;&gt; json.loads(json.dumps({None: None})) {'null': None} </code></pre>
3,842,616
Organizing Python classes in modules and/or packages
<p>I like the Java convention of having one public class per file, even if there are sometimes good reasons to put more than one public class into a single file. In my case I have alternative implementations of the same interface. But if I would place them into separate files, I'd have redundant names in the import sta...
3,842,687
3
1
null
2010-10-01 19:58:31.987 UTC
22
2020-10-10 06:58:11.937 UTC
2010-10-02 08:47:43.073 UTC
null
238,134
null
238,134
null
1
60
python|class|module|package
35,453
<p>A lot of it is personal preference. Using python modules, you do have the option to keep each class in a separate file and still allow for <code>import converters.SomeConverter</code> (or <code>from converters import SomeConverter</code>)</p> <p>Your file structure could look something like this:</p> <pre><code>* ...
3,266,524
How to get user password for database
<p>I am using phpMyAdmin; I created a database; now I want to locate the username and password for this new database I created. Note, I am not sys admin, I am only the developer, but I do have access to create db on MySQL in phpMyAdmin. Does my sys admin needs to tell me the username and password to access this db, or ...
3,266,546
4
0
null
2010-07-16 15:38:42.387 UTC
1
2022-01-21 09:37:30.77 UTC
2022-01-21 09:37:30.77 UTC
null
1,839,439
null
255,391
null
1
10
php|mysql|phpmyadmin
111,078
<p>In MySQL creating a database doesn't automatically create a user to go with it. You must explicitly create the user and grant acess.</p> <p><a href="http://dev.mysql.com/doc/refman/5.1/en/adding-users.html" rel="noreferrer">http://dev.mysql.com/doc/refman/5.1/en/adding-users.html</a></p>
24,270,036
Listening to all scroll events on a page
<p><strong>Background:</strong></p> <p>I'm writing a component that opens up a sub-menu on click. I can't know where this component will be placed on the page or how far it will be nested in areas that may have the <code>overflow</code> property set.</p> <p>Given that the overflow may clip the sub-menu I am instead m...
30,723,677
4
11
null
2014-06-17 17:34:51.037 UTC
4
2015-06-09 18:59:33.143 UTC
2014-06-17 17:45:19.827 UTC
null
573,634
null
573,634
null
1
28
javascript|jquery
15,258
<p>You should be able to attach a document-level listener with a third parameter of <code>true</code> to capture the scroll events on all elements. Here's what that looks like:</p> <pre><code>document.addEventListener('scroll', function(e){ }, true); </code></pre> <p>The <code>true</code> at the end is the important ...
19,252,777
.Net Remoting versus WCF
<p>I am wondering that I can do same thing from both .net remoting and WCF, then why WCF is more preferred over .Net remoting. Where can I choose (or in which situation) .Net remoting or WCF?</p>
19,252,815
2
12
null
2013-10-08 16:04:23.857 UTC
12
2016-02-19 04:19:17.59 UTC
2013-10-09 04:24:26.007 UTC
null
1,501,794
null
2,779,561
null
1
24
c#|wcf|.net-remoting
18,864
<p><strong>.NET Remoting</strong> applications can use the HTTP, TCP, and SMTP protocols whereas <strong>WCF</strong> can use named pipes and MSMQ as well along with all these protocols.</p> <p>You may find the best answer here: <a href="http://msdn.microsoft.com/en-us/library/aa730857%28v=vs.80%29.aspx" rel="noreferre...
8,650,463
groupby multiple columns in a F# 3.0 query
<p>Just trying out F# 3.0 and hit a bit of a wall when it comes to grouping by multiple columns. The obvious thing to try was</p> <pre><code>query { for d in context.table do groupBy (d.col1,d.col2) into g select (g.Key) } </code></pre> <p>But I get a "Only parameterless constructors and initializers are ...
16,826,263
8
8
null
2011-12-27 23:49:09.967 UTC
8
2019-04-10 06:38:23.47 UTC
2017-05-23 12:16:43.803 UTC
null
-1
null
926,042
null
1
38
f#|f#-3.0
3,045
<p>The following is an example of multiple columns being used for grouping in c# and converted to f# (overly paranoid management has made me rename everything, but I believe I have been consistent):</p> <p>(TheDatabase was generated by SqlMetal, GetSummedValuesResult is a F# record type)</p> <p>c#</p> <pre><code>pub...