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
1,915,829
Learning C when you already know C++?
<p>I think I have an advanced knowledge of C++, and I'd like to learn C.</p> <p>There are a lot of resources to help people going from C to C++, but I've not found anything useful to do the opposite of that. </p> <p>Specifically:</p> <ol> <li>Are there widely used general purpose libraries every C programmer should ...
1,917,084
10
0
null
2009-12-16 16:25:30.187 UTC
16
2014-02-18 17:50:12.723 UTC
2014-02-18 17:50:12.723 UTC
null
191,367
null
191,367
null
1
22
c++|c
15,137
<p>There's a lot here already, so maybe this is just a minor addition but here's what I find to be the biggest differences.</p> <p>Library:</p> <ul> <li>I put this first, because this in my opinion this is the biggest difference in practice. The C standard library is very(!) sparse. It offers a bare minimum of serv...
2,108,503
Code Sign error: The identity 'iPhone Developer' doesn't match any valid certificate/private key pair in the default keychain
<p>How do you fix this <strong>XCode error</strong> :</p> <blockquote> <p>Code Sign error: The identity 'iPhone Developer' doesn't match any valid certificate/private key pair in the default keychain</p> </blockquote>
4,453,252
12
7
null
2010-01-21 10:43:33.917 UTC
17
2013-06-10 11:08:16.793 UTC
2013-06-10 11:08:16.793 UTC
null
1,603,072
null
210,188
null
1
77
iphone
114,679
<p>This happens if you forgot to change your build settings to <code>Simulator</code>. Unless you want to build to a device, in which case you should see the other answers.</p>
8,765,879
how to limit foreach loop to three loops
<p>how to limit this loop ..just thee loops..thanks for helping</p> <pre><code>&lt;?php foreach($section['Article'] as $article) : ?&gt; &lt;tr&gt; &lt;td&gt; &lt;?php if ($article['status'] == 1) { echo $article['title']; } ?&gt; &lt;/td&gt; &lt...
8,765,910
6
2
null
2012-01-06 23:35:30.077 UTC
14
2019-08-01 09:11:39.227 UTC
2012-08-01 07:50:16.447 UTC
null
367,456
null
1,080,247
null
1
21
php
98,298
<p>Slice the array.</p> <pre><code>foreach(array_slice($section['Article'], 0, 3) as $article ): </code></pre>
8,486,414
Check image dimensions (height and width) before uploading image using PHP
<p>How can I check for height and width before uploading image, using PHP.</p> <p>Must I upload the image first and use "getimagesize()"? Or can I check this before uploading it using PHP?</p> <pre><code>&lt;?php foreach ($_FILES["files"]["error"] as $key =&gt; $error) { if( $error == UPLOAD_ERR_OK &amp;&amp; $_FILE...
8,486,471
8
2
null
2011-12-13 08:49:57.243 UTC
5
2016-07-01 08:45:52.44 UTC
null
null
null
null
673,108
null
1
30
php|image|file-upload|dimensions
96,611
<p>You need something that is executed on the client before the actual upload happens.<br> With (server-side) php you can check the dimension only after the file has been uploaded or with <a href="https://www.ibm.com/developerworks/library/os-php-v525/" rel="nofollow">upload hooks</a> <em>maybe</em> while the image is ...
46,562,561
Apollo/GraphQL field type for object with dynamic keys
<p>Let's say my graphql server wants to fetch the following data as JSON where <code>person3</code> and <code>person5</code> are some id's:</p> <pre><code>"persons": { "person3": { "id": "person3", "name": "Mike" }, "person5": { "id": "person5", "name": "Lisa" } } </code></pre> <p><strong>Ques...
46,563,788
3
4
null
2017-10-04 10:24:38.057 UTC
7
2021-07-26 01:58:06.76 UTC
2017-10-04 11:09:47.073 UTC
null
3,210,677
null
3,210,677
null
1
45
graphql|apollo|apollo-server
28,772
<p>GraphQL relies on both the server and the client knowing ahead of time what fields are available available for each type. In some cases, the client can discover those fields (via introspection), but for the server, they always need to be known ahead of time. So to somehow dynamically generate those fields based on t...
18,163,404
spring mvc date format with form:input
<p>I have hibernate entity and a bean:</p> <pre><code>@Entity public class GeneralObservation { @DateTimeFormat(pattern = "dd/MM/yyyy") Date date; @Column public Date getDate() { return date; } public void setDate(Date date) { this.date = date; } } </code></pre> <p>also I...
18,686,172
4
6
null
2013-08-10 15:30:07.087 UTC
9
2014-11-19 20:16:34.293 UTC
2013-08-11 00:38:41.917 UTC
null
1,941,151
null
517,073
null
1
20
java|spring|spring-mvc|jpa|jstl
91,216
<p>The solution is to put<br> <code>&lt;mvc:annotation-driven/&gt;</code> to mvc-dispatcher-servlet.xml and also xmlns:mvc="http://www.springframework.org/schema/mvc" to the begining of xml file.</p>
18,014,834
How to make line with rounded (smooth) corners with AndroidPlot
<p>I have a small problem with ploting my graph. On a picture below is what I have already done.</p> <hr> <p>The graph should represent the actual signal strength of available Wi-Fi network(s). It's a simple <code>XYPlot</code> here data are represented with <code>SimpleXYSeries</code> (values are dynamically created...
18,353,513
6
3
null
2013-08-02 10:35:05.317 UTC
8
2021-08-17 03:51:23.017 UTC
2014-02-01 13:54:01.397 UTC
null
63,550
null
1,331,415
null
1
11
android|androidplot
16,503
<p>You can use <a href="http://developer.android.com/reference/android/graphics/Path.html#cubicTo%28float,%20float,%20float,%20float,%20float,%20float%29" rel="nofollow noreferrer">Path.cubicTo()</a> method. It draws a line using cubic spline algorithm which results in the smoothing effect you want.</p> <p>Checkout th...
17,818,167
Find a Pull Request on GitHub where a commit was originally created
<p>Pull Requests are great for understanding the larger thinking around a change or set of changes made to a repo. Reading pull requests are a great way to quickly "grok" a project as, instead of small atomic changes to the source, you get larger groupings of logical changes. Analogous to organizing the lines in your c...
25,914,885
7
1
null
2013-07-23 18:28:19.717 UTC
40
2022-05-12 10:43:40.283 UTC
2021-01-09 03:20:20.31 UTC
null
1,402,846
null
92,694
null
1
245
git|github|pull-request
80,270
<p><strike>You can just go to GitHub and enter the SHA into the search bar, make sure you select the &quot;Issues&quot; link on the left.</strike></p> <p><strong>UPDATED 13 July 2017</strong></p> <p>Via the GitHub UI there is a now a really easy way to do this. If you are looking at a commit in the list of commits in a...
18,099,653
Removing everything except numbers in a string
<p>I've made a small calculator in javascript where users enter the interest rate and amount the they want to borrow, and it calculates how much of an incentive they might get.</p> <p>The problem is that I'm worried users will enter symbols, e.g. </p> <blockquote> <p>Loan amount: £360,000 - Interest Rate: 4.6%</p>...
18,099,759
7
4
null
2013-08-07 09:27:19.26 UTC
3
2021-06-09 09:14:35.583 UTC
2016-05-19 01:02:04.653 UTC
null
5,818,631
null
2,660,049
null
1
55
javascript|regex
59,097
<p>Note that you should use the correct DOM id to refer via getElementById. You can use the <a href="http://www.w3schools.com/jsref/jsref_replace.asp" rel="noreferrer">.replace()</a> method for that:</p> <pre><code>var loan_amt = document.getElementById('loan_amt'); loan_amt.value = loan_amt.value.replace(/[^0-9]/g, '...
6,828,124
How to find user control of an ASP.NET page inside of event of another user control on that ASP.NET page EDIT: different content placeholders?
<p>I have a ASP.NET page with 2 user controls registered. The first one has only one button in it. The second one is simple text and hidden on default. What I want is to make the second one visible when the button in the first one is clicked (that is on button click event). </p> <p>ASP.NET page:</p> <pre><code>&lt;%@...
6,844,214
4
0
null
2011-07-26 09:42:44.207 UTC
null
2017-03-21 03:59:02.533 UTC
2011-07-27 09:51:02.81 UTC
null
672,630
null
672,630
null
1
3
asp.net|user-controls|findcontrol|contentplaceholder
42,381
<p>Ok I found solution until better one comes my way. The problem is, as Jamie Dixon pointed out (thank you Jamie):</p> <p><em><code>The FindControl method does not do a deep search for controls. It looks directly in the location you specify for the control you're requesting.</code></em></p> <p>So because I have user...
57,030,018
React context with hooks prevent re render
<p>I use React context with hooks as a state manager for my React app. Every time the value changes in the store, all the components re-render. </p> <p>Is there any way to prevent React component to re-render?</p> <p>Store config:</p> <pre><code>import React, { useReducer } from "react"; import rootReducer from "./r...
57,031,877
4
3
null
2019-07-14 18:20:54.643 UTC
10
2020-04-14 15:09:57.177 UTC
2019-07-14 23:57:56.693 UTC
null
9,886,585
null
9,886,585
null
1
19
javascript|reactjs|react-native|react-context
23,273
<p>I believe what is happening here is expected behavior. The reason it renders twice is because you are automatically grabbing a new book/user when you visit the book or user page respectively.</p> <p>This happens because the page loads, then <code>useEffect</code> kicks off and grabs a book or user, then the page n...
39,990,017
Should I commit the yarn.lock file and what is it for?
<p>Yarn creates a <code>yarn.lock</code> file after you perform a <code>yarn install</code>. </p> <p>Should this be committed to the repository or ignored? What is it for?</p>
39,992,365
9
4
null
2016-10-12 03:24:53.737 UTC
60
2022-03-21 10:33:22.487 UTC
2016-11-23 18:13:55.17 UTC
null
6,650,102
null
1,403,314
null
1
498
yarnpkg
185,323
<p>Yes, you should check it in, see <a href="https://yarnpkg.com/en/docs/migrating-from-npm" rel="noreferrer">Migrating from npm</a></p> <p><strong>What is it for?</strong><br> The npm client installs dependencies into the <code>node_modules</code> directory non-deterministically. This means that based on the order dep...
27,480,134
Inserting Date() in to Mongodb through mongo shell
<p>I am inserting document through following query: </p> <pre><code>db.collection.insert( { date: Date('Dec 12, 2014 14:12:00') }) </code></pre> <p>But it will give me an error. </p> <p>How can I insert a date in my collection without getting an error?</p>
27,480,559
2
2
null
2014-12-15 08:40:10.683 UTC
4
2018-05-21 07:57:46.487 UTC
2018-05-21 07:57:46.487 UTC
null
4,015,870
null
3,528,347
null
1
16
javascript|mongodb|mongodb-query
39,611
<p>You must be getting a different error as the code above will result in the <code>Date()</code> method returning the current date as a string, regardless of the arguments supplied with the object. From the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date" rel="noreferrer"...
27,613,310
Rounding selected columns of data.table
<p>I have following data and code to round selected columns of this data.table:</p> <pre><code>mydf = structure(list(vnum1 = c(0.590165705411504, -1.39939534199836, 0.720226053660755, -0.253198380120377, -0.783366825121657), vnum2 = c(0.706508400384337, 0.526770398486406, 0.863136084517464, 0.838245498016477, 0.55677...
27,613,444
9
4
null
2014-12-23 02:35:26.207 UTC
14
2022-09-19 08:43:33.493 UTC
2022-09-19 08:43:33.493 UTC
null
5,784,757
null
3,522,130
null
1
47
r|data.table
92,741
<p>If you don't mind overwriting your original <code>mydf</code>:</p> <pre><code>cols &lt;- names(mydf)[1:2] mydf[,(cols) := round(.SD,1), .SDcols=cols] mydf # vnum1 vnum2 vch1 #1: 0.6 0.7 B #2: -1.4 0.5 E #3: 0.7 0.9 A #4: -0.3 0.8 C #5: -0.8 0.6 C </code></pre>
723,791
What are best practices for self-updating PHP+MySQL applications?
<p>It is pretty standard practice now for desktop applications to be self-updating. On the Mac, every non-Apple program that uses <a href="http://sparkle.andymatuschak.org/" rel="noreferrer">Sparkle</a> in my book is an instant win. For Windows developers, <a href="https://stackoverflow.com/questions/232347/how-should-...
723,855
7
2
null
2009-04-07 00:58:47.343 UTC
12
2012-05-23 10:26:00.7 UTC
2017-05-23 12:25:51.337 UTC
null
-1
null
53,182
null
1
29
php|mysql|security|upgrade
8,144
<p>Frankly, it really does depend on your userbase. There are tons of PHP applications that don't automatically upgrade themselves. Their users are either technical enough to handle the upgrade process, or just don't upgrade.</p> <p>I purpose two steps:</p> <p>1) Seriously ask yourself what your users are likely to...
544,450
Detecting honest web crawlers
<p>I would like to detect (on the server side) which requests are from bots. I don't care about malicious bots at this point, just the ones that are playing nice. I've seen a few approaches that mostly involve matching the user agent string against keywords like 'bot'. But that seems awkward, incomplete, and unmaint...
544,485
7
0
null
2009-02-13 01:55:33.483 UTC
43
2022-08-08 15:08:28.853 UTC
2013-01-26 11:03:21.617 UTC
null
569,101
CynicalTyler
9,304
null
1
44
c#|web-crawler|bots
20,022
<p>You can find a very thorough database of data on known "good" web crawlers in the robotstxt.org <a href="http://www.robotstxt.org/db.html" rel="noreferrer">Robots Database</a>. Utilizing this data would be far more effective than just matching <em>bot</em> in the user-agent.</p>
115,850
What pre-existing services exist for calculating distance between two addresses?
<p>I'd like to implement a way to display a list of stored addresses sorted by proximity to a given address.</p> <p>Addresses in the list will be stored in a database table. Separate parts have separate fields (we have fields for postal code, city name, etc.) so it is not just a giant <code>varchar</code>. These are...
115,902
8
0
null
2008-09-22 16:19:54.363 UTC
10
2009-06-08 20:58:11.983 UTC
2009-06-08 20:58:11.983 UTC
Yadyn
7,290
Yadyn
7,290
null
1
12
algorithm|geolocation|distance
10,375
<p><a href="http://code.google.com/apis/maps/documentation/services.html#Geocoding" rel="noreferrer">Google</a> and <a href="http://developer.yahoo.com/maps/rest/V1/geocode.html" rel="noreferrer">Yahoo!</a> both provide geocoding services for free. You can calculate distance using the <a href="http://en.wikipedia.org/...
718,479
What is the best way to produce a tilde in LaTeX for a website?
<p>Following the <a href="https://stackoverflow.com/questions/682201/latex-tildes-and-verbatim-mode">previous questions</a> on this topic, when you produce a website in LaTeX what is the best way to produce a url that contains a tilde? <code>\verb</code> produces the upper tilde that does not read well, and <code>$\sim...
718,484
9
1
null
2009-04-05 06:43:54.847 UTC
2
2021-06-05 17:10:01.23 UTC
2017-05-23 12:34:24.807 UTC
null
-1
vgm64
51,532
null
1
14
latex|tilde
39,267
<p>I'd look at the <a href="http://www.ctan.org/tex-archive/help/Catalogue/entries/url.html" rel="noreferrer"><code>url</code> package</a>.</p>
230,407
What is the unix command to see how much disk space there is and how much is remaining?
<p>I'm looking for the equivalent of right clicking on the drive in windows and seeing the disk space used and remaining info.</p>
230,412
10
0
null
2008-10-23 16:26:24.32 UTC
5
2018-12-24 09:16:22.657 UTC
2008-10-23 17:08:25.187 UTC
Alex B
6,180
Brian
700
null
1
22
unix|aix|diskspace
141,534
<p>Look for the commands <code>du</code> (disk usage) and <code>df</code> (disk free)</p>
177,514
Good XMPP Java Libraries for server side?
<p>I was hoping to implement a simple XMPP server in Java. </p> <p>What I need is a library which can parse and understand xmpp requests from a client. I have looked at Smack (mentioned below) and JSO. Smack appears to be client only so while it might help parsing packets it doesn't know how to respond to clients. I...
177,581
10
4
null
2008-10-07 07:43:22.01 UTC
38
2015-12-02 13:39:01.14 UTC
2012-05-04 12:49:09.217 UTC
Taylor Gautier
1,288
Taylor Gautier
19,013
null
1
63
java|xmpp
49,916
<p><a href="http://xmpp.org/xmpp-software/libraries/" rel="noreferrer">http://xmpp.org/xmpp-software/libraries/</a> has a list of software libraries for XMPP. Here is an <em>outdated</em> snapshot of it:</p> <p><h3>ActionScript</h3> </p> <ul> <li><a href="http://code.google.com/p/as3xmpp/" rel="noreferrer">as3xmpp</...
1,147,706
how to hide status bar when splash screen appears in iphone?
<p>Is there a way to hide the status bar when showing splash screen in iPhone and then show again in application?</p>
1,147,732
10
0
null
2009-07-18 14:40:28.267 UTC
28
2021-10-13 06:58:01.297 UTC
2021-10-13 06:58:01.297 UTC
null
16,439,658
null
83,905
null
1
85
objective-c|iphone|xcode|splash-screen|statusbar
49,676
<p>I'm pretty sure that if your Info.plist file has the <code>Status bar is initially hidden</code> value set to <code>YES</code>, then it won't show while your application is loading. Once your application has loaded, you can re-show the status bar using UIApplication's <code>setStatusBarHidden:animated:</code> metho...
970,198
How to mock the Request on Controller in ASP.Net MVC?
<p>I have a controller in C# using the ASP.Net MVC framework</p> <pre><code>public class HomeController:Controller{ public ActionResult Index() { if (Request.IsAjaxRequest()) { //do some ajaxy stuff } return View("Index"); } } </code></pre> <p>I got some tips on mockin...
970,272
10
3
null
2009-06-09 13:51:01.17 UTC
48
2021-05-16 11:26:34.047 UTC
2009-06-09 18:09:35.98 UTC
null
85,231
null
85,231
null
1
184
asp.net-mvc|unit-testing|mocking|rhino-mocks|moq
96,226
<p>Using <a href="https://github.com/Moq/moq4" rel="noreferrer">Moq</a>:</p> <pre><code>var request = new Mock&lt;HttpRequestBase&gt;(); // Not working - IsAjaxRequest() is static extension method and cannot be mocked // request.Setup(x =&gt; x.IsAjaxRequest()).Returns(true /* or false */); // use this request.SetupGe...
469,798
Konami Code in C#
<p>I am looking to have a C# application implement the Konami Code to display an Easter Egg. <a href="http://en.wikipedia.org/wiki/Konami_Code" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Konami_Code</a></p> <p>What is the best way to do this?</p> <p>This is in a standard C# windows forms app.</p>
469,970
11
2
null
2009-01-22 16:17:17.74 UTC
16
2016-11-26 01:33:29.083 UTC
2015-06-12 12:42:22.257 UTC
Sam Meldrum
1,015,495
Anthony D
52,622
null
1
24
c#|.net|winforms
9,531
<p>In windows forms I would have a class that knows what the sequence is and holds the state of where you are in the sequence. Something like this should do it.</p> <pre><code>using System; using System.Collections.Generic; using System.Windows.Forms; namespace WindowsFormsApplication3 { public class KonamiSequen...
1,030,782
The benefits and advantages of being a jack of all trades programmer?
<p>I've been doing web dev for 10 years now, mostly the MS stack but some LAMP as well. There are so many choices these days for programmers and the job market seems to be all over the place. </p> <p>Before I dive into some new technology once again I was hoping to get some perspective from others in regards to addi...
1,032,507
12
4
2009-06-23 05:42:45.44 UTC
2009-06-23 05:42:45.44 UTC
11
2017-10-20 09:00:09.917 UTC
2009-06-23 05:44:39.057 UTC
null
61,027
null
110,897
null
1
10
language-agnostic
5,330
<p>Here are some thoughts on the benefits of having diverse experience in the field of programming:</p> <ul> <li><strong>Each language and technology offers an opportunity to learn a different approach to problem solving.</strong> Having different problem solving techniques in your toolset is an invaluable way to stay...
34,249
Best algorithm to test if a linked list has a cycle
<p>What's the best (halting) algorithm for determining if a linked list has a cycle in it?</p> <p>[Edit] Analysis of asymptotic complexity for both time and space would be sweet so answers can be compared better.</p> <p>[Edit] Original question was not addressing nodes with outdegree > 1, but there's some talk about ...
34,255
12
2
null
2008-08-29 09:30:05.51 UTC
22
2022-03-25 10:18:55.68 UTC
2011-10-18 17:18:38.86 UTC
cdleary
976,554
cdleary
3,594
null
1
32
algorithm|data-structures|linked-list
20,671
<p>Have two pointers iterating through the list; make one iterate through at twice the speed of the other, and compare their positions at each step. Off the top of my head, something like:</p> <pre><code>node* tortoise(begin), * hare(begin); while(hare = hare-&gt;next) { if(hare == tortoise) { throw std::logic_er...
91,688
What are the differences between a clustered and a non-clustered index?
<p>What are the differences between a <code>clustered</code> and a <code>non-clustered index</code>?</p>
91,725
13
7
null
2008-09-18 11:14:23.283 UTC
116
2021-07-20 07:11:28.597 UTC
2018-03-23 07:05:10.277 UTC
Nigel Campbell
3,876,565
Eric Labashosky
6,522
null
1
304
sql-server|indexing|clustered-index|non-clustered-index
293,703
<p>Clustered Index</p> <ul> <li>Only one per table</li> <li>Faster to read than non clustered as data is physically stored in index order</li> </ul> <p>Non Clustered Index</p> <ul> <li>Can be used many times per table</li> <li>Quicker for insert and update operations than a clustered index</li> </ul> <p>Both types ...
1,117,916
Merge keys array and values array into an object in JavaScript
<p>I have:</p> <pre><code>var keys = [ "height", "width" ]; var values = [ "12px", "24px" ]; </code></pre> <p>And I'd like to convert it into this object:</p> <pre><code>{ height: "12px", width: "24px" } </code></pre> <p>In Python, there's the simple idiom <code>dict(zip(keys,values))</code>. Is there something sim...
1,117,927
13
1
null
2009-07-13 06:18:22.393 UTC
15
2021-08-26 13:55:42.383 UTC
2020-05-15 03:13:16.187 UTC
null
6,904,888
null
7,581
null
1
49
javascript|json|object
42,912
<p>Simple JS function would be:</p> <pre><code>function toObject(names, values) { var result = {}; for (var i = 0; i &lt; names.length; i++) result[names[i]] = values[i]; return result; } </code></pre> <p>Of course you could also actually implement functions like zip, etc as JS supports higher or...
57,923
What exactly is "managed" code?
<p>I've been writing C / C++ code for almost twenty years, and I know Perl, Python, PHP, and some Java as well, and I'm teaching myself JavaScript. But I've never done any .NET, VB, or C# stuff. What exactly does <strong>managed</strong> code mean?</p> <p>Wikipedia <a href="http://en.wikipedia.org/wiki/Managed_code" r...
57,945
15
2
null
2008-09-11 23:38:58.157 UTC
10
2016-09-13 20:56:08.813 UTC
2016-05-21 08:35:41.403 UTC
Cristi&#225;n Romo
5,104,596
Graeme
1,821
null
1
57
c#|.net|vb.net|managed-code
25,298
<p>When you compile C# code to a .exe, it is compiled to Common Intermediate Language(CIL) bytecode. Whenever you run a CIL executable it is executed on Microsofts Common Language Runtime(CLR) virtual machine. So no, it is not possible to include the VM withing your .NET executable file. You must have the .NET runtime ...
343,368
error LNK2005: _DllMain@12 already defined in MSVCRT.lib
<p>I am getting this linker error.</p> <blockquote> <p><strong>mfcs80.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MSVCRT.lib(dllmain.obj)</strong></p> </blockquote> <p>Please tell me the correct way of eliminating this bug. I read solution on microsoft support site about this bug but it didnt ...
343,467
17
0
null
2008-12-05 10:01:43.533 UTC
7
2021-11-10 04:53:23.443 UTC
2015-07-08 10:20:49.76 UTC
null
3,383,213
mahesh
38,038
null
1
38
c++|visual-c++|linker
56,573
<p>If you read the linker error thoroughly, and apply some knowledge, you may get there yourself:</p> <p>The linker links a number of compiled objects and libraries together to get a binary.</p> <p>Each object/library describes</p> <ul> <li>what symbols it expects to be present in other objects</li> <li>what symbols...
242,822
Why would someone use WHERE 1=1 AND <conditions> in a SQL clause?
<p>Why would someone use <code>WHERE 1=1 AND &lt;conditions&gt;</code> in a SQL clause (Either SQL obtained through concatenated strings, either view definition)</p> <p>I've seen somewhere that this would be used to protect against SQL Injection, but it seems very weird.</p> <p>If there is injection <code>WHERE 1 = 1...
242,831
21
2
null
2008-10-28 10:37:04.78 UTC
84
2021-06-03 11:33:23.747 UTC
2011-11-17 02:38:53.427 UTC
Thomas Owens
54,680
Bogdan Maxim
23,795
null
1
304
sql|dynamic-sql
251,404
<p>If the list of conditions is not known at compile time and is instead built at run time, you don't have to worry about whether you have one or more than one condition. You can generate them all like:</p> <pre><code>and &lt;condition&gt; </code></pre> <p>and concatenate them all together. With the <code>1=1</code> ...
365,191
How to get time difference in minutes in PHP
<p>How to calculate minute difference between two date-times in PHP?</p>
365,214
21
0
null
2008-12-13 13:05:25.16 UTC
72
2021-11-30 17:11:20.717 UTC
2012-07-21 07:58:41.5 UTC
null
812,149
tomaszs
38,940
null
1
327
php|date|time|minute
702,456
<p>Subtract the past most one from the future most one and divide by 60. </p> <p>Times are done in Unix format so they're just a big number showing the number of seconds from <code>January 1, 1970, 00:00:00 GMT</code></p>
34,833,653
filter spark dataframe with row field that is an array of strings
<p>Using Spark 1.5 and Scala 2.10.6</p> <p>I'm trying to filter a dataframe via a field "tags" that is an array of strings. Looking for all rows that have the tag 'private'.</p> <pre><code>val report = df.select("*") .where(df("tags").contains("private")) </code></pre> <p>getting:</p> <blockquote> <p>Exception...
34,843,830
2
5
null
2016-01-17 00:14:14.99 UTC
3
2017-02-09 23:41:16.403 UTC
2016-01-17 16:11:04.92 UTC
null
7,223
null
7,223
null
1
19
scala|apache-spark
45,976
<p>I think if you use <code>where(array_contains(...))</code> it will work. Here's my result:</p> <pre><code>scala&gt; import org.apache.spark.SparkContext import org.apache.spark.SparkContext scala&gt; import org.apache.spark.sql.DataFrame import org.apache.spark.sql.DataFrame scala&gt; def testData (sc: SparkConte...
6,426,142
How to append a string to each element of a Bash array?
<p>I have an array in Bash, each element is a string. How can I append another string to each element? In Java, the code is something like:</p> <pre><code>for (int i=0; i&lt;array.length; i++) { array[i].append("content"); } </code></pre>
6,426,365
4
1
null
2011-06-21 13:35:45.18 UTC
13
2019-01-17 07:00:20.953 UTC
2015-07-06 19:32:33.847 UTC
null
1,245,190
null
486,720
null
1
55
arrays|bash
54,679
<p>Tested, and it works:</p> <pre><code>array=(a b c d e) cnt=${#array[@]} for ((i=0;i&lt;cnt;i++)); do array[i]="${array[i]}$i" echo "${array[i]}" done </code></pre> <p>produces:</p> <pre><code>a0 b1 c2 d3 e4 </code></pre> <p>EDIT: declaration of the <code>array</code> could be shortened to</p> <pre><code...
6,918,623
CURLOPT_FOLLOWLOCATION cannot be activated
<p>So I keep getting this annoying error on multiple servers(its a warning, so I'd ignore it, but I need the function)</p> <blockquote> <p>Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set in /home/xxx/public_html/xxx.php on...
6,918,685
5
1
null
2011-08-02 21:06:57.67 UTC
3
2016-01-26 20:32:37.38 UTC
2013-03-13 08:43:34.853 UTC
null
367,456
null
810,304
null
1
16
curl|php
97,133
<p>Set <code>safe_mode = Off</code> in your php.ini file (it's usually in /etc/ on the server). If that's already off, then look around for the <code>open_basedir</code> stuff in the php.ini file, and change it accordingly.</p> <p>Basically, the follow location option has been disabled as a security measure, but PHP's...
6,647,783
Check value of least significant bit (LSB) and most significant bit (MSB) in C/C++
<p>I need to check the value of the least significant bit (LSB) and most significant bit (MSB) of an integer in C/C++. How would I do this?</p>
6,647,792
5
0
null
2011-07-11 08:52:55.043 UTC
11
2017-02-19 14:06:54.47 UTC
2012-12-20 06:43:22.313 UTC
null
922,184
null
554,785
null
1
27
c++|c|integer|bit-manipulation|bit
98,291
<pre><code>//int value; int LSB = value &amp; 1; </code></pre> <p>Alternatively <em>(which is not theoretically portable, but practically it is - see Steve's comment)</em></p> <pre><code>//int value; int LSB = value % 2; </code></pre> <p><strong><em>Details:</em></strong> The second formula is simpler. The % operat...
6,997,187
How to check for empty value in Javascript?
<p>I am working on a method of retrieving an array of hidden inputs in my form like so</p> <pre><code>&lt;input type="hidden" value="12:34:00" name="timetemp0"&gt; &lt;input type="hidden" value="14:45:00" name="timetemp1"&gt; &lt;input type="hidden" value="15:12:00" name="timetemp2"&gt; &lt;input type="hidden" value="...
6,997,562
6
4
null
2011-08-09 13:48:27.953 UTC
7
2022-06-12 13:23:42.53 UTC
2016-09-30 09:22:20.623 UTC
null
206,730
null
859,615
null
1
15
javascript|html|null
115,019
<p>Comment as an answer:</p> <pre><code>if (timetime[0].value) </code></pre> <p>This works because any variable in JS can be evaluated as a boolean, so this will generally catch things that are empty, null, or undefined.</p>
6,420,813
width of grid view boundfield
<p>I can not set the width of bound field. Is there any problem in the following markup. </p> <pre><code> &lt;asp:BoundField DataField="UserName" HeaderText="User Name" meta:resourcekey="BoundFieldUNCUserNameResource1"&gt; &lt;HeaderStyle Width="50%" /&gt; &lt;/as...
6,420,912
6
0
null
2011-06-21 05:39:16.517 UTC
6
2020-06-29 21:00:04.247 UTC
2013-12-06 05:26:27.167 UTC
null
1,459,996
null
767,445
null
1
21
asp.net|gridview|boundfield
62,579
<p>Try This:</p> <p><code>ItemStyle-Width="50%" ItemStyle-Wrap="false"</code> in the BoundField tag</p>
7,008,214
php string to int
<pre><code>$a = '88'; $b = '88 8888'; echo (int)$a; echo (int)$b; </code></pre> <p>as expected, both produce 88. Anyone know if there's a string to int function that will work for $b's value and produce 888888? I've googled around a bit with no luck.</p> <p>Thanks</p>
7,008,242
6
2
null
2011-08-10 08:58:57.057 UTC
2
2019-01-25 15:05:54.56 UTC
null
null
null
null
788,952
null
1
25
php|string|int
179,312
<p>You can remove the spaces before casting to <code>int</code>:</p> <pre><code>(int)str_replace(' ', '', $b); </code></pre> <p>Also, if you want to strip other commonly used digit delimiters (such as <code>,</code>), you can give the function an array (beware though -- in some countries, like mine for example, the c...
6,995,946
Log4J: How do I redirect an OutputStream or Writer to logger's writer(s)?
<p>I have a method which runs asynchronously after start, using OutputStream or Writer as parameter.</p> <p>It acts as a recording adapter for an OutputStream or Writer (<em>it's a third party API I can't change</em>).</p> <p><strong>How could I pass Log4J's internal OutputStream or Writer to that method?</strong><br...
6,996,147
7
4
null
2011-08-09 12:08:28.2 UTC
7
2022-02-16 10:07:48.793 UTC
2011-08-09 12:33:09.187 UTC
null
680,925
null
853,728
null
1
37
java|logging|log4j|outputstream|writer
47,238
<p>My suggestion is, why dont you write your OutputStream then?! I was about to write one for you, but I found this good example on the net, check it out!</p> <p><a href="https://web.archive.org/web/20130527080241/http://www.java2s.com/Open-Source/Java/Testing/jacareto/jacareto/toolkit/log4j/LogOutputStream.java.htm" ...
57,630,924
How many String objects would be created when concatenating multiple Strings?
<p>I was asked in an interview about the number of objects that will be created on the given problem:</p> <pre><code>String str1 = "First"; String str2 = "Second"; String str3 = "Third"; String str4 = str1 + str2 + str3; </code></pre> <p>I answered that there would be <strong>6 objects</strong> created in the string ...
57,631,217
7
7
null
2019-08-23 17:48:47.937 UTC
6
2019-08-28 10:04:10.273 UTC
2019-08-24 10:52:01.773 UTC
null
1,711,796
null
11,650,948
null
1
38
java|string|string-concatenation|string-pool|string-building
2,926
<p>Any answer to your question will depend on the JVM implementation and the Java version currently being used. I think it's an unreasonable question to ask in an interview.</p> <h2>Java 8</h2> <p>On my machine, with Java 1.8.0_201, your snippet results in this bytecode</p> <pre><code>L0 LINENUMBER 13 L0 LDC "Firs...
15,655,073
setTimeout and window.location (location.href) not working
<p>I want to redirect user to index.php in 5 seconds, but it redirects me right away. I don't want to use jQuery in this simple code.</p> <pre><code>&lt;script&gt; setTimeout(function(){location.href="index.php", 5000} ); &lt;/script&gt; </code></pre>
15,655,220
3
3
null
2013-03-27 09:06:34.237 UTC
1
2018-10-29 14:12:10.233 UTC
2013-03-27 09:12:43.66 UTC
null
2,118,700
null
1,860,890
null
1
14
javascript
70,968
<p>This is the right way...</p> <pre><code>setTimeout(function(){location.href="index.php"} , 5000); </code></pre> <p>You can check the docs here:</p> <p><a href="https://developer.mozilla.org/en/docs/DOM/window.setTimeout" rel="noreferrer">https://developer.mozilla.org/en/docs/DOM/window.setTimeout</a></p> <p><...
10,650,528
Access to path **** is denied
<p>I know there is a ton of stuff on this already and have tried a few things but have had no luck in fixing it. </p> <p>I have a C# program that has built an XML Document and im trying to save it to a folder thats in MyDocuments. I am getting the folliwing exception when calling the <code>XMLDoc.Save</code> function....
10,651,042
5
4
null
2012-05-18 09:59:52.247 UTC
null
2016-06-28 09:12:48.957 UTC
2016-06-28 09:12:48.957 UTC
null
975,520
null
589,195
null
1
8
c#
38,814
<p>There are a few possibilities:</p> <ul> <li>ConfigOutput is a folder</li> <li>ConfigOutput is a file that is in use (opened)</li> <li>You're not logged in as User 'Ash'</li> </ul> <p>You should not normally have to run as Admin to write to your own Documents folder. </p>
10,474,306
What's the main benefit of using eval() in JavaScript?
<p>I know this may be a newbie question, but I'm curious as to the main benefit of <code>eval()</code> - where would it be used best? I appreciate any info.</p>
10,474,424
15
5
null
2012-05-06 21:06:11.143 UTC
11
2019-12-24 10:10:35.56 UTC
2012-05-06 21:30:12.957 UTC
null
763,029
null
763,029
null
1
51
javascript|eval
43,347
<p>The <code>eval</code> function is best used: Never.</p> <p>It's purpose is to evaluate a string as a Javascript expression. Example:</p> <pre><code>eval('x = 42'); </code></pre> <p>It has been used a lot before, because a lot of people didn't know how to write the proper code for what they wanted to do. For examp...
31,715,310
Convert timestamp string to long in java
<p>I have to fetch time stamp from DB and retrieve only time and compare two time.</p> <p>//below are the string values</p> <pre><code> String st1 = "2015-07-24T09:39:14.000Z"; String st2 = "2015-07-24T09:45:44.000Z"; </code></pre> <p>//retrieving only time <strong>09:39:14</strong></p> <pre><code> String s ...
31,715,446
6
3
null
2015-07-30 04:43:18.597 UTC
1
2019-03-21 00:26:14.62 UTC
2019-03-21 00:26:14.62 UTC
null
4,257,225
null
4,257,225
null
1
8
java|string|numberformatexception
53,470
<p>Another option is by using SimpleDateFormat (May not be the best compare to JODA Time)</p> <pre><code>public static void main(String[] args) throws ParseException { String st1 = "2015-07-24T09:39:14.000Z"; String st2 = "2015-07-24T09:45:44.000Z"; String time1 = st1.substring(st1.indexOf("T"...
10,312,521
How do I fetch all Git branches?
<p>I cloned a Git repository containing many branches. However, <code>git branch</code> only shows one:</p> <pre><code>$ git branch * master </code></pre> <p>How would I pull all the branches locally so when I do <code>git branch</code>, it shows the following?</p> <pre><code>$ git branch * master * staging * etc... </...
10,312,587
36
10
null
2012-04-25 09:05:26.403 UTC
695
2022-08-06 10:04:49.363 UTC
2022-07-17 00:46:35.037 UTC
null
365,102
null
651,174
null
1
2,096
git|branch|git-branch
2,226,135
<h3>TL;DR answer</h3> <pre class="lang-sh prettyprint-override"><code>git branch -r | grep -v '\-&gt;' | sed &quot;s,\x1B\[[0-9;]*[a-zA-Z],,g&quot; | while read remote; do git branch --track &quot;${remote#origin/}&quot; &quot;$remote&quot;; done git fetch --all git pull --all </code></pre> <p>(It seems that pull fetch...
33,961,756
Disabling Pylint no member- E1101 error for specific libraries
<p>Is there anyway to hide <code>E1101</code> errors for objects that are created from a specific library? Our large repository is littered with <code>#pylint: disable=E1101</code> around various objects created by pandas.</p> <p>For example, pylint will throw a no member error on the following code:</p> <pre><code>...
35,106,735
3
5
null
2015-11-27 16:48:01.087 UTC
5
2019-06-21 09:02:22.927 UTC
2015-11-27 22:24:23.797 UTC
null
1,064,197
null
1,064,197
null
1
42
pandas|pylint
22,515
<p>You can mark their attributes as dynamically generated using <code>generated-members</code> option.</p> <p>E.g. for pandas:</p> <pre><code>generated-members=pandas.* </code></pre>
22,736,641
XOR on two lists in Python
<p>I'm a beginner in Python, and I have to do the XOR between two lists (the first one with the length : 600 and the other 60)</p> <p>I really don't know how to do that, if somebody can explain me how, it will be a pleasure.</p> <p>I have to do that to find the BPSK signal module, and I'm wondering on how doing that ...
22,736,711
2
2
null
2014-03-29 20:42:08.503 UTC
1
2014-03-30 00:24:11.62 UTC
2017-05-23 12:06:48.517 UTC
null
-1
user3464216
null
null
1
18
python|list|python-2.7|xor
47,015
<p>Given sequences <code>seq1</code> and <code>seq2</code>, you can calculate the <a href="http://docs.python.org/2/library/stdtypes.html#set.symmetric_difference" rel="noreferrer">symmetric difference</a> with</p> <pre><code>set(seq1).symmetric_difference(seq2) </code></pre> <p>For example,</p> <pre><code>In [19]: ...
22,715,086
Scheduling Python Script to run every hour accurately
<p>Before I ask, <strong>Cron Jobs and Task Scheduler</strong> will be my last options, this script will be used across Windows and Linux and I'd prefer to have a coded out method of doing this than leaving this to the end user to complete.</p> <p>Is there a library for Python that I can use to schedule tasks? I will n...
22,715,345
14
3
null
2014-03-28 14:05:37.127 UTC
75
2022-07-12 20:05:58.59 UTC
2020-06-20 09:12:55.06 UTC
null
-1
null
2,453,153
null
1
90
python|python-3.x|cron|scheduled-tasks|cron-task
200,171
<p>Maybe this can help: <a href="http://apscheduler.readthedocs.io/" rel="noreferrer">Advanced Python Scheduler</a></p> <p>Here's a small piece of code from their documentation:</p> <pre><code>from apscheduler.schedulers.blocking import BlockingScheduler def some_job(): print "Decorated job" scheduler = Blockin...
13,478,464
How to send data from JQuery AJAX request to Node.js server
<p><strong>What i want to do:</strong><br> Simply send some data (json for example), to a node.js http server, using jquery ajax requests.</p> <p>For some reason, i can't manage to get the data on the server, cause it never fires the 'data' event of the request.</p> <p><strong>Client code:</strong></p> <pre><code>$....
13,479,273
1
2
null
2012-11-20 17:14:44.487 UTC
12
2012-11-20 21:08:26.747 UTC
2012-11-20 21:08:26.747 UTC
null
608,097
null
608,097
null
1
20
node.js|jquery|request
61,606
<p>To get the 'data' event to fire on the node.js server side, you have to POST the data. That is, the 'data' event only responds to POSTed data. Specifying 'jsonp' as the data format forces a GET request, since jsonp is defined in the jquery documentation as:</p> <blockquote> <p>"jsonp": Loads in a JSON block usi...
13,436,467
JavaScript NoSQL Injection prevention in MongoDB
<p>How can I prevent JavaScript NoSQL injections into MongoDB?</p> <p>I am working on a Node.js application and I am passing <code>req.body</code>, which is a json object, into the mongoose model's save function. I thought there were safeguards behind the scenes, but this doesn't appear to be the case.</p>
13,438,800
4
6
null
2012-11-18 01:00:02.917 UTC
8
2019-10-22 23:15:58.41 UTC
2016-07-16 21:50:58.953 UTC
null
1,476,885
null
1,810,660
null
1
26
javascript|node.js|mongodb|mongoose|javascript-injection
25,872
<p><strong>Note</strong> My answer is incorrect. Please refer to other answers.</p> <p>--</p> <p>As a client program assembles a query in MongoDB, it builds a BSON object, not a string. Thus traditional SQL injection attacks are not a problem. </p> <p>For details follow the <a href="http://docs.mongodb.org/manual/f...
13,416,502
Django: Search form in Class Based ListView
<p>I am trying to realize a <code>Class Based ListView</code> which displays a selection of a table set. If the site is requested the first time, the dataset should be displayed. I would prefer a POST submission, but GET is also fine.</p> <p>That is a problem, which was easy to handle with <code>function based views</...
13,528,456
7
4
null
2012-11-16 12:22:04.207 UTC
20
2022-04-21 21:53:21.27 UTC
2012-11-24 22:36:10.08 UTC
null
631,348
null
729,241
null
1
31
django|forms|listview|django-class-based-views
49,419
<p>I think your goal is trying to filter queryset based on form submission, if so, by using GET :</p> <pre><code>class ProfileSearchView(ListView) template_name = '/your/template.html' model = Person def get_queryset(self): name = self.kwargs.get('name', '') object_list = self.model.objects...
13,532,084
Set rowSpan or colSpan of a child of a GridLayout programmatically?
<p>I have a <code>GridLayout</code> with 5 columns and 3 rows. Now I can insert arbitrary child views, which is great. Even better is, that I can assign <code>columnSpan=2</code> to some item in order to span it to 2 columns (the same with rowSpan).</p> <p>The problem now is, that I cannot assign rowSpan or columnSpan...
13,536,958
6
0
null
2012-11-23 15:38:06.357 UTC
12
2022-05-20 11:49:27.887 UTC
2017-10-04 23:22:44.357 UTC
null
3,755,692
null
1,463,757
null
1
34
android|html|grid-layout|html-table|columnspan
61,762
<p>OK, I spent some hours figuring out what's going on here. Well, I didn't find any working way to set columnSpan or rowSpan at runtime.</p> <p>But I found a solution that works (at least for me):</p> <h3>Java code</h3> <pre><code>private LinearLayout addNewSpannedView(Integer resourceId, ViewGroup rootElement) { ...
13,713,572
How is dynamic programming different from greedy algorithms?
<p>In the book I am using <a href="https://rads.stackoverflow.com/amzn/click/com/0201743957" rel="noreferrer" rel="nofollow noreferrer">Introduction to the Design &amp; Analysis of Algorithms</a>, <em>dynamic programming</em> is said to focus on the <strong>Principle of Optimality</strong>, "An optimal solution to any ...
13,713,735
7
3
null
2012-12-04 23:05:14.373 UTC
28
2019-02-22 14:22:25.197 UTC
2015-05-24 18:52:41 UTC
null
3,924,118
null
27,483
null
1
43
algorithm|dynamic-programming|greedy
33,778
<p>Dynamic programming is applicable to problems exhibiting the properties of:</p> <ul> <li>overlapping subproblems, and</li> <li>optimal substructure.</li> </ul> <p>Optimal substructure means that you can greedily solve subproblems and combine the solutions to solve the larger problem. <strong>The difference betwee...
3,821,468
SQL atomic increment and locking strategies - is this safe?
<p>I have a question about SQL and locking strategies. As an example, suppose I have a view counter for the images on my website. If I have a sproc or similar to perform the following statements:</p> <pre><code>START TRANSACTION; UPDATE images SET counter=counter+1 WHERE image_id=some_parameter; COMMIT; </code></pre> ...
3,821,780
2
1
null
2010-09-29 12:15:34.64 UTC
15
2010-12-13 14:33:09.567 UTC
2010-09-29 12:44:36.63 UTC
null
83,741
null
83,741
null
1
47
sql|locking|atomic|increment
15,643
<p><code>UPDATE</code> query places an update lock on the pages or records it reads.</p> <p>When a decision is made whether to update the record, the lock is either lifted or promoted to the exclusive lock.</p> <p>This means that in this scenario:</p> <pre><code>s1: read counter for image_id=15, get 0, store in temp...
45,553,339
How use Kotlin enum with Retrofit?
<p>How can I parse JSON to model with enum?</p> <p>Here is my enum class:</p> <pre><code>enum class VehicleEnumEntity(val value: String) { CAR("vehicle"), MOTORCYCLE("motorcycle"), VAN("van"), MOTORHOME("motorhome"), OTHER("other") } </code></pre> <p>and I need to parse <code>type</code> into an enum<...
45,553,707
2
6
null
2017-08-07 18:18:48.793 UTC
6
2022-02-06 11:21:32.943 UTC
2017-08-07 18:47:14.633 UTC
null
1,011,435
null
3,198,230
null
1
32
android|enums|gson|kotlin|retrofit2
17,912
<pre><code>enum class VehicleEnumEntity(val value: String) { @SerializedName("vehicle") CAR("vehicle"), @SerializedName("motorcycle") MOTORCYCLE("motorcycle"), @SerializedName("van") VAN("van"), @SerializedName("motorhome") MOTORHOME("motorhome"), @SerializedName("other") OTHER("other"...
28,498,295
Spring Boot ConflictingBeanDefinitionException: Annotation-specified bean name for @Controller class
<p>I keep getting the <code>ConflictingBeanDefinitionException</code> error in my Spring boot application. I am not entirely sure as to how to address it, I have several <code>@Configuration</code> annotated classes helping to set up Thymeleaf, Spring Security and Web. Why is the application trying to setup the <code>h...
28,503,680
7
5
null
2015-02-13 11:10:57.403 UTC
2
2021-09-13 21:28:47.073 UTC
2020-10-19 12:43:09.227 UTC
null
1,746,685
null
1,384,464
null
1
26
java|spring|spring-mvc|spring-security|spring-boot
62,371
<p>The solution, as I found out, is to disable double initialization by including a filter in the component scan. In my case:</p> <pre><code>@EnableScheduling @EnableAspectJAutoProxy @EnableCaching @Configuration @ComponentScan(basePackages = { "org.kemri.wellcome.hie" }, excludeFilters = {@Filter(value = Control...
9,198,440
is there a maximum size to android internal storage allocated for an app?
<p>I want to save a json file with all the application data (something similar to preference) but im not sure what is the limit size, because if the app cant use this file it will not function probably. is this information known beforehand and the OS reserve some space for your app or its based on the size available. <...
9,198,511
5
2
null
2012-02-08 17:31:29.343 UTC
10
2021-04-09 07:58:28.863 UTC
2017-05-23 10:30:46.61 UTC
null
-1
null
302,707
null
1
46
android|storage|android-sdcard
38,503
<p>If you use <a href="http://developer.android.com/reference/android/os/Environment.html#getExternalStorageDirectory%28%29" rel="noreferrer"><code>Environment.getExternalStorageDirectory()</code></a> (or <a href="http://developer.android.com/reference/android/content/Context.html#getExternalFilesDir%28java.lang.String...
16,054,596
Change color of non-transparent parts of png in Java
<p>I am trying to automatically change the color for a set of icons. Every icon has a white filled layer and the other part is transparent. Here is an example: (in this case it's green, just to make it visible)</p> <p><img src="https://i.stack.imgur.com/NWvnS.png" alt="icon search"></p> <p>I tried to do the followin...
16,054,867
4
0
null
2013-04-17 07:58:48.41 UTC
12
2022-01-23 12:02:11.333 UTC
2017-04-26 10:01:06.29 UTC
null
1,177,083
null
1,177,083
null
1
19
java|image|colors|png|transparency
17,302
<p>The problem is, that </p> <pre><code>Color originalColor = new Color(image.getRGB(xx, yy)); </code></pre> <p>discards all the alpha values. Instead you have to use </p> <pre><code> Color originalColor = new Color(image.getRGB(xx, yy), true); </code></pre> <p>to keep alpha values available.</p>
16,543,446
how to make leaflet map height variable
<p>In my Application I was making div of map as</p> <pre><code>&lt;div id="map" style="height: 610px; width:100%"&gt;&lt;/div&gt; </code></pre> <p>but to make my map responsive I want to make height also 100%, if I make <code>height: 100%</code> then it is not working.</p> <p>How can I make height also variable like...
16,543,492
4
2
null
2013-05-14 12:41:36.923 UTC
6
2021-12-10 06:17:58.223 UTC
2013-05-14 13:02:38.967 UTC
null
1,498,159
null
1,498,159
null
1
40
css|leaflet
62,911
<p>You need to set the parent elements to <code>height: 100%;</code> first</p> <pre><code>html, body { height: 100%; } </code></pre> <p><a href="http://jsfiddle.net/y8m7z/" rel="noreferrer"><strong>Demo</strong></a></p> <p><a href="http://jsfiddle.net/y8m7z/1/" rel="noreferrer"><strike>Demo</strike></a> (This won...
16,493,368
Can TortoiseMerge be used as a difftool with Windows Git Bash?
<p>I'm just starting to work with Git. I would like to use TortoiseMerge as the difftool and mergetool.</p> <p>In my <code>$HOME/.gitconfig</code> I have the following sections. I've removed the user and color sections for this question.</p> <pre><code>[merge] tool = tortoisemerge [mergetool &quot;tortoisemerge&qu...
16,494,703
7
0
null
2013-05-11 03:10:27.21 UTC
14
2022-03-17 01:30:41.443 UTC
2020-07-16 10:13:32.88 UTC
null
5,534,993
null
439,320
null
1
52
git|tortoisegit|git-diff|tortoisegitmerge
19,046
<p>The following settings work fine for me. However, I am using TortoiseGit not TortoiseSVN. Notice the difference in the parameters for diff.</p> <pre><code>[diff] tool = tortoisediff [difftool] prompt = false [merge] tool = tortoisemerge [mergetool] prompt = false keepBackup = false [difftool "tortoisediff...
41,762,947
How to get and print response from Httpclient.SendAsync call
<p>I'm trying to get a response from a HTTP request but i seem to be unable to. I have tried the following:</p> <pre><code>public Form1() { HttpClient client = new HttpClient(); client.BaseAddress = new Uri("someUrl"); string content = "someJsonString"; HttpRequestMessage sendRequest = new HttpRe...
41,764,220
1
6
null
2017-01-20 11:46:11.073 UTC
1
2022-08-16 09:48:28.483 UTC
2018-01-16 12:38:53.65 UTC
null
4,390,133
null
7,127,982
null
1
6
c#|asynchronous|httpclient
50,129
<p>here is a way to use <code>HttpClient</code>, and this should read the response of the request, in case the request return status 200, (the request is not <code>BadRequest</code> or <code>NotAuthorized</code>)</p> <pre><code>string url = 'your url here'; // usually you create on HttpClient per Application (it is th...
60,518,658
How to get logs of deployment from Kubernetes?
<p>I am creating an InfluxDB deployment in a Kubernetes cluster (v1.15.2), this is my yaml file:</p> <pre><code>apiVersion: extensions/v1beta1 kind: Deployment metadata: name: monitoring-influxdb namespace: kube-system spec: replicas: 1 template: metadata: labels: task: monitoring k8s-...
62,831,466
3
4
null
2020-03-04 03:30:29.117 UTC
7
2021-06-29 08:33:06.177 UTC
2021-06-29 08:33:06.177 UTC
null
16,281,483
null
2,628,868
null
1
45
kubernetes
48,776
<pre class="lang-sh prettyprint-override"><code>kubectl logs deployment/&lt;name-of-deployment&gt; # logs of deployment kubectl logs -f deployment/&lt;name-of-deployment&gt; # follow logs </code></pre>
17,537,687
If Cell in Range Contains Value Then Insert Comment in Adjacent Cell
<p>I hope the title clarifies the objective. All of my attempts fail miserably, for example:</p> <pre><code>Private Sub Worksheet_Change(ByVal Target As Range) With Range("A1:A10") = "blah" Range("A1:A10").Offset(0, 1).AddComment "fee" Range("A1:A10").Offset(0, 2).AddComment "fi" Range("A1...
17,537,877
1
0
null
2013-07-08 23:36:26.777 UTC
1
2013-07-09 17:01:42.803 UTC
2018-07-09 19:34:03.733 UTC
null
-1
null
2,487,576
null
1
4
vba|excel
41,526
<pre><code>Private Sub Worksheet_Change(ByVal Target As Range) Dim rng As Range, cell as Range On Error Goto haveError 'see if any changes are in the monitored range... Set rng = Application.Intersect(Target, Me.Range("A1:A10")) If Not rng is Nothing Then 'Next line prevents code updates fro...
17,539,236
How to replace/name keys in a Javascript key:value object?
<p>How should I replace the key strings in a Javascript key:value hash map (as an object)?</p> <p>This is what I have so far:</p> <pre><code>var hashmap = {"aaa":"foo", "bbb":"bar"}; console.log("before:"); console.log(hashmap); Object.keys(hashmap).forEach(function(key){ key = key + "xxx"; console.log("changi...
17,539,261
5
1
null
2013-07-09 03:06:52.543 UTC
3
2022-06-09 06:17:23.193 UTC
2018-10-31 14:55:54.267 UTC
null
114,900
null
733,034
null
1
13
javascript
64,292
<p>It has nothing to do with scope. <code>key</code> is just a local variable, it's not an alias for the actual object key, so assigning it doesn't change the object.</p> <pre><code>Object.keys(hashmap).forEach(function(key) { var newkey = key + "xxx"; hashmap[newkey] = hashmap[key]; delete hashmap[key]; }); </c...
11,499,287
Editing data from MySQL via PHP
<p>I am running into a frustrating problem with a PHP script that's supposed to allow me to edit individual rows within my MySQL database.</p> <p>This is the file where all of the rows from the database are displayed; it works just like it's supposed to. </p> <pre><code>&lt;table cellpadding="10"&gt; &lt;tr&gt; &lt;t...
11,499,460
9
2
null
2012-07-16 06:44:11.25 UTC
5
2021-09-28 16:19:02.457 UTC
null
null
null
null
1,010,462
null
1
4
php|mysql
46,387
<p><strong>StudentEdit.php:</strong> you forgot to call <code>@mysql_select_db($database) or die( "Unable to select database");</code> before you executed the query</p>
21,517,102
Regex to match md5 hashes
<p>What type of regex should be used to match a md5 hash. </p> <p>how to validate this type of string <code>00236a2ae558018ed13b5222ef1bd987</code></p> <p>i tried something like this: <code>('/^[a-z0-9]/')</code> but it didnt work.</p> <p>how to achieve this? thanks</p>
21,517,123
2
7
null
2014-02-02 22:28:31.533 UTC
0
2014-02-02 22:38:03.69 UTC
null
null
null
null
2,244,946
null
1
23
php|regex|match
41,064
<p>This is a PCRE that will match a MD5 hash:</p> <pre><code>define('R_MD5_MATCH', '/^[a-f0-9]{32}$/i'); if(preg_match(R_MD5_MATCH, $input_string)) { echo "It matches."; } else { echo "It does not match."; } </code></pre>
19,813,719
await keyword blocks main thread
<p>So I have the following code</p> <pre><code>private async void button1_Click(object sender, EventArgs e) { await DoSomethingAsync(); MessageBox.Show("Test"); } private async Task DoSomethingAsync() { for (int i = 0; i &lt; 1000000000; i++) { int a = 5; }; // simulate job MessageBo...
19,813,877
4
4
null
2013-11-06 13:44:33.337 UTC
12
2021-12-30 11:07:59.563 UTC
2018-02-07 14:51:20.083 UTC
null
2,463,281
null
2,463,281
null
1
22
c#|async-await
23,152
<p>I think you misunderstand what async means. <strong>It doesn't mean that the method runs in another thread!!</strong></p> <p>An async method runs synchronously until the first <code>await</code>, then returns a <code>Task</code> to the caller (unless it's <code>async void</code>, then it returns nothing). When the t...
17,161,285
Exception :com.sun.jersey.spi.inject.Errors$ErrorMessagesException
<p>I am using the Jersey API for the web services. I am sending the multipart data from client to server. I am getting exception when web services start to execute.</p> <pre><code>@POST @Path("uploadphoto") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces("text/plain") public String uploadNotices(@FormDataParam("fil...
17,161,572
11
1
null
2013-06-18 05:39:08.42 UTC
3
2020-09-04 20:07:02.543 UTC
2018-10-03 08:06:02.333 UTC
null
839,554
null
2,455,259
null
1
23
java|jakarta-ee|jersey
57,848
<p>It seems your missing few jars in your project.Try adding these to your project:</p> <blockquote> <p><strong>jersey-multipart.jar</strong></p> <p><strong>mimepull.jar</strong></p> </blockquote> <p>If you are using maven, you can add this dependency:</p> <pre><code>&lt;dependency&gt; &lt;groupId&gt;com.sun.je...
17,612,364
Difference between save and saveOrUpdate method hibernate
<p>Normally I had read about save() method generates new identifier for object and only fire <strong>INSERT</strong> and save it, it does not update it, while saveOrUpdate() method may <strong>INSERT</strong> or <strong>UPDATE</strong> record.</p> <p>But as per my experience, Here I can explains better by sample code,...
17,612,564
4
1
null
2013-07-12 10:02:34.997 UTC
7
2015-10-05 16:18:35.603 UTC
null
null
null
null
1,508,629
null
1
25
java|hibernate
91,146
<p><strong>save</strong></p> <p>Save <code>method</code> stores an <code>object</code> into the database. It will Persist the given transient instance, first assigning a generated identifier. It <code>returns</code> the <strong>id</strong> of the entity created.</p> <p>Whereas,</p> <p><strong>SaveOrUpdate()</strong>...
17,520,964
How to create ArrayList (ArrayList<Integer>) from array (int[]) in Java
<p>I have seen the question: <a href="https://stackoverflow.com/questions/157944/how-to-create-arraylist-arraylistt-from-array-t">Create ArrayList from array</a></p> <p>However when I try that solution with following code, it doesn't quite work in all the cases:</p> <pre><code>import java.util.ArrayList; import java....
17,520,983
5
2
null
2013-07-08 07:15:52.927 UTC
15
2014-11-02 09:47:13.053 UTC
2017-05-23 11:46:58.05 UTC
null
-1
null
1,119,997
null
1
29
java|arrays|generics|collections
103,296
<p>The problem in</p> <pre><code>intList = new ArrayList&lt;Integer&gt;(Arrays.asList(intArray)); </code></pre> <p>is that <code>int[]</code> is considered as a single <code>Object</code> instance since a primitive array extends from <code>Object</code>. This would work if you have <code>Integer[]</code> instead of <...
17,474,412
Removing Ignored Android Studio (or Intellij) Update Builds
<p>When an Android Studio update is posted and you mistakenly click on <code>Ignore This Update</code> how do you apply the update without having to reinstall Android Studio?</p>
17,474,413
4
1
null
2013-07-04 16:00:17.63 UTC
10
2019-11-02 15:15:47.923 UTC
null
null
null
null
1,373,278
null
1
46
android|intellij-idea|updates|android-studio
9,130
<p><strong>Update</strong></p> <p>As of the latest version of Android Studio, there is now a Preference in the UI <a href="https://stackoverflow.com/a/46999038/1373278">noted in an answer by Yogesh Umesh Vaity</a></p> <p><strong>Original Answer</strong></p> <p>The simple way to revert a mistaken choice is to close A...
17,202,128
Rounded cornes (border radius) Safari issue
<pre class="lang-css prettyprint-override"><code>.activity_rounded { -webkit-border-radius: 50%; -moz-border-radius: 50%; border-radius: 50%; -khtml-border-radius: 50%; border: 3px solid #fff; behavior: url(css/PIE.htc); } </code></pre> <pre class="lang-html prettyprint-override"><code>&lt;img s...
17,210,864
11
7
null
2013-06-19 21:59:43.26 UTC
15
2022-06-19 07:41:28.843 UTC
2022-06-19 07:41:28.843 UTC
null
11,870,285
null
867,418
null
1
61
html|css
96,571
<p>To illustrate the problem in Safari, let's begin with a plain image.</p> <p><img src="https://i.stack.imgur.com/yVesQ.png" height="150"></p> <p>Here we have an image of 100px x 100px. Adding a border of 3px increases the element dimensions to 106px x 106px:</p> <p><img src="https://i.stack.imgur.com/aCk3m.png" he...
18,348,797
Why is it considered bad practice in Java to call a method from within a constructor?
<p>In Java, why is it considered bad practice to call a method from within a constructor? Is it especially bad if the method is computationally heavy?</p>
18,369,062
3
3
null
2013-08-21 04:20:11.463 UTC
18
2020-01-12 05:06:08.217 UTC
2020-01-12 05:06:08.217 UTC
null
3,204,692
null
2,380,088
null
1
25
java
21,738
<p>First, in general there's no problem with calling methods in a constructor. The issues are specifically with the particular cases of calling overridable methods of the constructor's class, and of passing the object's <code>this</code> reference to methods (including constructors) of other objects.</p> <p>The reason...
23,348,456
Modify CSS classes using Javascript
<p>I was wondering if there is an easy way to change the CSS classes in JavaScript. I have gone through all other similar questions here and I couldn't find an straight-forward and simple solution.</p> <p>what I'm trying to do is to set the width and height of a <code>&lt;div&gt;</code> to match an image that I have o...
23,348,564
3
6
null
2014-04-28 18:22:12.497 UTC
7
2018-10-09 08:10:17.6 UTC
2014-04-28 18:32:35.223 UTC
null
1,326,008
null
1,326,008
null
1
29
javascript|css
73,200
<p>The reason only one or the other works is because in your second line of code, you destroy the whole <code>style</code> attribute, and recreate it. Note that <code>setAttribute()</code> overwrites the whole attribute.</p> <p>A better solution would be to use the <code>element.style</code> property, not the attribut...
5,264,355
RSpec failure: could not find table after migration...?
<p>I have a naked rails 3 app with one model, generated using <code>rails g model User</code>.</p> <p>I've added a factory (using <code>factory_girl_rails</code>):</p> <pre><code>Factory.define :user do |f| f.email "test@test.com" f.password "blah" f.password_confirmation "blah" f.display_name "neezer" end </...
5,264,371
3
0
null
2011-03-10 18:53:54.247 UTC
16
2014-08-04 09:53:28.557 UTC
2014-08-03 19:03:02.99 UTC
user456814
null
null
32,154
null
1
29
ruby-on-rails|ruby-on-rails-3|rspec|factory-bot
10,320
<p>Try to execute </p> <pre><code>rake db:test:prepare </code></pre> <p>This should fix your tests db.</p>
5,476,673
CSS Justify text, fill space with dots
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/3097851/fill-available-spaces-between-labels-with-dots-or-hyphens">Fill available spaces between labels with dots or hyphens</a> </p> </blockquote> <p>Any way to format text like this with simple CSS? I have a ...
5,476,886
3
6
null
2011-03-29 17:44:10.9 UTC
6
2011-08-11 07:00:58.22 UTC
2017-05-23 12:02:48.803 UTC
null
-1
null
2,542
null
1
35
css|xhtml
35,798
<p>Here's an elegant and unobtrusive one with some limitations (see below).</p> <p><a href="http://jsfiddle.net/j6JWT/7/">JSFiddle</a></p> <p>CSS:</p> <pre><code>dl { width: 400px } dt { float: left; width: 300px; overflow: hidden; white-space: nowrap } dd { float: left; width: 100px; overflow: hidden } dt:after { ...
5,210,778
Elegant way to make all dirs in a path
<p>Here are four paths:</p> <pre><code>p1=r'\foo\bar\foobar.txt' p2=r'\foo\bar\foo\foo\foobar.txt' p3=r'\foo\bar\foo\foo2\foobar.txt' p4=r'\foo2\bar\foo\foo\foobar.txt' </code></pre> <p>The directories may or may not exist on a drive. What would be the most elegant way to create the directories in each path?</p> <p>...
5,210,790
3
1
null
2011-03-06 13:32:26.81 UTC
6
2020-07-29 12:33:41.943 UTC
null
null
null
null
559,807
null
1
65
python|path
32,393
<p>You are looking for <a href="http://docs.python.org/library/os.html#os.makedirs" rel="noreferrer"><code>os.makedirs()</code></a> which does exactly what you need.</p> <p>The documentation states:</p> <blockquote> <p>Recursive directory creation function. Like mkdir(), but makes all intermediate-level directo...
5,200,187
Convert InputStream to BufferedReader
<p>I'm trying to read a text file line by line using InputStream from the assets directory in Android.</p> <p>I want to convert the InputStream to a BufferedReader to be able to use the readLine().</p> <p>I have the following code:</p> <pre><code>InputStream is; is = myContext.getAssets().open ("file.txt"); Buffered...
5,200,207
3
0
null
2011-03-04 22:56:53.61 UTC
23
2019-10-10 16:48:32.05 UTC
2019-10-10 16:48:32.05 UTC
null
140,750
null
591,452
null
1
166
java|android|inputstream|readline|bufferedreader
205,519
<p><code>BufferedReader</code> can't wrap an <code>InputStream</code> directly. It wraps another <code>Reader</code>. In this case you'd want to do something like:</p> <pre><code>BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8")); </code></pre>
9,606,614
Cleaning noise out of Java stack traces
<p>My Java stack traces have a lot of entries that I don't care about, showing method invocation going through proxies and Spring reflection methods and stuff like that. It can make it pretty hard to pick out the part of the stack trace that's actually from my code. Ruby on Rails includes a "stack trace cleaner" where ...
9,607,068
6
4
null
2012-03-07 17:51:59.397 UTC
6
2019-08-18 03:11:55.07 UTC
null
null
null
null
11,284
null
1
33
java|exception|stack-trace
8,365
<p><a href="/questions/tagged/eclipse" class="post-tag" title="show questions tagged 'eclipse'" rel="tag">eclipse</a> has a preference <strong>Stack trace filter patterns</strong> (look at <em>java</em> > <em>junit</em> or search for <code>stacktrace</code> in the preferences). You can ignore packages (also with wildca...
9,570,642
Send SMS programmatically, without the SMS composer window
<p>Until yesterday I thought that it was not possible to send background SMS without using the IOS SMS interface (Which many people here assure also). However, today I downloaded a new app called SmartSender, which schedules your SMS and then sends it automatically.</p> <p>I tested it and the SMS is not actually sent ...
13,143,305
6
5
null
2012-03-05 16:56:28.777 UTC
9
2014-11-26 13:32:25 UTC
2012-11-25 18:49:05.583 UTC
null
815,724
null
505,152
null
1
15
iphone|interface|sms
25,944
<p>In fact it is not possible; however it was when the question was answered. </p> <p>The App in question has now specified in its description that it won't work under IOS 6, so I think apple patched some bug that could be exploited to achieve this functionality.</p>
18,372,961
How to search a file in PhpStorm?
<ol> <li><p>Eclipse has this feature where you can <em>search any file in your folder</em>. Is there any such feature in PhpStorm?</p></li> <li><p>Is there a shortcut for indentation and how can I customize that?</p></li> </ol> <p>Googled it, but no results.</p>
18,373,397
5
5
null
2013-08-22 06:16:18.247 UTC
11
2019-06-14 10:04:36.917 UTC
2016-04-20 04:18:35.537 UTC
null
1,402,846
null
2,463,734
null
1
87
php|phpstorm
88,647
<p>From the Menu of PHPStorm Choose <strong>Navigate</strong> -> <strong>File</strong> or use the shortcut <kbd>ALT</kbd>+<kbd>SHIFT</kbd>+<kbd>O</kbd> or <kbd>CMD</kbd>+<kbd>SHIFT</kbd>+<kbd>O</kbd> or <kbd>CTRL</kbd>+<kbd>SHIFT</kbd>+<kbd>N</kbd> (as per the edit). Type the required file name you want to search. Done...
18,759,206
How to add subview inside UIAlertView for iOS 7?
<p>I am having an application on iTunes store which displays some <code>UILabel</code> and <code>UIWebView</code> on <code>UIAlertView</code>. According to session video, <code>addSubView</code> for <code>UIAlertView</code> will not work. They have talked about <code>ContentView</code>. But in the GM Seeds SDK, I could...
21,067,447
6
4
null
2013-09-12 08:28:32.893 UTC
15
2014-11-04 20:27:30.117 UTC
2014-07-20 15:04:36.35 UTC
null
2,792,531
null
1,168,908
null
1
22
ios|objective-c|ios7|uialertview
41,461
<p>You can really change <em>accessoryView</em> to <em>customContentView</em> in iOS7 (and it seems that in iOS8 as well) UIAlertView</p> <pre><code>[alertView setValue:customContentView forKey:@"accessoryView"]; </code></pre> <p>Try this code:</p> <pre><code>UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"TE...
18,406,369
Qt: can't find -lGL error
<p>I just reinstalled QtCreator, created new project (<em>Qt Application</em>) an got this after compilation: </p> <pre><code>/usr/bin/ld: **cannot find -lGL** collect2: error: ld returned 1 exit status make: *** [untitled1] Error 1 18:07:41: The process "/usr/bin/make" exited with code 2. Error while building/deployi...
18,503,519
8
3
null
2013-08-23 15:18:28.483 UTC
32
2020-05-16 08:23:07.037 UTC
2014-04-21 06:45:37.85 UTC
null
2,682,142
null
1,953,342
null
1
122
c++|qt|compiler-construction|qt-creator|ubuntu-13.04
103,995
<p>You should install package "libgl1-mesa-dev":</p> <pre><code>sudo apt install libgl1-mesa-dev </code></pre>
15,422,527
Best practices: how do you list required dependencies in your setup.py?
<p>This is how I do it currently:</p> <pre><code>import os from setuptools import setup, find_packages here = os.path.abspath(os.path.dirname(__file__)) requires = [ 'pyramid', 'pyramid_debugtoolbar', 'waitress', 'requests', 'mock', 'gunicorn', 'mongoengine', ] setup(name='repoapi', ...
15,422,703
2
1
null
2013-03-15 00:09:33.307 UTC
12
2020-04-16 11:09:16.363 UTC
2018-01-18 10:22:09.683 UTC
null
509,706
null
230,884
null
1
59
python
42,185
<p>You can split up your requirements into "install" dependencies and "test" dependencies like this:</p> <pre><code>import os from setuptools import setup, find_packages here = os.path.abspath(os.path.dirname(__file__)) install_requires = [ 'pyramid', 'pyramid_debugtoolbar', 'waitress', 'requests', ...
15,315,452
Selecting with complex criteria from pandas.DataFrame
<p>For example I have simple DF:</p> <pre><code>import pandas as pd from random import randint df = pd.DataFrame({'A': [randint(1, 9) for x in range(10)], 'B': [randint(1, 9)*10 for x in range(10)], 'C': [randint(1, 9)*100 for x in range(10)]}) </code></pre> <p>Can I select values...
15,315,507
5
2
null
2013-03-09 20:17:49.17 UTC
147
2022-07-22 01:28:55.677 UTC
2022-07-22 01:28:55.677 UTC
null
19,123,103
null
1,818,608
null
1
327
python|pandas
833,481
<p>Sure! Setup:</p> <pre><code>&gt;&gt;&gt; import pandas as pd &gt;&gt;&gt; from random import randint &gt;&gt;&gt; df = pd.DataFrame({'A': [randint(1, 9) for x in range(10)], 'B': [randint(1, 9)*10 for x in range(10)], 'C': [randint(1, 9)*100 for x in range(10)]}) &gt;&gt;&gt; ...
28,177,917
Uncaught TypeError: Cannot read property 'createDocumentFragment' of undefined
<p>I am trying to grab a webpage and load into a bootstrap 2.3.2 popover. So far I have:</p> <pre><code>$.ajax({ type: "POST", url: "AjaxUpdate/getHtml", data: { u: 'http://stackoverflow.com' }, dataType: 'html', error: function(jqXHR, textStatus, errorThrown) { console.log('error'); console.lo...
28,179,245
3
2
null
2015-01-27 18:56:06.44 UTC
7
2021-04-23 09:39:57.847 UTC
2015-01-27 21:10:23.663 UTC
null
1,960,455
null
1,592,380
null
1
67
javascript|jquery|twitter-bootstrap
99,295
<p>The reason for the error is the <code>$(this).html($link);</code> in your <code>.done()</code> callback.</p> <p><code>this</code> in the callback refers to the <code>[...]object that represents the ajax settings used in the call ($.ajaxSettings merged with the settings passed to $.ajax)[...]</code> and not to the ...
7,837,330
Generic one-to-one relation in Django
<p>I need to set up one-to-one relation which must also be generic. May be you can advice me a better design. So far I came up to the following models</p> <pre><code>class Event(models.Model): # skip event related fields... content_type = models.ForeignKey(ContentType) object_id = models.Posit...
9,295,723
2
1
null
2011-10-20 14:18:48.473 UTC
4
2022-06-03 19:20:17.91 UTC
2011-10-23 18:20:24.7 UTC
null
179,581
null
179,581
null
1
28
python|django|django-models|django-admin|one-to-one
8,082
<p>I recently <a href="https://stackoverflow.com/questions/9199000/reversing-a-unique-generic-foreign-key-and-returning-an-object-as-opposed-to-a">came across this problem</a>. What you have done is fine, but you can generalise it a little bit more by creating a mixin that reverses the relationship transparently:</p> ...
9,642,205
How to force a script reload and re-execute?
<p>I have a page that is loading a script from a third party (news feed). The <code>src</code> url for the script is assigned dynamically on load up (per third party code).</p> <pre><code>&lt;div id="div1287"&gt; &lt;!-- dynamically-generated elements will go here. --&gt; &lt;/div&gt; &lt;script id="script0348710...
9,642,359
6
8
null
2012-03-09 23:10:28.697 UTC
29
2022-05-19 19:38:18.317 UTC
2012-03-09 23:19:55.59 UTC
null
751,484
null
751,484
null
1
105
javascript|html|feed|script-tag
242,682
<p>How about adding a new script tag to &lt;head> with the script to (re)load? Something like below:</p> <pre><code>&lt;script&gt; function load_js() { var head= document.getElementsByTagName('head')[0]; var script= document.createElement('script'); script.src= 'source_file.js'; head.appe...
31,176,592
How to scale an image to cover entire parent div?
<p><a href="http://jsfiddle.net/Log82brL/15/" rel="nofollow noreferrer">http://jsfiddle.net/Log82brL/15/</a></p> <p>This <code>&lt;img&gt;</code> isn't shrink wrapping as I would expect with <code>min-width:100%</code></p> <p>I'm trying to shrink the <code>&lt;img&gt;</code> until either height or width matches the co...
31,355,127
12
7
null
2015-07-02 05:57:36.63 UTC
6
2022-08-31 15:26:22.58 UTC
2022-08-31 15:26:22.58 UTC
null
1,264,804
null
1,487,102
null
1
29
javascript|html|image|css
32,562
<p><a href="http://jsfiddle.net/Log82brL/7/" rel="noreferrer">http://jsfiddle.net/Log82brL/7/</a></p> <pre><code>#img { width: 100%; height: 100%; object-fit: cover; } </code></pre> <p>object-fit: cover allows the replaced content is sized to maintain its aspect ratio while filling the element’s entire content ...
5,412,019
How to get the last month data and month to date data
<p>Need help in writing the query to get the last month data as well as month to date data.</p> <p>If today's date is Mar 23 2011, I need to retrieve the data from last month and the data till todays date(means Mar 23 2011). </p> <p>If date is Apr 3 2011, data should consists of March month data and the data till Apr...
5,412,138
4
0
null
2011-03-23 21:45:22.55 UTC
7
2020-09-21 03:33:14.673 UTC
2011-03-23 21:49:47.443 UTC
null
78,522
null
543,509
null
1
11
sql|sql-server|tsql|sql-server-2008
56,452
<pre><code>Today including time info : getdate() Today without time info : DATEADD(DAY, DATEDIFF(day, 0, getdate()), 0) Tomorrow without time info : DATEADD(DAY, DATEDIFF(day, 0, getdate()), 1) Beginning of current month : DATEADD(month, datediff(month, 0, getdate()), 0) Beginning of last month : DATEADD(month, ...
4,935,655
How to trap the backspace key using jQuery?
<p>It does not appear the jQuery keyup, keydown, or keypress methods are fired when the backspace key is pressed. How would I trap the pressing of the backspace key?</p>
4,936,565
4
4
null
2011-02-08 16:36:00.867 UTC
7
2015-09-04 18:21:19.79 UTC
null
null
null
null
94,508
null
1
36
jquery
123,713
<p>try this one :</p> <pre><code> $('html').keyup(function(e){if(e.keyCode == 8)alert('backspace trapped')}) </code></pre>
5,272,216
Is it possible to install both 32bit and 64bit Java on Windows 7?
<p>Is it possible to install both 32bit and 64bit Java on Windows 7?</p> <p>I have some applications that I can run under 64bit, but there are some that only run under 32bit.</p>
5,272,255
4
4
null
2011-03-11 11:17:19.22 UTC
17
2017-04-20 13:29:18.66 UTC
2012-12-18 03:07:04.67 UTC
null
815,724
null
229,510
null
1
82
windows-7|32bit-64bit|java
188,329
<p>Yes, it is absolutely no problem. You could even have multiple versions of both 32bit and 64bit Java installed at the same time on the same machine.</p> <p>In fact, i have such a setup myself.</p>
5,384,847
Adding an item to an associative array
<pre class="lang-php prettyprint-override"><code>//go through each question foreach($file_data as $value) { //separate the string by pipes and place in variables list($category, $question) = explode('|', $value); //place in assoc array $data = array($category =&gt; $question); print_r($data); } </code>...
5,384,855
5
0
null
2011-03-21 23:11:23.09 UTC
20
2022-09-19 05:50:18.07 UTC
2021-02-03 09:31:28.813 UTC
null
11,044,542
null
185,672
null
1
105
php|arrays|associative-array
287,788
<p>I think you want <code>$data[$category] = $question;</code></p> <p>Or in case you want an array that maps categories to array of questions:</p> <pre><code>$data = array(); foreach($file_data as $value) { list($category, $question) = explode('|', $value, 2); if(!isset($data[$category])) { $data[$ca...
5,335,745
How do I handle multiple kinds of missingness in R?
<p>Many surveys have codes for different kinds of missingness. For instance, a codebook might indicate:</p> <blockquote> <p>0-99 Data</p> <p>-1 Question not asked</p> <p>-5 Do not know</p> <p>-7 Refused to respond</p> <p>-9 Module not asked</p> </blockquote> <p>Stata has a beautiful facility for handling these multipl...
5,341,302
6
0
null
2011-03-17 06:43:11.693 UTC
12
2013-08-25 17:03:06.22 UTC
2020-06-20 09:12:55.06 UTC
null
-1
null
636,656
null
1
19
r|data-structures|stata|survey|missing-data
1,660
<p>I know what you look for, and that is not implemented in R. I have no knowledge of a package where that is implemented, but it's not too difficult to code it yourself.</p> <p>A workable way is to add a dataframe to the attributes, containing the codes. To prevent doubling the whole dataframe and save space, I'd add...
12,148,281
Mask String with characters
<p>Hey guy's I tried to find a way to hide a string, but the code that I found just work with my application... Is there a way to hide the characters in a string with either <code>*</code> or <code>-</code> and if there is can someone please explain </p>
12,148,388
5
4
null
2012-08-27 19:25:36.553 UTC
2
2020-03-12 02:47:10.287 UTC
2020-02-21 14:28:37.987 UTC
null
6,904,888
null
1,617,498
null
1
8
java
46,332
<p>Is this for making a password? Consider the following:</p> <pre><code>class Password { final String password; // the string to mask Password(String password) { this.password = password; } // needs null protection // allow this to be equal to any string // reconsider this approach if adding it to a m...
12,627,422
Custom Texture Shader in Three.js
<p>I'm just looking to create a very simple Fragment Shader that draws a specified texture to the mesh. I've looked at a handful of custom fragment shaders that accomplished the same and built my own shaders and supporting JS code around it. However, it's just not working. Here's a working abstraction of the code I'm t...
12,628,857
1
1
null
2012-09-27 18:00:35.12 UTC
12
2018-08-08 19:53:54.177 UTC
2015-08-16 02:32:20.157 UTC
null
1,704,159
null
1,704,159
null
1
34
shader|textures|three.js|fragment-shader
34,062
<p>You are still using the old syntax for uniforms</p> <pre><code>var uniforms = { texture1: { type: "t", value: 0, texture: THREE.ImageUtils.loadTexture("texture.jpg") } }; </code></pre> <p>This is the new syntax </p> <pre><code>var uniforms = { texture1: { type: "t", value: THR...
12,400,071
ServiceStack: RESTful Resource Versioning
<p>I've taken a read to the <a href="https://github.com/ServiceStack/ServiceStack/wiki/Advantages-of-message-based-web-services">Advantages of message based web services</a> article and am wondering if there is there a recommended style/practice to versioning Restful resources in ServiceStack? The different versions ...
12,413,091
3
0
null
2012-09-13 05:40:28.853 UTC
38
2012-10-17 01:52:17.423 UTC
null
null
null
null
1,667,502
null
1
39
servicestack
10,589
<h2>Try to evolve (not re-implement) existing services</h2> <p>For versioning, you are going to be in for a world of hurt if you try to maintain different static types for different version endpoints. We initially started down this route but as soon as you start to support your first version the development effort to ...
12,268,835
Is it possible to run python SimpleHTTPServer on localhost only?
<p>I have a vpn connection and when I'm running python -m SimpleHTTPServer, it serves on 0.0.0.0:8000, which means it can be accessed via localhost <strong>and</strong> via my real ip. I don't want robots to scan me and interested that the server will be accessed only via localhost.</p> <p>Is it possible? </p> <pre><...
12,268,922
3
3
null
2012-09-04 17:50:44.63 UTC
34
2018-09-12 17:13:09.367 UTC
2018-09-12 17:13:09.367 UTC
null
745,828
null
1,639,431
null
1
100
python|http|command-line|python-2.x|simplehttpserver
121,101
<p>If you read the source you will see that only the port can be overridden on the command line. If you want to change the host it is served on, you will need to implement the <code>test()</code> method of the <code>SimpleHTTPServer</code> and <code>BaseHTTPServer</code> yourself. But that should be really easy.</p> ...
24,267,080
Calling stored procedure using VBA
<p>I am working in Access 2010 user front-end with a Microsoft SQL Server 2008 back-end.</p> <p>The tables in Access are all linked to the SQL server database.</p> <p>I have a stored procedure that inserts new values (supplied by the parameters) into a table.</p> <p>I asked a similar question previously and got a go...
24,269,044
2
5
null
2014-06-17 14:57:31.433 UTC
7
2020-07-08 19:46:10.597 UTC
2020-07-08 19:46:10.597 UTC
null
8,422,953
null
3,661,943
null
1
11
sql-server|vba|ms-access|stored-procedures
49,508
<p>Victoria,</p> <p>You can run a stored procedure using ADO, like below...</p> <pre><code>Set mobjConn = New ADODB.Connection mobjConn.Open "your connection string" Set mobjCmd = New ADODB.Command With mobjCmd .ActiveConnection = mobjConn .CommandText = "your stored procedure" .CommandType = adCmdStored...
22,493,723
Node.js Asynchronous Library Comparison - Q vs Async
<p>I have used <a href="https://github.com/kriskowal/q">kriskowal's Q library</a> for a project (web scraper / human-activity simulator) and have become acquainted with promises, returning them and resolving/rejecting them, and the library's basic asynchronous control flow methods and error-throwing/catching mechanisms...
26,883,101
3
7
null
2014-03-19 00:11:49.07 UTC
10
2015-12-19 10:47:26.323 UTC
2014-03-19 01:16:38.32 UTC
null
1,468,130
null
1,468,130
null
1
28
javascript|node.js|asynchronous|q
12,956
<p>Both libraries are good. I have discovered that they serve separate purposes and can be used in tandem.</p> <p>Q provides the developer with promise objects, which are future representations of values. Useful for time travelling.</p> <p>Async provides the developer with asynchronous versions of control structures ...