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
16,465,454
How do I scroll to the right on a page that overflows horizontally?
<p>I want to scroll to the far right edge of a page that is really wide (it's wide on purpose) when the user closes a modal (specifically, the Reveal modal in Foundation 4).</p> <p>I've tried setting an id on a div that's aligned all the way right, but that obviously doesn't work.</p>
16,465,556
3
1
null
2013-05-09 15:28:43.23 UTC
2
2013-08-12 22:45:35.59 UTC
null
null
null
null
1,475,082
null
1
17
javascript|jquery
44,806
<p>To scroll horizontally, you use <a href="http://api.jquery.com/scrollLeft/" rel="noreferrer">scrollLeft()</a>.</p> <pre><code>$('body, html').scrollLeft(400); </code></pre> <p>jQuery also supports animating the <code>scrollLeft</code> property.</p> <p>To scroll all the way to the right, you get the full width of ...
16,110,528
Tomcat multiple instances simultaneously
<p>I am trying to run multiple instances of Tomcat, but even after configuring different ports for listening and shutting down the second instance, it keeps trying to listen on 8080 (configured for 8081). I read that I have to set a different value for <code>CATALINA_BASE</code>. From all the articles there are online,...
16,110,675
5
4
null
2013-04-19 17:43:06.74 UTC
24
2018-04-10 12:25:47.91 UTC
2013-12-12 16:16:21.013 UTC
null
1,098,211
null
2,014,549
null
1
29
windows|tomcat|multiple-instances|catalina
52,262
<p>The easiest way I have run two copies of Tomcat involved the following steps (I was trying to run two distinct versions of tomcat, 6 and 7):</p> <ul> <li><p>Establish 2 copies of tomcat in different folders (if they are different versions then this is easy, if they are the same version then you will need be disting...
16,267,903
Changing minDate and maxDate on the fly using jQuery DatePicker
<p>I'm having a particular issue with the jQuery Datepicker. I can easily add a date range, but I want the selectable range to change depending on the event the user has picked.</p> <p>So if they pick event #1, they can only pick dates from event #1's date range.</p> <p>I've written a simple little function that gets...
16,267,968
5
2
null
2013-04-28 21:08:11.76 UTC
7
2019-02-20 06:27:27.673 UTC
2018-11-05 10:21:29.653 UTC
null
608,639
null
199,700
null
1
31
jquery|jquery-ui|datepicker
114,378
<p>You have a couple of options...</p> <p>1) You need to call the <code>destroy()</code> method not <code>remove()</code> so...</p> <pre><code>$('#date').datepicker('destroy'); </code></pre> <p>Then call your method to recreate the <code>datepicker</code> object.</p> <p>2) You can update the property of the existin...
16,059,771
Reverse Apply a commit to working copy
<p>In order to investigate the effect introduced by a previous commit, I want to reverse- apply it to my working copy and fiddle around with the code. </p> <p>I managed with a workflow around creating and applying a patch, but wonder if this can be done easier.</p> <pre><code>git checkout -b "tmp-fiddle" git diff -R ...
16,059,902
3
2
null
2013-04-17 12:16:52.557 UTC
8
2021-10-30 19:26:07.99 UTC
null
null
null
null
73,673
null
1
46
git|revert
12,914
<p>How about <a href="https://www.kernel.org/pub/software/scm/git/docs/git-revert.html" rel="noreferrer"><code>git revert -n</code></a>?</p> <blockquote> <pre><code>-n --no-commit </code></pre> <p>Usually the command automatically creates some commits with commit log messages stating which commits were reverted. ...
15,169,418
how can I get sessions to work using redis, express & socket.io?
<p>So I am trying to get Sessions to work inside my socket.on('connection', ...) I am trying to get this working using recent versions: Socket.io - 0.9.13, Express - 3.1.0 and latest versions of other modules.</p> <p>Anyway I have tried using both modules '<a href="https://npmjs.org/package/connect-redis" rel="norefer...
15,169,642
2
0
null
2013-03-02 00:58:32.333 UTC
9
2013-11-16 03:46:20.28 UTC
2013-03-02 01:29:45.223 UTC
null
685,404
null
685,404
null
1
9
session|express|redis|socket.io|node-redis
4,965
<p>inside the <code>io.configure</code>, you have to link the socket with the http session.</p> <p>Here's a piece of code that extracts the cookie (This is using socket.io with <code>xhr-polling</code>, I don't know if this would work for websocket, although I suspect it would work).</p> <pre><code>var cookie = requi...
24,475,917
Swift - Create data model from JSON response
<p>I'm learning Swift lang and one of the things that would be great to hear others input about is "How you handle models from JSON responses"? For example -</p> <p>I have <code>User.swift</code> model:</p> <pre><code>class User: NSObject { var user_token:String? var email:String? } </code></pre> <p>and also I w...
31,843,191
6
5
null
2014-06-29 12:05:54.757 UTC
8
2019-09-13 20:08:09.057 UTC
2014-06-29 12:28:17.687 UTC
null
727,208
null
2,117,550
null
1
12
json|swift|key-value
19,876
<p>I recommend using code generation to generate models in Swift based on JSON. To that end, I've created a tool at <a href="http://www.guideluxe.com/JsonToSwift">http://www.guideluxe.com/JsonToSwift</a> to make modeling and parsing JSON as easy as possible.</p> <p>After you've submited a sample JSON object with a cla...
37,276,637
RDP session is slow
<p>So I am connecting to my work computer from home and the Remote Desktop Connection app is annoyingly slow.</p> <p>I pinged my work pc from my computer and it returned at a reasonable time of 50ms~ with 0 loss. I then attempted to ping my home IP from the RDP session and it timed out every time. Not sure if this mig...
45,227,464
4
3
null
2016-05-17 12:45:33.973 UTC
12
2021-03-09 22:01:50.873 UTC
null
null
null
null
2,495,847
null
1
26
rdp|remote-connection|remote-client
113,765
<p>Did three things and now RDP is running screaming fast:</p> <ol> <li>Change RDP settings:</li> </ol> <p><a href="https://i.stack.imgur.com/P0WJ1.png" rel="noreferrer"><img src="https://i.stack.imgur.com/P0WJ1.png" alt="enter image description here"></a></p> <ol start="2"> <li><p>Run the RDP session and connect to...
26,988,071
Allow multiple CORS domain in express js
<p>How do I allow multiple domains for CORS in express in a simplified way.</p> <p>I have</p> <pre><code> cors: { origin: "www.one.com"; } app.all('*', function(req, res, next) { res.header("Access-Control-Allow-Origin", cors.origin); res.header("Access-Control-Allow-Headers",...
26,988,252
6
7
null
2014-11-18 06:34:31.79 UTC
6
2022-04-17 07:52:31.613 UTC
null
null
null
null
2,098,614
null
1
33
javascript|node.js|express|cors
61,813
<p>I would recommend the cors-module: <a href="https://www.npmjs.org/package/cors" rel="noreferrer">https://www.npmjs.org/package/cors</a> It does this kind of stuff for you - check the "<a href="https://www.npmjs.com/package/cors#configuring-cors-w-dynamic-origin" rel="noreferrer">Configuring CORS w/ Dynamic Origin</a...
17,208,254
How to Change Pixel Color of an Image in C#.NET
<p>I am working with Images in Java, I have designed more over 100+ images(.png) format, They were all Trasparent and Black Color Drawing.</p> <p>The problem is, Now I have been asked to change the color of the Drawing (Black -to ).</p> <p>I have searched many code snipped at google,that changes the Bitmap (pixels) o...
17,209,284
4
0
null
2013-06-20 07:58:44.403 UTC
8
2015-12-30 08:34:06.183 UTC
2013-06-20 09:34:54.063 UTC
null
1,079,945
null
1,079,945
null
1
21
c#|.net|drawing|pixels|bitmapimage
64,264
<p>Here is the Solution I have done with Pixels.</p> <p>Attaching the source code so one can try the exact and get the result.</p> <p>I have sample images of 128x128 (Width x Height).</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Drawing; using Syst...
17,507,525
Putting three.js animation inside of div
<p>This is three.js animation code example:</p> <pre><code>&lt;script defer="defer"&gt; var angularSpeed = 0.2; var lastTime = 0; function animate(){ var time = (new Date()).getTime(); var timeDiff = time - lastTime; var angleChange = angularSpeed * timeDiff * 2 * Math.PI / 1000; plane.rotation....
17,507,839
3
0
null
2013-07-06 22:01:54.18 UTC
8
2022-08-28 17:54:18.257 UTC
2013-07-06 22:08:25.763 UTC
null
1,226,513
null
1,226,513
null
1
24
html5-canvas|three.js
39,121
<p>You can use a pattern like the following:</p> <pre><code>&lt;div id=&quot;canvas&quot;&gt; #canvas { background-color: #000; width: 200px; height: 200px; border: 1px solid black; margin: 100px; padding: 0px; position: static; /* fixed or static */ top: 100px; left: 100px; } cont...
17,435,861
Kendo UI Datepicker disable typing
<p>I want users to be able to change a Kendo UI Datepicker value only through its button and selecting the date from the pop-up. How can I prevent users from typing in the Datepicker textbox? Can I disable the textbox without disabling the whole control?</p>
18,835,696
11
0
null
2013-07-02 21:05:42.16 UTC
6
2021-10-08 06:08:15.437 UTC
2013-07-03 07:07:40.187 UTC
null
2,759,625
null
966,572
null
1
37
javascript|html|kendo-ui
42,725
<p>On your input element add this attribute and value... </p> <pre><code>onkeydown="return false;" </code></pre> <p>This will disable typed input and still allow using the calendar control input. </p>
18,626,544
Devise "Confirmation token is invalid" when user signs up
<p>Using Rails 4 and Devise 3.1.0 on my web app. I wrote a Cucumber test to test user sign up; it fails when the "confirm my account" link is clicked from the e-mail.</p> <pre><code>Scenario: User signs up with valid data # features/users/sign_up.feature:9 ...
18,675,155
3
5
null
2013-09-05 01:55:07.607 UTC
6
2018-03-01 18:21:57.633 UTC
2017-05-23 11:44:11.96 UTC
null
-1
null
2,217,557
null
1
44
ruby-on-rails|devise|devise-confirmable
16,727
<p>So upgrading to Devise 3.1.0 left some 'cruft' in a view that I hadn't touched in a while.</p> <p>According to <a href="http://blog.plataformatec.com.br/2013/08/devise-3-1-now-with-more-secure-defaults/" rel="noreferrer">this blog post</a>, you need to change your Devise mailer to use <code>@token</code> instead of...
18,486,660
What are the differences between Model, ModelMap, and ModelAndView?
<p>What are the main differences between the following <a href="http://projects.spring.io/spring-framework/" rel="noreferrer">Spring Framework</a> classes?</p> <ul> <li><code>Model</code></li> <li><code>ModelMap</code></li> <li><code>ModelAndView</code></li> </ul> <p>Using <code>Model.put(String,Object)</code> we can...
18,487,335
3
0
null
2013-08-28 11:31:17.313 UTC
25
2018-01-06 01:50:05.603 UTC
2015-01-21 21:22:05.963 UTC
null
606,910
null
2,046,194
null
1
80
spring|spring-mvc
66,980
<p><code>Model</code> is an interface while <code>ModelMap</code> is a class.</p> <p><code>ModelAndView</code> is just a container for both a <code>ModelMap</code> and a view object. It allows a controller to return both as a single value.</p>
5,331,293
What's the benefit of seeding a random number generator with only prime numbers?
<p>While conducting some experiments in Java, my project supervisor reminded me to seed each iteration of the experiment with a different number. He also mentioned that I should use prime numbers for the seed values. This got me thinking &#8212; why primes? Why not any other number as the seed? Also, why must the prime...
5,331,910
3
8
null
2011-03-16 20:23:02.853 UTC
2
2011-03-17 10:19:55.007 UTC
2011-03-17 10:19:55.007 UTC
null
495,545
null
495,545
null
1
31
java|algorithm|random|seed
5,088
<p>Well one blink at the implementation would show you that he CAN'T have any reason for that claim at all. Why? Because that's how the set seed function looks like:</p> <pre><code>synchronized public void setSeed(long seed) { seed = (seed ^ multiplier) &amp; mask; this.seed.set(seed); haveNextNextGaussian...
18,387,814
Drawing on Canvas - PorterDuff.Mode.CLEAR draws black! Why?
<p>I'm trying to create a custom View which works simple: there is a Bitmap which is revealed by arc path - from 0deg to 360deg. Degrees are changing with some FPS.</p> <p>So I made a custom View with overridden <code>onDraw()</code> method:</p> <pre><code>@Override protected void onDraw(Canvas canvas) { canvas....
44,607,874
7
2
null
2013-08-22 18:08:52.56 UTC
6
2021-09-10 22:39:24.277 UTC
2013-08-23 16:48:16.757 UTC
null
997,381
null
997,381
null
1
34
android|canvas|drawing|porter-duff
24,612
<p><code>PorterDuff.Mode.CLEAR</code> doesn't work with hardware acceleration. Just set </p> <pre><code>view.setLayerType(View.LAYER_TYPE_SOFTWARE, null); </code></pre> <p>Works perfectly for me.</p>
18,410,035
Ways to iterate over a list in Java
<p>Being somewhat new to the Java language I'm trying to familiarize myself with all the ways (or at least the non-pathological ones) that one might iterate through a list (or perhaps other collections) and the advantages or disadvantages of each. </p> <p>Given a <code>List&lt;E&gt; list</code> object, I know of the f...
18,410,489
13
11
null
2013-08-23 19:00:14.92 UTC
230
2022-01-13 17:20:49.253 UTC
2018-02-23 17:22:48.827 UTC
null
63,550
null
1,171,509
null
1
674
java|loops|collections|iteration
1,144,876
<p>The three forms of looping are nearly identical. The enhanced <code>for</code> loop:</p> <pre><code>for (E element : list) { . . . } </code></pre> <p>is, according to the <a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-14.html#jls-14.14.2" rel="noreferrer">Java Language Specification</a>, <em>ide...
20,036,984
How do I restore a missing IIS Express SSL Certificate?
<p>After setting up HTTPS in IIS Express, according to such articles as <a href="http://robrich.org/archive/2012/06/04/moving-to-iis-express-and-https.aspx" rel="noreferrer">this</a> and <a href="http://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx" rel="noreferrer">this</a>, I am un...
20,048,613
8
3
null
2013-11-17 22:24:39.503 UTC
64
2021-04-24 12:12:24.267 UTC
2018-01-15 18:53:40.3 UTC
null
208,990
null
208,990
null
1
164
ssl|https|ssl-certificate|iis-express
114,465
<p>Windows 10 users: Repair is only in the Control Panel, not in the Add Remove programs app. I typically run appwiz.cpl to launch the old control panel applet and run repair from there.</p> <p>Windows 7 and 8.1: After going to Add/Remove Programs and choosing the &quot;Repair&quot; option on IIS Express, the certifica...
20,158,793
Creating c++ vector of pointers
<p>In my C++ code I have a class Object equipped with an id field of type int. Now I want to create a vector of pointers of type Object*. First I tried</p> <pre><code>vector&lt;Object*&gt; v; for(int id=0; id&lt;n; id++) { Object ob = Object(id); v.push_back(&amp;ob); } </code></pre> <p>but this failed becau...
20,159,876
3
3
null
2013-11-23 05:07:11.88 UTC
6
2015-04-06 02:39:45.797 UTC
2013-11-23 15:32:36.117 UTC
null
1,363,208
null
1,363,208
null
1
9
c++|pointers|vector
52,302
<p>In this loop:</p> <pre><code>for(int id=0; id&lt;n; id++) { Object ob = Object(id); v.push_back(&amp;ob); } </code></pre> <p>You are creating n times Object instance on stack. At every iteration there is created and removed element. You can simply avoid this using that:</p> <pre><code>for(int id=0; id&lt;...
15,436,702
Estimate Cohen's d for effect size
<p>given two vectors:</p> <pre><code>x &lt;- rnorm(10, 10, 1) y &lt;- rnorm(10, 5, 5) </code></pre> <p>How to calculate Cohen's d for effect size?</p> <p>For example, I want to use the <a href="http://www.statmethods.net/stats/power.html">pwr package</a> to estimate the power of a t-test with unequal variances and i...
15,437,034
4
0
null
2013-03-15 15:52:19.907 UTC
9
2021-06-29 09:53:43.687 UTC
2013-03-15 16:08:57.11 UTC
null
429,846
null
1,144,724
null
1
14
r|statistics
42,793
<p>Following <a href="http://www.statmethods.net/stats/power.html" rel="noreferrer"><strong>this link</strong></a> and <a href="http://en.wikipedia.org/wiki/Cohen%27s_d#Cohen.27s_d" rel="noreferrer"><strong>wikipedia</strong></a>, Cohen's d for a t-test seems to be:</p> <p><img src="https://i.stack.imgur.com/PP2Cf.jpg...
15,484,622
How to convert sparse matrix to dense matrix in Eigen
<p>Is there some easy and fast way to convert a sparse matrix to a dense matrix of doubles?</p> <p>Because my <code>SparseMatrix</code> is not sparse any more, but became dense after some matrix products.</p> <p>Another question I have: The Eigen library has excellent performance, how is this possible? I don't unders...
15,592,295
1
2
null
2013-03-18 18:53:25.187 UTC
9
2015-08-10 23:38:21.443 UTC
2013-03-23 14:48:45.25 UTC
null
1,737,727
null
2,165,656
null
1
20
c++|matrix|sparse-matrix|eigen
14,950
<p>Let's declare two matrices:</p> <pre><code>SparseMatrix&lt;double&gt; spMat; MatrixXd dMat; </code></pre> <p>Sparse to dense:</p> <pre><code>dMat = MatrixXd(spMat); </code></pre> <p>Dense to sparse:</p> <pre><code>spMat = dMat.sparseView(); </code></pre>
15,428,777
whats the difference between: %%a and %variable% variables?
<pre><code>for /f "tokens=*" %%a in ('find /v ":" "%appdata%\gamelauncher\options.txt" ^| find "menu=a"') do ( set usemenu=a ) for /f "tokens=*" %%a in ('find /v ":" "%appdata%\gamelauncher\options.txt" ^| find "menu=b"') do ( set usemenu=b ) for /f "tokens=*" %%a in ('find /v ":" "%appdata%\gamelauncher\options.txt" ^...
15,428,976
1
0
null
2013-03-15 09:29:14.63 UTC
5
2019-07-03 02:30:00.133 UTC
null
null
null
null
2,010,401
null
1
20
variables|batch-file|cmd
99,446
<p><code>%variable%</code> are <em>environment</em> variables. They are set with <code>set</code> and can be accessed with <code>%foo%</code> or <code>!foo!</code> (with delayed expansion if enabled). <code>%%a</code> are special variables created by the <code>for</code> command to represent the current loop item or a ...
15,133,595
Use case generalization versus extension
<p>UML Use Case Diagrams allow for two seemingly equivalent ways to show that a given use case might be realised in several different ways namely <a href="https://i.stack.imgur.com/VThNF.png">use case generalizations</a> as opposed to <a href="https://i.stack.imgur.com/Xc0hU.png">use case extensions</a>. I have seen th...
15,135,858
3
1
null
2013-02-28 10:51:30.013 UTC
8
2022-06-12 13:17:00.59 UTC
null
null
null
null
141,997
null
1
27
uml|use-case
21,706
<blockquote> <p>To my mind an extension is a weaker relationship than generalization as a direct substitution of the specialised use case for the base case must be possible in generalization but not necessarily in extensions.</p> </blockquote> <p>That is true.</p> <blockquote> <p>It seems to me that generalisation impl...
15,195,750
Minify/compress CSS with regex?
<p>In PHP can you compress/minify CSS with regex (PCRE)?</p> <p>(As a theoretical in regex. I'm sure there are libraries out there that do this well.)</p> <p><sub>Background note: After spending hours writing an answer to a <a href="https://stackoverflow.com/questions/15186425/string-replacement-fails-with-important"...
15,195,752
4
6
null
2013-03-04 06:24:22.66 UTC
10
2018-06-08 00:52:57.677 UTC
2017-05-23 12:25:20.837 UTC
null
-1
null
107,152
null
1
28
php|css|regex|pcre|minify
7,875
<h1>Simple regex CSS minifier/compressor</h1> <p>(Ok, it may not be overly simple, but pretty straight forward.)</p> <h2>Requirements</h2> <p>This answer assumes that the requirements are:</p> <ul> <li>Remove comments</li> <li>Replace whitespace combinations longer than 1 space with a single space</li> <li>Remove a...
15,363,923
Disable the underlying window when a popup is created in Python TKinter
<p>I have a master Frame (call it <code>a</code>), and a popup Toplevel (call it <code>b</code>). How do I make sure the user cannot click on anything in <code>a</code> while <code>b</code> is "alive"?</p>
15,363,998
1
0
null
2013-03-12 14:25:27.287 UTC
12
2018-02-22 18:47:34.183 UTC
null
null
null
null
755,934
null
1
32
python|tkinter
32,869
<p>If you don't want to hide the root but just make sure the user can only interact with the popup, you can use <a href="http://effbot.org/tkinterbook/widget.htm#Tkinter.Widget.grab_set-method" rel="noreferrer"><code>grab_set()</code></a> and <a href="http://effbot.org/tkinterbook/widget.htm#Tkinter.Widget.grab_release...
15,390,303
How to group by DESC order
<p>I have the following table called questions:</p> <pre><code>ID | asker 1 | Bob 2 | Bob 3 | Marley </code></pre> <p>I want to select each asker only once and if there are multiple askers with the same name, select the one of the highest id. So, the expected results:</p> <pre><code>ID | asker 3 | Marley 2 | Bob...
15,390,352
7
3
null
2013-03-13 15:59:44.897 UTC
5
2020-10-25 22:10:19.017 UTC
2020-10-25 22:10:19.017 UTC
null
1,839,439
null
1,848,708
null
1
40
mysql|sql|group-by
108,106
<p>If you want the last <code>id</code> for each <code>asker</code>, then you should use an aggregate function:</p> <pre><code>SELECT max(id) as id, asker FROM questions GROUP by asker ORDER by id DESC </code></pre> <p>The reason why you were getting the unusual result is because MySQL uses an extension to <cod...
45,183,875
Spring Boot Controller not mapping
<p>I have used STS and now I am using IntelliJ Ultimate Edition but I am still getting the same output. My controller is not getting mapped thus showing 404 error. I am completely new to Spring Framework.</p> <p>DemoApplication.java</p> <pre><code>package com.webservice.demo; import org.springframework.boot.SpringAp...
47,283,396
13
14
null
2017-07-19 07:35:56.767 UTC
6
2022-08-11 17:21:17.99 UTC
2017-07-19 11:42:54.93 UTC
null
472,495
null
6,154,775
null
1
45
java|spring
79,351
<p>I too had the similar issue and was able to finally resolve it by correcting the source package structure following <a href="https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-structuring-your-code.html" rel="noreferrer">this</a></p> <p>Your Controller classes are not scanned by the Component...
23,583,497
How to pass javascript/jQuery variable to PHP using POST method
<p>This is really basic. All I want to do is measure the html width of a browser window, and pass that data to a PHP script so that I can adjust what information is passed to the site.</p> <p>I've got the HTML width part down. I'm just having trouble passing the Javascript/jQuery variable to the PHP script using AJAX....
23,583,747
2
8
null
2014-05-10 16:22:22.557 UTC
0
2014-05-10 16:52:40.477 UTC
2014-05-10 16:46:46.787 UTC
null
1,021,725
null
3,623,716
null
1
2
javascript|php|jquery|ajax|post
47,274
<p>Here is the code that can be function within a file:</p> <p>For PHP part, you should pass value to the function and call the function.</p> <p>I guess you need return data to the client from the php function return. Then, for ajax part, you have to catch the return data.</p> <pre><code>&lt;? if(isset($_POST['width...
8,548,030
Why does "pip install" inside Python raise a SyntaxError?
<p>I'm trying to use pip to install a package. I try to run <code>pip install</code> from the Python shell, but I get a <code>SyntaxError</code>. Why do I get this error? How do I use pip to install the package?</p> <pre><code>&gt;&gt;&gt; pip install selenium ^ SyntaxError: invalid syntax </code></pr...
8,548,165
8
3
null
2011-12-17 21:23:32.337 UTC
91
2021-11-19 15:07:17.573 UTC
2017-01-10 00:44:18.36 UTC
null
202,229
null
958,083
null
1
292
python|pip|installation
955,024
<p>pip is run from the command line, not the Python interpreter. It is a program that <strong>installs</strong> modules, so you can use them from Python. Once you have installed the module, then you can open the Python shell and do <code>import selenium</code>.</p> <p>The Python shell is not a command line, it is an i...
4,986,683
Difference between Implicit and Explicit Transaction
<p>What is the difference between Implicit and Explicit transaction in Sql Server 2008?</p> <p>What happens in TransactionScope background? I'm using TransactionScope but in Sql server profiler I don't see "Begin transaction..." statement.</p> <p>How does it work?</p>
4,988,483
4
0
null
2011-02-13 20:30:59.217 UTC
6
2015-05-06 14:31:26.883 UTC
2011-02-14 02:49:04.467 UTC
null
573,261
null
648,723
null
1
20
sql-server-2005|sql-server-2008|c#-4.0|transactions|transactionscope
51,641
<ul> <li>Implicit Transactions: <a href="http://msdn.microsoft.com/en-us/library/ms188317.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/ms188317.aspx</a></li> <li>SET IMPLICIT_TRANSACTIONS { ON | OFF} <a href="http://msdn.microsoft.com/en-us/library/ms187807.aspx" rel="noreferrer">http://msdn.microsoft...
5,013,917
Can I serve JSPs from inside a JAR in lib, or is there a workaround?
<p>I have a web application deployed as a WAR file in Tomcat 7. The application is build as a multi-module project:</p> <ul> <li>core - packaged as JAR, contains most of the backend code</li> <li>core-api - packaged as JAR, contains interfaces toward core</li> <li>webapp - packaged as WAR, contains frontend code and d...
11,063,065
5
2
null
2011-02-16 08:03:12.63 UTC
26
2019-06-13 07:45:08.25 UTC
null
null
null
null
90,566
null
1
64
java|jsp|tomcat|servlets|tiles
32,152
<p>Servlet 3.0 which Tomcat 7 supports includes the ability to package jsps into a jar.</p> <p>You need to:</p> <ul> <li>place your jsps in <code>META-INF/resources</code> directory of your jar</li> <li>optionally include a <code>web-fragment.xml</code> in the <code>META-INF</code> directory of your jar</li> <li>plac...
4,967,530
How can I maintain the space between these two buttons in IE7 mode?
<p>I have 2 buttons horizontally aligned. In most browsers there's a space between them, but if you view this:</p> <p><a href="http://jsfiddle.net/2HP43/1/" rel="nofollow">http://jsfiddle.net/2HP43/1/</a></p> <p>in "Browser Mode: IE7" &amp; "Document Mode: IE7 Standards" you can see that the 2 buttons are stuck toget...
4,967,564
6
1
null
2011-02-11 09:42:47.5 UTC
1
2016-05-12 13:15:21.663 UTC
null
null
null
null
181,771
null
1
0
html|css|internet-explorer|internet-explorer-7
41,081
<p>Have you tried putting <code>&amp;nbsp;</code> in between them?</p> <p>IE does not render "padding" to W3C standards. (See <a href="http://www.quirksmode.org/css/box.html" rel="nofollow">here</a> for explanation.) That's almost assuredly where this problem is coming from, so you'll need to insert something in bet...
5,229,586
What is the C# standard for capitialising method names?
<p>What is the C# standard for capitialising method names? Is it:</p> <pre><code>MyClass.MyMethod() </code></pre> <p>or</p> <pre><code>MyClass.myMethod() </code></pre> <p>?</p>
5,229,612
8
3
null
2011-03-08 07:27:16.633 UTC
7
2021-01-24 13:39:51.81 UTC
2021-01-24 13:39:51.81 UTC
null
939,213
null
626,023
null
1
54
c#|naming-conventions
40,941
<p>The first one is right following the <a href="https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/capitalization-conventions" rel="nofollow noreferrer">.NET Capitalization Conventions</a></p>
5,448,545
How to retrieve GET parameters from JavaScript
<p>Consider:</p> <pre><code>http://example.com/page.html?returnurl=%2Fadmin </code></pre> <p>For <code>js</code> within <code>page.html</code>, how can it retrieve <code>GET</code> parameters?</p> <p>For the above simple example, <code>func('returnurl')</code> should be <code>/admin</code>.</p> <p>But it should also wo...
5,448,595
17
1
null
2011-03-27 10:09:49.803 UTC
86
2022-06-11 06:59:58.467 UTC
2020-10-08 21:02:27.487 UTC
null
63,550
null
641,151
null
1
413
javascript|get
664,589
<p>With the <a href="https://developer.mozilla.org/en/DOM/window.location" rel="noreferrer">window.location</a> object. This code gives you GET without the question mark.</p> <pre><code>window.location.search.substr(1) </code></pre> <p>From your example it will return <code>returnurl=%2Fadmin</code></p> <p><strong>E...
17,042,431
How to focus div?
<p>Please don't throw stones at me because i'm total newbie at js and jquery. is it possible to focus a div? i just wanted to process events when div is clicked OR is focused and when we click outside the div. Something like that:</p> <p>HTML:</p> <pre><code>&lt;div id="focusedDiv"&gt;&lt;/div&gt; </code></pre> <p>J...
17,042,452
1
2
null
2013-06-11 10:56:17.253 UTC
1
2013-06-11 10:57:39.83 UTC
null
null
null
null
1,178,399
null
1
6
jquery|html
55,086
<p>You have to set tabindex attribute:</p> <p><a href="http://jsfiddle.net/QAkGV/">http://jsfiddle.net/QAkGV/</a></p> <pre><code>&lt;div id="focusedDiv" tabindex="-1"&gt;&lt;/div&gt; </code></pre> <p>Or:</p> <pre><code>$("#focusedDiv").attr('tabindex',-1).focus(function () { .... }); </code></pre> <p>F...
61,966,810
Flutter - save file to download folder - downloads_path_provider
<p>I'm developing a mobile app using flutter. For that I used <a href="https://pub.dev/packages/downloads_path_provider" rel="noreferrer">downloads-path-provider</a> to get the download directory of the mobile phone. The emulator returns <code>/storage/emulated/0/Download</code>. Also when I save a file in this directo...
62,087,942
2
8
null
2020-05-23 02:47:15.773 UTC
4
2022-05-05 19:12:37.947 UTC
2020-05-29 14:15:34.463 UTC
null
436,341
null
9,532,360
null
1
10
android|flutter
38,086
<p>path_provider will probably undergo some changes soon, there are some open issues:</p> <p><a href="https://github.com/flutter/flutter/issues/35783" rel="noreferrer">https://github.com/flutter/flutter/issues/35783</a></p> <p>As of right now, the best way to get the download path on an Android device is to use:</p> <p...
12,064,439
Detect whether cell value was actually changed by editing
<p><code>Worksheet_Change</code> triggers when a cell value is changed (which is what I want), but it also triggers when you enter a cell as if to edit it but don't actually change the cell's value (and this is what I don't want to happen). </p> <p>Say I want to add shading to cells whose value was changed. So I code...
12,068,586
5
4
null
2012-08-21 23:21:53.973 UTC
4
2021-03-31 15:02:59.883 UTC
2018-06-27 16:09:49.793 UTC
user2140173
8,112,776
null
1,615,488
null
1
11
vba|excel
40,619
<p>I suggest automatically maintaining a "mirror copy" of your sheet, in another sheet, for comparison with the changed cell's value. </p> <p>@brettdj and @JohnLBevan essentially propose doing the same thing, but they store cell values in comments or a dictionary, respectively (and +1 for those ideas indeed). My feeli...
12,608,356
How to build simple jQuery image slider with sliding or opacity effect?
<p>Some of us might not want to use ready plugins because of their high sizes and possibilty of creating conflicts with current javascript. </p> <p>I was using light slider plugins before but when customer gives modular revise, it became really hard to manipulate. Then I aim to build mine for customising it easily. I ...
12,608,357
5
1
null
2012-09-26 18:43:32.93 UTC
34
2019-01-15 13:41:31.637 UTC
2014-10-14 13:41:22.62 UTC
null
1,428,241
null
1,428,241
null
1
28
javascript|jquery|css|animation|slideshow
77,386
<p>Before inspecting examples, you should know two jQuery functions which i used most. </p> <p><a href="http://api.jquery.com/index/" rel="nofollow noreferrer">index()</a> returns value is an integer indicating the position of the first element within the jQuery object relative to its sibling elements.</p> <p><a href...
12,338,244
Making resources theme dependent
<p>Now that we have two Icons (Dark and Light) as described in <a href="http://developer.android.com/guide/practices/ui_guidelines/icon_design_action_bar.html" rel="noreferrer">ActionBar Icon Guide</a>.</p> <pre><code>@drawable/ic_search_light @drawable/ic_search_dark </code></pre> <p>How to reference these Icons in...
12,339,924
1
4
null
2012-09-09 10:17:19.9 UTC
21
2015-05-01 08:39:40.727 UTC
2012-09-09 14:31:23.03 UTC
null
1,531,054
null
1,531,054
null
1
28
android|android-theme
10,119
<p>There's a way to define android <em>drawables</em> (and many other elements found in <em>res/values</em>) to be Theme dependent.</p> <p>Lets suppose we have two <em>drawables</em>, menu icons in this case:</p> <pre><code>res/drawable/ic_search_light.png res/drawable/ic_search_dark.png </code></pre> <p>And we want...
12,595,631
Debugging with gdb on a program with no optimization but still there is no symbol in the current context for local variables
<p>I've been having this problem for while now, but always seem to put off asking this question because it seems like I am doing something wrong... but right now I feel otherwise... taken this code:</p> <pre><code>#include &lt;string&gt; #include &lt;iostream&gt; #include &lt;algorithm&gt; int main(int argc, char** ar...
12,595,773
2
3
null
2012-09-26 06:17:46.55 UTC
21
2013-02-24 11:02:49.66 UTC
2012-09-26 07:00:33.663 UTC
user451498
null
user451498
null
null
1
33
c++|debugging|gcc|gdb
16,250
<p>No, even with --quiet it works for me. Maybe there's something wrong with your setup.</p> <pre><code>~/tmp $ g++ -Wall tmp.cpp -o tmp -O0 -ggdb3 ~/tmp $ gdb --quiet --args ./tmp string Reading symbols from /xxxxxxxx/tmp...done. (gdb) b 12 Breakpoint 1 at 0x400c95: file tmp.cpp, line 12. (gdb) run Starting program: ...
12,399,505
Understanding difference between redirect and rewrite .htaccess
<p>I'd like to understand the difference between redirecting and rewriting a URL using .htaccess. So here's an example: Say I have a link like <code>www.abc.com/ index.php?page=product_types&amp;cat=88</code> (call this the "original" url)</p> <p>But when the user types in <code>abc.com/shoes</code> (let's call this ...
12,399,668
1
2
null
2012-09-13 04:39:19.273 UTC
10
2017-09-03 12:04:20.967 UTC
2017-09-03 12:04:20.967 UTC
null
1,033,581
null
700,343
null
1
36
apache|.htaccess|mod-rewrite
30,649
<p>Some of the explanation can be found here: <a href="https://stackoverflow.com/a/11711948/851273">https://stackoverflow.com/a/11711948/851273</a></p> <p>The gist is that a rewrite happens solely on the server, the client (browser) is blind to it. The browser sends a request and gets content, it is none the wiser to ...
12,432,154
Int vs Word in common use?
<p>It seems like the common pattern of taking/returning <code>Int</code> (ie <code>ByteString.hGet</code> and <code>Data.List.length</code>) is contrary to the Haskell pattern of using strongly-descrbing types, since many of these cases can only handle positive numbers. Would it not be better to use <code>Word</code>,...
12,432,899
3
6
null
2012-09-14 21:21:09.377 UTC
6
2012-09-16 10:08:50.287 UTC
null
null
null
null
8,611
null
1
43
haskell|type-safety
4,883
<p>It is true that the expressiveness of the Haskell type system encourages users to assign precise types to entities they define. However, seasoned Haskellers will readily acknowledge that one must strike a balance between ultimate type precision (which besides isn't always attainable given the current limits of Haske...
12,131,273
Twitter Bootstrap - Tabs - URL doesn't change
<p>I'm using Twitter Bootstrap and its "tabs".</p> <p>I have the following code:</p> <pre><code>&lt;ul class="nav nav-tabs"&gt; &lt;li class="active"&gt;&lt;a data-toggle="tab" href="#add"&gt;add&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a data-toggle="tab" href="#edit" &gt;edit&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&l...
12,138,756
15
2
null
2012-08-26 15:19:06.007 UTC
44
2020-05-16 07:54:28.1 UTC
2012-12-04 20:12:01.297 UTC
null
448,144
null
867,418
null
1
113
jquery|twitter-bootstrap
93,227
<p>Try this code. It adds tab href to url + opens tab based on hash on page load:</p> <pre><code>$(function(){ var hash = window.location.hash; hash &amp;&amp; $('ul.nav a[href="' + hash + '"]').tab('show'); $('.nav-tabs a').click(function (e) { $(this).tab('show'); var scrollmem = $('body').scrollTop()...
3,238,517
How do I redirect a domain to a specific "landing page"?
<p>My client has several parked domains. She wants those domains to point to specific pages in her main site. For example:</p> <p>Let's pretend she has a page on her main site about bedroom redecorating. That page is located at www.mainsite.com/bedrooms/</p> <p>And let's say she has a parked domain called www.999bedr...
3,238,667
3
0
null
2010-07-13 15:05:27.063 UTC
6
2013-11-08 01:23:09.677 UTC
null
null
null
null
320,942
null
1
11
redirect
40,731
<p>There are (at least) two ways to do this. One way requires access to some sort of configuration on the server, and the other doesn't. I don't know if you're using the Apache web server, but if you are, you would add <code>mod_alias</code> to your configuration and restart Apache:</p> <pre><code>a2enmod alias apac...
3,976,272
JavaScript confirm box with custom buttons
<p>Can I write a custom confirm box in JavaScript that, instead of the default <code>OK</code> and <code>CANCEL</code> button, shows a <code>SAVE</code> and <code>DELETE</code> button?</p>
3,976,283
3
2
null
2010-10-20 09:11:09.333 UTC
1
2019-09-20 22:47:19.13 UTC
2015-07-11 13:15:19.74 UTC
null
4,370,109
null
461,807
null
1
14
javascript|confirmbutton
81,206
<p>Use the <a href="http://jqueryui.com/demos/dialog/#modal-confirmation" rel="noreferrer">jQuery UI Dialog Box</a> for this.</p> <p>You can do something like this:</p> <p>JS: </p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="...
3,583,061
Automatically mirror a git repository
<p>One of the side-effects of using an external Subversion repository was getting automatic offsite backups on every commit.</p> <p>I'd like to achieve the same using Git. </p> <p>i.e. every commit to my local repository automatically commits to an external one so the two repositories are always in sync.</p> <p>I im...
3,583,114
3
0
null
2010-08-27 09:56:10.967 UTC
14
2022-08-02 13:27:21.89 UTC
null
null
null
null
45,955
null
1
30
git|version-control|dvcs
16,377
<p>I wrote a post-commit hook for just this purpose. The hook itself is simple; just add a file named <code>post-commit</code> to your <code>.git/hooks/</code> directory with the following contents:</p> <pre><code>git push my_remote </code></pre> <p>The <code>post-commit</code> file should be executable. Also make su...
3,320,355
How should I approach building a Universal iOS app that will include iOS 4 features, even though the iPad doesn't yet run iOS 4?
<p>I'd like build a game for both the iPhone and iPad. As such, it would make sense to start this project from scratch as a universal app. However, iPhone and iPad currently run two different versions of the iOS since iOS 4 isn't available for the iPad yet. There are two iOS 4 features (GameCenter and iAd) that I wo...
3,320,709
4
1
null
2010-07-23 16:41:38.79 UTC
12
2011-08-14 01:21:58.01 UTC
2010-07-23 17:07:15.08 UTC
null
191,808
null
191,808
null
1
11
iphone|ipad|ios4|universal-binary
10,284
<p>If you're about to build a Universal App, just remember the following two source code snippets:</p> <ul> <li><p>Using classes only if they are available on the current device</p> <p>Consider this piece of code:</p> <pre><code>UILocalNotification* n = [[UILocalNotification alloc] init]; </code></pre> <p>When buil...
24,024,702
How can I decrypt a password hash in PHP?
<p>I need to decrypt a password. The password is encrypted with <code>password_hash</code> function.</p> <pre><code>$password = 'examplepassword'; $crypted = password_hash($password, PASSWORD_DEFAULT); </code></pre> <p>Now, let's assume that <code>$crypted</code> is stored in a database (there's a "users" table, with...
24,024,772
6
11
null
2014-06-03 20:51:40.343 UTC
12
2021-08-30 21:24:17.797 UTC
2020-04-30 02:19:16.76 UTC
null
9,811,969
null
3,569,234
null
1
24
php|mysql|encryption
180,927
<p>Bcrypt is a one-way hashing algorithm, you can't decrypt hashes. Use <a href="http://docs.php.net/manual/en/function.password-verify.php" rel="noreferrer">password_verify</a> to check whether a password matches the stored hash:</p> <pre><code>&lt;?php // See the password_hash() example to see where this came from. $...
22,739,701
Django, save ModelForm
<p>I have created a model <strong>Student</strong> which extends from the <strong>Django User</strong> and is a foreign key to another model while it has an integer field called year. What i'm trying to do is to save a form, which has 2 fields. The one is the <strong>course id</strong> and the another one is the the in...
22,749,879
2
4
null
2014-03-30 02:51:33.313 UTC
16
2014-03-30 21:06:50.72 UTC
2014-03-30 03:20:37.02 UTC
null
1,867,980
null
1,460,144
null
1
32
python|django|django-forms
65,671
<p>You dont need to redefine fields in the <code>ModelForm</code> if you've already mentioned them in the <code>fields</code> attribute. So your form should look like this -</p> <pre><code>class SelectCourseYear(forms.ModelForm): class Meta: model = Student fields = ['course', 'year'] # removing us...
8,464,262
Access is denied error on XDomainRequest
<p>I'm trying to use microsoft XDomainRequest to send cross domain request. Here is the code </p> <blockquote> <pre><code>... if ($.browser.msie &amp;&amp; window.XDomainRequest) { // Use Microsoft XDR var xdr = new XDomainRequest(); xdr.open("POST", "http://graph.facebook.com/1524623057/"); xdr.send(); } ...
8,509,981
2
6
null
2011-12-11 13:20:49.597 UTC
5
2013-01-16 12:18:14.403 UTC
2012-02-13 20:57:42.19 UTC
null
213,269
null
1,051,927
null
1
32
javascript|internet-explorer|cross-domain|xdomainrequest
19,329
<p>I found the reason of this problem. As stated in <a href="http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx" rel="noreferrer">Point 7</a>:</p> <blockquote> <p><strong>Requests must be targeted to the same scheme as the hosting page</strong></p> <p>Thi...
20,868,103
ref and out arguments in async method
<p>Does anyone know why <code>async</code> methods are not allowed to have <code>ref</code> and <code>out</code> arguments? I've done a bit of research on it but the only thing I could find was that it has to do with the stack unrolling.</p>
20,868,150
2
4
null
2014-01-01 11:22:16.94 UTC
16
2021-04-22 02:38:33.467 UTC
2021-04-22 02:38:33.467 UTC
null
1,402,846
null
1,239,433
null
1
95
c#|asynchronous
63,102
<blockquote> <p>Does anyone know why async methods are not allowed to have ref and out arguments? </p> </blockquote> <p>Sure. Think about it - an async method usually <em>returns</em> almost immediately, long before most of the actual logic is executed... that's done asynchronously. So any <code>out</code> parameter...
26,399,783
How to properly execute a function inside ng-repeat
<p><strong>SITUATION:</strong></p> <p>I am making an app in AngularJs that assign permissions. In order to do this i have three nested ng-repeat.</p> <p><em>First loop</em>: display PERMISSION GROUP</p> <p><em>Second loop</em>: For each permission group display CATEGORIES. Inside this loop execute a function that w...
26,400,951
4
5
null
2014-10-16 08:37:46.37 UTC
3
2016-02-15 03:01:25.107 UTC
2014-10-16 10:05:33.217 UTC
null
731,314
null
2,433,664
null
1
17
javascript|php|angularjs|angularjs-ng-repeat
65,177
<p>Calling a function inside ng-repeat is same as normal one. Since you need to display the sub categories at the time of page loading its better to get these data beforehand. Asynchronously loading sub categories will not fit into this scenario.</p> <p>Here is a minimal snippet achieving this (<a href="http://jsfiddl...
26,093,545
How to validate domain name using regex?
<p>This is my code for validating domain name.</p> <pre><code>function frmValidate() { var val = document.frmDomin; if (/^[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]\.[a-zA-Z]{2,}$/.test(val.name.value)) { } else { alert("Enter Valid Domain Name"); val.name.focus(); return false; ...
26,093,611
5
6
null
2014-09-29 06:14:01.893 UTC
2
2020-07-15 14:18:37.187 UTC
2017-06-01 09:33:46.8 UTC
null
2,724,961
null
1,416,847
null
1
15
javascript|regex
54,539
<p>Try this:</p> <pre><code>^[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9](?:\.[a-zA-Z]{2,})+$ </code></pre> <p><a href="http://rubular.com/r/KByADagF3Z">Demo</a></p>
10,889,391
regex - get numbers after certain character string
<p>I have a text string that can be any number of characters that I would like to attach an order number to the end. Then I can pluck off the order number when I need to use it again. Since there's a possibility that the number is variable length, I would like to do a regular expression that catch's everything after th...
10,889,423
3
0
null
2012-06-04 22:40:46.33 UTC
5
2013-12-01 06:32:06.48 UTC
2012-06-04 22:59:37.343 UTC
null
20,938
null
1,252,748
null
1
12
javascript|regex
47,756
<pre><code>var s = "aijfoi aodsifj adofija afdoiajd?order_num=3216545"; var m = s.match(/([^\?]*)\?order_num=(\d*)/); var num = m[2], rest = m[1]; </code></pre> <p>But remember that regular expressions are <em>slow</em>. Use <code>indexOf</code> and <code>substring</code>/<code>slice</code> when you can. For example:...
11,011,724
Java Object Assignment
<p>I am new to Java and I have some questions in mind regarding object assignment. For instance,</p> <pre><code>Test t1 = new Test(); Test t2 = t1; t1.i=1; </code></pre> <p>Assuming variable <code>i</code> is defined inside Test class, am I right to assume both t1 and t2 point to the same object where the modificatio...
11,011,764
8
2
null
2012-06-13 09:15:45.44 UTC
12
2020-10-20 06:33:19.563 UTC
2012-06-13 09:37:04.073 UTC
user1238193
null
user1238193
null
null
1
24
java|object|pass-by-reference|variable-assignment
46,760
<p>You are right, but Strings are a special case; they are immutable and act like primitives in this case.</p> <p>@newacct</p> <p>I quote <a href="http://docs.oracle.com/javase/tutorial/java/data/strings.html" rel="noreferrer">http://docs.oracle.com/javase/tutorial/java/data/strings.html</a> :</p> <blockquote> <p>...
11,268,930
How to git revert a commit using a SHA
<p>How can I revert a commit with a GIVEN SHA? I just want to remove the changes with a given SHA? I want to keep all the commits made BEFORE &amp; AFTER the give SHA. I just want to remove changes of that specified SHA.</p> <p>I have read <a href="https://stackoverflow.com/questions/1895059/git-revert-to-a-commit-by...
11,268,992
3
0
null
2012-06-29 21:04:46.92 UTC
5
2020-06-27 20:29:29.883 UTC
2017-05-23 12:17:28.077 UTC
null
-1
null
286,802
null
1
28
git
28,744
<p>You can use <code>git revert &lt;commit hash&gt;</code> to try to revert the changes made by the commit. This will not remove the commit from history, just make changes to undo it as a new commit. In other words you will have the first commit still in history, and an additional commit on the head of your branch whic...
11,138,927
Best way to limit the number of active Tasks running via the Parallel Task Library
<p>Consider a queue holding a <strong>lot</strong> of jobs that need processing. Limitation of queue is can only get 1 job at a time and no way of knowing how many jobs there are. The jobs take 10s to complete and involve a lot of waiting for responses from web services so is not CPU bound.</p> <p>If I use something l...
11,139,555
6
4
null
2012-06-21 13:10:51.557 UTC
12
2016-09-08 20:23:55.277 UTC
2017-05-23 12:02:22.183 UTC
null
-1
null
20,198
null
1
37
c#|.net|task-parallel-library
42,182
<p>I just gave an <a href="https://stackoverflow.com/questions/11099810/managing-the-tpl-queue/11100423#11100423">answer</a> which is very applicable to this question.</p> <p>Basically, the TPL Task class is made to schedule CPU-bound work. It is not made for blocking work.</p> <p>You are working with a resource that...
13,037,126
javascript void functions
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/1291942/what-does-javascriptvoid0-mean">What does “javascript:void(0)” mean?</a> </p> </blockquote> <p>I want to ask a few questions regarding <code>javascript:void(0)</code></p> <pre><code>&lt;input type='sub...
13,037,181
4
5
null
2012-10-23 18:47:00.463 UTC
2
2019-07-05 15:16:31.527 UTC
2019-07-05 15:16:31.527 UTC
null
10,445,697
null
1,370,507
null
1
7
javascript
39,470
<p><strong><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/void" rel="nofollow noreferrer">void()</a>:</strong></p> <blockquote> <p>This operator <strong>allows inserting expressions</strong> that produce side effects into places where an expression that evaluates to undefined is ...
13,051,204
Spring transaction REQUIRED vs REQUIRES_NEW : Rollback Transaction
<p>I have a method that has the <code>propagation = Propagation.REQUIRES_NEW</code> transactional property:</p> <pre><code>@Transactional(propagation = Propagation.REQUIRES_NEW) public void createUser(final UserBean userBean) { //Some logic here that requires modification in DB } </code></pre> <hr> <p>This metho...
13,052,757
2
3
null
2012-10-24 14:22:12.853 UTC
29
2022-02-19 19:12:33.08 UTC
2014-07-12 00:30:19.977 UTC
null
1,438,628
null
1,438,628
null
1
65
java|spring|hibernate|transactions|spring-transactions
174,693
<p>Using <code>REQUIRES_NEW</code> is only relevant when the method is invoked from a transactional context; when the method is invoked from a non-transactional context, it will behave exactly as <code>REQUIRED</code> - it will create a new transaction.</p> <p>That does not mean that there will only be one single trans...
12,647,891
How can you pass a bound variable to an ng-click function?
<p>I have a simple delete button that will accept a string or number but won't accept an ng-model variable ( not sure if that's the correct terminology ).</p> <pre><code>&lt;button class="btn btn-danger" ng-click="delete('{{submission.id}}')"&gt;delete&lt;/button&gt; </code></pre> <p>Which generates:</p> <pre><code>...
12,648,221
2
0
null
2012-09-28 21:55:36.95 UTC
11
2018-06-23 23:20:23.38 UTC
null
null
null
null
1,607,717
null
1
73
javascript|angularjs
53,844
<p>You don't need to use curly brackets (<code>{{}}</code>) in the <code>ng-click</code>, try this:</p> <pre><code>&lt;button class="btn btn-danger" ng-click="delete(submission.id)"&gt;delete&lt;/button&gt; </code></pre>
12,955,222
How to trigger HTML button when you press Enter in textbox?
<p>So the code that I have so far is:</p> <pre><code>&lt;fieldset id="LinkList"&gt; &lt;input type="text" id="addLinks" name="addLinks" value="http://"&gt; &lt;input type="button" id="linkadd" name="linkadd" value="add"&gt; &lt;/fieldset&gt; </code></pre> <p>It is not in a <code>&lt;form&gt;</code> and is jus...
12,955,267
14
4
null
2012-10-18 12:54:52.303 UTC
29
2022-06-14 00:14:58.48 UTC
2021-01-15 09:31:17.09 UTC
null
542,251
null
1,753,537
null
1
127
html|jquery|button|input|textbox
262,493
<pre><code>$(document).ready(function(){ $('#TextBoxId').keypress(function(e){ if(e.keyCode==13) $('#linkadd').click(); }); }); </code></pre>
16,961,838
Working with arrays in V8 (performance issue)
<p>I tried next code (it shows similar results in Google Chrome and nodejs):</p> <pre><code>var t = new Array(200000); console.time('wtf'); for (var i = 0; i &lt; 200000; ++i) {t.push(Math.random());} console.timeEnd('wtf'); wtf: 27839.499ms undefined </code></pre> <p>I also runned next tests:</p> <pre><code>var t =...
16,962,031
2
9
null
2013-06-06 12:15:13.323 UTC
13
2022-09-03 05:59:08.737 UTC
2013-06-06 12:39:29.24 UTC
null
2,027,961
null
2,027,961
null
1
28
javascript|arrays|google-chrome|firefox|v8
6,756
<p>If you preallocate, do not use <code>.push</code> because you will create a sparse array backed by a hashtable. <a href="https://github.com/v8/v8/blob/abfa9f17410a2a84c2ac3364e0288f4a8311b9b1/src/objects.h#L2411" rel="noreferrer">You can preallocate sparse arrays up to 99999 elements</a> which will be backed by a C ...
16,751,772
How do I use Travis-CI with C# or F#
<p>Travis CI continuous integration service officially supports many <a href="http://about.travis-ci.org/docs/#Specific-Language-Help" rel="noreferrer">languages</a>, but not C# or F#. </p> <p>Can I use it with my .net projects?</p>
27,413,136
5
0
null
2013-05-25 16:48:39.12 UTC
58
2017-06-22 13:37:13.443 UTC
2014-03-22 13:57:50.177 UTC
null
637,783
null
637,783
null
1
92
c#|f#|mono|travis-ci
14,626
<p>Travis CI now <a href="http://docs.travis-ci.com/user/languages/csharp/" rel="noreferrer">supports C#</a>. Quoting liberally from that page:</p> <blockquote> <h1>Overview</h1> <p>The setup for C#, F#, and Visual Basic projects looks like this:</p> </blockquote> <pre><code>language: csharp solution: solution...
25,700,971
Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root
<p>I am not sure how to fix this:</p> <pre><code>dyn-72-33-214-45:python mona$ sudo /usr/local/mysql/bin/mysqld stop 2014-09-06 09:49:04 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2014-09-06 09:49:04 ...
26,450,522
14
9
null
2014-09-06 13:50:58.353 UTC
15
2022-01-04 08:49:13.66 UTC
null
null
null
null
2,414,957
null
1
60
mysql|sql|my.cnf
161,084
<p>I'm using OS X (Yosemite) and this error happened to me when I upgraded from Mavericks to Yosemite. It was solved by using this command</p> <pre><code>sudo /usr/local/mysql/support-files/mysql.server start </code></pre>
58,010,655
Is adb remount broken on android api 29?
<p><code>adb remount</code> does not work correctly on api 29 when running from the emulator. The command works fine on all other emulators that have been tried (18, 23, 25, 26, 27 and 28).</p> <p>Any ideas why this might be?</p> <pre><code>Skip mounting partition: /product_services Skip mounting partition: /product...
61,375,430
2
3
null
2019-09-19 12:05:51.963 UTC
18
2021-01-23 21:03:56.28 UTC
null
null
null
null
12,090,237
null
1
58
android|android-emulator|adb|android-10.0
9,900
<h2>Update:</h2> <p>See @KiddTang answer which seems to be an actual solution</p> <hr /> <ul> <li><p>This issue is still occurring now even with API 30 (API R)! And even when starting emulator with writable-system option: (<code>emulator -writable-system -avd NAME_OF_DEVICE</code>)!</p> <ul> <li>I found there is an <a ...
4,095,504
Programmatically skip an NUnit test
<p>Is there a way for an NUnit test to end and tell the test runner that it should be considered skipped/ignored, rather than succeeded or failed?</p> <p>My motivation for this is that I have a few tests that don't apply in certain circumstances, but this can't be determined until the test (or maybe the fixture) starts...
4,095,528
2
0
null
2010-11-04 10:00:24.503 UTC
4
2021-03-22 07:37:24.867 UTC
2021-03-22 07:37:24.867 UTC
null
1,402,846
null
67,316
null
1
47
.net|unit-testing|nunit
17,195
<pre><code>Assert.Ignore(); </code></pre> <p>is specifically what you're asking for, though there is also:</p> <pre><code>Assert.Inconclusive(); </code></pre>
10,191,506
Internet Explorer Automation with VBA input events
<p>am trying to use automation in from Microsoft Access 2003 to control Internet Explorer 9 to complete a form using database data. </p> <p>The input fires an event in the browser which validates the data and makes the save button visible. If I use sendkeys the event is triggered; however, I have found sendkeys to b...
10,258,397
2
0
null
2012-04-17 12:44:28.933 UTC
4
2016-03-23 18:42:05.307 UTC
2012-04-20 18:09:27.923 UTC
null
290,504
null
290,504
null
1
6
internet-explorer|vba|automation
50,979
<p>After sweating over this for a few days, the answer was actually very simple but nearly impossible to find in any documentation on MSDN or anywhere else on the web. </p> <p>Before you change the value of the input field, you net to set the focus on that field. After you change the value, you need to set the focus...
9,784,683
Android external camera options - overlay on top of video stream, no middleman server/router
<p>I'm looking for a way to interface with an external camera from an Android device. The reason it needs to be an external camera is because I need to be able to modify the camera (remove IR filter) and I have no desire to break an on-board phone camera. </p> <p>It doesn't matter how the camera connects whether it is...
10,570,501
2
0
null
2012-03-20 10:05:56.243 UTC
9
2012-05-13 08:59:08.52 UTC
2017-05-23 12:25:39.467 UTC
null
-1
null
1,233,435
null
1
15
android|bluetooth|camera|usb|ip-camera
38,103
<p>I ended up opting for the IP camera option as it seemed to be the only viable option.</p> <p>I was able to purchase <a href="https://rads.stackoverflow.com/amzn/click/com/B00452V66G" rel="nofollow noreferrer" rel="nofollow noreferrer" title="this">this</a> camera and remove the IR filter by removing the glue at the...
9,896,216
Deploy Sinatra app on Heroku
<p>I have simple Sinatra app.</p> <p><strong>web.rb:</strong></p> <pre><code>require 'sinatra' get '/' do "Hello" end </code></pre> <p><strong>Gemfile:*</strong></p> <pre><code>source :rubygems gem 'sinatra', '1.1.0' gem 'thin', '1.2.7' </code></pre> <p><strong>config.ru:</strong></p> <pre><code>require '...
9,896,773
5
4
null
2012-03-27 19:22:11.413 UTC
14
2018-04-08 21:58:07.567 UTC
2012-03-27 20:07:22.673 UTC
null
25,066
null
205,270
null
1
16
ruby|heroku|sinatra
11,956
<p>You need a <code>Procfile</code> file alongside your <code>config.ru</code> to tell Heroku how to run your app. Here is the content of an example <code>Procfile</code>:</p> <pre><code>web: bundle exec ruby web.rb -p $PORT </code></pre> <p><a href="https://devcenter.heroku.com/articles/procfile" rel="nofollow noref...
9,734,384
Default timeout for HttpComponent Client
<p>I can't find any documentation on the default httpParams for httpclient 4.1 ?</p> <p>What's the default socket timeout when I do a GET ? </p>
9,734,836
5
0
null
2012-03-16 09:04:20.727 UTC
3
2021-01-29 14:15:33.67 UTC
null
null
null
null
356,899
null
1
23
java|apache-httpcomponents
52,334
<p>According to the <a href="http://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html" rel="noreferrer">documentation</a>, the <code>http.socket.timeout</code> parameter controls the SO_TIMEOUT value, and:</p> <blockquote> <p>If this parameter is not set, read operations will not time out (infinit...
10,137,214
How get next (previous) element in std::list without incrementing (decrementing) iterator?
<p>Say I have an <code>std::list&lt;int&gt; lst</code> and some <code>std::list&lt;int&gt;::iterator it</code> for iterating through the list. And depended to value of the <code>it</code> I want to use <code>it + 1</code> or <code>it - 1</code> in my code. Is there some good way to do that like <code>next()</code>, <co...
10,137,694
3
6
null
2012-04-13 08:00:34.11 UTC
3
2012-04-13 08:37:58.617 UTC
2012-04-13 08:02:13.133 UTC
null
427,328
null
509,233
null
1
51
c++|list|iterator
46,781
<p>Copying and incrementing/decrementing the copy is the only way it can be done.</p> <p>You can write wrapper functions to hide it (and as mentioned in answers, C++11 has std::prev/std::next which do just that (and Boost defines similar functions). But they are wrappers around this "copy and increment" operation, so ...
9,802,788
Call a REST API in PHP
<p>Our client had given me a REST API to which I need to make a PHP call. But as a matter of fact, the documentation given with the API is very limited, so I don't really know how to call the service.</p> <p>I've tried to Google it, but the only thing that came up was an already expired Yahoo! tutorial on how to call t...
9,802,854
12
0
null
2012-03-21 10:33:38.28 UTC
204
2022-02-25 00:14:44.67 UTC
2022-02-25 00:14:44.67 UTC
null
17,079,652
null
452,421
null
1
387
php|rest|web-services
941,770
<p>You can access any REST API with PHPs <code>cURL</code> Extension. However, the API Documentation (Methods, Parameters etc.) must be provided by your Client!</p> <p>Example:</p> <pre><code>// Method: POST, PUT, GET etc // Data: array("param" =&gt; "value") ==&gt; index.php?param=value function CallAPI($method, $u...
8,141,795
How to add an assembly manifest to a .NET executable?
<p>How can i add an assembly manifest to my .NET executable?</p> <hr> <p>An assembly manifest is is an XML file that is added to a .NET portable executable (PE) with resource type <code>RT_MANIFEST</code> (24). </p> <p>Assembly manifests are used to declare a number of things about the executable, e.g.:</p> <ul> <l...
8,844,086
3
2
null
2011-11-15 19:12:39.027 UTC
8
2015-11-27 18:15:33.73 UTC
2017-05-23 10:31:26.04 UTC
null
-1
null
12,597
null
1
33
visual-studio-2010|manifest|fusion
47,542
<p>If you want to add custom information to your application's manifest, you can follow these steps:</p> <ol> <li>Right-click on the project in the Solution Explorer.</li> <li>Click "Add New Item".</li> <li>Select "Application Manifest File".</li> </ol> <p>This adds a file named <code>app.manifest</code> to your proj...
11,619,545
jQuery loop through Child divs
<pre><code>&lt;div id="ChosenCategory" class="chosen"&gt; &lt;div class="cat_ch" name="1"&gt; &lt;div class="cat_ch" name="2"&gt; &lt;div class="cat_ch" name="3"&gt; &lt;div class="cat_ch" name="5"&gt; &lt;div class="clear"&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>I want to loop though <code>div.c...
11,619,756
8
3
null
2012-07-23 19:55:59.167 UTC
null
2015-10-22 18:10:30.457 UTC
null
null
null
null
842,767
null
1
10
javascript|jquery|loops|html|each
40,828
<p><a href="http://jsfiddle.net/2TRxh/" rel="nofollow">http://jsfiddle.net/2TRxh/</a></p> <p>I think your issue lies with the attempt to get the val off the div after you get the attribute <code>$(this).attr("name").val()</code>. Using <code>.val()</code> on a div doesn't make sense. If you remove that <code>$(this).a...
11,689,800
extra white space between tables in html email for gmail client
<p>My code is at</p> <p><a href="http://jsfiddle.net/user1212/G86KE/4/" rel="noreferrer">http://jsfiddle.net/user1212/G86KE/4/</a></p> <p>The problem is in gmail it leaves an extra white space between 2 tables inside the same cell. I have tried <code>display:block; margin:0; padding:0; line-height:0;</code></p> <p>...
11,692,240
9
5
null
2012-07-27 14:23:37.83 UTC
4
2018-06-26 23:33:47.337 UTC
2012-07-27 16:45:03.263 UTC
null
544,079
null
544,079
null
1
14
html|css|html-email
69,943
<p>Styling HTML mails is horrible.</p> <p>A few tips:</p> <p><code>border-spacing:0; /*this should fix the spacing problem*/</code></p> <p>You need to apply this to all the tables you are using, so you should include it in a <code>&lt;style&gt;</code> block at the top like so:</p> <pre><code>&lt;head&gt; &lt;styl...
11,556,607
Android : difference between invisible and gone?
<p>What is the difference between <code>invisible</code> and <code>gone</code> for the View visibility status?</p>
11,556,629
8
1
null
2012-07-19 08:14:18.817 UTC
66
2021-05-25 18:31:46.457 UTC
2015-12-22 17:12:31.04 UTC
null
1,332,549
null
1,399,620
null
1
539
android|android-xml|xml-attribute
180,747
<p>INVISIBLE:</p> <blockquote> <p>This view is invisible, but it still takes up space for layout purposes.</p> </blockquote> <p>GONE:</p> <blockquote> <p>This view is invisible, and it doesn't take any space for layout purposes.</p> </blockquote>
11,810,858
How to create SVN repository on server?
<p>How to create SVN repository on server? Although i have found various articles on this but still facing issues while creating repository on my website. Right now i am using <a href="http://www.assembla.com" rel="noreferrer">assembla</a> as my SVN repository, but want to create my own on my hosting.</p>
11,810,992
1
1
null
2012-08-04 18:04:01.653 UTC
11
2017-01-26 12:31:19.837 UTC
null
null
null
null
802,744
null
1
29
svn|webserver
70,127
<ol> <li><p><strong>Create a Repository:</strong></p> <p><code>svnadmin create /svnrepos</code> </p></li> <li><p><strong>Create a SVN User</strong></p> <p><code>vi /svnrepos/conf/svnserve.conf</code></p> <blockquote> <p>anon-access = none </p> <p>auth-access = write </p> <p>password-db = passwd</p> </...
11,776,767
What exactly is UIFont's point size?
<p>I am struggling to understand exactly what the point size in <code>UIFont</code> means. It's not pixels and it doesn't appear to be the standard definition of point which is that they relate to 1/72th inch.</p> <p>I worked out the pixel size using <code>-[NSString sizeWithFont:]</code> of fonts at various sizes and...
11,784,813
5
5
null
2012-08-02 11:48:06.513 UTC
17
2015-05-14 19:14:33.507 UTC
2012-08-03 09:07:07.653 UTC
null
1,068,248
null
1,068,248
null
1
50
objective-c|ios|fonts|uikit|uifont
23,264
<p>A font has an internal coordinate system, think of it as a unit square, within which a glyph's vector coordinates are specified at whatever arbitrary size accommodates all the glyphs in the font +- any amount of margin the font designer chooses.</p> <p>At 72.0 points the font's unit square is one inch. Glyph <em>x<...
11,510,483
Will a browser give an iframe a separate thread for JavaScript?
<p>Do web browsers use separate executional threads for JavaScript in iframes?</p> <p>I believe Chrome uses separate threads for each tab, so I am guessing that JavaScript in an iframe would share the same thread as its parent window, however, that seems like a security risk too.</p>
11,510,596
10
4
null
2012-07-16 18:40:04.717 UTC
6
2022-02-25 23:45:39.58 UTC
null
null
null
null
2,582
null
1
67
javascript|multithreading|browser
22,861
<p>Before chrome came along, all tabs of any browser shared the same single thread of JavaScript. Chrome upped the game here, and some others have since followed suit.</p> <p>This is a browser implementation detail, so there is no solid answer. Older browsers definitely don't. I don't know of any browser that definite...
12,018,992
Print Combining Strings and Numbers
<p>To print strings and numbers in Python, is there any other way than doing something like:</p> <pre><code>first = 10 second = 20 print "First number is %(first)d and second number is %(second)d" % {"first": first, "second":second} </code></pre>
12,019,007
6
5
null
2012-08-18 13:32:47.407 UTC
30
2022-03-14 15:48:16.357 UTC
2018-09-04 16:21:02.57 UTC
null
9,767,286
null
680,441
null
1
79
python|python-2.7
400,418
<blockquote> <p>Using <em>print function without parentheses</em> works with older versions of Python but is <strong>no longer supported on Python3</strong>, so you have to put the arguments inside parentheses. However, there are <a href="https://stackoverflow.com/questions/32122868/python-3-print-without-parenthesis/3...
11,555,468
How should I read a file line-by-line in Python?
<p>In pre-historic times (Python 1.4) we did:</p> <pre><code>fp = open('filename.txt') while 1: line = fp.readline() if not line: break print(line) </code></pre> <p>after Python 2.1, we did:</p> <pre><code>for line in open('filename.txt').xreadlines(): print(line) </code></pre> <p>before we got ...
11,555,509
3
6
null
2012-07-19 06:58:25.2 UTC
44
2022-08-29 13:23:39.647 UTC
2022-08-29 13:23:39.647 UTC
null
523,612
null
75,103
null
1
143
python
360,177
<p>There is exactly one reason why the following is preferred:</p> <pre><code>with open('filename.txt') as fp: for line in fp: print(line) </code></pre> <p>We are all spoiled by CPython's relatively deterministic reference-counting scheme for garbage collection. Other, hypothetical implementations of Pytho...
11,828,485
Get the option value in select in javascript
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/1085801/how-to-get-the-selected-value-of-dropdownlist-using-javascript">How to get the selected value of dropdownlist using JavaScript?</a><br> <a href="https://stackoverflow.com/questions/11828125/how-to-get-the...
11,828,653
2
1
null
2012-08-06 12:40:56.503 UTC
1
2016-10-21 14:33:05.247 UTC
2017-05-23 12:24:29.913 UTC
null
-1
null
1,115,161
null
1
-3
javascript
45,533
<pre><code>var elem = document.getElementById("short_code"), selectedNode = elem.options[elem.selectedIndex]; if ( selectedNode.value === "First" ) { //... </code></pre>
3,735,531
SQL/C# - Best method for executing a query
<p>I need to execute a sql query from within a c# class. I have thought of 2 options</p> <ol> <li>Starting a process of sqlcmd.</li> <li>Using a SqlCommand object.</li> </ol> <p>My question is which would be the better way? It's important that the solution only holds a connection to the server for a short time.</p> ...
3,735,547
5
4
null
2010-09-17 13:06:02.29 UTC
0
2015-07-31 15:30:26.67 UTC
null
null
null
null
393,908
null
1
18
c#|sql|sql-server-express
78,235
<p>Use a SqlCommand. This code will only keep the connection alive for a very short period of time (as long as your query is performant):</p> <pre><code>DataTable results = new DataTable(); using(SqlConnection conn = new SqlConnection(connString)) using(SqlCommand command = new SqlCommand(query, conn)) us...
3,803,951
htmlspecialchars(): Invalid multibyte sequence in argument
<p>I am getting this error in my local site.</p> <pre><code>Warning (2): htmlspecialchars(): Invalid multibyte sequence in argument in [/var/www/html/cake/basics.php, line 207] </code></pre> <p>Does anyone knows, what is the problem or what should be the solution for this?</p> <p>Thanks.</p>
3,803,972
6
0
null
2010-09-27 12:52:42.34 UTC
4
2014-10-23 13:10:32.977 UTC
null
null
null
null
417,143
null
1
16
php|cakephp|warnings|htmlspecialchars
39,599
<p>Be sure to specify the encoding to UTF-8 if your files are encoded as such:</p> <pre><code>htmlspecialchars($str, ENT_COMPAT, 'UTF-8'); </code></pre> <p>The default charset for <code>htmlspecialchars</code> is ISO-8859-1 (as of PHP v5.4 the default charset was turned to 'UTF-8'), which might explain why things go ...
3,498,730
Is C++ an Object Oriented language?
<p>I have always heard that C++ is not Object Oriented but rather "C with Classes". So, when I mentioned to an interviewer that C++ was not really object oriented, he asked me why I didn't consider it an OO language. I haven't done any C++ since University, and I didn't have much of an answer. Is C++ Object Oriented ...
3,498,750
18
13
null
2010-08-17 01:45:43.137 UTC
10
2021-11-11 22:04:25.21 UTC
2015-10-05 12:22:53.457 UTC
null
1,916,893
null
295,916
null
1
31
c++|oop
49,209
<p>C++ is usually considered a "multi-paradigm" language. That is, you can use it for object-oriented, procedural, and even functional programming.</p> <p>Those who would deny that C++ is OO generally have beef with the fact that the primitive types are not objects themselves. By this standard, Java would also not b...
8,065,571
Change state of toggle button from another button
<p>I'm creating a Java GUI using Swing with Eclipse and Window Builder Pro. I'm using <code>JButtons</code> and <code>JToggleButtons</code>. I want to change toggle button's state from another button.</p> <p><img src="https://i.stack.imgur.com/TbbtK.jpg" alt="enter image description here"></p> <p>For example, when I ...
8,065,687
4
0
null
2011-11-09 13:17:14.477 UTC
4
2014-11-15 07:57:16.083 UTC
2011-11-09 13:32:47.757 UTC
null
418,556
null
819,013
null
1
10
java|swing|jbutton|windowbuilder|jtogglebutton
48,070
<p><a href="http://download.oracle.com/javase/7/docs/api/javax/swing/AbstractButton.html#setSelected%28boolean%29">toggleButton.setSelected(boolean b)</a></p> <pre><code>import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.AbstractButton; import java...
8,145,509
MPMediaItem and iTunes Match
<p>I have an app that uses the iPod Library API to access the song database in iOS. With the release of iTunes Match, any song which is not on the device will fail to load. Is there a way I an request that the song be downloaded? Perhaps using the new iCloud API? </p> <p><strong>Edit:</strong> To be clear I am not a...
8,393,349
4
5
null
2011-11-16 01:23:51.463 UTC
14
2016-11-29 08:43:33.67 UTC
2011-11-16 17:37:32.737 UTC
null
647,315
null
647,315
null
1
30
objective-c|ios|core-audio|ipod|icloud
9,320
<p>I have found something, but it isn't great. If you select the song to be played through the iPod player then that will trigger a download. You can access the iPod player with an MPMusicPlayerController.</p> <pre><code>MPMusicPlayerController *mDRMAudioPlayer; mDRMAudioPlayer = [MPMusicPlayerController iPodMusicPl...
8,090,229
resize with averaging or rebin a numpy 2d array
<p>I am trying to reimplement in python an IDL function:</p> <p><a href="http://star.pst.qub.ac.uk/idl/REBIN.html" rel="noreferrer">http://star.pst.qub.ac.uk/idl/REBIN.html</a></p> <p>which downsizes by an integer factor a 2d array by averaging.</p> <p>For example:</p> <pre><code>&gt;&gt;&gt; a=np.arange(24).reshap...
8,090,605
5
1
null
2011-11-11 05:58:38.413 UTC
9
2022-07-03 16:48:44.36 UTC
null
null
null
null
597,609
null
1
38
python|numpy|slice|binning
34,221
<p>Here's an example based on <a href="https://stackoverflow.com/questions/4624112/grouping-2d-numpy-array-in-average/4624923#4624923">the answer you've linked</a> (for clarity):</p> <pre class="lang-py prettyprint-override"><code>&gt;&gt;&gt; import numpy as np &gt;&gt;&gt; a = np.arange(24).reshape((4,6)) &gt;&gt;...
8,141,440
How are constructors called during serialization and deserialization?
<p>How are the constructors called during serialization and deserialization</p> <ol> <li>When there is one class implementing serializable?</li> <li>When there is parent/child relationship and only child implements serializable?</li> <li>When there is parent/child relationship and both parent and child implements seri...
8,141,671
6
1
null
2011-11-15 18:46:00.283 UTC
17
2020-06-24 05:04:32.857 UTC
2015-09-21 11:41:04.427 UTC
null
1,310,566
null
968,161
null
1
60
java|serialization
47,270
<p>Example:</p> <pre><code> public class ParentDeserializationTest { public static void main(String[] args){ try { System.out.println(&quot;Creating...&quot;); Child c = new Child(1); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStrea...
8,080,579
Android TextField : set focus + soft input programmatically
<p>In my view, I have a search EditText and I would like to trigger programmatically the behaviour of a click event on the field, i.e give focus to the text field AND display soft keyboard if necessary (if no hard keyboard available).</p> <p>I tried <code>field.requestFocus()</code>. The field actually gets focus but ...
8,080,621
7
0
null
2011-11-10 13:55:22.653 UTC
18
2021-06-09 04:10:37.807 UTC
null
null
null
null
569,558
null
1
86
android|android-edittext
93,449
<p>Good sir, try this:</p> <pre><code>edittext.setFocusableInTouchMode(true); edittext.requestFocus(); </code></pre> <p>I'm not sure, but this might be required on some phones (some of the older devices):</p> <pre><code>final InputMethodManager inputMethodManager = (InputMethodManager) context .getSy...
8,345,581
C: printf a float value
<p>I want to print a float value which has 2 integer digits and 6 decimal digits after the comma. If I just use <code>printf("%f", myFloat)</code> I'm getting a truncated value.</p> <p>I don't know if this always happens in C, or it's just because I'm using C for microcontrollers (CCS to be exact), but at the referenc...
8,345,605
7
7
null
2011-12-01 17:25:42.54 UTC
17
2022-03-01 18:10:50.177 UTC
2012-06-19 01:32:38.2 UTC
null
44,390
null
808,091
null
1
104
c|floating-point
691,788
<p>You can do it like this:</p> <pre><code>printf("%.6f", myFloat); </code></pre> <p>6 represents the number of digits after the decimal separator.</p>
8,297,705
How to implement thread-safe lazy initialization?
<p>What are some recommended approaches to achieving <strong><em>thread-safe</em></strong> lazy initialization? For instance,</p> <pre><code>// Not thread-safe public Foo getInstance(){ if(INSTANCE == null){ INSTANCE = new Foo(); } return INSTANCE; } </code></pre>
8,297,830
13
0
null
2011-11-28 14:57:32.71 UTC
28
2022-08-24 02:24:55.127 UTC
null
null
null
null
584,862
null
1
66
java|thread-safety|lazy-initialization
61,484
<p>For singletons there is an elegant solution by delegating the task to the JVM code for static initialization.</p> <pre><code>public class Something { private Something() { } private static class LazyHolder { public static final Something INSTANCE = new Something(); } public static ...
8,158,969
H2 database error: Database may be already in use: "Locked by another process"
<p>I am trying to use the H2 database from a Java application. </p> <p>I created the database and its tables through the H2 Console and then I try to connect from Java using </p> <pre><code>Connection con = DriverManager.getConnection("jdbc:h2:~/dbname", "username", "password"); </code></pre> <p>However I receive th...
8,159,043
16
0
null
2011-11-16 21:27:43.807 UTC
18
2022-04-08 11:33:17.367 UTC
2015-10-24 12:24:29.077 UTC
null
5,240,004
null
260,108
null
1
58
java|database|h2
134,207
<p>H2 is still running (I can guarantee it). You need to use a TCP connection for multiple users such as -></p> <pre><code>&lt;property name="javax.persistence.jdbc.url" value="jdbc:h2:tcp://localhost/C:\Database\Data\production;"/&gt; </code></pre> <p>OR</p> <pre><code>DriverManager.getConnection("jdbc:h2:tcp://loc...
61,411,498
Why does rand() repeat numbers far more often on Linux than Mac?
<p>I was implementing a hashmap in C as part of a project I'm working on and using random inserts to test it. I noticed that <code>rand()</code> on Linux seems to repeat numbers far more often than on Mac. <code>RAND_MAX</code> is <code>2147483647/0x7FFFFFFF</code> on both platforms. I've reduced it to this test progr...
61,413,211
4
18
null
2020-04-24 15:08:24.23 UTC
8
2020-05-19 23:51:25.127 UTC
2020-05-19 23:51:25.127 UTC
null
13,513,445
null
9,242,143
null
1
124
c|linux|macos|random
8,394
<p>While at first it may sound like the macOS <code>rand()</code> is somehow better for not repeating any numbers, one should note that with this amount of numbers generated it is <a href="https://en.wikipedia.org/wiki/Birthday_problem" rel="noreferrer">expected</a> to see plenty of duplicates (in fact, around 790 mill...
4,382,440
C++ operator+ and operator+= overloading
<p>I'm implementing my own matrix class in c++ to help me develop my understanding of the language. I read somewhere that if you've got a working += operator, to use it in your + operator. So that's what I've got:</p> <pre><code>template &lt;class T&gt; const Matrix&lt;T&gt;&amp; Matrix&lt;T&gt;::operator+(const Matri...
4,382,461
3
9
null
2010-12-07 22:45:46.927 UTC
2
2010-12-08 13:43:27.967 UTC
2010-12-07 22:55:12.25 UTC
null
364,015
null
364,015
null
1
10
c++|operator-overloading
66,027
<p><code>operator+()</code> should not return a reference type as it is a new (locally declared) instance that holds the result of the operation.</p>
4,573,526
What could be causing a "Cannot access a disposed object" error in WCF?
<p>I am using the following code:</p> <pre><code>private WSHttpBinding ws; private EndpointAddress Srv_Login_EndPoint; private ChannelFactory&lt;Srv_Login.Srv_ILogin&gt; Srv_LoginChannelFactory; private Srv_Login.Srv_ILogin LoginService; </code></pre> <p>The Login is my constructor:</p> <pre><code>public Login() ...
4,573,571
3
0
null
2011-01-01 08:13:22.867 UTC
3
2019-03-21 08:37:13.433 UTC
2011-01-01 08:19:07.6 UTC
null
366,904
null
648,723
null
1
20
c#|wcf|objectdisposedexception
95,899
<p><code>Srv_LoginChannelFactory.Close()</code> is where it's being disposed. When you call close you are giving up whatever unmanaged resource you had. Attempting to do something other then inspecting its state or re-opening it results in the "Cannot access a disposed object" exception. </p> <p>This is true whenever ...
4,657,142
How do I encourage emacs to follow the compilation buffer
<p>Occasionally when I'm compiling, I have to scroll up my <em>compilation</em> buffer to see the details of an error. At this point, emacs stops "following" my compilation buffer, i.e., scrolling to automatically display new output. </p> <p>I'm using Aqumacs on OS X. Any idea how I can "reattach" or re encourage the ...
4,657,387
3
0
null
2011-01-11 11:32:39.343 UTC
4
2016-04-28 15:01:48.553 UTC
null
null
null
null
571,178
null
1
39
emacs
7,667
<p>I am not sure about aquamacs but for me (Emacs 23/Debian) I just go in the compilation window and place my cursor at the end of the window which will attach and follow (you can go to another window and it will still follow).</p>
4,139,532
Insert data into MySQL Database using javascript/AJAX
<p>I have made a very simple page using google maps API with several fields where users are going to put some data. It looks like following -</p> <p><a href="http://aiworker2.usask.ca/marker_field_db.html" rel="nofollow">http://aiworker2.usask.ca/marker_field_db.html</a></p> <p>What I want to do is store the data int...
4,139,625
4
0
null
2010-11-09 22:49:54.547 UTC
null
2012-10-11 06:28:33.66 UTC
null
null
null
null
400,859
null
1
2
javascript|jquery|ajax
42,810
<p>Your JavaScript runs on the client (in the browser). Your MySQL database exists on a server. </p> <p>In short, the client-side JavaScript cannot establish a <strong>direct</strong> connection to MySQL. You need to make an AJAX request to the server which runs a script that interacts with MySQL. The script can b...
14,596,499
iTunes Search Lookup for all a Developers Apps
<p>Is there a way to use the iTunes Lookup to show all of the apps a Developer has? Eg:</p> <pre><code>https://itunes.apple.com/lookup?devid=123 </code></pre> <p>I also tried:</p> <pre><code>http://itunes.apple.com/search?media=software&amp;term=Developer Name </code></pre> <p>But that didn't work either. Ideas?</p...
14,596,622
2
0
null
2013-01-30 04:04:37.11 UTC
8
2015-11-25 18:00:37.983 UTC
2015-11-25 18:00:37.983 UTC
null
1,505,120
null
144,695
null
1
5
ios|iphone|itunes
3,017
<p>To get the details of a developer,</p> <pre><code>https://itunes.apple.com/lookup?id=514675684 </code></pre> <p>To get all apps by that developer,</p> <pre><code>https://itunes.apple.com/lookup?id=514675684&amp;entity=software </code></pre> <p>To get the apps based on localization,</p> <pre><code>https://itunes...
4,500,198
Suppress warning on unused exception variable in C#
<p>I have this code:</p> <pre><code>try { someMethod(); } catch (XYZException e) { // do something without using e } </code></pre> <p>Doing this will give me a warning about declaring but never using <code>e</code>, which I hate. However, I also don't want to use a <code>catch</code> clause without that varia...
4,500,222
4
1
null
2010-12-21 14:17:13.96 UTC
5
2020-01-23 10:21:00.6 UTC
2010-12-21 14:45:31.82 UTC
null
25,727
null
48,648
null
1
50
c#|visual-studio-2008|exception-handling
14,421
<p>Define the catch clause without the exception variable as follows:</p> <pre><code>try { someMethod(); } catch (XYZException) { // do something without using e } </code></pre>
4,263,339
Installing Android Market App on Emulator
<p>I want to install android Market App on Emulator, so that I can browse and install various free apps on emulators.</p> <p>Can you guide me how to do this?</p>
4,755,642
5
2
null
2010-11-24 04:01:17.03 UTC
10
2020-12-28 01:50:07.847 UTC
2020-12-28 01:50:07.847 UTC
null
1,783,163
null
395,661
null
1
10
android
18,626
<p>Android market application cannot be directly downloaded to a computer. But there may be some alternative sites that provide the .apk file of the application. Search in Google. If you got that .apk file downloaded in your system, you can easily install that by the following steps. I usually do like this.</p> <ul> <...