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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
52,415,943 | Trying to git clone via SSH but getting broken pipe error | <p>I am having some strange issues trying to <code>git clone</code> one of my public GitHub repositories because of a weird issue. I know it's not an issue with my key, because I've taken the same key from another VM and just simply fixed its permissions. This is the error that I get when trying to use SSH:</p>
<pre><... | 54,004,358 | 6 | 4 | null | 2018-09-20 00:44:46.967 UTC | 13 | 2022-01-28 07:18:50.613 UTC | null | null | null | null | 1,493,116 | null | 1 | 47 | git | 29,088 | <p>I don't know who this guy is, but bless him! This worked for me: <a href="https://blog.bchoy.me/post/2018-09-11-vmware-ssh-bug/" rel="noreferrer">https://blog.bchoy.me/post/2018-09-11-vmware-ssh-bug/</a></p>
<p>Put this in your <code>~/.ssh/config</code></p>
<pre><code>Host *
ServerAliveInterval 600
TCPKeepA... |
88,800 | How do I restore from a drop database command using a mysql binary log? | <p>How can I restore a mysql database that was dropped using a "drop database" command? I have access to binary logs which should make this type of rollback possible.</p> | 88,856 | 5 | 0 | null | 2008-09-17 23:59:56.667 UTC | 1 | 2015-02-09 14:58:32.39 UTC | 2008-09-24 15:56:06.167 UTC | Oli | 12,870 | null | 17,002 | null | 1 | 8 | mysql|database|recovery | 39,980 | <p>Documentation Sucks. It alludes to DROP DATABASE being recoverable, but only in odd conditions i'm not familiar with <a href="http://dev.mysql.com/doc/refman/5.0/en/binary-log.html" rel="noreferrer">http://dev.mysql.com/doc/refman/5.0/en/binary-log.html</a> </p>
<p>According to Docs, binlogs are just a sequence of ... |
978,887 | Why does WPF databinding swallow exceptions? | <p>I recently wasted a lot of time trying to debug a WPF datagrid (from the WPF Toolkit). I had a column bound to a linq query with a property that was throwing an exception (in a few rows). WPF seems to catch the exception and it just makes the cells blank. I have fixed the bug causing the exception, but I would like ... | 978,901 | 5 | 0 | null | 2009-06-11 01:23:40.9 UTC | 9 | 2013-10-26 18:53:35.94 UTC | null | null | null | null | 118,736 | null | 1 | 21 | c#|.net|wpf|data-binding | 4,832 | <p>Databinding errors are swallowed natively, but they are displayed in the OUTPUT dialog in the visual studio interface. If you wish to be notified (and have as much control over it as possible), then you can use Trace Sources.</p>
<p>Bea Stollnitz provides a great writeup about this (and debuginng the bindings in ge... |
145,863 | Best Java/Swing browser component? | <p>What's the best cross platform Java Swing browser component at least able to play nicely in a swing interface (lightweight component ?) and able to run on MacOSX and Windows ?</p>
<p>Things like : <a href="http://code.google.com/p/flying-saucer//" rel="noreferrer">FlyingSaucer</a>, <a href="https://jdic.dev.java.ne... | 145,891 | 5 | 2 | null | 2008-09-28 13:45:56.92 UTC | 11 | 2012-09-03 23:06:43.987 UTC | null | null | null | JeanLaurent | 2,512 | null | 1 | 43 | java|swing|browser | 74,116 | <p>i belive this could help:</p>
<p><a href="http://djproject.sourceforge.net/ns/index.html" rel="noreferrer">http://djproject.sourceforge.net/ns/index.html</a></p> |
1,293,337 | How can I test final and static methods of a utility project? | <p>I'm trying to implement unit testing for aproject, it uses a legacy "utility" project that is littered with static methods and many of the classes are final or their methods are final. I'm not able to update the legacy project at all.</p>
<p>JMock and EasyMock both choke on final methods, and I don't see a nice wa... | 1,293,344 | 6 | 4 | null | 2009-08-18 11:41:56.037 UTC | 5 | 2019-01-10 15:32:19.323 UTC | 2009-08-18 11:56:06.163 UTC | null | 148,419 | null | 148,419 | null | 1 | 27 | java|junit | 39,204 | <p>If you're able to refactor your code, you can wrap your calls to the final/static methods in simple instance methods, for example:</p>
<pre><code>protected Foo doBar(String name) {
return Utility.doBar(name);
}
</code></pre>
<p>This allows you to override your wrapper method in the unit test to return a mock i... |
1,209,469 | storing android application data on SD Card | <p>Is there a way to store android application data on the SD card instead of in the internal memory?
I know how to transfer the application sqlite database from the internal memory to the SDCard, but what if the internal memory gets full in the first place? How does everyone handle this?</p> | 1,209,573 | 6 | 0 | null | 2009-07-30 21:24:29.48 UTC | 19 | 2013-03-07 00:28:15.023 UTC | 2012-08-22 18:22:46.427 UTC | null | 403,455 | null | 121,196 | null | 1 | 31 | android|memory-management|android-sdcard | 88,110 | <p><strong>Warning:</strong> This answer is out-dated. You should use <a href="http://developer.android.com/reference/android/os/Environment.html#getExternalStorageDirectory()" rel="nofollow noreferrer">Environment.getExternalStorageDirectory()</a> to get the root path of the SD card as mentioned in the answer... |
893,167 | How to Remove ReadOnly Attribute on File Using PowerShell? | <p>How can I remove the ReadOnly attribute on a file, using a PowerShell (version 1.0) script?</p> | 895,866 | 6 | 0 | null | 2009-05-21 14:20:31.59 UTC | 13 | 2017-11-07 14:23:34.987 UTC | 2013-10-15 08:51:27.767 UTC | null | 206,730 | null | 35,483 | null | 1 | 102 | powershell|powershell-1.0|scripting | 79,521 | <p>You can use <code>Set-ItemProperty</code>:</p>
<pre><code>Set-ItemProperty file.txt -name IsReadOnly -value $false
</code></pre>
<p>or shorter:</p>
<pre><code>sp file.txt IsReadOnly $false
</code></pre> |
58,764,811 | Object Oriented Programming - how to avoid duplication in processes that differ slightly depending on a variable | <p>Something that comes up quite a lot in my current work is that there is a generalised process that needs to happen, but then the odd part of that process needs to happen slightly differently depending on the value of a certain variable, and I'm not quite sure what's the most elegant way to handle this.</p>
<p>I'll ... | 58,765,168 | 10 | 10 | null | 2019-11-08 10:30:41.943 UTC | 9 | 2022-09-17 14:22:45.353 UTC | 2022-09-17 14:22:45.353 UTC | null | 7,132,550 | null | 2,257,227 | null | 1 | 64 | c#|.net|oop | 4,181 | <p>I would suggest encapsulating all options in one class:</p>
<pre><code>public class ProcessOptions
{
public bool Capitalise { get; set; }
public bool RemovePunctuation { get; set; }
public bool Replace { get; set; }
public char ReplaceChar { get; set; }
public char ReplacementChar { get; set; }
... |
20,926,551 | Recommended way of making React component/div draggable | <p>I want to make a draggable (that is, repositionable by mouse) React component, which seems to necessarily involve global state and scattered event handlers. I can do it the dirty way, with a global variable in my JS file, and could probably even wrap it in a nice closure interface, but I want to know if there's a wa... | 20,927,899 | 14 | 5 | null | 2014-01-04 20:46:40.397 UTC | 84 | 2022-07-11 14:35:50.39 UTC | null | null | null | null | 523,329 | null | 1 | 146 | javascript|reactjs | 211,824 | <p>I should probably turn this into a blog post, but here's pretty solid example.</p>
<p>The comments should explain things pretty well, but let me know if you have questions.</p>
<p>And here's the fiddle to play with: <a href="http://jsfiddle.net/Af9Jt/2/" rel="noreferrer">http://jsfiddle.net/Af9Jt/2/</a></p>
<pre>... |
17,690,776 | How to add pause to a Go program? | <p>When i ever execute a Go Console program it just executes in one second, I've been looking on Google, the Go website and Stackoverflow.</p>
<pre><code>import (
"fmt"
)
func main() {
fmt.Println()
}
</code></pre>
<p>It closes immediately when i execute it.</p>
<p>EDIT 2
actually i wanted the program to pe... | 17,690,896 | 4 | 0 | null | 2013-07-17 03:51:37.623 UTC | 12 | 2020-10-26 03:23:26.457 UTC | 2015-12-16 18:08:45.42 UTC | null | 538,551 | null | 2,567,256 | null | 1 | 46 | go | 45,338 | <p>You can pause the program for an arbitrarily long time by using <a href="http://golang.org/pkg/time/#example_Sleep"><code>time.Sleep()</code></a>. For example:</p>
<pre><code>package main
import ( "fmt"
"time"
)
func main() {
fmt.Println("Hello world!")
duration := time.Second
time.Sleep(d... |
21,104,702 | Dereferencing a pointer to 0 in C | <p>Sometimes data at memory address 0x0 is quite valuable -- take x86 real mode IVT as a more known example: it starts at 0x0 and contains pointers to interrupt handlers: a dword at 0x00 is a pointer to division by zero error handler.</p>
<p>However, C11 language standard prohibits dereferencing null pointers <a href=... | 21,104,798 | 5 | 9 | null | 2014-01-14 01:42:53.12 UTC | 10 | 2018-01-23 03:42:31.97 UTC | 2014-01-14 06:14:04.223 UTC | null | 527,702 | null | 3,192,369 | null | 1 | 55 | c|pointers|memory|dereference | 6,425 | <p>C does not <em>prohibit</em> dereferencing the null pointer, it merely makes it undefined behavior.</p>
<p>If your environment is such that you're able to dereference a pointer containing the address <code>0x0</code>, then you should be able to do so. The C language standard says nothing about what will happen when... |
22,992,543 | How do I git rebase the first commit? | <p>I used <code>git init</code> to create a fresh repo, then made three commits. Now I want to rebase to go back and amend my first commit, but if I do <code>git rebase -i HEAD~3</code> it complains! If I try the same with <code>HEAD~2</code> then it kinda works but only lets me rearrange the last two commits.</p>
<p>... | 23,000,315 | 2 | 2 | null | 2014-04-10 15:35:09.797 UTC | 68 | 2022-08-31 22:22:29.557 UTC | null | null | null | null | 304,282 | null | 1 | 376 | git|git-rebase | 77,485 | <p>The easy way, with a recent-enough Git (this has been out for a long time now so you should have this):</p>
<pre><code>git rebase -i --root
</code></pre>
<p>The other easy way, as <a href="https://stackoverflow.com/users/1253222/twalberg">twalberg</a> noted in a comment that has since been deleted but is now expande... |
2,208,926 | How to speedup xcode builds without any project modifications? | <p>Last version or XCode (3.2.1) is running very slow on OS X 10.6.</p>
<p>What kinds of tweaks can you do to your Mac in order to <strong>speedup Xcode build</strong> process. </p>
<p>I'm not looking for general hints like how to restructure your projects, just tweaks that are related to environment. </p>
<p>For ex... | 2,209,790 | 5 | 0 | null | 2010-02-05 17:08:21.89 UTC | 9 | 2011-11-16 15:24:54.217 UTC | 2010-02-05 18:56:28.893 UTC | null | 99,834 | null | 99,834 | null | 1 | 10 | xcode|macos|performance|xcodebuild|xcode3.2 | 5,427 | <p>I think I may got Xcode to build at decent speed with this command:</p>
<pre><code># Xcode 3.x
defaults write com.apple.Xcode PBXNumberOfParallelBuildSubtasks 4
# Xcode 4.x
defaults write com.apple.dt.Xcode IDEBuildOperationMaxNumberOfConcurrentCompileTasks 4
</code></pre>
<p>This will limit the number of process... |
1,714,761 | Download a file programmatically on Android | <p>I am downloading files from web server programmatically. After download is completed, I checked the file. The size ,extension and all other parameters are correct but when I try to play that file in media player it is showing that it is corrupted.</p>
<p>Here is my code:</p>
<pre><code> byte[] b = null;
Inp... | 1,718,140 | 5 | 1 | null | 2009-11-11 12:00:19.873 UTC | 23 | 2021-05-07 01:08:47.04 UTC | 2017-07-03 18:07:50.013 UTC | null | 1,033,581 | null | 152,867 | null | 1 | 34 | android | 93,658 | <p>This is some working code I have for downloading a given URL to a given File object. The File object (outputFile) has just been created using new File(path), I haven't called createNewFile or anything.</p>
<pre><code>private static void downloadFile(String url, File outputFile) {
try {
URL u = new URL(url)... |
1,349,740 | Arguments in @selector | <p>Is there any way that I can pass arguments in selector?</p>
<p><strong>example:</strong>
I have this method</p>
<pre><code>- (void)myMethod:(NSString*)value1 setValue2:(NSString*)value2{
}
</code></pre>
<p>and I need to call this function through a selector passing two arguments.</p>
<pre><code>[NSTimer schedul... | 1,349,800 | 5 | 0 | null | 2009-08-28 22:43:39.547 UTC | 20 | 2013-07-19 14:34:45.793 UTC | 2011-07-05 06:21:01.39 UTC | null | 147,019 | null | 162,266 | null | 1 | 35 | iphone|cocoa|cocoa-touch | 30,703 | <p>You could use the <code>NSTimer</code> method:</p>
<pre><code>+ (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)seconds
invocation:(NSInvocation *)invocation
repeats:(BOOL)repeats;
</code></pre>
<p>Instead, since an <code>NSInvocation</... |
2,269,307 | using jquery $.ajax to call a PHP function | <p>This may be a simple answer, but I'm using jQuery's $.ajax to call a PHP script. What I want to do is basically put that PHP script inside a function and call the PHP function from javascript. </p>
<pre><code><?php
if(isset($_POST['something'] {
//do something
}
?>
</code></pre>
<p>to this</p>
<pre><co... | 2,269,397 | 6 | 5 | null | 2010-02-15 22:15:57.557 UTC | 67 | 2018-05-20 15:04:08.613 UTC | 2018-03-16 10:39:29.747 UTC | null | 917,802 | null | 222,403 | null | 1 | 119 | php|jquery|ajax | 406,640 | <p>Use <code>$.ajax</code> to call a server context (or URL, or whatever) to invoke a particular 'action'. What you want is something like:</p>
<pre><code>$.ajax({ url: '/my/site',
data: {action: 'test'},
type: 'post',
success: function(output) {
alert(output);
... |
1,410,172 | Testing for multiple exceptions with JUnit 4 annotations | <p>Is it possible to test for multiple exceptions in a single JUnit unit test? I know for a single exception one can use, for example</p>
<pre><code> @Test(expected=IllegalStateException.class)
</code></pre>
<p>Now, if I want to test for another exception (say, NullPointerException), can this be done in the same ... | 1,410,254 | 7 | 1 | null | 2009-09-11 10:30:07.973 UTC | 5 | 2021-02-26 04:24:26.327 UTC | null | null | null | null | 171,993 | null | 1 | 27 | java|junit|exception | 55,782 | <p>You really want the test to do <em>one</em> thing, and to test for that. If you're not sure as to which exception is going to be thrown, that doesn't sound like a good test to me.</p>
<p>e.g. (in pseudo-code)</p>
<pre><code>try {
badOperation();
/// looks like we succeeded. Not good! Fail the test
fail();... |
2,016,513 | does continue work in a do while? | <p>I have a do while that looks like:</p>
<pre><code>User user = userDao.Get(1);
do
{
// processing
// get the next user
//
user = UserDao.GetNext(user.Id);
if(user == null)
continue; // will this work?????????????
}
while ( user != null)
</code></pre>
<p>If it does work, its going to go to the top ... | 2,016,563 | 7 | 6 | null | 2010-01-06 21:47:27.913 UTC | 3 | 2017-06-15 00:46:38.807 UTC | 2010-01-06 21:50:15.003 UTC | null | 65,295 | null | 68,183 | null | 1 | 29 | java|loops|do-while | 39,188 | <p>The continue makes it jump to the evaluation at the botton so the program can evaluate if it has to continue with another iteration or exit. In this case it will exit.</p>
<p>This is the specification: <a href="http://java.sun.com/docs/books/jls/third_edition/html/statements.html#6045" rel="noreferrer">http://java.... |
1,490,821 | What's the best way to get the current URL in Spring MVC? | <p>I'd like to create URLs based on the URL used by the client for the active request. Is there anything smarter than taking the current <code>HttpServletRequest</code> object and it's <code>getParameter...()</code> methods to rebuilt the complete URL including (and only) it's GET parameters.</p>
<p><strong>Clarificat... | 1,490,991 | 7 | 0 | null | 2009-09-29 06:08:43.62 UTC | 28 | 2021-05-26 01:34:46.693 UTC | 2018-12-27 10:01:57.9 UTC | null | 4,516,110 | null | 81,071 | null | 1 | 118 | url|spring-mvc|httprequest | 203,025 | <p>Well there are two methods to access this data easier, but the interface doesn't offer the possibility to get the whole URL with one call. You have to build it manually:</p>
<pre><code>public static String makeUrl(HttpServletRequest request)
{
return request.getRequestURL().toString() + "?" + request.getQuerySt... |
1,657,282 | How to remove numbers from string using Regex.Replace? | <p>I need to use <code>Regex.Replace</code> to remove all numbers and signs from a string.</p>
<p>Example input: <code>123- abcd33</code><br>
Example output: <code>abcd</code></p> | 1,657,288 | 8 | 1 | null | 2009-11-01 14:21:31.503 UTC | 5 | 2022-01-09 02:32:08.223 UTC | 2019-03-19 08:55:21.327 UTC | null | 3,885,376 | null | 43,907 | null | 1 | 82 | c#|regex | 147,626 | <p>Try the following:</p>
<pre><code>var output = Regex.Replace(input, @"[\d-]", string.Empty);
</code></pre>
<p>The <code>\d</code> identifier simply matches any digit character.</p> |
2,310,498 | Why doesn't String's hashCode() cache 0? | <p>I noticed in the Java 6 source code for String that hashCode only caches values other than 0. The difference in performance is exhibited by the following snippet:</p>
<pre><code>public class Main{
static void test(String s) {
long start = System.currentTimeMillis();
for (int i = 0; i < 10000000; i... | 2,313,224 | 9 | 2 | null | 2010-02-22 11:20:12.76 UTC | 22 | 2020-09-26 22:11:03.19 UTC | 2018-10-08 17:11:27.243 UTC | null | 1,033,581 | null | 276,101 | null | 1 | 77 | java|string|hashcode | 12,360 | <p>You're worrying about nothing. Here's a way to think about this issue.</p>
<p>Suppose you have an application that does nothing but sit around hashing Strings all year long. Let's say it takes a thousand strings, all in memory, calls hashCode() on them repeatedly in round-robin fashion, a million times through, t... |
1,693,041 | How to stop a java application? | <p>I have made a java application and have packed it into an executable jar file. Now a user can start that program from either of the following two ways:</p>
<ol>
<li><p>Start if from command prompt by executing the following command on the command prompt:</p>
<p>java -jar "MyJar.jar"</p></li>
<li><p>By double click... | 1,693,193 | 10 | 0 | null | 2009-11-07 13:35:40.573 UTC | 4 | 2013-07-29 06:58:31.487 UTC | 2009-11-07 13:46:37.93 UTC | null | 157,027 | null | 157,027 | null | 1 | 4 | java | 59,352 | <p>Stopping (exiting) the application should be inside the application. Whether it is command line or GUI based, the application developer should write code to exit it (For eg., in a command line application you might have something like <code>Press 5 to exit</code>, <code>Press Esc to Exit</code> etc) and in an applic... |
1,857,822 | Unique model field in Django and case sensitivity (postgres) | <p>Consider the following situation: -</p>
<p>Suppose my app allows users to create the states / provinces in their
country. Just for clarity, we are considering only ASCII characters
here.</p>
<p>In the US, a user could create the state called "Texas". If this app
is being used internally, let's say the user doesn't... | 1,905,928 | 10 | 4 | null | 2009-12-07 04:31:16.217 UTC | 11 | 2018-10-27 16:03:16.127 UTC | null | null | null | null | 46,928 | null | 1 | 31 | django|postgresql|django-models|unique | 13,489 | <p>You could define a custom model field derived from <code>models.CharField</code>.
This field could check for duplicate values, ignoring the case.</p>
<p>Custom fields documentation is here <a href="http://docs.djangoproject.com/en/dev/howto/custom-model-fields/" rel="noreferrer">http://docs.djangoproject.com/en/dev... |
1,369,361 | How can I programmatically create, read, write an excel without having office installed? | <p>I'm confused as hell with all the bazillion ways to read/write/create excel files. VSTO, OLEDB, etc, but they all <em>seem</em> to have the requirement that office must be installed.</p>
<p>Here is my situation: I need to develop an app which will take an excel file as input, do some calculations and create a new e... | 1,369,413 | 11 | 7 | null | 2009-09-02 18:24:54.093 UTC | 9 | 2017-08-18 17:09:41.343 UTC | 2017-04-15 18:48:45.617 UTC | null | 1,033,581 | null | 750 | null | 1 | 31 | c#|excel | 16,461 | <p>write your excel in HTML table format:</p>
<pre><code><html>
<body>
<table>
<tr>
<td style="background-color:#acc3ff">Cell1</td>
<td style="font-weight:bold">Cell2</td>
</tr>
</table>
</body>
</html>
</code></pre>
<p>and gi... |
2,323,292 | Assign output of a program to a variable using a MS batch file | <p>I need to assign the output of a program to a variable using a MS batch file.</p>
<p>So in GNU Bash shell I would use <code>VAR=$(application arg0 arg1)</code>. I need a similar behavior in Windows using a batch file.</p>
<p>Something like <code>set VAR=application arg0 arg1</code>.</p>
<h3>Similar Questions</h3>
<u... | 2,340,018 | 11 | 0 | null | 2010-02-24 02:33:31.61 UTC | 93 | 2022-08-28 17:59:18.727 UTC | 2022-05-24 16:09:41.987 UTC | null | 1,366,033 | null | 193,315 | null | 1 | 341 | batch-file|cmd|variable-assignment|windows-console | 383,829 | <p>One way is:</p>
<pre><code>application arg0 arg1 > temp.txt
set /p VAR=<temp.txt
</code></pre>
<p>Another is:</p>
<pre><code>for /f %%i in ('application arg0 arg1') do set VAR=%%i
</code></pre>
<p>Note that the first <code>%</code> in <code>%%i</code> is used to escape the <code>%</code> after it and is ne... |
1,568,057 | ASCII strings and endianness | <p>An intern who works with me showed me an exam he had taken in computer science about endianness issues. There was a question that showed an ASCII string "My-Pizza", and the student had to show how that string would be represented in memory on a little endian computer. Of course, this sounds like a trick question b... | 1,568,113 | 12 | 16 | null | 2009-10-14 18:12:50.657 UTC | 23 | 2019-08-24 00:36:32.833 UTC | 2009-10-15 05:13:06.417 UTC | null | 57,428 | null | 168,288 | null | 1 | 50 | c|ascii|endianness | 30,955 | <p>Without a doubt, you are correct.</p>
<p>ANSI C standard 6.1.4 specifies that string literals are stored in memory by "concatenating" the characters in the literal.</p>
<p>ANSI standard 6.3.6 also specifies the effect of addition on a pointer value:</p>
<blockquote>
<p>When an expression that has integral type ... |
2,169,732 | Most efficient solution for reading CLOB to String, and String to CLOB in Java? | <p>I have a big CLOB (more than 32kB) that I want to read to a String, using StringBuilder. How do I do this in the most efficient way? I can not use the "int length" constructor for StringBuilder since the lenght of my CLOB is longer than a "int" and needs a "long" value.</p>
<p>I am not that confortable with the Jav... | 2,171,455 | 12 | 9 | null | 2010-01-30 22:36:54.59 UTC | 12 | 2021-01-12 17:57:06.157 UTC | 2010-01-30 22:58:35.617 UTC | null | 213,269 | null | 213,269 | null | 1 | 54 | java|stringbuilder|clob | 178,592 | <blockquote>
<p>I can not use the "int length" constructor for <code>StringBuilder</code> since the length of my CLOB is longer than a <code>int</code> and needs a <code>long</code> value.</p>
</blockquote>
<p>If the CLOB length is greater than fits in an int, the CLOB data won't fit in a String either. You'll have ... |
1,561,554 | Cocoa-Touch: How do I see if two NSDates are in the same day? | <p>I need to know if two NSDate instances are both from the same day.</p>
<p>Is there an easier/better way to do it than getting the NSDateComponents and comparing day/month/year?</p> | 1,561,593 | 12 | 1 | null | 2009-10-13 16:59:12.277 UTC | 9 | 2017-03-17 20:05:13.48 UTC | 2015-04-26 00:48:34.703 UTC | null | 1,693,173 | null | 21,240 | null | 1 | 67 | ios|objective-c|macos|cocoa-touch | 22,044 | <p>NSDateComponents sounds like the best bet to me. Another tactic to try is toll-free-bridging it to a CFDate, then using CFDateGetAbsoluteTime and doing a subtraction to get the amount of time between the two dates. You'll have to do some additional math to figure out if the time difference lands the dates on the sam... |
1,899,072 | Getting a list of folders in a directory | <p>How do I get a list of the folders that exist in a certain directory with ruby?</p>
<p><code>Dir.entries()</code> looks close but I don't know how to limit to folders only.</p> | 1,899,164 | 13 | 0 | null | 2009-12-14 05:26:06.323 UTC | 12 | 2020-05-14 07:31:27.557 UTC | 2009-12-14 06:11:46.62 UTC | null | 39,892 | null | 126,163 | null | 1 | 95 | ruby|directory|directory-listing | 68,329 | <p>Jordan is close, but <code>Dir.entries</code> doesn't return the full path that <code>File.directory?</code> expects. Try this:</p>
<pre><code> Dir.entries('/your_dir').select {|entry| File.directory? File.join('/your_dir',entry) and !(entry =='.' || entry == '..') }
</code></pre> |
1,976,007 | What characters are forbidden in Windows and Linux directory names? | <p>I know that <code>/</code> is illegal in Linux, and the following are illegal in Windows
(I think) <code>*</code> <code>.</code> <code>"</code> <code>/</code> <code>\</code> <code>[</code> <code>]</code> <code>:</code> <code>;</code> <code>|</code> <code>,</code></p>
<p>What else am I missing?</p>
<p>I need a c... | 1,976,050 | 19 | 13 | null | 2009-12-29 18:11:36.49 UTC | 170 | 2022-07-03 01:28:00.653 UTC | 2021-04-29 02:28:58.807 UTC | null | 1,832,568 | null | 33,775 | null | 1 | 538 | windows|linux|directory|zip|filenames | 587,684 | <p>A “comprehensive guide” of forbidden filename characters is not going to work on Windows because it reserves filenames as well as characters. Yes, characters like
<code>*</code> <code>"</code> <code>?</code> and others are forbidden, but there are a infinite number of names composed only of valid characters that are... |
33,811,041 | Javascript: Zoom in on mouseover WITHOUT Jquery or plugins | <p>I've looked for this everywhere for weeks, and I simply cannot find something to tell me what I'm doing wrong or how to even proceed. The goal is to create a function similar to Amazon's zoom in on mouseover for products with small images.</p>
<p>I'm currently at a loss for how to proceed, though I am aware that I ... | 33,811,884 | 4 | 4 | null | 2015-11-19 17:56:05.413 UTC | 9 | 2021-03-31 19:19:03.17 UTC | 2015-11-19 18:04:00.68 UTC | null | 5,162,489 | null | 5,162,489 | null | 1 | 21 | javascript|html|css|zooming|mouseover | 59,779 | <p>you can just do it by playing background-position on mouse-over just moving background-position on mouseover <a href="http://codepen.io/anon/pen/NGJJeB" rel="nofollow noreferrer">DEMO</a></p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
<div class="snippet-code">
... |
8,486,165 | What can cause a persistent "Reload the page to get source for" error in firebug? | <p>I'm trying to debug the javascript of a specific page, and I keep seeing</p>
<p><code>Reload the page to get source for page.htm</code> in Firebug.</p>
<p>On Chrome, I'm mostly able to debug the js, but sometimes I also get a blank page. What can cause such issues? </p>
<p>I believe I always see a blank page in C... | 11,252,883 | 10 | 2 | null | 2011-12-13 08:23:31.657 UTC | 3 | 2014-02-06 07:20:31.453 UTC | null | null | null | null | 11,236 | null | 1 | 24 | javascript|firefox|firebug | 44,900 | <p>With firebug icon, you'll see a dropdown arrow. Click that arrow to open up the drop down menu.</p>
<p><img src="https://i.stack.imgur.com/fbdNu.png" alt="enter image description here"></p>
<p>Click <strong>Clear Activation List.</strong></p>
<p>Refresh the page now.</p>
<p>Now under script tab you'd see the Rel... |
6,736,189 | How to Add "Write a Review" / "Rate Us" Feature to My App? | <p>I wish to add some sort of a "Write a Review" or "Rate Us" feature to my app so my customers can easily rate and review my app.</p>
<p>Best practice I can think of is to have some sort of pop-up or open a UIWebView within my app so the user is not kicked off of my app while opening the App Store application as done... | 10,263,602 | 3 | 2 | null | 2011-07-18 16:33:20.327 UTC | 29 | 2022-04-07 12:29:32.433 UTC | 2022-04-07 12:29:32.433 UTC | null | 1,839,439 | null | 1,143,060 | null | 1 | 39 | ios|uiwebview|popup|review | 41,312 | <h1>StoreKit API (iOS 10.3 and up)</h1>
<p>As of iOS 10.3, the StoreKit API provides a way to request a review on the App Store without leaving your app. When called, the system may present the user with an alert that requests a review. The user may provide a star rating directly inside the alert, continue on to write... |
35,207,515 | What is the purpose of a single pound/hash sign (#) on its own line in the C/C++ preprocessor? | <p>I have been looking at the <a href="http://en.wikipedia.org/wiki/Boost_%28C%2B%2B_libraries%29">Boost</a> libraries source code, and I have noticed that often there are single pound signs without any preprocessor directives attached to them. I read through the GCC preprocessor manual and specification guide and can'... | 35,207,652 | 3 | 8 | null | 2016-02-04 17:20:57.113 UTC | 12 | 2018-11-19 12:20:42.223 UTC | 2016-02-06 20:54:05.94 UTC | null | 63,550 | null | 4,975,646 | null | 1 | 147 | c++|c|boost|c-preprocessor | 16,127 | <p>A <code>#</code> on its own on a line has no effect at all. I assume it's being used for aesthetic value.</p>
<p>The C standard says:</p>
<blockquote>
<p><strong>6.10.7 Null directive</strong></p>
<p><strong>Semantics</strong></p>
<p>A preprocessing directive of the form</p>
<p><code># new-line</code></p>
<p>has no ... |
40,273,463 | Angular 2 - Global CSS file | <p>Is it possible to add a global CSS file to Angular 2?
At the moment I have many different components that have the same button styling - but each of the components have their own CSS file with the styling. This is frustrating for changes.</p>
<p>I read somewhere on Stack Overflow to add:</p>
<pre><code>import { V... | 40,273,782 | 3 | 4 | null | 2016-10-26 22:59:27.107 UTC | 5 | 2019-05-04 19:20:52.13 UTC | null | null | null | null | 5,338,991 | null | 1 | 58 | css|angular|angular-cli | 65,984 | <p>You can simply import the css in the main html file.</p> |
1,128,305 | Regex for PascalCased words (aka camelCased with leading uppercase letter) | <p>How do I find all <a href="http://wiki.c2.com/?PascalCase" rel="noreferrer">PascalCased</a> words in a document with a regular expression? </p>
<p>If you don't know the word Pascal cased, I'm only concerned with leading <strong>Upper camel case</strong> (i.e., camel cased words in which the first letter is capitali... | 1,128,326 | 9 | 2 | null | 2009-07-14 21:59:56.233 UTC | 14 | 2022-08-13 15:40:27.81 UTC | 2019-08-22 07:59:46.14 UTC | null | 7,059,810 | null | 25,068 | null | 1 | 46 | regex|search|camelcasing|pascalcasing | 51,533 | <pre><code>([A-Z][a-z0-9]+)+
</code></pre>
<p>Assuming English. Use appropriate character classes if you want it internationalizable. This will match words such as "This". If you want to only match words with at least two capitals, just use</p>
<pre><code>([A-Z][a-z0-9]+){2,}
</code></pre>
<p>UPDATE:
As I mention... |
586,284 | Finding prime numbers with the Sieve of Eratosthenes (Originally: Is there a better way to prepare this array?) | <p><strong>Note:</strong> Version 2, below, uses the Sieve of Eratosthenes. There are several answers that helped with what I originally asked. I have chosen the Sieve of Eratosthenes method, implemented it, and changed the question title and tags appropriately. Thanks to everyone who helped!</p>
<h2>Introduction</... | 586,302 | 13 | 7 | null | 2009-02-25 14:54:13.983 UTC | 9 | 2019-04-23 09:14:58.073 UTC | 2017-05-23 11:55:06.673 UTC | eleven81 | -1 | eleven81 | 43,263 | null | 1 | 22 | java|arrays|primes|sieve-of-eratosthenes | 42,495 | <p>Your method of finding primes, by comparing every single element of the array with every possible factor is hideously inefficient. You can improve it immensely by doing a <a href="http://en.wikipedia.org/wiki/Sieve_of_Erastosthenes" rel="noreferrer">Sieve of Eratosthenes</a> over the entire array at once. Besides d... |
703,948 | What is the difference between a data flow diagram and a flow chart? | <p>I want to know why we use Data Flow Diagrams instead of flow charts.</p> | 703,960 | 14 | 1 | null | 2009-04-01 03:28:41.187 UTC | 1 | 2017-05-05 09:35:13.587 UTC | 2014-02-25 18:57:45.4 UTC | null | 321,731 | Rahul Vyas | 83,905 | null | 1 | 14 | flowchart | 129,689 | <p>You should use whatever you like. The diagram is just a tool. Use whatever tool fits you and your problem best. I usually just use boxes and arrows and squiggles and circles and little stick figures and whatever else I think gets the point across to the viewer. In short it doesn't matter if you even use a standard d... |
85,992 | How do I enumerate the properties of a JavaScript object? | <p>How do I enumerate the properties of a JavaScript object?</p>
<p>I actually want to list all the defined variables and their values, but I've learned that defining a variable actually creates a property of the window object.</p> | 86,014 | 14 | 0 | null | 2008-09-17 18:10:18.38 UTC | 136 | 2018-08-25 12:03:24.387 UTC | 2015-06-01 22:50:09.06 UTC | null | 63,550 | davenpcj | 4,777 | null | 1 | 719 | javascript|properties | 612,589 | <p>Simple enough:</p>
<pre><code>for(var propertyName in myObject) {
// propertyName is what you want
// you can get the value like this: myObject[propertyName]
}
</code></pre>
<p>Now, you will not get private variables this way because they are not available.</p>
<hr>
<p>EDIT: <a href="https://stackoverflow.... |
1,332,778 | What are your most common sql optimizations? | <p>What are your most common SQL optimization that you used?</p> | 1,332,805 | 17 | 0 | 2009-08-26 11:10:14.107 UTC | 2009-08-26 06:48:49.173 UTC | 25 | 2022-08-18 17:57:51.697 UTC | 2018-02-27 08:02:28.107 UTC | null | 680,068 | null | 153,621 | null | 1 | 33 | sql|optimization | 14,336 | <p>Reducing the amount of data that is returned, by only returning the fields required and only returning the rows required. This is the most common, as you do it for every query that returns data.</p>
<p>With ENGINE=InnoDB, the above advice especially applies to avoiding unnecessary fetching of <code>TEXT</code> and <... |
1,032,914 | How to make a div fill a remaining horizontal space? | <p><strong>I have 2 divs:</strong> one in the left side and one in the right side of my page. The one in the left side has fixed width and I want the one of the right side to fill the remaining space.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snipp... | 1,032,952 | 26 | 6 | null | 2009-06-23 14:29:30.553 UTC | 101 | 2021-07-27 14:34:19.35 UTC | 2020-03-10 02:14:33.463 UTC | null | 6,904,888 | null | 122,536 | null | 1 | 492 | html|css|width|responsive | 617,623 | <p>This seems to accomplish what you're going for.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>#left {
float:left;
width:180px;
background-color:#ff0000;
}
#right... |
854,128 | Find duplicate records in MySQL | <p>I want to pull out duplicate records in a MySQL Database. This can be done with:</p>
<pre><code>SELECT address, count(id) as cnt FROM list
GROUP BY address HAVING cnt > 1
</code></pre>
<p>Which results in:</p>
<pre><code>100 MAIN ST 2
</code></pre>
<p>I would like to pull it so that it shows each row that... | 854,177 | 28 | 0 | null | 2009-05-12 18:24:21.757 UTC | 244 | 2022-07-28 01:09:59.52 UTC | null | null | null | null | 497 | null | 1 | 725 | mysql|duplicates | 881,451 | <p>The key is to rewrite this query so that it can be used as a subquery.</p>
<pre><code>SELECT firstname,
lastname,
list.address
FROM list
INNER JOIN (SELECT address
FROM list
GROUP BY address
HAVING COUNT(id) > 1) dup
ON list.address = dup.add... |
6,800,509 | Are there APIs for text analysis/mining in Java? | <p>I want to know if there is an API to do text analysis in Java. Something that can extract all words in a text, separate words, expressions, etc. Something that can inform if a word found is a number, date, year, name, currency, etc.</p>
<p>I'm starting the text analysis now, so I only need an API to kickoff. I mad... | 6,800,681 | 5 | 7 | null | 2011-07-23 12:56:34.703 UTC | 10 | 2012-12-14 18:39:38.947 UTC | 2011-07-25 18:41:56.737 UTC | null | 734,984 | null | 734,984 | null | 1 | 25 | java|api|nlp|analysis|text-mining | 16,385 | <p>For example - you might use some classes from standard library <code>java.text</code>, or use <code>StreamTokenizer</code> (you might customize it according to your requirements). But as you know - <strong>text data from internet sources is usually has many orthographical mistakes</strong> and for better performance... |
6,323,296 | Python remove anything that is not a letter or number | <p>I'm having a little trouble with Python regular expressions.</p>
<p>What is a good way to remove all characters in a string that are not letters or numbers?</p>
<p>Thanks!</p> | 6,325,804 | 7 | 1 | null | 2011-06-12 17:09:48.13 UTC | 11 | 2012-09-02 05:09:23.287 UTC | null | null | null | null | 84,131 | null | 1 | 37 | python|regex|string | 55,874 | <p><code>[\w]</code> matches (alphanumeric or underscore).</p>
<p><code>[\W]</code> matches (not (alphanumeric or underscore)), which is equivalent to (not alphanumeric and not underscore)</p>
<p>You need <code>[\W_]</code> to remove ALL non-alphanumerics.</p>
<p>When using re.sub(), it will be much more efficient i... |
6,334,830 | PHP: Possible to automatically get all POSTed data? | <p>Simple question: Is it possible to get all the data POSTed to a page, even if you don't know all the fields?</p>
<p>For example, I want to write a simple script that collects any POSTed data and emails it. I can foresee that the fields in the form are likely to change a lot over time, and so to save myself some tim... | 6,334,857 | 9 | 2 | null | 2011-06-13 18:52:32.347 UTC | 19 | 2022-09-24 18:33:56.073 UTC | 2015-11-09 04:57:47.927 UTC | null | 408,262 | null | 199,700 | null | 1 | 65 | php|forms|post | 145,474 | <p>Sure. Just walk through the <code>$_POST</code> array:</p>
<pre><code>foreach ($_POST as $key => $value) {
echo "Field ".htmlspecialchars($key)." is ".htmlspecialchars($value)."<br>";
}
</code></pre> |
6,711,295 | How to check if Facebook is installed Android | <p>I am modifying my app to be able to catch if a user tries to publish without having the facebook app installed (required for SSO). Here is the code I am using:</p>
<pre><code>try{
ApplicationInfo info = getPackageManager().
getApplicationInfo("com.facebook.android", 0 );
return true;
} catch( P... | 6,711,348 | 9 | 0 | null | 2011-07-15 18:01:44.06 UTC | 16 | 2021-12-07 06:00:00.007 UTC | 2017-05-23 12:08:54.16 UTC | null | -1 | null | 796,231 | null | 1 | 68 | android|facebook|package | 57,891 | <p><code>com.facebook.android</code> is the package name for the Facebook SDK. The Facebook app's package is <code>com.facebook.katana</code>.</p> |
6,332,577 | Send Outlook Email Via Python? | <p>I am using <code>Outlook 2003</code>.</p>
<p>What is the best way to send email (through <code>Outlook 2003</code>) using <code>Python</code>?</p> | 6,332,639 | 9 | 2 | null | 2011-06-13 15:31:43.81 UTC | 63 | 2022-05-16 00:30:14.213 UTC | null | null | null | null | 540,009 | null | 1 | 94 | python|outlook | 321,522 | <p>For a solution that uses outlook see <a href="https://stackoverflow.com/a/17887528/5211833">TheoretiCAL's answer</a>.</p>
<p>Otherwise, use the smtplib that comes with python. Note that this will require your email account allows smtp, which is not necessarily enabled by default.</p>
<pre><code>SERVER = "smtp.e... |
6,556,522 | Authentication versus Authorization | <p>What's the difference in context of web applications? I see the abbreviation "auth" a lot. Does it stand for <strong>auth</strong>-entication or <strong>auth</strong>-orization? Or is it both?</p> | 6,556,548 | 17 | 4 | null | 2011-07-02 10:44:19.63 UTC | 197 | 2022-03-27 13:54:08.44 UTC | 2018-09-26 17:00:48.873 UTC | null | 458,610 | null | 458,610 | null | 1 | 699 | security|authorization|authentication | 253,636 | <blockquote>
<p><strong>Authentication</strong> is the process of ascertaining that somebody really is who they claim to be.</p>
<p><strong>Authorization</strong> refers to rules that determine who is allowed to do what. E.g. Adam may be authorized to create and delete databases,
while Usama is only authorised... |
41,459,657 | How to create dynamic plots to display on Flask? | <p>I wish to create dynamic plots based on user input on a flask app. However I am getting the following error:
string argument expected, got 'bytes'</p>
<p>If I use io.BytesIO(), I am not getting this error, but I am not getting the plot on test.html</p>
<pre><code>from flask import Flask
from flask import render_t... | 41,460,112 | 1 | 1 | null | 2017-01-04 08:51:36.053 UTC | 13 | 2017-01-04 09:17:41.22 UTC | null | null | null | null | 4,059,923 | null | 1 | 14 | python|flask|io | 20,923 | <p>Use <code>BytesIO</code> and later <code>decode()</code></p>
<p>Working example</p>
<pre><code>from flask import Flask
#from flask import render_template
import matplotlib.pyplot as plt
import io
import base64
app = Flask(__name__)
@app.route('/plot')
def build_plot():
img = io.BytesIO()
y = [1,2,3,4,5... |
15,571,022 | How to find reason for Generic GDI+ error when saving an image? | <p>Having a code that works for ages when loading and storing images, I discovered that I have <em>one single image</em> that breaks this code:</p>
<pre><code>const string i1Path = @"c:\my\i1.jpg";
const string i2Path = @"c:\my\i2.jpg";
var i = Image.FromFile(i1Path);
i.Save(i2Path, ImageFormat.Jpe... | 15,595,846 | 10 | 2 | null | 2013-03-22 13:02:40.26 UTC | 9 | 2020-09-18 04:59:44.637 UTC | 2020-09-18 04:59:44.637 UTC | null | 107,625 | null | 107,625 | null | 1 | 43 | c#|.net|image|gdi+|system.drawing | 113,868 | <p>While I still did not find out the reason what exactly caused the error when saving the image, I found a workaround to apply:</p>
<pre><code>const string i1Path = @"c:\my\i1.jpg";
const string i2Path = @"c:\my\i2.jpg";
var i = Image.FromFile(i1Path);
var i2 = new Bitmap(i);
i2.Save(i2Path, ImageFormat.Jpeg);
</co... |
10,413,704 | How to select value of input onClick? | <p>I have a <code><input type="text"></code> and if user clicks inside it I want to make the content (value) of that box selected. How would I do that?</p> | 10,413,799 | 4 | 3 | null | 2012-05-02 12:25:19.63 UTC | 7 | 2017-10-27 10:32:05.063 UTC | 2012-10-29 15:42:53.613 UTC | null | -1 | null | 1,368,173 | null | 1 | 27 | javascript | 59,188 | <pre><code><input type="text" onclick="select()"/>
</code></pre> |
10,803,296 | Modifying replace string in xargs | <p>When I am using <code>xargs</code> sometimes I do not need to explicitly use the replacing string:</p>
<pre><code>find . -name "*.txt" | xargs rm -rf
</code></pre>
<p>In other cases, I want to specify the replacing string in order to do things like:</p>
<pre><code>find . -name "*.txt" | xargs -I '{}' mv '{}' /foo... | 10,805,692 | 8 | 4 | null | 2012-05-29 16:41:51.147 UTC | 31 | 2022-02-22 10:31:31.063 UTC | 2012-05-29 20:05:35.06 UTC | null | 1,135,819 | null | 1,135,819 | null | 1 | 74 | bash|xargs | 74,210 | <p>In cases like this, a <code>while</code> loop would be more readable:</p>
<pre><code>find . -name "*.txt" | while IFS= read -r pathname; do
base=$(basename "$pathname"); name=${base%.*}; ext=${base##*.}
mv "$pathname" "foo/${name}.bar.${ext}"
done
</code></pre>
<p>Note that you may find files with the same... |
13,309,103 | AUGraph Record and Play with RemoteIO and MultiChannelMixer | <p>i have a Problem ;)</p>
<p>i want to record Audio from the Mic and Write it to the Filesystem with Extended Audio File Services and also play the recorded Stuff.
if i only use the remoteIO with two callbacks one for read one for write it works.</p>
<p>For the Volumen Control i want to use the MultiChannelMixer and... | 13,444,724 | 1 | 0 | null | 2012-11-09 13:34:43.843 UTC | 8 | 2012-11-18 21:21:20.06 UTC | 2012-11-14 14:19:58.743 UTC | null | 318,272 | null | 318,272 | null | 1 | 8 | objective-c|audio|core-audio|record|playback | 3,117 | <p>You need create AUGraph with three nodes (units):</p>
<ol>
<li>File Player (kAudioUnitSubType_AudioFilePlayer)</li>
<li>RemoteIO</li>
<li>Mixer</li>
</ol>
<p>Connect them like this:</p>
<pre><code>AUGraphConnectNodeInput(m_graph, m_player, 0, m_mixerNode, 0); // player -> mixer
AUGraphConnectNodeInput(m_graph,... |
13,750,953 | Is it possible to configure user.name and user.email per wildcard domains in .gitconfig? | <p>I have a work computer, and it's configured globally to use my work email and name when committing. This is good. However, I'd like to make some sort of rule that says, "if the repo origin is github, use user X and email Y"</p>
<p>I realize you can make a config entry per repository, but I'd like it to be more auto... | 46,239,540 | 5 | 2 | null | 2012-12-06 19:21:05.013 UTC | 12 | 2018-01-16 08:16:50.36 UTC | 2015-01-07 12:20:57.74 UTC | null | 895,245 | null | 169,491 | null | 1 | 49 | git|github | 14,204 | <p>Git <a href="https://github.com/blog/2360-git-2-13-has-been-released" rel="noreferrer">2.13 adds</a> support for conditional config includes. If you organize your checkouts into directories for each domain of work, then you can add custom settings based on where the checkouts are. In your global git config:</p>
<pr... |
24,301,235 | Tint menu icons | <p>I'm building an Android app and I use the icons from the Action Bar Icon Pack to use in the action bar. I define them through the xml files in the <code>menu</code> folder.
Is there a way to "tint" these icons so that they are all the same color?
So far, I have to do it manually with an image editing software but if... | 24,333,131 | 4 | 2 | null | 2014-06-19 07:40:33.827 UTC | 12 | 2018-01-24 14:35:44.397 UTC | null | null | null | null | 1,644,052 | null | 1 | 19 | android|xml|menu | 19,312 | <p>There may be a better way to do this, but one option is to redraw the icon in code.</p>
<p>Suppose you have a menu item for favorites and want to tint it gray:</p>
<pre class="lang-java prettyprint-override"><code>MenuItem favoriteItem = menu.findItem(R.id.action_favorite);
Drawable newIcon = (Drawable)favoriteIte... |
24,043,688 | postgresql using json sub-element in where clause | <p>This might be a very basic question but I am not able to find anything on this online.</p>
<p>If I create a sample table :</p>
<pre><code> create table dummy ( id int not null, data json );
</code></pre>
<p>Then, if I query the table using the following query:</p>
<pre><code>select * from dummy where data->'x... | 24,044,453 | 2 | 2 | null | 2014-06-04 17:20:02.323 UTC | 9 | 2014-06-04 18:13:33.417 UTC | null | null | null | null | 3,097,807 | null | 1 | 27 | sql|json|database|postgresql|postgresql-9.3 | 26,508 | <blockquote>
<p>Am I missing something here or typecasting is the only way I can get
an integer value from a json field ? </p>
</blockquote>
<p>You're correct, typecasting is the only way to read an integer value from a json field.</p>
<blockquote>
<p>If that's the case, does it not affect the performance when ... |
29,711,728 | How to Sort Geo-points according to the distance from current location in Android | <p>I have a "Place" object with a LatLng coordinate for each:</p>
<pre><code>import com.google.android.gms.maps.model.LatLng;
public class Place{
public String name;
public LatLng latlng;
public Restaurant(String name, LatLng latlng) {
this.name = name;
this.latlng = latlng;
}
}
</cod... | 29,713,656 | 4 | 3 | null | 2015-04-18 01:08:01.877 UTC | 14 | 2018-03-04 04:48:14.413 UTC | 2015-04-18 06:43:04.977 UTC | null | 2,126,077 | null | 1,282,637 | null | 1 | 8 | android|geolocation|latitude-longitude | 16,504 | <p>Taking the algorithm from <a href="https://stackoverflow.com/questions/5396286/sort-list-of-lon-lat-points-start-with-nearest/5396425#5396425">this answer</a> from the question posted by @shieldstroy, that uses the <a href="http://en.wikipedia.org/wiki/Great-circle_distance" rel="noreferrer">Great Circle Distance</a... |
16,372,593 | How to get facebook profile picture of user in facebook SDK 3.0 Android | <p>i am using facebook SDK 3.0 i have to get profile picture of user login.
Here is the code I use: </p>
<pre><code>URL image_value = new URL("http://graph.facebook.com/"+id+"/picture" );
profPict=BitmapFactory.decodeStream(image_value.openConnection().getInputStream());
</code></pre>
<p>But I don't get the desired r... | 17,794,658 | 8 | 1 | null | 2013-05-04 09:09:41.23 UTC | 9 | 2016-09-23 13:00:10.96 UTC | 2013-05-04 15:16:17.44 UTC | null | 1,677,125 | null | 2,349,436 | null | 1 | 15 | android|facebook|facebook-android-sdk | 28,091 | <p>You should change your code following:</p>
<pre><code>URL image_value = new URL("http://graph.facebook.com/"+id+"/picture" );
</code></pre>
<p>Possible GET parameters for the URL can be found here:
<a href="https://developers.facebook.com/docs/graph-api/reference/user/picture/" rel="noreferrer">https://developers.... |
16,105,718 | DataGridView changing cell background color | <p>I have the following code :</p>
<pre><code>private void dgvStatus_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
{
foreach (DataGridViewRow row in dgvStatus.Rows)
{
row.Cells[color.Index].Style.BackColor = Color.FromArgb(((GesTest.dsEssais.FMstatusAnomalieRow)row.DataBoun... | 16,106,585 | 10 | 0 | null | 2013-04-19 13:25:36.653 UTC | 4 | 2020-05-25 12:27:44.753 UTC | 2018-12-21 18:13:28.267 UTC | null | 3,998,265 | null | 2,145,522 | null | 1 | 20 | c#|winforms|datagridview | 164,096 | <p>I finally managed to get it working. Here the code :</p>
<pre><code>private void dgvStatus_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (e.ColumnIndex != color.Index)
return;
e.CellStyle.BackColor = Color.FromArgb(int.Parse(((DataRowView)dgvStatus.Rows[e.RowIndex].DataB... |
16,432,265 | What's the difference between runghc and runhaskell? | <p>RWH suddenly started using runhaskell instead of runghc. What's the difference? As far as I can tell, they work the same.</p> | 16,432,345 | 1 | 0 | null | 2013-05-08 03:40:53.13 UTC | 2 | 2015-05-14 01:56:09.68 UTC | null | null | null | null | 926,143 | null | 1 | 38 | haskell | 8,281 | <p><code>runhaskell</code> can run whatever Haskell interpreter you're using on your system—it does not necessarily have to be GHCi. For example, <code>runhaskell</code> could instead point to <code>runhugs</code> or <code>runjhc</code> or whatever, if appropriate.</p>
<p>Essentially, it's just a nice alias. By using ... |
16,557,071 | Git: error: RPC failed; result=22, HTTP code = 411 | <p><strong>Symptoms:</strong></p>
<p>Git suddenly refused to push a repository (to github in my case):</p>
<pre><code>$ git push
Counting objects: 9292, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2136/2136), done.
error: RPC failed; result=22, HTTP code = 411
fatal: The remote end hung ... | 16,557,072 | 1 | 1 | null | 2013-05-15 04:47:41.163 UTC | 28 | 2014-01-22 07:29:19.17 UTC | null | null | null | null | 166,484 | null | 1 | 68 | git|github|runtime-error | 28,319 | <p>Here is what helped, the following command increases git buffer to 500mb:</p>
<pre><code>git config http.postBuffer 524288000
</code></pre> |
16,296,622 | Rename column SQL Server 2008 | <p>I am using SQL Server 2008 and Navicat. I need to rename a column in a table using SQL.</p>
<pre><code>ALTER TABLE table_name RENAME COLUMN old_name to new_name;
</code></pre>
<p>This statement doesn't work.</p> | 16,296,669 | 11 | 2 | null | 2013-04-30 09:34:48.44 UTC | 104 | 2020-11-22 16:06:17.847 UTC | 2018-01-15 10:10:59.84 UTC | null | 133 | null | 1,303,193 | null | 1 | 763 | sql|sql-server|sql-server-2008|alter-table | 1,393,235 | <p>Use <code>sp_rename</code></p>
<pre><code>EXEC sp_RENAME 'TableName.OldColumnName' , 'NewColumnName', 'COLUMN'
</code></pre>
<p>See: <a href="http://blog.sqlauthority.com/2008/08/26/sql-server-how-to-rename-a-column-name-or-table-name/" rel="noreferrer">SQL SERVER – How to Rename a Column Name or Table Name</a></p... |
16,335,729 | how to convert image to matrix | <p>i am interested how to convert given image into matrix form with just numbers?for example let take following picture</p>
<p><img src="https://i.stack.imgur.com/8rbvI.jpg" alt="enter image description here"></p>
<p>as i know there exist in matlab special functions,which decompose given image into colors and nu... | 16,338,816 | 1 | 9 | null | 2013-05-02 10:28:14.863 UTC | 2 | 2020-08-23 20:49:11.527 UTC | 2013-05-02 11:01:07.757 UTC | null | 466,534 | null | 466,534 | null | 1 | -2 | matlab|image-processing|matrix | 44,646 | <p>Dato, when you use</p>
<pre><code>I = imread('test.jpg');
</code></pre>
<p>your image is already in an array form of numbers. Each "number" tells you part of the color information. </p>
<p>If the image file is in an indexed form you will get a NxM array (for an image of the size NxM).</p>
<p>If the image is not ... |
53,335,950 | Performance penalty of creating handlers on every render with react-hooks | <p>I'm currently very amazed about the use cases of the new react <a href="https://reactjs.org/docs/hooks-intro.html" rel="noreferrer">hooks</a> API and what you can possibly do with it.</p>
<p>A question that came up while experimenting was how expensive it is to always create a new handler function just to throw it ... | 53,336,060 | 5 | 10 | null | 2018-11-16 10:28:36.217 UTC | 3 | 2020-03-21 16:05:56.083 UTC | 2019-04-05 05:55:10.067 UTC | null | 5,928,186 | null | 5,005,177 | null | 1 | 36 | javascript|reactjs|arrow-functions|react-hooks | 7,747 | <p>The <strong><a href="https://reactjs.org/docs/hooks-faq.html#are-hooks-slow-because-of-creating-functions-in-render" rel="noreferrer">React FAQs</a></strong> provide an explanation to it </p>
<blockquote>
<p><strong>Are Hooks slow because of creating functions in render?</strong></p>
<p>No. In modern browser... |
41,932,635 | Scanning classpath/modulepath in runtime in Java 9 | <p>I can't seem to find any info on whether scanning all available classes (for interfaces, annotations etc) is still possible in runtime, the way Spring, Reflections and many other frameworks and libraries currently do, in the face of Jigsaw related changes to the way classes are loaded.</p>
<p><strong><em>EDIT</em><... | 45,612,376 | 2 | 6 | null | 2017-01-30 09:36:19.177 UTC | 12 | 2022-07-20 11:54:25.88 UTC | 2018-06-14 14:24:28.31 UTC | null | 294,657 | null | 294,657 | null | 1 | 24 | java|classpath|java-9|java-platform-module-system|java-module | 9,879 | <p>The following code achieves module path scanning in Java 9+ (Jigsaw / JPMS). It finds all classes on the callstack, then for each class reference, calls <code>classRef.getModule().getLayer().getConfiguration().modules()</code>, which returns a a <code>List<ResolvedModule></code>, rather than just a <code>List&... |
15,158,811 | Use of 1=2 in a SQL query | <p>Someone please explain the meaning of <strong><em>'1=2'</em></strong> in the below SQL query.</p>
<pre><code>SELECT E.EmpID,
E.EmpName,
Country = CASE
WHEN T.Active = 'N'
AND 1 = 2 THEN 'Not Working Anymore'
ELSE C.Country_Name
... | 15,158,931 | 10 | 7 | null | 2013-03-01 13:22:27.53 UTC | 2 | 2020-02-03 16:20:53.213 UTC | 2013-03-01 14:02:34.903 UTC | null | 73,226 | null | 609,736 | null | 1 | 7 | sql | 42,396 | <pre><code>when T.Active = 'N' and 1=2 then 'Not Working Anymore'
</code></pre>
<p>Simple, the above condition will never become <code>true</code>.
So the result will always be <code>C.Country_Name</code></p> |
24,727,428 | Eclipse Error: java.lang.CharSequence cannot be resolved | <p>I'm getting a error trying to compile a simple code in Eclipse. I'm using jre8.</p>
<p>For example, when I try to compile this code:</p>
<pre><code>import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class MyProject {
public static void main (String args[])
{
Li... | 28,989,940 | 2 | 6 | null | 2014-07-13 22:22:00.637 UTC | 4 | 2018-01-14 14:25:27.11 UTC | null | null | null | null | 3,513,453 | null | 1 | 10 | java|eclipse | 53,863 | <h1>Ensure that your Eclipse IDE supports Java 8:</h1>
<p>The first Eclipse version supporting Java 8 was Eclipse Kepler SR2 (4.3.2) with an additional patch. (See: <a href="https://waynebeaton.wordpress.com/2014/03/26/add-java-8-support-to-eclipse-kepler/" rel="nofollow noreferrer">Installing Java™ 8 Support in Eclip... |
12,005,993 | Java/Eclipse: How to configure Run Configuration's Classpath for JUnit test? | <p>I have an Eclipse project with the following directory structure:</p>
<pre><code>MyProj/
src/main/java/
com.me.myproject.widgets
Widget.java
src/main/config
widget-config.xml
src/test/java
com.me.myproject.widgets
WidgetTest.java
src/test/config
... | 12,006,195 | 2 | 0 | null | 2012-08-17 12:38:38.22 UTC | 5 | 2012-08-17 13:39:34.773 UTC | null | null | null | null | 892,029 | null | 1 | 3 | java|eclipse|junit|classpath | 59,052 | <p>I was under the impression that as long as you have <code>src/test/config/widget-test-config.xml</code> inside what Eclipse considers to be a source folder, it should already be on the classpath.</p>
<p>Is src/test a source folder for Eclipse ? If it is and you still get the problem, try out the following experimen... |
19,589,231 | Can I iterate through a NodeList using for-each in Java? | <p>I want to iterate through a <code>NodeList</code> using a for-each loop in Java. I have it working with a for loop and a do-while loop but not for-each.</p>
<pre><code>NodeList nList = dom.getElementsByTagName("year");
do {
Element ele = (Element) nList.item(i);
list.add(ele.getElementsByTagName("MonthId").... | 19,591,302 | 12 | 3 | null | 2013-10-25 11:58:24.017 UTC | 6 | 2022-08-28 13:16:19.95 UTC | 2018-01-08 16:19:06.95 UTC | null | 7,248,342 | null | 2,919,834 | null | 1 | 53 | java|xml|dom | 69,626 | <p>The workaround for this problem is straight-forward, and, thankfully you have to implements it only once.</p>
<pre><code>import java.util.*;
import org.w3c.dom.*;
public final class XmlUtil {
private XmlUtil(){}
public static List<Node> asList(NodeList n) {
return n.getLength()==0?
Collections... |
17,656,320 | Using Python in vimscript: How to export a value from a python script back to vim? | <p>I'm struggling with Python in vim.<br>
I still haven't found out how I can import a value from a python script (in a vim function) back to vim p.e.</p>
<pre><code>function! myvimscript()
python << endpython
import vim, random, sys
s = vim.eval("mylist")
# do operation with variable "s" in pytho... | 17,657,288 | 3 | 3 | null | 2013-07-15 14:11:31.803 UTC | 9 | 2019-12-12 05:53:37.583 UTC | 2015-02-15 17:04:44.43 UTC | null | 660,921 | null | 662,967 | null | 1 | 21 | python|variables|vim | 7,939 | <p>First of all, please define your function name starting with uppercase.</p>
<p>Here is an example for your two questions. I hope it helps:</p>
<pre><code>function! TestPy() range
let startline = line("'<")
let endline = line("'>")
echo "vim-start:".startline . " vim-endline:".endline
python <... |
17,364,951 | Remove all lines before a match with sed | <p>I'm using sed to filter a list of files. I have a sorted list of folders and I want to get all lines after a specific one. To do this task I'm using the solution described <a href="https://stackoverflow.com/a/5935779/518204">here</a> which works pretty well with any input I tried but it doesn't work when the match i... | 17,365,103 | 4 | 3 | null | 2013-06-28 12:40:11.303 UTC | 14 | 2021-01-16 15:14:14.237 UTC | 2021-01-16 09:29:50.52 UTC | null | 10,248,678 | null | 518,204 | null | 1 | 62 | sed | 59,057 | <p>try this (GNU sed only):</p>
<pre><code>sed '0,/^bin$/d'
</code></pre>
<p>..output is:</p>
<pre>
$sed '0,/^bin$/d' file
boot
...
sys
tmp
usr
var
vmlinuz
</pre> |
30,391,939 | Synchronization of data with video using WebRTC | <p>I'm using <code>WebRTC</code> to send video from a server to client browser (using the native <code>WebRTC API</code> and an <code>MCU WebRTC</code> server like Kurento).</p>
<p>Before sending it to clients each frame of the video contained metadata (like subtitles or any other applicative content). I'm looking for... | 35,572,224 | 2 | 4 | null | 2015-05-22 08:32:25.823 UTC | 9 | 2016-02-23 08:17:20.383 UTC | 2017-05-23 11:54:27.7 UTC | null | -1 | null | 2,463,642 | null | 1 | 22 | javascript|html|video|video-streaming|webrtc | 11,552 | <p>I suspect the amount of data per frame is fairly small. I would look at encoding it into a 2D barcode image and place it in each frame in a way so it is not removed by compression. Alternatively just encode timestamp like this. </p>
<p>Then on the player side you look at the image in a particular frame and get the ... |
36,916,093 | Convert ipynb to pdf in Jupyter | <p>I am new to ipython notebook, and I would like to convert my ipynb to pdf. But I get the following error when I try to Download as PDF via LaTex.</p>
<pre><code>nbconvert failed: pdflatex not found on PATH
</code></pre>
<p>There is no documentation anywhere how to add pdflatex to my PATH. I use windows. Thank you!... | 38,928,026 | 9 | 5 | null | 2016-04-28 13:24:55.04 UTC | 11 | 2022-03-06 13:13:38.14 UTC | 2016-04-29 13:41:42.827 UTC | null | 434,217 | null | 4,770,682 | null | 1 | 37 | jupyter|jupyter-notebook | 103,897 | <p>As said by <a href="https://stackoverflow.com/users/434217/thomas-k">Thomas K</a> in the comments, you need to have Latex installed, and after add the path to the directory containing <code>pdflatex.exe</code> file to the <code>PATH</code> variable of your system.</p>
<p>I have looked for a lightweight distribution... |
18,708,428 | How to do Authentication with Node.js and MEAN stack? | <p>I am currently working on a text based game with a small team of developers. The game requires login and we are using the MEAN (MongoDB, Express, Angular, Node) Stack for the application codebase, however i am stuck on authentication, as a rails developer i am used to being able to drop in a gem and use the helpers ... | 20,713,765 | 4 | 1 | null | 2013-09-09 23:08:39.837 UTC | 19 | 2018-02-16 19:43:54.94 UTC | 2014-08-07 19:17:58.333 UTC | null | 3,842,582 | user2693845 | null | null | 1 | 17 | node.js|mean-stack | 21,265 | <p>the MEAN stack by linnovate uses <a href="http://passportjs.org" rel="nofollow noreferrer">Passport.js</a> for its authentication. Passport uses different strategies for authentication. One of these strategies is a username and password pair, which they call <em>LocalStrategy</em>. </p>
<p>Here is one of the sample... |
25,932,730 | HashMap with Null Key and Null Value | <p>Consider the following Code :</p>
<pre><code>import java.util.*;
class Employee {
String name;
public Employee(String nm) {
this.name=nm;
}
}
public class HashMapKeyNullValue {
Employee e1;
public void display(){
Employee e2=null;
Map map=new HashMap... | 25,933,619 | 5 | 2 | null | 2014-09-19 11:19:02.903 UTC | 11 | 2022-03-21 18:21:18.683 UTC | 2022-03-21 18:21:18.683 UTC | null | 1,852,693 | null | 3,287,010 | null | 1 | 36 | java|collections|null|hashmap|hashcode | 130,227 | <p><strong><em><code>HashMap</code></em></strong> does not call hashcode when <em>null</em> is passed as key and null Key is handled as special case.</p>
<h2><strong>Put Method</strong></h2>
<p><strong><em><code>HashMap</code></em></strong> puts <em>null</em> key in bucket <em>0</em> and maps <em>null</em> as key to... |
18,377,268 | Checkbox value is always 'on' | <p>this is my checkbox</p>
<p><strong>HTML</strong></p>
<pre><code><label class="checkbox">
<input id="eu_want_team" name="eu_want_team" type="checkbox">
</label>
</code></pre>
<p><strong>JQuery</strong></p>
<pre><code>var eu_want_team = $('#eu_want_team').val();
alert(eu_want_team);
</code></... | 18,377,378 | 6 | 2 | null | 2013-08-22 09:59:25.197 UTC | 3 | 2013-08-22 10:24:50.237 UTC | 2013-08-22 10:10:08.393 UTC | null | 2,353,403 | user2705406 | null | null | 1 | 88 | javascript|jquery|html|dom|checkbox | 37,574 | <p>Use <code>.is(':checked')</code> instead: <strong><a href="http://jsfiddle.net/AB3eb/" rel="noreferrer">Working jsFiddle</a></strong></p>
<pre><code>var eu_want_team = $('#eu_want_team').is(':checked');
alert(eu_want_team);
</code></pre>
<p>or as @Itay said in comments you can use jQuery's <code>.prop()</code> to ... |
18,731,603 | How to tar certain file types in all subdirectories? | <p>I want to tar and all .php and .html files in a directory and its subdirectories. If I use </p>
<p><code>tar -cf my_archive *</code></p>
<p>it tars all the files, which I don't want. If I use </p>
<p><code>tar -cf my_archive *.php *.html</code></p>
<p>it ignores subdirectories. How can I make it tar recursively ... | 18,731,818 | 8 | 0 | null | 2013-09-11 02:11:12.873 UTC | 29 | 2022-07-02 19:22:31.45 UTC | 2013-09-11 02:30:48.083 UTC | null | 1,566,515 | null | 1,566,515 | null | 1 | 108 | linux|tar | 124,637 | <p><code>find ./someDir -name "*.php" -o -name "*.html" | tar -cf my_archive -T -</code></p> |
18,365,049 | Is there a way to make UITableView cells in iOS 7 not have a line break in the separator? | <p>I noticed that in iOS 7, UITableViewCells have a line break in the separator of the cell that iOS 6 does not have. Is there a way to get rid of this line break? Changing the separator to none and then making UIViews with the color of the separator still causes the white separator to occur regardless.</p> | 18,749,172 | 17 | 0 | null | 2013-08-21 18:29:58.59 UTC | 29 | 2015-11-21 21:09:38.39 UTC | null | null | null | null | 75,350 | null | 1 | 68 | uitableview|ios7 | 36,176 | <p><strong>For iOS7:</strong></p>
<pre><code>if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {
[self.tableView setSeparatorInset:UIEdgeInsetsZero];
}
</code></pre>
<p><strong>For iOS8:</strong></p>
<p>First configure your table view as follows:</p>
<pre><code>if ([self.tableView respondsT... |
18,392,741 | Apache2: 'AH01630: client denied by server configuration' | <p>I get this error when trying to access localhost via a browser.</p>
<pre><code>AH01630: client denied by server configuration
</code></pre>
<p>I checked my site folder permissions using:</p>
<pre><code>sudo chmod 777 -R *
</code></pre>
<p>Here is my configuration file:</p>
<pre><code><VirtualHost *:80>
Se... | 19,588,786 | 32 | 10 | null | 2013-08-23 00:13:34.773 UTC | 99 | 2022-09-16 17:18:36.853 UTC | 2015-11-10 22:42:27.61 UTC | null | 1,063,706 | null | 1,063,706 | null | 1 | 488 | server|apache2|apache2.4 | 786,076 | <p>If you are using Apache 2.4</p>
<p>You have to check allow and deny rules</p>
<p>Check out <a href="http://httpd.apache.org/docs/2.4/upgrading.html#access">http://httpd.apache.org/docs/2.4/upgrading.html#access</a></p>
<blockquote>
<p>In 2.2, access control based on client hostname, IP address, and other
char... |
15,430,016 | Non character argument in R string split function (strsplit) | <p>This works</p>
<pre><code>x <- "0.466:1.187:2.216:1.196"
y <- as.numeric(unlist(strsplit(x, ":")))
</code></pre>
<p>Values of <code>blat$LRwAvg</code> all look like <code>X</code> above but this doesn't work</p>
<pre><code>for (i in 1:50){
y <- as.numeric(unlist(strsplit(blat$LRwAvg[i], "\\:")))
blat... | 15,430,792 | 1 | 7 | null | 2013-03-15 10:31:04.147 UTC | 2 | 2019-10-29 12:10:12.107 UTC | 2013-03-15 10:37:58.087 UTC | null | 1,385,941 | null | 1,045,523 | null | 1 | 33 | string|r|for-loop|strsplit | 84,913 | <p>As agstudy implied <code>blat$LRwAvg <- as.character(blat$LRwAvg)</code> before loop fixed it</p>
<pre><code>blat$meanLRwAvg <- blat$gtFrqAvg #or some other variable in data frame with equal length
blat$LRwAvg <- as.character(blat$LRwAvg)
for (i in 1:50){
y <- as.numeric(unlist(strsplit(blat$LRwAvg[i]... |
15,267,034 | Is there an AddRange equivalent for a HashSet in C# | <p>With a list you can do:</p>
<pre><code>list.AddRange(otherCollection);
</code></pre>
<p>There is no add range method in a <code>HashSet</code>.
What is the best way to add another <code>ICollection</code> to a <code>HashSet</code>?</p> | 15,267,088 | 3 | 0 | null | 2013-03-07 09:09:33.76 UTC | 16 | 2021-06-23 18:53:55.397 UTC | 2020-08-13 18:19:42.73 UTC | null | 4,298,200 | null | 350,061 | null | 1 | 416 | c#|collections|hashset|addrange | 109,926 | <p>For <code>HashSet<T></code>, the name is <a href="http://msdn.microsoft.com/en-us/library/bb342097.aspx" rel="noreferrer"><code>UnionWith</code></a>.</p>
<p>This is to indicate the distinct way the <code>HashSet</code> works. You cannot safely <code>Add</code> a set of random elements to it like in <code>Coll... |
48,147,356 | Install Qt on Ubuntu | <p>Need to build simple GUI application. For this reason I decided to install Qt on my Ubuntu 16. I have downloaded open source Qt edition <a href="https://www.qt.io/download-qt-installer?hsCtaTracking=9f6a2170-a938-42df-a8e2-a9f0b1d6cdce%7C6cb0de4f-9bb5-4778-ab02-bfb62735f3e5" rel="noreferrer">from theirs site</a>. Go... | 48,147,619 | 4 | 4 | null | 2018-01-08 09:25:30.287 UTC | 26 | 2021-10-12 22:05:11.107 UTC | null | null | null | null | 1,501,700 | null | 1 | 67 | c++|linux|qt|ubuntu | 186,697 | <p>The ubuntu package name is <code>qt5-default</code>, not <code>qt</code>.</p> |
9,181,782 | Why are the terms "automatic" and "dynamic" preferred over the terms "stack" and "heap" in C++ memory management? | <p>Related to a lot of questions and answers on SO, I've learned that it's better to refer to objects whose lifetime is managed as residing in automatic storage rather than the stack. </p>
<p>Also, dynamically allocated objects shouldn't be referred to as residing on the heap, but in dynamic storage.</p>
<p>I get tha... | 9,182,244 | 6 | 6 | null | 2012-02-07 18:31:51.183 UTC | 12 | 2021-07-02 21:28:53.78 UTC | 2021-07-02 21:28:53.78 UTC | null | 5,459,839 | null | 673,730 | null | 1 | 46 | c++|heap-memory|stack-memory|automatic-storage | 10,572 | <p><strong>Automatic</strong> tells me something about the lifetime of an object: specifically that it is bound <em>automatically</em> to the enclosing scope, and will be destroyed <em>automatically</em> when that scope exits.</p>
<p><strong>Dynamic</strong> tells me that the lifetime of an object is not controlled <e... |
9,611,061 | How to support both iPad and iPhone retina graphics in universal apps | <p>Apple presented new iPad that support retina graphics.</p>
<p>I saw <a href="http://9to5mac.com/2011/06/14/ios-5-sdk-includes-retina-display-graphics-for-next-generation-ipad/" rel="noreferrer">this link retina graphic in apple apps</a>. As you can see apple just use "@2x" suffix for retina iPad display.</p>
<p>I ... | 9,611,572 | 2 | 10 | null | 2012-03-07 23:59:27.247 UTC | 60 | 2016-07-29 12:03:37.83 UTC | 2012-03-08 00:17:34.96 UTC | user166390 | null | null | 558,824 | null | 1 | 71 | iphone|ios|ipad|retina-display | 46,239 | <p>I just created a test app and tested.<br/></p>
<p><strong>So for devices without retina:</strong><br/>
<code>ImageName.png</code> - For iPhone/iPod<br/>
<code>ImageName~ipad.png</code> -- For iPad<br/></p>
<p><strong>For devices with retina display:</strong><br/>
<code>ImageName@2x.png</code> - For iPhone/iPod<br/... |
67,065,119 | Why don't instance fields need to be final or effectively final to be used in lambda expressions? | <p>I'm practicing lambda expressions in Java. I know local variables need to be final or effectively final according to the Oracle documentation for Java SE 16 <a href="https://docs.oracle.com/javase/specs/jls/se16/html/jls-15.html#jls-15.27.2" rel="noreferrer">Lambda Body </a>:</p>
<blockquote>
<p>Any local variable, ... | 67,065,633 | 3 | 3 | null | 2021-04-12 20:15:12.577 UTC | 9 | 2021-04-13 12:07:24.27 UTC | 2021-04-13 04:43:16.12 UTC | null | 1,746,118 | null | 15,596,616 | null | 1 | 30 | java|lambda|instance-variables|local-variables | 3,119 | <p>Instance variables are stored in the heap space whereas local variables are stored in the stack space. Each thread maintains its own stack and hence the local variables are not shared across the threads. On the other hand, the heap space is shared by all threads and therefore, multiple threads can modify an instance... |
5,436,951 | Rails 3: validates :presence => true vs validates_presence_of | <p>What is the difference between <code>validates :presence</code> and <code>validates_presence_of</code>? Looking through <code>ActiveModel</code> it looks like they setup the validation the same way. However, given the following model definition:</p>
<pre><code>class Account < ActiveRecord::Base
has_one :owner_... | 5,436,994 | 4 | 0 | null | 2011-03-25 19:04:09.137 UTC | 4 | 2018-02-08 19:28:31.313 UTC | 2018-02-08 19:28:31.313 UTC | null | 2,252,927 | null | 633,219 | null | 1 | 31 | ruby-on-rails-3 | 21,932 | <p>All those <code>validates_whatever_of :attr</code> macros do is call <code>validates :attr, :whatever => true</code>. </p>
<p><strong>The problem is you are using <a href="http://api.rubyonrails.org/classes/ActiveModel/Validations/ClassMethods.html#method-i-validate" rel="noreferrer"><code>validate</code></a> an... |
5,126,892 | In TSQL, how to evaluate an expression and assign it to a BIT field? | <p>I'm struggling on something very simple. I'm trying to assign the results of a boolean expression to a <code>BIT</code> variable.</p>
<p>Basically I would like to do something like: </p>
<pre><code>DECLARE @is_search_term_empty BIT
SET @is_search_term_empty = (@search_term = '')
</code></pre>
<p>where <code>@se... | 5,126,909 | 4 | 0 | null | 2011-02-26 12:27:12.903 UTC | 0 | 2017-07-03 20:55:18.637 UTC | null | null | null | null | 144,607 | null | 1 | 37 | sql|tsql|sql-server-2008 | 15,768 | <p>You can do this with a <code>CASE</code> statement:</p>
<pre><code>DECLARE @bitvar BIT
DECLARE @search_term varchar(128)
set @search_term = 'abc'
SET @bitvar = CASE
WHEN (@search_term = 'abc') THEN 1
ELSE 0
END
select @bitvar
</code></pre> |
5,153,986 | CSS selector to select an id with a slash in the id name? | <p>I've got <code><span id="/about-us"></code> being generated by this CMS I'm using. </p>
<p>I'd like to select this element with jQuery but it doesn't seem to like selecting elements with a slash in them.</p>
<p>Is this possible?</p> | 5,154,155 | 5 | 4 | null | 2011-03-01 11:38:59.713 UTC | 7 | 2019-07-01 17:26:15.283 UTC | 2014-05-21 01:20:55.723 UTC | null | 775,283 | null | 15,441 | null | 1 | 43 | jquery|jquery-selectors | 25,988 | <p>you can do </p>
<pre><code>$("#\\/about-us")
</code></pre>
<p> </p> |
5,549,781 | Generate Upper and Lowercase Alphanumeric Random String in Oracle | <p>How does one generate an upper and lowercase alphanumeric random string from oracle?</p>
<p>I have used <code>select DBMS_RANDOM.STRING('x', 10) from dual</code> to generate uppercase alphanumeric characters</p>
<p>and <code>select DBMS_RANDOM.STRING('a', 10) from dual</code> to generate uppercase and lowercase al... | 5,550,448 | 6 | 0 | null | 2011-04-05 09:25:23.003 UTC | 5 | 2013-11-10 19:00:41.367 UTC | null | null | null | null | 110,545 | null | 1 | 15 | oracle | 39,647 | <p>You can make your own function. This is one option:</p>
<pre><code>create or replace function random_str(v_length number) return varchar2 is
my_str varchar2(4000);
begin
for i in 1..v_length loop
my_str := my_str || dbms_random.string(
case when dbms_random.value(0, 1) < 0.5 then 'l' ... |
5,522,337 | C# Picturebox transparent background doesn't seem to work | <p>For a project of mine I need images to display with a transparent background. I made some .png images that have a transparent background(to check this I opened them in Photoshop). Now I have a class that extends PictureBox:</p>
<pre><code>class Foo : PictureBox
{
public Foo(int argument)
: base()
{
... | 5,523,359 | 6 | 6 | null | 2011-04-02 09:24:02.307 UTC | 5 | 2016-09-04 18:41:57.77 UTC | null | null | null | null | 618,702 | null | 1 | 23 | c#|transparency|picturebox | 102,228 | <p>It probably works perfectly. You are seeing what's behind the picture box control. Which is the form. Whose BackColor is probably white. You can set the form's BackgroundImage property to be sure, you should see the image through the picture box. Like this:</p>
<p><img src="https://i.stack.imgur.com/ZpjtL.png"... |
4,954,140 | How to redirect qDebug, qWarning, qCritical etc output? | <p>I'm using a lot of <code>qDebug() <<</code> statements for debug output. Is there any cross-platform way I can redirect that debug output to a file, without resorting to shell scripts? I'm guessing that <a href="http://opennet.ru/man.shtml?topic=open&category=2&russian=0" rel="noreferrer">open()</a> an... | 4,954,188 | 6 | 0 | null | 2011-02-10 06:42:29.95 UTC | 35 | 2022-01-14 12:37:10.347 UTC | 2011-03-16 06:42:52.703 UTC | null | 415,784 | null | 521,032 | null | 1 | 97 | c++|debugging|qt|mingw|qdebug | 87,037 | <p>You've to install a message handler using <code>qInstallMsgHandler</code> function, and then, you can use <code>QTextStream</code> to write the <em>debug</em> message to a file. Here is a sample example:</p>
<pre><code>#include <QtGlobal>
#include <stdio.h>
#include <stdlib.h>
void myMessageOutpu... |
4,851,234 | Difference between int* and int[] in C++ | <p>Context: C++
Consider the example below</p>
<pre><code>class TestClass
{
private:
int A[];
int *B;
public:
TestClass();
};
TestClass::TestClass()
{
A = 0; // Fails due to error: incompatible types in assignment of `int' to `int[0u]'
B = 0; // Passes
}
</code></pre>
<p>A = 0 fails but B = 0 su... | 4,851,326 | 7 | 5 | null | 2011-01-31 13:12:46.51 UTC | 3 | 2016-08-24 07:27:13.45 UTC | null | null | null | null | 197,928 | null | 1 | 11 | c++ | 51,133 | <p>The only difference between them is that <code>int A[]</code> <em>in a class</em> would not compile, and should not compile!</p>
<h1>Comeau C++ compiler gives this error:</h1>
<blockquote>
<pre>"ComeauTest.c", line 4: error:
incomplete type is not allowed
int A[];
^ </pre>
</blockquote>
<p><a h... |
5,523,135 | .htaccess produces 500 Internal Server Error | <p>The content of .htaccess is:</p>
<pre><code>php_value upload_max_filesize 64M
</code></pre>
<p>Works on localhost, screws up every hosting server I upload it to.
The error.log says: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration</p>
<p>Is there anot... | 5,686,596 | 7 | 7 | null | 2011-04-02 12:29:30.053 UTC | 1 | 2022-03-10 04:33:13.477 UTC | 2011-04-02 12:36:41.743 UTC | null | 493,991 | null | 493,991 | null | 1 | 20 | apache | 49,861 | <p>The problem was the hosting provider, they only allow changing this via php.ini</p> |
4,852,767 | How can I check if a file exists on a remote server using PHP? | <p>How can I check if a specific file exists on a remote server using PHP via FTP connections?</p> | 9,568,577 | 7 | 0 | null | 2011-01-31 15:43:41.097 UTC | 10 | 2022-02-11 23:10:44.553 UTC | 2011-01-31 15:50:53.403 UTC | null | 218,196 | null | 498,504 | null | 1 | 33 | php | 54,974 | <p>I used this, a bit easier:</p>
<pre><code>// the server you wish to connect to - you can also use the server ip ex. 107.23.17.20
$ftp_server = "ftp.example.com";
// set up a connection to the server we chose or die and show an error
$conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $f... |
5,346,926 | How to specify database name in Code First? | <p>How do I tell EF what to name the database and where to put it?</p>
<p>If there is no connection string in the Web.Config, it tries to put it in the local SQLEXPRESS Server, but I want to put it out on a known SQL Server and name it what I want. Any suggestions?</p> | 5,346,966 | 8 | 1 | null | 2011-03-18 00:52:01.913 UTC | 12 | 2022-01-17 23:08:27.883 UTC | 2014-05-12 19:33:21.6 UTC | null | 2,864,740 | null | 587,920 | null | 1 | 60 | entity-framework-4|ef-code-first | 52,846 | <p>Create a connection string in the app.config/web.config with the same name as the context and the EF will use that DB.</p> |
5,461,468 | How to debug Spring MVC url mapping? | <p>I am using Spring MVC 3 and am having an issue with a URL mapping. I have a method</p>
<pre><code> @Controller
public class DocumentController {
@RequestMapping( value="/docs/pupil/classes/{courseCategoryType}", method=RequestMethod.GET )
public ModelAndView listClassesForPupil( @PathVariable("courseCa... | 42,279,116 | 11 | 2 | null | 2011-03-28 15:39:50.023 UTC | 13 | 2020-11-26 07:08:58.373 UTC | 2013-01-16 21:39:15.957 UTC | null | 254,477 | null | 254,477 | null | 1 | 42 | java|spring|spring-mvc | 61,745 | <p>For problems like this I feel like the best "entrypoint" to start debugging is the method <code>getHandler(HttpServletRequest request)</code> of the <code>DispatcherServlet</code>. </p>
<p>Inside this method every configured <code>HandlerMapping</code> is inspected if it responsible for handling your specific reque... |
5,034,580 | Comparing chars in Java | <p>I want to check a char variable is one of 21 specific chars, what is the shortest way I can do this?</p>
<p>For example:</p>
<pre><code>if(symbol == ('A'|'B'|'C')){}
</code></pre>
<p>Doesn't seem to be working. Do I need to write it like:</p>
<pre><code>if(symbol == 'A' || symbol == 'B' etc.)
</code></pre> | 5,034,600 | 13 | 1 | null | 2011-02-17 20:59:15.373 UTC | 20 | 2021-12-28 21:08:42.673 UTC | 2019-08-19 08:09:32.577 UTC | null | 313,528 | null | 313,528 | null | 1 | 73 | java|comparison|char | 551,520 | <p>If your input is a character and the characters you are checking against are mostly consecutive you could try this:</p>
<pre><code>if ((symbol >= 'A' && symbol <= 'Z') || symbol == '?') {
// ...
}
</code></pre>
<hr>
<p>However if your input is a string a more compact approach (but slower) is to ... |
5,542,680 | How to get a UITableview to go to the top of page on reload? | <p>I am trying to get a UITableview to go to the top of the page when I reload the table data when I call the following from </p>
<pre><code>- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
// A bunch of code...
[TableView reloadData];
}
</code></pr... | 5,544,007 | 14 | 0 | null | 2011-04-04 18:30:03.797 UTC | 10 | 2022-03-04 10:49:03.183 UTC | 2020-02-02 10:43:32.697 UTC | null | 1,265,393 | null | 688,315 | null | 1 | 39 | iphone|cocoa-touch|tableview | 31,182 | <p>Here's another way you could do it:</p>
<p><strong>Objective-C</strong></p>
<pre><code>[tableView setContentOffset:CGPointZero animated:YES];
</code></pre>
<p><strong>Swift 3 and higher</strong></p>
<pre><code>tableView.setContentOffset(.zero, animated: true)
</code></pre>
<p>Probably the easiest and most strai... |
5,269,713 | css ellipsis on second line | <p>CSS <code>text-overflow: ellipsis</code> on second line, is this possible? I can't find it on the net.</p>
<p>example:</p>
<p>what I want is like this:</p>
<pre><code>I hope someone could help me. I need
an ellipsis on the second line of...
</code></pre>
<p>but what's happening is this:</p>
<pre><code>I hope s... | 7,680,712 | 21 | 4 | null | 2011-03-11 06:30:55.613 UTC | 66 | 2021-12-14 15:28:16.66 UTC | 2015-12-18 01:29:46.74 UTC | null | 251,986 | null | 251,986 | null | 1 | 317 | html|css | 361,007 | <p>A requirement for <code>text-overflow: ellipsis;</code> to work is a one-line version of <code>white-space</code> (<code>pre</code>, <code>nowrap</code> etc). Which means the text will never reach the second line.</p>
<p>Ergo. Not possible in pure CSS.</p>
<p>My source when I was looking for the exact same thing j... |
12,142,350 | CMD: How do I recursively remove the "Hidden"-Attribute of files and directories | <p>I can't find a command or simple batch of commands to recursively remove the "Hidden"-Attribute from files and directories. All commands like "attrib" and "for" seem to skip hidden files. E.g.:</p>
<pre><code>attrib -H /S /D /L mydir
</code></pre>
<p>doesn't do anything at all, because it skips all hidden stuff. D... | 12,150,188 | 7 | 0 | null | 2012-08-27 12:51:00.107 UTC | 8 | 2017-12-19 07:52:00.113 UTC | 2017-01-15 18:31:22.657 UTC | null | 3,826,372 | null | 434,268 | null | 1 | 20 | windows|batch-file|cmd | 175,131 | <p>Move the -h and specify that mydir is a directory</p>
<pre><code>attrib /S /D /L -H mydir\*.*
</code></pre> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.