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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
50,937,362 | Multiprocessing on Python 3 Jupyter | <p>I come here because I have an issue with my Jupiter's Python3 notebook.
I need to create a function that uses the multiprocessing library.
Before to implement it, I make some tests.
I found a looooot of different examples but the issue is everytime the same : my code is executed but nothing happens in the noteboo... | 53,162,557 | 4 | 0 | null | 2018-06-19 21:46:32.553 UTC | 4 | 2022-05-19 20:00:13.91 UTC | 2020-02-04 09:55:54.097 UTC | null | 1,185,254 | null | 9,533,185 | null | 1 | 25 | multiprocessing|jupyter-notebook|python-3.6 | 46,472 | <p>Another way of running multiprocessing jobs in a Jupyter notebook is to use one of the approaches supported by the <a href="https://github.com/micahscopes/nbmultitask" rel="nofollow noreferrer">nbmultitask</a> package.</p> |
39,931,316 | What is the PID in the host, of a process running inside a Docker container? | <p>There are several processes running in a Docker container, their PIDs are isolated in the container namespace, is there a way to figure out what are their PIDs on the Docker host?</p>
<p>For example there is an Apache web server running inside a Docker container,
(I use Apache+PHP image from <a href="https://hub.d... | 39,932,796 | 3 | 1 | null | 2016-10-08 10:33:09.817 UTC | 9 | 2021-11-10 20:42:48.233 UTC | null | null | null | null | 296,988 | null | 1 | 29 | linux|docker|process|pid | 35,246 | <p>You can look at the <code>/proc/<pid>/status</code> file to determine the mapping between the namespace PID and the global PID. For example, if in a docker container I start several <code>sleep 900</code> processes, like this:</p>
<pre><code># docker run --rm -it alpine sh
/ # sleep 900 &
/ # sleep 900 &... |
37,326,002 | Is it possible to make a trainable variable not trainable? | <p>I created a <em><strong>trainable</strong> variable</em> in a scope. Later, I entered the same scope, set the scope to <code>reuse_variables</code>, and used <code>get_variable</code> to retrieve the same variable. However, I cannot set the variable's trainable property to <code>False</code>. My <code>get_variable</... | 37,327,561 | 4 | 1 | null | 2016-05-19 14:17:19.537 UTC | 20 | 2019-05-17 20:21:56 UTC | 2018-01-04 02:52:23.547 UTC | null | 3,924,118 | null | 1,913,898 | null | 1 | 38 | tensorflow|pre-trained-model | 32,165 | <p>After looking at the documentation and the code, I was <strong>not</strong> able to find a way to remove a Variable from the <code>TRAINABLE_VARIABLES</code>.</p>
<h3>Here is what happens:</h3>
<ul>
<li>The first time <code>tf.get_variable('weights', trainable=True)</code> is called, the variable is added to the l... |
25,848,879 | Difference between mod and rem operators in VHDL? | <p>I came across these statements in VHDL programming and could not understand the difference between the two operators mod and rem</p>
<pre><code> 9 mod 5
(-9) mod 5
9 mod (-5)
9 rem 5
(-9) rem 5
9 rem (-5)
</code></pre> | 25,850,139 | 2 | 1 | null | 2014-09-15 13:09:00.72 UTC | 6 | 2017-11-24 10:20:03.827 UTC | null | null | null | null | 2,828,316 | null | 1 | 17 | vhdl | 88,183 | <p>A way to see the different is to run a quick simulation in a test bench, for
example using a process like this:</p>
<pre><code>process is
begin
report " 9 mod 5 = " & integer'image(9 mod 5);
report " 9 rem 5 = " & integer'image(9 rem 5);
report " 9 mod (-5) = " & integer'image(9 mod (-... |
25,758,737 | vagrant login as root by default | <p>Problem: frequently the first command I type to my boxes is <code>su -</code>.</p>
<p>Question: how do I make <code>vagrant ssh</code> use the root user by default?</p>
<p>Version: vagrant 1.6.5</p> | 25,758,738 | 11 | 1 | null | 2014-09-10 06:31:20.003 UTC | 45 | 2022-02-02 15:22:24.853 UTC | null | null | null | null | 1,574,942 | null | 1 | 104 | authentication|ssh|vagrant|root | 179,126 | <p><strong>Solution:</strong> <br/>
Add the following to your <code>Vagrantfile</code>:</p>
<pre class="lang-ruby prettyprint-override"><code>config.ssh.username = 'root'
config.ssh.password = 'vagrant'
config.ssh.insert_key = 'true'
</code></pre>
<p>When you <code>vagrant ssh</code> henceforth, you will login as <co... |
30,685,623 | How to implement a Java stream? | <p>I want to implement a <code>Stream<T></code>.</p>
<p>I don't want to just use <code>implements Stream<T></code>, because I would have to implement a ton of methods.</p>
<p>Can this be avoided?</p>
<p>To be more concrete, how can I stream <code>t1</code>, <code>t2</code> and <code>t3</code> for example... | 30,685,799 | 5 | 2 | null | 2015-06-06 17:27:18.453 UTC | 15 | 2017-08-12 00:34:12.823 UTC | 2017-04-04 16:35:59.707 UTC | null | 3,453,226 | null | 1,022,707 | null | 1 | 39 | java|java-8|java-stream | 39,768 | <p>The JDK's standard implementation of <code>Stream</code> is the internal class <code>java.util.stream.ReferencePipeline</code>, you cannot instantiate it directly. </p>
<p>Instead you can use <code>java.util.stream.Stream.builder()</code>, <code>java.util.stream.StreamSupport.stream(Spliterator<T>, boolean)</... |
32,466,073 | Alamofire No Such Module (CocoaPods) | <p>Using Xcode 7</p>
<p>I am trying to install Alamofire in a sample project. Have used the instructions from <a href="http://www.raywenderlich.com/97014/use-cocoapods-with-swift" rel="noreferrer">Ray Wenderlich's page</a></p>
<p>Only change from above link is the podfile -- which is from GitHub page <a href="https:/... | 32,499,180 | 18 | 3 | null | 2015-09-08 19:48:47.613 UTC | 5 | 2021-10-07 06:02:10.57 UTC | 2018-03-18 14:50:34.243 UTC | null | 1,033,581 | null | 849,775 | null | 1 | 37 | ios|cocoapods|alamofire | 55,687 | <p>Try this one.</p>
<p>For Swift 2.0 there is no need to add Alamofire.xcodeproj into your xcode. Simply copy and paste source folder from <a href="https://github.com/Alamofire">https://github.com/Alamofire</a> and you are done.</p>
<p>or if you want to install Alamofire from Cocoapods then try below code.</p>
<pre... |
36,553,274 | Uncaught TypeError: Cannot set property playerNo of # which has only a getter on line 4 | <p>I'm moving from using the hacky JavaScript classes of old (functions and prototypes) to the new ES6 classes.</p>
<p>I'm probably doing something stupid but I'm not sure why I'm not allowed to do this:</p>
<pre><code>class Player{
constructor(playerNo){
this.playerNo = playerNo;
}
get player... | 36,553,360 | 3 | 3 | null | 2016-04-11 15:42:33.913 UTC | 6 | 2021-01-23 17:53:19.467 UTC | null | null | null | null | 2,953,666 | null | 1 | 33 | javascript|ecmascript-6 | 54,801 | <p>You have recursion with setting <code>playerNo</code>.</p>
<p>In the <code>playerNo</code> setter, try setting <code>this._playerNo = 0</code>.</p>
<p>In the rest of the code, continue to make a distinction between the name of the setter method and the internal property that stores the data. </p> |
34,607,841 | React router nav bar example | <p>I am a beginner in React JS and would like to develop a react router based navigation for my Dashboard. The mockup is as follows:</p>
<p><a href="https://i.stack.imgur.com/lwtCO.png"><img src="https://i.stack.imgur.com/lwtCO.png" alt="Mockup"></a></p>
<p>My app.js code which I created to try routing is as follows:... | 34,634,762 | 4 | 4 | null | 2016-01-05 09:10:22.927 UTC | 38 | 2022-05-29 18:14:00.957 UTC | 2016-01-05 17:05:41.363 UTC | null | 452,332 | null | 452,332 | null | 1 | 71 | reactjs|nav|react-router | 173,789 | <p>Yes, Daniel is correct, but to expand upon his answer, your primary app component would need to have a navbar component within it. That way, when you render the primary app (any page under the '/' path), it would also display the navbar. I am guessing that you wouldn't want your login page to display the navbar, so ... |
6,821,755 | multi tenant with custom domain on rails | <p>I'm creating a multi tenant application like shopify and wanna know how can I create custom domain on server that points to the same application instance?
For example:</p>
<pre><code>app1.mysystem.com == www.mystore.com
app2.mystem.com == www.killerstore.com
</code></pre>
<p>I need to do that config on CNAME like ... | 6,822,083 | 2 | 0 | null | 2011-07-25 20:12:45.99 UTC | 10 | 2016-04-06 15:48:15.313 UTC | null | null | null | null | 151,174 | null | 1 | 4 | ruby-on-rails|apache|multi-tenant | 1,862 | <p>I have a similar setup and am using nginX. What I did for ease of maintenance was accepted all the connections from nginx and did the filtering in my app.</p>
<pre><code># application_controller.rb
before_filter :current_client
private
def current_client
# I am using MongoDB with Mongoid, so change the syntax of... |
6,322,127 | Can not find the tag library descriptor for http://java.sun.com/jsf/facelets | <p>I've a JSP with</p>
<pre><code><%@taglib uri="http://java.sun.com/jsf/facelets" prefix="ui" %>
</code></pre>
<p>However it errors with</p>
<blockquote>
<p>The absolute uri: <a href="http://java.sun.com/jsf/facelets" rel="nofollow">http://java.sun.com/jsf/facelets</a> cannot be resolved in either web.xml o... | 6,322,355 | 2 | 0 | null | 2011-06-12 13:13:36.423 UTC | 9 | 2015-04-28 14:23:42.7 UTC | 2015-03-05 11:37:17.597 UTC | null | 157,882 | null | 779,098 | null | 1 | 13 | jsp|jsf|facelets|taglib | 39,112 | <p>Facelets is intented to <strong>replace</strong> JSP altogether. But yet you're attempting to declare it as a JSP taglib. This is never going to work. Both are distinct view technologies. Facelets is a XML based view technology which is designed to be a successor of JSP. In Java EE 6 which was released december 2009... |
6,661,108 | Import WordNet In NLTK | <p>I want to import <em><code>wordnet</code></em> dictionary but when i import Dictionary form <em><code>wordnet</code></em> i see this error :</p>
<pre><code> for l in open(WNSEARCHDIR+'/lexnames').readlines():
IOError: [Errno 2] No such file or directory: 'C:\\Program Files\\WordNet\\2.0\\dict/lexnames'
</code></pre... | 6,662,494 | 2 | 0 | null | 2011-07-12 08:00:34.917 UTC | 6 | 2021-08-20 16:21:47.233 UTC | 2011-07-12 09:34:37 UTC | null | 166,749 | null | 838,242 | null | 1 | 15 | python|dictionary|nltk|wordnet|stemming | 41,933 | <p>The following works for me:</p>
<pre><code>>>> nltk.download()
# Download window opens, fetch wordnet
>>> from nltk.corpus import wordnet as wn
</code></pre>
<p>Now I've a <code>WordNetCorpusReader</code> called <code>wn</code>. I don't know why you're looking for a <code>Dictionary</code> class,... |
6,634,077 | PHP SOAP client Tutorial/Recommendation? | <p>I need to build some integration with a SOAP service based on .NET 2.0. Im using PHP 5 and have never used SOAP. There doesn't appear to be any straight forward tutorials about how to talk to a soap service using PHP.</p>
<p>Does anyone know where to find some good tutorials or docs?</p> | 6,634,106 | 2 | 1 | null | 2011-07-09 09:59:54.3 UTC | 7 | 2015-06-15 11:34:11.407 UTC | 2013-08-09 15:33:46.07 UTC | null | 630,443 | null | 579,049 | null | 1 | 21 | php|soap|soap-client | 39,217 | <p>Have you tried <a href="http://php.net/manual/pl/class.soapclient.php" rel="noreferrer">SoapClient</a> which is already built into PHP?</p>
<p>There is one tutorial: <a href="http://www.codingfriends.com/index.php/2010/04/16/soap-client-calling-net-web-service/" rel="noreferrer">PHP - Soap Client calling .NET Web s... |
6,567,724 | Matplotlib so log axis only has minor tick mark labels at specified points. Also change size of tick labels in colorbar | <p>I am trying to create a plot but I just want the ticklabels to show as shown where the log scale is shown as above. I only want the minor ticklabel for 50, 500 and 2000 to show. Is there anyway to specify the minor tick labels to show?? I have been trying to figure this out for a bit but haven't found a good solutio... | 6,568,248 | 2 | 0 | null | 2011-07-04 05:50:13.857 UTC | 14 | 2021-11-07 16:47:00.857 UTC | 2016-07-26 10:12:13.043 UTC | null | 2,666,859 | null | 748,357 | null | 1 | 22 | python|numpy|scipy|matplotlib | 25,311 | <ol>
<li>Use <code>FixedLocator</code> to statically define explicit tick locations.</li>
<li>Colorbar <code>cbar</code> will have an <code>.ax</code> attribute that will provide access to the usual axis methods including tick formatting. This is not a reference to an <code>axes</code> (e.g. <code>ax1</code>, <code>ax2... |
7,129,249 | Getting the floor value of a number in SQLite? | <p>I have a SQLite database with a table containing the scores of some league players in a bowling center. I'm trying to get the average of the Score column for each player ID. The problem with this is I only need the whole part of the average, and it should not be rounded (example: an average of 168.99 should return 1... | 7,129,253 | 3 | 0 | null | 2011-08-20 02:33:23.277 UTC | null | 2021-11-24 17:55:26.333 UTC | 2021-11-24 17:55:26.333 UTC | null | 9,449,426 | null | 804,929 | null | 1 | 29 | sql|sqlite|floor | 27,842 | <p>You can just use cast it to an integer. It will truncate it, which is equivalent to floor.</p> |
7,479,720 | Removing the first 16 bytes from a byte array | <p>In Java, how do I take a byte[] array and remove the first 16 bytes from the array? I know I might have to do this by copying the array into a new array. Any examples or help would be appreciated.</p> | 7,479,741 | 4 | 0 | null | 2011-09-20 03:18:31.18 UTC | null | 2021-01-16 02:49:53.45 UTC | 2011-09-20 04:17:50.653 UTC | null | 98,094 | null | 98,094 | null | 1 | 11 | java|bytearray | 38,356 | <p>See <code>Arrays</code> class in the <a href="https://docs.oracle.com/javase/9/docs/api/java/util/Arrays.html#copyOfRange-byte:A-int-int-" rel="nofollow noreferrer">Java library</a>:</p>
<pre><code>Arrays.copyOfRange(byte[] original, int from, int to)
</code></pre>
<p><code>from</code> is inclusive, whereas <code>to... |
7,496,840 | Get Android shared preferences value in activity/normal class | <p>I have made a shared preference activity that store the user settings, now i want to get values in a activity or normal java class.please provide a solution or example i have already tried this code but failed.</p>
<pre><code>public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);... | 7,497,079 | 4 | 2 | null | 2011-09-21 08:35:11.227 UTC | 11 | 2018-08-11 05:08:42.01 UTC | 2011-09-21 09:19:06.13 UTC | null | 213,550 | null | 921,653 | null | 1 | 41 | android|sharedpreferences | 118,214 | <p>If you have a SharedPreferenceActivity by which you have saved your values </p>
<pre><code>SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
String imgSett = prefs.getString(keyChannel, "");
</code></pre>
<p>if the value is saved in a SharedPreference in an Activity then this is the co... |
7,869,405 | Opencv match contour image | <p>I'd like to know what would be the best strategy to compare a group of contours, in fact are edges resulting of a canny edges detection, from two pictures, in order to know which pair is more alike. </p>
<p>I have this image:</p>
<p><a href="http://i55.tinypic.com/10fe1y8.jpg" rel="noreferrer">http://i55.tinypic.c... | 7,870,399 | 1 | 0 | null | 2011-10-23 21:39:01.173 UTC | 14 | 2011-10-24 16:52:29.123 UTC | null | null | null | null | 985,289 | null | 1 | 16 | opencv|contour | 20,547 | <p>Well, for this you have a couple of options depending on how robust you need your approach to be.</p>
<h2>Simple Solutions (with assumptions):</h2>
<p>For these methods, I'm assuming your the images you supplied are what you are working with (i.e., the objects are already segmented and approximately the same scale... |
2,083,923 | Empty textbox using Jquery | <p>I'm able to hide the 'tr' when 'Remove' is clicked. with the following code.</p>
<pre><code>$("a#minus").bind("click", function(e){
$(this).closest('tr').hide();
});
</code></pre>
<p>But I also want to clear the content of the 2 text boxes (id of the textbox's are dynamic [frm_Expense_expensesVO_<em>__strAmoun... | 2,083,938 | 4 | 0 | null | 2010-01-18 04:35:37.26 UTC | 2 | 2010-01-18 06:25:00.99 UTC | null | null | null | null | 234,110 | null | 1 | 6 | jquery|textbox | 58,325 | <pre><code>$("a#minus").bind("click", function(e){
$(this).closest('tr').hide().find('input:text').val('');
});
</code></pre>
<p><strong>Note:</strong> Also see <a href="https://stackoverflow.com/questions/2083923/empty-textbox-using-jquery/2083955#2083955">darmen's answer</a> on why the selector <code>a#minus</co... |
2,134,461 | Why can't indexed views have a MAX() aggregate? | <p>I have been trying out a few index views and am impressed but I nearly always need a max or a min as well and can not understand why it doesn't work with these, can anyone explain why?</p>
<p>I KNOW they are not allowed, I just can't understand why!!! Count etc. is allowed why not MIN/MAX, I'm looking for explanati... | 2,134,890 | 4 | 0 | null | 2010-01-25 18:09:23.537 UTC | 4 | 2019-10-17 06:12:16.927 UTC | 2010-01-25 19:04:02.287 UTC | null | 40,725 | null | 234,457 | null | 1 | 51 | sql-server|view|indexing|aggregate | 16,833 | <p>These aggregates are not allowed because they cannot be recomputed solely based on the changed values.</p>
<p>Some aggregates, like <code>COUNT_BIG()</code> or <code>SUM()</code>, can be recomputed just by looking at the data that changed. These are allowed within an indexed view because, if an underlying value cha... |
26,182,524 | Oracle: How to select current date (Today) before midnight? | <p>Using Oracle, how do you select current date (i.e. SYSDATE) at 11:59:59?</p>
<p>Take into account that the definition of midnight <a href="https://english.stackexchange.com/questions/6459/how-should-midnight-on-be-interpreted">might be a little ambiguous</a> (Midnight Thursday means Straddling Thursday and Friday o... | 26,182,525 | 3 | 1 | null | 2014-10-03 16:00:02.093 UTC | 6 | 2015-10-16 03:01:17.473 UTC | 2017-04-13 12:38:09.717 UTC | null | -1 | null | 2,658,613 | null | 1 | 11 | sql|database|oracle | 76,025 | <p>To select current date (Today) before midnight (one second before) you can use any of the following statements:</p>
<pre><code>SELECT TRUNC(SYSDATE + 1) - 1/(24*60*60) FROM DUAL
SELECT TRUNC(SYSDATE + 1) - INTERVAL '1' SECOND FROM DUAL;
</code></pre>
<p>What it does:</p>
<ol>
<li>Sum one day to <code>SYSDATE</cod... |
7,123,060 | Is there a predict function for plm in R? | <p>I have a small N large T panel which I am estimating via <code>plm::plm</code> (panel linear regression model), with fixed effects.</p>
<p>Is there any way to get predicted values for a new dataset? (I want to
estimate parameters on a subset of my sample, and then use these to
calculate model-implied values for the ... | 7,129,240 | 5 | 5 | null | 2011-08-19 14:28:17.17 UTC | 11 | 2022-04-17 22:22:25.577 UTC | 2022-04-17 22:22:25.577 UTC | null | 4,640,346 | null | 1,106,532 | null | 1 | 19 | r|panel-data|plm | 15,382 | <p>There are (at least) two methods in the package to produce estimates from plm objects: </p>
<p>-- fixef.plm: Extract the Fixed Effects</p>
<p>-- pmodel.response: A function to extract the model.response</p>
<p>It appears to me that the author(s) are not interested in providing estimates for the "r... |
7,433,602 | How to center in JTable cell a value? | <p>How to center a value in <code>JTable</code> cell? I'm using Netbeans.</p> | 7,433,758 | 6 | 1 | null | 2011-09-15 15:41:39.297 UTC | 10 | 2017-08-12 16:59:26.313 UTC | 2011-09-15 18:09:28.133 UTC | null | 418,556 | null | 452,011 | null | 1 | 31 | java|swing|jtable | 95,530 | <p>You need to customize the renderer. To center the first column you can do:</p>
<pre><code>DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer();
centerRenderer.setHorizontalAlignment( JLabel.CENTER );
table.getColumnModel().getColumn(0).setCellRenderer( centerRenderer );
</code></pre>
<p>To cent... |
7,537,791 | Understanding Recursion to generate permutations | <p>I find recursion, apart from very straight forward ones like factorial, very difficult to understand. The following snippet prints all permutations of a string. Can anyone help me understand it. What is the way to go about to understand recursion properly.</p>
<pre><code>void permute(char a[], int i, int n)
{
in... | 7,537,933 | 6 | 4 | null | 2011-09-24 08:00:40.993 UTC | 52 | 2020-04-11 00:13:54.71 UTC | 2011-09-24 10:15:50.72 UTC | null | 176,418 | null | 176,418 | null | 1 | 51 | c++|recursion | 80,207 | <p>PaulR has the right suggestion. You have to run through the code by "hand" (using whatever tools you want - debuggers, paper, logging function calls and variables at certain points) until you understand it. For an explanation of the code I'll refer you to quasiverse's excellent answer.</p>
<p>Perhaps this visualiza... |
7,190,965 | How to move (and overwrite) all files from one directory to another? | <p>I know of the <code>mv</code> command to move a file from one place to another, but how do I move all files from one directory into another (that has a bunch of other files), overwriting if the file already exists?</p> | 7,190,995 | 6 | 2 | null | 2011-08-25 13:12:35.02 UTC | 7 | 2019-11-12 13:43:52.47 UTC | 2011-08-25 16:39:11.61 UTC | null | 471,272 | null | 906,475 | null | 1 | 60 | linux|unix | 189,352 | <p>It's just <code>mv srcdir/* targetdir/</code>.</p>
<p>If there are too many files in <code>srcdir</code> you might want to try something like the following approach:</p>
<pre><code>cd srcdir
find -exec mv {} targetdir/ +
</code></pre>
<p>In contrast to <code>\;</code> the final <code>+</code> collects arguments i... |
14,004,442 | Cannot apply indexing with [] to an expression of type `object' | <p><strong>H</strong>ere is my code: An ArrayList of ArrayList that returns a float:</p>
<pre><code>public ArrayList walls=new ArrayList();
public void Start()
{
walls[0] = ReturnInArrayList(279,275,0,0,90);
walls[1] = ReturnInArrayList(62,275,0,0,0);
walls[2] = ReturnInArrayList(62,275,62,0,90);
wal... | 14,004,488 | 4 | 4 | null | 2012-12-22 16:21:19.44 UTC | 2 | 2020-06-09 19:06:34.477 UTC | 2020-06-09 19:06:34.477 UTC | null | 1,646,928 | null | 1,646,928 | null | 1 | 16 | c#|object|arraylist|indexing | 83,190 | <p>The problem is that <code>paredes[i]</code> returns an <code>object</code> which is the return type of the <code>ArrayList</code> indexer. You need to cast this to an <code>ArrayList</code> to be able to access it:</p>
<pre><code>float a= (float)((ArrayList)paredes[i])[0];
</code></pre>
<p>A better solution though... |
14,191,929 | Fingerprint Scanner using Camera | <p>Working on fingerprint scanner using camera or without, its possibility and its success rate?, I came across one of open source SDK named <a href="http://digitalpersona.com/fingerjetfx/">FingerJetFX</a> its provide feasibilty with android too.</p>
<p>The FingerJetFX OSE fingerprint feature extractor is platform-ind... | 14,205,345 | 2 | 1 | null | 2013-01-07 07:54:16.623 UTC | 25 | 2017-04-27 15:14:23.55 UTC | 2013-01-07 09:54:14.243 UTC | null | 903,469 | null | 646,806 | null | 1 | 43 | android|sdk|android-ndk|camera|fingerprint | 41,988 | <p><strong>Android Camera Based Solutions:</strong></p>
<p>As someone who's done significant research on this exact problem, I can tell you it's difficult to get a suitable image for templating (feature extraction) using a stock camera found on any current Android device. The main debilitating issue is achieving signi... |
14,299,638 | Existential vs. Universally quantified types in Haskell | <p>What exactly is the difference between these? I think I understand how existential types work, they are like having a base class in OO without a way to down cast. How are universal types different? </p> | 14,299,983 | 2 | 3 | null | 2013-01-13 01:07:04.713 UTC | 31 | 2019-10-03 22:29:26.63 UTC | 2017-07-28 16:41:50.703 UTC | null | 6,936,361 | null | 1,615,960 | null | 1 | 60 | haskell|polymorphism|existential-type | 10,541 | <p>The terms "universal" and "existential" here come from the similarly-named quantifiers in <a href="http://en.wikipedia.org/wiki/Predicate_logic">predicate logic</a>. </p>
<p><a href="http://en.wikipedia.org/wiki/Universal_quantification">Universal quantification</a> is normally written as ∀, which you can read as "... |
14,288,288 | Gitlab repository mirroring | <p>Is it possible to have <a href="http://gitlabhq.com/" rel="nofollow noreferrer">gitlab</a> set up to automatically sync (mirror) a repository hosted at another location?</p>
<p>At the moment, the easiest way I know of doing this involves manually pushing to the two (gitlab and the other) repository, but this is time... | 14,291,690 | 10 | 1 | null | 2013-01-11 23:24:24.307 UTC | 40 | 2022-01-15 13:01:49.753 UTC | 2021-04-30 15:13:50.363 UTC | null | 3,783,352 | null | 1,595,865 | null | 1 | 66 | git|version-control|mirroring|gitlab | 61,601 | <p>Update Dec 2016: Mirroring is suported with GitLAb EE 8.2+: see "<a href="https://gitlab.com/help/workflow/repository_mirroring.md" rel="noreferrer">Repository mirroring</a>".</p>
<p>As commented by <a href="https://stackoverflow.com/users/4454315/xiaodong-qi">Xiaodong Qi</a>:</p>
<blockquote>
<p>This answer can... |
14,284,494 | MySQL Error 1264: out of range value for column | <p>As I <code>SET</code> cust_fax in a table in MySQL like this:</p>
<pre><code>cust_fax integer(10) NOT NULL,
</code></pre>
<p>and then I insert value like this:</p>
<pre><code>INSERT INTO database values ('3172978990');
</code></pre>
<p>but then it say </p>
<blockquote>
<p>`error 1264` out of value for column<... | 14,284,564 | 6 | 3 | null | 2013-01-11 18:33:09.523 UTC | 15 | 2022-04-10 05:34:59.387 UTC | 2017-03-31 11:21:35.497 UTC | null | 476,951 | null | 1,906,411 | null | 1 | 106 | mysql|sql|insert|integer | 458,125 | <p>The value 3172978990 is greater than 2147483647 – the maximum value for <code>INT</code> – hence the error. MySQL integer types and their ranges are <a href="https://dev.mysql.com/doc/refman/8.0/en/integer-types.html" rel="noreferrer">listed here</a>.</p>
<p>Also note that the <code>(10)</code> in <code>INT(10)</co... |
14,162,648 | SQL Server 2012 column identity increment jumping from 6 to 1000+ on 7th entry | <p>I have a strange scenario in which the auto identity int column in my SQL Server 2012 database is not incrementing properly.</p>
<p>Say I have a table which uses an int auto identity as a primary key it is sporadically skipping increments, for example:</p>
<p>1,
2,
3,
4,
5,
1004,
1005</p>
<p>This is happening on ... | 14,162,761 | 3 | 5 | null | 2013-01-04 18:19:23.743 UTC | 33 | 2018-02-27 23:48:17.067 UTC | null | null | null | null | 1,384,204 | null | 1 | 129 | sql|sql-server|sql-server-2012|identity | 112,815 | <p>This is all perfectly normal. Microsoft added <code>sequences</code> in SQL Server 2012, finally, i might add and changed the way identity keys are generated. Have a look <a href="http://www.codeproject.com/Tips/668042/SQL-Server-2012-Auto-Identity-Column-Value-Jump-Is" rel="noreferrer">here</a> for some explanation... |
13,916,620 | REST API Login Pattern | <p>I am creating a REST api, closely following apigee suggestions, using nouns not verbs, api version baked into the url, two api paths per collection, GET POST PUT DELETE usage, etc.</p>
<p>I am working on the login system, but unsure of the proper REST way to login users. I am not working on security at this point,... | 14,031,061 | 3 | 10 | null | 2012-12-17 15:05:14.797 UTC | 119 | 2021-03-24 04:48:01.03 UTC | 2021-03-24 04:48:01.03 UTC | null | 9,213,345 | null | 1,649,865 | null | 1 | 199 | design-patterns|rest | 179,351 | <p><a href="http://www.ics.uci.edu/~fielding/pubs/webarch_icse2000.pdf" rel="noreferrer">Principled Design of the Modern Web Architecture by Roy T. Fielding and Richard N. Taylor</a>, i.e. sequence of works from all REST terminology came from, contains definition of client-server interaction:</p>
<blockquote>
<p>All... |
47,460,085 | Error Message "Xcode alone is not sufficient on Sierra" | <p>I'd like to install openCV to vectorize image, but there's a series error message regarding Xcode and Ruby.</p>
<p>First, I use terminal to install openCV, <code>brew install opencv</code>. </p>
<p>Then, I got error message indicating that the system doesn't like my ruby version.</p>
<pre><code>/usr/local/Homebre... | 47,475,201 | 5 | 5 | null | 2017-11-23 16:41:36.65 UTC | 7 | 2020-01-18 00:03:40.69 UTC | 2017-11-24 14:22:33.433 UTC | null | 6,765,415 | null | 6,765,415 | null | 1 | 47 | ruby|xcode|python-3.x|homebrew|command-line-tool | 33,665 | <p>Let me explain this myself so people won't make the same mistakes.</p>
<p>When I saw the last line of the error message </p>
<pre><code>Error: Xcode alone is not sufficient on Sierra.
Install the Command Line Tools:
xcode-select --install
</code></pre>
<p>My thought was: I already have Xcode why the system ask m... |
9,132,930 | JavaScript date.format is not a function | <p>I am using this piece of code to get string representing date <code>yyyy-mm-dd</code> from a hidden field and then format it as needed:</p>
<pre><code>var date_string = $('#end-date').val();
var splitDate = date_string.split("-");
var end_date = new Date(splitDate[0], splitDate[1] - 1, splitDate[2]);
end_date.forma... | 9,132,972 | 2 | 1 | null | 2012-02-03 17:36:13.427 UTC | 2 | 2014-05-24 18:12:26.777 UTC | null | null | null | null | 135,829 | null | 1 | 16 | javascript|html | 73,617 | <p>That is because <code>.format</code> is not a native JavaScript function on <code>Date.prototype</code>.</p>
<p>You need to add a lib like this one: <a href="http://jacwright.com/projects/javascript/date_format/">http://jacwright.com/projects/javascript/date_format/</a></p>
<p>I personally use <a href="http://mome... |
34,100,048 | Create empty branch on GitHub | <p>I want to create a new GitHub branch, called <code>release</code>.</p>
<p>This branch <strong>needs to be empty</strong>! However, there is an existing branch with x commits and I don't want to have its commit history.</p>
<p>The only method I found is to create a <em>local</em> <code>--orphan</code> branch.</p> | 34,100,189 | 5 | 5 | null | 2015-12-05 01:07:50.997 UTC | 86 | 2021-11-12 07:12:15.183 UTC | 2020-07-14 14:56:16.82 UTC | null | 3,266,847 | null | 5,498,155 | null | 1 | 246 | git|github | 171,821 | <p><strong>November 2021 Update:</strong> As of git version 2.27, you can now use <code>git switch --orphan <new branch></code> to create an empty branch with no history.</p>
<p>Unlike <code>git checkout --orphan <new branch></code>, this branch won't have any files from your current branch (save for those ... |
841,696 | Please explain in the simplest, most jargon-free English possible, the "universal property of fold"? | <p>I am working through "Real World Haskell", which led to to a free PDF called <a href="http://www.google.com/url?sa=t&source=web&ct=res&cd=1&url=http%3A%2F%2Fwww.cs.nott.ac.uk%2F~gmh%2Ffold.pdf&ei=G5gESt-OPNKLtgfMrIGbBw&rct=j&q=%22A+tutorial+on+the+universality+and+expressiveness+of+fold%2... | 842,484 | 5 | 3 | null | 2009-05-08 20:41:56.41 UTC | 9 | 2013-12-15 14:35:28.03 UTC | 2013-12-15 14:35:28.03 UTC | null | 1,243,762 | null | 80,112 | null | 1 | 15 | functional-programming|fold|haskell | 1,935 | <p>(Jargon mode off :-)</p>
<p>The universal property is just a way of proving that two expressions are equal. (That's what is meant by the jargon "proof principle".)
The universal property says that if you are able to prove these two equations</p>
<pre><code>g [] = v
g (x:xs) = f x (g xs)
</code></pre>
<p>then... |
367,178 | Usage of IoC Containers; specifically Windsor | <p>I think the answer to this question is so obivous that noone has bothered writing about this, but its late and I really can't get my head around this.</p>
<p>I've been reading into IoC containers (Windsor in this case) and I'm missing how you talk to the container from the various parts of your code.</p>
<p>I get ... | 367,388 | 5 | 0 | null | 2008-12-14 23:52:08.72 UTC | 11 | 2012-08-21 21:32:02.413 UTC | null | null | null | Andrew Bullock | 28,543 | null | 1 | 28 | c#|inversion-of-control|castle-windsor | 8,440 | <p>99% of the cases it's one container instance per app. Normally you initialize it in Application_Start (for a web app), <a href="https://github.com/castleproject/Castle.MonoRail-READONLY/blob/45ac205867396b1b7ad287a872e5b20afd0af837/src/TempWeb/Global.asax.cs" rel="nofollow noreferrer">like this</a>.</p>
<p>After th... |
742,451 | What is a good regular expression for catching typos in an email address? | <p>When users create an account on my site I want to make server validation for emails to not accept <em>every</em> input.</p>
<p>I will send a confirmation, in a way to do a <a href="https://stackoverflow.com/questions/156430/regexp-recognition-of-email-address-hard/156441#156441">handshake validation</a>.</p>
<p>I ... | 742,455 | 5 | 4 | null | 2009-04-12 21:19:57.603 UTC | 23 | 2022-02-18 06:48:24.453 UTC | 2022-02-18 06:48:24.453 UTC | null | 96,944 | null | 32,173 | null | 1 | 92 | c#|regex|email-validation | 69,679 | <pre><code>^\S+@\S+$
</code></pre> |
579,262 | What is the purpose of the EBP frame pointer register? | <p>I'm a beginner in assembly language and have noticed that the x86 code emitted by compilers usually keeps the frame pointer around even in release/optimized mode when it could use the <code>EBP</code> register for something else.</p>
<p>I understand why the frame pointer might make code easier to debug, and might b... | 579,311 | 5 | 10 | null | 2009-02-23 20:45:38.04 UTC | 53 | 2018-06-11 18:45:00.487 UTC | 2018-06-11 18:45:00.487 UTC | dsimcha | 224,132 | dsimcha | 23,903 | null | 1 | 103 | performance|assembly|x86 | 58,369 | <p>Frame pointer is a reference pointer allowing a debugger to know where local variable or an argument is at with a single constant offset. Although ESP's value changes over the course of execution, EBP remains the same making it possible to reach the same variable at the same offset (such as first parameter will alwa... |
125,813 | How to determine the OS path separator in JavaScript? | <p>How can I tell in JavaScript what path separator is used in the OS where the script is running?</p> | 125,825 | 5 | 4 | null | 2008-09-24 07:23:24.95 UTC | 8 | 2021-12-10 09:53:45.953 UTC | 2020-10-21 08:17:43.62 UTC | null | 1,402,846 | Pawel Pojawa | null | null | 1 | 111 | javascript|file|directory | 73,439 | <p>Afair you can always use / as a path separator, even on Windows.</p>
<p>Quote from <a href="http://bytes.com/forum/thread23123.html" rel="noreferrer">http://bytes.com/forum/thread23123.html</a>:</p>
<blockquote>
<p>So, the situation can be summed up
rather simply:</p>
<ul>
<li><p>All DOS services since ... |
748,014 | Do I need to manually close an ifstream? | <p>Do I need to manually call <code>close()</code> when I use a <code>std::ifstream</code>?</p>
<p>For example, in the code:</p>
<pre><code>std::string readContentsOfFile(std::string fileName) {
std::ifstream file(fileName.c_str());
if (file.good()) {
std::stringstream buffer;
buffer << file.r... | 748,059 | 5 | 0 | null | 2009-04-14 14:59:26.16 UTC | 51 | 2018-10-15 08:49:06.25 UTC | 2014-11-04 21:19:57.04 UTC | null | 1,950,231 | null | 61,915 | null | 1 | 243 | c++|ifstream|raii | 90,161 | <p>NO</p>
<p>This is what RAII is for, let the destructor do its job. There is no harm in closing it manually, but it's not the C++ way, it's programming in C with classes.</p>
<p>If you want to close the file before the end of a function you can always use a nested scope.</p>
<p>In the standard (27.8.1.5 Class templa... |
1,134,075 | Finding node order in XML document in SQL Server | <p>How can I find the order of nodes in an XML document?</p>
<p>What I have is a document like this:</p>
<pre><code><value code="1">
<value code="11">
<value code="111"/>
</value>
<value code="12">
<value code="121">
<value code="1211"/>... | 9,863,151 | 6 | 3 | null | 2009-07-15 21:03:58.237 UTC | 12 | 2020-04-22 08:53:57.207 UTC | 2017-09-04 14:26:50.013 UTC | null | 4,519,059 | null | 47,161 | null | 1 | 19 | sql|sql-server|xml|xquery | 17,730 | <p>You can emulate the <code>position()</code> function by counting the number of sibling nodes preceding each node:</p>
<pre class="lang-sql prettyprint-override"><code>SELECT
code = value.value('@code', 'int'),
parent_code = value.value('../@code', 'int'),
ord = value.value('for $i in . return count(../*... |
42,536,506 | Could not load file or assembly 'Microsoft.CodeAnalysis, version= 1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependenc | <p>An update occurred last night and now I find myself unable to do a ctrl + '.' for code suggestions in VS 2015. An error message comes up saying the following:</p>
<blockquote>
<p>Could not load file or assembly 'Microsoft.CodeAnalysis, version= 1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of ... | 42,596,568 | 19 | 3 | null | 2017-03-01 16:04:26.26 UTC | 9 | 2022-04-14 09:53:40.743 UTC | 2017-05-22 18:56:00.453 UTC | null | 1,959,948 | null | 3,019,291 | null | 1 | 90 | c#|visual-studio-2015 | 96,094 | <p>I had the same problem with Visual Studio 2015 Update 2, to solve the problem globally for all solutions, update to <strong>Visual Studio 2015 Update 3</strong>. Here is a link: <a href="https://www.visualstudio.com/en-us/news/releasenotes/vs2015-update3-vs" rel="noreferrer">Download from here</a> </p> |
21,250,849 | npm install doesn't create node_modules directory | <p>I am trying to do a homework for a mongodb uni course. They gave us some files, instructions are:</p>
<p>run <code>npm install mongodb</code> then <code>node app.js</code></p>
<p>for some reason npm install does not create a node_modules directory but I don't see any build errors:</p>
<pre><code>mongo-uni/hw1-2$ ... | 30,518,020 | 12 | 4 | null | 2014-01-21 06:33:11.543 UTC | 9 | 2022-06-30 07:58:29.953 UTC | 2014-01-21 06:38:42.5 UTC | null | 1,388,319 | null | 2,031,033 | null | 1 | 77 | node.js|npm|node-modules | 190,637 | <p><code>npm init</code></p>
<p>It is all you need. It will create the package.json file on the fly for you.</p> |
17,917,160 | iOS developer program certificate transfer | <p>I have some problems with my developer certificate and profile. I have certificate of developer program on my office Mac. I want to develop and test the app on my device at home, so I have added my device and generated provision profile from office Mac. Download and install *.cer and provision on my home Mac, but I ... | 17,917,209 | 3 | 0 | null | 2013-07-29 06:17:04.743 UTC | 10 | 2018-07-01 21:47:05.3 UTC | 2018-07-01 21:47:05.3 UTC | null | 1,506,363 | null | 1,727,703 | null | 1 | 30 | ios|objective-c|swift|xcode|provisioning-profile | 23,118 | <ul>
<li>Open your keychain program at workplace.</li>
<li>Select My certificates section. Select entries listed as iOS Developer certificate, iOS Distribution Certificate etc. For the sake of simplicity select everything that you find related to your membership.</li>
<li>Select Export.</li>
<li>It will ask you enter c... |
1,947,121 | A good NASM/FASM tutorial? | <p>Does anyone know any good <a href="http://www.nasm.us/" rel="noreferrer">NASM</a> or FASM tutorials? I am trying to learn assembler but I can't seem to find any good resources on it.</p> | 1,947,135 | 5 | 2 | null | 2009-12-22 15:33:03.67 UTC | 30 | 2013-10-27 21:37:28.987 UTC | 2013-08-09 13:42:12.71 UTC | user1228 | null | null | 139,766 | null | 1 | 38 | assembly|nasm|fasm | 43,925 | <p>There is e.g. <a href="http://leto.net/writing/nasm.php" rel="noreferrer">Writing A Useful Program With NASM </a> and of course the obvious <a href="http://www.nasm.us/doc/nasmdoc3.html" rel="noreferrer">http://www.nasm.us/doc/nasmdoc3.html</a>.</p>
<p>There are a couple of sample programs at <a href="http://www.cs... |
1,962,332 | How to draw vectors (physical 2D/3D vectors) in MATLAB? | <p>I want to know the simplest way to plot vectors in <a href="http://en.wikipedia.org/wiki/MATLAB" rel="noreferrer">MATLAB</a>.
For example:</p>
<pre><code>a = [2 3 5];
b = [1 1 0];
c = a + b;
</code></pre>
<p>I want to visualize this vector addition as head-to-tail/parallelogram method. How do I plot these vectors... | 1,962,413 | 6 | 0 | null | 2009-12-26 00:43:02.49 UTC | 8 | 2016-02-29 06:18:07.333 UTC | 2009-12-27 16:18:54.86 UTC | null | 63,550 | null | 107,349 | null | 1 | 20 | matlab|vector|plot | 151,818 | <pre><code>a = [2 3 5];
b = [1 1 0];
c = a+b;
starts = zeros(3,3);
ends = [a;b;c];
quiver3(starts(:,1), starts(:,2), starts(:,3), ends(:,1), ends(:,2), ends(:,3))
axis equal
</code></pre> |
2,008,149 | Is there something like LINQ for Java? | <p>Started to learn LINQ with C#.<br/>
Especially LINQ to Objects and LINQ to XML.<br/>
I really enjoy the power of LINQ.<br/></p>
<p>I learned that there is something called <a href="http://hugoware.net/Projects/jLinq" rel="nofollow noreferrer">JLINQ</a> a JavaScript implementation.<br/>
Also (as Catbert posted) Scal... | 2,008,262 | 8 | 5 | null | 2010-01-05 18:22:10.637 UTC | 11 | 2020-05-14 07:25:08.56 UTC | 2020-05-14 07:25:08.56 UTC | null | 1,409,881 | null | 49,544 | null | 1 | 26 | java|linq|scala|closures|java-7 | 14,286 | <p>Look at <a href="http://www.scala-lang.org/" rel="noreferrer">Scala</a>, which is powerful functional programming language, but is similar to Java and runs on Java platform.</p>
<p>In Scala it is possible to use essentially the same code constructs as in LINQ, albeit without special query comprehensions syntax pres... |
1,868,333 | How can I determine the type of a generic field in Java? | <p>I have been trying to determine the type of a field in a class. I've seen all the introspection methods but haven't quite figured out how to do it. This is going to be used to generate xml/json from a java class. I've looked at a number of the questions here but haven't found exactly what I need.</p>
<p>Example:</p... | 1,868,375 | 8 | 1 | null | 2009-12-08 17:00:07.543 UTC | 22 | 2021-04-20 14:25:04.687 UTC | 2016-09-01 21:25:07.893 UTC | null | 227,299 | null | 227,299 | null | 1 | 41 | java|generics|reflection|types|introspection | 58,858 | <p>Have a look at <a href="http://java.sun.com/docs/books/tutorial/reflect/member/fieldTypes.html" rel="noreferrer">Obtaining Field Types</a> from the Java Tutorial <a href="http://java.sun.com/docs/books/tutorial/reflect/" rel="noreferrer">Trail: The Reflection API</a>. </p>
<p>Basically, what you need to do is to ge... |
1,641,957 | Is an array name a pointer? | <p>Is an array's name a pointer in C?
If not, what is the difference between an array's name and a pointer variable?</p> | 1,641,963 | 8 | 8 | null | 2009-10-29 06:38:05.2 UTC | 180 | 2020-09-04 15:52:04.277 UTC | 2017-05-22 08:30:33.56 UTC | null | 584,518 | user188276 | null | null | 1 | 251 | c|arrays|pointers | 95,198 | <p>An array is an array and a pointer is a pointer, but in most cases array names are <em>converted</em> to pointers. A term often used is that they <em>decay</em> to pointers.</p>
<p>Here is an array:</p>
<pre><code>int a[7];
</code></pre>
<p><code>a</code> contains space for seven integers, and you can put a value... |
1,359,680 | C# Training Quizzes | <p>I have been programming 10 years, mostly in vba and vb.net but I know c# well enough to program what I normally do. I yesterday was applying for a Senior c# position and I did so poorly on the induction test its not funny :)</p>
<p>I have always found that for me the best way to learn and recall is via questions an... | 1,359,712 | 9 | 4 | null | 2009-08-31 22:26:33.923 UTC | 18 | 2013-09-09 18:18:05.9 UTC | 2013-09-09 18:18:05.9 UTC | user1228 | null | John Sheppard | null | null | 1 | 15 | c#|c | 26,177 | <p>You might want to take a look at <a href="http://www.microsoft.com/click/areyoucertifiable/" rel="noreferrer">Are You Certifiable</a> from Microsoft.</p>
<p>You have to register with a Windows Live ID to access all the questions. The questions they have cover a range of programming technologies (includes SQL Serve... |
1,670,463 | Latex - Change margins of only a few pages | <p>I have a Latex document where I need to change the margins of only a few pages (the pages where I'm adding a lot of graphics).</p>
<p>In particular, I'd like to change the top margins (<code>\voffset</code>). I've tried doing:</p>
<pre><code>\addtolength{\voffset}{-4cm}
% Insert images here
\addtolength{\voffset... | 1,670,572 | 10 | 0 | null | 2009-11-03 22:10:51.217 UTC | 34 | 2022-06-20 23:57:15.953 UTC | null | null | null | null | 7,277 | null | 1 | 123 | latex | 217,535 | <p>I've used this in <code>beamer</code>, but not for general documents, but it looks like that's what the original hint suggests</p>
<pre><code>\newenvironment{changemargin}[2]{%
\begin{list}{}{%
\setlength{\topsep}{0pt}%
\setlength{\leftmargin}{#1}%
\setlength{\rightmargin}{#2}%
\setlength{\listparindent}{\parindent... |
2,113,069 | C# getting its own class name | <p>If I have a class called <code>MyProgram</code>, is there a way of retrieving "<em>MyProgram</em>" as a string?</p> | 2,113,076 | 11 | 0 | null | 2010-01-21 21:30:26.173 UTC | 66 | 2021-07-12 02:05:58.017 UTC | 2016-12-21 02:19:26.373 UTC | user6269864 | null | null | 144,152 | null | 1 | 624 | c#|reflection | 531,162 | <p>Try this:</p>
<pre><code>this.GetType().Name
</code></pre> |
2,100,829 | When should you branch? | <p>When working with a SCM system, when should you branch?</p> | 2,100,846 | 12 | 0 | null | 2010-01-20 11:06:32.187 UTC | 51 | 2022-07-26 14:06:14.21 UTC | 2010-01-20 11:08:16.273 UTC | null | 20,972 | null | 38,522 | null | 1 | 112 | version-control|branch | 38,280 | <p>There are several uses for branching. One of the most common uses is for separating projects that once had a common code base. This is very useful to experiment with your code, without affecting the main trunk.</p>
<p>In general, you would see two branch types:</p>
<ul>
<li><p>Feature Branch: If a particular featu... |
33,567,101 | Using lapply to change column names of a list of data frames | <p>I'm trying to use <strong>lapply</strong> on a list of data frames; but failing at passing the parameters correctly (I think). </p>
<p>List of data frames:</p>
<pre><code>df1 <- data.frame(A = 1:10, B= 11:20)
df2 <- data.frame(A = 21:30, B = 31:40)
listDF <- list(df1, df2,df3) #multiple data frames w... | 33,567,207 | 3 | 3 | null | 2015-11-06 12:44:48.303 UTC | 9 | 2019-02-22 17:47:16.113 UTC | 2016-02-16 18:26:55.84 UTC | null | 2,204,410 | null | 3,310,782 | null | 1 | 16 | r|dataframe|lapply | 26,612 | <p>You can also use <code>setNames</code> if you want to replace all columns</p>
<pre><code>df1 <- data.frame(A = 1:10, B= 11:20)
df2 <- data.frame(A = 21:30, B = 31:40)
listDF <- list(df1, df2)
new_col_name <- c("C", "D")
lapply(listDF, setNames, nm = new_col_name)
## [[1]]
## C D
## 1 1 11
## 2... |
8,579,330 | Appending to crontab with a shell script on Ubuntu | <p>I'm trying to add a line to the crontab on Ubuntu.</p>
<p>Right now, I'm doing <code>crontab -e</code> and editing the crontab there.</p>
<p>However, I can't seem to find the real crontab file, since <code>crontab -e</code> seems to give you a temporary working copy.</p>
<p><code>/etc/crontab</code> looks like th... | 8,579,472 | 4 | 2 | null | 2011-12-20 17:19:54.637 UTC | 17 | 2015-02-17 11:03:25.06 UTC | null | null | null | null | 773,862 | null | 1 | 54 | ubuntu|cron|debian|crontab | 46,417 | <p>Use <code>crontab -l > file</code> to list current user's crontab to the <code>file</code>, and <code>crontab file</code>, to install new crontab.</p> |
17,911,918 | Bootstrap Modal popping up but has a "tinted" page and can't interact | <p>I am using bootstrap to set up a modal popup. When a button is clicked, the modal dialog opens, but the entire page is slightly "tinted", and I can't interact with the modal (the page essentially freezes). Do you know why this would be? Here is the code:</p>
<p>button:</p>
<pre><code><a class="add-list-butto... | 17,914,626 | 10 | 5 | null | 2013-07-28 19:19:07.42 UTC | 11 | 2021-09-07 19:32:10.57 UTC | 2013-07-29 00:55:33.793 UTC | null | 1,072,337 | null | 1,072,337 | null | 1 | 31 | twitter-bootstrap|modal-dialog | 43,951 | <p>Ok, so I figured out the issue. </p>
<p>If the modal container has a fixed position or is within an element with fixed position this behavior will occur.</p>
<p>Easiest way is to just move the modal div so it is outside any elements with special positioning. One good place might be just before the closing body ta... |
6,552,141 | How can a stack underflow happen in C++? | <p>What is a simple example in C++ that causes a stack underflow in the case of invoking and returning from method calls?</p>
<p>I am familiar with the calling convention, i.e <code>thiscall</code>, <code>stdcall</code> and the <code>cdecl</code> and way they would clean the stack. Wouldn't a stack underflow automatic... | 6,553,169 | 4 | 10 | null | 2011-07-01 18:56:12.413 UTC | 9 | 2019-03-26 16:59:21.73 UTC | 2019-03-26 16:59:21.73 UTC | null | 1,711,796 | null | 352,341 | null | 1 | 19 | c++|compiler-construction|stackunderflow | 18,576 | <p>The only way I can see this actually happening would be if you declared a function to use the <code>stdcall</code> (or any other calling convention that specifies the callee clean the stack) and then invoke the function through a function pointer that was specified as a <code>cdecl</code> (or any other calling conve... |
6,339,756 | Why UTF-32 exists whereas only 21 bits are necessary to encode every character? | <p>We know that codepoints can be in this interval 0..10FFFF which is less than 2^21. Then why do we need UTF-32 when all codepoints can be represented by 3 bytes? UTF-24 should be enough.</p> | 6,339,781 | 4 | 0 | null | 2011-06-14 06:15:06.733 UTC | 9 | 2021-12-27 09:56:20.853 UTC | null | null | null | null | 585,795 | null | 1 | 34 | unicode|encoding | 6,278 | <p>Computers are generally much better at dealing with data on 4 byte boundaries. The benefits in terms of reduced memory consumption are relatively small compared with the pain of working on 3-byte boundaries.</p>
<p>(I <em>speculate</em> there was also a reluctance to have a limit that was "only what we can curr... |
36,059,986 | how to $project ObjectId to string value in mongodb aggregate? | <p>Is there an operator I could use in <strong>aggregate</strong> function to get a string instead of ObjectId in response? </p>
<pre><code>db.something.aggregate([
{ "$match": { "property": { "$exists": true } } },
{ "$project": { "stringId": "$_id.???" } }
])
</code></pre> | 51,231,012 | 3 | 3 | null | 2016-03-17 12:00:48.003 UTC | 10 | 2019-12-19 07:07:20.973 UTC | 2019-12-19 07:07:20.973 UTC | null | 7,510,657 | null | 55,514 | null | 1 | 41 | mongodb|mongodb-query|aggregation-framework | 45,662 | <p>Mongodb <strong>4.0</strong> has introduced <a href="https://docs.mongodb.com/manual/reference/operator/aggregation/toString/" rel="noreferrer"><strong><code>$toString</code></strong></a> aggregation operator. So, Now you can easily convert ObjectId to string</p>
<pre><code>db.collection.aggregate([
{
$projec... |
16,033,521 | inline border styles in an HTML Email | <p>I'm working on a responsive HTML email and I'm having a rendering problem in Gmail ONLY in IE (just had to be!) It works fine in the other 27 client variants. we need to support</p>
<p>I've set up a fiddle here: <a href="http://jsfiddle.net/39gzj/" rel="nofollow">http://jsfiddle.net/39gzj/</a></p>
<p>Now if you lo... | 16,034,193 | 2 | 7 | null | 2013-04-16 09:35:29.993 UTC | null | 2015-07-07 17:58:29.523 UTC | 2013-04-16 10:17:37.983 UTC | null | 508,248 | null | 508,248 | null | 1 | 5 | html|css|html-email | 41,180 | <p>Your problem is that the border is on the table itself. You tend to find that the email clients don't like that. The way that I got around it was by placing tables within tables a bit like this:</p>
<pre><code><table width="600" cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="600" valign... |
5,198,304 | How to keep form values after post | <p>I am trying to find what the easiest way to keep form values after post. I am really trying to have to keep from learning ajax right this second for the one form, Plus I am not sure how hard it would be to implement ajax into my already existing google map page. So I am trying to find a way to retain the values of t... | 5,198,784 | 2 | 5 | null | 2011-03-04 19:24:29.433 UTC | 8 | 2020-01-02 04:48:23.217 UTC | 2015-09-09 07:57:16.78 UTC | null | 1,059,828 | null | 271,534 | null | 1 | 31 | php|javascript|html|ajax | 124,905 | <p>If you are looking to just repopulate the fields with the values that were posted in them, then just echo the post value back into the field, like so:</p>
<pre><code><input type="text" name="myField1" value="<?php echo isset($_POST['myField1']) ? $_POST['myField1'] : '' ?>" />
</code></pre> |
288,850 | How to return JSON from a 2.0 asmx web service | <p>I am using .Net framework 2.0 / jQuery to make an Ajax call to a 2.0 web service. No matter what I set the contentType to in the ajax call, the service always returns XML. I want it to return Json!</p>
<p>Here is the call:</p>
<pre><code> $(document).ready(function() {
$.ajax({
type: "POS... | 289,332 | 7 | 2 | null | 2008-11-14 00:12:09.347 UTC | 12 | 2014-04-04 08:12:16.34 UTC | 2014-01-17 15:07:10.567 UTC | null | 1,193,596 | camainc | 7,232 | null | 1 | 27 | jquery|.net|asp.net|ajax|web-services | 69,441 | <p>It's no problem to <a href="http://encosia.com/2010/03/08/asmx-scriptservice-mistakes-installation-and-configuration/" rel="noreferrer">return JSON from ASMX services in ASP.NET 2.0</a>. You just need the ASP.NET AJAX Extensions installed.</p>
<p>Do be sure to add the [ScriptService] decoration to your web service.... |
1,206,903 | How do I require an inline in the Django Admin? | <p>I have the following admin setup so that I can add/edit a user and their profile at the same time. </p>
<pre><code>class ProfileInline(admin.StackedInline):
"""
Allows profile to be added when creating user
"""
model = Profile
class UserProfileAdmin(admin.ModelAdmin):
"""
Options for the a... | 1,233,644 | 7 | 0 | null | 2009-07-30 14:21:19.99 UTC | 12 | 2022-03-19 14:23:09.6 UTC | 2022-03-19 10:47:28.683 UTC | null | 8,172,439 | null | 147,862 | null | 1 | 29 | python|python-3.x|django|django-admin|inline | 15,102 | <p>I took Carl's advice and made a much better implementation then the hack-ish one I mentioned in my comment to his answer. Here is my solution:</p>
<p>From my forms.py:</p>
<pre><code>from django.forms.models import BaseInlineFormSet
class RequiredInlineFormSet(BaseInlineFormSet):
"""
Generates an inline... |
829,007 | Find out what process registered a global hotkey? (Windows API) | <p>As far as I've been able to find out, Windows doesn't offer an API function to tell what application has registered a global hotkey (via RegisterHotkey). I can only find out that a hotkey is registered if RegisterHotkey returns false, but not who "owns" the hotkey.</p>
<p>In the absence of a direct API, could there... | 887,086 | 7 | 0 | null | 2009-05-06 10:32:49.253 UTC | 61 | 2022-09-21 06:43:19.277 UTC | 2022-02-09 20:20:12.24 UTC | null | 4,294,399 | null | 9,226 | null | 1 | 135 | delphi|winapi|hotkeys|registerhotkey | 37,546 | <p>Your question piqued my interest, so I've done a bit of digging and while, unfortunately I don't have a proper answer for you, I thought I'd share what I have.</p>
<p>I found this <a href="http://groups.google.com/group/borland.public.delphi.winapi/msg/ceb5818acd623a24" rel="noreferrer">example of creating keyboard... |
206,318 | Are there any HTTP/HTTPS interception tools other than Fiddler, Charles, Poster, and Achilles? | <p>I'm in the process of testing my application with respect to security. </p>
<p>Aside from <a href="http://www.fiddler2.com/fiddler2/" rel="noreferrer">Fiddler</a>, <a href="http://www.charlesproxy.com/" rel="noreferrer">Charles</a> and <a href="https://addons.mozilla.org/en-us/firefox/addon/poster/" rel="noreferrer... | 234,487 | 8 | 4 | null | 2008-10-15 20:31:05.687 UTC | 23 | 2015-12-17 11:35:15.55 UTC | 2012-07-23 08:46:00.56 UTC | oneBelizean | 587,642 | oneBelizean | 17,337 | null | 1 | 30 | security|http|testing|https | 51,713 | <p>Achilles does work on HTTPS traffic, but they note on their site that it is not the best tool any more.</p>
<p>Their suggestions are <a href="http://portswigger.net/burp/" rel="noreferrer">Burp Suite</a> and <a href="http://www.owasp.org/index.php/Category:OWASP_WebScarab_Project" rel="noreferrer">WebScarab</a> bot... |
724,862 | Converting from hex to string | <p>I need to check for a <code>string</code> located inside a packet that I receive as <code>byte</code> array. If I use <code>BitConverter.ToString()</code>, I get the bytes as <code>string</code> with dashes (f.e.: 00-50-25-40-A5-FF).<br>
I tried most functions I found after a quick googling, but most of them have in... | 724,905 | 8 | 2 | null | 2009-04-07 09:45:10.9 UTC | 13 | 2022-09-16 06:31:18.43 UTC | 2014-01-15 17:02:21.277 UTC | null | 1,864,167 | null | 81,800 | null | 1 | 43 | c#|string|hex|bitconverter | 186,196 | <p>Like so?</p>
<pre><code>static void Main()
{
byte[] data = FromHex("47-61-74-65-77-61-79-53-65-72-76-65-72");
string s = Encoding.ASCII.GetString(data); // GatewayServer
}
public static byte[] FromHex(string hex)
{
hex = hex.Replace("-", "");
byte[] raw = new byte[hex.Length / 2];
for (int i = 0... |
502,303 | How do I programmatically get the GUID of an application in C# with .NET? | <p>I need to access the assembly of my project in C#.</p>
<p>I can see the GUID in the 'Assembly Information' dialog in under project properties, and at the moment I have just copied it to a const in the code. The GUID will never change, so this is not that bad of a solution, but it would be nice to access it directly.... | 502,327 | 8 | 3 | null | 2009-02-02 05:49:28.067 UTC | 26 | 2022-08-10 23:34:10.043 UTC | 2022-08-10 23:31:42.807 UTC | moocha | 63,550 | Nathan | 6,062 | null | 1 | 117 | c#|.net | 122,421 | <p>Try the following code. The value you are looking for is stored on a <code>GuidAttribute</code> instance attached to the <code>Assembly</code></p>
<pre class="lang-cs prettyprint-override"><code>using System.Runtime.InteropServices;
static void Main(string[] args)
{
var assembly = typeof(Program).Assembly;
... |
350,419 | How do you reconcile common C++ naming conventions with those of the libraries | <p>Most C++ naming conventions dictate the use of <code>camelCaseIdentifiers</code>: names that start with an uppercase letter for classes (<code>Person</code>, <code>Booking</code>) and names that start with a lowercase letter for fields and variables (<code>getPrice()</code>, <code>isValid()</code>, <code>largestValu... | 350,448 | 10 | 0 | null | 2008-12-08 18:36:35.94 UTC | 11 | 2020-05-10 01:16:31.36 UTC | 2017-05-23 17:28:01.427 UTC | null | 396,583 | Diomidis Spinellis | 20,520 | null | 1 | 45 | c++|coding-style|naming-conventions | 10,770 | <p>One way it to adopt the C++ <code>naming_convention</code>, this is what most code examples in the literature do nowadays.</p>
<p>I slowly see these conventions move into production code but it's a battle against MFC naming conventions that still prevail in many places.</p>
<p>Other style differences that fight ag... |
10,499 | Oracle - What TNS Names file am I using? | <p>Sometimes I get Oracle connection problems because I can't figure out which tnsnames.ora file my database client is using.</p>
<p>What's the best way to figure this out? ++happy for various platform solutions. </p> | 29,807 | 11 | 0 | null | 2008-08-13 23:49:15.623 UTC | 21 | 2016-04-10 13:02:16.583 UTC | 2008-08-30 09:07:24.703 UTC | Mark Harrison | 116 | Mark Harrison | 116 | null | 1 | 59 | oracle|connection|tnsnames|tns | 230,693 | <p>Oracle provides a utility called <code>tnsping</code>:</p>
<pre><code>R:\>tnsping someconnection
TNS Ping Utility for 32-bit Windows: Version 9.0.1.3.1 - Production on 27-AUG-20
08 10:38:07
Copyright (c) 1997 Oracle Corporation. All rights reserved.
Used parameter files:
C:\Oracle92\network\ADMIN\sqlnet.ora
... |
238,284 | How to copy text programmatically in my Android app? | <p>I'm building an Android app and I want to copy the text value of an EditText widget. It's possible for the user to press <code>Menu+A</code> then <code>Menu+C</code> to copy the value, but how would I do this programmatically?</p> | 238,297 | 15 | 2 | null | 2008-10-26 17:13:32.487 UTC | 54 | 2022-07-19 09:39:09.393 UTC | 2018-07-31 10:09:33.84 UTC | Andy Lester | 7,874,047 | Zach | 9,128 | null | 1 | 256 | android|menu|clipboardmanager | 122,961 | <p>Use <a href="https://developer.android.com/reference/android/content/ClipboardManager#setPrimaryClip(android.content.ClipData)" rel="noreferrer"><code>ClipboardManager#setPrimaryClip</code></a> method:</p>
<pre><code>import android.content.ClipboardManager;
// ...
ClipboardManager clipboard = (ClipboardManager) g... |
147,528 | How do I force a DIV block to extend to the bottom of a page even if it has no content? | <p>In the markup shown below, I'm trying to get the content div to stretch all the way to the bottom of the page but it's only stretching if there's content to display. The reason I want to do this is so the vertical border still appears down the page even if there isn't any content to display.</p>
<p>Here is my <stron... | 579,123 | 18 | 1 | null | 2008-09-29 04:40:24.29 UTC | 51 | 2021-10-03 19:15:39.377 UTC | 2021-04-21 06:52:33.543 UTC | Marcel Tjandraatmadja | 11,044,542 | null | 17,211 | null | 1 | 214 | css|html|border | 420,265 | <p>Your problem is not that the div is not at 100% height, but that the container around it is not.This will help in the browser I suspect you are using:</p>
<pre><code>html,body { height:100%; }
</code></pre>
<p>You may need to adjust padding and margins as well, but this will get you 90% of the way there.If you ne... |
606,191 | Convert bytes to a string | <p>I captured the standard output of an external program into a <code>bytes</code> object:</p>
<pre class="lang-none prettyprint-override"><code>>>> from subprocess import *
>>> command_stdout = Popen(['ls', '-l'], stdout=PIPE).communicate()[0]
>>>
>>> command_stdout
b'total 0\n-rw-r... | 606,199 | 24 | 5 | null | 2009-03-03 12:23:01.583 UTC | 551 | 2022-09-19 17:00:33.33 UTC | 2022-09-19 17:00:33.33 UTC | J.F. Sebastian | 63,550 | Tomas Sedovic | 2,239 | null | 1 | 3,455 | python|string|python-3.x | 4,317,582 | <p><a href="https://docs.python.org/3/library/stdtypes.html#bytes.decode" rel="noreferrer">Decode the <code>bytes</code> object</a> to produce a string:</p>
<pre><code>>>> b"abcde".decode("utf-8")
'abcde'
</code></pre>
<p>The above example <em>assumes</em> that the <code>bytes</code> objec... |
6,854,996 | MySQL INSERT IF (custom if statements) | <p>First, here's the concise summary of the question:</p>
<p>Is it possible to run an <code>INSERT</code> statement conditionally?
Something akin to this:</p>
<pre><code>IF(expression) INSERT...
</code></pre>
<p>Now, I know I can do this with a stored procedure.
My question is: can I do this in my query?</p>
<hr>
... | 6,855,014 | 5 | 0 | null | 2011-07-28 06:44:35.79 UTC | 16 | 2020-05-14 18:41:08.35 UTC | 2011-08-18 04:15:05.16 UTC | null | 825,568 | null | 825,568 | null | 1 | 50 | mysql|concurrency|insert|if-statement|race-condition | 102,926 | <pre><code>INSERT INTO TABLE
SELECT value_for_column1, value_for_column2, ...
FROM wherever
WHERE your_special_condition
</code></pre>
<p>If no rows are returned from the select (because your special condition is false) no insert happens.</p>
<p>Using your schema from question (assuming your <code>id</code> column is... |
6,468,349 | How to remove Black background between start new activity during slide_left animation? | <p>When I call new activity by animation the background gets black.<br />
How can I remove remove the black background?</p>
<p>For the animation I'm using:</p>
<pre><code>getWindow().setBackgroundDrawableResource(R.drawable.mainbg_);
overridePendingTransition (R.anim.push_up_in,0);
</code></pre> | 6,468,734 | 6 | 0 | null | 2011-06-24 13:18:12.957 UTC | 10 | 2022-03-11 16:11:19.13 UTC | 2022-03-11 16:11:19.13 UTC | null | 10,749,567 | null | 644,182 | null | 1 | 37 | android|android-activity|android-animation|android-drawable|android-transitions | 27,554 | <p>set the theme of that activity as transluscent in manifest file</p>
<pre><code>android:theme="@android:style/Theme.Translucent"
</code></pre>
<p>so your code will be something like this</p>
<pre><code><activity android:name=".AdActivity"
android:theme="@android:style/Theme.Translucent" />
</code></p... |
6,992,793 | Is there any benefit in using PHP comments over HTML comments in HTML code? | <p>I heard someone say that there is, so I was wondering.</p>
<p>HTML comment:</p>
<pre><code><!-- Comment goes here. -->
</code></pre>
<p>PHP comment:</p>
<pre><code><?php // Comment goes here. ?>
</code></pre> | 6,992,816 | 6 | 2 | null | 2011-08-09 07:29:46.597 UTC | 0 | 2021-09-29 07:40:45.327 UTC | 2013-01-05 17:42:32.197 UTC | null | 200,145 | null | 200,145 | null | 1 | 44 | php|html|comments | 2,799 | <p>Unlike HTML comments, PHP comments don't show up in the final output. That is often desirable, as comments are usually internal notes that are none of anybody's business.</p> |
6,597,967 | .Net Coding Standards Using a prefix "Is" or "Has" on Method Names | <p>Is it advisable to prefix an "<em>Is</em>" or a "<em>Has</em>" when creating a method that returns a Boolean. My feeling is that this practice is more suited to defining property names. </p>
<p>Say, we have a method like the following has some logic:</p>
<pre><code>bool IsActivePage()
{
// Some logic to deter... | 6,598,131 | 7 | 3 | null | 2011-07-06 14:22:34.453 UTC | 8 | 2020-01-22 19:57:06.58 UTC | 2011-07-06 14:29:42.603 UTC | null | 96,780 | null | 477,097 | null | 1 | 28 | c#|.net|coding-style | 10,950 | <p>The <a href="http://msdn.microsoft.com/en-us/library/ms229012.aspx" rel="noreferrer">Framework Design Guidelines</a> state that you should "give methods names that are verbs or verb phrases" since "typically methods act on data". <em>Properties</em>, on the other hand, should be named "using a noun, noun phrase, or ... |
6,585,417 | Stored procedure slow when called from web, fast from Management Studio | <p>I have stored procedure that insanely times out every single time it's called from the web application.</p>
<p>I fired up the Sql Profiler and traced the calls that time out and finally found out these things: </p>
<ol>
<li>When executed the statements from within the MS SQL Management Studio, with same arguments ... | 6,586,281 | 8 | 7 | null | 2011-07-05 15:46:50.66 UTC | 43 | 2021-06-04 11:31:07.337 UTC | 2017-09-19 01:23:19.053 UTC | null | 3,885,376 | null | 363,674 | null | 1 | 109 | asp.net|sql-server-2008|stored-procedures | 78,176 | <p>I've had a similar issue arise in the past, so I'm eager to see a resolution to this question. Aaron Bertrand's comment on the OP led to <a href="https://stackoverflow.com/questions/2248112/sql-server-query-times-out-when-executed-from-web-but-super-fast-when-executed/">Query times out when executed from web, but su... |
6,904,825 | Deserialize JSON to anonymous object | <p>In C#, I have successfully serialized an anonymous object into JSON by use of code like this...</p>
<pre><code>var obj = new { Amount = 108, Message = "Hello" };
JavaScriptSerializer serializer = new JavaScriptSerializer();
String output = serializer.Serialize(obj);
</code></pre>
<p>However, what I would l... | 6,905,037 | 9 | 1 | null | 2011-08-01 21:43:03.727 UTC | 13 | 2022-03-11 14:14:04.037 UTC | 2022-02-24 08:03:46.29 UTC | null | 326,820 | null | 410,167 | null | 1 | 64 | c#|asp.net|json | 93,725 | <p><a href="http://james.newtonking.com/pages/json-net.aspx" rel="noreferrer"><strong>JSON.Net</strong></a> is a powerful library to work with JSON in .Net</p>
<p>There's a method <a href="http://www.newtonsoft.com/json/help/html/DeserializeAnonymousType.htm" rel="noreferrer">DeserializeAnonymousType</a> you can tap i... |
15,776,365 | HTML Best Practices: Should I use ’ or the special keyboard shortcut? | <p>I know that <code>&rsquo;</code> will produce an apostrophe in an HTML document.</p>
<p>I also know that <code>option shift right bracket</code> on a Mac will simply produce a <code>’</code> character.</p>
<p>Are there best practices for writing code, e.g., should I write</p>
<pre><code><b>The User&... | 15,776,551 | 6 | 5 | null | 2013-04-02 23:38:21.91 UTC | 13 | 2020-11-04 07:42:33.563 UTC | null | null | null | null | 2,238,214 | null | 1 | 54 | html|apostrophe|smart-quotes | 159,916 | <p>I don't think that one is better than the other in general; it depends on how you intend to use it.</p>
<ul>
<li>If you want to store it in a DB column that has a charset/collation that does not support the right single quote character, you may run into storing it as the multi-byte character instead of 7-bit ASCII ... |
15,673,889 | Correct usage of rvalue references as parameters | <p>Let's take the following method as an example:</p>
<pre><code>void Asset::Load( const std::string& path )
{
// complicated method....
}
</code></pre>
<p>General use of this method would be as follows:</p>
<pre><code>Asset exampleAsset;
exampleAsset.Load("image0.png");
</code></pre>
<p>Since we know most ... | 15,674,543 | 6 | 0 | null | 2013-03-28 03:43:08.53 UTC | 27 | 2021-10-20 07:31:27.74 UTC | 2020-05-02 20:51:04.95 UTC | null | 72,178 | null | 965,619 | null | 1 | 69 | c++|c++11|rvalue-reference | 49,816 | <p>For your particular case, the second overload is useless.</p>
<p>With the original code, which has just one overload for <code>Load</code>, this function is called for lvalues and rvalues.</p>
<p>With the new code, the first overload is called for lvalues and the second is called for rvalues. However, the second o... |
15,859,113 | $.focus() not working | <p>The <a href="http://api.jquery.com/focus/" rel="noreferrer">last example of jQuery's <code>focus()</code> documentation</a> states</p>
<pre><code>$('#id').focus()
</code></pre>
<p>should make the input focused (active). I can't seem to get this working.</p>
<p>Even in the console on this site, I'm trying it for t... | 15,859,155 | 20 | 6 | null | 2013-04-07 05:12:39.457 UTC | 27 | 2022-08-16 15:56:23.78 UTC | null | null | null | null | 1,406,664 | null | 1 | 194 | jquery | 234,434 | <p>Actually the example you gave for focusing on this site works just fine, as long as you're not focused in the console. The reason that's not working is simply because it's not stealing focus from the dev console. If you run the following code in your console and then quickly click in your browser window after, you w... |
50,549,611 | Slicing a vector in C++ | <p>Is there an equivalent of list slicing <code>[1:]</code> from Python in C++ with vectors? I simply want to get all but the first element from a vector.</p>
<p>Python's list slicing operator:</p>
<pre><code>list1 = [1, 2, 3]
list2 = list1[1:]
print(list2) # [2, 3]
</code></pre>
<p>C++ Desired result:</p>
<pre>... | 50,549,636 | 6 | 6 | null | 2018-05-27 06:30:07.253 UTC | 12 | 2022-03-30 09:31:14.193 UTC | 2021-07-16 03:09:18.29 UTC | null | 5,376,789 | null | 9,620,849 | null | 1 | 70 | python|c++|vector|slice | 67,347 | <p>This can easily be done using <code>std::vector</code>'s copy constructor:</p>
<pre><code>v2 = std::vector<int>(v1.begin() + 1, v1.end());
</code></pre> |
10,275,769 | BigInteger.toString method is deleting leading 0 | <p>I am trying to generate MD5 sum using MessageDigest.
And i am having following code. </p>
<pre><code>byte[] md5sum = digest.digest();
BigInteger bigInt = new BigInteger(1, md5sum);
output = bigInt.toString(16);
</code></pre>
<p>This returns not 32 character string but a 31 character string <code>8611c0b0832bce5a19... | 10,275,845 | 5 | 5 | null | 2012-04-23 06:24:47.857 UTC | 6 | 2021-10-21 09:58:35.033 UTC | 2012-04-23 06:39:43.193 UTC | null | 818,557 | null | 446,976 | null | 1 | 31 | java|tostring|biginteger | 18,041 | <p>I would personally <em>avoid</em> using <code>BigInteger</code> to convert binary data to text. That's not really what it's there for, even if it <em>can</em> be used for that. There's loads of code available to convert a <code>byte[]</code> to its hex representation - e.g. using <a href="http://commons.apache.org/c... |
31,876,372 | What is reification? | <p>I know that Java implements parametric polymorphism (Generics) with erasure. I understand what erasure is.</p>
<p>I know that C# implements parametric polymorphism with reification. I know that can make you write</p>
<pre><code>public void dosomething(List<String> input) {}
public void dosomething(List<In... | 31,876,747 | 4 | 4 | null | 2015-08-07 11:13:14.837 UTC | 63 | 2022-09-23 20:18:12.143 UTC | 2015-08-21 18:18:49.13 UTC | null | 1,783,619 | null | 381,801 | null | 1 | 175 | c#|generics|reification | 16,034 | <p>Reification is the process of taking an abstract thing and creating a concrete thing.</p>
<p>The term <em>reification</em> in C# generics refers to the process by which a <a href="https://stackoverflow.com/questions/2564745/what-is-the-difference-between-a-generic-type-and-a-generic-type-definition"><em>generic typ... |
53,103,148 | Services and ViewModels in Android MVVM - How do they interact? | <p>I've been using ViewModels from Android Architecture for some time now, and abide by never exposing the ViewModel to Context/Views (Android Framework/UI). However, recently I have run into an interesting problem.</p>
<p>When making a timer app, when a timer is started, a Service is run in the background running the... | 53,174,404 | 2 | 3 | null | 2018-11-01 14:19:01.627 UTC | 9 | 2020-07-05 03:34:56.847 UTC | 2018-11-01 14:30:06.157 UTC | null | 1,327,957 | null | 1,327,957 | null | 1 | 34 | android|mvvm|android-service|android-architecture-components | 14,193 | <p>After some toying with different structures, the Service has found it's place in MVVM. What was throwing me off in this situation was thinking a Service shouldn't be started from a ViewModel and the fact that two repositories were necessary: Room Database to store Timers and a Service to represent the state of ongoi... |
13,326,806 | Enable USB debugging through Clockworkmod with adb | <p>So, a few days ago my Nexus 7 got dropped, and now there's a big crack in the screen. The touchscreen is broken. That is, I can still see what happens, but it is unresponsive. <br>
I have found a way to completely control it through adb, and through this I rooted it. <br>
However, rooting it wiped all my data and se... | 13,332,721 | 2 | 3 | null | 2012-11-10 22:47:08.203 UTC | 11 | 2012-11-11 15:46:52.51 UTC | 2012-11-11 02:41:14.353 UTC | null | 1,488,308 | null | 1,488,308 | null | 1 | 19 | android|adb|root|touchscreen|nexus-7 | 97,503 | <p>Well, as far as I know, You can try doing this:</p>
<ul>
<li>Run an ADB shell in ClockworkMod</li>
<li>Remount /system in readwrite mode.</li>
<li>Add this to /system/build.prop: <b>persist.service.adb.enable=1</b></li>
<li>Save the file.</li>
</ul> |
13,469,803 | PHP - Merging two arrays into one array (also Remove Duplicates) | <p>Hi I'm Trying to merge two arrays and also want to remove duplicate values from final Array.</p>
<p>Here is my Array 1:</p>
<pre><code>Array
(
[0] => stdClass Object
(
[ID] => 749
[post_author] => 1
[post_date] => 2012-11-20 06:26:07
[post_date_gmt] => 2012-11-20 06:26:07... | 13,469,882 | 8 | 4 | null | 2012-11-20 09:10:01.66 UTC | 23 | 2021-03-01 09:12:23.867 UTC | 2017-12-28 12:09:11.837 UTC | null | 6,868,227 | null | 1,550,566 | null | 1 | 125 | php|arrays|wordpress|multidimensional-array | 133,637 | <pre><code>array_unique(array_merge($array1,$array2), SORT_REGULAR);
</code></pre>
<p><a href="http://se2.php.net/manual/en/function.array-unique.php">http://se2.php.net/manual/en/function.array-unique.php</a></p> |
20,374,083 | Deserialize json array stream one item at a time | <p>I serialize an array of large objects to a json http response stream. Now I want to deserialize these objects from the stream one at a time. Are there any c# libraries that will let me do this? I've looked at json.net but it seems I'd have to deserialize the complete array of objects at once.</p>
<pre><code>[{large... | 20,386,292 | 4 | 3 | null | 2013-12-04 11:26:01.337 UTC | 15 | 2019-02-15 23:33:32.893 UTC | 2013-12-04 12:25:41.25 UTC | null | 475,807 | null | 475,807 | null | 1 | 39 | c#|json|serialization|stream|json.net | 27,576 | <p>In order to read the JSON incrementally, you'll need to use a <code>JsonTextReader</code> in combination with a <code>StreamReader</code>. But, you don't necessarily have to read all the JSON manually from the reader. You should be able to leverage the Linq-To-JSON API to load each large object from the reader so ... |
24,379,601 | How to make an HTTP request + basic auth in Swift | <p>I have a RESTFull service with basic authentication and I want to invoke it from iOS+swift. How and where I must provide Credential for this request?</p>
<p>My code (sorry, I just start learn iOS/obj-c/swift):</p>
<pre><code>class APIProxy: NSObject {
var data: NSMutableData = NSMutableData()
func conne... | 24,380,884 | 9 | 2 | null | 2014-06-24 06:20:14.433 UTC | 41 | 2022-03-18 06:10:40.84 UTC | 2021-07-28 13:24:08.903 UTC | null | 921,573 | null | 2,618,519 | null | 1 | 115 | ios|swift | 125,667 | <p>You provide credentials in a <code>URLRequest</code> instance, like this in Swift 3:</p>
<pre><code>let username = "user"
let password = "pass"
let loginString = String(format: "%@:%@", username, password)
let loginData = loginString.data(using: String.Encoding.utf8)!
let base64LoginString = loginData.base64Encoded... |
16,349,884 | Updating package with Bower | <p>I am trying to update angular 1.0.5 to 1.0.6. I use Yeoman, and when try to update it is installing 1.0.5. I cleared the cache (removed everything from ~/.bower), still get the below log. I checked the <a href="https://github.com/angular/bower-angular/blob/master/angular.js" rel="noreferrer">repo</a>, and it has 1.0... | 16,356,149 | 2 | 2 | null | 2013-05-03 00:38:45.263 UTC | 1 | 2016-02-26 05:04:04.09 UTC | 2015-02-25 00:09:49.383 UTC | null | 31,671 | null | 303,477 | null | 1 | 44 | javascript|angularjs|bower | 51,713 | <p>You have to upgrade to latest version of Bower: <code>npm update -g bower</code></p>
<p>bower-angular 1.0.6 switched from component.json to bower.json which is only supported in Bower >=0.9.0</p> |
11,398,397 | Oracle - How to use merge to update a column based on the values from other table and columns | <p>I would like to update the values in closed_date column based on the values comparison from other columns and other table. I used Oracle merge into statement. But it gave me an error:</p>
<p>Error: ORA-00969: missing ON keyword</p>
<p>I am not sure what goes wrong. Do I miss anything? Below is my script:</p>
<pre... | 11,400,052 | 1 | 3 | null | 2012-07-09 15:36:21.403 UTC | null | 2012-07-17 10:00:02.837 UTC | 2012-07-17 10:00:02.837 UTC | null | 966,703 | null | 1,279,486 | null | 1 | 4 | sql|oracle | 38,344 | <p>You have two errors, as you can see with a simple example. Firstly the <code>on</code> clause needs to be wrapped in parenthesis. Secondly, you can't reference the alias of the sub-select in the <code>using</code> clause within that sub-query.</p>
<p>If I set up a simple example using your table names as follows:</... |
15,469,284 | JPA, custom query and dates | <p>I'm facing a strange issue. I've search including here in stack overflow and for JPA and Custom query I should specified the parameter. So I have a query string since I have over 14 fields but I'm facing issues with the dates. I'm always getting the IllegalStateException</p>
<pre><code>INFO: query STRING = SELECT t... | 15,469,590 | 4 | 1 | null | 2013-03-18 03:23:14.697 UTC | 1 | 2013-03-19 01:17:27.023 UTC | 2013-03-19 01:17:27.023 UTC | null | 765,147 | null | 765,147 | null | 1 | 3 | java|datetime|jpa | 78,640 | <p>javadoc for both</p>
<pre><code>setParameter(String name, java.util.Date value, TemporalType temporalType)`
setParameter(String name, java.util.Calendar value, TemporalType temporalType)`
</code></pre>
<p>states:</p>
<blockquote>
<p>Throws: <code>IllegalArgumentException</code> - if the parameter name does not ... |
17,213,293 | How to get R plot window size? | <p>How can I get the size of the plot window in R? I've been using xwininfo, but there must be a function or variable in R to extract the current plot height and width.</p>
<p><em>UPDATE</em></p>
<p>This works as a <code>savePlot()</code> replacement if you don't have Cairo support and you want to export plots to Win... | 17,213,579 | 3 | 0 | null | 2013-06-20 12:08:14.067 UTC | 10 | 2014-06-11 06:41:56.863 UTC | 2014-06-11 06:41:56.863 UTC | null | 489,704 | null | 382,271 | null | 1 | 16 | r|plot | 17,650 | <p>You can use <code>dev.size</code>. Here is an example:</p>
<pre><code> x11()
plot(1)
dev.size("in")
[1] 6.989583 6.992017
dev.size("cm")
[1] 17.75354 17.75972
</code></pre>
<p>This gets the size of your plotting window in inches and centimeters. </p>
<p>Similar for a <code>png</code> device:</p>
<pre><co... |
22,015,179 | Fatal error: Call to undefined function sqlsrv_connect() | <p>I have come across quite a few post regarding the same subject question, however I am still unable to resolve it and so I ask. I am trying to connect to sql in my php script. My connection string is:</p>
<pre><code>/* Specify the server and connection string attributes. */
$serverName = "xxx-PC\SQLExpress";
$connec... | 22,043,692 | 8 | 2 | null | 2014-02-25 13:06:53.597 UTC | 4 | 2022-07-28 18:52:46.077 UTC | 2014-02-27 05:57:03.83 UTC | null | 1,478,133 | null | 1,478,133 | null | 1 | 36 | php|sql-server|wamp | 227,643 | <p><a href="https://stackoverflow.com/questions/14849010/fatal-error-call-to-undefined-function-pg-connect?rq=1">This</a> helped me get to my answer. There are two <code>php.ini</code> files located, in my case, for wamp. One is under the php folder and the other one is in the <code>C:\wamp\bin\apache\Apachex.x.x\bin</... |
21,987,596 | Get CSS transform property with jQuery | <p>I'm trying to get the <code>-webkit-transform: translateY('')</code> property in a variable.</p>
<p>HTML</p>
<pre><code><form class="form-con" style="-webkit-transform: translateY(-802px);"></form>
</code></pre>
<p>JS</p>
<pre><code>$('.foo').click(function() {
var current_pull = parseInt($('.for... | 21,987,646 | 4 | 3 | null | 2014-02-24 12:20:09.053 UTC | 7 | 2017-03-06 08:49:33.68 UTC | null | null | null | null | 560,291 | null | 1 | 23 | javascript|jquery | 64,063 | <pre><code>$('.foo').click(function() {
var current_pull = parseInt($('.form-con').css('transform').split(',')[5]);
});
</code></pre> |
21,856,097 | How can I check JavaScript code for syntax errors ONLY from the command line? | <p>JavaScript programs can be checked for errors in IDEs or using <a href="https://stackoverflow.com/questions/5279226/how-to-check-client-side-javascript-code-for-errors">online web apps</a> but I'm looking for a way to detect syntax errors <em>alone</em>.</p>
<p>I've tried JSLint and JSHint and looked at their optio... | 22,824,099 | 6 | 8 | null | 2014-02-18 14:00:40.293 UTC | 8 | 2021-10-05 13:23:31.847 UTC | 2017-05-23 12:17:38.603 UTC | null | -1 | null | 1,269,037 | null | 1 | 47 | javascript|syntax-error|jslint|jshint | 34,784 | <p>The solution is to enable jshint's <code>--verbose</code> option, which shows the error or warning code (e.g. <code>E020</code> for <code>Expected '}' to match '{'</code> or <code>W110</code> for <code>Mixed double and single quotes</code>), then grep for errors only:</p>
<pre><code>jshint --verbose test.js | grep ... |
26,824,225 | Loop through folder, renaming files that meet specific criteria using VBA? | <p>I am new to VBA (and have only a bit of training in java), but assembled this bit of code with the help of other posts here and have hit a wall.</p>
<p>I am trying to write code that will cycle through each file in a folder, testing if each file meets certain criteria. If criteria are met, the file names should be... | 26,924,038 | 3 | 2 | null | 2014-11-09 02:09:07.41 UTC | 2 | 2018-06-08 22:46:12.257 UTC | null | null | null | null | 4,231,532 | null | 1 | 5 | vba|excel|excel-2013 | 39,746 | <p>I think it's a good idea to first collect all of the filenames in an array or collection before starting to process them, particularly if you're going to be renaming them. If you don't there's no guarantee you won't confuse Dir(), leading it to skip files or process the "same" file twice. Also in VBA there's no need... |
26,745,462 | How do I use basic HTTP authentication with the python Requests library? | <p>I'm trying to use basic HTTP authentication in python. I am using the <a href="https://docs.python-requests.org/" rel="noreferrer">Requests library</a>:</p>
<pre><code>auth = requests.post('http://' + hostname, auth=HTTPBasicAuth(user, password))
request = requests.get('http://' + hostname + '/rest/applications')
</... | 26,746,603 | 6 | 3 | null | 2014-11-04 21:34:36.773 UTC | 19 | 2022-09-01 11:08:03.993 UTC | 2021-06-22 11:15:20.37 UTC | null | 362,951 | null | 2,991,712 | null | 1 | 104 | python|api|python-requests|appdynamics | 193,686 | <p>You need to use a <a href="https://requests.readthedocs.io/en/latest/user/advanced/#session-objects" rel="noreferrer">session object</a> and send the authentication <em>each request</em>. The session will also track cookies for you:</p>
<pre><code>session = requests.Session()
session.auth = (user, password)
auth =... |
39,659,127 | Restrict variadic template arguments | <p>Can we restrict variadic template arguments to a certain type? I.e., achieve something like this (not real C++ of course):</p>
<pre><code>struct X {};
auto foo(X... args)
</code></pre>
<p>Here my intention is to have a function which accepts a variable number of <code>X</code> parameters.</p>
<p>The closest we h... | 39,659,128 | 6 | 7 | null | 2016-09-23 11:00:11.38 UTC | 22 | 2022-08-07 07:42:49.437 UTC | 2016-09-23 11:17:02.45 UTC | null | 1,774,667 | null | 2,805,305 | null | 1 | 52 | c++|templates|variadic-templates|c++17|c++-faq | 7,147 | <p>Yes it is possible. First of all you need to decide if you want to accept only the type, or if you want to accept a implicitly convertible type. I use <code>std::is_convertible</code> in the examples because it better mimics the behavior of non-templated parameters, e.g. a <code>long long</code> parameter will accep... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.